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

[Babel 8] Remove some Scope methods #16705

Merged
merged 7 commits into from
Sep 7, 2024

Conversation

liuxingbaoyu
Copy link
Member

@liuxingbaoyu liuxingbaoyu commented Jul 31, 2024

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link babel/website#2935
Any Dependency Changes?
License MIT

@babel-bot
Copy link
Collaborator

babel-bot commented Jul 31, 2024

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

@liuxingbaoyu liuxingbaoyu marked this pull request as draft July 31, 2024 16:21
@liuxingbaoyu liuxingbaoyu changed the title [Babel 8] Remove Scope#{traverse,_renameFromMap} [Babel 8] Remove some Scope methods Jul 31, 2024
@liuxingbaoyu liuxingbaoyu marked this pull request as ready for review July 31, 2024 18:59
@liuxingbaoyu liuxingbaoyu added PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release pkg: traverse (scope) PR: Needs Docs labels Aug 1, 2024
Comment on lines 48 to 57
} else if (typeof i === "number") {
args.push(t.numericLiteral(i));

// Used in array-rest to create an array from a subset of an iterable.
helperName = "slicedToArray";
// TODO if (this.hub.isLoose("es6.forOf")) helperName += "-loose";
} else {
// Used in array-rest to create an array
helperName = "toArray";
}
Copy link
Member

Choose a reason for hiding this comment

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

In this file i is always true, right?

@@ -193,7 +248,7 @@ export class DestructuringTransformer {
) {
return node;
} else {
return this.scope.toArray(node, count, this.arrayLikeIsIterable);
return toArray(this.scope, node, count, this.arrayLikeIsIterable);
Copy link
Member

Choose a reason for hiding this comment

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

Can we maybe inline the toArray function here, given that this method is very short and already called toArray?


let helperName;
const args = [node];
if (i === true) {
Copy link
Member

Choose a reason for hiding this comment

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

Can i ever be true here?

@nicolo-ribaudo nicolo-ribaudo added this to the v8.0.0-beta milestone Sep 7, 2024
@nicolo-ribaudo nicolo-ribaudo merged commit 7467c9d into babel:main Sep 7, 2024
52 checks passed
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 8, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2024
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 pkg: traverse (scope) PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants