Skip to content

Commit

Permalink
fix(es/minifier): Fix logic for checking arguments (#3313)
Browse files Browse the repository at this point in the history
swc_ecma_minifier:
 - Don't mark `arguments` in nested scope as a inline blocker.
  • Loading branch information
kdy1 authored Jan 19, 2022
1 parent 4966af8 commit 1aa494b
Show file tree
Hide file tree
Showing 342 changed files with 7,396 additions and 8,343 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,26 @@ function _setPrototypeOf(o, p) {
}
}), superClass && _setPrototypeOf(subClass, superClass);
}(Point3d, Point);
var _super = function(Derived) {
var hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}();
return function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
};
}(Point3d);
var Derived, hasNativeReflectConstruct, _super = (Derived = Point3d, hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}(), function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
});
function Point3d() {
return _classCallCheck(this, Point3d), _super.apply(this, arguments);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,26 @@ function _setPrototypeOf(o, p) {
}
}), superClass && _setPrototypeOf(subClass, superClass);
}(Point3d, Point);
var _super = function(Derived) {
var hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}();
return function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
};
}(Point3d);
var Derived, hasNativeReflectConstruct, _super = (Derived = Point3d, hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}(), function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
});
function Point3d() {
return _classCallCheck(this, Point3d), _super.apply(this, arguments);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,26 @@ var A = function() {
}
}), superClass && _setPrototypeOf(subClass, superClass);
}(B, A);
var _super = function(Derived) {
var hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}();
return function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
};
}(B);
var Derived, hasNativeReflectConstruct, _super = (Derived = B, hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}(), function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
});
function B() {
return _classCallCheck(this, B), _super.apply(this, arguments);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,26 @@ var Base = function() {
}
}), superClass && _setPrototypeOf(subClass, superClass);
}(Derived1, Base1);
var Constructor, protoProps, staticProps, _super = function(Derived2) {
var hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}();
return function() {
var obj1, self, call, result, Super = _getPrototypeOf(Derived2);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj1 = call) && "undefined" != typeof Symbol && obj1.constructor === Symbol ? "symbol" : typeof obj1) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
};
}(Derived1);
var Constructor, protoProps, staticProps, Derived, hasNativeReflectConstruct, _super = (Derived = Derived1, hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}(), function() {
var obj1, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj1 = call) && "undefined" != typeof Symbol && obj1.constructor === Symbol ? "symbol" : typeof obj1) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
});
function Derived1() {
return _classCallCheck(this, Derived1), _super.apply(this, arguments);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,26 @@ var Lion = function(Animal) {
}
}), superClass && _setPrototypeOf(subClass, superClass);
}(Lion, Animal);
var Constructor, protoProps, staticProps, _super = function(Derived) {
var hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}();
return function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
};
}(Lion);
var Constructor, protoProps, staticProps, Derived, hasNativeReflectConstruct, _super = (Derived = Lion, hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}(), function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
});
function Lion() {
var _this;
return !function(instance, Constructor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,26 @@ var Lion = function(Animal) {
}
}), superClass && _setPrototypeOf(subClass, superClass);
}(Lion, Animal);
var Constructor, protoProps, staticProps, _super = function(Derived) {
var hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}();
return function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
};
}(Lion);
var Constructor, protoProps, staticProps, Derived, hasNativeReflectConstruct, _super = (Derived = Lion, hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}(), function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
});
function Lion() {
var _this;
return !function(instance, Constructor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,26 @@ var B = function() {
}
}), superClass && _setPrototypeOf(subClass, superClass);
}(C, B1);
var Constructor, protoProps, staticProps, _super = function(Derived) {
var hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}();
return function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
};
}(C);
var Constructor, protoProps, staticProps, Derived, hasNativeReflectConstruct, _super = (Derived = C, hasNativeReflectConstruct = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
} catch (e) {
return !1;
}
}(), function() {
var obj, self, call, result, Super = _getPrototypeOf(Derived);
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else result = Super.apply(this, arguments);
return self = this, (call = result) && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
})(self);
});
function C() {
return _classCallCheck(this, C), _super.apply(this, arguments);
}
Expand Down
Loading

1 comment on commit 1aa494b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 1aa494b Previous: 4966af8 Ratio
full_es2015 163125302 ns/iter (± 6135864) 152918656 ns/iter (± 3728093) 1.07
full_es2016 170439417 ns/iter (± 7306248) 158698715 ns/iter (± 6334198) 1.07
full_es2017 169015719 ns/iter (± 5651342) 159255978 ns/iter (± 5873266) 1.06
full_es2018 169135773 ns/iter (± 8105957) 158221018 ns/iter (± 7369472) 1.07
full_es2019 166809769 ns/iter (± 7274404) 157066969 ns/iter (± 6233802) 1.06
full_es2020 150664429 ns/iter (± 5974516) 140655044 ns/iter (± 4352062) 1.07
full_es3 210445033 ns/iter (± 6658359) 206561439 ns/iter (± 9563496) 1.02
full_es5 211048349 ns/iter (± 11625750) 206639296 ns/iter (± 14564419) 1.02
parser 679660 ns/iter (± 17122) 658781 ns/iter (± 11513) 1.03

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.