chrivers / pyjaco

Python to JavaScript translator
http://pyjaco.org
MIT License
140 stars 18 forks source link

List comprehension with conditions does not work #69

Closed caioariede closed 12 years ago

caioariede commented 12 years ago

First, thank you guys, this project is awesome! :)

I found that..

Given:

[x for x in (1, 2, 3, 4) if (x % 2) == 0]

We expect:

[2, 4]

But what we get is:

[1, 2, 3, 4]
chrivers commented 12 years ago

Thank you for the kind words - it's always nice to know that people enjoy what we do :-)

And thanks for reporting this bug. I assume you're using HEAD from chrivers/pyjaco? If not, please try that. And in any case, can you please attach the resulting JS code? Thank you very much.

chrivers commented 12 years ago

(It is very possible that this is a bug, because list comprehension is one area where we don't have 100% support)

caioariede commented 12 years ago

I tried with http://pyjaco.org/demo (not HEAD)

Using trunk I got the result I expected :)

Thanks!