introduce statement class for mom

This commit is contained in:
Torsten Ruger 2017-09-06 12:11:30 +03:00
parent 0e98179888
commit 0e51492430
3 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,5 @@
module Mom
class IfStatement < Instruction
class IfStatement < Statement
attr_reader :condition , :if_true , :if_false
attr_accessor :hoisted

View File

@ -4,10 +4,8 @@ module Mom
class Instruction
attr :next_instruction
# flattening will change the structure from a tree to a linked list (and use
# next_instruction to do so)
# implement flatten as noop to avoid condition
def flatten
raise "not implemented"
end
end
@ -19,6 +17,13 @@ module Mom
end
end
class Statement
# flattening will change the structure from a tree to a linked list (and use
# next_instruction to do so)
def flatten
raise "not implemented"
end
end
end

View File

@ -1,6 +1,6 @@
module Mom
class WhileStatement < Instruction
class WhileStatement < Statement
attr_reader :condition , :statements
attr_accessor :hoisted