pretty much redid the variable idea (now slot)

This commit is contained in:
Torsten Ruger
2014-08-20 17:14:52 +03:00
parent ba71e568ef
commit 1371d395ec
11 changed files with 111 additions and 129 deletions

View File

@ -5,7 +5,9 @@ module Ast
class IntegerExpression < Expression
# attr_reader :value
def compile method , message
Virtual::IntegerConstant.new value
to = Virtual::Return.new(Integer)
method.add_code Virtual::Set.new( to , Virtual::IntegerConstant.new(value))
to
end
end
@ -34,10 +36,11 @@ module Ast
# otherwise it's a method without args and a send is ussued.
# this makes the namespace static, ie when eval and co are implemented method needs recompilation
def compile method , message
return Virtual::Self.new( Virtual::Mystery.new ) if name == :self
return Virtual::Self.new( Virtual::Mystery ) if name == :self
if method.has_var(name)
message.compile_get(method , name )
else
raise "Unimplemented"
message.compile_send( method , name , Virtual::Self.new( Virtual::Mystery.new ) )
end
end