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

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

Issue 2168563002: Implicitly pass 'scope()' as parent scope for function scopes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/parsing/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_PARSING_PARSER_H_ 5 #ifndef V8_PARSING_PARSER_H_
6 #define V8_PARSING_PARSER_H_ 6 #define V8_PARSING_PARSER_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 536
537 V8_INLINE void AddParameterInitializationBlock( 537 V8_INLINE void AddParameterInitializationBlock(
538 const ParserFormalParameters& parameters, 538 const ParserFormalParameters& parameters,
539 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok); 539 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok);
540 540
541 void ParseAsyncArrowSingleExpressionBody( 541 void ParseAsyncArrowSingleExpressionBody(
542 ZoneList<Statement*>* body, bool accept_IN, 542 ZoneList<Statement*>* body, bool accept_IN,
543 Type::ExpressionClassifier* classifier, int pos, bool* ok); 543 Type::ExpressionClassifier* classifier, int pos, bool* ok);
544 544
545 V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type); 545 V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type);
546 V8_INLINE Scope* NewFunctionScope(Scope* parent_scope, FunctionKind kind); 546 V8_INLINE Scope* NewFunctionScope(FunctionKind kind);
547 547
548 V8_INLINE void AddFormalParameter(ParserFormalParameters* parameters, 548 V8_INLINE void AddFormalParameter(ParserFormalParameters* parameters,
549 Expression* pattern, 549 Expression* pattern,
550 Expression* initializer, 550 Expression* initializer,
551 int initializer_end_position, bool is_rest); 551 int initializer_end_position, bool is_rest);
552 V8_INLINE void DeclareFormalParameter( 552 V8_INLINE void DeclareFormalParameter(
553 Scope* scope, const ParserFormalParameters::Parameter& parameter, 553 Scope* scope, const ParserFormalParameters::Parameter& parameter,
554 Type::ExpressionClassifier* classifier); 554 Type::ExpressionClassifier* classifier);
555 void ParseArrowFunctionFormalParameters(ParserFormalParameters* parameters, 555 void ParseArrowFunctionFormalParameters(ParserFormalParameters* parameters,
556 Expression* params, int end_pos, 556 Expression* params, int end_pos,
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 void DeclareImport(const AstRawString* local_name, int pos, bool* ok); 1041 void DeclareImport(const AstRawString* local_name, int pos, bool* ok);
1042 1042
1043 bool TargetStackContainsLabel(const AstRawString* label); 1043 bool TargetStackContainsLabel(const AstRawString* label);
1044 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); 1044 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok);
1045 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); 1045 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok);
1046 1046
1047 Statement* BuildAssertIsCoercible(Variable* var); 1047 Statement* BuildAssertIsCoercible(Variable* var);
1048 1048
1049 // Factory methods. 1049 // Factory methods.
1050 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, 1050 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super,
1051 Scope* scope, int pos, int end_pos, 1051 int pos, int end_pos,
1052 LanguageMode language_mode); 1052 LanguageMode language_mode);
1053 1053
1054 // Skip over a lazy function, either using cached data if we have it, or 1054 // Skip over a lazy function, either using cached data if we have it, or
1055 // by parsing the function with PreParser. Consumes the ending }. 1055 // by parsing the function with PreParser. Consumes the ending }.
1056 // 1056 //
1057 // If bookmark is set, the (pre-)parser may decide to abort skipping 1057 // If bookmark is set, the (pre-)parser may decide to abort skipping
1058 // in order to force the function to be eagerly parsed, after all. 1058 // in order to force the function to be eagerly parsed, after all.
1059 // In this case, it'll reset the scanner using the bookmark. 1059 // In this case, it'll reset the scanner using the bookmark.
1060 void SkipLazyFunctionBody(int* materialized_literal_count, 1060 void SkipLazyFunctionBody(int* materialized_literal_count,
1061 int* expected_property_count, bool* ok, 1061 int* expected_property_count, bool* ok,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 1140
1141 bool ParserTraits::IsFutureStrictReserved( 1141 bool ParserTraits::IsFutureStrictReserved(
1142 const AstRawString* identifier) const { 1142 const AstRawString* identifier) const {
1143 return parser_->scanner()->IdentifierIsFutureStrictReserved(identifier); 1143 return parser_->scanner()->IdentifierIsFutureStrictReserved(identifier);
1144 } 1144 }
1145 1145
1146 Scope* ParserTraits::NewScope(Scope* parent_scope, ScopeType scope_type) { 1146 Scope* ParserTraits::NewScope(Scope* parent_scope, ScopeType scope_type) {
1147 return parser_->NewScope(parent_scope, scope_type); 1147 return parser_->NewScope(parent_scope, scope_type);
1148 } 1148 }
1149 1149
1150 Scope* ParserTraits::NewFunctionScope(Scope* parent_scope, FunctionKind kind) { 1150 Scope* ParserTraits::NewFunctionScope(FunctionKind kind) {
1151 return parser_->NewFunctionScope(parent_scope, kind); 1151 return parser_->NewFunctionScope(kind);
1152 } 1152 }
1153 1153
1154 const AstRawString* ParserTraits::EmptyIdentifierString() { 1154 const AstRawString* ParserTraits::EmptyIdentifierString() {
1155 return parser_->ast_value_factory()->empty_string(); 1155 return parser_->ast_value_factory()->empty_string();
1156 } 1156 }
1157 1157
1158 1158
1159 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count, 1159 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count,
1160 int* expected_property_count, bool* ok, 1160 int* expected_property_count, bool* ok,
1161 Scanner::BookmarkScope* bookmark) { 1161 Scanner::BookmarkScope* bookmark) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 1313
1314 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { 1314 DoExpression* ParserTraits::ParseDoExpression(bool* ok) {
1315 return parser_->ParseDoExpression(ok); 1315 return parser_->ParseDoExpression(ok);
1316 } 1316 }
1317 1317
1318 1318
1319 } // namespace internal 1319 } // namespace internal
1320 } // namespace v8 1320 } // namespace v8
1321 1321
1322 #endif // V8_PARSING_PARSER_H_ 1322 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698