| Index: pkg/analyzer/lib/src/dart/element/element.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
|
| index e3f4dfeeab2c9f4feb4b3fb7b5647c04d8e0d28a..584f797d755272a2b1e32f74654d3cb8030a1b83 100644
|
| --- a/pkg/analyzer/lib/src/dart/element/element.dart
|
| +++ b/pkg/analyzer/lib/src/dart/element/element.dart
|
| @@ -928,6 +928,13 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
|
| Source librarySource;
|
|
|
| /**
|
| + * A table mapping the offset of a directive to the annotations associated
|
| + * with that directive, or `null` if none of the annotations in the
|
| + * compilation unit have annotations.
|
| + */
|
| + Map<int, List<ElementAnnotation>> annotationMap = null;
|
| +
|
| + /**
|
| * A list containing all of the top-level accessors (getters and setters)
|
| * contained in this compilation unit.
|
| */
|
| @@ -1103,6 +1110,18 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
|
| @override
|
| CompilationUnit computeNode() => unit;
|
|
|
| + /**
|
| + * Return the annotations associated with the directive at the given [offset],
|
| + * or an empty list if the directive has no annotations or if there is no
|
| + * directive at the given offset.
|
| + */
|
| + List<ElementAnnotation> getAnnotations(int offset) {
|
| + if (annotationMap == null) {
|
| + return ElementAnnotation.EMPTY_LIST;
|
| + }
|
| + return annotationMap[offset] ?? ElementAnnotation.EMPTY_LIST;
|
| + }
|
| +
|
| @override
|
| ElementImpl getChild(String identifier) {
|
| //
|
| @@ -1181,6 +1200,15 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
|
| _variables[index] = to;
|
| }
|
|
|
| + /**
|
| + * Set the annotations associated with the directive at the given [offset] to
|
| + * the given list of [annotations].
|
| + */
|
| + void setAnnotations(int offset, List<ElementAnnotation> annotations) {
|
| + annotationMap ??= new HashMap<int, List<ElementAnnotation>>();
|
| + annotationMap[offset] = annotations;
|
| + }
|
| +
|
| @override
|
| void visitChildren(ElementVisitor visitor) {
|
| super.visitChildren(visitor);
|
|
|