move to syms for names
This commit is contained in:
@ -24,7 +24,7 @@ module Ast
|
||||
class NameExpression < Expression
|
||||
attr_reader :name
|
||||
def initialize name
|
||||
@name = name
|
||||
@name = name.to_sym
|
||||
end
|
||||
# compiling a variable resolves it.
|
||||
# if it wasn't defined, nli is returned
|
||||
@ -32,7 +32,7 @@ module Ast
|
||||
context.locals[name]
|
||||
end
|
||||
def inspect
|
||||
self.class.name + '.new("' + name + '")'
|
||||
"#{self.class.name}.new(#{name})"
|
||||
end
|
||||
def to_s
|
||||
name
|
||||
|
@ -5,7 +5,9 @@ module Ast
|
||||
attr_reader :name, :args , :receiver
|
||||
|
||||
def initialize name, args , receiver = Ast::NameExpression.new(:self)
|
||||
@name , @args , @receiver = name.to_sym , args , receiver
|
||||
@name = name.to_sym
|
||||
@args = args
|
||||
@receiver = receiver
|
||||
end
|
||||
|
||||
def compile context , into
|
||||
@ -14,6 +16,7 @@ module Ast
|
||||
r = context.current_class.name
|
||||
if !receiver.nil? and receiver.name != :self
|
||||
r = receiver.name
|
||||
raise "uups #{receiver.class}.#{receiver.name.class}" unless r.is_a? Symbol
|
||||
end
|
||||
clazz = context.object_space.get_or_create_class r
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
module Ast
|
||||
class ModuleExpression < Expression
|
||||
|
||||
attr_reader :name ,:expressions
|
||||
|
||||
def initialize name , expressions
|
||||
@name = name.to_sym
|
||||
@expressions = expressions
|
||||
|
Reference in New Issue
Block a user