Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip unnecessary temp vars in path.insertAfter #14268

Merged
merged 7 commits into from Feb 14, 2022
Merged
@@ -1,13 +1,13 @@
export default (param => {
var _class, _temp;
var _class;

return _temp = _class = class App {
return _class = class App {
getParam() {
return param;
}

}, _class.props = {
prop1: 'prop1',
prop2: 'prop2'
}, _temp;
}, _class;
});
@@ -1,6 +1,6 @@
var _class, _temp;
var _class;

call((_temp = _class = class {}, _class.test = true, _temp));
call((_class = class {}, _class.test = true, _class));
export default class _class2 {}
_class2.test = true;
;
@@ -1,11 +1,11 @@
function withContext(ComposedComponent) {
var _class, _temp;
var _class;

return _temp = _class = class WithContext extends Component {}, _class.propTypes = {
return _class = class WithContext extends Component {}, _class.propTypes = {
context: PropTypes.shape({
addCss: PropTypes.func,
setTitle: PropTypes.func,
setMeta: PropTypes.func
})
}, _temp;
}, _class;
}
@@ -1,3 +1,3 @@
var _class, _temp;
var _class;

var Foo = (_temp = _class = class Foo {}, _class.num = 0, _temp);
var Foo = (_class = class Foo {}, _class.num = 0, _class);
@@ -1,8 +1,6 @@
class Foo extends Bar {
constructor() {
var _temp;

foo((_temp = super(), this.bar = "foo", _temp));
foo((super(), this.bar = "foo", this));
}

}
Expand Up @@ -20,7 +20,7 @@ var Foo = /*#__PURE__*/function () {

_babelHelpers$classPr = babelHelpers.classPrivateFieldLooseBase(this, _foo2)[_foo2];

var Nested = /*#__PURE__*/function (_babelHelpers$classPr2) {
var Nested = /*#__PURE__*/function () {
function Nested() {
babelHelpers.classCallCheck(this, Nested);
Object.defineProperty(this, _foo2, {
Expand All @@ -30,11 +30,11 @@ var Foo = /*#__PURE__*/function () {
}

babelHelpers.createClass(Nested, [{
key: _babelHelpers$classPr2,
key: _babelHelpers$classPr,
value: function () {}
}]);
return Nested;
}(_babelHelpers$classPr);
}();

babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo];
}
Expand Down
@@ -1,16 +1,16 @@
export default (param => {
var _class, _props, _temp;
var _class, _props;

return _temp = (_props = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("props"), _class = class App {
return _props = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("props"), (_class = class App {
getParam() {
return param;
}

}), Object.defineProperty(_class, _props, {
}, Object.defineProperty(_class, _props, {
writable: true,
value: {
prop1: 'prop1',
prop2: 'prop2'
}
}), _temp;
}), _class);
});
@@ -1,7 +1,7 @@
function classFactory() {
var _class, _foo, _bar, _temp;
var _class, _foo, _bar;

return _temp = (_foo = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("foo"), _bar = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("bar"), _class = class Foo {
return _foo = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("foo"), _bar = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("bar"), (_class = class Foo {
constructor() {
Object.defineProperty(this, _foo, {
writable: true,
Expand All @@ -25,10 +25,10 @@ function classFactory() {
return babelHelpers.classPrivateFieldLooseBase(Foo, _bar)[_bar];
}

}), Object.defineProperty(_class, _bar, {
}, Object.defineProperty(_class, _bar, {
writable: true,
value: "bar"
}), _temp;
}), _class);
}

var Foo1 = classFactory();
Expand Down
@@ -1,6 +1,6 @@
var _class, _num, _temp;
var _class, _num;

var Foo = (_temp = (_num = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("num"), _class = class Foo {}), Object.defineProperty(_class, _num, {
var Foo = (_num = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("num"), (_class = class Foo {}, Object.defineProperty(_class, _num, {
writable: true,
value: 0
}), _temp);
}), _class));
Expand Up @@ -8,13 +8,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
var _super = babelHelpers.createSuper(Foo);

function Foo() {
var _temp, _this;
var _this;

babelHelpers.classCallCheck(this, Foo);
foo((_temp = _this = _super.call(this), Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, {
foo((_this = _super.call(this), Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, {
writable: true,
value: "foo"
}), _temp));
}), babelHelpers.assertThisInitialized(_this)));
return _this;
}

Expand Down
Expand Up @@ -20,7 +20,7 @@ var Foo = /*#__PURE__*/function () {

_babelHelpers$classPr = babelHelpers.classPrivateFieldGet(this, _foo2);

var Nested = /*#__PURE__*/function (_babelHelpers$classPr2) {
var Nested = /*#__PURE__*/function () {
function Nested() {
babelHelpers.classCallCheck(this, Nested);
babelHelpers.classPrivateFieldInitSpec(this, _foo2, {
Expand All @@ -30,11 +30,11 @@ var Foo = /*#__PURE__*/function () {
}

babelHelpers.createClass(Nested, [{
key: _babelHelpers$classPr2,
key: _babelHelpers$classPr,
value: function () {}
}]);
return Nested;
}(_babelHelpers$classPr);
}();

babelHelpers.classPrivateFieldGet(this, _foo);
}
Expand Down
@@ -1,7 +1,7 @@
export default (param => {
var _class, _temp, _props;
var _class, _props;

return _temp = _class = class App {
return _class = class App {
getParam() {
return param;
}
Expand All @@ -12,5 +12,5 @@ export default (param => {
prop1: 'prop1',
prop2: 'prop2'
}
}, _temp;
}, _class;
});
@@ -1,7 +1,7 @@
function classFactory() {
var _class, _foo, _temp, _bar;
var _class, _foo, _bar;

return _temp = (_foo = /*#__PURE__*/new WeakMap(), _class = class Foo {
return _foo = /*#__PURE__*/new WeakMap(), (_class = class Foo {
constructor() {
babelHelpers.classPrivateFieldInitSpec(this, _foo, {
writable: true,
Expand All @@ -25,8 +25,8 @@ function classFactory() {
return babelHelpers.classStaticPrivateFieldSpecGet(Foo, _class, _bar);
}

}), _bar = {
}, _bar = {
writable: true,
value: "bar"
}, _temp;
}, _class);
}
@@ -1,9 +1,9 @@
var _class, _temp, _test;
var _class, _test;

call((_temp = _class = class {}, _test = {
call((_class = class {}, _test = {
writable: true,
value: true
}, _temp));
}, _class));
export default class _class2 {}
var _test2 = {
writable: true,
Expand Down
@@ -1,7 +1,7 @@
function withContext(ComposedComponent) {
var _class, _temp, _propTypes;
var _class, _propTypes;

return _temp = _class = class WithContext extends Component {}, _propTypes = {
return _class = class WithContext extends Component {}, _propTypes = {
writable: true,
value: {
context: PropTypes.shape({
Expand All @@ -10,5 +10,5 @@ function withContext(ComposedComponent) {
setMeta: PropTypes.func
})
}
}, _temp;
}, _class;
}
@@ -1,6 +1,6 @@
var _class, _temp, _num;
var _class, _num;

var Foo = (_temp = _class = class Foo {}, _num = {
var Foo = (_class = class Foo {}, _num = {
writable: true,
value: 0
}, _temp);
}, _class);
@@ -1,6 +1,6 @@
var _class, _temp, _x;
var _class, _x;

var f = (_temp = _class = class Foo {}, _x = {
var f = (_class = class Foo {}, _x = {
writable: true,
value: _class
}, babelHelpers.defineProperty(_class, "y", _class), _temp);
}, babelHelpers.defineProperty(_class, "y", _class), _class);
Expand Up @@ -8,13 +8,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
var _super = babelHelpers.createSuper(Foo);

function Foo() {
var _temp, _this;
var _this;

babelHelpers.classCallCheck(this, Foo);
foo((_temp = _this = _super.call(this), babelHelpers.classPrivateFieldInitSpec(babelHelpers.assertThisInitialized(_this), _bar, {
foo((_this = _super.call(this), babelHelpers.classPrivateFieldInitSpec(babelHelpers.assertThisInitialized(_this), _bar, {
writable: true,
value: "foo"
}), _temp));
}), babelHelpers.assertThisInitialized(_this)));
return _this;
}

Expand Down
Expand Up @@ -15,7 +15,7 @@ _ref3 = /regex/;
_baz = baz;
_ref4 = `template${expression}`;

var MyClass = /*#__PURE__*/function (_computed3, _computed4, _ref5) {
var MyClass = /*#__PURE__*/function () {
"use strict";

function MyClass() {
Expand All @@ -36,20 +36,20 @@ var MyClass = /*#__PURE__*/function (_computed3, _computed4, _ref5) {
get: function () {},
set: function (value) {}
}, {
key: _computed3,
key: _computed,
get: function () {}
}, {
key: _computed4,
key: _computed2,
set: function (value) {}
}, {
key: _ref5,
key: _ref2,
value: function () {}
}], [{
key: "10",
value: function _() {}
}]);
return MyClass;
}(_computed, _computed2, _ref2);
}();

MyClass[_one] = "test";
MyClass[2 * 4 + 7] = "247";
Expand Down
@@ -1,7 +1,7 @@
export default (param => {
var _class, _temp;
var _class;

return _temp = _class = /*#__PURE__*/function () {
return _class = /*#__PURE__*/function () {
function App() {
babelHelpers.classCallCheck(this, App);
}
Expand All @@ -16,5 +16,5 @@ export default (param => {
}(), _class.props = {
prop1: 'prop1',
prop2: 'prop2'
}, _temp;
}, _class;
});
@@ -1,8 +1,8 @@
var _class, _temp;
var _class;

call((_temp = _class = /*#__PURE__*/babelHelpers.createClass(function _class() {
call((_class = /*#__PURE__*/babelHelpers.createClass(function _class() {
babelHelpers.classCallCheck(this, _class);
}), _class.test = true, _temp));
}), _class.test = true, _class));

var _default = /*#__PURE__*/babelHelpers.createClass(function _default() {
babelHelpers.classCallCheck(this, _default);
Expand Down
@@ -1,7 +1,7 @@
function withContext(ComposedComponent) {
var _class, _temp;
var _class;

return _temp = _class = /*#__PURE__*/function (_Component) {
return _class = /*#__PURE__*/function (_Component) {
"use strict";

babelHelpers.inherits(WithContext, _Component);
Expand All @@ -20,5 +20,5 @@ function withContext(ComposedComponent) {
setTitle: PropTypes.func,
setMeta: PropTypes.func
})
}, _temp;
}, _class;
}
@@ -1,7 +1,7 @@
var _class, _temp;
var _class;

var Foo = (_temp = _class = /*#__PURE__*/babelHelpers.createClass(function Foo() {
var Foo = (_class = /*#__PURE__*/babelHelpers.createClass(function Foo() {
"use strict";

babelHelpers.classCallCheck(this, Foo);
}), _class.num = 0, _temp);
}), _class.num = 0, _class);
Expand Up @@ -6,10 +6,10 @@ var Foo = /*#__PURE__*/function (_Bar) {
var _super = babelHelpers.createSuper(Foo);

function Foo() {
var _temp, _this;
var _this;

babelHelpers.classCallCheck(this, Foo);
foo((_temp = _this = _super.call(this), _this.bar = "foo", _temp));
foo((_this = _super.call(this), _this.bar = "foo", babelHelpers.assertThisInitialized(_this)));
return _this;
}

Expand Down