On this page

class webpack.javascript.JavascriptParser extends ParserClass

Defines the parser state base type used by this module.

new JavascriptParser(sourceType?, options?): void

Creates an instance of JavascriptParser.

Attributes
destructuringAssignmentProperties:<WeakMap>
hooks:
<Readonly> < <object> >
magicCommentContext:
{Context}
options:<object>
prevStatement:
<ClassDeclaration> | <MaybeNamedClassDeclaration> | <ClassExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ConditionalExpression> | <FunctionExpression> | <ImportExpression> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UnaryExpression> | <UpdateExpression> | <YieldExpression> | <FunctionDeclaration> | <MaybeNamedFunctionDeclaration> | <ImportDeclaration> | <ExportNamedDeclaration> | <ExportDefaultDeclaration> | <ExportAllDeclaration> | <ExpressionStatement> | <BlockStatement> | <StaticBlock> | <EmptyStatement> | <DebuggerStatement> | <WithStatement> | <ReturnStatement> | <LabeledStatement> | <BreakStatement> | <ContinueStatement> | <IfStatement> | <SwitchStatement> | <ThrowStatement> | <TryStatement> | <WhileStatement> | <DoWhileStatement> | <ForStatement> | <ForInStatement> | <ForOfStatement> | <VariableDeclaration>
semicolons:<Set>
sourceType:
<"module"> | <"auto"> | <"script">
statementPath:<StatementPathItem>
[]
ALLOWED_MEMBER_TYPES_ALL:
{3}
ALLOWED_MEMBER_TYPES_CALL_EXPRESSION:
{1}
ALLOWED_MEMBER_TYPES_EXPRESSION:
{2}
getImportAttributes:<Function>
Gets import attributes.
VariableInfo:
{typeof VariableInfo}
VariableInfoFlags:
<Readonly> < <object> >
blockPreWalkClassDeclaration(statement): void
  • statement <ClassDeclaration> | <MaybeNamedClassDeclaration> class declaration
  • Returns: <void>

Block pre walk class declaration.


blockPreWalkExportDefaultDeclaration(statement): void
  • statement {ExportDefaultDeclaration} statement
  • Returns: <void>

Block pre walk export default declaration.


blockPreWalkExportNamedDeclaration(statement): void
  • statement {ExportNamedDeclaration} statement
  • Returns: <void>

Block pre walk export named declaration.


blockPreWalkExpressionStatement(statement): void
  • statement {ExpressionStatement} expression statement
  • Returns: <void>

Block pre walk expression statement.


blockPreWalkStatement(statement): void
  • statement <ClassDeclaration> | <MaybeNamedClassDeclaration> | <FunctionDeclaration> | <MaybeNamedFunctionDeclaration> | <ImportDeclaration> | <ExportNamedDeclaration> | <ExportDefaultDeclaration> | <ExportAllDeclaration> | <ExpressionStatement> | <BlockStatement> | <StaticBlock> | <EmptyStatement> | <DebuggerStatement> | <WithStatement> | <ReturnStatement> | <LabeledStatement> | <BreakStatement> | <ContinueStatement> | <IfStatement> | <SwitchStatement> | <ThrowStatement> | <TryStatement> | <WhileStatement> | <DoWhileStatement> | <ForStatement> | <ForInStatement> | <ForOfStatement> | <VariableDeclaration> statement
  • Returns: <void>

Block pre walk statement.


blockPreWalkStatements(statements): void
  • statements <ClassDeclaration> | <FunctionDeclaration> | <ImportDeclaration> | <ExportNamedDeclaration> | <ExportDefaultDeclaration> | <ExportAllDeclaration> | <ExpressionStatement> | <BlockStatement> | <StaticBlock> | <EmptyStatement> | <DebuggerStatement> | <WithStatement> | <ReturnStatement> | <LabeledStatement> | <BreakStatement> | <ContinueStatement> | <IfStatement> | <SwitchStatement> | <ThrowStatement> | <TryStatement> | <WhileStatement> | <DoWhileStatement> | <ForStatement> | <ForInStatement> | <ForOfStatement> | <VariableDeclaration[]> statements
  • Returns: <void>

Block pre walking iterates the scope for block variable declarations


blockPreWalkVariableDeclaration(statement): void
  • statement {VariableDeclaration} variable declaration
  • Returns: <void>

Block pre walk variable declaration.


callHooksForExpression(hookMap, expr, ...args?): void
  • hookMap <HookMap><<SyncBailHook><<T>, <R>, <UnsetAdditionalOptions>>> hooks the should be called
  • expr <ClassExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ConditionalExpression> | <FunctionExpression> | <ImportExpression> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UnaryExpression> | <UpdateExpression> | <YieldExpression> | <Super> expression
  • args <AsArray><<T>> args for the hook
  • Returns: <R> | <undefined> result of hook

Call hooks for expression.


callHooksForExpressionWithFallback(hookMap, expr, fallback, defined, ...args?): void
  • hookMap <HookMap><<SyncBailHook><<T>, <R>, <UnsetAdditionalOptions>>> hooks the should be called
  • expr <ClassExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ConditionalExpression> | <FunctionExpression> | <ImportExpression> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UnaryExpression> | <UpdateExpression> | <YieldExpression> | <Super> expression info
  • fallback <Function> | <undefined> callback when variable in not handled by hooks
  • defined <Function> | <undefined> callback when variable is defined
  • args <AsArray><<T>> args for the hook
  • Returns: <R> | <undefined> result of hook

Call hooks for expression with fallback.


callHooksForInfo(hookMap, info, ...args?): void
  • hookMap <HookMap><<SyncBailHook><<T>, <R>, <UnsetAdditionalOptions>>> hooks that should be called
  • info <ExportedVariableInfo> variable info
  • args <AsArray><<T>> args for the hook
  • Returns: <R> | <undefined> result of hook

Call hooks for info.


callHooksForInfoWithFallback(hookMap, info, fallback, defined, ...args?): void

Call hooks for info with fallback.


callHooksForName(hookMap, name, ...args?): void
  • hookMap <HookMap><<SyncBailHook><<T>, <R>, <UnsetAdditionalOptions>>> hooks the should be called
  • name <string> key in map
  • args <AsArray><<T>> args for the hook
  • Returns: <R> | <undefined> result of hook

Call hooks for name.


callHooksForNameWithFallback(hookMap, name, fallback, defined, ...args?): void
  • hookMap <HookMap><<SyncBailHook><<T>, <R>, <UnsetAdditionalOptions>>> hooks the should be called
  • name <string> key in map
  • fallback <Function> | <undefined> callback when variable in not handled by hooks
  • defined <Function> | <undefined> callback when variable is defined
  • args <AsArray><<T>> args for the hook
  • Returns: <R> | <undefined> result of hook

Call hooks for name with fallback.


defineVariable(name): void
Attributes
variable name
Returns:<void>

Processes the provided name.


destructuringAssignmentPropertiesFor(node): Set
Attributes
node
Returns:<Set>
< <DestructuringAssignmentProperty> > | <undefined> destructured identifiers

Destructuring assignment properties for.


detectMode(statements): void
  • statements <ClassDeclaration> | <FunctionDeclaration> | <ImportDeclaration> | <ExportNamedDeclaration> | <ExportDefaultDeclaration> | <ExportAllDeclaration> | <ExpressionStatement> | <BlockStatement> | <StaticBlock> | <EmptyStatement> | <DebuggerStatement> | <WithStatement> | <ReturnStatement> | <LabeledStatement> | <BreakStatement> | <ContinueStatement> | <IfStatement> | <SwitchStatement> | <ThrowStatement> | <TryStatement> | <WhileStatement> | <DoWhileStatement> | <ForStatement> | <ForInStatement> | <ForOfStatement> | <VariableDeclaration> | <Directive[]> statements
  • Returns: <void>

Processes the provided statement.


enterArrayPattern(pattern, onIdent): void
  • pattern {ArrayPattern} object pattern
  • onIdent <Function> callback
  • Returns: <void>

Enter array pattern.


enterAssignmentPattern(pattern, onIdent): void
  • pattern {AssignmentPattern} object pattern
  • onIdent <Function> callback
  • Returns: <void>

Enter assignment pattern.


enterDeclaration(declaration, onIdent): void
Attributes
declaration:<Declaration>
declaration
onIdent:<Function>
on ident callback
Returns:<void>

Processes the provided declaration.


enterDestructuringAssignment(pattern, expression): ClassExpression | Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | SimpleCallExpression | NewExpression | ChainExpression | ConditionalExpression | FunctionExpression | ImportExpression | LogicalExpression | MemberExpression | MetaProperty | ObjectExpression | SequenceExpression | TaggedTemplateExpression | TemplateLiteral | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | undefined
Attributes
pattern:<Pattern>
pattern
expression:<Expression>
assignment expression
Returns:
<ClassExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ConditionalExpression> | <FunctionExpression> | <ImportExpression> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UnaryExpression> | <UpdateExpression> | <YieldExpression> | <undefined> destructuring expression

Enter destructuring assignment.


enterIdentifier(pattern, onIdent): void
  • pattern {Identifier} identifier pattern
  • onIdent <Function> callback
  • Returns: <void>

Processes the provided pattern.


enterObjectPattern(pattern, onIdent): void
  • pattern {ObjectPattern} object pattern
  • onIdent <Function> callback
  • Returns: <void>

Enter object pattern.


enterPattern(pattern, onIdent): void
  • pattern <Property> | <Identifier> | <MemberExpression> | <ObjectPattern> | <ArrayPattern> | <RestElement> | <AssignmentPattern> pattern
  • onIdent <Function> on ident callback
  • Returns: <void>

Processes the provided pattern.


enterPatterns(patterns, onIdent): void
Attributes
patterns:<string> | <Property> | <Identifier> | <MemberExpression> | <ObjectPattern> | <ArrayPattern> | <RestElement> | <AssignmentPattern[]>
patterns
onIdent:<Function>
on ident callback
Returns:<void>

Processes the provided pattern.


enterRestElement(pattern, onIdent): void
  • pattern {RestElement} object pattern
  • onIdent <Function> callback
  • Returns: <void>

Enter rest element.


evaluate(source): BasicEvaluatedExpression
Attributes
source:<string>
source code
evaluation result

Returns evaluation result.


evaluatedVariable(tagInfo): VariableInfo
Attributes
tagInfo:<TagInfo>
tag info
variable info

Evaluated variable.


evaluateExpression(expression): void
  • expression <ClassExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ConditionalExpression> | <FunctionExpression> | <ImportExpression> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UnaryExpression> | <UpdateExpression> | <YieldExpression> | <PrivateIdentifier> | <SpreadElement> | <Super> expression node
  • Returns: <BasicEvaluatedExpression> evaluation result

Evaluate expression.


extractMemberExpressionChain(expression): void
  • expression <ClassExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ConditionalExpression> | <FunctionExpression> | <ImportExpression> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UnaryExpression> | <UpdateExpression> | <YieldExpression> | <Super> a member expression
  • Returns: <object> member names (reverse order) and remaining object

Extract member expression chain.


getComments(range): void

Returns comments in the range.


getFreeInfoFromVariable(varName): object | undefined
Attributes
varName:<string>
variable name
name of the free variable and variable info for that

Gets free info from variable.


getMemberExpressionInfo(expression, allowedTypes): void
  • expression <ClassExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ConditionalExpression> | <FunctionExpression> | <ImportExpression> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UnaryExpression> | <UpdateExpression> | <YieldExpression> | <Super> a member expression
  • allowedTypes <number> which types should be returned, presented in bit mask
  • Returns: <CallExpressionInfo> | <ExpressionExpressionInfo> | <undefined> expression info

Gets member expression info.


getNameForExpression(expression): object | undefined
Attributes
expression:<Expression>
an expression
name info

Gets name for expression.


getNameInfoFromVariable(varName): object | undefined
Attributes
varName:<string>
variable name
name of the free variable and variable info for that

Gets name info from variable.


getRenameIdentifier(expr): void
  • expr <ClassExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ConditionalExpression> | <FunctionExpression> | <ImportExpression> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UnaryExpression> | <UpdateExpression> | <YieldExpression> | <SpreadElement> expression
  • Returns: <string> | <VariableInfo> | <undefined> identifier

Gets rename identifier.


getTagData(name, tag): Record
Attributes

Returns tag data.


getVariableInfo(name): ExportedVariableInfo
Attributes
variable name
info for this variable

Gets variable info.


inBlockScope(fn, inExecutedPath?): void
Attributes
inner function
inExecutedPath:<boolean>
executed state
Returns:<void>

Processes the provided fn.


inClassScope(hasThis, params, fn): void
Attributes
hasThis:<boolean>
true, when this is defined
params:
{Identifier[]} scope params
inner function
Returns:<void>

Processes the provided has thi.


inFunctionScope(hasThis, params, fn): void
Attributes
hasThis:<boolean>
true, when this is defined
params:<string> | <Identifier> | <MemberExpression> | <ObjectPattern> | <ArrayPattern> | <RestElement> | <AssignmentPattern[]>
scope params
inner function
Returns:<void>

Processes the provided has thi.


inScope(params, fn): void
Attributes
params:<string> | <Property> | <Identifier> | <MemberExpression> | <ObjectPattern> | <ArrayPattern> | <RestElement> | <AssignmentPattern[]>
scope params
inner function
Returns:<void>

Processes the provided param.


isAsiPosition(pos): boolean
Attributes
source code position
Returns:<boolean>
true when a semicolon has been inserted before this position, false if not

Checks whether this javascript parser is asi position.


isPure(expr, commentsStartPos): void
  • expr <ClassDeclaration> | <MaybeNamedClassDeclaration> | <ClassExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ConditionalExpression> | <FunctionExpression> | <ImportExpression> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UnaryExpression> | <UpdateExpression> | <YieldExpression> | <FunctionDeclaration> | <MaybeNamedFunctionDeclaration> | <PrivateIdentifier> | <VariableDeclaration> | <null> | <undefined> an expression
  • commentsStartPos <number> source position from which annotation comments are checked
  • Returns: <boolean> true, when the expression is pure

Checks whether this javascript parser is pure.


isStatementLevelExpression(expr): boolean
Attributes
expression
Returns:<boolean>
true, when the expression is a statement level expression

Checks whether this javascript parser is statement level expression.


isVariableDefined(name): boolean
Attributes
variable name
Returns:<boolean>
true, when variable is defined

Checks whether this javascript parser is variable defined.


modulePreWalkExportAllDeclaration(statement): void
  • statement {ExportAllDeclaration} statement
  • Returns: <void>

Module pre walk export all declaration.


modulePreWalkExportNamedDeclaration(statement): void
  • statement {ExportNamedDeclaration} statement
  • Returns: <void>

Module pre walk export named declaration.


modulePreWalkImportDeclaration(statement): void
  • statement {ImportDeclaration} statement
  • Returns: <void>

Module pre walk import declaration.


modulePreWalkStatements(statements): void
  • statements <ClassDeclaration> | <FunctionDeclaration> | <ImportDeclaration> | <ExportNamedDeclaration> | <ExportDefaultDeclaration> | <ExportAllDeclaration> | <ExpressionStatement> | <BlockStatement> | <StaticBlock> | <EmptyStatement> | <DebuggerStatement> | <WithStatement> | <ReturnStatement> | <LabeledStatement> | <BreakStatement> | <ContinueStatement> | <IfStatement> | <SwitchStatement> | <ThrowStatement> | <TryStatement> | <WhileStatement> | <DoWhileStatement> | <ForStatement> | <ForInStatement> | <ForOfStatement> | <VariableDeclaration[]> statements
  • Returns: <void>

Module pre walking iterates the scope for import entries


parse(source, state): ParserState
Attributes
source:<string> | <Buffer>
< <ArrayBufferLike> > | <PreparsedAst> the source to parse
the parser state
the parser state

Parses the provided source and updates the parser state.


parseCalculatedString(expression): CalculatedStringResult
Attributes
expression:<Expression>
expression

Parses calculated string.


parseCommentOptions(range): void

Parses comment options.


parseString(expression): string
Attributes
expression:<Expression>
expression
Returns:<string>
parsed string

Returns parsed string.


preWalkAssignmentExpression(expression): void
  • expression {AssignmentExpression} assignment expression
  • Returns: <void>

Pre walk assignment expression.


preWalkBlockStatement(statement): void
  • statement {BlockStatement} block statement
  • Returns: <void>

Pre walk block statement.


preWalkCatchClause(catchClause): void
  • catchClause {CatchClause} catch clause
  • Returns: <void>

Pre walk catch clause.


preWalkDoWhileStatement(statement): void
  • statement {DoWhileStatement} do while statement
  • Returns: <void>

Pre walk do while statement.


preWalkForInStatement(statement): void
  • statement {ForInStatement} for statement
  • Returns: <void>

Pre walk for in statement.


preWalkForOfStatement(statement): void
  • statement {ForOfStatement} statement
  • Returns: <void>

Pre walk for of statement.


preWalkForStatement(statement): void
  • statement {ForStatement} for statement
  • Returns: <void>

Pre walk for statement.


preWalkFunctionDeclaration(statement): void
  • statement <FunctionDeclaration> | <MaybeNamedFunctionDeclaration> function declaration
  • Returns: <void>

Pre walk function declaration.


preWalkIfStatement(statement): void
  • statement {IfStatement} if statement
  • Returns: <void>

Pre walk if statement.


preWalkLabeledStatement(statement): void
  • statement {LabeledStatement} with statement
  • Returns: <void>

Pre walk labeled statement.


preWalkStatement(statement): void
  • statement <ClassDeclaration> | <MaybeNamedClassDeclaration> | <FunctionDeclaration> | <MaybeNamedFunctionDeclaration> | <ImportDeclaration> | <ExportNamedDeclaration> | <ExportDefaultDeclaration> | <ExportAllDeclaration> | <ExpressionStatement> | <BlockStatement> | <StaticBlock> | <EmptyStatement> | <DebuggerStatement> | <WithStatement> | <ReturnStatement> | <LabeledStatement> | <BreakStatement> | <ContinueStatement> | <IfStatement> | <SwitchStatement> | <ThrowStatement> | <TryStatement> | <WhileStatement> | <DoWhileStatement> | <ForStatement> | <ForInStatement> | <ForOfStatement> | <VariableDeclaration> statement
  • Returns: <void>

Walking iterates the statements and expressions and processes them


preWalkStatements(statements): void
  • statements <ClassDeclaration> | <FunctionDeclaration> | <ImportDeclaration> | <ExportNamedDeclaration> | <ExportDefaultDeclaration> | <ExportAllDeclaration> | <ExpressionStatement> | <BlockStatement> | <StaticBlock> | <EmptyStatement> | <DebuggerStatement> | <WithStatement> | <ReturnStatement> | <LabeledStatement> | <BreakStatement> | <ContinueStatement> | <IfStatement> | <SwitchStatement> | <ThrowStatement> | <TryStatement> | <WhileStatement> | <DoWhileStatement> | <ForStatement> | <ForInStatement> | <ForOfStatement> | <VariableDeclaration[]> statements
  • Returns: <void>

Pre walking iterates the scope for variable declarations


preWalkSwitchCases(switchCases): void
  • switchCases {SwitchCase[]} switch statement
  • Returns: <void>

Pre walk switch cases.


preWalkSwitchStatement(statement): void
  • statement {SwitchStatement} switch statement
  • Returns: <void>

Pre walk switch statement.


preWalkTryStatement(statement): void
  • statement {TryStatement} try statement
  • Returns: <void>

Pre walk try statement.


preWalkVariableDeclaration(statement): void
  • statement {VariableDeclaration} variable declaration
  • Returns: <void>

Pre walk variable declaration.


preWalkVariableDeclarator(declarator): void
  • declarator {VariableDeclarator} variable declarator
  • Returns: <void>

Pre walk variable declarator.


preWalkWhileStatement(statement): void
  • statement {WhileStatement} while statement
  • Returns: <void>

Pre walk while statement.


preWalkWithStatement(statement): void
  • statement {WithStatement} with statement
  • Returns: <void>

Pre walk with statement.


setAsiPosition(pos): void
Attributes
source code position
Returns:<void>

Updates asi position using the provided po.


setVariable(name, variableInfo): void
Attributes
variable name
new info for this variable
Returns:<void>

Updates variable using the provided name.


tagVariable(name, tag, data?, flags?): void
Attributes
name
tag info
flags:
<0> | <2> | <1> | <4> flags
Returns:<void>

Processes the provided name.


undefineVariable(name): void
Attributes
variable name
Returns:<void>

Processes the provided name.


unsetAsiPosition(pos): void
Attributes
source code position
Returns:<void>

Unset asi position.


walkArrayExpression(expression): void
  • expression {ArrayExpression} array expression
  • Returns: <void>

Walk array expression.


walkArrayPattern(pattern): void
  • pattern {ArrayPattern} array pattern
  • Returns: <void>

Walk array pattern.


walkArrowFunctionExpression(expression): void
  • expression {ArrowFunctionExpression} arrow function expression
  • Returns: <void>

Walk arrow function expression.


walkAssignmentExpression(expression): void
  • expression {AssignmentExpression} assignment expression
  • Returns: <void>

Walk assignment expression.


walkAssignmentPattern(pattern): void
  • pattern {AssignmentPattern} assignment pattern
  • Returns: <void>

Walk assignment pattern.


walkAwaitExpression(expression): void
  • expression {AwaitExpression} await expression
  • Returns: <void>

Walk await expression.


walkBinaryExpression(expression): void
  • expression {BinaryExpression} the binary expression
  • Returns: <void>

Walk binary expression.


walkBlockStatement(statement): void
  • statement <BlockStatement> | <StaticBlock> block statement
  • Returns: <void>

Walk block statement.


walkCallExpression(expression): void
Attributes
expression:<CallExpression>
expression
Returns:<void>

Walk call expression.


walkCatchClause(catchClause): void
  • catchClause {CatchClause} catch clause
  • Returns: <void>

Processes the provided catch clause.


walkChainExpression(expression): void
  • expression {ChainExpression} expression
  • Returns: <void>

Walk chain expression.


walkClass(classy): void
  • classy <ClassDeclaration> | <MaybeNamedClassDeclaration> | <ClassExpression> a class node
  • Returns: <void>

Processes the provided classy.


walkClassDeclaration(statement): void
  • statement <ClassDeclaration> | <MaybeNamedClassDeclaration> class declaration
  • Returns: <void>

Walk class declaration.


walkClassExpression(expression): void
  • expression {ClassExpression} the class expression
  • Returns: <void>

Walk class expression.


walkConditionalExpression(expression): void
  • expression {ConditionalExpression} conditional expression
  • Returns: <void>

Walk conditional expression.


walkDoWhileStatement(statement): void
  • statement {DoWhileStatement} do while statement
  • Returns: <void>

Walk do while statement.


walkExportDefaultDeclaration(statement): void
  • statement {ExportDefaultDeclaration} statement
  • Returns: <void>

Walk export default declaration.


walkExportNamedDeclaration(statement): void
  • statement {ExportNamedDeclaration} the statement
  • Returns: <void>

Walk export named declaration.


walkExpression(expression): void
  • expression <ClassExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ConditionalExpression> | <FunctionExpression> | <ImportExpression> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UnaryExpression> | <UpdateExpression> | <YieldExpression> | <PrivateIdentifier> | <SpreadElement> | <Super> expression
  • Returns: <void>

Processes the provided expression.


walkExpressions(expressions): void
  • expressions <ClassExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ConditionalExpression> | <FunctionExpression> | <ImportExpression> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UnaryExpression> | <UpdateExpression> | <YieldExpression> | <SpreadElement> | <null>[] expressions
  • Returns: <void>

Processes the provided expression.


walkExpressionStatement(statement): void
  • statement {ExpressionStatement} expression statement
  • Returns: <void>

Walk expression statement.


walkForInStatement(statement): void
  • statement {ForInStatement} for statement
  • Returns: <void>

Walk for in statement.


walkForOfStatement(statement): void
  • statement {ForOfStatement} for statement
  • Returns: <void>

Walk for of statement.


walkForStatement(statement): void
  • statement {ForStatement} for statement
  • Returns: <void>

Walk for statement.


walkFunctionDeclaration(statement): void
  • statement <FunctionDeclaration> | <MaybeNamedFunctionDeclaration> function declaration
  • Returns: <void>

Walk function declaration.


walkFunctionExpression(expression): void
  • expression {FunctionExpression} arrow function expression
  • Returns: <void>

Walk function expression.


walkIdentifier(expression): void
  • expression {Identifier} identifier
  • Returns: <void>

Processes the provided expression.


walkIfStatement(statement): void
  • statement {IfStatement} if statement
  • Returns: <void>

Processes the provided statement.


walkImportExpression(expression): void
Attributes
import expression
Returns:<void>

Walk import expression.


walkLabeledStatement(statement): void
  • statement {LabeledStatement} with statement
  • Returns: <void>

Walk labeled statement.


walkLeftRightExpression(expression): void
  • expression <BinaryExpression> | <LogicalExpression> the expression
  • Returns: <void>

Walk left right expression.


walkLogicalExpression(expression): void
  • expression {LogicalExpression} the logical expression
  • Returns: <void>

Walk logical expression.


walkMemberExpression(expression): void
  • expression {MemberExpression} member expression
  • Returns: <void>

Walk member expression.


walkMemberExpressionWithExpressionName(expression, name, rootInfo, members, onUnhandled): void

Walk member expression with expression name.


walkMetaProperty(metaProperty): void
  • metaProperty {MetaProperty} meta property
  • Returns: <void>

Walk meta property.


walkNestedStatement(statement): void
Attributes
statement:<Statement>
the nested statement
Returns:<void>

Walks a statements that is nested within a parent statement and can potentially be a non-block statement. This enforces the nested statement to never be in ASI position.


walkNewExpression(expression): void
  • expression {NewExpression} new expression
  • Returns: <void>

Walk new expression.


walkObjectExpression(expression): void
  • expression {ObjectExpression} object expression
  • Returns: <void>

Walk object expression.


walkObjectPattern(pattern): void
  • pattern {ObjectPattern} pattern
  • Returns: <void>

Walk object pattern.


walkPattern(pattern): void
Attributes
pattern:<Pattern>
pattern
Returns:<void>

Processes the provided pattern.


walkProperty(prop): void
  • prop <Property> | <SpreadElement> property or spread element
  • Returns: <void>

Processes the provided prop.


walkRestElement(pattern): void
  • pattern {RestElement} rest element
  • Returns: <void>

Processes the provided pattern.


walkReturnStatement(statement): void
  • statement {ReturnStatement} return statement
  • Returns: <void>

Walk return statement.


walkSequenceExpression(expression): void
  • expression {SequenceExpression} the sequence
  • Returns: <void>

Walk sequence expression.


walkSpreadElement(expression): void
  • expression {SpreadElement} spread element
  • Returns: <void>

Walk spread element.


walkStatement(statement): void
  • statement <ClassDeclaration> | <MaybeNamedClassDeclaration> | <FunctionDeclaration> | <MaybeNamedFunctionDeclaration> | <ImportDeclaration> | <ExportNamedDeclaration> | <ExportDefaultDeclaration> | <ExportAllDeclaration> | <ExpressionStatement> | <BlockStatement> | <StaticBlock> | <EmptyStatement> | <DebuggerStatement> | <WithStatement> | <ReturnStatement> | <LabeledStatement> | <BreakStatement> | <ContinueStatement> | <IfStatement> | <SwitchStatement> | <ThrowStatement> | <TryStatement> | <WhileStatement> | <DoWhileStatement> | <ForStatement> | <ForInStatement> | <ForOfStatement> | <VariableDeclaration> statement
  • Returns: <void>

Processes the provided statement.


walkStatements(statements): void
  • statements <ClassDeclaration> | <FunctionDeclaration> | <ImportDeclaration> | <ExportNamedDeclaration> | <ExportDefaultDeclaration> | <ExportAllDeclaration> | <ExpressionStatement> | <BlockStatement> | <StaticBlock> | <EmptyStatement> | <DebuggerStatement> | <WithStatement> | <ReturnStatement> | <LabeledStatement> | <BreakStatement> | <ContinueStatement> | <IfStatement> | <SwitchStatement> | <ThrowStatement> | <TryStatement> | <WhileStatement> | <DoWhileStatement> | <ForStatement> | <ForInStatement> | <ForOfStatement> | <VariableDeclaration[]> statements
  • Returns: <void>

Walking iterates the statements and expressions and processes them


walkSwitchCases(switchCases): void
  • switchCases {SwitchCase[]} switch statement
  • Returns: <void>

Processes the provided switch case.


walkSwitchStatement(statement): void
  • statement {SwitchStatement} switch statement
  • Returns: <void>

Walk switch statement.


walkTaggedTemplateExpression(expression): void
  • expression {TaggedTemplateExpression} tagged template expression
  • Returns: <void>

Walk tagged template expression.


walkTemplateLiteral(expression): void
  • expression {TemplateLiteral} template literal
  • Returns: <void>

Walk template literal.


walkTerminatingStatement(statement): void
  • statement <ReturnStatement> | <ThrowStatement> return or throw statement
  • Returns: <void>

Walk terminating statement.


walkThisExpression(expression): void
  • expression {ThisExpression} this expression
  • Returns: <void>

Walk this expression.


walkThrowStatement(statement): void
  • statement {ThrowStatement} return statement
  • Returns: <void>

Walk throw statement.


walkTryStatement(statement): void
  • statement {TryStatement} try statement
  • Returns: <void>

Walk try statement.


walkUnaryExpression(expression): void
  • expression {UnaryExpression} the unary expression
  • Returns: <void>

Walk unary expression.


walkUpdateExpression(expression): void
  • expression {UpdateExpression} the update expression
  • Returns: <void>

Walk update expression.


walkVariableDeclaration(statement): void
  • statement {VariableDeclaration} variable declaration
  • Returns: <void>

Walk variable declaration.


walkWhileStatement(statement): void
  • statement {WhileStatement} while statement
  • Returns: <void>

Walk while statement.


walkWithStatement(statement): void
  • statement {WithStatement} with statement
  • Returns: <void>

Walk with statement.


walkYieldExpression(expression): void
  • expression {YieldExpression} yield expression
  • Returns: <void>

Walk yield expression.


Attributes
plugins:<Function>
[] parser plugin
Returns:
{typeof JavascriptParser} parser

Returns parser.

Attributes
conditional:
range:
<Tuple> < <number> , <number> >
value:<string>

Attributes
calleeName:<string>
getCalleeMembers:<Function>
getMemberRanges:<Function>
getMembers:<Function>
getMembersOptionals:<Function>
type:
{"call"}

Type:
<FunctionDeclaration> | <VariableDeclaration> | <ClassDeclaration>

Helper function for joining two ranges into a single range. This is useful when working with AST nodes, as it allows you to combine the ranges of child nodes to create the range of the parent node.

Attributes
loc:
{SourceLocation}
range:
<Tuple> < <number> , <number> >
shorthand:<string> | <boolean>


Type:
<ImportExpressionImport> | <UnaryExpression> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ClassExpression> | <ConditionalExpression> | <FunctionExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UpdateExpression> | <YieldExpression>

Attributes
getMemberRanges:<Function>
getMembers:<Function>
getMembersOptionals:<Function>
type:
{"expression"}

Type:<undefined> | <null> | <string> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral>


Attributes
harmonyNamedExports:<Set>
harmonyStarExports:<HarmonyStarExportsList>
lastHarmonyImportOrder:<number>
localModules:<LocalModule>
[]

Type:
<Identifier> | <MemberExpression> | <ObjectPattern> | <ArrayPattern> | <RestElement> | <AssignmentPattern>

Type:
<FunctionDeclaration> | <VariableDeclaration> | <ClassDeclaration> | <ExpressionStatement> | <BlockStatement> | <StaticBlock> | <EmptyStatement> | <DebuggerStatement> | <WithStatement> | <ReturnStatement> | <LabeledStatement> | <BreakStatement> | <ContinueStatement> | <IfStatement> | <SwitchStatement> | <ThrowStatement> | <TryStatement> | <WhileStatement> | <DoWhileStatement> | <ForStatement> | <ForInStatement> | <ForOfStatement>

Type:
<ImportDeclaration> | <ExportNamedDeclaration> | <ExportAllDeclaration> | <ImportExpressionImport> | <UnaryExpression> | <ArrayExpression> | <ArrowFunctionExpression> | <AssignmentExpression> | <AwaitExpression> | <BinaryExpression> | <SimpleCallExpression> | <NewExpression> | <ChainExpression> | <ClassExpression> | <ConditionalExpression> | <FunctionExpression> | <Identifier> | <SimpleLiteral> | <RegExpLiteral> | <BigIntLiteral> | <LogicalExpression> | <MemberExpression> | <MetaProperty> | <ObjectExpression> | <SequenceExpression> | <TaggedTemplateExpression> | <TemplateLiteral> | <ThisExpression> | <UpdateExpression> | <YieldExpression> | <FunctionDeclaration> | <MaybeNamedFunctionDeclaration> | <VariableDeclaration> | <ClassDeclaration> | <MaybeNamedClassDeclaration> | <ExpressionStatement> | <BlockStatement> | <StaticBlock> | <EmptyStatement> | <DebuggerStatement> | <WithStatement> | <ReturnStatement> | <LabeledStatement> | <BreakStatement> | <ContinueStatement> | <IfStatement> | <SwitchStatement> | <ThrowStatement> | <TryStatement> | <WhileStatement> | <DoWhileStatement> | <ForStatement> | <ForInStatement> | <ForOfStatement> | <ExportDefaultDeclaration>