상속: ScriptFunction
 internal override Object Evaluate(){
   if( VsaEngine.executeForJSEE )
     throw new JScriptException(JSError.NonSupportedInDebugger);
   ScriptObject enclosingScope = Globals.ScopeStack.Peek();
   this.func.own_scope.SetParent(enclosingScope);
   Closure result = new Closure(this.func);
   if (this.field != null)
     this.field.value = result;
   return result;
 }
 internal ArgumentsObject(ScriptObject parent, Object[] arguments, FunctionObject function, Closure callee, ScriptObject scope, ArgumentsObject caller)
   : base(parent) {
   this.arguments = arguments;
   this.formal_names = function.formal_parameters;
   this.scope = scope;
   this.callee = callee;
   this.caller = caller;
   this.length = arguments.Length;
   this.noExpando = false;
 }
예제 #3
0
 public static ClosureEventMonitor CreateMonitor(Closure clo)
 {
     ClosureEventMonitor mon = (ClosureEventMonitor)monitorMap[clo];
       if (mon == null)
       {
     mon = new ClosureEventMonitor(clo);
     monitorMap[clo] = mon;
       }
       return mon;
 }
 internal override object Evaluate()
 {
     if (VsaEngine.executeForJSEE)
     {
         throw new JScriptException(JSError.NonSupportedInDebugger);
     }
     ScriptObject parent = base.Globals.ScopeStack.Peek();
     this.func.own_scope.SetParent(parent);
     Closure closure = new Closure(this.func);
     if (this.field != null)
     {
         this.field.value = closure;
     }
     return closure;
 }
 internal virtual object Call(object[] args, object thisob, ScriptObject enclosing_scope, Closure calleeClosure, Binder binder, CultureInfo culture)
 {
     return this.Call(args, thisob);
 }
 private object CallASTFunc(object[] args, object thisob, ScriptObject enclosing_scope, Closure calleeClosure, Binder binder, CultureInfo culture)
 {
     object obj7;
     object caller = calleeClosure.caller;
     calleeClosure.caller = this.globals.caller;
     this.globals.caller = calleeClosure;
     object arguments = calleeClosure.arguments;
     ScriptObject obj4 = this.globals.ScopeStack.Peek();
     ArgumentsObject obj5 = (obj4 is Microsoft.JScript.StackFrame) ? ((Microsoft.JScript.StackFrame) obj4).caller_arguments : null;
     Microsoft.JScript.StackFrame item = new Microsoft.JScript.StackFrame(enclosing_scope, this.fields, new object[this.fields.Length], thisob);
     if (this.isMethod && !this.isStatic)
     {
         item.closureInstance = thisob;
     }
     this.globals.ScopeStack.GuardedPush(item);
     try
     {
         this.own_scope.CloseNestedFunctions(item);
         ArgumentsObject obj6 = null;
         if (this.hasArgumentsObject)
         {
             obj6 = new ArgumentsObject(this.globals.globalObject.originalObjectPrototype, args, this, calleeClosure, item, obj5);
             item.localVars[this.argumentsSlotNumber] = obj6;
         }
         item.caller_arguments = obj6;
         calleeClosure.arguments = obj6;
         this.ConvertArguments(args, item.localVars, 0, args.Length, this.formal_parameters.Length, binder, culture);
         Completion completion = (Completion) this.body.Evaluate();
         if (completion.Return)
         {
             return completion.value;
         }
         obj7 = null;
     }
     finally
     {
         this.globals.ScopeStack.Pop();
         calleeClosure.arguments = arguments;
         this.globals.caller = calleeClosure.caller;
         calleeClosure.caller = caller;
     }
     return obj7;
 }
 internal override object Call(object[] args, object thisob, ScriptObject enclosing_scope, Closure calleeClosure, Binder binder, CultureInfo culture)
 {
     object obj7;
     if (this.body != null)
     {
         return this.CallASTFunc(args, thisob, enclosing_scope, calleeClosure, binder, culture);
     }
     object caller = calleeClosure.caller;
     calleeClosure.caller = this.globals.caller;
     this.globals.caller = calleeClosure;
     object arguments = calleeClosure.arguments;
     ScriptObject obj4 = this.globals.ScopeStack.Peek();
     ArgumentsObject obj5 = (obj4 is Microsoft.JScript.StackFrame) ? ((Microsoft.JScript.StackFrame) obj4).caller_arguments : null;
     Microsoft.JScript.StackFrame item = new Microsoft.JScript.StackFrame(enclosing_scope, this.fields, this.must_save_stack_locals ? new object[this.fields.Length] : null, thisob);
     this.globals.ScopeStack.GuardedPush(item);
     ArgumentsObject obj6 = new ArgumentsObject(this.globals.globalObject.originalObjectPrototype, args, this, calleeClosure, item, obj5);
     item.caller_arguments = obj6;
     calleeClosure.arguments = obj6;
     try
     {
         int length = this.formal_parameters.Length;
         int num2 = args.Length;
         if (this.hasArgumentsObject)
         {
             object[] objArray = new object[length + 3];
             objArray[0] = thisob;
             objArray[1] = base.engine;
             objArray[2] = obj6;
             this.ConvertArguments(args, objArray, 3, num2, length, binder, culture);
             return this.method.Invoke(thisob, BindingFlags.SuppressChangeType, null, objArray, null);
         }
         if (!this.isMethod)
         {
             object[] objArray2 = new object[length + 2];
             objArray2[0] = thisob;
             objArray2[1] = base.engine;
             this.ConvertArguments(args, objArray2, 2, num2, length, binder, culture);
             return this.method.Invoke(thisob, BindingFlags.SuppressChangeType, null, objArray2, null);
         }
         if (length == num2)
         {
             this.ConvertArguments(args, args, 0, num2, length, binder, culture);
             return this.method.Invoke(thisob, BindingFlags.SuppressChangeType, null, args, null);
         }
         object[] newargs = new object[length];
         this.ConvertArguments(args, newargs, 0, num2, length, binder, culture);
         obj7 = this.method.Invoke(thisob, BindingFlags.SuppressChangeType, null, newargs, null);
     }
     catch (TargetInvocationException exception)
     {
         throw exception.InnerException;
     }
     finally
     {
         this.globals.ScopeStack.Pop();
         calleeClosure.arguments = arguments;
         this.globals.caller = calleeClosure.caller;
         calleeClosure.caller = caller;
     }
     return obj7;
 }
예제 #8
0
 private Object CallASTFunc(Object[] args, Object thisob, ScriptObject enclosing_scope, Closure calleeClosure, Binder binder, CultureInfo culture){
   Object saved_caller = calleeClosure.caller;
   calleeClosure.caller = this.globals.caller;
   this.globals.caller = calleeClosure;
   Object saved_args = calleeClosure.arguments;
   ScriptObject calling_scope = globals.ScopeStack.Peek();
   ArgumentsObject caller_arguments = (calling_scope is StackFrame) ? ((StackFrame)calling_scope).caller_arguments : null;
   StackFrame sf = new StackFrame(enclosing_scope, this.fields, new Object[this.fields.Length], thisob);
   if (this.isMethod && !this.isStatic)
     sf.closureInstance = thisob;
   globals.ScopeStack.GuardedPush(sf);
   try{
     this.own_scope.CloseNestedFunctions(sf);
     ArgumentsObject arguments = null;
     if (this.hasArgumentsObject){
       arguments = new ArgumentsObject(this.globals.globalObject.originalObjectPrototype, args, this, calleeClosure, sf, caller_arguments);
       sf.localVars[this.argumentsSlotNumber] = arguments;
     }
     sf.caller_arguments = arguments;
     calleeClosure.arguments = arguments;
     this.ConvertArguments(args, sf.localVars, 0, args.Length, this.formal_parameters.Length, binder, culture);
     Completion result = (Completion)(this.body.Evaluate());
     if (result.Return)
       return result.value;
     else
       return null;
   }finally{
     this.globals.ScopeStack.Pop();
     calleeClosure.arguments = saved_args;
     this.globals.caller = calleeClosure.caller;
     calleeClosure.caller = saved_caller;
   }
 }
예제 #9
0
 internal override Object Call(Object[] args, Object thisob, ScriptObject enclosing_scope, Closure calleeClosure, Binder binder, CultureInfo culture){
   if (this.body != null)
     return CallASTFunc(args, thisob, enclosing_scope, calleeClosure, binder, culture);
   
   Object saved_caller = calleeClosure.caller;
   calleeClosure.caller = this.globals.caller;
   this.globals.caller = calleeClosure;
   Object saved_args = calleeClosure.arguments;
   ScriptObject calling_scope = globals.ScopeStack.Peek();
   ArgumentsObject caller_arguments = (calling_scope is StackFrame) ? ((StackFrame)calling_scope).caller_arguments : null;
   StackFrame sf = new StackFrame(enclosing_scope, this.fields, this.must_save_stack_locals ? new Object[this.fields.Length] : null, thisob);
   globals.ScopeStack.GuardedPush(sf);
   ArgumentsObject arguments = new ArgumentsObject(globals.globalObject.originalObjectPrototype, args, this, calleeClosure, sf, caller_arguments);
   sf.caller_arguments = arguments;
   calleeClosure.arguments = arguments;
   try{
     try{
       int n = this.formal_parameters.Length;
       int m = args.Length;
       if (this.hasArgumentsObject){
         Object[] newargs = new Object[n+3];
         newargs[0] = thisob;
         newargs[1] = this.engine;
         newargs[2] = arguments;
         this.ConvertArguments(args, newargs, 3, m, n, binder, culture);
         return this.method.Invoke(thisob, BindingFlags.SuppressChangeType, null, newargs, null);
       }else if (!this.isMethod){
         Object[] newargs = new Object[n+2];
         newargs[0] = thisob;
         newargs[1] = this.engine;
         this.ConvertArguments(args, newargs, 2, m, n, binder, culture);
         return this.method.Invoke(thisob, BindingFlags.SuppressChangeType, null, newargs, null);
       }else if (n == m){
         this.ConvertArguments(args, args, 0, m, n, binder, culture);
         return this.method.Invoke(thisob, BindingFlags.SuppressChangeType, null, args, null);
       }else{
         Object[] newargs = new Object[n];
         this.ConvertArguments(args, newargs, 0, m, n, binder, culture);
         return this.method.Invoke(thisob, BindingFlags.SuppressChangeType, null, newargs, null);
       }
     }catch(TargetInvocationException e){
       throw e.InnerException;
     }
   }finally{
     globals.ScopeStack.Pop();
     calleeClosure.arguments = saved_args;
     this.globals.caller = calleeClosure.caller;
     calleeClosure.caller = saved_caller;
   }
 }
예제 #10
0
 public static ClosureEventMonitor Find(Closure clo)
 {
     return (ClosureEventMonitor)monitorMap[clo];
 }
예제 #11
0
 public ClosureEventMonitor(Closure closure)
 {
     this.closure = closure;
 }
예제 #12
0
 internal virtual Object Call(Object[] args, Object thisob, ScriptObject enclosing_scope, Closure calleeClosure, Binder binder, CultureInfo culture)
 {
     return(this.Call(args, thisob));
 }
예제 #13
0
 internal ArgumentsObject(ScriptObject parent, Object[] arguments, FunctionObject function, Closure callee, ScriptObject scope, ArgumentsObject caller)
     : base(parent)
 {
     this.arguments    = arguments;
     this.formal_names = function.formal_parameters;
     this.scope        = scope;
     this.callee       = callee;
     this.caller       = caller;
     this.length       = arguments.Length;
     this.noExpando    = false;
 }