minify
minify copied to clipboard
evaluate pass incorrectly sets values to undefined
I'm not sure if this project is still maintained, but I'm reporting in case.
Not completely sure this is a different issue than #897, but the testcase is different.
'use strict';
function f(x) {
const s = 'AB'[x];
console.log(s);
return Math.floor(1);
}
With evaluate and no other passes:
"use strict";function f(x){var s="AB"[x];console.log(undefined);return Math.floor(1)}
With babel.transform(inCode, {presets: ['minify', '@babel/preset-env']}): (maybe #904)
Error: Couldn't find intersection
at NodePath.getDeepestCommonAncestorFrom (/babel/babel/packages/babel-traverse/lib/path/ancestry.js:153:11)
at getSegmentedSubPaths (/babel/minify/packages/babel-plugin-minify-builtins/lib/index.js:244:14)
at BuiltInReplacer.replace (/babel/minify/packages/babel-plugin-minify-builtins/lib/index.js:92:31)
at PluginPass.exit (/babel/minify/packages/babel-plugin-minify-builtins/lib/index.js:205:27)
at newFn (/babel/babel/packages/babel-traverse/lib/visitors.js:193:21)
at NodePath._call (/babel/babel/packages/babel-traverse/lib/path/context.js:53:20)
at NodePath.call (/babel/babel/packages/babel-traverse/lib/path/context.js:40:17)
at NodePath.visit (/babel/babel/packages/babel-traverse/lib/path/context.js:97:8)
at TraversalContext.visitQueue (/babel/babel/packages/babel-traverse/lib/context.js:118:16)
at TraversalContext.visitSingle (/babel/babel/packages/babel-traverse/lib/context.js:90:19)
Expected:
"use strict";function f(x){return console.log("AB"[x]),1}