parser.h 45 KB
Newer Older
1
// Copyright 2012 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4

5 6
#ifndef V8_PARSING_PARSER_H_
#define V8_PARSING_PARSER_H_
7

8 9
#include <cstddef>

10
#include "src/ast/ast-source-ranges.h"
11
#include "src/ast/ast-value-factory.h"
12 13
#include "src/ast/ast.h"
#include "src/ast/scopes.h"
14
#include "src/base/compiler-specific.h"
15
#include "src/base/pointer-with-payload.h"
16
#include "src/base/small-vector.h"
17
#include "src/base/threaded-list.h"
18
#include "src/common/globals.h"
19
#include "src/parsing/import-assertions.h"
20
#include "src/parsing/parse-info.h"
21
#include "src/parsing/parser-base.h"
22
#include "src/parsing/parsing.h"
23
#include "src/parsing/preparser.h"
24
#include "src/zone/zone-chunk-list.h"
25

26
namespace v8 {
27

28 29
class ScriptCompiler;

30
namespace internal {
31

32
class ConsumedPreparseData;
33
class ParseInfo;
34 35
class ParserTarget;
class ParserTargetScope;
36
class PendingCompilationErrorHandler;
37
class PreparseData;
38

39 40
// ----------------------------------------------------------------------------
// JAVASCRIPT PARSING
41

42
class Parser;
43

44

45
struct ParserFormalParameters : FormalParametersBase {
46
  struct Parameter : public ZoneObject {
47
    Parameter(Expression* pattern, Expression* initializer, int position,
48
              int initializer_end_position, bool is_rest)
49
        : initializer_and_is_rest(initializer, is_rest),
50
          pattern(pattern),
51
          position(position),
52 53
          initializer_end_position(initializer_end_position) {}

54
    base::PointerWithPayload<Expression, bool, 1> initializer_and_is_rest;
55

56
    Expression* pattern;
57 58 59
    Expression* initializer() const {
      return initializer_and_is_rest.GetPointer();
    }
60
    int position;
61
    int initializer_end_position;
62
    inline bool is_rest() const { return initializer_and_is_rest.GetPayload(); }
63

64
    Parameter* next_parameter = nullptr;
65
    bool is_simple() const {
66 67
      return pattern->IsVariableProxy() && initializer() == nullptr &&
             !is_rest();
68
    }
69

70 71 72 73 74
    const AstRawString* name() const {
      DCHECK(is_simple());
      return pattern->AsVariableProxy()->raw_name();
    }

75 76
    Parameter** next() { return &next_parameter; }
    Parameter* const* next() const { return &next_parameter; }
77 78
  };

79 80 81 82 83 84
  void set_strict_parameter_error(const Scanner::Location& loc,
                                  MessageTemplate message) {
    strict_error_loc = loc;
    strict_error_message = message;
  }

85
  bool has_duplicate() const { return duplicate_loc.IsValid(); }
86 87
  void ValidateDuplicate(Parser* parser) const;
  void ValidateStrictMode(Parser* parser) const;
88

89
  explicit ParserFormalParameters(DeclarationScope* scope)
90
      : FormalParametersBase(scope) {}
91

92
  base::ThreadedList<Parameter> params;
93
  Scanner::Location duplicate_loc = Scanner::Location::invalid();
94 95
  Scanner::Location strict_error_loc = Scanner::Location::invalid();
  MessageTemplate strict_error_message = MessageTemplate::kNone;
96 97
};

98
template <>
99
struct ParserTypes<Parser> {
100 101
  using Base = ParserBase<Parser>;
  using Impl = Parser;
102 103

  // Return types for traversing functions.
104 105 106
  using Block = v8::internal::Block*;
  using BreakableStatement = v8::internal::BreakableStatement*;
  using ClassLiteralProperty = ClassLiteral::Property*;
107
  using ClassLiteralStaticElement = ClassLiteral::StaticElement*;
108
  using ClassPropertyList = ZonePtrList<ClassLiteral::Property>*;
109
  using ClassStaticElementList = ZonePtrList<ClassLiteral::StaticElement>*;
110 111 112 113 114 115 116 117 118 119 120 121
  using Expression = v8::internal::Expression*;
  using ExpressionList = ScopedPtrList<v8::internal::Expression>;
  using FormalParameters = ParserFormalParameters;
  using ForStatement = v8::internal::ForStatement*;
  using FunctionLiteral = v8::internal::FunctionLiteral*;
  using Identifier = const AstRawString*;
  using IterationStatement = v8::internal::IterationStatement*;
  using ObjectLiteralProperty = ObjectLiteral::Property*;
  using ObjectPropertyList = ScopedPtrList<v8::internal::ObjectLiteralProperty>;
  using Statement = v8::internal::Statement*;
  using StatementList = ScopedPtrList<v8::internal::Statement>;
  using Suspend = v8::internal::Suspend*;
122 123

  // For constructing objects returned by the traversing functions.
124
  using Factory = AstNodeFactory;
125

126
  // Other implementation-specific functions.
127 128 129
  using FuncNameInferrer = v8::internal::FuncNameInferrer;
  using SourceRange = v8::internal::SourceRange;
  using SourceRangeScope = v8::internal::SourceRangeScope;
130 131
};

132
class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
133
 public:
134
  Parser(LocalIsolate* local_isolate, ParseInfo* info, Handle<Script> script);
135
  ~Parser() {
136
    delete reusable_preparser_;
137
    reusable_preparser_ = nullptr;
138
  }
139

140
  static bool IsPreParser() { return false; }
141

142
  // Sets the literal on |info| if parsing succeeded.
143 144
  void ParseOnBackground(LocalIsolate* isolate, ParseInfo* info,
                         int start_position, int end_position,
145
                         int function_literal_id);
146

147 148 149 150
  // Initializes an empty scope chain for top-level scripts, or scopes which
  // consist of only the native context.
  void InitializeEmptyScopeChain(ParseInfo* info);

151 152
  // Deserialize the scope chain prior to parsing in which the script is going
  // to be executed. If the script is a top-level script, or the scope chain
153 154
  // consists of only a native context, maybe_outer_scope_info should be an
  // empty handle.
155 156 157 158
  //
  // This only deserializes the scope chain, but doesn't connect the scopes to
  // their corresponding scope infos. Therefore, looking up variables in the
  // deserialized scopes is not possible.
159 160
  template <typename IsolateT>
  void DeserializeScopeChain(IsolateT* isolate, ParseInfo* info,
161 162 163
                             MaybeHandle<ScopeInfo> maybe_outer_scope_info,
                             Scope::DeserializationMode mode =
                                 Scope::DeserializationMode::kScopesOnly);
164

165 166
  // Move statistics to Isolate
  void UpdateStatistics(Isolate* isolate, Handle<Script> script);
167 168 169 170
  void UpdateStatistics(
      Handle<Script> script,
      base::SmallVector<v8::Isolate::UseCounterFeature, 8>* use_counters,
      int* preparse_skipped);
171 172
  template <typename IsolateT>
  void HandleSourceURLComments(IsolateT* isolate, Handle<Script> script);
173

174
 private:
175
  friend class ParserBase<Parser>;
176 177
  friend struct ParserFormalParameters;
  friend class i::ExpressionScope<ParserTypes<Parser>>;
178 179 180
  friend class i::VariableDeclarationParsingScope<ParserTypes<Parser>>;
  friend class i::ParameterDeclarationParsingScope<ParserTypes<Parser>>;
  friend class i::ArrowHeadParsingScope<ParserTypes<Parser>>;
181
  friend bool v8::internal::parsing::ParseProgram(
182
      ParseInfo*, Handle<Script>, MaybeHandle<ScopeInfo> maybe_outer_scope_info,
183
      Isolate*, parsing::ReportStatisticsMode stats_mode);
184
  friend bool v8::internal::parsing::ParseFunction(
185
      ParseInfo*, Handle<SharedFunctionInfo> shared_info, Isolate*,
186
      parsing::ReportStatisticsMode stats_mode);
187

188
  bool AllowsLazyParsingWithoutUnresolvedVariables() const {
189 190 191
    return !MaybeParsingArrowhead() &&
           scope()->AllowsLazyParsingWithoutUnresolvedVariables(
               original_scope_);
192 193
  }

194 195 196
  bool parse_lazily() const { return mode_ == PARSE_LAZILY; }
  enum Mode { PARSE_LAZILY, PARSE_EAGERLY };

197
  class V8_NODISCARD ParsingModeScope {
198 199 200 201 202 203 204 205 206 207 208 209
   public:
    ParsingModeScope(Parser* parser, Mode mode)
        : parser_(parser), old_mode_(parser->mode_) {
      parser_->mode_ = mode;
    }
    ~ParsingModeScope() { parser_->mode_ = old_mode_; }

   private:
    Parser* parser_;
    Mode old_mode_;
  };

210 211 212 213 214 215 216
  // Runtime encoding of different completion modes.
  enum CompletionKind {
    kNormalCompletion,
    kThrowCompletion,
    kAbruptCompletion
  };

217 218 219
  Variable* NewTemporary(const AstRawString* name) {
    return scope()->NewTemporary(name);
  }
220

221
  void PrepareGeneratorVariables();
222

223 224 225 226 227 228 229 230
  // Sets the literal on |info| if parsing succeeded.
  void ParseProgram(Isolate* isolate, Handle<Script> script, ParseInfo* info,
                    MaybeHandle<ScopeInfo> maybe_outer_scope_info);

  // Sets the literal on |info| if parsing succeeded.
  void ParseFunction(Isolate* isolate, ParseInfo* info,
                     Handle<SharedFunctionInfo> shared_info);

231 232
  template <typename IsolateT>
  void PostProcessParseResult(IsolateT* isolate, ParseInfo* info,
233
                              FunctionLiteral* literal);
234

235
  FunctionLiteral* DoParseFunction(Isolate* isolate, ParseInfo* info,
236 237
                                   int start_position, int end_position,
                                   int function_literal_id,
238
                                   const AstRawString* raw_name);
239

240 241 242 243 244 245 246 247 248
  FunctionLiteral* DoParseDeserializedFunction(
      Isolate* isolate, MaybeHandle<ScopeInfo> maybe_outer_scope_info,
      ParseInfo* info, int start_position, int end_position,
      int function_literal_id, const AstRawString* raw_name);

  FunctionLiteral* ParseClassForInstanceMemberInitialization(
      Isolate* isolate, MaybeHandle<ScopeInfo> maybe_class_scope_info,
      int initializer_pos, int initializer_id, int initializer_end_pos);

249
  // Called by ParseProgram after setting up the scanner.
250
  FunctionLiteral* DoParseProgram(Isolate* isolate, ParseInfo* info);
251

252 253 254
  // Parse with the script as if the source is implicitly wrapped in a function.
  // We manually construct the AST and scopes for a top-level function and the
  // function wrapper.
255
  void ParseWrapped(Isolate* isolate, ParseInfo* info,
256
                    ScopedPtrList<Statement>* body, DeclarationScope* scope,
257
                    Zone* zone);
258

259 260 261 262
  void ParseREPLProgram(ParseInfo* info, ScopedPtrList<Statement>* body,
                        DeclarationScope* scope);
  Expression* WrapREPLResult(Expression* value);

263 264 265
  ZonePtrList<const AstRawString>* PrepareWrappedArguments(Isolate* isolate,
                                                           ParseInfo* info,
                                                           Zone* zone);
266

267
  PreParser* reusable_preparser() {
268
    if (reusable_preparser_ == nullptr) {
269 270
      reusable_preparser_ = new PreParser(
          &preparser_zone_, &scanner_, stack_limit_, ast_value_factory(),
271 272
          pending_error_handler(), runtime_call_stats_, v8_file_logger_,
          flags(), parsing_on_main_thread_);
273
      reusable_preparser_->set_allow_eval_cache(allow_eval_cache());
274
      preparse_data_buffer_.reserve(128);
275 276 277 278
    }
    return reusable_preparser_;
  }

279
  void ParseModuleItemList(ScopedPtrList<Statement>* body);
280 281 282 283 284 285
  Statement* ParseModuleItem();
  const AstRawString* ParseModuleSpecifier();
  void ParseImportDeclaration();
  Statement* ParseExportDeclaration();
  Statement* ParseExportDefault();
  void ParseExportStar();
286 287 288 289 290 291
  struct ExportClauseData {
    const AstRawString* export_name;
    const AstRawString* local_name;
    Scanner::Location location;
  };
  ZoneChunkList<ExportClauseData>* ParseExportClause(
292 293
      Scanner::Location* reserved_loc,
      Scanner::Location* string_literal_local_name_loc);
294 295 296 297 298 299 300 301 302 303
  struct NamedImport : public ZoneObject {
    const AstRawString* import_name;
    const AstRawString* local_name;
    const Scanner::Location location;
    NamedImport(const AstRawString* import_name, const AstRawString* local_name,
                Scanner::Location location)
        : import_name(import_name),
          local_name(local_name),
          location(location) {}
  };
304
  const AstRawString* ParseExportSpecifierName();
305
  ZonePtrList<const NamedImport>* ParseNamedImports(int pos);
306

307
  ImportAssertions* ParseImportAssertClause();
308
  Statement* BuildInitializationBlock(DeclarationParsingResult* parsing_result);
309
  Expression* RewriteReturn(Expression* return_value, int pos);
310 311
  Statement* RewriteSwitchStatement(SwitchStatement* switch_statement,
                                    Scope* scope);
312
  Block* RewriteCatchPattern(CatchInfo* catch_info);
313
  void ReportVarRedeclarationIn(const AstRawString* name, Scope* scope);
314
  Statement* RewriteTryStatement(Block* try_block, Block* catch_block,
315
                                 const SourceRange& catch_range,
316
                                 Block* finally_block,
317
                                 const SourceRange& finally_range,
318
                                 const CatchInfo& catch_info, int pos);
319
  void ParseAndRewriteGeneratorFunctionBody(int pos, FunctionKind kind,
320 321 322
                                            ScopedPtrList<Statement>* body);
  void ParseAndRewriteAsyncGeneratorFunctionBody(
      int pos, FunctionKind kind, ScopedPtrList<Statement>* body);
323
  void DeclareFunctionNameVar(const AstRawString* function_name,
324
                              FunctionSyntaxKind function_syntax_kind,
325
                              DeclarationScope* function_scope);
326

327
  Statement* DeclareFunction(const AstRawString* variable_name,
328
                             FunctionLiteral* function, VariableMode mode,
329
                             VariableKind kind, int beg_pos, int end_pos,
330 331
                             ZonePtrList<const AstRawString>* names);
  Variable* CreateSyntheticContextVariable(const AstRawString* synthetic_name);
332
  Variable* CreatePrivateNameVariable(ClassScope* scope, VariableMode mode,
333
                                      IsStaticFlag is_static_flag,
334
                                      const AstRawString* name);
335 336 337
  FunctionLiteral* CreateInitializerFunction(const char* name,
                                             DeclarationScope* scope,
                                             Statement* initializer_stmt);
338

339 340 341 342 343
  bool IdentifierEquals(const AstRawString* identifier,
                        const AstRawString* other) {
    return identifier == other;
  }

344 345 346
  Statement* DeclareClass(const AstRawString* variable_name, Expression* value,
                          ZonePtrList<const AstRawString>* names,
                          int class_token_pos, int end_pos);
347 348
  void DeclareClassVariable(ClassScope* scope, const AstRawString* name,
                            ClassInfo* class_info, int class_token_pos);
349 350 351 352 353 354 355 356 357 358 359 360 361
  void DeclareClassBrandVariable(ClassScope* scope, ClassInfo* class_info,
                                 int class_token_pos);
  void DeclarePrivateClassMember(ClassScope* scope,
                                 const AstRawString* property_name,
                                 ClassLiteralProperty* property,
                                 ClassLiteralProperty::Kind kind,
                                 bool is_static, ClassInfo* class_info);
  void DeclarePublicClassMethod(const AstRawString* class_name,
                                ClassLiteralProperty* property,
                                bool is_constructor, ClassInfo* class_info);
  void DeclarePublicClassField(ClassScope* scope,
                               ClassLiteralProperty* property, bool is_static,
                               bool is_computed_name, ClassInfo* class_info);
362
  void DeclareClassProperty(ClassScope* scope, const AstRawString* class_name,
363 364
                            ClassLiteralProperty* property, bool is_constructor,
                            ClassInfo* class_info);
365
  void DeclareClassField(ClassScope* scope, ClassLiteralProperty* property,
366 367 368
                         const AstRawString* property_name, bool is_static,
                         bool is_computed_name, bool is_private,
                         ClassInfo* class_info);
369
  void AddClassStaticBlock(Block* block, ClassInfo* class_info);
370 371
  Expression* RewriteClassLiteral(ClassScope* block_scope,
                                  const AstRawString* name,
372 373 374 375 376 377
                                  ClassInfo* class_info, int pos, int end_pos);
  Statement* DeclareNative(const AstRawString* name, int pos);

  Block* IgnoreCompletion(Statement* statement);

  Scope* NewHiddenCatchScope();
378

379 380 381 382
  bool HasCheckedSyntax() {
    return scope()->GetDeclarationScope()->has_checked_syntax();
  }

383
  void InitializeVariables(
384
      ScopedPtrList<Statement>* statements, VariableKind kind,
385
      const DeclarationParsingResult::Declaration* declaration);
386

387 388
  Block* RewriteForVarInLegacy(const ForInfo& for_info);
  void DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block,
389 390
                                        Expression** each_variable);
  Block* CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info);
391

rossberg's avatar
rossberg committed
392
  Statement* DesugarLexicalBindingsInForStatement(
393
      ForStatement* loop, Statement* init, Expression* cond, Statement* next,
394
      Statement* body, Scope* inner_scope, const ForInfo& for_info);
395

396
  FunctionLiteral* ParseFunctionLiteral(
397
      const AstRawString* name, Scanner::Location function_name_location,
398
      FunctionNameValidity function_name_validity, FunctionKind kind,
399
      int function_token_position, FunctionSyntaxKind type,
400
      LanguageMode language_mode,
401
      ZonePtrList<const AstRawString>* arguments_for_wrapped_function);
402

403 404 405 406 407
  ObjectLiteral* InitializeObjectLiteral(ObjectLiteral* object_literal) {
    object_literal->CalculateEmitStore(main_zone());
    return object_literal;
  }

408 409 410 411
  // Insert initializer statements for var-bindings shadowing parameter bindings
  // from a non-simple parameter list.
  void InsertShadowingVarBindingInitializers(Block* block);

412
  // Implement sloppy block-scoped functions, ES2015 Annex B 3.3
413
  void InsertSloppyBlockFunctionVarBindings(DeclarationScope* scope);
414

415 416 417 418 419 420
  void DeclareUnboundVariable(const AstRawString* name, VariableMode mode,
                              InitializationFlag init, int pos);
  V8_WARN_UNUSED_RESULT
  VariableProxy* DeclareBoundVariable(const AstRawString* name,
                                      VariableMode mode, int pos);
  void DeclareAndBindVariable(VariableProxy* proxy, VariableKind kind,
421 422
                              VariableMode mode, Scope* declaration_scope,
                              bool* was_added, int initializer_position);
423 424 425 426 427 428
  V8_WARN_UNUSED_RESULT
  Variable* DeclareVariable(const AstRawString* name, VariableKind kind,
                            VariableMode mode, InitializationFlag init,
                            Scope* declaration_scope, bool* was_added,
                            int begin, int end = kNoSourcePosition);
  void Declare(Declaration* declaration, const AstRawString* name,
429
               VariableKind kind, VariableMode mode, InitializationFlag init,
430
               Scope* declaration_scope, bool* was_added, int var_begin_pos,
431
               int var_end_pos = kNoSourcePosition);
432

433
  // Factory methods.
434
  FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super,
435
                                      int pos, int end_pos);
436

437 438
  // Skip over a lazy function, either using cached data if we have it, or
  // by parsing the function with PreParser. Consumes the ending }.
439 440 441 442 443 444 445
  // In case the preparser detects an error it cannot identify, it resets the
  // scanner- and preparser state to the initial one, before PreParsing the
  // function.
  // SkipFunction returns true if it correctly parsed the function, including
  // cases where we detect an error. It returns false, if we needed to stop
  // parsing or could not identify an error correctly, meaning the caller needs
  // to fully reparse. In this case it resets the scanner and preparser state.
446
  bool SkipFunction(const AstRawString* function_name, FunctionKind kind,
447
                    FunctionSyntaxKind function_syntax_kind,
448
                    DeclarationScope* function_scope, int* num_parameters,
449
                    int* function_length,
450
                    ProducedPreparseData** produced_preparsed_scope_data);
451

452
  Block* BuildParameterInitializationBlock(
453
      const ParserFormalParameters& parameters);
454 455
  Block* BuildRejectPromiseOnException(Block* block,
                                       REPLMode repl_mode = REPLMode::kNo);
456

457 458
  void ParseFunction(
      ScopedPtrList<Statement>* body, const AstRawString* function_name,
459
      int pos, FunctionKind kind, FunctionSyntaxKind function_syntax_kind,
460 461
      DeclarationScope* function_scope, int* num_parameters,
      int* function_length, bool* has_duplicate_parameters,
462
      int* expected_property_count, int* suspend_count,
463
      ZonePtrList<const AstRawString>* arguments_for_wrapped_function);
464

465
  void ThrowPendingError(Isolate* isolate, Handle<Script> script);
466

467 468 469 470 471
  class TemplateLiteral : public ZoneObject {
   public:
    TemplateLiteral(Zone* zone, int pos)
        : cooked_(8, zone), raw_(8, zone), expressions_(8, zone), pos_(pos) {}

472 473 474
    const ZonePtrList<const AstRawString>* cooked() const { return &cooked_; }
    const ZonePtrList<const AstRawString>* raw() const { return &raw_; }
    const ZonePtrList<Expression>* expressions() const { return &expressions_; }
475 476
    int position() const { return pos_; }

477 478
    void AddTemplateSpan(const AstRawString* cooked, const AstRawString* raw,
                         int end, Zone* zone) {
479 480 481 482 483 484 485 486 487 488
      DCHECK_NOT_NULL(raw);
      cooked_.Add(cooked, zone);
      raw_.Add(raw, zone);
    }

    void AddExpression(Expression* expression, Zone* zone) {
      expressions_.Add(expression, zone);
    }

   private:
489 490 491
    ZonePtrList<const AstRawString> cooked_;
    ZonePtrList<const AstRawString> raw_;
    ZonePtrList<Expression> expressions_;
492 493 494
    int pos_;
  };

495
  using TemplateLiteralState = TemplateLiteral*;
496

497
  TemplateLiteralState OpenTemplateLiteral(int pos);
498 499 500
  // "should_cook" means that the span can be "cooked": in tagged template
  // literals, both the raw and "cooked" representations are available to user
  // code ("cooked" meaning that escape sequences are converted to their
501 502
  // interpreted values). Invalid escape sequences cause the cooked span
  // to be represented by undefined, instead of being a syntax error.
503 504 505
  // "tail" indicates that this span is the last in the literal.
  void AddTemplateSpan(TemplateLiteralState* state, bool should_cook,
                       bool tail);
506 507 508 509
  void AddTemplateExpression(TemplateLiteralState* state,
                             Expression* expression);
  Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start,
                                   Expression* tag);
510

511 512
  ArrayLiteral* ArrayLiteralFromListWithSpread(
      const ScopedPtrList<Expression>& list);
513
  Expression* RewriteSuperCall(Expression* call_expression);
514

515
  void SetLanguageMode(Scope* scope, LanguageMode mode);
516
#if V8_ENABLE_WEBASSEMBLY
517
  void SetAsmModule();
518
#endif  // V8_ENABLE_WEBASSEMBLY
519

520
  Expression* RewriteSpreads(ArrayLiteral* lit);
nikolaos's avatar
nikolaos committed
521

522
  Expression* BuildInitialYield(int pos, FunctionKind kind);
523
  Assignment* BuildCreateJSGeneratorObject(int pos, FunctionKind kind);
524

525 526
  // Generic AST generator for throwing errors from compiled code.
  Expression* NewThrowError(Runtime::FunctionId function_id,
527 528
                            MessageTemplate message, const AstRawString* arg,
                            int pos);
529 530 531

  Statement* CheckCallable(Variable* var, Expression* error, int pos);

532
  void RewriteAsyncFunctionBody(ScopedPtrList<Statement>* body, Block* block,
533 534
                                Expression* return_value,
                                REPLMode repl_mode = REPLMode::kNo);
535

536
  void AddArrowFunctionFormalParameters(ParserFormalParameters* parameters,
537
                                        Expression* params, int end_pos);
538 539
  void SetFunctionName(Expression* value, const AstRawString* name,
                       const AstRawString* prefix = nullptr);
540

541 542 543 544 545
  // Helper functions for recursive descent.
  V8_INLINE bool IsEval(const AstRawString* identifier) const {
    return identifier == ast_value_factory()->eval_string();
  }

546 547 548 549
  V8_INLINE bool IsAsync(const AstRawString* identifier) const {
    return identifier == ast_value_factory()->async_string();
  }

550 551 552 553 554 555 556 557 558 559
  V8_INLINE bool IsArguments(const AstRawString* identifier) const {
    return identifier == ast_value_factory()->arguments_string();
  }

  V8_INLINE bool IsEvalOrArguments(const AstRawString* identifier) const {
    return IsEval(identifier) || IsArguments(identifier);
  }

  // Returns true if the expression is of type "this.foo".
  V8_INLINE static bool IsThisProperty(Expression* expression) {
560
    DCHECK_NOT_NULL(expression);
561
    Property* property = expression->AsProperty();
562
    return property != nullptr && property->obj()->IsThisExpression();
563 564
  }

565
  // Returns true if the expression is of type "obj.#foo" or "obj?.#foo".
566 567 568
  V8_INLINE static bool IsPrivateReference(Expression* expression) {
    DCHECK_NOT_NULL(expression);
    Property* property = expression->AsProperty();
569 570 571 572
    if (expression->IsOptionalChain()) {
      Expression* expr_inner = expression->AsOptionalChain()->expression();
      property = expr_inner->AsProperty();
    }
573 574 575
    return property != nullptr && property->IsPrivateReference();
  }

576
  // This returns true if the expression is an identifier (wrapped
577 578
  // inside a variable proxy).  We exclude the case of 'this', which
  // has been converted to a variable proxy.
579 580
  V8_INLINE static bool IsIdentifier(Expression* expression) {
    VariableProxy* operand = expression->AsVariableProxy();
581
    return operand != nullptr && !operand->is_new_target();
582 583 584 585 586 587 588
  }

  V8_INLINE static const AstRawString* AsIdentifier(Expression* expression) {
    DCHECK(IsIdentifier(expression));
    return expression->AsVariableProxy()->raw_name();
  }

589 590 591 592
  V8_INLINE VariableProxy* AsIdentifierExpression(Expression* expression) {
    return expression->AsVariableProxy();
  }

593 594 595 596
  V8_INLINE bool IsConstructor(const AstRawString* identifier) const {
    return identifier == ast_value_factory()->constructor_string();
  }

597 598 599 600
  V8_INLINE bool IsName(const AstRawString* identifier) const {
    return identifier == ast_value_factory()->name_string();
  }

601 602
  V8_INLINE static bool IsBoilerplateProperty(
      ObjectLiteral::Property* property) {
603
    return !property->IsPrototype();
604 605
  }

606 607 608 609
  V8_INLINE v8::Extension* extension() const { return info_->extension(); }

  V8_INLINE bool ParsingExtension() const { return extension() != nullptr; }

610 611 612 613 614 615 616
  V8_INLINE bool IsNative(Expression* expr) const {
    DCHECK_NOT_NULL(expr);
    return expr->IsVariableProxy() &&
           expr->AsVariableProxy()->raw_name() ==
               ast_value_factory()->native_string();
  }

617 618 619 620 621
  V8_INLINE static bool IsArrayIndex(const AstRawString* string,
                                     uint32_t* index) {
    return string->AsArrayIndex(index);
  }

622 623 624 625 626 627 628 629
  // Returns true if the statement is an expression statement containing
  // a single string literal.  If a second argument is given, the literal
  // is also compared with it and the result is true only if they are equal.
  V8_INLINE bool IsStringLiteral(Statement* statement,
                                 const AstRawString* arg = nullptr) const {
    ExpressionStatement* e_stat = statement->AsExpressionStatement();
    if (e_stat == nullptr) return false;
    Literal* literal = e_stat->expression()->AsLiteral();
630 631
    if (literal == nullptr || !literal->IsString()) return false;
    return arg == nullptr || literal->AsRawString() == arg;
632 633
  }

634 635
  V8_INLINE void GetDefaultStrings(const AstRawString** default_string,
                                   const AstRawString** dot_default_string) {
636
    *default_string = ast_value_factory()->default_string();
637
    *dot_default_string = ast_value_factory()->dot_default_string();
638 639
  }

640 641
  // Functions for encapsulating the differences between parsing and preparsing;
  // operations interleaved with the recursive descent.
642
  V8_INLINE void PushLiteralName(const AstRawString* id) {
643
    fni_.PushLiteralName(id);
644 645
  }

646
  V8_INLINE void PushVariableName(const AstRawString* id) {
647
    fni_.PushVariableName(id);
648 649
  }

650
  V8_INLINE void PushPropertyName(Expression* expression) {
651
    if (expression->IsPropertyName()) {
652
      fni_.PushLiteralName(expression->AsLiteral()->AsRawPropertyName());
653
    } else {
654
      fni_.PushLiteralName(ast_value_factory()->computed_string());
655 656 657
    }
  }

658
  V8_INLINE void PushEnclosingName(const AstRawString* name) {
659
    fni_.PushEnclosingName(name);
660 661
  }

662
  V8_INLINE void AddFunctionForNameInference(FunctionLiteral* func_to_infer) {
663
    fni_.AddFunction(func_to_infer);
664 665
  }

666
  V8_INLINE void InferFunctionName() { fni_.Infer(); }
667

668 669 670 671 672 673 674 675 676 677
  // If we assign a function literal to a property we pretenure the
  // literal so it can be added as a constant function property.
  V8_INLINE static void CheckAssigningFunctionLiteralToProperty(
      Expression* left, Expression* right) {
    DCHECK_NOT_NULL(left);
    if (left->IsProperty() && right->IsFunctionLiteral()) {
      right->AsFunctionLiteral()->set_pretenure();
    }
  }

678 679 680 681 682 683
  // Returns true if we have a binary expression between two numeric
  // literals. In that case, *x will be changed to an expression which is the
  // computed value.
  bool ShortcutNumericLiteralBinaryExpression(Expression** x, Expression* y,
                                              Token::Value op, int pos);

684 685 686 687 688
  // Returns true if we have a binary operation between a binary/n-ary
  // expression (with the same operation) and a value, which can be collapsed
  // into a single n-ary expression. In that case, *x will be changed to an
  // n-ary expression.
  bool CollapseNaryExpression(Expression** x, Expression* y, Token::Value op,
689
                              int pos, const SourceRange& range);
690

691
  // Returns a UnaryExpression or, in one of the following cases, a Literal.
692
  // ! <literal> -> true / false
693 694 695
  // + <Number literal> -> <Number literal>
  // - <Number literal> -> <Number literal with value negated>
  // ~ <literal> -> true / false
696 697 698 699
  Expression* BuildUnaryExpression(Expression* expression, Token::Value op,
                                   int pos);

  // Generate AST node that throws a ReferenceError with the given type.
700 701
  V8_INLINE Expression* NewThrowReferenceError(MessageTemplate message,
                                               int pos) {
702 703 704 705 706 707 708
    return NewThrowError(Runtime::kNewReferenceError, message,
                         ast_value_factory()->empty_string(), pos);
  }

  // Generate AST node that throws a SyntaxError with the given
  // type. The first argument may be null (in the handle sense) in
  // which case no arguments are passed to the constructor.
709
  V8_INLINE Expression* NewThrowSyntaxError(MessageTemplate message,
710 711 712 713 714 715
                                            const AstRawString* arg, int pos) {
    return NewThrowError(Runtime::kNewSyntaxError, message, arg, pos);
  }

  // Generate AST node that throws a TypeError with the given
  // type. Both arguments must be non-null (in the handle sense).
716
  V8_INLINE Expression* NewThrowTypeError(MessageTemplate message,
717 718 719 720
                                          const AstRawString* arg, int pos) {
    return NewThrowError(Runtime::kNewTypeError, message, arg, pos);
  }

721 722 723 724
  // Dummy implementation. The parser should never have a unidentifiable
  // error.
  V8_INLINE void ReportUnidentifiableError() { UNREACHABLE(); }

725 726 727 728
  const AstRawString* GetRawNameFromIdentifier(const AstRawString* arg) {
    return arg;
  }

729 730 731 732 733 734 735
  const AstRawString* PreParserIdentifierToAstRawString(
      const PreParserIdentifier& arg) {
    // This method definition is only needed due to an MSVC oddity that
    // instantiates the method despite it being unused. See crbug.com/v8/12266 .
    UNREACHABLE();
  }

736 737 738 739
  IterationStatement* AsIterationStatement(BreakableStatement* s) {
    return s->AsIterationStatement();
  }

740 741 742 743
  void ReportUnexpectedTokenAt(
      Scanner::Location location, Token::Value token,
      MessageTemplate message = MessageTemplate::kUnexpectedToken);

744
  // "null" return type creators.
745 746 747
  V8_INLINE static std::nullptr_t NullIdentifier() { return nullptr; }
  V8_INLINE static std::nullptr_t NullExpression() { return nullptr; }
  V8_INLINE static std::nullptr_t NullLiteralProperty() { return nullptr; }
748 749 750 751
  V8_INLINE static ZonePtrList<Expression>* NullExpressionList() {
    return nullptr;
  }
  V8_INLINE static ZonePtrList<Statement>* NullStatementList() {
752 753
    return nullptr;
  }
754
  V8_INLINE static std::nullptr_t NullStatement() { return nullptr; }
755
  V8_INLINE static std::nullptr_t NullBlock() { return nullptr; }
756
  Expression* FailureExpression() { return factory()->FailureExpression(); }
757 758 759 760

  template <typename T>
  V8_INLINE static bool IsNull(T subject) {
    return subject == nullptr;
761
  }
762

763 764 765 766
  V8_INLINE static bool IsIterationStatement(Statement* subject) {
    return subject->AsIterationStatement() != nullptr;
  }

767
  // Non-null empty string.
768 769 770 771
  V8_INLINE const AstRawString* EmptyIdentifierString() const {
    return ast_value_factory()->empty_string();
  }

772 773 774
  // Producing data during the recursive descent.
  V8_INLINE const AstRawString* GetSymbol() const {
    const AstRawString* result = scanner()->CurrentSymbol(ast_value_factory());
775
    DCHECK_NOT_NULL(result);
776 777 778
    return result;
  }

779 780
  V8_INLINE const AstRawString* GetIdentifier() const { return GetSymbol(); }

781 782 783 784 785 786 787
  V8_INLINE const AstRawString* GetNextSymbol() const {
    return scanner()->NextSymbol(ast_value_factory());
  }

  V8_INLINE const AstRawString* GetNumberAsSymbol() const {
    double double_value = scanner()->DoubleValue();
    char array[100];
788 789
    const char* string =
        DoubleToCString(double_value, base::ArrayVector(array));
790
    return ast_value_factory()->GetOneByteString(string);
791 792
  }

793 794
  const AstRawString* GetBigIntAsSymbol();

795 796 797
  class ThisExpression* ThisExpression() {
    UseThis();
    return factory()->ThisExpression();
798 799
  }

800 801 802 803 804
  class ThisExpression* NewThisExpression(int pos) {
    UseThis();
    return factory()->NewThisExpression(pos);
  }

805
  Expression* NewSuperPropertyReference(Scope* home_object_scope, int pos);
806 807
  Expression* NewSuperCallReference(int pos);
  Expression* NewTargetExpression(int pos);
808
  Expression* ImportMetaExpression(int pos);
809

810
  Expression* ExpressionFromLiteral(Token::Value token, int pos);
811

812 813 814
  V8_INLINE VariableProxy* ExpressionFromPrivateName(
      PrivateNameScopeIterator* private_name_scope, const AstRawString* name,
      int start_position) {
815 816
    VariableProxy* proxy = factory()->ast_node_factory()->NewVariableProxy(
        name, NORMAL_VARIABLE, start_position);
817
    private_name_scope->AddUnresolvedPrivateName(proxy);
818 819 820
    return proxy;
  }

821
  V8_INLINE VariableProxy* ExpressionFromIdentifier(
822
      const AstRawString* name, int start_position,
823
      InferName infer = InferName::kYes) {
824
    if (infer == InferName::kYes) {
825
      fni_.PushVariableName(name);
826
    }
827
    return expression_scope()->NewVariable(name, start_position);
828 829
  }

830 831 832 833 834
  V8_INLINE void DeclareIdentifier(const AstRawString* name,
                                   int start_position) {
    expression_scope()->Declare(name, start_position);
  }

835 836 837 838 839
  V8_INLINE Variable* DeclareCatchVariableName(Scope* scope,
                                               const AstRawString* name) {
    return scope->DeclareCatchVariableName(name);
  }

840
  V8_INLINE ZonePtrList<Expression>* NewExpressionList(int size) const {
841
    return zone()->New<ZonePtrList<Expression>>(size, zone());
842
  }
843
  V8_INLINE ZonePtrList<ObjectLiteral::Property>* NewObjectPropertyList(
844
      int size) const {
845
    return zone()->New<ZonePtrList<ObjectLiteral::Property>>(size, zone());
846
  }
847
  V8_INLINE ZonePtrList<ClassLiteral::Property>* NewClassPropertyList(
848
      int size) const {
849
    return zone()->New<ZonePtrList<ClassLiteral::Property>>(size, zone());
850
  }
851 852 853 854
  V8_INLINE ZonePtrList<ClassLiteral::StaticElement>* NewClassStaticElementList(
      int size) const {
    return zone()->New<ZonePtrList<ClassLiteral::StaticElement>>(size, zone());
  }
855
  V8_INLINE ZonePtrList<Statement>* NewStatementList(int size) const {
856
    return zone()->New<ZonePtrList<Statement>>(size, zone());
857 858
  }

859 860
  Expression* NewV8Intrinsic(const AstRawString* name,
                             const ScopedPtrList<Expression>& args, int pos);
861

862 863 864 865
  Expression* NewV8RuntimeFunctionForFuzzing(
      const Runtime::Function* function, const ScopedPtrList<Expression>& args,
      int pos);

866
  V8_INLINE Statement* NewThrowStatement(Expression* exception, int pos) {
867
    return factory()->NewExpressionStatement(
868
        factory()->NewThrow(exception, pos), pos);
869 870
  }

871 872 873 874 875
  V8_INLINE void AddFormalParameter(ParserFormalParameters* parameters,
                                    Expression* pattern,
                                    Expression* initializer,
                                    int initializer_end_position,
                                    bool is_rest) {
876
    parameters->UpdateArityAndFunctionLength(initializer != nullptr, is_rest);
877 878 879 880
    auto parameter =
        parameters->scope->zone()->New<ParserFormalParameters::Parameter>(
            pattern, initializer, scanner()->location().beg_pos,
            initializer_end_position, is_rest);
881 882

    parameters->params.Add(parameter);
883 884
  }

885
  V8_INLINE void DeclareFormalParameters(ParserFormalParameters* parameters) {
886 887
    bool is_simple = parameters->is_simple;
    DeclarationScope* scope = parameters->scope;
888
    if (!is_simple) scope->MakeParametersNonSimple();
889
    for (auto parameter : parameters->params) {
890
      bool is_optional = parameter->initializer() != nullptr;
891 892 893 894
      // If the parameter list is simple, declare the parameters normally with
      // their names. If the parameter list is not simple, declare a temporary
      // for each parameter - the corresponding named variable is declared by
      // BuildParamerterInitializationBlock.
895
      scope->DeclareParameter(
896
          is_simple ? parameter->name() : ast_value_factory()->empty_string(),
897
          is_simple ? VariableMode::kVar : VariableMode::kTemporary,
898
          is_optional, parameter->is_rest(), ast_value_factory(),
899
          parameter->position);
900 901 902
    }
  }

903 904 905
  void DeclareArrowFunctionFormalParameters(
      ParserFormalParameters* parameters, Expression* params,
      const Scanner::Location& params_loc);
906

907
  Expression* ExpressionListToExpression(const ScopedPtrList<Expression>& args);
908

909 910 911
  void SetFunctionNameFromPropertyName(LiteralProperty* property,
                                       const AstRawString* name,
                                       const AstRawString* prefix = nullptr);
912
  void SetFunctionNameFromPropertyName(ObjectLiteralProperty* property,
913 914
                                       const AstRawString* name,
                                       const AstRawString* prefix = nullptr);
915 916 917 918

  void SetFunctionNameFromIdentifierRef(Expression* value,
                                        Expression* identifier);

919 920 921 922
  V8_INLINE void CountUsage(v8::Isolate::UseCounterFeature feature) {
    ++use_counts_[feature];
  }

923 924 925 926 927 928
  // Returns true iff we're parsing the first function literal during
  // CreateDynamicFunction().
  V8_INLINE bool ParsingDynamicFunctionDeclaration() const {
    return parameters_end_pos_ != kNoSourcePosition;
  }

929 930 931 932 933 934 935 936 937 938 939 940
  V8_INLINE void ConvertBinaryToNaryOperationSourceRange(
      BinaryOperation* binary_op, NaryOperation* nary_op) {
    if (source_range_map_ == nullptr) return;
    DCHECK_NULL(source_range_map_->Find(nary_op));

    BinaryOperationSourceRanges* ranges =
        static_cast<BinaryOperationSourceRanges*>(
            source_range_map_->Find(binary_op));
    if (ranges == nullptr) return;

    SourceRange range = ranges->GetRange(SourceRangeKind::kRight);
    source_range_map_->Insert(
941
        nary_op, zone()->New<NaryOperationSourceRanges>(zone(), range));
942 943 944 945 946 947 948 949 950 951 952 953 954
  }

  V8_INLINE void AppendNaryOperationSourceRange(NaryOperation* node,
                                                const SourceRange& range) {
    if (source_range_map_ == nullptr) return;
    NaryOperationSourceRanges* ranges =
        static_cast<NaryOperationSourceRanges*>(source_range_map_->Find(node));
    if (ranges == nullptr) return;

    ranges->AddRange(range);
    DCHECK_EQ(node->subsequent_length(), ranges->RangeCount());
  }

955 956 957 958
  V8_INLINE void RecordBlockSourceRange(Block* node,
                                        int32_t continuation_position) {
    if (source_range_map_ == nullptr) return;
    source_range_map_->Insert(
959
        node, zone()->New<BlockSourceRanges>(continuation_position));
960 961
  }

962 963 964 965
  V8_INLINE void RecordCaseClauseSourceRange(CaseClause* node,
                                             const SourceRange& body_range) {
    if (source_range_map_ == nullptr) return;
    source_range_map_->Insert(node,
966
                              zone()->New<CaseClauseSourceRanges>(body_range));
967 968
  }

969 970 971 972 973 974
  V8_INLINE void RecordConditionalSourceRange(Expression* node,
                                              const SourceRange& then_range,
                                              const SourceRange& else_range) {
    if (source_range_map_ == nullptr) return;
    source_range_map_->Insert(
        node->AsConditional(),
975
        zone()->New<ConditionalSourceRanges>(then_range, else_range));
976 977
  }

978 979
  V8_INLINE void RecordFunctionLiteralSourceRange(FunctionLiteral* node) {
    if (source_range_map_ == nullptr) return;
980
    source_range_map_->Insert(node, zone()->New<FunctionLiteralSourceRanges>());
981 982
  }

983 984 985
  V8_INLINE void RecordBinaryOperationSourceRange(
      Expression* node, const SourceRange& right_range) {
    if (source_range_map_ == nullptr) return;
986 987 988
    source_range_map_->Insert(
        node->AsBinaryOperation(),
        zone()->New<BinaryOperationSourceRanges>(right_range));
989 990
  }

991 992 993 994 995
  V8_INLINE void RecordJumpStatementSourceRange(Statement* node,
                                                int32_t continuation_position) {
    if (source_range_map_ == nullptr) return;
    source_range_map_->Insert(
        static_cast<JumpStatement*>(node),
996
        zone()->New<JumpStatementSourceRanges>(continuation_position));
997 998 999 1000 1001 1002 1003 1004
  }

  V8_INLINE void RecordIfStatementSourceRange(Statement* node,
                                              const SourceRange& then_range,
                                              const SourceRange& else_range) {
    if (source_range_map_ == nullptr) return;
    source_range_map_->Insert(
        node->AsIfStatement(),
1005
        zone()->New<IfStatementSourceRanges>(then_range, else_range));
1006 1007 1008 1009 1010 1011
  }

  V8_INLINE void RecordIterationStatementSourceRange(
      IterationStatement* node, const SourceRange& body_range) {
    if (source_range_map_ == nullptr) return;
    source_range_map_->Insert(
1012
        node, zone()->New<IterationStatementSourceRanges>(body_range));
1013 1014
  }

1015 1016 1017 1018 1019 1020 1021 1022
  // Used to record source ranges of expressions associated with optional chain:
  V8_INLINE void RecordExpressionSourceRange(Expression* node,
                                             const SourceRange& right_range) {
    if (source_range_map_ == nullptr) return;
    source_range_map_->Insert(node,
                              zone()->New<ExpressionSourceRanges>(right_range));
  }

1023 1024 1025
  V8_INLINE void RecordSuspendSourceRange(Expression* node,
                                          int32_t continuation_position) {
    if (source_range_map_ == nullptr) return;
1026 1027 1028
    source_range_map_->Insert(
        static_cast<Suspend*>(node),
        zone()->New<SuspendSourceRanges>(continuation_position));
1029 1030
  }

1031 1032 1033 1034 1035
  V8_INLINE void RecordSwitchStatementSourceRange(
      Statement* node, int32_t continuation_position) {
    if (source_range_map_ == nullptr) return;
    source_range_map_->Insert(
        node->AsSwitchStatement(),
1036
        zone()->New<SwitchStatementSourceRanges>(continuation_position));
1037 1038 1039 1040 1041 1042 1043 1044
  }

  V8_INLINE void RecordThrowSourceRange(Statement* node,
                                        int32_t continuation_position) {
    if (source_range_map_ == nullptr) return;
    ExpressionStatement* expr_stmt = static_cast<ExpressionStatement*>(node);
    Throw* throw_expr = expr_stmt->expression()->AsThrow();
    source_range_map_->Insert(
1045
        throw_expr, zone()->New<ThrowSourceRanges>(continuation_position));
1046 1047 1048 1049 1050 1051
  }

  V8_INLINE void RecordTryCatchStatementSourceRange(
      TryCatchStatement* node, const SourceRange& body_range) {
    if (source_range_map_ == nullptr) return;
    source_range_map_->Insert(
1052
        node, zone()->New<TryCatchStatementSourceRanges>(body_range));
1053 1054 1055 1056 1057 1058
  }

  V8_INLINE void RecordTryFinallyStatementSourceRange(
      TryFinallyStatement* node, const SourceRange& body_range) {
    if (source_range_map_ == nullptr) return;
    source_range_map_->Insert(
1059
        node, zone()->New<TryFinallyStatementSourceRanges>(body_range));
1060 1061
  }

1062 1063 1064 1065
  // Generate the next internal variable name for binding an exported namespace
  // object (used to implement the "export * as" syntax).
  const AstRawString* NextInternalNamespaceExportName();

1066 1067
  ParseInfo* info() const { return info_; }

1068 1069 1070 1071
  std::vector<uint8_t>* preparse_data_buffer() {
    return &preparse_data_buffer_;
  }

1072
  // Parser's private field members.
1073
  friend class PreParserZoneScope;  // Uses reusable_preparser().
1074
  friend class PreparseDataBuilder;  // Uses preparse_data_buffer()
1075

1076
  LocalIsolate* local_isolate_;
1077
  ParseInfo* info_;
1078
  Handle<Script> script_;
1079
  Scanner scanner_;
1080
  Zone preparser_zone_;
1081
  PreParser* reusable_preparser_;
1082
  Mode mode_;
1083
  bool overall_parse_is_parked_ = false;
1084

1085 1086
  MaybeHandle<FixedArray> maybe_wrapped_arguments_;

1087 1088
  SourceRangeMap* source_range_map_ = nullptr;

1089 1090
  friend class ParserTargetScope;

1091
  ScriptCompiler::CompileOptions compile_options_;
1092

1093 1094 1095
  // For NextInternalNamespaceExportName().
  int number_of_named_namespace_exports_ = 0;

1096 1097
  // Other information which will be stored in Parser and moved to Isolate after
  // parsing.
1098
  int use_counts_[v8::Isolate::kUseCounterFeatureCount];
1099
  int total_preparse_skipped_;
1100
  bool allow_lazy_;
1101
  bool temp_zoned_;
1102
  ConsumedPreparseData* consumed_preparse_data_;
1103
  std::vector<uint8_t> preparse_data_buffer_;
1104

1105 1106 1107 1108 1109
  // If not kNoSourcePosition, indicates that the first function literal
  // encountered is a dynamic function, see CreateDynamicFunction(). This field
  // indicates the correct position of the ')' that closes the parameter list.
  // After that ')' is encountered, this field is reset to kNoSourcePosition.
  int parameters_end_pos_;
1110
};
1111

1112 1113
}  // namespace internal
}  // namespace v8
1114

1115
#endif  // V8_PARSING_PARSER_H_