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

Side by Side Diff: src/scopes.h

Issue 885243002: Implement parsing of ES6 Rest Parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [parsing]: eval/arguments parameter names are ok in sloppy mode Created 5 years, 10 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 | « src/preparser.h ('k') | test/cctest/test-parsing.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_SCOPES_H_ 5 #ifndef V8_SCOPES_H_
6 #define V8_SCOPES_H_ 6 #define V8_SCOPES_H_
7 7
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/zone.h" 9 #include "src/zone.h"
10 10
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 // Strict mode support. 460 // Strict mode support.
461 bool IsDeclared(const AstRawString* name) { 461 bool IsDeclared(const AstRawString* name) {
462 // During formal parameter list parsing the scope only contains 462 // During formal parameter list parsing the scope only contains
463 // two variables inserted at initialization: "this" and "arguments". 463 // two variables inserted at initialization: "this" and "arguments".
464 // "this" is an invalid parameter name and "arguments" is invalid parameter 464 // "this" is an invalid parameter name and "arguments" is invalid parameter
465 // name in strict mode. Therefore looking up with the map which includes 465 // name in strict mode. Therefore looking up with the map which includes
466 // "this" and "arguments" in addition to all formal parameters is safe. 466 // "this" and "arguments" in addition to all formal parameters is safe.
467 return variables_.Lookup(name) != NULL; 467 return variables_.Lookup(name) != NULL;
468 } 468 }
469 469
470 bool IsDeclaredParameter(const AstRawString* name) {
471 // If IsSimpleParameterList is false, duplicate parameters are not allowed,
472 // however `arguments` may be allowed if function is not strict code. Thus,
473 // the assumptions explained above do not hold.
474 Variable* var = variables_.Lookup(name);
475 return var != NULL && params_.Contains(var);
476 }
477
470 // --------------------------------------------------------------------------- 478 // ---------------------------------------------------------------------------
471 // Debugging. 479 // Debugging.
472 480
473 #ifdef DEBUG 481 #ifdef DEBUG
474 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively 482 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively
475 #endif 483 #endif
476 484
477 // --------------------------------------------------------------------------- 485 // ---------------------------------------------------------------------------
478 // Implementation. 486 // Implementation.
479 protected: 487 protected:
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 Scope* outer_scope, 699 Scope* outer_scope,
692 Handle<ScopeInfo> scope_info); 700 Handle<ScopeInfo> scope_info);
693 701
694 AstValueFactory* ast_value_factory_; 702 AstValueFactory* ast_value_factory_;
695 Zone* zone_; 703 Zone* zone_;
696 }; 704 };
697 705
698 } } // namespace v8::internal 706 } } // namespace v8::internal
699 707
700 #endif // V8_SCOPES_H_ 708 #endif // V8_SCOPES_H_
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698