-
Notifications
You must be signed in to change notification settings - Fork 48.6k
[compiler] Implement support for hoisted and recursive functions #30922
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
Conversation
Summary: Introduces a new binding kind for functions that allows them to be hoisted. Also has the result of causing all nested function declarations to be outputted as function declarations, not as let bindings. [ghstack-poisoned]
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
case InstructionKind.HoistedFunction: | ||
CompilerError.invariant(false, { | ||
reason: 'Unexpected HoistedFunction variable in for..in collection', | ||
description: null, | ||
loc: iterableItem.loc, | ||
suggestions: null, | ||
}); | ||
case InstructionKind.Function: | ||
CompilerError.invariant(false, { | ||
reason: 'Unexpected Function variable in for..in collection', | ||
description: null, | ||
loc: iterableItem.loc, | ||
suggestions: null, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could just collapse all these unsupported cases
case InstructionKind.HoistedFunction: | ||
CompilerError.invariant(false, { | ||
reason: 'Unexpected HoistedFunction variable in for..of collection', | ||
description: null, | ||
loc: iterableItem.loc, | ||
suggestions: null, | ||
}); | ||
case InstructionKind.Function: | ||
CompilerError.invariant(false, { | ||
reason: 'Unexpected Function variable in for..of collection', | ||
description: null, | ||
loc: iterableItem.loc, | ||
suggestions: null, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow awesome!
…ctions" Summary: Introduces a new binding kind for functions that allows them to be hoisted. Also has the result of causing all nested function declarations to be outputted as function declarations, not as let bindings. [ghstack-poisoned]
…ctions" Summary: Introduces a new binding kind for functions that allows them to be hoisted. Also has the result of causing all nested function declarations to be outputted as function declarations, not as let bindings. [ghstack-poisoned]
Summary: Introduces a new binding kind for functions that allows them to be hoisted. Also has the result of causing all nested function declarations to be outputted as function declarations, not as let bindings. ghstack-source-id: fa40d49 Pull Request resolved: #30922 DiffTrain build for [d7167c3](d7167c3)
**breaking change for canary users: Bumps peer dependency of React from `19.0.0-rc-206df66e-20240912` to `19.0.0-rc-a99d8e8d-20240916`** [diff facebook/react@206df66e...a99d8e8d](facebook/react@206df66...a99d8e8) <details> <summary>React upstream changes</summary> - facebook/react#30977 - facebook/react#30971 - facebook/react#30922 - facebook/react#30917 - facebook/react#30902 - facebook/react#30912 - facebook/react#30970 - facebook/react#30969 - facebook/react#30967 - facebook/react#30966 - facebook/react#30960 - facebook/react#30968 - facebook/react#30961 - facebook/react#28255 - facebook/react#30957 - facebook/react#30958 - facebook/react#30959 - facebook/react#30951 - facebook/react#30954 - facebook/react#30920 - facebook/react#30942 </details>
Stack from ghstack (oldest at bottom):
Summary:
Introduces a new binding kind for functions that allows them to be hoisted. Also has the result of causing all nested function declarations to be outputted as function declarations, not as let bindings.