From 324c9c2eae21b50a0cab3f69c757c3bcaeb17da2 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 7 Mar 2016 11:32:28 +0200 Subject: [PATCH] better handling of statement lists --- lib/soml/code/to_code.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/soml/code/to_code.rb b/lib/soml/code/to_code.rb index b19a911..389dd4f 100644 --- a/lib/soml/code/to_code.rb +++ b/lib/soml/code/to_code.rb @@ -16,7 +16,7 @@ module Soml w = ClassStatement.new() w.name = name w.derives = derives.children.first - w.statements = process_all(statements) + w.statements = process(statements) w end @@ -29,7 +29,7 @@ module Soml raise "error, argument must be a identifier, not #{p}" unless p.type == :parameter p.children end - w.statements = process_all(statements) + w.statements = process(statements) w.receiver = receiver w end @@ -56,7 +56,7 @@ module Soml w = WhileStatement.new() w.branch_type = branch_type w.condition = process(condition) - w.statements = process_all(statements) + w.statements = process(statements) w end @@ -65,8 +65,8 @@ module Soml w = IfStatement.new() w.branch_type = branch_type w.condition = process(condition) - w.if_true = process_all(if_true) - w.if_false = process_all(if_false) + w.if_true = process(if_true) + w.if_false = process(if_false) w end @@ -83,6 +83,8 @@ module Soml w.statements = process_all(statement.children) w end + alias :on_true_statements :on_statements + alias :on_false_statements :on_statements def on_return statement w = ReturnStatement.new() @@ -114,7 +116,7 @@ module Soml def on_call statement name_s , arguments , receiver = *statement w = CallSite.new() - w.name = name_s + w.name = name_s.children.first w.arguments = process_all(arguments) w.receiver = process(receiver) w