better handling of statement lists

This commit is contained in:
Torsten Ruger 2016-03-07 11:32:28 +02:00
parent c9d25fcf81
commit 324c9c2eae
1 changed files with 8 additions and 6 deletions

View File

@ -16,7 +16,7 @@ module Soml
w = ClassStatement.new() w = ClassStatement.new()
w.name = name w.name = name
w.derives = derives.children.first w.derives = derives.children.first
w.statements = process_all(statements) w.statements = process(statements)
w w
end end
@ -29,7 +29,7 @@ module Soml
raise "error, argument must be a identifier, not #{p}" unless p.type == :parameter raise "error, argument must be a identifier, not #{p}" unless p.type == :parameter
p.children p.children
end end
w.statements = process_all(statements) w.statements = process(statements)
w.receiver = receiver w.receiver = receiver
w w
end end
@ -56,7 +56,7 @@ module Soml
w = WhileStatement.new() w = WhileStatement.new()
w.branch_type = branch_type w.branch_type = branch_type
w.condition = process(condition) w.condition = process(condition)
w.statements = process_all(statements) w.statements = process(statements)
w w
end end
@ -65,8 +65,8 @@ module Soml
w = IfStatement.new() w = IfStatement.new()
w.branch_type = branch_type w.branch_type = branch_type
w.condition = process(condition) w.condition = process(condition)
w.if_true = process_all(if_true) w.if_true = process(if_true)
w.if_false = process_all(if_false) w.if_false = process(if_false)
w w
end end
@ -83,6 +83,8 @@ module Soml
w.statements = process_all(statement.children) w.statements = process_all(statement.children)
w w
end end
alias :on_true_statements :on_statements
alias :on_false_statements :on_statements
def on_return statement def on_return statement
w = ReturnStatement.new() w = ReturnStatement.new()
@ -114,7 +116,7 @@ module Soml
def on_call statement def on_call statement
name_s , arguments , receiver = *statement name_s , arguments , receiver = *statement
w = CallSite.new() w = CallSite.new()
w.name = name_s w.name = name_s.children.first
w.arguments = process_all(arguments) w.arguments = process_all(arguments)
w.receiver = process(receiver) w.receiver = process(receiver)
w w