--- /dev/null
+// (beautified)
+var o = {};
+
+[ o[1 + .1 + .1] ] = [];
+
+console.log(o);
+// output: { '1.2000000000000002': undefined }
+//
+// minify: { '1.2': undefined }
+//
+// options: {
+// "compress": {
+// "unsafe_math": true
+// },
+// "mangle": false,
+// "validate": true
+// }
\ No newline at end of file
if (result.error) throw result.error;
assert.strictEqual(result.code, read("test/input/reduce/diff_error.reduced.js"));
});
+ it("Should maintain valid LHS in destructuring assignments", function() {
+ if (semver.satisfies(process.version, "<6")) return;
+ var result = reduce_test(read("test/input/reduce/destructured_assign.js"), {
+ compress: {
+ unsafe_math: true,
+ },
+ mangle: false,
+ validate: true,
+ });
+ if (result.error) throw result.error;
+ assert.strictEqual(result.code, read("test/input/reduce/destructured_assign.reduced.js"));
+ });
it("Should handle destructured catch expressions", function() {
if (semver.satisfies(process.version, "<6")) return;
var result = reduce_test(read("test/input/reduce/destructured_catch.js"), {
else if (node instanceof U.AST_PropAccess) {
var expr = [
node.expression,
- node.property instanceof U.AST_Node && node.property,
+ node.property instanceof U.AST_Node && !(parent instanceof U.AST_Destructured) && node.property,
][ node.start._permute++ % 2 ];
if (expr) {
CHANGED = true;