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

TransformationError: Node type 'GeneratorExp' [...] No transformation for the node #70

Open
joerick opened this issue Nov 6, 2022 · 2 comments

Comments

@joerick
Copy link

joerick commented Nov 6, 2022

Hi there! This is a very interesting project to me, currently trying to assess if it will solve a problem I have.

When converting some files in my project, I get this error:

$ pj pyinstrument/frame.py
An error occurred while compiling source file 'pyinstrument/frame.py'
TransformationError: Node type 'GeneratorExp': Line: 306, column: 29. No transformation for the node

The line that it's referencing is this:

        calculated_time = sum(child.time for child in self.children) + self.absorbed_time

So I guess that's the generator expression. I use them a lot in this project. I guess it might translate like so?

        let calculated_time = this.children.map(child => child.time).reduce((a, b) => a+b) + this.absorbed_time

Is there a way to get these generator expressions to convert?

@azazel75
Copy link
Collaborator

azazel75 commented Nov 6, 2022 via email

@joerick
Copy link
Author

joerick commented Nov 6, 2022

Ah, yeah, that might work. I almost think that, given generator expressions don't exist in JS, there's always gonna be an array involved so maybe it should always output an array for such an expression - at least, it seems better than failing.

I'll do some more experimentation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants