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 501ec8de8180db9cc61a6ba071444bec558a99e9..2f7fc973c05cd4fecc0100e7ae828a36056f055c 100644 |
--- a/pkg/analyzer/lib/src/summary/format.dart |
+++ b/pkg/analyzer/lib/src/summary/format.dart |
@@ -12,19 +12,6 @@ import 'idl.dart' as idl; |
import 'dart:convert' as convert; |
import 'api_signature.dart' as api_sig; |
-class _CacheSourceKindReader extends fb.Reader<idl.CacheSourceKind> { |
- const _CacheSourceKindReader() : super(); |
- |
- @override |
- int get size => 1; |
- |
- @override |
- idl.CacheSourceKind read(fb.BufferContext bc, int offset) { |
- int index = const fb.Uint8Reader().read(bc, offset); |
- return index < idl.CacheSourceKind.values.length ? idl.CacheSourceKind.values[index] : idl.CacheSourceKind.library; |
- } |
-} |
- |
class _IndexNameKindReader extends fb.Reader<idl.IndexNameKind> { |
const _IndexNameKindReader() : super(); |
@@ -142,497 +129,6 @@ class _UnlinkedParamKindReader extends fb.Reader<idl.UnlinkedParamKind> { |
} |
} |
-class CacheAnalysisErrorBuilder extends Object with _CacheAnalysisErrorMixin implements idl.CacheAnalysisError { |
- String _correction; |
- String _errorCodeUniqueName; |
- int _length; |
- String _message; |
- int _offset; |
- |
- @override |
- String get correction => _correction ??= ''; |
- |
- /** |
- * The correction to be displayed for this error, or `null` if there is no |
- * correction information for this error. The correction should indicate how |
- * the user can fix the error. |
- */ |
- void set correction(String value) { |
- this._correction = value; |
- } |
- |
- @override |
- String get errorCodeUniqueName => _errorCodeUniqueName ??= ''; |
- |
- /** |
- * The unique name of the error code. |
- */ |
- void set errorCodeUniqueName(String value) { |
- this._errorCodeUniqueName = value; |
- } |
- |
- @override |
- int get length => _length ??= 0; |
- |
- /** |
- * Length of the error range. |
- */ |
- void set length(int value) { |
- assert(value == null || value >= 0); |
- this._length = value; |
- } |
- |
- @override |
- String get message => _message ??= ''; |
- |
- /** |
- * The message to be displayed for this error. The message should indicate |
- * what is wrong and why it is wrong. |
- */ |
- void set message(String value) { |
- this._message = value; |
- } |
- |
- @override |
- int get offset => _offset ??= 0; |
- |
- /** |
- * Offset of the error range relative to the beginning of the file. |
- */ |
- void set offset(int value) { |
- assert(value == null || value >= 0); |
- this._offset = value; |
- } |
- |
- CacheAnalysisErrorBuilder({String correction, String errorCodeUniqueName, int length, String message, int offset}) |
- : _correction = correction, |
- _errorCodeUniqueName = errorCodeUniqueName, |
- _length = length, |
- _message = message, |
- _offset = offset; |
- |
- /** |
- * Flush [informative] data recursively. |
- */ |
- void flushInformative() { |
- } |
- |
- /** |
- * Accumulate non-[informative] data into [signature]. |
- */ |
- void collectApiSignature(api_sig.ApiSignature signature) { |
- signature.addString(this._errorCodeUniqueName ?? ''); |
- signature.addInt(this._offset ?? 0); |
- signature.addInt(this._length ?? 0); |
- signature.addString(this._message ?? ''); |
- signature.addString(this._correction ?? ''); |
- } |
- |
- fb.Offset finish(fb.Builder fbBuilder) { |
- fb.Offset offset_correction; |
- fb.Offset offset_errorCodeUniqueName; |
- fb.Offset offset_message; |
- if (_correction != null) { |
- offset_correction = fbBuilder.writeString(_correction); |
- } |
- if (_errorCodeUniqueName != null) { |
- offset_errorCodeUniqueName = fbBuilder.writeString(_errorCodeUniqueName); |
- } |
- if (_message != null) { |
- offset_message = fbBuilder.writeString(_message); |
- } |
- fbBuilder.startTable(); |
- if (offset_correction != null) { |
- fbBuilder.addOffset(4, offset_correction); |
- } |
- if (offset_errorCodeUniqueName != null) { |
- fbBuilder.addOffset(0, offset_errorCodeUniqueName); |
- } |
- if (_length != null && _length != 0) { |
- fbBuilder.addUint32(2, _length); |
- } |
- if (offset_message != null) { |
- fbBuilder.addOffset(3, offset_message); |
- } |
- if (_offset != null && _offset != 0) { |
- fbBuilder.addUint32(1, _offset); |
- } |
- return fbBuilder.endTable(); |
- } |
-} |
- |
-class _CacheAnalysisErrorReader extends fb.TableReader<_CacheAnalysisErrorImpl> { |
- const _CacheAnalysisErrorReader(); |
- |
- @override |
- _CacheAnalysisErrorImpl createObject(fb.BufferContext bc, int offset) => new _CacheAnalysisErrorImpl(bc, offset); |
-} |
- |
-class _CacheAnalysisErrorImpl extends Object with _CacheAnalysisErrorMixin implements idl.CacheAnalysisError { |
- final fb.BufferContext _bc; |
- final int _bcOffset; |
- |
- _CacheAnalysisErrorImpl(this._bc, this._bcOffset); |
- |
- String _correction; |
- String _errorCodeUniqueName; |
- int _length; |
- String _message; |
- int _offset; |
- |
- @override |
- String get correction { |
- _correction ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 4, ''); |
- return _correction; |
- } |
- |
- @override |
- String get errorCodeUniqueName { |
- _errorCodeUniqueName ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, ''); |
- return _errorCodeUniqueName; |
- } |
- |
- @override |
- int get length { |
- _length ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 2, 0); |
- return _length; |
- } |
- |
- @override |
- String get message { |
- _message ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 3, ''); |
- return _message; |
- } |
- |
- @override |
- int get offset { |
- _offset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0); |
- return _offset; |
- } |
-} |
- |
-abstract class _CacheAnalysisErrorMixin implements idl.CacheAnalysisError { |
- @override |
- Map<String, Object> toJson() { |
- Map<String, Object> _result = <String, Object>{}; |
- if (correction != '') _result["correction"] = correction; |
- if (errorCodeUniqueName != '') _result["errorCodeUniqueName"] = errorCodeUniqueName; |
- if (length != 0) _result["length"] = length; |
- if (message != '') _result["message"] = message; |
- if (offset != 0) _result["offset"] = offset; |
- return _result; |
- } |
- |
- @override |
- Map<String, Object> toMap() => { |
- "correction": correction, |
- "errorCodeUniqueName": errorCodeUniqueName, |
- "length": length, |
- "message": message, |
- "offset": offset, |
- }; |
- |
- @override |
- String toString() => convert.JSON.encode(toJson()); |
-} |
- |
-class CacheSourceContentBuilder extends Object with _CacheSourceContentMixin implements idl.CacheSourceContent { |
- List<String> _exportedUris; |
- List<String> _importedUris; |
- idl.CacheSourceKind _kind; |
- List<String> _partUris; |
- |
- @override |
- List<String> get exportedUris => _exportedUris ??= <String>[]; |
- |
- /** |
- * The list of exported URIs, e.g. `dart:core`, or `foo/bar.dart`, |
- * or `package:foo/bar.dart`. Empty if [kind] is [CacheSourceKind.part]. |
- */ |
- void set exportedUris(List<String> value) { |
- this._exportedUris = value; |
- } |
- |
- @override |
- List<String> get importedUris => _importedUris ??= <String>[]; |
- |
- /** |
- * The list of explicitly imported URIs, e.g. `dart:core`, or `foo/bar.dart`, |
- * or `package:foo/bar.dart`. Empty if [kind] is [CacheSourceKind.part]. |
- */ |
- void set importedUris(List<String> value) { |
- this._importedUris = value; |
- } |
- |
- @override |
- idl.CacheSourceKind get kind => _kind ??= idl.CacheSourceKind.library; |
- |
- /** |
- * The kind of the source. |
- */ |
- void set kind(idl.CacheSourceKind value) { |
- this._kind = value; |
- } |
- |
- @override |
- List<String> get partUris => _partUris ??= <String>[]; |
- |
- /** |
- * The list of part URIs, e.g. `foo/bar.dart`. Empty if [kind] is |
- * [CacheSourceKind.part]. |
- */ |
- void set partUris(List<String> value) { |
- this._partUris = value; |
- } |
- |
- CacheSourceContentBuilder({List<String> exportedUris, List<String> importedUris, idl.CacheSourceKind kind, List<String> partUris}) |
- : _exportedUris = exportedUris, |
- _importedUris = importedUris, |
- _kind = kind, |
- _partUris = partUris; |
- |
- /** |
- * Flush [informative] data recursively. |
- */ |
- void flushInformative() { |
- } |
- |
- /** |
- * Accumulate non-[informative] data into [signature]. |
- */ |
- void collectApiSignature(api_sig.ApiSignature signature) { |
- signature.addInt(this._kind == null ? 0 : this._kind.index); |
- if (this._importedUris == null) { |
- signature.addInt(0); |
- } else { |
- signature.addInt(this._importedUris.length); |
- for (var x in this._importedUris) { |
- signature.addString(x); |
- } |
- } |
- if (this._exportedUris == null) { |
- signature.addInt(0); |
- } else { |
- signature.addInt(this._exportedUris.length); |
- for (var x in this._exportedUris) { |
- signature.addString(x); |
- } |
- } |
- if (this._partUris == null) { |
- signature.addInt(0); |
- } else { |
- signature.addInt(this._partUris.length); |
- for (var x in this._partUris) { |
- signature.addString(x); |
- } |
- } |
- } |
- |
- List<int> toBuffer() { |
- fb.Builder fbBuilder = new fb.Builder(); |
- return fbBuilder.finish(finish(fbBuilder), "CaSS"); |
- } |
- |
- fb.Offset finish(fb.Builder fbBuilder) { |
- fb.Offset offset_exportedUris; |
- fb.Offset offset_importedUris; |
- fb.Offset offset_partUris; |
- if (!(_exportedUris == null || _exportedUris.isEmpty)) { |
- offset_exportedUris = fbBuilder.writeList(_exportedUris.map((b) => fbBuilder.writeString(b)).toList()); |
- } |
- if (!(_importedUris == null || _importedUris.isEmpty)) { |
- offset_importedUris = fbBuilder.writeList(_importedUris.map((b) => fbBuilder.writeString(b)).toList()); |
- } |
- if (!(_partUris == null || _partUris.isEmpty)) { |
- offset_partUris = fbBuilder.writeList(_partUris.map((b) => fbBuilder.writeString(b)).toList()); |
- } |
- fbBuilder.startTable(); |
- if (offset_exportedUris != null) { |
- fbBuilder.addOffset(2, offset_exportedUris); |
- } |
- if (offset_importedUris != null) { |
- fbBuilder.addOffset(1, offset_importedUris); |
- } |
- if (_kind != null && _kind != idl.CacheSourceKind.library) { |
- fbBuilder.addUint8(0, _kind.index); |
- } |
- if (offset_partUris != null) { |
- fbBuilder.addOffset(3, offset_partUris); |
- } |
- return fbBuilder.endTable(); |
- } |
-} |
- |
-idl.CacheSourceContent readCacheSourceContent(List<int> buffer) { |
- fb.BufferContext rootRef = new fb.BufferContext.fromBytes(buffer); |
- return const _CacheSourceContentReader().read(rootRef, 0); |
-} |
- |
-class _CacheSourceContentReader extends fb.TableReader<_CacheSourceContentImpl> { |
- const _CacheSourceContentReader(); |
- |
- @override |
- _CacheSourceContentImpl createObject(fb.BufferContext bc, int offset) => new _CacheSourceContentImpl(bc, offset); |
-} |
- |
-class _CacheSourceContentImpl extends Object with _CacheSourceContentMixin implements idl.CacheSourceContent { |
- final fb.BufferContext _bc; |
- final int _bcOffset; |
- |
- _CacheSourceContentImpl(this._bc, this._bcOffset); |
- |
- List<String> _exportedUris; |
- List<String> _importedUris; |
- idl.CacheSourceKind _kind; |
- List<String> _partUris; |
- |
- @override |
- List<String> get exportedUris { |
- _exportedUris ??= const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bc, _bcOffset, 2, const <String>[]); |
- return _exportedUris; |
- } |
- |
- @override |
- List<String> get importedUris { |
- _importedUris ??= const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bc, _bcOffset, 1, const <String>[]); |
- return _importedUris; |
- } |
- |
- @override |
- idl.CacheSourceKind get kind { |
- _kind ??= const _CacheSourceKindReader().vTableGet(_bc, _bcOffset, 0, idl.CacheSourceKind.library); |
- return _kind; |
- } |
- |
- @override |
- List<String> get partUris { |
- _partUris ??= const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bc, _bcOffset, 3, const <String>[]); |
- return _partUris; |
- } |
-} |
- |
-abstract class _CacheSourceContentMixin implements idl.CacheSourceContent { |
- @override |
- Map<String, Object> toJson() { |
- Map<String, Object> _result = <String, Object>{}; |
- if (exportedUris.isNotEmpty) _result["exportedUris"] = exportedUris; |
- if (importedUris.isNotEmpty) _result["importedUris"] = importedUris; |
- if (kind != idl.CacheSourceKind.library) _result["kind"] = kind.toString().split('.')[1]; |
- if (partUris.isNotEmpty) _result["partUris"] = partUris; |
- return _result; |
- } |
- |
- @override |
- Map<String, Object> toMap() => { |
- "exportedUris": exportedUris, |
- "importedUris": importedUris, |
- "kind": kind, |
- "partUris": partUris, |
- }; |
- |
- @override |
- String toString() => convert.JSON.encode(toJson()); |
-} |
- |
-class CacheSourceErrorsInLibraryBuilder extends Object with _CacheSourceErrorsInLibraryMixin implements idl.CacheSourceErrorsInLibrary { |
- List<CacheAnalysisErrorBuilder> _errors; |
- |
- @override |
- List<CacheAnalysisErrorBuilder> get errors => _errors ??= <CacheAnalysisErrorBuilder>[]; |
- |
- /** |
- * The list of errors in the source in the library. |
- */ |
- void set errors(List<CacheAnalysisErrorBuilder> value) { |
- this._errors = value; |
- } |
- |
- CacheSourceErrorsInLibraryBuilder({List<CacheAnalysisErrorBuilder> errors}) |
- : _errors = errors; |
- |
- /** |
- * Flush [informative] data recursively. |
- */ |
- void flushInformative() { |
- _errors?.forEach((b) => b.flushInformative()); |
- } |
- |
- /** |
- * Accumulate non-[informative] data into [signature]. |
- */ |
- void collectApiSignature(api_sig.ApiSignature signature) { |
- if (this._errors == null) { |
- signature.addInt(0); |
- } else { |
- signature.addInt(this._errors.length); |
- for (var x in this._errors) { |
- x?.collectApiSignature(signature); |
- } |
- } |
- } |
- |
- List<int> toBuffer() { |
- fb.Builder fbBuilder = new fb.Builder(); |
- return fbBuilder.finish(finish(fbBuilder), "CSEL"); |
- } |
- |
- fb.Offset finish(fb.Builder fbBuilder) { |
- fb.Offset offset_errors; |
- if (!(_errors == null || _errors.isEmpty)) { |
- offset_errors = fbBuilder.writeList(_errors.map((b) => b.finish(fbBuilder)).toList()); |
- } |
- fbBuilder.startTable(); |
- if (offset_errors != null) { |
- fbBuilder.addOffset(0, offset_errors); |
- } |
- return fbBuilder.endTable(); |
- } |
-} |
- |
-idl.CacheSourceErrorsInLibrary readCacheSourceErrorsInLibrary(List<int> buffer) { |
- fb.BufferContext rootRef = new fb.BufferContext.fromBytes(buffer); |
- return const _CacheSourceErrorsInLibraryReader().read(rootRef, 0); |
-} |
- |
-class _CacheSourceErrorsInLibraryReader extends fb.TableReader<_CacheSourceErrorsInLibraryImpl> { |
- const _CacheSourceErrorsInLibraryReader(); |
- |
- @override |
- _CacheSourceErrorsInLibraryImpl createObject(fb.BufferContext bc, int offset) => new _CacheSourceErrorsInLibraryImpl(bc, offset); |
-} |
- |
-class _CacheSourceErrorsInLibraryImpl extends Object with _CacheSourceErrorsInLibraryMixin implements idl.CacheSourceErrorsInLibrary { |
- final fb.BufferContext _bc; |
- final int _bcOffset; |
- |
- _CacheSourceErrorsInLibraryImpl(this._bc, this._bcOffset); |
- |
- List<idl.CacheAnalysisError> _errors; |
- |
- @override |
- List<idl.CacheAnalysisError> get errors { |
- _errors ??= const fb.ListReader<idl.CacheAnalysisError>(const _CacheAnalysisErrorReader()).vTableGet(_bc, _bcOffset, 0, const <idl.CacheAnalysisError>[]); |
- return _errors; |
- } |
-} |
- |
-abstract class _CacheSourceErrorsInLibraryMixin implements idl.CacheSourceErrorsInLibrary { |
- @override |
- Map<String, Object> toJson() { |
- Map<String, Object> _result = <String, Object>{}; |
- if (errors.isNotEmpty) _result["errors"] = errors.map((_value) => _value.toJson()).toList(); |
- return _result; |
- } |
- |
- @override |
- Map<String, Object> toMap() => { |
- "errors": errors, |
- }; |
- |
- @override |
- String toString() => convert.JSON.encode(toJson()); |
-} |
- |
class CodeRangeBuilder extends Object with _CodeRangeMixin implements idl.CodeRange { |
int _length; |
int _offset; |