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] Always emit FuncDecl for outlined functions #30464

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

poteto
Copy link
Member

@poteto poteto commented Jul 25, 2024

Stack from ghstack (oldest at bottom):

Addresses follow up feedback from #30446. Since the outlined function is
guaranteed to have a module-scoped unique identifier name, we can
simplify the insertion logic for the outlined function to always emit a
function declaration rather than switch based on the original function
type. This is fine because the outlined function is synthetic anyway.

[ghstack-poisoned]
Copy link

vercel bot commented Jul 25, 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 Jul 25, 2024 6:10pm

poteto added a commit that referenced this pull request Jul 25, 2024
Addresses follow up feedback from #30446. Since the outlined function is
guaranteed to have a module-scoped unique identifier name, we can
simplify the insertion logic for the outlined function to always emit a
function declaration rather than switch based on the original function
type. This is fine because the outlined function is synthetic anyway.

ghstack-source-id: 0a4d1f7b0a5a34f8ed68c463b1a153c51c3ea75e
Pull Request resolved: #30464
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jul 25, 2024
@poteto poteto requested a review from josephsavona July 25, 2024 18:04
@poteto poteto requested review from mofeiZ and gsathya July 25, 2024 19:19
},
);
return insertedFuncExpr;
const insertedFuncDecl = varDecl.insertAfter(fn)[0]!;
Copy link
Contributor

@mofeiZ mofeiZ Jul 25, 2024

Choose a reason for hiding this comment

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

Since we're not using the createNewFunctionNode helper here, let's manually exclude from re-compilation (ALREADY_COMPILED.add(transformedFn);)

ohh nvm, I see we're already doing this after calling insertNewOutlinedFunctionNode. please disregard!

Copy link
Contributor

@mofeiZ mofeiZ left a comment

Choose a reason for hiding this comment

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

Thanks for the followup!

@@ -482,7 +468,7 @@ export function compileProgram(
reason: 'Unexpected nested outlined functions',
loc: outlined.fn.loc,
});
const fn = insertNewFunctionNode(current.fn, outlined.fn);
const fn = insertNewOutlinedFunctionNode(current.fn, outlined.fn);
fn.skip();
ALREADY_COMPILED.add(fn.node);
Copy link
Member Author

Choose a reason for hiding this comment

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

@mofeiZ looks this is already skipped here

@poteto poteto merged commit 2e87654 into gh/poteto/35/base Jul 25, 2024
21 checks passed
poteto added a commit that referenced this pull request Jul 25, 2024
Addresses follow up feedback from #30446. Since the outlined function is
guaranteed to have a module-scoped unique identifier name, we can
simplify the insertion logic for the outlined function to always emit a
function declaration rather than switch based on the original function
type. This is fine because the outlined function is synthetic anyway.

ghstack-source-id: 0a4d1f7b0a5a34f8ed68c463b1a153c51c3ea75e
Pull Request resolved: #30464
@poteto poteto deleted the gh/poteto/35/head branch July 25, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants