Exemplo n.º 1
0
 private void OperHostCall()
 {
     bool terminated = this.Terminated;
     ScripterState state = this.scripter.Owner.State;
     this.scripter.Owner.State = ScripterState.Running;
     FunctionObject functionObject = this.GetFunctionObject(this.r.arg1);
     object v = this.stack.Pop();
     CallStackRec csr = null;
     if (this.debugging)
     {
         csr = new CallStackRec(this.scripter, functionObject, this.n);
     }
     int paramCount = functionObject.ParamCount;
     for (int i = 0; i < paramCount; i++)
     {
         object obj4 = this.stack.Pop();
         if (this.debugging)
         {
             csr.Parameters.Insert(0, obj4);
         }
         if (obj4 == null)
         {
             functionObject.Params[(paramCount - 1) - i] = obj4;
         }
         else if (obj4.GetType() == typeof(ObjectObject))
         {
             ObjectObject obj5 = obj4 as ObjectObject;
             int num3 = functionObject.Param_Ids[i];
             if ((this.symbol_table[num3].TypeId == 0x10) && ((functionObject.Owner.NamespaceNameIndex == this.symbol_table.SYSTEM_COLLECTIONS_ID) || (functionObject.Owner.Name == "ArrayList")))
             {
                 functionObject.Params[(paramCount - 1) - i] = obj5;
             }
             else
             {
                 functionObject.Params[(paramCount - 1) - i] = obj5.Instance;
             }
         }
         else
         {
             functionObject.Params[(paramCount - 1) - i] = obj4;
         }
     }
     if (this.debugging)
     {
         this.callstack.Add(csr);
     }
     if (functionObject.Kind == MemberKind.Constructor)
     {
         if (functionObject.Owner.HasModifier(Modifier.Abstract))
         {
             this.scripter.ToScriptObject(v).Instance = new object();
         }
         else
         {
             this.scripter.ToScriptObject(v).Instance = functionObject.InvokeConstructor();
         }
     }
     else
     {
         object obj6;
         if (functionObject.Static)
         {
             if (v == null)
             {
                 obj6 = functionObject.InvokeMethod(null);
             }
             else
             {
                 Type importedType = (v as ClassObject).ImportedType;
                 obj6 = functionObject.InvokeMethod(importedType);
             }
         }
         else if (v is ObjectObject)
         {
             obj6 = functionObject.InvokeMethod((v as ObjectObject).Instance);
         }
         else
         {
             obj6 = functionObject.InvokeMethod(v);
         }
         if (this.r.res != 0)
         {
             this.PutValue(this.r.res, obj6);
         }
     }
     if (this.debugging)
     {
         this.callstack.Pop();
     }
     this.Terminated = terminated;
     this.scripter.Owner.State = state;
     this.n++;
 }
Exemplo n.º 2
0
 private void OperCall()
 {
     FunctionObject functionObject = this.GetFunctionObject(this.r.arg1);
     if (functionObject.Imported)
     {
         this.OperHostCall();
     }
     else
     {
         object obj3 = this.stack.Pop();
         functionObject.AllocateSub();
         functionObject.PutThis(obj3);
         CallStackRec csr = null;
         if (this.debugging)
         {
             csr = new CallStackRec(this.scripter, functionObject, this.n);
         }
         int num = this.r.arg2;
         for (int i = 0; i < num; i++)
         {
             obj3 = this.stack.Pop();
             functionObject.PutParam((num - 1) - i, obj3);
             if (this.debugging)
             {
                 csr.Parameters.Insert(0, obj3);
             }
         }
         if (this.debugging)
         {
             this.callstack.Add(csr);
         }
         this.stack.Push(this.n);
         this.n = functionObject.Init.FinalNumber;
         this.curr_stack_count = this.stack.Count;
     }
 }
Exemplo n.º 3
0
 private void OperCallVirt()
 {
     FunctionObject functionObject = this.GetFunctionObject(this.r.arg1);
     object v = this.stack.Pop();
     int typeId = this.symbol_table[this[this.n - 1].arg1].TypeId;
     if (this.GetClassObject(typeId).IsInterface)
     {
         typeId = this.scripter.ToScriptObject(v).Class_Object.Id;
     }
     functionObject = functionObject.GetLateBindingFunction(v, typeId, this.GetUpcase());
     if (functionObject.Imported)
     {
         this.stack.Push(v);
         this.OperHostCall();
     }
     else
     {
         functionObject.AllocateSub();
         functionObject.PutThis(v);
         CallStackRec csr = null;
         if (this.debugging)
         {
             csr = new CallStackRec(this.scripter, functionObject, this.n);
         }
         int num2 = this.r.arg2;
         for (int i = 0; i < num2; i++)
         {
             v = this.stack.Pop();
             functionObject.PutParam((num2 - 1) - i, v);
             if (this.debugging)
             {
                 csr.Parameters.Insert(0, v);
             }
         }
         if (this.debugging)
         {
             this.callstack.Add(csr);
         }
         this.stack.Push(this.n);
         this.n = functionObject.Init.FinalNumber;
     }
 }
Exemplo n.º 4
0
 internal void Add(CallStackRec csr)
 {
     this.items.Insert(0, csr);
 }