rubyx/lib/bosl/compiler/module_expression.rb
Torsten Ruger 775bca50ac switching to ast::processor
using instance methods instead of context
2015-09-19 18:56:18 +03:00

26 lines
872 B
Ruby

module Bosl
Compiler.class_eval do
# module attr_reader :name ,:expressions
def on_module expression
return clazz
end
def on_class expression
clazz = Parfait::Space.object_space.get_class_by_name! expression.name
#puts "Compiling class #{clazz.name.inspect}"
expression_value = nil
expression.expressions.each do |expr|
# check if it's a function definition and add
# if not, execute it, but that does means we should be in salama (executable), not ruby.
# ie throw an error for now
raise "only functions for now #{expr.inspect}" unless expr.is_a? Ast::FunctionExpression
#puts "compiling expression #{expression}"
expression_value = process(expr )
#puts "compiled expression #{expression_value.inspect}"
end
return expression_value
end
end
end