private DebugInfo(ModuleLiteral env, EvaluationStackFrame frame) { Contract.Requires(frame != null); InvocationEnv = env; Frame = frame.Detach(); m_locals = frame.Frame.Select((val, idx) => new LocalVarImpl(frame, idx)).ToArray(); }
/// <nodoc/> public EvaluationState(int threadId, Node node, Context context, ModuleLiteral env, EvaluationStackFrame args) : base(threadId) { Node = node; Context = context; Env = env; // Debugger has to move the stack frame to evaluation heap to prolong the lifetime of the frame. Args = args.Detach().Frame.Select(f => f.Value).ToArray(); }
/// <nodoc /> public Closure(ModuleLiteral env, FunctionLikeExpression function, EvaluationStackFrame frame) : base(location: default(LineInfo)) // Closures don't have locations { Contract.Requires(env != null); Contract.Requires(function != null); Contract.Requires(frame != null); Env = env; Function = function; // Now, closure instances are created only for anonymous functions. // In this case, frame that represents a captured state should be cloned, // because frame are pooled. Frame = frame.Detach(); }