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

side_effects=true changes this binding with optional chain #1372

Closed
iccir opened this issue Apr 9, 2023 · 1 comment
Closed

side_effects=true changes this binding with optional chain #1372

iccir opened this issue Apr 9, 2023 · 1 comment

Comments

@iccir
Copy link
Contributor

iccir commented Apr 9, 2023

Bug report or Feature request?

Bug report

Version (complete output of terser -V or specific git commit)

5.16.8

Complete CLI command or minify() options used

--compress defaults=false,side_effects=true

terser input

(function(o) {
    console.log((0, o?.f)("PASS"));
})({
    a: "FAIL",
    f(b) {
        return this.a || b;
    },
});

terser output or error
FAIL when side_effects=true, PASS when false. Un-tersified code piped directly into node prints PASS.

Expected result
PASS

@iccir
Copy link
Contributor Author

iccir commented Apr 9, 2023

maintain_this_binding in common.js needs to handle AST_Chain nodes.

iccir added a commit to iccir/terser that referenced this issue Apr 9, 2023
@iccir iccir mentioned this issue Apr 9, 2023
iccir added a commit to iccir/terser that referenced this issue Apr 10, 2023
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

No branches or pull requests

1 participant