Skip to content

Commit

Permalink
fixed files form Closure #95
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent b9a1498 commit f5c3303
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -896,9 +896,16 @@ void defineSlot(Node n, Node parent, JSType type, boolean inferred) {
// scope where the root object appears. This helps out people
// who declare "global" names in an anonymous namespace.
Scope scopeToDeclareIn = scope;
if (n.getType() == Token.GETPROP && !scope.isGlobal() &&
isQnameRootedInGlobalScope(n)) {
Scope globalScope = scope.getGlobalScope();

// don't try to declare in the global scope if there's
// already a symbol there with this name.
if (!globalScope.isDeclared(variableName, false)) {
scopeToDeclareIn = scope.getGlobalScope();
}
}

// declared in closest scope?
if (scopeToDeclareIn.isDeclared(variableName, false)) {
Expand Down

0 comments on commit f5c3303

Please sign in to comment.