public override bool EvalStep(out object answer, ref Control expression, ref Environment environment) { #if DEBUG Warm("-"); NoteCalls(this.lambda.Body); NoteCalls(this.rand); randTypeHistogram.Note(this.randType); bodyTypeHistogram.Note(this.bodyType); SCode.location = "SimpleLet1"; #endif object evarg = null; Control unev = this.rand; Environment env = environment; while (unev.EvalStep(out evarg, ref unev, ref env)) { } ; #if DEBUG SCode.location = "SimpleLet1"; #endif if (evarg == Interpreter.UnwindStack) { ((UnwinderState)env).AddFrame(new Let1Frame0(this, environment)); answer = Interpreter.UnwindStack; environment = env; return(false); } // this.closeCount += 1; // Use the base environment for lookup. object [] cells = environment.GetValueCells(this.lambda.StaticMapping); #if DEBUG SCode.location = "SimpleLet1"; #endif SimpleClosure cl = new SimpleClosure(this.lambda, environment.BaseEnvironment, cells); // object evop = null; // Control unevop = this.rator; // env = environment; // while (unevop.EvalStep (out evop, ref unevop, ref env)) { }; //#if DEBUG // SCode.location = "SimpleLet1"; //#endif // if (evop == Interpreter.UnwindStack) { // throw new NotImplementedException (); // //((UnwinderState) env).AddFrame (new Combination1Frame1 (this, environment, evarg)); // //answer = Interpreter.UnwindStack; // //environment = env; // //return false; // } expression = this.lambda.Body; environment = new SmallEnvironment1(cl, evarg); answer = null; // keep the compiler happy return(true); // return cl.Call (out answer, ref expression, ref environment, evarg); }
public bool Call(out object answer, ref Control expression, ref Environment environment, object arg0) { #if DEBUG SCode.location = "-"; this.BumpCallCount(); SCode.location = "SimpleClosure.Call1"; SCode.NoteCalls(this, this.lambdaBody); #endif if (this.arity != 1) { return(Error.WrongNumberOfArguments(out answer, ref expression, ref environment)); } //if (callCount++ == Configuration.OptimizeThreshold && this.StaticCells.Length != 0) this.XXOptimize (); expression = this.lambdaBody; environment = new SmallEnvironment1(this, arg0); answer = null; // keep the compiler happy return(true); }