fix(es/minifier): Fix bugs (#3238)

swc_ecma_minifier:
 - `collapse_vars`: Respect `mutated`. (Closes #2679)
 - Add a test for https://github.com/vercel/next.js/issues/31084.
This commit is contained in:
Donny/강동윤 2022-01-12 16:57:54 +09:00 committed by GitHub
parent dc99778808
commit 74fd353053
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
79 changed files with 1006 additions and 346 deletions

View File

@ -12,25 +12,25 @@ var c = function() {
a(this, c);
};
module.exports = (function() {
var d, e, f = function() {
var d, e, f, g = function() {
"use strict";
var b, d, e;
function f() {
a(this, f);
function g() {
a(this, g);
}
return b = f, d = [
return b = g, d = [
{
key: "it",
value: function() {
this.bb = new f.MyA();
this.bb = new g.MyA();
}
}
], b(b.prototype, d), e && b(b, e), f;
], b(b.prototype, d), e && b(b, e), g;
}();
return d = f, e = c, "MyA" in d ? Object.defineProperty(d, "MyA", {
value: e,
return d = g, e = "MyA", f = c, e in d ? Object.defineProperty(d, e, {
value: f,
enumerable: !0,
configurable: !0,
writable: !0
}) : d.MyA = e, f;
}) : d[e] = f, g;
})();

View File

@ -0,0 +1,60 @@
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": false
},
"target": "es5",
"loose": false,
"minify": {
"compress": {
"arguments": false,
"arrows": true,
"booleans": true,
"booleans_as_integers": false,
"collapse_vars": true,
"comparisons": true,
"computed_props": false,
"conditionals": false,
"dead_code": false,
"directives": false,
"drop_console": false,
"drop_debugger": true,
"evaluate": true,
"expression": false,
"hoist_funs": false,
"hoist_props": true,
"hoist_vars": false,
"if_return": true,
"join_vars": true,
"keep_classnames": false,
"keep_fargs": true,
"keep_fnames": false,
"keep_infinity": false,
"loops": true,
"negate_iife": true,
"properties": true,
"reduce_funcs": false,
"reduce_vars": false,
"side_effects": true,
"switches": false,
"typeofs": true,
"unsafe": false,
"unsafe_arrows": false,
"unsafe_comps": false,
"unsafe_Function": false,
"unsafe_math": false,
"unsafe_symbols": false,
"unsafe_methods": false,
"unsafe_proto": false,
"unsafe_regexp": false,
"unsafe_undefined": false,
"unused": true
},
"mangle": false
}
},
"module": {
"type": "es6"
}
}

View File

@ -0,0 +1,6 @@
(function () {
var a = {};
a.b = 1;
a = null;
window.test = a;
})();

View File

@ -0,0 +1,4 @@
!function() {
var a = {};
a.b = 1, a = null, window.test = a;
}();

View File

@ -2,6 +2,12 @@ var A;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _getPrototypeOf(o) {
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
@ -68,23 +74,18 @@ function _setPrototypeOf(o, p) {
};
var Line = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function Line(start, end) {
_classCallCheck(this, Line), this.start = start, this.end = end;
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = Line, [
return Constructor = Line, protoProps = null, staticProps = [
{
key: "fromorigin2d",
value: function(p) {
return null;
}
}
]), Line;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Line;
}();
A1.Line = Line;
}(A || (A = {}));

View File

@ -2,6 +2,12 @@ var A;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
!function(A1) {
var B, Line, Point = function(x, y) {
"use strict";
@ -9,16 +15,11 @@ function _classCallCheck(instance, Constructor) {
};
A1.Point = Point, (B = A1.B || (A1.B = {})).Origin = new Point(0, 0), Line = (function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function Line(start, end) {
_classCallCheck(this, Line);
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = Line, [
return Constructor = Line, protoProps = null, staticProps = [
{
key: "fromOrigin",
value: function(p) {
@ -28,6 +29,6 @@ function _classCallCheck(instance, Constructor) {
}, p);
}
}
]), Line;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Line;
})(), B.Line = Line;
}(A || (A = {}));

View File

@ -1,6 +1,12 @@
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _getPrototypeOf(o) {
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
@ -13,16 +19,11 @@ function _setPrototypeOf(o, p) {
}
var C = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function C(a, b) {
_classCallCheck(this, C), this.a = a, this.b = b;
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = C, [
return Constructor = C, protoProps = null, staticProps = [
{
key: "fn",
value: function() {
@ -36,7 +37,7 @@ var C = function() {
},
set: function(v) {}
}
]), C;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}(), r = C.fn();
r.x, r.foo;
var D = function(C) {

View File

@ -1,10 +1,10 @@
var M;
!function(M) {
var obj, key;
obj = {}, (key = this.bar) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value;
obj = {}, value = 0, (key = this.bar) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0;
}) : obj[key] = value;
}(M || (M = {}));

View File

@ -1,10 +1,10 @@
var M;
!function(M) {
var obj, key;
obj = {}, (key = this.bar) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value;
obj = {}, value = 0, (key = this.bar) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0;
}) : obj[key] = value;
}(M || (M = {}));

View File

@ -1,7 +1,7 @@
var obj, key;
obj = {}, (key = this.bar) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value;
obj = {}, value = 0, (key = this.bar) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0;
}) : obj[key] = value;

View File

@ -1,7 +1,7 @@
var obj, key;
obj = {}, (key = this.bar) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value;
obj = {}, value = 0, (key = this.bar) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0;
}) : obj[key] = value;

View File

@ -4,12 +4,12 @@ function _defineProperties(target, props) {
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var obj, key, tmp = (obj = {}, (key = this.bar()) in obj ? Object.defineProperty(obj, key, {
value: 1,
var obj, key, value, tmp = (obj = {}, value = 1, (key = this.bar()) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 1, obj)[0], C = function() {
}) : obj[key] = value, obj)[0], C = function() {
"use strict";
var Constructor, protoProps, staticProps;
function C() {

View File

@ -4,12 +4,12 @@ function _defineProperties(target, props) {
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var obj, key, tmp = (obj = {}, (key = this.bar()) in obj ? Object.defineProperty(obj, key, {
value: 1,
var obj, key, value, tmp = (obj = {}, value = 1, (key = this.bar()) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 1, obj)[0], C = function() {
}) : obj[key] = value, obj)[0], C = function() {
"use strict";
var Constructor, protoProps, staticProps;
function C() {

View File

@ -20,7 +20,7 @@ function _setPrototypeOf(o, p) {
return o.__proto__ = p, o;
}, _setPrototypeOf(o, p);
}
var obj, key, Base = function() {
var obj, key, value, Base = function() {
"use strict";
function Base() {
_classCallCheck(this, Base);
@ -33,12 +33,12 @@ var obj, key, Base = function() {
}
}
]), Base;
}(), tmp = ((key = super.bar()) in (obj = {}) ? Object.defineProperty(obj, key, {
value: 1,
}(), tmp = (value = 1, (key = super.bar()) in (obj = {}) ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 1, obj)[0], C = function(Base) {
}) : obj[key] = value, obj)[0], C = function(Base) {
"use strict";
!function(subClass, superClass) {
if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function");

View File

@ -20,7 +20,7 @@ function _setPrototypeOf(o, p) {
return o.__proto__ = p, o;
}, _setPrototypeOf(o, p);
}
var obj, key, Base = function() {
var obj, key, value, Base = function() {
"use strict";
function Base() {
_classCallCheck(this, Base);
@ -33,12 +33,12 @@ var obj, key, Base = function() {
}
}
]), Base;
}(), tmp = ((key = super.bar()) in (obj = {}) ? Object.defineProperty(obj, key, {
value: 1,
}(), tmp = (value = 1, (key = super.bar()) in (obj = {}) ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 1, obj)[0], C = function(Base) {
}) : obj[key] = value, obj)[0], C = function(Base) {
"use strict";
!function(subClass, superClass) {
if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function");

View File

@ -1,17 +1,18 @@
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var C = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function C() {
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, C);
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = C, [
return Constructor = C, protoProps = null, staticProps = [
{
key: "bar",
value: function() {
@ -25,5 +26,5 @@ var C = function() {
})({}, "", function() {}), 0;
}
}
]), C;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}();

View File

@ -1,17 +1,18 @@
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var C = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function C() {
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, C);
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = C, [
return Constructor = C, protoProps = null, staticProps = [
{
key: "bar",
value: function() {
@ -25,5 +26,5 @@ var C = function() {
})({}, "", function() {}), 0;
}
}
]), C;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}();

View File

@ -1,6 +1,12 @@
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var Foo = function() {
"use strict";
_classCallCheck(this, Foo);
@ -9,21 +15,16 @@ var Foo = function() {
_classCallCheck(this, Foo2);
}, C = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function C() {
_classCallCheck(this, C);
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = C, [
return Constructor = C, protoProps = null, staticProps = [
{
key: "",
value: function() {
return new Foo;
}
}
]), C;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}();

View File

@ -1,6 +1,12 @@
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var Foo = function() {
"use strict";
_classCallCheck(this, Foo);
@ -9,21 +15,16 @@ var Foo = function() {
_classCallCheck(this, Foo2);
}, C = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function C() {
_classCallCheck(this, C);
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = C, [
return Constructor = C, protoProps = null, staticProps = [
{
key: "",
value: function() {
return new Foo;
}
}
]), C;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}();

View File

@ -1,7 +1,7 @@
var obj;
0 in (obj = {}) ? Object.defineProperty(obj, 0, {
value: 0,
var obj, key, value;
value = 0, (key = 0) in (obj = {}) ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[0] = 0;
}) : obj[key] = value;

View File

@ -1,7 +1,7 @@
var obj;
0 in (obj = {}) ? Object.defineProperty(obj, 0, {
value: 0,
var obj, key, value;
value = 0, (key = 0) in (obj = {}) ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[0] = 0;
}) : obj[key] = value;

View File

@ -1,7 +1,7 @@
var E1, E2, obj, key, E1, E2;
(E1 = E1 || (E1 = {}))[E1.x = 0] = "x", (E2 = E2 || (E2 = {}))[E2.x = 0] = "x", obj = {}, (key = E1.x || E2.x) in obj ? Object.defineProperty(obj, key, {
value: 0,
var E1, E2, obj, key, value, E1, E2;
(E1 = E1 || (E1 = {}))[E1.x = 0] = "x", (E2 = E2 || (E2 = {}))[E2.x = 0] = "x", obj = {}, value = 0, (key = E1.x || E2.x) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0;
}) : obj[key] = value;

View File

@ -1,7 +1,7 @@
var E1, E2, obj, key, E1, E2;
(E1 = E1 || (E1 = {}))[E1.x = 0] = "x", (E2 = E2 || (E2 = {}))[E2.x = 0] = "x", obj = {}, (key = E1.x || E2.x) in obj ? Object.defineProperty(obj, key, {
value: 0,
var E1, E2, obj, key, value, E1, E2;
(E1 = E1 || (E1 = {}))[E1.x = 0] = "x", (E2 = E2 || (E2 = {}))[E2.x = 0] = "x", obj = {}, value = 0, (key = E1.x || E2.x) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0;
}) : obj[key] = value;

View File

@ -1,7 +1,7 @@
var E, obj, key, E;
(E = E || (E = {}))[E.member = 0] = "member", obj = {}, (key = E.member) in obj ? Object.defineProperty(obj, key, {
value: 0,
var E, obj, key, value, E;
(E = E || (E = {}))[E.member = 0] = "member", obj = {}, value = 0, (key = E.member) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0;
}) : obj[key] = value;

View File

@ -1,7 +1,7 @@
var E, obj, key, E;
(E = E || (E = {}))[E.member = 0] = "member", obj = {}, (key = E.member) in obj ? Object.defineProperty(obj, key, {
value: 0,
var E, obj, key, value, E;
(E = E || (E = {}))[E.member = 0] = "member", obj = {}, value = 0, (key = E.member) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0;
}) : obj[key] = value;

View File

@ -1,17 +1,18 @@
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var C = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function C() {
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, C);
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = C, [
return Constructor = C, protoProps = null, staticProps = [
{
key: "",
value: function() {}
@ -26,5 +27,5 @@ var C = function() {
key: "",
set: function(x) {}
}
]), C;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}();

View File

@ -1,17 +1,18 @@
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var C = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function C() {
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, C);
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = C, [
return Constructor = C, protoProps = null, staticProps = [
{
key: "",
value: function() {}
@ -26,5 +27,5 @@ var C = function() {
key: "",
set: function(x) {}
}
]), C;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}();

View File

@ -1,7 +1,7 @@
var obj, key;
obj = {}, (key = e) in obj ? Object.defineProperty(obj, key, {
value: 1,
var obj, key, value;
obj = {}, value = 1, (key = e) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 1;
}) : obj[key] = value;

View File

@ -1,7 +1,7 @@
var obj, key;
obj = {}, (key = e) in obj ? Object.defineProperty(obj, key, {
value: 1,
var obj, key, value;
obj = {}, value = 1, (key = e) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 1;
}) : obj[key] = value;

View File

@ -1,6 +1,12 @@
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var C = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function C() {
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
@ -9,12 +15,7 @@ var C = function() {
value: void 0
});
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = C, [
return Constructor = C, protoProps = null, staticProps = [
{
key: "test",
value: function() {
@ -26,5 +27,5 @@ var C = function() {
})(new C(), _x, 10), new new C()().x = 123;
}
}
]), C;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}(), _x = new WeakMap();

View File

@ -8,9 +8,15 @@ function _classPrivateFieldSet(receiver, privateMap, value) {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var A = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function A() {
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11;
!function(instance, Constructor) {
@ -20,17 +26,12 @@ var A = function() {
value: 0
}), _classPrivateFieldSet(this, _field, 1), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) + 2), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) - 3), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) / 4), _classPrivateFieldSet(this, _field, 5 * _classPrivateFieldGet(this, _field)), _classPrivateFieldSet(this, _field, Math.pow(_classPrivateFieldGet(this, _field), 6)), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) % 7), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) << 8), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) >> 9), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) >>> 10), _classPrivateFieldSet(this, _field, 11 & _classPrivateFieldGet(this, _field)), _classPrivateFieldSet(this, _field, 12 | _classPrivateFieldGet(this, _field)), _classPrivateFieldSet(this, _field, 13 ^ _classPrivateFieldGet(this, _field)), _classPrivateFieldSet(A.getInstance(), _field, 1), _classPrivateFieldSet(_ref = A.getInstance(), _field, _classPrivateFieldGet(_ref, _field) + 2), _classPrivateFieldSet(_ref1 = A.getInstance(), _field, _classPrivateFieldGet(_ref1, _field) - 3), _classPrivateFieldSet(_ref2 = A.getInstance(), _field, _classPrivateFieldGet(_ref2, _field) / 4), _classPrivateFieldSet(_ref3 = A.getInstance(), _field, 5 * _classPrivateFieldGet(_ref3, _field)), _classPrivateFieldSet(_ref4 = A.getInstance(), _field, Math.pow(_classPrivateFieldGet(_ref4, _field), 6)), _classPrivateFieldSet(_ref5 = A.getInstance(), _field, _classPrivateFieldGet(_ref5, _field) % 7), _classPrivateFieldSet(_ref6 = A.getInstance(), _field, _classPrivateFieldGet(_ref6, _field) << 8), _classPrivateFieldSet(_ref7 = A.getInstance(), _field, _classPrivateFieldGet(_ref7, _field) >> 9), _classPrivateFieldSet(_ref8 = A.getInstance(), _field, _classPrivateFieldGet(_ref8, _field) >>> 10), _classPrivateFieldSet(_ref9 = A.getInstance(), _field, 11 & _classPrivateFieldGet(_ref9, _field)), _classPrivateFieldSet(_ref10 = A.getInstance(), _field, 12 | _classPrivateFieldGet(_ref10, _field)), _classPrivateFieldSet(_ref11 = A.getInstance(), _field, 13 ^ _classPrivateFieldGet(_ref11, _field));
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = A, [
return Constructor = A, protoProps = null, staticProps = [
{
key: "getInstance",
value: function() {
return new A();
}
}
]), A;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), A;
}(), _field = new WeakMap();

View File

@ -7,21 +7,22 @@ function _classPrivateFieldSet(receiver, privateMap, value) {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var Test = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function Test() {
_classCallCheck(this, Test), _y.set(this, {
writable: !0,
value: 123
});
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = Test, [
return Constructor = Test, protoProps = null, staticProps = [
{
key: "something",
value: function(obj) {
@ -42,5 +43,5 @@ var Test = function() {
}(_s, _y) + 1);
}
}
]), Test;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Test;
}(), _y = new WeakMap();

View File

@ -1,17 +1,18 @@
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var CharacterInfo = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function CharacterInfo() {
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, CharacterInfo);
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = CharacterInfo, [
return Constructor = CharacterInfo, protoProps = null, staticProps = [
{
key: "isDecimalDigit",
value: function(c) {
@ -30,5 +31,5 @@ var CharacterInfo = function() {
return Debug.assert(isHexDigit(c)), isDecimalDigit(c) ? c - CharacterCodes._0 : c >= CharacterCodes.A && c <= CharacterCodes.F ? c - CharacterCodes.A + 10 : c - CharacterCodes.a + 10;
}
}
]), CharacterInfo;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), CharacterInfo;
}();

View File

@ -1,17 +1,18 @@
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var C = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function C() {
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, C);
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = C, [
return Constructor = C, protoProps = null, staticProps = [
{
key: "foo",
value: function() {
@ -28,5 +29,5 @@ var C = function() {
}, 1;
}
}
]), C;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}();

View File

@ -1,17 +1,18 @@
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var _key, tmp = (_key = Symbol.iterator, Symbol.isConcatSpreadable), tmp1 = Symbol.toPrimitive, tmp2 = Symbol.toPrimitive, C = function() {
"use strict";
var Constructor;
var Constructor, protoProps, staticProps;
function C() {
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, C);
}
return (function(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
})(Constructor = C, [
return Constructor = C, protoProps = null, staticProps = [
{
key: tmp,
value: function() {}
@ -26,6 +27,6 @@ var _key, tmp = (_key = Symbol.iterator, Symbol.isConcatSpreadable), tmp1 = Symb
key: tmp2,
set: function(x) {}
}
]), C;
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}();
C[_key] = 0;

View File

@ -1,7 +1,7 @@
var obj, key;
obj = {}, (key = Symbol.isConcatSpreadable) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value;
obj = {}, value = 0, (key = Symbol.isConcatSpreadable) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0;
}) : obj[key] = value;

View File

@ -1,7 +1,7 @@
var obj, key;
obj = {}, (key = Symbol.nonsense) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value;
obj = {}, value = 0, (key = Symbol.nonsense) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0, ({})[Symbol.nonsense];
}) : obj[key] = value, ({})[Symbol.nonsense];

View File

@ -1,7 +1,7 @@
var obj, key;
(obj = {}, (key = Symbol.for) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value;
(obj = {}, value = 0, (key = Symbol.for) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0, obj)[Symbol.for];
}) : obj[key] = value, obj)[Symbol.for];

View File

@ -1,7 +1,7 @@
var obj, key;
obj = {}, (key = Symbol.prototype) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value;
obj = {}, value = 0, (key = Symbol.prototype) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0;
}) : obj[key] = value;

View File

@ -1,7 +1,7 @@
var obj, key, M;
M || (M = {}), (obj = {}, (key = Symbol.iterator) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value, M;
M || (M = {}), (obj = {}, value = 0, (key = Symbol.iterator) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0, obj)[(void 0).iterator];
}) : obj[key] = value, obj)[(void 0).iterator];

View File

@ -1,7 +1,7 @@
var obj, key, M;
M || (M = {}), (obj = {}, (key = Symbol.iterator) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value, M;
M || (M = {}), (obj = {}, value = 0, (key = Symbol.iterator) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0, obj)[(void 0).iterator];
}) : obj[key] = value, obj)[(void 0).iterator];

View File

@ -1,7 +1,7 @@
var obj, key;
(obj = {}, (key = Symbol.iterator) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value;
(obj = {}, value = 0, (key = Symbol.iterator) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0, obj)[Symbol.nonsense];
}) : obj[key] = value, obj)[Symbol.nonsense];

View File

@ -1,7 +1,7 @@
var obj, key;
obj = {}, (key = Symbol.foo) in obj ? Object.defineProperty(obj, key, {
value: 0,
var obj, key, value;
obj = {}, value = 0, (key = Symbol.foo) in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = 0;
}) : obj[key] = value;

View File

@ -1 +1,2 @@
"abc".concat("undefined" != typeof Symbol && "hi".constructor === Symbol ? "symbol" : "string", "def");
var obj;
"abc".concat((obj = "hi", "undefined" != typeof Symbol && obj.constructor === Symbol) ? "symbol" : typeof obj, "def");

View File

@ -1 +1,2 @@
"abc".concat("undefined" != typeof Symbol && "hi".constructor === Symbol ? "symbol" : "string", "def");
var obj;
"abc".concat((obj = "hi", "undefined" != typeof Symbol && obj.constructor === Symbol) ? "symbol" : typeof obj, "def");

View File

@ -5,6 +5,7 @@ dir="${1-"./inputs/"}"
echo "Removing useless files in $dir"
find $dir -type f \( \
-name "*.map" -o \
-name "*.html" -o \
-name "*.xml" -o \
-name "*.aac" -o \

View File

@ -11,12 +11,10 @@ export NEXT_DEBUG_MINIFY=1
rm -rf .next
# Install latest canary
# npm i next@canary
yarn add next@canary
# This is not useful data, as this is a script used only by me (@kdy1)
npx next telemetry disable
npx next build | grep '{ name:' | node "$SCRIPT_DIR/evaluate.js"
touch "$SCRIPT_DIR/../../tests/compress.rs"

View File

@ -39,6 +39,7 @@ if [[ $REDUCED_SIZE -le 3 ]]; then
./scripts/_/notify.sh "Removed $1"
(cd $dir && git commit -m "Remove a file as it didn't break anything" $1)
else
cat $wd/input.js
# mkdir -p "$SCRIPT_DIR/../tests/compress/fixture/reduced/$hash"
# cp "$wd/input.js" "$SCRIPT_DIR/../tests/compress/fixture/reduced/$hash/input.js"
./scripts/_/notify.sh "Found errornous input"

View File

@ -17,6 +17,7 @@ where
/// **This negates bool**.
///
/// Returns true if it's negated.
#[cfg_attr(feature = "debug", tracing::instrument(skip(self, expr)))]
pub(super) fn optimize_bang_within_logical_ops(
&mut self,
expr: &mut Expr,
@ -76,8 +77,8 @@ where
};
self.changed = true;
self.with_ctx(ctx).negate(&mut e.left);
self.with_ctx(ctx).negate(&mut e.right);
self.with_ctx(ctx).negate(&mut e.left, false);
self.with_ctx(ctx).negate(&mut e.right, is_ret_val_ignored);
if cfg!(feature = "debug") {
tracing::debug!("[Change] {} => {}", start, dump(&*e, false));

View File

@ -37,6 +37,7 @@ where
|| !usage.is_fn_local
|| usage.assign_count != 1
|| usage.var_kind == Some(VarDeclKind::Const)
|| usage.mutated
{
return;
}

View File

@ -39,7 +39,7 @@ where
in_bool_ctx: true,
..self.ctx
};
self.with_ctx(ctx).negate(&mut stmt.test);
self.with_ctx(ctx).negate(&mut stmt.test, false);
swap(alt, &mut *stmt.cons);
return;
}
@ -50,7 +50,7 @@ where
tracing::debug!(
"if_return: Negating an if statement because the alt is return / continue"
);
self.negate(&mut stmt.test);
self.negate(&mut stmt.test, false);
swap(alt, &mut *stmt.cons);
}
_ => return,

View File

@ -1287,15 +1287,15 @@ where
// `cond ? true : false` => !!cond
if lb && !rb {
self.negate(&mut cond.test);
self.negate(&mut cond.test);
self.negate(&mut cond.test, false);
self.negate(&mut cond.test, false);
*expr = *cond.test.take();
return;
}
// `cond ? false : true` => !cond
if !lb && rb {
self.negate(&mut cond.test);
self.negate(&mut cond.test, false);
*expr = *cond.test.take();
return;
}

View File

@ -161,14 +161,13 @@ where
}
/// TODO: Optimize based on the type.
pub(super) fn negate_twice(&mut self, e: &mut Expr) {
self.negate(e);
self.negate(e);
pub(super) fn negate_twice(&mut self, e: &mut Expr, is_ret_val_ignored: bool) {
self.negate(e, is_ret_val_ignored);
self.negate(e, is_ret_val_ignored);
}
pub(super) fn negate(&mut self, e: &mut Expr) {
self.changed = true;
negate(e, self.ctx.in_bool_ctx)
pub(super) fn negate(&mut self, e: &mut Expr, is_ret_val_ignored: bool) {
self.changed |= negate(e, self.ctx.in_bool_ctx, is_ret_val_ignored)
}
/// This method does
@ -294,7 +293,7 @@ where
self.changed = true;
tracing::debug!("Optimizing: e && true => !!e");
self.negate_twice(&mut bin.left);
self.negate_twice(&mut bin.left, false);
*e = *bin.left.take();
} else {
self.changed = true;
@ -314,7 +313,7 @@ where
self.changed = true;
tracing::debug!("Optimizing: e || false => !!e");
self.negate_twice(&mut bin.left);
self.negate_twice(&mut bin.left, false);
*e = *bin.left.take();
}
}

View File

@ -15,15 +15,13 @@ impl<M> Pure<'_, M>
where
M: Mode,
{
pub(super) fn negate_twice(&mut self, e: &mut Expr) {
self.changed = true;
negate(e, false);
negate(e, false);
pub(super) fn negate_twice(&mut self, e: &mut Expr, is_ret_val_ignored: bool) {
self.changed |= negate(e, false, is_ret_val_ignored);
self.changed |= negate(e, false, is_ret_val_ignored);
}
pub(super) fn negate(&mut self, e: &mut Expr, in_bool_ctx: bool) {
self.changed = true;
negate(e, in_bool_ctx)
pub(super) fn negate(&mut self, e: &mut Expr, in_bool_ctx: bool, is_ret_val_ignored: bool) {
self.changed |= negate(e, in_bool_ctx, is_ret_val_ignored)
}
/// `!(a && b)` => `!a || !b`
@ -53,7 +51,7 @@ where
}
tracing::debug!("bools: Optimizing `!(a && b)` as `!a || !b`");
self.changed = true;
self.negate(arg, false);
self.negate(arg, false, false);
*e = *arg.take();
return;
@ -76,7 +74,7 @@ where
return;
}
tracing::debug!("bools: Optimizing `!!(a || b)` as `!a && !b`");
self.negate(arg_of_arg, false);
self.negate(arg_of_arg, false, false);
*e = *arg.take();
return;
@ -296,7 +294,7 @@ where
let last = exprs.last_mut().unwrap();
self.optimize_expr_in_bool_ctx(last);
// Negate last element.
negate(last, false);
self.changed |= negate(last, false, false);
}
*n = *e.arg.take();
@ -541,7 +539,7 @@ where
}
if self.can_swap_bin_operands(&left, &right, false) {
tracing::debug!("Swapping operands of binary exprssion");
tracing::debug!("Swapping operands of binary expession");
swap(left, right);
return true;
}

View File

@ -26,7 +26,7 @@ where
tracing::debug!("conditionals: `foo ? true : bar` => `!!foo || bar`");
// Negate twice to convert `test` to boolean.
self.negate_twice(&mut cond.test);
self.negate_twice(&mut cond.test, false);
self.changed = true;
*e = Expr::Bin(BinExpr {
@ -43,7 +43,7 @@ where
tracing::debug!("conditionals: `foo ? false : bar` => `!foo && bar`");
self.changed = true;
self.negate(&mut cond.test, false);
self.negate(&mut cond.test, false, false);
*e = Expr::Bin(BinExpr {
span: cond.span,
@ -63,7 +63,7 @@ where
self.changed = true;
// Negate twice to convert `test` to boolean.
self.negate_twice(&mut cond.test);
self.negate_twice(&mut cond.test, false);
*e = Expr::Bin(BinExpr {
span: cond.span,
@ -78,7 +78,7 @@ where
tracing::debug!("conditionals: `foo ? bar : true` => `!foo || bar");
self.changed = true;
self.negate(&mut cond.test, false);
self.negate(&mut cond.test, false, false);
*e = Expr::Bin(BinExpr {
span: cond.span,
@ -136,7 +136,7 @@ where
tracing::debug!("conditionals: `a ? foo : bar` => `!a ? bar : foo` (considered cost)");
let start_str = dump(&*cond, false);
self.negate(&mut cond.test, true);
self.negate(&mut cond.test, true, false);
swap(&mut cond.cons, &mut cond.alt);
if cfg!(feature = "debug") {

View File

@ -126,8 +126,7 @@ impl<M> Pure<'_, M> {
match if_stmt {
Stmt::If(mut s) => {
assert_eq!(s.alt, None);
self.changed = true;
negate(&mut s.test, false);
self.changed |= negate(&mut s.test, false, false);
s.cons = if cons.len() == 1 && is_fine_for_if_cons(&cons[0]) {
Box::new(cons.into_iter().next().unwrap())

View File

@ -84,7 +84,7 @@ where
tracing::debug!("loops: Compressing for-if-break into a for statement");
// We negate because this `test` is used as a condition for `break`.
self.negate(test, true);
self.negate(test, true, false);
match s.test.take() {
Some(left) => {

View File

@ -126,7 +126,7 @@ where
self.changed |= v.changed;
}
} else {
let results = nodes
let changed = nodes
.par_iter_mut()
.map(|node| {
let mut v = Pure {
@ -144,11 +144,9 @@ where
v.changed
})
.collect::<Vec<_>>();
.reduce(|| false, |a, b| a || b);
for res in results {
self.changed |= res;
}
self.changed |= changed;
}
}
}

View File

@ -13,12 +13,15 @@ mod tests;
/// Creates `!e` where e is the expression passed as an argument.
///
/// Returns true if this modified ast.
///
/// # Note
///
/// This method returns `!e` if `!!e` is given as a argument.
///
/// TODO: Handle special cases like !1 or !0
pub(super) fn negate(e: &mut Expr, in_bool_ctx: bool) {
#[must_use]
pub(super) fn negate(e: &mut Expr, in_bool_ctx: bool, is_ret_val_ignored: bool) -> bool {
let start_str = dump(&*e, false);
match e {
@ -44,7 +47,7 @@ pub(super) fn negate(e: &mut Expr, in_bool_ctx: bool) {
}
};
tracing::debug!("negate: binary");
return;
return true;
}
Expr::Bin(BinExpr {
@ -55,10 +58,10 @@ pub(super) fn negate(e: &mut Expr, in_bool_ctx: bool) {
}) if is_ok_to_negate_rhs(&right) => {
tracing::debug!("negate: a && b => !a || !b");
negate(&mut **left, in_bool_ctx);
negate(&mut **right, in_bool_ctx);
let a = negate(&mut **left, in_bool_ctx, false);
let b = negate(&mut **right, in_bool_ctx, is_ret_val_ignored);
*op = op!("||");
return;
return a || b;
}
Expr::Bin(BinExpr {
@ -69,10 +72,10 @@ pub(super) fn negate(e: &mut Expr, in_bool_ctx: bool) {
}) if is_ok_to_negate_rhs(&right) => {
tracing::debug!("negate: a || b => !a && !b");
negate(&mut **left, in_bool_ctx);
negate(&mut **right, in_bool_ctx);
let a = negate(&mut **left, in_bool_ctx, false);
let b = negate(&mut **right, in_bool_ctx, is_ret_val_ignored);
*op = op!("&&");
return;
return a || b;
}
Expr::Cond(CondExpr { cons, alt, .. })
@ -80,17 +83,16 @@ pub(super) fn negate(e: &mut Expr, in_bool_ctx: bool) {
{
tracing::debug!("negate: cond");
negate(&mut **cons, in_bool_ctx);
negate(&mut **alt, in_bool_ctx);
return;
let a = negate(&mut **cons, in_bool_ctx, false);
let b = negate(&mut **alt, in_bool_ctx, is_ret_val_ignored);
return a || b;
}
Expr::Seq(SeqExpr { exprs, .. }) => {
if let Some(last) = exprs.last_mut() {
tracing::debug!("negate: seq");
negate(&mut **last, in_bool_ctx);
return;
return negate(&mut **last, in_bool_ctx, is_ret_val_ignored);
}
}
@ -106,7 +108,7 @@ pub(super) fn negate(e: &mut Expr, in_bool_ctx: bool) {
Expr::Unary(UnaryExpr { op: op!("!"), .. }) => {
tracing::debug!("negate: !!bool => !bool");
*e = *arg.take();
return;
return true;
}
Expr::Bin(BinExpr { op: op!("in"), .. })
| Expr::Bin(BinExpr {
@ -115,13 +117,13 @@ pub(super) fn negate(e: &mut Expr, in_bool_ctx: bool) {
}) => {
tracing::debug!("negate: !bool => bool");
*e = *arg.take();
return;
return true;
}
_ => {
if in_bool_ctx {
tracing::debug!("negate: !expr => expr (in bool context)");
*e = *arg.take();
return;
return true;
}
}
},
@ -129,16 +131,25 @@ pub(super) fn negate(e: &mut Expr, in_bool_ctx: bool) {
_ => {}
}
tracing::debug!("negate: e => !e");
if is_ret_val_ignored {
tracing::debug!("negate: noop because it's ignored");
*e = *arg;
*e = Expr::Unary(UnaryExpr {
span: DUMMY_SP,
op: op!("!"),
arg,
});
false
} else {
tracing::debug!("negate: e => !e");
if cfg!(feature = "debug") {
tracing::trace!("[Change] Negated `{}` as `{}`", start_str, dump(&*e, false));
*e = Expr::Unary(UnaryExpr {
span: DUMMY_SP,
op: op!("!"),
arg,
});
if cfg!(feature = "debug") {
tracing::trace!("[Change] Negated `{}` as `{}`", start_str, dump(&*e, false));
}
true
}
}
@ -207,7 +218,9 @@ pub(crate) fn is_ok_to_negate_rhs(rhs: &Expr) -> bool {
}
/// A negative value means that it's efficient to negate the expression.
#[cfg_attr(feature = "debug", tracing::instrument(skip(e)))]
pub(crate) fn negate_cost(e: &Expr, in_bool_ctx: bool, is_ret_val_ignored: bool) -> Option<isize> {
#[cfg_attr(test, tracing::instrument(skip(e)))]
fn cost(
e: &Expr,
in_bool_ctx: bool,
@ -319,13 +332,12 @@ pub(crate) fn negate_cost(e: &Expr, in_bool_ctx: bool, is_ret_val_ignored: bool)
}
})();
// Print more info while testing negate_cost
if cfg!(test) {
tracing::trace!(
"negation cost of `{}` = {}\nin_book_ctx={:?}\nis_ret_val_ignored={:?}",
dump(&e.clone().fold_with(&mut as_folder(fixer(None))), false),
tracing::debug!(
"negation cost of `{}` = {}",
dump(&e.clone().fold_with(&mut as_folder(fixer(None))), true),
cost,
in_bool_ctx,
is_ret_val_ignored
);
}

View File

@ -12,7 +12,7 @@ var ClassA = function ClassA1() {
_classCallCheck(this, ClassA1);
};
module.exports = (function() {
var obj, value, ClassB1 = function() {
var obj, key, value, ClassB1 = function() {
"use strict";
var Constructor, protoProps, staticProps;
function ClassB() {
@ -27,10 +27,10 @@ module.exports = (function() {
}
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), ClassB;
}();
return obj = ClassB1, value = ClassA, "MyA" in obj ? Object.defineProperty(obj, "MyA", {
return obj = ClassB1, key = "MyA", value = ClassA, key in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj.MyA = value, ClassB1;
}) : obj[key] = value, ClassB1;
})();

View File

@ -4291,18 +4291,20 @@
} : $assign;
},
18255: function(module, __unused_webpack_exports, __webpack_require__) {
var activeXDocument, anObject = __webpack_require__(83941), defineProperties = __webpack_require__(68381), enumBugKeys = __webpack_require__(91080), hiddenKeys = __webpack_require__(38276), html = __webpack_require__(40969), documentCreateElement = __webpack_require__(28554), sharedKey = __webpack_require__(16735), PROTOTYPE = "prototype", SCRIPT = "script", IE_PROTO = sharedKey("IE_PROTO"), EmptyConstructor = function() {}, scriptTag = function(content) {
var activeXDocument1, anObject = __webpack_require__(83941), defineProperties = __webpack_require__(68381), enumBugKeys = __webpack_require__(91080), hiddenKeys = __webpack_require__(38276), html = __webpack_require__(40969), documentCreateElement = __webpack_require__(28554), sharedKey = __webpack_require__(16735), PROTOTYPE = "prototype", SCRIPT = "script", IE_PROTO = sharedKey("IE_PROTO"), EmptyConstructor = function() {}, scriptTag = function(content) {
return "<" + SCRIPT + ">" + content + "</" + SCRIPT + ">";
}, NullProtoObjectViaActiveX = function(activeXDocument) {
return null.write(scriptTag("")), null.close(), null.parentWindow.Object;
activeXDocument.write(scriptTag("")), activeXDocument.close();
var temp = activeXDocument.parentWindow.Object;
return activeXDocument = null, temp;
}, NullProtoObjectViaIFrame = function() {
var iframeDocument, iframe = documentCreateElement("iframe");
return iframe.style.display = "none", html.appendChild(iframe), iframe.src = String("java" + SCRIPT + ":"), (iframeDocument = iframe.contentWindow.document).open(), iframeDocument.write(scriptTag("document.F=Object")), iframeDocument.close(), iframeDocument.F;
}, NullProtoObject = function() {
try {
activeXDocument = new ActiveXObject("htmlfile");
activeXDocument1 = new ActiveXObject("htmlfile");
} catch (error) {}
NullProtoObject = "undefined" != typeof document ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument);
NullProtoObject = "undefined" != typeof document ? document.domain && activeXDocument1 ? NullProtoObjectViaActiveX(activeXDocument1) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument1);
for(var length = enumBugKeys.length; length--;)delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
return NullProtoObject();
};
@ -17257,7 +17259,7 @@
P = c;
}
}, exports.unstable_pauseExecution = function() {}, exports.unstable_requestPaint = k, exports.unstable_runWithPriority = function(a, b) {
switch(3){
switch(a){
case 1:
case 2:
case 3:
@ -17265,9 +17267,10 @@
case 5:
break;
default:
a = 3;
}
var c = P;
P = 3;
P = a;
try {
return b();
} finally{

View File

@ -0,0 +1,44 @@
{
"arguments": false,
"arrows": true,
"booleans": true,
"booleans_as_integers": false,
"collapse_vars": true,
"comparisons": true,
"computed_props": false,
"conditionals": false,
"dead_code": false,
"directives": false,
"drop_console": false,
"drop_debugger": true,
"evaluate": true,
"expression": false,
"hoist_funs": false,
"hoist_props": true,
"hoist_vars": false,
"if_return": true,
"join_vars": true,
"keep_classnames": false,
"keep_fargs": true,
"keep_fnames": false,
"keep_infinity": false,
"loops": true,
"negate_iife": true,
"properties": true,
"reduce_funcs": false,
"reduce_vars": false,
"side_effects": true,
"switches": false,
"typeofs": true,
"unsafe": false,
"unsafe_arrows": false,
"unsafe_comps": false,
"unsafe_Function": false,
"unsafe_math": false,
"unsafe_symbols": false,
"unsafe_methods": false,
"unsafe_proto": false,
"unsafe_regexp": false,
"unsafe_undefined": false,
"unused": true
}

View File

@ -0,0 +1,5 @@
(function () {
var a = {};
a.b = 1;
a = null;
})();

View File

@ -0,0 +1,5 @@
!function() {
var a = {};
a.b = 1;
a = null;
}();

View File

@ -303,7 +303,7 @@
}
class ut {
constructor(t, e, n){
void 0 === e ? e = 0 : 0 > t.length && L(), void 0 === n ? n = t.length - 0 : n > t.length - 0 && L(), this.segments = t, this.offset = 0, this.len = n;
void 0 === e ? e = 0 : e > t.length && L(), void 0 === n ? n = t.length - e : n > t.length - e && L(), this.segments = t, this.offset = e, this.len = n;
}
get length() {
return this.len;

View File

@ -245,7 +245,7 @@
}
function daysInMonth(year, month) {
if (isNaN(year) || isNaN(month)) return NaN;
var modMonth = (month % 12 + 12) % 12;
var x, modMonth = (month % (x = 12) + x) % x;
return year += (month - modMonth) / 12, 1 === modMonth ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
}
indexOf = Array.prototype.indexOf ? Array.prototype.indexOf : function(o) {

View File

@ -0,0 +1,381 @@
// Generated by CoffeeScript 1.12.7
(function() {
"use strict";
var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
sax = require('sax');
events = require('events');
bom = require('./bom');
processors = require('./processors');
setImmediate = require('timers').setImmediate;
defaults = require('./defaults').defaults;
isEmpty = function(thing) {
return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0;
};
processItem = function(processors, item, key) {
var i, len, process;
for (i = 0, len = processors.length; i < len; i++) {
process = processors[i];
item = process(item, key);
}
return item;
};
exports.Parser = (function(superClass) {
extend(Parser, superClass);
function Parser(opts) {
this.parseStringPromise = bind(this.parseStringPromise, this);
this.parseString = bind(this.parseString, this);
this.reset = bind(this.reset, this);
this.assignOrPush = bind(this.assignOrPush, this);
this.processAsync = bind(this.processAsync, this);
var key, ref, value;
if (!(this instanceof exports.Parser)) {
return new exports.Parser(opts);
}
this.options = {};
ref = defaults["0.2"];
for (key in ref) {
if (!hasProp.call(ref, key)) continue;
value = ref[key];
this.options[key] = value;
}
for (key in opts) {
if (!hasProp.call(opts, key)) continue;
value = opts[key];
this.options[key] = value;
}
if (this.options.xmlns) {
this.options.xmlnskey = this.options.attrkey + "ns";
}
if (this.options.normalizeTags) {
if (!this.options.tagNameProcessors) {
this.options.tagNameProcessors = [];
}
this.options.tagNameProcessors.unshift(processors.normalize);
}
this.reset();
}
Parser.prototype.processAsync = function() {
var chunk, err;
try {
if (this.remaining.length <= this.options.chunkSize) {
chunk = this.remaining;
this.remaining = '';
this.saxParser = this.saxParser.write(chunk);
return this.saxParser.close();
} else {
chunk = this.remaining.substr(0, this.options.chunkSize);
this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length);
this.saxParser = this.saxParser.write(chunk);
return setImmediate(this.processAsync);
}
} catch (error1) {
err = error1;
if (!this.saxParser.errThrown) {
this.saxParser.errThrown = true;
return this.emit(err);
}
}
};
Parser.prototype.assignOrPush = function(obj, key, newValue) {
if (!(key in obj)) {
if (!this.options.explicitArray) {
return obj[key] = newValue;
} else {
return obj[key] = [newValue];
}
} else {
if (!(obj[key] instanceof Array)) {
obj[key] = [obj[key]];
}
return obj[key].push(newValue);
}
};
Parser.prototype.reset = function() {
var attrkey, charkey, ontext, stack;
this.removeAllListeners();
this.saxParser = sax.parser(this.options.strict, {
trim: false,
normalize: false,
xmlns: this.options.xmlns
});
this.saxParser.errThrown = false;
this.saxParser.onerror = (function(_this) {
return function(error) {
_this.saxParser.resume();
if (!_this.saxParser.errThrown) {
_this.saxParser.errThrown = true;
return _this.emit("error", error);
}
};
})(this);
this.saxParser.onend = (function(_this) {
return function() {
if (!_this.saxParser.ended) {
_this.saxParser.ended = true;
return _this.emit("end", _this.resultObject);
}
};
})(this);
this.saxParser.ended = false;
this.EXPLICIT_CHARKEY = this.options.explicitCharkey;
this.resultObject = null;
stack = [];
attrkey = this.options.attrkey;
charkey = this.options.charkey;
this.saxParser.onopentag = (function(_this) {
return function(node) {
var key, newValue, obj, processedKey, ref;
obj = {};
obj[charkey] = "";
if (!_this.options.ignoreAttrs) {
ref = node.attributes;
for (key in ref) {
if (!hasProp.call(ref, key)) continue;
if (!(attrkey in obj) && !_this.options.mergeAttrs) {
obj[attrkey] = {};
}
newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
if (_this.options.mergeAttrs) {
_this.assignOrPush(obj, processedKey, newValue);
} else {
obj[attrkey][processedKey] = newValue;
}
}
}
obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name;
if (_this.options.xmlns) {
obj[_this.options.xmlnskey] = {
uri: node.uri,
local: node.local
};
}
return stack.push(obj);
};
})(this);
this.saxParser.onclosetag = (function(_this) {
return function() {
var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;
obj = stack.pop();
nodeName = obj["#name"];
if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) {
delete obj["#name"];
}
if (obj.cdata === true) {
cdata = obj.cdata;
delete obj.cdata;
}
s = stack[stack.length - 1];
if (obj[charkey].match(/^\s*$/) && !cdata) {
emptyStr = obj[charkey];
delete obj[charkey];
} else {
if (_this.options.trim) {
obj[charkey] = obj[charkey].trim();
}
if (_this.options.normalize) {
obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim();
}
obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey];
if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
obj = obj[charkey];
}
}
if (isEmpty(obj)) {
obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr;
}
if (_this.options.validator != null) {
xpath = "/" + ((function() {
var i, len, results;
results = [];
for (i = 0, len = stack.length; i < len; i++) {
node = stack[i];
results.push(node["#name"]);
}
return results;
})()).concat(nodeName).join("/");
(function() {
var err;
try {
return obj = _this.options.validator(xpath, s && s[nodeName], obj);
} catch (error1) {
err = error1;
return _this.emit("error", err);
}
})();
}
if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') {
if (!_this.options.preserveChildrenOrder) {
node = {};
if (_this.options.attrkey in obj) {
node[_this.options.attrkey] = obj[_this.options.attrkey];
delete obj[_this.options.attrkey];
}
if (!_this.options.charsAsChildren && _this.options.charkey in obj) {
node[_this.options.charkey] = obj[_this.options.charkey];
delete obj[_this.options.charkey];
}
if (Object.getOwnPropertyNames(obj).length > 0) {
node[_this.options.childkey] = obj;
}
obj = node;
} else if (s) {
s[_this.options.childkey] = s[_this.options.childkey] || [];
objClone = {};
for (key in obj) {
if (!hasProp.call(obj, key)) continue;
objClone[key] = obj[key];
}
s[_this.options.childkey].push(objClone);
delete obj["#name"];
if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
obj = obj[charkey];
}
}
}
if (stack.length > 0) {
return _this.assignOrPush(s, nodeName, obj);
} else {
if (_this.options.explicitRoot) {
old = obj;
obj = {};
obj[nodeName] = old;
}
_this.resultObject = obj;
_this.saxParser.ended = true;
return _this.emit("end", _this.resultObject);
}
};
})(this);
ontext = (function(_this) {
return function(text) {
var charChild, s;
s = stack[stack.length - 1];
if (s) {
s[charkey] += text;
if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) {
s[_this.options.childkey] = s[_this.options.childkey] || [];
charChild = {
'#name': '__text__'
};
charChild[charkey] = text;
if (_this.options.normalize) {
charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim();
}
s[_this.options.childkey].push(charChild);
}
return s;
}
};
})(this);
this.saxParser.ontext = ontext;
return this.saxParser.oncdata = (function(_this) {
return function(text) {
var s;
s = ontext(text);
if (s) {
return s.cdata = true;
}
};
})(this);
};
Parser.prototype.parseString = function(str, cb) {
var err;
if ((cb != null) && typeof cb === "function") {
this.on("end", function(result) {
this.reset();
return cb(null, result);
});
this.on("error", function(err) {
this.reset();
return cb(err);
});
}
try {
str = str.toString();
if (str.trim() === '') {
this.emit("end", null);
return true;
}
str = bom.stripBOM(str);
if (this.options.async) {
this.remaining = str;
setImmediate(this.processAsync);
return this.saxParser;
}
return this.saxParser.write(str).close();
} catch (error1) {
err = error1;
if (!(this.saxParser.errThrown || this.saxParser.ended)) {
this.emit('error', err);
return this.saxParser.errThrown = true;
} else if (this.saxParser.ended) {
throw err;
}
}
};
Parser.prototype.parseStringPromise = function(str) {
return new Promise((function(_this) {
return function(resolve, reject) {
return _this.parseString(str, function(err, value) {
if (err) {
return reject(err);
} else {
return resolve(value);
}
});
};
})(this));
};
return Parser;
})(events);
exports.parseString = function(str, a, b) {
var cb, options, parser;
if (b != null) {
if (typeof b === 'function') {
cb = b;
}
if (typeof a === 'object') {
options = a;
}
} else {
if (typeof a === 'function') {
cb = a;
}
options = {};
}
parser = new exports.Parser(options);
return parser.parseString(str, cb);
};
exports.parseStringPromise = function(str, a) {
var options, parser;
if (typeof a === 'object') {
options = a;
}
parser = new exports.Parser(options);
return parser.parseStringPromise(str);
};
}).call(this);

View File

@ -0,0 +1,118 @@
(function() {
"use strict";
var bom, defaults, events, isEmpty, processItem, processors1, sax, setImmediate, bind = function(fn, me) {
return function() {
return fn.apply(me, arguments);
};
}, extend = function(child, parent) {
for(var key in parent)hasProp.call(parent, key) && (child[key] = parent[key]);
function ctor() {
this.constructor = child;
}
return ctor.prototype = parent.prototype, child.prototype = new ctor(), child.__super__ = parent.prototype, child;
}, hasProp = {}.hasOwnProperty;
sax = require("sax"), events = require("events"), bom = require("./bom"), processors1 = require("./processors"), setImmediate = require("timers").setImmediate, defaults = require("./defaults").defaults, isEmpty = function(thing) {
return "object" == typeof thing && null != thing && 0 === Object.keys(thing).length;
}, processItem = function(processors, item, key) {
var i, len;
for(i = 0, len = processors.length; i < len; i++)item = processors[i](item, key);
return item;
}, exports.Parser = (function(superClass) {
function Parser(opts) {
var key, ref, value;
if (this.parseStringPromise = bind(this.parseStringPromise, this), this.parseString = bind(this.parseString, this), this.reset = bind(this.reset, this), this.assignOrPush = bind(this.assignOrPush, this), this.processAsync = bind(this.processAsync, this), !(this instanceof exports.Parser)) return new exports.Parser(opts);
for(key in this.options = {}, ref = defaults["0.2"])hasProp.call(ref, key) && (value = ref[key], this.options[key] = value);
for(key in opts)hasProp.call(opts, key) && (value = opts[key], this.options[key] = value);
this.options.xmlns && (this.options.xmlnskey = this.options.attrkey + "ns"), this.options.normalizeTags && (this.options.tagNameProcessors || (this.options.tagNameProcessors = []), this.options.tagNameProcessors.unshift(processors1.normalize)), this.reset();
}
return extend(Parser, superClass), Parser.prototype.processAsync = function() {
var chunk, err;
try {
if (this.remaining.length <= this.options.chunkSize) return chunk = this.remaining, this.remaining = "", this.saxParser = this.saxParser.write(chunk), this.saxParser.close();
return chunk = this.remaining.substr(0, this.options.chunkSize), this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length), this.saxParser = this.saxParser.write(chunk), setImmediate(this.processAsync);
} catch (error1) {
if (err = error1, !this.saxParser.errThrown) return this.saxParser.errThrown = !0, this.emit(err);
}
}, Parser.prototype.assignOrPush = function(obj, key, newValue) {
return key in obj ? (obj[key] instanceof Array || (obj[key] = [
obj[key]
]), obj[key].push(newValue)) : this.options.explicitArray ? obj[key] = [
newValue
] : obj[key] = newValue;
}, Parser.prototype.reset = function() {
var attrkey, charkey, ontext, stack, _this, _this1, _this2, _this3, _this4;
return this.removeAllListeners(), this.saxParser = sax.parser(this.options.strict, {
trim: !1,
normalize: !1,
xmlns: this.options.xmlns
}), this.saxParser.errThrown = !1, _this = this, this.saxParser.onerror = function(error) {
if (_this.saxParser.resume(), !_this.saxParser.errThrown) return _this.saxParser.errThrown = !0, _this.emit("error", error);
}, _this1 = this, this.saxParser.onend = function() {
if (!_this1.saxParser.ended) return _this1.saxParser.ended = !0, _this1.emit("end", _this1.resultObject);
}, this.saxParser.ended = !1, this.EXPLICIT_CHARKEY = this.options.explicitCharkey, this.resultObject = null, stack = [], attrkey = this.options.attrkey, charkey = this.options.charkey, _this2 = this, this.saxParser.onopentag = function(node) {
var key, newValue, obj, processedKey, ref;
if ((obj = {})[charkey] = "", !_this2.options.ignoreAttrs) for(key in ref = node.attributes)hasProp.call(ref, key) && (attrkey in obj || _this2.options.mergeAttrs || (obj[attrkey] = {}), newValue = _this2.options.attrValueProcessors ? processItem(_this2.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key], processedKey = _this2.options.attrNameProcessors ? processItem(_this2.options.attrNameProcessors, key) : key, _this2.options.mergeAttrs ? _this2.assignOrPush(obj, processedKey, newValue) : obj[attrkey][processedKey] = newValue);
return obj["#name"] = _this2.options.tagNameProcessors ? processItem(_this2.options.tagNameProcessors, node.name) : node.name, _this2.options.xmlns && (obj[_this2.options.xmlnskey] = {
uri: node.uri,
local: node.local
}), stack.push(obj);
}, _this3 = this, this.saxParser.onclosetag = function() {
var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;
if (nodeName = (obj = stack.pop())["#name"], _this3.options.explicitChildren && _this3.options.preserveChildrenOrder || delete obj["#name"], !0 === obj.cdata && (cdata = obj.cdata, delete obj.cdata), s = stack[stack.length - 1], obj[charkey].match(/^\s*$/) && !cdata ? (emptyStr = obj[charkey], delete obj[charkey]) : (_this3.options.trim && (obj[charkey] = obj[charkey].trim()), _this3.options.normalize && (obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim()), obj[charkey] = _this3.options.valueProcessors ? processItem(_this3.options.valueProcessors, obj[charkey], nodeName) : obj[charkey], 1 === Object.keys(obj).length && charkey in obj && !_this3.EXPLICIT_CHARKEY && (obj = obj[charkey])), isEmpty(obj) && (obj = "" !== _this3.options.emptyTag ? _this3.options.emptyTag : emptyStr), null != _this3.options.validator && (xpath = "/" + (function() {
var i, len, results;
for(i = 0, results = [], len = stack.length; i < len; i++)node = stack[i], results.push(node["#name"]);
return results;
})().concat(nodeName).join("/"), (function() {
var err;
try {
obj = _this3.options.validator(xpath, s && s[nodeName], obj);
} catch (error1) {
return err = error1, _this3.emit("error", err);
}
})()), _this3.options.explicitChildren && !_this3.options.mergeAttrs && "object" == typeof obj) if (_this3.options.preserveChildrenOrder) {
if (s) {
for(key in s[_this3.options.childkey] = s[_this3.options.childkey] || [], objClone = {}, obj)hasProp.call(obj, key) && (objClone[key] = obj[key]);
s[_this3.options.childkey].push(objClone), delete obj["#name"], 1 === Object.keys(obj).length && charkey in obj && !_this3.EXPLICIT_CHARKEY && (obj = obj[charkey]);
}
} else node = {}, _this3.options.attrkey in obj && (node[_this3.options.attrkey] = obj[_this3.options.attrkey], delete obj[_this3.options.attrkey]), !_this3.options.charsAsChildren && _this3.options.charkey in obj && (node[_this3.options.charkey] = obj[_this3.options.charkey], delete obj[_this3.options.charkey]), Object.getOwnPropertyNames(obj).length > 0 && (node[_this3.options.childkey] = obj), obj = node;
return stack.length > 0 ? _this3.assignOrPush(s, nodeName, obj) : (_this3.options.explicitRoot && (old = obj, (obj = {})[nodeName] = old), _this3.resultObject = obj, _this3.saxParser.ended = !0, _this3.emit("end", _this3.resultObject));
}, _this4 = this, ontext = function(text) {
var charChild, s;
if (s = stack[stack.length - 1]) return s[charkey] += text, _this4.options.explicitChildren && _this4.options.preserveChildrenOrder && _this4.options.charsAsChildren && (_this4.options.includeWhiteChars || "" !== text.replace(/\\n/g, "").trim()) && (s[_this4.options.childkey] = s[_this4.options.childkey] || [], (charChild = {
"#name": "__text__"
})[charkey] = text, _this4.options.normalize && (charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim()), s[_this4.options.childkey].push(charChild)), s;
}, this.saxParser.ontext = ontext, this.saxParser.oncdata = function(text) {
var s;
if (s = ontext(text)) return s.cdata = !0;
};
}, Parser.prototype.parseString = function(str, cb) {
var err1;
null != cb && "function" == typeof cb && (this.on("end", function(result) {
return this.reset(), cb(null, result);
}), this.on("error", function(err) {
return this.reset(), cb(err);
}));
try {
if (str = str.toString(), "" === str.trim()) return this.emit("end", null), !0;
if (str = bom.stripBOM(str), this.options.async) return this.remaining = str, setImmediate(this.processAsync), this.saxParser;
return this.saxParser.write(str).close();
} catch (error1) {
if (err1 = error1, !(this.saxParser.errThrown || this.saxParser.ended)) return this.emit("error", err1), this.saxParser.errThrown = !0;
if (this.saxParser.ended) throw err1;
}
}, Parser.prototype.parseStringPromise = function(str) {
var _this;
return new Promise((_this = this, function(resolve, reject) {
return _this.parseString(str, function(err, value) {
return err ? reject(err) : resolve(value);
});
}));
}, Parser;
})(events), exports.parseString = function(str, a, b) {
var cb, options;
return null != b ? ("function" == typeof b && (cb = b), "object" == typeof a && (options = a)) : ("function" == typeof a && (cb = a), options = {}), new exports.Parser(options).parseString(str, cb);
}, exports.parseStringPromise = function(str, a) {
var options;
return "object" == typeof a && (options = a), new exports.Parser(options).parseStringPromise(str);
};
}).call(this);

View File

@ -0,0 +1,4 @@
{
"defaults": true,
"toplevel": true
}

View File

@ -1862,9 +1862,9 @@
function LocationHashbangUrl(appBase, hashPrefix) {
var appBaseNoFile = stripFile(appBase);
parseAbsoluteUrl(appBase, this, appBase), this.$$parse = function(url) {
var path, url1, base, firstPathSegmentMatch, withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url), withoutHashUrl = "#" == withoutBaseUrl.charAt(0) ? beginsWith(hashPrefix, withoutBaseUrl) : this.$$html5 ? withoutBaseUrl : "";
var path, url1, base, firstPathSegmentMatch, windowsFilePathExp, withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url), withoutHashUrl = "#" == withoutBaseUrl.charAt(0) ? beginsWith(hashPrefix, withoutBaseUrl) : this.$$html5 ? withoutBaseUrl : "";
if (!isString(withoutHashUrl)) throw $locationMinErr("ihshprfx", "Invalid url \"{0}\", missing hash prefix \"{1}\".", url, hashPrefix);
parseAppUrl(withoutHashUrl, this, appBase), path = this.$$path, url1 = withoutHashUrl, base = appBase, 0 === url1.indexOf(base) && (url1 = url1.replace(base, "")), this.$$path = /^\/?.*?:(\/.*)/.exec(url1) ? path : (firstPathSegmentMatch = /^\/?.*?:(\/.*)/.exec(path)) ? firstPathSegmentMatch[1] : path, this.$$compose();
parseAppUrl(withoutHashUrl, this, appBase), path = this.$$path, url1 = withoutHashUrl, base = appBase, windowsFilePathExp = /^\/?.*?:(\/.*)/, 0 === url1.indexOf(base) && (url1 = url1.replace(base, "")), this.$$path = windowsFilePathExp.exec(url1) ? path : (firstPathSegmentMatch = windowsFilePathExp.exec(path)) ? firstPathSegmentMatch[1] : path, this.$$compose();
}, this.$$compose = function() {
var search = toKeyValue(this.$$search), hash = this.$$hash ? "#" + encodeUriSegment(this.$$hash) : "";
this.$$url = encodePath(this.$$path) + (search ? "?" + search : "") + hash, this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : "");

View File

@ -824,21 +824,24 @@
jQuery.event = {
global: {},
add: function(elem, types, handler, data, selector) {
var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data(null);
if (elemData) for(handler.handler && (handler = (handleObjIn = handler).handler, selector = handleObjIn.selector), handler.guid || (handler.guid = jQuery.guid++), (events = elemData.events) || (events = elemData.events = {}), (eventHandle = elemData.handle) || ((eventHandle = elemData.handle = function(e) {
return "function" === core_strundefined || e && jQuery.event.triggered === e.type ? undefined1 : jQuery.event.dispatch.apply(eventHandle.elem, arguments);
}).elem = null), t = (types = (types || "").match(core_rnotwhite) || [
""
]).length; t--;)type = origType = (tmp = rtypenamespace.exec(types[t]) || [])[1], namespaces = (tmp[2] || "").split(".").sort(), special = jQuery.event.special[type] || {}, type = (selector ? special.delegateType : special.bindType) || type, special = jQuery.event.special[type] || {}, handleObj = jQuery.extend({
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test(selector),
namespace: namespaces.join(".")
}, handleObjIn), (handlers = events[type]) || ((handlers = events[type] = []).delegateCount = 0, (!special.setup || !1 === special.setup.call(null, data, namespaces, eventHandle)) && (null.addEventListener ? null.addEventListener(type, eventHandle, !1) : null.attachEvent && null.attachEvent("on" + type, eventHandle))), special.add && (special.add.call(null, handleObj), handleObj.handler.guid || (handleObj.handler.guid = handler.guid)), selector ? handlers.splice(handlers.delegateCount++, 0, handleObj) : handlers.push(handleObj), jQuery.event.global[type] = !0;
var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data(elem);
if (elemData) {
for(handler.handler && (handler = (handleObjIn = handler).handler, selector = handleObjIn.selector), handler.guid || (handler.guid = jQuery.guid++), (events = elemData.events) || (events = elemData.events = {}), (eventHandle = elemData.handle) || ((eventHandle = elemData.handle = function(e) {
return "function" === core_strundefined || e && jQuery.event.triggered === e.type ? undefined1 : jQuery.event.dispatch.apply(eventHandle.elem, arguments);
}).elem = elem), t = (types = (types || "").match(core_rnotwhite) || [
""
]).length; t--;)type = origType = (tmp = rtypenamespace.exec(types[t]) || [])[1], namespaces = (tmp[2] || "").split(".").sort(), special = jQuery.event.special[type] || {}, type = (selector ? special.delegateType : special.bindType) || type, special = jQuery.event.special[type] || {}, handleObj = jQuery.extend({
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test(selector),
namespace: namespaces.join(".")
}, handleObjIn), (handlers = events[type]) || ((handlers = events[type] = []).delegateCount = 0, (!special.setup || !1 === special.setup.call(elem, data, namespaces, eventHandle)) && (elem.addEventListener ? elem.addEventListener(type, eventHandle, !1) : elem.attachEvent && elem.attachEvent("on" + type, eventHandle))), special.add && (special.add.call(elem, handleObj), handleObj.handler.guid || (handleObj.handler.guid = handler.guid)), selector ? handlers.splice(handlers.delegateCount++, 0, handleObj) : handlers.push(handleObj), jQuery.event.global[type] = !0;
elem = null;
}
},
remove: function(elem, types, handler, selector, mappedTypes) {
var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData(elem) && jQuery._data(elem);
@ -1140,12 +1143,14 @@
return fn[expando] = !0, fn;
}
function assert(fn) {
document.createElement("div");
var div = document.createElement("div");
try {
return fn(null);
return fn(div);
} catch (e) {
return !1;
} finally{}
} finally{
div = null;
}
}
function Sizzle(selector, context, results, seed) {
var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector;

View File

@ -601,7 +601,7 @@
var v, uc_prop = prop.charAt(0).toUpperCase() + prop.substr(1), props = (prop + " " + vendors.join(uc_prop + " ") + uc_prop).split(" ");
for(v in props)if (undefined !== fbCSS[props[v]]) return !0;
}
var nokiaLTE7_3, w1, ua, platform, wkmatch, wkversion, ffmatch, ffversion, operammobilematch, omversion, rebase, fauxBase, base, supports, element, documentElement, getComputedStyle, ua1, fakeBody = $("<body>").prependTo("html"), fbCSS = fakeBody[0].style, vendors = [
var nokiaLTE7_3, w1, ua, platform, wkmatch, wkversion, ffmatch, ffversion, operammobilematch, omversion, rebase, fauxBase, base, fauxEle, href, supports, element, documentElement, getComputedStyle, ua1, fakeBody = $("<body>").prependTo("html"), fbCSS = fakeBody[0].style, vendors = [
"Webkit",
"Moz",
"O"
@ -630,9 +630,9 @@
boxShadow: !!propExists("boxShadow") && !bb,
fixedPosition: (w1 = window1, ua = navigator.userAgent, platform = navigator.platform, wkmatch = ua.match(/AppleWebKit\/([0-9]+)/), wkversion = !!wkmatch && wkmatch[1], ffmatch = ua.match(/Fennec\/([0-9]+)/), ffversion = !!ffmatch && ffmatch[1], operammobilematch = ua.match(/Opera Mobi\/([0-9]+)/), omversion = !!operammobilematch && operammobilematch[1], !((platform.indexOf("iPhone") > -1 || platform.indexOf("iPad") > -1 || platform.indexOf("iPod") > -1) && wkversion && wkversion < 534 || w1.operamini && "[object OperaMini]" === ({}).toString.call(w1.operamini) || operammobilematch && omversion < 7458 || ua.indexOf("Android") > -1 && wkversion && wkversion < 533 || ffversion && ffversion < 6 || "palmGetResource" in window1 && wkversion && wkversion < 534 || ua.indexOf("MeeGo") > -1 && ua.indexOf("NokiaBrowser/8.5.0") > -1)),
scrollTop: ("pageXOffset" in window1 || "scrollTop" in document1.documentElement || "scrollTop" in fakeBody[0]) && !("palmGetResource" in window1) && !operamini,
dynamicBaseTag: (fauxBase = location.protocol + "//" + location.host + location.pathname + "ui-dir/", (base = $("head base")).length ? base.attr("href") : base = $("<base>", {
dynamicBaseTag: (fauxBase = location.protocol + "//" + location.host + location.pathname + "ui-dir/", fauxEle = null, href = "", (base = $("head base")).length ? href = base.attr("href") : base = fauxEle = $("<base>", {
href: fauxBase
}).appendTo("head"), rebase = $("<a href='testurl' />").prependTo(fakeBody)[0].href, base[0].href = location.pathname, 0 === rebase.indexOf(fauxBase)),
}).appendTo("head"), rebase = $("<a href='testurl' />").prependTo(fakeBody)[0].href, base[0].href = href || location.pathname, fauxEle && fauxEle.remove(), 0 === rebase.indexOf(fauxBase)),
cssPointerEvents: (element = document1.createElement("x"), documentElement = document1.documentElement, getComputedStyle = window1.getComputedStyle, "pointerEvents" in element.style && (element.style.pointerEvents = "auto", element.style.pointerEvents = "x", documentElement.appendChild(element), supports = getComputedStyle && "auto" === getComputedStyle(element, "").pointerEvents, documentElement.removeChild(element), !!supports)),
boundingRect: void 0 !== document1.createElement("div").getBoundingClientRect,
inlineSVG: function() {
@ -1690,7 +1690,7 @@
}, $.mobile._registerInternalEvents = function() {
var getAjaxFormData = function($form, calculateOnly) {
var url, formData, vclickedName, method, ret = !0;
return !(!$.mobile.ajaxEnabled || $form.is(":jqmData(ajax='false')") || !$form.jqmHijackable().length || $form.attr("target")) && (url = $lastVClicked && $lastVClicked.attr("formaction") || $form.attr("action"), method = ($form.attr("method") || "get").toLowerCase(), url || (url = $.mobile.getClosestBaseUrl($form), "get" === method && (url = $.mobile.path.parseUrl(url).hrefNoSearch), url === $.mobile.path.documentBase.hrefNoHash && (url = documentUrl.hrefNoSearch)), url = $.mobile.path.makeUrlAbsolute(url, $.mobile.getClosestBaseUrl($form)), (!$.mobile.path.isExternal(url) || !!$.mobile.path.isPermittedCrossDomainRequest(documentUrl, url)) && (calculateOnly || (formData = $form.serializeArray(), $lastVClicked && $lastVClicked[0].form === $form[0] && (vclickedName = $lastVClicked.attr("name")) && ($.each(formData, function(key, value) {
return !(!$.mobile.ajaxEnabled || $form.is(":jqmData(ajax='false')") || !$form.jqmHijackable().length || $form.attr("target")) && (url = $lastVClicked && $lastVClicked.attr("formaction") || $form.attr("action"), method = ($form.attr("method") || "get").toLowerCase(), url || (url = $.mobile.getClosestBaseUrl($form), "get" === method && (url = $.mobile.path.parseUrl(url).hrefNoSearch), url !== $.mobile.path.documentBase.hrefNoHash || (url = documentUrl.hrefNoSearch)), url = $.mobile.path.makeUrlAbsolute(url, $.mobile.getClosestBaseUrl($form)), (!$.mobile.path.isExternal(url) || !!$.mobile.path.isPermittedCrossDomainRequest(documentUrl, url)) && (calculateOnly || (formData = $form.serializeArray(), $lastVClicked && $lastVClicked[0].form === $form[0] && (vclickedName = $lastVClicked.attr("name")) && ($.each(formData, function(key, value) {
if (value.name === vclickedName) return vclickedName = "", !1;
}), vclickedName && formData.push({
name: vclickedName,

View File

@ -2270,7 +2270,7 @@ Elements.prototype = {
this.empty().adopt(target.childNodes), supportsHTML5Elements || fragment1.removeChild(wrapper), wrapper = null;
}));
var testForm = document.createElement("form");
null.innerHTML = "<select><option>s</option></select>", "s" != null.firstChild.value && (Element.Properties.value = {
testForm.innerHTML = "<select><option>s</option></select>", "s" != testForm.firstChild.value && (Element.Properties.value = {
set: function(value) {
if ("select" != this.get("tag")) return this.setProperty("value", value);
for(var options = this.getElements("option"), i = 0; i < options.length; i++){
@ -2298,8 +2298,8 @@ Elements.prototype = {
});
})(), (function() {
var html = document.html, el = document.createElement("div");
null.style.color = "red", null.style.color = null;
var doesNotRemoveStyles = "red" == null.style.color;
el.style.color = "red", el.style.color = null;
var doesNotRemoveStyles = "red" == el.style.color;
el = null, Element.Properties.styles = {
set: function(styles) {
this.setStyles(styles);

View File

@ -785,7 +785,7 @@
priorityLevel = 3;
}
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = 3;
currentPriorityLevel = priorityLevel;
try {
return eventHandler();
} finally{
@ -1099,10 +1099,10 @@
for(var newElement = cloneElement.apply(this, arguments), i = 2; i < arguments.length; i++)validateChildKeys(arguments[i], newElement.type);
return validatePropTypes(newElement), newElement;
}, exports.createContext = function(defaultValue, calculateChangedBits) {
void 0 === calculateChangedBits && (calculateChangedBits = null);
void 0 === calculateChangedBits ? calculateChangedBits = null : null !== calculateChangedBits && "function" != typeof calculateChangedBits && error1("createContext: Expected the optional second argument to be a function. Instead received: %s", calculateChangedBits);
var context = {
$$typeof: REACT_CONTEXT_TYPE,
_calculateChangedBits: null,
_calculateChangedBits: calculateChangedBits,
_currentValue: defaultValue,
_currentValue2: defaultValue,
_threadCount: 0,

View File

@ -721,7 +721,7 @@
var type = props.type;
if (("submit" === type || "reset" === type) && (void 0 === props.value || null === props.value)) return;
var initialValue = toString(node._wrapperState.initialValue);
isHydrating || initialValue !== node.value && (node.value = initialValue), node.defaultValue = initialValue;
isHydrating || initialValue === node.value || (node.value = initialValue), node.defaultValue = initialValue;
}
var name = node.name;
"" !== name && (node.name = ""), node.defaultChecked = !node.defaultChecked, node.defaultChecked = !!node._wrapperState.initialChecked, "" !== name && (node.name = name);
@ -6863,22 +6863,22 @@
return workInProgress.child;
})(current13, workInProgress16, renderLanes12);
case 5:
return current6 = current13, workInProgress8 = workInProgress16, renderLanes5 = renderLanes12, pushHostContext(workInProgress8), null === current6 && tryToClaimNextHydratableInstance(workInProgress8), type7 = workInProgress8.type, nextProps2 = workInProgress8.pendingProps, prevProps = null !== current6 ? current6.memoizedProps : null, shouldSetTextContent(type7, nextProps2) || null !== prevProps && shouldSetTextContent(type7, prevProps) && (workInProgress8.flags |= 16), markRef(current6, workInProgress8), reconcileChildren(current6, workInProgress8, null, renderLanes5), workInProgress8.child;
return current6 = current13, workInProgress8 = workInProgress16, renderLanes5 = renderLanes12, pushHostContext(workInProgress8), null === current6 && tryToClaimNextHydratableInstance(workInProgress8), type7 = workInProgress8.type, nextProps2 = workInProgress8.pendingProps, prevProps = null !== current6 ? current6.memoizedProps : null, nextChildren6 = nextProps2.children, shouldSetTextContent(type7, nextProps2) ? nextChildren6 = null : null !== prevProps && shouldSetTextContent(type7, prevProps) && (workInProgress8.flags |= 16), markRef(current6, workInProgress8), reconcileChildren(current6, workInProgress8, nextChildren6, renderLanes5), workInProgress8.child;
case 6:
return current7 = current13, workInProgress9 = workInProgress16, null === current7 && tryToClaimNextHydratableInstance(workInProgress9), null;
case 13:
return updateSuspenseComponent(current13, workInProgress16, renderLanes12);
case 4:
return current8 = current13, workInProgress10 = workInProgress16, renderLanes6 = renderLanes12, pushHostContainer(workInProgress10, workInProgress10.stateNode.containerInfo), nextChildren5 = workInProgress10.pendingProps, null === current8 ? workInProgress10.child = reconcileChildFibers(workInProgress10, null, nextChildren5, renderLanes6) : reconcileChildren(current8, workInProgress10, nextChildren5, renderLanes6), workInProgress10.child;
return current8 = current13, workInProgress10 = workInProgress16, renderLanes6 = renderLanes12, pushHostContainer(workInProgress10, workInProgress10.stateNode.containerInfo), nextChildren2 = workInProgress10.pendingProps, null === current8 ? workInProgress10.child = reconcileChildFibers(workInProgress10, null, nextChildren2, renderLanes6) : reconcileChildren(current8, workInProgress10, nextChildren2, renderLanes6), workInProgress10.child;
case 11:
var type = workInProgress16.type, _unresolvedProps2 = workInProgress16.pendingProps, _resolvedProps2 = workInProgress16.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
return updateForwardRef(current13, workInProgress16, type, _resolvedProps2, renderLanes12);
case 7:
return current9 = current13, workInProgress11 = workInProgress16, renderLanes7 = renderLanes12, nextChildren2 = workInProgress11.pendingProps, reconcileChildren(current9, workInProgress11, nextChildren2, renderLanes7), workInProgress11.child;
return current9 = current13, workInProgress11 = workInProgress16, renderLanes7 = renderLanes12, nextChildren3 = workInProgress11.pendingProps, reconcileChildren(current9, workInProgress11, nextChildren3, renderLanes7), workInProgress11.child;
case 8:
return current10 = current13, workInProgress12 = workInProgress16, renderLanes8 = renderLanes12, nextChildren3 = workInProgress12.pendingProps.children, reconcileChildren(current10, workInProgress12, nextChildren3, renderLanes8), workInProgress12.child;
return current10 = current13, workInProgress12 = workInProgress16, renderLanes8 = renderLanes12, nextChildren4 = workInProgress12.pendingProps.children, reconcileChildren(current10, workInProgress12, nextChildren4, renderLanes8), workInProgress12.child;
case 12:
return current11 = current13, workInProgress13 = workInProgress16, renderLanes9 = renderLanes12, workInProgress13.flags |= Update, (stateNode1 = workInProgress13.stateNode).effectDuration = 0, stateNode1.passiveEffectDuration = 0, nextChildren4 = workInProgress13.pendingProps.children, reconcileChildren(current11, workInProgress13, nextChildren4, renderLanes9), workInProgress13.child;
return current11 = current13, workInProgress13 = workInProgress16, renderLanes9 = renderLanes12, workInProgress13.flags |= Update, (stateNode1 = workInProgress13.stateNode).effectDuration = 0, stateNode1.passiveEffectDuration = 0, nextChildren5 = workInProgress13.pendingProps.children, reconcileChildren(current11, workInProgress13, nextChildren5, renderLanes9), workInProgress13.child;
case 10:
return (function(current, workInProgress17, renderLanes13) {
var context2 = workInProgress17.type._context, newProps = workInProgress17.pendingProps, oldProps = workInProgress17.memoizedProps, newValue2 = newProps.value;
@ -6934,7 +6934,7 @@
case 9:
return current12 = current13, workInProgress14 = workInProgress16, renderLanes10 = renderLanes12, void 0 === (context1 = workInProgress14.type)._context ? context1 === context1.Consumer || hasWarnedAboutUsingContextAsConsumer || (hasWarnedAboutUsingContextAsConsumer = !0, error1("Rendering <Context> directly is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")) : context1 = context1._context, "function" != typeof (render = (newProps2 = workInProgress14.pendingProps).children) && error1("A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it."), prepareToReadContext(workInProgress14, renderLanes10), newValue1 = readContext(context1, newProps2.unstable_observedBits), ReactCurrentOwner$1.current = workInProgress14, setIsRendering(!0), newChildren = render(newValue1), setIsRendering(!1), workInProgress14.flags |= 1, reconcileChildren(current12, workInProgress14, newChildren, renderLanes10), workInProgress14.child;
case 14:
var current6, workInProgress8, renderLanes5, type7, nextProps2, prevProps, current7, workInProgress9, current8, workInProgress10, renderLanes6, nextChildren5, current9, workInProgress11, renderLanes7, nextChildren2, current10, workInProgress12, renderLanes8, nextChildren3, current11, workInProgress13, renderLanes9, stateNode1, nextChildren4, current12, workInProgress14, renderLanes10, newChildren, context1, newProps2, render, newValue1, _type2 = workInProgress16.type, _resolvedProps3 = resolveDefaultProps(_type2, workInProgress16.pendingProps);
var current6, workInProgress8, renderLanes5, type7, nextProps2, prevProps, nextChildren6, current7, workInProgress9, current8, workInProgress10, renderLanes6, nextChildren2, current9, workInProgress11, renderLanes7, nextChildren3, current10, workInProgress12, renderLanes8, nextChildren4, current11, workInProgress13, renderLanes9, stateNode1, nextChildren5, current12, workInProgress14, renderLanes10, newChildren, context1, newProps2, render, newValue1, _type2 = workInProgress16.type, _resolvedProps3 = resolveDefaultProps(_type2, workInProgress16.pendingProps);
if (workInProgress16.type !== workInProgress16.elementType) {
var outerPropTypes1 = _type2.propTypes;
outerPropTypes1 && checkPropTypes(outerPropTypes1, _resolvedProps3, "prop", getComponentName(_type2));

View File

@ -1,5 +1,5 @@
function f() {
function g() {}
return (g = 0), false;
return g = 0, !!g;
}
console.log(f());

View File

@ -1,4 +1,4 @@
//! Ensure that worng macro definitions are catched by swc monorepo.
//! Ensure that wrong macro definitions are catched by swc monorepo.
use swc_ecma_visit::Fold;