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

Dart constructor tearoff support. #819

Closed
wants to merge 2 commits into from

Conversation

jwren
Copy link
Contributor

@jwren jwren commented Aug 17, 2021

See ConstructorTearoffs.dart test, with the exception of the last expression, var f2 = C<num>.new; I have the Dart.bnf parser working with the new syntax.

@alexander-doroshko -- thanks for any insights to getting around the BNF parsing of this expression as a new expression or call expression instead of a compare expression.

@@ -313,19 +313,19 @@ private functionNative ::= 'native' (stringLiteralExpression ';' | ';' | stringL

methodDeclaration ::= metadata* ('external' | 'static' | 'const')* methodDeclarationPrivate initializers? (';' | functionBodyOrNative | redirection)?
{pin=3 mixin="com.jetbrains.lang.dart.psi.impl.AbstractDartMethodDeclarationImpl" implements="com.jetbrains.lang.dart.psi.DartComponent"}
private methodDeclarationPrivate ::= returnType <<methodNameWrapper>> typeParameters? formalParameterList | !untypedFunctionType <<methodNameWrapper>> typeParameters? formalParameterList // todo remove, use functionSignature as in spec
private methodDeclarationPrivate ::= returnType (<<methodNameWrapper>> | 'new') typeParameters? formalParameterList | !untypedFunctionType (<<methodNameWrapper>> | 'new') typeParameters? formalParameterList // todo remove, use functionSignature as in spec
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's suspicious that here's no '.' before 'new'. Are you sure this change is needed? Tests don't fail if I revert changes in this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct, the syntax for named constructors kicks in making this change unnecessary, reverting here.

@alexander-doroshko
Copy link
Member

Thanks for the PR.
The remaining part of work is tricky indeed. I'm afraid I don't have an answer yet.

jwren added 2 commits August 18, 2021 13:37
See ConstructorTearoffs.dart test, with the exception of the last expression, `var f2 = C<num>.new;` I have the Dart.bnf parser working with the new syntax.
@@ -313,19 +313,19 @@ private functionNative ::= 'native' (stringLiteralExpression ';' | ';' | stringL

methodDeclaration ::= metadata* ('external' | 'static' | 'const')* methodDeclarationPrivate initializers? (';' | functionBodyOrNative | redirection)?
{pin=3 mixin="com.jetbrains.lang.dart.psi.impl.AbstractDartMethodDeclarationImpl" implements="com.jetbrains.lang.dart.psi.DartComponent"}
private methodDeclarationPrivate ::= returnType <<methodNameWrapper>> typeParameters? formalParameterList | !untypedFunctionType <<methodNameWrapper>> typeParameters? formalParameterList // todo remove, use functionSignature as in spec
private methodDeclarationPrivate ::= returnType <<methodNameWrapper>> typeParameters? formalParameterList | !untypedFunctionType (<<methodNameWrapper>> | 'new') typeParameters? formalParameterList // todo remove, use functionSignature as in spec
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were two 'new' additions in this line =). I removed the second one as well before merging.

@alexander-doroshko
Copy link
Member

Merged this wip. Tracking issue remains open: https://youtrack.jetbrains.com/issue/WEB-52293

@SergeyZh SergeyZh closed this in d98b72f Aug 19, 2021
SergeyZh pushed a commit that referenced this pull request Sep 17, 2021
close #819

(cherry picked from commit be32521dcccff3790fdc665e229931d998a9bae9)

IJ-CR-14281

GitOrigin-RevId: 76dbdff591743a666ec4a4957e879b422ae60ae5
SergeyZh pushed a commit that referenced this pull request Sep 27, 2021
close #819

(cherry picked from commit be32521dcccff3790fdc665e229931d998a9bae9)

IJ-CR-14281

GitOrigin-RevId: 4525761d9f441d1a786b669a99061fb77e4e59d4
SergeyZh pushed a commit that referenced this pull request Sep 28, 2021
close #819

(cherry picked from commit be32521dcccff3790fdc665e229931d998a9bae9)

IJ-CR-14281

(cherry picked from commit 4525761d9f441d1a786b669a99061fb77e4e59d4)

GitOrigin-RevId: c592eda34d32f0cfd9e89fa1da7069c7715cbf7d
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.

2 participants