Skip to content

Move more class state out of replaceSupers#7750

Merged
jridgewell merged 1 commit intobabel:masterfrom
jridgewell:class-stuff-out-of-replace-supers
Apr 22, 2018
Merged

Move more class state out of replaceSupers#7750
jridgewell merged 1 commit intobabel:masterfrom
jridgewell:class-stuff-out-of-replace-supers

Conversation

@jridgewell
Copy link
Copy Markdown
Member

Yes, the output is uglier. But, this is necessary for me to refactor
replaceSupers for #7733, which is necessary for both #7555 and
#7553 (comment).

I'm still in the middle of cleaning up all this code. Don't expect
transformClass to survive much longer as it's written currently.

@jridgewell jridgewell added the PR: Internal 🏠 A type of pull request used for our changelog categories label Apr 18, 2018
@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Apr 18, 2018

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/7675/

@babel-bot
Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/7624/

environmentVisitor,
{
ReturnStatement(path, state) {
// TODO get this shit out of here
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lol 🙌 ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

https://github.com/babel/babel/pull/7737/files#diff-74b3eb66512735b6b5013e5d41e33642R65. I've been planing this removal for the issues linked in OP.

woops.super.test();
_this = _Foo.call(this) || this;

_Foo.prototype.test.call(_this);
Copy link
Copy Markdown
Member

@hzoo hzoo Apr 18, 2018

Choose a reason for hiding this comment

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

I would think loose mode doesn't need this assertion right? At least it wasn't there before

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's closer to spec code, but this is only here because I haven't optimized any special cases yet.

babelHelpers.classCallCheck(this, Outer);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Outer).call(this));

var _babelHelpers$get$cal = babelHelpers.get(babelHelpers.getPrototypeOf(Outer.prototype), "toString", babelHelpers.assertThisInitialized(_this)).call(_this);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Didn't really look into it, but is it supposed to call assertThisInitialized multiple twice like this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, but it won't hurt. Like I said in the OP, this output is worse because I'm not optimizing any special cases yet, I just need to refactor code out of here so I can work on access-to-function-calls so we can get Private props. Then I can start work on refactoring all of the classes transform.

Yes, the output is uglier. But, this is necessary for me to refactor
`replaceSupers` for babel#7733, which is necessary for both babel#7555 and
babel#7553 (comment).

I'm still in the middle of cleaning up all this code. Don't expect
`transformClass` to survive much longer as it's written currently.
@jridgewell jridgewell force-pushed the class-stuff-out-of-replace-supers branch from 7354d7f to fbe6705 Compare April 22, 2018 02:48
@jridgewell jridgewell merged commit 0a257e8 into babel:master Apr 22, 2018
@jridgewell jridgewell deleted the class-stuff-out-of-replace-supers branch April 22, 2018 02:56
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants