Skip to content

Don't shorten booleans that a property is accessed on - #457

Open
samipuro wants to merge 1 commit into
matthiasmullie:masterfrom
samipuro:fix/bool-member-access
Open

samipuro wants to merge 1 commit into
matthiasmullie:masterfrom
samipuro:fix/bool-member-access

Conversation

@samipuro

@samipuro samipuro commented Nov 5, 2026

Copy link
Copy Markdown

Fixes #430.

true.valueOf() was minified to !0.valueOf(), which is a syntax error. With a space or brackets the result is valid but wrong: true .toString() became !0 .toString() and false['toString']() became !1['toString'](), which negate the call result.

true and false are now left as they are when followed by ., [ or ?.. A ?. followed by a digit is still treated as a ternary, so a?true?.5:1 is still shortened.

Tests added to JSTest. The two property access cases fail before this change.

This branch has not been deployed

No deployments
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.

true.valueOf minification

1 participant