class Dhallish::Ast::Import_Alternative

Attributes

lhs[RW]
rhs[RW]

Public Class Methods

new(lhs, rhs) click to toggle source
# File lib/ast.rb, line 779
def initialize(lhs, rhs)
        @lhs = lhs
        @rhs = rhs
        @lhs_succeded = false
end

Public Instance Methods

compute_type(ctx) click to toggle source
# 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) click to toggle source
# File lib/ast.rb, line 797
def evaluate(ctx)
        if @lhs_succeded
                @lhs.evaluate ctx
        else
                @rhs.evaluate ctx
        end
end