예제 #1
0
        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);
        }
예제 #2
0
파일: IntIL.cs 프로젝트: DragonXYZ/cilpe
        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;
        }