Method: StyleScript::RangeNode#compile_array

Defined in:
lib/style_script/nodes.rb

#compile_array(o) ⇒ Object

Expand the range into the equivalent array, if it’s not being used as part of a comprehension, slice, or splice. TODO: This generates pretty ugly code … shrink it.



478
479
480
481
482
# File 'lib/style_script/nodes.rb', line 478

def compile_array(o)
  body = Expressions.wrap(LiteralNode.wrap('i'))
  arr  = Expressions.wrap(ForNode.new(body, {:source => ValueNode.new(self)}, Value.new('i')))
  ParentheticalNode.new(CallNode.new(CodeNode.new([], arr))).compile(o)
end