-
Notifications
You must be signed in to change notification settings - Fork 22
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
Function declarations/expressions with #
names not properly handled
#10
Comments
The only situation in which this really needs deconflicting is when there's code inside the function trying to access a variable |
Actually, no, we can only cut corners when it's a named function expression, not a function declaration. It seems easiest to just always deconflict this. diff --git a/src/print/handlers.ts b/src/print/handlers.ts
index 240fc8e..fd2240a 100644
--- a/src/print/handlers.ts
+++ b/src/print/handlers.ts
@@ -569,7 +569,7 @@ const handlers: Record<string, Handler> = {
if (node.async) chunks.push(c('async '));
chunks.push(c(node.generator ? 'function* ' : 'function '));
- if (node.id) chunks.push(c(node.id.name, node.id));
+ if (node.id) chunks.push(...handle(node.id, state));
chunks.push(c('('));
const params = node.params.map(p => handle(p, { This looks like it works. PR coming soon. |
deconflict #-identifiers in function names
If this were handled correctly, it would allow a nice solution to sveltejs/svelte#3900
The text was updated successfully, but these errors were encountered: