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

[compiler] Implement support for hoisted and recursive functions #30922

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

mvitousek
Copy link
Contributor

@mvitousek mvitousek commented Sep 9, 2024

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.

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]
Copy link

vercel bot commented Sep 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 16, 2024 6:10pm

mvitousek added a commit that referenced this pull request Sep 9, 2024
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: 7ebf5ea58611c3b29f38d73320eb12e37b49b28b
Pull Request resolved: #30922
Comment on lines 1004 to 1017
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,
});
Copy link
Contributor

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

Comment on lines 1120 to 1133
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,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor

@josephsavona josephsavona left a 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]
mvitousek added a commit that referenced this pull request Sep 9, 2024
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: 597e5478208fb10d8d09b3d5b217c18cf9e74de5
Pull Request resolved: #30922
…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]
mvitousek added a commit that referenced this pull request Sep 16, 2024
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: fa40d4909fb3d30c23691e36510ebb3c3cc41053
Pull Request resolved: #30922
@mvitousek mvitousek merged commit ad41acf into gh/mvitousek/32/base Sep 16, 2024
19 checks passed
mvitousek added a commit that referenced this pull request Sep 16, 2024
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: fa40d4909fb3d30c23691e36510ebb3c3cc41053
Pull Request resolved: #30922
@mvitousek mvitousek deleted the gh/mvitousek/32/head branch September 16, 2024 18:13
github-actions bot pushed a commit that referenced this pull request Sep 16, 2024
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: fa40d4909fb3d30c23691e36510ebb3c3cc41053
Pull Request resolved: #30922

DiffTrain build for [d7167c3](d7167c3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants