-
Notifications
You must be signed in to change notification settings - Fork 205
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
FunctionTypeAnnotation
s should not require names for parameters, but do today
#2208
Comments
Another alternative design could be to have separate |
True, I worry a bit that it doesn't map very directly to |
Yes, in my opinion In the analyzer it might be slightly less convenient though, because we have another layer of options - default parameters, field formal parameters, super formal parameters, all of which can be [required, optional] * [positional, named]. |
I would go for the original proposal. |
I generally like having a simpler class hierarchy, so I think it will just opt for the original proposal. It isn't as ideal for named parameters in function types, but I think that is ok. |
Sounds good. |
Bug: dart-lang/language#2208 Change-Id: I2a9bed6cc243eef2bfa313f7280d1d60c51a7b36 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242140 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jake Macdonald <jakemac@google.com>
Today the
ParameterDeclaration
class requires a name (it extends fromDeclaration
). This type is then used in theFunctionTypeAnnotation
class to represent the parameters, but in that context they don't require a name.The name is also an
Identifier
, which probably doesn't make sense in the context of a function type either, it isn't anything you can reference afaik.Proposal
Make a new class
Parameter
which does not extend fromDeclaration
, and has all the fields thatParameterDeclaration
has. TheParameterDeclaration
class would now implement bothDeclaration
andParameter
. And we would add an additional classFunctionTypeParameter
which would implementParameter
, and also have aString? get name
field, instead of theIdentifier get name
field onDeclaration
.cc @scheglov @johnniwinther
The text was updated successfully, but these errors were encountered: