ticket 34
Posted: Thu Feb 27, 2014 11:55 am
Starting a new thread regarding ticket 34 so we don't clutter the other one...
As of right now with 2014-02-24_var-assign-is-has.patch, the rule for fields is that the modifers/attributes should either preceed the assignment operator on the same line or be indented on subsequent lines.
If you we make the assignment statement valid in an indented block, I think the rule for valid syntax becomes harder to verbalize, document, and implement. But I do the see the merits of saying it should be supported for the sake of consistency. Not sure how often that syntax would actually get used though. Up to you.
Here's a bug in the last patch though: If you type...
It's supposed to give the dev the error message: The "is" keyword and modifiers should either precede the equals sign or be indented on the next line per line 1320 but instead you get Expecting an expression. "shared" is a reserved keyword that is not expected here.. Works correctly for the "has" case. I think this is because
on line 1312 is what throws for the "is" case, so the clause that would display the correct message is never entered. Oops...
hopscc wrote:Sorry hadn't answered - been away last week...
That failing test was to for completeness to exercise a case with all the possible clauses (nicely laid out on separate lines) and with the changed positioning of the initialisation clause - its distinct from the cases with the clauses joined on (a) single line(s)
Its a reasonably logical layout that should be valid...
The coding of the patch is a better approach than the previously more rigorous position dependent probing for clauses in expected orders..
Leave it as is FTM and I'll take a task to look at whats needed to support the failing case...
As of right now with 2014-02-24_var-assign-is-has.patch, the rule for fields is that the modifers/attributes should either preceed the assignment operator on the same line or be indented on subsequent lines.
If you we make the assignment statement valid in an indented block, I think the rule for valid syntax becomes harder to verbalize, document, and implement. But I do the see the merits of saying it should be supported for the sake of consistency. Not sure how often that syntax would actually get used though. Up to you.
Here's a bug in the last patch though: If you type...
var foo = 5 is shared
It's supposed to give the dev the error message: The "is" keyword and modifiers should either precede the equals sign or be indented on the next line per line 1320 but instead you get Expecting an expression. "shared" is a reserved keyword that is not expected here.. Works correctly for the "has" case. I think this is because
initExpr = .expression to ?
on line 1312 is what throws for the "is" case, so the clause that would display the correct message is never entered. Oops...