Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: src/scopes.cc

Issue 1473243006: Reland shipping of --harmony-destructuring-bind (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | test/mozilla/mozilla.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index 6a6b8ad45c7e74a092a716b715eafe33918dcb5c..57dcb3a9fc8647539cfe66bf17e85825678a649e 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -610,7 +610,11 @@ Declaration* Scope::CheckConflictingVarDeclarations() {
int length = decls_.length();
for (int i = 0; i < length; i++) {
Declaration* decl = decls_[i];
- if (decl->mode() != VAR && !is_block_scope()) continue;
+ // We don't create a separate scope to hold the function name of a function
+ // expression, so we have to make sure not to consider it when checking for
+ // conflicts (since it's conceptually "outside" the declaration scope).
+ if (is_function_scope() && decl == function()) continue;
+ if (IsLexicalVariableMode(decl->mode()) && !is_block_scope()) continue;
const AstRawString* name = decl->proxy()->raw_name();
// Iterate through all scopes until and including the declaration scope.
@@ -620,11 +624,11 @@ Declaration* Scope::CheckConflictingVarDeclarations() {
// captured in Parser::Declare. The only conflicts we still need to check
// are lexical vs VAR, or any declarations within a declaration block scope
// vs lexical declarations in its surrounding (function) scope.
- if (decl->mode() != VAR) current = current->outer_scope_;
+ if (IsLexicalVariableMode(decl->mode())) current = current->outer_scope_;
do {
// There is a conflict if there exists a non-VAR binding.
Variable* other_var = current->variables_.Lookup(name);
- if (other_var != NULL && other_var->mode() != VAR) {
+ if (other_var != NULL && IsLexicalVariableMode(other_var->mode())) {
return decl;
}
previous = current;
« no previous file with comments | « src/flag-definitions.h ('k') | test/mozilla/mozilla.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698