tfpt review “/shelveset:RubyAST;REDMOND\tomat”
Merges Statement with Expression in AST. Gets rid of ExpressionStatement
to make ASTs smaller.
Any AST expression can be now emitted as statement (i.e. we don’t need
its value) by Transform method and any statement can be emitted as
expression by TransformRead method.
The grammar considers a construct a syntactic statement if the grammar
doesn’t allow it to be read in an assignment rhs or pass it as an
argument to a method call.
a = return 1
foo(1 if false)
are not valid Ruby statements, therefore 'return ’ and ’ if
’ are syntactic statements.
If a statement is used in begin … end or (…) block as the last
statement its value becomes the value of the block. This way a value of
some statements can be retrieved (e.g. alias foo bar, undef x, if
, while ). Most of such statements have nil value,
some of them however might evaluate to a non-nil value (e.g. if