2
/* **********************************************************************************
3
* Copyright (c) Roman Ivantsov
4
* This source code is subject to terms and conditions of the MIT License
5
* for Irony. A copy of the license can be found in the License.txt file
6
* at the root of this distribution.
7
* By using this source code in any fashion, you are agreeing to be bound by the terms of the
9
* You must not remove this notice from this software.
10
* **********************************************************************************/
14
using System.Collections.Generic;
17
using Irony.CompilerServices;
18
using Irony.Scripting.Ast;
20
namespace Irony.Scripting.Runtime {
22
public class Closure {
23
public string MethodName; //either BindingInfo.Name, or name of the variable storing lambda expression
24
public readonly Frame ParentFrame;
25
public readonly AstNode Node;
26
public readonly FunctionBindingInfo BindingInfo;
27
public Closure(Frame parentFrame, AstNode node, FunctionBindingInfo bindingInfo) {
28
MethodName = bindingInfo.Name;
29
ParentFrame = parentFrame;
31
BindingInfo = bindingInfo;
33
public void Evaluate(EvaluationContext context) {
34
context.PushFrame(MethodName, Node, ParentFrame);
36
BindingInfo.Evaluate(context);