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

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

Issue 1871923003: Add parsing for ambient declarations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@types-devel
Patch Set: Minor fixes to address code review comments Created 4 years, 8 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_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/hashmap.h" 10 #include "src/hashmap.h"
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 V8_INLINE PreParserExpression ParseDoExpression(bool* ok); 1212 V8_INLINE PreParserExpression ParseDoExpression(bool* ok);
1213 PreParserExpression ParseFunctionLiteral( 1213 PreParserExpression ParseFunctionLiteral(
1214 PreParserIdentifier name, Scanner::Location function_name_location, 1214 PreParserIdentifier name, Scanner::Location function_name_location,
1215 FunctionNameValidity function_name_validity, FunctionKind kind, 1215 FunctionNameValidity function_name_validity, FunctionKind kind,
1216 int function_token_position, FunctionLiteral::FunctionType type, 1216 int function_token_position, FunctionLiteral::FunctionType type,
1217 LanguageMode language_mode, typesystem::TypeFlags type_flags, bool* ok); 1217 LanguageMode language_mode, typesystem::TypeFlags type_flags, bool* ok);
1218 1218
1219 PreParserExpression ParseClassLiteral(PreParserIdentifier name, 1219 PreParserExpression ParseClassLiteral(PreParserIdentifier name,
1220 Scanner::Location class_name_location, 1220 Scanner::Location class_name_location,
1221 bool name_is_strict_reserved, int pos, 1221 bool name_is_strict_reserved, int pos,
1222 bool* ok); 1222 bool ambient, bool* ok);
1223 1223
1224 PreParserExpressionList PrepareSpreadArguments(PreParserExpressionList list) { 1224 PreParserExpressionList PrepareSpreadArguments(PreParserExpressionList list) {
1225 return list; 1225 return list;
1226 } 1226 }
1227 1227
1228 inline void MaterializeUnspreadArgumentsLiterals(int count); 1228 inline void MaterializeUnspreadArgumentsLiterals(int count);
1229 1229
1230 inline PreParserExpression SpreadCall(PreParserExpression function, 1230 inline PreParserExpression SpreadCall(PreParserExpression function,
1231 PreParserExpressionList args, int pos); 1231 PreParserExpressionList args, int pos);
1232 1232
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 // By making the 'exception handling' explicit, we are forced to check 1351 // By making the 'exception handling' explicit, we are forced to check
1352 // for failure at the call sites. 1352 // for failure at the call sites.
1353 Statement ParseStatementListItem(bool* ok); 1353 Statement ParseStatementListItem(bool* ok);
1354 void ParseStatementList(int end_token, bool* ok, 1354 void ParseStatementList(int end_token, bool* ok,
1355 Scanner::BookmarkScope* bookmark = nullptr); 1355 Scanner::BookmarkScope* bookmark = nullptr);
1356 Statement ParseStatement(AllowLabelledFunctionStatement allow_function, 1356 Statement ParseStatement(AllowLabelledFunctionStatement allow_function,
1357 bool* ok); 1357 bool* ok);
1358 Statement ParseSubStatement(AllowLabelledFunctionStatement allow_function, 1358 Statement ParseSubStatement(AllowLabelledFunctionStatement allow_function,
1359 bool* ok); 1359 bool* ok);
1360 Statement ParseScopedStatement(bool legacy, bool* ok); 1360 Statement ParseScopedStatement(bool legacy, bool* ok);
1361 Statement ParseFunctionDeclaration(bool* ok); 1361 Statement ParseFunctionDeclaration(bool ambient, bool* ok);
1362 Statement ParseClassDeclaration(bool* ok); 1362 Statement ParseClassDeclaration(bool ambient, bool* ok);
1363 Statement ParseBlock(bool* ok); 1363 Statement ParseBlock(bool* ok);
1364 Statement ParseVariableStatement(VariableDeclarationContext var_context, 1364 Statement ParseVariableStatement(VariableDeclarationContext var_context,
1365 bool* ok); 1365 bool ambient, bool* ok);
1366 Statement ParseVariableDeclarations(VariableDeclarationContext var_context, 1366 Statement ParseVariableDeclarations(VariableDeclarationContext var_context,
1367 int* num_decl, bool* is_lexical, 1367 int* num_decl, bool* is_lexical,
1368 bool* is_binding_pattern, 1368 bool* is_binding_pattern,
1369 Scanner::Location* first_initializer_loc, 1369 Scanner::Location* first_initializer_loc,
1370 Scanner::Location* bindings_loc, 1370 Scanner::Location* bindings_loc,
1371 bool* ok); 1371 bool ambient, bool* ok);
1372 Statement ParseExpressionOrLabelledStatement( 1372 Statement ParseExpressionOrLabelledStatement(
1373 AllowLabelledFunctionStatement allow_function, bool* ok); 1373 AllowLabelledFunctionStatement allow_function, bool* ok);
1374 Statement ParseIfStatement(bool* ok); 1374 Statement ParseIfStatement(bool* ok);
1375 Statement ParseContinueStatement(bool* ok); 1375 Statement ParseContinueStatement(bool* ok);
1376 Statement ParseBreakStatement(bool* ok); 1376 Statement ParseBreakStatement(bool* ok);
1377 Statement ParseReturnStatement(bool* ok); 1377 Statement ParseReturnStatement(bool* ok);
1378 Statement ParseWithStatement(bool* ok); 1378 Statement ParseWithStatement(bool* ok);
1379 Statement ParseSwitchStatement(bool* ok); 1379 Statement ParseSwitchStatement(bool* ok);
1380 Statement ParseDoWhileStatement(bool* ok); 1380 Statement ParseDoWhileStatement(bool* ok);
1381 Statement ParseWhileStatement(bool* ok); 1381 Statement ParseWhileStatement(bool* ok);
(...skipping 19 matching lines...) Expand all
1401 FunctionKind kind, int function_token_pos, 1401 FunctionKind kind, int function_token_pos,
1402 FunctionLiteral::FunctionType function_type, 1402 FunctionLiteral::FunctionType function_type,
1403 LanguageMode language_mode, 1403 LanguageMode language_mode,
1404 typesystem::TypeFlags type_flags, bool* ok); 1404 typesystem::TypeFlags type_flags, bool* ok);
1405 void ParseLazyFunctionLiteralBody(bool* ok, 1405 void ParseLazyFunctionLiteralBody(bool* ok,
1406 Scanner::BookmarkScope* bookmark = nullptr); 1406 Scanner::BookmarkScope* bookmark = nullptr);
1407 1407
1408 PreParserExpression ParseClassLiteral(PreParserIdentifier name, 1408 PreParserExpression ParseClassLiteral(PreParserIdentifier name,
1409 Scanner::Location class_name_location, 1409 Scanner::Location class_name_location,
1410 bool name_is_strict_reserved, int pos, 1410 bool name_is_strict_reserved, int pos,
1411 bool* ok); 1411 bool ambient, bool* ok);
1412 }; 1412 };
1413 1413
1414 1414
1415 void PreParserTraits::MaterializeTemplateCallsiteLiterals() { 1415 void PreParserTraits::MaterializeTemplateCallsiteLiterals() {
1416 pre_parser_->function_state_->NextMaterializedLiteralIndex(); 1416 pre_parser_->function_state_->NextMaterializedLiteralIndex();
1417 pre_parser_->function_state_->NextMaterializedLiteralIndex(); 1417 pre_parser_->function_state_->NextMaterializedLiteralIndex();
1418 } 1418 }
1419 1419
1420 1420
1421 void PreParserTraits::MaterializeUnspreadArgumentsLiterals(int count) { 1421 void PreParserTraits::MaterializeUnspreadArgumentsLiterals(int count) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 const PreParserFormalParameters& parameters, FunctionKind kind, 1498 const PreParserFormalParameters& parameters, FunctionKind kind,
1499 FunctionLiteral::FunctionType function_type, bool* ok) { 1499 FunctionLiteral::FunctionType function_type, bool* ok) {
1500 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, 1500 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters,
1501 kind, function_type, ok); 1501 kind, function_type, ok);
1502 } 1502 }
1503 1503
1504 } // namespace internal 1504 } // namespace internal
1505 } // namespace v8 1505 } // namespace v8
1506 1506
1507 #endif // V8_PARSING_PREPARSER_H 1507 #endif // V8_PARSING_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | src/parsing/preparser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698