Skip to content

Support optional new/const. #669

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

Merged
merged 2 commits into from
Feb 20, 2018
Merged

Support optional new/const. #669

merged 2 commits into from
Feb 20, 2018

Conversation

munificent
Copy link
Member

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.

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.
# Conflicts:
#	pubspec.lock
#	test/whitespace/type_arguments.stmt
@munificent munificent merged commit b89b572 into master Feb 20, 2018
@munificent munificent deleted the optional-new branch December 3, 2018 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants