-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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
}, | ||
); | ||
return insertedFuncExpr; | ||
const insertedFuncDecl = varDecl.insertAfter(fn)[0]!; |
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.
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!
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.
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); |
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.
@mofeiZ looks this is already skipped here
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
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.