Skip to content

Setting pure_getters to true changing statement ordering incorrectly #343

@BYK

Description

@BYK

We have bumped into an issue while compressing some generated Handlebars templates with the following options:

evaluate: false, unsafe: true, pure_getters: true, warnings: false 

I was able to narrow it down to pure_getters. Once it's set to false, the problem went away.

A comparison of the original function, faulty compressed function and a properly-working compressed function can be found here: https://gist.github.com/BYK/7331690

Note how assigning a.session to d early, completely changes the boolean expression and makes it true always. Kudos to @gabalafou for tracing this down.

I'm guessing it is a combination of pure_getters and cascade being both true but I have no experience in UglifyJS codebase so this is a wild guess after glancing over it a bit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions