one more basic test back online

This commit is contained in:
Torsten Ruger 2014-07-13 14:12:43 +03:00
parent dc6cb2bb52
commit ae21863245
3 changed files with 10 additions and 8 deletions

View File

@ -45,11 +45,10 @@ module Ast
class ModuleName < NameExpression class ModuleName < NameExpression
def compile frame , method 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 raise "uups #{clazz}.#{name}" unless clazz
#class qualifier, means call from metaclass #class qualifier, means call from metaclass
clazz = clazz.meta_class clazz = clazz.meta_class
puts "CLAZZ #{clazz}"
clazz clazz
end end
end end

View File

@ -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 # 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(...) # 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 # 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 # no name, nor nothing. as this is just the object really
def initialize(object) def initialize(object)
@ -16,7 +16,11 @@ module Boot
@functions = [] @functions = []
@me_self = object @me_self = object
end end
def attributes
[]
end
# in a non-booting version this should map to _add_singleton_method # in a non-booting version this should map to _add_singleton_method
def add_function function def add_function function
raise "not a function #{function}" unless function.is_a? Virtual::Function raise "not a function #{function}" unless function.is_a? Virtual::Function
@ -46,10 +50,10 @@ module Boot
end end
def inspect def inspect
"MetaClass on #{@me_self}, #{@functions.length} functions" "MetaClass.new(:#{@me_self.name})"
end end
def to_s def to_s
inspect "#{inspect} on #{@me_self}, #{@functions.length} functions"
end end
end end
end end

View File

@ -41,8 +41,7 @@ class TestBasic < MiniTest::Test
def test_module_name def test_module_name
@string_input = 'FooBar ' @string_input = 'FooBar '
@parse_output = {:module_name=>"FooBar"} @output = [Boot::MetaClass.new(:FooBar)]
@output = Ast::ModuleName.new("FooBar")
check check
end end