Class: NScript::PushNode

Inherits:
Object
  • Object
show all
Defined in:
lib/nscript/parser/nodes.rb

Class Method Summary collapse

Class Method Details

.wrap(array, expressions) ⇒ Object



672
673
674
675
676
677
678
679
# File 'lib/nscript/parser/nodes.rb', line 672

def self.wrap(array, expressions)
  expr = expressions.unwrap
  return expressions if expr.statement_only? || expr.contains? {|n| n.statement_only? }
  Expressions.wrap(CallNode.new(
    ValueNode.new(LiteralNode.new(array), [AccessorNode.new(Value.new('push'))]),
    [expr]
  ))
end