feat(es/minifier): Evaluate more iifes (#4200)

This commit is contained in:
Donny/강동윤 2022-03-31 08:35:30 +09:00 committed by GitHub
parent c6a583741c
commit 11fe5fabd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 17 deletions

View File

@ -2051,7 +2051,11 @@ where
..self.ctx
};
s.visit_mut_children_with(&mut *self.with_ctx(ctx));
s.init.visit_mut_with(self);
s.test.visit_mut_with(self);
s.update.visit_mut_with(self);
s.body.visit_mut_with(&mut *self.with_ctx(ctx));
self.with_ctx(ctx).optimize_init_of_for_stmt(s);
}

View File

@ -251,7 +251,6 @@ functions/inline_true/input.js
functions/inner_ref/input.js
functions/issue_203/input.js
functions/issue_2084/input.js
functions/issue_2101/input.js
functions/issue_2107/input.js
functions/issue_2114_1/input.js
functions/issue_2114_2/input.js
@ -499,8 +498,6 @@ issue_976/eval_mangle/input.js
issue_976/eval_unused/input.js
issue_979/issue979_reported/input.js
issue_979/issue979_test_negated_is_best/input.js
issue_t120/issue_t120_1/input.js
issue_t120/issue_t120_2/input.js
issue_t120/issue_t120_3/input.js
issue_t120/issue_t120_4/input.js
issue_t120/issue_t120_5/input.js

View File

@ -6933,15 +6933,13 @@
break;
}
0 === notloadedImgs.length && (console.log('Images loaded'), !1 === sequence ? (function(src) {
var tags = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : AvailableTags;
return /^blob:/i.test(src) ? (function(url) {
return new Promise(function(resolve, reject) {
var http = new XMLHttpRequest();
http.open('GET', url, !0), http.responseType = 'blob', http.onreadystatechange = function() {
http.readyState === XMLHttpRequest.DONE && (200 === http.status || 0 === http.status) && resolve(this.response);
}, http.onerror = reject, http.send();
});
})(src).then(readToBuffer).then(function(buffer) {
var url, tags = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : AvailableTags;
return /^blob:/i.test(src) ? (url = src, new Promise(function(resolve, reject) {
var http = new XMLHttpRequest();
http.open('GET', url, !0), http.responseType = 'blob', http.onreadystatechange = function() {
http.readyState === XMLHttpRequest.DONE && (200 === http.status || 0 === http.status) && resolve(this.response);
}, http.onerror = reject, http.send();
})).then(readToBuffer).then(function(buffer) {
return function(file) {
var selectedTags = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : AvailableTags, dataView = new DataView(file), length = file.byteLength, exifTags = selectedTags.reduce(function(result, selectedTag) {
var exifTag = Object.keys(ExifTags).filter(function(tag) {

View File

@ -535,6 +535,7 @@ functions/inline_loop_4/input.js
functions/issue_1841_1/input.js
functions/issue_1841_2/input.js
functions/issue_2097/input.js
functions/issue_2101/input.js
functions/issue_2647_1/input.js
functions/issue_2647_2/input.js
functions/issue_2647_3/input.js
@ -808,6 +809,8 @@ issue_782/remove_redundant_sequence_items/input.js
issue_926/template_strings/input.js
issue_973/this_binding_sequences/input.js
issue_973/this_binding_side_effects/input.js
issue_t120/issue_t120_1/input.js
issue_t120/issue_t120_2/input.js
issue_t50/issue_t50/input.js
issue_t50/issue_t50_const/input.js
issue_t50/issue_t50_let/input.js

View File

@ -1,6 +1,14 @@
function foo(node) {
for (var i; (i = void 0), (i = node.data) && i.a != i.b; ) node = node.data;
for(var i; (i = node.data) && i.a != i.b;)node = node.data;
return node;
}
var x = { a: 1, b: 2, data: { a: "hello" } };
console.log(foo(x).a, foo({ a: "world" }).a);
var x = {
a: 1,
b: 2,
data: {
a: "hello"
}
};
console.log(foo(x).a, foo({
a: "world"
}).a);

View File

@ -4,7 +4,7 @@
"inline": 3,
"join_vars": true,
"loops": true,
"passes": 3,
"passes": 4,
"reduce_vars": true,
"sequences": true,
"side_effects": true,