Reworking if statement
Using 2 phase approach Flattening tbd
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
require_relative "check"
|
||||
|
||||
module Mom
|
||||
|
||||
# The funny thing about the ruby truth is that is is anything but false or nil
|
||||
@@ -5,17 +7,11 @@ module Mom
|
||||
# To implement the normal ruby logic, we check for false or nil and jump
|
||||
# to the false branch. true_block follows implicitly
|
||||
#
|
||||
# The class only carries the blocks for analysis, and does
|
||||
# - NOT imply any order
|
||||
# - will not "handle" the blocks in subsequent processing.
|
||||
#
|
||||
class TruthCheck < Instruction
|
||||
attr_reader :condition , :true_block , :false_block , :merge_block
|
||||
class TruthCheck < Check
|
||||
attr_reader :condition
|
||||
|
||||
def initialize(condition , true_block , false_block , merge_block)
|
||||
@condition , @true_block , @false_block , @merge_block = condition , true_block , false_block , merge_block
|
||||
def initialize(condition)
|
||||
@condition = condition
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user