Skip to content

Dart2js does not accept "x = (){return 42;}()" in initializer list. #11508

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

Closed
lrhn opened this issue Jun 25, 2013 · 4 comments
Closed

Dart2js does not accept "x = (){return 42;}()" in initializer list. #11508

lrhn opened this issue Jun 25, 2013 · 4 comments
Labels
closed-duplicate Closed in favor of an existing report web-dart2js

Comments

@lrhn
Copy link
Member

lrhn commented Jun 25, 2013

Example code:

class C {
 final int x;
 C() : x = (){ return 42; }();
}

main() {
  print(new C().x);
}

This errs with the message:
initcall.dart:3:28: unexpected token '('
 C() : x = (){ return 42; }();

The grammar allows the syntax.

@kasperl
Copy link

kasperl commented Jun 25, 2013

Added this to the Later milestone.
Removed Priority-Unassigned label.
Added Priority-Medium label.

@DartBot
Copy link

DartBot commented Jun 25, 2013

This comment was originally written by @mhausner


See issue #11509. I think this is a spec issue, not a compiler bug.


cc @gbracha.

@DartBot
Copy link

DartBot commented Jun 25, 2013

This comment was originally written by @mhausner


It's a defect in the grammar.


Added Duplicate label.
Marked as being merged into #11509.

@peter-ahe-google
Copy link
Contributor

Thank you for keeping us updated, Matthias!

@lrhn lrhn added Type-Defect web-dart2js closed-duplicate Closed in favor of an existing report labels Jun 25, 2013
@lrhn lrhn added this to the Later milestone Jun 25, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report web-dart2js
Projects
None yet
Development

No branches or pull requests

4 participants