mishoo / UglifyJS

JavaScript parser / mangler / compressor / beautifier toolkit
http://lisperator.net/uglifyjs/
Other
13.08k stars 1.25k forks source link

[ES6] Compressing assignments in arrow functions fails #1090

Closed avdg closed 8 years ago

avdg commented 8 years ago

Harmony only (f63803e3e3753253721a4d7abbbe2ff46f11eecc)

Test: https://github.com/tc39/test262/blob/93e9da29a0604e9c2742436979eb1074eb301758/test/language/expressions/arrow-function/syntax/arrowparameters-cover-initialize-1.js

Test case: var af = (x = 1) => x Output (with -c flag): var af=x=1=>x;

avdg commented 8 years ago

Related to #448

avdg commented 8 years ago
{
  "_class": "AST_Toplevel",
  "body": [
    {
      "_class": "AST_Var",
      "definitions": [
        {
          "_class": "AST_VarDef",
          "name": {
            "_class": "AST_SymbolVar",
            "name": "af"
          },
          "value": {
            "_class": "AST_Arrow",
            "argnames": [
              {
                "_class": "AST_SymbolFunarg",
                "default": {
                  "_class": "AST_Number",
                  "value": 1
                },
                "name": "x"
              }
            ],
            "body": {
              "_class": "AST_SymbolRef",
              "name": "x"
            }
          }
        }
      ]
    }
  ]
}
kzc commented 8 years ago

@avdg Would it be possible to put an [ES6] prefix in the title of ES6 issues? It's easier to separate the issues that way.

avdg commented 8 years ago

Should be resolved by now