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:
@ -41,7 +41,7 @@ module Vool
|
||||
|
||||
def to_s(depth = 0)
|
||||
arg_str = @args.collect{|a| a.to_s}.join(', ')
|
||||
at_depth(depth , "def self.#{name}(#{arg_str})\n#{@body.to_s(depth + 1)}end")
|
||||
at_depth(depth , "def self.#{name}(#{arg_str})\n#{@body.to_s(1)}\nend")
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -50,7 +50,7 @@ module Vool
|
||||
|
||||
def to_s(depth = 0)
|
||||
arg_str = @args.collect{|a| a.to_s}.join(', ')
|
||||
at_depth(depth , "def #{name}(#{arg_str})\n#{@body.to_s(depth + 1)}\nend")
|
||||
at_depth(depth , "def #{name}(#{arg_str})\n#{@body.to_s(1)}\nend")
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -72,11 +72,7 @@ module Vool
|
||||
first = stats.shift.to_mom(compiler)
|
||||
while( nekst = stats.shift )
|
||||
next_mom = nekst.to_mom(compiler)
|
||||
if next_mom.is_a?(Mom::BlockCompiler)
|
||||
compiler.block_compilers << next_mom
|
||||
else
|
||||
first.append next_mom
|
||||
end
|
||||
first.append next_mom
|
||||
end
|
||||
first
|
||||
end
|
||||
|
Reference in New Issue
Block a user