コード例 #1
0
  /*
   * If either 'eval' or 'with' is used in a local scope, we must make sure
   * that all containing local scopes don't get munged. Otherwise, the
   * obfuscation would potentially introduce bugs.
   */
  private void protectScopeFromObfuscation(ScriptOrFnScope scope) {
    assert scope != null;

    if (scope == globalScope) {
      // The global scope does not get obfuscated,
      // so we don't need to worry about it...
      return;
    }

    // Find the highest local scope containing the specified scope.
    while (scope.getParentScope() != globalScope) {
      scope = scope.getParentScope();
    }

    assert scope.getParentScope() == globalScope;
    scope.preventMunging();
  }
コード例 #2
0
 /*
  * Returns the identifier for the specified symbol defined in the specified
  * scope or in any scope above it. Returns null if this symbol does not have
  * a corresponding identifier.
  */
 private JavaScriptIdentifier getIdentifier(String symbol, ScriptOrFnScope scope) {
   JavaScriptIdentifier identifier;
   while (scope != null) {
     identifier = scope.getIdentifier(symbol);
     if (identifier != null) {
       return identifier;
     }
     scope = scope.getParentScope(); // ??此代码不知何意
   }
   return null;
 }