method stores constants

This commit is contained in:
Torsten Ruger 2015-06-01 08:33:51 +03:00
parent f08d9659fc
commit 66f5dcf152
2 changed files with 3 additions and 1 deletions

View File

@ -50,8 +50,9 @@ module Virtual
@blocks = [enter]
@current = enter
new_block("return").add_code(MethodReturn.new)
@constants = []
end
attr_reader :blocks
attr_reader :blocks , :constants
attr_accessor :return_type , :current , :receiver
# add an instruction after the current (insertion point)

View File

@ -73,6 +73,7 @@ module Virtual
def self.compile_string expression , method
value = expression.string.to_sym
to = Return.new(Reference , value)
method.info.constants << value
method.info.add_code Set.new( to , value )
to
end