1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Compile static common attributes statically

This commit is contained in:
Takashi Kokubun 2015-11-14 02:58:39 +09:00
parent 2c23f95fbe
commit ec2aecb4bd

View file

@ -128,11 +128,16 @@ module Hamlit
end
def compile_common!(temple, key, static_value, dynamic_values)
value = build_attr(:static, key, static_value) if static_value
type, value = :static, static_value if static_value
dynamic_values.each do |dynamic_value|
value = build_attr(:dynamic, key, dynamic_value)
type, value = :dynamic, dynamic_value
end
temple << value
if type == :dynamic && StaticAnalyzer.static?(value)
type, value = :static, eval("(#{value}).to_s")
end
temple << build_attr(type, key, value)
end
def build_attr(type, key, value)