-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(es/minifier): Respect span hygiene from expr simplifier #6899
Conversation
InvestigationThis looks like an issue of span hygiene. After the first pass, the input becomes console.log("The result should be 0. And it is:", (function(n, e) {
var r = Math.abs(n - e);
function t(e) {
return e < n;
}
function u(n) {
return n > e;
}
function c(n1) {
;
;
return n1 < n || n1 > e;
}
return {
length: r,
max: e,
min: n,
constrain: function(r) {
;
return c(r) ? r < n ? n : e : r;
},
reachedAny: c,
reachedMax: u,
reachedMin: t,
removeOffset: function(n) {
return r ? n - r * Math.ceil((n - e) / r) : n;
}
};
})(0, 3).constrain(-1)); but if I pass this to the minifier it passes. Investigation 2I verifed the behavior using console.log("The result should be 0. And it is:", function(n, e) {
var r = Math.abs(n - e);
function t(e) {
return e < n
}
function u(n) {
return n > e
}
function c(n) {
return t(n) || u(n)
}
return {
length: r,
max: e,
min: n,
constrain: function(r) {
return /*#__NOINLINE__*/c(r) ? (/*#__NOINLINE__*/t(r) ? n : e) : r
},
reachedAny: c,
reachedMax: u,
reachedMin: t,
removeOffset: function(n) {
return r ? n - r * Math.ceil((n - e) / r) : n
}
}
}(0, 3).constrain(-1)); Investigation 3inlining of Investigation 4Investigation 5
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swc-bump:
- swc_ecma_transforms_optimization
Skipping the review as this is a very trivial change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated review comment generated by auto-rebase script
Description:
Related issue: