| 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 060811cc0a1cd3ab9d865c98cf20272e5909c7ac..cce5954393bbe70f4090e378030f8d9b62bf24d5 100644
|
| --- a/pkg/analyzer/lib/src/summary/format.dart
|
| +++ b/pkg/analyzer/lib/src/summary/format.dart
|
| @@ -7,8 +7,8 @@
|
|
|
| library analyzer.src.summary.format;
|
|
|
| -import 'dart:convert';
|
| import 'base.dart' as base;
|
| +import 'flat_buffers.dart' as fb;
|
|
|
| /**
|
| * Enum used to indicate the kind of entity referred to by a
|
| @@ -41,32 +41,11 @@ enum UnlinkedParamKind {
|
| named,
|
| }
|
|
|
| -/**
|
| - * Information about a dependency that exists between one library and another
|
| - * due to an "import" declaration.
|
| - */
|
| -class PrelinkedDependency extends base.SummaryClass {
|
| - String _uri;
|
| -
|
| - PrelinkedDependency.fromJson(Map json)
|
| - : _uri = json["uri"];
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "uri": uri,
|
| - };
|
| -
|
| - /**
|
| - * The relative URI used to import one library from the other.
|
| - */
|
| - String get uri => _uri ?? '';
|
| -}
|
| -
|
| class PrelinkedDependencyBuilder {
|
| - final Map _json = {};
|
| -
|
| bool _finished = false;
|
|
|
| + String _uri;
|
| +
|
| PrelinkedDependencyBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -74,16 +53,21 @@ class PrelinkedDependencyBuilder {
|
| */
|
| void set uri(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("uri"));
|
| - if (_value != null) {
|
| - _json["uri"] = _value;
|
| - }
|
| + _uri = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_uri;
|
| + if (_uri != null) {
|
| + offset_uri = fbBuilder.writeString(_uri);
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_uri != null) {
|
| + fbBuilder.addOffset(0, offset_uri);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -94,61 +78,41 @@ PrelinkedDependencyBuilder encodePrelinkedDependency(base.BuilderContext builder
|
| }
|
|
|
| /**
|
| - * Pre-linked summary of a library.
|
| + * Information about a dependency that exists between one library and another
|
| + * due to an "import" declaration.
|
| */
|
| -class PrelinkedLibrary extends base.SummaryClass {
|
| - List<PrelinkedUnit> _units;
|
| - List<PrelinkedDependency> _dependencies;
|
| - List<int> _importDependencies;
|
| +abstract class PrelinkedDependency extends base.SummaryClass {
|
|
|
| - PrelinkedLibrary.fromJson(Map json)
|
| - : _units = json["units"]?.map((x) => new PrelinkedUnit.fromJson(x))?.toList(),
|
| - _dependencies = json["dependencies"]?.map((x) => new PrelinkedDependency.fromJson(x))?.toList(),
|
| - _importDependencies = json["importDependencies"];
|
| + /**
|
| + * The relative URI used to import one library from the other.
|
| + */
|
| + String get uri;
|
| +}
|
|
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "units": units,
|
| - "dependencies": dependencies,
|
| - "importDependencies": importDependencies,
|
| - };
|
| +class _PrelinkedDependencyReader extends fb.TableReader<_PrelinkedDependencyReader> implements PrelinkedDependency {
|
| + final fb.BufferPointer _bp;
|
|
|
| - PrelinkedLibrary.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8.decode(buffer)));
|
| + const _PrelinkedDependencyReader([this._bp]);
|
|
|
| - /**
|
| - * The pre-linked summary of all the compilation units constituting the
|
| - * library. The summary of the defining compilation unit is listed first,
|
| - * followed by the summary of each part, in the order of the `part`
|
| - * declarations in the defining compilation unit.
|
| - */
|
| - List<PrelinkedUnit> get units => _units ?? const <PrelinkedUnit>[];
|
| + @override
|
| + _PrelinkedDependencyReader createReader(fb.BufferPointer bp) => new _PrelinkedDependencyReader(bp);
|
|
|
| - /**
|
| - * The libraries that this library depends on (either via an explicit import
|
| - * statement or via the implicit dependencies on `dart:core` and
|
| - * `dart:async`). The first element of this array is a pseudo-dependency
|
| - * representing the library itself (it is also used for "dynamic").
|
| - *
|
| - * TODO(paulberry): consider removing this entirely and just using
|
| - * [UnlinkedLibrary.imports].
|
| - */
|
| - List<PrelinkedDependency> get dependencies => _dependencies ?? const <PrelinkedDependency>[];
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "uri": uri,
|
| + };
|
|
|
| - /**
|
| - * For each import in [UnlinkedUnit.imports], an index into [dependencies]
|
| - * of the library being imported.
|
| - *
|
| - * TODO(paulberry): if [dependencies] is removed, this can be removed as
|
| - * well, since there will effectively be a one-to-one mapping.
|
| - */
|
| - List<int> get importDependencies => _importDependencies ?? const <int>[];
|
| + @override
|
| + String get uri => const fb.StringReader().vTableGet(_bp, 0, '');
|
| }
|
|
|
| class PrelinkedLibraryBuilder {
|
| - final Map _json = {};
|
| -
|
| bool _finished = false;
|
|
|
| + List<PrelinkedUnitBuilder> _units;
|
| + List<PrelinkedDependencyBuilder> _dependencies;
|
| + List<int> _importDependencies;
|
| +
|
| PrelinkedLibraryBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -159,10 +123,7 @@ class PrelinkedLibraryBuilder {
|
| */
|
| void set units(List<PrelinkedUnitBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("units"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["units"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _units = _value;
|
| }
|
|
|
| /**
|
| @@ -176,10 +137,7 @@ class PrelinkedLibraryBuilder {
|
| */
|
| void set dependencies(List<PrelinkedDependencyBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("dependencies"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["dependencies"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _dependencies = _value;
|
| }
|
|
|
| /**
|
| @@ -191,18 +149,40 @@ class PrelinkedLibraryBuilder {
|
| */
|
| void set importDependencies(List<int> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("importDependencies"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["importDependencies"] = _value.toList();
|
| - }
|
| + _importDependencies = _value;
|
| }
|
|
|
| - List<int> toBuffer() => UTF8.encode(JSON.encode(finish()));
|
| + List<int> toBuffer() {
|
| + fb.Builder fbBuilder = new fb.Builder();
|
| + return fbBuilder.finish(finish(fbBuilder));
|
| + }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_units;
|
| + fb.Offset offset_dependencies;
|
| + fb.Offset offset_importDependencies;
|
| + if (!(_units == null || _units.isEmpty)) {
|
| + offset_units = fbBuilder.writeList(_units.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_dependencies == null || _dependencies.isEmpty)) {
|
| + offset_dependencies = fbBuilder.writeList(_dependencies.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_importDependencies == null || _importDependencies.isEmpty)) {
|
| + offset_importDependencies = fbBuilder.writeListInt32(_importDependencies);
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_units != null) {
|
| + fbBuilder.addOffset(0, offset_units);
|
| + }
|
| + if (offset_dependencies != null) {
|
| + fbBuilder.addOffset(1, offset_dependencies);
|
| + }
|
| + if (offset_importDependencies != null) {
|
| + fbBuilder.addOffset(2, offset_importDependencies);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -215,60 +195,76 @@ PrelinkedLibraryBuilder encodePrelinkedLibrary(base.BuilderContext builderContex
|
| }
|
|
|
| /**
|
| - * Information about the resolution of an [UnlinkedReference].
|
| + * Pre-linked summary of a library.
|
| */
|
| -class PrelinkedReference extends base.SummaryClass {
|
| - int _dependency;
|
| - PrelinkedReferenceKind _kind;
|
| - int _unit;
|
| - int _numTypeParameters;
|
| -
|
| - PrelinkedReference.fromJson(Map json)
|
| - : _dependency = json["dependency"],
|
| - _kind = json["kind"] == null ? null : PrelinkedReferenceKind.values[json["kind"]],
|
| - _unit = json["unit"],
|
| - _numTypeParameters = json["numTypeParameters"];
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "dependency": dependency,
|
| - "kind": kind,
|
| - "unit": unit,
|
| - "numTypeParameters": numTypeParameters,
|
| - };
|
| +abstract class PrelinkedLibrary extends base.SummaryClass {
|
| + factory PrelinkedLibrary.fromBuffer(List<int> buffer) {
|
| + fb.BufferPointer rootRef = new fb.BufferPointer.fromBytes(buffer);
|
| + return const _PrelinkedLibraryReader().read(rootRef);
|
| + }
|
|
|
| /**
|
| - * Index into [PrelinkedLibrary.dependencies] indicating which imported library
|
| - * declares the entity being referred to.
|
| + * The pre-linked summary of all the compilation units constituting the
|
| + * library. The summary of the defining compilation unit is listed first,
|
| + * followed by the summary of each part, in the order of the `part`
|
| + * declarations in the defining compilation unit.
|
| */
|
| - int get dependency => _dependency ?? 0;
|
| + List<PrelinkedUnit> get units;
|
|
|
| /**
|
| - * The kind of the entity being referred to. For the pseudo-type `dynamic`,
|
| - * the kind is [PrelinkedReferenceKind.classOrEnum].
|
| + * The libraries that this library depends on (either via an explicit import
|
| + * statement or via the implicit dependencies on `dart:core` and
|
| + * `dart:async`). The first element of this array is a pseudo-dependency
|
| + * representing the library itself (it is also used for "dynamic").
|
| + *
|
| + * TODO(paulberry): consider removing this entirely and just using
|
| + * [UnlinkedLibrary.imports].
|
| */
|
| - PrelinkedReferenceKind get kind => _kind ?? PrelinkedReferenceKind.classOrEnum;
|
| + List<PrelinkedDependency> get dependencies;
|
|
|
| /**
|
| - * Integer index indicating which unit in the imported library contains the
|
| - * definition of the entity. As with indices into [PrelinkedLibrary.units],
|
| - * zero represents the defining compilation unit, and nonzero values
|
| - * represent parts in the order of the corresponding `part` declarations.
|
| + * For each import in [UnlinkedUnit.imports], an index into [dependencies]
|
| + * of the library being imported.
|
| + *
|
| + * TODO(paulberry): if [dependencies] is removed, this can be removed as
|
| + * well, since there will effectively be a one-to-one mapping.
|
| */
|
| - int get unit => _unit ?? 0;
|
| + List<int> get importDependencies;
|
| +}
|
|
|
| - /**
|
| - * If the entity being referred to is generic, the number of type parameters
|
| - * it accepts. Otherwise zero.
|
| - */
|
| - int get numTypeParameters => _numTypeParameters ?? 0;
|
| +class _PrelinkedLibraryReader extends fb.TableReader<_PrelinkedLibraryReader> implements PrelinkedLibrary {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _PrelinkedLibraryReader([this._bp]);
|
| +
|
| + @override
|
| + _PrelinkedLibraryReader createReader(fb.BufferPointer bp) => new _PrelinkedLibraryReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "units": units,
|
| + "dependencies": dependencies,
|
| + "importDependencies": importDependencies,
|
| + };
|
| +
|
| + @override
|
| + List<PrelinkedUnit> get units => const fb.ListReader<PrelinkedUnit>(const _PrelinkedUnitReader()).vTableGet(_bp, 0, const <PrelinkedUnit>[]);
|
| +
|
| + @override
|
| + List<PrelinkedDependency> get dependencies => const fb.ListReader<PrelinkedDependency>(const _PrelinkedDependencyReader()).vTableGet(_bp, 1, const <PrelinkedDependency>[]);
|
| +
|
| + @override
|
| + List<int> get importDependencies => const fb.ListReader<int>(const fb.Int32Reader()).vTableGet(_bp, 2, const <int>[]);
|
| }
|
|
|
| class PrelinkedReferenceBuilder {
|
| - final Map _json = {};
|
| -
|
| bool _finished = false;
|
|
|
| + int _dependency;
|
| + PrelinkedReferenceKind _kind;
|
| + int _unit;
|
| + int _numTypeParameters;
|
| +
|
| PrelinkedReferenceBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -277,10 +273,7 @@ class PrelinkedReferenceBuilder {
|
| */
|
| void set dependency(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("dependency"));
|
| - if (_value != null) {
|
| - _json["dependency"] = _value;
|
| - }
|
| + _dependency = _value;
|
| }
|
|
|
| /**
|
| @@ -289,10 +282,7 @@ class PrelinkedReferenceBuilder {
|
| */
|
| void set kind(PrelinkedReferenceKind _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("kind"));
|
| - if (!(_value == null || _value == PrelinkedReferenceKind.classOrEnum)) {
|
| - _json["kind"] = _value.index;
|
| - }
|
| + _kind = _value;
|
| }
|
|
|
| /**
|
| @@ -303,10 +293,7 @@ class PrelinkedReferenceBuilder {
|
| */
|
| void set unit(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("unit"));
|
| - if (_value != null) {
|
| - _json["unit"] = _value;
|
| - }
|
| + _unit = _value;
|
| }
|
|
|
| /**
|
| @@ -315,16 +302,26 @@ class PrelinkedReferenceBuilder {
|
| */
|
| void set numTypeParameters(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("numTypeParameters"));
|
| - if (_value != null) {
|
| - _json["numTypeParameters"] = _value;
|
| - }
|
| + _numTypeParameters = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fbBuilder.startTable();
|
| + if (_dependency != null && _dependency != 0) {
|
| + fbBuilder.addInt32(0, _dependency);
|
| + }
|
| + if (_kind != null && _kind != PrelinkedReferenceKind.classOrEnum) {
|
| + fbBuilder.addInt32(1, _kind.index);
|
| + }
|
| + if (_unit != null && _unit != 0) {
|
| + fbBuilder.addInt32(2, _unit);
|
| + }
|
| + if (_numTypeParameters != null && _numTypeParameters != 0) {
|
| + fbBuilder.addInt32(3, _numTypeParameters);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -338,31 +335,74 @@ PrelinkedReferenceBuilder encodePrelinkedReference(base.BuilderContext builderCo
|
| }
|
|
|
| /**
|
| - * Pre-linked summary of a compilation unit.
|
| + * Information about the resolution of an [UnlinkedReference].
|
| */
|
| -class PrelinkedUnit extends base.SummaryClass {
|
| - List<PrelinkedReference> _references;
|
| +abstract class PrelinkedReference extends base.SummaryClass {
|
| +
|
| + /**
|
| + * Index into [PrelinkedLibrary.dependencies] indicating which imported library
|
| + * declares the entity being referred to.
|
| + */
|
| + int get dependency;
|
|
|
| - PrelinkedUnit.fromJson(Map json)
|
| - : _references = json["references"]?.map((x) => new PrelinkedReference.fromJson(x))?.toList();
|
| + /**
|
| + * The kind of the entity being referred to. For the pseudo-type `dynamic`,
|
| + * the kind is [PrelinkedReferenceKind.classOrEnum].
|
| + */
|
| + PrelinkedReferenceKind get kind;
|
| +
|
| + /**
|
| + * Integer index indicating which unit in the imported library contains the
|
| + * definition of the entity. As with indices into [PrelinkedLibrary.units],
|
| + * zero represents the defining compilation unit, and nonzero values
|
| + * represent parts in the order of the corresponding `part` declarations.
|
| + */
|
| + int get unit;
|
| +
|
| + /**
|
| + * If the entity being referred to is generic, the number of type parameters
|
| + * it accepts. Otherwise zero.
|
| + */
|
| + int get numTypeParameters;
|
| +}
|
| +
|
| +class _PrelinkedReferenceReader extends fb.TableReader<_PrelinkedReferenceReader> implements PrelinkedReference {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _PrelinkedReferenceReader([this._bp]);
|
| +
|
| + @override
|
| + _PrelinkedReferenceReader createReader(fb.BufferPointer bp) => new _PrelinkedReferenceReader(bp);
|
|
|
| @override
|
| Map<String, Object> toMap() => {
|
| - "references": references,
|
| + "dependency": dependency,
|
| + "kind": kind,
|
| + "unit": unit,
|
| + "numTypeParameters": numTypeParameters,
|
| };
|
|
|
| - /**
|
| - * For each reference in [UnlinkedUnit.references], information about how
|
| - * that reference is resolved.
|
| - */
|
| - List<PrelinkedReference> get references => _references ?? const <PrelinkedReference>[];
|
| + @override
|
| + int get dependency => const fb.Int32Reader().vTableGet(_bp, 0, 0);
|
| +
|
| + @override
|
| + PrelinkedReferenceKind get kind {
|
| + int index = const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| + return PrelinkedReferenceKind.values[index];
|
| + }
|
| +
|
| + @override
|
| + int get unit => const fb.Int32Reader().vTableGet(_bp, 2, 0);
|
| +
|
| + @override
|
| + int get numTypeParameters => const fb.Int32Reader().vTableGet(_bp, 3, 0);
|
| }
|
|
|
| class PrelinkedUnitBuilder {
|
| - final Map _json = {};
|
| -
|
| bool _finished = false;
|
|
|
| + List<PrelinkedReferenceBuilder> _references;
|
| +
|
| PrelinkedUnitBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -371,16 +411,21 @@ class PrelinkedUnitBuilder {
|
| */
|
| void set references(List<PrelinkedReferenceBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("references"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["references"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _references = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_references;
|
| + if (!(_references == null || _references.isEmpty)) {
|
| + offset_references = fbBuilder.writeList(_references.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_references != null) {
|
| + fbBuilder.addOffset(0, offset_references);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -391,56 +436,42 @@ PrelinkedUnitBuilder encodePrelinkedUnit(base.BuilderContext builderContext, {Li
|
| }
|
|
|
| /**
|
| - * Information about SDK.
|
| + * Pre-linked summary of a compilation unit.
|
| */
|
| -class SdkBundle extends base.SummaryClass {
|
| - List<String> _prelinkedLibraryUris;
|
| - List<PrelinkedLibrary> _prelinkedLibraries;
|
| - List<String> _unlinkedUnitUris;
|
| - List<UnlinkedUnit> _unlinkedUnits;
|
| -
|
| - SdkBundle.fromJson(Map json)
|
| - : _prelinkedLibraryUris = json["prelinkedLibraryUris"],
|
| - _prelinkedLibraries = json["prelinkedLibraries"]?.map((x) => new PrelinkedLibrary.fromJson(x))?.toList(),
|
| - _unlinkedUnitUris = json["unlinkedUnitUris"],
|
| - _unlinkedUnits = json["unlinkedUnits"]?.map((x) => new UnlinkedUnit.fromJson(x))?.toList();
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "prelinkedLibraryUris": prelinkedLibraryUris,
|
| - "prelinkedLibraries": prelinkedLibraries,
|
| - "unlinkedUnitUris": unlinkedUnitUris,
|
| - "unlinkedUnits": unlinkedUnits,
|
| - };
|
| -
|
| - SdkBundle.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8.decode(buffer)));
|
| +abstract class PrelinkedUnit extends base.SummaryClass {
|
|
|
| /**
|
| - * The list of URIs of items in [prelinkedLibraries], e.g. `dart:core`.
|
| + * For each reference in [UnlinkedUnit.references], information about how
|
| + * that reference is resolved.
|
| */
|
| - List<String> get prelinkedLibraryUris => _prelinkedLibraryUris ?? const <String>[];
|
| + List<PrelinkedReference> get references;
|
| +}
|
|
|
| - /**
|
| - * Pre-linked libraries.
|
| - */
|
| - List<PrelinkedLibrary> get prelinkedLibraries => _prelinkedLibraries ?? const <PrelinkedLibrary>[];
|
| +class _PrelinkedUnitReader extends fb.TableReader<_PrelinkedUnitReader> implements PrelinkedUnit {
|
| + final fb.BufferPointer _bp;
|
|
|
| - /**
|
| - * The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`.
|
| - */
|
| - List<String> get unlinkedUnitUris => _unlinkedUnitUris ?? const <String>[];
|
| + const _PrelinkedUnitReader([this._bp]);
|
|
|
| - /**
|
| - * Unlinked information for the compilation units constituting the SDK.
|
| - */
|
| - List<UnlinkedUnit> get unlinkedUnits => _unlinkedUnits ?? const <UnlinkedUnit>[];
|
| + @override
|
| + _PrelinkedUnitReader createReader(fb.BufferPointer bp) => new _PrelinkedUnitReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "references": references,
|
| + };
|
| +
|
| + @override
|
| + List<PrelinkedReference> get references => const fb.ListReader<PrelinkedReference>(const _PrelinkedReferenceReader()).vTableGet(_bp, 0, const <PrelinkedReference>[]);
|
| }
|
|
|
| class SdkBundleBuilder {
|
| - final Map _json = {};
|
| -
|
| bool _finished = false;
|
|
|
| + List<String> _prelinkedLibraryUris;
|
| + List<PrelinkedLibraryBuilder> _prelinkedLibraries;
|
| + List<String> _unlinkedUnitUris;
|
| + List<UnlinkedUnitBuilder> _unlinkedUnits;
|
| +
|
| SdkBundleBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -448,10 +479,7 @@ class SdkBundleBuilder {
|
| */
|
| void set prelinkedLibraryUris(List<String> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("prelinkedLibraryUris"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["prelinkedLibraryUris"] = _value.toList();
|
| - }
|
| + _prelinkedLibraryUris = _value;
|
| }
|
|
|
| /**
|
| @@ -459,10 +487,7 @@ class SdkBundleBuilder {
|
| */
|
| void set prelinkedLibraries(List<PrelinkedLibraryBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("prelinkedLibraries"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["prelinkedLibraries"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _prelinkedLibraries = _value;
|
| }
|
|
|
| /**
|
| @@ -470,10 +495,7 @@ class SdkBundleBuilder {
|
| */
|
| void set unlinkedUnitUris(List<String> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("unlinkedUnitUris"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["unlinkedUnitUris"] = _value.toList();
|
| - }
|
| + _unlinkedUnitUris = _value;
|
| }
|
|
|
| /**
|
| @@ -481,18 +503,47 @@ class SdkBundleBuilder {
|
| */
|
| void set unlinkedUnits(List<UnlinkedUnitBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("unlinkedUnits"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["unlinkedUnits"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _unlinkedUnits = _value;
|
| }
|
|
|
| - List<int> toBuffer() => UTF8.encode(JSON.encode(finish()));
|
| + List<int> toBuffer() {
|
| + fb.Builder fbBuilder = new fb.Builder();
|
| + return fbBuilder.finish(finish(fbBuilder));
|
| + }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_prelinkedLibraryUris;
|
| + fb.Offset offset_prelinkedLibraries;
|
| + fb.Offset offset_unlinkedUnitUris;
|
| + fb.Offset offset_unlinkedUnits;
|
| + if (!(_prelinkedLibraryUris == null || _prelinkedLibraryUris.isEmpty)) {
|
| + offset_prelinkedLibraryUris = fbBuilder.writeList(_prelinkedLibraryUris.map((b) => fbBuilder.writeString(b)).toList());
|
| + }
|
| + if (!(_prelinkedLibraries == null || _prelinkedLibraries.isEmpty)) {
|
| + offset_prelinkedLibraries = fbBuilder.writeList(_prelinkedLibraries.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_unlinkedUnitUris == null || _unlinkedUnitUris.isEmpty)) {
|
| + offset_unlinkedUnitUris = fbBuilder.writeList(_unlinkedUnitUris.map((b) => fbBuilder.writeString(b)).toList());
|
| + }
|
| + if (!(_unlinkedUnits == null || _unlinkedUnits.isEmpty)) {
|
| + offset_unlinkedUnits = fbBuilder.writeList(_unlinkedUnits.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_prelinkedLibraryUris != null) {
|
| + fbBuilder.addOffset(0, offset_prelinkedLibraryUris);
|
| + }
|
| + if (offset_prelinkedLibraries != null) {
|
| + fbBuilder.addOffset(1, offset_prelinkedLibraries);
|
| + }
|
| + if (offset_unlinkedUnitUris != null) {
|
| + fbBuilder.addOffset(2, offset_unlinkedUnitUris);
|
| + }
|
| + if (offset_unlinkedUnits != null) {
|
| + fbBuilder.addOffset(3, offset_unlinkedUnits);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -506,122 +557,80 @@ SdkBundleBuilder encodeSdkBundle(base.BuilderContext builderContext, {List<Strin
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a class declaration.
|
| + * Information about SDK.
|
| */
|
| -class UnlinkedClass extends base.SummaryClass {
|
| - String _name;
|
| - int _nameOffset;
|
| - UnlinkedDocumentationComment _documentationComment;
|
| - List<UnlinkedTypeParam> _typeParameters;
|
| - UnlinkedTypeRef _supertype;
|
| - List<UnlinkedTypeRef> _mixins;
|
| - List<UnlinkedTypeRef> _interfaces;
|
| - List<UnlinkedVariable> _fields;
|
| - List<UnlinkedExecutable> _executables;
|
| - bool _isAbstract;
|
| - bool _isMixinApplication;
|
| - bool _hasNoSupertype;
|
| -
|
| - UnlinkedClass.fromJson(Map json)
|
| - : _name = json["name"],
|
| - _nameOffset = json["nameOffset"],
|
| - _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]),
|
| - _typeParameters = json["typeParameters"]?.map((x) => new UnlinkedTypeParam.fromJson(x))?.toList(),
|
| - _supertype = json["supertype"] == null ? null : new UnlinkedTypeRef.fromJson(json["supertype"]),
|
| - _mixins = json["mixins"]?.map((x) => new UnlinkedTypeRef.fromJson(x))?.toList(),
|
| - _interfaces = json["interfaces"]?.map((x) => new UnlinkedTypeRef.fromJson(x))?.toList(),
|
| - _fields = json["fields"]?.map((x) => new UnlinkedVariable.fromJson(x))?.toList(),
|
| - _executables = json["executables"]?.map((x) => new UnlinkedExecutable.fromJson(x))?.toList(),
|
| - _isAbstract = json["isAbstract"],
|
| - _isMixinApplication = json["isMixinApplication"],
|
| - _hasNoSupertype = json["hasNoSupertype"];
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "name": name,
|
| - "nameOffset": nameOffset,
|
| - "documentationComment": documentationComment,
|
| - "typeParameters": typeParameters,
|
| - "supertype": supertype,
|
| - "mixins": mixins,
|
| - "interfaces": interfaces,
|
| - "fields": fields,
|
| - "executables": executables,
|
| - "isAbstract": isAbstract,
|
| - "isMixinApplication": isMixinApplication,
|
| - "hasNoSupertype": hasNoSupertype,
|
| - };
|
| +abstract class SdkBundle extends base.SummaryClass {
|
| + factory SdkBundle.fromBuffer(List<int> buffer) {
|
| + fb.BufferPointer rootRef = new fb.BufferPointer.fromBytes(buffer);
|
| + return const _SdkBundleReader().read(rootRef);
|
| + }
|
|
|
| /**
|
| - * Name of the class.
|
| + * The list of URIs of items in [prelinkedLibraries], e.g. `dart:core`.
|
| */
|
| - String get name => _name ?? '';
|
| + List<String> get prelinkedLibraryUris;
|
|
|
| /**
|
| - * Offset of the class name relative to the beginning of the file.
|
| + * Pre-linked libraries.
|
| */
|
| - int get nameOffset => _nameOffset ?? 0;
|
| + List<PrelinkedLibrary> get prelinkedLibraries;
|
|
|
| /**
|
| - * Documentation comment for the class, or `null` if there is no
|
| - * documentation comment.
|
| + * The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`.
|
| */
|
| - UnlinkedDocumentationComment get documentationComment => _documentationComment;
|
| + List<String> get unlinkedUnitUris;
|
|
|
| /**
|
| - * Type parameters of the class, if any.
|
| + * Unlinked information for the compilation units constituting the SDK.
|
| */
|
| - List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <UnlinkedTypeParam>[];
|
| + List<UnlinkedUnit> get unlinkedUnits;
|
| +}
|
|
|
| - /**
|
| - * Supertype of the class, or `null` if either (a) the class doesn't
|
| - * explicitly declare a supertype (and hence has supertype `Object`), or (b)
|
| - * the class *is* `Object` (and hence has no supertype).
|
| - */
|
| - UnlinkedTypeRef get supertype => _supertype;
|
| +class _SdkBundleReader extends fb.TableReader<_SdkBundleReader> implements SdkBundle {
|
| + final fb.BufferPointer _bp;
|
|
|
| - /**
|
| - * Mixins appearing in a `with` clause, if any.
|
| - */
|
| - List<UnlinkedTypeRef> get mixins => _mixins ?? const <UnlinkedTypeRef>[];
|
| + const _SdkBundleReader([this._bp]);
|
|
|
| - /**
|
| - * Interfaces appearing in an `implements` clause, if any.
|
| - */
|
| - List<UnlinkedTypeRef> get interfaces => _interfaces ?? const <UnlinkedTypeRef>[];
|
| + @override
|
| + _SdkBundleReader createReader(fb.BufferPointer bp) => new _SdkBundleReader(bp);
|
|
|
| - /**
|
| - * Field declarations contained in the class.
|
| - */
|
| - List<UnlinkedVariable> get fields => _fields ?? const <UnlinkedVariable>[];
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "prelinkedLibraryUris": prelinkedLibraryUris,
|
| + "prelinkedLibraries": prelinkedLibraries,
|
| + "unlinkedUnitUris": unlinkedUnitUris,
|
| + "unlinkedUnits": unlinkedUnits,
|
| + };
|
|
|
| - /**
|
| - * Executable objects (methods, getters, and setters) contained in the class.
|
| - */
|
| - List<UnlinkedExecutable> get executables => _executables ?? const <UnlinkedExecutable>[];
|
| + @override
|
| + List<String> get prelinkedLibraryUris => const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bp, 0, const <String>[]);
|
|
|
| - /**
|
| - * Indicates whether the class is declared with the `abstract` keyword.
|
| - */
|
| - bool get isAbstract => _isAbstract ?? false;
|
| + @override
|
| + List<PrelinkedLibrary> get prelinkedLibraries => const fb.ListReader<PrelinkedLibrary>(const _PrelinkedLibraryReader()).vTableGet(_bp, 1, const <PrelinkedLibrary>[]);
|
|
|
| - /**
|
| - * Indicates whether the class is declared using mixin application syntax.
|
| - */
|
| - bool get isMixinApplication => _isMixinApplication ?? false;
|
| + @override
|
| + List<String> get unlinkedUnitUris => const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bp, 2, const <String>[]);
|
|
|
| - /**
|
| - * Indicates whether this class is the core "Object" class (and hence has no
|
| - * supertype)
|
| - */
|
| - bool get hasNoSupertype => _hasNoSupertype ?? false;
|
| + @override
|
| + List<UnlinkedUnit> get unlinkedUnits => const fb.ListReader<UnlinkedUnit>(const _UnlinkedUnitReader()).vTableGet(_bp, 3, const <UnlinkedUnit>[]);
|
| }
|
|
|
| class UnlinkedClassBuilder {
|
| - final Map _json = {};
|
| -
|
| bool _finished = false;
|
|
|
| + String _name;
|
| + int _nameOffset;
|
| + UnlinkedDocumentationCommentBuilder _documentationComment;
|
| + List<UnlinkedTypeParamBuilder> _typeParameters;
|
| + UnlinkedTypeRefBuilder _supertype;
|
| + List<UnlinkedTypeRefBuilder> _mixins;
|
| + List<UnlinkedTypeRefBuilder> _interfaces;
|
| + List<UnlinkedVariableBuilder> _fields;
|
| + List<UnlinkedExecutableBuilder> _executables;
|
| + bool _isAbstract;
|
| + bool _isMixinApplication;
|
| + bool _hasNoSupertype;
|
| +
|
| UnlinkedClassBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -629,10 +638,7 @@ class UnlinkedClassBuilder {
|
| */
|
| void set name(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("name"));
|
| - if (_value != null) {
|
| - _json["name"] = _value;
|
| - }
|
| + _name = _value;
|
| }
|
|
|
| /**
|
| @@ -640,10 +646,7 @@ class UnlinkedClassBuilder {
|
| */
|
| void set nameOffset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("nameOffset"));
|
| - if (_value != null) {
|
| - _json["nameOffset"] = _value;
|
| - }
|
| + _nameOffset = _value;
|
| }
|
|
|
| /**
|
| @@ -652,10 +655,7 @@ class UnlinkedClassBuilder {
|
| */
|
| void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("documentationComment"));
|
| - if (_value != null) {
|
| - _json["documentationComment"] = _value.finish();
|
| - }
|
| + _documentationComment = _value;
|
| }
|
|
|
| /**
|
| @@ -663,10 +663,7 @@ class UnlinkedClassBuilder {
|
| */
|
| void set typeParameters(List<UnlinkedTypeParamBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("typeParameters"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["typeParameters"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _typeParameters = _value;
|
| }
|
|
|
| /**
|
| @@ -676,10 +673,7 @@ class UnlinkedClassBuilder {
|
| */
|
| void set supertype(UnlinkedTypeRefBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("supertype"));
|
| - if (_value != null) {
|
| - _json["supertype"] = _value.finish();
|
| - }
|
| + _supertype = _value;
|
| }
|
|
|
| /**
|
| @@ -687,10 +681,7 @@ class UnlinkedClassBuilder {
|
| */
|
| void set mixins(List<UnlinkedTypeRefBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("mixins"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["mixins"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _mixins = _value;
|
| }
|
|
|
| /**
|
| @@ -698,10 +689,7 @@ class UnlinkedClassBuilder {
|
| */
|
| void set interfaces(List<UnlinkedTypeRefBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("interfaces"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["interfaces"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _interfaces = _value;
|
| }
|
|
|
| /**
|
| @@ -709,10 +697,7 @@ class UnlinkedClassBuilder {
|
| */
|
| void set fields(List<UnlinkedVariableBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("fields"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["fields"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _fields = _value;
|
| }
|
|
|
| /**
|
| @@ -720,10 +705,7 @@ class UnlinkedClassBuilder {
|
| */
|
| void set executables(List<UnlinkedExecutableBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("executables"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["executables"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _executables = _value;
|
| }
|
|
|
| /**
|
| @@ -731,10 +713,7 @@ class UnlinkedClassBuilder {
|
| */
|
| void set isAbstract(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isAbstract"));
|
| - if (_value != null) {
|
| - _json["isAbstract"] = _value;
|
| - }
|
| + _isAbstract = _value;
|
| }
|
|
|
| /**
|
| @@ -742,10 +721,7 @@ class UnlinkedClassBuilder {
|
| */
|
| void set isMixinApplication(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isMixinApplication"));
|
| - if (_value != null) {
|
| - _json["isMixinApplication"] = _value;
|
| - }
|
| + _isMixinApplication = _value;
|
| }
|
|
|
| /**
|
| @@ -754,16 +730,82 @@ class UnlinkedClassBuilder {
|
| */
|
| void set hasNoSupertype(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("hasNoSupertype"));
|
| - if (_value != null) {
|
| - _json["hasNoSupertype"] = _value;
|
| - }
|
| + _hasNoSupertype = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_name;
|
| + fb.Offset offset_documentationComment;
|
| + fb.Offset offset_typeParameters;
|
| + fb.Offset offset_supertype;
|
| + fb.Offset offset_mixins;
|
| + fb.Offset offset_interfaces;
|
| + fb.Offset offset_fields;
|
| + fb.Offset offset_executables;
|
| + if (_name != null) {
|
| + offset_name = fbBuilder.writeString(_name);
|
| + }
|
| + if (_documentationComment != null) {
|
| + offset_documentationComment = _documentationComment.finish(fbBuilder);
|
| + }
|
| + if (!(_typeParameters == null || _typeParameters.isEmpty)) {
|
| + offset_typeParameters = fbBuilder.writeList(_typeParameters.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (_supertype != null) {
|
| + offset_supertype = _supertype.finish(fbBuilder);
|
| + }
|
| + if (!(_mixins == null || _mixins.isEmpty)) {
|
| + offset_mixins = fbBuilder.writeList(_mixins.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_interfaces == null || _interfaces.isEmpty)) {
|
| + offset_interfaces = fbBuilder.writeList(_interfaces.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_fields == null || _fields.isEmpty)) {
|
| + offset_fields = fbBuilder.writeList(_fields.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_executables == null || _executables.isEmpty)) {
|
| + offset_executables = fbBuilder.writeList(_executables.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_name != null) {
|
| + fbBuilder.addOffset(0, offset_name);
|
| + }
|
| + if (_nameOffset != null && _nameOffset != 0) {
|
| + fbBuilder.addInt32(1, _nameOffset);
|
| + }
|
| + if (offset_documentationComment != null) {
|
| + fbBuilder.addOffset(2, offset_documentationComment);
|
| + }
|
| + if (offset_typeParameters != null) {
|
| + fbBuilder.addOffset(3, offset_typeParameters);
|
| + }
|
| + if (offset_supertype != null) {
|
| + fbBuilder.addOffset(4, offset_supertype);
|
| + }
|
| + if (offset_mixins != null) {
|
| + fbBuilder.addOffset(5, offset_mixins);
|
| + }
|
| + if (offset_interfaces != null) {
|
| + fbBuilder.addOffset(6, offset_interfaces);
|
| + }
|
| + if (offset_fields != null) {
|
| + fbBuilder.addOffset(7, offset_fields);
|
| + }
|
| + if (offset_executables != null) {
|
| + fbBuilder.addOffset(8, offset_executables);
|
| + }
|
| + if (_isAbstract == true) {
|
| + fbBuilder.addInt8(9, 1);
|
| + }
|
| + if (_isMixinApplication == true) {
|
| + fbBuilder.addInt8(10, 1);
|
| + }
|
| + if (_hasNoSupertype == true) {
|
| + fbBuilder.addInt8(11, 1);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -785,39 +827,142 @@ UnlinkedClassBuilder encodeUnlinkedClass(base.BuilderContext builderContext, {St
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a `show` or `hide` combinator in an
|
| - * import or export declaration.
|
| + * Unlinked summary information about a class declaration.
|
| */
|
| -class UnlinkedCombinator extends base.SummaryClass {
|
| - List<String> _shows;
|
| - List<String> _hides;
|
| +abstract class UnlinkedClass extends base.SummaryClass {
|
|
|
| - UnlinkedCombinator.fromJson(Map json)
|
| - : _shows = json["shows"],
|
| - _hides = json["hides"];
|
| + /**
|
| + * Name of the class.
|
| + */
|
| + String get name;
|
|
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "shows": shows,
|
| - "hides": hides,
|
| - };
|
| + /**
|
| + * Offset of the class name relative to the beginning of the file.
|
| + */
|
| + int get nameOffset;
|
|
|
| /**
|
| - * List of names which are shown. Empty if this is a `hide` combinator.
|
| + * Documentation comment for the class, or `null` if there is no
|
| + * documentation comment.
|
| */
|
| - List<String> get shows => _shows ?? const <String>[];
|
| + UnlinkedDocumentationComment get documentationComment;
|
|
|
| /**
|
| - * List of names which are hidden. Empty if this is a `show` combinator.
|
| + * Type parameters of the class, if any.
|
| + */
|
| + List<UnlinkedTypeParam> get typeParameters;
|
| +
|
| + /**
|
| + * Supertype of the class, or `null` if either (a) the class doesn't
|
| + * explicitly declare a supertype (and hence has supertype `Object`), or (b)
|
| + * the class *is* `Object` (and hence has no supertype).
|
| + */
|
| + UnlinkedTypeRef get supertype;
|
| +
|
| + /**
|
| + * Mixins appearing in a `with` clause, if any.
|
| + */
|
| + List<UnlinkedTypeRef> get mixins;
|
| +
|
| + /**
|
| + * Interfaces appearing in an `implements` clause, if any.
|
| + */
|
| + List<UnlinkedTypeRef> get interfaces;
|
| +
|
| + /**
|
| + * Field declarations contained in the class.
|
| + */
|
| + List<UnlinkedVariable> get fields;
|
| +
|
| + /**
|
| + * Executable objects (methods, getters, and setters) contained in the class.
|
| + */
|
| + List<UnlinkedExecutable> get executables;
|
| +
|
| + /**
|
| + * Indicates whether the class is declared with the `abstract` keyword.
|
| + */
|
| + bool get isAbstract;
|
| +
|
| + /**
|
| + * Indicates whether the class is declared using mixin application syntax.
|
| + */
|
| + bool get isMixinApplication;
|
| +
|
| + /**
|
| + * Indicates whether this class is the core "Object" class (and hence has no
|
| + * supertype)
|
| */
|
| - List<String> get hides => _hides ?? const <String>[];
|
| + bool get hasNoSupertype;
|
| }
|
|
|
| -class UnlinkedCombinatorBuilder {
|
| - final Map _json = {};
|
| +class _UnlinkedClassReader extends fb.TableReader<_UnlinkedClassReader> implements UnlinkedClass {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedClassReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedClassReader createReader(fb.BufferPointer bp) => new _UnlinkedClassReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "name": name,
|
| + "nameOffset": nameOffset,
|
| + "documentationComment": documentationComment,
|
| + "typeParameters": typeParameters,
|
| + "supertype": supertype,
|
| + "mixins": mixins,
|
| + "interfaces": interfaces,
|
| + "fields": fields,
|
| + "executables": executables,
|
| + "isAbstract": isAbstract,
|
| + "isMixinApplication": isMixinApplication,
|
| + "hasNoSupertype": hasNoSupertype,
|
| + };
|
| +
|
| + @override
|
| + String get name => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
|
|
| + @override
|
| + UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocumentationCommentReader().vTableGet(_bp, 2, null);
|
| +
|
| + @override
|
| + List<UnlinkedTypeParam> get typeParameters => const fb.ListReader<UnlinkedTypeParam>(const _UnlinkedTypeParamReader()).vTableGet(_bp, 3, const <UnlinkedTypeParam>[]);
|
| +
|
| + @override
|
| + UnlinkedTypeRef get supertype => const _UnlinkedTypeRefReader().vTableGet(_bp, 4, null);
|
| +
|
| + @override
|
| + List<UnlinkedTypeRef> get mixins => const fb.ListReader<UnlinkedTypeRef>(const _UnlinkedTypeRefReader()).vTableGet(_bp, 5, const <UnlinkedTypeRef>[]);
|
| +
|
| + @override
|
| + List<UnlinkedTypeRef> get interfaces => const fb.ListReader<UnlinkedTypeRef>(const _UnlinkedTypeRefReader()).vTableGet(_bp, 6, const <UnlinkedTypeRef>[]);
|
| +
|
| + @override
|
| + List<UnlinkedVariable> get fields => const fb.ListReader<UnlinkedVariable>(const _UnlinkedVariableReader()).vTableGet(_bp, 7, const <UnlinkedVariable>[]);
|
| +
|
| + @override
|
| + List<UnlinkedExecutable> get executables => const fb.ListReader<UnlinkedExecutable>(const _UnlinkedExecutableReader()).vTableGet(_bp, 8, const <UnlinkedExecutable>[]);
|
| +
|
| + @override
|
| + bool get isAbstract => const fb.Int8Reader().vTableGet(_bp, 9, 0) == 1;
|
| +
|
| + @override
|
| + bool get isMixinApplication => const fb.Int8Reader().vTableGet(_bp, 10, 0) == 1;
|
| +
|
| + @override
|
| + bool get hasNoSupertype => const fb.Int8Reader().vTableGet(_bp, 11, 0) == 1;
|
| +}
|
| +
|
| +class UnlinkedCombinatorBuilder {
|
| bool _finished = false;
|
|
|
| + List<String> _shows;
|
| + List<String> _hides;
|
| +
|
| UnlinkedCombinatorBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -825,10 +970,7 @@ class UnlinkedCombinatorBuilder {
|
| */
|
| void set shows(List<String> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("shows"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["shows"] = _value.toList();
|
| - }
|
| + _shows = _value;
|
| }
|
|
|
| /**
|
| @@ -836,16 +978,28 @@ class UnlinkedCombinatorBuilder {
|
| */
|
| void set hides(List<String> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("hides"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["hides"] = _value.toList();
|
| - }
|
| + _hides = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_shows;
|
| + fb.Offset offset_hides;
|
| + if (!(_shows == null || _shows.isEmpty)) {
|
| + offset_shows = fbBuilder.writeList(_shows.map((b) => fbBuilder.writeString(b)).toList());
|
| + }
|
| + if (!(_hides == null || _hides.isEmpty)) {
|
| + offset_hides = fbBuilder.writeList(_hides.map((b) => fbBuilder.writeString(b)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_shows != null) {
|
| + fbBuilder.addOffset(0, offset_shows);
|
| + }
|
| + if (offset_hides != null) {
|
| + fbBuilder.addOffset(1, offset_hides);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -857,64 +1011,61 @@ UnlinkedCombinatorBuilder encodeUnlinkedCombinator(base.BuilderContext builderCo
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a documentation comment.
|
| + * Unlinked summary information about a `show` or `hide` combinator in an
|
| + * import or export declaration.
|
| */
|
| -class UnlinkedDocumentationComment extends base.SummaryClass {
|
| - String _text;
|
| - int _offset;
|
| - int _length;
|
| -
|
| - UnlinkedDocumentationComment.fromJson(Map json)
|
| - : _text = json["text"],
|
| - _offset = json["offset"],
|
| - _length = json["length"];
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "text": text,
|
| - "offset": offset,
|
| - "length": length,
|
| - };
|
| -
|
| - /**
|
| - * Text of the documentation comment, with '\r\n' replaced by '\n'.
|
| - *
|
| - * References appearing within the doc comment in square brackets are not
|
| - * specially encoded.
|
| - */
|
| - String get text => _text ?? '';
|
| +abstract class UnlinkedCombinator extends base.SummaryClass {
|
|
|
| /**
|
| - * Offset of the beginning of the documentation comment relative to the
|
| - * beginning of the file.
|
| + * List of names which are shown. Empty if this is a `hide` combinator.
|
| */
|
| - int get offset => _offset ?? 0;
|
| + List<String> get shows;
|
|
|
| /**
|
| - * Length of the documentation comment (prior to replacing '\r\n' with '\n').
|
| + * List of names which are hidden. Empty if this is a `show` combinator.
|
| */
|
| - int get length => _length ?? 0;
|
| + List<String> get hides;
|
| }
|
|
|
| -class UnlinkedDocumentationCommentBuilder {
|
| - final Map _json = {};
|
| +class _UnlinkedCombinatorReader extends fb.TableReader<_UnlinkedCombinatorReader> implements UnlinkedCombinator {
|
| + final fb.BufferPointer _bp;
|
|
|
| - bool _finished = false;
|
| + const _UnlinkedCombinatorReader([this._bp]);
|
|
|
| - UnlinkedDocumentationCommentBuilder(base.BuilderContext context);
|
| + @override
|
| + _UnlinkedCombinatorReader createReader(fb.BufferPointer bp) => new _UnlinkedCombinatorReader(bp);
|
|
|
| - /**
|
| - * Text of the documentation comment, with '\r\n' replaced by '\n'.
|
| - *
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "shows": shows,
|
| + "hides": hides,
|
| + };
|
| +
|
| + @override
|
| + List<String> get shows => const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bp, 0, const <String>[]);
|
| +
|
| + @override
|
| + List<String> get hides => const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bp, 1, const <String>[]);
|
| +}
|
| +
|
| +class UnlinkedDocumentationCommentBuilder {
|
| + bool _finished = false;
|
| +
|
| + String _text;
|
| + int _offset;
|
| + int _length;
|
| +
|
| + UnlinkedDocumentationCommentBuilder(base.BuilderContext context);
|
| +
|
| + /**
|
| + * Text of the documentation comment, with '\r\n' replaced by '\n'.
|
| + *
|
| * References appearing within the doc comment in square brackets are not
|
| * specially encoded.
|
| */
|
| void set text(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("text"));
|
| - if (_value != null) {
|
| - _json["text"] = _value;
|
| - }
|
| + _text = _value;
|
| }
|
|
|
| /**
|
| @@ -923,10 +1074,7 @@ class UnlinkedDocumentationCommentBuilder {
|
| */
|
| void set offset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("offset"));
|
| - if (_value != null) {
|
| - _json["offset"] = _value;
|
| - }
|
| + _offset = _value;
|
| }
|
|
|
| /**
|
| @@ -934,16 +1082,27 @@ class UnlinkedDocumentationCommentBuilder {
|
| */
|
| void set length(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("length"));
|
| - if (_value != null) {
|
| - _json["length"] = _value;
|
| - }
|
| + _length = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_text;
|
| + if (_text != null) {
|
| + offset_text = fbBuilder.writeString(_text);
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_text != null) {
|
| + fbBuilder.addOffset(0, offset_text);
|
| + }
|
| + if (_offset != null && _offset != 0) {
|
| + fbBuilder.addInt32(1, _offset);
|
| + }
|
| + if (_length != null && _length != 0) {
|
| + fbBuilder.addInt32(2, _length);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -956,55 +1115,63 @@ UnlinkedDocumentationCommentBuilder encodeUnlinkedDocumentationComment(base.Buil
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about an enum declaration.
|
| + * Unlinked summary information about a documentation comment.
|
| */
|
| -class UnlinkedEnum extends base.SummaryClass {
|
| - String _name;
|
| - int _nameOffset;
|
| - UnlinkedDocumentationComment _documentationComment;
|
| - List<UnlinkedEnumValue> _values;
|
| -
|
| - UnlinkedEnum.fromJson(Map json)
|
| - : _name = json["name"],
|
| - _nameOffset = json["nameOffset"],
|
| - _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]),
|
| - _values = json["values"]?.map((x) => new UnlinkedEnumValue.fromJson(x))?.toList();
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "name": name,
|
| - "nameOffset": nameOffset,
|
| - "documentationComment": documentationComment,
|
| - "values": values,
|
| - };
|
| +abstract class UnlinkedDocumentationComment extends base.SummaryClass {
|
|
|
| /**
|
| - * Name of the enum type.
|
| + * Text of the documentation comment, with '\r\n' replaced by '\n'.
|
| + *
|
| + * References appearing within the doc comment in square brackets are not
|
| + * specially encoded.
|
| */
|
| - String get name => _name ?? '';
|
| + String get text;
|
|
|
| /**
|
| - * Offset of the enum name relative to the beginning of the file.
|
| + * Offset of the beginning of the documentation comment relative to the
|
| + * beginning of the file.
|
| */
|
| - int get nameOffset => _nameOffset ?? 0;
|
| + int get offset;
|
|
|
| /**
|
| - * Documentation comment for the enum, or `null` if there is no documentation
|
| - * comment.
|
| + * Length of the documentation comment (prior to replacing '\r\n' with '\n').
|
| */
|
| - UnlinkedDocumentationComment get documentationComment => _documentationComment;
|
| + int get length;
|
| +}
|
|
|
| - /**
|
| - * Values listed in the enum declaration, in declaration order.
|
| - */
|
| - List<UnlinkedEnumValue> get values => _values ?? const <UnlinkedEnumValue>[];
|
| +class _UnlinkedDocumentationCommentReader extends fb.TableReader<_UnlinkedDocumentationCommentReader> implements UnlinkedDocumentationComment {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedDocumentationCommentReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedDocumentationCommentReader createReader(fb.BufferPointer bp) => new _UnlinkedDocumentationCommentReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "text": text,
|
| + "offset": offset,
|
| + "length": length,
|
| + };
|
| +
|
| + @override
|
| + String get text => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + int get offset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| +
|
| + @override
|
| + int get length => const fb.Int32Reader().vTableGet(_bp, 2, 0);
|
| }
|
|
|
| class UnlinkedEnumBuilder {
|
| - final Map _json = {};
|
| -
|
| bool _finished = false;
|
|
|
| + String _name;
|
| + int _nameOffset;
|
| + UnlinkedDocumentationCommentBuilder _documentationComment;
|
| + List<UnlinkedEnumValueBuilder> _values;
|
| +
|
| UnlinkedEnumBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -1012,10 +1179,7 @@ class UnlinkedEnumBuilder {
|
| */
|
| void set name(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("name"));
|
| - if (_value != null) {
|
| - _json["name"] = _value;
|
| - }
|
| + _name = _value;
|
| }
|
|
|
| /**
|
| @@ -1023,10 +1187,7 @@ class UnlinkedEnumBuilder {
|
| */
|
| void set nameOffset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("nameOffset"));
|
| - if (_value != null) {
|
| - _json["nameOffset"] = _value;
|
| - }
|
| + _nameOffset = _value;
|
| }
|
|
|
| /**
|
| @@ -1035,10 +1196,7 @@ class UnlinkedEnumBuilder {
|
| */
|
| void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("documentationComment"));
|
| - if (_value != null) {
|
| - _json["documentationComment"] = _value.finish();
|
| - }
|
| + _documentationComment = _value;
|
| }
|
|
|
| /**
|
| @@ -1046,16 +1204,38 @@ class UnlinkedEnumBuilder {
|
| */
|
| void set values(List<UnlinkedEnumValueBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("values"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["values"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _values = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_name;
|
| + fb.Offset offset_documentationComment;
|
| + fb.Offset offset_values;
|
| + if (_name != null) {
|
| + offset_name = fbBuilder.writeString(_name);
|
| + }
|
| + if (_documentationComment != null) {
|
| + offset_documentationComment = _documentationComment.finish(fbBuilder);
|
| + }
|
| + if (!(_values == null || _values.isEmpty)) {
|
| + offset_values = fbBuilder.writeList(_values.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_name != null) {
|
| + fbBuilder.addOffset(0, offset_name);
|
| + }
|
| + if (_nameOffset != null && _nameOffset != 0) {
|
| + fbBuilder.addInt32(1, _nameOffset);
|
| + }
|
| + if (offset_documentationComment != null) {
|
| + fbBuilder.addOffset(2, offset_documentationComment);
|
| + }
|
| + if (offset_values != null) {
|
| + fbBuilder.addOffset(3, offset_values);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -1069,48 +1249,68 @@ UnlinkedEnumBuilder encodeUnlinkedEnum(base.BuilderContext builderContext, {Stri
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a single enumerated value in an enum
|
| - * declaration.
|
| + * Unlinked summary information about an enum declaration.
|
| */
|
| -class UnlinkedEnumValue extends base.SummaryClass {
|
| - String _name;
|
| - int _nameOffset;
|
| - UnlinkedDocumentationComment _documentationComment;
|
| +abstract class UnlinkedEnum extends base.SummaryClass {
|
| +
|
| + /**
|
| + * Name of the enum type.
|
| + */
|
| + String get name;
|
| +
|
| + /**
|
| + * Offset of the enum name relative to the beginning of the file.
|
| + */
|
| + int get nameOffset;
|
| +
|
| + /**
|
| + * Documentation comment for the enum, or `null` if there is no documentation
|
| + * comment.
|
| + */
|
| + UnlinkedDocumentationComment get documentationComment;
|
| +
|
| + /**
|
| + * Values listed in the enum declaration, in declaration order.
|
| + */
|
| + List<UnlinkedEnumValue> get values;
|
| +}
|
|
|
| - UnlinkedEnumValue.fromJson(Map json)
|
| - : _name = json["name"],
|
| - _nameOffset = json["nameOffset"],
|
| - _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]);
|
| +class _UnlinkedEnumReader extends fb.TableReader<_UnlinkedEnumReader> implements UnlinkedEnum {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedEnumReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedEnumReader createReader(fb.BufferPointer bp) => new _UnlinkedEnumReader(bp);
|
|
|
| @override
|
| Map<String, Object> toMap() => {
|
| "name": name,
|
| "nameOffset": nameOffset,
|
| "documentationComment": documentationComment,
|
| + "values": values,
|
| };
|
|
|
| - /**
|
| - * Name of the enumerated value.
|
| - */
|
| - String get name => _name ?? '';
|
| + @override
|
| + String get name => const fb.StringReader().vTableGet(_bp, 0, '');
|
|
|
| - /**
|
| - * Offset of the enum value name relative to the beginning of the file.
|
| - */
|
| - int get nameOffset => _nameOffset ?? 0;
|
| + @override
|
| + int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
|
|
| - /**
|
| - * Documentation comment for the enum value, or `null` if there is no
|
| - * documentation comment.
|
| - */
|
| - UnlinkedDocumentationComment get documentationComment => _documentationComment;
|
| + @override
|
| + UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocumentationCommentReader().vTableGet(_bp, 2, null);
|
| +
|
| + @override
|
| + List<UnlinkedEnumValue> get values => const fb.ListReader<UnlinkedEnumValue>(const _UnlinkedEnumValueReader()).vTableGet(_bp, 3, const <UnlinkedEnumValue>[]);
|
| }
|
|
|
| class UnlinkedEnumValueBuilder {
|
| - final Map _json = {};
|
| -
|
| bool _finished = false;
|
|
|
| + String _name;
|
| + int _nameOffset;
|
| + UnlinkedDocumentationCommentBuilder _documentationComment;
|
| +
|
| UnlinkedEnumValueBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -1118,10 +1318,7 @@ class UnlinkedEnumValueBuilder {
|
| */
|
| void set name(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("name"));
|
| - if (_value != null) {
|
| - _json["name"] = _value;
|
| - }
|
| + _name = _value;
|
| }
|
|
|
| /**
|
| @@ -1129,10 +1326,7 @@ class UnlinkedEnumValueBuilder {
|
| */
|
| void set nameOffset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("nameOffset"));
|
| - if (_value != null) {
|
| - _json["nameOffset"] = _value;
|
| - }
|
| + _nameOffset = _value;
|
| }
|
|
|
| /**
|
| @@ -1141,16 +1335,31 @@ class UnlinkedEnumValueBuilder {
|
| */
|
| void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("documentationComment"));
|
| - if (_value != null) {
|
| - _json["documentationComment"] = _value.finish();
|
| - }
|
| + _documentationComment = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_name;
|
| + fb.Offset offset_documentationComment;
|
| + if (_name != null) {
|
| + offset_name = fbBuilder.writeString(_name);
|
| + }
|
| + if (_documentationComment != null) {
|
| + offset_documentationComment = _documentationComment.finish(fbBuilder);
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_name != null) {
|
| + fbBuilder.addOffset(0, offset_name);
|
| + }
|
| + if (_nameOffset != null && _nameOffset != 0) {
|
| + fbBuilder.addInt32(1, _nameOffset);
|
| + }
|
| + if (offset_documentationComment != null) {
|
| + fbBuilder.addOffset(2, offset_documentationComment);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -1163,144 +1372,70 @@ UnlinkedEnumValueBuilder encodeUnlinkedEnumValue(base.BuilderContext builderCont
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a function, method, getter, or setter
|
| + * Unlinked summary information about a single enumerated value in an enum
|
| * declaration.
|
| */
|
| -class UnlinkedExecutable extends base.SummaryClass {
|
| - String _name;
|
| - int _nameOffset;
|
| - UnlinkedDocumentationComment _documentationComment;
|
| - List<UnlinkedTypeParam> _typeParameters;
|
| - UnlinkedTypeRef _returnType;
|
| - List<UnlinkedParam> _parameters;
|
| - UnlinkedExecutableKind _kind;
|
| - bool _isAbstract;
|
| - bool _isStatic;
|
| - bool _isConst;
|
| - bool _isFactory;
|
| - bool _hasImplicitReturnType;
|
| - bool _isExternal;
|
| -
|
| - UnlinkedExecutable.fromJson(Map json)
|
| - : _name = json["name"],
|
| - _nameOffset = json["nameOffset"],
|
| - _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]),
|
| - _typeParameters = json["typeParameters"]?.map((x) => new UnlinkedTypeParam.fromJson(x))?.toList(),
|
| - _returnType = json["returnType"] == null ? null : new UnlinkedTypeRef.fromJson(json["returnType"]),
|
| - _parameters = json["parameters"]?.map((x) => new UnlinkedParam.fromJson(x))?.toList(),
|
| - _kind = json["kind"] == null ? null : UnlinkedExecutableKind.values[json["kind"]],
|
| - _isAbstract = json["isAbstract"],
|
| - _isStatic = json["isStatic"],
|
| - _isConst = json["isConst"],
|
| - _isFactory = json["isFactory"],
|
| - _hasImplicitReturnType = json["hasImplicitReturnType"],
|
| - _isExternal = json["isExternal"];
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "name": name,
|
| - "nameOffset": nameOffset,
|
| - "documentationComment": documentationComment,
|
| - "typeParameters": typeParameters,
|
| - "returnType": returnType,
|
| - "parameters": parameters,
|
| - "kind": kind,
|
| - "isAbstract": isAbstract,
|
| - "isStatic": isStatic,
|
| - "isConst": isConst,
|
| - "isFactory": isFactory,
|
| - "hasImplicitReturnType": hasImplicitReturnType,
|
| - "isExternal": isExternal,
|
| - };
|
| +abstract class UnlinkedEnumValue extends base.SummaryClass {
|
|
|
| /**
|
| - * Name of the executable. For setters, this includes the trailing "=". For
|
| - * named constructors, this excludes the class name and excludes the ".".
|
| - * For unnamed constructors, this is the empty string.
|
| + * Name of the enumerated value.
|
| */
|
| - String get name => _name ?? '';
|
| + String get name;
|
|
|
| /**
|
| - * Offset of the executable name relative to the beginning of the file. For
|
| - * named constructors, this excludes the class name and excludes the ".".
|
| - * For unnamed constructors, this is the offset of the class name (i.e. the
|
| - * offset of the second "C" in "class C { C(); }").
|
| + * Offset of the enum value name relative to the beginning of the file.
|
| */
|
| - int get nameOffset => _nameOffset ?? 0;
|
| + int get nameOffset;
|
|
|
| /**
|
| - * Documentation comment for the executable, or `null` if there is no
|
| + * Documentation comment for the enum value, or `null` if there is no
|
| * documentation comment.
|
| */
|
| - UnlinkedDocumentationComment get documentationComment => _documentationComment;
|
| -
|
| - /**
|
| - * Type parameters of the executable, if any. Empty if support for generic
|
| - * method syntax is disabled.
|
| - */
|
| - List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <UnlinkedTypeParam>[];
|
| -
|
| - /**
|
| - * Declared return type of the executable. Absent if the return type is
|
| - * `void` or the executable is a constructor. Note that when strong mode is
|
| - * enabled, the actual return type may be different due to type inference.
|
| - */
|
| - UnlinkedTypeRef get returnType => _returnType;
|
| -
|
| - /**
|
| - * Parameters of the executable, if any. Note that getters have no
|
| - * parameters (hence this will be the empty list), and setters have a single
|
| - * parameter.
|
| - */
|
| - List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[];
|
| + UnlinkedDocumentationComment get documentationComment;
|
| +}
|
|
|
| - /**
|
| - * The kind of the executable (function/method, getter, setter, or
|
| - * constructor).
|
| - */
|
| - UnlinkedExecutableKind get kind => _kind ?? UnlinkedExecutableKind.functionOrMethod;
|
| +class _UnlinkedEnumValueReader extends fb.TableReader<_UnlinkedEnumValueReader> implements UnlinkedEnumValue {
|
| + final fb.BufferPointer _bp;
|
|
|
| - /**
|
| - * Indicates whether the executable is declared using the `abstract` keyword.
|
| - */
|
| - bool get isAbstract => _isAbstract ?? false;
|
| + const _UnlinkedEnumValueReader([this._bp]);
|
|
|
| - /**
|
| - * Indicates whether the executable is declared using the `static` keyword.
|
| - *
|
| - * Note that for top level executables, this flag is false, since they are
|
| - * not declared using the `static` keyword (even though they are considered
|
| - * static for semantic purposes).
|
| - */
|
| - bool get isStatic => _isStatic ?? false;
|
| + @override
|
| + _UnlinkedEnumValueReader createReader(fb.BufferPointer bp) => new _UnlinkedEnumValueReader(bp);
|
|
|
| - /**
|
| - * Indicates whether the executable is declared using the `const` keyword.
|
| - */
|
| - bool get isConst => _isConst ?? false;
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "name": name,
|
| + "nameOffset": nameOffset,
|
| + "documentationComment": documentationComment,
|
| + };
|
|
|
| - /**
|
| - * Indicates whether the executable is declared using the `factory` keyword.
|
| - */
|
| - bool get isFactory => _isFactory ?? false;
|
| + @override
|
| + String get name => const fb.StringReader().vTableGet(_bp, 0, '');
|
|
|
| - /**
|
| - * Indicates whether the executable lacks an explicit return type
|
| - * declaration. False for constructors and setters.
|
| - */
|
| - bool get hasImplicitReturnType => _hasImplicitReturnType ?? false;
|
| + @override
|
| + int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
|
|
| - /**
|
| - * Indicates whether the executable is declared using the `external` keyword.
|
| - */
|
| - bool get isExternal => _isExternal ?? false;
|
| + @override
|
| + UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocumentationCommentReader().vTableGet(_bp, 2, null);
|
| }
|
|
|
| class UnlinkedExecutableBuilder {
|
| - final Map _json = {};
|
| -
|
| bool _finished = false;
|
|
|
| + String _name;
|
| + int _nameOffset;
|
| + UnlinkedDocumentationCommentBuilder _documentationComment;
|
| + List<UnlinkedTypeParamBuilder> _typeParameters;
|
| + UnlinkedTypeRefBuilder _returnType;
|
| + List<UnlinkedParamBuilder> _parameters;
|
| + UnlinkedExecutableKind _kind;
|
| + bool _isAbstract;
|
| + bool _isStatic;
|
| + bool _isConst;
|
| + bool _isFactory;
|
| + bool _hasImplicitReturnType;
|
| + bool _isExternal;
|
| +
|
| UnlinkedExecutableBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -1310,10 +1445,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set name(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("name"));
|
| - if (_value != null) {
|
| - _json["name"] = _value;
|
| - }
|
| + _name = _value;
|
| }
|
|
|
| /**
|
| @@ -1324,10 +1456,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set nameOffset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("nameOffset"));
|
| - if (_value != null) {
|
| - _json["nameOffset"] = _value;
|
| - }
|
| + _nameOffset = _value;
|
| }
|
|
|
| /**
|
| @@ -1336,10 +1465,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("documentationComment"));
|
| - if (_value != null) {
|
| - _json["documentationComment"] = _value.finish();
|
| - }
|
| + _documentationComment = _value;
|
| }
|
|
|
| /**
|
| @@ -1348,10 +1474,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set typeParameters(List<UnlinkedTypeParamBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("typeParameters"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["typeParameters"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _typeParameters = _value;
|
| }
|
|
|
| /**
|
| @@ -1361,10 +1484,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set returnType(UnlinkedTypeRefBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("returnType"));
|
| - if (_value != null) {
|
| - _json["returnType"] = _value.finish();
|
| - }
|
| + _returnType = _value;
|
| }
|
|
|
| /**
|
| @@ -1374,10 +1494,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set parameters(List<UnlinkedParamBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("parameters"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["parameters"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _parameters = _value;
|
| }
|
|
|
| /**
|
| @@ -1386,10 +1503,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set kind(UnlinkedExecutableKind _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("kind"));
|
| - if (!(_value == null || _value == UnlinkedExecutableKind.functionOrMethod)) {
|
| - _json["kind"] = _value.index;
|
| - }
|
| + _kind = _value;
|
| }
|
|
|
| /**
|
| @@ -1397,10 +1511,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set isAbstract(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isAbstract"));
|
| - if (_value != null) {
|
| - _json["isAbstract"] = _value;
|
| - }
|
| + _isAbstract = _value;
|
| }
|
|
|
| /**
|
| @@ -1412,10 +1523,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set isStatic(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isStatic"));
|
| - if (_value != null) {
|
| - _json["isStatic"] = _value;
|
| - }
|
| + _isStatic = _value;
|
| }
|
|
|
| /**
|
| @@ -1423,10 +1531,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set isConst(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isConst"));
|
| - if (_value != null) {
|
| - _json["isConst"] = _value;
|
| - }
|
| + _isConst = _value;
|
| }
|
|
|
| /**
|
| @@ -1434,10 +1539,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set isFactory(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isFactory"));
|
| - if (_value != null) {
|
| - _json["isFactory"] = _value;
|
| - }
|
| + _isFactory = _value;
|
| }
|
|
|
| /**
|
| @@ -1446,10 +1548,7 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set hasImplicitReturnType(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("hasImplicitReturnType"));
|
| - if (_value != null) {
|
| - _json["hasImplicitReturnType"] = _value;
|
| - }
|
| + _hasImplicitReturnType = _value;
|
| }
|
|
|
| /**
|
| @@ -1457,16 +1556,73 @@ class UnlinkedExecutableBuilder {
|
| */
|
| void set isExternal(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isExternal"));
|
| - if (_value != null) {
|
| - _json["isExternal"] = _value;
|
| - }
|
| + _isExternal = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_name;
|
| + fb.Offset offset_documentationComment;
|
| + fb.Offset offset_typeParameters;
|
| + fb.Offset offset_returnType;
|
| + fb.Offset offset_parameters;
|
| + if (_name != null) {
|
| + offset_name = fbBuilder.writeString(_name);
|
| + }
|
| + if (_documentationComment != null) {
|
| + offset_documentationComment = _documentationComment.finish(fbBuilder);
|
| + }
|
| + if (!(_typeParameters == null || _typeParameters.isEmpty)) {
|
| + offset_typeParameters = fbBuilder.writeList(_typeParameters.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (_returnType != null) {
|
| + offset_returnType = _returnType.finish(fbBuilder);
|
| + }
|
| + if (!(_parameters == null || _parameters.isEmpty)) {
|
| + offset_parameters = fbBuilder.writeList(_parameters.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_name != null) {
|
| + fbBuilder.addOffset(0, offset_name);
|
| + }
|
| + if (_nameOffset != null && _nameOffset != 0) {
|
| + fbBuilder.addInt32(1, _nameOffset);
|
| + }
|
| + if (offset_documentationComment != null) {
|
| + fbBuilder.addOffset(2, offset_documentationComment);
|
| + }
|
| + if (offset_typeParameters != null) {
|
| + fbBuilder.addOffset(3, offset_typeParameters);
|
| + }
|
| + if (offset_returnType != null) {
|
| + fbBuilder.addOffset(4, offset_returnType);
|
| + }
|
| + if (offset_parameters != null) {
|
| + fbBuilder.addOffset(5, offset_parameters);
|
| + }
|
| + if (_kind != null && _kind != UnlinkedExecutableKind.functionOrMethod) {
|
| + fbBuilder.addInt32(6, _kind.index);
|
| + }
|
| + if (_isAbstract == true) {
|
| + fbBuilder.addInt8(7, 1);
|
| + }
|
| + if (_isStatic == true) {
|
| + fbBuilder.addInt8(8, 1);
|
| + }
|
| + if (_isConst == true) {
|
| + fbBuilder.addInt8(9, 1);
|
| + }
|
| + if (_isFactory == true) {
|
| + fbBuilder.addInt8(10, 1);
|
| + }
|
| + if (_hasImplicitReturnType == true) {
|
| + fbBuilder.addInt8(11, 1);
|
| + }
|
| + if (_isExternal == true) {
|
| + fbBuilder.addInt8(12, 1);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -1489,49 +1645,169 @@ UnlinkedExecutableBuilder encodeUnlinkedExecutable(base.BuilderContext builderCo
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about an export declaration (stored outside
|
| - * [UnlinkedPublicNamespace]).
|
| + * Unlinked summary information about a function, method, getter, or setter
|
| + * declaration.
|
| */
|
| -class UnlinkedExportNonPublic extends base.SummaryClass {
|
| - int _offset;
|
| - int _uriOffset;
|
| - int _uriEnd;
|
| +abstract class UnlinkedExecutable extends base.SummaryClass {
|
| +
|
| + /**
|
| + * Name of the executable. For setters, this includes the trailing "=". For
|
| + * named constructors, this excludes the class name and excludes the ".".
|
| + * For unnamed constructors, this is the empty string.
|
| + */
|
| + String get name;
|
|
|
| - UnlinkedExportNonPublic.fromJson(Map json)
|
| - : _offset = json["offset"],
|
| - _uriOffset = json["uriOffset"],
|
| - _uriEnd = json["uriEnd"];
|
| + /**
|
| + * Offset of the executable name relative to the beginning of the file. For
|
| + * named constructors, this excludes the class name and excludes the ".".
|
| + * For unnamed constructors, this is the offset of the class name (i.e. the
|
| + * offset of the second "C" in "class C { C(); }").
|
| + */
|
| + int get nameOffset;
|
|
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "offset": offset,
|
| - "uriOffset": uriOffset,
|
| - "uriEnd": uriEnd,
|
| - };
|
| + /**
|
| + * Documentation comment for the executable, or `null` if there is no
|
| + * documentation comment.
|
| + */
|
| + UnlinkedDocumentationComment get documentationComment;
|
|
|
| /**
|
| - * Offset of the "export" keyword.
|
| + * Type parameters of the executable, if any. Empty if support for generic
|
| + * method syntax is disabled.
|
| */
|
| - int get offset => _offset ?? 0;
|
| + List<UnlinkedTypeParam> get typeParameters;
|
|
|
| /**
|
| - * Offset of the URI string (including quotes) relative to the beginning of
|
| - * the file.
|
| + * Declared return type of the executable. Absent if the return type is
|
| + * `void` or the executable is a constructor. Note that when strong mode is
|
| + * enabled, the actual return type may be different due to type inference.
|
| */
|
| - int get uriOffset => _uriOffset ?? 0;
|
| + UnlinkedTypeRef get returnType;
|
|
|
| /**
|
| - * End of the URI string (including quotes) relative to the beginning of the
|
| - * file.
|
| + * Parameters of the executable, if any. Note that getters have no
|
| + * parameters (hence this will be the empty list), and setters have a single
|
| + * parameter.
|
| + */
|
| + List<UnlinkedParam> get parameters;
|
| +
|
| + /**
|
| + * The kind of the executable (function/method, getter, setter, or
|
| + * constructor).
|
| + */
|
| + UnlinkedExecutableKind get kind;
|
| +
|
| + /**
|
| + * Indicates whether the executable is declared using the `abstract` keyword.
|
| + */
|
| + bool get isAbstract;
|
| +
|
| + /**
|
| + * Indicates whether the executable is declared using the `static` keyword.
|
| + *
|
| + * Note that for top level executables, this flag is false, since they are
|
| + * not declared using the `static` keyword (even though they are considered
|
| + * static for semantic purposes).
|
| + */
|
| + bool get isStatic;
|
| +
|
| + /**
|
| + * Indicates whether the executable is declared using the `const` keyword.
|
| + */
|
| + bool get isConst;
|
| +
|
| + /**
|
| + * Indicates whether the executable is declared using the `factory` keyword.
|
| + */
|
| + bool get isFactory;
|
| +
|
| + /**
|
| + * Indicates whether the executable lacks an explicit return type
|
| + * declaration. False for constructors and setters.
|
| */
|
| - int get uriEnd => _uriEnd ?? 0;
|
| + bool get hasImplicitReturnType;
|
| +
|
| + /**
|
| + * Indicates whether the executable is declared using the `external` keyword.
|
| + */
|
| + bool get isExternal;
|
| }
|
|
|
| -class UnlinkedExportNonPublicBuilder {
|
| - final Map _json = {};
|
| +class _UnlinkedExecutableReader extends fb.TableReader<_UnlinkedExecutableReader> implements UnlinkedExecutable {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedExecutableReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedExecutableReader createReader(fb.BufferPointer bp) => new _UnlinkedExecutableReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "name": name,
|
| + "nameOffset": nameOffset,
|
| + "documentationComment": documentationComment,
|
| + "typeParameters": typeParameters,
|
| + "returnType": returnType,
|
| + "parameters": parameters,
|
| + "kind": kind,
|
| + "isAbstract": isAbstract,
|
| + "isStatic": isStatic,
|
| + "isConst": isConst,
|
| + "isFactory": isFactory,
|
| + "hasImplicitReturnType": hasImplicitReturnType,
|
| + "isExternal": isExternal,
|
| + };
|
| +
|
| + @override
|
| + String get name => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| +
|
| + @override
|
| + UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocumentationCommentReader().vTableGet(_bp, 2, null);
|
| +
|
| + @override
|
| + List<UnlinkedTypeParam> get typeParameters => const fb.ListReader<UnlinkedTypeParam>(const _UnlinkedTypeParamReader()).vTableGet(_bp, 3, const <UnlinkedTypeParam>[]);
|
| +
|
| + @override
|
| + UnlinkedTypeRef get returnType => const _UnlinkedTypeRefReader().vTableGet(_bp, 4, null);
|
| +
|
| + @override
|
| + List<UnlinkedParam> get parameters => const fb.ListReader<UnlinkedParam>(const _UnlinkedParamReader()).vTableGet(_bp, 5, const <UnlinkedParam>[]);
|
| +
|
| + @override
|
| + UnlinkedExecutableKind get kind {
|
| + int index = const fb.Int32Reader().vTableGet(_bp, 6, 0);
|
| + return UnlinkedExecutableKind.values[index];
|
| + }
|
| +
|
| + @override
|
| + bool get isAbstract => const fb.Int8Reader().vTableGet(_bp, 7, 0) == 1;
|
| +
|
| + @override
|
| + bool get isStatic => const fb.Int8Reader().vTableGet(_bp, 8, 0) == 1;
|
| +
|
| + @override
|
| + bool get isConst => const fb.Int8Reader().vTableGet(_bp, 9, 0) == 1;
|
| +
|
| + @override
|
| + bool get isFactory => const fb.Int8Reader().vTableGet(_bp, 10, 0) == 1;
|
|
|
| + @override
|
| + bool get hasImplicitReturnType => const fb.Int8Reader().vTableGet(_bp, 11, 0) == 1;
|
| +
|
| + @override
|
| + bool get isExternal => const fb.Int8Reader().vTableGet(_bp, 12, 0) == 1;
|
| +}
|
| +
|
| +class UnlinkedExportNonPublicBuilder {
|
| bool _finished = false;
|
|
|
| + int _offset;
|
| + int _uriOffset;
|
| + int _uriEnd;
|
| +
|
| UnlinkedExportNonPublicBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -1539,10 +1815,7 @@ class UnlinkedExportNonPublicBuilder {
|
| */
|
| void set offset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("offset"));
|
| - if (_value != null) {
|
| - _json["offset"] = _value;
|
| - }
|
| + _offset = _value;
|
| }
|
|
|
| /**
|
| @@ -1551,10 +1824,7 @@ class UnlinkedExportNonPublicBuilder {
|
| */
|
| void set uriOffset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("uriOffset"));
|
| - if (_value != null) {
|
| - _json["uriOffset"] = _value;
|
| - }
|
| + _uriOffset = _value;
|
| }
|
|
|
| /**
|
| @@ -1563,16 +1833,23 @@ class UnlinkedExportNonPublicBuilder {
|
| */
|
| void set uriEnd(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("uriEnd"));
|
| - if (_value != null) {
|
| - _json["uriEnd"] = _value;
|
| - }
|
| + _uriEnd = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fbBuilder.startTable();
|
| + if (_offset != null && _offset != 0) {
|
| + fbBuilder.addInt32(0, _offset);
|
| + }
|
| + if (_uriOffset != null && _uriOffset != 0) {
|
| + fbBuilder.addInt32(1, _uriOffset);
|
| + }
|
| + if (_uriEnd != null && _uriEnd != 0) {
|
| + fbBuilder.addInt32(2, _uriEnd);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -1585,39 +1862,60 @@ UnlinkedExportNonPublicBuilder encodeUnlinkedExportNonPublic(base.BuilderContext
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about an export declaration (stored inside
|
| + * Unlinked summary information about an export declaration (stored outside
|
| * [UnlinkedPublicNamespace]).
|
| */
|
| -class UnlinkedExportPublic extends base.SummaryClass {
|
| - String _uri;
|
| - List<UnlinkedCombinator> _combinators;
|
| -
|
| - UnlinkedExportPublic.fromJson(Map json)
|
| - : _uri = json["uri"],
|
| - _combinators = json["combinators"]?.map((x) => new UnlinkedCombinator.fromJson(x))?.toList();
|
| +abstract class UnlinkedExportNonPublic extends base.SummaryClass {
|
|
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "uri": uri,
|
| - "combinators": combinators,
|
| - };
|
| + /**
|
| + * Offset of the "export" keyword.
|
| + */
|
| + int get offset;
|
|
|
| /**
|
| - * URI used in the source code to reference the exported library.
|
| + * Offset of the URI string (including quotes) relative to the beginning of
|
| + * the file.
|
| */
|
| - String get uri => _uri ?? '';
|
| + int get uriOffset;
|
|
|
| /**
|
| - * Combinators contained in this import declaration.
|
| + * End of the URI string (including quotes) relative to the beginning of the
|
| + * file.
|
| */
|
| - List<UnlinkedCombinator> get combinators => _combinators ?? const <UnlinkedCombinator>[];
|
| + int get uriEnd;
|
| }
|
|
|
| -class UnlinkedExportPublicBuilder {
|
| - final Map _json = {};
|
| +class _UnlinkedExportNonPublicReader extends fb.TableReader<_UnlinkedExportNonPublicReader> implements UnlinkedExportNonPublic {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedExportNonPublicReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedExportNonPublicReader createReader(fb.BufferPointer bp) => new _UnlinkedExportNonPublicReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "offset": offset,
|
| + "uriOffset": uriOffset,
|
| + "uriEnd": uriEnd,
|
| + };
|
| +
|
| + @override
|
| + int get offset => const fb.Int32Reader().vTableGet(_bp, 0, 0);
|
| +
|
| + @override
|
| + int get uriOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| +
|
| + @override
|
| + int get uriEnd => const fb.Int32Reader().vTableGet(_bp, 2, 0);
|
| +}
|
|
|
| +class UnlinkedExportPublicBuilder {
|
| bool _finished = false;
|
|
|
| + String _uri;
|
| + List<UnlinkedCombinatorBuilder> _combinators;
|
| +
|
| UnlinkedExportPublicBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -1625,10 +1923,7 @@ class UnlinkedExportPublicBuilder {
|
| */
|
| void set uri(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("uri"));
|
| - if (_value != null) {
|
| - _json["uri"] = _value;
|
| - }
|
| + _uri = _value;
|
| }
|
|
|
| /**
|
| @@ -1636,16 +1931,28 @@ class UnlinkedExportPublicBuilder {
|
| */
|
| void set combinators(List<UnlinkedCombinatorBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("combinators"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["combinators"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _combinators = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_uri;
|
| + fb.Offset offset_combinators;
|
| + if (_uri != null) {
|
| + offset_uri = fbBuilder.writeString(_uri);
|
| + }
|
| + if (!(_combinators == null || _combinators.isEmpty)) {
|
| + offset_combinators = fbBuilder.writeList(_combinators.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_uri != null) {
|
| + fbBuilder.addOffset(0, offset_uri);
|
| + }
|
| + if (offset_combinators != null) {
|
| + fbBuilder.addOffset(1, offset_combinators);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -1657,125 +1964,74 @@ UnlinkedExportPublicBuilder encodeUnlinkedExportPublic(base.BuilderContext build
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about an import declaration.
|
| + * Unlinked summary information about an export declaration (stored inside
|
| + * [UnlinkedPublicNamespace]).
|
| */
|
| -class UnlinkedImport extends base.SummaryClass {
|
| +abstract class UnlinkedExportPublic extends base.SummaryClass {
|
| +
|
| + /**
|
| + * URI used in the source code to reference the exported library.
|
| + */
|
| + String get uri;
|
| +
|
| + /**
|
| + * Combinators contained in this import declaration.
|
| + */
|
| + List<UnlinkedCombinator> get combinators;
|
| +}
|
| +
|
| +class _UnlinkedExportPublicReader extends fb.TableReader<_UnlinkedExportPublicReader> implements UnlinkedExportPublic {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedExportPublicReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedExportPublicReader createReader(fb.BufferPointer bp) => new _UnlinkedExportPublicReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "uri": uri,
|
| + "combinators": combinators,
|
| + };
|
| +
|
| + @override
|
| + String get uri => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + List<UnlinkedCombinator> get combinators => const fb.ListReader<UnlinkedCombinator>(const _UnlinkedCombinatorReader()).vTableGet(_bp, 1, const <UnlinkedCombinator>[]);
|
| +}
|
| +
|
| +class UnlinkedImportBuilder {
|
| + bool _finished = false;
|
| +
|
| String _uri;
|
| int _offset;
|
| int _prefixReference;
|
| - List<UnlinkedCombinator> _combinators;
|
| + List<UnlinkedCombinatorBuilder> _combinators;
|
| bool _isDeferred;
|
| bool _isImplicit;
|
| int _uriOffset;
|
| int _uriEnd;
|
| int _prefixOffset;
|
|
|
| - UnlinkedImport.fromJson(Map json)
|
| - : _uri = json["uri"],
|
| - _offset = json["offset"],
|
| - _prefixReference = json["prefixReference"],
|
| - _combinators = json["combinators"]?.map((x) => new UnlinkedCombinator.fromJson(x))?.toList(),
|
| - _isDeferred = json["isDeferred"],
|
| - _isImplicit = json["isImplicit"],
|
| - _uriOffset = json["uriOffset"],
|
| - _uriEnd = json["uriEnd"],
|
| - _prefixOffset = json["prefixOffset"];
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "uri": uri,
|
| - "offset": offset,
|
| - "prefixReference": prefixReference,
|
| - "combinators": combinators,
|
| - "isDeferred": isDeferred,
|
| - "isImplicit": isImplicit,
|
| - "uriOffset": uriOffset,
|
| - "uriEnd": uriEnd,
|
| - "prefixOffset": prefixOffset,
|
| - };
|
| + UnlinkedImportBuilder(base.BuilderContext context);
|
|
|
| /**
|
| * URI used in the source code to reference the imported library.
|
| */
|
| - String get uri => _uri ?? '';
|
| + void set uri(String _value) {
|
| + assert(!_finished);
|
| + _uri = _value;
|
| + }
|
|
|
| /**
|
| * If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
|
| * is true, zero.
|
| */
|
| - int get offset => _offset ?? 0;
|
| -
|
| - /**
|
| - * Index into [UnlinkedUnit.references] of the prefix declared by this
|
| - * import declaration, or zero if this import declaration declares no prefix.
|
| - *
|
| - * Note that multiple imports can declare the same prefix.
|
| - */
|
| - int get prefixReference => _prefixReference ?? 0;
|
| -
|
| - /**
|
| - * Combinators contained in this import declaration.
|
| - */
|
| - List<UnlinkedCombinator> get combinators => _combinators ?? const <UnlinkedCombinator>[];
|
| -
|
| - /**
|
| - * Indicates whether the import declaration uses the `deferred` keyword.
|
| - */
|
| - bool get isDeferred => _isDeferred ?? false;
|
| -
|
| - /**
|
| - * Indicates whether the import declaration is implicit.
|
| - */
|
| - bool get isImplicit => _isImplicit ?? false;
|
| -
|
| - /**
|
| - * Offset of the URI string (including quotes) relative to the beginning of
|
| - * the file. If [isImplicit] is true, zero.
|
| - */
|
| - int get uriOffset => _uriOffset ?? 0;
|
| -
|
| - /**
|
| - * End of the URI string (including quotes) relative to the beginning of the
|
| - * file. If [isImplicit] is true, zero.
|
| - */
|
| - int get uriEnd => _uriEnd ?? 0;
|
| -
|
| - /**
|
| - * Offset of the prefix name relative to the beginning of the file, or zero
|
| - * if there is no prefix.
|
| - */
|
| - int get prefixOffset => _prefixOffset ?? 0;
|
| -}
|
| -
|
| -class UnlinkedImportBuilder {
|
| - final Map _json = {};
|
| -
|
| - bool _finished = false;
|
| -
|
| - UnlinkedImportBuilder(base.BuilderContext context);
|
| -
|
| - /**
|
| - * URI used in the source code to reference the imported library.
|
| - */
|
| - void set uri(String _value) {
|
| - assert(!_finished);
|
| - assert(!_json.containsKey("uri"));
|
| - if (_value != null) {
|
| - _json["uri"] = _value;
|
| - }
|
| - }
|
| -
|
| - /**
|
| - * If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
|
| - * is true, zero.
|
| - */
|
| - void set offset(int _value) {
|
| - assert(!_finished);
|
| - assert(!_json.containsKey("offset"));
|
| - if (_value != null) {
|
| - _json["offset"] = _value;
|
| - }
|
| - }
|
| + void set offset(int _value) {
|
| + assert(!_finished);
|
| + _offset = _value;
|
| + }
|
|
|
| /**
|
| * Index into [UnlinkedUnit.references] of the prefix declared by this
|
| @@ -1785,10 +2041,7 @@ class UnlinkedImportBuilder {
|
| */
|
| void set prefixReference(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("prefixReference"));
|
| - if (_value != null) {
|
| - _json["prefixReference"] = _value;
|
| - }
|
| + _prefixReference = _value;
|
| }
|
|
|
| /**
|
| @@ -1796,10 +2049,7 @@ class UnlinkedImportBuilder {
|
| */
|
| void set combinators(List<UnlinkedCombinatorBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("combinators"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["combinators"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _combinators = _value;
|
| }
|
|
|
| /**
|
| @@ -1807,10 +2057,7 @@ class UnlinkedImportBuilder {
|
| */
|
| void set isDeferred(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isDeferred"));
|
| - if (_value != null) {
|
| - _json["isDeferred"] = _value;
|
| - }
|
| + _isDeferred = _value;
|
| }
|
|
|
| /**
|
| @@ -1818,10 +2065,7 @@ class UnlinkedImportBuilder {
|
| */
|
| void set isImplicit(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isImplicit"));
|
| - if (_value != null) {
|
| - _json["isImplicit"] = _value;
|
| - }
|
| + _isImplicit = _value;
|
| }
|
|
|
| /**
|
| @@ -1830,10 +2074,7 @@ class UnlinkedImportBuilder {
|
| */
|
| void set uriOffset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("uriOffset"));
|
| - if (_value != null) {
|
| - _json["uriOffset"] = _value;
|
| - }
|
| + _uriOffset = _value;
|
| }
|
|
|
| /**
|
| @@ -1842,10 +2083,7 @@ class UnlinkedImportBuilder {
|
| */
|
| void set uriEnd(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("uriEnd"));
|
| - if (_value != null) {
|
| - _json["uriEnd"] = _value;
|
| - }
|
| + _uriEnd = _value;
|
| }
|
|
|
| /**
|
| @@ -1854,16 +2092,49 @@ class UnlinkedImportBuilder {
|
| */
|
| void set prefixOffset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("prefixOffset"));
|
| - if (_value != null) {
|
| - _json["prefixOffset"] = _value;
|
| - }
|
| + _prefixOffset = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_uri;
|
| + fb.Offset offset_combinators;
|
| + if (_uri != null) {
|
| + offset_uri = fbBuilder.writeString(_uri);
|
| + }
|
| + if (!(_combinators == null || _combinators.isEmpty)) {
|
| + offset_combinators = fbBuilder.writeList(_combinators.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_uri != null) {
|
| + fbBuilder.addOffset(0, offset_uri);
|
| + }
|
| + if (_offset != null && _offset != 0) {
|
| + fbBuilder.addInt32(1, _offset);
|
| + }
|
| + if (_prefixReference != null && _prefixReference != 0) {
|
| + fbBuilder.addInt32(2, _prefixReference);
|
| + }
|
| + if (offset_combinators != null) {
|
| + fbBuilder.addOffset(3, offset_combinators);
|
| + }
|
| + if (_isDeferred == true) {
|
| + fbBuilder.addInt8(4, 1);
|
| + }
|
| + if (_isImplicit == true) {
|
| + fbBuilder.addInt8(5, 1);
|
| + }
|
| + if (_uriOffset != null && _uriOffset != 0) {
|
| + fbBuilder.addInt32(6, _uriOffset);
|
| + }
|
| + if (_uriEnd != null && _uriEnd != 0) {
|
| + fbBuilder.addInt32(7, _uriEnd);
|
| + }
|
| + if (_prefixOffset != null && _prefixOffset != 0) {
|
| + fbBuilder.addInt32(8, _prefixOffset);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -1882,92 +2153,124 @@ UnlinkedImportBuilder encodeUnlinkedImport(base.BuilderContext builderContext, {
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a function parameter.
|
| + * Unlinked summary information about an import declaration.
|
| */
|
| -class UnlinkedParam extends base.SummaryClass {
|
| - String _name;
|
| - int _nameOffset;
|
| - UnlinkedTypeRef _type;
|
| - List<UnlinkedParam> _parameters;
|
| - UnlinkedParamKind _kind;
|
| - bool _isFunctionTyped;
|
| - bool _isInitializingFormal;
|
| - bool _hasImplicitType;
|
| +abstract class UnlinkedImport extends base.SummaryClass {
|
|
|
| - UnlinkedParam.fromJson(Map json)
|
| - : _name = json["name"],
|
| - _nameOffset = json["nameOffset"],
|
| - _type = json["type"] == null ? null : new UnlinkedTypeRef.fromJson(json["type"]),
|
| - _parameters = json["parameters"]?.map((x) => new UnlinkedParam.fromJson(x))?.toList(),
|
| - _kind = json["kind"] == null ? null : UnlinkedParamKind.values[json["kind"]],
|
| - _isFunctionTyped = json["isFunctionTyped"],
|
| - _isInitializingFormal = json["isInitializingFormal"],
|
| - _hasImplicitType = json["hasImplicitType"];
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "name": name,
|
| - "nameOffset": nameOffset,
|
| - "type": type,
|
| - "parameters": parameters,
|
| - "kind": kind,
|
| - "isFunctionTyped": isFunctionTyped,
|
| - "isInitializingFormal": isInitializingFormal,
|
| - "hasImplicitType": hasImplicitType,
|
| - };
|
| + /**
|
| + * URI used in the source code to reference the imported library.
|
| + */
|
| + String get uri;
|
|
|
| /**
|
| - * Name of the parameter.
|
| + * If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
|
| + * is true, zero.
|
| */
|
| - String get name => _name ?? '';
|
| + int get offset;
|
|
|
| /**
|
| - * Offset of the parameter name relative to the beginning of the file.
|
| + * Index into [UnlinkedUnit.references] of the prefix declared by this
|
| + * import declaration, or zero if this import declaration declares no prefix.
|
| + *
|
| + * Note that multiple imports can declare the same prefix.
|
| */
|
| - int get nameOffset => _nameOffset ?? 0;
|
| + int get prefixReference;
|
|
|
| /**
|
| - * If [isFunctionTyped] is `true`, the declared return type. If
|
| - * [isFunctionTyped] is `false`, the declared type. Absent if
|
| - * [isFunctionTyped] is `true` and the declared return type is `void`. Note
|
| - * that when strong mode is enabled, the actual type may be different due to
|
| - * type inference.
|
| + * Combinators contained in this import declaration.
|
| */
|
| - UnlinkedTypeRef get type => _type;
|
| + List<UnlinkedCombinator> get combinators;
|
|
|
| /**
|
| - * If [isFunctionTyped] is `true`, the parameters of the function type.
|
| + * Indicates whether the import declaration uses the `deferred` keyword.
|
| */
|
| - List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[];
|
| + bool get isDeferred;
|
|
|
| /**
|
| - * Kind of the parameter.
|
| + * Indicates whether the import declaration is implicit.
|
| */
|
| - UnlinkedParamKind get kind => _kind ?? UnlinkedParamKind.required;
|
| + bool get isImplicit;
|
|
|
| /**
|
| - * Indicates whether this is a function-typed parameter.
|
| + * Offset of the URI string (including quotes) relative to the beginning of
|
| + * the file. If [isImplicit] is true, zero.
|
| */
|
| - bool get isFunctionTyped => _isFunctionTyped ?? false;
|
| + int get uriOffset;
|
|
|
| /**
|
| - * Indicates whether this is an initializing formal parameter (i.e. it is
|
| - * declared using `this.` syntax).
|
| + * End of the URI string (including quotes) relative to the beginning of the
|
| + * file. If [isImplicit] is true, zero.
|
| */
|
| - bool get isInitializingFormal => _isInitializingFormal ?? false;
|
| + int get uriEnd;
|
|
|
| /**
|
| - * Indicates whether this parameter lacks an explicit type declaration.
|
| - * Always false for a function-typed parameter.
|
| + * Offset of the prefix name relative to the beginning of the file, or zero
|
| + * if there is no prefix.
|
| */
|
| - bool get hasImplicitType => _hasImplicitType ?? false;
|
| + int get prefixOffset;
|
| }
|
|
|
| -class UnlinkedParamBuilder {
|
| - final Map _json = {};
|
| +class _UnlinkedImportReader extends fb.TableReader<_UnlinkedImportReader> implements UnlinkedImport {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedImportReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedImportReader createReader(fb.BufferPointer bp) => new _UnlinkedImportReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "uri": uri,
|
| + "offset": offset,
|
| + "prefixReference": prefixReference,
|
| + "combinators": combinators,
|
| + "isDeferred": isDeferred,
|
| + "isImplicit": isImplicit,
|
| + "uriOffset": uriOffset,
|
| + "uriEnd": uriEnd,
|
| + "prefixOffset": prefixOffset,
|
| + };
|
| +
|
| + @override
|
| + String get uri => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + int get offset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| +
|
| + @override
|
| + int get prefixReference => const fb.Int32Reader().vTableGet(_bp, 2, 0);
|
| +
|
| + @override
|
| + List<UnlinkedCombinator> get combinators => const fb.ListReader<UnlinkedCombinator>(const _UnlinkedCombinatorReader()).vTableGet(_bp, 3, const <UnlinkedCombinator>[]);
|
| +
|
| + @override
|
| + bool get isDeferred => const fb.Int8Reader().vTableGet(_bp, 4, 0) == 1;
|
| +
|
| + @override
|
| + bool get isImplicit => const fb.Int8Reader().vTableGet(_bp, 5, 0) == 1;
|
| +
|
| + @override
|
| + int get uriOffset => const fb.Int32Reader().vTableGet(_bp, 6, 0);
|
| +
|
| + @override
|
| + int get uriEnd => const fb.Int32Reader().vTableGet(_bp, 7, 0);
|
| +
|
| + @override
|
| + int get prefixOffset => const fb.Int32Reader().vTableGet(_bp, 8, 0);
|
| +}
|
|
|
| +class UnlinkedParamBuilder {
|
| bool _finished = false;
|
|
|
| + String _name;
|
| + int _nameOffset;
|
| + UnlinkedTypeRefBuilder _type;
|
| + List<UnlinkedParamBuilder> _parameters;
|
| + UnlinkedParamKind _kind;
|
| + bool _isFunctionTyped;
|
| + bool _isInitializingFormal;
|
| + bool _hasImplicitType;
|
| +
|
| UnlinkedParamBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -1975,10 +2278,7 @@ class UnlinkedParamBuilder {
|
| */
|
| void set name(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("name"));
|
| - if (_value != null) {
|
| - _json["name"] = _value;
|
| - }
|
| + _name = _value;
|
| }
|
|
|
| /**
|
| @@ -1986,10 +2286,7 @@ class UnlinkedParamBuilder {
|
| */
|
| void set nameOffset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("nameOffset"));
|
| - if (_value != null) {
|
| - _json["nameOffset"] = _value;
|
| - }
|
| + _nameOffset = _value;
|
| }
|
|
|
| /**
|
| @@ -2001,10 +2298,7 @@ class UnlinkedParamBuilder {
|
| */
|
| void set type(UnlinkedTypeRefBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("type"));
|
| - if (_value != null) {
|
| - _json["type"] = _value.finish();
|
| - }
|
| + _type = _value;
|
| }
|
|
|
| /**
|
| @@ -2012,10 +2306,7 @@ class UnlinkedParamBuilder {
|
| */
|
| void set parameters(List<UnlinkedParamBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("parameters"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["parameters"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _parameters = _value;
|
| }
|
|
|
| /**
|
| @@ -2023,10 +2314,7 @@ class UnlinkedParamBuilder {
|
| */
|
| void set kind(UnlinkedParamKind _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("kind"));
|
| - if (!(_value == null || _value == UnlinkedParamKind.required)) {
|
| - _json["kind"] = _value.index;
|
| - }
|
| + _kind = _value;
|
| }
|
|
|
| /**
|
| @@ -2034,10 +2322,7 @@ class UnlinkedParamBuilder {
|
| */
|
| void set isFunctionTyped(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isFunctionTyped"));
|
| - if (_value != null) {
|
| - _json["isFunctionTyped"] = _value;
|
| - }
|
| + _isFunctionTyped = _value;
|
| }
|
|
|
| /**
|
| @@ -2046,10 +2331,7 @@ class UnlinkedParamBuilder {
|
| */
|
| void set isInitializingFormal(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isInitializingFormal"));
|
| - if (_value != null) {
|
| - _json["isInitializingFormal"] = _value;
|
| - }
|
| + _isInitializingFormal = _value;
|
| }
|
|
|
| /**
|
| @@ -2058,16 +2340,50 @@ class UnlinkedParamBuilder {
|
| */
|
| void set hasImplicitType(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("hasImplicitType"));
|
| - if (_value != null) {
|
| - _json["hasImplicitType"] = _value;
|
| - }
|
| + _hasImplicitType = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_name;
|
| + fb.Offset offset_type;
|
| + fb.Offset offset_parameters;
|
| + if (_name != null) {
|
| + offset_name = fbBuilder.writeString(_name);
|
| + }
|
| + if (_type != null) {
|
| + offset_type = _type.finish(fbBuilder);
|
| + }
|
| + if (!(_parameters == null || _parameters.isEmpty)) {
|
| + offset_parameters = fbBuilder.writeList(_parameters.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_name != null) {
|
| + fbBuilder.addOffset(0, offset_name);
|
| + }
|
| + if (_nameOffset != null && _nameOffset != 0) {
|
| + fbBuilder.addInt32(1, _nameOffset);
|
| + }
|
| + if (offset_type != null) {
|
| + fbBuilder.addOffset(2, offset_type);
|
| + }
|
| + if (offset_parameters != null) {
|
| + fbBuilder.addOffset(3, offset_parameters);
|
| + }
|
| + if (_kind != null && _kind != UnlinkedParamKind.required) {
|
| + fbBuilder.addInt32(4, _kind.index);
|
| + }
|
| + if (_isFunctionTyped == true) {
|
| + fbBuilder.addInt8(5, 1);
|
| + }
|
| + if (_isInitializingFormal == true) {
|
| + fbBuilder.addInt8(6, 1);
|
| + }
|
| + if (_hasImplicitType == true) {
|
| + fbBuilder.addInt8(7, 1);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -2085,133 +2401,198 @@ UnlinkedParamBuilder encodeUnlinkedParam(base.BuilderContext builderContext, {St
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a part declaration.
|
| + * Unlinked summary information about a function parameter.
|
| */
|
| -class UnlinkedPart extends base.SummaryClass {
|
| - int _uriOffset;
|
| - int _uriEnd;
|
| -
|
| - UnlinkedPart.fromJson(Map json)
|
| - : _uriOffset = json["uriOffset"],
|
| - _uriEnd = json["uriEnd"];
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "uriOffset": uriOffset,
|
| - "uriEnd": uriEnd,
|
| - };
|
| +abstract class UnlinkedParam extends base.SummaryClass {
|
|
|
| /**
|
| - * Offset of the URI string (including quotes) relative to the beginning of
|
| - * the file.
|
| + * Name of the parameter.
|
| */
|
| - int get uriOffset => _uriOffset ?? 0;
|
| + String get name;
|
|
|
| /**
|
| - * End of the URI string (including quotes) relative to the beginning of the
|
| - * file.
|
| + * Offset of the parameter name relative to the beginning of the file.
|
| */
|
| - int get uriEnd => _uriEnd ?? 0;
|
| -}
|
| + int get nameOffset;
|
|
|
| -class UnlinkedPartBuilder {
|
| - final Map _json = {};
|
| + /**
|
| + * If [isFunctionTyped] is `true`, the declared return type. If
|
| + * [isFunctionTyped] is `false`, the declared type. Absent if
|
| + * [isFunctionTyped] is `true` and the declared return type is `void`. Note
|
| + * that when strong mode is enabled, the actual type may be different due to
|
| + * type inference.
|
| + */
|
| + UnlinkedTypeRef get type;
|
|
|
| - bool _finished = false;
|
| + /**
|
| + * If [isFunctionTyped] is `true`, the parameters of the function type.
|
| + */
|
| + List<UnlinkedParam> get parameters;
|
|
|
| - UnlinkedPartBuilder(base.BuilderContext context);
|
| + /**
|
| + * Kind of the parameter.
|
| + */
|
| + UnlinkedParamKind get kind;
|
|
|
| /**
|
| - * Offset of the URI string (including quotes) relative to the beginning of
|
| - * the file.
|
| + * Indicates whether this is a function-typed parameter.
|
| */
|
| - void set uriOffset(int _value) {
|
| - assert(!_finished);
|
| - assert(!_json.containsKey("uriOffset"));
|
| - if (_value != null) {
|
| - _json["uriOffset"] = _value;
|
| - }
|
| - }
|
| + bool get isFunctionTyped;
|
|
|
| /**
|
| - * End of the URI string (including quotes) relative to the beginning of the
|
| - * file.
|
| + * Indicates whether this is an initializing formal parameter (i.e. it is
|
| + * declared using `this.` syntax).
|
| */
|
| - void set uriEnd(int _value) {
|
| - assert(!_finished);
|
| - assert(!_json.containsKey("uriEnd"));
|
| - if (_value != null) {
|
| - _json["uriEnd"] = _value;
|
| - }
|
| - }
|
| + bool get isInitializingFormal;
|
|
|
| - Map finish() {
|
| - assert(!_finished);
|
| - _finished = true;
|
| - return _json;
|
| - }
|
| + /**
|
| + * Indicates whether this parameter lacks an explicit type declaration.
|
| + * Always false for a function-typed parameter.
|
| + */
|
| + bool get hasImplicitType;
|
| }
|
|
|
| -UnlinkedPartBuilder encodeUnlinkedPart(base.BuilderContext builderContext, {int uriOffset, int uriEnd}) {
|
| - UnlinkedPartBuilder builder = new UnlinkedPartBuilder(builderContext);
|
| - builder.uriOffset = uriOffset;
|
| - builder.uriEnd = uriEnd;
|
| - return builder;
|
| -}
|
| +class _UnlinkedParamReader extends fb.TableReader<_UnlinkedParamReader> implements UnlinkedParam {
|
| + final fb.BufferPointer _bp;
|
|
|
| -/**
|
| - * Unlinked summary information about a specific name contributed by a
|
| - * compilation unit to a library's public namespace.
|
| - *
|
| - * TODO(paulberry): add a count of generic parameters, so that resynthesis
|
| - * doesn't have to peek into the library to obtain this info.
|
| - *
|
| - * TODO(paulberry): for classes, add info about static members and
|
| - * constructors, since this will be needed to prelink info about constants.
|
| - *
|
| - * TODO(paulberry): some of this information is redundant with information
|
| - * elsewhere in the summary. Consider reducing the redundancy to reduce
|
| - * summary size.
|
| - */
|
| -class UnlinkedPublicName extends base.SummaryClass {
|
| - String _name;
|
| - PrelinkedReferenceKind _kind;
|
| - int _numTypeParameters;
|
| + const _UnlinkedParamReader([this._bp]);
|
|
|
| - UnlinkedPublicName.fromJson(Map json)
|
| - : _name = json["name"],
|
| - _kind = json["kind"] == null ? null : PrelinkedReferenceKind.values[json["kind"]],
|
| - _numTypeParameters = json["numTypeParameters"];
|
| + @override
|
| + _UnlinkedParamReader createReader(fb.BufferPointer bp) => new _UnlinkedParamReader(bp);
|
|
|
| @override
|
| Map<String, Object> toMap() => {
|
| "name": name,
|
| + "nameOffset": nameOffset,
|
| + "type": type,
|
| + "parameters": parameters,
|
| "kind": kind,
|
| - "numTypeParameters": numTypeParameters,
|
| + "isFunctionTyped": isFunctionTyped,
|
| + "isInitializingFormal": isInitializingFormal,
|
| + "hasImplicitType": hasImplicitType,
|
| };
|
|
|
| + @override
|
| + String get name => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| +
|
| + @override
|
| + UnlinkedTypeRef get type => const _UnlinkedTypeRefReader().vTableGet(_bp, 2, null);
|
| +
|
| + @override
|
| + List<UnlinkedParam> get parameters => const fb.ListReader<UnlinkedParam>(const _UnlinkedParamReader()).vTableGet(_bp, 3, const <UnlinkedParam>[]);
|
| +
|
| + @override
|
| + UnlinkedParamKind get kind {
|
| + int index = const fb.Int32Reader().vTableGet(_bp, 4, 0);
|
| + return UnlinkedParamKind.values[index];
|
| + }
|
| +
|
| + @override
|
| + bool get isFunctionTyped => const fb.Int8Reader().vTableGet(_bp, 5, 0) == 1;
|
| +
|
| + @override
|
| + bool get isInitializingFormal => const fb.Int8Reader().vTableGet(_bp, 6, 0) == 1;
|
| +
|
| + @override
|
| + bool get hasImplicitType => const fb.Int8Reader().vTableGet(_bp, 7, 0) == 1;
|
| +}
|
| +
|
| +class UnlinkedPartBuilder {
|
| + bool _finished = false;
|
| +
|
| + int _uriOffset;
|
| + int _uriEnd;
|
| +
|
| + UnlinkedPartBuilder(base.BuilderContext context);
|
| +
|
| /**
|
| - * The name itself.
|
| + * Offset of the URI string (including quotes) relative to the beginning of
|
| + * the file.
|
| */
|
| - String get name => _name ?? '';
|
| + void set uriOffset(int _value) {
|
| + assert(!_finished);
|
| + _uriOffset = _value;
|
| + }
|
|
|
| /**
|
| - * The kind of object referred to by the name.
|
| + * End of the URI string (including quotes) relative to the beginning of the
|
| + * file.
|
| + */
|
| + void set uriEnd(int _value) {
|
| + assert(!_finished);
|
| + _uriEnd = _value;
|
| + }
|
| +
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| + assert(!_finished);
|
| + _finished = true;
|
| + fbBuilder.startTable();
|
| + if (_uriOffset != null && _uriOffset != 0) {
|
| + fbBuilder.addInt32(0, _uriOffset);
|
| + }
|
| + if (_uriEnd != null && _uriEnd != 0) {
|
| + fbBuilder.addInt32(1, _uriEnd);
|
| + }
|
| + return fbBuilder.endTable();
|
| + }
|
| +}
|
| +
|
| +UnlinkedPartBuilder encodeUnlinkedPart(base.BuilderContext builderContext, {int uriOffset, int uriEnd}) {
|
| + UnlinkedPartBuilder builder = new UnlinkedPartBuilder(builderContext);
|
| + builder.uriOffset = uriOffset;
|
| + builder.uriEnd = uriEnd;
|
| + return builder;
|
| +}
|
| +
|
| +/**
|
| + * Unlinked summary information about a part declaration.
|
| + */
|
| +abstract class UnlinkedPart extends base.SummaryClass {
|
| +
|
| + /**
|
| + * Offset of the URI string (including quotes) relative to the beginning of
|
| + * the file.
|
| */
|
| - PrelinkedReferenceKind get kind => _kind ?? PrelinkedReferenceKind.classOrEnum;
|
| + int get uriOffset;
|
|
|
| /**
|
| - * If the entity being referred to is generic, the number of type parameters
|
| - * it accepts. Otherwise zero.
|
| + * End of the URI string (including quotes) relative to the beginning of the
|
| + * file.
|
| */
|
| - int get numTypeParameters => _numTypeParameters ?? 0;
|
| + int get uriEnd;
|
| }
|
|
|
| -class UnlinkedPublicNameBuilder {
|
| - final Map _json = {};
|
| +class _UnlinkedPartReader extends fb.TableReader<_UnlinkedPartReader> implements UnlinkedPart {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedPartReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedPartReader createReader(fb.BufferPointer bp) => new _UnlinkedPartReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "uriOffset": uriOffset,
|
| + "uriEnd": uriEnd,
|
| + };
|
| +
|
| + @override
|
| + int get uriOffset => const fb.Int32Reader().vTableGet(_bp, 0, 0);
|
| +
|
| + @override
|
| + int get uriEnd => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| +}
|
|
|
| +class UnlinkedPublicNameBuilder {
|
| bool _finished = false;
|
|
|
| + String _name;
|
| + PrelinkedReferenceKind _kind;
|
| + int _numTypeParameters;
|
| +
|
| UnlinkedPublicNameBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -2219,10 +2600,7 @@ class UnlinkedPublicNameBuilder {
|
| */
|
| void set name(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("name"));
|
| - if (_value != null) {
|
| - _json["name"] = _value;
|
| - }
|
| + _name = _value;
|
| }
|
|
|
| /**
|
| @@ -2230,10 +2608,7 @@ class UnlinkedPublicNameBuilder {
|
| */
|
| void set kind(PrelinkedReferenceKind _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("kind"));
|
| - if (!(_value == null || _value == PrelinkedReferenceKind.classOrEnum)) {
|
| - _json["kind"] = _value.index;
|
| - }
|
| + _kind = _value;
|
| }
|
|
|
| /**
|
| @@ -2242,16 +2617,27 @@ class UnlinkedPublicNameBuilder {
|
| */
|
| void set numTypeParameters(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("numTypeParameters"));
|
| - if (_value != null) {
|
| - _json["numTypeParameters"] = _value;
|
| - }
|
| + _numTypeParameters = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_name;
|
| + if (_name != null) {
|
| + offset_name = fbBuilder.writeString(_name);
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_name != null) {
|
| + fbBuilder.addOffset(0, offset_name);
|
| + }
|
| + if (_kind != null && _kind != PrelinkedReferenceKind.classOrEnum) {
|
| + fbBuilder.addInt32(1, _kind.index);
|
| + }
|
| + if (_numTypeParameters != null && _numTypeParameters != 0) {
|
| + fbBuilder.addInt32(2, _numTypeParameters);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -2264,53 +2650,73 @@ UnlinkedPublicNameBuilder encodeUnlinkedPublicName(base.BuilderContext builderCo
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about what a compilation unit contributes to a
|
| - * library's public namespace. This is the subset of [UnlinkedUnit] that is
|
| - * required from dependent libraries in order to perform prelinking.
|
| + * Unlinked summary information about a specific name contributed by a
|
| + * compilation unit to a library's public namespace.
|
| + *
|
| + * TODO(paulberry): add a count of generic parameters, so that resynthesis
|
| + * doesn't have to peek into the library to obtain this info.
|
| + *
|
| + * TODO(paulberry): for classes, add info about static members and
|
| + * constructors, since this will be needed to prelink info about constants.
|
| + *
|
| + * TODO(paulberry): some of this information is redundant with information
|
| + * elsewhere in the summary. Consider reducing the redundancy to reduce
|
| + * summary size.
|
| */
|
| -class UnlinkedPublicNamespace extends base.SummaryClass {
|
| - List<UnlinkedPublicName> _names;
|
| - List<UnlinkedExportPublic> _exports;
|
| - List<String> _parts;
|
| -
|
| - UnlinkedPublicNamespace.fromJson(Map json)
|
| - : _names = json["names"]?.map((x) => new UnlinkedPublicName.fromJson(x))?.toList(),
|
| - _exports = json["exports"]?.map((x) => new UnlinkedExportPublic.fromJson(x))?.toList(),
|
| - _parts = json["parts"];
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "names": names,
|
| - "exports": exports,
|
| - "parts": parts,
|
| - };
|
| -
|
| - UnlinkedPublicNamespace.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8.decode(buffer)));
|
| +abstract class UnlinkedPublicName extends base.SummaryClass {
|
|
|
| /**
|
| - * Public names defined in the compilation unit.
|
| - *
|
| - * TODO(paulberry): consider sorting these names to reduce unnecessary
|
| - * relinking.
|
| + * The name itself.
|
| */
|
| - List<UnlinkedPublicName> get names => _names ?? const <UnlinkedPublicName>[];
|
| + String get name;
|
|
|
| /**
|
| - * Export declarations in the compilation unit.
|
| + * The kind of object referred to by the name.
|
| */
|
| - List<UnlinkedExportPublic> get exports => _exports ?? const <UnlinkedExportPublic>[];
|
| + PrelinkedReferenceKind get kind;
|
|
|
| /**
|
| - * URIs referenced by part declarations in the compilation unit.
|
| + * If the entity being referred to is generic, the number of type parameters
|
| + * it accepts. Otherwise zero.
|
| */
|
| - List<String> get parts => _parts ?? const <String>[];
|
| + int get numTypeParameters;
|
| }
|
|
|
| -class UnlinkedPublicNamespaceBuilder {
|
| - final Map _json = {};
|
| +class _UnlinkedPublicNameReader extends fb.TableReader<_UnlinkedPublicNameReader> implements UnlinkedPublicName {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedPublicNameReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedPublicNameReader createReader(fb.BufferPointer bp) => new _UnlinkedPublicNameReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "name": name,
|
| + "kind": kind,
|
| + "numTypeParameters": numTypeParameters,
|
| + };
|
|
|
| + @override
|
| + String get name => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + PrelinkedReferenceKind get kind {
|
| + int index = const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| + return PrelinkedReferenceKind.values[index];
|
| + }
|
| +
|
| + @override
|
| + int get numTypeParameters => const fb.Int32Reader().vTableGet(_bp, 2, 0);
|
| +}
|
| +
|
| +class UnlinkedPublicNamespaceBuilder {
|
| bool _finished = false;
|
|
|
| + List<UnlinkedPublicNameBuilder> _names;
|
| + List<UnlinkedExportPublicBuilder> _exports;
|
| + List<String> _parts;
|
| +
|
| UnlinkedPublicNamespaceBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -2321,10 +2727,7 @@ class UnlinkedPublicNamespaceBuilder {
|
| */
|
| void set names(List<UnlinkedPublicNameBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("names"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["names"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _names = _value;
|
| }
|
|
|
| /**
|
| @@ -2332,10 +2735,7 @@ class UnlinkedPublicNamespaceBuilder {
|
| */
|
| void set exports(List<UnlinkedExportPublicBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("exports"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["exports"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _exports = _value;
|
| }
|
|
|
| /**
|
| @@ -2343,18 +2743,40 @@ class UnlinkedPublicNamespaceBuilder {
|
| */
|
| void set parts(List<String> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("parts"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["parts"] = _value.toList();
|
| - }
|
| + _parts = _value;
|
| }
|
|
|
| - List<int> toBuffer() => UTF8.encode(JSON.encode(finish()));
|
| + List<int> toBuffer() {
|
| + fb.Builder fbBuilder = new fb.Builder();
|
| + return fbBuilder.finish(finish(fbBuilder));
|
| + }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_names;
|
| + fb.Offset offset_exports;
|
| + fb.Offset offset_parts;
|
| + if (!(_names == null || _names.isEmpty)) {
|
| + offset_names = fbBuilder.writeList(_names.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_exports == null || _exports.isEmpty)) {
|
| + offset_exports = fbBuilder.writeList(_exports.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_parts == null || _parts.isEmpty)) {
|
| + offset_parts = fbBuilder.writeList(_parts.map((b) => fbBuilder.writeString(b)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_names != null) {
|
| + fbBuilder.addOffset(0, offset_names);
|
| + }
|
| + if (offset_exports != null) {
|
| + fbBuilder.addOffset(1, offset_exports);
|
| + }
|
| + if (offset_parts != null) {
|
| + fbBuilder.addOffset(2, offset_parts);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -2367,41 +2789,66 @@ UnlinkedPublicNamespaceBuilder encodeUnlinkedPublicNamespace(base.BuilderContext
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a name referred to in one library that
|
| - * might be defined in another.
|
| + * Unlinked summary information about what a compilation unit contributes to a
|
| + * library's public namespace. This is the subset of [UnlinkedUnit] that is
|
| + * required from dependent libraries in order to perform prelinking.
|
| */
|
| -class UnlinkedReference extends base.SummaryClass {
|
| - String _name;
|
| - int _prefixReference;
|
| -
|
| - UnlinkedReference.fromJson(Map json)
|
| - : _name = json["name"],
|
| - _prefixReference = json["prefixReference"];
|
| +abstract class UnlinkedPublicNamespace extends base.SummaryClass {
|
| + factory UnlinkedPublicNamespace.fromBuffer(List<int> buffer) {
|
| + fb.BufferPointer rootRef = new fb.BufferPointer.fromBytes(buffer);
|
| + return const _UnlinkedPublicNamespaceReader().read(rootRef);
|
| + }
|
|
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "name": name,
|
| - "prefixReference": prefixReference,
|
| - };
|
| + /**
|
| + * Public names defined in the compilation unit.
|
| + *
|
| + * TODO(paulberry): consider sorting these names to reduce unnecessary
|
| + * relinking.
|
| + */
|
| + List<UnlinkedPublicName> get names;
|
|
|
| /**
|
| - * Name of the entity being referred to. The empty string refers to the
|
| - * pseudo-type `dynamic`.
|
| + * Export declarations in the compilation unit.
|
| */
|
| - String get name => _name ?? '';
|
| + List<UnlinkedExportPublic> get exports;
|
|
|
| /**
|
| - * Prefix used to refer to the entity, or zero if no prefix is used. This is
|
| - * an index into [UnlinkedUnit.references].
|
| + * URIs referenced by part declarations in the compilation unit.
|
| */
|
| - int get prefixReference => _prefixReference ?? 0;
|
| + List<String> get parts;
|
| }
|
|
|
| -class UnlinkedReferenceBuilder {
|
| - final Map _json = {};
|
| +class _UnlinkedPublicNamespaceReader extends fb.TableReader<_UnlinkedPublicNamespaceReader> implements UnlinkedPublicNamespace {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedPublicNamespaceReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedPublicNamespaceReader createReader(fb.BufferPointer bp) => new _UnlinkedPublicNamespaceReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "names": names,
|
| + "exports": exports,
|
| + "parts": parts,
|
| + };
|
| +
|
| + @override
|
| + List<UnlinkedPublicName> get names => const fb.ListReader<UnlinkedPublicName>(const _UnlinkedPublicNameReader()).vTableGet(_bp, 0, const <UnlinkedPublicName>[]);
|
| +
|
| + @override
|
| + List<UnlinkedExportPublic> get exports => const fb.ListReader<UnlinkedExportPublic>(const _UnlinkedExportPublicReader()).vTableGet(_bp, 1, const <UnlinkedExportPublic>[]);
|
| +
|
| + @override
|
| + List<String> get parts => const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bp, 2, const <String>[]);
|
| +}
|
|
|
| +class UnlinkedReferenceBuilder {
|
| bool _finished = false;
|
|
|
| + String _name;
|
| + int _prefixReference;
|
| +
|
| UnlinkedReferenceBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -2410,10 +2857,7 @@ class UnlinkedReferenceBuilder {
|
| */
|
| void set name(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("name"));
|
| - if (_value != null) {
|
| - _json["name"] = _value;
|
| - }
|
| + _name = _value;
|
| }
|
|
|
| /**
|
| @@ -2422,16 +2866,24 @@ class UnlinkedReferenceBuilder {
|
| */
|
| void set prefixReference(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("prefixReference"));
|
| - if (_value != null) {
|
| - _json["prefixReference"] = _value;
|
| - }
|
| + _prefixReference = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_name;
|
| + if (_name != null) {
|
| + offset_name = fbBuilder.writeString(_name);
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_name != null) {
|
| + fbBuilder.addOffset(0, offset_name);
|
| + }
|
| + if (_prefixReference != null && _prefixReference != 0) {
|
| + fbBuilder.addInt32(1, _prefixReference);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -2443,71 +2895,55 @@ UnlinkedReferenceBuilder encodeUnlinkedReference(base.BuilderContext builderCont
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a typedef declaration.
|
| + * Unlinked summary information about a name referred to in one library that
|
| + * might be defined in another.
|
| */
|
| -class UnlinkedTypedef extends base.SummaryClass {
|
| - String _name;
|
| - int _nameOffset;
|
| - UnlinkedDocumentationComment _documentationComment;
|
| - List<UnlinkedTypeParam> _typeParameters;
|
| - UnlinkedTypeRef _returnType;
|
| - List<UnlinkedParam> _parameters;
|
| -
|
| - UnlinkedTypedef.fromJson(Map json)
|
| - : _name = json["name"],
|
| - _nameOffset = json["nameOffset"],
|
| - _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]),
|
| - _typeParameters = json["typeParameters"]?.map((x) => new UnlinkedTypeParam.fromJson(x))?.toList(),
|
| - _returnType = json["returnType"] == null ? null : new UnlinkedTypeRef.fromJson(json["returnType"]),
|
| - _parameters = json["parameters"]?.map((x) => new UnlinkedParam.fromJson(x))?.toList();
|
| -
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "name": name,
|
| - "nameOffset": nameOffset,
|
| - "documentationComment": documentationComment,
|
| - "typeParameters": typeParameters,
|
| - "returnType": returnType,
|
| - "parameters": parameters,
|
| - };
|
| +abstract class UnlinkedReference extends base.SummaryClass {
|
|
|
| /**
|
| - * Name of the typedef.
|
| + * Name of the entity being referred to. The empty string refers to the
|
| + * pseudo-type `dynamic`.
|
| */
|
| - String get name => _name ?? '';
|
| + String get name;
|
|
|
| /**
|
| - * Offset of the typedef name relative to the beginning of the file.
|
| + * Prefix used to refer to the entity, or zero if no prefix is used. This is
|
| + * an index into [UnlinkedUnit.references].
|
| */
|
| - int get nameOffset => _nameOffset ?? 0;
|
| + int get prefixReference;
|
| +}
|
|
|
| - /**
|
| - * Documentation comment for the typedef, or `null` if there is no
|
| - * documentation comment.
|
| - */
|
| - UnlinkedDocumentationComment get documentationComment => _documentationComment;
|
| +class _UnlinkedReferenceReader extends fb.TableReader<_UnlinkedReferenceReader> implements UnlinkedReference {
|
| + final fb.BufferPointer _bp;
|
|
|
| - /**
|
| - * Type parameters of the typedef, if any.
|
| - */
|
| - List<UnlinkedTypeParam> get typeParameters => _typeParameters ?? const <UnlinkedTypeParam>[];
|
| + const _UnlinkedReferenceReader([this._bp]);
|
|
|
| - /**
|
| - * Return type of the typedef. Absent if the return type is `void`.
|
| - */
|
| - UnlinkedTypeRef get returnType => _returnType;
|
| + @override
|
| + _UnlinkedReferenceReader createReader(fb.BufferPointer bp) => new _UnlinkedReferenceReader(bp);
|
|
|
| - /**
|
| - * Parameters of the executable, if any.
|
| - */
|
| - List<UnlinkedParam> get parameters => _parameters ?? const <UnlinkedParam>[];
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "name": name,
|
| + "prefixReference": prefixReference,
|
| + };
|
| +
|
| + @override
|
| + String get name => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + int get prefixReference => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| }
|
|
|
| class UnlinkedTypedefBuilder {
|
| - final Map _json = {};
|
| -
|
| bool _finished = false;
|
|
|
| + String _name;
|
| + int _nameOffset;
|
| + UnlinkedDocumentationCommentBuilder _documentationComment;
|
| + List<UnlinkedTypeParamBuilder> _typeParameters;
|
| + UnlinkedTypeRefBuilder _returnType;
|
| + List<UnlinkedParamBuilder> _parameters;
|
| +
|
| UnlinkedTypedefBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -2515,10 +2951,7 @@ class UnlinkedTypedefBuilder {
|
| */
|
| void set name(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("name"));
|
| - if (_value != null) {
|
| - _json["name"] = _value;
|
| - }
|
| + _name = _value;
|
| }
|
|
|
| /**
|
| @@ -2526,10 +2959,7 @@ class UnlinkedTypedefBuilder {
|
| */
|
| void set nameOffset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("nameOffset"));
|
| - if (_value != null) {
|
| - _json["nameOffset"] = _value;
|
| - }
|
| + _nameOffset = _value;
|
| }
|
|
|
| /**
|
| @@ -2538,10 +2968,7 @@ class UnlinkedTypedefBuilder {
|
| */
|
| void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("documentationComment"));
|
| - if (_value != null) {
|
| - _json["documentationComment"] = _value.finish();
|
| - }
|
| + _documentationComment = _value;
|
| }
|
|
|
| /**
|
| @@ -2549,10 +2976,7 @@ class UnlinkedTypedefBuilder {
|
| */
|
| void set typeParameters(List<UnlinkedTypeParamBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("typeParameters"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["typeParameters"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _typeParameters = _value;
|
| }
|
|
|
| /**
|
| @@ -2560,10 +2984,7 @@ class UnlinkedTypedefBuilder {
|
| */
|
| void set returnType(UnlinkedTypeRefBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("returnType"));
|
| - if (_value != null) {
|
| - _json["returnType"] = _value.finish();
|
| - }
|
| + _returnType = _value;
|
| }
|
|
|
| /**
|
| @@ -2571,16 +2992,52 @@ class UnlinkedTypedefBuilder {
|
| */
|
| void set parameters(List<UnlinkedParamBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("parameters"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["parameters"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _parameters = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_name;
|
| + fb.Offset offset_documentationComment;
|
| + fb.Offset offset_typeParameters;
|
| + fb.Offset offset_returnType;
|
| + fb.Offset offset_parameters;
|
| + if (_name != null) {
|
| + offset_name = fbBuilder.writeString(_name);
|
| + }
|
| + if (_documentationComment != null) {
|
| + offset_documentationComment = _documentationComment.finish(fbBuilder);
|
| + }
|
| + if (!(_typeParameters == null || _typeParameters.isEmpty)) {
|
| + offset_typeParameters = fbBuilder.writeList(_typeParameters.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (_returnType != null) {
|
| + offset_returnType = _returnType.finish(fbBuilder);
|
| + }
|
| + if (!(_parameters == null || _parameters.isEmpty)) {
|
| + offset_parameters = fbBuilder.writeList(_parameters.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_name != null) {
|
| + fbBuilder.addOffset(0, offset_name);
|
| + }
|
| + if (_nameOffset != null && _nameOffset != 0) {
|
| + fbBuilder.addInt32(1, _nameOffset);
|
| + }
|
| + if (offset_documentationComment != null) {
|
| + fbBuilder.addOffset(2, offset_documentationComment);
|
| + }
|
| + if (offset_typeParameters != null) {
|
| + fbBuilder.addOffset(3, offset_typeParameters);
|
| + }
|
| + if (offset_returnType != null) {
|
| + fbBuilder.addOffset(4, offset_returnType);
|
| + }
|
| + if (offset_parameters != null) {
|
| + fbBuilder.addOffset(5, offset_parameters);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -2596,47 +3053,86 @@ UnlinkedTypedefBuilder encodeUnlinkedTypedef(base.BuilderContext builderContext,
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a type parameter declaration.
|
| + * Unlinked summary information about a typedef declaration.
|
| */
|
| -class UnlinkedTypeParam extends base.SummaryClass {
|
| - String _name;
|
| - int _nameOffset;
|
| - UnlinkedTypeRef _bound;
|
| +abstract class UnlinkedTypedef extends base.SummaryClass {
|
|
|
| - UnlinkedTypeParam.fromJson(Map json)
|
| - : _name = json["name"],
|
| - _nameOffset = json["nameOffset"],
|
| - _bound = json["bound"] == null ? null : new UnlinkedTypeRef.fromJson(json["bound"]);
|
| + /**
|
| + * Name of the typedef.
|
| + */
|
| + String get name;
|
|
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "name": name,
|
| - "nameOffset": nameOffset,
|
| - "bound": bound,
|
| - };
|
| + /**
|
| + * Offset of the typedef name relative to the beginning of the file.
|
| + */
|
| + int get nameOffset;
|
|
|
| /**
|
| - * Name of the type parameter.
|
| + * Documentation comment for the typedef, or `null` if there is no
|
| + * documentation comment.
|
| */
|
| - String get name => _name ?? '';
|
| + UnlinkedDocumentationComment get documentationComment;
|
|
|
| /**
|
| - * Offset of the type parameter name relative to the beginning of the file.
|
| + * Type parameters of the typedef, if any.
|
| */
|
| - int get nameOffset => _nameOffset ?? 0;
|
| + List<UnlinkedTypeParam> get typeParameters;
|
|
|
| /**
|
| - * Bound of the type parameter, if a bound is explicitly declared. Otherwise
|
| - * null.
|
| + * Return type of the typedef. Absent if the return type is `void`.
|
| + */
|
| + UnlinkedTypeRef get returnType;
|
| +
|
| + /**
|
| + * Parameters of the executable, if any.
|
| */
|
| - UnlinkedTypeRef get bound => _bound;
|
| + List<UnlinkedParam> get parameters;
|
| }
|
|
|
| -class UnlinkedTypeParamBuilder {
|
| - final Map _json = {};
|
| +class _UnlinkedTypedefReader extends fb.TableReader<_UnlinkedTypedefReader> implements UnlinkedTypedef {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedTypedefReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedTypedefReader createReader(fb.BufferPointer bp) => new _UnlinkedTypedefReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "name": name,
|
| + "nameOffset": nameOffset,
|
| + "documentationComment": documentationComment,
|
| + "typeParameters": typeParameters,
|
| + "returnType": returnType,
|
| + "parameters": parameters,
|
| + };
|
| +
|
| + @override
|
| + String get name => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| +
|
| + @override
|
| + UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocumentationCommentReader().vTableGet(_bp, 2, null);
|
| +
|
| + @override
|
| + List<UnlinkedTypeParam> get typeParameters => const fb.ListReader<UnlinkedTypeParam>(const _UnlinkedTypeParamReader()).vTableGet(_bp, 3, const <UnlinkedTypeParam>[]);
|
| +
|
| + @override
|
| + UnlinkedTypeRef get returnType => const _UnlinkedTypeRefReader().vTableGet(_bp, 4, null);
|
| +
|
| + @override
|
| + List<UnlinkedParam> get parameters => const fb.ListReader<UnlinkedParam>(const _UnlinkedParamReader()).vTableGet(_bp, 5, const <UnlinkedParam>[]);
|
| +}
|
|
|
| +class UnlinkedTypeParamBuilder {
|
| bool _finished = false;
|
|
|
| + String _name;
|
| + int _nameOffset;
|
| + UnlinkedTypeRefBuilder _bound;
|
| +
|
| UnlinkedTypeParamBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -2644,10 +3140,7 @@ class UnlinkedTypeParamBuilder {
|
| */
|
| void set name(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("name"));
|
| - if (_value != null) {
|
| - _json["name"] = _value;
|
| - }
|
| + _name = _value;
|
| }
|
|
|
| /**
|
| @@ -2655,10 +3148,7 @@ class UnlinkedTypeParamBuilder {
|
| */
|
| void set nameOffset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("nameOffset"));
|
| - if (_value != null) {
|
| - _json["nameOffset"] = _value;
|
| - }
|
| + _nameOffset = _value;
|
| }
|
|
|
| /**
|
| @@ -2667,16 +3157,31 @@ class UnlinkedTypeParamBuilder {
|
| */
|
| void set bound(UnlinkedTypeRefBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("bound"));
|
| - if (_value != null) {
|
| - _json["bound"] = _value.finish();
|
| - }
|
| + _bound = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_name;
|
| + fb.Offset offset_bound;
|
| + if (_name != null) {
|
| + offset_name = fbBuilder.writeString(_name);
|
| + }
|
| + if (_bound != null) {
|
| + offset_bound = _bound.finish(fbBuilder);
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_name != null) {
|
| + fbBuilder.addOffset(0, offset_name);
|
| + }
|
| + if (_nameOffset != null && _nameOffset != 0) {
|
| + fbBuilder.addInt32(1, _nameOffset);
|
| + }
|
| + if (offset_bound != null) {
|
| + fbBuilder.addOffset(2, offset_bound);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -2689,25 +3194,61 @@ UnlinkedTypeParamBuilder encodeUnlinkedTypeParam(base.BuilderContext builderCont
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a reference to a type.
|
| + * Unlinked summary information about a type parameter declaration.
|
| */
|
| -class UnlinkedTypeRef extends base.SummaryClass {
|
| - int _reference;
|
| - int _paramReference;
|
| - List<UnlinkedTypeRef> _typeArguments;
|
| +abstract class UnlinkedTypeParam extends base.SummaryClass {
|
| +
|
| + /**
|
| + * Name of the type parameter.
|
| + */
|
| + String get name;
|
| +
|
| + /**
|
| + * Offset of the type parameter name relative to the beginning of the file.
|
| + */
|
| + int get nameOffset;
|
| +
|
| + /**
|
| + * Bound of the type parameter, if a bound is explicitly declared. Otherwise
|
| + * null.
|
| + */
|
| + UnlinkedTypeRef get bound;
|
| +}
|
| +
|
| +class _UnlinkedTypeParamReader extends fb.TableReader<_UnlinkedTypeParamReader> implements UnlinkedTypeParam {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedTypeParamReader([this._bp]);
|
|
|
| - UnlinkedTypeRef.fromJson(Map json)
|
| - : _reference = json["reference"],
|
| - _paramReference = json["paramReference"],
|
| - _typeArguments = json["typeArguments"]?.map((x) => new UnlinkedTypeRef.fromJson(x))?.toList();
|
| + @override
|
| + _UnlinkedTypeParamReader createReader(fb.BufferPointer bp) => new _UnlinkedTypeParamReader(bp);
|
|
|
| @override
|
| Map<String, Object> toMap() => {
|
| - "reference": reference,
|
| - "paramReference": paramReference,
|
| - "typeArguments": typeArguments,
|
| + "name": name,
|
| + "nameOffset": nameOffset,
|
| + "bound": bound,
|
| };
|
|
|
| + @override
|
| + String get name => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| +
|
| + @override
|
| + UnlinkedTypeRef get bound => const _UnlinkedTypeRefReader().vTableGet(_bp, 2, null);
|
| +}
|
| +
|
| +class UnlinkedTypeRefBuilder {
|
| + bool _finished = false;
|
| +
|
| + int _reference;
|
| + int _paramReference;
|
| + List<UnlinkedTypeRefBuilder> _typeArguments;
|
| +
|
| + UnlinkedTypeRefBuilder(base.BuilderContext context);
|
| +
|
| /**
|
| * Index into [UnlinkedUnit.references] for the type being referred to, or
|
| * zero if this is a reference to a type parameter.
|
| @@ -2718,7 +3259,10 @@ class UnlinkedTypeRef extends base.SummaryClass {
|
| * zero. To distinguish between references to type parameters and references
|
| * to types, check whether [paramReference] is zero.
|
| */
|
| - int get reference => _reference ?? 0;
|
| + void set reference(int _value) {
|
| + assert(!_finished);
|
| + _reference = _value;
|
| + }
|
|
|
| /**
|
| * If this is a reference to a type parameter, one-based index into the list
|
| @@ -2739,21 +3283,53 @@ class UnlinkedTypeRef extends base.SummaryClass {
|
| * If the type being referred to is not a type parameter, [paramReference] is
|
| * zero.
|
| */
|
| - int get paramReference => _paramReference ?? 0;
|
| + void set paramReference(int _value) {
|
| + assert(!_finished);
|
| + _paramReference = _value;
|
| + }
|
|
|
| /**
|
| * If this is an instantiation of a generic type, the type arguments used to
|
| * instantiate it. Trailing type arguments of type `dynamic` are omitted.
|
| */
|
| - List<UnlinkedTypeRef> get typeArguments => _typeArguments ?? const <UnlinkedTypeRef>[];
|
| -}
|
| + void set typeArguments(List<UnlinkedTypeRefBuilder> _value) {
|
| + assert(!_finished);
|
| + _typeArguments = _value;
|
| + }
|
|
|
| -class UnlinkedTypeRefBuilder {
|
| - final Map _json = {};
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| + assert(!_finished);
|
| + _finished = true;
|
| + fb.Offset offset_typeArguments;
|
| + if (!(_typeArguments == null || _typeArguments.isEmpty)) {
|
| + offset_typeArguments = fbBuilder.writeList(_typeArguments.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (_reference != null && _reference != 0) {
|
| + fbBuilder.addInt32(0, _reference);
|
| + }
|
| + if (_paramReference != null && _paramReference != 0) {
|
| + fbBuilder.addInt32(1, _paramReference);
|
| + }
|
| + if (offset_typeArguments != null) {
|
| + fbBuilder.addOffset(2, offset_typeArguments);
|
| + }
|
| + return fbBuilder.endTable();
|
| + }
|
| +}
|
|
|
| - bool _finished = false;
|
| +UnlinkedTypeRefBuilder encodeUnlinkedTypeRef(base.BuilderContext builderContext, {int reference, int paramReference, List<UnlinkedTypeRefBuilder> typeArguments}) {
|
| + UnlinkedTypeRefBuilder builder = new UnlinkedTypeRefBuilder(builderContext);
|
| + builder.reference = reference;
|
| + builder.paramReference = paramReference;
|
| + builder.typeArguments = typeArguments;
|
| + return builder;
|
| +}
|
|
|
| - UnlinkedTypeRefBuilder(base.BuilderContext context);
|
| +/**
|
| + * Unlinked summary information about a reference to a type.
|
| + */
|
| +abstract class UnlinkedTypeRef extends base.SummaryClass {
|
|
|
| /**
|
| * Index into [UnlinkedUnit.references] for the type being referred to, or
|
| @@ -2765,13 +3341,7 @@ class UnlinkedTypeRefBuilder {
|
| * zero. To distinguish between references to type parameters and references
|
| * to types, check whether [paramReference] is zero.
|
| */
|
| - void set reference(int _value) {
|
| - assert(!_finished);
|
| - assert(!_json.containsKey("reference"));
|
| - if (_value != null) {
|
| - _json["reference"] = _value;
|
| - }
|
| - }
|
| + int get reference;
|
|
|
| /**
|
| * If this is a reference to a type parameter, one-based index into the list
|
| @@ -2792,202 +3362,76 @@ class UnlinkedTypeRefBuilder {
|
| * If the type being referred to is not a type parameter, [paramReference] is
|
| * zero.
|
| */
|
| - void set paramReference(int _value) {
|
| - assert(!_finished);
|
| - assert(!_json.containsKey("paramReference"));
|
| - if (_value != null) {
|
| - _json["paramReference"] = _value;
|
| - }
|
| - }
|
| + int get paramReference;
|
|
|
| /**
|
| * If this is an instantiation of a generic type, the type arguments used to
|
| * instantiate it. Trailing type arguments of type `dynamic` are omitted.
|
| */
|
| - void set typeArguments(List<UnlinkedTypeRefBuilder> _value) {
|
| - assert(!_finished);
|
| - assert(!_json.containsKey("typeArguments"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["typeArguments"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| - }
|
| -
|
| - Map finish() {
|
| - assert(!_finished);
|
| - _finished = true;
|
| - return _json;
|
| - }
|
| + List<UnlinkedTypeRef> get typeArguments;
|
| }
|
|
|
| -UnlinkedTypeRefBuilder encodeUnlinkedTypeRef(base.BuilderContext builderContext, {int reference, int paramReference, List<UnlinkedTypeRefBuilder> typeArguments}) {
|
| - UnlinkedTypeRefBuilder builder = new UnlinkedTypeRefBuilder(builderContext);
|
| - builder.reference = reference;
|
| - builder.paramReference = paramReference;
|
| - builder.typeArguments = typeArguments;
|
| - return builder;
|
| -}
|
| +class _UnlinkedTypeRefReader extends fb.TableReader<_UnlinkedTypeRefReader> implements UnlinkedTypeRef {
|
| + final fb.BufferPointer _bp;
|
|
|
| -/**
|
| - * Unlinked summary information about a compilation unit ("part file").
|
| - */
|
| -class UnlinkedUnit extends base.SummaryClass {
|
| - String _libraryName;
|
| - int _libraryNameOffset;
|
| - int _libraryNameLength;
|
| - UnlinkedDocumentationComment _libraryDocumentationComment;
|
| - UnlinkedPublicNamespace _publicNamespace;
|
| - List<UnlinkedReference> _references;
|
| - List<UnlinkedClass> _classes;
|
| - List<UnlinkedEnum> _enums;
|
| - List<UnlinkedExecutable> _executables;
|
| - List<UnlinkedExportNonPublic> _exports;
|
| - List<UnlinkedImport> _imports;
|
| - List<UnlinkedPart> _parts;
|
| - List<UnlinkedTypedef> _typedefs;
|
| - List<UnlinkedVariable> _variables;
|
| -
|
| - UnlinkedUnit.fromJson(Map json)
|
| - : _libraryName = json["libraryName"],
|
| - _libraryNameOffset = json["libraryNameOffset"],
|
| - _libraryNameLength = json["libraryNameLength"],
|
| - _libraryDocumentationComment = json["libraryDocumentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["libraryDocumentationComment"]),
|
| - _publicNamespace = json["publicNamespace"] == null ? null : new UnlinkedPublicNamespace.fromJson(json["publicNamespace"]),
|
| - _references = json["references"]?.map((x) => new UnlinkedReference.fromJson(x))?.toList(),
|
| - _classes = json["classes"]?.map((x) => new UnlinkedClass.fromJson(x))?.toList(),
|
| - _enums = json["enums"]?.map((x) => new UnlinkedEnum.fromJson(x))?.toList(),
|
| - _executables = json["executables"]?.map((x) => new UnlinkedExecutable.fromJson(x))?.toList(),
|
| - _exports = json["exports"]?.map((x) => new UnlinkedExportNonPublic.fromJson(x))?.toList(),
|
| - _imports = json["imports"]?.map((x) => new UnlinkedImport.fromJson(x))?.toList(),
|
| - _parts = json["parts"]?.map((x) => new UnlinkedPart.fromJson(x))?.toList(),
|
| - _typedefs = json["typedefs"]?.map((x) => new UnlinkedTypedef.fromJson(x))?.toList(),
|
| - _variables = json["variables"]?.map((x) => new UnlinkedVariable.fromJson(x))?.toList();
|
| + const _UnlinkedTypeRefReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedTypeRefReader createReader(fb.BufferPointer bp) => new _UnlinkedTypeRefReader(bp);
|
|
|
| @override
|
| Map<String, Object> toMap() => {
|
| - "libraryName": libraryName,
|
| - "libraryNameOffset": libraryNameOffset,
|
| - "libraryNameLength": libraryNameLength,
|
| - "libraryDocumentationComment": libraryDocumentationComment,
|
| - "publicNamespace": publicNamespace,
|
| - "references": references,
|
| - "classes": classes,
|
| - "enums": enums,
|
| - "executables": executables,
|
| - "exports": exports,
|
| - "imports": imports,
|
| - "parts": parts,
|
| - "typedefs": typedefs,
|
| - "variables": variables,
|
| + "reference": reference,
|
| + "paramReference": paramReference,
|
| + "typeArguments": typeArguments,
|
| };
|
|
|
| - UnlinkedUnit.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8.decode(buffer)));
|
| + @override
|
| + int get reference => const fb.Int32Reader().vTableGet(_bp, 0, 0);
|
| +
|
| + @override
|
| + int get paramReference => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| +
|
| + @override
|
| + List<UnlinkedTypeRef> get typeArguments => const fb.ListReader<UnlinkedTypeRef>(const _UnlinkedTypeRefReader()).vTableGet(_bp, 2, const <UnlinkedTypeRef>[]);
|
| +}
|
| +
|
| +class UnlinkedUnitBuilder {
|
| + bool _finished = false;
|
| +
|
| + String _libraryName;
|
| + int _libraryNameOffset;
|
| + int _libraryNameLength;
|
| + UnlinkedDocumentationCommentBuilder _libraryDocumentationComment;
|
| + UnlinkedPublicNamespaceBuilder _publicNamespace;
|
| + List<UnlinkedReferenceBuilder> _references;
|
| + List<UnlinkedClassBuilder> _classes;
|
| + List<UnlinkedEnumBuilder> _enums;
|
| + List<UnlinkedExecutableBuilder> _executables;
|
| + List<UnlinkedExportNonPublicBuilder> _exports;
|
| + List<UnlinkedImportBuilder> _imports;
|
| + List<UnlinkedPartBuilder> _parts;
|
| + List<UnlinkedTypedefBuilder> _typedefs;
|
| + List<UnlinkedVariableBuilder> _variables;
|
| +
|
| + UnlinkedUnitBuilder(base.BuilderContext context);
|
|
|
| /**
|
| * Name of the library (from a "library" declaration, if present).
|
| */
|
| - String get libraryName => _libraryName ?? '';
|
| + void set libraryName(String _value) {
|
| + assert(!_finished);
|
| + _libraryName = _value;
|
| + }
|
|
|
| /**
|
| * Offset of the library name relative to the beginning of the file (or 0 if
|
| * the library has no name).
|
| */
|
| - int get libraryNameOffset => _libraryNameOffset ?? 0;
|
| -
|
| - /**
|
| - * Length of the library name as it appears in the source code (or 0 if the
|
| - * library has no name).
|
| - */
|
| - int get libraryNameLength => _libraryNameLength ?? 0;
|
| -
|
| - /**
|
| - * Documentation comment for the library, or `null` if there is no
|
| - * documentation comment.
|
| - */
|
| - UnlinkedDocumentationComment get libraryDocumentationComment => _libraryDocumentationComment;
|
| -
|
| - /**
|
| - * Unlinked public namespace of this compilation unit.
|
| - */
|
| - UnlinkedPublicNamespace get publicNamespace => _publicNamespace;
|
| -
|
| - /**
|
| - * Top level and prefixed names referred to by this compilation unit. The
|
| - * zeroth element of this array is always populated and always represents a
|
| - * reference to the pseudo-type "dynamic".
|
| - */
|
| - List<UnlinkedReference> get references => _references ?? const <UnlinkedReference>[];
|
| -
|
| - /**
|
| - * Classes declared in the compilation unit.
|
| - */
|
| - List<UnlinkedClass> get classes => _classes ?? const <UnlinkedClass>[];
|
| -
|
| - /**
|
| - * Enums declared in the compilation unit.
|
| - */
|
| - List<UnlinkedEnum> get enums => _enums ?? const <UnlinkedEnum>[];
|
| -
|
| - /**
|
| - * Top level executable objects (functions, getters, and setters) declared in
|
| - * the compilation unit.
|
| - */
|
| - List<UnlinkedExecutable> get executables => _executables ?? const <UnlinkedExecutable>[];
|
| -
|
| - /**
|
| - * Export declarations in the compilation unit.
|
| - */
|
| - List<UnlinkedExportNonPublic> get exports => _exports ?? const <UnlinkedExportNonPublic>[];
|
| -
|
| - /**
|
| - * Import declarations in the compilation unit.
|
| - */
|
| - List<UnlinkedImport> get imports => _imports ?? const <UnlinkedImport>[];
|
| -
|
| - /**
|
| - * Part declarations in the compilation unit.
|
| - */
|
| - List<UnlinkedPart> get parts => _parts ?? const <UnlinkedPart>[];
|
| -
|
| - /**
|
| - * Typedefs declared in the compilation unit.
|
| - */
|
| - List<UnlinkedTypedef> get typedefs => _typedefs ?? const <UnlinkedTypedef>[];
|
| -
|
| - /**
|
| - * Top level variables declared in the compilation unit.
|
| - */
|
| - List<UnlinkedVariable> get variables => _variables ?? const <UnlinkedVariable>[];
|
| -}
|
| -
|
| -class UnlinkedUnitBuilder {
|
| - final Map _json = {};
|
| -
|
| - bool _finished = false;
|
| -
|
| - UnlinkedUnitBuilder(base.BuilderContext context);
|
| -
|
| - /**
|
| - * Name of the library (from a "library" declaration, if present).
|
| - */
|
| - void set libraryName(String _value) {
|
| - assert(!_finished);
|
| - assert(!_json.containsKey("libraryName"));
|
| - if (_value != null) {
|
| - _json["libraryName"] = _value;
|
| - }
|
| - }
|
| -
|
| - /**
|
| - * Offset of the library name relative to the beginning of the file (or 0 if
|
| - * the library has no name).
|
| - */
|
| - void set libraryNameOffset(int _value) {
|
| - assert(!_finished);
|
| - assert(!_json.containsKey("libraryNameOffset"));
|
| - if (_value != null) {
|
| - _json["libraryNameOffset"] = _value;
|
| - }
|
| - }
|
| + void set libraryNameOffset(int _value) {
|
| + assert(!_finished);
|
| + _libraryNameOffset = _value;
|
| + }
|
|
|
| /**
|
| * Length of the library name as it appears in the source code (or 0 if the
|
| @@ -2995,10 +3439,7 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set libraryNameLength(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("libraryNameLength"));
|
| - if (_value != null) {
|
| - _json["libraryNameLength"] = _value;
|
| - }
|
| + _libraryNameLength = _value;
|
| }
|
|
|
| /**
|
| @@ -3007,10 +3448,7 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set libraryDocumentationComment(UnlinkedDocumentationCommentBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("libraryDocumentationComment"));
|
| - if (_value != null) {
|
| - _json["libraryDocumentationComment"] = _value.finish();
|
| - }
|
| + _libraryDocumentationComment = _value;
|
| }
|
|
|
| /**
|
| @@ -3018,10 +3456,7 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set publicNamespace(UnlinkedPublicNamespaceBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("publicNamespace"));
|
| - if (_value != null) {
|
| - _json["publicNamespace"] = _value.finish();
|
| - }
|
| + _publicNamespace = _value;
|
| }
|
|
|
| /**
|
| @@ -3031,10 +3466,7 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set references(List<UnlinkedReferenceBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("references"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["references"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _references = _value;
|
| }
|
|
|
| /**
|
| @@ -3042,10 +3474,7 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set classes(List<UnlinkedClassBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("classes"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["classes"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _classes = _value;
|
| }
|
|
|
| /**
|
| @@ -3053,10 +3482,7 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set enums(List<UnlinkedEnumBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("enums"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["enums"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _enums = _value;
|
| }
|
|
|
| /**
|
| @@ -3065,10 +3491,7 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set executables(List<UnlinkedExecutableBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("executables"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["executables"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _executables = _value;
|
| }
|
|
|
| /**
|
| @@ -3076,10 +3499,7 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set exports(List<UnlinkedExportNonPublicBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("exports"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["exports"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _exports = _value;
|
| }
|
|
|
| /**
|
| @@ -3087,10 +3507,7 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set imports(List<UnlinkedImportBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("imports"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["imports"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _imports = _value;
|
| }
|
|
|
| /**
|
| @@ -3098,10 +3515,7 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set parts(List<UnlinkedPartBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("parts"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["parts"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _parts = _value;
|
| }
|
|
|
| /**
|
| @@ -3109,10 +3523,7 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set typedefs(List<UnlinkedTypedefBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("typedefs"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["typedefs"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _typedefs = _value;
|
| }
|
|
|
| /**
|
| @@ -3120,18 +3531,109 @@ class UnlinkedUnitBuilder {
|
| */
|
| void set variables(List<UnlinkedVariableBuilder> _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("variables"));
|
| - if (!(_value == null || _value.isEmpty)) {
|
| - _json["variables"] = _value.map((b) => b.finish()).toList();
|
| - }
|
| + _variables = _value;
|
| }
|
|
|
| - List<int> toBuffer() => UTF8.encode(JSON.encode(finish()));
|
| + List<int> toBuffer() {
|
| + fb.Builder fbBuilder = new fb.Builder();
|
| + return fbBuilder.finish(finish(fbBuilder));
|
| + }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_libraryName;
|
| + fb.Offset offset_libraryDocumentationComment;
|
| + fb.Offset offset_publicNamespace;
|
| + fb.Offset offset_references;
|
| + fb.Offset offset_classes;
|
| + fb.Offset offset_enums;
|
| + fb.Offset offset_executables;
|
| + fb.Offset offset_exports;
|
| + fb.Offset offset_imports;
|
| + fb.Offset offset_parts;
|
| + fb.Offset offset_typedefs;
|
| + fb.Offset offset_variables;
|
| + if (_libraryName != null) {
|
| + offset_libraryName = fbBuilder.writeString(_libraryName);
|
| + }
|
| + if (_libraryDocumentationComment != null) {
|
| + offset_libraryDocumentationComment = _libraryDocumentationComment.finish(fbBuilder);
|
| + }
|
| + if (_publicNamespace != null) {
|
| + offset_publicNamespace = _publicNamespace.finish(fbBuilder);
|
| + }
|
| + if (!(_references == null || _references.isEmpty)) {
|
| + offset_references = fbBuilder.writeList(_references.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_classes == null || _classes.isEmpty)) {
|
| + offset_classes = fbBuilder.writeList(_classes.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_enums == null || _enums.isEmpty)) {
|
| + offset_enums = fbBuilder.writeList(_enums.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_executables == null || _executables.isEmpty)) {
|
| + offset_executables = fbBuilder.writeList(_executables.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_exports == null || _exports.isEmpty)) {
|
| + offset_exports = fbBuilder.writeList(_exports.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_imports == null || _imports.isEmpty)) {
|
| + offset_imports = fbBuilder.writeList(_imports.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_parts == null || _parts.isEmpty)) {
|
| + offset_parts = fbBuilder.writeList(_parts.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_typedefs == null || _typedefs.isEmpty)) {
|
| + offset_typedefs = fbBuilder.writeList(_typedefs.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + if (!(_variables == null || _variables.isEmpty)) {
|
| + offset_variables = fbBuilder.writeList(_variables.map((b) => b.finish(fbBuilder)).toList());
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_libraryName != null) {
|
| + fbBuilder.addOffset(0, offset_libraryName);
|
| + }
|
| + if (_libraryNameOffset != null && _libraryNameOffset != 0) {
|
| + fbBuilder.addInt32(1, _libraryNameOffset);
|
| + }
|
| + if (_libraryNameLength != null && _libraryNameLength != 0) {
|
| + fbBuilder.addInt32(2, _libraryNameLength);
|
| + }
|
| + if (offset_libraryDocumentationComment != null) {
|
| + fbBuilder.addOffset(3, offset_libraryDocumentationComment);
|
| + }
|
| + if (offset_publicNamespace != null) {
|
| + fbBuilder.addOffset(4, offset_publicNamespace);
|
| + }
|
| + if (offset_references != null) {
|
| + fbBuilder.addOffset(5, offset_references);
|
| + }
|
| + if (offset_classes != null) {
|
| + fbBuilder.addOffset(6, offset_classes);
|
| + }
|
| + if (offset_enums != null) {
|
| + fbBuilder.addOffset(7, offset_enums);
|
| + }
|
| + if (offset_executables != null) {
|
| + fbBuilder.addOffset(8, offset_executables);
|
| + }
|
| + if (offset_exports != null) {
|
| + fbBuilder.addOffset(9, offset_exports);
|
| + }
|
| + if (offset_imports != null) {
|
| + fbBuilder.addOffset(10, offset_imports);
|
| + }
|
| + if (offset_parts != null) {
|
| + fbBuilder.addOffset(11, offset_parts);
|
| + }
|
| + if (offset_typedefs != null) {
|
| + fbBuilder.addOffset(12, offset_typedefs);
|
| + }
|
| + if (offset_variables != null) {
|
| + fbBuilder.addOffset(13, offset_variables);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -3155,93 +3657,172 @@ UnlinkedUnitBuilder encodeUnlinkedUnit(base.BuilderContext builderContext, {Stri
|
| }
|
|
|
| /**
|
| - * Unlinked summary information about a top level variable, local variable, or
|
| - * a field.
|
| + * Unlinked summary information about a compilation unit ("part file").
|
| */
|
| -class UnlinkedVariable extends base.SummaryClass {
|
| - String _name;
|
| - int _nameOffset;
|
| - UnlinkedDocumentationComment _documentationComment;
|
| - UnlinkedTypeRef _type;
|
| - bool _isStatic;
|
| - bool _isFinal;
|
| - bool _isConst;
|
| - bool _hasImplicitType;
|
| -
|
| - UnlinkedVariable.fromJson(Map json)
|
| - : _name = json["name"],
|
| - _nameOffset = json["nameOffset"],
|
| - _documentationComment = json["documentationComment"] == null ? null : new UnlinkedDocumentationComment.fromJson(json["documentationComment"]),
|
| - _type = json["type"] == null ? null : new UnlinkedTypeRef.fromJson(json["type"]),
|
| - _isStatic = json["isStatic"],
|
| - _isFinal = json["isFinal"],
|
| - _isConst = json["isConst"],
|
| - _hasImplicitType = json["hasImplicitType"];
|
| +abstract class UnlinkedUnit extends base.SummaryClass {
|
| + factory UnlinkedUnit.fromBuffer(List<int> buffer) {
|
| + fb.BufferPointer rootRef = new fb.BufferPointer.fromBytes(buffer);
|
| + return const _UnlinkedUnitReader().read(rootRef);
|
| + }
|
|
|
| - @override
|
| - Map<String, Object> toMap() => {
|
| - "name": name,
|
| - "nameOffset": nameOffset,
|
| - "documentationComment": documentationComment,
|
| - "type": type,
|
| - "isStatic": isStatic,
|
| - "isFinal": isFinal,
|
| - "isConst": isConst,
|
| - "hasImplicitType": hasImplicitType,
|
| - };
|
| + /**
|
| + * Name of the library (from a "library" declaration, if present).
|
| + */
|
| + String get libraryName;
|
|
|
| /**
|
| - * Name of the variable.
|
| + * Offset of the library name relative to the beginning of the file (or 0 if
|
| + * the library has no name).
|
| */
|
| - String get name => _name ?? '';
|
| + int get libraryNameOffset;
|
|
|
| /**
|
| - * Offset of the variable name relative to the beginning of the file.
|
| + * Length of the library name as it appears in the source code (or 0 if the
|
| + * library has no name).
|
| */
|
| - int get nameOffset => _nameOffset ?? 0;
|
| + int get libraryNameLength;
|
|
|
| /**
|
| - * Documentation comment for the variable, or `null` if there is no
|
| + * Documentation comment for the library, or `null` if there is no
|
| * documentation comment.
|
| */
|
| - UnlinkedDocumentationComment get documentationComment => _documentationComment;
|
| + UnlinkedDocumentationComment get libraryDocumentationComment;
|
|
|
| /**
|
| - * Declared type of the variable. Note that when strong mode is enabled, the
|
| - * actual type of the variable may be different due to type inference.
|
| + * Unlinked public namespace of this compilation unit.
|
| */
|
| - UnlinkedTypeRef get type => _type;
|
| + UnlinkedPublicNamespace get publicNamespace;
|
|
|
| /**
|
| - * Indicates whether the variable is declared using the `static` keyword.
|
| - *
|
| - * Note that for top level variables, this flag is false, since they are not
|
| - * declared using the `static` keyword (even though they are considered
|
| - * static for semantic purposes).
|
| + * Top level and prefixed names referred to by this compilation unit. The
|
| + * zeroth element of this array is always populated and always represents a
|
| + * reference to the pseudo-type "dynamic".
|
| */
|
| - bool get isStatic => _isStatic ?? false;
|
| + List<UnlinkedReference> get references;
|
|
|
| /**
|
| - * Indicates whether the variable is declared using the `final` keyword.
|
| + * Classes declared in the compilation unit.
|
| */
|
| - bool get isFinal => _isFinal ?? false;
|
| + List<UnlinkedClass> get classes;
|
|
|
| /**
|
| - * Indicates whether the variable is declared using the `const` keyword.
|
| + * Enums declared in the compilation unit.
|
| */
|
| - bool get isConst => _isConst ?? false;
|
| + List<UnlinkedEnum> get enums;
|
|
|
| /**
|
| - * Indicates whether this variable lacks an explicit type declaration.
|
| + * Top level executable objects (functions, getters, and setters) declared in
|
| + * the compilation unit.
|
| + */
|
| + List<UnlinkedExecutable> get executables;
|
| +
|
| + /**
|
| + * Export declarations in the compilation unit.
|
| + */
|
| + List<UnlinkedExportNonPublic> get exports;
|
| +
|
| + /**
|
| + * Import declarations in the compilation unit.
|
| + */
|
| + List<UnlinkedImport> get imports;
|
| +
|
| + /**
|
| + * Part declarations in the compilation unit.
|
| + */
|
| + List<UnlinkedPart> get parts;
|
| +
|
| + /**
|
| + * Typedefs declared in the compilation unit.
|
| */
|
| - bool get hasImplicitType => _hasImplicitType ?? false;
|
| + List<UnlinkedTypedef> get typedefs;
|
| +
|
| + /**
|
| + * Top level variables declared in the compilation unit.
|
| + */
|
| + List<UnlinkedVariable> get variables;
|
| }
|
|
|
| -class UnlinkedVariableBuilder {
|
| - final Map _json = {};
|
| +class _UnlinkedUnitReader extends fb.TableReader<_UnlinkedUnitReader> implements UnlinkedUnit {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedUnitReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedUnitReader createReader(fb.BufferPointer bp) => new _UnlinkedUnitReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "libraryName": libraryName,
|
| + "libraryNameOffset": libraryNameOffset,
|
| + "libraryNameLength": libraryNameLength,
|
| + "libraryDocumentationComment": libraryDocumentationComment,
|
| + "publicNamespace": publicNamespace,
|
| + "references": references,
|
| + "classes": classes,
|
| + "enums": enums,
|
| + "executables": executables,
|
| + "exports": exports,
|
| + "imports": imports,
|
| + "parts": parts,
|
| + "typedefs": typedefs,
|
| + "variables": variables,
|
| + };
|
| +
|
| + @override
|
| + String get libraryName => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + int get libraryNameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| +
|
| + @override
|
| + int get libraryNameLength => const fb.Int32Reader().vTableGet(_bp, 2, 0);
|
|
|
| + @override
|
| + UnlinkedDocumentationComment get libraryDocumentationComment => const _UnlinkedDocumentationCommentReader().vTableGet(_bp, 3, null);
|
| +
|
| + @override
|
| + UnlinkedPublicNamespace get publicNamespace => const _UnlinkedPublicNamespaceReader().vTableGet(_bp, 4, null);
|
| +
|
| + @override
|
| + List<UnlinkedReference> get references => const fb.ListReader<UnlinkedReference>(const _UnlinkedReferenceReader()).vTableGet(_bp, 5, const <UnlinkedReference>[]);
|
| +
|
| + @override
|
| + List<UnlinkedClass> get classes => const fb.ListReader<UnlinkedClass>(const _UnlinkedClassReader()).vTableGet(_bp, 6, const <UnlinkedClass>[]);
|
| +
|
| + @override
|
| + List<UnlinkedEnum> get enums => const fb.ListReader<UnlinkedEnum>(const _UnlinkedEnumReader()).vTableGet(_bp, 7, const <UnlinkedEnum>[]);
|
| +
|
| + @override
|
| + List<UnlinkedExecutable> get executables => const fb.ListReader<UnlinkedExecutable>(const _UnlinkedExecutableReader()).vTableGet(_bp, 8, const <UnlinkedExecutable>[]);
|
| +
|
| + @override
|
| + List<UnlinkedExportNonPublic> get exports => const fb.ListReader<UnlinkedExportNonPublic>(const _UnlinkedExportNonPublicReader()).vTableGet(_bp, 9, const <UnlinkedExportNonPublic>[]);
|
| +
|
| + @override
|
| + List<UnlinkedImport> get imports => const fb.ListReader<UnlinkedImport>(const _UnlinkedImportReader()).vTableGet(_bp, 10, const <UnlinkedImport>[]);
|
| +
|
| + @override
|
| + List<UnlinkedPart> get parts => const fb.ListReader<UnlinkedPart>(const _UnlinkedPartReader()).vTableGet(_bp, 11, const <UnlinkedPart>[]);
|
| +
|
| + @override
|
| + List<UnlinkedTypedef> get typedefs => const fb.ListReader<UnlinkedTypedef>(const _UnlinkedTypedefReader()).vTableGet(_bp, 12, const <UnlinkedTypedef>[]);
|
| +
|
| + @override
|
| + List<UnlinkedVariable> get variables => const fb.ListReader<UnlinkedVariable>(const _UnlinkedVariableReader()).vTableGet(_bp, 13, const <UnlinkedVariable>[]);
|
| +}
|
| +
|
| +class UnlinkedVariableBuilder {
|
| bool _finished = false;
|
|
|
| + String _name;
|
| + int _nameOffset;
|
| + UnlinkedDocumentationCommentBuilder _documentationComment;
|
| + UnlinkedTypeRefBuilder _type;
|
| + bool _isStatic;
|
| + bool _isFinal;
|
| + bool _isConst;
|
| + bool _hasImplicitType;
|
| +
|
| UnlinkedVariableBuilder(base.BuilderContext context);
|
|
|
| /**
|
| @@ -3249,10 +3830,7 @@ class UnlinkedVariableBuilder {
|
| */
|
| void set name(String _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("name"));
|
| - if (_value != null) {
|
| - _json["name"] = _value;
|
| - }
|
| + _name = _value;
|
| }
|
|
|
| /**
|
| @@ -3260,10 +3838,7 @@ class UnlinkedVariableBuilder {
|
| */
|
| void set nameOffset(int _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("nameOffset"));
|
| - if (_value != null) {
|
| - _json["nameOffset"] = _value;
|
| - }
|
| + _nameOffset = _value;
|
| }
|
|
|
| /**
|
| @@ -3272,10 +3847,7 @@ class UnlinkedVariableBuilder {
|
| */
|
| void set documentationComment(UnlinkedDocumentationCommentBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("documentationComment"));
|
| - if (_value != null) {
|
| - _json["documentationComment"] = _value.finish();
|
| - }
|
| + _documentationComment = _value;
|
| }
|
|
|
| /**
|
| @@ -3284,10 +3856,7 @@ class UnlinkedVariableBuilder {
|
| */
|
| void set type(UnlinkedTypeRefBuilder _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("type"));
|
| - if (_value != null) {
|
| - _json["type"] = _value.finish();
|
| - }
|
| + _type = _value;
|
| }
|
|
|
| /**
|
| @@ -3299,10 +3868,7 @@ class UnlinkedVariableBuilder {
|
| */
|
| void set isStatic(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isStatic"));
|
| - if (_value != null) {
|
| - _json["isStatic"] = _value;
|
| - }
|
| + _isStatic = _value;
|
| }
|
|
|
| /**
|
| @@ -3310,10 +3876,7 @@ class UnlinkedVariableBuilder {
|
| */
|
| void set isFinal(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isFinal"));
|
| - if (_value != null) {
|
| - _json["isFinal"] = _value;
|
| - }
|
| + _isFinal = _value;
|
| }
|
|
|
| /**
|
| @@ -3321,10 +3884,7 @@ class UnlinkedVariableBuilder {
|
| */
|
| void set isConst(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("isConst"));
|
| - if (_value != null) {
|
| - _json["isConst"] = _value;
|
| - }
|
| + _isConst = _value;
|
| }
|
|
|
| /**
|
| @@ -3332,16 +3892,50 @@ class UnlinkedVariableBuilder {
|
| */
|
| void set hasImplicitType(bool _value) {
|
| assert(!_finished);
|
| - assert(!_json.containsKey("hasImplicitType"));
|
| - if (_value != null) {
|
| - _json["hasImplicitType"] = _value;
|
| - }
|
| + _hasImplicitType = _value;
|
| }
|
|
|
| - Map finish() {
|
| + fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| - return _json;
|
| + fb.Offset offset_name;
|
| + fb.Offset offset_documentationComment;
|
| + fb.Offset offset_type;
|
| + if (_name != null) {
|
| + offset_name = fbBuilder.writeString(_name);
|
| + }
|
| + if (_documentationComment != null) {
|
| + offset_documentationComment = _documentationComment.finish(fbBuilder);
|
| + }
|
| + if (_type != null) {
|
| + offset_type = _type.finish(fbBuilder);
|
| + }
|
| + fbBuilder.startTable();
|
| + if (offset_name != null) {
|
| + fbBuilder.addOffset(0, offset_name);
|
| + }
|
| + if (_nameOffset != null && _nameOffset != 0) {
|
| + fbBuilder.addInt32(1, _nameOffset);
|
| + }
|
| + if (offset_documentationComment != null) {
|
| + fbBuilder.addOffset(2, offset_documentationComment);
|
| + }
|
| + if (offset_type != null) {
|
| + fbBuilder.addOffset(3, offset_type);
|
| + }
|
| + if (_isStatic == true) {
|
| + fbBuilder.addInt8(4, 1);
|
| + }
|
| + if (_isFinal == true) {
|
| + fbBuilder.addInt8(5, 1);
|
| + }
|
| + if (_isConst == true) {
|
| + fbBuilder.addInt8(6, 1);
|
| + }
|
| + if (_hasImplicitType == true) {
|
| + fbBuilder.addInt8(7, 1);
|
| + }
|
| + return fbBuilder.endTable();
|
| }
|
| }
|
|
|
| @@ -3358,3 +3952,101 @@ UnlinkedVariableBuilder encodeUnlinkedVariable(base.BuilderContext builderContex
|
| return builder;
|
| }
|
|
|
| +/**
|
| + * Unlinked summary information about a top level variable, local variable, or
|
| + * a field.
|
| + */
|
| +abstract class UnlinkedVariable extends base.SummaryClass {
|
| +
|
| + /**
|
| + * Name of the variable.
|
| + */
|
| + String get name;
|
| +
|
| + /**
|
| + * Offset of the variable name relative to the beginning of the file.
|
| + */
|
| + int get nameOffset;
|
| +
|
| + /**
|
| + * Documentation comment for the variable, or `null` if there is no
|
| + * documentation comment.
|
| + */
|
| + UnlinkedDocumentationComment get documentationComment;
|
| +
|
| + /**
|
| + * Declared type of the variable. Note that when strong mode is enabled, the
|
| + * actual type of the variable may be different due to type inference.
|
| + */
|
| + UnlinkedTypeRef get type;
|
| +
|
| + /**
|
| + * Indicates whether the variable is declared using the `static` keyword.
|
| + *
|
| + * Note that for top level variables, this flag is false, since they are not
|
| + * declared using the `static` keyword (even though they are considered
|
| + * static for semantic purposes).
|
| + */
|
| + bool get isStatic;
|
| +
|
| + /**
|
| + * Indicates whether the variable is declared using the `final` keyword.
|
| + */
|
| + bool get isFinal;
|
| +
|
| + /**
|
| + * Indicates whether the variable is declared using the `const` keyword.
|
| + */
|
| + bool get isConst;
|
| +
|
| + /**
|
| + * Indicates whether this variable lacks an explicit type declaration.
|
| + */
|
| + bool get hasImplicitType;
|
| +}
|
| +
|
| +class _UnlinkedVariableReader extends fb.TableReader<_UnlinkedVariableReader> implements UnlinkedVariable {
|
| + final fb.BufferPointer _bp;
|
| +
|
| + const _UnlinkedVariableReader([this._bp]);
|
| +
|
| + @override
|
| + _UnlinkedVariableReader createReader(fb.BufferPointer bp) => new _UnlinkedVariableReader(bp);
|
| +
|
| + @override
|
| + Map<String, Object> toMap() => {
|
| + "name": name,
|
| + "nameOffset": nameOffset,
|
| + "documentationComment": documentationComment,
|
| + "type": type,
|
| + "isStatic": isStatic,
|
| + "isFinal": isFinal,
|
| + "isConst": isConst,
|
| + "hasImplicitType": hasImplicitType,
|
| + };
|
| +
|
| + @override
|
| + String get name => const fb.StringReader().vTableGet(_bp, 0, '');
|
| +
|
| + @override
|
| + int get nameOffset => const fb.Int32Reader().vTableGet(_bp, 1, 0);
|
| +
|
| + @override
|
| + UnlinkedDocumentationComment get documentationComment => const _UnlinkedDocumentationCommentReader().vTableGet(_bp, 2, null);
|
| +
|
| + @override
|
| + UnlinkedTypeRef get type => const _UnlinkedTypeRefReader().vTableGet(_bp, 3, null);
|
| +
|
| + @override
|
| + bool get isStatic => const fb.Int8Reader().vTableGet(_bp, 4, 0) == 1;
|
| +
|
| + @override
|
| + bool get isFinal => const fb.Int8Reader().vTableGet(_bp, 5, 0) == 1;
|
| +
|
| + @override
|
| + bool get isConst => const fb.Int8Reader().vTableGet(_bp, 6, 0) == 1;
|
| +
|
| + @override
|
| + bool get hasImplicitType => const fb.Int8Reader().vTableGet(_bp, 7, 0) == 1;
|
| +}
|
| +
|
|
|