-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function literal with square brackets not an assignable expression #2709
Comments
This comment was originally written by [email protected] The same productions lead us to believe that the following should be allowed (but isn't): Error: line 65 pos 22: unexpected token '.' |
Once we finalize 1676 and 1189 we'll be able to proceed on this. |
Gilad, any update? |
Function expressions have changed since this was filed (and so has try-catch). Function expressions have no return type and no name, so the examples should now look like this: try { () {}.x; } catch(e) {}; these are syntactically legal (though they give rise to warnings and will fail at runtime). So I think the issue is moot. |
Removed Priority-Medium label. |
Interpreting "issue is moot" as "AssumedStale". |
Added AssumedStale label. |
This issue was originally filed by [email protected]
Spec (0.08) says:
ch 10 - function literal is a primary:
primary:
...
functionExpression |
...
10.27:
assignableExpression:
primary (argument* assignableSelector)+ |
super assignableSelector |
identifier
;
assignableSelector:
[' expression
]' |`.' identifier
;
which should mean that something like 'void foo() {}[0]' is an assignable expression and can be used with a postfix operator:
postfixExpression:
assignableExpression postfixOperator |
...
However, the following test fails on VM:
'file:///media/sf_dart_local/co19/tests/co19/src/Language/10_Expressions/26_Postfix_Expressions_A01_t01.dart': Error: line 64 pos 26: expression is not assignable
try { void f() {} [0]++; } catch(var e) {}
^
might be related to issue #1189
The text was updated successfully, but these errors were encountered: