forgot to add compiled methods to the class, fixed

This commit is contained in:
Torsten Ruger 2014-08-07 15:37:32 +03:00
parent b9e259e11a
commit a9ab3ca13e
3 changed files with 4 additions and 3 deletions

View File

@ -27,8 +27,9 @@ module Ast
# check if it's a function definition and add
# if not, execute it, but that does means we should be in salama (executable), not ruby. ie throw an error for now
raise "only functions for now #{expression.inspect}" unless expression.is_a? Ast::FunctionExpression
puts "compiling expression #{expression}"
#puts "compiling expression #{expression}"
expression_value = expression.compile(method,message )
clazz.add_method_definition(expression_value)
#puts "compiled expression #{expression_value.inspect}"
end

View File

@ -17,7 +17,7 @@ module Boot
[:name , :super_class]
end
def add_method_definition method
raise "not a method #{method}" unless method.is_a? Virtual::MethodDefinition
raise "not a method #{method.class} #{method.inspect}" unless method.is_a? Virtual::MethodDefinition
raise "syserr " unless method.name.is_a? Symbol
@method_definitions << method
end

View File

@ -11,7 +11,7 @@ class Object
end
end
HERE
@output = "---RETURN_MARKER- &11 !ruby/object:Boot::BootClassRETURN_MARKER method_definitions:RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :index_ofRETURN_MARKER args: &1 !ruby/class 'Virtual::Reference'RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver:RETURN_MARKER - *1RETURN_MARKER return_type: &7 !ruby/class 'Virtual::Integer'RETURN_MARKER start: &2 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *2RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :_get_instance_variableRETURN_MARKER args:RETURN_MARKER - *1RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *1RETURN_MARKER return_type: &4 !ruby/class 'Virtual::Mystery'RETURN_MARKER start: &3 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *3RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :_set_instance_variableRETURN_MARKER args:RETURN_MARKER - *1RETURN_MARKER - *1RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *1RETURN_MARKER return_type: *4RETURN_MARKER start: &5 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *5RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :putstringRETURN_MARKER args: []RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: !ruby/object:Virtual::SelfReferenceRETURN_MARKER clazz: RETURN_MARKER return_type: *4RETURN_MARKER start: &6 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *6RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :putintRETURN_MARKER args: []RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *7RETURN_MARKER return_type: *7RETURN_MARKER start: &8 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *8RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :fiboRETURN_MARKER args: []RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *7RETURN_MARKER return_type: *7RETURN_MARKER start: &9 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *9RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :exitRETURN_MARKER args: []RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *7RETURN_MARKER return_type: *4RETURN_MARKER start: &10 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *10RETURN_MARKER name: :ObjectRETURN_MARKER super_class_name: :ObjectRETURN_MARKER meta_class: !ruby/object:Boot::MetaClassRETURN_MARKER layout: !ruby/object:Virtual::LayoutRETURN_MARKER members: []RETURN_MARKER functions: []RETURN_MARKER me_self: *11RETURN_MARKER"
@output = "---RETURN_MARKER- &12 !ruby/object:Boot::BootClassRETURN_MARKER method_definitions:RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :index_ofRETURN_MARKER args: &1 !ruby/class 'Virtual::Reference'RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver:RETURN_MARKER - *1RETURN_MARKER return_type: &7 !ruby/class 'Virtual::Integer'RETURN_MARKER start: &2 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *2RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :_get_instance_variableRETURN_MARKER args:RETURN_MARKER - *1RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *1RETURN_MARKER return_type: &4 !ruby/class 'Virtual::Mystery'RETURN_MARKER start: &3 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *3RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :_set_instance_variableRETURN_MARKER args:RETURN_MARKER - *1RETURN_MARKER - *1RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *1RETURN_MARKER return_type: *4RETURN_MARKER start: &5 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *5RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :putstringRETURN_MARKER args: []RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: !ruby/object:Virtual::SelfReferenceRETURN_MARKER clazz: RETURN_MARKER return_type: *4RETURN_MARKER start: &6 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *6RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :putintRETURN_MARKER args: []RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *7RETURN_MARKER return_type: *7RETURN_MARKER start: &8 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *8RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :fiboRETURN_MARKER args: []RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *7RETURN_MARKER return_type: *7RETURN_MARKER start: &9 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *9RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :exitRETURN_MARKER args: []RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *7RETURN_MARKER return_type: *4RETURN_MARKER start: &10 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *10RETURN_MARKER - !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :get_classRETURN_MARKER args: []RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: !ruby/object:Virtual::SelfReferenceRETURN_MARKER clazz: RETURN_MARKER return_type: !ruby/object:Virtual::ReturnRETURN_MARKER name: :returnRETURN_MARKER type: *4RETURN_MARKER start: !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::ObjectGetRETURN_MARKER name: :layoutRETURN_MARKER next: !ruby/object:Virtual::LoadSelfRETURN_MARKER value: !ruby/object:Virtual::ReturnRETURN_MARKER name: :returnRETURN_MARKER type: !ruby/object:Virtual::Mystery {}RETURN_MARKER next: &11 !ruby/object:Virtual::MessageSendRETURN_MARKER name: :get_classRETURN_MARKER args: []RETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *11RETURN_MARKER name: :ObjectRETURN_MARKER super_class_name: :ObjectRETURN_MARKER meta_class: !ruby/object:Boot::MetaClassRETURN_MARKER layout: !ruby/object:Virtual::LayoutRETURN_MARKER members: []RETURN_MARKER functions: []RETURN_MARKER me_self: *12RETURN_MARKER"
check
end