@@ -17949,15 +17949,15 @@ const installImprove = (modules) => {
1794917949 * @returns {unknown} its value
1795017950 */
1795117951 const constantOf = (node) => {
17952- if (node instanceof A.AST_String || node instanceof A.AST_Number ) {
17952+ if (node instanceof A.StringNode || node instanceof A.NumberNode ) {
1795317953 return node.value;
1795417954 }
17955- if (node instanceof A.AST_True ) return true;
17956- if (node instanceof A.AST_False ) return false;
17957- if (node instanceof A.AST_Null ) return null;
17958- if (node instanceof A.AST_NaN ) return Number.NaN;
17959- if (node instanceof A.AST_Infinity ) return Infinity;
17960- if (node instanceof A.AST_UnaryPrefix ) {
17955+ if (node instanceof A.TrueNode ) return true;
17956+ if (node instanceof A.FalseNode ) return false;
17957+ if (node instanceof A.NullNode ) return null;
17958+ if (node instanceof A.NaNNode ) return Number.NaN;
17959+ if (node instanceof A.InfinityNode ) return Infinity;
17960+ if (node instanceof A.UnaryPrefixNode ) {
1796117961 const inner = constantOf(node.expression);
1796217962 if (inner === NOT_CONSTANT) return NOT_CONSTANT;
1796317963 if (node.operator === "-" && typeof inner === "number") return -inner;
@@ -17975,7 +17975,7 @@ const installImprove = (modules) => {
1797517975 */
1797617976 const builtInOf = (call) => {
1797717977 const callee = call.expression;
17978- if (callee instanceof A.AST_SymbolRef ) {
17978+ if (callee instanceof A.SymbolRefNode ) {
1797917979 return isUndeclaredRef(callee) && foldedGlobals.has(callee.name)
1798017980 ? {
1798117981 fn: /** @type {EXPECTED_ANY} */ (global)[callee.name],
@@ -17984,10 +17984,10 @@ const installImprove = (modules) => {
1798417984 }
1798517985 : undefined;
1798617986 }
17987- if (!(callee instanceof A.AST_Dot ) || callee.optional) return undefined;
17987+ if (!(callee instanceof A.DotNode ) || callee.optional) return undefined;
1798817988 const object = callee.expression;
1798917989 const name = callee.property;
17990- if (object instanceof A.AST_SymbolRef ) {
17990+ if (object instanceof A.SymbolRefNode ) {
1799117991 const methods = isUndeclaredRef(object)
1799217992 ? foldedStatics.get(object.name)
1799317993 : undefined;
@@ -17999,7 +17999,7 @@ const installImprove = (modules) => {
1799917999 }
1800018000 : undefined;
1800118001 }
18002- if (object instanceof A.AST_String ) {
18002+ if (object instanceof A.StringNode ) {
1800318003 // Case and white space follow the engine's Unicode version.
1800418004 if (unicodeDependentMethods.has(name) && !ASCII.test(object.value)) {
1800518005 return undefined;
@@ -18012,12 +18012,12 @@ const installImprove = (modules) => {
1801218012 }
1801318013 : undefined;
1801418014 }
18015- if (object instanceof A.AST_Array && foldedArrayMethods.has(name)) {
18015+ if (object instanceof A.ArrayNode && foldedArrayMethods.has(name)) {
1801618016 /** @type {unknown[]} */
1801718017 const elements = [];
1801818018 for (const element of object.elements) {
1801918019 const value =
18020- element instanceof A.AST_Hole ? undefined : constantOf(element);
18020+ element instanceof A.HoleNode ? undefined : constantOf(element);
1802118021 if (value === NOT_CONSTANT) return undefined;
1802218022 elements.push(value);
1802318023 }
@@ -18033,14 +18033,14 @@ const installImprove = (modules) => {
1803318033 /**
1803418034 * Whether a `with` or a direct `eval` around the node visited could bind a
1803518035 * global's name to something else.
18036- * @param {TerserCompressor } compressor the compressor
18036+ * @param {CompressorShape } compressor the compressor
1803718037 * @returns {boolean} true when one could
1803818038 */
1803918039 const globalMayBeRebound = (compressor) => {
1804018040 let parent;
1804118041 for (let i = 0; (parent = compressor.parent(i)); i++) {
18042- if (parent instanceof A.AST_With ) return true;
18043- if (parent instanceof A.AST_Scope && parent.uses_eval) return true;
18042+ if (parent instanceof A.WithNode ) return true;
18043+ if (parent instanceof A.ScopeNode && parent.uses_eval) return true;
1804418044 }
1804518045 return false;
1804618046 };
@@ -18049,7 +18049,7 @@ const installImprove = (modules) => {
1804918049 * A call of a built-in on literals, evaluated as it runs when built-ins are
1805018050 * left as the language defines them, or the call where that is not shorter.
1805118051 * @param {Node} call a call terser has optimized
18052- * @param {TerserCompressor } compressor the compressor
18052+ * @param {CompressorShape } compressor the compressor
1805318053 * @returns {Node} what replaces it
1805418054 */
1805518055 const foldBuiltInCall = (call, compressor) => {
@@ -18087,26 +18087,26 @@ const installImprove = (modules) => {
1808718087 return folded.print_to_string().length <= limit ? folded : call;
1808818088 };
1808918089
18090- const { AST_Call, AST_Dot, AST_New, AST_SymbolRef } = A;
18091- /** @type {(this: Node, compressor: TerserCompressor ) => Node} */
18092- const optimizeCall = AST_Call .prototype.optimize;
18093- AST_Call .prototype.optimize = function optimize(
18094- /** @type {TerserCompressor } */ compressor
18090+ const { CallNode, DotNode, NewNode, SymbolRefNode } = A;
18091+ /** @type {(this: Node, compressor: CompressorShape ) => Node} */
18092+ const optimizeCall = CallNode .prototype.optimize;
18093+ CallNode .prototype.optimize = function optimize(
18094+ /** @type {CompressorShape } */ compressor
1809518095 ) {
1809618096 const optimized = optimizeCall.call(this, compressor);
18097- if (!improvements.enabled || !(optimized instanceof AST_Call )) {
18097+ if (!improvements.enabled || !(optimized instanceof CallNode )) {
1809818098 return optimized;
1809918099 }
1810018100 // Every call is met here, nearly none of a built-in, so its name goes first.
1810118101 const callee = optimized.expression;
1810218102 const name =
18103- callee instanceof AST_Dot
18103+ callee instanceof DotNode
1810418104 ? callee.property
18105- : callee instanceof AST_SymbolRef
18105+ : callee instanceof SymbolRefNode
1810618106 ? callee.name
1810718107 : undefined;
1810818108 return foldedNames.has(name) &&
18109- !(optimized instanceof AST_New ) &&
18109+ !(optimized instanceof NewNode ) &&
1811018110 compressor.option("evaluate")
1811118111 ? foldBuiltInCall(optimized, compressor)
1811218112 : optimized;
0 commit comments