remove unused classes and cases from vool

This commit is contained in:
Torsten Ruger 2017-04-04 18:21:11 +03:00
parent d6e346d9c0
commit 91fdfb0c1e
3 changed files with 5 additions and 39 deletions

View File

@ -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

View File

@ -1,5 +0,0 @@
module Vool
class FunctionStatement < Statement
attr_accessor :return_type , :name , :parameters, :statements , :receiver
end
end

View File

@ -1,5 +0,0 @@
module Vool
class OperatorExpression < Statement
attr_accessor :operator , :left_expression , :right_expression
end
end