mirror of https://github.com/webpack/webpack.git
				
				
				
			refactor: types more
This commit is contained in:
		
							parent
							
								
									e719e60340
								
							
						
					
					
						commit
						30390058ef
					
				|  | @ -16,11 +16,10 @@ const memoize = require("../util/memoize"); | ||||||
| const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); | const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); | ||||||
| 
 | 
 | ||||||
| /** @typedef {import("acorn").Options} AcornOptions */ | /** @typedef {import("acorn").Options} AcornOptions */ | ||||||
| /** @typedef {import("estree").ArrayExpression} ArrayExpressionNode */ |  | ||||||
| /** @typedef {import("estree").AssignmentExpression} AssignmentExpression */ | /** @typedef {import("estree").AssignmentExpression} AssignmentExpression */ | ||||||
| /** @typedef {import("estree").BinaryExpression} BinaryExpressionNode */ | /** @typedef {import("estree").BinaryExpression} BinaryExpression */ | ||||||
| /** @typedef {import("estree").BlockStatement} BlockStatementNode */ | /** @typedef {import("estree").BlockStatement} BlockStatementNode */ | ||||||
| /** @typedef {import("estree").SequenceExpression} SequenceExpressionNode */ | /** @typedef {import("estree").SequenceExpression} SequenceExpression */ | ||||||
| /** @typedef {import("estree").CallExpression} CallExpressionNode */ | /** @typedef {import("estree").CallExpression} CallExpressionNode */ | ||||||
| /** @typedef {import("estree").BaseCallExpression} BaseCallExpression */ | /** @typedef {import("estree").BaseCallExpression} BaseCallExpression */ | ||||||
| /** @typedef {import("estree").StaticBlock} StaticBlock */ | /** @typedef {import("estree").StaticBlock} StaticBlock */ | ||||||
|  | @ -31,20 +30,34 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); | ||||||
| /** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */ | /** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */ | ||||||
| /** @typedef {import("estree").ClassExpression} ClassExpression */ | /** @typedef {import("estree").ClassExpression} ClassExpression */ | ||||||
| /** @typedef {import("estree").Comment} CommentNode */ | /** @typedef {import("estree").Comment} CommentNode */ | ||||||
| /** @typedef {import("estree").ConditionalExpression} ConditionalExpressionNode */ | /** @typedef {import("estree").ConditionalExpression} ConditionalExpression */ | ||||||
| /** @typedef {import("estree").Declaration} DeclarationNode */ | /** @typedef {import("estree").Declaration} DeclarationNode */ | ||||||
| /** @typedef {import("estree").PrivateIdentifier} PrivateIdentifierNode */ | /** @typedef {import("estree").PrivateIdentifier} PrivateIdentifier */ | ||||||
| /** @typedef {import("estree").PropertyDefinition} PropertyDefinition */ | /** @typedef {import("estree").PropertyDefinition} PropertyDefinition */ | ||||||
| /** @typedef {import("estree").Expression} ExpressionNode */ | /** @typedef {import("estree").Expression} ExpressionNode */ | ||||||
| /** @typedef {import("estree").Identifier} IdentifierNode */ | /** @typedef {import("estree").Identifier} Identifier */ | ||||||
| /** @typedef {import("estree").VariableDeclaration} VariableDeclaration */ | /** @typedef {import("estree").VariableDeclaration} VariableDeclaration */ | ||||||
| /** @typedef {import("estree").IfStatement} IfStatement */ | /** @typedef {import("estree").IfStatement} IfStatement */ | ||||||
| /** @typedef {import("estree").LabeledStatement} LabeledStatement */ | /** @typedef {import("estree").LabeledStatement} LabeledStatement */ | ||||||
| /** @typedef {import("estree").Literal} LiteralNode */ | /** @typedef {import("estree").Literal} LiteralNode */ | ||||||
| /** @typedef {import("estree").LogicalExpression} LogicalExpressionNode */ | /** @typedef {import("estree").LogicalExpression} LogicalExpression */ | ||||||
| /** @typedef {import("estree").ChainExpression} ChainExpressionNode */ | /** @typedef {import("estree").ChainExpression} ChainExpressionNode */ | ||||||
| /** @typedef {import("estree").MemberExpression} MemberExpressionNode */ | /** @typedef {import("estree").MemberExpression} MemberExpressionNode */ | ||||||
| /** @typedef {import("estree").MetaProperty} MetaPropertyNode */ | /** @typedef {import("estree").MetaProperty} MetaPropertyNode */ | ||||||
|  | /** @typedef {import("estree").Property} Property */ | ||||||
|  | /** @typedef {import("estree").AssignmentPattern} AssignmentPattern */ | ||||||
|  | /** @typedef {import("estree").UpdateExpression} UpdateExpression */ | ||||||
|  | /** @typedef {import("estree").ObjectExpression} ObjectExpression */ | ||||||
|  | /** @typedef {import("estree").UnaryExpression} UnaryExpression */ | ||||||
|  | /** @typedef {import("estree").ArrayExpression} ArrayExpression */ | ||||||
|  | /** @typedef {import("estree").BlockStatement} BlockStatement */ | ||||||
|  | /** @typedef {import("estree").ArrayPattern} ArrayPattern */ | ||||||
|  | /** @typedef {import("estree").AwaitExpression} AwaitExpression */ | ||||||
|  | /** @typedef {import("estree").ThisExpression} ThisExpression */ | ||||||
|  | /** @typedef {import("estree").RestElement} RestElement */ | ||||||
|  | /** @typedef {import("estree").ObjectPattern} ObjectPattern */ | ||||||
|  | /** @typedef {import("estree").SwitchCase} SwitchCase */ | ||||||
|  | /** @typedef {import("estree").CatchClause} CatchClause */ | ||||||
| /** @typedef {import("estree").VariableDeclarator} VariableDeclarator */ | /** @typedef {import("estree").VariableDeclarator} VariableDeclarator */ | ||||||
| /** @typedef {import("estree").ForInStatement} ForInStatement */ | /** @typedef {import("estree").ForInStatement} ForInStatement */ | ||||||
| /** @typedef {import("estree").ForOfStatement} ForOfStatement */ | /** @typedef {import("estree").ForOfStatement} ForOfStatement */ | ||||||
|  | @ -52,8 +65,9 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); | ||||||
| /** @typedef {import("estree").WithStatement} WithStatement */ | /** @typedef {import("estree").WithStatement} WithStatement */ | ||||||
| /** @typedef {import("estree").ThrowStatement} ThrowStatement */ | /** @typedef {import("estree").ThrowStatement} ThrowStatement */ | ||||||
| /** @typedef {import("estree").MethodDefinition} MethodDefinition */ | /** @typedef {import("estree").MethodDefinition} MethodDefinition */ | ||||||
| /** @typedef {import("estree").ModuleDeclaration} ModuleDeclarationNode */ | /** @typedef {import("estree").ModuleDeclaration} ModuleDeclaration */ | ||||||
| /** @typedef {import("estree").NewExpression} NewExpressionNode */ | /** @typedef {import("estree").NewExpression} NewExpression */ | ||||||
|  | /** @typedef {import("estree").SpreadElement} SpreadElement */ | ||||||
| /** @typedef {import("estree").WhileStatement} WhileStatement */ | /** @typedef {import("estree").WhileStatement} WhileStatement */ | ||||||
| /** @typedef {import("estree").ExpressionStatement} ExpressionStatement */ | /** @typedef {import("estree").ExpressionStatement} ExpressionStatement */ | ||||||
| /** @typedef {import("estree").FunctionDeclaration} FunctionDeclaration */ | /** @typedef {import("estree").FunctionDeclaration} FunctionDeclaration */ | ||||||
|  | @ -62,12 +76,12 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); | ||||||
| /** @typedef {import("estree").Node} AnyNode */ | /** @typedef {import("estree").Node} AnyNode */ | ||||||
| /** @typedef {import("estree").Program} ProgramNode */ | /** @typedef {import("estree").Program} ProgramNode */ | ||||||
| /** @typedef {import("estree").Statement} StatementNode */ | /** @typedef {import("estree").Statement} StatementNode */ | ||||||
| /** @typedef {import("estree").ImportDeclaration} ImportDeclarationNode */ | /** @typedef {import("estree").ImportDeclaration} ImportDeclaration */ | ||||||
| /** @typedef {import("estree").ExportDefaultDeclaration} ExportDefaultDeclaration */ | /** @typedef {import("estree").ExportDefaultDeclaration} ExportDefaultDeclaration */ | ||||||
| /** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclarationNode */ | /** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclarationNode */ | ||||||
| /** @typedef {import("estree").Super} SuperNode */ | /** @typedef {import("estree").Super} SuperNode */ | ||||||
| /** @typedef {import("estree").TaggedTemplateExpression} TaggedTemplateExpressionNode */ | /** @typedef {import("estree").TaggedTemplateExpression} TaggedTemplateExpression */ | ||||||
| /** @typedef {import("estree").TemplateLiteral} TemplateLiteralNode */ | /** @typedef {import("estree").TemplateLiteral} TemplateLiteral */ | ||||||
| /** @typedef {import("estree").ThisExpression} ThisExpressionNode */ | /** @typedef {import("estree").ThisExpression} ThisExpressionNode */ | ||||||
| /** @typedef {import("estree").UnaryExpression} UnaryExpressionNode */ | /** @typedef {import("estree").UnaryExpression} UnaryExpressionNode */ | ||||||
| /** @typedef {import("estree").VariableDeclarator} VariableDeclaratorNode */ | /** @typedef {import("estree").VariableDeclarator} VariableDeclaratorNode */ | ||||||
|  | @ -115,7 +129,7 @@ class VariableInfo { | ||||||
|  * @typedef {Object} ScopeInfo |  * @typedef {Object} ScopeInfo | ||||||
|  * @property {StackedMap<string, VariableInfo | ScopeInfo>} definitions |  * @property {StackedMap<string, VariableInfo | ScopeInfo>} definitions | ||||||
|  * @property {boolean | "arrow"} topLevelScope |  * @property {boolean | "arrow"} topLevelScope | ||||||
|  * @property {boolean} inShorthand |  * @property {boolean | string} inShorthand | ||||||
|  * @property {boolean} isStrict |  * @property {boolean} isStrict | ||||||
|  * @property {boolean} isAsmJs |  * @property {boolean} isAsmJs | ||||||
|  * @property {boolean} inTry |  * @property {boolean} inTry | ||||||
|  | @ -224,13 +238,13 @@ class JavascriptParser extends Parser { | ||||||
| 			evaluateTypeof: new HookMap(() => new SyncBailHook(["expression"])), | 			evaluateTypeof: new HookMap(() => new SyncBailHook(["expression"])), | ||||||
| 			/** @type {HookMap<SyncBailHook<[ExpressionNode], BasicEvaluatedExpression | undefined | null>>} */ | 			/** @type {HookMap<SyncBailHook<[ExpressionNode], BasicEvaluatedExpression | undefined | null>>} */ | ||||||
| 			evaluate: new HookMap(() => new SyncBailHook(["expression"])), | 			evaluate: new HookMap(() => new SyncBailHook(["expression"])), | ||||||
| 			/** @type {HookMap<SyncBailHook<[IdentifierNode | ThisExpressionNode | MemberExpressionNode | MetaPropertyNode], BasicEvaluatedExpression | undefined | null>>} */ | 			/** @type {HookMap<SyncBailHook<[Identifier | ThisExpressionNode | MemberExpressionNode | MetaPropertyNode], BasicEvaluatedExpression | undefined | null>>} */ | ||||||
| 			evaluateIdentifier: new HookMap(() => new SyncBailHook(["expression"])), | 			evaluateIdentifier: new HookMap(() => new SyncBailHook(["expression"])), | ||||||
| 			/** @type {HookMap<SyncBailHook<[IdentifierNode | ThisExpressionNode | MemberExpressionNode], BasicEvaluatedExpression | undefined | null>>} */ | 			/** @type {HookMap<SyncBailHook<[Identifier | ThisExpressionNode | MemberExpressionNode], BasicEvaluatedExpression | undefined | null>>} */ | ||||||
| 			evaluateDefinedIdentifier: new HookMap( | 			evaluateDefinedIdentifier: new HookMap( | ||||||
| 				() => new SyncBailHook(["expression"]) | 				() => new SyncBailHook(["expression"]) | ||||||
| 			), | 			), | ||||||
| 			/** @type {HookMap<SyncBailHook<[NewExpressionNode], BasicEvaluatedExpression | undefined | null>>} */ | 			/** @type {HookMap<SyncBailHook<[NewExpression], BasicEvaluatedExpression | undefined | null>>} */ | ||||||
| 			evaluateNewExpression: new HookMap( | 			evaluateNewExpression: new HookMap( | ||||||
| 				() => new SyncBailHook(["expression"]) | 				() => new SyncBailHook(["expression"]) | ||||||
| 			), | 			), | ||||||
|  | @ -242,16 +256,16 @@ class JavascriptParser extends Parser { | ||||||
| 			evaluateCallExpressionMember: new HookMap( | 			evaluateCallExpressionMember: new HookMap( | ||||||
| 				() => new SyncBailHook(["expression", "param"]) | 				() => new SyncBailHook(["expression", "param"]) | ||||||
| 			), | 			), | ||||||
| 			/** @type {HookMap<SyncBailHook<[ExpressionNode | DeclarationNode | PrivateIdentifierNode, number], boolean | void>>} */ | 			/** @type {HookMap<SyncBailHook<[ExpressionNode | DeclarationNode | PrivateIdentifier, number], boolean | void>>} */ | ||||||
| 			isPure: new HookMap( | 			isPure: new HookMap( | ||||||
| 				() => new SyncBailHook(["expression", "commentsStartPosition"]) | 				() => new SyncBailHook(["expression", "commentsStartPosition"]) | ||||||
| 			), | 			), | ||||||
| 			/** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ | 			/** @type {SyncBailHook<[StatementNode | ModuleDeclaration], boolean | void>} */ | ||||||
| 			preStatement: new SyncBailHook(["statement"]), | 			preStatement: new SyncBailHook(["statement"]), | ||||||
| 
 | 
 | ||||||
| 			/** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ | 			/** @type {SyncBailHook<[StatementNode | ModuleDeclaration], boolean | void>} */ | ||||||
| 			blockPreStatement: new SyncBailHook(["declaration"]), | 			blockPreStatement: new SyncBailHook(["declaration"]), | ||||||
| 			/** @type {SyncBailHook<[StatementNode | ModuleDeclarationNode], boolean | void>} */ | 			/** @type {SyncBailHook<[StatementNode | ModuleDeclaration], boolean | void>} */ | ||||||
| 			statement: new SyncBailHook(["statement"]), | 			statement: new SyncBailHook(["statement"]), | ||||||
| 			/** @type {SyncBailHook<[IfStatement], boolean | void>} */ | 			/** @type {SyncBailHook<[IfStatement], boolean | void>} */ | ||||||
| 			statementIf: new SyncBailHook(["statement"]), | 			statementIf: new SyncBailHook(["statement"]), | ||||||
|  | @ -270,9 +284,9 @@ class JavascriptParser extends Parser { | ||||||
| 			]), | 			]), | ||||||
| 			/** @type {HookMap<SyncBailHook<[LabeledStatement], boolean | void>>} */ | 			/** @type {HookMap<SyncBailHook<[LabeledStatement], boolean | void>>} */ | ||||||
| 			label: new HookMap(() => new SyncBailHook(["statement"])), | 			label: new HookMap(() => new SyncBailHook(["statement"])), | ||||||
| 			/** @type {SyncBailHook<[ImportDeclarationNode, ImportSource], boolean | void>} */ | 			/** @type {SyncBailHook<[ImportDeclaration, ImportSource], boolean | void>} */ | ||||||
| 			import: new SyncBailHook(["statement", "source"]), | 			import: new SyncBailHook(["statement", "source"]), | ||||||
| 			/** @type {SyncBailHook<[ImportDeclarationNode, ImportSource, string, string], boolean | void>} */ | 			/** @type {SyncBailHook<[ImportDeclaration, ImportSource, string, string], boolean | void>} */ | ||||||
| 			importSpecifier: new SyncBailHook([ | 			importSpecifier: new SyncBailHook([ | ||||||
| 				"statement", | 				"statement", | ||||||
| 				"source", | 				"source", | ||||||
|  | @ -314,7 +328,7 @@ class JavascriptParser extends Parser { | ||||||
| 			varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])), | 			varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])), | ||||||
| 			/** @type {HookMap<SyncBailHook<[DeclarationNode], boolean | void>>} */ | 			/** @type {HookMap<SyncBailHook<[DeclarationNode], boolean | void>>} */ | ||||||
| 			varDeclarationVar: new HookMap(() => new SyncBailHook(["declaration"])), | 			varDeclarationVar: new HookMap(() => new SyncBailHook(["declaration"])), | ||||||
| 			/** @type {HookMap<SyncBailHook<[IdentifierNode], boolean | void>>} */ | 			/** @type {HookMap<SyncBailHook<[Identifier], boolean | void>>} */ | ||||||
| 			pattern: new HookMap(() => new SyncBailHook(["pattern"])), | 			pattern: new HookMap(() => new SyncBailHook(["pattern"])), | ||||||
| 			/** @type {HookMap<SyncBailHook<[ExpressionNode], boolean | void>>} */ | 			/** @type {HookMap<SyncBailHook<[ExpressionNode], boolean | void>>} */ | ||||||
| 			canRename: new HookMap(() => new SyncBailHook(["initExpression"])), | 			canRename: new HookMap(() => new SyncBailHook(["initExpression"])), | ||||||
|  | @ -363,9 +377,9 @@ class JavascriptParser extends Parser { | ||||||
| 			), | 			), | ||||||
| 			/** @type {SyncBailHook<[ChainExpressionNode], boolean | void>} */ | 			/** @type {SyncBailHook<[ChainExpressionNode], boolean | void>} */ | ||||||
| 			optionalChaining: new SyncBailHook(["optionalChaining"]), | 			optionalChaining: new SyncBailHook(["optionalChaining"]), | ||||||
| 			/** @type {HookMap<SyncBailHook<[NewExpressionNode], boolean | void>>} */ | 			/** @type {HookMap<SyncBailHook<[NewExpression], boolean | void>>} */ | ||||||
| 			new: new HookMap(() => new SyncBailHook(["expression"])), | 			new: new HookMap(() => new SyncBailHook(["expression"])), | ||||||
| 			/** @type {SyncBailHook<[BinaryExpressionNode], boolean | void>} */ | 			/** @type {SyncBailHook<[BinaryExpression], boolean | void>} */ | ||||||
| 			binaryExpression: new SyncBailHook(["binaryExpression"]), | 			binaryExpression: new SyncBailHook(["binaryExpression"]), | ||||||
| 			/** @type {HookMap<SyncBailHook<[ExpressionNode], boolean | void>>} */ | 			/** @type {HookMap<SyncBailHook<[ExpressionNode], boolean | void>>} */ | ||||||
| 			expression: new HookMap(() => new SyncBailHook(["expression"])), | 			expression: new HookMap(() => new SyncBailHook(["expression"])), | ||||||
|  | @ -434,7 +448,7 @@ class JavascriptParser extends Parser { | ||||||
| 			} | 			} | ||||||
| 		}); | 		}); | ||||||
| 		this.hooks.evaluate.for("NewExpression").tap("JavascriptParser", _expr => { | 		this.hooks.evaluate.for("NewExpression").tap("JavascriptParser", _expr => { | ||||||
| 			const expr = /** @type {NewExpressionNode} */ (_expr); | 			const expr = /** @type {NewExpression} */ (_expr); | ||||||
| 			const callee = expr.callee; | 			const callee = expr.callee; | ||||||
| 			if (callee.type !== "Identifier") return; | 			if (callee.type !== "Identifier") return; | ||||||
| 			if (callee.name !== "RegExp") { | 			if (callee.name !== "RegExp") { | ||||||
|  | @ -495,7 +509,7 @@ class JavascriptParser extends Parser { | ||||||
| 		this.hooks.evaluate | 		this.hooks.evaluate | ||||||
| 			.for("LogicalExpression") | 			.for("LogicalExpression") | ||||||
| 			.tap("JavascriptParser", _expr => { | 			.tap("JavascriptParser", _expr => { | ||||||
| 				const expr = /** @type {LogicalExpressionNode} */ (_expr); | 				const expr = /** @type {LogicalExpression} */ (_expr); | ||||||
| 
 | 
 | ||||||
| 				const left = this.evaluateExpression(expr.left); | 				const left = this.evaluateExpression(expr.left); | ||||||
| 				let returnRight = false; | 				let returnRight = false; | ||||||
|  | @ -554,13 +568,13 @@ class JavascriptParser extends Parser { | ||||||
| 		 * import("./" + foo + bar); // webpack will auto evaluate this into import("./foobar")
 | 		 * import("./" + foo + bar); // webpack will auto evaluate this into import("./foobar")
 | ||||||
| 		 * ``` | 		 * ``` | ||||||
| 		 * @param {boolean | number | BigInt | string} value the value to convert to an expression | 		 * @param {boolean | number | BigInt | string} value the value to convert to an expression | ||||||
| 		 * @param {BinaryExpressionNode | UnaryExpressionNode} expr the expression being evaluated | 		 * @param {BinaryExpression | UnaryExpressionNode} expr the expression being evaluated | ||||||
| 		 * @param {boolean} sideEffects whether the expression has side effects | 		 * @param {boolean} sideEffects whether the expression has side effects | ||||||
| 		 * @returns {BasicEvaluatedExpression} the evaluated expression | 		 * @returns {BasicEvaluatedExpression} the evaluated expression | ||||||
| 		 * @example | 		 * @example | ||||||
| 		 * | 		 * | ||||||
| 		 * ```js
 | 		 * ```js
 | ||||||
| 		 * const binaryExpr = new BinaryExpressionNode("+", | 		 * const binaryExpr = new BinaryExpression("+", | ||||||
| 		 * 	{ type: "Literal", value: 2 }, | 		 * 	{ type: "Literal", value: 2 }, | ||||||
| 		 * 	{ type: "Literal", value: 3 } | 		 * 	{ type: "Literal", value: 3 } | ||||||
| 		 * ); | 		 * ); | ||||||
|  | @ -605,7 +619,7 @@ class JavascriptParser extends Parser { | ||||||
| 		this.hooks.evaluate | 		this.hooks.evaluate | ||||||
| 			.for("BinaryExpression") | 			.for("BinaryExpression") | ||||||
| 			.tap("JavascriptParser", _expr => { | 			.tap("JavascriptParser", _expr => { | ||||||
| 				const expr = /** @type {BinaryExpressionNode} */ (_expr); | 				const expr = /** @type {BinaryExpression} */ (_expr); | ||||||
| 
 | 
 | ||||||
| 				/** | 				/** | ||||||
| 				 * Evaluates a binary expression if and only if it is a const operation (e.g. 1 + 2, "a" + "b", etc.). | 				 * Evaluates a binary expression if and only if it is a const operation (e.g. 1 + 2, "a" + "b", etc.). | ||||||
|  | @ -1086,7 +1100,7 @@ class JavascriptParser extends Parser { | ||||||
| 				.setRange(expr.range); | 				.setRange(expr.range); | ||||||
| 		}); | 		}); | ||||||
| 		this.hooks.evaluate.for("Identifier").tap("JavascriptParser", expr => { | 		this.hooks.evaluate.for("Identifier").tap("JavascriptParser", expr => { | ||||||
| 			if (/** @type {IdentifierNode} */ (expr).name === "undefined") { | 			if (/** @type {Identifier} */ (expr).name === "undefined") { | ||||||
| 				return new BasicEvaluatedExpression() | 				return new BasicEvaluatedExpression() | ||||||
| 					.setUndefined() | 					.setUndefined() | ||||||
| 					.setRange(expr.range); | 					.setRange(expr.range); | ||||||
|  | @ -1145,9 +1159,7 @@ class JavascriptParser extends Parser { | ||||||
| 			}); | 			}); | ||||||
| 		}; | 		}; | ||||||
| 		tapEvaluateWithVariableInfo("Identifier", expr => { | 		tapEvaluateWithVariableInfo("Identifier", expr => { | ||||||
| 			const info = this.getVariableInfo( | 			const info = this.getVariableInfo(/** @type {Identifier} */ (expr).name); | ||||||
| 				/** @type {IdentifierNode} */ (expr).name |  | ||||||
| 			); |  | ||||||
| 			if ( | 			if ( | ||||||
| 				typeof info === "string" || | 				typeof info === "string" || | ||||||
| 				(info instanceof VariableInfo && typeof info.freeName === "string") | 				(info instanceof VariableInfo && typeof info.freeName === "string") | ||||||
|  | @ -1297,7 +1309,7 @@ class JavascriptParser extends Parser { | ||||||
| 
 | 
 | ||||||
| 		/** | 		/** | ||||||
| 		 * @param {"cooked" | "raw"} kind kind of values to get | 		 * @param {"cooked" | "raw"} kind kind of values to get | ||||||
| 		 * @param {TemplateLiteralNode} templateLiteralExpr TemplateLiteral expr | 		 * @param {TemplateLiteral} templateLiteralExpr TemplateLiteral expr | ||||||
| 		 * @returns {{quasis: BasicEvaluatedExpression[], parts: BasicEvaluatedExpression[]}} Simplified template | 		 * @returns {{quasis: BasicEvaluatedExpression[], parts: BasicEvaluatedExpression[]}} Simplified template | ||||||
| 		 */ | 		 */ | ||||||
| 		const getSimplifiedTemplateResult = (kind, templateLiteralExpr) => { | 		const getSimplifiedTemplateResult = (kind, templateLiteralExpr) => { | ||||||
|  | @ -1348,7 +1360,7 @@ class JavascriptParser extends Parser { | ||||||
| 		this.hooks.evaluate | 		this.hooks.evaluate | ||||||
| 			.for("TemplateLiteral") | 			.for("TemplateLiteral") | ||||||
| 			.tap("JavascriptParser", _node => { | 			.tap("JavascriptParser", _node => { | ||||||
| 				const node = /** @type {TemplateLiteralNode} */ (_node); | 				const node = /** @type {TemplateLiteral} */ (_node); | ||||||
| 
 | 
 | ||||||
| 				const { quasis, parts } = getSimplifiedTemplateResult("cooked", node); | 				const { quasis, parts } = getSimplifiedTemplateResult("cooked", node); | ||||||
| 				if (parts.length === 1) { | 				if (parts.length === 1) { | ||||||
|  | @ -1361,7 +1373,7 @@ class JavascriptParser extends Parser { | ||||||
| 		this.hooks.evaluate | 		this.hooks.evaluate | ||||||
| 			.for("TaggedTemplateExpression") | 			.for("TaggedTemplateExpression") | ||||||
| 			.tap("JavascriptParser", _node => { | 			.tap("JavascriptParser", _node => { | ||||||
| 				const node = /** @type {TaggedTemplateExpressionNode} */ (_node); | 				const node = /** @type {TaggedTemplateExpression} */ (_node); | ||||||
| 				const tag = this.evaluateExpression(node.tag); | 				const tag = this.evaluateExpression(node.tag); | ||||||
| 
 | 
 | ||||||
| 				if (tag.isIdentifier() && tag.identifier === "String.raw") { | 				if (tag.isIdentifier() && tag.identifier === "String.raw") { | ||||||
|  | @ -1466,7 +1478,7 @@ class JavascriptParser extends Parser { | ||||||
| 		this.hooks.evaluate | 		this.hooks.evaluate | ||||||
| 			.for("ConditionalExpression") | 			.for("ConditionalExpression") | ||||||
| 			.tap("JavascriptParser", _expr => { | 			.tap("JavascriptParser", _expr => { | ||||||
| 				const expr = /** @type {ConditionalExpressionNode} */ (_expr); | 				const expr = /** @type {ConditionalExpression} */ (_expr); | ||||||
| 
 | 
 | ||||||
| 				const condition = this.evaluateExpression(expr.test); | 				const condition = this.evaluateExpression(expr.test); | ||||||
| 				const conditionValue = condition.asBool(); | 				const conditionValue = condition.asBool(); | ||||||
|  | @ -1497,7 +1509,7 @@ class JavascriptParser extends Parser { | ||||||
| 		this.hooks.evaluate | 		this.hooks.evaluate | ||||||
| 			.for("ArrayExpression") | 			.for("ArrayExpression") | ||||||
| 			.tap("JavascriptParser", _expr => { | 			.tap("JavascriptParser", _expr => { | ||||||
| 				const expr = /** @type {ArrayExpressionNode} */ (_expr); | 				const expr = /** @type {ArrayExpression} */ (_expr); | ||||||
| 
 | 
 | ||||||
| 				const items = expr.elements.map(element => { | 				const items = expr.elements.map(element => { | ||||||
| 					return ( | 					return ( | ||||||
|  | @ -1564,6 +1576,10 @@ class JavascriptParser extends Parser { | ||||||
| 		return this.destructuringAssignmentProperties.get(node); | 		return this.destructuringAssignmentProperties.get(node); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {ExpressionNode} expr expression | ||||||
|  | 	 * @returns {string | VariableInfoInterface | undefined} identifier | ||||||
|  | 	 */ | ||||||
| 	getRenameIdentifier(expr) { | 	getRenameIdentifier(expr) { | ||||||
| 		const result = this.evaluateExpression(expr); | 		const result = this.evaluateExpression(expr); | ||||||
| 		if (result.isIdentifier()) { | 		if (result.isIdentifier()) { | ||||||
|  | @ -1797,10 +1813,16 @@ class JavascriptParser extends Parser { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Real Statements
 | 	// Real Statements
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {BlockStatement} statement block statement | ||||||
|  | 	 */ | ||||||
| 	preWalkBlockStatement(statement) { | 	preWalkBlockStatement(statement) { | ||||||
| 		this.preWalkStatements(statement.body); | 		this.preWalkStatements(statement.body); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {BlockStatement} statement block statement | ||||||
|  | 	 */ | ||||||
| 	walkBlockStatement(statement) { | 	walkBlockStatement(statement) { | ||||||
| 		this.inBlockScope(() => { | 		this.inBlockScope(() => { | ||||||
| 			const body = statement.body; | 			const body = statement.body; | ||||||
|  | @ -1811,6 +1833,9 @@ class JavascriptParser extends Parser { | ||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {ExpressionStatement} statement expression statement | ||||||
|  | 	 */ | ||||||
| 	walkExpressionStatement(statement) { | 	walkExpressionStatement(statement) { | ||||||
| 		this.walkExpression(statement.expression); | 		this.walkExpression(statement.expression); | ||||||
| 	} | 	} | ||||||
|  | @ -2435,6 +2460,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {VariableDeclaration} statement variable declaration | ||||||
|  | 	 */ | ||||||
| 	walkVariableDeclaration(statement) { | 	walkVariableDeclaration(statement) { | ||||||
| 		for (const declarator of statement.declarations) { | 		for (const declarator of statement.declarations) { | ||||||
| 			switch (declarator.type) { | 			switch (declarator.type) { | ||||||
|  | @ -2462,16 +2490,25 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {ClassDeclaration} statement class declaration | ||||||
|  | 	 */ | ||||||
| 	blockPreWalkClassDeclaration(statement) { | 	blockPreWalkClassDeclaration(statement) { | ||||||
| 		if (statement.id) { | 		if (statement.id) { | ||||||
| 			this.defineVariable(statement.id.name); | 			this.defineVariable(statement.id.name); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {ClassDeclaration} statement class declaration | ||||||
|  | 	 */ | ||||||
| 	walkClassDeclaration(statement) { | 	walkClassDeclaration(statement) { | ||||||
| 		this.walkClass(statement); | 		this.walkClass(statement); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {SwitchCase[]} switchCases switch statement | ||||||
|  | 	 */ | ||||||
| 	preWalkSwitchCases(switchCases) { | 	preWalkSwitchCases(switchCases) { | ||||||
| 		for (let index = 0, len = switchCases.length; index < len; index++) { | 		for (let index = 0, len = switchCases.length; index < len; index++) { | ||||||
| 			const switchCase = switchCases[index]; | 			const switchCase = switchCases[index]; | ||||||
|  | @ -2479,6 +2516,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {SwitchCase[]} switchCases switch statement | ||||||
|  | 	 */ | ||||||
| 	walkSwitchCases(switchCases) { | 	walkSwitchCases(switchCases) { | ||||||
| 		this.inBlockScope(() => { | 		this.inBlockScope(() => { | ||||||
| 			const len = switchCases.length; | 			const len = switchCases.length; | ||||||
|  | @ -2514,10 +2554,16 @@ class JavascriptParser extends Parser { | ||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {CatchClause} catchClause catch clause | ||||||
|  | 	 */ | ||||||
| 	preWalkCatchClause(catchClause) { | 	preWalkCatchClause(catchClause) { | ||||||
| 		this.preWalkStatement(catchClause.body); | 		this.preWalkStatement(catchClause.body); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {CatchClause} catchClause catch clause | ||||||
|  | 	 */ | ||||||
| 	walkCatchClause(catchClause) { | 	walkCatchClause(catchClause) { | ||||||
| 		this.inBlockScope(() => { | 		this.inBlockScope(() => { | ||||||
| 			// Error binding is optional in catch clause since ECMAScript 2019
 | 			// Error binding is optional in catch clause since ECMAScript 2019
 | ||||||
|  | @ -2554,6 +2600,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {AssignmentPattern} pattern assignment pattern | ||||||
|  | 	 */ | ||||||
| 	walkAssignmentPattern(pattern) { | 	walkAssignmentPattern(pattern) { | ||||||
| 		this.walkExpression(pattern.right); | 		this.walkExpression(pattern.right); | ||||||
| 		this.walkPattern(pattern.left); | 		this.walkPattern(pattern.left); | ||||||
|  | @ -2569,6 +2618,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {ArrayPattern} pattern array pattern | ||||||
|  | 	 */ | ||||||
| 	walkArrayPattern(pattern) { | 	walkArrayPattern(pattern) { | ||||||
| 		for (let i = 0, len = pattern.elements.length; i < len; i++) { | 		for (let i = 0, len = pattern.elements.length; i < len; i++) { | ||||||
| 			const element = pattern.elements[i]; | 			const element = pattern.elements[i]; | ||||||
|  | @ -2576,6 +2628,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {RestElement} pattern rest element | ||||||
|  | 	 */ | ||||||
| 	walkRestElement(pattern) { | 	walkRestElement(pattern) { | ||||||
| 		this.walkPattern(pattern.argument); | 		this.walkPattern(pattern.argument); | ||||||
| 	} | 	} | ||||||
|  | @ -2668,12 +2723,18 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {AwaitExpression} expression await expression | ||||||
|  | 	 */ | ||||||
| 	walkAwaitExpression(expression) { | 	walkAwaitExpression(expression) { | ||||||
| 		if (this.scope.topLevelScope === true) | 		if (this.scope.topLevelScope === true) | ||||||
| 			this.hooks.topLevelAwait.call(expression); | 			this.hooks.topLevelAwait.call(expression); | ||||||
| 		this.walkExpression(expression.argument); | 		this.walkExpression(expression.argument); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {ArrayExpression} expression array expression | ||||||
|  | 	 */ | ||||||
| 	walkArrayExpression(expression) { | 	walkArrayExpression(expression) { | ||||||
| 		if (expression.elements) { | 		if (expression.elements) { | ||||||
| 			this.walkExpressions(expression.elements); | 			this.walkExpressions(expression.elements); | ||||||
|  | @ -2686,6 +2747,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {ObjectExpression} expression object expression | ||||||
|  | 	 */ | ||||||
| 	walkObjectExpression(expression) { | 	walkObjectExpression(expression) { | ||||||
| 		for ( | 		for ( | ||||||
| 			let propIndex = 0, len = expression.properties.length; | 			let propIndex = 0, len = expression.properties.length; | ||||||
|  | @ -2697,6 +2761,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {Property | SpreadElement} prop property or spread element | ||||||
|  | 	 */ | ||||||
| 	walkProperty(prop) { | 	walkProperty(prop) { | ||||||
| 		if (prop.type === "SpreadElement") { | 		if (prop.type === "SpreadElement") { | ||||||
| 			this.walkExpression(prop.argument); | 			this.walkExpression(prop.argument); | ||||||
|  | @ -2762,7 +2829,7 @@ class JavascriptParser extends Parser { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/** | 	/** | ||||||
| 	 * @param {SequenceExpressionNode} expression the sequence | 	 * @param {SequenceExpression} expression the sequence | ||||||
| 	 */ | 	 */ | ||||||
| 	walkSequenceExpression(expression) { | 	walkSequenceExpression(expression) { | ||||||
| 		if (!expression.expressions) return; | 		if (!expression.expressions) return; | ||||||
|  | @ -2786,10 +2853,16 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {UpdateExpression} expression the update expression | ||||||
|  | 	 */ | ||||||
| 	walkUpdateExpression(expression) { | 	walkUpdateExpression(expression) { | ||||||
| 		this.walkExpression(expression.argument); | 		this.walkExpression(expression.argument); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {UnaryExpression} expression the unary expression | ||||||
|  | 	 */ | ||||||
| 	walkUnaryExpression(expression) { | 	walkUnaryExpression(expression) { | ||||||
| 		if (expression.operator === "typeof") { | 		if (expression.operator === "typeof") { | ||||||
| 			const result = this.callHooksForExpression( | 			const result = this.callHooksForExpression( | ||||||
|  | @ -2815,12 +2888,18 @@ class JavascriptParser extends Parser { | ||||||
| 		this.walkExpression(expression.right); | 		this.walkExpression(expression.right); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {BinaryExpression} expression the binary expression | ||||||
|  | 	 */ | ||||||
| 	walkBinaryExpression(expression) { | 	walkBinaryExpression(expression) { | ||||||
| 		if (this.hooks.binaryExpression.call(expression) === undefined) { | 		if (this.hooks.binaryExpression.call(expression) === undefined) { | ||||||
| 			this.walkLeftRightExpression(expression); | 			this.walkLeftRightExpression(expression); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {LogicalExpression} expression the logical expression | ||||||
|  | 	 */ | ||||||
| 	walkLogicalExpression(expression) { | 	walkLogicalExpression(expression) { | ||||||
| 		const result = this.hooks.expressionLogicalOperator.call(expression); | 		const result = this.hooks.expressionLogicalOperator.call(expression); | ||||||
| 		if (result === undefined) { | 		if (result === undefined) { | ||||||
|  | @ -2832,6 +2911,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {AssignmentExpression} expression assignment expression | ||||||
|  | 	 */ | ||||||
| 	walkAssignmentExpression(expression) { | 	walkAssignmentExpression(expression) { | ||||||
| 		if (expression.left.type === "Identifier") { | 		if (expression.left.type === "Identifier") { | ||||||
| 			const renameIdentifier = this.getRenameIdentifier(expression.right); | 			const renameIdentifier = this.getRenameIdentifier(expression.right); | ||||||
|  | @ -2902,6 +2984,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {ConditionalExpression} expression conditional expression | ||||||
|  | 	 */ | ||||||
| 	walkConditionalExpression(expression) { | 	walkConditionalExpression(expression) { | ||||||
| 		const result = this.hooks.expressionConditionalOperator.call(expression); | 		const result = this.hooks.expressionConditionalOperator.call(expression); | ||||||
| 		if (result === undefined) { | 		if (result === undefined) { | ||||||
|  | @ -2919,6 +3004,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {NewExpression} expression new expression | ||||||
|  | 	 */ | ||||||
| 	walkNewExpression(expression) { | 	walkNewExpression(expression) { | ||||||
| 		const result = this.callHooksForExpression( | 		const result = this.callHooksForExpression( | ||||||
| 			this.hooks.new, | 			this.hooks.new, | ||||||
|  | @ -2944,6 +3032,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {TaggedTemplateExpression} expression tagged template expression | ||||||
|  | 	 */ | ||||||
| 	walkTaggedTemplateExpression(expression) { | 	walkTaggedTemplateExpression(expression) { | ||||||
| 		if (expression.tag) { | 		if (expression.tag) { | ||||||
| 			this.walkExpression(expression.tag); | 			this.walkExpression(expression.tag); | ||||||
|  | @ -2953,6 +3044,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {ClassExpression} expression the class expression | ||||||
|  | 	 */ | ||||||
| 	walkClassExpression(expression) { | 	walkClassExpression(expression) { | ||||||
| 		this.walkClass(expression); | 		this.walkClass(expression); | ||||||
| 	} | 	} | ||||||
|  | @ -3123,6 +3217,9 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {MemberExpressionNode} expression member expression | ||||||
|  | 	 */ | ||||||
| 	walkMemberExpression(expression) { | 	walkMemberExpression(expression) { | ||||||
| 		const exprInfo = this.getMemberExpressionInfo( | 		const exprInfo = this.getMemberExpressionInfo( | ||||||
| 			expression, | 			expression, | ||||||
|  | @ -3216,10 +3313,16 @@ class JavascriptParser extends Parser { | ||||||
| 		if (expression.computed === true) this.walkExpression(expression.property); | 		if (expression.computed === true) this.walkExpression(expression.property); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {ThisExpression} expression this expression | ||||||
|  | 	 */ | ||||||
| 	walkThisExpression(expression) { | 	walkThisExpression(expression) { | ||||||
| 		this.callHooksForName(this.hooks.expression, "this", expression); | 		this.callHooksForName(this.hooks.expression, "this", expression); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {Identifier} expression identifier | ||||||
|  | 	 */ | ||||||
| 	walkIdentifier(expression) { | 	walkIdentifier(expression) { | ||||||
| 		this.callHooksForName(this.hooks.expression, expression.name, expression); | 		this.callHooksForName(this.hooks.expression, expression.name, expression); | ||||||
| 	} | 	} | ||||||
|  | @ -3741,7 +3844,7 @@ class JavascriptParser extends Parser { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/** | 	/** | ||||||
| 	 * @param {ExpressionNode | DeclarationNode | PrivateIdentifierNode | null | undefined} expr an expression | 	 * @param {ExpressionNode | DeclarationNode | PrivateIdentifier | null | undefined} expr an expression | ||||||
| 	 * @param {number} commentsStartPos source position from which annotation comments are checked | 	 * @param {number} commentsStartPos source position from which annotation comments are checked | ||||||
| 	 * @returns {boolean} true, when the expression is pure | 	 * @returns {boolean} true, when the expression is pure | ||||||
| 	 */ | 	 */ | ||||||
|  | @ -3978,6 +4081,10 @@ class JavascriptParser extends Parser { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @param {TagInfo} tagInfo tag info | ||||||
|  | 	 * @returns {VariableInfo} variable info | ||||||
|  | 	 */ | ||||||
| 	evaluatedVariable(tagInfo) { | 	evaluatedVariable(tagInfo) { | ||||||
| 		return new VariableInfo(this.scope, undefined, tagInfo); | 		return new VariableInfo(this.scope, undefined, tagInfo); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -5375,7 +5375,9 @@ declare class JavascriptParser extends Parser { | ||||||
| 	destructuringAssignmentPropertiesFor( | 	destructuringAssignmentPropertiesFor( | ||||||
| 		node: Expression | 		node: Expression | ||||||
| 	): undefined | Set<string>; | 	): undefined | Set<string>; | ||||||
| 	getRenameIdentifier(expr?: any): undefined | string | VariableInfoInterface; | 	getRenameIdentifier( | ||||||
|  | 		expr: Expression | ||||||
|  | 	): undefined | string | VariableInfoInterface; | ||||||
| 	walkClass(classy: ClassExpression | ClassDeclaration): void; | 	walkClass(classy: ClassExpression | ClassDeclaration): void; | ||||||
| 	preWalkStatements(statements?: any): void; | 	preWalkStatements(statements?: any): void; | ||||||
| 	blockPreWalkStatements(statements?: any): void; | 	blockPreWalkStatements(statements?: any): void; | ||||||
|  | @ -5390,9 +5392,9 @@ declare class JavascriptParser extends Parser { | ||||||
| 	 * This enforces the nested statement to never be in ASI position. | 	 * This enforces the nested statement to never be in ASI position. | ||||||
| 	 */ | 	 */ | ||||||
| 	walkNestedStatement(statement: Statement): void; | 	walkNestedStatement(statement: Statement): void; | ||||||
| 	preWalkBlockStatement(statement?: any): void; | 	preWalkBlockStatement(statement: BlockStatement): void; | ||||||
| 	walkBlockStatement(statement?: any): void; | 	walkBlockStatement(statement: BlockStatement): void; | ||||||
| 	walkExpressionStatement(statement?: any): void; | 	walkExpressionStatement(statement: ExpressionStatement): void; | ||||||
| 	preWalkIfStatement(statement: IfStatement): void; | 	preWalkIfStatement(statement: IfStatement): void; | ||||||
| 	walkIfStatement(statement: IfStatement): void; | 	walkIfStatement(statement: IfStatement): void; | ||||||
| 	preWalkLabeledStatement(statement: LabeledStatement): void; | 	preWalkLabeledStatement(statement: LabeledStatement): void; | ||||||
|  | @ -5430,44 +5432,44 @@ declare class JavascriptParser extends Parser { | ||||||
| 	preWalkVariableDeclaration(statement: VariableDeclaration): void; | 	preWalkVariableDeclaration(statement: VariableDeclaration): void; | ||||||
| 	blockPreWalkVariableDeclaration(statement: VariableDeclaration): void; | 	blockPreWalkVariableDeclaration(statement: VariableDeclaration): void; | ||||||
| 	preWalkVariableDeclarator(declarator: VariableDeclarator): void; | 	preWalkVariableDeclarator(declarator: VariableDeclarator): void; | ||||||
| 	walkVariableDeclaration(statement?: any): void; | 	walkVariableDeclaration(statement: VariableDeclaration): void; | ||||||
| 	blockPreWalkClassDeclaration(statement?: any): void; | 	blockPreWalkClassDeclaration(statement: ClassDeclaration): void; | ||||||
| 	walkClassDeclaration(statement?: any): void; | 	walkClassDeclaration(statement: ClassDeclaration): void; | ||||||
| 	preWalkSwitchCases(switchCases?: any): void; | 	preWalkSwitchCases(switchCases: SwitchCase[]): void; | ||||||
| 	walkSwitchCases(switchCases?: any): void; | 	walkSwitchCases(switchCases: SwitchCase[]): void; | ||||||
| 	preWalkCatchClause(catchClause?: any): void; | 	preWalkCatchClause(catchClause: CatchClause): void; | ||||||
| 	walkCatchClause(catchClause?: any): void; | 	walkCatchClause(catchClause: CatchClause): void; | ||||||
| 	walkPattern(pattern?: any): void; | 	walkPattern(pattern?: any): void; | ||||||
| 	walkAssignmentPattern(pattern?: any): void; | 	walkAssignmentPattern(pattern: AssignmentPattern): void; | ||||||
| 	walkObjectPattern(pattern?: any): void; | 	walkObjectPattern(pattern?: any): void; | ||||||
| 	walkArrayPattern(pattern?: any): void; | 	walkArrayPattern(pattern: ArrayPattern): void; | ||||||
| 	walkRestElement(pattern?: any): void; | 	walkRestElement(pattern: RestElement): void; | ||||||
| 	walkExpressions(expressions?: any): void; | 	walkExpressions(expressions?: any): void; | ||||||
| 	walkExpression(expression?: any): void; | 	walkExpression(expression?: any): void; | ||||||
| 	walkAwaitExpression(expression?: any): void; | 	walkAwaitExpression(expression: AwaitExpression): void; | ||||||
| 	walkArrayExpression(expression?: any): void; | 	walkArrayExpression(expression: ArrayExpression): void; | ||||||
| 	walkSpreadElement(expression?: any): void; | 	walkSpreadElement(expression?: any): void; | ||||||
| 	walkObjectExpression(expression?: any): void; | 	walkObjectExpression(expression: ObjectExpression): void; | ||||||
| 	walkProperty(prop?: any): void; | 	walkProperty(prop: Property | SpreadElement): void; | ||||||
| 	walkFunctionExpression(expression?: any): void; | 	walkFunctionExpression(expression?: any): void; | ||||||
| 	walkArrowFunctionExpression(expression?: any): void; | 	walkArrowFunctionExpression(expression?: any): void; | ||||||
| 	walkSequenceExpression(expression: SequenceExpression): void; | 	walkSequenceExpression(expression: SequenceExpression): void; | ||||||
| 	walkUpdateExpression(expression?: any): void; | 	walkUpdateExpression(expression: UpdateExpression): void; | ||||||
| 	walkUnaryExpression(expression?: any): void; | 	walkUnaryExpression(expression: UnaryExpression): void; | ||||||
| 	walkLeftRightExpression(expression?: any): void; | 	walkLeftRightExpression(expression?: any): void; | ||||||
| 	walkBinaryExpression(expression?: any): void; | 	walkBinaryExpression(expression: BinaryExpression): void; | ||||||
| 	walkLogicalExpression(expression?: any): void; | 	walkLogicalExpression(expression: LogicalExpression): void; | ||||||
| 	walkAssignmentExpression(expression?: any): void; | 	walkAssignmentExpression(expression: AssignmentExpression): void; | ||||||
| 	walkConditionalExpression(expression?: any): void; | 	walkConditionalExpression(expression: ConditionalExpression): void; | ||||||
| 	walkNewExpression(expression?: any): void; | 	walkNewExpression(expression: NewExpression): void; | ||||||
| 	walkYieldExpression(expression?: any): void; | 	walkYieldExpression(expression?: any): void; | ||||||
| 	walkTemplateLiteral(expression?: any): void; | 	walkTemplateLiteral(expression?: any): void; | ||||||
| 	walkTaggedTemplateExpression(expression?: any): void; | 	walkTaggedTemplateExpression(expression: TaggedTemplateExpression): void; | ||||||
| 	walkClassExpression(expression?: any): void; | 	walkClassExpression(expression: ClassExpression): void; | ||||||
| 	walkChainExpression(expression: ChainExpression): void; | 	walkChainExpression(expression: ChainExpression): void; | ||||||
| 	walkImportExpression(expression: ImportExpression): void; | 	walkImportExpression(expression: ImportExpression): void; | ||||||
| 	walkCallExpression(expression?: any): void; | 	walkCallExpression(expression?: any): void; | ||||||
| 	walkMemberExpression(expression?: any): void; | 	walkMemberExpression(expression: MemberExpression): void; | ||||||
| 	walkMemberExpressionWithExpressionName( | 	walkMemberExpressionWithExpressionName( | ||||||
| 		expression?: any, | 		expression?: any, | ||||||
| 		name?: any, | 		name?: any, | ||||||
|  | @ -5475,8 +5477,8 @@ declare class JavascriptParser extends Parser { | ||||||
| 		members?: any, | 		members?: any, | ||||||
| 		onUnhandled?: any | 		onUnhandled?: any | ||||||
| 	): void; | 	): void; | ||||||
| 	walkThisExpression(expression?: any): void; | 	walkThisExpression(expression: ThisExpression): void; | ||||||
| 	walkIdentifier(expression?: any): void; | 	walkIdentifier(expression: Identifier): void; | ||||||
| 	walkMetaProperty(metaProperty: MetaProperty): void; | 	walkMetaProperty(metaProperty: MetaProperty): void; | ||||||
| 	callHooksForExpression(hookMap: any, expr: any, ...args: any[]): any; | 	callHooksForExpression(hookMap: any, expr: any, ...args: any[]): any; | ||||||
| 	callHooksForExpressionWithFallback<T, R>( | 	callHooksForExpressionWithFallback<T, R>( | ||||||
|  | @ -5577,7 +5579,7 @@ declare class JavascriptParser extends Parser { | ||||||
| 	isVariableDefined(name: string): boolean; | 	isVariableDefined(name: string): boolean; | ||||||
| 	getVariableInfo(name: string): ExportedVariableInfo; | 	getVariableInfo(name: string): ExportedVariableInfo; | ||||||
| 	setVariable(name: string, variableInfo: ExportedVariableInfo): void; | 	setVariable(name: string, variableInfo: ExportedVariableInfo): void; | ||||||
| 	evaluatedVariable(tagInfo?: any): VariableInfo; | 	evaluatedVariable(tagInfo: TagInfo): VariableInfo; | ||||||
| 	parseCommentOptions(range: [number, number]): any; | 	parseCommentOptions(range: [number, number]): any; | ||||||
| 	extractMemberExpressionChain(expression: MemberExpression): { | 	extractMemberExpressionChain(expression: MemberExpression): { | ||||||
| 		members: string[]; | 		members: string[]; | ||||||
|  | @ -7761,21 +7763,21 @@ type NodeEstreeIndex = | ||||||
| 	| PropertyDefinition | 	| PropertyDefinition | ||||||
| 	| VariableDeclarator | 	| VariableDeclarator | ||||||
| 	| Program | 	| Program | ||||||
| 	| AssignmentProperty | 	| SwitchCase | ||||||
| 	| Property |  | ||||||
| 	| CatchClause | 	| CatchClause | ||||||
|  | 	| AssignmentPattern | ||||||
|  | 	| ArrayPattern | ||||||
|  | 	| RestElement | ||||||
|  | 	| Property | ||||||
|  | 	| SpreadElement | ||||||
|  | 	| AssignmentProperty | ||||||
| 	| ClassBody | 	| ClassBody | ||||||
| 	| ImportSpecifier | 	| ImportSpecifier | ||||||
| 	| ImportDefaultSpecifier | 	| ImportDefaultSpecifier | ||||||
| 	| ImportNamespaceSpecifier | 	| ImportNamespaceSpecifier | ||||||
| 	| ExportSpecifier | 	| ExportSpecifier | ||||||
| 	| ObjectPattern | 	| ObjectPattern | ||||||
| 	| ArrayPattern |  | ||||||
| 	| RestElement |  | ||||||
| 	| AssignmentPattern |  | ||||||
| 	| SpreadElement |  | ||||||
| 	| Super | 	| Super | ||||||
| 	| SwitchCase |  | ||||||
| 	| TemplateElement; | 	| TemplateElement; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  | @ -11079,7 +11081,7 @@ declare interface RuntimeValueOptions { | ||||||
| declare interface ScopeInfo { | declare interface ScopeInfo { | ||||||
| 	definitions: StackedMap<string, ScopeInfo | VariableInfo>; | 	definitions: StackedMap<string, ScopeInfo | VariableInfo>; | ||||||
| 	topLevelScope: boolean | "arrow"; | 	topLevelScope: boolean | "arrow"; | ||||||
| 	inShorthand: boolean; | 	inShorthand: string | boolean; | ||||||
| 	isStrict: boolean; | 	isStrict: boolean; | ||||||
| 	isAsmJs: boolean; | 	isAsmJs: boolean; | ||||||
| 	inTry: boolean; | 	inTry: boolean; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue