예제 #1
0
        protected override void VisitCallMethod(CallMethod node, object data)
        {
            ParameterValues paramVals =
                state.Stack.Perform_CallMethod(node.Method, node.IsVirtCall);

            if (node.IsVirtCall)
            {
                paramVals.ChooseVirtualMethod();
            }

            Exception exc    = null;
            Value     retVal = null;

            if (holder.ContainsMethodBody(paramVals.Method))
            {
                retVal = InterpretMethod(holder, holder[paramVals.Method], paramVals, out exc, indent + "    ");
            }
            else
            {
                retVal = paramVals.Invoke(out exc);
            }

            if (exc == null)
            {
                if (retVal != null)
                {
                    state.Stack.Push(retVal);
                }
                AddTask(node.Next);
            }
            else
            {
                HandleException(node, exc);
            }
        }
예제 #2
0
        protected override void VisitNewObject(NewObject node, object data)
        {
            ParameterValues paramVals =
                state.Stack.Perform_CreateObject(node.Constructor);

            Exception exc = null;

            if (holder.ContainsMethodBody(paramVals.Method))
            {
                InterpretMethod(holder, holder[paramVals.Method], paramVals, out exc, indent + "    ");
            }
            else
            {
                paramVals.Invoke(out exc);
            }

            if (exc == null)
            {
                AddTask(node.Next);
            }
            else
            {
                HandleException(node, exc);
            }
        }
예제 #3
0
파일: Spec.cs 프로젝트: PlumpMath/cilpe-1
        internal Node InterpretNode(Node downNode)
        {
            Node      nextDown;
            Exception exc;

            this.state.InterpretNode(downNode, out nextDown, out exc);

            if (nextDown != null && exc == null)
            {
                return(nextDown);
            }
            else if (downNode is CallMethod)
            {
                ParameterValues paramVals = this.state.Stack.Perform_CallMethod((downNode as CallMethod).Method, (downNode as CallMethod).IsVirtCall);
                Value           retVal    = paramVals.Invoke(out exc);
                if (exc != null)
                {
                    throw new InternalException();
                }
                if (retVal != null)
                {
                    state.Stack.Push(retVal);
                }
                return(downNode.Next);
            }
            else if (downNode is NewObject)
            {
                ParameterValues paramVals = state.Stack.Perform_CreateObject((downNode as NewObject).Constructor);
                paramVals.Invoke(out exc);
                if (exc != null)
                {
                    throw new InternalException();
                }
                return(downNode.Next);
            }
            else
            {
                throw new IncorrectBTAnnotationException();
            }
        }