コード例 #1
0
        public GSharpObject InvokeMethod(GSharpMethod method, StackFrame frame, GSharpObject self, GSharpObject[] arguments)
        {
            Stack.NewFrame(frame);
            int insCount = method.Body.Count;
            int i        = 0;

            foreach (string param in method.Parameters.Keys)
            {
                Stack.StoreLocal(method.Parameters[param], arguments[i++]);
            }

            StackFrame top = Stack.Top;

            while (top.InstructionPointer < insCount && !top.AbortExecution)
            {
                Instruction currInstr = method.Body[Stack.InstructionPointer++];
                ExecuteInstruction(currInstr);
            }

            if (top.AbortExecution)
            {
                return(null);
            }

            GSharpObject retVal = Stack.Pop();

            Stack.EndFrame();

            return(retVal);
        }
コード例 #2
0
 public StackFrame(int localCount, GSharpMethod method, GSharpObject self)
 {
     LocalCount = localCount;
     Method     = method;
     Module     = method.Module;
     Self       = self;
     locals     = new GSharpObject[localCount];
 }
コード例 #3
0
 public void AddMethod(GSharpMethod method)
 {
     SetAttribute(method.Name, method);
 }
コード例 #4
0
 public void NewFrame(int localCount, GSharpMethod method, GSharpObject self)
 {
     Frames++;
     top = new StackFrame(localCount, method, self);
     frames.Push(top);
 }
コード例 #5
0
 public InstanceMethodCallback(GSharpMethod method, GSharpObject self) : base("Instance Method Callback")
 {
     Method    = method;
     this.self = self;
 }