introduce statement class for mom
This commit is contained in:
parent
0e98179888
commit
0e51492430
@ -1,5 +1,5 @@
|
|||||||
module Mom
|
module Mom
|
||||||
class IfStatement < Instruction
|
class IfStatement < Statement
|
||||||
attr_reader :condition , :if_true , :if_false
|
attr_reader :condition , :if_true , :if_false
|
||||||
|
|
||||||
attr_accessor :hoisted
|
attr_accessor :hoisted
|
||||||
|
@ -4,10 +4,8 @@ module Mom
|
|||||||
class Instruction
|
class Instruction
|
||||||
attr :next_instruction
|
attr :next_instruction
|
||||||
|
|
||||||
# flattening will change the structure from a tree to a linked list (and use
|
# implement flatten as noop to avoid condition
|
||||||
# next_instruction to do so)
|
|
||||||
def flatten
|
def flatten
|
||||||
raise "not implemented"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -19,6 +17,13 @@ module Mom
|
|||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
module Mom
|
module Mom
|
||||||
class WhileStatement < Instruction
|
class WhileStatement < Statement
|
||||||
attr_reader :condition , :statements
|
attr_reader :condition , :statements
|
||||||
|
|
||||||
attr_accessor :hoisted
|
attr_accessor :hoisted
|
||||||
|
Loading…
Reference in New Issue
Block a user