Files
sdk/pkg/analyzer/pubspec.yaml
T
Paul Berry 43159ba5c8 Make NormalFormalParameter implement AnnotatedNode.
This makes sense since AnnotatedNode is the interface for AST nodes
that can be annotated with either a documentation comment, a list of
annotations (metadata), or both, and NormalFormalParameter matches
that description.

It is not 100% clear why NormalFormalParameter didn't previously
implement AnnotatedNode; my best guess is that when the class
hierarchy for the analyzer AST was first being designed, an effort was
made to make the "implements" hierarchy of the interface classes match
the "extends" hierarchy of the implementation classes, and since
`NormalFormalParameterImpl` extends `FormalParameterImpl` but not
`AnnotatedNodeImpl`, the decision was made for `NormalFormalParameter`
not to extend `AnnotatedNode`.

But there are already plenty of other cases where the "implements"
hierarchy of the interface classes doesn't match the "extends"
hierarchy of the implementation classes, and I'm not aware of this
causing any problems. For example, `AssertInitializer` implements both
`Assertion` and `ConstructorInitializer`, whereas
`AssertInitializerImpl` extends only
`ConstructorInitializerImpl`. Other AST interface classes that
implement multiple super-interfaces include `AssertStatement`,
`AssignmentExpression`, `BinaryExpression`, `CascadeExpression`,
`ConstructorReference`, `DartPattern`, `FunctionExpressionInvocation`,
`FunctionReference`, `Identifier`, `IndexExpression`,
`MethodInvocation`, `PostfixExpression`, `PrefixExpression`,
`PropertyAccess`, `RedirectingConstructorInvocation`,
`RestPatternElement`, `SuperConstructorInvocation`, and `TypeLiteral`.

This paves the way for fixing
https://github.com/dart-lang/sdk/issues/56313, which concerns
inconsistencies in the behavior of `beginToken` between
`NormalFormalParameter` and the other `AnnotatedNode`s.

Change-Id: Id8216efea6ccbd7f02cbc6ad1b8bc8e4405b42fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-07-26 16:05:57 +00:00

53 lines
1.2 KiB
YAML

name: analyzer
version: 6.9.0-dev
description: >-
This package provides a library that performs static analysis of Dart code.
repository: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer
environment:
sdk: '>=3.3.0 <4.0.0'
dependencies:
_fe_analyzer_shared: ^73.0.0
collection: ^1.19.0
convert: ^3.0.0
crypto: ^3.0.0
glob: ^2.0.0
macros: '>=0.1.2-main.3 <0.1.3'
meta: ^1.15.0
package_config: ^2.0.0
path: ^1.9.0
pub_semver: ^2.1.4
source_span: ^1.8.0
watcher: ^1.1.0
yaml: ^3.0.0
# We use 'any' version constraints here as we get our package versions from
# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
# best practice for packages is to specify their compatible version ranges.
# See also https://dart.dev/tools/pub/dependencies.
dev_dependencies:
analyzer_utilities: any
args: any
async: any
checks: any
heap_snapshot: any
linter: any
lints: any
matcher: any
test: any
test_reflective_loader: any
vm_service: any
dependency_overrides:
_fe_analyzer_shared:
path: ../_fe_analyzer_shared
analyzer_utilities:
path: ../analyzer_utilities
heap_snapshot:
path: ../heap_snapshot
linter:
path: ../linter
vm_service:
path: ../vm_service