method stores constants
This commit is contained in:
parent
f08d9659fc
commit
66f5dcf152
@ -50,8 +50,9 @@ module Virtual
|
|||||||
@blocks = [enter]
|
@blocks = [enter]
|
||||||
@current = enter
|
@current = enter
|
||||||
new_block("return").add_code(MethodReturn.new)
|
new_block("return").add_code(MethodReturn.new)
|
||||||
|
@constants = []
|
||||||
end
|
end
|
||||||
attr_reader :blocks
|
attr_reader :blocks , :constants
|
||||||
attr_accessor :return_type , :current , :receiver
|
attr_accessor :return_type , :current , :receiver
|
||||||
|
|
||||||
# add an instruction after the current (insertion point)
|
# add an instruction after the current (insertion point)
|
||||||
|
@ -73,6 +73,7 @@ module Virtual
|
|||||||
def self.compile_string expression , method
|
def self.compile_string expression , method
|
||||||
value = expression.string.to_sym
|
value = expression.string.to_sym
|
||||||
to = Return.new(Reference , value)
|
to = Return.new(Reference , value)
|
||||||
|
method.info.constants << value
|
||||||
method.info.add_code Set.new( to , value )
|
method.info.add_code Set.new( to , value )
|
||||||
to
|
to
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user