Class: Dhallish::Ast::Import_Alternative
- Inherits:
-
Object
- Object
- Dhallish::Ast::Import_Alternative
- Defined in:
- lib/ast.rb
Instance Attribute Summary collapse
-
#lhs ⇒ Object
Returns the value of attribute lhs.
-
#rhs ⇒ Object
Returns the value of attribute rhs.
Instance Method Summary collapse
- #compute_type(ctx) ⇒ Object
- #evaluate(ctx) ⇒ Object
-
#initialize(lhs, rhs) ⇒ Import_Alternative
constructor
A new instance of Import_Alternative.
Constructor Details
#initialize(lhs, rhs) ⇒ Import_Alternative
Returns a new instance of Import_Alternative.
779 780 781 782 783 |
# File 'lib/ast.rb', line 779 def initialize(lhs, rhs) @lhs = lhs @rhs = rhs @lhs_succeded = false end |
Instance Attribute Details
#lhs ⇒ Object
Returns the value of attribute lhs.
776 777 778 |
# File 'lib/ast.rb', line 776 def lhs @lhs end |
#rhs ⇒ Object
Returns the value of attribute rhs.
777 778 779 |
# File 'lib/ast.rb', line 777 def rhs @rhs end |
Instance Method Details
#compute_type(ctx) ⇒ Object
785 786 787 788 789 790 791 792 793 794 795 |
# File 'lib/ast.rb', line 785 def compute_type(ctx) begin type = @lhs.compute_type ctx @lhs_succeded = true type rescue AssertionError, DhallError => e raise e rescue @rhs.compute_type ctx end end |
#evaluate(ctx) ⇒ Object
797 798 799 800 801 802 803 |
# File 'lib/ast.rb', line 797 def evaluate(ctx) if @lhs_succeded @lhs.evaluate ctx else @rhs.evaluate ctx end end |