public static Value InterpretMethod(MethodBodyHolder holder, MethodBodyBlock body, ParameterValues paramVals, out Exception exc, string indent) { exc = null; GraphProcessor graphProcessor = new GraphProcessor(); IntVisitor visitor = new IntVisitor(graphProcessor,holder,indent); visitor.state = new State(body.Variables.Count); int paramCount = 0; foreach (Variable var in body.Variables.ParameterMapper) visitor.state.Pool[var] = paramVals[paramCount++]; visitor.AddTask(body); graphProcessor.Process(); Value result = null; if (visitor.unhandledException != null) exc = visitor.unhandledException; else if (body.ReturnType != typeof(void)) result = visitor.state.Stack.Pop().FromStack(body.ReturnType); return result; }
internal IntVisitor(GraphProcessor graphProcessor, MethodBodyHolder holder, string indent) : base(graphProcessor) { this.holder = holder; this.indent = indent; }