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

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

Issue 2252223002: Introduce ModuleScope subclass of DeclarationScope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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-base.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_PARSING_PREPARSER_H 5 #ifndef V8_PARSING_PREPARSER_H
6 #define V8_PARSING_PREPARSER_H 6 #define V8_PARSING_PREPARSER_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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 ast_value_factory, log, this), 1029 ast_value_factory, log, this),
1030 use_counts_(nullptr) {} 1030 use_counts_(nullptr) {}
1031 1031
1032 // Pre-parse the program from the character stream; returns true on 1032 // Pre-parse the program from the character stream; returns true on
1033 // success (even if parsing failed, the pre-parse data successfully 1033 // success (even if parsing failed, the pre-parse data successfully
1034 // captured the syntax error), and false if a stack-overflow happened 1034 // captured the syntax error), and false if a stack-overflow happened
1035 // during parsing. 1035 // during parsing.
1036 PreParseResult PreParseProgram(int* materialized_literals = 0, 1036 PreParseResult PreParseProgram(int* materialized_literals = 0,
1037 bool is_module = false) { 1037 bool is_module = false) {
1038 DCHECK_NULL(scope_state_); 1038 DCHECK_NULL(scope_state_);
1039 Scope* scope = NewScriptScope(); 1039 DeclarationScope* scope = NewScriptScope();
1040 1040
1041 // ModuleDeclarationInstantiation for Source Text Module Records creates a 1041 // ModuleDeclarationInstantiation for Source Text Module Records creates a
1042 // new Module Environment Record whose outer lexical environment record is 1042 // new Module Environment Record whose outer lexical environment record is
1043 // the global scope. 1043 // the global scope.
1044 if (is_module) scope = NewModuleScope(scope); 1044 if (is_module) scope = NewModuleScope(scope);
1045 1045
1046 FunctionState top_scope(&function_state_, &scope_state_, scope, 1046 FunctionState top_scope(&function_state_, &scope_state_, scope,
1047 kNormalFunction); 1047 kNormalFunction);
1048 bool ok = true; 1048 bool ok = true;
1049 int start_position = scanner()->peek_location().beg_pos; 1049 int start_position = scanner()->peek_location().beg_pos;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 const PreParserFormalParameters& parameters, FunctionKind kind, 1259 const PreParserFormalParameters& parameters, FunctionKind kind,
1260 FunctionLiteral::FunctionType function_type, bool* ok) { 1260 FunctionLiteral::FunctionType function_type, bool* ok) {
1261 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, 1261 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters,
1262 kind, function_type, ok); 1262 kind, function_type, ok);
1263 } 1263 }
1264 1264
1265 } // namespace internal 1265 } // namespace internal
1266 } // namespace v8 1266 } // namespace v8
1267 1267
1268 #endif // V8_PARSING_PREPARSER_H 1268 #endif // V8_PARSING_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698