1
Vote

Invalid Operator Precendence between => and ,

description

Running the command-line minifier on valid ES2015 code with arrow functions in this specific block causes the functionality of the code to change.

The problem came about when trying to minify this code:
var func = (eve) => {
    delete eve.$id;
    return eve;
};
Running the minifier on this file outputs the following:
var func=n=>delete n.$id,n
However, this means the following happens
var eve = {"$id":1, "name":2};
var result = func(eve)  # returns true
This was the output when running the "-analyze" command line argument:
Microsoft Ajax Minifier (version 5.14.5506.26196)
JavaScript and CSS minification and verification command-line utility
Copyright 2013 Microsoft Corporation

Minifying 'C:\Users\\chbrenon.REDMOND\Documents\JSMin\func.js'


Global Objects
  func [globalvar][0 references] [defined (1,5)]

Arrow Function [Anonymous] - starts at line 1, col 12
  eve [argument] [2 references renamed to n] [defined (1,13)]


Original Size: 57 bytes; reduced size: 26 bytes (54.4% minification)
Gzip of source input approx. 71 bytes (-24.6% compression)
Gzip of minified output approx. 46 bytes (19.3% compression)

var func=n=>delete n.$id,n

file attachments

comments