Chromium Code Reviews| Index: src/parsing/parser.cc |
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
| index 83f24273a7efd2c4a5449608efa2fb0a221cfb07..e1fb38dc5ac2b88c3098a978f688ecdf177d82a3 100644 |
| --- a/src/parsing/parser.cc |
| +++ b/src/parsing/parser.cc |
| @@ -920,7 +920,8 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) { |
| ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone()); |
| bool ok = true; |
| int beg_pos = scanner()->location().beg_pos; |
| - if (info->is_module()) { |
| + parsing_module_ = info->is_module(); |
| + if (parsing_module_) { |
| ParseModuleItemList(body, &ok); |
| } else { |
| // Don't count the mode in the use counters--give the program a chance |
| @@ -1355,7 +1356,7 @@ void* Parser::ParseExportClause(ZoneList<const AstRawString*>* export_names, |
| // Keep track of the first reserved word encountered in case our |
| // caller needs to report an error. |
| if (!reserved_loc->IsValid() && |
| - !Token::IsIdentifier(name_tok, STRICT, false)) { |
| + !Token::IsIdentifier(name_tok, STRICT, false, true)) { |
|
adamk
2016/04/22 22:03:04
Please just pass parsing_module_ for readability h
mike3
2016/04/22 23:05:58
Acknowledged.
|
| *reserved_loc = scanner()->location(); |
| } |
| const AstRawString* local_name = ParseIdentifierName(CHECK_OK); |
| @@ -1406,7 +1407,7 @@ ZoneList<ImportDeclaration*>* Parser::ParseNamedImports(int pos, bool* ok) { |
| if (CheckContextualKeyword(CStrVector("as"))) { |
| local_name = ParseIdentifierName(CHECK_OK); |
| } |
| - if (!Token::IsIdentifier(scanner()->current_token(), STRICT, false)) { |
| + if (!Token::IsIdentifier(scanner()->current_token(), STRICT, false, true)) { |
|
adamk
2016/04/22 22:03:04
And here
mike3
2016/04/22 23:05:58
Acknowledged.
|
| *ok = false; |
| ReportMessage(MessageTemplate::kUnexpectedReserved); |
| return NULL; |
| @@ -4612,7 +4613,7 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser( |
| } |
| PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( |
| language_mode(), function_state_->kind(), scope_->has_simple_parameters(), |
| - logger, bookmark); |
| + parsing_module_, logger, bookmark); |
| if (pre_parse_timer_ != NULL) { |
| pre_parse_timer_->Stop(); |
| } |