Skip to content

Commit bd1eb97

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Add 'metadata' directly to 'ElementDirective'.
Follow up of https://dart-review.googlesource.com/c/sdk/+/443149 I added to Element and Fragment, forgot ElementDirective. Change-Id: I9073aed99317ebf41f3ab88ceed9689424bd6ee7 Bug: #61216 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443940 Reviewed-by: Johnni Winther <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent b385085 commit bd1eb97

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

pkg/analyzer/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* Add `DartObject.constructorInvocation` with the constructor and arguments.
33
* Make `PropertyAccessorElement.variable` non-nullable.
44
* Add `documentationComment` to `Element` and `Fragment`.
5-
* Add `metadata` to `Element` and `Fragment`.`
5+
* Add `metadata` to `Element` and `Fragment`.
6+
* Add `metadata` to `ElementDirective`.
67
* Fix draining analysis events when used by `package:build`.
78
* Deprecate `LibraryElementResult.element2`, use `element` instead.
89
* Deprecate `ResolvedLibraryResult.element2`, use `element` instead.

pkg/analyzer/api.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,7 @@ package:analyzer/dart/element/element.dart:
34593459
ElementDirective (class extends Object implements Annotatable):
34603460
new (constructor: ElementDirective Function())
34613461
libraryFragment (getter: LibraryFragment)
3462+
metadata (getter: Metadata)
34623463
uri (getter: DirectiveUri)
34633464
ElementKind (class extends Object implements Comparable<ElementKind>):
34643465
AUGMENTATION_IMPORT (static getter: ElementKind)

pkg/analyzer/lib/dart/element/element.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,16 @@ abstract class ElementDirective
10471047
/// The library fragment that contains this object.
10481048
LibraryFragment get libraryFragment;
10491049

1050+
/// The metadata associated with the element or fragment.
1051+
///
1052+
/// If the receiver is an element that has fragments, the list will include
1053+
/// all of the metadata from all of the fragments.
1054+
///
1055+
/// The list will be empty if the receiver does not have any metadata or if
1056+
/// the library containing this element has not yet been fully resolved.
1057+
@override
1058+
Metadata get metadata;
1059+
10501060
/// The interpretation of the URI specified in the directive.
10511061
DirectiveUri get uri;
10521062
}

0 commit comments

Comments
 (0)