Exemple #1
0
 public JSValue GetBindingValue(string key)
 {
     for (JSEnvRec lex = this.LexicalEnv; lex != null; lex = lex.Parent)
     {
         JSValue r;
         if (lex.TryGetBindingValue(key, out r))
         {
             return(r);
         }
     }
     throw new JSRuntimeException("ReferenceError", key + " is not defined");
 }
Exemple #2
0
 internal virtual JSValue GetFunctionWithThis(string key, out JSValue lThisObj)
 {
     for (JSEnvRec lex = this.LexicalEnv; lex != null; lex = lex.Parent)
     {
         JSValue r;
         if (lex.TryGetBindingValue(key, out r))
         {
             if (lex is JSObjectScope)
             {
                 lThisObj = ((JSObjectScope)lex).ScopeObject;
                 return(r);
             }
             lThisObj = JSUndefined.Instance;
             return(r);
         }
     }
     throw new JSRuntimeException("ReferenceError", key + " is not defined");
 }