diff --git a/lib/ast/basic_expressions.rb b/lib/ast/basic_expressions.rb index d3146369..2210d191 100644 --- a/lib/ast/basic_expressions.rb +++ b/lib/ast/basic_expressions.rb @@ -45,11 +45,10 @@ module Ast class ModuleName < NameExpression def compile frame , method - clazz = context.object_space.get_or_create_class name + clazz = ::Virtual::Object.space.get_or_create_class name raise "uups #{clazz}.#{name}" unless clazz #class qualifier, means call from metaclass clazz = clazz.meta_class - puts "CLAZZ #{clazz}" clazz end end diff --git a/lib/boot/meta_class.rb b/lib/boot/meta_class.rb index 3931d7ab..a7ddb381 100644 --- a/lib/boot/meta_class.rb +++ b/lib/boot/meta_class.rb @@ -8,7 +8,7 @@ module Boot # PS: can't say i fancy the << self syntax and am considerernig adding a keyword for it, like meta # In effect it is a very similar construct to def self.function(...) # So one could write def meta.function(...) and thus define on the meta-class - class MetaClass < Virtual::ObjectConstant + class MetaClass < Virtual::Object # no name, nor nothing. as this is just the object really def initialize(object) @@ -16,7 +16,11 @@ module Boot @functions = [] @me_self = object end - + + def attributes + [] + end + # in a non-booting version this should map to _add_singleton_method def add_function function raise "not a function #{function}" unless function.is_a? Virtual::Function @@ -46,10 +50,10 @@ module Boot end def inspect - "MetaClass on #{@me_self}, #{@functions.length} functions" + "MetaClass.new(:#{@me_self.name})" end def to_s - inspect + "#{inspect} on #{@me_self}, #{@functions.length} functions" end end end diff --git a/test/virtual/test_basic.rb b/test/virtual/test_basic.rb index 79480214..7e007444 100644 --- a/test/virtual/test_basic.rb +++ b/test/virtual/test_basic.rb @@ -41,8 +41,7 @@ class TestBasic < MiniTest::Test def test_module_name @string_input = 'FooBar ' - @parse_output = {:module_name=>"FooBar"} - @output = Ast::ModuleName.new("FooBar") + @output = [Boot::MetaClass.new(:FooBar)] check end