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

Side by Side Diff: src/parsing/parser-base.h

Issue 2297643002: Move DeclarationDescriptor to ParserBase. (Closed)
Patch Set: Created 4 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 | « src/parsing/parser.cc ('k') | src/parsing/pattern-rewriter.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_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/hashmap.h" 10 #include "src/base/hashmap.h"
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 } 625 }
626 ~ParsingModeScope() { 626 ~ParsingModeScope() {
627 parser_->mode_ = old_mode_; 627 parser_->mode_ = old_mode_;
628 } 628 }
629 629
630 private: 630 private:
631 ParserBase* parser_; 631 ParserBase* parser_;
632 Mode old_mode_; 632 Mode old_mode_;
633 }; 633 };
634 634
635 struct DeclarationDescriptor {
nickie 2016/08/30 14:04:34 (I'm wondering...) Would it be better if this wer
636 enum Kind { NORMAL, PARAMETER };
637 Scope* scope;
638 Scope* hoist_scope;
639 VariableMode mode;
640 int declaration_pos;
641 int initialization_pos;
642 Kind declaration_kind;
643 };
644
645 struct DeclarationParsingResult {
646 struct Declaration {
647 Declaration(ExpressionT pattern, int initializer_position,
648 ExpressionT initializer)
649 : pattern(pattern),
650 initializer_position(initializer_position),
651 initializer(initializer) {}
652
653 ExpressionT pattern;
654 int initializer_position;
655 ExpressionT initializer;
656 };
657
658 DeclarationParsingResult()
659 : declarations(4),
660 first_initializer_loc(Scanner::Location::invalid()),
661 bindings_loc(Scanner::Location::invalid()) {}
662
663 DeclarationDescriptor descriptor;
664 List<Declaration> declarations;
665 Scanner::Location first_initializer_loc;
666 Scanner::Location bindings_loc;
667 };
668
635 DeclarationScope* NewScriptScope() const { 669 DeclarationScope* NewScriptScope() const {
636 return new (zone()) DeclarationScope(zone()); 670 return new (zone()) DeclarationScope(zone());
637 } 671 }
638 672
639 DeclarationScope* NewVarblockScope() const { 673 DeclarationScope* NewVarblockScope() const {
640 return new (zone()) DeclarationScope(zone(), scope(), BLOCK_SCOPE); 674 return new (zone()) DeclarationScope(zone(), scope(), BLOCK_SCOPE);
641 } 675 }
642 676
643 ModuleScope* NewModuleScope(DeclarationScope* parent) const { 677 ModuleScope* NewModuleScope(DeclarationScope* parent) const {
644 return new (zone()) ModuleScope(parent, ast_value_factory()); 678 return new (zone()) ModuleScope(parent, ast_value_factory());
(...skipping 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after
3696 has_seen_constructor_ = true; 3730 has_seen_constructor_ = true;
3697 return; 3731 return;
3698 } 3732 }
3699 } 3733 }
3700 3734
3701 3735
3702 } // namespace internal 3736 } // namespace internal
3703 } // namespace v8 3737 } // namespace v8
3704 3738
3705 #endif // V8_PARSING_PARSER_BASE_H 3739 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/pattern-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698