rubyx/lib/bosl/compiler/operator_expressions.rb

19 lines
470 B
Ruby
Raw Normal View History

module Bosl
Compiler.class_eval do
# operator attr_reader :operator, :left, :right
def on_operator expression
2015-09-19 17:57:44 +03:00
operator , left , right = *expression
2015-09-23 18:35:37 +03:00
Virtual::Return.new(:int)
end
def on_assign expression
name , value = *expression
name = name.to_a.first
2015-09-20 16:52:26 +03:00
v = process(value)
index = method.ensure_local( name )
2015-09-23 18:35:37 +03:00
method.source.add_code Virtual::Set.new(Virtual::FrameSlot.new(:int,index ) , v )
end
end
end