rubyx/lib/bosl/compiler/module_expression.rb
Torsten Ruger f4a4ccb98e several larger changes came together, bit of cleaning too
- all code must be in functions (which must be in classes).
— changes a fair few tests
— also changes api, as method is not recursive, not passed around
- all state in instance vars in compiler (no accessors)
- class is another such variable, surely more coming
all green again
2015-10-06 00:27:13 +03:00

21 lines
612 B
Ruby

module Bosl
Compiler.class_eval do
# module attr_reader :name ,:expressions
def on_module expression
name , rest = *expression
return process_all(rest).last
end
def on_class expression
#puts expression.inspect
name , derives , expressions = *expression
raise "classes dont yet play babushka, get coding #{name}" if @clazz
@clazz = Parfait::Space.object_space.get_class_by_name! name
puts "Compiling class #{@clazz.name.inspect}"
expression_value = process_all(expressions).last
@clazz = nil
return expression_value
end
end
end