move that test to core (cant be done in compiled code) and focus on string addition instead
This commit is contained in:
@ -26,7 +26,8 @@ module Ast
|
||||
locals[arg] = arg_value
|
||||
args << arg_value
|
||||
end
|
||||
function = Vm::Function.new(name , args )
|
||||
class_name = context.current_class.name
|
||||
function = Vm::Function.new("#{class_name}::#{name}" , args )
|
||||
context.current_class.add_function function
|
||||
|
||||
parent_locals = context.locals
|
||||
|
@ -20,7 +20,7 @@ module Ast
|
||||
|
||||
return_reg = Vm::Integer.new(7)
|
||||
if expression_value.is_a?(Vm::IntegerConstant) or expression_value.is_a?(Vm::StringConstant)
|
||||
return_reg.load into , expression_value if expression_value.register != return_reg.register
|
||||
return_reg.load into , expression_value
|
||||
else
|
||||
return_reg.move( into, expression_value ) if expression_value.register != return_reg.register
|
||||
end
|
||||
|
23
lib/core/base_object.rb
Normal file
23
lib/core/base_object.rb
Normal file
@ -0,0 +1,23 @@
|
||||
module Core
|
||||
class BaseObject
|
||||
|
||||
def _set_instance_variable(name , value)
|
||||
return name
|
||||
end
|
||||
|
||||
def _get_instance_variable( name )
|
||||
return name
|
||||
end
|
||||
|
||||
def _get_singleton_method(name )
|
||||
return name
|
||||
end
|
||||
def _add_singleton_method(method)
|
||||
return 4
|
||||
end
|
||||
def initialize()
|
||||
return 4
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -29,7 +29,7 @@ module Vm
|
||||
|
||||
def initialize(name , args = [] , return_type = nil)
|
||||
super()
|
||||
@name = name
|
||||
@name = name.to_sym
|
||||
@args = Array.new(args.length)
|
||||
args.each_with_index do |arg , i|
|
||||
if arg.is_a?(Value)
|
||||
|
Reference in New Issue
Block a user