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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing castings #37

Closed
1 task done
hugoattal opened this issue Apr 6, 2023 · 2 comments 路 Fixed by #98
Closed
1 task done

Missing castings #37

hugoattal opened this issue Apr 6, 2023 · 2 comments 路 Fixed by #98
Labels
bug Something isn't working

Comments

@hugoattal
Copy link
Contributor

hugoattal commented Apr 6, 2023

Describe the feature

Hey 馃檪!

So I'd like to parse any code using builder.raw, but it fails on some castings.
For example, I'd like to generate foo(bar) (bar being a variable), doing it like this does not work:

builders.functionCall("foo", builders.raw("bar"));

Here are a few more examples.

const result = builders.raw("bar()");
console.log(generateCode(result)); // works
const result = builders.raw("bar"); // MagicastError: Casting "Identifier" is not supported
console.log(generateCode(result));
const result = builders.raw("() => 'a'"); // MagicastError: Casting "ArrowFunctionExpression" is not supported
console.log(generateCode(result));

I can help with the implementation if needed!

Additional information

  • Would you be willing to help implement this feature?
@antfu antfu added the bug Something isn't working label Apr 6, 2023
@antfu
Copy link
Member

antfu commented Apr 6, 2023

Nice spotting! Indeed we have a lot to improve. PR welcome!

@denis-sokolov
Copy link

Another one to the list is FunctionDeclaration (#43).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants