boo-lang / boo

The Boo Programming Language.
BSD 3-Clause "New" or "Revised" License
858 stars 146 forks source link

Generator expression handles "while" modifier incorrectly #195

Open masonwheeler opened 5 years ago

masonwheeler commented 5 years ago

Boo allows Python-style generator expressions, using the StatementModifier AST node for the filter part. StatementModifier contains three possible modifiers: if, unless, and while.

In GeneratorExpressionProcessor.CreateMoveNext, it processes a generator expression and, if it has a filter, turns that into an if statement if the StatementModifier type is If, or an unless statement otherwise, meaning that it's possible to write a generator expression using the while modifier, which the compiler will then proceed to treat as an unless modifier.

No compile error is raised stating that the while modifier is not valid here; the compiler silently generates bad code.