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

Side by Side Diff: src/parser.h

Issue 1318023004: Do not permit binding over catch parameters in for-of (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PARSER_H_ 5 #ifndef V8_PARSER_H_
6 #define V8_PARSER_H_ 6 #define V8_PARSER_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/compiler.h" // TODO(titzer): remove this include dependency 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 // declarations from different scopes. It covers for example 1127 // declarations from different scopes. It covers for example
1128 // 1128 //
1129 // function f() { { { var x; } let x; } } 1129 // function f() { { { var x; } let x; } }
1130 // function g() { { var x; let x; } } 1130 // function g() { { var x; let x; } }
1131 // 1131 //
1132 // The var declarations are hoisted to the function scope, but originate from 1132 // The var declarations are hoisted to the function scope, but originate from
1133 // a scope where the name has also been let bound or the var declaration is 1133 // a scope where the name has also been let bound or the var declaration is
1134 // hoisted over such a scope. 1134 // hoisted over such a scope.
1135 void CheckConflictingVarDeclarations(Scope* scope, bool* ok); 1135 void CheckConflictingVarDeclarations(Scope* scope, bool* ok);
1136 1136
1137 // Catch statements introduce some odd scoping constraints. You can't put a
1138 // for-of statement that tries to bind to the same identifier as the
1139 // CatchParameter, for example. (see B.3.5)
1140 bool IsDeclaredAsCatchParameter(Scope* scope, const AstRawString* name);
1141
1137 // Parser support 1142 // Parser support
1138 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode); 1143 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode);
1139 Variable* Declare(Declaration* declaration, 1144 Variable* Declare(Declaration* declaration,
1140 DeclarationDescriptor::Kind declaration_kind, bool resolve, 1145 DeclarationDescriptor::Kind declaration_kind, bool resolve,
1141 bool* ok, Scope* declaration_scope = nullptr); 1146 bool* ok, Scope* declaration_scope = nullptr);
1142 1147
1143 bool TargetStackContainsLabel(const AstRawString* label); 1148 bool TargetStackContainsLabel(const AstRawString* label);
1144 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); 1149 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok);
1145 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); 1150 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok);
1146 1151
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 parser_->BuildParameterInitializationBlock(parameters, ok); 1372 parser_->BuildParameterInitializationBlock(parameters, ok);
1368 if (!*ok) return; 1373 if (!*ok) return;
1369 if (init_block != nullptr) { 1374 if (init_block != nullptr) {
1370 body->Add(init_block, parser_->zone()); 1375 body->Add(init_block, parser_->zone());
1371 } 1376 }
1372 } 1377 }
1373 } 1378 }
1374 } } // namespace v8::internal 1379 } } // namespace v8::internal
1375 1380
1376 #endif // V8_PARSER_H_ 1381 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698