Closed lucaswerkmeister closed 10 years ago
On second thought, it should definitely be split like that.
ExpressionStatement(ArithmeticAssignmentOperation | SetAssignmentOperation | LogicalAssignmentOperation | PrefixOperation | PostfixOperation | Invocation expression)
AssignmentStatement(ArithmeticAssignmentOperation | SetAssignmentOperation | LogicalAssignmentOperation expression)
PrefixPostfixStatement(PrefixOperation | PostfixOperation expression)
InvocationStatement(Invocation expression)
Ah damn, no, I got that completely wrong. In general, you have to allow an expression statement with a plain assignment expression, in order to support this:
things.first.content = thing;
(currentElement else defaultElement).attribute = val;
These aren’t covered by Specification
because for a specification, the LHS is just a member name.
So I’ll just have to assert
(at runtime :( ) that the LHS of the assignment isn’t a simple base expression.
Should I do that? Or perhaps that should be allowed?
(Well, at least the types in ExpressionStatement
and AssignmentStatement
are a lot simpler now… so that’s nice. It’s probably still worth it to have separate classes for them, though.)
Since the
ceylon.ast
AST should be unambigous, I’d makeExpressionStatement
’sExpression
have the typeArithmeticAssignmentOperation | SetAssignmentOperation | LogicalAssignmentOperation | PrefixOperation | PostfixOperation | Invocation
; that is, instead ofAssignmentOperation
, have “AssignmentOperation ∖ AssignOperation
” (that’s a set minus), which (as Ceylon doesn’t have complement types) we denote by listing the case types ofAssignmentOperation
withoutAssignOperation
.(Perhaps it should be split into
AssignmentStatement
,PrefixPostfixStatement
,InvocationStatement
? Otherwise the type becomes so long…)Any opposed?