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.
Boo allows Python-style generator expressions, using the
StatementModifier
AST node for the filter part.StatementModifier
contains three possible modifiers:if
,unless
, andwhile
.In
GeneratorExpressionProcessor.CreateMoveNext
, it processes a generator expression and, if it has a filter, turns that into anif
statement if theStatementModifier
type isIf
, or anunless
statement otherwise, meaning that it's possible to write a generator expression using thewhile
modifier, which the compiler will then proceed to treat as anunless
modifier.No compile error is raised stating that the
while
modifier is not valid here; the compiler silently generates bad code.