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

Unified Diff: pkg/analyzer/lib/src/summary/format.dart

Issue 2293143003: Revert "Remove 'Element.docRange'." (Closed)
Patch Set: Created 4 years, 4 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/generated/utilities_dart.dart ('k') | pkg/analyzer/lib/src/summary/format.fbs » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/format.dart
diff --git a/pkg/analyzer/lib/src/summary/format.dart b/pkg/analyzer/lib/src/summary/format.dart
index 641287e85e68b90e4f18592854662127010f11a3..626f4431234a2f108dd3e8aec202d43c8582f3b1 100644
--- a/pkg/analyzer/lib/src/summary/format.dart
+++ b/pkg/analyzer/lib/src/summary/format.dart
@@ -4795,13 +4795,32 @@ abstract class _UnlinkedConstructorInitializerMixin implements idl.UnlinkedConst
}
class UnlinkedDocumentationCommentBuilder extends Object with _UnlinkedDocumentationCommentMixin implements idl.UnlinkedDocumentationComment {
+ int _length;
+ int _offset;
String _text;
@override
- int get length => throw new UnimplementedError('attempt to access deprecated field');
+ int get length => _length ??= 0;
+
+ /**
+ * Length of the documentation comment (prior to replacing '\r\n' with '\n').
+ */
+ void set length(int _value) {
+ assert(_value == null || _value >= 0);
+ _length = _value;
+ }
@override
- int get offset => throw new UnimplementedError('attempt to access deprecated field');
+ int get offset => _offset ??= 0;
+
+ /**
+ * Offset of the beginning of the documentation comment relative to the
+ * beginning of the file.
+ */
+ void set offset(int _value) {
+ assert(_value == null || _value >= 0);
+ _offset = _value;
+ }
@override
String get text => _text ??= '';
@@ -4816,8 +4835,10 @@ class UnlinkedDocumentationCommentBuilder extends Object with _UnlinkedDocumenta
_text = _value;
}
- UnlinkedDocumentationCommentBuilder({String text})
- : _text = text;
+ UnlinkedDocumentationCommentBuilder({int length, int offset, String text})
+ : _length = length,
+ _offset = offset,
+ _text = text;
/**
* Flush [informative] data recursively.
@@ -4829,7 +4850,9 @@ class UnlinkedDocumentationCommentBuilder extends Object with _UnlinkedDocumenta
* Accumulate non-[informative] data into [signature].
*/
void collectApiSignature(api_sig.ApiSignature signature) {
+ signature.addInt(this._length ?? 0);
signature.addString(this._text ?? '');
+ signature.addInt(this._offset ?? 0);
}
fb.Offset finish(fb.Builder fbBuilder) {
@@ -4838,6 +4861,12 @@ class UnlinkedDocumentationCommentBuilder extends Object with _UnlinkedDocumenta
offset_text = fbBuilder.writeString(_text);
}
fbBuilder.startTable();
+ if (_length != null && _length != 0) {
+ fbBuilder.addUint32(0, _length);
+ }
+ if (_offset != null && _offset != 0) {
+ fbBuilder.addUint32(2, _offset);
+ }
if (offset_text != null) {
fbBuilder.addOffset(1, offset_text);
}
@@ -4858,13 +4887,21 @@ class _UnlinkedDocumentationCommentImpl extends Object with _UnlinkedDocumentati
_UnlinkedDocumentationCommentImpl(this._bc, this._bcOffset);
+ int _length;
+ int _offset;
String _text;
@override
- int get length => throw new UnimplementedError('attempt to access deprecated field');
+ int get length {
+ _length ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
+ return _length;
+ }
@override
- int get offset => throw new UnimplementedError('attempt to access deprecated field');
+ int get offset {
+ _offset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 2, 0);
+ return _offset;
+ }
@override
String get text {
@@ -4877,12 +4914,16 @@ abstract class _UnlinkedDocumentationCommentMixin implements idl.UnlinkedDocumen
@override
Map<String, Object> toJson() {
Map<String, Object> _result = <String, Object>{};
+ if (length != 0) _result["length"] = length;
+ if (offset != 0) _result["offset"] = offset;
if (text != '') _result["text"] = text;
return _result;
}
@override
Map<String, Object> toMap() => {
+ "length": length,
+ "offset": offset,
"text": text,
};
« no previous file with comments | « pkg/analyzer/lib/src/generated/utilities_dart.dart ('k') | pkg/analyzer/lib/src/summary/format.fbs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698