update and fix class compilation

This commit is contained in:
Torsten Ruger 2015-09-20 16:30:39 +03:00
parent f2fc9c5f89
commit 77f0a08060
3 changed files with 8 additions and 15 deletions

View File

@ -12,7 +12,7 @@ GIT
GIT GIT
remote: git://github.com/salama/salama-reader.git remote: git://github.com/salama/salama-reader.git
revision: 8e07a7568f4b41d0f9b06c6c851b4fa785b88fc4 revision: e8bc570d2530e501a08ed35eb5b6fac26dc78309
specs: specs:
salama-reader (0.2.0) salama-reader (0.2.0)
ast (~> 2.1.0) ast (~> 2.1.0)

View File

@ -4,8 +4,8 @@ module Bosl
# call_site - attr_reader :name, :args , :receiver # call_site - attr_reader :name, :args , :receiver
def on_call expession def on_call expression
name , arguments , receiver = *expession name , arguments , receiver = *expression
name = name.to_a.first name = name.to_a.first
if receiver if receiver

View File

@ -6,18 +6,11 @@ module Bosl
end end
def on_class expression def on_class expression
clazz = Parfait::Space.object_space.get_class_by_name! expression.name puts expression.inspect
name , derives , expressions = *expression
clazz = Parfait::Space.object_space.get_class_by_name! name
#puts "Compiling class #{clazz.name.inspect}" #puts "Compiling class #{clazz.name.inspect}"
expression_value = nil expression_value = process_all(expressions).last
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 return expression_value
end end