Compile static common attributes statically

This commit is contained in:
Takashi Kokubun 2015-11-14 02:58:39 +09:00
parent 2c23f95fbe
commit ec2aecb4bd
1 changed files with 8 additions and 3 deletions

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)