GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — fix(regenerator): catch-pattern support review issues by JLHwung · Pull Request #18763 · babel/babel Conversation
Contributor
In this PR we fix the review issues on #18732:
Case 1function* g(obj = { [arguments.length]() {} }) { yield Object.keys(obj); } console.log(g().next().value); // main → ["0"] // PR → ReferenceError: _args is not defined The root cause of case 1 is that the Case 2function* g() { for (let arguments = 1; arguments < 3; arguments++) { yield arguments; } } console.log([...g()]); // main → [1, 2] // PR → [1] The root cause of case 2 is that the Case 3function* g() { try { yield 1; } catch ([__proto__]) { yield { __proto__, __proto__: null }; } } console.log(g().next().value); // main → 1 // PR → SyntaxError: Duplicate __proto__ fields are not allowed in object literals The root casue of case 3 is a renamer bug. This is now fixed in babel-traverse.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsRenaming the binding of `{ __proto__ }` turned it into
`{ __proto__: _t }`, which sets the prototype instead of defining an own
property, and is a syntax error next to another `__proto__: value`.
The key is now `["__proto__"]` in object literals.
Assisted-by: Claude Opus 5.5
…ndings Block-scoped bindings named `arguments`, such as `for (let arguments = 1; ...)`, were left alone and then hoisted into the inner function, where `arguments` is that function's own. They are now renamed before hoisting, so every remaining `arguments` reference in the body is the generator's own and is replaced with `_args`. The `this`/`arguments` detection no longer visits the parameters, which stay in the outer function. `function* g(a = arguments.length)` used to reference `_args` before it was declared, and computed keys of methods in parameter defaults did too. Assisted-by: Claude Opus 5.5 …` renaming `renameArgumentsBindingsVisitor` starts from the children of the body, so every scope it visits differs from the function scope and the check against it was always true. The catch clause code now reads the parameter, scope and body from a single `handler` path instead of three separate lookups with casts. Assisted-by: Claude Opus 5.5
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
liuxingbaoyu
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks!
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThis branch has not been deployedNo deployments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabelsProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | ||||||||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |