Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 1376473007: Add the 'docRange' property and use it to compute documentation comment. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/generated/element_handle.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/element.dart
diff --git a/pkg/analyzer/lib/src/generated/element.dart b/pkg/analyzer/lib/src/generated/element.dart
index bff8b4ea52a255a4c15b055936e956b20a85d4bc..30aa17ebcaff5fdaf4c9843c6b2181ac3e5b6dd5 100644
--- a/pkg/analyzer/lib/src/generated/element.dart
+++ b/pkg/analyzer/lib/src/generated/element.dart
@@ -2462,6 +2462,12 @@ abstract class Element implements AnalysisTarget {
String get displayName;
/**
+ * Return the source range of the documentation comment for this element,
+ * or `null` if this element does not or cannot have a documentation.
+ */
+ SourceRange get docRange;
+
+ /**
* Return the element that either physically or logically encloses this
* element. This will be `null` if this element is a library because libraries
* are the top-level elements in the model.
@@ -2828,6 +2834,17 @@ abstract class ElementImpl implements Element {
ElementLocation _cachedLocation;
/**
+ * The offset to the beginning of the documentation comment,
+ * or `null` if this element does not have a documentation comment.
+ */
+ int _docRangeOffset;
+
+ /**
+ * The length of the documentation comment range for this element.
+ */
+ int _docRangeLength;
+
+ /**
* Initialize a newly created element to have the given [name] at the given
* [_nameOffset].
*/
@@ -2853,6 +2870,14 @@ abstract class ElementImpl implements Element {
String get displayName => _name;
@override
+ SourceRange get docRange {
+ if (_docRangeOffset != null && _docRangeLength != null) {
+ return new SourceRange(_docRangeOffset, _docRangeLength);
+ }
+ return null;
+ }
+
+ @override
Element get enclosingElement => _enclosingElement;
/**
@@ -3102,6 +3127,14 @@ abstract class ElementImpl implements Element {
}
/**
+ * Set the documentation comment source range for this element.
+ */
+ void setDocRange(int offset, int length) {
+ _docRangeOffset = offset;
+ _docRangeLength = length;
+ }
+
+ /**
* Set whether the given [modifier] is associated with this element to
* correspond to the given [value].
*/
@@ -7917,6 +7950,9 @@ abstract class Member implements Element {
@override
String get displayName => _baseElement.displayName;
+ @override
+ SourceRange get docRange => _baseElement.docRange;
+
int get id => _baseElement.id;
@override
@@ -8427,6 +8463,9 @@ class MultiplyDefinedElementImpl implements MultiplyDefinedElement {
String get displayName => _name;
@override
+ SourceRange get docRange => null;
+
+ @override
Element get enclosingElement => null;
@override
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/generated/element_handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698