-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
@@ -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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Thanks for the PR. |
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.
d45b1cd
to
34b8b93
Compare
@@ -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 |
There was a problem hiding this comment.
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.
Merged this wip. Tracking issue remains open: https://youtrack.jetbrains.com/issue/WEB-52293 |
close #819 (cherry picked from commit be32521dcccff3790fdc665e229931d998a9bae9) IJ-CR-14281 GitOrigin-RevId: 76dbdff591743a666ec4a4957e879b422ae60ae5
close #819 (cherry picked from commit be32521dcccff3790fdc665e229931d998a9bae9) IJ-CR-14281 GitOrigin-RevId: 4525761d9f441d1a786b669a99061fb77e4e59d4
close #819 (cherry picked from commit be32521dcccff3790fdc665e229931d998a9bae9) IJ-CR-14281 (cherry picked from commit 4525761d9f441d1a786b669a99061fb77e4e59d4) GitOrigin-RevId: c592eda34d32f0cfd9e89fa1da7069c7715cbf7d
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.