Class: SFRP::Raw::IfExp
- Inherits:
-
Struct
- Object
- Struct
- SFRP::Raw::IfExp
- Includes:
- SugarExp
- Defined in:
- lib/sfrp/raw/expression.rb
Instance Attribute Summary collapse
-
#cond_exp ⇒ Object
Returns the value of attribute cond_exp.
-
#else_exp ⇒ Object
Returns the value of attribute else_exp.
-
#sp ⇒ Object
Returns the value of attribute sp.
-
#then_exp ⇒ Object
Returns the value of attribute then_exp.
Instance Method Summary collapse
Methods included from SugarExp
#blame_side_effect, #to_flat, #vconst_refs
Instance Attribute Details
#cond_exp ⇒ Object
Returns the value of attribute cond_exp
139 140 141 |
# File 'lib/sfrp/raw/expression.rb', line 139 def cond_exp @cond_exp end |
#else_exp ⇒ Object
Returns the value of attribute else_exp
139 140 141 |
# File 'lib/sfrp/raw/expression.rb', line 139 def else_exp @else_exp end |
#sp ⇒ Object
Returns the value of attribute sp
139 140 141 |
# File 'lib/sfrp/raw/expression.rb', line 139 def sp @sp end |
#then_exp ⇒ Object
Returns the value of attribute then_exp
139 140 141 |
# File 'lib/sfrp/raw/expression.rb', line 139 def then_exp @then_exp end |
Instance Method Details
#convert ⇒ Object
142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/sfrp/raw/expression.rb', line 142 def convert cases = [ MatchExp::Case.new( MatchExp::Pattern.new(Ref.new('True'), nil, [], sp), then_exp ), MatchExp::Case.new( MatchExp::Pattern.new(Ref.new('False'), nil, [], sp), else_exp ) ] MatchExp.new(cond_exp, cases, sp) end |