class Dhallish::Ast::ListConcatNode

Public Class Methods

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

Public Instance Methods

compute_type(ctx) click to toggle source
# File lib/ast.rb, line 265
def compute_type(ctx)
        lhs_type = @lhs.compute_type(ctx)
        rhs_type = @rhs.compute_type(ctx)

        assert ("List Concat: left operand not a list but #{lhs_type}") { lhs_type.is_a? Types::List }
        assert ("List Concatenation operands type mismatch. Left: #{lhs_type}, Right: #{rhs_type}") { rhs_type == lhs_type }

        lhs_type
end
evaluate(ctx) click to toggle source
# File lib/ast.rb, line 275
def evaluate(ctx)
        lhs = @lhs.evaluate(ctx)
        rhs = @rhs.evaluate(ctx)
        lhs + rhs
end