Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip unnecessary temp vars in
path.insertAfter
(#14268)
* Avoid storing value of expressions hidden in sequences * Register `.push`ed bindings in the correct scope * Avoid injecting a new tmp var when there is one available * Avoid temp var for `super()` * `.insertAfter` after the last sequence expression child * Avoid duplicated tmp vars in class heritage * Insert `.insertAfter` ndoes before when it's equivalent
- Loading branch information
1 parent
b17b8e2
commit 020a7b0
Showing
68 changed files
with
299 additions
and
277 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
...-properties/test/fixtures/assumption-setPublicClassFields/non-block-arrow-func/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}); |
4 changes: 2 additions & 2 deletions
4
...lass-properties/test/fixtures/assumption-setPublicClassFields/regression-T2983/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
; |
6 changes: 3 additions & 3 deletions
6
...class-properties/test/fixtures/assumption-setPublicClassFields/regression-T6719/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
4 changes: 2 additions & 2 deletions
4
...lass-properties/test/fixtures/assumption-setPublicClassFields/static-infer-name/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
4 changes: 1 addition & 3 deletions
4
...class-properties/test/fixtures/assumption-setPublicClassFields/super-expression/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
class Foo extends Bar { | ||
constructor() { | ||
var _temp; | ||
|
||
foo((_temp = super(), this.bar = "foo", _temp)); | ||
foo((super(), this.bar = "foo", this)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...gin-proposal-class-properties/test/fixtures/private-loose/non-block-arrow-func/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...-plugin-proposal-class-properties/test/fixtures/private-loose/static-infer-name/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
.../babel-plugin-proposal-class-properties/test/fixtures/private/regression-T2983/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
.../babel-plugin-proposal-class-properties/test/fixtures/private/static-infer-name/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
6 changes: 3 additions & 3 deletions
6
.../babel-plugin-proposal-class-properties/test/fixtures/private/static-self-field/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...l-plugin-proposal-class-properties/test/fixtures/public-loose/regression-T2983/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...l-plugin-proposal-class-properties/test/fixtures/public-loose/static-infer-name/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.