Skip to content
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

Support optional new and const. #652

Closed
lrhn opened this issue Sep 28, 2017 · 0 comments
Closed

Support optional new and const. #652

lrhn opened this issue Sep 28, 2017 · 0 comments

Comments

@lrhn
Copy link
Member

lrhn commented Sep 28, 2017

This is the formatter specific issue tracking dart-lang/sdk#30921.

The formatter for Dart 2 will need to understand and format programs that omit some new and const prefixes.
The exact details depends on which format the common front-end provides for such a program, but it must be possible to format without introducing the missing new and const tokens in the output.

@lrhn lrhn added this to the 2.0-beta 1 milestone Sep 28, 2017
munificent added a commit that referenced this issue Feb 20, 2018
In almost all cases, an elided "new"/"const" is parsed as a normal
method call by analyzer, so the existing formatting behavior for those
does the right thing. The only edge case is a named constructor on a
generic class. That syntax can *only* be a constructor call, so it's
parsed as an instance creation expression.

When we get to that code path, we need to not add an extra space before
the class name if there is no preceding "new" or "const" keyword.

Fix #652.
munificent added a commit that referenced this issue Feb 20, 2018
In almost all cases, an elided "new"/"const" is parsed as a normal
method call by analyzer, so the existing formatting behavior for those
does the right thing. The only edge case is a named constructor on a
generic class. That syntax can *only* be a constructor call, so it's
parsed as an instance creation expression.

When we get to that code path, we need to not add an extra space before
the class name if there is no preceding "new" or "const" keyword.

Fix #652.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant