12345678910111213141516171819202122 |
- module Chervil::AST
- class Application
- attr_reader :expr
- attr_reader :arguments
-
- def initialize(expr, arguments)
- @expr = expr
- @arguments = arguments
- end
-
- def ==(other)
- @expr == other.expr && @arguments == other.arguments
- end
-
- def evaluate(env)
- if @expr.class == Identifier
- function = env.get(@expr.name)
- function.call(@arguments.map { |arg| arg.evaluate(env) })
- end
- end
- end
- end
|