public object ExecuteFunc(IMethod_Sharp method, object _this, object[] _params) { _activeContext = this; if (this.DebugLevel >= 9) { environment.logger.Log("<Call>::" + method.DeclaringType.FullName + "::" + method.Name.ToString()); } StackFrame stack = new StackFrame(method.Name, method.isStatic); stacks.Push(stack); object[] _withp = null; bool isctor = method.Name == ".ctor"; if (isctor) { //CLRSharp_Instance pthis = new CLRSharp_Instance(GetType(func.ReturnType) as Type_Common_CLRSharp); //StackFrame.RefObj pthis = new StackFrame.RefObj(stack, 0, StackFrame.RefType.arg); _withp = new object[_params == null ? 1 : (_params.Length + 1)]; if (_params != null) _params.CopyTo(_withp, 1); _withp[0] = _this; } else { if (!method.isStatic) { _withp = new object[(_params == null) ? 1 : (_params.Length + 1)]; _withp[0] = _this; if (_params != null) _params.CopyTo(_withp, 1); } else { _withp = _params; } } stack.SetParams(_withp); if (method.body != null) { stack.Init(method.body); stack.SetCodePos(0); //._pos = method.body.bodyNative.Instructions[0]; stack._codepos = 0; if (method.body.bodyNative.HasExceptionHandlers && !SetNoTry) { RunCodeWithTry(method.body, stack); } else { RunCode(stack, method.body); } } if (this.DebugLevel >= 9) { environment.logger.Log("<CallEnd>"); } var ret = stacks.Pop().Return(); return isctor ? _this : ret; //if (func.HasBody) //{ // RunCode(stack, func.Body.Instructions); //} //var ret = stacks.Pop().Return(); //if (this.DebugLevel >= 9) //{ // environment.logger.Log("<CallEnd>"); //} //return ret; }
public object ExecuteFunc(IMethod_Sharp method, object _this, object[] _params) { bool flag = this.DebugLevel >= 9; if (flag) { this.environment.logger.Log("<Call>::" + method.DeclaringType.FullName + "::" + method.Name.ToString()); } StackFrame stackFrame = new StackFrame(method.Name, method.isStatic); this.stacks.Push(stackFrame); bool flag2 = method.Name == ".ctor"; bool flag3 = flag2; object[] array; if (flag3) { array = new object[(_params == null) ? 1 : (_params.Length + 1)]; bool flag4 = _params != null; if (flag4) { _params.CopyTo(array, 1); } array[0] = _this; } else { bool flag5 = !method.isStatic; if (flag5) { array = new object[(_params == null) ? 1 : (_params.Length + 1)]; array[0] = _this; bool flag6 = _params != null; if (flag6) { _params.CopyTo(array, 1); } } else { array = _params; } } stackFrame.SetParams(array); bool flag7 = method.body != null; if (flag7) { stackFrame.Init(method.body); stackFrame.SetCodePos(0); stackFrame._codepos = 0; bool flag8 = method.body.bodyNative.HasExceptionHandlers && !this.SetNoTry; if (flag8) { this.RunCodeWithTry(method.body, stackFrame); } else { this.RunCode(stackFrame, method.body); } } bool flag9 = this.DebugLevel >= 9; if (flag9) { this.environment.logger.Log("<CallEnd>"); } object obj = this.stacks.Pop().Return(); return(flag2 ? _this : obj); }
public object ExecuteFunc(IMethod_Sharp method, object _this, object[] _params) { _activeContext = this; if (this.DebugLevel >= 9) { environment.logger.Log("<Call>::" + method.DeclaringType.FullName + "::" + method.Name.ToString()); } StackFrame stack = new StackFrame(method.Name, method.isStatic); stacks.Push(stack); object[] _withp = null; bool isctor = method.Name == ".ctor"; if (isctor) { //CLRSharp_Instance pthis = new CLRSharp_Instance(GetType(func.ReturnType) as Type_Common_CLRSharp); //StackFrame.RefObj pthis = new StackFrame.RefObj(stack, 0, StackFrame.RefType.arg); _withp = new object[_params == null ? 1 : (_params.Length + 1)]; if (_params != null) { _params.CopyTo(_withp, 1); } _withp[0] = _this; } else { if (!method.isStatic) { _withp = new object[(_params == null) ? 1 : (_params.Length + 1)]; _withp[0] = _this; if (_params != null) { _params.CopyTo(_withp, 1); } } else { _withp = _params; } } stack.SetParams(_withp); if (method.body != null) { stack.Init(method.body); stack.SetCodePos(0); //._pos = method.body.bodyNative.Instructions[0]; stack._codepos = 0; if (method.body.bodyNative.HasExceptionHandlers && !SetNoTry) { RunCodeWithTry(method.body, stack); } else { RunCode(stack, method.body); } } if (this.DebugLevel >= 9) { environment.logger.Log("<CallEnd>"); } var ret = stacks.Pop().Return(); return(isctor ? _this : ret); //if (func.HasBody) //{ // RunCode(stack, func.Body.Instructions); //} //var ret = stacks.Pop().Return(); //if (this.DebugLevel >= 9) //{ // environment.logger.Log("<CallEnd>"); //} //return ret; }