introduce statement class for mom
This commit is contained in:
parent
0e98179888
commit
0e51492430
@ -1,5 +1,5 @@
|
||||
module Mom
|
||||
class IfStatement < Instruction
|
||||
class IfStatement < Statement
|
||||
attr_reader :condition , :if_true , :if_false
|
||||
|
||||
attr_accessor :hoisted
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
module Mom
|
||||
class WhileStatement < Instruction
|
||||
class WhileStatement < Statement
|
||||
attr_reader :condition , :statements
|
||||
|
||||
attr_accessor :hoisted
|
||||
|
Loading…
Reference in New Issue
Block a user