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

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

Issue 2662183002: [parser] Remove hoist_scope from DeclarationDescriptor (Closed)
Patch Set: Factored out helper function Created 3 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
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/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 602
603 private: 603 private:
604 FunctionState* function_state_; 604 FunctionState* function_state_;
605 int next_materialized_literal_index_; 605 int next_materialized_literal_index_;
606 int expected_property_count_; 606 int expected_property_count_;
607 }; 607 };
608 608
609 struct DeclarationDescriptor { 609 struct DeclarationDescriptor {
610 enum Kind { NORMAL, PARAMETER }; 610 enum Kind { NORMAL, PARAMETER };
611 Scope* scope; 611 Scope* scope;
612 Scope* hoist_scope;
613 VariableMode mode; 612 VariableMode mode;
614 int declaration_pos; 613 int declaration_pos;
615 int initialization_pos; 614 int initialization_pos;
616 Kind declaration_kind; 615 Kind declaration_kind;
617 }; 616 };
618 617
619 struct DeclarationParsingResult { 618 struct DeclarationParsingResult {
620 struct Declaration { 619 struct Declaration {
621 Declaration(ExpressionT pattern, int initializer_position, 620 Declaration(ExpressionT pattern, int initializer_position,
622 ExpressionT initializer) 621 ExpressionT initializer)
(...skipping 3035 matching lines...) Expand 10 before | Expand all | Expand 10 after
3658 Consume(Token::LET); 3657 Consume(Token::LET);
3659 DCHECK(var_context != kStatement); 3658 DCHECK(var_context != kStatement);
3660 parsing_result->descriptor.mode = LET; 3659 parsing_result->descriptor.mode = LET;
3661 break; 3660 break;
3662 default: 3661 default:
3663 UNREACHABLE(); // by current callers 3662 UNREACHABLE(); // by current callers
3664 break; 3663 break;
3665 } 3664 }
3666 3665
3667 parsing_result->descriptor.scope = scope(); 3666 parsing_result->descriptor.scope = scope();
3668 parsing_result->descriptor.hoist_scope = nullptr;
3669 3667
3670 // The scope of a var/const declared variable anywhere inside a function 3668 // The scope of a var/const declared variable anywhere inside a function
3671 // is the entire function (ECMA-262, 3rd, 10.1.3, and 12.2). The scope 3669 // is the entire function (ECMA-262, 3rd, 10.1.3, and 12.2). The scope
3672 // of a let declared variable is the scope of the immediately enclosing 3670 // of a let declared variable is the scope of the immediately enclosing
3673 // block. 3671 // block.
3674 int bindings_start = peek_position(); 3672 int bindings_start = peek_position();
3675 do { 3673 do {
3676 // Parse binding pattern. 3674 // Parse binding pattern.
3677 FuncNameInferrer::State fni_state(fni_); 3675 FuncNameInferrer::State fni_state(fni_);
3678 3676
(...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after
5723 return; 5721 return;
5724 } 5722 }
5725 } 5723 }
5726 5724
5727 #undef CHECK_OK_VOID 5725 #undef CHECK_OK_VOID
5728 5726
5729 } // namespace internal 5727 } // namespace internal
5730 } // namespace v8 5728 } // namespace v8
5731 5729
5732 #endif // V8_PARSING_PARSER_BASE_H 5730 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698