From 91fdfb0c1eea1e520db3cdfaa117109336cd1507 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Tue, 4 Apr 2017 18:21:11 +0300 Subject: [PATCH] remove unused classes and cases from vool --- lib/vool/compiler.rb | 34 +++++---------------------------- lib/vool/function_statement.rb | 5 ----- lib/vool/operator_expression.rb | 5 ----- 3 files changed, 5 insertions(+), 39 deletions(-) delete mode 100644 lib/vool/function_statement.rb delete mode 100644 lib/vool/operator_expression.rb diff --git a/lib/vool/compiler.rb b/lib/vool/compiler.rb index c8e3738d..ebe892fb 100644 --- a/lib/vool/compiler.rb +++ b/lib/vool/compiler.rb @@ -127,20 +127,6 @@ module Vool ReturnStatement.new( return_value ) end - def on_function statement - return_type , name , parameters, statements , receiver = *statement - w = FunctionStatement.new() - w.return_type = return_type - w.name = name.children.first - w.parameters = parameters.to_a.collect do |p| - raise "error, argument must be a identifier, not #{p}" unless p.type == :parameter - p.children - end - w.statements = process(statements) - w.receiver = receiver - w - end - def on_while statement condition , statements = *statement w = WhileStatement.new( process(condition) ) @@ -150,7 +136,6 @@ module Vool end def on_if statement -# puts "IF #{statement}" condition , if_true , if_false = *statement w = IfStatement.new( process(condition) ) simplify_condition(w) @@ -159,20 +144,6 @@ module Vool w end - def simplify_condition( cond ) - return unless cond.condition.is_a?(ScopeStatement) - cond.condition = cond.condition.first if cond.condition.single? - end - - def on_operator_value statement - operator , left_e , right_e = *statement - w = OperatorStatement.new() - w.operator = operator - w.left_expression = process(left_e) - w.right_expression = process(right_e) - w - end - def on_send statement kids = statement.children.dup receiver = kids.shift @@ -210,6 +181,11 @@ module Vool private + def simplify_condition( cond ) + return unless cond.condition.is_a?(ScopeStatement) + cond.condition = cond.condition.first if cond.condition.single? + end + def instance_name sym sym.to_s[1 .. -1].to_sym end diff --git a/lib/vool/function_statement.rb b/lib/vool/function_statement.rb deleted file mode 100644 index 747a9eb2..00000000 --- a/lib/vool/function_statement.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Vool - class FunctionStatement < Statement - attr_accessor :return_type , :name , :parameters, :statements , :receiver - end -end diff --git a/lib/vool/operator_expression.rb b/lib/vool/operator_expression.rb deleted file mode 100644 index 794a9e83..00000000 --- a/lib/vool/operator_expression.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Vool - class OperatorExpression < Statement - attr_accessor :operator , :left_expression , :right_expression - end -end