Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance pure_getters, reduce_vars & unused #4863

Merged
merged 1 commit into from
Apr 23, 2021

Conversation

alexlamsl
Copy link
Collaborator

No description provided.

@alexlamsl
Copy link
Collaborator Author

@kzc this takes care of #4858 (comment) & #4858 (comment)

Casting #4858 (comment) into the Void would also require upgrading collapse_vars which is WIP

@kzc
Copy link
Contributor

kzc commented Apr 23, 2021

Cool! Looking forward to seeing what ufuzz comes up with.

Hey, this is strange...

$ cat r2.js | uglify-js -bc toplevel
effect();


$ cat r2.js | uglify-js -bc toplevel | od -c
0000000    e   f   f   e   c   t   (   )   ;  \n  \n  \n                
0000014

Why the extra newlines for r2.js?

@kzc
Copy link
Contributor

kzc commented Apr 23, 2021

Top level AST_EmptyStatement...

$ cat r2.js | uglify-js -bc toplevel -o ast
{
  "_class": "AST_Toplevel",
  "globals": [
    "1000006 effect",
    "1000007 o",
    "1000008 n"
  ],
  "body": [
    {
      "_class": "AST_SimpleStatement",
      "body": {
        "_class": "AST_Call",
        "expression": {
          "_class": "AST_SymbolRef",
          "name": "effect",
          "thedef": "1000006 effect"
        },
        "args": []
      }
    },
    {
      "_class": "AST_EmptyStatement"
    }
  ],
  "enclosed": [
    "1000006 effect",
    "1000007 o",
    "1000008 n",
    "1000001 r"
  ],
  "variables": [
    "1000001 r"
  ]
}

@alexlamsl
Copy link
Collaborator Author

Something else these build tests are good for is testing pure_getters=true, which we can never do with ufuzz (not without getting an onslaught of false positives anyway)

@alexlamsl
Copy link
Collaborator Author

Hey, this is strange...

So that's because (r.default = r).__esModule = !0; can only be reduced to !0; due to side effects on LHS.

Won't affect output size except for beautify=true, and passes would certainly get rid of the dead meat easily as well so I guess we can leave it as is for now.

@alexlamsl alexlamsl merged commit 9b8deff into mishoo:master Apr 23, 2021
@alexlamsl alexlamsl deleted the pure_getters branch April 23, 2021 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants