first ginger parfait test

This commit is contained in:
Torsten Ruger 2014-08-06 18:49:20 +03:00
parent 9a197ff7c1
commit b9e259e11a
2 changed files with 18 additions and 1 deletions

View File

@ -19,6 +19,20 @@ module Ast
end
class ClassExpression < ModuleExpression
def compile method , message
clazz = ::Virtual::Object.space.get_or_create_class name
puts "Created class #{clazz.name.inspect}"
# context.current_class = clazz
expressions.each do |expression|
# 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}"
expression_value = expression.compile(method,message )
#puts "compiled expression #{expression_value.inspect}"
end
return clazz
end
end
end

View File

@ -6,9 +6,12 @@ class TestMethods < MiniTest::Test
def test_object
@string_input = <<HERE
class Object
def get_class()
@layout.get_class()
end
end
HERE
@output = "---RETURN_MARKER- !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :fooRETURN_MARKER args:RETURN_MARKER - !ruby/object:Virtual::ArgumentRETURN_MARKER name: :xRETURN_MARKER type: !ruby/object:Virtual::Mystery {}RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: !ruby/object:Virtual::SelfReferenceRETURN_MARKER clazz: RETURN_MARKER return_type: !ruby/object:Virtual::IntegerConstantRETURN_MARKER integer: 5RETURN_MARKER start: &1 !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: *1RETURN_MARKER"
@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"
check
end