one more basic test back online
This commit is contained in:
parent
dc6cb2bb52
commit
ae21863245
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user