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

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

Issue 1534043002: Cache element docs (and add to completions) (#23694). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: tweaks Created 5 years 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/dart/element/member.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7d5164e2470d1c437a16d4b431f8f80b2673a5f6..ff3986823980880bd0ee10c2e968a1c042c1a6b6 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -1673,6 +1673,11 @@ abstract class ElementImpl implements Element {
ElementLocation _cachedLocation;
/**
+ * The documentation comment for this element.
+ */
+ String _docComment;
+
+ /**
* The offset to the beginning of the documentation comment,
* or `null` if this element does not have a documentation comment.
*/
@@ -1717,6 +1722,16 @@ abstract class ElementImpl implements Element {
}
@override
+ String get documentationComment => _docComment;
+
+ /**
+ * The documentation comment source for this element.
+ */
+ void set documentationComment(String doc) {
+ _docComment = doc?.replaceAll('\r\n', '\n');
+ }
+
+ @override
Element get enclosingElement => _enclosingElement;
/**
@@ -1866,13 +1881,7 @@ abstract class ElementImpl implements Element {
}
@override
- String computeDocumentationComment() {
- AnalysisContext context = this.context;
- if (context == null) {
- return null;
- }
- return context.computeDocumentationComment(this);
- }
+ String computeDocumentationComment() => documentationComment;
@override
AstNode computeNode() => getNodeMatching((node) => node is AstNode);
@@ -3236,7 +3245,8 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
}
@override
- bool operator ==(Object object) => object is LibraryElementImpl &&
+ bool operator ==(Object object) =>
+ object is LibraryElementImpl &&
_definingCompilationUnit == object.definingCompilationUnit;
@override
@@ -3658,6 +3668,9 @@ class MultiplyDefinedElementImpl implements MultiplyDefinedElement {
SourceRange get docRange => null;
@override
+ String get documentationComment => null;
+
+ @override
Element get enclosingElement => null;
@override
@@ -4226,7 +4239,8 @@ class PropertyAccessorElementImpl extends ExecutableElementImpl
}
@override
- bool operator ==(Object object) => super == object &&
+ bool operator ==(Object object) =>
+ super == object &&
isGetter == (object as PropertyAccessorElement).isGetter;
@override
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/dart/element/member.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698