* Creates an instance of JavascriptParser. * @param {"module" | "script" | "auto"=} sourceType default source type * @param {{ parse?: ParseFunction, typescript?: boolean }=} options parser options
(sourceType = "auto", options = {})
| 541 | * @param {{ parse?: ParseFunction, typescript?: boolean }=} options parser options |
| 542 | */ |
| 543 | constructor(sourceType = "auto", options = {}) { |
| 544 | super(); |
| 545 | this.hooks = Object.freeze({ |
| 546 | /** @type {HookMap<SyncBailHook<[UnaryExpression], BasicEvaluatedExpression | null | undefined>>} */ |
| 547 | evaluateTypeof: new HookMap(() => new SyncBailHook(["expression"])), |
| 548 | /** @type {HookMap<SyncBailHook<[Expression | SpreadElement | PrivateIdentifier | Super], BasicEvaluatedExpression | null | undefined>>} */ |
| 549 | evaluate: new HookMap(() => new SyncBailHook(["expression"])), |
| 550 | /** @type {HookMap<SyncBailHook<[Identifier | ThisExpression | MemberExpression | MetaProperty], BasicEvaluatedExpression | null | undefined>>} */ |
| 551 | evaluateIdentifier: new HookMap(() => new SyncBailHook(["expression"])), |
| 552 | /** @type {HookMap<SyncBailHook<[Identifier | ThisExpression | MemberExpression], BasicEvaluatedExpression | null | undefined>>} */ |
| 553 | evaluateDefinedIdentifier: new HookMap( |
| 554 | () => new SyncBailHook(["expression"]) |
| 555 | ), |
| 556 | /** @type {HookMap<SyncBailHook<[NewExpression], BasicEvaluatedExpression | null | undefined>>} */ |
| 557 | evaluateNewExpression: new HookMap( |
| 558 | () => new SyncBailHook(["expression"]) |
| 559 | ), |
| 560 | /** @type {HookMap<SyncBailHook<[CallExpression], BasicEvaluatedExpression | null | undefined>>} */ |
| 561 | evaluateCallExpression: new HookMap( |
| 562 | () => new SyncBailHook(["expression"]) |
| 563 | ), |
| 564 | /** @type {HookMap<SyncBailHook<[CallExpression, BasicEvaluatedExpression], BasicEvaluatedExpression | null | undefined>>} */ |
| 565 | evaluateCallExpressionMember: new HookMap( |
| 566 | () => new SyncBailHook(["expression", "param"]) |
| 567 | ), |
| 568 | /** @type {HookMap<SyncBailHook<[Expression | Declaration | PrivateIdentifier | MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration, number], boolean | void>>} */ |
| 569 | isPure: new HookMap( |
| 570 | () => new SyncBailHook(["expression", "commentsStartPosition"]) |
| 571 | ), |
| 572 | /** @type {SyncBailHook<[Statement | ModuleDeclaration | MaybeNamedClassDeclaration | MaybeNamedFunctionDeclaration], boolean | void>} */ |
| 573 | preStatement: new SyncBailHook(["statement"]), |
| 574 | |
| 575 | /** @type {SyncBailHook<[Statement | ModuleDeclaration | MaybeNamedClassDeclaration | MaybeNamedFunctionDeclaration], boolean | void>} */ |
| 576 | blockPreStatement: new SyncBailHook(["declaration"]), |
| 577 | /** @type {SyncBailHook<[Statement | ModuleDeclaration | MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration], boolean | void>} */ |
| 578 | statement: new SyncBailHook(["statement"]), |
| 579 | /** @type {SyncBailHook<[IfStatement], boolean | void>} */ |
| 580 | statementIf: new SyncBailHook(["statement"]), |
| 581 | /** @type {SyncBailHook<[Expression], GuardCollection | void>} */ |
| 582 | collectGuards: new SyncBailHook(["expression"]), |
| 583 | /** @type {SyncBailHook<[Expression, ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration], boolean | void>} */ |
| 584 | classExtendsExpression: new SyncBailHook([ |
| 585 | "expression", |
| 586 | "classDefinition" |
| 587 | ]), |
| 588 | /** @type {SyncBailHook<[MethodDefinition | PropertyDefinition | StaticBlock, ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration], boolean | void>} */ |
| 589 | classBodyElement: new SyncBailHook(["element", "classDefinition"]), |
| 590 | /** @type {SyncBailHook<[Expression, MethodDefinition | PropertyDefinition, ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration], boolean | void>} */ |
| 591 | classBodyValue: new SyncBailHook([ |
| 592 | "expression", |
| 593 | "element", |
| 594 | "classDefinition" |
| 595 | ]), |
| 596 | /** @type {HookMap<SyncBailHook<[LabeledStatement], boolean | void>>} */ |
| 597 | label: new HookMap(() => new SyncBailHook(["statement"])), |
| 598 | /** @type {SyncBailHook<[ImportDeclaration, ImportSource], boolean | void>} */ |
| 599 | import: new SyncBailHook(["statement", "source"]), |
| 600 | /** @type {SyncBailHook<[ImportDeclaration, ImportSource, string | null, string], boolean | void>} */ |
nothing calls this directly
no test coverage detected