Introduce singleton types
Just for future, as this gives us a way to know immediately in the type, which represent normal, and which singleton classes Also instantiate singleton class lazily (with singleton type) This makes the type of class single, ie unique, immediately when it is used, ie methods or variables defined. Fixes a design mistake, where all singletonn classes shared the same type, and thus unique methods per class were impossible (Also some misc in commit)
This commit is contained in:
@ -25,16 +25,21 @@ module Parfait
|
||||
8
|
||||
end
|
||||
|
||||
def initialize( clazz , clazz_type)
|
||||
raise "No type for #{clazz.name}" unless clazz_type
|
||||
super( clazz_type )
|
||||
def initialize( clazz )
|
||||
clazz_hash = clazz.type.to_hash
|
||||
@clazz = clazz
|
||||
super( Type.for_hash(clazz_hash , self , 1) )
|
||||
@clazz.set_type( @instance_type )
|
||||
end
|
||||
|
||||
def rxf_reference_name
|
||||
@clazz.name
|
||||
end
|
||||
|
||||
def name
|
||||
:"#{clazz.name}.Single"
|
||||
end
|
||||
|
||||
def inspect
|
||||
"SingletonClass(#{@clazz.name})"
|
||||
end
|
||||
|
Reference in New Issue
Block a user