From 28256b5529f5233a159e30da9c35835e7ef60685 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 11 Jun 2024 14:13:36 +0200 Subject: [PATCH 01/23] Add `package:record_use` --- pkgs/placeholder | 0 pkgs/record_use/.github/workflows/test.yaml | 34 +++ pkgs/record_use/.gitignore | 7 + pkgs/record_use/CHANGELOG.md | 3 + pkgs/record_use/LICENSE | 27 +++ pkgs/record_use/README.md | 102 +++++++++ pkgs/record_use/analysis_options.yaml | 9 + .../example/record_use_example.dart | 12 + pkgs/record_use/lib/record_use.dart | 12 + pkgs/record_use/lib/record_use_internal.dart | 14 ++ .../lib/src/data_classes/annotation.dart | 44 ++++ .../lib/src/data_classes/arguments.dart | 123 +++++++++++ .../lib/src/data_classes/definition.dart | 56 +++++ .../lib/src/data_classes/field.dart | 44 ++++ .../lib/src/data_classes/identifier.dart | 41 ++++ .../lib/src/data_classes/location.dart | 44 ++++ .../lib/src/data_classes/metadata.dart | 49 +++++ .../lib/src/data_classes/reference.dart | 102 +++++++++ .../lib/src/data_classes/usage.dart | 57 +++++ .../lib/src/data_classes/usage_record.dart | 97 ++++++++ pkgs/record_use/lib/src/record_use.dart | 130 +++++++++++ pkgs/record_use/pubspec.yaml | 16 ++ pkgs/record_use/test/record_use_test.dart | 208 ++++++++++++++++++ 23 files changed, 1231 insertions(+) delete mode 100644 pkgs/placeholder create mode 100644 pkgs/record_use/.github/workflows/test.yaml create mode 100644 pkgs/record_use/.gitignore create mode 100644 pkgs/record_use/CHANGELOG.md create mode 100644 pkgs/record_use/LICENSE create mode 100644 pkgs/record_use/README.md create mode 100644 pkgs/record_use/analysis_options.yaml create mode 100644 pkgs/record_use/example/record_use_example.dart create mode 100644 pkgs/record_use/lib/record_use.dart create mode 100644 pkgs/record_use/lib/record_use_internal.dart create mode 100644 pkgs/record_use/lib/src/data_classes/annotation.dart create mode 100644 pkgs/record_use/lib/src/data_classes/arguments.dart create mode 100644 pkgs/record_use/lib/src/data_classes/definition.dart create mode 100644 pkgs/record_use/lib/src/data_classes/field.dart create mode 100644 pkgs/record_use/lib/src/data_classes/identifier.dart create mode 100644 pkgs/record_use/lib/src/data_classes/location.dart create mode 100644 pkgs/record_use/lib/src/data_classes/metadata.dart create mode 100644 pkgs/record_use/lib/src/data_classes/reference.dart create mode 100644 pkgs/record_use/lib/src/data_classes/usage.dart create mode 100644 pkgs/record_use/lib/src/data_classes/usage_record.dart create mode 100644 pkgs/record_use/lib/src/record_use.dart create mode 100644 pkgs/record_use/pubspec.yaml create mode 100644 pkgs/record_use/test/record_use_test.dart diff --git a/pkgs/placeholder b/pkgs/placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/pkgs/record_use/.github/workflows/test.yaml b/pkgs/record_use/.github/workflows/test.yaml new file mode 100644 index 00000000..090666b7 --- /dev/null +++ b/pkgs/record_use/.github/workflows/test.yaml @@ -0,0 +1,34 @@ +name: test +permissions: read-all + +on: + pull_request: + branches: [ main ] + push: + branches: [ main ] + schedule: + - cron: '0 0 * * 0' # weekly + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + sdk: [stable, dev] + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 + with: + sdk: ${{matrix.sdk}} + + - run: dart pub get + + - run: dart analyze --fatal-infos + + - run: dart format --output=none --set-exit-if-changed . + + - run: dart test + + - name: Run Chrome tests - wasm + run: dart test --platform chrome --compiler dart2wasm + if: always() && matrix.sdk == 'dev' diff --git a/pkgs/record_use/.gitignore b/pkgs/record_use/.gitignore new file mode 100644 index 00000000..3cceda55 --- /dev/null +++ b/pkgs/record_use/.gitignore @@ -0,0 +1,7 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ + +# Avoid committing pubspec.lock for library packages; see +# https://dart.dev/guides/libraries/private-files#pubspeclock. +pubspec.lock diff --git a/pkgs/record_use/CHANGELOG.md b/pkgs/record_use/CHANGELOG.md new file mode 100644 index 00000000..a0712a79 --- /dev/null +++ b/pkgs/record_use/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.0 + +- Initial version. diff --git a/pkgs/record_use/LICENSE b/pkgs/record_use/LICENSE new file mode 100644 index 00000000..b03a7886 --- /dev/null +++ b/pkgs/record_use/LICENSE @@ -0,0 +1,27 @@ +Copyright 2024, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google LLC nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/pkgs/record_use/README.md b/pkgs/record_use/README.md new file mode 100644 index 00000000..8ed1d488 --- /dev/null +++ b/pkgs/record_use/README.md @@ -0,0 +1,102 @@ +# `package:record_use` + + +> [!CAUTION] +> This is an experimental package, and it's API can break at any time. Use at +> your own discretion. + +This package provides the data classes for the usage recording feature in the +Dart SDK. + +Dart objects with the `@RecordUse` annotation are being recorded at compile +time, providing the user with information. The information depends on the object +being recorded. + +- If placed on a static method, the annotation means that calls to the method +are being recorded. If the `arguments` parameter is set to `true`, then +arguments will also be recorded, as far as they can be inferred at compile time. +- If placed on a class with a constant constructor, the annotation means that +any constant instance of the class will be recorded. This is particularly useful +when placing + +## Example +```dart +import 'package:meta/meta.dart' show RecordUse; + +void main() { + print(SomeClass.stringMetadata(42)); + print(SomeClass.doubleMetadata(42)); + print(SomeClass.intMetadata(42)); + print(SomeClass.boolMetadata(42)); +} + +class SomeClass { + @RecordMetadata('leroyjenkins') + @RecordUse() + static stringMetadata(int i) { + return i + 1; + } + + @RecordMetadata(3.14) + @RecordUse() + static doubleMetadata(int i) { + return i + 1; + } + + @RecordMetadata(42) + @RecordUse() + static intMetadata(int i) { + return i + 1; + } + + @RecordMetadata(true) + @RecordUse() + static boolMetadata(int i) { + return i + 1; + } +} + +@RecordUse() +class RecordMetadata { + final Object metadata; + + const RecordMetadata(this.metadata); +} + +``` +This code will generate a JSON file that contains both the `metadata` values of +the `RecordMetadata` instances, as well as the arguments for the different +methods annotated with `@RecordUse()`. + +This information can then be accessed in a link hook as follows: +```dart +import 'package:native_assets_cli/native_assets_cli.dart'; + +void main(List arguments){ + link(arguments, (config, output) async { + final uses = config.recordedUses; + + final args = uses.callReferencesTo(boolMetadataId)); + //[args] is an iterable of [Argument] classes, in this case containing "42" + + final fields = uses.instanceReferencesTo(recordMetadataId); + //[fields] is an iterable of [Field] classes, in this case containing + // {"arguments": "leroyjenkins"} + // {"arguments": 3.14} + // {"arguments": 42} + // {"arguments": true} + + ... // Do something with the information, such as tree-shaking native assets + }); +} +``` + +## Installation +To install the record_use package, run the following command: + +```bash +dart pub add record_use +``` + +## Contributing +Contributions are welcome! Please open an issue or submit a pull request. \ No newline at end of file diff --git a/pkgs/record_use/analysis_options.yaml b/pkgs/record_use/analysis_options.yaml new file mode 100644 index 00000000..77a5e838 --- /dev/null +++ b/pkgs/record_use/analysis_options.yaml @@ -0,0 +1,9 @@ +include: package:dart_flutter_team_lints/analysis_options.yaml + +linter: + rules: + - conditional_uri_does_not_exist + - prefer_const_constructors + - prefer_final_locals + - prefer_relative_imports + - unnecessary_parenthesis diff --git a/pkgs/record_use/example/record_use_example.dart b/pkgs/record_use/example/record_use_example.dart new file mode 100644 index 00000000..5a0c3e71 --- /dev/null +++ b/pkgs/record_use/example/record_use_example.dart @@ -0,0 +1,12 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:record_use/record_use.dart'; + +void doStuff(RecordUse usage, Identifier callId, Identifier referenceId) { + print(usage.metadata); + print(usage.callReferencesTo(callId)); + print(usage.instanceReferencesTo(referenceId)); + print(usage.hasNonConstArguments(callId)); +} diff --git a/pkgs/record_use/lib/record_use.dart b/pkgs/record_use/lib/record_use.dart new file mode 100644 index 00000000..483b6388 --- /dev/null +++ b/pkgs/record_use/lib/record_use.dart @@ -0,0 +1,12 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +export 'src/data_classes/arguments.dart' + show Arguments, ConstArguments, NonConstArguments; +export 'src/data_classes/field.dart' show Field; +export 'src/data_classes/identifier.dart' show Identifier; +export 'src/data_classes/location.dart' show Location; +export 'src/data_classes/metadata.dart' show Metadata; +export 'src/data_classes/reference.dart' show CallReference, InstanceReference; +export 'src/record_use.dart' show RecordUse; diff --git a/pkgs/record_use/lib/record_use_internal.dart b/pkgs/record_use/lib/record_use_internal.dart new file mode 100644 index 00000000..61523b3d --- /dev/null +++ b/pkgs/record_use/lib/record_use_internal.dart @@ -0,0 +1,14 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +export 'src/data_classes/annotation.dart'; +export 'src/data_classes/arguments.dart'; +export 'src/data_classes/definition.dart'; +export 'src/data_classes/field.dart'; +export 'src/data_classes/identifier.dart'; +export 'src/data_classes/location.dart'; +export 'src/data_classes/metadata.dart'; +export 'src/data_classes/reference.dart'; +export 'src/data_classes/usage.dart'; +export 'src/data_classes/usage_record.dart'; diff --git a/pkgs/record_use/lib/src/data_classes/annotation.dart b/pkgs/record_use/lib/src/data_classes/annotation.dart new file mode 100644 index 00000000..8f27f324 --- /dev/null +++ b/pkgs/record_use/lib/src/data_classes/annotation.dart @@ -0,0 +1,44 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; + +import 'identifier.dart'; + +class Annotation { + final Identifier identifier; + final Map fields; + + Annotation({ + required this.identifier, + required this.fields, + }); + + factory Annotation.fromJson( + Map json, + List identifiers, + ) => + Annotation( + identifier: identifiers[json['id'] as int], + fields: json['fields'] as Map, + ); + + Map toJson(List identifiers) => { + 'id': identifiers.indexOf(identifier), + 'fields': fields, + }; + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + final mapEquals = const DeepCollectionEquality().equals; + + return other is Annotation && + other.identifier == identifier && + mapEquals(other.fields, fields); + } + + @override + int get hashCode => identifier.hashCode ^ fields.hashCode; +} diff --git a/pkgs/record_use/lib/src/data_classes/arguments.dart b/pkgs/record_use/lib/src/data_classes/arguments.dart new file mode 100644 index 00000000..1f681dc4 --- /dev/null +++ b/pkgs/record_use/lib/src/data_classes/arguments.dart @@ -0,0 +1,123 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; + +class Arguments { + ConstArguments constArguments; + NonConstArguments nonConstArguments; + + Arguments({ + ConstArguments? constArguments, + NonConstArguments? nonConstArguments, + }) : constArguments = constArguments ?? ConstArguments(), + nonConstArguments = nonConstArguments ?? NonConstArguments(); + + factory Arguments.fromJson(Map json) { + final constJson = json['const'] as Map?; + final nonConstJson = json['nonConst'] as Map?; + return Arguments( + constArguments: + constJson != null ? ConstArguments.fromJson(constJson) : null, + nonConstArguments: nonConstJson != null + ? NonConstArguments.fromJson(nonConstJson) + : null, + ); + } + + Map toJson() { + final hasConst = + constArguments.named.isNotEmpty || constArguments.positional.isNotEmpty; + final hasNonConst = nonConstArguments.named.isNotEmpty || + nonConstArguments.positional.isNotEmpty; + return { + if (hasConst) 'const': constArguments.toJson(), + if (hasNonConst) 'nonConst': nonConstArguments.toJson(), + }; + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is Arguments && + other.constArguments == constArguments && + other.nonConstArguments == nonConstArguments; + } + + @override + int get hashCode => constArguments.hashCode ^ nonConstArguments.hashCode; +} + +class ConstArguments { + Map positional; + Map named; + + ConstArguments({Map? positional, Map? named}) + : named = named ?? {}, + positional = positional ?? {}; + + factory ConstArguments.fromJson(Map json) => ConstArguments( + positional: json['positional'] != null + ? (json['positional'] as Map) + .map((key, value) => MapEntry(int.parse(key), value)) + : {}, + named: + json['named'] != null ? json['named'] as Map : {}, + ); + + Map toJson() => { + if (positional.isNotEmpty) + 'positional': + positional.map((key, value) => MapEntry(key.toString(), value)), + if (named.isNotEmpty) 'named': named, + }; + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + final mapEquals = const DeepCollectionEquality().equals; + + return other is ConstArguments && + mapEquals(other.positional, positional) && + mapEquals(other.named, named); + } + + @override + int get hashCode => positional.hashCode ^ named.hashCode; +} + +class NonConstArguments { + List positional; + List named; // Assuming named arguments are strings (keys) + + NonConstArguments({List? positional, List? named}) + : named = named ?? [], + positional = positional ?? []; + + factory NonConstArguments.fromJson(Map json) => + NonConstArguments( + positional: + json['positional'] != null ? json['positional'] as List : [], + named: json['named'] != null ? json['named'] as List : [], + ); + + Map toJson() => { + if (positional.isNotEmpty) 'positional': positional, + if (named.isNotEmpty) 'named': named, + }; + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + final listEquals = const DeepCollectionEquality().equals; + + return other is NonConstArguments && + listEquals(other.positional, positional) && + listEquals(other.named, named); + } + + @override + int get hashCode => positional.hashCode ^ named.hashCode; +} diff --git a/pkgs/record_use/lib/src/data_classes/definition.dart b/pkgs/record_use/lib/src/data_classes/definition.dart new file mode 100644 index 00000000..06c811d1 --- /dev/null +++ b/pkgs/record_use/lib/src/data_classes/definition.dart @@ -0,0 +1,56 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'identifier.dart'; +import 'location.dart'; + +class Definition { + final Identifier identifier; + final Location location; // Represents the '@' field in the JSON + final String? loadingUnit; + + Definition({ + required this.identifier, + required this.location, + this.loadingUnit, + }); + + factory Definition.fromJson( + Map json, + List identifiers, + ) { + final identifier = identifiers[json['id'] as int]; + return Definition( + identifier: identifier, + location: Location.fromJson( + json['@'] as Map, + identifier.uri, + null, + ), + loadingUnit: json['loadingUnit'] as String?, + ); + } + + Map toJson( + List identifiers, + List uris, + ) => + { + 'id': identifiers.indexOf(identifier), + '@': location.toJson(), + 'loadingUnit': loadingUnit, + }; + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is Definition && + other.identifier == identifier && + other.loadingUnit == loadingUnit; + } + + @override + int get hashCode => identifier.hashCode ^ loadingUnit.hashCode; +} diff --git a/pkgs/record_use/lib/src/data_classes/field.dart b/pkgs/record_use/lib/src/data_classes/field.dart new file mode 100644 index 00000000..13e7b5c3 --- /dev/null +++ b/pkgs/record_use/lib/src/data_classes/field.dart @@ -0,0 +1,44 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Field { + final String className; + final String name; + final Object? value; + + Field({ + required this.className, + required this.name, + required this.value, + }); + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is Field && + other.className == className && + other.name == name && + other.value == value; + } + + @override + int get hashCode => className.hashCode ^ name.hashCode ^ value.hashCode; + + Map toJson() { + return { + 'className': className, + 'name': name, + 'value': value, + }; + } + + factory Field.fromJson(Map map) { + return Field( + className: map['className'] as String, + name: map['name'] as String, + value: map['value'], + ); + } +} diff --git a/pkgs/record_use/lib/src/data_classes/identifier.dart b/pkgs/record_use/lib/src/data_classes/identifier.dart new file mode 100644 index 00000000..e5737e33 --- /dev/null +++ b/pkgs/record_use/lib/src/data_classes/identifier.dart @@ -0,0 +1,41 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Identifier { + String uri; + String? parent; // Optional since not all elements have parents + String name; + + Identifier({ + required this.uri, + this.parent, + required this.name, + }); + + factory Identifier.fromJson(Map json, List uris) => + Identifier( + uri: uris[json['uri'] as int], + parent: json['parent'] as String?, + name: json['name'] as String, + ); + + Map toJson(List uris) => { + 'uri': uris.indexOf(uri), + if (parent != null) 'parent': parent, + 'name': name, + }; + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is Identifier && + other.uri == uri && + other.parent == parent && + other.name == name; + } + + @override + int get hashCode => uri.hashCode ^ parent.hashCode ^ name.hashCode; +} diff --git a/pkgs/record_use/lib/src/data_classes/location.dart b/pkgs/record_use/lib/src/data_classes/location.dart new file mode 100644 index 00000000..6cd9d88d --- /dev/null +++ b/pkgs/record_use/lib/src/data_classes/location.dart @@ -0,0 +1,44 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Location { + String uri; + int line; + int column; + Location({ + required this.uri, + required this.line, + required this.column, + }); + + factory Location.fromJson( + Map map, String? uri, List? uris) { + return Location( + uri: uri ?? uris![map['uri'] as int], + line: map['line'] as int, + column: map['column'] as int, + ); + } + + Map toJson({List? uris}) { + return { + if (uris != null) 'uri': uris.indexOf(uri), + 'line': line, + 'column': column, + }; + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is Location && + other.uri == uri && + other.line == line && + other.column == column; + } + + @override + int get hashCode => uri.hashCode ^ line.hashCode ^ column.hashCode; +} diff --git a/pkgs/record_use/lib/src/data_classes/metadata.dart b/pkgs/record_use/lib/src/data_classes/metadata.dart new file mode 100644 index 00000000..d2aee07b --- /dev/null +++ b/pkgs/record_use/lib/src/data_classes/metadata.dart @@ -0,0 +1,49 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:pub_semver/pub_semver.dart'; + +class Metadata { + final String? comment; + final Version version; + + Metadata({ + this.comment, + required this.version, + }); + + factory Metadata.fromJson(Map json) => Metadata( + comment: json['comment'] as String?, + version: Version.parse(json['version'] as String), + ); + + Map toJson() => { + if (comment != null) 'comment': comment, + 'version': version.toString(), + }; + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is Metadata && + other.comment == comment && + other.version == version; + } + + @override + int get hashCode { + return comment.hashCode ^ version.hashCode; + } + + @override + String toString() { + return ''' +Metadata( + comment: $comment, + version: $version, +) +'''; + } +} diff --git a/pkgs/record_use/lib/src/data_classes/reference.dart b/pkgs/record_use/lib/src/data_classes/reference.dart new file mode 100644 index 00000000..367cacf7 --- /dev/null +++ b/pkgs/record_use/lib/src/data_classes/reference.dart @@ -0,0 +1,102 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'arguments.dart'; +import 'field.dart'; +import 'location.dart'; + +sealed class Reference { + final String? loadingUnit; + // Represents the "@" field in the JSON + + final Location location; + + const Reference({this.loadingUnit, required this.location}); + + Map toJson(List uris) => { + 'loadingUnit': loadingUnit, + '@': location.toJson(uris: uris), + }; + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is Reference && + other.loadingUnit == loadingUnit && + other.location == location; + } + + @override + int get hashCode => loadingUnit.hashCode ^ location.hashCode; +} + +final class CallReference extends Reference { + final Arguments? arguments; + + const CallReference({ + required this.arguments, + super.loadingUnit, + required super.location, + }); + + factory CallReference.fromJson(Map json, List uris) { + return CallReference( + arguments: json['arguments'] != null + ? Arguments.fromJson(json['arguments'] as Map) + : null, + loadingUnit: json['loadingUnit'] as String?, + location: + Location.fromJson(json['@'] as Map, null, uris), + ); + } + + @override + Map toJson(List uris) { + final argumentJson = arguments?.toJson() ?? {}; + return { + if (argumentJson.isNotEmpty) 'arguments': argumentJson, + ...super.toJson(uris), + }; + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is CallReference && other.arguments == arguments; + } + + @override + int get hashCode => arguments.hashCode; +} + +final class InstanceReference extends Reference { + final List fields; + + InstanceReference({ + super.loadingUnit, + required super.location, + required this.fields, + }); + + factory InstanceReference.fromJson( + Map json, List uris) { + return InstanceReference( + loadingUnit: json['loadingUnit'] as String?, + location: + Location.fromJson(json['@'] as Map, null, uris), + fields: (json['fields'] as List) + .map((fieldStr) => Field.fromJson(fieldStr as Map)) + .toList(), + ); + } + + @override + Map toJson(List uris) => { + if (fields.isNotEmpty) + 'fields': fields.map((field) => field.toJson()).toList(), + ...super.toJson(uris), + }; +} diff --git a/pkgs/record_use/lib/src/data_classes/usage.dart b/pkgs/record_use/lib/src/data_classes/usage.dart new file mode 100644 index 00000000..67abd498 --- /dev/null +++ b/pkgs/record_use/lib/src/data_classes/usage.dart @@ -0,0 +1,57 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; + +import 'definition.dart'; +import 'identifier.dart'; +import 'reference.dart'; + +class Usage { + final Definition definition; + final List references; + + Usage({ + required this.definition, + required this.references, + }); + + factory Usage.fromJson( + Map json, + List identifiers, + List uris, + T Function(Map, List) constr, + ) => + Usage( + definition: Definition.fromJson( + json['definition'] as Map, + identifiers, + ), + references: (json['references'] as List) + .map((x) => constr(x as Map, uris)) + .toList(), + ); + + Map toJson( + List identifiers, + List uris, + ) => + { + 'definition': definition.toJson(identifiers, uris), + 'references': references.map((x) => x.toJson(uris)).toList(), + }; + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + final listEquals = const DeepCollectionEquality().equals; + + return other is Usage && + other.definition == definition && + listEquals(other.references, references); + } + + @override + int get hashCode => definition.hashCode ^ references.hashCode; +} diff --git a/pkgs/record_use/lib/src/data_classes/usage_record.dart b/pkgs/record_use/lib/src/data_classes/usage_record.dart new file mode 100644 index 00000000..dd9371a1 --- /dev/null +++ b/pkgs/record_use/lib/src/data_classes/usage_record.dart @@ -0,0 +1,97 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; + +import 'identifier.dart'; +import 'metadata.dart'; +import 'reference.dart'; +import 'usage.dart'; + +class UsageRecord { + final Metadata metadata; + final List> calls; + final List> instances; + + UsageRecord({ + required this.metadata, + required this.calls, + required this.instances, + }); + + factory UsageRecord.fromJson(Map json) { + final uris = json['uris'] as List; + final identifiers = (json['ids'] as List) + .whereType>() + .map( + (e) => Identifier.fromJson(e, uris), + ) + .toList(); + return UsageRecord( + metadata: Metadata.fromJson(json['metadata'] as Map), + calls: (json['calls'] as List?) + ?.map((x) => Usage.fromJson( + x as Map, + identifiers, + uris, + CallReference.fromJson, + )) + .toList() ?? + [], + instances: (json['instances'] as List?) + ?.map((x) => Usage.fromJson( + x as Map, + identifiers, + uris, + InstanceReference.fromJson, + )) + .toList() ?? + [], + ); + } + + Map toJson() { + final identifiers = { + ...calls.map((call) => call.definition.identifier), + ...instances.map((instance) => instance.definition.identifier), + }.toList(); + final uris = { + ...identifiers.map((e) => e.uri), + ...calls.expand((call) => [ + call.definition.location.uri, + ...call.references.map((reference) => reference.location.uri), + ]), + ...instances.expand((instance) => [ + instance.definition.location.uri, + ...instance.references.map((reference) => reference.location.uri), + ]), + }.toList(); + return { + 'metadata': metadata.toJson(), + 'uris': uris, + 'ids': identifiers.map((identifier) => identifier.toJson(uris)).toList(), + if (calls.isNotEmpty) + 'calls': calls + .map((reference) => reference.toJson(identifiers, uris)) + .toList(), + if (instances.isNotEmpty) + 'instances': instances + .map((reference) => reference.toJson(identifiers, uris)) + .toList(), + }; + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + final listEquals = const DeepCollectionEquality().equals; + + return other is UsageRecord && + other.metadata == metadata && + listEquals(other.calls, calls); + } + + @override + int get hashCode => metadata.hashCode ^ calls.hashCode; +} diff --git a/pkgs/record_use/lib/src/record_use.dart b/pkgs/record_use/lib/src/record_use.dart new file mode 100644 index 00000000..ef52d5d6 --- /dev/null +++ b/pkgs/record_use/lib/src/record_use.dart @@ -0,0 +1,130 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:collection/collection.dart'; + +import 'data_classes/arguments.dart'; +import 'data_classes/field.dart'; +import 'data_classes/identifier.dart'; +import 'data_classes/metadata.dart'; +import 'data_classes/reference.dart'; +import 'data_classes/usage.dart'; +import 'data_classes/usage_record.dart'; + +extension type RecordUse._(UsageRecord _recordUses) { + RecordUse.fromJson(Map json) + : this._(UsageRecord.fromJson(json)); + + /// Show the metadata for this recording of usages. + Metadata get metadata => _recordUses.metadata; + + /// Finds all arguments for calls to the [definition]. + /// + /// The definition must be annotated with `@RecordUse()`. If there are no + /// calls to the definition, either because it was treeshaken, because it was + /// not annotated, or because it does not exist, returns `null`. + /// + /// Returns an empty iterable if the arguments were not collected. + /// + /// Example: + /// ```dart + /// import 'package:meta/meta.dart' show ResourceIdentifier; + /// void main() { + /// print(SomeClass.someStaticMethod(42)); + /// } + /// + /// class SomeClass { + /// @ResourceIdentifier('id') + /// static someStaticMethod(int i) { + /// return i + 1; + /// } + /// } + /// ``` + /// + /// Would mean that + /// ``` + /// argumentsForCallsTo(Identifier( + /// uri: 'path/to/file.dart', + /// parent: 'SomeClass', + /// name: 'someStaticMethod'), + /// ).first == + /// Arguments( + /// constArguments: ConstArguments(positional: {1: 42}), + /// ); + /// ``` + Iterable? callReferencesTo(Identifier definition) => + _callTo(definition) + ?.references + .map((reference) => reference.arguments) + .whereType(); + + /// Finds all fields of a const instance of the class at [definition]. + /// + /// The definition must be annotated with `@RecordUse()`. If there are + /// no instances of the definition, either because it was treeshaken, because + /// it was not annotated, or because it does not exist, returns `null`. + /// + /// The types of fields supported are defined at + /// TODO: insert reference to the supported field types for serialization + /// + /// Example: + /// ```dart + /// void main() { + /// print(SomeClass.someStaticMethod(42)); + /// } + /// + /// class SomeClass { + /// @AnnotationClass('freddie') + /// static someStaticMethod(int i) { + /// return i + 1; + /// } + /// } + /// + /// @ResourceIdentifier() + /// class AnnotationClass { + /// final String s; + /// const AnnotationClass(this.s); + /// } + /// ``` + /// + /// Would mean that + /// ``` + /// fieldsForConstructionOf(Identifier( + /// uri: 'path/to/file.dart', + /// name: 'AnnotationClass'), + /// ).first == + /// [ + /// Field(name: "s", className: "AnnotationClass", value: "freddie") + /// ]; + /// ``` + /// + /// What kinds of fields can be recorded depends on the implementation of + /// https://dart-review.googlesource.com/c/sdk/+/369620/13/pkg/vm/lib/transformations/record_use/record_instance.dart + Iterable>? instanceReferencesTo(Identifier definition) => + _recordUses.instances + .firstWhereOrNull( + (instance) => instance.definition.identifier == definition) + ?.references + .map((reference) => reference.fields); + + /// Checks if any call to [definition] has non-const arguments. + /// + /// The definition must be annotated with `@RecordUse()`. If there are no + /// calls to the definition, either because it was treeshaken, because it was + /// not annotated, or because it does not exist, returns `false`. + bool hasNonConstArguments(Identifier definition) => + _callTo(definition)?.references.any( + (reference) { + final nonConstArguments = reference.arguments?.nonConstArguments; + final hasNamed = nonConstArguments?.named.isNotEmpty ?? false; + final hasPositional = + nonConstArguments?.positional.isNotEmpty ?? false; + return hasNamed || hasPositional; + }, + ) ?? + false; + + Usage? _callTo(Identifier definition) => _recordUses.calls + .firstWhereOrNull((call) => call.definition.identifier == definition); +} diff --git a/pkgs/record_use/pubspec.yaml b/pkgs/record_use/pubspec.yaml new file mode 100644 index 00000000..03d8b327 --- /dev/null +++ b/pkgs/record_use/pubspec.yaml @@ -0,0 +1,16 @@ +name: record_use +description: > + The serialization logic and API for the usage recording SDK feature. +repository: https://github.com/mosuem/record_use +version: 0.1.0 +environment: + sdk: ^3.4.0 + +dependencies: + collection: ^1.18.0 + pub_semver: ^2.1.4 + +dev_dependencies: + dart_flutter_team_lints: ^3.1.0 + lints: ^4.0.0 + test: ^1.24.0 diff --git a/pkgs/record_use/test/record_use_test.dart b/pkgs/record_use/test/record_use_test.dart new file mode 100644 index 00000000..2adbfb1f --- /dev/null +++ b/pkgs/record_use/test/record_use_test.dart @@ -0,0 +1,208 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:pub_semver/pub_semver.dart'; +import 'package:record_use/record_use.dart'; +import 'package:record_use/record_use_internal.dart'; +import 'package:test/test.dart'; + +void main() { + test('Json->Object->Json', () { + expect(UsageRecord.fromJson(recordedUsesJson).toJson(), recordedUsesJson); + }); + test('Object->Json->Object', () { + expect(UsageRecord.fromJson(recordedUses.toJson()), recordedUses); + }); + + test('API calls', () { + expect( + RecordUse.fromJson(recordedUsesJson).callReferencesTo(callId), + recordedUses.calls.expand((e) => e.references).map((e) => e.arguments), + ); + }); + test('API instances', () { + expect( + RecordUse.fromJson(recordedUsesJson).instanceReferencesTo(instanceId), + recordedUses.instances.expand((e) => e.references).map((e) => e.fields), + ); + }); +} + +final callId = Identifier( + uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') + .toString(), + parent: 'MyClass', + name: 'get:loadDeferredLibrary', +); +final instanceId = Identifier( + uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') + .toString(), + name: 'MyAnnotation', +); + +final recordedUses = UsageRecord( + metadata: Metadata( + version: Version(1, 6, 2, pre: 'wip', build: '5.-.2.z'), + comment: + 'Recorded references at compile time and their argument values, as far' + ' as known, to definitions annotated with @RecordReference', + ), + instances: [ + Usage( + definition: Definition( + identifier: instanceId, + location: Location( + uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') + .toString(), + line: 15, + column: 30, + ), + ), + references: [ + InstanceReference( + location: Location( + uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') + .toString(), + line: 40, + column: 30, + ), + fields: [ + Field( + className: 'className', + name: 'a', + value: 42, + ), + ], + loadingUnit: '3', + ), + ], + ), + ], + calls: [ + Usage( + definition: Definition( + identifier: callId, + location: Location( + uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') + .toString(), + line: 12, + column: 67, + ), + loadingUnit: 'part_15.js', + ), + references: [ + CallReference( + arguments: Arguments( + constArguments: ConstArguments( + positional: {0: 'lib_SHA1', 1: false, 2: 1}, + named: {'leroy': 'jenkins', 'freddy': 'mercury'}, + ), + ), + location: Location( + uri: Uri.parse( + 'file://benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart') + .toString(), + line: 14, + column: 49, + ), + loadingUnit: 'o.js', + ), + CallReference( + arguments: Arguments( + constArguments: ConstArguments( + positional: {0: 'lib_SHA1', 2: 0}, + named: {'leroy': 'jenkins'}, + ), + nonConstArguments: NonConstArguments( + positional: [1], + named: ['freddy'], + ), + ), + location: Location( + uri: Uri.parse( + 'file://benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart') + .toString(), + line: 14, + column: 48, + ), + loadingUnit: 'o.js', + ), + ], + ), + ], +); + +final recordedUsesJson = { + 'metadata': { + 'comment': + 'Recorded references at compile time and their argument values, as far' + ' as known, to definitions annotated with @RecordReference', + 'version': '1.6.2-wip+5.-.2.z' + }, + 'uris': [ + 'file://lib/_internal/js_runtime/lib/js_helper.dart', + 'file://benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart' + ], + 'ids': [ + {'uri': 0, 'parent': 'MyClass', 'name': 'get:loadDeferredLibrary'}, + {'uri': 0, 'name': 'MyAnnotation'} + ], + 'calls': [ + { + 'definition': { + 'id': 0, + '@': {'line': 12, 'column': 67}, + 'loadingUnit': 'part_15.js' + }, + 'references': [ + { + 'arguments': { + 'const': { + 'positional': {'0': 'lib_SHA1', '1': false, '2': 1}, + 'named': {'leroy': 'jenkins', 'freddy': 'mercury'} + } + }, + 'loadingUnit': 'o.js', + '@': {'uri': 1, 'line': 14, 'column': 49} + }, + { + 'arguments': { + 'const': { + 'positional': {'0': 'lib_SHA1', '2': 0}, + 'named': {'leroy': 'jenkins'} + }, + 'nonConst': { + 'positional': [1], + 'named': ['freddy'] + } + }, + 'loadingUnit': 'o.js', + '@': {'uri': 1, 'line': 14, 'column': 48} + } + ] + } + ], + 'instances': [ + { + 'definition': { + 'id': 1, + '@': {'line': 15, 'column': 30}, + 'loadingUnit': null + }, + 'references': [ + { + 'fields': [ + { + 'className': 'className', + 'name': 'a', + 'value': 42, + } + ], + 'loadingUnit': '3', + '@': {'uri': 0, 'line': 40, 'column': 30} + } + ] + } + ] +}; From c2a913022c9aa5e8a5741f6ce045a7e2a56977a0 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 11 Jun 2024 14:17:36 +0200 Subject: [PATCH 02/23] Add workflows --- .github/workflows/native.yaml | 182 ++++++++++++++++++++++++++ .github/workflows/post_summaries.yaml | 17 +++ .github/workflows/record_use.yaml | 43 ++++++ README.md | 2 +- 4 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/native.yaml create mode 100644 .github/workflows/post_summaries.yaml create mode 100644 .github/workflows/record_use.yaml diff --git a/.github/workflows/native.yaml b/.github/workflows/native.yaml new file mode 100644 index 00000000..e710f842 --- /dev/null +++ b/.github/workflows/native.yaml @@ -0,0 +1,182 @@ +# CI for the native_* packages. +# +# Combined into a single workflow so that deps are configured and installed once. + +name: native +permissions: read-all + +on: + pull_request: + branches: [main] + paths: + - ".github/workflows/native.yaml" + - "pkgs/native_assets_builder/**" + - "pkgs/native_assets_cli/**" + - "pkgs/native_toolchain_c/**" + - "tools/**" + push: + branches: [main] + paths: + - ".github/workflows/native.yaml" + - "pkgs/native_assets_builder/**" + - "pkgs/native_assets_cli/**" + - "pkgs/native_toolchain_c/**" + - "tools/**" + schedule: + - cron: "0 0 * * 0" # weekly + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu, macos, windows] + # TODO(https://github.com/dart-lang/native/issues/1154): Use 'stable' instead of 3.3.0. + sdk: [stable, 3.3.0, dev] + package: [native_assets_builder, native_assets_cli, native_toolchain_c] + # Breaking changes temporarily break the example run on the Dart SDK until native_assets_builder is rolled into the Dart SDK dev build. + breaking-change: [false] + exclude: + # Only run analyze against dev on one host. + - os: macos + sdk: dev + - os: windows + sdk: dev + # TODO(https://github.com/dart-lang/native/issues/1154): Use 'stable' instead of 3.3.0. + - os: macos + sdk: 3.3.0 + - os: ubuntu + sdk: 3.3.0 + - os: windows + sdk: stable + + runs-on: ${{ matrix.os }}-latest + + defaults: + run: + working-directory: pkgs/${{ matrix.package }} + + steps: + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + + - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 + with: + sdk: ${{ matrix.sdk }} + + - uses: nttld/setup-ndk@6a7e9c5494a25c4842ca1011f710300132eacd94 + with: + ndk-version: r26b + if: ${{ (matrix.sdk == 'stable' || matrix.sdk == '3.3.0') && matrix.os != 'macos' }} + + - run: dart pub get + + - run: dart pub get -C test_data/dart_app/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/native_add/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/native_add_v1_0_0/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/native_add_add_source/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/native_subtract/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/package_reading_metadata/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/package_with_metadata/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/simple_link/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/complex_link/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/complex_link_helper/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/drop_dylib_link/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C test_data/add_asset_link/ + if: ${{ matrix.package == 'native_assets_builder' }} + + - run: dart pub get -C example/build/native_add_app/ + if: ${{ matrix.package == 'native_assets_cli' }} + + - run: dart pub get -C example/build/native_add_library/ + if: ${{ matrix.package == 'native_assets_cli' }} + + - run: dart pub get -C example/build/use_dart_api/ + if: ${{ matrix.package == 'native_assets_cli' }} + + - run: dart pub get -C example/link/package_with_assets/ + if: ${{ matrix.package == 'native_assets_cli' }} + + - run: dart pub get -C example/link/app_with_asset_treeshaking/ + if: ${{ matrix.package == 'native_assets_cli' }} + + - run: dart analyze --fatal-infos + # Run on dev to ensure we're not depending on deprecated SDK things. + + - run: dart format --output=none --set-exit-if-changed . + if: ${{ (matrix.sdk == 'stable' || matrix.sdk == '3.3.0') }} + + - name: Install native toolchains + run: sudo apt-get update && sudo apt-get install clang-15 gcc-i686-linux-gnu gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-riscv64-linux-gnu + if: ${{ (matrix.sdk == 'stable' || matrix.sdk == '3.3.0') && matrix.os == 'ubuntu' }} + + - run: dart test + if: ${{ (matrix.sdk == 'stable' || matrix.sdk == '3.3.0') }} + + - run: dart --enable-experiment=native-assets test + working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/ + if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }} + + - run: dart --enable-experiment=native-assets run + working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/ + if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }} + + - run: dart --enable-experiment=native-assets build bin/native_add_app.dart + working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/ + if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }} + + - run: ./native_add_app.exe + working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/bin/native_add_app/ + if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }} + + - run: dart --enable-experiment=native-assets test + working-directory: pkgs/${{ matrix.package }}/example/build/use_dart_api/ + if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }} + + - name: Install coverage + run: dart pub global activate coverage + if: ${{ matrix.sdk == 'stable' || matrix.sdk == '3.3.0' }} + + - name: Collect coverage + run: dart pub global run coverage:test_with_coverage + if: ${{ matrix.sdk == 'stable' || matrix.sdk == '3.3.0' }} + + - name: Upload coverage + uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 + with: + flag-name: ${{ matrix.package }}_${{ matrix.os }} + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel: true + if: ${{ matrix.sdk == 'stable' || matrix.sdk == '3.3.0' }} + + coverage-finished: + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Upload coverage + uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 + with: + carryforward: "ffigen,jni,jnigen,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows,objective_c" + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/post_summaries.yaml b/.github/workflows/post_summaries.yaml new file mode 100644 index 00000000..8697d74a --- /dev/null +++ b/.github/workflows/post_summaries.yaml @@ -0,0 +1,17 @@ +name: Comment on the pull request + +on: + # Trigger this workflow after the Health workflow completes. This workflow will have permissions to + # do things like create comments on the PR, even if the original workflow couldn't. + workflow_run: + workflows: + - Health + - Publish + types: + - completed + +jobs: + upload: + uses: dart-lang/ecosystem/.github/workflows/post_summaries.yaml@main + permissions: + pull-requests: write diff --git a/.github/workflows/record_use.yaml b/.github/workflows/record_use.yaml new file mode 100644 index 00000000..d49561f9 --- /dev/null +++ b/.github/workflows/record_use.yaml @@ -0,0 +1,43 @@ +name: record_use +permissions: read-all + +on: + pull_request: + branches: [ main ] + paths: + - .github/workflows/record_use.yaml + - pkgs/record_use/** + push: + branches: [ main ] + paths: + - .github/workflows/record_use.yaml + - pkgs/record_use/** + schedule: + - cron: '0 0 * * 0' # weekly + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: pkgs/record_use/ + strategy: + matrix: + sdk: [stable, dev] + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 + with: + sdk: ${{matrix.sdk}} + + - run: dart pub get + + - run: dart analyze --fatal-infos + + - run: dart format --output=none --set-exit-if-changed . + + - run: dart test + + - name: Run Chrome tests - wasm + run: dart test --platform chrome --compiler dart2wasm + if: always() && matrix.sdk == 'dev' diff --git a/README.md b/README.md index 2fbc6037..411a98e0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This repository is home to various Dart packages under the [dart.dev](https://pu ## Packages | Package | Description | Version | -|---|---|---| +|[`record_use`](pkgs/record_use/)| The serialization logic and API for the usage recording SDK feature.|[![pub package](https://img.shields.io/pub/v/record_use.svg)](https://pub.dev/packages/record_use)| ## Publishing automation From 33d1849ba774098fb92c7466c5d8d0eebe0aabd1 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 11 Jun 2024 14:21:45 +0200 Subject: [PATCH 03/23] Add health workflow --- .github/workflows/health.yaml | 17 ++++ .github/workflows/native.yaml | 182 ---------------------------------- 2 files changed, 17 insertions(+), 182 deletions(-) create mode 100644 .github/workflows/health.yaml delete mode 100644 .github/workflows/native.yaml diff --git a/.github/workflows/health.yaml b/.github/workflows/health.yaml new file mode 100644 index 00000000..2286be59 --- /dev/null +++ b/.github/workflows/health.yaml @@ -0,0 +1,17 @@ +name: Health +on: + pull_request: + branches: [ main ] + paths: + - .github/workflows/record_use.yaml + - pkgs/record_use/** + types: [opened, synchronize, reopened, labeled, unlabeled] +jobs: + health: + uses: dart-lang/ecosystem/.github/workflows/health.yaml@main + with: + coverage_web: false + checks: "version,changelog,license,do-not-submit,breaking,coverage" + sdk: master + permissions: + pull-requests: write diff --git a/.github/workflows/native.yaml b/.github/workflows/native.yaml deleted file mode 100644 index e710f842..00000000 --- a/.github/workflows/native.yaml +++ /dev/null @@ -1,182 +0,0 @@ -# CI for the native_* packages. -# -# Combined into a single workflow so that deps are configured and installed once. - -name: native -permissions: read-all - -on: - pull_request: - branches: [main] - paths: - - ".github/workflows/native.yaml" - - "pkgs/native_assets_builder/**" - - "pkgs/native_assets_cli/**" - - "pkgs/native_toolchain_c/**" - - "tools/**" - push: - branches: [main] - paths: - - ".github/workflows/native.yaml" - - "pkgs/native_assets_builder/**" - - "pkgs/native_assets_cli/**" - - "pkgs/native_toolchain_c/**" - - "tools/**" - schedule: - - cron: "0 0 * * 0" # weekly - -jobs: - build: - strategy: - fail-fast: false - matrix: - os: [ubuntu, macos, windows] - # TODO(https://github.com/dart-lang/native/issues/1154): Use 'stable' instead of 3.3.0. - sdk: [stable, 3.3.0, dev] - package: [native_assets_builder, native_assets_cli, native_toolchain_c] - # Breaking changes temporarily break the example run on the Dart SDK until native_assets_builder is rolled into the Dart SDK dev build. - breaking-change: [false] - exclude: - # Only run analyze against dev on one host. - - os: macos - sdk: dev - - os: windows - sdk: dev - # TODO(https://github.com/dart-lang/native/issues/1154): Use 'stable' instead of 3.3.0. - - os: macos - sdk: 3.3.0 - - os: ubuntu - sdk: 3.3.0 - - os: windows - sdk: stable - - runs-on: ${{ matrix.os }}-latest - - defaults: - run: - working-directory: pkgs/${{ matrix.package }} - - steps: - - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - - - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: ${{ matrix.sdk }} - - - uses: nttld/setup-ndk@6a7e9c5494a25c4842ca1011f710300132eacd94 - with: - ndk-version: r26b - if: ${{ (matrix.sdk == 'stable' || matrix.sdk == '3.3.0') && matrix.os != 'macos' }} - - - run: dart pub get - - - run: dart pub get -C test_data/dart_app/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C test_data/native_add/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C test_data/native_add_v1_0_0/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C test_data/native_add_add_source/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C test_data/native_subtract/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C test_data/package_reading_metadata/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C test_data/package_with_metadata/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C test_data/simple_link/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C test_data/complex_link/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C test_data/complex_link_helper/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C test_data/drop_dylib_link/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C test_data/add_asset_link/ - if: ${{ matrix.package == 'native_assets_builder' }} - - - run: dart pub get -C example/build/native_add_app/ - if: ${{ matrix.package == 'native_assets_cli' }} - - - run: dart pub get -C example/build/native_add_library/ - if: ${{ matrix.package == 'native_assets_cli' }} - - - run: dart pub get -C example/build/use_dart_api/ - if: ${{ matrix.package == 'native_assets_cli' }} - - - run: dart pub get -C example/link/package_with_assets/ - if: ${{ matrix.package == 'native_assets_cli' }} - - - run: dart pub get -C example/link/app_with_asset_treeshaking/ - if: ${{ matrix.package == 'native_assets_cli' }} - - - run: dart analyze --fatal-infos - # Run on dev to ensure we're not depending on deprecated SDK things. - - - run: dart format --output=none --set-exit-if-changed . - if: ${{ (matrix.sdk == 'stable' || matrix.sdk == '3.3.0') }} - - - name: Install native toolchains - run: sudo apt-get update && sudo apt-get install clang-15 gcc-i686-linux-gnu gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-riscv64-linux-gnu - if: ${{ (matrix.sdk == 'stable' || matrix.sdk == '3.3.0') && matrix.os == 'ubuntu' }} - - - run: dart test - if: ${{ (matrix.sdk == 'stable' || matrix.sdk == '3.3.0') }} - - - run: dart --enable-experiment=native-assets test - working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/ - if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }} - - - run: dart --enable-experiment=native-assets run - working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/ - if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }} - - - run: dart --enable-experiment=native-assets build bin/native_add_app.dart - working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/ - if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }} - - - run: ./native_add_app.exe - working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/bin/native_add_app/ - if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }} - - - run: dart --enable-experiment=native-assets test - working-directory: pkgs/${{ matrix.package }}/example/build/use_dart_api/ - if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }} - - - name: Install coverage - run: dart pub global activate coverage - if: ${{ matrix.sdk == 'stable' || matrix.sdk == '3.3.0' }} - - - name: Collect coverage - run: dart pub global run coverage:test_with_coverage - if: ${{ matrix.sdk == 'stable' || matrix.sdk == '3.3.0' }} - - - name: Upload coverage - uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 - with: - flag-name: ${{ matrix.package }}_${{ matrix.os }} - github-token: ${{ secrets.GITHUB_TOKEN }} - parallel: true - if: ${{ matrix.sdk == 'stable' || matrix.sdk == '3.3.0' }} - - coverage-finished: - needs: [build] - runs-on: ubuntu-latest - steps: - - name: Upload coverage - uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 - with: - carryforward: "ffigen,jni,jnigen,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows,objective_c" - github-token: ${{ secrets.GITHUB_TOKEN }} - parallel-finished: true From bf0c843fd1626c5ae2314a2e2bb7c78507aa9b93 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 12 Jun 2024 09:59:41 +0200 Subject: [PATCH 04/23] Delete old workflows --- pkgs/record_use/.github/workflows/test.yaml | 34 --------------------- 1 file changed, 34 deletions(-) delete mode 100644 pkgs/record_use/.github/workflows/test.yaml diff --git a/pkgs/record_use/.github/workflows/test.yaml b/pkgs/record_use/.github/workflows/test.yaml deleted file mode 100644 index 090666b7..00000000 --- a/pkgs/record_use/.github/workflows/test.yaml +++ /dev/null @@ -1,34 +0,0 @@ -name: test -permissions: read-all - -on: - pull_request: - branches: [ main ] - push: - branches: [ main ] - schedule: - - cron: '0 0 * * 0' # weekly - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - sdk: [stable, dev] - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 - with: - sdk: ${{matrix.sdk}} - - - run: dart pub get - - - run: dart analyze --fatal-infos - - - run: dart format --output=none --set-exit-if-changed . - - - run: dart test - - - name: Run Chrome tests - wasm - run: dart test --platform chrome --compiler dart2wasm - if: always() && matrix.sdk == 'dev' From adc5640876e4c5cabdcd1103bfc698d0160bc6e7 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 12 Jun 2024 10:01:00 +0200 Subject: [PATCH 05/23] update setup dart --- .github/workflows/record_use.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/record_use.yaml b/.github/workflows/record_use.yaml index d49561f9..7a1512ae 100644 --- a/.github/workflows/record_use.yaml +++ b/.github/workflows/record_use.yaml @@ -26,7 +26,7 @@ jobs: sdk: [stable, dev] steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 + - uses: dart-lang/setup-dart@2986c8e337a31eb7b455ce93dc984e9bf5797756 with: sdk: ${{matrix.sdk}} From c715a659cf61eee169d18a415ea5d6e270b75739 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 18 Jun 2024 13:23:52 +0200 Subject: [PATCH 06/23] First attempt --- .../lib/src/data_classes/arguments.dart | 120 +- .../lib/src/data_classes/definition.dart | 55 +- .../lib/src/data_classes/field.dart | 49 +- .../lib/src/data_classes/identifier.dart | 49 +- .../lib/src/data_classes/location.dart | 39 +- .../lib/src/data_classes/metadata.dart | 40 +- .../lib/src/data_classes/reference.dart | 87 +- .../lib/src/data_classes/usage.dart | 61 +- .../lib/src/data_classes/usage_record.dart | 98 +- .../lib/src/proto/read/usages.pb.dart | 1037 ++++++++++++++++ .../lib/src/proto/read/usages.pbenum.dart | 11 + .../lib/src/proto/read/usages.pbjson.dart | 265 +++++ .../lib/src/proto/read/usages.pbserver.dart | 14 + .../src/proto/storage/usages_storage.pb.dart | 1047 +++++++++++++++++ .../proto/storage/usages_storage.pbenum.dart | 11 + .../proto/storage/usages_storage.pbjson.dart | 267 +++++ .../storage/usages_storage.pbserver.dart | 14 + pkgs/record_use/lib/src/record_use.dart | 8 +- pkgs/record_use/pubspec.yaml | 1 + pkgs/record_use/test/record_use_test.dart | 34 +- pkgs/record_use/usages.proto | 86 ++ pkgs/record_use/usages_storage.proto | 88 ++ 22 files changed, 3057 insertions(+), 424 deletions(-) create mode 100644 pkgs/record_use/lib/src/proto/read/usages.pb.dart create mode 100644 pkgs/record_use/lib/src/proto/read/usages.pbenum.dart create mode 100644 pkgs/record_use/lib/src/proto/read/usages.pbjson.dart create mode 100644 pkgs/record_use/lib/src/proto/read/usages.pbserver.dart create mode 100644 pkgs/record_use/lib/src/proto/storage/usages_storage.pb.dart create mode 100644 pkgs/record_use/lib/src/proto/storage/usages_storage.pbenum.dart create mode 100644 pkgs/record_use/lib/src/proto/storage/usages_storage.pbjson.dart create mode 100644 pkgs/record_use/lib/src/proto/storage/usages_storage.pbserver.dart create mode 100644 pkgs/record_use/usages.proto create mode 100644 pkgs/record_use/usages_storage.proto diff --git a/pkgs/record_use/lib/src/data_classes/arguments.dart b/pkgs/record_use/lib/src/data_classes/arguments.dart index 1f681dc4..ca6e5627 100644 --- a/pkgs/record_use/lib/src/data_classes/arguments.dart +++ b/pkgs/record_use/lib/src/data_classes/arguments.dart @@ -2,122 +2,66 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:collection/collection.dart'; +import '../proto/usages.pb.dart' as pb; class Arguments { - ConstArguments constArguments; - NonConstArguments nonConstArguments; - - Arguments({ - ConstArguments? constArguments, - NonConstArguments? nonConstArguments, - }) : constArguments = constArguments ?? ConstArguments(), - nonConstArguments = nonConstArguments ?? NonConstArguments(); - - factory Arguments.fromJson(Map json) { - final constJson = json['const'] as Map?; - final nonConstJson = json['nonConst'] as Map?; - return Arguments( - constArguments: - constJson != null ? ConstArguments.fromJson(constJson) : null, - nonConstArguments: nonConstJson != null - ? NonConstArguments.fromJson(nonConstJson) - : null, - ); - } + final pb.Arguments _arguments; - Map toJson() { - final hasConst = - constArguments.named.isNotEmpty || constArguments.positional.isNotEmpty; - final hasNonConst = nonConstArguments.named.isNotEmpty || - nonConstArguments.positional.isNotEmpty; - return { - if (hasConst) 'const': constArguments.toJson(), - if (hasNonConst) 'nonConst': nonConstArguments.toJson(), - }; - } + late final ConstArguments constArguments = _arguments.hasConst_1() + ? ConstArguments(_arguments.const_1) + : ConstArguments(); + late final NonConstArguments nonConstArguments = _arguments.hasNonConst() + ? NonConstArguments(_arguments.nonConst) + : NonConstArguments(); + + Arguments(this._arguments); + + @override + int get hashCode => _arguments.hashCode; @override bool operator ==(Object other) { if (identical(this, other)) return true; - return other is Arguments && - other.constArguments == constArguments && - other.nonConstArguments == nonConstArguments; + return other is Arguments && other._arguments == _arguments; } - - @override - int get hashCode => constArguments.hashCode ^ nonConstArguments.hashCode; } class ConstArguments { - Map positional; - Map named; - - ConstArguments({Map? positional, Map? named}) - : named = named ?? {}, - positional = positional ?? {}; - - factory ConstArguments.fromJson(Map json) => ConstArguments( - positional: json['positional'] != null - ? (json['positional'] as Map) - .map((key, value) => MapEntry(int.parse(key), value)) - : {}, - named: - json['named'] != null ? json['named'] as Map : {}, - ); - - Map toJson() => { - if (positional.isNotEmpty) - 'positional': - positional.map((key, value) => MapEntry(key.toString(), value)), - if (named.isNotEmpty) 'named': named, - }; + final pb.ConstArguments? _arguments; + + late final Map positional = _arguments?.positional ?? {}; + late final Map named = _arguments?.named ?? {}; + + ConstArguments([this._arguments]); + + @override + int get hashCode => positional.hashCode ^ named.hashCode; @override bool operator ==(Object other) { if (identical(this, other)) return true; - final mapEquals = const DeepCollectionEquality().equals; - return other is ConstArguments && - mapEquals(other.positional, positional) && - mapEquals(other.named, named); + return other is ConstArguments && other._arguments == _arguments; } - - @override - int get hashCode => positional.hashCode ^ named.hashCode; } class NonConstArguments { - List positional; - List named; // Assuming named arguments are strings (keys) + final pb.NonConstArguments? _arguments; + late final List positional = _arguments?.positional ?? []; - NonConstArguments({List? positional, List? named}) - : named = named ?? [], - positional = positional ?? []; + /// Assuming named arguments are strings (keys) + late final List named = _arguments?.named ?? []; - factory NonConstArguments.fromJson(Map json) => - NonConstArguments( - positional: - json['positional'] != null ? json['positional'] as List : [], - named: json['named'] != null ? json['named'] as List : [], - ); + NonConstArguments([this._arguments]); - Map toJson() => { - if (positional.isNotEmpty) 'positional': positional, - if (named.isNotEmpty) 'named': named, - }; + @override + int get hashCode => _arguments.hashCode; @override bool operator ==(Object other) { if (identical(this, other)) return true; - final listEquals = const DeepCollectionEquality().equals; - return other is NonConstArguments && - listEquals(other.positional, positional) && - listEquals(other.named, named); + return other is NonConstArguments && other._arguments == _arguments; } - - @override - int get hashCode => positional.hashCode ^ named.hashCode; } diff --git a/pkgs/record_use/lib/src/data_classes/definition.dart b/pkgs/record_use/lib/src/data_classes/definition.dart index 06c811d1..2f64746d 100644 --- a/pkgs/record_use/lib/src/data_classes/definition.dart +++ b/pkgs/record_use/lib/src/data_classes/definition.dart @@ -2,55 +2,34 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import '../proto/usages.pb.dart' as pb; import 'identifier.dart'; import 'location.dart'; class Definition { - final Identifier identifier; - final Location location; // Represents the '@' field in the JSON - final String? loadingUnit; - - Definition({ - required this.identifier, - required this.location, - this.loadingUnit, - }); - - factory Definition.fromJson( - Map json, - List identifiers, - ) { - final identifier = identifiers[json['id'] as int]; - return Definition( - identifier: identifier, - location: Location.fromJson( - json['@'] as Map, - identifier.uri, - null, - ), - loadingUnit: json['loadingUnit'] as String?, - ); - } + final pb.Definition _definition; + final List _identifiers; + final List _uris; + + late final Identifier identifier = + Identifier.fromPb(_identifiers[_definition.identifier], _uris); + + /// Represents the '@' field in the JSON + late final Location location = + Location(_definition.location, identifier.uri, null); + + late final String? loadingUnit = + _definition.hasLoadingUnit() ? _definition.loadingUnit : null; - Map toJson( - List identifiers, - List uris, - ) => - { - 'id': identifiers.indexOf(identifier), - '@': location.toJson(), - 'loadingUnit': loadingUnit, - }; + Definition(this._definition, this._identifiers, this._uris); @override bool operator ==(Object other) { if (identical(this, other)) return true; - return other is Definition && - other.identifier == identifier && - other.loadingUnit == loadingUnit; + return other is Definition && other._definition == _definition; } @override - int get hashCode => identifier.hashCode ^ loadingUnit.hashCode; + int get hashCode => _definition.hashCode; } diff --git a/pkgs/record_use/lib/src/data_classes/field.dart b/pkgs/record_use/lib/src/data_classes/field.dart index 13e7b5c3..ceae5544 100644 --- a/pkgs/record_use/lib/src/data_classes/field.dart +++ b/pkgs/record_use/lib/src/data_classes/field.dart @@ -2,43 +2,30 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -class Field { - final String className; - final String name; - final Object? value; +import '../proto/usages.pb.dart' as pb; - Field({ - required this.className, - required this.name, - required this.value, - }); +class Field { + final pb.Field _field; - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; + late final String className = _field.className; + late final String name = _field.name; + late final Object? value = switch (_field.value.whichValue()) { + pb.FieldValue_Value.intValue => _field.value.intValue, + pb.FieldValue_Value.doubleValue => _field.value.doubleValue, + pb.FieldValue_Value.boolValue => _field.value.boolValue, + pb.FieldValue_Value.stringValue => _field.value.stringValue, + pb.FieldValue_Value.notSet => throw UnimplementedError(), + }; - return other is Field && - other.className == className && - other.name == name && - other.value == value; - } + Field(this._field); @override - int get hashCode => className.hashCode ^ name.hashCode ^ value.hashCode; + int get hashCode => _field.hashCode; - Map toJson() { - return { - 'className': className, - 'name': name, - 'value': value, - }; - } + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; - factory Field.fromJson(Map map) { - return Field( - className: map['className'] as String, - name: map['name'] as String, - value: map['value'], - ); + return other is Field && other._field == _field; } } diff --git a/pkgs/record_use/lib/src/data_classes/identifier.dart b/pkgs/record_use/lib/src/data_classes/identifier.dart index e5737e33..053d3106 100644 --- a/pkgs/record_use/lib/src/data_classes/identifier.dart +++ b/pkgs/record_use/lib/src/data_classes/identifier.dart @@ -2,40 +2,35 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import '../proto/usages.pb.dart' as pb; + class Identifier { - String uri; - String? parent; // Optional since not all elements have parents - String name; - - Identifier({ - required this.uri, - this.parent, - required this.name, - }); - - factory Identifier.fromJson(Map json, List uris) => - Identifier( - uri: uris[json['uri'] as int], - parent: json['parent'] as String?, - name: json['name'] as String, - ); - - Map toJson(List uris) => { - 'uri': uris.indexOf(uri), - if (parent != null) 'parent': parent, - 'name': name, - }; + final pb.Identifier _identifier; + + final String uri; + + /// Optional since not all elements have parents + late final String? parent = + _identifier.hasParent() ? _identifier.parent : null; + late final String name = _identifier.name; + + Identifier.fromPb(this._identifier, List uris) + : uri = uris[_identifier.uri]; + + Identifier(this.uri, String? parent, String name) + : _identifier = pb.Identifier( + name: name, + parent: parent, + uri: uri, + ); @override bool operator ==(Object other) { if (identical(this, other)) return true; - return other is Identifier && - other.uri == uri && - other.parent == parent && - other.name == name; + return other is Identifier && other._identifier == _identifier; } @override - int get hashCode => uri.hashCode ^ parent.hashCode ^ name.hashCode; + int get hashCode => _identifier.hashCode; } diff --git a/pkgs/record_use/lib/src/data_classes/location.dart b/pkgs/record_use/lib/src/data_classes/location.dart index 6cd9d88d..56cfc325 100644 --- a/pkgs/record_use/lib/src/data_classes/location.dart +++ b/pkgs/record_use/lib/src/data_classes/location.dart @@ -2,43 +2,24 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -class Location { - String uri; - int line; - int column; - Location({ - required this.uri, - required this.line, - required this.column, - }); +import '../proto/usages.pb.dart' as pb; - factory Location.fromJson( - Map map, String? uri, List? uris) { - return Location( - uri: uri ?? uris![map['uri'] as int], - line: map['line'] as int, - column: map['column'] as int, - ); - } +class Location { + late String uri; + late int line; + late int column; - Map toJson({List? uris}) { - return { - if (uris != null) 'uri': uris.indexOf(uri), - 'line': line, - 'column': column, - }; - } + final pb.Location _protoLocation; + Location(this._protoLocation, String? uri, List? uris) + : uri = uri ?? uris![_protoLocation.uri]; @override bool operator ==(Object other) { if (identical(this, other)) return true; - return other is Location && - other.uri == uri && - other.line == line && - other.column == column; + return other is Location && other._protoLocation == _protoLocation; } @override - int get hashCode => uri.hashCode ^ line.hashCode ^ column.hashCode; + int get hashCode => _protoLocation.hashCode; } diff --git a/pkgs/record_use/lib/src/data_classes/metadata.dart b/pkgs/record_use/lib/src/data_classes/metadata.dart index d2aee07b..635835f3 100644 --- a/pkgs/record_use/lib/src/data_classes/metadata.dart +++ b/pkgs/record_use/lib/src/data_classes/metadata.dart @@ -4,46 +4,26 @@ import 'package:pub_semver/pub_semver.dart'; -class Metadata { - final String? comment; - final Version version; - - Metadata({ - this.comment, - required this.version, - }); +import '../proto/usages.pb.dart' as pb; - factory Metadata.fromJson(Map json) => Metadata( - comment: json['comment'] as String?, - version: Version.parse(json['version'] as String), - ); +class Metadata { + final pb.Metadata _protoMetadata; + late final String? comment = _protoMetadata.comment; + late final Version version = Version.parse(_protoMetadata.version); - Map toJson() => { - if (comment != null) 'comment': comment, - 'version': version.toString(), - }; + Metadata({required pb.Metadata protoMetadata}) + : _protoMetadata = protoMetadata; @override bool operator ==(Object other) { if (identical(this, other)) return true; - return other is Metadata && - other.comment == comment && - other.version == version; + return other is Metadata && other._protoMetadata == _protoMetadata; } @override - int get hashCode { - return comment.hashCode ^ version.hashCode; - } + int get hashCode => _protoMetadata.hashCode; @override - String toString() { - return ''' -Metadata( - comment: $comment, - version: $version, -) -'''; - } + String toString() => _protoMetadata.toString(); } diff --git a/pkgs/record_use/lib/src/data_classes/reference.dart b/pkgs/record_use/lib/src/data_classes/reference.dart index 367cacf7..f3048304 100644 --- a/pkgs/record_use/lib/src/data_classes/reference.dart +++ b/pkgs/record_use/lib/src/data_classes/reference.dart @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import '../proto/usages.pb.dart' as pb; import 'arguments.dart'; import 'field.dart'; import 'location.dart'; @@ -14,11 +15,6 @@ sealed class Reference { const Reference({this.loadingUnit, required this.location}); - Map toJson(List uris) => { - 'loadingUnit': loadingUnit, - '@': location.toJson(uris: uris), - }; - @override bool operator ==(Object other) { if (identical(this, other)) return true; @@ -33,70 +29,49 @@ sealed class Reference { } final class CallReference extends Reference { - final Arguments? arguments; - - const CallReference({ - required this.arguments, - super.loadingUnit, - required super.location, - }); - - factory CallReference.fromJson(Map json, List uris) { - return CallReference( - arguments: json['arguments'] != null - ? Arguments.fromJson(json['arguments'] as Map) - : null, - loadingUnit: json['loadingUnit'] as String?, - location: - Location.fromJson(json['@'] as Map, null, uris), - ); - } + final pb.Reference _reference; - @override - Map toJson(List uris) { - final argumentJson = arguments?.toJson() ?? {}; - return { - if (argumentJson.isNotEmpty) 'arguments': argumentJson, - ...super.toJson(uris), - }; - } + late final Arguments? arguments = + _reference.hasArguments() ? Arguments(_reference.arguments) : null; + + CallReference(this._reference, List uris) + : super( + location: Location(_reference.location, null, uris), + loadingUnit: + _reference.hasLoadingUnit() ? _reference.loadingUnit : null, + ); @override bool operator ==(Object other) { if (identical(this, other)) return true; - return other is CallReference && other.arguments == arguments; + return other is CallReference && other._reference == _reference; } @override - int get hashCode => arguments.hashCode; + int get hashCode => _reference.hashCode; } final class InstanceReference extends Reference { - final List fields; - - InstanceReference({ - super.loadingUnit, - required super.location, - required this.fields, - }); - - factory InstanceReference.fromJson( - Map json, List uris) { - return InstanceReference( - loadingUnit: json['loadingUnit'] as String?, - location: - Location.fromJson(json['@'] as Map, null, uris), - fields: (json['fields'] as List) - .map((fieldStr) => Field.fromJson(fieldStr as Map)) - .toList(), - ); + final pb.Reference _reference; + + late final Iterable fields = + _reference.hasFields() ? _reference.fields.fields.map(Field.new) : []; + + InstanceReference(this._reference, List uris) + : super( + location: Location(_reference.location, null, uris), + loadingUnit: + _reference.hasLoadingUnit() ? _reference.loadingUnit : null, + ); + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is CallReference && other._reference == _reference; } @override - Map toJson(List uris) => { - if (fields.isNotEmpty) - 'fields': fields.map((field) => field.toJson()).toList(), - ...super.toJson(uris), - }; + int get hashCode => _reference.hashCode; } diff --git a/pkgs/record_use/lib/src/data_classes/usage.dart b/pkgs/record_use/lib/src/data_classes/usage.dart index 67abd498..cff17aa3 100644 --- a/pkgs/record_use/lib/src/data_classes/usage.dart +++ b/pkgs/record_use/lib/src/data_classes/usage.dart @@ -2,56 +2,41 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:collection/collection.dart'; - +import '../proto/usages.pb.dart' as pb; import 'definition.dart'; -import 'identifier.dart'; import 'reference.dart'; class Usage { - final Definition definition; - final List references; + final pb.Usage _usage; + final List _ids; + final List _uris; + late final Definition definition = Definition(_usage.definition, _ids, _uris); + late final List references = _usage.references + .map( + (e) => switch (e.whichReference()) { + pb.Reference_Reference.arguments => CallReference(e, _uris), + pb.Reference_Reference.fields => InstanceReference(e, _uris), + pb.Reference_Reference.notSet => throw UnimplementedError(), + }, + ) + .whereType() + .toList(); Usage({ - required this.definition, - required this.references, - }); - - factory Usage.fromJson( - Map json, - List identifiers, - List uris, - T Function(Map, List) constr, - ) => - Usage( - definition: Definition.fromJson( - json['definition'] as Map, - identifiers, - ), - references: (json['references'] as List) - .map((x) => constr(x as Map, uris)) - .toList(), - ); - - Map toJson( - List identifiers, - List uris, - ) => - { - 'definition': definition.toJson(identifiers, uris), - 'references': references.map((x) => x.toJson(uris)).toList(), - }; + required pb.Usage usage, + required List ids, + required List uris, + }) : _usage = usage, + _ids = ids, + _uris = uris; @override bool operator ==(Object other) { if (identical(this, other)) return true; - final listEquals = const DeepCollectionEquality().equals; - return other is Usage && - other.definition == definition && - listEquals(other.references, references); + return other is Usage && other._usage == _usage; } @override - int get hashCode => definition.hashCode ^ references.hashCode; + int get hashCode => _usage.hashCode; } diff --git a/pkgs/record_use/lib/src/data_classes/usage_record.dart b/pkgs/record_use/lib/src/data_classes/usage_record.dart index dd9371a1..2389247c 100644 --- a/pkgs/record_use/lib/src/data_classes/usage_record.dart +++ b/pkgs/record_use/lib/src/data_classes/usage_record.dart @@ -2,17 +2,19 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:typed_data'; + import 'package:collection/collection.dart'; -import 'identifier.dart'; +import '../proto/usages.pb.dart' as pb; import 'metadata.dart'; import 'reference.dart'; import 'usage.dart'; class UsageRecord { final Metadata metadata; - final List> calls; - final List> instances; + final Iterable> calls; + final Iterable> instances; UsageRecord({ required this.metadata, @@ -20,68 +22,6 @@ class UsageRecord { required this.instances, }); - factory UsageRecord.fromJson(Map json) { - final uris = json['uris'] as List; - final identifiers = (json['ids'] as List) - .whereType>() - .map( - (e) => Identifier.fromJson(e, uris), - ) - .toList(); - return UsageRecord( - metadata: Metadata.fromJson(json['metadata'] as Map), - calls: (json['calls'] as List?) - ?.map((x) => Usage.fromJson( - x as Map, - identifiers, - uris, - CallReference.fromJson, - )) - .toList() ?? - [], - instances: (json['instances'] as List?) - ?.map((x) => Usage.fromJson( - x as Map, - identifiers, - uris, - InstanceReference.fromJson, - )) - .toList() ?? - [], - ); - } - - Map toJson() { - final identifiers = { - ...calls.map((call) => call.definition.identifier), - ...instances.map((instance) => instance.definition.identifier), - }.toList(); - final uris = { - ...identifiers.map((e) => e.uri), - ...calls.expand((call) => [ - call.definition.location.uri, - ...call.references.map((reference) => reference.location.uri), - ]), - ...instances.expand((instance) => [ - instance.definition.location.uri, - ...instance.references.map((reference) => reference.location.uri), - ]), - }.toList(); - return { - 'metadata': metadata.toJson(), - 'uris': uris, - 'ids': identifiers.map((identifier) => identifier.toJson(uris)).toList(), - if (calls.isNotEmpty) - 'calls': calls - .map((reference) => reference.toJson(identifiers, uris)) - .toList(), - if (instances.isNotEmpty) - 'instances': instances - .map((reference) => reference.toJson(identifiers, uris)) - .toList(), - }; - } - @override bool operator ==(Object other) { if (identical(this, other)) return true; @@ -89,9 +29,33 @@ class UsageRecord { return other is UsageRecord && other.metadata == metadata && - listEquals(other.calls, calls); + listEquals(other.calls, calls) && + listEquals(other.instances, instances); } @override - int get hashCode => metadata.hashCode ^ calls.hashCode; + int get hashCode => metadata.hashCode ^ calls.hashCode ^ instances.hashCode; + + factory UsageRecord.fromFile(Uint8List fileContents) { + final usages = pb.Usages.fromBuffer(fileContents); + final ids = usages.ids; + final uris = usages.uris.map((e) => e.value).toList(); + return UsageRecord( + metadata: Metadata(protoMetadata: usages.metadata), + calls: usages.calls.map((e) => Usage( + usage: e, + ids: ids, + uris: uris, + )), + instances: usages.calls.map((e) => Usage( + usage: e, + ids: ids, + uris: uris, + )), + ); + } + + Uint8List serialize() { + return pb.Usages().writeToBuffer(); + } } diff --git a/pkgs/record_use/lib/src/proto/read/usages.pb.dart b/pkgs/record_use/lib/src/proto/read/usages.pb.dart new file mode 100644 index 00000000..a1526e3b --- /dev/null +++ b/pkgs/record_use/lib/src/proto/read/usages.pb.dart @@ -0,0 +1,1037 @@ +// +// Generated code. Do not modify. +// source: usages.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class Usages extends $pb.GeneratedMessage { + factory Usages({ + Metadata? metadata, + $core.Iterable? calls, + $core.Iterable? instances, + }) { + final $result = create(); + if (metadata != null) { + $result.metadata = metadata; + } + if (calls != null) { + $result.calls.addAll(calls); + } + if (instances != null) { + $result.instances.addAll(instances); + } + return $result; + } + Usages._() : super(); + factory Usages.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Usages.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Usages', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOM(1, _omitFieldNames ? '' : 'metadata', subBuilder: Metadata.create) + ..pc(4, _omitFieldNames ? '' : 'calls', $pb.PbFieldType.PM, subBuilder: Usage.create) + ..pc(5, _omitFieldNames ? '' : 'instances', $pb.PbFieldType.PM, subBuilder: Usage.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Usages clone() => Usages()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Usages copyWith(void Function(Usages) updates) => super.copyWith((message) => updates(message as Usages)) as Usages; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Usages create() => Usages._(); + Usages createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Usages getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Usages? _defaultInstance; + + @$pb.TagNumber(1) + Metadata get metadata => $_getN(0); + @$pb.TagNumber(1) + set metadata(Metadata v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasMetadata() => $_has(0); + @$pb.TagNumber(1) + void clearMetadata() => clearField(1); + @$pb.TagNumber(1) + Metadata ensureMetadata() => $_ensure(0); + + @$pb.TagNumber(4) + $core.List get calls => $_getList(1); + + @$pb.TagNumber(5) + $core.List get instances => $_getList(2); +} + +class Metadata extends $pb.GeneratedMessage { + factory Metadata({ + $core.String? comment, + $core.String? version, + }) { + final $result = create(); + if (comment != null) { + $result.comment = comment; + } + if (version != null) { + $result.version = version; + } + return $result; + } + Metadata._() : super(); + factory Metadata.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Metadata.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Metadata', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'comment') + ..aOS(2, _omitFieldNames ? '' : 'version') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Metadata clone() => Metadata()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Metadata copyWith(void Function(Metadata) updates) => super.copyWith((message) => updates(message as Metadata)) as Metadata; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Metadata create() => Metadata._(); + Metadata createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Metadata getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Metadata? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get comment => $_getSZ(0); + @$pb.TagNumber(1) + set comment($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasComment() => $_has(0); + @$pb.TagNumber(1) + void clearComment() => clearField(1); + + @$pb.TagNumber(2) + $core.String get version => $_getSZ(1); + @$pb.TagNumber(2) + set version($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasVersion() => $_has(1); + @$pb.TagNumber(2) + void clearVersion() => clearField(2); +} + +class Uri extends $pb.GeneratedMessage { + factory Uri({ + $core.String? value, + }) { + final $result = create(); + if (value != null) { + $result.value = value; + } + return $result; + } + Uri._() : super(); + factory Uri.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Uri.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Uri', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'value') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Uri clone() => Uri()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Uri copyWith(void Function(Uri) updates) => super.copyWith((message) => updates(message as Uri)) as Uri; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Uri create() => Uri._(); + Uri createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Uri getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Uri? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get value => $_getSZ(0); + @$pb.TagNumber(1) + set value($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasValue() => $_has(0); + @$pb.TagNumber(1) + void clearValue() => clearField(1); +} + +class Identifier extends $pb.GeneratedMessage { + factory Identifier({ + Uri? uri, + $core.String? parent, + $core.String? name, + }) { + final $result = create(); + if (uri != null) { + $result.uri = uri; + } + if (parent != null) { + $result.parent = parent; + } + if (name != null) { + $result.name = name; + } + return $result; + } + Identifier._() : super(); + factory Identifier.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Identifier.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Identifier', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOM(1, _omitFieldNames ? '' : 'uri', subBuilder: Uri.create) + ..aOS(2, _omitFieldNames ? '' : 'parent') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Identifier clone() => Identifier()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Identifier copyWith(void Function(Identifier) updates) => super.copyWith((message) => updates(message as Identifier)) as Identifier; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Identifier create() => Identifier._(); + Identifier createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Identifier getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Identifier? _defaultInstance; + + @$pb.TagNumber(1) + Uri get uri => $_getN(0); + @$pb.TagNumber(1) + set uri(Uri v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasUri() => $_has(0); + @$pb.TagNumber(1) + void clearUri() => clearField(1); + @$pb.TagNumber(1) + Uri ensureUri() => $_ensure(0); + + @$pb.TagNumber(2) + $core.String get parent => $_getSZ(1); + @$pb.TagNumber(2) + set parent($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasParent() => $_has(1); + @$pb.TagNumber(2) + void clearParent() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); +} + +class Usage extends $pb.GeneratedMessage { + factory Usage({ + Definition? definition, + $core.Iterable? references, + }) { + final $result = create(); + if (definition != null) { + $result.definition = definition; + } + if (references != null) { + $result.references.addAll(references); + } + return $result; + } + Usage._() : super(); + factory Usage.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Usage.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Usage', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOM(1, _omitFieldNames ? '' : 'definition', subBuilder: Definition.create) + ..pc(2, _omitFieldNames ? '' : 'references', $pb.PbFieldType.PM, subBuilder: Reference.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Usage clone() => Usage()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Usage copyWith(void Function(Usage) updates) => super.copyWith((message) => updates(message as Usage)) as Usage; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Usage create() => Usage._(); + Usage createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Usage getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Usage? _defaultInstance; + + @$pb.TagNumber(1) + Definition get definition => $_getN(0); + @$pb.TagNumber(1) + set definition(Definition v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasDefinition() => $_has(0); + @$pb.TagNumber(1) + void clearDefinition() => clearField(1); + @$pb.TagNumber(1) + Definition ensureDefinition() => $_ensure(0); + + @$pb.TagNumber(2) + $core.List get references => $_getList(1); +} + +class Definition extends $pb.GeneratedMessage { + factory Definition({ + Identifier? identifier, + Location? location, + $core.String? loadingUnit, + }) { + final $result = create(); + if (identifier != null) { + $result.identifier = identifier; + } + if (location != null) { + $result.location = location; + } + if (loadingUnit != null) { + $result.loadingUnit = loadingUnit; + } + return $result; + } + Definition._() : super(); + factory Definition.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Definition.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Definition', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOM(1, _omitFieldNames ? '' : 'identifier', subBuilder: Identifier.create) + ..aOM(2, _omitFieldNames ? '' : 'location', subBuilder: Location.create) + ..aOS(3, _omitFieldNames ? '' : 'loadingUnit') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Definition clone() => Definition()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Definition copyWith(void Function(Definition) updates) => super.copyWith((message) => updates(message as Definition)) as Definition; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Definition create() => Definition._(); + Definition createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Definition getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Definition? _defaultInstance; + + @$pb.TagNumber(1) + Identifier get identifier => $_getN(0); + @$pb.TagNumber(1) + set identifier(Identifier v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasIdentifier() => $_has(0); + @$pb.TagNumber(1) + void clearIdentifier() => clearField(1); + @$pb.TagNumber(1) + Identifier ensureIdentifier() => $_ensure(0); + + @$pb.TagNumber(2) + Location get location => $_getN(1); + @$pb.TagNumber(2) + set location(Location v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasLocation() => $_has(1); + @$pb.TagNumber(2) + void clearLocation() => clearField(2); + @$pb.TagNumber(2) + Location ensureLocation() => $_ensure(1); + + @$pb.TagNumber(3) + $core.String get loadingUnit => $_getSZ(2); + @$pb.TagNumber(3) + set loadingUnit($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasLoadingUnit() => $_has(2); + @$pb.TagNumber(3) + void clearLoadingUnit() => clearField(3); +} + +class Location extends $pb.GeneratedMessage { + factory Location({ + Uri? uri, + $core.int? line, + $core.int? column, + }) { + final $result = create(); + if (uri != null) { + $result.uri = uri; + } + if (line != null) { + $result.line = line; + } + if (column != null) { + $result.column = column; + } + return $result; + } + Location._() : super(); + factory Location.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Location.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Location', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOM(1, _omitFieldNames ? '' : 'uri', subBuilder: Uri.create) + ..a<$core.int>(2, _omitFieldNames ? '' : 'line', $pb.PbFieldType.OU3) + ..a<$core.int>(3, _omitFieldNames ? '' : 'column', $pb.PbFieldType.OU3) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Location clone() => Location()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Location copyWith(void Function(Location) updates) => super.copyWith((message) => updates(message as Location)) as Location; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Location create() => Location._(); + Location createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Location getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Location? _defaultInstance; + + @$pb.TagNumber(1) + Uri get uri => $_getN(0); + @$pb.TagNumber(1) + set uri(Uri v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasUri() => $_has(0); + @$pb.TagNumber(1) + void clearUri() => clearField(1); + @$pb.TagNumber(1) + Uri ensureUri() => $_ensure(0); + + @$pb.TagNumber(2) + $core.int get line => $_getIZ(1); + @$pb.TagNumber(2) + set line($core.int v) { $_setUnsignedInt32(1, v); } + @$pb.TagNumber(2) + $core.bool hasLine() => $_has(1); + @$pb.TagNumber(2) + void clearLine() => clearField(2); + + @$pb.TagNumber(3) + $core.int get column => $_getIZ(2); + @$pb.TagNumber(3) + set column($core.int v) { $_setUnsignedInt32(2, v); } + @$pb.TagNumber(3) + $core.bool hasColumn() => $_has(2); + @$pb.TagNumber(3) + void clearColumn() => clearField(3); +} + +enum Reference_Reference { + arguments, + fields, + notSet +} + +class Reference extends $pb.GeneratedMessage { + factory Reference({ + Location? location, + $core.String? loadingUnit, + Arguments? arguments, + Fields? fields, + }) { + final $result = create(); + if (location != null) { + $result.location = location; + } + if (loadingUnit != null) { + $result.loadingUnit = loadingUnit; + } + if (arguments != null) { + $result.arguments = arguments; + } + if (fields != null) { + $result.fields = fields; + } + return $result; + } + Reference._() : super(); + factory Reference.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Reference.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static const $core.Map<$core.int, Reference_Reference> _Reference_ReferenceByTag = { + 3 : Reference_Reference.arguments, + 4 : Reference_Reference.fields, + 0 : Reference_Reference.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Reference', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..oo(0, [3, 4]) + ..aOM(1, _omitFieldNames ? '' : 'location', subBuilder: Location.create) + ..aOS(2, _omitFieldNames ? '' : 'loadingUnit') + ..aOM(3, _omitFieldNames ? '' : 'arguments', subBuilder: Arguments.create) + ..aOM(4, _omitFieldNames ? '' : 'fields', subBuilder: Fields.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Reference clone() => Reference()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Reference copyWith(void Function(Reference) updates) => super.copyWith((message) => updates(message as Reference)) as Reference; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Reference create() => Reference._(); + Reference createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Reference getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Reference? _defaultInstance; + + Reference_Reference whichReference() => _Reference_ReferenceByTag[$_whichOneof(0)]!; + void clearReference() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + Location get location => $_getN(0); + @$pb.TagNumber(1) + set location(Location v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasLocation() => $_has(0); + @$pb.TagNumber(1) + void clearLocation() => clearField(1); + @$pb.TagNumber(1) + Location ensureLocation() => $_ensure(0); + + @$pb.TagNumber(2) + $core.String get loadingUnit => $_getSZ(1); + @$pb.TagNumber(2) + set loadingUnit($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasLoadingUnit() => $_has(1); + @$pb.TagNumber(2) + void clearLoadingUnit() => clearField(2); + + @$pb.TagNumber(3) + Arguments get arguments => $_getN(2); + @$pb.TagNumber(3) + set arguments(Arguments v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasArguments() => $_has(2); + @$pb.TagNumber(3) + void clearArguments() => clearField(3); + @$pb.TagNumber(3) + Arguments ensureArguments() => $_ensure(2); + + @$pb.TagNumber(4) + Fields get fields => $_getN(3); + @$pb.TagNumber(4) + set fields(Fields v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasFields() => $_has(3); + @$pb.TagNumber(4) + void clearFields() => clearField(4); + @$pb.TagNumber(4) + Fields ensureFields() => $_ensure(3); +} + +class Fields extends $pb.GeneratedMessage { + factory Fields({ + $core.Iterable? fields, + }) { + final $result = create(); + if (fields != null) { + $result.fields.addAll(fields); + } + return $result; + } + Fields._() : super(); + factory Fields.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Fields.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Fields', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..pc(1, _omitFieldNames ? '' : 'fields', $pb.PbFieldType.PM, subBuilder: Field.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Fields clone() => Fields()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Fields copyWith(void Function(Fields) updates) => super.copyWith((message) => updates(message as Fields)) as Fields; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Fields create() => Fields._(); + Fields createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Fields getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Fields? _defaultInstance; + + @$pb.TagNumber(1) + $core.List get fields => $_getList(0); +} + +enum Arguments_Kind { + const_1, + nonConst, + notSet +} + +class Arguments extends $pb.GeneratedMessage { + factory Arguments({ + ConstArguments? const_1, + NonConstArguments? nonConst, + }) { + final $result = create(); + if (const_1 != null) { + $result.const_1 = const_1; + } + if (nonConst != null) { + $result.nonConst = nonConst; + } + return $result; + } + Arguments._() : super(); + factory Arguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Arguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static const $core.Map<$core.int, Arguments_Kind> _Arguments_KindByTag = { + 1 : Arguments_Kind.const_1, + 2 : Arguments_Kind.nonConst, + 0 : Arguments_Kind.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Arguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..oo(0, [1, 2]) + ..aOM(1, _omitFieldNames ? '' : 'const', subBuilder: ConstArguments.create) + ..aOM(2, _omitFieldNames ? '' : 'nonConst', subBuilder: NonConstArguments.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Arguments clone() => Arguments()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Arguments copyWith(void Function(Arguments) updates) => super.copyWith((message) => updates(message as Arguments)) as Arguments; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Arguments create() => Arguments._(); + Arguments createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Arguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Arguments? _defaultInstance; + + Arguments_Kind whichKind() => _Arguments_KindByTag[$_whichOneof(0)]!; + void clearKind() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + ConstArguments get const_1 => $_getN(0); + @$pb.TagNumber(1) + set const_1(ConstArguments v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasConst_1() => $_has(0); + @$pb.TagNumber(1) + void clearConst_1() => clearField(1); + @$pb.TagNumber(1) + ConstArguments ensureConst_1() => $_ensure(0); + + @$pb.TagNumber(2) + NonConstArguments get nonConst => $_getN(1); + @$pb.TagNumber(2) + set nonConst(NonConstArguments v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasNonConst() => $_has(1); + @$pb.TagNumber(2) + void clearNonConst() => clearField(2); + @$pb.TagNumber(2) + NonConstArguments ensureNonConst() => $_ensure(1); +} + +class ConstArguments extends $pb.GeneratedMessage { + factory ConstArguments({ + $core.Map<$core.int, $core.String>? positional, + $core.Map<$core.String, $core.String>? named, + }) { + final $result = create(); + if (positional != null) { + $result.positional.addAll(positional); + } + if (named != null) { + $result.named.addAll(named); + } + return $result; + } + ConstArguments._() : super(); + factory ConstArguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ConstArguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ConstArguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..m<$core.int, $core.String>(1, _omitFieldNames ? '' : 'positional', entryClassName: 'ConstArguments.PositionalEntry', keyFieldType: $pb.PbFieldType.OU3, valueFieldType: $pb.PbFieldType.OS, packageName: const $pb.PackageName('usages')) + ..m<$core.String, $core.String>(2, _omitFieldNames ? '' : 'named', entryClassName: 'ConstArguments.NamedEntry', keyFieldType: $pb.PbFieldType.OS, valueFieldType: $pb.PbFieldType.OS, packageName: const $pb.PackageName('usages')) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ConstArguments clone() => ConstArguments()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ConstArguments copyWith(void Function(ConstArguments) updates) => super.copyWith((message) => updates(message as ConstArguments)) as ConstArguments; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ConstArguments create() => ConstArguments._(); + ConstArguments createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ConstArguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ConstArguments? _defaultInstance; + + @$pb.TagNumber(1) + $core.Map<$core.int, $core.String> get positional => $_getMap(0); + + @$pb.TagNumber(2) + $core.Map<$core.String, $core.String> get named => $_getMap(1); +} + +class NonConstArguments extends $pb.GeneratedMessage { + factory NonConstArguments({ + $core.Iterable<$core.int>? positional, + $core.Iterable<$core.String>? named, + }) { + final $result = create(); + if (positional != null) { + $result.positional.addAll(positional); + } + if (named != null) { + $result.named.addAll(named); + } + return $result; + } + NonConstArguments._() : super(); + factory NonConstArguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory NonConstArguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'NonConstArguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..p<$core.int>(1, _omitFieldNames ? '' : 'positional', $pb.PbFieldType.KU3) + ..pPS(2, _omitFieldNames ? '' : 'named') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + NonConstArguments clone() => NonConstArguments()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + NonConstArguments copyWith(void Function(NonConstArguments) updates) => super.copyWith((message) => updates(message as NonConstArguments)) as NonConstArguments; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static NonConstArguments create() => NonConstArguments._(); + NonConstArguments createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static NonConstArguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static NonConstArguments? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$core.int> get positional => $_getList(0); + + @$pb.TagNumber(2) + $core.List<$core.String> get named => $_getList(1); +} + +class Field extends $pb.GeneratedMessage { + factory Field({ + $core.String? className, + $core.String? name, + FieldValue? value, + }) { + final $result = create(); + if (className != null) { + $result.className = className; + } + if (name != null) { + $result.name = name; + } + if (value != null) { + $result.value = value; + } + return $result; + } + Field._() : super(); + factory Field.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Field.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Field', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'className') + ..aOS(2, _omitFieldNames ? '' : 'name') + ..aOM(3, _omitFieldNames ? '' : 'value', subBuilder: FieldValue.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Field clone() => Field()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Field copyWith(void Function(Field) updates) => super.copyWith((message) => updates(message as Field)) as Field; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Field create() => Field._(); + Field createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Field getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Field? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get className => $_getSZ(0); + @$pb.TagNumber(1) + set className($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasClassName() => $_has(0); + @$pb.TagNumber(1) + void clearClassName() => clearField(1); + + @$pb.TagNumber(2) + $core.String get name => $_getSZ(1); + @$pb.TagNumber(2) + set name($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasName() => $_has(1); + @$pb.TagNumber(2) + void clearName() => clearField(2); + + @$pb.TagNumber(3) + FieldValue get value => $_getN(2); + @$pb.TagNumber(3) + set value(FieldValue v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasValue() => $_has(2); + @$pb.TagNumber(3) + void clearValue() => clearField(3); + @$pb.TagNumber(3) + FieldValue ensureValue() => $_ensure(2); +} + +enum FieldValue_Value { + intValue, + doubleValue, + boolValue, + stringValue, + notSet +} + +class FieldValue extends $pb.GeneratedMessage { + factory FieldValue({ + $core.int? intValue, + $core.double? doubleValue, + $core.bool? boolValue, + $core.String? stringValue, + }) { + final $result = create(); + if (intValue != null) { + $result.intValue = intValue; + } + if (doubleValue != null) { + $result.doubleValue = doubleValue; + } + if (boolValue != null) { + $result.boolValue = boolValue; + } + if (stringValue != null) { + $result.stringValue = stringValue; + } + return $result; + } + FieldValue._() : super(); + factory FieldValue.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory FieldValue.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static const $core.Map<$core.int, FieldValue_Value> _FieldValue_ValueByTag = { + 1 : FieldValue_Value.intValue, + 2 : FieldValue_Value.doubleValue, + 3 : FieldValue_Value.boolValue, + 4 : FieldValue_Value.stringValue, + 0 : FieldValue_Value.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'FieldValue', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..oo(0, [1, 2, 3, 4]) + ..a<$core.int>(1, _omitFieldNames ? '' : 'intValue', $pb.PbFieldType.O3) + ..a<$core.double>(2, _omitFieldNames ? '' : 'doubleValue', $pb.PbFieldType.OD) + ..aOB(3, _omitFieldNames ? '' : 'boolValue') + ..aOS(4, _omitFieldNames ? '' : 'stringValue') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + FieldValue clone() => FieldValue()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + FieldValue copyWith(void Function(FieldValue) updates) => super.copyWith((message) => updates(message as FieldValue)) as FieldValue; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static FieldValue create() => FieldValue._(); + FieldValue createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static FieldValue getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static FieldValue? _defaultInstance; + + FieldValue_Value whichValue() => _FieldValue_ValueByTag[$_whichOneof(0)]!; + void clearValue() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + $core.int get intValue => $_getIZ(0); + @$pb.TagNumber(1) + set intValue($core.int v) { $_setSignedInt32(0, v); } + @$pb.TagNumber(1) + $core.bool hasIntValue() => $_has(0); + @$pb.TagNumber(1) + void clearIntValue() => clearField(1); + + @$pb.TagNumber(2) + $core.double get doubleValue => $_getN(1); + @$pb.TagNumber(2) + set doubleValue($core.double v) { $_setDouble(1, v); } + @$pb.TagNumber(2) + $core.bool hasDoubleValue() => $_has(1); + @$pb.TagNumber(2) + void clearDoubleValue() => clearField(2); + + @$pb.TagNumber(3) + $core.bool get boolValue => $_getBF(2); + @$pb.TagNumber(3) + set boolValue($core.bool v) { $_setBool(2, v); } + @$pb.TagNumber(3) + $core.bool hasBoolValue() => $_has(2); + @$pb.TagNumber(3) + void clearBoolValue() => clearField(3); + + @$pb.TagNumber(4) + $core.String get stringValue => $_getSZ(3); + @$pb.TagNumber(4) + set stringValue($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasStringValue() => $_has(3); + @$pb.TagNumber(4) + void clearStringValue() => clearField(4); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/pkgs/record_use/lib/src/proto/read/usages.pbenum.dart b/pkgs/record_use/lib/src/proto/read/usages.pbenum.dart new file mode 100644 index 00000000..7a454fd8 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/read/usages.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: usages.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/pkgs/record_use/lib/src/proto/read/usages.pbjson.dart b/pkgs/record_use/lib/src/proto/read/usages.pbjson.dart new file mode 100644 index 00000000..66999fe6 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/read/usages.pbjson.dart @@ -0,0 +1,265 @@ +// +// Generated code. Do not modify. +// source: usages.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use usagesDescriptor instead') +const Usages$json = { + '1': 'Usages', + '2': [ + {'1': 'metadata', '3': 1, '4': 1, '5': 11, '6': '.usages.Metadata', '10': 'metadata'}, + {'1': 'calls', '3': 4, '4': 3, '5': 11, '6': '.usages.Usage', '10': 'calls'}, + {'1': 'instances', '3': 5, '4': 3, '5': 11, '6': '.usages.Usage', '10': 'instances'}, + ], +}; + +/// Descriptor for `Usages`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List usagesDescriptor = $convert.base64Decode( + 'CgZVc2FnZXMSLAoIbWV0YWRhdGEYASABKAsyEC51c2FnZXMuTWV0YWRhdGFSCG1ldGFkYXRhEi' + 'MKBWNhbGxzGAQgAygLMg0udXNhZ2VzLlVzYWdlUgVjYWxscxIrCglpbnN0YW5jZXMYBSADKAsy' + 'DS51c2FnZXMuVXNhZ2VSCWluc3RhbmNlcw=='); + +@$core.Deprecated('Use metadataDescriptor instead') +const Metadata$json = { + '1': 'Metadata', + '2': [ + {'1': 'comment', '3': 1, '4': 1, '5': 9, '9': 0, '10': 'comment', '17': true}, + {'1': 'version', '3': 2, '4': 1, '5': 9, '10': 'version'}, + ], + '8': [ + {'1': '_comment'}, + ], +}; + +/// Descriptor for `Metadata`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List metadataDescriptor = $convert.base64Decode( + 'CghNZXRhZGF0YRIdCgdjb21tZW50GAEgASgJSABSB2NvbW1lbnSIAQESGAoHdmVyc2lvbhgCIA' + 'EoCVIHdmVyc2lvbkIKCghfY29tbWVudA=='); + +@$core.Deprecated('Use uriDescriptor instead') +const Uri$json = { + '1': 'Uri', + '2': [ + {'1': 'value', '3': 1, '4': 1, '5': 9, '10': 'value'}, + ], +}; + +/// Descriptor for `Uri`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List uriDescriptor = $convert.base64Decode( + 'CgNVcmkSFAoFdmFsdWUYASABKAlSBXZhbHVl'); + +@$core.Deprecated('Use identifierDescriptor instead') +const Identifier$json = { + '1': 'Identifier', + '2': [ + {'1': 'uri', '3': 1, '4': 1, '5': 11, '6': '.usages.Uri', '10': 'uri'}, + {'1': 'parent', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'parent', '17': true}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + ], + '8': [ + {'1': '_parent'}, + ], +}; + +/// Descriptor for `Identifier`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List identifierDescriptor = $convert.base64Decode( + 'CgpJZGVudGlmaWVyEh0KA3VyaRgBIAEoCzILLnVzYWdlcy5VcmlSA3VyaRIbCgZwYXJlbnQYAi' + 'ABKAlIAFIGcGFyZW50iAEBEhIKBG5hbWUYAyABKAlSBG5hbWVCCQoHX3BhcmVudA=='); + +@$core.Deprecated('Use usageDescriptor instead') +const Usage$json = { + '1': 'Usage', + '2': [ + {'1': 'definition', '3': 1, '4': 1, '5': 11, '6': '.usages.Definition', '10': 'definition'}, + {'1': 'references', '3': 2, '4': 3, '5': 11, '6': '.usages.Reference', '10': 'references'}, + ], +}; + +/// Descriptor for `Usage`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List usageDescriptor = $convert.base64Decode( + 'CgVVc2FnZRIyCgpkZWZpbml0aW9uGAEgASgLMhIudXNhZ2VzLkRlZmluaXRpb25SCmRlZmluaX' + 'Rpb24SMQoKcmVmZXJlbmNlcxgCIAMoCzIRLnVzYWdlcy5SZWZlcmVuY2VSCnJlZmVyZW5jZXM='); + +@$core.Deprecated('Use definitionDescriptor instead') +const Definition$json = { + '1': 'Definition', + '2': [ + {'1': 'identifier', '3': 1, '4': 1, '5': 11, '6': '.usages.Identifier', '10': 'identifier'}, + {'1': 'location', '3': 2, '4': 1, '5': 11, '6': '.usages.Location', '10': 'location'}, + {'1': 'loading_unit', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'loadingUnit', '17': true}, + ], + '8': [ + {'1': '_loading_unit'}, + ], +}; + +/// Descriptor for `Definition`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List definitionDescriptor = $convert.base64Decode( + 'CgpEZWZpbml0aW9uEjIKCmlkZW50aWZpZXIYASABKAsyEi51c2FnZXMuSWRlbnRpZmllclIKaW' + 'RlbnRpZmllchIsCghsb2NhdGlvbhgCIAEoCzIQLnVzYWdlcy5Mb2NhdGlvblIIbG9jYXRpb24S' + 'JgoMbG9hZGluZ191bml0GAMgASgJSABSC2xvYWRpbmdVbml0iAEBQg8KDV9sb2FkaW5nX3VuaX' + 'Q='); + +@$core.Deprecated('Use locationDescriptor instead') +const Location$json = { + '1': 'Location', + '2': [ + {'1': 'uri', '3': 1, '4': 1, '5': 11, '6': '.usages.Uri', '10': 'uri'}, + {'1': 'line', '3': 2, '4': 1, '5': 13, '10': 'line'}, + {'1': 'column', '3': 3, '4': 1, '5': 13, '10': 'column'}, + ], +}; + +/// Descriptor for `Location`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List locationDescriptor = $convert.base64Decode( + 'CghMb2NhdGlvbhIdCgN1cmkYASABKAsyCy51c2FnZXMuVXJpUgN1cmkSEgoEbGluZRgCIAEoDV' + 'IEbGluZRIWCgZjb2x1bW4YAyABKA1SBmNvbHVtbg=='); + +@$core.Deprecated('Use referenceDescriptor instead') +const Reference$json = { + '1': 'Reference', + '2': [ + {'1': 'location', '3': 1, '4': 1, '5': 11, '6': '.usages.Location', '10': 'location'}, + {'1': 'loading_unit', '3': 2, '4': 1, '5': 9, '10': 'loadingUnit'}, + {'1': 'arguments', '3': 3, '4': 1, '5': 11, '6': '.usages.Arguments', '9': 0, '10': 'arguments'}, + {'1': 'fields', '3': 4, '4': 1, '5': 11, '6': '.usages.Fields', '9': 0, '10': 'fields'}, + ], + '8': [ + {'1': 'reference'}, + ], +}; + +/// Descriptor for `Reference`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List referenceDescriptor = $convert.base64Decode( + 'CglSZWZlcmVuY2USLAoIbG9jYXRpb24YASABKAsyEC51c2FnZXMuTG9jYXRpb25SCGxvY2F0aW' + '9uEiEKDGxvYWRpbmdfdW5pdBgCIAEoCVILbG9hZGluZ1VuaXQSMQoJYXJndW1lbnRzGAMgASgL' + 'MhEudXNhZ2VzLkFyZ3VtZW50c0gAUglhcmd1bWVudHMSKAoGZmllbGRzGAQgASgLMg4udXNhZ2' + 'VzLkZpZWxkc0gAUgZmaWVsZHNCCwoJcmVmZXJlbmNl'); + +@$core.Deprecated('Use fieldsDescriptor instead') +const Fields$json = { + '1': 'Fields', + '2': [ + {'1': 'fields', '3': 1, '4': 3, '5': 11, '6': '.usages.Field', '10': 'fields'}, + ], +}; + +/// Descriptor for `Fields`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldsDescriptor = $convert.base64Decode( + 'CgZGaWVsZHMSJQoGZmllbGRzGAEgAygLMg0udXNhZ2VzLkZpZWxkUgZmaWVsZHM='); + +@$core.Deprecated('Use argumentsDescriptor instead') +const Arguments$json = { + '1': 'Arguments', + '2': [ + {'1': 'const', '3': 1, '4': 1, '5': 11, '6': '.usages.ConstArguments', '9': 0, '10': 'const'}, + {'1': 'non_const', '3': 2, '4': 1, '5': 11, '6': '.usages.NonConstArguments', '9': 0, '10': 'nonConst'}, + ], + '8': [ + {'1': 'kind'}, + ], +}; + +/// Descriptor for `Arguments`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List argumentsDescriptor = $convert.base64Decode( + 'CglBcmd1bWVudHMSLgoFY29uc3QYASABKAsyFi51c2FnZXMuQ29uc3RBcmd1bWVudHNIAFIFY2' + '9uc3QSOAoJbm9uX2NvbnN0GAIgASgLMhkudXNhZ2VzLk5vbkNvbnN0QXJndW1lbnRzSABSCG5v' + 'bkNvbnN0QgYKBGtpbmQ='); + +@$core.Deprecated('Use constArgumentsDescriptor instead') +const ConstArguments$json = { + '1': 'ConstArguments', + '2': [ + {'1': 'positional', '3': 1, '4': 3, '5': 11, '6': '.usages.ConstArguments.PositionalEntry', '10': 'positional'}, + {'1': 'named', '3': 2, '4': 3, '5': 11, '6': '.usages.ConstArguments.NamedEntry', '10': 'named'}, + ], + '3': [ConstArguments_PositionalEntry$json, ConstArguments_NamedEntry$json], +}; + +@$core.Deprecated('Use constArgumentsDescriptor instead') +const ConstArguments_PositionalEntry$json = { + '1': 'PositionalEntry', + '2': [ + {'1': 'key', '3': 1, '4': 1, '5': 13, '10': 'key'}, + {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, + ], + '7': {'7': true}, +}; + +@$core.Deprecated('Use constArgumentsDescriptor instead') +const ConstArguments_NamedEntry$json = { + '1': 'NamedEntry', + '2': [ + {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, + {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, + ], + '7': {'7': true}, +}; + +/// Descriptor for `ConstArguments`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List constArgumentsDescriptor = $convert.base64Decode( + 'Cg5Db25zdEFyZ3VtZW50cxJGCgpwb3NpdGlvbmFsGAEgAygLMiYudXNhZ2VzLkNvbnN0QXJndW' + '1lbnRzLlBvc2l0aW9uYWxFbnRyeVIKcG9zaXRpb25hbBI3CgVuYW1lZBgCIAMoCzIhLnVzYWdl' + 'cy5Db25zdEFyZ3VtZW50cy5OYW1lZEVudHJ5UgVuYW1lZBo9Cg9Qb3NpdGlvbmFsRW50cnkSEA' + 'oDa2V5GAEgASgNUgNrZXkSFAoFdmFsdWUYAiABKAlSBXZhbHVlOgI4ARo4CgpOYW1lZEVudHJ5' + 'EhAKA2tleRgBIAEoCVIDa2V5EhQKBXZhbHVlGAIgASgJUgV2YWx1ZToCOAE='); + +@$core.Deprecated('Use nonConstArgumentsDescriptor instead') +const NonConstArguments$json = { + '1': 'NonConstArguments', + '2': [ + {'1': 'positional', '3': 1, '4': 3, '5': 13, '10': 'positional'}, + {'1': 'named', '3': 2, '4': 3, '5': 9, '10': 'named'}, + ], +}; + +/// Descriptor for `NonConstArguments`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List nonConstArgumentsDescriptor = $convert.base64Decode( + 'ChFOb25Db25zdEFyZ3VtZW50cxIeCgpwb3NpdGlvbmFsGAEgAygNUgpwb3NpdGlvbmFsEhQKBW' + '5hbWVkGAIgAygJUgVuYW1lZA=='); + +@$core.Deprecated('Use fieldDescriptor instead') +const Field$json = { + '1': 'Field', + '2': [ + {'1': 'class_name', '3': 1, '4': 1, '5': 9, '10': 'className'}, + {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, + {'1': 'value', '3': 3, '4': 1, '5': 11, '6': '.usages.FieldValue', '10': 'value'}, + ], +}; + +/// Descriptor for `Field`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldDescriptor = $convert.base64Decode( + 'CgVGaWVsZBIdCgpjbGFzc19uYW1lGAEgASgJUgljbGFzc05hbWUSEgoEbmFtZRgCIAEoCVIEbm' + 'FtZRIoCgV2YWx1ZRgDIAEoCzISLnVzYWdlcy5GaWVsZFZhbHVlUgV2YWx1ZQ=='); + +@$core.Deprecated('Use fieldValueDescriptor instead') +const FieldValue$json = { + '1': 'FieldValue', + '2': [ + {'1': 'int_value', '3': 1, '4': 1, '5': 5, '9': 0, '10': 'intValue'}, + {'1': 'double_value', '3': 2, '4': 1, '5': 1, '9': 0, '10': 'doubleValue'}, + {'1': 'bool_value', '3': 3, '4': 1, '5': 8, '9': 0, '10': 'boolValue'}, + {'1': 'string_value', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'stringValue'}, + ], + '8': [ + {'1': 'value'}, + ], +}; + +/// Descriptor for `FieldValue`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldValueDescriptor = $convert.base64Decode( + 'CgpGaWVsZFZhbHVlEh0KCWludF92YWx1ZRgBIAEoBUgAUghpbnRWYWx1ZRIjCgxkb3VibGVfdm' + 'FsdWUYAiABKAFIAFILZG91YmxlVmFsdWUSHwoKYm9vbF92YWx1ZRgDIAEoCEgAUglib29sVmFs' + 'dWUSIwoMc3RyaW5nX3ZhbHVlGAQgASgJSABSC3N0cmluZ1ZhbHVlQgcKBXZhbHVl'); + diff --git a/pkgs/record_use/lib/src/proto/read/usages.pbserver.dart b/pkgs/record_use/lib/src/proto/read/usages.pbserver.dart new file mode 100644 index 00000000..5be7bda9 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/read/usages.pbserver.dart @@ -0,0 +1,14 @@ +// +// Generated code. Do not modify. +// source: usages.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +export 'usages.pb.dart'; + diff --git a/pkgs/record_use/lib/src/proto/storage/usages_storage.pb.dart b/pkgs/record_use/lib/src/proto/storage/usages_storage.pb.dart new file mode 100644 index 00000000..f95a5156 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/storage/usages_storage.pb.dart @@ -0,0 +1,1047 @@ +// +// Generated code. Do not modify. +// source: usages_storage.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class Usages extends $pb.GeneratedMessage { + factory Usages({ + Metadata? metadata, + $core.Iterable? uris, + $core.Iterable? ids, + $core.Iterable? calls, + $core.Iterable? instances, + }) { + final $result = create(); + if (metadata != null) { + $result.metadata = metadata; + } + if (uris != null) { + $result.uris.addAll(uris); + } + if (ids != null) { + $result.ids.addAll(ids); + } + if (calls != null) { + $result.calls.addAll(calls); + } + if (instances != null) { + $result.instances.addAll(instances); + } + return $result; + } + Usages._() : super(); + factory Usages.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Usages.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Usages', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOM(1, _omitFieldNames ? '' : 'metadata', subBuilder: Metadata.create) + ..pc(2, _omitFieldNames ? '' : 'uris', $pb.PbFieldType.PM, subBuilder: Uri.create) + ..pc(3, _omitFieldNames ? '' : 'ids', $pb.PbFieldType.PM, subBuilder: Identifier.create) + ..pc(4, _omitFieldNames ? '' : 'calls', $pb.PbFieldType.PM, subBuilder: Usage.create) + ..pc(5, _omitFieldNames ? '' : 'instances', $pb.PbFieldType.PM, subBuilder: Usage.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Usages clone() => Usages()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Usages copyWith(void Function(Usages) updates) => super.copyWith((message) => updates(message as Usages)) as Usages; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Usages create() => Usages._(); + Usages createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Usages getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Usages? _defaultInstance; + + @$pb.TagNumber(1) + Metadata get metadata => $_getN(0); + @$pb.TagNumber(1) + set metadata(Metadata v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasMetadata() => $_has(0); + @$pb.TagNumber(1) + void clearMetadata() => clearField(1); + @$pb.TagNumber(1) + Metadata ensureMetadata() => $_ensure(0); + + @$pb.TagNumber(2) + $core.List get uris => $_getList(1); + + @$pb.TagNumber(3) + $core.List get ids => $_getList(2); + + @$pb.TagNumber(4) + $core.List get calls => $_getList(3); + + @$pb.TagNumber(5) + $core.List get instances => $_getList(4); +} + +class Metadata extends $pb.GeneratedMessage { + factory Metadata({ + $core.String? comment, + $core.String? version, + }) { + final $result = create(); + if (comment != null) { + $result.comment = comment; + } + if (version != null) { + $result.version = version; + } + return $result; + } + Metadata._() : super(); + factory Metadata.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Metadata.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Metadata', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'comment') + ..aOS(2, _omitFieldNames ? '' : 'version') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Metadata clone() => Metadata()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Metadata copyWith(void Function(Metadata) updates) => super.copyWith((message) => updates(message as Metadata)) as Metadata; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Metadata create() => Metadata._(); + Metadata createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Metadata getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Metadata? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get comment => $_getSZ(0); + @$pb.TagNumber(1) + set comment($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasComment() => $_has(0); + @$pb.TagNumber(1) + void clearComment() => clearField(1); + + @$pb.TagNumber(2) + $core.String get version => $_getSZ(1); + @$pb.TagNumber(2) + set version($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasVersion() => $_has(1); + @$pb.TagNumber(2) + void clearVersion() => clearField(2); +} + +class Uri extends $pb.GeneratedMessage { + factory Uri({ + $core.String? value, + }) { + final $result = create(); + if (value != null) { + $result.value = value; + } + return $result; + } + Uri._() : super(); + factory Uri.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Uri.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Uri', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'value') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Uri clone() => Uri()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Uri copyWith(void Function(Uri) updates) => super.copyWith((message) => updates(message as Uri)) as Uri; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Uri create() => Uri._(); + Uri createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Uri getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Uri? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get value => $_getSZ(0); + @$pb.TagNumber(1) + set value($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasValue() => $_has(0); + @$pb.TagNumber(1) + void clearValue() => clearField(1); +} + +class Identifier extends $pb.GeneratedMessage { + factory Identifier({ + $core.int? uri, + $core.String? parent, + $core.String? name, + }) { + final $result = create(); + if (uri != null) { + $result.uri = uri; + } + if (parent != null) { + $result.parent = parent; + } + if (name != null) { + $result.name = name; + } + return $result; + } + Identifier._() : super(); + factory Identifier.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Identifier.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Identifier', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..a<$core.int>(1, _omitFieldNames ? '' : 'uri', $pb.PbFieldType.OU3) + ..aOS(2, _omitFieldNames ? '' : 'parent') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Identifier clone() => Identifier()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Identifier copyWith(void Function(Identifier) updates) => super.copyWith((message) => updates(message as Identifier)) as Identifier; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Identifier create() => Identifier._(); + Identifier createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Identifier getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Identifier? _defaultInstance; + + @$pb.TagNumber(1) + $core.int get uri => $_getIZ(0); + @$pb.TagNumber(1) + set uri($core.int v) { $_setUnsignedInt32(0, v); } + @$pb.TagNumber(1) + $core.bool hasUri() => $_has(0); + @$pb.TagNumber(1) + void clearUri() => clearField(1); + + @$pb.TagNumber(2) + $core.String get parent => $_getSZ(1); + @$pb.TagNumber(2) + set parent($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasParent() => $_has(1); + @$pb.TagNumber(2) + void clearParent() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); +} + +class Usage extends $pb.GeneratedMessage { + factory Usage({ + Definition? definition, + $core.Iterable? references, + }) { + final $result = create(); + if (definition != null) { + $result.definition = definition; + } + if (references != null) { + $result.references.addAll(references); + } + return $result; + } + Usage._() : super(); + factory Usage.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Usage.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Usage', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOM(1, _omitFieldNames ? '' : 'definition', subBuilder: Definition.create) + ..pc(2, _omitFieldNames ? '' : 'references', $pb.PbFieldType.PM, subBuilder: Reference.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Usage clone() => Usage()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Usage copyWith(void Function(Usage) updates) => super.copyWith((message) => updates(message as Usage)) as Usage; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Usage create() => Usage._(); + Usage createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Usage getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Usage? _defaultInstance; + + @$pb.TagNumber(1) + Definition get definition => $_getN(0); + @$pb.TagNumber(1) + set definition(Definition v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasDefinition() => $_has(0); + @$pb.TagNumber(1) + void clearDefinition() => clearField(1); + @$pb.TagNumber(1) + Definition ensureDefinition() => $_ensure(0); + + @$pb.TagNumber(2) + $core.List get references => $_getList(1); +} + +class Definition extends $pb.GeneratedMessage { + factory Definition({ + $core.int? identifier, + Location? location, + $core.String? loadingUnit, + }) { + final $result = create(); + if (identifier != null) { + $result.identifier = identifier; + } + if (location != null) { + $result.location = location; + } + if (loadingUnit != null) { + $result.loadingUnit = loadingUnit; + } + return $result; + } + Definition._() : super(); + factory Definition.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Definition.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Definition', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..a<$core.int>(1, _omitFieldNames ? '' : 'identifier', $pb.PbFieldType.OU3) + ..aOM(2, _omitFieldNames ? '' : 'location', subBuilder: Location.create) + ..aOS(3, _omitFieldNames ? '' : 'loadingUnit') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Definition clone() => Definition()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Definition copyWith(void Function(Definition) updates) => super.copyWith((message) => updates(message as Definition)) as Definition; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Definition create() => Definition._(); + Definition createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Definition getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Definition? _defaultInstance; + + @$pb.TagNumber(1) + $core.int get identifier => $_getIZ(0); + @$pb.TagNumber(1) + set identifier($core.int v) { $_setUnsignedInt32(0, v); } + @$pb.TagNumber(1) + $core.bool hasIdentifier() => $_has(0); + @$pb.TagNumber(1) + void clearIdentifier() => clearField(1); + + @$pb.TagNumber(2) + Location get location => $_getN(1); + @$pb.TagNumber(2) + set location(Location v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasLocation() => $_has(1); + @$pb.TagNumber(2) + void clearLocation() => clearField(2); + @$pb.TagNumber(2) + Location ensureLocation() => $_ensure(1); + + @$pb.TagNumber(3) + $core.String get loadingUnit => $_getSZ(2); + @$pb.TagNumber(3) + set loadingUnit($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasLoadingUnit() => $_has(2); + @$pb.TagNumber(3) + void clearLoadingUnit() => clearField(3); +} + +class Location extends $pb.GeneratedMessage { + factory Location({ + $core.int? uri, + $core.int? line, + $core.int? column, + }) { + final $result = create(); + if (uri != null) { + $result.uri = uri; + } + if (line != null) { + $result.line = line; + } + if (column != null) { + $result.column = column; + } + return $result; + } + Location._() : super(); + factory Location.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Location.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Location', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..a<$core.int>(1, _omitFieldNames ? '' : 'uri', $pb.PbFieldType.OU3) + ..a<$core.int>(2, _omitFieldNames ? '' : 'line', $pb.PbFieldType.OU3) + ..a<$core.int>(3, _omitFieldNames ? '' : 'column', $pb.PbFieldType.OU3) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Location clone() => Location()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Location copyWith(void Function(Location) updates) => super.copyWith((message) => updates(message as Location)) as Location; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Location create() => Location._(); + Location createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Location getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Location? _defaultInstance; + + @$pb.TagNumber(1) + $core.int get uri => $_getIZ(0); + @$pb.TagNumber(1) + set uri($core.int v) { $_setUnsignedInt32(0, v); } + @$pb.TagNumber(1) + $core.bool hasUri() => $_has(0); + @$pb.TagNumber(1) + void clearUri() => clearField(1); + + @$pb.TagNumber(2) + $core.int get line => $_getIZ(1); + @$pb.TagNumber(2) + set line($core.int v) { $_setUnsignedInt32(1, v); } + @$pb.TagNumber(2) + $core.bool hasLine() => $_has(1); + @$pb.TagNumber(2) + void clearLine() => clearField(2); + + @$pb.TagNumber(3) + $core.int get column => $_getIZ(2); + @$pb.TagNumber(3) + set column($core.int v) { $_setUnsignedInt32(2, v); } + @$pb.TagNumber(3) + $core.bool hasColumn() => $_has(2); + @$pb.TagNumber(3) + void clearColumn() => clearField(3); +} + +enum Reference_Reference { + arguments, + fields, + notSet +} + +class Reference extends $pb.GeneratedMessage { + factory Reference({ + Location? location, + $core.String? loadingUnit, + Arguments? arguments, + Fields? fields, + }) { + final $result = create(); + if (location != null) { + $result.location = location; + } + if (loadingUnit != null) { + $result.loadingUnit = loadingUnit; + } + if (arguments != null) { + $result.arguments = arguments; + } + if (fields != null) { + $result.fields = fields; + } + return $result; + } + Reference._() : super(); + factory Reference.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Reference.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static const $core.Map<$core.int, Reference_Reference> _Reference_ReferenceByTag = { + 3 : Reference_Reference.arguments, + 4 : Reference_Reference.fields, + 0 : Reference_Reference.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Reference', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..oo(0, [3, 4]) + ..aOM(1, _omitFieldNames ? '' : 'location', subBuilder: Location.create) + ..aOS(2, _omitFieldNames ? '' : 'loadingUnit') + ..aOM(3, _omitFieldNames ? '' : 'arguments', subBuilder: Arguments.create) + ..aOM(4, _omitFieldNames ? '' : 'fields', subBuilder: Fields.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Reference clone() => Reference()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Reference copyWith(void Function(Reference) updates) => super.copyWith((message) => updates(message as Reference)) as Reference; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Reference create() => Reference._(); + Reference createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Reference getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Reference? _defaultInstance; + + Reference_Reference whichReference() => _Reference_ReferenceByTag[$_whichOneof(0)]!; + void clearReference() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + Location get location => $_getN(0); + @$pb.TagNumber(1) + set location(Location v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasLocation() => $_has(0); + @$pb.TagNumber(1) + void clearLocation() => clearField(1); + @$pb.TagNumber(1) + Location ensureLocation() => $_ensure(0); + + @$pb.TagNumber(2) + $core.String get loadingUnit => $_getSZ(1); + @$pb.TagNumber(2) + set loadingUnit($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasLoadingUnit() => $_has(1); + @$pb.TagNumber(2) + void clearLoadingUnit() => clearField(2); + + @$pb.TagNumber(3) + Arguments get arguments => $_getN(2); + @$pb.TagNumber(3) + set arguments(Arguments v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasArguments() => $_has(2); + @$pb.TagNumber(3) + void clearArguments() => clearField(3); + @$pb.TagNumber(3) + Arguments ensureArguments() => $_ensure(2); + + @$pb.TagNumber(4) + Fields get fields => $_getN(3); + @$pb.TagNumber(4) + set fields(Fields v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasFields() => $_has(3); + @$pb.TagNumber(4) + void clearFields() => clearField(4); + @$pb.TagNumber(4) + Fields ensureFields() => $_ensure(3); +} + +class Fields extends $pb.GeneratedMessage { + factory Fields({ + $core.Iterable? fields, + }) { + final $result = create(); + if (fields != null) { + $result.fields.addAll(fields); + } + return $result; + } + Fields._() : super(); + factory Fields.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Fields.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Fields', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..pc(1, _omitFieldNames ? '' : 'fields', $pb.PbFieldType.PM, subBuilder: Field.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Fields clone() => Fields()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Fields copyWith(void Function(Fields) updates) => super.copyWith((message) => updates(message as Fields)) as Fields; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Fields create() => Fields._(); + Fields createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Fields getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Fields? _defaultInstance; + + @$pb.TagNumber(1) + $core.List get fields => $_getList(0); +} + +enum Arguments_Kind { + const_1, + nonConst, + notSet +} + +class Arguments extends $pb.GeneratedMessage { + factory Arguments({ + ConstArguments? const_1, + NonConstArguments? nonConst, + }) { + final $result = create(); + if (const_1 != null) { + $result.const_1 = const_1; + } + if (nonConst != null) { + $result.nonConst = nonConst; + } + return $result; + } + Arguments._() : super(); + factory Arguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Arguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static const $core.Map<$core.int, Arguments_Kind> _Arguments_KindByTag = { + 1 : Arguments_Kind.const_1, + 2 : Arguments_Kind.nonConst, + 0 : Arguments_Kind.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Arguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..oo(0, [1, 2]) + ..aOM(1, _omitFieldNames ? '' : 'const', subBuilder: ConstArguments.create) + ..aOM(2, _omitFieldNames ? '' : 'nonConst', subBuilder: NonConstArguments.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Arguments clone() => Arguments()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Arguments copyWith(void Function(Arguments) updates) => super.copyWith((message) => updates(message as Arguments)) as Arguments; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Arguments create() => Arguments._(); + Arguments createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Arguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Arguments? _defaultInstance; + + Arguments_Kind whichKind() => _Arguments_KindByTag[$_whichOneof(0)]!; + void clearKind() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + ConstArguments get const_1 => $_getN(0); + @$pb.TagNumber(1) + set const_1(ConstArguments v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasConst_1() => $_has(0); + @$pb.TagNumber(1) + void clearConst_1() => clearField(1); + @$pb.TagNumber(1) + ConstArguments ensureConst_1() => $_ensure(0); + + @$pb.TagNumber(2) + NonConstArguments get nonConst => $_getN(1); + @$pb.TagNumber(2) + set nonConst(NonConstArguments v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasNonConst() => $_has(1); + @$pb.TagNumber(2) + void clearNonConst() => clearField(2); + @$pb.TagNumber(2) + NonConstArguments ensureNonConst() => $_ensure(1); +} + +class ConstArguments extends $pb.GeneratedMessage { + factory ConstArguments({ + $core.Map<$core.int, $core.String>? positional, + $core.Map<$core.String, $core.String>? named, + }) { + final $result = create(); + if (positional != null) { + $result.positional.addAll(positional); + } + if (named != null) { + $result.named.addAll(named); + } + return $result; + } + ConstArguments._() : super(); + factory ConstArguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ConstArguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ConstArguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..m<$core.int, $core.String>(1, _omitFieldNames ? '' : 'positional', entryClassName: 'ConstArguments.PositionalEntry', keyFieldType: $pb.PbFieldType.OU3, valueFieldType: $pb.PbFieldType.OS, packageName: const $pb.PackageName('usages')) + ..m<$core.String, $core.String>(2, _omitFieldNames ? '' : 'named', entryClassName: 'ConstArguments.NamedEntry', keyFieldType: $pb.PbFieldType.OS, valueFieldType: $pb.PbFieldType.OS, packageName: const $pb.PackageName('usages')) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ConstArguments clone() => ConstArguments()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ConstArguments copyWith(void Function(ConstArguments) updates) => super.copyWith((message) => updates(message as ConstArguments)) as ConstArguments; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ConstArguments create() => ConstArguments._(); + ConstArguments createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ConstArguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ConstArguments? _defaultInstance; + + @$pb.TagNumber(1) + $core.Map<$core.int, $core.String> get positional => $_getMap(0); + + @$pb.TagNumber(2) + $core.Map<$core.String, $core.String> get named => $_getMap(1); +} + +class NonConstArguments extends $pb.GeneratedMessage { + factory NonConstArguments({ + $core.Iterable<$core.int>? positional, + $core.Iterable<$core.String>? named, + }) { + final $result = create(); + if (positional != null) { + $result.positional.addAll(positional); + } + if (named != null) { + $result.named.addAll(named); + } + return $result; + } + NonConstArguments._() : super(); + factory NonConstArguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory NonConstArguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'NonConstArguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..p<$core.int>(1, _omitFieldNames ? '' : 'positional', $pb.PbFieldType.KU3) + ..pPS(2, _omitFieldNames ? '' : 'named') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + NonConstArguments clone() => NonConstArguments()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + NonConstArguments copyWith(void Function(NonConstArguments) updates) => super.copyWith((message) => updates(message as NonConstArguments)) as NonConstArguments; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static NonConstArguments create() => NonConstArguments._(); + NonConstArguments createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static NonConstArguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static NonConstArguments? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$core.int> get positional => $_getList(0); + + @$pb.TagNumber(2) + $core.List<$core.String> get named => $_getList(1); +} + +class Field extends $pb.GeneratedMessage { + factory Field({ + $core.String? className, + $core.String? name, + FieldValue? value, + }) { + final $result = create(); + if (className != null) { + $result.className = className; + } + if (name != null) { + $result.name = name; + } + if (value != null) { + $result.value = value; + } + return $result; + } + Field._() : super(); + factory Field.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Field.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Field', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'className') + ..aOS(2, _omitFieldNames ? '' : 'name') + ..aOM(3, _omitFieldNames ? '' : 'value', subBuilder: FieldValue.create) + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Field clone() => Field()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Field copyWith(void Function(Field) updates) => super.copyWith((message) => updates(message as Field)) as Field; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Field create() => Field._(); + Field createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Field getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Field? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get className => $_getSZ(0); + @$pb.TagNumber(1) + set className($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasClassName() => $_has(0); + @$pb.TagNumber(1) + void clearClassName() => clearField(1); + + @$pb.TagNumber(2) + $core.String get name => $_getSZ(1); + @$pb.TagNumber(2) + set name($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasName() => $_has(1); + @$pb.TagNumber(2) + void clearName() => clearField(2); + + @$pb.TagNumber(3) + FieldValue get value => $_getN(2); + @$pb.TagNumber(3) + set value(FieldValue v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasValue() => $_has(2); + @$pb.TagNumber(3) + void clearValue() => clearField(3); + @$pb.TagNumber(3) + FieldValue ensureValue() => $_ensure(2); +} + +enum FieldValue_Value { + intValue, + doubleValue, + boolValue, + stringValue, + notSet +} + +class FieldValue extends $pb.GeneratedMessage { + factory FieldValue({ + $core.int? intValue, + $core.double? doubleValue, + $core.bool? boolValue, + $core.String? stringValue, + }) { + final $result = create(); + if (intValue != null) { + $result.intValue = intValue; + } + if (doubleValue != null) { + $result.doubleValue = doubleValue; + } + if (boolValue != null) { + $result.boolValue = boolValue; + } + if (stringValue != null) { + $result.stringValue = stringValue; + } + return $result; + } + FieldValue._() : super(); + factory FieldValue.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory FieldValue.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + + static const $core.Map<$core.int, FieldValue_Value> _FieldValue_ValueByTag = { + 1 : FieldValue_Value.intValue, + 2 : FieldValue_Value.doubleValue, + 3 : FieldValue_Value.boolValue, + 4 : FieldValue_Value.stringValue, + 0 : FieldValue_Value.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'FieldValue', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) + ..oo(0, [1, 2, 3, 4]) + ..a<$core.int>(1, _omitFieldNames ? '' : 'intValue', $pb.PbFieldType.O3) + ..a<$core.double>(2, _omitFieldNames ? '' : 'doubleValue', $pb.PbFieldType.OD) + ..aOB(3, _omitFieldNames ? '' : 'boolValue') + ..aOS(4, _omitFieldNames ? '' : 'stringValue') + ..hasRequiredFields = false + ; + + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + FieldValue clone() => FieldValue()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + FieldValue copyWith(void Function(FieldValue) updates) => super.copyWith((message) => updates(message as FieldValue)) as FieldValue; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static FieldValue create() => FieldValue._(); + FieldValue createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static FieldValue getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static FieldValue? _defaultInstance; + + FieldValue_Value whichValue() => _FieldValue_ValueByTag[$_whichOneof(0)]!; + void clearValue() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + $core.int get intValue => $_getIZ(0); + @$pb.TagNumber(1) + set intValue($core.int v) { $_setSignedInt32(0, v); } + @$pb.TagNumber(1) + $core.bool hasIntValue() => $_has(0); + @$pb.TagNumber(1) + void clearIntValue() => clearField(1); + + @$pb.TagNumber(2) + $core.double get doubleValue => $_getN(1); + @$pb.TagNumber(2) + set doubleValue($core.double v) { $_setDouble(1, v); } + @$pb.TagNumber(2) + $core.bool hasDoubleValue() => $_has(1); + @$pb.TagNumber(2) + void clearDoubleValue() => clearField(2); + + @$pb.TagNumber(3) + $core.bool get boolValue => $_getBF(2); + @$pb.TagNumber(3) + set boolValue($core.bool v) { $_setBool(2, v); } + @$pb.TagNumber(3) + $core.bool hasBoolValue() => $_has(2); + @$pb.TagNumber(3) + void clearBoolValue() => clearField(3); + + @$pb.TagNumber(4) + $core.String get stringValue => $_getSZ(3); + @$pb.TagNumber(4) + set stringValue($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasStringValue() => $_has(3); + @$pb.TagNumber(4) + void clearStringValue() => clearField(4); +} + + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/pkgs/record_use/lib/src/proto/storage/usages_storage.pbenum.dart b/pkgs/record_use/lib/src/proto/storage/usages_storage.pbenum.dart new file mode 100644 index 00000000..42cb45b6 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/storage/usages_storage.pbenum.dart @@ -0,0 +1,11 @@ +// +// Generated code. Do not modify. +// source: usages_storage.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + diff --git a/pkgs/record_use/lib/src/proto/storage/usages_storage.pbjson.dart b/pkgs/record_use/lib/src/proto/storage/usages_storage.pbjson.dart new file mode 100644 index 00000000..2003fb71 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/storage/usages_storage.pbjson.dart @@ -0,0 +1,267 @@ +// +// Generated code. Do not modify. +// source: usages_storage.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use usagesDescriptor instead') +const Usages$json = { + '1': 'Usages', + '2': [ + {'1': 'metadata', '3': 1, '4': 1, '5': 11, '6': '.usages.Metadata', '10': 'metadata'}, + {'1': 'uris', '3': 2, '4': 3, '5': 11, '6': '.usages.Uri', '10': 'uris'}, + {'1': 'ids', '3': 3, '4': 3, '5': 11, '6': '.usages.Identifier', '10': 'ids'}, + {'1': 'calls', '3': 4, '4': 3, '5': 11, '6': '.usages.Usage', '10': 'calls'}, + {'1': 'instances', '3': 5, '4': 3, '5': 11, '6': '.usages.Usage', '10': 'instances'}, + ], +}; + +/// Descriptor for `Usages`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List usagesDescriptor = $convert.base64Decode( + 'CgZVc2FnZXMSLAoIbWV0YWRhdGEYASABKAsyEC51c2FnZXMuTWV0YWRhdGFSCG1ldGFkYXRhEh' + '8KBHVyaXMYAiADKAsyCy51c2FnZXMuVXJpUgR1cmlzEiQKA2lkcxgDIAMoCzISLnVzYWdlcy5J' + 'ZGVudGlmaWVyUgNpZHMSIwoFY2FsbHMYBCADKAsyDS51c2FnZXMuVXNhZ2VSBWNhbGxzEisKCW' + 'luc3RhbmNlcxgFIAMoCzINLnVzYWdlcy5Vc2FnZVIJaW5zdGFuY2Vz'); + +@$core.Deprecated('Use metadataDescriptor instead') +const Metadata$json = { + '1': 'Metadata', + '2': [ + {'1': 'comment', '3': 1, '4': 1, '5': 9, '9': 0, '10': 'comment', '17': true}, + {'1': 'version', '3': 2, '4': 1, '5': 9, '10': 'version'}, + ], + '8': [ + {'1': '_comment'}, + ], +}; + +/// Descriptor for `Metadata`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List metadataDescriptor = $convert.base64Decode( + 'CghNZXRhZGF0YRIdCgdjb21tZW50GAEgASgJSABSB2NvbW1lbnSIAQESGAoHdmVyc2lvbhgCIA' + 'EoCVIHdmVyc2lvbkIKCghfY29tbWVudA=='); + +@$core.Deprecated('Use uriDescriptor instead') +const Uri$json = { + '1': 'Uri', + '2': [ + {'1': 'value', '3': 1, '4': 1, '5': 9, '10': 'value'}, + ], +}; + +/// Descriptor for `Uri`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List uriDescriptor = $convert.base64Decode( + 'CgNVcmkSFAoFdmFsdWUYASABKAlSBXZhbHVl'); + +@$core.Deprecated('Use identifierDescriptor instead') +const Identifier$json = { + '1': 'Identifier', + '2': [ + {'1': 'uri', '3': 1, '4': 1, '5': 13, '10': 'uri'}, + {'1': 'parent', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'parent', '17': true}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + ], + '8': [ + {'1': '_parent'}, + ], +}; + +/// Descriptor for `Identifier`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List identifierDescriptor = $convert.base64Decode( + 'CgpJZGVudGlmaWVyEhAKA3VyaRgBIAEoDVIDdXJpEhsKBnBhcmVudBgCIAEoCUgAUgZwYXJlbn' + 'SIAQESEgoEbmFtZRgDIAEoCVIEbmFtZUIJCgdfcGFyZW50'); + +@$core.Deprecated('Use usageDescriptor instead') +const Usage$json = { + '1': 'Usage', + '2': [ + {'1': 'definition', '3': 1, '4': 1, '5': 11, '6': '.usages.Definition', '10': 'definition'}, + {'1': 'references', '3': 2, '4': 3, '5': 11, '6': '.usages.Reference', '10': 'references'}, + ], +}; + +/// Descriptor for `Usage`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List usageDescriptor = $convert.base64Decode( + 'CgVVc2FnZRIyCgpkZWZpbml0aW9uGAEgASgLMhIudXNhZ2VzLkRlZmluaXRpb25SCmRlZmluaX' + 'Rpb24SMQoKcmVmZXJlbmNlcxgCIAMoCzIRLnVzYWdlcy5SZWZlcmVuY2VSCnJlZmVyZW5jZXM='); + +@$core.Deprecated('Use definitionDescriptor instead') +const Definition$json = { + '1': 'Definition', + '2': [ + {'1': 'identifier', '3': 1, '4': 1, '5': 13, '10': 'identifier'}, + {'1': 'location', '3': 2, '4': 1, '5': 11, '6': '.usages.Location', '10': 'location'}, + {'1': 'loading_unit', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'loadingUnit', '17': true}, + ], + '8': [ + {'1': '_loading_unit'}, + ], +}; + +/// Descriptor for `Definition`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List definitionDescriptor = $convert.base64Decode( + 'CgpEZWZpbml0aW9uEh4KCmlkZW50aWZpZXIYASABKA1SCmlkZW50aWZpZXISLAoIbG9jYXRpb2' + '4YAiABKAsyEC51c2FnZXMuTG9jYXRpb25SCGxvY2F0aW9uEiYKDGxvYWRpbmdfdW5pdBgDIAEo' + 'CUgAUgtsb2FkaW5nVW5pdIgBAUIPCg1fbG9hZGluZ191bml0'); + +@$core.Deprecated('Use locationDescriptor instead') +const Location$json = { + '1': 'Location', + '2': [ + {'1': 'uri', '3': 1, '4': 1, '5': 13, '10': 'uri'}, + {'1': 'line', '3': 2, '4': 1, '5': 13, '10': 'line'}, + {'1': 'column', '3': 3, '4': 1, '5': 13, '10': 'column'}, + ], +}; + +/// Descriptor for `Location`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List locationDescriptor = $convert.base64Decode( + 'CghMb2NhdGlvbhIQCgN1cmkYASABKA1SA3VyaRISCgRsaW5lGAIgASgNUgRsaW5lEhYKBmNvbH' + 'VtbhgDIAEoDVIGY29sdW1u'); + +@$core.Deprecated('Use referenceDescriptor instead') +const Reference$json = { + '1': 'Reference', + '2': [ + {'1': 'location', '3': 1, '4': 1, '5': 11, '6': '.usages.Location', '10': 'location'}, + {'1': 'loading_unit', '3': 2, '4': 1, '5': 9, '10': 'loadingUnit'}, + {'1': 'arguments', '3': 3, '4': 1, '5': 11, '6': '.usages.Arguments', '9': 0, '10': 'arguments'}, + {'1': 'fields', '3': 4, '4': 1, '5': 11, '6': '.usages.Fields', '9': 0, '10': 'fields'}, + ], + '8': [ + {'1': 'reference'}, + ], +}; + +/// Descriptor for `Reference`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List referenceDescriptor = $convert.base64Decode( + 'CglSZWZlcmVuY2USLAoIbG9jYXRpb24YASABKAsyEC51c2FnZXMuTG9jYXRpb25SCGxvY2F0aW' + '9uEiEKDGxvYWRpbmdfdW5pdBgCIAEoCVILbG9hZGluZ1VuaXQSMQoJYXJndW1lbnRzGAMgASgL' + 'MhEudXNhZ2VzLkFyZ3VtZW50c0gAUglhcmd1bWVudHMSKAoGZmllbGRzGAQgASgLMg4udXNhZ2' + 'VzLkZpZWxkc0gAUgZmaWVsZHNCCwoJcmVmZXJlbmNl'); + +@$core.Deprecated('Use fieldsDescriptor instead') +const Fields$json = { + '1': 'Fields', + '2': [ + {'1': 'fields', '3': 1, '4': 3, '5': 11, '6': '.usages.Field', '10': 'fields'}, + ], +}; + +/// Descriptor for `Fields`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldsDescriptor = $convert.base64Decode( + 'CgZGaWVsZHMSJQoGZmllbGRzGAEgAygLMg0udXNhZ2VzLkZpZWxkUgZmaWVsZHM='); + +@$core.Deprecated('Use argumentsDescriptor instead') +const Arguments$json = { + '1': 'Arguments', + '2': [ + {'1': 'const', '3': 1, '4': 1, '5': 11, '6': '.usages.ConstArguments', '9': 0, '10': 'const'}, + {'1': 'non_const', '3': 2, '4': 1, '5': 11, '6': '.usages.NonConstArguments', '9': 0, '10': 'nonConst'}, + ], + '8': [ + {'1': 'kind'}, + ], +}; + +/// Descriptor for `Arguments`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List argumentsDescriptor = $convert.base64Decode( + 'CglBcmd1bWVudHMSLgoFY29uc3QYASABKAsyFi51c2FnZXMuQ29uc3RBcmd1bWVudHNIAFIFY2' + '9uc3QSOAoJbm9uX2NvbnN0GAIgASgLMhkudXNhZ2VzLk5vbkNvbnN0QXJndW1lbnRzSABSCG5v' + 'bkNvbnN0QgYKBGtpbmQ='); + +@$core.Deprecated('Use constArgumentsDescriptor instead') +const ConstArguments$json = { + '1': 'ConstArguments', + '2': [ + {'1': 'positional', '3': 1, '4': 3, '5': 11, '6': '.usages.ConstArguments.PositionalEntry', '10': 'positional'}, + {'1': 'named', '3': 2, '4': 3, '5': 11, '6': '.usages.ConstArguments.NamedEntry', '10': 'named'}, + ], + '3': [ConstArguments_PositionalEntry$json, ConstArguments_NamedEntry$json], +}; + +@$core.Deprecated('Use constArgumentsDescriptor instead') +const ConstArguments_PositionalEntry$json = { + '1': 'PositionalEntry', + '2': [ + {'1': 'key', '3': 1, '4': 1, '5': 13, '10': 'key'}, + {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, + ], + '7': {'7': true}, +}; + +@$core.Deprecated('Use constArgumentsDescriptor instead') +const ConstArguments_NamedEntry$json = { + '1': 'NamedEntry', + '2': [ + {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, + {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, + ], + '7': {'7': true}, +}; + +/// Descriptor for `ConstArguments`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List constArgumentsDescriptor = $convert.base64Decode( + 'Cg5Db25zdEFyZ3VtZW50cxJGCgpwb3NpdGlvbmFsGAEgAygLMiYudXNhZ2VzLkNvbnN0QXJndW' + '1lbnRzLlBvc2l0aW9uYWxFbnRyeVIKcG9zaXRpb25hbBI3CgVuYW1lZBgCIAMoCzIhLnVzYWdl' + 'cy5Db25zdEFyZ3VtZW50cy5OYW1lZEVudHJ5UgVuYW1lZBo9Cg9Qb3NpdGlvbmFsRW50cnkSEA' + 'oDa2V5GAEgASgNUgNrZXkSFAoFdmFsdWUYAiABKAlSBXZhbHVlOgI4ARo4CgpOYW1lZEVudHJ5' + 'EhAKA2tleRgBIAEoCVIDa2V5EhQKBXZhbHVlGAIgASgJUgV2YWx1ZToCOAE='); + +@$core.Deprecated('Use nonConstArgumentsDescriptor instead') +const NonConstArguments$json = { + '1': 'NonConstArguments', + '2': [ + {'1': 'positional', '3': 1, '4': 3, '5': 13, '10': 'positional'}, + {'1': 'named', '3': 2, '4': 3, '5': 9, '10': 'named'}, + ], +}; + +/// Descriptor for `NonConstArguments`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List nonConstArgumentsDescriptor = $convert.base64Decode( + 'ChFOb25Db25zdEFyZ3VtZW50cxIeCgpwb3NpdGlvbmFsGAEgAygNUgpwb3NpdGlvbmFsEhQKBW' + '5hbWVkGAIgAygJUgVuYW1lZA=='); + +@$core.Deprecated('Use fieldDescriptor instead') +const Field$json = { + '1': 'Field', + '2': [ + {'1': 'class_name', '3': 1, '4': 1, '5': 9, '10': 'className'}, + {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, + {'1': 'value', '3': 3, '4': 1, '5': 11, '6': '.usages.FieldValue', '10': 'value'}, + ], +}; + +/// Descriptor for `Field`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldDescriptor = $convert.base64Decode( + 'CgVGaWVsZBIdCgpjbGFzc19uYW1lGAEgASgJUgljbGFzc05hbWUSEgoEbmFtZRgCIAEoCVIEbm' + 'FtZRIoCgV2YWx1ZRgDIAEoCzISLnVzYWdlcy5GaWVsZFZhbHVlUgV2YWx1ZQ=='); + +@$core.Deprecated('Use fieldValueDescriptor instead') +const FieldValue$json = { + '1': 'FieldValue', + '2': [ + {'1': 'int_value', '3': 1, '4': 1, '5': 5, '9': 0, '10': 'intValue'}, + {'1': 'double_value', '3': 2, '4': 1, '5': 1, '9': 0, '10': 'doubleValue'}, + {'1': 'bool_value', '3': 3, '4': 1, '5': 8, '9': 0, '10': 'boolValue'}, + {'1': 'string_value', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'stringValue'}, + ], + '8': [ + {'1': 'value'}, + ], +}; + +/// Descriptor for `FieldValue`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldValueDescriptor = $convert.base64Decode( + 'CgpGaWVsZFZhbHVlEh0KCWludF92YWx1ZRgBIAEoBUgAUghpbnRWYWx1ZRIjCgxkb3VibGVfdm' + 'FsdWUYAiABKAFIAFILZG91YmxlVmFsdWUSHwoKYm9vbF92YWx1ZRgDIAEoCEgAUglib29sVmFs' + 'dWUSIwoMc3RyaW5nX3ZhbHVlGAQgASgJSABSC3N0cmluZ1ZhbHVlQgcKBXZhbHVl'); + diff --git a/pkgs/record_use/lib/src/proto/storage/usages_storage.pbserver.dart b/pkgs/record_use/lib/src/proto/storage/usages_storage.pbserver.dart new file mode 100644 index 00000000..1b452d1f --- /dev/null +++ b/pkgs/record_use/lib/src/proto/storage/usages_storage.pbserver.dart @@ -0,0 +1,14 @@ +// +// Generated code. Do not modify. +// source: usages_storage.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +export 'usages_storage.pb.dart'; + diff --git a/pkgs/record_use/lib/src/record_use.dart b/pkgs/record_use/lib/src/record_use.dart index ef52d5d6..6fa4e385 100644 --- a/pkgs/record_use/lib/src/record_use.dart +++ b/pkgs/record_use/lib/src/record_use.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:typed_data'; + import 'package:collection/collection.dart'; import 'data_classes/arguments.dart'; @@ -13,8 +15,8 @@ import 'data_classes/usage.dart'; import 'data_classes/usage_record.dart'; extension type RecordUse._(UsageRecord _recordUses) { - RecordUse.fromJson(Map json) - : this._(UsageRecord.fromJson(json)); + RecordUse.fromFile(Uint8List contents) + : this._(UsageRecord.fromFile(contents)); /// Show the metadata for this recording of usages. Metadata get metadata => _recordUses.metadata; @@ -101,7 +103,7 @@ extension type RecordUse._(UsageRecord _recordUses) { /// /// What kinds of fields can be recorded depends on the implementation of /// https://dart-review.googlesource.com/c/sdk/+/369620/13/pkg/vm/lib/transformations/record_use/record_instance.dart - Iterable>? instanceReferencesTo(Identifier definition) => + Iterable>? instanceReferencesTo(Identifier definition) => _recordUses.instances .firstWhereOrNull( (instance) => instance.definition.identifier == definition) diff --git a/pkgs/record_use/pubspec.yaml b/pkgs/record_use/pubspec.yaml index 03d8b327..e4517996 100644 --- a/pkgs/record_use/pubspec.yaml +++ b/pkgs/record_use/pubspec.yaml @@ -8,6 +8,7 @@ environment: dependencies: collection: ^1.18.0 + protobuf: ^3.1.0 pub_semver: ^2.1.4 dev_dependencies: diff --git a/pkgs/record_use/test/record_use_test.dart b/pkgs/record_use/test/record_use_test.dart index 2adbfb1f..8fd4a52f 100644 --- a/pkgs/record_use/test/record_use_test.dart +++ b/pkgs/record_use/test/record_use_test.dart @@ -3,30 +3,30 @@ // BSD-style license that can be found in the LICENSE file. import 'package:pub_semver/pub_semver.dart'; -import 'package:record_use/record_use.dart'; import 'package:record_use/record_use_internal.dart'; import 'package:test/test.dart'; void main() { - test('Json->Object->Json', () { - expect(UsageRecord.fromJson(recordedUsesJson).toJson(), recordedUsesJson); - }); + // test('Json->Object->Json', () { + // expect( + // UsageRecord.fromFile(recordedUsesJson).serialize(), recordedUsesJson); + // }); test('Object->Json->Object', () { - expect(UsageRecord.fromJson(recordedUses.toJson()), recordedUses); + expect(UsageRecord.fromFile(recordedUses.serialize()), recordedUses); }); - test('API calls', () { - expect( - RecordUse.fromJson(recordedUsesJson).callReferencesTo(callId), - recordedUses.calls.expand((e) => e.references).map((e) => e.arguments), - ); - }); - test('API instances', () { - expect( - RecordUse.fromJson(recordedUsesJson).instanceReferencesTo(instanceId), - recordedUses.instances.expand((e) => e.references).map((e) => e.fields), - ); - }); + // test('API calls', () { + // expect( + // RecordUse.fromFile(recordedUsesJson).callReferencesTo(callId), + // recordedUses.calls.expand((e) => e.references).map((e) => e.arguments), + // ); + // }); + // test('API instances', () { + // expect( + // RecordUse.fromFile(recordedUsesJson).instanceReferencesTo(instanceId), + // recordedUses.instances.expand((e) => e.references).map((e) => e.fields), + // ); + // }); } final callId = Identifier( diff --git a/pkgs/record_use/usages.proto b/pkgs/record_use/usages.proto new file mode 100644 index 00000000..592334dc --- /dev/null +++ b/pkgs/record_use/usages.proto @@ -0,0 +1,86 @@ +syntax = "proto3"; +package usages; + +message Usages { + Metadata metadata = 1; + repeated Usage calls = 4; + repeated Usage instances = 5; +} + +message Metadata { + optional string comment = 1; + string version = 2; +} + +message Uri { + string value = 1; +} + +message Identifier { + Uri uri = 1; + optional string parent = 2; + string name = 3; +} + +message Usage { + Definition definition = 1; + repeated Reference references = 2; +} + +message Definition { + Identifier identifier = 1; + Location location = 2; + optional string loading_unit = 3; // Optional, as some loading units are null +} + +message Location { + Uri uri = 1; + uint32 line = 2; + uint32 column = 3; +} + +message Reference { + Location location = 1; + string loading_unit = 2; + oneof reference { + Arguments arguments = 3; + Fields fields = 4; + } +} + +message Fields { + repeated Field fields = 1; +} + +message Arguments { + oneof kind { + ConstArguments const = 1; + NonConstArguments non_const = 2; + } +} + +message ConstArguments { + map positional = 1; + map named = 2; +} + +message NonConstArguments { + repeated uint32 positional = 1; + repeated string named = 2; +} + +message Field { + string class_name = 1; + string name = 2; + FieldValue value = 3; +} + +message FieldValue { + oneof value { + int32 int_value = 1; + double double_value = 2; + bool bool_value = 3; + string string_value = 4; + } +} + diff --git a/pkgs/record_use/usages_storage.proto b/pkgs/record_use/usages_storage.proto new file mode 100644 index 00000000..509a3fcf --- /dev/null +++ b/pkgs/record_use/usages_storage.proto @@ -0,0 +1,88 @@ +syntax = "proto3"; +package usages; + +message Usages { + Metadata metadata = 1; + repeated Uri uris = 2; + repeated Identifier ids = 3; + repeated Usage calls = 4; + repeated Usage instances = 5; +} + +message Metadata { + optional string comment = 1; + string version = 2; +} + +message Uri { + string value = 1; +} + +message Identifier { + uint32 uri = 1; + optional string parent = 2; + string name = 3; +} + +message Usage { + Definition definition = 1; + repeated Reference references = 2; +} + +message Definition { + uint32 identifier = 1; + Location location = 2; + optional string loading_unit = 3; // Optional, as some loading units are null +} + +message Location { + uint32 uri = 1; + uint32 line = 2; + uint32 column = 3; +} + +message Reference { + Location location = 1; + string loading_unit = 2; + oneof reference { + Arguments arguments = 3; + Fields fields = 4; + } +} + +message Fields { + repeated Field fields = 1; +} + +message Arguments { + oneof kind { + ConstArguments const = 1; + NonConstArguments non_const = 2; + } +} + +message ConstArguments { + map positional = 1; + map named = 2; +} + +message NonConstArguments { + repeated uint32 positional = 1; + repeated string named = 2; +} + +message Field { + string class_name = 1; + string name = 2; + FieldValue value = 3; +} + +message FieldValue { + oneof value { + int32 int_value = 1; + double double_value = 2; + bool bool_value = 3; + string string_value = 4; + } +} + From 8ebd94cc8fd45bea64d8ad83cfa0a979edd44117 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 18 Jun 2024 17:25:11 +0200 Subject: [PATCH 07/23] Switch to protobuf --- pkgs/record_use/README.md | 29 +- pkgs/record_use/lib/record_use.dart | 9 +- pkgs/record_use/lib/record_use_internal.dart | 12 +- .../lib/src/data_classes/annotation.dart | 44 - .../lib/src/data_classes/arguments.dart | 67 -- .../lib/src/data_classes/definition.dart | 35 - .../lib/src/data_classes/extensions.dart | 105 ++ .../lib/src/data_classes/field.dart | 31 - .../lib/src/data_classes/identifier.dart | 36 - .../lib/src/data_classes/location.dart | 25 - .../lib/src/data_classes/metadata.dart | 29 - .../lib/src/data_classes/reference.dart | 77 -- .../lib/src/data_classes/usage.dart | 42 - .../lib/src/data_classes/usage_record.dart | 61 - .../lib/src/proto/read/usages.pb.dart | 1037 ---------------- .../lib/src/proto/read/usages.pbjson.dart | 265 ----- .../src/proto/storage/usages_storage.pb.dart | 1047 ----------------- .../proto/storage/usages_storage.pbjson.dart | 267 ----- .../lib/src/proto/usages_read.pb.dart | 396 +++++++ ...es.pbenum.dart => usages_read.pbenum.dart} | 3 +- .../lib/src/proto/usages_read.pbjson.dart | 139 +++ ...bserver.dart => usages_read.pbserver.dart} | 5 +- .../lib/src/proto/usages_read.proto | 31 + .../lib/src/proto/usages_shared.pb.dart | 796 +++++++++++++ .../lib/src/proto/usages_shared.pbenum.dart | 10 + .../lib/src/proto/usages_shared.pbjson.dart | 271 +++++ .../lib/src/proto/usages_shared.pbserver.dart | 13 + .../src/proto/usages_shared.proto} | 50 +- .../lib/src/proto/usages_storage.pb.dart | 411 +++++++ .../{storage => }/usages_storage.pbenum.dart | 1 - .../lib/src/proto/usages_storage.pbjson.dart | 142 +++ .../usages_storage.pbserver.dart | 1 - .../lib/src/proto/usages_storage.proto | 32 + pkgs/record_use/lib/src/record_use.dart | 81 +- pkgs/record_use/test/record_use_test.dart | 208 ---- pkgs/record_use/test/storage_test.dart | 26 + pkgs/record_use/test/testdata/data.binpb | Bin 0 -> 775 bytes pkgs/record_use/test/testdata/data.dart | 107 ++ pkgs/record_use/test/testdata/data.textpb | 130 ++ pkgs/record_use/test/usage_test.dart | 49 + pkgs/record_use/usages_storage.proto | 88 -- 41 files changed, 2744 insertions(+), 3464 deletions(-) delete mode 100644 pkgs/record_use/lib/src/data_classes/annotation.dart delete mode 100644 pkgs/record_use/lib/src/data_classes/arguments.dart delete mode 100644 pkgs/record_use/lib/src/data_classes/definition.dart create mode 100644 pkgs/record_use/lib/src/data_classes/extensions.dart delete mode 100644 pkgs/record_use/lib/src/data_classes/field.dart delete mode 100644 pkgs/record_use/lib/src/data_classes/identifier.dart delete mode 100644 pkgs/record_use/lib/src/data_classes/location.dart delete mode 100644 pkgs/record_use/lib/src/data_classes/metadata.dart delete mode 100644 pkgs/record_use/lib/src/data_classes/reference.dart delete mode 100644 pkgs/record_use/lib/src/data_classes/usage.dart delete mode 100644 pkgs/record_use/lib/src/data_classes/usage_record.dart delete mode 100644 pkgs/record_use/lib/src/proto/read/usages.pb.dart delete mode 100644 pkgs/record_use/lib/src/proto/read/usages.pbjson.dart delete mode 100644 pkgs/record_use/lib/src/proto/storage/usages_storage.pb.dart delete mode 100644 pkgs/record_use/lib/src/proto/storage/usages_storage.pbjson.dart create mode 100644 pkgs/record_use/lib/src/proto/usages_read.pb.dart rename pkgs/record_use/lib/src/proto/{read/usages.pbenum.dart => usages_read.pbenum.dart} (91%) create mode 100644 pkgs/record_use/lib/src/proto/usages_read.pbjson.dart rename pkgs/record_use/lib/src/proto/{read/usages.pbserver.dart => usages_read.pbserver.dart} (87%) create mode 100644 pkgs/record_use/lib/src/proto/usages_read.proto create mode 100644 pkgs/record_use/lib/src/proto/usages_shared.pb.dart create mode 100644 pkgs/record_use/lib/src/proto/usages_shared.pbenum.dart create mode 100644 pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart create mode 100644 pkgs/record_use/lib/src/proto/usages_shared.pbserver.dart rename pkgs/record_use/{usages.proto => lib/src/proto/usages_shared.proto} (51%) create mode 100644 pkgs/record_use/lib/src/proto/usages_storage.pb.dart rename pkgs/record_use/lib/src/proto/{storage => }/usages_storage.pbenum.dart (99%) create mode 100644 pkgs/record_use/lib/src/proto/usages_storage.pbjson.dart rename pkgs/record_use/lib/src/proto/{storage => }/usages_storage.pbserver.dart (99%) create mode 100644 pkgs/record_use/lib/src/proto/usages_storage.proto delete mode 100644 pkgs/record_use/test/record_use_test.dart create mode 100644 pkgs/record_use/test/storage_test.dart create mode 100644 pkgs/record_use/test/testdata/data.binpb create mode 100644 pkgs/record_use/test/testdata/data.dart create mode 100644 pkgs/record_use/test/testdata/data.textpb create mode 100644 pkgs/record_use/test/usage_test.dart delete mode 100644 pkgs/record_use/usages_storage.proto diff --git a/pkgs/record_use/README.md b/pkgs/record_use/README.md index 8ed1d488..0e27d2bd 100644 --- a/pkgs/record_use/README.md +++ b/pkgs/record_use/README.md @@ -12,12 +12,11 @@ Dart objects with the `@RecordUse` annotation are being recorded at compile time, providing the user with information. The information depends on the object being recorded. -- If placed on a static method, the annotation means that calls to the method -are being recorded. If the `arguments` parameter is set to `true`, then -arguments will also be recorded, as far as they can be inferred at compile time. +- If placed on a static method, the annotation means that arguments passed to +the method will be recorded, as far as they can be inferred at compile time. - If placed on a class with a constant constructor, the annotation means that any constant instance of the class will be recorded. This is particularly useful -when placing +when using the class as an annotation. ## Example ```dart @@ -64,7 +63,7 @@ class RecordMetadata { } ``` -This code will generate a JSON file that contains both the `metadata` values of +This code will generate a data file that contains both the `metadata` values of the `RecordMetadata` instances, as well as the arguments for the different methods annotated with `@RecordUse()`. @@ -76,11 +75,12 @@ void main(List arguments){ link(arguments, (config, output) async { final uses = config.recordedUses; - final args = uses.callReferencesTo(boolMetadataId)); - //[args] is an iterable of [Argument] classes, in this case containing "42" + final args = uses.constArgumentsTo(boolMetadataId)); + //[args] is an iterable of arguments, in this case containing "42" final fields = uses.instanceReferencesTo(recordMetadataId); - //[fields] is an iterable of [Field] classes, in this case containing + //[fields] is an iterable of the fields of the class, in this case + //containing // {"arguments": "leroyjenkins"} // {"arguments": 3.14} // {"arguments": 42} @@ -98,5 +98,18 @@ To install the record_use package, run the following command: dart pub add record_use ``` +## Internals + +The data is stored in protobuf format. Two schemas are provided: + +### [usages_read](lib/src/proto/usages_read.proto) +This is the schema for the internal API for the storage format, which is used +in the SDK for writing the data, and in the [record_use](lib/src/record_use.dart) format for retrieving the +data for the queries from the user. + +### [usages_storage](lib/src/proto/usages_storage.proto) +This schema is for the storage of the data, and contains some optimizations such +as collecting all URIs in a table, to avoid repetitions. + ## Contributing Contributions are welcome! Please open an issue or submit a pull request. \ No newline at end of file diff --git a/pkgs/record_use/lib/record_use.dart b/pkgs/record_use/lib/record_use.dart index 483b6388..07d851c5 100644 --- a/pkgs/record_use/lib/record_use.dart +++ b/pkgs/record_use/lib/record_use.dart @@ -2,11 +2,4 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -export 'src/data_classes/arguments.dart' - show Arguments, ConstArguments, NonConstArguments; -export 'src/data_classes/field.dart' show Field; -export 'src/data_classes/identifier.dart' show Identifier; -export 'src/data_classes/location.dart' show Location; -export 'src/data_classes/metadata.dart' show Metadata; -export 'src/data_classes/reference.dart' show CallReference, InstanceReference; -export 'src/record_use.dart' show RecordUse; +export 'src/record_use.dart' show Identifier, RecordUse; diff --git a/pkgs/record_use/lib/record_use_internal.dart b/pkgs/record_use/lib/record_use_internal.dart index 61523b3d..b8b89b4d 100644 --- a/pkgs/record_use/lib/record_use_internal.dart +++ b/pkgs/record_use/lib/record_use_internal.dart @@ -2,13 +2,5 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -export 'src/data_classes/annotation.dart'; -export 'src/data_classes/arguments.dart'; -export 'src/data_classes/definition.dart'; -export 'src/data_classes/field.dart'; -export 'src/data_classes/identifier.dart'; -export 'src/data_classes/location.dart'; -export 'src/data_classes/metadata.dart'; -export 'src/data_classes/reference.dart'; -export 'src/data_classes/usage.dart'; -export 'src/data_classes/usage_record.dart'; +export 'src/proto/usages_read.pb.dart'; +export 'src/proto/usages_shared.pb.dart'; diff --git a/pkgs/record_use/lib/src/data_classes/annotation.dart b/pkgs/record_use/lib/src/data_classes/annotation.dart deleted file mode 100644 index 8f27f324..00000000 --- a/pkgs/record_use/lib/src/data_classes/annotation.dart +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:collection/collection.dart'; - -import 'identifier.dart'; - -class Annotation { - final Identifier identifier; - final Map fields; - - Annotation({ - required this.identifier, - required this.fields, - }); - - factory Annotation.fromJson( - Map json, - List identifiers, - ) => - Annotation( - identifier: identifiers[json['id'] as int], - fields: json['fields'] as Map, - ); - - Map toJson(List identifiers) => { - 'id': identifiers.indexOf(identifier), - 'fields': fields, - }; - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - final mapEquals = const DeepCollectionEquality().equals; - - return other is Annotation && - other.identifier == identifier && - mapEquals(other.fields, fields); - } - - @override - int get hashCode => identifier.hashCode ^ fields.hashCode; -} diff --git a/pkgs/record_use/lib/src/data_classes/arguments.dart b/pkgs/record_use/lib/src/data_classes/arguments.dart deleted file mode 100644 index ca6e5627..00000000 --- a/pkgs/record_use/lib/src/data_classes/arguments.dart +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import '../proto/usages.pb.dart' as pb; - -class Arguments { - final pb.Arguments _arguments; - - late final ConstArguments constArguments = _arguments.hasConst_1() - ? ConstArguments(_arguments.const_1) - : ConstArguments(); - late final NonConstArguments nonConstArguments = _arguments.hasNonConst() - ? NonConstArguments(_arguments.nonConst) - : NonConstArguments(); - - Arguments(this._arguments); - - @override - int get hashCode => _arguments.hashCode; - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is Arguments && other._arguments == _arguments; - } -} - -class ConstArguments { - final pb.ConstArguments? _arguments; - - late final Map positional = _arguments?.positional ?? {}; - late final Map named = _arguments?.named ?? {}; - - ConstArguments([this._arguments]); - - @override - int get hashCode => positional.hashCode ^ named.hashCode; - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is ConstArguments && other._arguments == _arguments; - } -} - -class NonConstArguments { - final pb.NonConstArguments? _arguments; - late final List positional = _arguments?.positional ?? []; - - /// Assuming named arguments are strings (keys) - late final List named = _arguments?.named ?? []; - - NonConstArguments([this._arguments]); - - @override - int get hashCode => _arguments.hashCode; - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is NonConstArguments && other._arguments == _arguments; - } -} diff --git a/pkgs/record_use/lib/src/data_classes/definition.dart b/pkgs/record_use/lib/src/data_classes/definition.dart deleted file mode 100644 index 2f64746d..00000000 --- a/pkgs/record_use/lib/src/data_classes/definition.dart +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import '../proto/usages.pb.dart' as pb; -import 'identifier.dart'; -import 'location.dart'; - -class Definition { - final pb.Definition _definition; - final List _identifiers; - final List _uris; - - late final Identifier identifier = - Identifier.fromPb(_identifiers[_definition.identifier], _uris); - - /// Represents the '@' field in the JSON - late final Location location = - Location(_definition.location, identifier.uri, null); - - late final String? loadingUnit = - _definition.hasLoadingUnit() ? _definition.loadingUnit : null; - - Definition(this._definition, this._identifiers, this._uris); - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is Definition && other._definition == _definition; - } - - @override - int get hashCode => _definition.hashCode; -} diff --git a/pkgs/record_use/lib/src/data_classes/extensions.dart b/pkgs/record_use/lib/src/data_classes/extensions.dart new file mode 100644 index 00000000..00fca219 --- /dev/null +++ b/pkgs/record_use/lib/src/data_classes/extensions.dart @@ -0,0 +1,105 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:typed_data'; + +import '../proto/usages_read.pb.dart' as pb; +import '../proto/usages_shared.pb.dart' as pb_shared; +import '../proto/usages_storage.pb.dart' as pb_storage; + +extension UsagesExt on pb.Usages { + Uint8List toBuffer() => _toStorage().writeToBuffer(); + String toDebugJson() => + const JsonEncoder.withIndent(' ').convert(_toStorage().writeToJsonMap()); + + pb_storage.Usages _toStorage() { + final definitions = + [...calls, ...instances].map((e) => e.definition).toList(); + final uris = [...calls, ...instances] + .expand((e) => [ + e.definition.identifier.uri, + ...e.references.map( + (e) => e.location.uri, + ) + ]) + .toList(); + return pb_storage.Usages( + metadata: metadata, + definitions: definitions, + uris: uris, + instances: instances.map((e) => e.toStorage(definitions, uris)), + calls: calls.map((e) => e.toStorage(definitions, uris)), + ); + } +} + +extension UsageExt on pb.Usage { + pb_storage.Usage toStorage( + List definitions, List uris) => + pb_storage.Usage( + definition: definitions.indexOf(definition), + references: references.map((e) => e.toStorage(uris)), + ); +} + +extension ReferenceExt on pb.Reference { + pb_storage.Reference toStorage(List uris) => pb_storage.Reference( + arguments: hasArguments() ? arguments : null, + fields: hasFields() ? fields : null, + loadingUnit: loadingUnit, + location: location.toStorage(uris), + ); +} + +extension LocationExt on pb.Location { + pb_storage.Location toStorage(List uris) => pb_storage.Location( + column: column, + line: line, + uri: uris.indexOf(uri), + ); +} + +extension UsagesStorageExt on pb_storage.Usages { + pb.Usages toApi() => pb.Usages( + metadata: metadata, + calls: calls.map((e) => e.toApi(definitions, uris)), + instances: instances.map((e) => e.toApi(definitions, uris)), + ); +} + +extension UsageStorageExt on pb_storage.Usage { + pb.Usage toApi(List definitions, List uris) => + pb.Usage( + definition: definitions[definition], + references: references.map((e) => e.toApi(uris)), + ); +} + +extension ReferenceStorageExt on pb_storage.Reference { + pb.Reference toApi(List uris) => pb.Reference( + arguments: hasArguments() ? arguments : null, + fields: hasFields() ? fields : null, + loadingUnit: loadingUnit, + location: location.toApi(uris), + ); +} + +extension LocationStorageExt on pb_storage.Location { + pb.Location toApi(List uris) => pb.Location( + column: column, + line: line, + uri: uris[uri], + ); +} + +extension FieldValueExt on pb_shared.FieldValue { + Object toObject() => switch (whichValue()) { + pb_shared.FieldValue_Value.intValue => intValue, + pb_shared.FieldValue_Value.doubleValue => doubleValue, + pb_shared.FieldValue_Value.boolValue => boolValue, + pb_shared.FieldValue_Value.stringValue => stringValue, + pb_shared.FieldValue_Value.notSet => throw ArgumentError(), + }; +} diff --git a/pkgs/record_use/lib/src/data_classes/field.dart b/pkgs/record_use/lib/src/data_classes/field.dart deleted file mode 100644 index ceae5544..00000000 --- a/pkgs/record_use/lib/src/data_classes/field.dart +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import '../proto/usages.pb.dart' as pb; - -class Field { - final pb.Field _field; - - late final String className = _field.className; - late final String name = _field.name; - late final Object? value = switch (_field.value.whichValue()) { - pb.FieldValue_Value.intValue => _field.value.intValue, - pb.FieldValue_Value.doubleValue => _field.value.doubleValue, - pb.FieldValue_Value.boolValue => _field.value.boolValue, - pb.FieldValue_Value.stringValue => _field.value.stringValue, - pb.FieldValue_Value.notSet => throw UnimplementedError(), - }; - - Field(this._field); - - @override - int get hashCode => _field.hashCode; - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is Field && other._field == _field; - } -} diff --git a/pkgs/record_use/lib/src/data_classes/identifier.dart b/pkgs/record_use/lib/src/data_classes/identifier.dart deleted file mode 100644 index 053d3106..00000000 --- a/pkgs/record_use/lib/src/data_classes/identifier.dart +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import '../proto/usages.pb.dart' as pb; - -class Identifier { - final pb.Identifier _identifier; - - final String uri; - - /// Optional since not all elements have parents - late final String? parent = - _identifier.hasParent() ? _identifier.parent : null; - late final String name = _identifier.name; - - Identifier.fromPb(this._identifier, List uris) - : uri = uris[_identifier.uri]; - - Identifier(this.uri, String? parent, String name) - : _identifier = pb.Identifier( - name: name, - parent: parent, - uri: uri, - ); - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is Identifier && other._identifier == _identifier; - } - - @override - int get hashCode => _identifier.hashCode; -} diff --git a/pkgs/record_use/lib/src/data_classes/location.dart b/pkgs/record_use/lib/src/data_classes/location.dart deleted file mode 100644 index 56cfc325..00000000 --- a/pkgs/record_use/lib/src/data_classes/location.dart +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import '../proto/usages.pb.dart' as pb; - -class Location { - late String uri; - late int line; - late int column; - - final pb.Location _protoLocation; - Location(this._protoLocation, String? uri, List? uris) - : uri = uri ?? uris![_protoLocation.uri]; - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is Location && other._protoLocation == _protoLocation; - } - - @override - int get hashCode => _protoLocation.hashCode; -} diff --git a/pkgs/record_use/lib/src/data_classes/metadata.dart b/pkgs/record_use/lib/src/data_classes/metadata.dart deleted file mode 100644 index 635835f3..00000000 --- a/pkgs/record_use/lib/src/data_classes/metadata.dart +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:pub_semver/pub_semver.dart'; - -import '../proto/usages.pb.dart' as pb; - -class Metadata { - final pb.Metadata _protoMetadata; - late final String? comment = _protoMetadata.comment; - late final Version version = Version.parse(_protoMetadata.version); - - Metadata({required pb.Metadata protoMetadata}) - : _protoMetadata = protoMetadata; - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is Metadata && other._protoMetadata == _protoMetadata; - } - - @override - int get hashCode => _protoMetadata.hashCode; - - @override - String toString() => _protoMetadata.toString(); -} diff --git a/pkgs/record_use/lib/src/data_classes/reference.dart b/pkgs/record_use/lib/src/data_classes/reference.dart deleted file mode 100644 index f3048304..00000000 --- a/pkgs/record_use/lib/src/data_classes/reference.dart +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import '../proto/usages.pb.dart' as pb; -import 'arguments.dart'; -import 'field.dart'; -import 'location.dart'; - -sealed class Reference { - final String? loadingUnit; - // Represents the "@" field in the JSON - - final Location location; - - const Reference({this.loadingUnit, required this.location}); - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is Reference && - other.loadingUnit == loadingUnit && - other.location == location; - } - - @override - int get hashCode => loadingUnit.hashCode ^ location.hashCode; -} - -final class CallReference extends Reference { - final pb.Reference _reference; - - late final Arguments? arguments = - _reference.hasArguments() ? Arguments(_reference.arguments) : null; - - CallReference(this._reference, List uris) - : super( - location: Location(_reference.location, null, uris), - loadingUnit: - _reference.hasLoadingUnit() ? _reference.loadingUnit : null, - ); - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is CallReference && other._reference == _reference; - } - - @override - int get hashCode => _reference.hashCode; -} - -final class InstanceReference extends Reference { - final pb.Reference _reference; - - late final Iterable fields = - _reference.hasFields() ? _reference.fields.fields.map(Field.new) : []; - - InstanceReference(this._reference, List uris) - : super( - location: Location(_reference.location, null, uris), - loadingUnit: - _reference.hasLoadingUnit() ? _reference.loadingUnit : null, - ); - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is CallReference && other._reference == _reference; - } - - @override - int get hashCode => _reference.hashCode; -} diff --git a/pkgs/record_use/lib/src/data_classes/usage.dart b/pkgs/record_use/lib/src/data_classes/usage.dart deleted file mode 100644 index cff17aa3..00000000 --- a/pkgs/record_use/lib/src/data_classes/usage.dart +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import '../proto/usages.pb.dart' as pb; -import 'definition.dart'; -import 'reference.dart'; - -class Usage { - final pb.Usage _usage; - final List _ids; - final List _uris; - late final Definition definition = Definition(_usage.definition, _ids, _uris); - late final List references = _usage.references - .map( - (e) => switch (e.whichReference()) { - pb.Reference_Reference.arguments => CallReference(e, _uris), - pb.Reference_Reference.fields => InstanceReference(e, _uris), - pb.Reference_Reference.notSet => throw UnimplementedError(), - }, - ) - .whereType() - .toList(); - - Usage({ - required pb.Usage usage, - required List ids, - required List uris, - }) : _usage = usage, - _ids = ids, - _uris = uris; - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is Usage && other._usage == _usage; - } - - @override - int get hashCode => _usage.hashCode; -} diff --git a/pkgs/record_use/lib/src/data_classes/usage_record.dart b/pkgs/record_use/lib/src/data_classes/usage_record.dart deleted file mode 100644 index 2389247c..00000000 --- a/pkgs/record_use/lib/src/data_classes/usage_record.dart +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:typed_data'; - -import 'package:collection/collection.dart'; - -import '../proto/usages.pb.dart' as pb; -import 'metadata.dart'; -import 'reference.dart'; -import 'usage.dart'; - -class UsageRecord { - final Metadata metadata; - final Iterable> calls; - final Iterable> instances; - - UsageRecord({ - required this.metadata, - required this.calls, - required this.instances, - }); - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - final listEquals = const DeepCollectionEquality().equals; - - return other is UsageRecord && - other.metadata == metadata && - listEquals(other.calls, calls) && - listEquals(other.instances, instances); - } - - @override - int get hashCode => metadata.hashCode ^ calls.hashCode ^ instances.hashCode; - - factory UsageRecord.fromFile(Uint8List fileContents) { - final usages = pb.Usages.fromBuffer(fileContents); - final ids = usages.ids; - final uris = usages.uris.map((e) => e.value).toList(); - return UsageRecord( - metadata: Metadata(protoMetadata: usages.metadata), - calls: usages.calls.map((e) => Usage( - usage: e, - ids: ids, - uris: uris, - )), - instances: usages.calls.map((e) => Usage( - usage: e, - ids: ids, - uris: uris, - )), - ); - } - - Uint8List serialize() { - return pb.Usages().writeToBuffer(); - } -} diff --git a/pkgs/record_use/lib/src/proto/read/usages.pb.dart b/pkgs/record_use/lib/src/proto/read/usages.pb.dart deleted file mode 100644 index a1526e3b..00000000 --- a/pkgs/record_use/lib/src/proto/read/usages.pb.dart +++ /dev/null @@ -1,1037 +0,0 @@ -// -// Generated code. Do not modify. -// source: usages.proto -// -// @dart = 2.12 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: unnecessary_import, unnecessary_this, unused_import - -import 'dart:core' as $core; - -import 'package:protobuf/protobuf.dart' as $pb; - -class Usages extends $pb.GeneratedMessage { - factory Usages({ - Metadata? metadata, - $core.Iterable? calls, - $core.Iterable? instances, - }) { - final $result = create(); - if (metadata != null) { - $result.metadata = metadata; - } - if (calls != null) { - $result.calls.addAll(calls); - } - if (instances != null) { - $result.instances.addAll(instances); - } - return $result; - } - Usages._() : super(); - factory Usages.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Usages.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Usages', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOM(1, _omitFieldNames ? '' : 'metadata', subBuilder: Metadata.create) - ..pc(4, _omitFieldNames ? '' : 'calls', $pb.PbFieldType.PM, subBuilder: Usage.create) - ..pc(5, _omitFieldNames ? '' : 'instances', $pb.PbFieldType.PM, subBuilder: Usage.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Usages clone() => Usages()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Usages copyWith(void Function(Usages) updates) => super.copyWith((message) => updates(message as Usages)) as Usages; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Usages create() => Usages._(); - Usages createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Usages getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Usages? _defaultInstance; - - @$pb.TagNumber(1) - Metadata get metadata => $_getN(0); - @$pb.TagNumber(1) - set metadata(Metadata v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasMetadata() => $_has(0); - @$pb.TagNumber(1) - void clearMetadata() => clearField(1); - @$pb.TagNumber(1) - Metadata ensureMetadata() => $_ensure(0); - - @$pb.TagNumber(4) - $core.List get calls => $_getList(1); - - @$pb.TagNumber(5) - $core.List get instances => $_getList(2); -} - -class Metadata extends $pb.GeneratedMessage { - factory Metadata({ - $core.String? comment, - $core.String? version, - }) { - final $result = create(); - if (comment != null) { - $result.comment = comment; - } - if (version != null) { - $result.version = version; - } - return $result; - } - Metadata._() : super(); - factory Metadata.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Metadata.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Metadata', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'comment') - ..aOS(2, _omitFieldNames ? '' : 'version') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Metadata clone() => Metadata()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Metadata copyWith(void Function(Metadata) updates) => super.copyWith((message) => updates(message as Metadata)) as Metadata; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Metadata create() => Metadata._(); - Metadata createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Metadata getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Metadata? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get comment => $_getSZ(0); - @$pb.TagNumber(1) - set comment($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasComment() => $_has(0); - @$pb.TagNumber(1) - void clearComment() => clearField(1); - - @$pb.TagNumber(2) - $core.String get version => $_getSZ(1); - @$pb.TagNumber(2) - set version($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasVersion() => $_has(1); - @$pb.TagNumber(2) - void clearVersion() => clearField(2); -} - -class Uri extends $pb.GeneratedMessage { - factory Uri({ - $core.String? value, - }) { - final $result = create(); - if (value != null) { - $result.value = value; - } - return $result; - } - Uri._() : super(); - factory Uri.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Uri.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Uri', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'value') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Uri clone() => Uri()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Uri copyWith(void Function(Uri) updates) => super.copyWith((message) => updates(message as Uri)) as Uri; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Uri create() => Uri._(); - Uri createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Uri getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Uri? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get value => $_getSZ(0); - @$pb.TagNumber(1) - set value($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasValue() => $_has(0); - @$pb.TagNumber(1) - void clearValue() => clearField(1); -} - -class Identifier extends $pb.GeneratedMessage { - factory Identifier({ - Uri? uri, - $core.String? parent, - $core.String? name, - }) { - final $result = create(); - if (uri != null) { - $result.uri = uri; - } - if (parent != null) { - $result.parent = parent; - } - if (name != null) { - $result.name = name; - } - return $result; - } - Identifier._() : super(); - factory Identifier.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Identifier.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Identifier', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOM(1, _omitFieldNames ? '' : 'uri', subBuilder: Uri.create) - ..aOS(2, _omitFieldNames ? '' : 'parent') - ..aOS(3, _omitFieldNames ? '' : 'name') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Identifier clone() => Identifier()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Identifier copyWith(void Function(Identifier) updates) => super.copyWith((message) => updates(message as Identifier)) as Identifier; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Identifier create() => Identifier._(); - Identifier createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Identifier getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Identifier? _defaultInstance; - - @$pb.TagNumber(1) - Uri get uri => $_getN(0); - @$pb.TagNumber(1) - set uri(Uri v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasUri() => $_has(0); - @$pb.TagNumber(1) - void clearUri() => clearField(1); - @$pb.TagNumber(1) - Uri ensureUri() => $_ensure(0); - - @$pb.TagNumber(2) - $core.String get parent => $_getSZ(1); - @$pb.TagNumber(2) - set parent($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasParent() => $_has(1); - @$pb.TagNumber(2) - void clearParent() => clearField(2); - - @$pb.TagNumber(3) - $core.String get name => $_getSZ(2); - @$pb.TagNumber(3) - set name($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasName() => $_has(2); - @$pb.TagNumber(3) - void clearName() => clearField(3); -} - -class Usage extends $pb.GeneratedMessage { - factory Usage({ - Definition? definition, - $core.Iterable? references, - }) { - final $result = create(); - if (definition != null) { - $result.definition = definition; - } - if (references != null) { - $result.references.addAll(references); - } - return $result; - } - Usage._() : super(); - factory Usage.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Usage.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Usage', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOM(1, _omitFieldNames ? '' : 'definition', subBuilder: Definition.create) - ..pc(2, _omitFieldNames ? '' : 'references', $pb.PbFieldType.PM, subBuilder: Reference.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Usage clone() => Usage()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Usage copyWith(void Function(Usage) updates) => super.copyWith((message) => updates(message as Usage)) as Usage; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Usage create() => Usage._(); - Usage createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Usage getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Usage? _defaultInstance; - - @$pb.TagNumber(1) - Definition get definition => $_getN(0); - @$pb.TagNumber(1) - set definition(Definition v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasDefinition() => $_has(0); - @$pb.TagNumber(1) - void clearDefinition() => clearField(1); - @$pb.TagNumber(1) - Definition ensureDefinition() => $_ensure(0); - - @$pb.TagNumber(2) - $core.List get references => $_getList(1); -} - -class Definition extends $pb.GeneratedMessage { - factory Definition({ - Identifier? identifier, - Location? location, - $core.String? loadingUnit, - }) { - final $result = create(); - if (identifier != null) { - $result.identifier = identifier; - } - if (location != null) { - $result.location = location; - } - if (loadingUnit != null) { - $result.loadingUnit = loadingUnit; - } - return $result; - } - Definition._() : super(); - factory Definition.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Definition.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Definition', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOM(1, _omitFieldNames ? '' : 'identifier', subBuilder: Identifier.create) - ..aOM(2, _omitFieldNames ? '' : 'location', subBuilder: Location.create) - ..aOS(3, _omitFieldNames ? '' : 'loadingUnit') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Definition clone() => Definition()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Definition copyWith(void Function(Definition) updates) => super.copyWith((message) => updates(message as Definition)) as Definition; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Definition create() => Definition._(); - Definition createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Definition getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Definition? _defaultInstance; - - @$pb.TagNumber(1) - Identifier get identifier => $_getN(0); - @$pb.TagNumber(1) - set identifier(Identifier v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasIdentifier() => $_has(0); - @$pb.TagNumber(1) - void clearIdentifier() => clearField(1); - @$pb.TagNumber(1) - Identifier ensureIdentifier() => $_ensure(0); - - @$pb.TagNumber(2) - Location get location => $_getN(1); - @$pb.TagNumber(2) - set location(Location v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasLocation() => $_has(1); - @$pb.TagNumber(2) - void clearLocation() => clearField(2); - @$pb.TagNumber(2) - Location ensureLocation() => $_ensure(1); - - @$pb.TagNumber(3) - $core.String get loadingUnit => $_getSZ(2); - @$pb.TagNumber(3) - set loadingUnit($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasLoadingUnit() => $_has(2); - @$pb.TagNumber(3) - void clearLoadingUnit() => clearField(3); -} - -class Location extends $pb.GeneratedMessage { - factory Location({ - Uri? uri, - $core.int? line, - $core.int? column, - }) { - final $result = create(); - if (uri != null) { - $result.uri = uri; - } - if (line != null) { - $result.line = line; - } - if (column != null) { - $result.column = column; - } - return $result; - } - Location._() : super(); - factory Location.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Location.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Location', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOM(1, _omitFieldNames ? '' : 'uri', subBuilder: Uri.create) - ..a<$core.int>(2, _omitFieldNames ? '' : 'line', $pb.PbFieldType.OU3) - ..a<$core.int>(3, _omitFieldNames ? '' : 'column', $pb.PbFieldType.OU3) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Location clone() => Location()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Location copyWith(void Function(Location) updates) => super.copyWith((message) => updates(message as Location)) as Location; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Location create() => Location._(); - Location createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Location getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Location? _defaultInstance; - - @$pb.TagNumber(1) - Uri get uri => $_getN(0); - @$pb.TagNumber(1) - set uri(Uri v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasUri() => $_has(0); - @$pb.TagNumber(1) - void clearUri() => clearField(1); - @$pb.TagNumber(1) - Uri ensureUri() => $_ensure(0); - - @$pb.TagNumber(2) - $core.int get line => $_getIZ(1); - @$pb.TagNumber(2) - set line($core.int v) { $_setUnsignedInt32(1, v); } - @$pb.TagNumber(2) - $core.bool hasLine() => $_has(1); - @$pb.TagNumber(2) - void clearLine() => clearField(2); - - @$pb.TagNumber(3) - $core.int get column => $_getIZ(2); - @$pb.TagNumber(3) - set column($core.int v) { $_setUnsignedInt32(2, v); } - @$pb.TagNumber(3) - $core.bool hasColumn() => $_has(2); - @$pb.TagNumber(3) - void clearColumn() => clearField(3); -} - -enum Reference_Reference { - arguments, - fields, - notSet -} - -class Reference extends $pb.GeneratedMessage { - factory Reference({ - Location? location, - $core.String? loadingUnit, - Arguments? arguments, - Fields? fields, - }) { - final $result = create(); - if (location != null) { - $result.location = location; - } - if (loadingUnit != null) { - $result.loadingUnit = loadingUnit; - } - if (arguments != null) { - $result.arguments = arguments; - } - if (fields != null) { - $result.fields = fields; - } - return $result; - } - Reference._() : super(); - factory Reference.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Reference.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static const $core.Map<$core.int, Reference_Reference> _Reference_ReferenceByTag = { - 3 : Reference_Reference.arguments, - 4 : Reference_Reference.fields, - 0 : Reference_Reference.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Reference', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..oo(0, [3, 4]) - ..aOM(1, _omitFieldNames ? '' : 'location', subBuilder: Location.create) - ..aOS(2, _omitFieldNames ? '' : 'loadingUnit') - ..aOM(3, _omitFieldNames ? '' : 'arguments', subBuilder: Arguments.create) - ..aOM(4, _omitFieldNames ? '' : 'fields', subBuilder: Fields.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Reference clone() => Reference()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Reference copyWith(void Function(Reference) updates) => super.copyWith((message) => updates(message as Reference)) as Reference; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Reference create() => Reference._(); - Reference createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Reference getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Reference? _defaultInstance; - - Reference_Reference whichReference() => _Reference_ReferenceByTag[$_whichOneof(0)]!; - void clearReference() => clearField($_whichOneof(0)); - - @$pb.TagNumber(1) - Location get location => $_getN(0); - @$pb.TagNumber(1) - set location(Location v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasLocation() => $_has(0); - @$pb.TagNumber(1) - void clearLocation() => clearField(1); - @$pb.TagNumber(1) - Location ensureLocation() => $_ensure(0); - - @$pb.TagNumber(2) - $core.String get loadingUnit => $_getSZ(1); - @$pb.TagNumber(2) - set loadingUnit($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasLoadingUnit() => $_has(1); - @$pb.TagNumber(2) - void clearLoadingUnit() => clearField(2); - - @$pb.TagNumber(3) - Arguments get arguments => $_getN(2); - @$pb.TagNumber(3) - set arguments(Arguments v) { setField(3, v); } - @$pb.TagNumber(3) - $core.bool hasArguments() => $_has(2); - @$pb.TagNumber(3) - void clearArguments() => clearField(3); - @$pb.TagNumber(3) - Arguments ensureArguments() => $_ensure(2); - - @$pb.TagNumber(4) - Fields get fields => $_getN(3); - @$pb.TagNumber(4) - set fields(Fields v) { setField(4, v); } - @$pb.TagNumber(4) - $core.bool hasFields() => $_has(3); - @$pb.TagNumber(4) - void clearFields() => clearField(4); - @$pb.TagNumber(4) - Fields ensureFields() => $_ensure(3); -} - -class Fields extends $pb.GeneratedMessage { - factory Fields({ - $core.Iterable? fields, - }) { - final $result = create(); - if (fields != null) { - $result.fields.addAll(fields); - } - return $result; - } - Fields._() : super(); - factory Fields.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Fields.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Fields', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..pc(1, _omitFieldNames ? '' : 'fields', $pb.PbFieldType.PM, subBuilder: Field.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Fields clone() => Fields()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Fields copyWith(void Function(Fields) updates) => super.copyWith((message) => updates(message as Fields)) as Fields; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Fields create() => Fields._(); - Fields createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Fields getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Fields? _defaultInstance; - - @$pb.TagNumber(1) - $core.List get fields => $_getList(0); -} - -enum Arguments_Kind { - const_1, - nonConst, - notSet -} - -class Arguments extends $pb.GeneratedMessage { - factory Arguments({ - ConstArguments? const_1, - NonConstArguments? nonConst, - }) { - final $result = create(); - if (const_1 != null) { - $result.const_1 = const_1; - } - if (nonConst != null) { - $result.nonConst = nonConst; - } - return $result; - } - Arguments._() : super(); - factory Arguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Arguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static const $core.Map<$core.int, Arguments_Kind> _Arguments_KindByTag = { - 1 : Arguments_Kind.const_1, - 2 : Arguments_Kind.nonConst, - 0 : Arguments_Kind.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Arguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..oo(0, [1, 2]) - ..aOM(1, _omitFieldNames ? '' : 'const', subBuilder: ConstArguments.create) - ..aOM(2, _omitFieldNames ? '' : 'nonConst', subBuilder: NonConstArguments.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Arguments clone() => Arguments()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Arguments copyWith(void Function(Arguments) updates) => super.copyWith((message) => updates(message as Arguments)) as Arguments; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Arguments create() => Arguments._(); - Arguments createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Arguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Arguments? _defaultInstance; - - Arguments_Kind whichKind() => _Arguments_KindByTag[$_whichOneof(0)]!; - void clearKind() => clearField($_whichOneof(0)); - - @$pb.TagNumber(1) - ConstArguments get const_1 => $_getN(0); - @$pb.TagNumber(1) - set const_1(ConstArguments v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasConst_1() => $_has(0); - @$pb.TagNumber(1) - void clearConst_1() => clearField(1); - @$pb.TagNumber(1) - ConstArguments ensureConst_1() => $_ensure(0); - - @$pb.TagNumber(2) - NonConstArguments get nonConst => $_getN(1); - @$pb.TagNumber(2) - set nonConst(NonConstArguments v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasNonConst() => $_has(1); - @$pb.TagNumber(2) - void clearNonConst() => clearField(2); - @$pb.TagNumber(2) - NonConstArguments ensureNonConst() => $_ensure(1); -} - -class ConstArguments extends $pb.GeneratedMessage { - factory ConstArguments({ - $core.Map<$core.int, $core.String>? positional, - $core.Map<$core.String, $core.String>? named, - }) { - final $result = create(); - if (positional != null) { - $result.positional.addAll(positional); - } - if (named != null) { - $result.named.addAll(named); - } - return $result; - } - ConstArguments._() : super(); - factory ConstArguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ConstArguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ConstArguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..m<$core.int, $core.String>(1, _omitFieldNames ? '' : 'positional', entryClassName: 'ConstArguments.PositionalEntry', keyFieldType: $pb.PbFieldType.OU3, valueFieldType: $pb.PbFieldType.OS, packageName: const $pb.PackageName('usages')) - ..m<$core.String, $core.String>(2, _omitFieldNames ? '' : 'named', entryClassName: 'ConstArguments.NamedEntry', keyFieldType: $pb.PbFieldType.OS, valueFieldType: $pb.PbFieldType.OS, packageName: const $pb.PackageName('usages')) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - ConstArguments clone() => ConstArguments()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - ConstArguments copyWith(void Function(ConstArguments) updates) => super.copyWith((message) => updates(message as ConstArguments)) as ConstArguments; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static ConstArguments create() => ConstArguments._(); - ConstArguments createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static ConstArguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static ConstArguments? _defaultInstance; - - @$pb.TagNumber(1) - $core.Map<$core.int, $core.String> get positional => $_getMap(0); - - @$pb.TagNumber(2) - $core.Map<$core.String, $core.String> get named => $_getMap(1); -} - -class NonConstArguments extends $pb.GeneratedMessage { - factory NonConstArguments({ - $core.Iterable<$core.int>? positional, - $core.Iterable<$core.String>? named, - }) { - final $result = create(); - if (positional != null) { - $result.positional.addAll(positional); - } - if (named != null) { - $result.named.addAll(named); - } - return $result; - } - NonConstArguments._() : super(); - factory NonConstArguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory NonConstArguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'NonConstArguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..p<$core.int>(1, _omitFieldNames ? '' : 'positional', $pb.PbFieldType.KU3) - ..pPS(2, _omitFieldNames ? '' : 'named') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - NonConstArguments clone() => NonConstArguments()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - NonConstArguments copyWith(void Function(NonConstArguments) updates) => super.copyWith((message) => updates(message as NonConstArguments)) as NonConstArguments; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static NonConstArguments create() => NonConstArguments._(); - NonConstArguments createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static NonConstArguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static NonConstArguments? _defaultInstance; - - @$pb.TagNumber(1) - $core.List<$core.int> get positional => $_getList(0); - - @$pb.TagNumber(2) - $core.List<$core.String> get named => $_getList(1); -} - -class Field extends $pb.GeneratedMessage { - factory Field({ - $core.String? className, - $core.String? name, - FieldValue? value, - }) { - final $result = create(); - if (className != null) { - $result.className = className; - } - if (name != null) { - $result.name = name; - } - if (value != null) { - $result.value = value; - } - return $result; - } - Field._() : super(); - factory Field.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Field.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Field', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'className') - ..aOS(2, _omitFieldNames ? '' : 'name') - ..aOM(3, _omitFieldNames ? '' : 'value', subBuilder: FieldValue.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Field clone() => Field()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Field copyWith(void Function(Field) updates) => super.copyWith((message) => updates(message as Field)) as Field; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Field create() => Field._(); - Field createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Field getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Field? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get className => $_getSZ(0); - @$pb.TagNumber(1) - set className($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasClassName() => $_has(0); - @$pb.TagNumber(1) - void clearClassName() => clearField(1); - - @$pb.TagNumber(2) - $core.String get name => $_getSZ(1); - @$pb.TagNumber(2) - set name($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasName() => $_has(1); - @$pb.TagNumber(2) - void clearName() => clearField(2); - - @$pb.TagNumber(3) - FieldValue get value => $_getN(2); - @$pb.TagNumber(3) - set value(FieldValue v) { setField(3, v); } - @$pb.TagNumber(3) - $core.bool hasValue() => $_has(2); - @$pb.TagNumber(3) - void clearValue() => clearField(3); - @$pb.TagNumber(3) - FieldValue ensureValue() => $_ensure(2); -} - -enum FieldValue_Value { - intValue, - doubleValue, - boolValue, - stringValue, - notSet -} - -class FieldValue extends $pb.GeneratedMessage { - factory FieldValue({ - $core.int? intValue, - $core.double? doubleValue, - $core.bool? boolValue, - $core.String? stringValue, - }) { - final $result = create(); - if (intValue != null) { - $result.intValue = intValue; - } - if (doubleValue != null) { - $result.doubleValue = doubleValue; - } - if (boolValue != null) { - $result.boolValue = boolValue; - } - if (stringValue != null) { - $result.stringValue = stringValue; - } - return $result; - } - FieldValue._() : super(); - factory FieldValue.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory FieldValue.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static const $core.Map<$core.int, FieldValue_Value> _FieldValue_ValueByTag = { - 1 : FieldValue_Value.intValue, - 2 : FieldValue_Value.doubleValue, - 3 : FieldValue_Value.boolValue, - 4 : FieldValue_Value.stringValue, - 0 : FieldValue_Value.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'FieldValue', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..oo(0, [1, 2, 3, 4]) - ..a<$core.int>(1, _omitFieldNames ? '' : 'intValue', $pb.PbFieldType.O3) - ..a<$core.double>(2, _omitFieldNames ? '' : 'doubleValue', $pb.PbFieldType.OD) - ..aOB(3, _omitFieldNames ? '' : 'boolValue') - ..aOS(4, _omitFieldNames ? '' : 'stringValue') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - FieldValue clone() => FieldValue()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - FieldValue copyWith(void Function(FieldValue) updates) => super.copyWith((message) => updates(message as FieldValue)) as FieldValue; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static FieldValue create() => FieldValue._(); - FieldValue createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static FieldValue getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static FieldValue? _defaultInstance; - - FieldValue_Value whichValue() => _FieldValue_ValueByTag[$_whichOneof(0)]!; - void clearValue() => clearField($_whichOneof(0)); - - @$pb.TagNumber(1) - $core.int get intValue => $_getIZ(0); - @$pb.TagNumber(1) - set intValue($core.int v) { $_setSignedInt32(0, v); } - @$pb.TagNumber(1) - $core.bool hasIntValue() => $_has(0); - @$pb.TagNumber(1) - void clearIntValue() => clearField(1); - - @$pb.TagNumber(2) - $core.double get doubleValue => $_getN(1); - @$pb.TagNumber(2) - set doubleValue($core.double v) { $_setDouble(1, v); } - @$pb.TagNumber(2) - $core.bool hasDoubleValue() => $_has(1); - @$pb.TagNumber(2) - void clearDoubleValue() => clearField(2); - - @$pb.TagNumber(3) - $core.bool get boolValue => $_getBF(2); - @$pb.TagNumber(3) - set boolValue($core.bool v) { $_setBool(2, v); } - @$pb.TagNumber(3) - $core.bool hasBoolValue() => $_has(2); - @$pb.TagNumber(3) - void clearBoolValue() => clearField(3); - - @$pb.TagNumber(4) - $core.String get stringValue => $_getSZ(3); - @$pb.TagNumber(4) - set stringValue($core.String v) { $_setString(3, v); } - @$pb.TagNumber(4) - $core.bool hasStringValue() => $_has(3); - @$pb.TagNumber(4) - void clearStringValue() => clearField(4); -} - - -const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); -const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/pkgs/record_use/lib/src/proto/read/usages.pbjson.dart b/pkgs/record_use/lib/src/proto/read/usages.pbjson.dart deleted file mode 100644 index 66999fe6..00000000 --- a/pkgs/record_use/lib/src/proto/read/usages.pbjson.dart +++ /dev/null @@ -1,265 +0,0 @@ -// -// Generated code. Do not modify. -// source: usages.proto -// -// @dart = 2.12 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: unnecessary_import, unnecessary_this, unused_import - -import 'dart:convert' as $convert; -import 'dart:core' as $core; -import 'dart:typed_data' as $typed_data; - -@$core.Deprecated('Use usagesDescriptor instead') -const Usages$json = { - '1': 'Usages', - '2': [ - {'1': 'metadata', '3': 1, '4': 1, '5': 11, '6': '.usages.Metadata', '10': 'metadata'}, - {'1': 'calls', '3': 4, '4': 3, '5': 11, '6': '.usages.Usage', '10': 'calls'}, - {'1': 'instances', '3': 5, '4': 3, '5': 11, '6': '.usages.Usage', '10': 'instances'}, - ], -}; - -/// Descriptor for `Usages`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List usagesDescriptor = $convert.base64Decode( - 'CgZVc2FnZXMSLAoIbWV0YWRhdGEYASABKAsyEC51c2FnZXMuTWV0YWRhdGFSCG1ldGFkYXRhEi' - 'MKBWNhbGxzGAQgAygLMg0udXNhZ2VzLlVzYWdlUgVjYWxscxIrCglpbnN0YW5jZXMYBSADKAsy' - 'DS51c2FnZXMuVXNhZ2VSCWluc3RhbmNlcw=='); - -@$core.Deprecated('Use metadataDescriptor instead') -const Metadata$json = { - '1': 'Metadata', - '2': [ - {'1': 'comment', '3': 1, '4': 1, '5': 9, '9': 0, '10': 'comment', '17': true}, - {'1': 'version', '3': 2, '4': 1, '5': 9, '10': 'version'}, - ], - '8': [ - {'1': '_comment'}, - ], -}; - -/// Descriptor for `Metadata`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List metadataDescriptor = $convert.base64Decode( - 'CghNZXRhZGF0YRIdCgdjb21tZW50GAEgASgJSABSB2NvbW1lbnSIAQESGAoHdmVyc2lvbhgCIA' - 'EoCVIHdmVyc2lvbkIKCghfY29tbWVudA=='); - -@$core.Deprecated('Use uriDescriptor instead') -const Uri$json = { - '1': 'Uri', - '2': [ - {'1': 'value', '3': 1, '4': 1, '5': 9, '10': 'value'}, - ], -}; - -/// Descriptor for `Uri`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List uriDescriptor = $convert.base64Decode( - 'CgNVcmkSFAoFdmFsdWUYASABKAlSBXZhbHVl'); - -@$core.Deprecated('Use identifierDescriptor instead') -const Identifier$json = { - '1': 'Identifier', - '2': [ - {'1': 'uri', '3': 1, '4': 1, '5': 11, '6': '.usages.Uri', '10': 'uri'}, - {'1': 'parent', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'parent', '17': true}, - {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, - ], - '8': [ - {'1': '_parent'}, - ], -}; - -/// Descriptor for `Identifier`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List identifierDescriptor = $convert.base64Decode( - 'CgpJZGVudGlmaWVyEh0KA3VyaRgBIAEoCzILLnVzYWdlcy5VcmlSA3VyaRIbCgZwYXJlbnQYAi' - 'ABKAlIAFIGcGFyZW50iAEBEhIKBG5hbWUYAyABKAlSBG5hbWVCCQoHX3BhcmVudA=='); - -@$core.Deprecated('Use usageDescriptor instead') -const Usage$json = { - '1': 'Usage', - '2': [ - {'1': 'definition', '3': 1, '4': 1, '5': 11, '6': '.usages.Definition', '10': 'definition'}, - {'1': 'references', '3': 2, '4': 3, '5': 11, '6': '.usages.Reference', '10': 'references'}, - ], -}; - -/// Descriptor for `Usage`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List usageDescriptor = $convert.base64Decode( - 'CgVVc2FnZRIyCgpkZWZpbml0aW9uGAEgASgLMhIudXNhZ2VzLkRlZmluaXRpb25SCmRlZmluaX' - 'Rpb24SMQoKcmVmZXJlbmNlcxgCIAMoCzIRLnVzYWdlcy5SZWZlcmVuY2VSCnJlZmVyZW5jZXM='); - -@$core.Deprecated('Use definitionDescriptor instead') -const Definition$json = { - '1': 'Definition', - '2': [ - {'1': 'identifier', '3': 1, '4': 1, '5': 11, '6': '.usages.Identifier', '10': 'identifier'}, - {'1': 'location', '3': 2, '4': 1, '5': 11, '6': '.usages.Location', '10': 'location'}, - {'1': 'loading_unit', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'loadingUnit', '17': true}, - ], - '8': [ - {'1': '_loading_unit'}, - ], -}; - -/// Descriptor for `Definition`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List definitionDescriptor = $convert.base64Decode( - 'CgpEZWZpbml0aW9uEjIKCmlkZW50aWZpZXIYASABKAsyEi51c2FnZXMuSWRlbnRpZmllclIKaW' - 'RlbnRpZmllchIsCghsb2NhdGlvbhgCIAEoCzIQLnVzYWdlcy5Mb2NhdGlvblIIbG9jYXRpb24S' - 'JgoMbG9hZGluZ191bml0GAMgASgJSABSC2xvYWRpbmdVbml0iAEBQg8KDV9sb2FkaW5nX3VuaX' - 'Q='); - -@$core.Deprecated('Use locationDescriptor instead') -const Location$json = { - '1': 'Location', - '2': [ - {'1': 'uri', '3': 1, '4': 1, '5': 11, '6': '.usages.Uri', '10': 'uri'}, - {'1': 'line', '3': 2, '4': 1, '5': 13, '10': 'line'}, - {'1': 'column', '3': 3, '4': 1, '5': 13, '10': 'column'}, - ], -}; - -/// Descriptor for `Location`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List locationDescriptor = $convert.base64Decode( - 'CghMb2NhdGlvbhIdCgN1cmkYASABKAsyCy51c2FnZXMuVXJpUgN1cmkSEgoEbGluZRgCIAEoDV' - 'IEbGluZRIWCgZjb2x1bW4YAyABKA1SBmNvbHVtbg=='); - -@$core.Deprecated('Use referenceDescriptor instead') -const Reference$json = { - '1': 'Reference', - '2': [ - {'1': 'location', '3': 1, '4': 1, '5': 11, '6': '.usages.Location', '10': 'location'}, - {'1': 'loading_unit', '3': 2, '4': 1, '5': 9, '10': 'loadingUnit'}, - {'1': 'arguments', '3': 3, '4': 1, '5': 11, '6': '.usages.Arguments', '9': 0, '10': 'arguments'}, - {'1': 'fields', '3': 4, '4': 1, '5': 11, '6': '.usages.Fields', '9': 0, '10': 'fields'}, - ], - '8': [ - {'1': 'reference'}, - ], -}; - -/// Descriptor for `Reference`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List referenceDescriptor = $convert.base64Decode( - 'CglSZWZlcmVuY2USLAoIbG9jYXRpb24YASABKAsyEC51c2FnZXMuTG9jYXRpb25SCGxvY2F0aW' - '9uEiEKDGxvYWRpbmdfdW5pdBgCIAEoCVILbG9hZGluZ1VuaXQSMQoJYXJndW1lbnRzGAMgASgL' - 'MhEudXNhZ2VzLkFyZ3VtZW50c0gAUglhcmd1bWVudHMSKAoGZmllbGRzGAQgASgLMg4udXNhZ2' - 'VzLkZpZWxkc0gAUgZmaWVsZHNCCwoJcmVmZXJlbmNl'); - -@$core.Deprecated('Use fieldsDescriptor instead') -const Fields$json = { - '1': 'Fields', - '2': [ - {'1': 'fields', '3': 1, '4': 3, '5': 11, '6': '.usages.Field', '10': 'fields'}, - ], -}; - -/// Descriptor for `Fields`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldsDescriptor = $convert.base64Decode( - 'CgZGaWVsZHMSJQoGZmllbGRzGAEgAygLMg0udXNhZ2VzLkZpZWxkUgZmaWVsZHM='); - -@$core.Deprecated('Use argumentsDescriptor instead') -const Arguments$json = { - '1': 'Arguments', - '2': [ - {'1': 'const', '3': 1, '4': 1, '5': 11, '6': '.usages.ConstArguments', '9': 0, '10': 'const'}, - {'1': 'non_const', '3': 2, '4': 1, '5': 11, '6': '.usages.NonConstArguments', '9': 0, '10': 'nonConst'}, - ], - '8': [ - {'1': 'kind'}, - ], -}; - -/// Descriptor for `Arguments`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List argumentsDescriptor = $convert.base64Decode( - 'CglBcmd1bWVudHMSLgoFY29uc3QYASABKAsyFi51c2FnZXMuQ29uc3RBcmd1bWVudHNIAFIFY2' - '9uc3QSOAoJbm9uX2NvbnN0GAIgASgLMhkudXNhZ2VzLk5vbkNvbnN0QXJndW1lbnRzSABSCG5v' - 'bkNvbnN0QgYKBGtpbmQ='); - -@$core.Deprecated('Use constArgumentsDescriptor instead') -const ConstArguments$json = { - '1': 'ConstArguments', - '2': [ - {'1': 'positional', '3': 1, '4': 3, '5': 11, '6': '.usages.ConstArguments.PositionalEntry', '10': 'positional'}, - {'1': 'named', '3': 2, '4': 3, '5': 11, '6': '.usages.ConstArguments.NamedEntry', '10': 'named'}, - ], - '3': [ConstArguments_PositionalEntry$json, ConstArguments_NamedEntry$json], -}; - -@$core.Deprecated('Use constArgumentsDescriptor instead') -const ConstArguments_PositionalEntry$json = { - '1': 'PositionalEntry', - '2': [ - {'1': 'key', '3': 1, '4': 1, '5': 13, '10': 'key'}, - {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, - ], - '7': {'7': true}, -}; - -@$core.Deprecated('Use constArgumentsDescriptor instead') -const ConstArguments_NamedEntry$json = { - '1': 'NamedEntry', - '2': [ - {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, - {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, - ], - '7': {'7': true}, -}; - -/// Descriptor for `ConstArguments`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List constArgumentsDescriptor = $convert.base64Decode( - 'Cg5Db25zdEFyZ3VtZW50cxJGCgpwb3NpdGlvbmFsGAEgAygLMiYudXNhZ2VzLkNvbnN0QXJndW' - '1lbnRzLlBvc2l0aW9uYWxFbnRyeVIKcG9zaXRpb25hbBI3CgVuYW1lZBgCIAMoCzIhLnVzYWdl' - 'cy5Db25zdEFyZ3VtZW50cy5OYW1lZEVudHJ5UgVuYW1lZBo9Cg9Qb3NpdGlvbmFsRW50cnkSEA' - 'oDa2V5GAEgASgNUgNrZXkSFAoFdmFsdWUYAiABKAlSBXZhbHVlOgI4ARo4CgpOYW1lZEVudHJ5' - 'EhAKA2tleRgBIAEoCVIDa2V5EhQKBXZhbHVlGAIgASgJUgV2YWx1ZToCOAE='); - -@$core.Deprecated('Use nonConstArgumentsDescriptor instead') -const NonConstArguments$json = { - '1': 'NonConstArguments', - '2': [ - {'1': 'positional', '3': 1, '4': 3, '5': 13, '10': 'positional'}, - {'1': 'named', '3': 2, '4': 3, '5': 9, '10': 'named'}, - ], -}; - -/// Descriptor for `NonConstArguments`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List nonConstArgumentsDescriptor = $convert.base64Decode( - 'ChFOb25Db25zdEFyZ3VtZW50cxIeCgpwb3NpdGlvbmFsGAEgAygNUgpwb3NpdGlvbmFsEhQKBW' - '5hbWVkGAIgAygJUgVuYW1lZA=='); - -@$core.Deprecated('Use fieldDescriptor instead') -const Field$json = { - '1': 'Field', - '2': [ - {'1': 'class_name', '3': 1, '4': 1, '5': 9, '10': 'className'}, - {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, - {'1': 'value', '3': 3, '4': 1, '5': 11, '6': '.usages.FieldValue', '10': 'value'}, - ], -}; - -/// Descriptor for `Field`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldDescriptor = $convert.base64Decode( - 'CgVGaWVsZBIdCgpjbGFzc19uYW1lGAEgASgJUgljbGFzc05hbWUSEgoEbmFtZRgCIAEoCVIEbm' - 'FtZRIoCgV2YWx1ZRgDIAEoCzISLnVzYWdlcy5GaWVsZFZhbHVlUgV2YWx1ZQ=='); - -@$core.Deprecated('Use fieldValueDescriptor instead') -const FieldValue$json = { - '1': 'FieldValue', - '2': [ - {'1': 'int_value', '3': 1, '4': 1, '5': 5, '9': 0, '10': 'intValue'}, - {'1': 'double_value', '3': 2, '4': 1, '5': 1, '9': 0, '10': 'doubleValue'}, - {'1': 'bool_value', '3': 3, '4': 1, '5': 8, '9': 0, '10': 'boolValue'}, - {'1': 'string_value', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'stringValue'}, - ], - '8': [ - {'1': 'value'}, - ], -}; - -/// Descriptor for `FieldValue`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldValueDescriptor = $convert.base64Decode( - 'CgpGaWVsZFZhbHVlEh0KCWludF92YWx1ZRgBIAEoBUgAUghpbnRWYWx1ZRIjCgxkb3VibGVfdm' - 'FsdWUYAiABKAFIAFILZG91YmxlVmFsdWUSHwoKYm9vbF92YWx1ZRgDIAEoCEgAUglib29sVmFs' - 'dWUSIwoMc3RyaW5nX3ZhbHVlGAQgASgJSABSC3N0cmluZ1ZhbHVlQgcKBXZhbHVl'); - diff --git a/pkgs/record_use/lib/src/proto/storage/usages_storage.pb.dart b/pkgs/record_use/lib/src/proto/storage/usages_storage.pb.dart deleted file mode 100644 index f95a5156..00000000 --- a/pkgs/record_use/lib/src/proto/storage/usages_storage.pb.dart +++ /dev/null @@ -1,1047 +0,0 @@ -// -// Generated code. Do not modify. -// source: usages_storage.proto -// -// @dart = 2.12 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: unnecessary_import, unnecessary_this, unused_import - -import 'dart:core' as $core; - -import 'package:protobuf/protobuf.dart' as $pb; - -class Usages extends $pb.GeneratedMessage { - factory Usages({ - Metadata? metadata, - $core.Iterable? uris, - $core.Iterable? ids, - $core.Iterable? calls, - $core.Iterable? instances, - }) { - final $result = create(); - if (metadata != null) { - $result.metadata = metadata; - } - if (uris != null) { - $result.uris.addAll(uris); - } - if (ids != null) { - $result.ids.addAll(ids); - } - if (calls != null) { - $result.calls.addAll(calls); - } - if (instances != null) { - $result.instances.addAll(instances); - } - return $result; - } - Usages._() : super(); - factory Usages.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Usages.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Usages', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOM(1, _omitFieldNames ? '' : 'metadata', subBuilder: Metadata.create) - ..pc(2, _omitFieldNames ? '' : 'uris', $pb.PbFieldType.PM, subBuilder: Uri.create) - ..pc(3, _omitFieldNames ? '' : 'ids', $pb.PbFieldType.PM, subBuilder: Identifier.create) - ..pc(4, _omitFieldNames ? '' : 'calls', $pb.PbFieldType.PM, subBuilder: Usage.create) - ..pc(5, _omitFieldNames ? '' : 'instances', $pb.PbFieldType.PM, subBuilder: Usage.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Usages clone() => Usages()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Usages copyWith(void Function(Usages) updates) => super.copyWith((message) => updates(message as Usages)) as Usages; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Usages create() => Usages._(); - Usages createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Usages getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Usages? _defaultInstance; - - @$pb.TagNumber(1) - Metadata get metadata => $_getN(0); - @$pb.TagNumber(1) - set metadata(Metadata v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasMetadata() => $_has(0); - @$pb.TagNumber(1) - void clearMetadata() => clearField(1); - @$pb.TagNumber(1) - Metadata ensureMetadata() => $_ensure(0); - - @$pb.TagNumber(2) - $core.List get uris => $_getList(1); - - @$pb.TagNumber(3) - $core.List get ids => $_getList(2); - - @$pb.TagNumber(4) - $core.List get calls => $_getList(3); - - @$pb.TagNumber(5) - $core.List get instances => $_getList(4); -} - -class Metadata extends $pb.GeneratedMessage { - factory Metadata({ - $core.String? comment, - $core.String? version, - }) { - final $result = create(); - if (comment != null) { - $result.comment = comment; - } - if (version != null) { - $result.version = version; - } - return $result; - } - Metadata._() : super(); - factory Metadata.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Metadata.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Metadata', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'comment') - ..aOS(2, _omitFieldNames ? '' : 'version') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Metadata clone() => Metadata()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Metadata copyWith(void Function(Metadata) updates) => super.copyWith((message) => updates(message as Metadata)) as Metadata; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Metadata create() => Metadata._(); - Metadata createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Metadata getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Metadata? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get comment => $_getSZ(0); - @$pb.TagNumber(1) - set comment($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasComment() => $_has(0); - @$pb.TagNumber(1) - void clearComment() => clearField(1); - - @$pb.TagNumber(2) - $core.String get version => $_getSZ(1); - @$pb.TagNumber(2) - set version($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasVersion() => $_has(1); - @$pb.TagNumber(2) - void clearVersion() => clearField(2); -} - -class Uri extends $pb.GeneratedMessage { - factory Uri({ - $core.String? value, - }) { - final $result = create(); - if (value != null) { - $result.value = value; - } - return $result; - } - Uri._() : super(); - factory Uri.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Uri.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Uri', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'value') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Uri clone() => Uri()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Uri copyWith(void Function(Uri) updates) => super.copyWith((message) => updates(message as Uri)) as Uri; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Uri create() => Uri._(); - Uri createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Uri getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Uri? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get value => $_getSZ(0); - @$pb.TagNumber(1) - set value($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasValue() => $_has(0); - @$pb.TagNumber(1) - void clearValue() => clearField(1); -} - -class Identifier extends $pb.GeneratedMessage { - factory Identifier({ - $core.int? uri, - $core.String? parent, - $core.String? name, - }) { - final $result = create(); - if (uri != null) { - $result.uri = uri; - } - if (parent != null) { - $result.parent = parent; - } - if (name != null) { - $result.name = name; - } - return $result; - } - Identifier._() : super(); - factory Identifier.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Identifier.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Identifier', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..a<$core.int>(1, _omitFieldNames ? '' : 'uri', $pb.PbFieldType.OU3) - ..aOS(2, _omitFieldNames ? '' : 'parent') - ..aOS(3, _omitFieldNames ? '' : 'name') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Identifier clone() => Identifier()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Identifier copyWith(void Function(Identifier) updates) => super.copyWith((message) => updates(message as Identifier)) as Identifier; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Identifier create() => Identifier._(); - Identifier createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Identifier getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Identifier? _defaultInstance; - - @$pb.TagNumber(1) - $core.int get uri => $_getIZ(0); - @$pb.TagNumber(1) - set uri($core.int v) { $_setUnsignedInt32(0, v); } - @$pb.TagNumber(1) - $core.bool hasUri() => $_has(0); - @$pb.TagNumber(1) - void clearUri() => clearField(1); - - @$pb.TagNumber(2) - $core.String get parent => $_getSZ(1); - @$pb.TagNumber(2) - set parent($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasParent() => $_has(1); - @$pb.TagNumber(2) - void clearParent() => clearField(2); - - @$pb.TagNumber(3) - $core.String get name => $_getSZ(2); - @$pb.TagNumber(3) - set name($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasName() => $_has(2); - @$pb.TagNumber(3) - void clearName() => clearField(3); -} - -class Usage extends $pb.GeneratedMessage { - factory Usage({ - Definition? definition, - $core.Iterable? references, - }) { - final $result = create(); - if (definition != null) { - $result.definition = definition; - } - if (references != null) { - $result.references.addAll(references); - } - return $result; - } - Usage._() : super(); - factory Usage.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Usage.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Usage', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOM(1, _omitFieldNames ? '' : 'definition', subBuilder: Definition.create) - ..pc(2, _omitFieldNames ? '' : 'references', $pb.PbFieldType.PM, subBuilder: Reference.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Usage clone() => Usage()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Usage copyWith(void Function(Usage) updates) => super.copyWith((message) => updates(message as Usage)) as Usage; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Usage create() => Usage._(); - Usage createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Usage getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Usage? _defaultInstance; - - @$pb.TagNumber(1) - Definition get definition => $_getN(0); - @$pb.TagNumber(1) - set definition(Definition v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasDefinition() => $_has(0); - @$pb.TagNumber(1) - void clearDefinition() => clearField(1); - @$pb.TagNumber(1) - Definition ensureDefinition() => $_ensure(0); - - @$pb.TagNumber(2) - $core.List get references => $_getList(1); -} - -class Definition extends $pb.GeneratedMessage { - factory Definition({ - $core.int? identifier, - Location? location, - $core.String? loadingUnit, - }) { - final $result = create(); - if (identifier != null) { - $result.identifier = identifier; - } - if (location != null) { - $result.location = location; - } - if (loadingUnit != null) { - $result.loadingUnit = loadingUnit; - } - return $result; - } - Definition._() : super(); - factory Definition.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Definition.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Definition', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..a<$core.int>(1, _omitFieldNames ? '' : 'identifier', $pb.PbFieldType.OU3) - ..aOM(2, _omitFieldNames ? '' : 'location', subBuilder: Location.create) - ..aOS(3, _omitFieldNames ? '' : 'loadingUnit') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Definition clone() => Definition()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Definition copyWith(void Function(Definition) updates) => super.copyWith((message) => updates(message as Definition)) as Definition; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Definition create() => Definition._(); - Definition createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Definition getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Definition? _defaultInstance; - - @$pb.TagNumber(1) - $core.int get identifier => $_getIZ(0); - @$pb.TagNumber(1) - set identifier($core.int v) { $_setUnsignedInt32(0, v); } - @$pb.TagNumber(1) - $core.bool hasIdentifier() => $_has(0); - @$pb.TagNumber(1) - void clearIdentifier() => clearField(1); - - @$pb.TagNumber(2) - Location get location => $_getN(1); - @$pb.TagNumber(2) - set location(Location v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasLocation() => $_has(1); - @$pb.TagNumber(2) - void clearLocation() => clearField(2); - @$pb.TagNumber(2) - Location ensureLocation() => $_ensure(1); - - @$pb.TagNumber(3) - $core.String get loadingUnit => $_getSZ(2); - @$pb.TagNumber(3) - set loadingUnit($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasLoadingUnit() => $_has(2); - @$pb.TagNumber(3) - void clearLoadingUnit() => clearField(3); -} - -class Location extends $pb.GeneratedMessage { - factory Location({ - $core.int? uri, - $core.int? line, - $core.int? column, - }) { - final $result = create(); - if (uri != null) { - $result.uri = uri; - } - if (line != null) { - $result.line = line; - } - if (column != null) { - $result.column = column; - } - return $result; - } - Location._() : super(); - factory Location.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Location.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Location', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..a<$core.int>(1, _omitFieldNames ? '' : 'uri', $pb.PbFieldType.OU3) - ..a<$core.int>(2, _omitFieldNames ? '' : 'line', $pb.PbFieldType.OU3) - ..a<$core.int>(3, _omitFieldNames ? '' : 'column', $pb.PbFieldType.OU3) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Location clone() => Location()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Location copyWith(void Function(Location) updates) => super.copyWith((message) => updates(message as Location)) as Location; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Location create() => Location._(); - Location createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Location getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Location? _defaultInstance; - - @$pb.TagNumber(1) - $core.int get uri => $_getIZ(0); - @$pb.TagNumber(1) - set uri($core.int v) { $_setUnsignedInt32(0, v); } - @$pb.TagNumber(1) - $core.bool hasUri() => $_has(0); - @$pb.TagNumber(1) - void clearUri() => clearField(1); - - @$pb.TagNumber(2) - $core.int get line => $_getIZ(1); - @$pb.TagNumber(2) - set line($core.int v) { $_setUnsignedInt32(1, v); } - @$pb.TagNumber(2) - $core.bool hasLine() => $_has(1); - @$pb.TagNumber(2) - void clearLine() => clearField(2); - - @$pb.TagNumber(3) - $core.int get column => $_getIZ(2); - @$pb.TagNumber(3) - set column($core.int v) { $_setUnsignedInt32(2, v); } - @$pb.TagNumber(3) - $core.bool hasColumn() => $_has(2); - @$pb.TagNumber(3) - void clearColumn() => clearField(3); -} - -enum Reference_Reference { - arguments, - fields, - notSet -} - -class Reference extends $pb.GeneratedMessage { - factory Reference({ - Location? location, - $core.String? loadingUnit, - Arguments? arguments, - Fields? fields, - }) { - final $result = create(); - if (location != null) { - $result.location = location; - } - if (loadingUnit != null) { - $result.loadingUnit = loadingUnit; - } - if (arguments != null) { - $result.arguments = arguments; - } - if (fields != null) { - $result.fields = fields; - } - return $result; - } - Reference._() : super(); - factory Reference.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Reference.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static const $core.Map<$core.int, Reference_Reference> _Reference_ReferenceByTag = { - 3 : Reference_Reference.arguments, - 4 : Reference_Reference.fields, - 0 : Reference_Reference.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Reference', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..oo(0, [3, 4]) - ..aOM(1, _omitFieldNames ? '' : 'location', subBuilder: Location.create) - ..aOS(2, _omitFieldNames ? '' : 'loadingUnit') - ..aOM(3, _omitFieldNames ? '' : 'arguments', subBuilder: Arguments.create) - ..aOM(4, _omitFieldNames ? '' : 'fields', subBuilder: Fields.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Reference clone() => Reference()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Reference copyWith(void Function(Reference) updates) => super.copyWith((message) => updates(message as Reference)) as Reference; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Reference create() => Reference._(); - Reference createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Reference getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Reference? _defaultInstance; - - Reference_Reference whichReference() => _Reference_ReferenceByTag[$_whichOneof(0)]!; - void clearReference() => clearField($_whichOneof(0)); - - @$pb.TagNumber(1) - Location get location => $_getN(0); - @$pb.TagNumber(1) - set location(Location v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasLocation() => $_has(0); - @$pb.TagNumber(1) - void clearLocation() => clearField(1); - @$pb.TagNumber(1) - Location ensureLocation() => $_ensure(0); - - @$pb.TagNumber(2) - $core.String get loadingUnit => $_getSZ(1); - @$pb.TagNumber(2) - set loadingUnit($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasLoadingUnit() => $_has(1); - @$pb.TagNumber(2) - void clearLoadingUnit() => clearField(2); - - @$pb.TagNumber(3) - Arguments get arguments => $_getN(2); - @$pb.TagNumber(3) - set arguments(Arguments v) { setField(3, v); } - @$pb.TagNumber(3) - $core.bool hasArguments() => $_has(2); - @$pb.TagNumber(3) - void clearArguments() => clearField(3); - @$pb.TagNumber(3) - Arguments ensureArguments() => $_ensure(2); - - @$pb.TagNumber(4) - Fields get fields => $_getN(3); - @$pb.TagNumber(4) - set fields(Fields v) { setField(4, v); } - @$pb.TagNumber(4) - $core.bool hasFields() => $_has(3); - @$pb.TagNumber(4) - void clearFields() => clearField(4); - @$pb.TagNumber(4) - Fields ensureFields() => $_ensure(3); -} - -class Fields extends $pb.GeneratedMessage { - factory Fields({ - $core.Iterable? fields, - }) { - final $result = create(); - if (fields != null) { - $result.fields.addAll(fields); - } - return $result; - } - Fields._() : super(); - factory Fields.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Fields.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Fields', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..pc(1, _omitFieldNames ? '' : 'fields', $pb.PbFieldType.PM, subBuilder: Field.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Fields clone() => Fields()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Fields copyWith(void Function(Fields) updates) => super.copyWith((message) => updates(message as Fields)) as Fields; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Fields create() => Fields._(); - Fields createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Fields getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Fields? _defaultInstance; - - @$pb.TagNumber(1) - $core.List get fields => $_getList(0); -} - -enum Arguments_Kind { - const_1, - nonConst, - notSet -} - -class Arguments extends $pb.GeneratedMessage { - factory Arguments({ - ConstArguments? const_1, - NonConstArguments? nonConst, - }) { - final $result = create(); - if (const_1 != null) { - $result.const_1 = const_1; - } - if (nonConst != null) { - $result.nonConst = nonConst; - } - return $result; - } - Arguments._() : super(); - factory Arguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Arguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static const $core.Map<$core.int, Arguments_Kind> _Arguments_KindByTag = { - 1 : Arguments_Kind.const_1, - 2 : Arguments_Kind.nonConst, - 0 : Arguments_Kind.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Arguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..oo(0, [1, 2]) - ..aOM(1, _omitFieldNames ? '' : 'const', subBuilder: ConstArguments.create) - ..aOM(2, _omitFieldNames ? '' : 'nonConst', subBuilder: NonConstArguments.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Arguments clone() => Arguments()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Arguments copyWith(void Function(Arguments) updates) => super.copyWith((message) => updates(message as Arguments)) as Arguments; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Arguments create() => Arguments._(); - Arguments createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Arguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Arguments? _defaultInstance; - - Arguments_Kind whichKind() => _Arguments_KindByTag[$_whichOneof(0)]!; - void clearKind() => clearField($_whichOneof(0)); - - @$pb.TagNumber(1) - ConstArguments get const_1 => $_getN(0); - @$pb.TagNumber(1) - set const_1(ConstArguments v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasConst_1() => $_has(0); - @$pb.TagNumber(1) - void clearConst_1() => clearField(1); - @$pb.TagNumber(1) - ConstArguments ensureConst_1() => $_ensure(0); - - @$pb.TagNumber(2) - NonConstArguments get nonConst => $_getN(1); - @$pb.TagNumber(2) - set nonConst(NonConstArguments v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasNonConst() => $_has(1); - @$pb.TagNumber(2) - void clearNonConst() => clearField(2); - @$pb.TagNumber(2) - NonConstArguments ensureNonConst() => $_ensure(1); -} - -class ConstArguments extends $pb.GeneratedMessage { - factory ConstArguments({ - $core.Map<$core.int, $core.String>? positional, - $core.Map<$core.String, $core.String>? named, - }) { - final $result = create(); - if (positional != null) { - $result.positional.addAll(positional); - } - if (named != null) { - $result.named.addAll(named); - } - return $result; - } - ConstArguments._() : super(); - factory ConstArguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ConstArguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ConstArguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..m<$core.int, $core.String>(1, _omitFieldNames ? '' : 'positional', entryClassName: 'ConstArguments.PositionalEntry', keyFieldType: $pb.PbFieldType.OU3, valueFieldType: $pb.PbFieldType.OS, packageName: const $pb.PackageName('usages')) - ..m<$core.String, $core.String>(2, _omitFieldNames ? '' : 'named', entryClassName: 'ConstArguments.NamedEntry', keyFieldType: $pb.PbFieldType.OS, valueFieldType: $pb.PbFieldType.OS, packageName: const $pb.PackageName('usages')) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - ConstArguments clone() => ConstArguments()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - ConstArguments copyWith(void Function(ConstArguments) updates) => super.copyWith((message) => updates(message as ConstArguments)) as ConstArguments; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static ConstArguments create() => ConstArguments._(); - ConstArguments createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static ConstArguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static ConstArguments? _defaultInstance; - - @$pb.TagNumber(1) - $core.Map<$core.int, $core.String> get positional => $_getMap(0); - - @$pb.TagNumber(2) - $core.Map<$core.String, $core.String> get named => $_getMap(1); -} - -class NonConstArguments extends $pb.GeneratedMessage { - factory NonConstArguments({ - $core.Iterable<$core.int>? positional, - $core.Iterable<$core.String>? named, - }) { - final $result = create(); - if (positional != null) { - $result.positional.addAll(positional); - } - if (named != null) { - $result.named.addAll(named); - } - return $result; - } - NonConstArguments._() : super(); - factory NonConstArguments.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory NonConstArguments.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'NonConstArguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..p<$core.int>(1, _omitFieldNames ? '' : 'positional', $pb.PbFieldType.KU3) - ..pPS(2, _omitFieldNames ? '' : 'named') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - NonConstArguments clone() => NonConstArguments()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - NonConstArguments copyWith(void Function(NonConstArguments) updates) => super.copyWith((message) => updates(message as NonConstArguments)) as NonConstArguments; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static NonConstArguments create() => NonConstArguments._(); - NonConstArguments createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static NonConstArguments getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static NonConstArguments? _defaultInstance; - - @$pb.TagNumber(1) - $core.List<$core.int> get positional => $_getList(0); - - @$pb.TagNumber(2) - $core.List<$core.String> get named => $_getList(1); -} - -class Field extends $pb.GeneratedMessage { - factory Field({ - $core.String? className, - $core.String? name, - FieldValue? value, - }) { - final $result = create(); - if (className != null) { - $result.className = className; - } - if (name != null) { - $result.name = name; - } - if (value != null) { - $result.value = value; - } - return $result; - } - Field._() : super(); - factory Field.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Field.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Field', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'className') - ..aOS(2, _omitFieldNames ? '' : 'name') - ..aOM(3, _omitFieldNames ? '' : 'value', subBuilder: FieldValue.create) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Field clone() => Field()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Field copyWith(void Function(Field) updates) => super.copyWith((message) => updates(message as Field)) as Field; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Field create() => Field._(); - Field createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Field getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Field? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get className => $_getSZ(0); - @$pb.TagNumber(1) - set className($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasClassName() => $_has(0); - @$pb.TagNumber(1) - void clearClassName() => clearField(1); - - @$pb.TagNumber(2) - $core.String get name => $_getSZ(1); - @$pb.TagNumber(2) - set name($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasName() => $_has(1); - @$pb.TagNumber(2) - void clearName() => clearField(2); - - @$pb.TagNumber(3) - FieldValue get value => $_getN(2); - @$pb.TagNumber(3) - set value(FieldValue v) { setField(3, v); } - @$pb.TagNumber(3) - $core.bool hasValue() => $_has(2); - @$pb.TagNumber(3) - void clearValue() => clearField(3); - @$pb.TagNumber(3) - FieldValue ensureValue() => $_ensure(2); -} - -enum FieldValue_Value { - intValue, - doubleValue, - boolValue, - stringValue, - notSet -} - -class FieldValue extends $pb.GeneratedMessage { - factory FieldValue({ - $core.int? intValue, - $core.double? doubleValue, - $core.bool? boolValue, - $core.String? stringValue, - }) { - final $result = create(); - if (intValue != null) { - $result.intValue = intValue; - } - if (doubleValue != null) { - $result.doubleValue = doubleValue; - } - if (boolValue != null) { - $result.boolValue = boolValue; - } - if (stringValue != null) { - $result.stringValue = stringValue; - } - return $result; - } - FieldValue._() : super(); - factory FieldValue.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory FieldValue.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static const $core.Map<$core.int, FieldValue_Value> _FieldValue_ValueByTag = { - 1 : FieldValue_Value.intValue, - 2 : FieldValue_Value.doubleValue, - 3 : FieldValue_Value.boolValue, - 4 : FieldValue_Value.stringValue, - 0 : FieldValue_Value.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'FieldValue', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..oo(0, [1, 2, 3, 4]) - ..a<$core.int>(1, _omitFieldNames ? '' : 'intValue', $pb.PbFieldType.O3) - ..a<$core.double>(2, _omitFieldNames ? '' : 'doubleValue', $pb.PbFieldType.OD) - ..aOB(3, _omitFieldNames ? '' : 'boolValue') - ..aOS(4, _omitFieldNames ? '' : 'stringValue') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - FieldValue clone() => FieldValue()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - FieldValue copyWith(void Function(FieldValue) updates) => super.copyWith((message) => updates(message as FieldValue)) as FieldValue; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static FieldValue create() => FieldValue._(); - FieldValue createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static FieldValue getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static FieldValue? _defaultInstance; - - FieldValue_Value whichValue() => _FieldValue_ValueByTag[$_whichOneof(0)]!; - void clearValue() => clearField($_whichOneof(0)); - - @$pb.TagNumber(1) - $core.int get intValue => $_getIZ(0); - @$pb.TagNumber(1) - set intValue($core.int v) { $_setSignedInt32(0, v); } - @$pb.TagNumber(1) - $core.bool hasIntValue() => $_has(0); - @$pb.TagNumber(1) - void clearIntValue() => clearField(1); - - @$pb.TagNumber(2) - $core.double get doubleValue => $_getN(1); - @$pb.TagNumber(2) - set doubleValue($core.double v) { $_setDouble(1, v); } - @$pb.TagNumber(2) - $core.bool hasDoubleValue() => $_has(1); - @$pb.TagNumber(2) - void clearDoubleValue() => clearField(2); - - @$pb.TagNumber(3) - $core.bool get boolValue => $_getBF(2); - @$pb.TagNumber(3) - set boolValue($core.bool v) { $_setBool(2, v); } - @$pb.TagNumber(3) - $core.bool hasBoolValue() => $_has(2); - @$pb.TagNumber(3) - void clearBoolValue() => clearField(3); - - @$pb.TagNumber(4) - $core.String get stringValue => $_getSZ(3); - @$pb.TagNumber(4) - set stringValue($core.String v) { $_setString(3, v); } - @$pb.TagNumber(4) - $core.bool hasStringValue() => $_has(3); - @$pb.TagNumber(4) - void clearStringValue() => clearField(4); -} - - -const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); -const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/pkgs/record_use/lib/src/proto/storage/usages_storage.pbjson.dart b/pkgs/record_use/lib/src/proto/storage/usages_storage.pbjson.dart deleted file mode 100644 index 2003fb71..00000000 --- a/pkgs/record_use/lib/src/proto/storage/usages_storage.pbjson.dart +++ /dev/null @@ -1,267 +0,0 @@ -// -// Generated code. Do not modify. -// source: usages_storage.proto -// -// @dart = 2.12 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: unnecessary_import, unnecessary_this, unused_import - -import 'dart:convert' as $convert; -import 'dart:core' as $core; -import 'dart:typed_data' as $typed_data; - -@$core.Deprecated('Use usagesDescriptor instead') -const Usages$json = { - '1': 'Usages', - '2': [ - {'1': 'metadata', '3': 1, '4': 1, '5': 11, '6': '.usages.Metadata', '10': 'metadata'}, - {'1': 'uris', '3': 2, '4': 3, '5': 11, '6': '.usages.Uri', '10': 'uris'}, - {'1': 'ids', '3': 3, '4': 3, '5': 11, '6': '.usages.Identifier', '10': 'ids'}, - {'1': 'calls', '3': 4, '4': 3, '5': 11, '6': '.usages.Usage', '10': 'calls'}, - {'1': 'instances', '3': 5, '4': 3, '5': 11, '6': '.usages.Usage', '10': 'instances'}, - ], -}; - -/// Descriptor for `Usages`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List usagesDescriptor = $convert.base64Decode( - 'CgZVc2FnZXMSLAoIbWV0YWRhdGEYASABKAsyEC51c2FnZXMuTWV0YWRhdGFSCG1ldGFkYXRhEh' - '8KBHVyaXMYAiADKAsyCy51c2FnZXMuVXJpUgR1cmlzEiQKA2lkcxgDIAMoCzISLnVzYWdlcy5J' - 'ZGVudGlmaWVyUgNpZHMSIwoFY2FsbHMYBCADKAsyDS51c2FnZXMuVXNhZ2VSBWNhbGxzEisKCW' - 'luc3RhbmNlcxgFIAMoCzINLnVzYWdlcy5Vc2FnZVIJaW5zdGFuY2Vz'); - -@$core.Deprecated('Use metadataDescriptor instead') -const Metadata$json = { - '1': 'Metadata', - '2': [ - {'1': 'comment', '3': 1, '4': 1, '5': 9, '9': 0, '10': 'comment', '17': true}, - {'1': 'version', '3': 2, '4': 1, '5': 9, '10': 'version'}, - ], - '8': [ - {'1': '_comment'}, - ], -}; - -/// Descriptor for `Metadata`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List metadataDescriptor = $convert.base64Decode( - 'CghNZXRhZGF0YRIdCgdjb21tZW50GAEgASgJSABSB2NvbW1lbnSIAQESGAoHdmVyc2lvbhgCIA' - 'EoCVIHdmVyc2lvbkIKCghfY29tbWVudA=='); - -@$core.Deprecated('Use uriDescriptor instead') -const Uri$json = { - '1': 'Uri', - '2': [ - {'1': 'value', '3': 1, '4': 1, '5': 9, '10': 'value'}, - ], -}; - -/// Descriptor for `Uri`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List uriDescriptor = $convert.base64Decode( - 'CgNVcmkSFAoFdmFsdWUYASABKAlSBXZhbHVl'); - -@$core.Deprecated('Use identifierDescriptor instead') -const Identifier$json = { - '1': 'Identifier', - '2': [ - {'1': 'uri', '3': 1, '4': 1, '5': 13, '10': 'uri'}, - {'1': 'parent', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'parent', '17': true}, - {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, - ], - '8': [ - {'1': '_parent'}, - ], -}; - -/// Descriptor for `Identifier`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List identifierDescriptor = $convert.base64Decode( - 'CgpJZGVudGlmaWVyEhAKA3VyaRgBIAEoDVIDdXJpEhsKBnBhcmVudBgCIAEoCUgAUgZwYXJlbn' - 'SIAQESEgoEbmFtZRgDIAEoCVIEbmFtZUIJCgdfcGFyZW50'); - -@$core.Deprecated('Use usageDescriptor instead') -const Usage$json = { - '1': 'Usage', - '2': [ - {'1': 'definition', '3': 1, '4': 1, '5': 11, '6': '.usages.Definition', '10': 'definition'}, - {'1': 'references', '3': 2, '4': 3, '5': 11, '6': '.usages.Reference', '10': 'references'}, - ], -}; - -/// Descriptor for `Usage`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List usageDescriptor = $convert.base64Decode( - 'CgVVc2FnZRIyCgpkZWZpbml0aW9uGAEgASgLMhIudXNhZ2VzLkRlZmluaXRpb25SCmRlZmluaX' - 'Rpb24SMQoKcmVmZXJlbmNlcxgCIAMoCzIRLnVzYWdlcy5SZWZlcmVuY2VSCnJlZmVyZW5jZXM='); - -@$core.Deprecated('Use definitionDescriptor instead') -const Definition$json = { - '1': 'Definition', - '2': [ - {'1': 'identifier', '3': 1, '4': 1, '5': 13, '10': 'identifier'}, - {'1': 'location', '3': 2, '4': 1, '5': 11, '6': '.usages.Location', '10': 'location'}, - {'1': 'loading_unit', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'loadingUnit', '17': true}, - ], - '8': [ - {'1': '_loading_unit'}, - ], -}; - -/// Descriptor for `Definition`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List definitionDescriptor = $convert.base64Decode( - 'CgpEZWZpbml0aW9uEh4KCmlkZW50aWZpZXIYASABKA1SCmlkZW50aWZpZXISLAoIbG9jYXRpb2' - '4YAiABKAsyEC51c2FnZXMuTG9jYXRpb25SCGxvY2F0aW9uEiYKDGxvYWRpbmdfdW5pdBgDIAEo' - 'CUgAUgtsb2FkaW5nVW5pdIgBAUIPCg1fbG9hZGluZ191bml0'); - -@$core.Deprecated('Use locationDescriptor instead') -const Location$json = { - '1': 'Location', - '2': [ - {'1': 'uri', '3': 1, '4': 1, '5': 13, '10': 'uri'}, - {'1': 'line', '3': 2, '4': 1, '5': 13, '10': 'line'}, - {'1': 'column', '3': 3, '4': 1, '5': 13, '10': 'column'}, - ], -}; - -/// Descriptor for `Location`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List locationDescriptor = $convert.base64Decode( - 'CghMb2NhdGlvbhIQCgN1cmkYASABKA1SA3VyaRISCgRsaW5lGAIgASgNUgRsaW5lEhYKBmNvbH' - 'VtbhgDIAEoDVIGY29sdW1u'); - -@$core.Deprecated('Use referenceDescriptor instead') -const Reference$json = { - '1': 'Reference', - '2': [ - {'1': 'location', '3': 1, '4': 1, '5': 11, '6': '.usages.Location', '10': 'location'}, - {'1': 'loading_unit', '3': 2, '4': 1, '5': 9, '10': 'loadingUnit'}, - {'1': 'arguments', '3': 3, '4': 1, '5': 11, '6': '.usages.Arguments', '9': 0, '10': 'arguments'}, - {'1': 'fields', '3': 4, '4': 1, '5': 11, '6': '.usages.Fields', '9': 0, '10': 'fields'}, - ], - '8': [ - {'1': 'reference'}, - ], -}; - -/// Descriptor for `Reference`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List referenceDescriptor = $convert.base64Decode( - 'CglSZWZlcmVuY2USLAoIbG9jYXRpb24YASABKAsyEC51c2FnZXMuTG9jYXRpb25SCGxvY2F0aW' - '9uEiEKDGxvYWRpbmdfdW5pdBgCIAEoCVILbG9hZGluZ1VuaXQSMQoJYXJndW1lbnRzGAMgASgL' - 'MhEudXNhZ2VzLkFyZ3VtZW50c0gAUglhcmd1bWVudHMSKAoGZmllbGRzGAQgASgLMg4udXNhZ2' - 'VzLkZpZWxkc0gAUgZmaWVsZHNCCwoJcmVmZXJlbmNl'); - -@$core.Deprecated('Use fieldsDescriptor instead') -const Fields$json = { - '1': 'Fields', - '2': [ - {'1': 'fields', '3': 1, '4': 3, '5': 11, '6': '.usages.Field', '10': 'fields'}, - ], -}; - -/// Descriptor for `Fields`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldsDescriptor = $convert.base64Decode( - 'CgZGaWVsZHMSJQoGZmllbGRzGAEgAygLMg0udXNhZ2VzLkZpZWxkUgZmaWVsZHM='); - -@$core.Deprecated('Use argumentsDescriptor instead') -const Arguments$json = { - '1': 'Arguments', - '2': [ - {'1': 'const', '3': 1, '4': 1, '5': 11, '6': '.usages.ConstArguments', '9': 0, '10': 'const'}, - {'1': 'non_const', '3': 2, '4': 1, '5': 11, '6': '.usages.NonConstArguments', '9': 0, '10': 'nonConst'}, - ], - '8': [ - {'1': 'kind'}, - ], -}; - -/// Descriptor for `Arguments`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List argumentsDescriptor = $convert.base64Decode( - 'CglBcmd1bWVudHMSLgoFY29uc3QYASABKAsyFi51c2FnZXMuQ29uc3RBcmd1bWVudHNIAFIFY2' - '9uc3QSOAoJbm9uX2NvbnN0GAIgASgLMhkudXNhZ2VzLk5vbkNvbnN0QXJndW1lbnRzSABSCG5v' - 'bkNvbnN0QgYKBGtpbmQ='); - -@$core.Deprecated('Use constArgumentsDescriptor instead') -const ConstArguments$json = { - '1': 'ConstArguments', - '2': [ - {'1': 'positional', '3': 1, '4': 3, '5': 11, '6': '.usages.ConstArguments.PositionalEntry', '10': 'positional'}, - {'1': 'named', '3': 2, '4': 3, '5': 11, '6': '.usages.ConstArguments.NamedEntry', '10': 'named'}, - ], - '3': [ConstArguments_PositionalEntry$json, ConstArguments_NamedEntry$json], -}; - -@$core.Deprecated('Use constArgumentsDescriptor instead') -const ConstArguments_PositionalEntry$json = { - '1': 'PositionalEntry', - '2': [ - {'1': 'key', '3': 1, '4': 1, '5': 13, '10': 'key'}, - {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, - ], - '7': {'7': true}, -}; - -@$core.Deprecated('Use constArgumentsDescriptor instead') -const ConstArguments_NamedEntry$json = { - '1': 'NamedEntry', - '2': [ - {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, - {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, - ], - '7': {'7': true}, -}; - -/// Descriptor for `ConstArguments`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List constArgumentsDescriptor = $convert.base64Decode( - 'Cg5Db25zdEFyZ3VtZW50cxJGCgpwb3NpdGlvbmFsGAEgAygLMiYudXNhZ2VzLkNvbnN0QXJndW' - '1lbnRzLlBvc2l0aW9uYWxFbnRyeVIKcG9zaXRpb25hbBI3CgVuYW1lZBgCIAMoCzIhLnVzYWdl' - 'cy5Db25zdEFyZ3VtZW50cy5OYW1lZEVudHJ5UgVuYW1lZBo9Cg9Qb3NpdGlvbmFsRW50cnkSEA' - 'oDa2V5GAEgASgNUgNrZXkSFAoFdmFsdWUYAiABKAlSBXZhbHVlOgI4ARo4CgpOYW1lZEVudHJ5' - 'EhAKA2tleRgBIAEoCVIDa2V5EhQKBXZhbHVlGAIgASgJUgV2YWx1ZToCOAE='); - -@$core.Deprecated('Use nonConstArgumentsDescriptor instead') -const NonConstArguments$json = { - '1': 'NonConstArguments', - '2': [ - {'1': 'positional', '3': 1, '4': 3, '5': 13, '10': 'positional'}, - {'1': 'named', '3': 2, '4': 3, '5': 9, '10': 'named'}, - ], -}; - -/// Descriptor for `NonConstArguments`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List nonConstArgumentsDescriptor = $convert.base64Decode( - 'ChFOb25Db25zdEFyZ3VtZW50cxIeCgpwb3NpdGlvbmFsGAEgAygNUgpwb3NpdGlvbmFsEhQKBW' - '5hbWVkGAIgAygJUgVuYW1lZA=='); - -@$core.Deprecated('Use fieldDescriptor instead') -const Field$json = { - '1': 'Field', - '2': [ - {'1': 'class_name', '3': 1, '4': 1, '5': 9, '10': 'className'}, - {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, - {'1': 'value', '3': 3, '4': 1, '5': 11, '6': '.usages.FieldValue', '10': 'value'}, - ], -}; - -/// Descriptor for `Field`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldDescriptor = $convert.base64Decode( - 'CgVGaWVsZBIdCgpjbGFzc19uYW1lGAEgASgJUgljbGFzc05hbWUSEgoEbmFtZRgCIAEoCVIEbm' - 'FtZRIoCgV2YWx1ZRgDIAEoCzISLnVzYWdlcy5GaWVsZFZhbHVlUgV2YWx1ZQ=='); - -@$core.Deprecated('Use fieldValueDescriptor instead') -const FieldValue$json = { - '1': 'FieldValue', - '2': [ - {'1': 'int_value', '3': 1, '4': 1, '5': 5, '9': 0, '10': 'intValue'}, - {'1': 'double_value', '3': 2, '4': 1, '5': 1, '9': 0, '10': 'doubleValue'}, - {'1': 'bool_value', '3': 3, '4': 1, '5': 8, '9': 0, '10': 'boolValue'}, - {'1': 'string_value', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'stringValue'}, - ], - '8': [ - {'1': 'value'}, - ], -}; - -/// Descriptor for `FieldValue`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldValueDescriptor = $convert.base64Decode( - 'CgpGaWVsZFZhbHVlEh0KCWludF92YWx1ZRgBIAEoBUgAUghpbnRWYWx1ZRIjCgxkb3VibGVfdm' - 'FsdWUYAiABKAFIAFILZG91YmxlVmFsdWUSHwoKYm9vbF92YWx1ZRgDIAEoCEgAUglib29sVmFs' - 'dWUSIwoMc3RyaW5nX3ZhbHVlGAQgASgJSABSC3N0cmluZ1ZhbHVlQgcKBXZhbHVl'); - diff --git a/pkgs/record_use/lib/src/proto/usages_read.pb.dart b/pkgs/record_use/lib/src/proto/usages_read.pb.dart new file mode 100644 index 00000000..a4a474c4 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/usages_read.pb.dart @@ -0,0 +1,396 @@ +// +// Generated code. Do not modify. +// source: usages_read.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import 'usages_shared.pb.dart' as $0; + +class Usages extends $pb.GeneratedMessage { + factory Usages({ + $0.Metadata? metadata, + $core.Iterable? calls, + $core.Iterable? instances, + }) { + final $result = create(); + if (metadata != null) { + $result.metadata = metadata; + } + if (calls != null) { + $result.calls.addAll(calls); + } + if (instances != null) { + $result.instances.addAll(instances); + } + return $result; + } + Usages._() : super(); + factory Usages.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Usages.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Usages', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..aOM<$0.Metadata>(1, _omitFieldNames ? '' : 'metadata', + subBuilder: $0.Metadata.create) + ..pc(4, _omitFieldNames ? '' : 'calls', $pb.PbFieldType.PM, + subBuilder: Usage.create) + ..pc(5, _omitFieldNames ? '' : 'instances', $pb.PbFieldType.PM, + subBuilder: Usage.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Usages clone() => Usages()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Usages copyWith(void Function(Usages) updates) => + super.copyWith((message) => updates(message as Usages)) as Usages; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Usages create() => Usages._(); + Usages createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Usages getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Usages? _defaultInstance; + + @$pb.TagNumber(1) + $0.Metadata get metadata => $_getN(0); + @$pb.TagNumber(1) + set metadata($0.Metadata v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasMetadata() => $_has(0); + @$pb.TagNumber(1) + void clearMetadata() => clearField(1); + @$pb.TagNumber(1) + $0.Metadata ensureMetadata() => $_ensure(0); + + @$pb.TagNumber(4) + $core.List get calls => $_getList(1); + + @$pb.TagNumber(5) + $core.List get instances => $_getList(2); +} + +class Usage extends $pb.GeneratedMessage { + factory Usage({ + $0.Definition? definition, + $core.Iterable? references, + }) { + final $result = create(); + if (definition != null) { + $result.definition = definition; + } + if (references != null) { + $result.references.addAll(references); + } + return $result; + } + Usage._() : super(); + factory Usage.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Usage.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Usage', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..aOM<$0.Definition>(1, _omitFieldNames ? '' : 'definition', + subBuilder: $0.Definition.create) + ..pc(2, _omitFieldNames ? '' : 'references', $pb.PbFieldType.PM, + subBuilder: Reference.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Usage clone() => Usage()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Usage copyWith(void Function(Usage) updates) => + super.copyWith((message) => updates(message as Usage)) as Usage; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Usage create() => Usage._(); + Usage createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Usage getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Usage? _defaultInstance; + + @$pb.TagNumber(1) + $0.Definition get definition => $_getN(0); + @$pb.TagNumber(1) + set definition($0.Definition v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasDefinition() => $_has(0); + @$pb.TagNumber(1) + void clearDefinition() => clearField(1); + @$pb.TagNumber(1) + $0.Definition ensureDefinition() => $_ensure(0); + + @$pb.TagNumber(2) + $core.List get references => $_getList(1); +} + +class Location extends $pb.GeneratedMessage { + factory Location({ + $core.String? uri, + $core.int? line, + $core.int? column, + }) { + final $result = create(); + if (uri != null) { + $result.uri = uri; + } + if (line != null) { + $result.line = line; + } + if (column != null) { + $result.column = column; + } + return $result; + } + Location._() : super(); + factory Location.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Location.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Location', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'uri') + ..a<$core.int>(2, _omitFieldNames ? '' : 'line', $pb.PbFieldType.OU3) + ..a<$core.int>(3, _omitFieldNames ? '' : 'column', $pb.PbFieldType.OU3) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Location clone() => Location()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Location copyWith(void Function(Location) updates) => + super.copyWith((message) => updates(message as Location)) as Location; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Location create() => Location._(); + Location createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Location getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Location? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get uri => $_getSZ(0); + @$pb.TagNumber(1) + set uri($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasUri() => $_has(0); + @$pb.TagNumber(1) + void clearUri() => clearField(1); + + @$pb.TagNumber(2) + $core.int get line => $_getIZ(1); + @$pb.TagNumber(2) + set line($core.int v) { + $_setUnsignedInt32(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasLine() => $_has(1); + @$pb.TagNumber(2) + void clearLine() => clearField(2); + + @$pb.TagNumber(3) + $core.int get column => $_getIZ(2); + @$pb.TagNumber(3) + set column($core.int v) { + $_setUnsignedInt32(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasColumn() => $_has(2); + @$pb.TagNumber(3) + void clearColumn() => clearField(3); +} + +enum Reference_Reference { arguments, fields, notSet } + +class Reference extends $pb.GeneratedMessage { + factory Reference({ + Location? location, + $core.String? loadingUnit, + $0.Arguments? arguments, + $0.Fields? fields, + }) { + final $result = create(); + if (location != null) { + $result.location = location; + } + if (loadingUnit != null) { + $result.loadingUnit = loadingUnit; + } + if (arguments != null) { + $result.arguments = arguments; + } + if (fields != null) { + $result.fields = fields; + } + return $result; + } + Reference._() : super(); + factory Reference.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Reference.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static const $core.Map<$core.int, Reference_Reference> + _Reference_ReferenceByTag = { + 3: Reference_Reference.arguments, + 4: Reference_Reference.fields, + 0: Reference_Reference.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Reference', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..oo(0, [3, 4]) + ..aOM(1, _omitFieldNames ? '' : 'location', + subBuilder: Location.create) + ..aOS(2, _omitFieldNames ? '' : 'loadingUnit') + ..aOM<$0.Arguments>(3, _omitFieldNames ? '' : 'arguments', + subBuilder: $0.Arguments.create) + ..aOM<$0.Fields>(4, _omitFieldNames ? '' : 'fields', + subBuilder: $0.Fields.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Reference clone() => Reference()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Reference copyWith(void Function(Reference) updates) => + super.copyWith((message) => updates(message as Reference)) as Reference; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Reference create() => Reference._(); + Reference createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Reference getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Reference? _defaultInstance; + + Reference_Reference whichReference() => + _Reference_ReferenceByTag[$_whichOneof(0)]!; + void clearReference() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + Location get location => $_getN(0); + @$pb.TagNumber(1) + set location(Location v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasLocation() => $_has(0); + @$pb.TagNumber(1) + void clearLocation() => clearField(1); + @$pb.TagNumber(1) + Location ensureLocation() => $_ensure(0); + + @$pb.TagNumber(2) + $core.String get loadingUnit => $_getSZ(1); + @$pb.TagNumber(2) + set loadingUnit($core.String v) { + $_setString(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasLoadingUnit() => $_has(1); + @$pb.TagNumber(2) + void clearLoadingUnit() => clearField(2); + + @$pb.TagNumber(3) + $0.Arguments get arguments => $_getN(2); + @$pb.TagNumber(3) + set arguments($0.Arguments v) { + setField(3, v); + } + + @$pb.TagNumber(3) + $core.bool hasArguments() => $_has(2); + @$pb.TagNumber(3) + void clearArguments() => clearField(3); + @$pb.TagNumber(3) + $0.Arguments ensureArguments() => $_ensure(2); + + @$pb.TagNumber(4) + $0.Fields get fields => $_getN(3); + @$pb.TagNumber(4) + set fields($0.Fields v) { + setField(4, v); + } + + @$pb.TagNumber(4) + $core.bool hasFields() => $_has(3); + @$pb.TagNumber(4) + void clearFields() => clearField(4); + @$pb.TagNumber(4) + $0.Fields ensureFields() => $_ensure(3); +} + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/pkgs/record_use/lib/src/proto/read/usages.pbenum.dart b/pkgs/record_use/lib/src/proto/usages_read.pbenum.dart similarity index 91% rename from pkgs/record_use/lib/src/proto/read/usages.pbenum.dart rename to pkgs/record_use/lib/src/proto/usages_read.pbenum.dart index 7a454fd8..2abf009c 100644 --- a/pkgs/record_use/lib/src/proto/read/usages.pbenum.dart +++ b/pkgs/record_use/lib/src/proto/usages_read.pbenum.dart @@ -1,6 +1,6 @@ // // Generated code. Do not modify. -// source: usages.proto +// source: usages_read.proto // // @dart = 2.12 @@ -8,4 +8,3 @@ // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import - diff --git a/pkgs/record_use/lib/src/proto/usages_read.pbjson.dart b/pkgs/record_use/lib/src/proto/usages_read.pbjson.dart new file mode 100644 index 00000000..a67c0fea --- /dev/null +++ b/pkgs/record_use/lib/src/proto/usages_read.pbjson.dart @@ -0,0 +1,139 @@ +// +// Generated code. Do not modify. +// source: usages_read.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use usagesDescriptor instead') +const Usages$json = { + '1': 'Usages', + '2': [ + { + '1': 'metadata', + '3': 1, + '4': 1, + '5': 11, + '6': '.usages_shared.Metadata', + '10': 'metadata' + }, + { + '1': 'calls', + '3': 4, + '4': 3, + '5': 11, + '6': '.usages.Usage', + '10': 'calls' + }, + { + '1': 'instances', + '3': 5, + '4': 3, + '5': 11, + '6': '.usages.Usage', + '10': 'instances' + }, + ], +}; + +/// Descriptor for `Usages`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List usagesDescriptor = $convert.base64Decode( + 'CgZVc2FnZXMSMwoIbWV0YWRhdGEYASABKAsyFy51c2FnZXNfc2hhcmVkLk1ldGFkYXRhUghtZX' + 'RhZGF0YRIjCgVjYWxscxgEIAMoCzINLnVzYWdlcy5Vc2FnZVIFY2FsbHMSKwoJaW5zdGFuY2Vz' + 'GAUgAygLMg0udXNhZ2VzLlVzYWdlUglpbnN0YW5jZXM='); + +@$core.Deprecated('Use usageDescriptor instead') +const Usage$json = { + '1': 'Usage', + '2': [ + { + '1': 'definition', + '3': 1, + '4': 1, + '5': 11, + '6': '.usages_shared.Definition', + '10': 'definition' + }, + { + '1': 'references', + '3': 2, + '4': 3, + '5': 11, + '6': '.usages.Reference', + '10': 'references' + }, + ], +}; + +/// Descriptor for `Usage`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List usageDescriptor = $convert.base64Decode( + 'CgVVc2FnZRI5CgpkZWZpbml0aW9uGAEgASgLMhkudXNhZ2VzX3NoYXJlZC5EZWZpbml0aW9uUg' + 'pkZWZpbml0aW9uEjEKCnJlZmVyZW5jZXMYAiADKAsyES51c2FnZXMuUmVmZXJlbmNlUgpyZWZl' + 'cmVuY2Vz'); + +@$core.Deprecated('Use locationDescriptor instead') +const Location$json = { + '1': 'Location', + '2': [ + {'1': 'uri', '3': 1, '4': 1, '5': 9, '10': 'uri'}, + {'1': 'line', '3': 2, '4': 1, '5': 13, '10': 'line'}, + {'1': 'column', '3': 3, '4': 1, '5': 13, '10': 'column'}, + ], +}; + +/// Descriptor for `Location`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List locationDescriptor = $convert.base64Decode( + 'CghMb2NhdGlvbhIQCgN1cmkYASABKAlSA3VyaRISCgRsaW5lGAIgASgNUgRsaW5lEhYKBmNvbH' + 'VtbhgDIAEoDVIGY29sdW1u'); + +@$core.Deprecated('Use referenceDescriptor instead') +const Reference$json = { + '1': 'Reference', + '2': [ + { + '1': 'location', + '3': 1, + '4': 1, + '5': 11, + '6': '.usages.Location', + '10': 'location' + }, + {'1': 'loading_unit', '3': 2, '4': 1, '5': 9, '10': 'loadingUnit'}, + { + '1': 'arguments', + '3': 3, + '4': 1, + '5': 11, + '6': '.usages_shared.Arguments', + '9': 0, + '10': 'arguments' + }, + { + '1': 'fields', + '3': 4, + '4': 1, + '5': 11, + '6': '.usages_shared.Fields', + '9': 0, + '10': 'fields' + }, + ], + '8': [ + {'1': 'reference'}, + ], +}; + +/// Descriptor for `Reference`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List referenceDescriptor = $convert.base64Decode( + 'CglSZWZlcmVuY2USLAoIbG9jYXRpb24YASABKAsyEC51c2FnZXMuTG9jYXRpb25SCGxvY2F0aW' + '9uEiEKDGxvYWRpbmdfdW5pdBgCIAEoCVILbG9hZGluZ1VuaXQSOAoJYXJndW1lbnRzGAMgASgL' + 'MhgudXNhZ2VzX3NoYXJlZC5Bcmd1bWVudHNIAFIJYXJndW1lbnRzEi8KBmZpZWxkcxgEIAEoCz' + 'IVLnVzYWdlc19zaGFyZWQuRmllbGRzSABSBmZpZWxkc0ILCglyZWZlcmVuY2U='); diff --git a/pkgs/record_use/lib/src/proto/read/usages.pbserver.dart b/pkgs/record_use/lib/src/proto/usages_read.pbserver.dart similarity index 87% rename from pkgs/record_use/lib/src/proto/read/usages.pbserver.dart rename to pkgs/record_use/lib/src/proto/usages_read.pbserver.dart index 5be7bda9..3231126d 100644 --- a/pkgs/record_use/lib/src/proto/read/usages.pbserver.dart +++ b/pkgs/record_use/lib/src/proto/usages_read.pbserver.dart @@ -1,6 +1,6 @@ // // Generated code. Do not modify. -// source: usages.proto +// source: usages_read.proto // // @dart = 2.12 @@ -10,5 +10,4 @@ // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import -export 'usages.pb.dart'; - +export 'usages_read.pb.dart'; diff --git a/pkgs/record_use/lib/src/proto/usages_read.proto b/pkgs/record_use/lib/src/proto/usages_read.proto new file mode 100644 index 00000000..2cefbb9a --- /dev/null +++ b/pkgs/record_use/lib/src/proto/usages_read.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package usages; + +import "usages_shared.proto"; + +message Usages { + usages_shared.Metadata metadata = 1; + repeated Usage calls = 4; + repeated Usage instances = 5; +} + +message Usage { + usages_shared.Definition definition = 1; + repeated Reference references = 2; +} + + +message Location { + string uri = 1; + uint32 line = 2; + uint32 column = 3; +} + +message Reference { + Location location = 1; + string loading_unit = 2; + oneof reference { + usages_shared.Arguments arguments = 3; + usages_shared.Fields fields = 4; + } +} diff --git a/pkgs/record_use/lib/src/proto/usages_shared.pb.dart b/pkgs/record_use/lib/src/proto/usages_shared.pb.dart new file mode 100644 index 00000000..9fcecda3 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/usages_shared.pb.dart @@ -0,0 +1,796 @@ +// +// Generated code. Do not modify. +// source: usages_shared.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class Metadata extends $pb.GeneratedMessage { + factory Metadata({ + $core.String? comment, + $core.String? version, + }) { + final $result = create(); + if (comment != null) { + $result.comment = comment; + } + if (version != null) { + $result.version = version; + } + return $result; + } + Metadata._() : super(); + factory Metadata.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Metadata.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Metadata', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'comment') + ..aOS(2, _omitFieldNames ? '' : 'version') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Metadata clone() => Metadata()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Metadata copyWith(void Function(Metadata) updates) => + super.copyWith((message) => updates(message as Metadata)) as Metadata; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Metadata create() => Metadata._(); + Metadata createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Metadata getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Metadata? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get comment => $_getSZ(0); + @$pb.TagNumber(1) + set comment($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasComment() => $_has(0); + @$pb.TagNumber(1) + void clearComment() => clearField(1); + + @$pb.TagNumber(2) + $core.String get version => $_getSZ(1); + @$pb.TagNumber(2) + set version($core.String v) { + $_setString(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasVersion() => $_has(1); + @$pb.TagNumber(2) + void clearVersion() => clearField(2); +} + +class Definition extends $pb.GeneratedMessage { + factory Definition({ + Identifier? identifier, + $core.int? line, + $core.int? column, + $core.String? loadingUnit, + }) { + final $result = create(); + if (identifier != null) { + $result.identifier = identifier; + } + if (line != null) { + $result.line = line; + } + if (column != null) { + $result.column = column; + } + if (loadingUnit != null) { + $result.loadingUnit = loadingUnit; + } + return $result; + } + Definition._() : super(); + factory Definition.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Definition.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Definition', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), + createEmptyInstance: create) + ..aOM(1, _omitFieldNames ? '' : 'identifier', + subBuilder: Identifier.create) + ..a<$core.int>(2, _omitFieldNames ? '' : 'line', $pb.PbFieldType.OU3) + ..a<$core.int>(3, _omitFieldNames ? '' : 'column', $pb.PbFieldType.OU3) + ..aOS(4, _omitFieldNames ? '' : 'loadingUnit') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Definition clone() => Definition()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Definition copyWith(void Function(Definition) updates) => + super.copyWith((message) => updates(message as Definition)) as Definition; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Definition create() => Definition._(); + Definition createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Definition getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static Definition? _defaultInstance; + + @$pb.TagNumber(1) + Identifier get identifier => $_getN(0); + @$pb.TagNumber(1) + set identifier(Identifier v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasIdentifier() => $_has(0); + @$pb.TagNumber(1) + void clearIdentifier() => clearField(1); + @$pb.TagNumber(1) + Identifier ensureIdentifier() => $_ensure(0); + + @$pb.TagNumber(2) + $core.int get line => $_getIZ(1); + @$pb.TagNumber(2) + set line($core.int v) { + $_setUnsignedInt32(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasLine() => $_has(1); + @$pb.TagNumber(2) + void clearLine() => clearField(2); + + @$pb.TagNumber(3) + $core.int get column => $_getIZ(2); + @$pb.TagNumber(3) + set column($core.int v) { + $_setUnsignedInt32(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasColumn() => $_has(2); + @$pb.TagNumber(3) + void clearColumn() => clearField(3); + + @$pb.TagNumber(4) + $core.String get loadingUnit => $_getSZ(3); + @$pb.TagNumber(4) + set loadingUnit($core.String v) { + $_setString(3, v); + } + + @$pb.TagNumber(4) + $core.bool hasLoadingUnit() => $_has(3); + @$pb.TagNumber(4) + void clearLoadingUnit() => clearField(4); +} + +class Identifier extends $pb.GeneratedMessage { + factory Identifier({ + $core.String? uri, + $core.String? parent, + $core.String? name, + }) { + final $result = create(); + if (uri != null) { + $result.uri = uri; + } + if (parent != null) { + $result.parent = parent; + } + if (name != null) { + $result.name = name; + } + return $result; + } + Identifier._() : super(); + factory Identifier.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Identifier.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Identifier', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'uri') + ..aOS(2, _omitFieldNames ? '' : 'parent') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Identifier clone() => Identifier()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Identifier copyWith(void Function(Identifier) updates) => + super.copyWith((message) => updates(message as Identifier)) as Identifier; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Identifier create() => Identifier._(); + Identifier createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Identifier getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static Identifier? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get uri => $_getSZ(0); + @$pb.TagNumber(1) + set uri($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasUri() => $_has(0); + @$pb.TagNumber(1) + void clearUri() => clearField(1); + + @$pb.TagNumber(2) + $core.String get parent => $_getSZ(1); + @$pb.TagNumber(2) + set parent($core.String v) { + $_setString(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasParent() => $_has(1); + @$pb.TagNumber(2) + void clearParent() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { + $_setString(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); +} + +class Fields extends $pb.GeneratedMessage { + factory Fields({ + $core.Iterable? fields, + }) { + final $result = create(); + if (fields != null) { + $result.fields.addAll(fields); + } + return $result; + } + Fields._() : super(); + factory Fields.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Fields.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Fields', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), + createEmptyInstance: create) + ..pc(1, _omitFieldNames ? '' : 'fields', $pb.PbFieldType.PM, + subBuilder: Field.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Fields clone() => Fields()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Fields copyWith(void Function(Fields) updates) => + super.copyWith((message) => updates(message as Fields)) as Fields; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Fields create() => Fields._(); + Fields createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Fields getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Fields? _defaultInstance; + + @$pb.TagNumber(1) + $core.List get fields => $_getList(0); +} + +enum Arguments_Kind { constArguments, nonConstArguments, notSet } + +class Arguments extends $pb.GeneratedMessage { + factory Arguments({ + ConstArguments? constArguments, + NonConstArguments? nonConstArguments, + }) { + final $result = create(); + if (constArguments != null) { + $result.constArguments = constArguments; + } + if (nonConstArguments != null) { + $result.nonConstArguments = nonConstArguments; + } + return $result; + } + Arguments._() : super(); + factory Arguments.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Arguments.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static const $core.Map<$core.int, Arguments_Kind> _Arguments_KindByTag = { + 1: Arguments_Kind.constArguments, + 2: Arguments_Kind.nonConstArguments, + 0: Arguments_Kind.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Arguments', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), + createEmptyInstance: create) + ..oo(0, [1, 2]) + ..aOM(1, _omitFieldNames ? '' : 'constArguments', + subBuilder: ConstArguments.create) + ..aOM(2, _omitFieldNames ? '' : 'nonConstArguments', + subBuilder: NonConstArguments.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Arguments clone() => Arguments()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Arguments copyWith(void Function(Arguments) updates) => + super.copyWith((message) => updates(message as Arguments)) as Arguments; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Arguments create() => Arguments._(); + Arguments createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Arguments getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Arguments? _defaultInstance; + + Arguments_Kind whichKind() => _Arguments_KindByTag[$_whichOneof(0)]!; + void clearKind() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + ConstArguments get constArguments => $_getN(0); + @$pb.TagNumber(1) + set constArguments(ConstArguments v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasConstArguments() => $_has(0); + @$pb.TagNumber(1) + void clearConstArguments() => clearField(1); + @$pb.TagNumber(1) + ConstArguments ensureConstArguments() => $_ensure(0); + + @$pb.TagNumber(2) + NonConstArguments get nonConstArguments => $_getN(1); + @$pb.TagNumber(2) + set nonConstArguments(NonConstArguments v) { + setField(2, v); + } + + @$pb.TagNumber(2) + $core.bool hasNonConstArguments() => $_has(1); + @$pb.TagNumber(2) + void clearNonConstArguments() => clearField(2); + @$pb.TagNumber(2) + NonConstArguments ensureNonConstArguments() => $_ensure(1); +} + +class ConstArguments extends $pb.GeneratedMessage { + factory ConstArguments({ + $core.Map<$core.int, FieldValue>? positional, + $core.Map<$core.String, FieldValue>? named, + }) { + final $result = create(); + if (positional != null) { + $result.positional.addAll(positional); + } + if (named != null) { + $result.named.addAll(named); + } + return $result; + } + ConstArguments._() : super(); + factory ConstArguments.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ConstArguments.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'ConstArguments', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), + createEmptyInstance: create) + ..m<$core.int, FieldValue>(1, _omitFieldNames ? '' : 'positional', + entryClassName: 'ConstArguments.PositionalEntry', + keyFieldType: $pb.PbFieldType.OU3, + valueFieldType: $pb.PbFieldType.OM, + valueCreator: FieldValue.create, + valueDefaultOrMaker: FieldValue.getDefault, + packageName: const $pb.PackageName('usages_shared')) + ..m<$core.String, FieldValue>(2, _omitFieldNames ? '' : 'named', + entryClassName: 'ConstArguments.NamedEntry', + keyFieldType: $pb.PbFieldType.OS, + valueFieldType: $pb.PbFieldType.OM, + valueCreator: FieldValue.create, + valueDefaultOrMaker: FieldValue.getDefault, + packageName: const $pb.PackageName('usages_shared')) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ConstArguments clone() => ConstArguments()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ConstArguments copyWith(void Function(ConstArguments) updates) => + super.copyWith((message) => updates(message as ConstArguments)) + as ConstArguments; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ConstArguments create() => ConstArguments._(); + ConstArguments createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ConstArguments getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static ConstArguments? _defaultInstance; + + @$pb.TagNumber(1) + $core.Map<$core.int, FieldValue> get positional => $_getMap(0); + + @$pb.TagNumber(2) + $core.Map<$core.String, FieldValue> get named => $_getMap(1); +} + +class NonConstArguments extends $pb.GeneratedMessage { + factory NonConstArguments({ + $core.Iterable<$core.int>? positional, + $core.Iterable<$core.String>? named, + }) { + final $result = create(); + if (positional != null) { + $result.positional.addAll(positional); + } + if (named != null) { + $result.named.addAll(named); + } + return $result; + } + NonConstArguments._() : super(); + factory NonConstArguments.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory NonConstArguments.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'NonConstArguments', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), + createEmptyInstance: create) + ..p<$core.int>(1, _omitFieldNames ? '' : 'positional', $pb.PbFieldType.KU3) + ..pPS(2, _omitFieldNames ? '' : 'named') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + NonConstArguments clone() => NonConstArguments()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + NonConstArguments copyWith(void Function(NonConstArguments) updates) => + super.copyWith((message) => updates(message as NonConstArguments)) + as NonConstArguments; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static NonConstArguments create() => NonConstArguments._(); + NonConstArguments createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static NonConstArguments getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static NonConstArguments? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$core.int> get positional => $_getList(0); + + @$pb.TagNumber(2) + $core.List<$core.String> get named => $_getList(1); +} + +class Field extends $pb.GeneratedMessage { + factory Field({ + $core.String? className, + $core.String? name, + FieldValue? value, + }) { + final $result = create(); + if (className != null) { + $result.className = className; + } + if (name != null) { + $result.name = name; + } + if (value != null) { + $result.value = value; + } + return $result; + } + Field._() : super(); + factory Field.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Field.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Field', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'className') + ..aOS(2, _omitFieldNames ? '' : 'name') + ..aOM(3, _omitFieldNames ? '' : 'value', + subBuilder: FieldValue.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Field clone() => Field()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Field copyWith(void Function(Field) updates) => + super.copyWith((message) => updates(message as Field)) as Field; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Field create() => Field._(); + Field createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Field getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Field? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get className => $_getSZ(0); + @$pb.TagNumber(1) + set className($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasClassName() => $_has(0); + @$pb.TagNumber(1) + void clearClassName() => clearField(1); + + @$pb.TagNumber(2) + $core.String get name => $_getSZ(1); + @$pb.TagNumber(2) + set name($core.String v) { + $_setString(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasName() => $_has(1); + @$pb.TagNumber(2) + void clearName() => clearField(2); + + @$pb.TagNumber(3) + FieldValue get value => $_getN(2); + @$pb.TagNumber(3) + set value(FieldValue v) { + setField(3, v); + } + + @$pb.TagNumber(3) + $core.bool hasValue() => $_has(2); + @$pb.TagNumber(3) + void clearValue() => clearField(3); + @$pb.TagNumber(3) + FieldValue ensureValue() => $_ensure(2); +} + +enum FieldValue_Value { intValue, doubleValue, boolValue, stringValue, notSet } + +class FieldValue extends $pb.GeneratedMessage { + factory FieldValue({ + $core.int? intValue, + $core.double? doubleValue, + $core.bool? boolValue, + $core.String? stringValue, + }) { + final $result = create(); + if (intValue != null) { + $result.intValue = intValue; + } + if (doubleValue != null) { + $result.doubleValue = doubleValue; + } + if (boolValue != null) { + $result.boolValue = boolValue; + } + if (stringValue != null) { + $result.stringValue = stringValue; + } + return $result; + } + FieldValue._() : super(); + factory FieldValue.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory FieldValue.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static const $core.Map<$core.int, FieldValue_Value> _FieldValue_ValueByTag = { + 1: FieldValue_Value.intValue, + 2: FieldValue_Value.doubleValue, + 3: FieldValue_Value.boolValue, + 4: FieldValue_Value.stringValue, + 0: FieldValue_Value.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'FieldValue', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), + createEmptyInstance: create) + ..oo(0, [1, 2, 3, 4]) + ..a<$core.int>(1, _omitFieldNames ? '' : 'intValue', $pb.PbFieldType.O3) + ..a<$core.double>( + 2, _omitFieldNames ? '' : 'doubleValue', $pb.PbFieldType.OD) + ..aOB(3, _omitFieldNames ? '' : 'boolValue') + ..aOS(4, _omitFieldNames ? '' : 'stringValue') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + FieldValue clone() => FieldValue()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + FieldValue copyWith(void Function(FieldValue) updates) => + super.copyWith((message) => updates(message as FieldValue)) as FieldValue; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static FieldValue create() => FieldValue._(); + FieldValue createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static FieldValue getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static FieldValue? _defaultInstance; + + FieldValue_Value whichValue() => _FieldValue_ValueByTag[$_whichOneof(0)]!; + void clearValue() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + $core.int get intValue => $_getIZ(0); + @$pb.TagNumber(1) + set intValue($core.int v) { + $_setSignedInt32(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasIntValue() => $_has(0); + @$pb.TagNumber(1) + void clearIntValue() => clearField(1); + + @$pb.TagNumber(2) + $core.double get doubleValue => $_getN(1); + @$pb.TagNumber(2) + set doubleValue($core.double v) { + $_setDouble(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasDoubleValue() => $_has(1); + @$pb.TagNumber(2) + void clearDoubleValue() => clearField(2); + + @$pb.TagNumber(3) + $core.bool get boolValue => $_getBF(2); + @$pb.TagNumber(3) + set boolValue($core.bool v) { + $_setBool(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasBoolValue() => $_has(2); + @$pb.TagNumber(3) + void clearBoolValue() => clearField(3); + + @$pb.TagNumber(4) + $core.String get stringValue => $_getSZ(3); + @$pb.TagNumber(4) + set stringValue($core.String v) { + $_setString(3, v); + } + + @$pb.TagNumber(4) + $core.bool hasStringValue() => $_has(3); + @$pb.TagNumber(4) + void clearStringValue() => clearField(4); +} + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/pkgs/record_use/lib/src/proto/usages_shared.pbenum.dart b/pkgs/record_use/lib/src/proto/usages_shared.pbenum.dart new file mode 100644 index 00000000..5b22f28b --- /dev/null +++ b/pkgs/record_use/lib/src/proto/usages_shared.pbenum.dart @@ -0,0 +1,10 @@ +// +// Generated code. Do not modify. +// source: usages_shared.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import diff --git a/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart b/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart new file mode 100644 index 00000000..46bd26e8 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart @@ -0,0 +1,271 @@ +// +// Generated code. Do not modify. +// source: usages_shared.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use metadataDescriptor instead') +const Metadata$json = { + '1': 'Metadata', + '2': [ + { + '1': 'comment', + '3': 1, + '4': 1, + '5': 9, + '9': 0, + '10': 'comment', + '17': true + }, + {'1': 'version', '3': 2, '4': 1, '5': 9, '10': 'version'}, + ], + '8': [ + {'1': '_comment'}, + ], +}; + +/// Descriptor for `Metadata`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List metadataDescriptor = $convert.base64Decode( + 'CghNZXRhZGF0YRIdCgdjb21tZW50GAEgASgJSABSB2NvbW1lbnSIAQESGAoHdmVyc2lvbhgCIA' + 'EoCVIHdmVyc2lvbkIKCghfY29tbWVudA=='); + +@$core.Deprecated('Use definitionDescriptor instead') +const Definition$json = { + '1': 'Definition', + '2': [ + { + '1': 'identifier', + '3': 1, + '4': 1, + '5': 11, + '6': '.usages_shared.Identifier', + '10': 'identifier' + }, + {'1': 'line', '3': 2, '4': 1, '5': 13, '10': 'line'}, + {'1': 'column', '3': 3, '4': 1, '5': 13, '10': 'column'}, + { + '1': 'loading_unit', + '3': 4, + '4': 1, + '5': 9, + '9': 0, + '10': 'loadingUnit', + '17': true + }, + ], + '8': [ + {'1': '_loading_unit'}, + ], +}; + +/// Descriptor for `Definition`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List definitionDescriptor = $convert.base64Decode( + 'CgpEZWZpbml0aW9uEjkKCmlkZW50aWZpZXIYASABKAsyGS51c2FnZXNfc2hhcmVkLklkZW50aW' + 'ZpZXJSCmlkZW50aWZpZXISEgoEbGluZRgCIAEoDVIEbGluZRIWCgZjb2x1bW4YAyABKA1SBmNv' + 'bHVtbhImCgxsb2FkaW5nX3VuaXQYBCABKAlIAFILbG9hZGluZ1VuaXSIAQFCDwoNX2xvYWRpbm' + 'dfdW5pdA=='); + +@$core.Deprecated('Use identifierDescriptor instead') +const Identifier$json = { + '1': 'Identifier', + '2': [ + {'1': 'uri', '3': 1, '4': 1, '5': 9, '10': 'uri'}, + {'1': 'parent', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'parent', '17': true}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + ], + '8': [ + {'1': '_parent'}, + ], +}; + +/// Descriptor for `Identifier`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List identifierDescriptor = $convert.base64Decode( + 'CgpJZGVudGlmaWVyEhAKA3VyaRgBIAEoCVIDdXJpEhsKBnBhcmVudBgCIAEoCUgAUgZwYXJlbn' + 'SIAQESEgoEbmFtZRgDIAEoCVIEbmFtZUIJCgdfcGFyZW50'); + +@$core.Deprecated('Use fieldsDescriptor instead') +const Fields$json = { + '1': 'Fields', + '2': [ + { + '1': 'fields', + '3': 1, + '4': 3, + '5': 11, + '6': '.usages_shared.Field', + '10': 'fields' + }, + ], +}; + +/// Descriptor for `Fields`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldsDescriptor = $convert.base64Decode( + 'CgZGaWVsZHMSLAoGZmllbGRzGAEgAygLMhQudXNhZ2VzX3NoYXJlZC5GaWVsZFIGZmllbGRz'); + +@$core.Deprecated('Use argumentsDescriptor instead') +const Arguments$json = { + '1': 'Arguments', + '2': [ + { + '1': 'const_arguments', + '3': 1, + '4': 1, + '5': 11, + '6': '.usages_shared.ConstArguments', + '9': 0, + '10': 'constArguments' + }, + { + '1': 'non_const_arguments', + '3': 2, + '4': 1, + '5': 11, + '6': '.usages_shared.NonConstArguments', + '9': 0, + '10': 'nonConstArguments' + }, + ], + '8': [ + {'1': 'kind'}, + ], +}; + +/// Descriptor for `Arguments`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List argumentsDescriptor = $convert.base64Decode( + 'CglBcmd1bWVudHMSSAoPY29uc3RfYXJndW1lbnRzGAEgASgLMh0udXNhZ2VzX3NoYXJlZC5Db2' + '5zdEFyZ3VtZW50c0gAUg5jb25zdEFyZ3VtZW50cxJSChNub25fY29uc3RfYXJndW1lbnRzGAIg' + 'ASgLMiAudXNhZ2VzX3NoYXJlZC5Ob25Db25zdEFyZ3VtZW50c0gAUhFub25Db25zdEFyZ3VtZW' + '50c0IGCgRraW5k'); + +@$core.Deprecated('Use constArgumentsDescriptor instead') +const ConstArguments$json = { + '1': 'ConstArguments', + '2': [ + { + '1': 'positional', + '3': 1, + '4': 3, + '5': 11, + '6': '.usages_shared.ConstArguments.PositionalEntry', + '10': 'positional' + }, + { + '1': 'named', + '3': 2, + '4': 3, + '5': 11, + '6': '.usages_shared.ConstArguments.NamedEntry', + '10': 'named' + }, + ], + '3': [ConstArguments_PositionalEntry$json, ConstArguments_NamedEntry$json], +}; + +@$core.Deprecated('Use constArgumentsDescriptor instead') +const ConstArguments_PositionalEntry$json = { + '1': 'PositionalEntry', + '2': [ + {'1': 'key', '3': 1, '4': 1, '5': 13, '10': 'key'}, + { + '1': 'value', + '3': 2, + '4': 1, + '5': 11, + '6': '.usages_shared.FieldValue', + '10': 'value' + }, + ], + '7': {'7': true}, +}; + +@$core.Deprecated('Use constArgumentsDescriptor instead') +const ConstArguments_NamedEntry$json = { + '1': 'NamedEntry', + '2': [ + {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, + { + '1': 'value', + '3': 2, + '4': 1, + '5': 11, + '6': '.usages_shared.FieldValue', + '10': 'value' + }, + ], + '7': {'7': true}, +}; + +/// Descriptor for `ConstArguments`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List constArgumentsDescriptor = $convert.base64Decode( + 'Cg5Db25zdEFyZ3VtZW50cxJNCgpwb3NpdGlvbmFsGAEgAygLMi0udXNhZ2VzX3NoYXJlZC5Db2' + '5zdEFyZ3VtZW50cy5Qb3NpdGlvbmFsRW50cnlSCnBvc2l0aW9uYWwSPgoFbmFtZWQYAiADKAsy' + 'KC51c2FnZXNfc2hhcmVkLkNvbnN0QXJndW1lbnRzLk5hbWVkRW50cnlSBW5hbWVkGlgKD1Bvc2' + 'l0aW9uYWxFbnRyeRIQCgNrZXkYASABKA1SA2tleRIvCgV2YWx1ZRgCIAEoCzIZLnVzYWdlc19z' + 'aGFyZWQuRmllbGRWYWx1ZVIFdmFsdWU6AjgBGlMKCk5hbWVkRW50cnkSEAoDa2V5GAEgASgJUg' + 'NrZXkSLwoFdmFsdWUYAiABKAsyGS51c2FnZXNfc2hhcmVkLkZpZWxkVmFsdWVSBXZhbHVlOgI4' + 'AQ=='); + +@$core.Deprecated('Use nonConstArgumentsDescriptor instead') +const NonConstArguments$json = { + '1': 'NonConstArguments', + '2': [ + {'1': 'positional', '3': 1, '4': 3, '5': 13, '10': 'positional'}, + {'1': 'named', '3': 2, '4': 3, '5': 9, '10': 'named'}, + ], +}; + +/// Descriptor for `NonConstArguments`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List nonConstArgumentsDescriptor = $convert.base64Decode( + 'ChFOb25Db25zdEFyZ3VtZW50cxIeCgpwb3NpdGlvbmFsGAEgAygNUgpwb3NpdGlvbmFsEhQKBW' + '5hbWVkGAIgAygJUgVuYW1lZA=='); + +@$core.Deprecated('Use fieldDescriptor instead') +const Field$json = { + '1': 'Field', + '2': [ + {'1': 'class_name', '3': 1, '4': 1, '5': 9, '10': 'className'}, + {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, + { + '1': 'value', + '3': 3, + '4': 1, + '5': 11, + '6': '.usages_shared.FieldValue', + '10': 'value' + }, + ], +}; + +/// Descriptor for `Field`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldDescriptor = $convert.base64Decode( + 'CgVGaWVsZBIdCgpjbGFzc19uYW1lGAEgASgJUgljbGFzc05hbWUSEgoEbmFtZRgCIAEoCVIEbm' + 'FtZRIvCgV2YWx1ZRgDIAEoCzIZLnVzYWdlc19zaGFyZWQuRmllbGRWYWx1ZVIFdmFsdWU='); + +@$core.Deprecated('Use fieldValueDescriptor instead') +const FieldValue$json = { + '1': 'FieldValue', + '2': [ + {'1': 'int_value', '3': 1, '4': 1, '5': 5, '9': 0, '10': 'intValue'}, + {'1': 'double_value', '3': 2, '4': 1, '5': 1, '9': 0, '10': 'doubleValue'}, + {'1': 'bool_value', '3': 3, '4': 1, '5': 8, '9': 0, '10': 'boolValue'}, + {'1': 'string_value', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'stringValue'}, + ], + '8': [ + {'1': 'value'}, + ], +}; + +/// Descriptor for `FieldValue`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldValueDescriptor = $convert.base64Decode( + 'CgpGaWVsZFZhbHVlEh0KCWludF92YWx1ZRgBIAEoBUgAUghpbnRWYWx1ZRIjCgxkb3VibGVfdm' + 'FsdWUYAiABKAFIAFILZG91YmxlVmFsdWUSHwoKYm9vbF92YWx1ZRgDIAEoCEgAUglib29sVmFs' + 'dWUSIwoMc3RyaW5nX3ZhbHVlGAQgASgJSABSC3N0cmluZ1ZhbHVlQgcKBXZhbHVl'); diff --git a/pkgs/record_use/lib/src/proto/usages_shared.pbserver.dart b/pkgs/record_use/lib/src/proto/usages_shared.pbserver.dart new file mode 100644 index 00000000..567d265c --- /dev/null +++ b/pkgs/record_use/lib/src/proto/usages_shared.pbserver.dart @@ -0,0 +1,13 @@ +// +// Generated code. Do not modify. +// source: usages_shared.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +export 'usages_shared.pb.dart'; diff --git a/pkgs/record_use/usages.proto b/pkgs/record_use/lib/src/proto/usages_shared.proto similarity index 51% rename from pkgs/record_use/usages.proto rename to pkgs/record_use/lib/src/proto/usages_shared.proto index 592334dc..fea9ef20 100644 --- a/pkgs/record_use/usages.proto +++ b/pkgs/record_use/lib/src/proto/usages_shared.proto @@ -1,51 +1,22 @@ syntax = "proto3"; -package usages; +package usages_shared; -message Usages { - Metadata metadata = 1; - repeated Usage calls = 4; - repeated Usage instances = 5; -} - message Metadata { optional string comment = 1; string version = 2; } -message Uri { - string value = 1; -} - -message Identifier { - Uri uri = 1; - optional string parent = 2; - string name = 3; -} - -message Usage { - Definition definition = 1; - repeated Reference references = 2; -} - message Definition { Identifier identifier = 1; - Location location = 2; - optional string loading_unit = 3; // Optional, as some loading units are null -} - -message Location { - Uri uri = 1; uint32 line = 2; uint32 column = 3; + optional string loading_unit = 4; // Optional, as some loading units are null } -message Reference { - Location location = 1; - string loading_unit = 2; - oneof reference { - Arguments arguments = 3; - Fields fields = 4; - } +message Identifier { + string uri = 1; + optional string parent = 2; + string name = 3; } message Fields { @@ -54,14 +25,14 @@ message Fields { message Arguments { oneof kind { - ConstArguments const = 1; - NonConstArguments non_const = 2; + ConstArguments const_arguments = 1; + NonConstArguments non_const_arguments = 2; } } message ConstArguments { - map positional = 1; - map named = 2; + map positional = 1; + map named = 2; } message NonConstArguments { @@ -83,4 +54,3 @@ message FieldValue { string string_value = 4; } } - diff --git a/pkgs/record_use/lib/src/proto/usages_storage.pb.dart b/pkgs/record_use/lib/src/proto/usages_storage.pb.dart new file mode 100644 index 00000000..55a43ea8 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/usages_storage.pb.dart @@ -0,0 +1,411 @@ +// +// Generated code. Do not modify. +// source: usages_storage.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import 'usages_shared.pb.dart' as $0; + +class Usages extends $pb.GeneratedMessage { + factory Usages({ + $0.Metadata? metadata, + $core.Iterable<$core.String>? uris, + $core.Iterable<$0.Definition>? definitions, + $core.Iterable? calls, + $core.Iterable? instances, + }) { + final $result = create(); + if (metadata != null) { + $result.metadata = metadata; + } + if (uris != null) { + $result.uris.addAll(uris); + } + if (definitions != null) { + $result.definitions.addAll(definitions); + } + if (calls != null) { + $result.calls.addAll(calls); + } + if (instances != null) { + $result.instances.addAll(instances); + } + return $result; + } + Usages._() : super(); + factory Usages.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Usages.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Usages', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..aOM<$0.Metadata>(1, _omitFieldNames ? '' : 'metadata', + subBuilder: $0.Metadata.create) + ..pPS(2, _omitFieldNames ? '' : 'uris') + ..pc<$0.Definition>( + 3, _omitFieldNames ? '' : 'definitions', $pb.PbFieldType.PM, + subBuilder: $0.Definition.create) + ..pc(4, _omitFieldNames ? '' : 'calls', $pb.PbFieldType.PM, + subBuilder: Usage.create) + ..pc(5, _omitFieldNames ? '' : 'instances', $pb.PbFieldType.PM, + subBuilder: Usage.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Usages clone() => Usages()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Usages copyWith(void Function(Usages) updates) => + super.copyWith((message) => updates(message as Usages)) as Usages; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Usages create() => Usages._(); + Usages createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Usages getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Usages? _defaultInstance; + + @$pb.TagNumber(1) + $0.Metadata get metadata => $_getN(0); + @$pb.TagNumber(1) + set metadata($0.Metadata v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasMetadata() => $_has(0); + @$pb.TagNumber(1) + void clearMetadata() => clearField(1); + @$pb.TagNumber(1) + $0.Metadata ensureMetadata() => $_ensure(0); + + @$pb.TagNumber(2) + $core.List<$core.String> get uris => $_getList(1); + + @$pb.TagNumber(3) + $core.List<$0.Definition> get definitions => $_getList(2); + + @$pb.TagNumber(4) + $core.List get calls => $_getList(3); + + @$pb.TagNumber(5) + $core.List get instances => $_getList(4); +} + +class Usage extends $pb.GeneratedMessage { + factory Usage({ + $core.int? definition, + $core.Iterable? references, + }) { + final $result = create(); + if (definition != null) { + $result.definition = definition; + } + if (references != null) { + $result.references.addAll(references); + } + return $result; + } + Usage._() : super(); + factory Usage.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Usage.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Usage', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..a<$core.int>(1, _omitFieldNames ? '' : 'definition', $pb.PbFieldType.OU3) + ..pc(2, _omitFieldNames ? '' : 'references', $pb.PbFieldType.PM, + subBuilder: Reference.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Usage clone() => Usage()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Usage copyWith(void Function(Usage) updates) => + super.copyWith((message) => updates(message as Usage)) as Usage; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Usage create() => Usage._(); + Usage createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Usage getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Usage? _defaultInstance; + + @$pb.TagNumber(1) + $core.int get definition => $_getIZ(0); + @$pb.TagNumber(1) + set definition($core.int v) { + $_setUnsignedInt32(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasDefinition() => $_has(0); + @$pb.TagNumber(1) + void clearDefinition() => clearField(1); + + @$pb.TagNumber(2) + $core.List get references => $_getList(1); +} + +class Location extends $pb.GeneratedMessage { + factory Location({ + $core.int? uri, + $core.int? line, + $core.int? column, + }) { + final $result = create(); + if (uri != null) { + $result.uri = uri; + } + if (line != null) { + $result.line = line; + } + if (column != null) { + $result.column = column; + } + return $result; + } + Location._() : super(); + factory Location.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Location.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Location', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..a<$core.int>(1, _omitFieldNames ? '' : 'uri', $pb.PbFieldType.OU3) + ..a<$core.int>(2, _omitFieldNames ? '' : 'line', $pb.PbFieldType.OU3) + ..a<$core.int>(3, _omitFieldNames ? '' : 'column', $pb.PbFieldType.OU3) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Location clone() => Location()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Location copyWith(void Function(Location) updates) => + super.copyWith((message) => updates(message as Location)) as Location; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Location create() => Location._(); + Location createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Location getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Location? _defaultInstance; + + @$pb.TagNumber(1) + $core.int get uri => $_getIZ(0); + @$pb.TagNumber(1) + set uri($core.int v) { + $_setUnsignedInt32(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasUri() => $_has(0); + @$pb.TagNumber(1) + void clearUri() => clearField(1); + + @$pb.TagNumber(2) + $core.int get line => $_getIZ(1); + @$pb.TagNumber(2) + set line($core.int v) { + $_setUnsignedInt32(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasLine() => $_has(1); + @$pb.TagNumber(2) + void clearLine() => clearField(2); + + @$pb.TagNumber(3) + $core.int get column => $_getIZ(2); + @$pb.TagNumber(3) + set column($core.int v) { + $_setUnsignedInt32(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasColumn() => $_has(2); + @$pb.TagNumber(3) + void clearColumn() => clearField(3); +} + +enum Reference_Reference { arguments, fields, notSet } + +class Reference extends $pb.GeneratedMessage { + factory Reference({ + Location? location, + $core.String? loadingUnit, + $0.Arguments? arguments, + $0.Fields? fields, + }) { + final $result = create(); + if (location != null) { + $result.location = location; + } + if (loadingUnit != null) { + $result.loadingUnit = loadingUnit; + } + if (arguments != null) { + $result.arguments = arguments; + } + if (fields != null) { + $result.fields = fields; + } + return $result; + } + Reference._() : super(); + factory Reference.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Reference.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static const $core.Map<$core.int, Reference_Reference> + _Reference_ReferenceByTag = { + 3: Reference_Reference.arguments, + 4: Reference_Reference.fields, + 0: Reference_Reference.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Reference', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..oo(0, [3, 4]) + ..aOM(1, _omitFieldNames ? '' : 'location', + subBuilder: Location.create) + ..aOS(2, _omitFieldNames ? '' : 'loadingUnit') + ..aOM<$0.Arguments>(3, _omitFieldNames ? '' : 'arguments', + subBuilder: $0.Arguments.create) + ..aOM<$0.Fields>(4, _omitFieldNames ? '' : 'fields', + subBuilder: $0.Fields.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Reference clone() => Reference()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Reference copyWith(void Function(Reference) updates) => + super.copyWith((message) => updates(message as Reference)) as Reference; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Reference create() => Reference._(); + Reference createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Reference getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Reference? _defaultInstance; + + Reference_Reference whichReference() => + _Reference_ReferenceByTag[$_whichOneof(0)]!; + void clearReference() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + Location get location => $_getN(0); + @$pb.TagNumber(1) + set location(Location v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasLocation() => $_has(0); + @$pb.TagNumber(1) + void clearLocation() => clearField(1); + @$pb.TagNumber(1) + Location ensureLocation() => $_ensure(0); + + @$pb.TagNumber(2) + $core.String get loadingUnit => $_getSZ(1); + @$pb.TagNumber(2) + set loadingUnit($core.String v) { + $_setString(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasLoadingUnit() => $_has(1); + @$pb.TagNumber(2) + void clearLoadingUnit() => clearField(2); + + @$pb.TagNumber(3) + $0.Arguments get arguments => $_getN(2); + @$pb.TagNumber(3) + set arguments($0.Arguments v) { + setField(3, v); + } + + @$pb.TagNumber(3) + $core.bool hasArguments() => $_has(2); + @$pb.TagNumber(3) + void clearArguments() => clearField(3); + @$pb.TagNumber(3) + $0.Arguments ensureArguments() => $_ensure(2); + + @$pb.TagNumber(4) + $0.Fields get fields => $_getN(3); + @$pb.TagNumber(4) + set fields($0.Fields v) { + setField(4, v); + } + + @$pb.TagNumber(4) + $core.bool hasFields() => $_has(3); + @$pb.TagNumber(4) + void clearFields() => clearField(4); + @$pb.TagNumber(4) + $0.Fields ensureFields() => $_ensure(3); +} + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/pkgs/record_use/lib/src/proto/storage/usages_storage.pbenum.dart b/pkgs/record_use/lib/src/proto/usages_storage.pbenum.dart similarity index 99% rename from pkgs/record_use/lib/src/proto/storage/usages_storage.pbenum.dart rename to pkgs/record_use/lib/src/proto/usages_storage.pbenum.dart index 42cb45b6..59dbb677 100644 --- a/pkgs/record_use/lib/src/proto/storage/usages_storage.pbenum.dart +++ b/pkgs/record_use/lib/src/proto/usages_storage.pbenum.dart @@ -8,4 +8,3 @@ // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import - diff --git a/pkgs/record_use/lib/src/proto/usages_storage.pbjson.dart b/pkgs/record_use/lib/src/proto/usages_storage.pbjson.dart new file mode 100644 index 00000000..450e2a32 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/usages_storage.pbjson.dart @@ -0,0 +1,142 @@ +// +// Generated code. Do not modify. +// source: usages_storage.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use usagesDescriptor instead') +const Usages$json = { + '1': 'Usages', + '2': [ + { + '1': 'metadata', + '3': 1, + '4': 1, + '5': 11, + '6': '.usages_shared.Metadata', + '10': 'metadata' + }, + {'1': 'uris', '3': 2, '4': 3, '5': 9, '10': 'uris'}, + { + '1': 'definitions', + '3': 3, + '4': 3, + '5': 11, + '6': '.usages_shared.Definition', + '10': 'definitions' + }, + { + '1': 'calls', + '3': 4, + '4': 3, + '5': 11, + '6': '.usages.Usage', + '10': 'calls' + }, + { + '1': 'instances', + '3': 5, + '4': 3, + '5': 11, + '6': '.usages.Usage', + '10': 'instances' + }, + ], +}; + +/// Descriptor for `Usages`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List usagesDescriptor = $convert.base64Decode( + 'CgZVc2FnZXMSMwoIbWV0YWRhdGEYASABKAsyFy51c2FnZXNfc2hhcmVkLk1ldGFkYXRhUghtZX' + 'RhZGF0YRISCgR1cmlzGAIgAygJUgR1cmlzEjsKC2RlZmluaXRpb25zGAMgAygLMhkudXNhZ2Vz' + 'X3NoYXJlZC5EZWZpbml0aW9uUgtkZWZpbml0aW9ucxIjCgVjYWxscxgEIAMoCzINLnVzYWdlcy' + '5Vc2FnZVIFY2FsbHMSKwoJaW5zdGFuY2VzGAUgAygLMg0udXNhZ2VzLlVzYWdlUglpbnN0YW5j' + 'ZXM='); + +@$core.Deprecated('Use usageDescriptor instead') +const Usage$json = { + '1': 'Usage', + '2': [ + {'1': 'definition', '3': 1, '4': 1, '5': 13, '10': 'definition'}, + { + '1': 'references', + '3': 2, + '4': 3, + '5': 11, + '6': '.usages.Reference', + '10': 'references' + }, + ], +}; + +/// Descriptor for `Usage`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List usageDescriptor = $convert.base64Decode( + 'CgVVc2FnZRIeCgpkZWZpbml0aW9uGAEgASgNUgpkZWZpbml0aW9uEjEKCnJlZmVyZW5jZXMYAi' + 'ADKAsyES51c2FnZXMuUmVmZXJlbmNlUgpyZWZlcmVuY2Vz'); + +@$core.Deprecated('Use locationDescriptor instead') +const Location$json = { + '1': 'Location', + '2': [ + {'1': 'uri', '3': 1, '4': 1, '5': 13, '10': 'uri'}, + {'1': 'line', '3': 2, '4': 1, '5': 13, '10': 'line'}, + {'1': 'column', '3': 3, '4': 1, '5': 13, '10': 'column'}, + ], +}; + +/// Descriptor for `Location`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List locationDescriptor = $convert.base64Decode( + 'CghMb2NhdGlvbhIQCgN1cmkYASABKA1SA3VyaRISCgRsaW5lGAIgASgNUgRsaW5lEhYKBmNvbH' + 'VtbhgDIAEoDVIGY29sdW1u'); + +@$core.Deprecated('Use referenceDescriptor instead') +const Reference$json = { + '1': 'Reference', + '2': [ + { + '1': 'location', + '3': 1, + '4': 1, + '5': 11, + '6': '.usages.Location', + '10': 'location' + }, + {'1': 'loading_unit', '3': 2, '4': 1, '5': 9, '10': 'loadingUnit'}, + { + '1': 'arguments', + '3': 3, + '4': 1, + '5': 11, + '6': '.usages_shared.Arguments', + '9': 0, + '10': 'arguments' + }, + { + '1': 'fields', + '3': 4, + '4': 1, + '5': 11, + '6': '.usages_shared.Fields', + '9': 0, + '10': 'fields' + }, + ], + '8': [ + {'1': 'reference'}, + ], +}; + +/// Descriptor for `Reference`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List referenceDescriptor = $convert.base64Decode( + 'CglSZWZlcmVuY2USLAoIbG9jYXRpb24YASABKAsyEC51c2FnZXMuTG9jYXRpb25SCGxvY2F0aW' + '9uEiEKDGxvYWRpbmdfdW5pdBgCIAEoCVILbG9hZGluZ1VuaXQSOAoJYXJndW1lbnRzGAMgASgL' + 'MhgudXNhZ2VzX3NoYXJlZC5Bcmd1bWVudHNIAFIJYXJndW1lbnRzEi8KBmZpZWxkcxgEIAEoCz' + 'IVLnVzYWdlc19zaGFyZWQuRmllbGRzSABSBmZpZWxkc0ILCglyZWZlcmVuY2U='); diff --git a/pkgs/record_use/lib/src/proto/storage/usages_storage.pbserver.dart b/pkgs/record_use/lib/src/proto/usages_storage.pbserver.dart similarity index 99% rename from pkgs/record_use/lib/src/proto/storage/usages_storage.pbserver.dart rename to pkgs/record_use/lib/src/proto/usages_storage.pbserver.dart index 1b452d1f..8b31b651 100644 --- a/pkgs/record_use/lib/src/proto/storage/usages_storage.pbserver.dart +++ b/pkgs/record_use/lib/src/proto/usages_storage.pbserver.dart @@ -11,4 +11,3 @@ // ignore_for_file: unnecessary_import, unnecessary_this, unused_import export 'usages_storage.pb.dart'; - diff --git a/pkgs/record_use/lib/src/proto/usages_storage.proto b/pkgs/record_use/lib/src/proto/usages_storage.proto new file mode 100644 index 00000000..45486311 --- /dev/null +++ b/pkgs/record_use/lib/src/proto/usages_storage.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package usages; + +import "usages_shared.proto"; + +message Usages { + usages_shared.Metadata metadata = 1; + repeated string uris = 2; + repeated usages_shared.Definition definitions = 3; + repeated Usage calls = 4; + repeated Usage instances = 5; +} + +message Usage { + uint32 definition = 1; + repeated Reference references = 2; +} + +message Location { + uint32 uri = 1; + uint32 line = 2; + uint32 column = 3; +} + +message Reference { + Location location = 1; + string loading_unit = 2; + oneof reference { + usages_shared.Arguments arguments = 3; + usages_shared.Fields fields = 4; + } +} diff --git a/pkgs/record_use/lib/src/record_use.dart b/pkgs/record_use/lib/src/record_use.dart index 6fa4e385..c2f09c65 100644 --- a/pkgs/record_use/lib/src/record_use.dart +++ b/pkgs/record_use/lib/src/record_use.dart @@ -5,23 +5,29 @@ import 'dart:typed_data'; import 'package:collection/collection.dart'; +import 'package:pub_semver/pub_semver.dart'; -import 'data_classes/arguments.dart'; -import 'data_classes/field.dart'; -import 'data_classes/identifier.dart'; -import 'data_classes/metadata.dart'; -import 'data_classes/reference.dart'; -import 'data_classes/usage.dart'; -import 'data_classes/usage_record.dart'; +import 'data_classes/extensions.dart'; +import 'proto/usages_read.pb.dart' as pb; +import 'proto/usages_shared.pb.dart' as pb_shared; +import 'proto/usages_storage.pb.dart' as pb_storage; -extension type RecordUse._(UsageRecord _recordUses) { +class Identifier { + final String uri; + final String? parent; + final String name; + + Identifier({required this.uri, this.parent, required this.name}); +} + +extension type RecordUse._(pb.Usages _recordUses) { RecordUse.fromFile(Uint8List contents) - : this._(UsageRecord.fromFile(contents)); + : this._(pb_storage.Usages.fromBuffer(contents).toApi()); /// Show the metadata for this recording of usages. - Metadata get metadata => _recordUses.metadata; + Version get version => Version.parse(_recordUses.metadata.version); - /// Finds all arguments for calls to the [definition]. + /// Finds all arguments for calls to the [method]. /// /// The definition must be annotated with `@RecordUse()`. If there are no /// calls to the definition, either because it was treeshaken, because it was @@ -55,13 +61,18 @@ extension type RecordUse._(UsageRecord _recordUses) { /// constArguments: ConstArguments(positional: {1: 42}), /// ); /// ``` - Iterable? callReferencesTo(Identifier definition) => - _callTo(definition) - ?.references - .map((reference) => reference.arguments) - .whereType(); + Iterable<({Map named, Map positional})>? + constArgumentsTo(Identifier method) => + _callTo(method)?.references.map((reference) => ( + named: reference.arguments.constArguments.named.map( + (key, value) => MapEntry(key, value.toObject()), + ), + positional: reference.arguments.constArguments.positional.map( + (key, value) => MapEntry(key, value.toObject()), + ), + )); - /// Finds all fields of a const instance of the class at [definition]. + /// Finds all fields of a const instance of the class at [classIdentifier]. /// /// The definition must be annotated with `@RecordUse()`. If there are /// no instances of the definition, either because it was treeshaken, because @@ -103,30 +114,36 @@ extension type RecordUse._(UsageRecord _recordUses) { /// /// What kinds of fields can be recorded depends on the implementation of /// https://dart-review.googlesource.com/c/sdk/+/369620/13/pkg/vm/lib/transformations/record_use/record_instance.dart - Iterable>? instanceReferencesTo(Identifier definition) => - _recordUses.instances - .firstWhereOrNull( - (instance) => instance.definition.identifier == definition) - ?.references - .map((reference) => reference.fields); + Iterable>? instanceReferencesTo(Identifier classIdentifier) { + final instances = _recordUses.instances; + final firstWhereOrNull = instances.firstWhereOrNull((instance) => + _compareIdentifiers(instance.definition.identifier, classIdentifier)); + return firstWhereOrNull?.references.map((reference) => + reference.fields.fields.map((field) => field.value.toObject())); + } - /// Checks if any call to [definition] has non-const arguments. + /// Checks if any call to [method] has non-const arguments. /// /// The definition must be annotated with `@RecordUse()`. If there are no /// calls to the definition, either because it was treeshaken, because it was /// not annotated, or because it does not exist, returns `false`. - bool hasNonConstArguments(Identifier definition) => - _callTo(definition)?.references.any( + bool hasNonConstArguments(Identifier method) => + _callTo(method)?.references.any( (reference) { - final nonConstArguments = reference.arguments?.nonConstArguments; - final hasNamed = nonConstArguments?.named.isNotEmpty ?? false; - final hasPositional = - nonConstArguments?.positional.isNotEmpty ?? false; + final nonConstArguments = reference.arguments.nonConstArguments; + final hasNamed = nonConstArguments.named.isNotEmpty; + final hasPositional = nonConstArguments.positional.isNotEmpty; return hasNamed || hasPositional; }, ) ?? false; - Usage? _callTo(Identifier definition) => _recordUses.calls - .firstWhereOrNull((call) => call.definition.identifier == definition); + pb.Usage? _callTo(Identifier identifier) => + _recordUses.calls.firstWhereOrNull((call) => + _compareIdentifiers(call.definition.identifier, identifier)); + + bool _compareIdentifiers(pb_shared.Identifier id1, Identifier id2) => + id1.uri == id2.uri && + (id1.hasParent() ? id1.parent : null) == id2.parent && + id1.name == id2.name; } diff --git a/pkgs/record_use/test/record_use_test.dart b/pkgs/record_use/test/record_use_test.dart deleted file mode 100644 index 8fd4a52f..00000000 --- a/pkgs/record_use/test/record_use_test.dart +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:pub_semver/pub_semver.dart'; -import 'package:record_use/record_use_internal.dart'; -import 'package:test/test.dart'; - -void main() { - // test('Json->Object->Json', () { - // expect( - // UsageRecord.fromFile(recordedUsesJson).serialize(), recordedUsesJson); - // }); - test('Object->Json->Object', () { - expect(UsageRecord.fromFile(recordedUses.serialize()), recordedUses); - }); - - // test('API calls', () { - // expect( - // RecordUse.fromFile(recordedUsesJson).callReferencesTo(callId), - // recordedUses.calls.expand((e) => e.references).map((e) => e.arguments), - // ); - // }); - // test('API instances', () { - // expect( - // RecordUse.fromFile(recordedUsesJson).instanceReferencesTo(instanceId), - // recordedUses.instances.expand((e) => e.references).map((e) => e.fields), - // ); - // }); -} - -final callId = Identifier( - uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') - .toString(), - parent: 'MyClass', - name: 'get:loadDeferredLibrary', -); -final instanceId = Identifier( - uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') - .toString(), - name: 'MyAnnotation', -); - -final recordedUses = UsageRecord( - metadata: Metadata( - version: Version(1, 6, 2, pre: 'wip', build: '5.-.2.z'), - comment: - 'Recorded references at compile time and their argument values, as far' - ' as known, to definitions annotated with @RecordReference', - ), - instances: [ - Usage( - definition: Definition( - identifier: instanceId, - location: Location( - uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') - .toString(), - line: 15, - column: 30, - ), - ), - references: [ - InstanceReference( - location: Location( - uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') - .toString(), - line: 40, - column: 30, - ), - fields: [ - Field( - className: 'className', - name: 'a', - value: 42, - ), - ], - loadingUnit: '3', - ), - ], - ), - ], - calls: [ - Usage( - definition: Definition( - identifier: callId, - location: Location( - uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') - .toString(), - line: 12, - column: 67, - ), - loadingUnit: 'part_15.js', - ), - references: [ - CallReference( - arguments: Arguments( - constArguments: ConstArguments( - positional: {0: 'lib_SHA1', 1: false, 2: 1}, - named: {'leroy': 'jenkins', 'freddy': 'mercury'}, - ), - ), - location: Location( - uri: Uri.parse( - 'file://benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart') - .toString(), - line: 14, - column: 49, - ), - loadingUnit: 'o.js', - ), - CallReference( - arguments: Arguments( - constArguments: ConstArguments( - positional: {0: 'lib_SHA1', 2: 0}, - named: {'leroy': 'jenkins'}, - ), - nonConstArguments: NonConstArguments( - positional: [1], - named: ['freddy'], - ), - ), - location: Location( - uri: Uri.parse( - 'file://benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart') - .toString(), - line: 14, - column: 48, - ), - loadingUnit: 'o.js', - ), - ], - ), - ], -); - -final recordedUsesJson = { - 'metadata': { - 'comment': - 'Recorded references at compile time and their argument values, as far' - ' as known, to definitions annotated with @RecordReference', - 'version': '1.6.2-wip+5.-.2.z' - }, - 'uris': [ - 'file://lib/_internal/js_runtime/lib/js_helper.dart', - 'file://benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart' - ], - 'ids': [ - {'uri': 0, 'parent': 'MyClass', 'name': 'get:loadDeferredLibrary'}, - {'uri': 0, 'name': 'MyAnnotation'} - ], - 'calls': [ - { - 'definition': { - 'id': 0, - '@': {'line': 12, 'column': 67}, - 'loadingUnit': 'part_15.js' - }, - 'references': [ - { - 'arguments': { - 'const': { - 'positional': {'0': 'lib_SHA1', '1': false, '2': 1}, - 'named': {'leroy': 'jenkins', 'freddy': 'mercury'} - } - }, - 'loadingUnit': 'o.js', - '@': {'uri': 1, 'line': 14, 'column': 49} - }, - { - 'arguments': { - 'const': { - 'positional': {'0': 'lib_SHA1', '2': 0}, - 'named': {'leroy': 'jenkins'} - }, - 'nonConst': { - 'positional': [1], - 'named': ['freddy'] - } - }, - 'loadingUnit': 'o.js', - '@': {'uri': 1, 'line': 14, 'column': 48} - } - ] - } - ], - 'instances': [ - { - 'definition': { - 'id': 1, - '@': {'line': 15, 'column': 30}, - 'loadingUnit': null - }, - 'references': [ - { - 'fields': [ - { - 'className': 'className', - 'name': 'a', - 'value': 42, - } - ], - 'loadingUnit': '3', - '@': {'uri': 0, 'line': 40, 'column': 30} - } - ] - } - ] -}; diff --git a/pkgs/record_use/test/storage_test.dart b/pkgs/record_use/test/storage_test.dart new file mode 100644 index 00000000..10a57d51 --- /dev/null +++ b/pkgs/record_use/test/storage_test.dart @@ -0,0 +1,26 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:record_use/record_use_internal.dart'; +import 'package:record_use/src/data_classes/extensions.dart'; +import 'package:record_use/src/record_use.dart'; +import 'package:test/test.dart'; + +import 'testdata/data.dart'; + +void main() { + test('Buffer->Object->Buffer', () { + final recordedUsesPb = File('test/testdata/data.binpb').readAsBytesSync(); + expect((RecordUse.fromFile(recordedUsesPb) as Usages).toBuffer(), + recordedUsesPb); + }); + test('Object->Buffer->Object', () { + expect( + RecordUse.fromFile(recordedUses.toBuffer()), + recordedUses, + ); + }); +} diff --git a/pkgs/record_use/test/testdata/data.binpb b/pkgs/record_use/test/testdata/data.binpb new file mode 100644 index 0000000000000000000000000000000000000000..dc12f9fa010ffff771c6fccc826d1dc0fd1c09a6 GIT binary patch literal 775 zcmb_ZIZwkd7;P$!Vy^OmL=*{RA|WA;gciX73)cYRl0af%sNCcWahuqc?NEh*Kfxcy zfwC}GOtzojVSkT&I^^RKBdKDHslo&miU>7jhDI_U@C>QpIZ`HKYEtBiGWA;IC=7jL zS%G?&GEEa^aZUR|4#h4tlE#>D!3~$fS_vTyGuD5|O-fIH;vRpqV5t=x1?{~dAM6|k zdqF#RhjwCvkHawI-LS)jK_yrg_H;)TqI%Bvg*~R24NwI!QwB~(ny&ponlshc;X^KX zx6qeWl)^Zycz?lv5RdcPF*IIEp2-+Gn7%77GN!e+`ikZ_lPvz7$Sv{'leroy': 'jenkins', 'freddy': 'mercury'}, + ); + expect( + arguments[0].positional, + {0: 'lib_SHA1', 1: false, 2: 1}, + ); + expect(arguments[1].named, isEmpty); + expect(arguments[1].positional, isEmpty); + }); + test('API instances', () { + final recordedUsesPb = File('test/testdata/data.binpb').readAsBytesSync(); + final instanceId = Identifier( + uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') + .toString(), + name: 'MyAnnotation', + ); + expect( + RecordUse.fromFile(recordedUsesPb).instanceReferencesTo(instanceId), + [ + [42] + ], + ); + }); +} diff --git a/pkgs/record_use/usages_storage.proto b/pkgs/record_use/usages_storage.proto deleted file mode 100644 index 509a3fcf..00000000 --- a/pkgs/record_use/usages_storage.proto +++ /dev/null @@ -1,88 +0,0 @@ -syntax = "proto3"; -package usages; - -message Usages { - Metadata metadata = 1; - repeated Uri uris = 2; - repeated Identifier ids = 3; - repeated Usage calls = 4; - repeated Usage instances = 5; -} - -message Metadata { - optional string comment = 1; - string version = 2; -} - -message Uri { - string value = 1; -} - -message Identifier { - uint32 uri = 1; - optional string parent = 2; - string name = 3; -} - -message Usage { - Definition definition = 1; - repeated Reference references = 2; -} - -message Definition { - uint32 identifier = 1; - Location location = 2; - optional string loading_unit = 3; // Optional, as some loading units are null -} - -message Location { - uint32 uri = 1; - uint32 line = 2; - uint32 column = 3; -} - -message Reference { - Location location = 1; - string loading_unit = 2; - oneof reference { - Arguments arguments = 3; - Fields fields = 4; - } -} - -message Fields { - repeated Field fields = 1; -} - -message Arguments { - oneof kind { - ConstArguments const = 1; - NonConstArguments non_const = 2; - } -} - -message ConstArguments { - map positional = 1; - map named = 2; -} - -message NonConstArguments { - repeated uint32 positional = 1; - repeated string named = 2; -} - -message Field { - string class_name = 1; - string name = 2; - FieldValue value = 3; -} - -message FieldValue { - oneof value { - int32 int_value = 1; - double double_value = 2; - bool bool_value = 3; - string string_value = 4; - } -} - From b15892f989967ce5b1fd8f31536520ec84f624fe Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 19 Jun 2024 09:07:20 +0200 Subject: [PATCH 08/23] Fix example --- pkgs/record_use/example/record_use_example.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/record_use/example/record_use_example.dart b/pkgs/record_use/example/record_use_example.dart index 5a0c3e71..0dcb0c2d 100644 --- a/pkgs/record_use/example/record_use_example.dart +++ b/pkgs/record_use/example/record_use_example.dart @@ -5,8 +5,8 @@ import 'package:record_use/record_use.dart'; void doStuff(RecordUse usage, Identifier callId, Identifier referenceId) { - print(usage.metadata); - print(usage.callReferencesTo(callId)); + print(usage.version); + print(usage.constArgumentsTo(callId)); print(usage.instanceReferencesTo(referenceId)); print(usage.hasNonConstArguments(callId)); } From 241ece2df30bef89cb39f3e313106c37cf56057a Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 19 Jun 2024 09:10:08 +0200 Subject: [PATCH 09/23] Rename --- pkgs/record_use/example/record_use_example.dart | 2 +- pkgs/record_use/lib/record_use.dart | 2 +- pkgs/record_use/lib/src/record_use.dart | 13 ++++++------- pkgs/record_use/test/storage_test.dart | 4 ++-- pkgs/record_use/test/usage_test.dart | 4 ++-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/pkgs/record_use/example/record_use_example.dart b/pkgs/record_use/example/record_use_example.dart index 0dcb0c2d..c5fb7c26 100644 --- a/pkgs/record_use/example/record_use_example.dart +++ b/pkgs/record_use/example/record_use_example.dart @@ -4,7 +4,7 @@ import 'package:record_use/record_use.dart'; -void doStuff(RecordUse usage, Identifier callId, Identifier referenceId) { +void doStuff(RecordedUsages usage, Identifier callId, Identifier referenceId) { print(usage.version); print(usage.constArgumentsTo(callId)); print(usage.instanceReferencesTo(referenceId)); diff --git a/pkgs/record_use/lib/record_use.dart b/pkgs/record_use/lib/record_use.dart index 07d851c5..7b40776a 100644 --- a/pkgs/record_use/lib/record_use.dart +++ b/pkgs/record_use/lib/record_use.dart @@ -2,4 +2,4 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -export 'src/record_use.dart' show Identifier, RecordUse; +export 'src/record_use.dart' show Identifier, RecordedUsages; diff --git a/pkgs/record_use/lib/src/record_use.dart b/pkgs/record_use/lib/src/record_use.dart index c2f09c65..7b631a25 100644 --- a/pkgs/record_use/lib/src/record_use.dart +++ b/pkgs/record_use/lib/src/record_use.dart @@ -20,12 +20,12 @@ class Identifier { Identifier({required this.uri, this.parent, required this.name}); } -extension type RecordUse._(pb.Usages _recordUses) { - RecordUse.fromFile(Uint8List contents) +extension type RecordedUsages._(pb.Usages _usages) { + RecordedUsages.fromFile(Uint8List contents) : this._(pb_storage.Usages.fromBuffer(contents).toApi()); /// Show the metadata for this recording of usages. - Version get version => Version.parse(_recordUses.metadata.version); + Version get version => Version.parse(_usages.metadata.version); /// Finds all arguments for calls to the [method]. /// @@ -115,7 +115,7 @@ extension type RecordUse._(pb.Usages _recordUses) { /// What kinds of fields can be recorded depends on the implementation of /// https://dart-review.googlesource.com/c/sdk/+/369620/13/pkg/vm/lib/transformations/record_use/record_instance.dart Iterable>? instanceReferencesTo(Identifier classIdentifier) { - final instances = _recordUses.instances; + final instances = _usages.instances; final firstWhereOrNull = instances.firstWhereOrNull((instance) => _compareIdentifiers(instance.definition.identifier, classIdentifier)); return firstWhereOrNull?.references.map((reference) => @@ -138,9 +138,8 @@ extension type RecordUse._(pb.Usages _recordUses) { ) ?? false; - pb.Usage? _callTo(Identifier identifier) => - _recordUses.calls.firstWhereOrNull((call) => - _compareIdentifiers(call.definition.identifier, identifier)); + pb.Usage? _callTo(Identifier identifier) => _usages.calls.firstWhereOrNull( + (call) => _compareIdentifiers(call.definition.identifier, identifier)); bool _compareIdentifiers(pb_shared.Identifier id1, Identifier id2) => id1.uri == id2.uri && diff --git a/pkgs/record_use/test/storage_test.dart b/pkgs/record_use/test/storage_test.dart index 10a57d51..04fe8d4f 100644 --- a/pkgs/record_use/test/storage_test.dart +++ b/pkgs/record_use/test/storage_test.dart @@ -14,12 +14,12 @@ import 'testdata/data.dart'; void main() { test('Buffer->Object->Buffer', () { final recordedUsesPb = File('test/testdata/data.binpb').readAsBytesSync(); - expect((RecordUse.fromFile(recordedUsesPb) as Usages).toBuffer(), + expect((RecordedUsages.fromFile(recordedUsesPb) as Usages).toBuffer(), recordedUsesPb); }); test('Object->Buffer->Object', () { expect( - RecordUse.fromFile(recordedUses.toBuffer()), + RecordedUsages.fromFile(recordedUses.toBuffer()), recordedUses, ); }); diff --git a/pkgs/record_use/test/usage_test.dart b/pkgs/record_use/test/usage_test.dart index fd0734f5..bc8bad85 100644 --- a/pkgs/record_use/test/usage_test.dart +++ b/pkgs/record_use/test/usage_test.dart @@ -18,7 +18,7 @@ void main() { parent: 'MyClass', name: 'get:loadDeferredLibrary', ); - final arguments = RecordUse.fromFile(recordedUses.toBuffer()) + final arguments = RecordedUsages.fromFile(recordedUses.toBuffer()) .constArgumentsTo(callId)! .toList(); expect( @@ -40,7 +40,7 @@ void main() { name: 'MyAnnotation', ); expect( - RecordUse.fromFile(recordedUsesPb).instanceReferencesTo(instanceId), + RecordedUsages.fromFile(recordedUsesPb).instanceReferencesTo(instanceId), [ [42] ], From 67fddbb6b5ec71e11e2075bab0d82dc30aaf093e Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 19 Jun 2024 09:15:55 +0200 Subject: [PATCH 10/23] Add const constructor --- pkgs/record_use/lib/src/record_use.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/record_use/lib/src/record_use.dart b/pkgs/record_use/lib/src/record_use.dart index 7b631a25..1d36527c 100644 --- a/pkgs/record_use/lib/src/record_use.dart +++ b/pkgs/record_use/lib/src/record_use.dart @@ -17,7 +17,7 @@ class Identifier { final String? parent; final String name; - Identifier({required this.uri, this.parent, required this.name}); + const Identifier({required this.uri, this.parent, required this.name}); } extension type RecordedUsages._(pb.Usages _usages) { From 67a7f47764a6c88d5daaf670f474d14550e20afd Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 19 Jun 2024 09:45:34 +0200 Subject: [PATCH 11/23] Get right branch --- .github/workflows/health.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/health.yaml b/.github/workflows/health.yaml index 2286be59..78647dc4 100644 --- a/.github/workflows/health.yaml +++ b/.github/workflows/health.yaml @@ -12,6 +12,5 @@ jobs: with: coverage_web: false checks: "version,changelog,license,do-not-submit,breaking,coverage" - sdk: master permissions: pull-requests: write From 84f8af487e358d567a8f33b9b1e997972203cbc9 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 19 Jun 2024 09:53:24 +0200 Subject: [PATCH 12/23] Add ignore --- .github/workflows/health.yaml | 1 - pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/health.yaml b/.github/workflows/health.yaml index 78647dc4..b684ae67 100644 --- a/.github/workflows/health.yaml +++ b/.github/workflows/health.yaml @@ -11,6 +11,5 @@ jobs: uses: dart-lang/ecosystem/.github/workflows/health.yaml@main with: coverage_web: false - checks: "version,changelog,license,do-not-submit,breaking,coverage" permissions: pull-requests: write diff --git a/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart b/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart index 46bd26e8..4f42cd49 100644 --- a/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart +++ b/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: annotate_overrides, camel_case_types, comment_references, lines_longer_than_80_chars // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import From 2c074728784c4f36ccf13e93ff34a4265b0f5b9d Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 19 Jun 2024 09:55:08 +0200 Subject: [PATCH 13/23] Remove chrome tests --- .github/workflows/record_use.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/record_use.yaml b/.github/workflows/record_use.yaml index 7a1512ae..bf129c57 100644 --- a/.github/workflows/record_use.yaml +++ b/.github/workflows/record_use.yaml @@ -37,7 +37,3 @@ jobs: - run: dart format --output=none --set-exit-if-changed . - run: dart test - - - name: Run Chrome tests - wasm - run: dart test --platform chrome --compiler dart2wasm - if: always() && matrix.sdk == 'dev' From 9be8dfe5afa1166e0adb6fef09255ae82474be85 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 19 Jun 2024 10:03:04 +0200 Subject: [PATCH 14/23] Add license header --- pkgs/record_use/test/testdata/data.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/record_use/test/testdata/data.dart b/pkgs/record_use/test/testdata/data.dart index a4585971..9fe132a5 100644 --- a/pkgs/record_use/test/testdata/data.dart +++ b/pkgs/record_use/test/testdata/data.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:pub_semver/pub_semver.dart'; import 'package:record_use/record_use_internal.dart' as pb; From d232bcbb334d0df55ecfdf295afd5315bcd31917 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 19 Jun 2024 11:33:13 +0200 Subject: [PATCH 15/23] Require uniqueness --- pkgs/record_use/lib/record_use_internal.dart | 1 + .../lib/src/data_classes/extensions.dart | 19 ++--- pkgs/record_use/test/storage_test.dart | 7 +- pkgs/record_use/test/testdata/data.dart | 69 ++++++++++--------- 4 files changed, 55 insertions(+), 41 deletions(-) diff --git a/pkgs/record_use/lib/record_use_internal.dart b/pkgs/record_use/lib/record_use_internal.dart index b8b89b4d..c5127a1f 100644 --- a/pkgs/record_use/lib/record_use_internal.dart +++ b/pkgs/record_use/lib/record_use_internal.dart @@ -2,5 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +export 'src/data_classes/extensions.dart'; export 'src/proto/usages_read.pb.dart'; export 'src/proto/usages_shared.pb.dart'; diff --git a/pkgs/record_use/lib/src/data_classes/extensions.dart b/pkgs/record_use/lib/src/data_classes/extensions.dart index 00fca219..34efc474 100644 --- a/pkgs/record_use/lib/src/data_classes/extensions.dart +++ b/pkgs/record_use/lib/src/data_classes/extensions.dart @@ -15,22 +15,23 @@ extension UsagesExt on pb.Usages { const JsonEncoder.withIndent(' ').convert(_toStorage().writeToJsonMap()); pb_storage.Usages _toStorage() { + final usageList = [...calls, ...instances]; final definitions = - [...calls, ...instances].map((e) => e.definition).toList(); - final uris = [...calls, ...instances] - .expand((e) => [ - e.definition.identifier.uri, - ...e.references.map( - (e) => e.location.uri, - ) + usageList.map((usage) => usage.definition).toSet().toList(); + final uris = usageList + .expand((usage) => [ + usage.definition.identifier.uri, + ...usage.references.map((reference) => reference.location.uri) ]) + .toSet() .toList(); return pb_storage.Usages( metadata: metadata, definitions: definitions, uris: uris, - instances: instances.map((e) => e.toStorage(definitions, uris)), - calls: calls.map((e) => e.toStorage(definitions, uris)), + instances: + instances.map((instance) => instance.toStorage(definitions, uris)), + calls: calls.map((call) => call.toStorage(definitions, uris)), ); } } diff --git a/pkgs/record_use/test/storage_test.dart b/pkgs/record_use/test/storage_test.dart index 04fe8d4f..94ede726 100644 --- a/pkgs/record_use/test/storage_test.dart +++ b/pkgs/record_use/test/storage_test.dart @@ -5,7 +5,6 @@ import 'dart:io'; import 'package:record_use/record_use_internal.dart'; -import 'package:record_use/src/data_classes/extensions.dart'; import 'package:record_use/src/record_use.dart'; import 'package:test/test.dart'; @@ -23,4 +22,10 @@ void main() { recordedUses, ); }); + test('empty Object->Buffer->Object', () { + expect( + RecordedUsages.fromFile(emptyUsages.toBuffer()), + emptyUsages, + ); + }); } diff --git a/pkgs/record_use/test/testdata/data.dart b/pkgs/record_use/test/testdata/data.dart index 9fe132a5..a4405c58 100644 --- a/pkgs/record_use/test/testdata/data.dart +++ b/pkgs/record_use/test/testdata/data.dart @@ -3,19 +3,26 @@ // BSD-style license that can be found in the LICENSE file. import 'package:pub_semver/pub_semver.dart'; -import 'package:record_use/record_use_internal.dart' as pb; -final pb.Usages recordedUses = pb.Usages( - metadata: pb.Metadata( +import 'package:record_use/record_use_internal.dart'; + +final Usages emptyUsages = Usages( + metadata: Metadata(version: Version(1, 2, 3).toString()), + calls: [], + instances: [], +); + +final Usages recordedUses = Usages( + metadata: Metadata( version: Version(1, 6, 2, pre: 'wip', build: '5.-.2.z').toString(), comment: 'Recorded references at compile time and their argument values, as far' ' as known, to definitions annotated with @RecordReference', ), instances: [ - pb.Usage( - definition: pb.Definition( - identifier: pb.Identifier( + Usage( + definition: Definition( + identifier: Identifier( uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') .toString(), name: 'MyAnnotation', @@ -24,18 +31,18 @@ final pb.Usages recordedUses = pb.Usages( column: 30, ), references: [ - pb.Reference( - location: pb.Location( + Reference( + location: Location( uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') .toString(), line: 40, column: 30, ), - fields: pb.Fields(fields: [ - pb.Field( + fields: Fields(fields: [ + Field( className: 'className', name: 'a', - value: pb.FieldValue(intValue: 42), + value: FieldValue(intValue: 42), ), ]), loadingUnit: '3', @@ -44,9 +51,9 @@ final pb.Usages recordedUses = pb.Usages( ), ], calls: [ - pb.Usage( - definition: pb.Definition( - identifier: pb.Identifier( + Usage( + definition: Definition( + identifier: Identifier( uri: Uri.parse('file://lib/_internal/js_runtime/lib/js_helper.dart') .toString(), parent: 'MyClass', @@ -57,21 +64,21 @@ final pb.Usages recordedUses = pb.Usages( loadingUnit: 'part_15.js', ), references: [ - pb.Reference( - arguments: pb.Arguments( - constArguments: pb.ConstArguments( + Reference( + arguments: Arguments( + constArguments: ConstArguments( positional: { - 0: pb.FieldValue(stringValue: 'lib_SHA1'), - 1: pb.FieldValue(boolValue: false), - 2: pb.FieldValue(intValue: 1), + 0: FieldValue(stringValue: 'lib_SHA1'), + 1: FieldValue(boolValue: false), + 2: FieldValue(intValue: 1), }, named: { - 'leroy': pb.FieldValue(stringValue: 'jenkins'), - 'freddy': pb.FieldValue(stringValue: 'mercury'), + 'leroy': FieldValue(stringValue: 'jenkins'), + 'freddy': FieldValue(stringValue: 'mercury'), }, ), ), - location: pb.Location( + location: Location( uri: Uri.parse( 'file://benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart') .toString(), @@ -80,23 +87,23 @@ final pb.Usages recordedUses = pb.Usages( ), loadingUnit: 'o.js', ), - pb.Reference( - arguments: pb.Arguments( - constArguments: pb.ConstArguments( + Reference( + arguments: Arguments( + constArguments: ConstArguments( positional: { - 0: pb.FieldValue(stringValue: 'lib_SHA1'), - 2: pb.FieldValue(intValue: 0), + 0: FieldValue(stringValue: 'lib_SHA1'), + 2: FieldValue(intValue: 0), }, named: { - 'leroy': pb.FieldValue(stringValue: 'jenkins'), + 'leroy': FieldValue(stringValue: 'jenkins'), }, ), - nonConstArguments: pb.NonConstArguments( + nonConstArguments: NonConstArguments( positional: [1], named: ['freddy'], ), ), - location: pb.Location( + location: Location( uri: Uri.parse( 'file://benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart') .toString(), From 484e2b3ce60aa661960e47d8b4d8399ee67dfc2f Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 19 Jun 2024 13:27:55 +0200 Subject: [PATCH 16/23] Fix test data --- pkgs/record_use/test/testdata/data.binpb | Bin 775 -> 610 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/pkgs/record_use/test/testdata/data.binpb b/pkgs/record_use/test/testdata/data.binpb index dc12f9fa010ffff771c6fccc826d1dc0fd1c09a6..a069d1c5e3bab3a74b0f746519abf090cc0d7761 100644 GIT binary patch delta 12 TcmZo?d&IJVopJLT#%M+W96AH& delta 25 fcmaFF($2PlopItRTSlSDJd7qlY`mGBF`5woW9bH! From d4135a00af19c5e4bbdca13739d3b6f357dfe438 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 19 Jun 2024 14:03:26 +0200 Subject: [PATCH 17/23] Save uris --- .../lib/src/data_classes/extensions.dart | 48 +++- .../lib/src/proto/usages_read.pb.dart | 218 +++++++++++++++++- .../lib/src/proto/usages_read.pbjson.dart | 62 ++++- .../lib/src/proto/usages_read.proto | 15 +- .../lib/src/proto/usages_shared.pb.dart | 206 ----------------- .../lib/src/proto/usages_shared.pbjson.dart | 54 ----- .../lib/src/proto/usages_shared.proto | 13 -- .../lib/src/proto/usages_storage.pb.dart | 214 ++++++++++++++++- .../lib/src/proto/usages_storage.pbjson.dart | 62 ++++- .../lib/src/proto/usages_storage.proto | 15 +- pkgs/record_use/lib/src/record_use.dart | 3 +- pkgs/record_use/test/storage_test.dart | 3 + pkgs/record_use/test/testdata/data.binpb | Bin 610 -> 510 bytes .../test/testdata/{data.textpb => data.txtpb} | 9 +- 14 files changed, 613 insertions(+), 309 deletions(-) rename pkgs/record_use/test/testdata/{data.textpb => data.txtpb} (88%) diff --git a/pkgs/record_use/lib/src/data_classes/extensions.dart b/pkgs/record_use/lib/src/data_classes/extensions.dart index 34efc474..7c625bf9 100644 --- a/pkgs/record_use/lib/src/data_classes/extensions.dart +++ b/pkgs/record_use/lib/src/data_classes/extensions.dart @@ -16,8 +16,6 @@ extension UsagesExt on pb.Usages { pb_storage.Usages _toStorage() { final usageList = [...calls, ...instances]; - final definitions = - usageList.map((usage) => usage.definition).toSet().toList(); final uris = usageList .expand((usage) => [ usage.definition.identifier.uri, @@ -25,6 +23,10 @@ extension UsagesExt on pb.Usages { ]) .toSet() .toList(); + final definitions = usageList + .map((usage) => usage.definition.toStorage(uris)) + .toSet() + .toList(); return pb_storage.Usages( metadata: metadata, definitions: definitions, @@ -38,9 +40,9 @@ extension UsagesExt on pb.Usages { extension UsageExt on pb.Usage { pb_storage.Usage toStorage( - List definitions, List uris) => + List definitions, List uris) => pb_storage.Usage( - definition: definitions.indexOf(definition), + definition: definitions.indexOf(definition.toStorage(uris)), references: references.map((e) => e.toStorage(uris)), ); } @@ -62,6 +64,23 @@ extension LocationExt on pb.Location { ); } +extension DefinitionExt on pb.Definition { + pb_storage.Definition toStorage(List uris) => pb_storage.Definition( + identifier: identifier.toStorage(uris), + column: column, + line: line, + loadingUnit: hasLoadingUnit() ? loadingUnit : null, + ); +} + +extension IdentifierExt on pb.Identifier { + pb_storage.Identifier toStorage(List uris) => pb_storage.Identifier( + name: name, + parent: hasParent() ? parent : null, + uri: uris.indexOf(uri), + ); +} + extension UsagesStorageExt on pb_storage.Usages { pb.Usages toApi() => pb.Usages( metadata: metadata, @@ -71,9 +90,9 @@ extension UsagesStorageExt on pb_storage.Usages { } extension UsageStorageExt on pb_storage.Usage { - pb.Usage toApi(List definitions, List uris) => + pb.Usage toApi(List definitions, List uris) => pb.Usage( - definition: definitions[definition], + definition: definitions[definition].toApi(uris), references: references.map((e) => e.toApi(uris)), ); } @@ -95,6 +114,23 @@ extension LocationStorageExt on pb_storage.Location { ); } +extension DefinitionStorageExt on pb_storage.Definition { + pb.Definition toApi(List uris) => pb.Definition( + identifier: identifier.toApi(uris), + column: column, + line: line, + loadingUnit: hasLoadingUnit() ? loadingUnit : null, + ); +} + +extension IdentifierStorageExt on pb_storage.Identifier { + pb.Identifier toApi(List uris) => pb.Identifier( + name: name, + parent: hasParent() ? parent : null, + uri: uris[uri], + ); +} + extension FieldValueExt on pb_shared.FieldValue { Object toObject() => switch (whichValue()) { pb_shared.FieldValue_Value.intValue => intValue, diff --git a/pkgs/record_use/lib/src/proto/usages_read.pb.dart b/pkgs/record_use/lib/src/proto/usages_read.pb.dart index a4a474c4..5d897d07 100644 --- a/pkgs/record_use/lib/src/proto/usages_read.pb.dart +++ b/pkgs/record_use/lib/src/proto/usages_read.pb.dart @@ -97,7 +97,7 @@ class Usages extends $pb.GeneratedMessage { class Usage extends $pb.GeneratedMessage { factory Usage({ - $0.Definition? definition, + Definition? definition, $core.Iterable? references, }) { final $result = create(); @@ -121,8 +121,8 @@ class Usage extends $pb.GeneratedMessage { _omitMessageNames ? '' : 'Usage', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), createEmptyInstance: create) - ..aOM<$0.Definition>(1, _omitFieldNames ? '' : 'definition', - subBuilder: $0.Definition.create) + ..aOM(1, _omitFieldNames ? '' : 'definition', + subBuilder: Definition.create) ..pc(2, _omitFieldNames ? '' : 'references', $pb.PbFieldType.PM, subBuilder: Reference.create) ..hasRequiredFields = false; @@ -149,9 +149,9 @@ class Usage extends $pb.GeneratedMessage { static Usage? _defaultInstance; @$pb.TagNumber(1) - $0.Definition get definition => $_getN(0); + Definition get definition => $_getN(0); @$pb.TagNumber(1) - set definition($0.Definition v) { + set definition(Definition v) { setField(1, v); } @@ -160,7 +160,7 @@ class Usage extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearDefinition() => clearField(1); @$pb.TagNumber(1) - $0.Definition ensureDefinition() => $_ensure(0); + Definition ensureDefinition() => $_ensure(0); @$pb.TagNumber(2) $core.List get references => $_getList(1); @@ -391,6 +391,212 @@ class Reference extends $pb.GeneratedMessage { $0.Fields ensureFields() => $_ensure(3); } +class Definition extends $pb.GeneratedMessage { + factory Definition({ + Identifier? identifier, + $core.int? line, + $core.int? column, + $core.String? loadingUnit, + }) { + final $result = create(); + if (identifier != null) { + $result.identifier = identifier; + } + if (line != null) { + $result.line = line; + } + if (column != null) { + $result.column = column; + } + if (loadingUnit != null) { + $result.loadingUnit = loadingUnit; + } + return $result; + } + Definition._() : super(); + factory Definition.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Definition.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Definition', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..aOM(1, _omitFieldNames ? '' : 'identifier', + subBuilder: Identifier.create) + ..a<$core.int>(2, _omitFieldNames ? '' : 'line', $pb.PbFieldType.OU3) + ..a<$core.int>(3, _omitFieldNames ? '' : 'column', $pb.PbFieldType.OU3) + ..aOS(4, _omitFieldNames ? '' : 'loadingUnit') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Definition clone() => Definition()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Definition copyWith(void Function(Definition) updates) => + super.copyWith((message) => updates(message as Definition)) as Definition; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Definition create() => Definition._(); + Definition createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Definition getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static Definition? _defaultInstance; + + @$pb.TagNumber(1) + Identifier get identifier => $_getN(0); + @$pb.TagNumber(1) + set identifier(Identifier v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasIdentifier() => $_has(0); + @$pb.TagNumber(1) + void clearIdentifier() => clearField(1); + @$pb.TagNumber(1) + Identifier ensureIdentifier() => $_ensure(0); + + @$pb.TagNumber(2) + $core.int get line => $_getIZ(1); + @$pb.TagNumber(2) + set line($core.int v) { + $_setUnsignedInt32(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasLine() => $_has(1); + @$pb.TagNumber(2) + void clearLine() => clearField(2); + + @$pb.TagNumber(3) + $core.int get column => $_getIZ(2); + @$pb.TagNumber(3) + set column($core.int v) { + $_setUnsignedInt32(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasColumn() => $_has(2); + @$pb.TagNumber(3) + void clearColumn() => clearField(3); + + @$pb.TagNumber(4) + $core.String get loadingUnit => $_getSZ(3); + @$pb.TagNumber(4) + set loadingUnit($core.String v) { + $_setString(3, v); + } + + @$pb.TagNumber(4) + $core.bool hasLoadingUnit() => $_has(3); + @$pb.TagNumber(4) + void clearLoadingUnit() => clearField(4); +} + +class Identifier extends $pb.GeneratedMessage { + factory Identifier({ + $core.String? uri, + $core.String? parent, + $core.String? name, + }) { + final $result = create(); + if (uri != null) { + $result.uri = uri; + } + if (parent != null) { + $result.parent = parent; + } + if (name != null) { + $result.name = name; + } + return $result; + } + Identifier._() : super(); + factory Identifier.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Identifier.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Identifier', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'uri') + ..aOS(2, _omitFieldNames ? '' : 'parent') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Identifier clone() => Identifier()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Identifier copyWith(void Function(Identifier) updates) => + super.copyWith((message) => updates(message as Identifier)) as Identifier; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Identifier create() => Identifier._(); + Identifier createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Identifier getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static Identifier? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get uri => $_getSZ(0); + @$pb.TagNumber(1) + set uri($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasUri() => $_has(0); + @$pb.TagNumber(1) + void clearUri() => clearField(1); + + @$pb.TagNumber(2) + $core.String get parent => $_getSZ(1); + @$pb.TagNumber(2) + set parent($core.String v) { + $_setString(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasParent() => $_has(1); + @$pb.TagNumber(2) + void clearParent() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { + $_setString(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); +} + const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/pkgs/record_use/lib/src/proto/usages_read.pbjson.dart b/pkgs/record_use/lib/src/proto/usages_read.pbjson.dart index a67c0fea..82b4dc57 100644 --- a/pkgs/record_use/lib/src/proto/usages_read.pbjson.dart +++ b/pkgs/record_use/lib/src/proto/usages_read.pbjson.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: annotate_overrides, camel_case_types, comment_references, lines_longer_than_80_chars // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import @@ -59,7 +59,7 @@ const Usage$json = { '3': 1, '4': 1, '5': 11, - '6': '.usages_shared.Definition', + '6': '.usages.Definition', '10': 'definition' }, { @@ -75,9 +75,8 @@ const Usage$json = { /// Descriptor for `Usage`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List usageDescriptor = $convert.base64Decode( - 'CgVVc2FnZRI5CgpkZWZpbml0aW9uGAEgASgLMhkudXNhZ2VzX3NoYXJlZC5EZWZpbml0aW9uUg' - 'pkZWZpbml0aW9uEjEKCnJlZmVyZW5jZXMYAiADKAsyES51c2FnZXMuUmVmZXJlbmNlUgpyZWZl' - 'cmVuY2Vz'); + 'CgVVc2FnZRIyCgpkZWZpbml0aW9uGAEgASgLMhIudXNhZ2VzLkRlZmluaXRpb25SCmRlZmluaX' + 'Rpb24SMQoKcmVmZXJlbmNlcxgCIAMoCzIRLnVzYWdlcy5SZWZlcmVuY2VSCnJlZmVyZW5jZXM='); @$core.Deprecated('Use locationDescriptor instead') const Location$json = { @@ -137,3 +136,56 @@ final $typed_data.Uint8List referenceDescriptor = $convert.base64Decode( '9uEiEKDGxvYWRpbmdfdW5pdBgCIAEoCVILbG9hZGluZ1VuaXQSOAoJYXJndW1lbnRzGAMgASgL' 'MhgudXNhZ2VzX3NoYXJlZC5Bcmd1bWVudHNIAFIJYXJndW1lbnRzEi8KBmZpZWxkcxgEIAEoCz' 'IVLnVzYWdlc19zaGFyZWQuRmllbGRzSABSBmZpZWxkc0ILCglyZWZlcmVuY2U='); + +@$core.Deprecated('Use definitionDescriptor instead') +const Definition$json = { + '1': 'Definition', + '2': [ + { + '1': 'identifier', + '3': 1, + '4': 1, + '5': 11, + '6': '.usages.Identifier', + '10': 'identifier' + }, + {'1': 'line', '3': 2, '4': 1, '5': 13, '10': 'line'}, + {'1': 'column', '3': 3, '4': 1, '5': 13, '10': 'column'}, + { + '1': 'loading_unit', + '3': 4, + '4': 1, + '5': 9, + '9': 0, + '10': 'loadingUnit', + '17': true + }, + ], + '8': [ + {'1': '_loading_unit'}, + ], +}; + +/// Descriptor for `Definition`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List definitionDescriptor = $convert.base64Decode( + 'CgpEZWZpbml0aW9uEjIKCmlkZW50aWZpZXIYASABKAsyEi51c2FnZXMuSWRlbnRpZmllclIKaW' + 'RlbnRpZmllchISCgRsaW5lGAIgASgNUgRsaW5lEhYKBmNvbHVtbhgDIAEoDVIGY29sdW1uEiYK' + 'DGxvYWRpbmdfdW5pdBgEIAEoCUgAUgtsb2FkaW5nVW5pdIgBAUIPCg1fbG9hZGluZ191bml0'); + +@$core.Deprecated('Use identifierDescriptor instead') +const Identifier$json = { + '1': 'Identifier', + '2': [ + {'1': 'uri', '3': 1, '4': 1, '5': 9, '10': 'uri'}, + {'1': 'parent', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'parent', '17': true}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + ], + '8': [ + {'1': '_parent'}, + ], +}; + +/// Descriptor for `Identifier`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List identifierDescriptor = $convert.base64Decode( + 'CgpJZGVudGlmaWVyEhAKA3VyaRgBIAEoCVIDdXJpEhsKBnBhcmVudBgCIAEoCUgAUgZwYXJlbn' + 'SIAQESEgoEbmFtZRgDIAEoCVIEbmFtZUIJCgdfcGFyZW50'); diff --git a/pkgs/record_use/lib/src/proto/usages_read.proto b/pkgs/record_use/lib/src/proto/usages_read.proto index 2cefbb9a..5e113621 100644 --- a/pkgs/record_use/lib/src/proto/usages_read.proto +++ b/pkgs/record_use/lib/src/proto/usages_read.proto @@ -10,7 +10,7 @@ message Usages { } message Usage { - usages_shared.Definition definition = 1; + Definition definition = 1; repeated Reference references = 2; } @@ -29,3 +29,16 @@ message Reference { usages_shared.Fields fields = 4; } } + +message Definition { + Identifier identifier = 1; + uint32 line = 2; + uint32 column = 3; + optional string loading_unit = 4; // Optional, as some loading units are null +} + +message Identifier { + string uri = 1; + optional string parent = 2; + string name = 3; +} diff --git a/pkgs/record_use/lib/src/proto/usages_shared.pb.dart b/pkgs/record_use/lib/src/proto/usages_shared.pb.dart index 9fcecda3..ea404c21 100644 --- a/pkgs/record_use/lib/src/proto/usages_shared.pb.dart +++ b/pkgs/record_use/lib/src/proto/usages_shared.pb.dart @@ -89,212 +89,6 @@ class Metadata extends $pb.GeneratedMessage { void clearVersion() => clearField(2); } -class Definition extends $pb.GeneratedMessage { - factory Definition({ - Identifier? identifier, - $core.int? line, - $core.int? column, - $core.String? loadingUnit, - }) { - final $result = create(); - if (identifier != null) { - $result.identifier = identifier; - } - if (line != null) { - $result.line = line; - } - if (column != null) { - $result.column = column; - } - if (loadingUnit != null) { - $result.loadingUnit = loadingUnit; - } - return $result; - } - Definition._() : super(); - factory Definition.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory Definition.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'Definition', - package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), - createEmptyInstance: create) - ..aOM(1, _omitFieldNames ? '' : 'identifier', - subBuilder: Identifier.create) - ..a<$core.int>(2, _omitFieldNames ? '' : 'line', $pb.PbFieldType.OU3) - ..a<$core.int>(3, _omitFieldNames ? '' : 'column', $pb.PbFieldType.OU3) - ..aOS(4, _omitFieldNames ? '' : 'loadingUnit') - ..hasRequiredFields = false; - - @$core.Deprecated('Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Definition clone() => Definition()..mergeFromMessage(this); - @$core.Deprecated('Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Definition copyWith(void Function(Definition) updates) => - super.copyWith((message) => updates(message as Definition)) as Definition; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Definition create() => Definition._(); - Definition createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Definition getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static Definition? _defaultInstance; - - @$pb.TagNumber(1) - Identifier get identifier => $_getN(0); - @$pb.TagNumber(1) - set identifier(Identifier v) { - setField(1, v); - } - - @$pb.TagNumber(1) - $core.bool hasIdentifier() => $_has(0); - @$pb.TagNumber(1) - void clearIdentifier() => clearField(1); - @$pb.TagNumber(1) - Identifier ensureIdentifier() => $_ensure(0); - - @$pb.TagNumber(2) - $core.int get line => $_getIZ(1); - @$pb.TagNumber(2) - set line($core.int v) { - $_setUnsignedInt32(1, v); - } - - @$pb.TagNumber(2) - $core.bool hasLine() => $_has(1); - @$pb.TagNumber(2) - void clearLine() => clearField(2); - - @$pb.TagNumber(3) - $core.int get column => $_getIZ(2); - @$pb.TagNumber(3) - set column($core.int v) { - $_setUnsignedInt32(2, v); - } - - @$pb.TagNumber(3) - $core.bool hasColumn() => $_has(2); - @$pb.TagNumber(3) - void clearColumn() => clearField(3); - - @$pb.TagNumber(4) - $core.String get loadingUnit => $_getSZ(3); - @$pb.TagNumber(4) - set loadingUnit($core.String v) { - $_setString(3, v); - } - - @$pb.TagNumber(4) - $core.bool hasLoadingUnit() => $_has(3); - @$pb.TagNumber(4) - void clearLoadingUnit() => clearField(4); -} - -class Identifier extends $pb.GeneratedMessage { - factory Identifier({ - $core.String? uri, - $core.String? parent, - $core.String? name, - }) { - final $result = create(); - if (uri != null) { - $result.uri = uri; - } - if (parent != null) { - $result.parent = parent; - } - if (name != null) { - $result.name = name; - } - return $result; - } - Identifier._() : super(); - factory Identifier.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory Identifier.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'Identifier', - package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), - createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'uri') - ..aOS(2, _omitFieldNames ? '' : 'parent') - ..aOS(3, _omitFieldNames ? '' : 'name') - ..hasRequiredFields = false; - - @$core.Deprecated('Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Identifier clone() => Identifier()..mergeFromMessage(this); - @$core.Deprecated('Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Identifier copyWith(void Function(Identifier) updates) => - super.copyWith((message) => updates(message as Identifier)) as Identifier; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Identifier create() => Identifier._(); - Identifier createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Identifier getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static Identifier? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get uri => $_getSZ(0); - @$pb.TagNumber(1) - set uri($core.String v) { - $_setString(0, v); - } - - @$pb.TagNumber(1) - $core.bool hasUri() => $_has(0); - @$pb.TagNumber(1) - void clearUri() => clearField(1); - - @$pb.TagNumber(2) - $core.String get parent => $_getSZ(1); - @$pb.TagNumber(2) - set parent($core.String v) { - $_setString(1, v); - } - - @$pb.TagNumber(2) - $core.bool hasParent() => $_has(1); - @$pb.TagNumber(2) - void clearParent() => clearField(2); - - @$pb.TagNumber(3) - $core.String get name => $_getSZ(2); - @$pb.TagNumber(3) - set name($core.String v) { - $_setString(2, v); - } - - @$pb.TagNumber(3) - $core.bool hasName() => $_has(2); - @$pb.TagNumber(3) - void clearName() => clearField(3); -} - class Fields extends $pb.GeneratedMessage { factory Fields({ $core.Iterable? fields, diff --git a/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart b/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart index 4f42cd49..4b0149e3 100644 --- a/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart +++ b/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart @@ -38,60 +38,6 @@ final $typed_data.Uint8List metadataDescriptor = $convert.base64Decode( 'CghNZXRhZGF0YRIdCgdjb21tZW50GAEgASgJSABSB2NvbW1lbnSIAQESGAoHdmVyc2lvbhgCIA' 'EoCVIHdmVyc2lvbkIKCghfY29tbWVudA=='); -@$core.Deprecated('Use definitionDescriptor instead') -const Definition$json = { - '1': 'Definition', - '2': [ - { - '1': 'identifier', - '3': 1, - '4': 1, - '5': 11, - '6': '.usages_shared.Identifier', - '10': 'identifier' - }, - {'1': 'line', '3': 2, '4': 1, '5': 13, '10': 'line'}, - {'1': 'column', '3': 3, '4': 1, '5': 13, '10': 'column'}, - { - '1': 'loading_unit', - '3': 4, - '4': 1, - '5': 9, - '9': 0, - '10': 'loadingUnit', - '17': true - }, - ], - '8': [ - {'1': '_loading_unit'}, - ], -}; - -/// Descriptor for `Definition`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List definitionDescriptor = $convert.base64Decode( - 'CgpEZWZpbml0aW9uEjkKCmlkZW50aWZpZXIYASABKAsyGS51c2FnZXNfc2hhcmVkLklkZW50aW' - 'ZpZXJSCmlkZW50aWZpZXISEgoEbGluZRgCIAEoDVIEbGluZRIWCgZjb2x1bW4YAyABKA1SBmNv' - 'bHVtbhImCgxsb2FkaW5nX3VuaXQYBCABKAlIAFILbG9hZGluZ1VuaXSIAQFCDwoNX2xvYWRpbm' - 'dfdW5pdA=='); - -@$core.Deprecated('Use identifierDescriptor instead') -const Identifier$json = { - '1': 'Identifier', - '2': [ - {'1': 'uri', '3': 1, '4': 1, '5': 9, '10': 'uri'}, - {'1': 'parent', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'parent', '17': true}, - {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, - ], - '8': [ - {'1': '_parent'}, - ], -}; - -/// Descriptor for `Identifier`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List identifierDescriptor = $convert.base64Decode( - 'CgpJZGVudGlmaWVyEhAKA3VyaRgBIAEoCVIDdXJpEhsKBnBhcmVudBgCIAEoCUgAUgZwYXJlbn' - 'SIAQESEgoEbmFtZRgDIAEoCVIEbmFtZUIJCgdfcGFyZW50'); - @$core.Deprecated('Use fieldsDescriptor instead') const Fields$json = { '1': 'Fields', diff --git a/pkgs/record_use/lib/src/proto/usages_shared.proto b/pkgs/record_use/lib/src/proto/usages_shared.proto index fea9ef20..03a44866 100644 --- a/pkgs/record_use/lib/src/proto/usages_shared.proto +++ b/pkgs/record_use/lib/src/proto/usages_shared.proto @@ -6,19 +6,6 @@ message Metadata { string version = 2; } -message Definition { - Identifier identifier = 1; - uint32 line = 2; - uint32 column = 3; - optional string loading_unit = 4; // Optional, as some loading units are null -} - -message Identifier { - string uri = 1; - optional string parent = 2; - string name = 3; -} - message Fields { repeated Field fields = 1; } diff --git a/pkgs/record_use/lib/src/proto/usages_storage.pb.dart b/pkgs/record_use/lib/src/proto/usages_storage.pb.dart index 55a43ea8..6087a26a 100644 --- a/pkgs/record_use/lib/src/proto/usages_storage.pb.dart +++ b/pkgs/record_use/lib/src/proto/usages_storage.pb.dart @@ -19,7 +19,7 @@ class Usages extends $pb.GeneratedMessage { factory Usages({ $0.Metadata? metadata, $core.Iterable<$core.String>? uris, - $core.Iterable<$0.Definition>? definitions, + $core.Iterable? definitions, $core.Iterable? calls, $core.Iterable? instances, }) { @@ -56,9 +56,9 @@ class Usages extends $pb.GeneratedMessage { ..aOM<$0.Metadata>(1, _omitFieldNames ? '' : 'metadata', subBuilder: $0.Metadata.create) ..pPS(2, _omitFieldNames ? '' : 'uris') - ..pc<$0.Definition>( + ..pc( 3, _omitFieldNames ? '' : 'definitions', $pb.PbFieldType.PM, - subBuilder: $0.Definition.create) + subBuilder: Definition.create) ..pc(4, _omitFieldNames ? '' : 'calls', $pb.PbFieldType.PM, subBuilder: Usage.create) ..pc(5, _omitFieldNames ? '' : 'instances', $pb.PbFieldType.PM, @@ -104,7 +104,7 @@ class Usages extends $pb.GeneratedMessage { $core.List<$core.String> get uris => $_getList(1); @$pb.TagNumber(3) - $core.List<$0.Definition> get definitions => $_getList(2); + $core.List get definitions => $_getList(2); @$pb.TagNumber(4) $core.List get calls => $_getList(3); @@ -406,6 +406,212 @@ class Reference extends $pb.GeneratedMessage { $0.Fields ensureFields() => $_ensure(3); } +class Definition extends $pb.GeneratedMessage { + factory Definition({ + Identifier? identifier, + $core.int? line, + $core.int? column, + $core.String? loadingUnit, + }) { + final $result = create(); + if (identifier != null) { + $result.identifier = identifier; + } + if (line != null) { + $result.line = line; + } + if (column != null) { + $result.column = column; + } + if (loadingUnit != null) { + $result.loadingUnit = loadingUnit; + } + return $result; + } + Definition._() : super(); + factory Definition.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Definition.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Definition', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..aOM(1, _omitFieldNames ? '' : 'identifier', + subBuilder: Identifier.create) + ..a<$core.int>(2, _omitFieldNames ? '' : 'line', $pb.PbFieldType.OU3) + ..a<$core.int>(3, _omitFieldNames ? '' : 'column', $pb.PbFieldType.OU3) + ..aOS(4, _omitFieldNames ? '' : 'loadingUnit') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Definition clone() => Definition()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Definition copyWith(void Function(Definition) updates) => + super.copyWith((message) => updates(message as Definition)) as Definition; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Definition create() => Definition._(); + Definition createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Definition getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static Definition? _defaultInstance; + + @$pb.TagNumber(1) + Identifier get identifier => $_getN(0); + @$pb.TagNumber(1) + set identifier(Identifier v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasIdentifier() => $_has(0); + @$pb.TagNumber(1) + void clearIdentifier() => clearField(1); + @$pb.TagNumber(1) + Identifier ensureIdentifier() => $_ensure(0); + + @$pb.TagNumber(2) + $core.int get line => $_getIZ(1); + @$pb.TagNumber(2) + set line($core.int v) { + $_setUnsignedInt32(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasLine() => $_has(1); + @$pb.TagNumber(2) + void clearLine() => clearField(2); + + @$pb.TagNumber(3) + $core.int get column => $_getIZ(2); + @$pb.TagNumber(3) + set column($core.int v) { + $_setUnsignedInt32(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasColumn() => $_has(2); + @$pb.TagNumber(3) + void clearColumn() => clearField(3); + + @$pb.TagNumber(4) + $core.String get loadingUnit => $_getSZ(3); + @$pb.TagNumber(4) + set loadingUnit($core.String v) { + $_setString(3, v); + } + + @$pb.TagNumber(4) + $core.bool hasLoadingUnit() => $_has(3); + @$pb.TagNumber(4) + void clearLoadingUnit() => clearField(4); +} + +class Identifier extends $pb.GeneratedMessage { + factory Identifier({ + $core.int? uri, + $core.String? parent, + $core.String? name, + }) { + final $result = create(); + if (uri != null) { + $result.uri = uri; + } + if (parent != null) { + $result.parent = parent; + } + if (name != null) { + $result.name = name; + } + return $result; + } + Identifier._() : super(); + factory Identifier.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Identifier.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Identifier', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages'), + createEmptyInstance: create) + ..a<$core.int>(1, _omitFieldNames ? '' : 'uri', $pb.PbFieldType.OU3) + ..aOS(2, _omitFieldNames ? '' : 'parent') + ..aOS(3, _omitFieldNames ? '' : 'name') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Identifier clone() => Identifier()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Identifier copyWith(void Function(Identifier) updates) => + super.copyWith((message) => updates(message as Identifier)) as Identifier; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Identifier create() => Identifier._(); + Identifier createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Identifier getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static Identifier? _defaultInstance; + + @$pb.TagNumber(1) + $core.int get uri => $_getIZ(0); + @$pb.TagNumber(1) + set uri($core.int v) { + $_setUnsignedInt32(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasUri() => $_has(0); + @$pb.TagNumber(1) + void clearUri() => clearField(1); + + @$pb.TagNumber(2) + $core.String get parent => $_getSZ(1); + @$pb.TagNumber(2) + set parent($core.String v) { + $_setString(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasParent() => $_has(1); + @$pb.TagNumber(2) + void clearParent() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { + $_setString(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); +} + const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/pkgs/record_use/lib/src/proto/usages_storage.pbjson.dart b/pkgs/record_use/lib/src/proto/usages_storage.pbjson.dart index 450e2a32..3eca781b 100644 --- a/pkgs/record_use/lib/src/proto/usages_storage.pbjson.dart +++ b/pkgs/record_use/lib/src/proto/usages_storage.pbjson.dart @@ -31,7 +31,7 @@ const Usages$json = { '3': 3, '4': 3, '5': 11, - '6': '.usages_shared.Definition', + '6': '.usages.Definition', '10': 'definitions' }, { @@ -56,10 +56,9 @@ const Usages$json = { /// Descriptor for `Usages`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List usagesDescriptor = $convert.base64Decode( 'CgZVc2FnZXMSMwoIbWV0YWRhdGEYASABKAsyFy51c2FnZXNfc2hhcmVkLk1ldGFkYXRhUghtZX' - 'RhZGF0YRISCgR1cmlzGAIgAygJUgR1cmlzEjsKC2RlZmluaXRpb25zGAMgAygLMhkudXNhZ2Vz' - 'X3NoYXJlZC5EZWZpbml0aW9uUgtkZWZpbml0aW9ucxIjCgVjYWxscxgEIAMoCzINLnVzYWdlcy' - '5Vc2FnZVIFY2FsbHMSKwoJaW5zdGFuY2VzGAUgAygLMg0udXNhZ2VzLlVzYWdlUglpbnN0YW5j' - 'ZXM='); + 'RhZGF0YRISCgR1cmlzGAIgAygJUgR1cmlzEjQKC2RlZmluaXRpb25zGAMgAygLMhIudXNhZ2Vz' + 'LkRlZmluaXRpb25SC2RlZmluaXRpb25zEiMKBWNhbGxzGAQgAygLMg0udXNhZ2VzLlVzYWdlUg' + 'VjYWxscxIrCglpbnN0YW5jZXMYBSADKAsyDS51c2FnZXMuVXNhZ2VSCWluc3RhbmNlcw=='); @$core.Deprecated('Use usageDescriptor instead') const Usage$json = { @@ -140,3 +139,56 @@ final $typed_data.Uint8List referenceDescriptor = $convert.base64Decode( '9uEiEKDGxvYWRpbmdfdW5pdBgCIAEoCVILbG9hZGluZ1VuaXQSOAoJYXJndW1lbnRzGAMgASgL' 'MhgudXNhZ2VzX3NoYXJlZC5Bcmd1bWVudHNIAFIJYXJndW1lbnRzEi8KBmZpZWxkcxgEIAEoCz' 'IVLnVzYWdlc19zaGFyZWQuRmllbGRzSABSBmZpZWxkc0ILCglyZWZlcmVuY2U='); + +@$core.Deprecated('Use definitionDescriptor instead') +const Definition$json = { + '1': 'Definition', + '2': [ + { + '1': 'identifier', + '3': 1, + '4': 1, + '5': 11, + '6': '.usages.Identifier', + '10': 'identifier' + }, + {'1': 'line', '3': 2, '4': 1, '5': 13, '10': 'line'}, + {'1': 'column', '3': 3, '4': 1, '5': 13, '10': 'column'}, + { + '1': 'loading_unit', + '3': 4, + '4': 1, + '5': 9, + '9': 0, + '10': 'loadingUnit', + '17': true + }, + ], + '8': [ + {'1': '_loading_unit'}, + ], +}; + +/// Descriptor for `Definition`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List definitionDescriptor = $convert.base64Decode( + 'CgpEZWZpbml0aW9uEjIKCmlkZW50aWZpZXIYASABKAsyEi51c2FnZXMuSWRlbnRpZmllclIKaW' + 'RlbnRpZmllchISCgRsaW5lGAIgASgNUgRsaW5lEhYKBmNvbHVtbhgDIAEoDVIGY29sdW1uEiYK' + 'DGxvYWRpbmdfdW5pdBgEIAEoCUgAUgtsb2FkaW5nVW5pdIgBAUIPCg1fbG9hZGluZ191bml0'); + +@$core.Deprecated('Use identifierDescriptor instead') +const Identifier$json = { + '1': 'Identifier', + '2': [ + {'1': 'uri', '3': 1, '4': 1, '5': 13, '10': 'uri'}, + {'1': 'parent', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'parent', '17': true}, + {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + ], + '8': [ + {'1': '_parent'}, + ], +}; + +/// Descriptor for `Identifier`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List identifierDescriptor = $convert.base64Decode( + 'CgpJZGVudGlmaWVyEhAKA3VyaRgBIAEoDVIDdXJpEhsKBnBhcmVudBgCIAEoCUgAUgZwYXJlbn' + 'SIAQESEgoEbmFtZRgDIAEoCVIEbmFtZUIJCgdfcGFyZW50'); diff --git a/pkgs/record_use/lib/src/proto/usages_storage.proto b/pkgs/record_use/lib/src/proto/usages_storage.proto index 45486311..bcc90414 100644 --- a/pkgs/record_use/lib/src/proto/usages_storage.proto +++ b/pkgs/record_use/lib/src/proto/usages_storage.proto @@ -6,7 +6,7 @@ import "usages_shared.proto"; message Usages { usages_shared.Metadata metadata = 1; repeated string uris = 2; - repeated usages_shared.Definition definitions = 3; + repeated Definition definitions = 3; repeated Usage calls = 4; repeated Usage instances = 5; } @@ -30,3 +30,16 @@ message Reference { usages_shared.Fields fields = 4; } } + +message Definition { + Identifier identifier = 1; + uint32 line = 2; + uint32 column = 3; + optional string loading_unit = 4; // Optional, as some loading units are null +} + +message Identifier { + uint32 uri = 1; + optional string parent = 2; + string name = 3; +} diff --git a/pkgs/record_use/lib/src/record_use.dart b/pkgs/record_use/lib/src/record_use.dart index 1d36527c..5016691a 100644 --- a/pkgs/record_use/lib/src/record_use.dart +++ b/pkgs/record_use/lib/src/record_use.dart @@ -9,7 +9,6 @@ import 'package:pub_semver/pub_semver.dart'; import 'data_classes/extensions.dart'; import 'proto/usages_read.pb.dart' as pb; -import 'proto/usages_shared.pb.dart' as pb_shared; import 'proto/usages_storage.pb.dart' as pb_storage; class Identifier { @@ -141,7 +140,7 @@ extension type RecordedUsages._(pb.Usages _usages) { pb.Usage? _callTo(Identifier identifier) => _usages.calls.firstWhereOrNull( (call) => _compareIdentifiers(call.definition.identifier, identifier)); - bool _compareIdentifiers(pb_shared.Identifier id1, Identifier id2) => + bool _compareIdentifiers(pb.Identifier id1, Identifier id2) => id1.uri == id2.uri && (id1.hasParent() ? id1.parent : null) == id2.parent && id1.name == id2.name; diff --git a/pkgs/record_use/test/storage_test.dart b/pkgs/record_use/test/storage_test.dart index 94ede726..630e5d37 100644 --- a/pkgs/record_use/test/storage_test.dart +++ b/pkgs/record_use/test/storage_test.dart @@ -12,6 +12,9 @@ import 'testdata/data.dart'; void main() { test('Buffer->Object->Buffer', () { + // File('test/testdata/data.txtpb') + // .writeAsStringSync(recordedUses.toDebugJson()); + // File('test/testdata/data.binpb').writeAsBytesSync(recordedUses.toBuffer()); final recordedUsesPb = File('test/testdata/data.binpb').readAsBytesSync(); expect((RecordedUsages.fromFile(recordedUsesPb) as Usages).toBuffer(), recordedUsesPb); diff --git a/pkgs/record_use/test/testdata/data.binpb b/pkgs/record_use/test/testdata/data.binpb index a069d1c5e3bab3a74b0f746519abf090cc0d7761..8dfb96ba32da270bb021f56f0dd25f194833dbf1 100644 GIT binary patch delta 27 hcmaFF@{f4~2P3N)mkI~NWP3(qRxvICAZsP#P5@qJ21@_{ delta 31 lcmeyz{D@@(2O~=cR~XmC=_Zr;7>!swxSW7& Date: Thu, 20 Jun 2024 09:35:25 +0200 Subject: [PATCH 18/23] Update .github/workflows/record_use.yaml Co-authored-by: Devon Carew --- .github/workflows/record_use.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/record_use.yaml b/.github/workflows/record_use.yaml index bf129c57..05a2cc8f 100644 --- a/.github/workflows/record_use.yaml +++ b/.github/workflows/record_use.yaml @@ -1,4 +1,4 @@ -name: record_use +name: 'package:record_use' permissions: read-all on: From 308838e2d1b031d4f4a357ea41b484263fa5a756 Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 20 Jun 2024 09:35:35 +0200 Subject: [PATCH 19/23] Update pkgs/record_use/README.md Co-authored-by: Devon Carew --- pkgs/record_use/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/record_use/README.md b/pkgs/record_use/README.md index 0e27d2bd..ea1872ac 100644 --- a/pkgs/record_use/README.md +++ b/pkgs/record_use/README.md @@ -19,6 +19,7 @@ any constant instance of the class will be recorded. This is particularly useful when using the class as an annotation. ## Example + ```dart import 'package:meta/meta.dart' show RecordUse; From b17551b739be0f17d1e2d2c8197939107e40a66d Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 20 Jun 2024 15:01:10 +0200 Subject: [PATCH 20/23] Allow lists --- .../lib/src/data_classes/extensions.dart | 5 +- .../lib/src/proto/usages_read.pbjson.dart | 2 +- .../lib/src/proto/usages_shared.pb.dart | 230 ++++++++++++++---- .../lib/src/proto/usages_shared.pbjson.dart | 107 ++++++-- .../lib/src/proto/usages_shared.proto | 24 +- pkgs/record_use/test/storage_test.dart | 3 +- pkgs/record_use/test/testdata/data.binpb | Bin 510 -> 612 bytes pkgs/record_use/test/testdata/data.dart | 15 ++ .../test/testdata/{data.txtpb => data.json} | 66 ++++- pkgs/record_use/test/usage_test.dart | 11 +- 10 files changed, 386 insertions(+), 77 deletions(-) rename pkgs/record_use/test/testdata/{data.txtpb => data.json} (59%) diff --git a/pkgs/record_use/lib/src/data_classes/extensions.dart b/pkgs/record_use/lib/src/data_classes/extensions.dart index 7c625bf9..0e9d33f3 100644 --- a/pkgs/record_use/lib/src/data_classes/extensions.dart +++ b/pkgs/record_use/lib/src/data_classes/extensions.dart @@ -133,10 +133,13 @@ extension IdentifierStorageExt on pb_storage.Identifier { extension FieldValueExt on pb_shared.FieldValue { Object toObject() => switch (whichValue()) { + pb_shared.FieldValue_Value.map => + map.value.map((key, value) => MapEntry(key, value.toObject())), + pb_shared.FieldValue_Value.list => list.value.map((e) => e.toObject()), pb_shared.FieldValue_Value.intValue => intValue, pb_shared.FieldValue_Value.doubleValue => doubleValue, pb_shared.FieldValue_Value.boolValue => boolValue, pb_shared.FieldValue_Value.stringValue => stringValue, - pb_shared.FieldValue_Value.notSet => throw ArgumentError(), + pb_shared.FieldValue_Value.notSet => throw UnimplementedError(), }; } diff --git a/pkgs/record_use/lib/src/proto/usages_read.pbjson.dart b/pkgs/record_use/lib/src/proto/usages_read.pbjson.dart index 82b4dc57..d6de7a6c 100644 --- a/pkgs/record_use/lib/src/proto/usages_read.pbjson.dart +++ b/pkgs/record_use/lib/src/proto/usages_read.pbjson.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types, comment_references, lines_longer_than_80_chars +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import diff --git a/pkgs/record_use/lib/src/proto/usages_shared.pb.dart b/pkgs/record_use/lib/src/proto/usages_shared.pb.dart index ea404c21..f535a362 100644 --- a/pkgs/record_use/lib/src/proto/usages_shared.pb.dart +++ b/pkgs/record_use/lib/src/proto/usages_shared.pb.dart @@ -140,8 +140,6 @@ class Fields extends $pb.GeneratedMessage { $core.List get fields => $_getList(0); } -enum Arguments_Kind { constArguments, nonConstArguments, notSet } - class Arguments extends $pb.GeneratedMessage { factory Arguments({ ConstArguments? constArguments, @@ -164,16 +162,10 @@ class Arguments extends $pb.GeneratedMessage { [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - static const $core.Map<$core.int, Arguments_Kind> _Arguments_KindByTag = { - 1: Arguments_Kind.constArguments, - 2: Arguments_Kind.nonConstArguments, - 0: Arguments_Kind.notSet - }; static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'Arguments', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), createEmptyInstance: create) - ..oo(0, [1, 2]) ..aOM(1, _omitFieldNames ? '' : 'constArguments', subBuilder: ConstArguments.create) ..aOM(2, _omitFieldNames ? '' : 'nonConstArguments', @@ -201,9 +193,6 @@ class Arguments extends $pb.GeneratedMessage { _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static Arguments? _defaultInstance; - Arguments_Kind whichKind() => _Arguments_KindByTag[$_whichOneof(0)]!; - void clearKind() => clearField($_whichOneof(0)); - @$pb.TagNumber(1) ConstArguments get constArguments => $_getN(0); @$pb.TagNumber(1) @@ -461,16 +450,32 @@ class Field extends $pb.GeneratedMessage { FieldValue ensureValue() => $_ensure(2); } -enum FieldValue_Value { intValue, doubleValue, boolValue, stringValue, notSet } +enum FieldValue_Value { + map, + list, + intValue, + doubleValue, + boolValue, + stringValue, + notSet +} class FieldValue extends $pb.GeneratedMessage { factory FieldValue({ + StringMapValue? map, + ListValue? list, $core.int? intValue, $core.double? doubleValue, $core.bool? boolValue, $core.String? stringValue, }) { final $result = create(); + if (map != null) { + $result.map = map; + } + if (list != null) { + $result.list = list; + } if (intValue != null) { $result.intValue = intValue; } @@ -494,22 +499,28 @@ class FieldValue extends $pb.GeneratedMessage { create()..mergeFromJson(i, r); static const $core.Map<$core.int, FieldValue_Value> _FieldValue_ValueByTag = { - 1: FieldValue_Value.intValue, - 2: FieldValue_Value.doubleValue, - 3: FieldValue_Value.boolValue, - 4: FieldValue_Value.stringValue, + 1: FieldValue_Value.map, + 2: FieldValue_Value.list, + 3: FieldValue_Value.intValue, + 4: FieldValue_Value.doubleValue, + 5: FieldValue_Value.boolValue, + 6: FieldValue_Value.stringValue, 0: FieldValue_Value.notSet }; static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'FieldValue', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), createEmptyInstance: create) - ..oo(0, [1, 2, 3, 4]) - ..a<$core.int>(1, _omitFieldNames ? '' : 'intValue', $pb.PbFieldType.O3) + ..oo(0, [1, 2, 3, 4, 5, 6]) + ..aOM(1, _omitFieldNames ? '' : 'map', + subBuilder: StringMapValue.create) + ..aOM(2, _omitFieldNames ? '' : 'list', + subBuilder: ListValue.create) + ..a<$core.int>(3, _omitFieldNames ? '' : 'intValue', $pb.PbFieldType.O3) ..a<$core.double>( - 2, _omitFieldNames ? '' : 'doubleValue', $pb.PbFieldType.OD) - ..aOB(3, _omitFieldNames ? '' : 'boolValue') - ..aOS(4, _omitFieldNames ? '' : 'stringValue') + 4, _omitFieldNames ? '' : 'doubleValue', $pb.PbFieldType.OD) + ..aOB(5, _omitFieldNames ? '' : 'boolValue') + ..aOS(6, _omitFieldNames ? '' : 'stringValue') ..hasRequiredFields = false; @$core.Deprecated('Using this can add significant overhead to your binary. ' @@ -537,52 +548,189 @@ class FieldValue extends $pb.GeneratedMessage { void clearValue() => clearField($_whichOneof(0)); @$pb.TagNumber(1) - $core.int get intValue => $_getIZ(0); + StringMapValue get map => $_getN(0); @$pb.TagNumber(1) - set intValue($core.int v) { - $_setSignedInt32(0, v); + set map(StringMapValue v) { + setField(1, v); } @$pb.TagNumber(1) - $core.bool hasIntValue() => $_has(0); + $core.bool hasMap() => $_has(0); + @$pb.TagNumber(1) + void clearMap() => clearField(1); @$pb.TagNumber(1) - void clearIntValue() => clearField(1); + StringMapValue ensureMap() => $_ensure(0); @$pb.TagNumber(2) - $core.double get doubleValue => $_getN(1); + ListValue get list => $_getN(1); @$pb.TagNumber(2) - set doubleValue($core.double v) { - $_setDouble(1, v); + set list(ListValue v) { + setField(2, v); } @$pb.TagNumber(2) - $core.bool hasDoubleValue() => $_has(1); + $core.bool hasList() => $_has(1); + @$pb.TagNumber(2) + void clearList() => clearField(2); @$pb.TagNumber(2) - void clearDoubleValue() => clearField(2); + ListValue ensureList() => $_ensure(1); @$pb.TagNumber(3) - $core.bool get boolValue => $_getBF(2); + $core.int get intValue => $_getIZ(2); @$pb.TagNumber(3) - set boolValue($core.bool v) { - $_setBool(2, v); + set intValue($core.int v) { + $_setSignedInt32(2, v); } @$pb.TagNumber(3) - $core.bool hasBoolValue() => $_has(2); + $core.bool hasIntValue() => $_has(2); @$pb.TagNumber(3) - void clearBoolValue() => clearField(3); + void clearIntValue() => clearField(3); @$pb.TagNumber(4) - $core.String get stringValue => $_getSZ(3); + $core.double get doubleValue => $_getN(3); @$pb.TagNumber(4) - set stringValue($core.String v) { - $_setString(3, v); + set doubleValue($core.double v) { + $_setDouble(3, v); } @$pb.TagNumber(4) - $core.bool hasStringValue() => $_has(3); + $core.bool hasDoubleValue() => $_has(3); @$pb.TagNumber(4) - void clearStringValue() => clearField(4); + void clearDoubleValue() => clearField(4); + + @$pb.TagNumber(5) + $core.bool get boolValue => $_getBF(4); + @$pb.TagNumber(5) + set boolValue($core.bool v) { + $_setBool(4, v); + } + + @$pb.TagNumber(5) + $core.bool hasBoolValue() => $_has(4); + @$pb.TagNumber(5) + void clearBoolValue() => clearField(5); + + @$pb.TagNumber(6) + $core.String get stringValue => $_getSZ(5); + @$pb.TagNumber(6) + set stringValue($core.String v) { + $_setString(5, v); + } + + @$pb.TagNumber(6) + $core.bool hasStringValue() => $_has(5); + @$pb.TagNumber(6) + void clearStringValue() => clearField(6); +} + +class ListValue extends $pb.GeneratedMessage { + factory ListValue({ + $core.Iterable? value, + }) { + final $result = create(); + if (value != null) { + $result.value.addAll(value); + } + return $result; + } + ListValue._() : super(); + factory ListValue.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ListValue.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'ListValue', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), + createEmptyInstance: create) + ..pc(1, _omitFieldNames ? '' : 'value', $pb.PbFieldType.PM, + subBuilder: FieldValue.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ListValue clone() => ListValue()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ListValue copyWith(void Function(ListValue) updates) => + super.copyWith((message) => updates(message as ListValue)) as ListValue; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ListValue create() => ListValue._(); + ListValue createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ListValue getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ListValue? _defaultInstance; + + @$pb.TagNumber(1) + $core.List get value => $_getList(0); +} + +class StringMapValue extends $pb.GeneratedMessage { + factory StringMapValue({ + $core.Map<$core.String, FieldValue>? value, + }) { + final $result = create(); + if (value != null) { + $result.value.addAll(value); + } + return $result; + } + StringMapValue._() : super(); + factory StringMapValue.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory StringMapValue.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'StringMapValue', + package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), + createEmptyInstance: create) + ..m<$core.String, FieldValue>(1, _omitFieldNames ? '' : 'value', + entryClassName: 'StringMapValue.ValueEntry', + keyFieldType: $pb.PbFieldType.OS, + valueFieldType: $pb.PbFieldType.OM, + valueCreator: FieldValue.create, + valueDefaultOrMaker: FieldValue.getDefault, + packageName: const $pb.PackageName('usages_shared')) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + StringMapValue clone() => StringMapValue()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + StringMapValue copyWith(void Function(StringMapValue) updates) => + super.copyWith((message) => updates(message as StringMapValue)) + as StringMapValue; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static StringMapValue create() => StringMapValue._(); + StringMapValue createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static StringMapValue getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static StringMapValue? _defaultInstance; + + @$pb.TagNumber(1) + $core.Map<$core.String, FieldValue> get value => $_getMap(0); } const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); diff --git a/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart b/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart index 4b0149e3..e9691b3c 100644 --- a/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart +++ b/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types, comment_references, lines_longer_than_80_chars +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import @@ -67,7 +67,6 @@ const Arguments$json = { '4': 1, '5': 11, '6': '.usages_shared.ConstArguments', - '9': 0, '10': 'constArguments' }, { @@ -76,21 +75,16 @@ const Arguments$json = { '4': 1, '5': 11, '6': '.usages_shared.NonConstArguments', - '9': 0, '10': 'nonConstArguments' }, ], - '8': [ - {'1': 'kind'}, - ], }; /// Descriptor for `Arguments`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List argumentsDescriptor = $convert.base64Decode( - 'CglBcmd1bWVudHMSSAoPY29uc3RfYXJndW1lbnRzGAEgASgLMh0udXNhZ2VzX3NoYXJlZC5Db2' - '5zdEFyZ3VtZW50c0gAUg5jb25zdEFyZ3VtZW50cxJSChNub25fY29uc3RfYXJndW1lbnRzGAIg' - 'ASgLMiAudXNhZ2VzX3NoYXJlZC5Ob25Db25zdEFyZ3VtZW50c0gAUhFub25Db25zdEFyZ3VtZW' - '50c0IGCgRraW5k'); + 'CglBcmd1bWVudHMSRgoPY29uc3RfYXJndW1lbnRzGAEgASgLMh0udXNhZ2VzX3NoYXJlZC5Db2' + '5zdEFyZ3VtZW50c1IOY29uc3RBcmd1bWVudHMSUAoTbm9uX2NvbnN0X2FyZ3VtZW50cxgCIAEo' + 'CzIgLnVzYWdlc19zaGFyZWQuTm9uQ29uc3RBcmd1bWVudHNSEW5vbkNvbnN0QXJndW1lbnRz'); @$core.Deprecated('Use constArgumentsDescriptor instead') const ConstArguments$json = { @@ -200,10 +194,28 @@ final $typed_data.Uint8List fieldDescriptor = $convert.base64Decode( const FieldValue$json = { '1': 'FieldValue', '2': [ - {'1': 'int_value', '3': 1, '4': 1, '5': 5, '9': 0, '10': 'intValue'}, - {'1': 'double_value', '3': 2, '4': 1, '5': 1, '9': 0, '10': 'doubleValue'}, - {'1': 'bool_value', '3': 3, '4': 1, '5': 8, '9': 0, '10': 'boolValue'}, - {'1': 'string_value', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'stringValue'}, + { + '1': 'map', + '3': 1, + '4': 1, + '5': 11, + '6': '.usages_shared.StringMapValue', + '9': 0, + '10': 'map' + }, + { + '1': 'list', + '3': 2, + '4': 1, + '5': 11, + '6': '.usages_shared.ListValue', + '9': 0, + '10': 'list' + }, + {'1': 'int_value', '3': 3, '4': 1, '5': 5, '9': 0, '10': 'intValue'}, + {'1': 'double_value', '3': 4, '4': 1, '5': 1, '9': 0, '10': 'doubleValue'}, + {'1': 'bool_value', '3': 5, '4': 1, '5': 8, '9': 0, '10': 'boolValue'}, + {'1': 'string_value', '3': 6, '4': 1, '5': 9, '9': 0, '10': 'stringValue'}, ], '8': [ {'1': 'value'}, @@ -212,6 +224,67 @@ const FieldValue$json = { /// Descriptor for `FieldValue`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List fieldValueDescriptor = $convert.base64Decode( - 'CgpGaWVsZFZhbHVlEh0KCWludF92YWx1ZRgBIAEoBUgAUghpbnRWYWx1ZRIjCgxkb3VibGVfdm' - 'FsdWUYAiABKAFIAFILZG91YmxlVmFsdWUSHwoKYm9vbF92YWx1ZRgDIAEoCEgAUglib29sVmFs' - 'dWUSIwoMc3RyaW5nX3ZhbHVlGAQgASgJSABSC3N0cmluZ1ZhbHVlQgcKBXZhbHVl'); + 'CgpGaWVsZFZhbHVlEjEKA21hcBgBIAEoCzIdLnVzYWdlc19zaGFyZWQuU3RyaW5nTWFwVmFsdW' + 'VIAFIDbWFwEi4KBGxpc3QYAiABKAsyGC51c2FnZXNfc2hhcmVkLkxpc3RWYWx1ZUgAUgRsaXN0' + 'Eh0KCWludF92YWx1ZRgDIAEoBUgAUghpbnRWYWx1ZRIjCgxkb3VibGVfdmFsdWUYBCABKAFIAF' + 'ILZG91YmxlVmFsdWUSHwoKYm9vbF92YWx1ZRgFIAEoCEgAUglib29sVmFsdWUSIwoMc3RyaW5n' + 'X3ZhbHVlGAYgASgJSABSC3N0cmluZ1ZhbHVlQgcKBXZhbHVl'); + +@$core.Deprecated('Use listValueDescriptor instead') +const ListValue$json = { + '1': 'ListValue', + '2': [ + { + '1': 'value', + '3': 1, + '4': 3, + '5': 11, + '6': '.usages_shared.FieldValue', + '10': 'value' + }, + ], +}; + +/// Descriptor for `ListValue`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List listValueDescriptor = $convert.base64Decode( + 'CglMaXN0VmFsdWUSLwoFdmFsdWUYASADKAsyGS51c2FnZXNfc2hhcmVkLkZpZWxkVmFsdWVSBX' + 'ZhbHVl'); + +@$core.Deprecated('Use stringMapValueDescriptor instead') +const StringMapValue$json = { + '1': 'StringMapValue', + '2': [ + { + '1': 'value', + '3': 1, + '4': 3, + '5': 11, + '6': '.usages_shared.StringMapValue.ValueEntry', + '10': 'value' + }, + ], + '3': [StringMapValue_ValueEntry$json], +}; + +@$core.Deprecated('Use stringMapValueDescriptor instead') +const StringMapValue_ValueEntry$json = { + '1': 'ValueEntry', + '2': [ + {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, + { + '1': 'value', + '3': 2, + '4': 1, + '5': 11, + '6': '.usages_shared.FieldValue', + '10': 'value' + }, + ], + '7': {'7': true}, +}; + +/// Descriptor for `StringMapValue`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List stringMapValueDescriptor = $convert.base64Decode( + 'Cg5TdHJpbmdNYXBWYWx1ZRI+CgV2YWx1ZRgBIAMoCzIoLnVzYWdlc19zaGFyZWQuU3RyaW5nTW' + 'FwVmFsdWUuVmFsdWVFbnRyeVIFdmFsdWUaUwoKVmFsdWVFbnRyeRIQCgNrZXkYASABKAlSA2tl' + 'eRIvCgV2YWx1ZRgCIAEoCzIZLnVzYWdlc19zaGFyZWQuRmllbGRWYWx1ZVIFdmFsdWU6AjgB'); diff --git a/pkgs/record_use/lib/src/proto/usages_shared.proto b/pkgs/record_use/lib/src/proto/usages_shared.proto index 03a44866..c8b3cc33 100644 --- a/pkgs/record_use/lib/src/proto/usages_shared.proto +++ b/pkgs/record_use/lib/src/proto/usages_shared.proto @@ -11,10 +11,8 @@ message Fields { } message Arguments { - oneof kind { - ConstArguments const_arguments = 1; - NonConstArguments non_const_arguments = 2; - } + ConstArguments const_arguments = 1; + NonConstArguments non_const_arguments = 2; } message ConstArguments { @@ -35,9 +33,19 @@ message Field { message FieldValue { oneof value { - int32 int_value = 1; - double double_value = 2; - bool bool_value = 3; - string string_value = 4; + StringMapValue map = 1; + ListValue list = 2; + int32 int_value = 3; + double double_value = 4; + bool bool_value = 5; + string string_value = 6; } } + +message ListValue { + repeated FieldValue value = 1; +} + +message StringMapValue { + map value = 1; +} diff --git a/pkgs/record_use/test/storage_test.dart b/pkgs/record_use/test/storage_test.dart index 630e5d37..4a3ec099 100644 --- a/pkgs/record_use/test/storage_test.dart +++ b/pkgs/record_use/test/storage_test.dart @@ -12,7 +12,8 @@ import 'testdata/data.dart'; void main() { test('Buffer->Object->Buffer', () { - // File('test/testdata/data.txtpb') + // Uncomment to reset test files + // File('test/testdata/data.json') // .writeAsStringSync(recordedUses.toDebugJson()); // File('test/testdata/data.binpb').writeAsBytesSync(recordedUses.toBuffer()); final recordedUsesPb = File('test/testdata/data.binpb').readAsBytesSync(); diff --git a/pkgs/record_use/test/testdata/data.binpb b/pkgs/record_use/test/testdata/data.binpb index 8dfb96ba32da270bb021f56f0dd25f194833dbf1..f7779a6ad15b0969cbf2dc57581e240838058497 100644 GIT binary patch delta 209 zcmeyz{Dfsg1S8X9#>tV4GWA9rIhjfE!5)r=Tx=YSLQEPAK$=O2NrF*Gh>JBRwJ5(* zh|`EYD>W}WGp|@kn2Rl~C^aPoESQ^Glw4X=Db&aa(ks9xVIahkua{LURmhdZ#mB)Q z#D!uy$W#U{K@JunUM_AfPA=x`)JkihSTa_d6uHH delta 106 zcmaFD@{f5#1S4bJ%%u2W4@W~THV#H1CJ6>0%_PJGWD9Yz=A;(oR|;_| zv1g^`WoPCU3kh?vr4^;7q<{r;Q;U*Iiz{0: 'lib_SHA1', 1: false, 2: 1}, ); - expect(arguments[1].named, isEmpty); - expect(arguments[1].positional, isEmpty); + expect(arguments[1].named, { + 'leroy': 'jenkins', + 'albert': ['camus', 'einstein'] + }); + expect(arguments[1].positional, { + 0: 'lib_SHA1', + 2: 0, + 4: {'key': 99} + }); }); test('API instances', () { final recordedUsesPb = File('test/testdata/data.binpb').readAsBytesSync(); From ce4d997f0dbd50355fbc72e0e99a6a41e3113f90 Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 20 Jun 2024 15:05:38 +0200 Subject: [PATCH 21/23] Remove from analysis --- pkgs/record_use/analysis_options.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/record_use/analysis_options.yaml b/pkgs/record_use/analysis_options.yaml index 77a5e838..8b87070d 100644 --- a/pkgs/record_use/analysis_options.yaml +++ b/pkgs/record_use/analysis_options.yaml @@ -1,3 +1,7 @@ +analyzer: + exclude: + - lib/src/proto/** + include: package:dart_flutter_team_lints/analysis_options.yaml linter: From 43a934639d9bb6b00e3fc734ed3c47b814e36196 Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 20 Jun 2024 15:06:38 +0200 Subject: [PATCH 22/23] Add headers --- pkgs/record_use/lib/src/proto/usages_read.proto | 4 ++++ pkgs/record_use/lib/src/proto/usages_shared.proto | 4 ++++ pkgs/record_use/lib/src/proto/usages_storage.proto | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/pkgs/record_use/lib/src/proto/usages_read.proto b/pkgs/record_use/lib/src/proto/usages_read.proto index 5e113621..f1c44f88 100644 --- a/pkgs/record_use/lib/src/proto/usages_read.proto +++ b/pkgs/record_use/lib/src/proto/usages_read.proto @@ -1,3 +1,7 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + syntax = "proto3"; package usages; diff --git a/pkgs/record_use/lib/src/proto/usages_shared.proto b/pkgs/record_use/lib/src/proto/usages_shared.proto index c8b3cc33..d0430ae6 100644 --- a/pkgs/record_use/lib/src/proto/usages_shared.proto +++ b/pkgs/record_use/lib/src/proto/usages_shared.proto @@ -1,3 +1,7 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + syntax = "proto3"; package usages_shared; diff --git a/pkgs/record_use/lib/src/proto/usages_storage.proto b/pkgs/record_use/lib/src/proto/usages_storage.proto index bcc90414..8cef7943 100644 --- a/pkgs/record_use/lib/src/proto/usages_storage.proto +++ b/pkgs/record_use/lib/src/proto/usages_storage.proto @@ -1,3 +1,7 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + syntax = "proto3"; package usages; From eb565032a758c265e56d913d2ced6043a094ee7f Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 20 Jun 2024 15:32:35 +0200 Subject: [PATCH 23/23] add null support --- .../lib/src/data_classes/extensions.dart | 8 ++- .../lib/src/proto/usages_shared.pb.dart | 65 ++++++++++++------- .../lib/src/proto/usages_shared.pbjson.dart | 20 +++--- .../lib/src/proto/usages_shared.proto | 5 +- pkgs/record_use/test/testdata/data.dart | 4 +- 5 files changed, 63 insertions(+), 39 deletions(-) diff --git a/pkgs/record_use/lib/src/data_classes/extensions.dart b/pkgs/record_use/lib/src/data_classes/extensions.dart index 0e9d33f3..1264a8c3 100644 --- a/pkgs/record_use/lib/src/data_classes/extensions.dart +++ b/pkgs/record_use/lib/src/data_classes/extensions.dart @@ -133,13 +133,15 @@ extension IdentifierStorageExt on pb_storage.Identifier { extension FieldValueExt on pb_shared.FieldValue { Object toObject() => switch (whichValue()) { - pb_shared.FieldValue_Value.map => - map.value.map((key, value) => MapEntry(key, value.toObject())), - pb_shared.FieldValue_Value.list => list.value.map((e) => e.toObject()), + pb_shared.FieldValue_Value.mapValue => + mapValue.value.map((key, value) => MapEntry(key, value.toObject())), + pb_shared.FieldValue_Value.listValue => + listValue.value.map((e) => e.toObject()), pb_shared.FieldValue_Value.intValue => intValue, pb_shared.FieldValue_Value.doubleValue => doubleValue, pb_shared.FieldValue_Value.boolValue => boolValue, pb_shared.FieldValue_Value.stringValue => stringValue, + pb_shared.FieldValue_Value.nullValue => nullValue, pb_shared.FieldValue_Value.notSet => throw UnimplementedError(), }; } diff --git a/pkgs/record_use/lib/src/proto/usages_shared.pb.dart b/pkgs/record_use/lib/src/proto/usages_shared.pb.dart index f535a362..5961c534 100644 --- a/pkgs/record_use/lib/src/proto/usages_shared.pb.dart +++ b/pkgs/record_use/lib/src/proto/usages_shared.pb.dart @@ -451,30 +451,32 @@ class Field extends $pb.GeneratedMessage { } enum FieldValue_Value { - map, - list, + mapValue, + listValue, intValue, doubleValue, boolValue, stringValue, + nullValue, notSet } class FieldValue extends $pb.GeneratedMessage { factory FieldValue({ - StringMapValue? map, - ListValue? list, + StringMapValue? mapValue, + ListValue? listValue, $core.int? intValue, $core.double? doubleValue, $core.bool? boolValue, $core.String? stringValue, + $core.bool? nullValue, }) { final $result = create(); - if (map != null) { - $result.map = map; + if (mapValue != null) { + $result.mapValue = mapValue; } - if (list != null) { - $result.list = list; + if (listValue != null) { + $result.listValue = listValue; } if (intValue != null) { $result.intValue = intValue; @@ -488,6 +490,9 @@ class FieldValue extends $pb.GeneratedMessage { if (stringValue != null) { $result.stringValue = stringValue; } + if (nullValue != null) { + $result.nullValue = nullValue; + } return $result; } FieldValue._() : super(); @@ -499,28 +504,30 @@ class FieldValue extends $pb.GeneratedMessage { create()..mergeFromJson(i, r); static const $core.Map<$core.int, FieldValue_Value> _FieldValue_ValueByTag = { - 1: FieldValue_Value.map, - 2: FieldValue_Value.list, + 1: FieldValue_Value.mapValue, + 2: FieldValue_Value.listValue, 3: FieldValue_Value.intValue, 4: FieldValue_Value.doubleValue, 5: FieldValue_Value.boolValue, 6: FieldValue_Value.stringValue, + 7: FieldValue_Value.nullValue, 0: FieldValue_Value.notSet }; static final $pb.BuilderInfo _i = $pb.BuilderInfo( _omitMessageNames ? '' : 'FieldValue', package: const $pb.PackageName(_omitMessageNames ? '' : 'usages_shared'), createEmptyInstance: create) - ..oo(0, [1, 2, 3, 4, 5, 6]) - ..aOM(1, _omitFieldNames ? '' : 'map', + ..oo(0, [1, 2, 3, 4, 5, 6, 7]) + ..aOM(1, _omitFieldNames ? '' : 'mapValue', subBuilder: StringMapValue.create) - ..aOM(2, _omitFieldNames ? '' : 'list', + ..aOM(2, _omitFieldNames ? '' : 'listValue', subBuilder: ListValue.create) ..a<$core.int>(3, _omitFieldNames ? '' : 'intValue', $pb.PbFieldType.O3) ..a<$core.double>( 4, _omitFieldNames ? '' : 'doubleValue', $pb.PbFieldType.OD) ..aOB(5, _omitFieldNames ? '' : 'boolValue') ..aOS(6, _omitFieldNames ? '' : 'stringValue') + ..aOB(7, _omitFieldNames ? '' : 'nullValue') ..hasRequiredFields = false; @$core.Deprecated('Using this can add significant overhead to your binary. ' @@ -548,32 +555,32 @@ class FieldValue extends $pb.GeneratedMessage { void clearValue() => clearField($_whichOneof(0)); @$pb.TagNumber(1) - StringMapValue get map => $_getN(0); + StringMapValue get mapValue => $_getN(0); @$pb.TagNumber(1) - set map(StringMapValue v) { + set mapValue(StringMapValue v) { setField(1, v); } @$pb.TagNumber(1) - $core.bool hasMap() => $_has(0); + $core.bool hasMapValue() => $_has(0); @$pb.TagNumber(1) - void clearMap() => clearField(1); + void clearMapValue() => clearField(1); @$pb.TagNumber(1) - StringMapValue ensureMap() => $_ensure(0); + StringMapValue ensureMapValue() => $_ensure(0); @$pb.TagNumber(2) - ListValue get list => $_getN(1); + ListValue get listValue => $_getN(1); @$pb.TagNumber(2) - set list(ListValue v) { + set listValue(ListValue v) { setField(2, v); } @$pb.TagNumber(2) - $core.bool hasList() => $_has(1); + $core.bool hasListValue() => $_has(1); @$pb.TagNumber(2) - void clearList() => clearField(2); + void clearListValue() => clearField(2); @$pb.TagNumber(2) - ListValue ensureList() => $_ensure(1); + ListValue ensureListValue() => $_ensure(1); @$pb.TagNumber(3) $core.int get intValue => $_getIZ(2); @@ -622,6 +629,18 @@ class FieldValue extends $pb.GeneratedMessage { $core.bool hasStringValue() => $_has(5); @$pb.TagNumber(6) void clearStringValue() => clearField(6); + + @$pb.TagNumber(7) + $core.bool get nullValue => $_getBF(6); + @$pb.TagNumber(7) + set nullValue($core.bool v) { + $_setBool(6, v); + } + + @$pb.TagNumber(7) + $core.bool hasNullValue() => $_has(6); + @$pb.TagNumber(7) + void clearNullValue() => clearField(7); } class ListValue extends $pb.GeneratedMessage { diff --git a/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart b/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart index e9691b3c..83601c8e 100644 --- a/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart +++ b/pkgs/record_use/lib/src/proto/usages_shared.pbjson.dart @@ -195,27 +195,28 @@ const FieldValue$json = { '1': 'FieldValue', '2': [ { - '1': 'map', + '1': 'map_value', '3': 1, '4': 1, '5': 11, '6': '.usages_shared.StringMapValue', '9': 0, - '10': 'map' + '10': 'mapValue' }, { - '1': 'list', + '1': 'list_value', '3': 2, '4': 1, '5': 11, '6': '.usages_shared.ListValue', '9': 0, - '10': 'list' + '10': 'listValue' }, {'1': 'int_value', '3': 3, '4': 1, '5': 5, '9': 0, '10': 'intValue'}, {'1': 'double_value', '3': 4, '4': 1, '5': 1, '9': 0, '10': 'doubleValue'}, {'1': 'bool_value', '3': 5, '4': 1, '5': 8, '9': 0, '10': 'boolValue'}, {'1': 'string_value', '3': 6, '4': 1, '5': 9, '9': 0, '10': 'stringValue'}, + {'1': 'null_value', '3': 7, '4': 1, '5': 8, '9': 0, '10': 'nullValue'}, ], '8': [ {'1': 'value'}, @@ -224,11 +225,12 @@ const FieldValue$json = { /// Descriptor for `FieldValue`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List fieldValueDescriptor = $convert.base64Decode( - 'CgpGaWVsZFZhbHVlEjEKA21hcBgBIAEoCzIdLnVzYWdlc19zaGFyZWQuU3RyaW5nTWFwVmFsdW' - 'VIAFIDbWFwEi4KBGxpc3QYAiABKAsyGC51c2FnZXNfc2hhcmVkLkxpc3RWYWx1ZUgAUgRsaXN0' - 'Eh0KCWludF92YWx1ZRgDIAEoBUgAUghpbnRWYWx1ZRIjCgxkb3VibGVfdmFsdWUYBCABKAFIAF' - 'ILZG91YmxlVmFsdWUSHwoKYm9vbF92YWx1ZRgFIAEoCEgAUglib29sVmFsdWUSIwoMc3RyaW5n' - 'X3ZhbHVlGAYgASgJSABSC3N0cmluZ1ZhbHVlQgcKBXZhbHVl'); + 'CgpGaWVsZFZhbHVlEjwKCW1hcF92YWx1ZRgBIAEoCzIdLnVzYWdlc19zaGFyZWQuU3RyaW5nTW' + 'FwVmFsdWVIAFIIbWFwVmFsdWUSOQoKbGlzdF92YWx1ZRgCIAEoCzIYLnVzYWdlc19zaGFyZWQu' + 'TGlzdFZhbHVlSABSCWxpc3RWYWx1ZRIdCglpbnRfdmFsdWUYAyABKAVIAFIIaW50VmFsdWUSIw' + 'oMZG91YmxlX3ZhbHVlGAQgASgBSABSC2RvdWJsZVZhbHVlEh8KCmJvb2xfdmFsdWUYBSABKAhI' + 'AFIJYm9vbFZhbHVlEiMKDHN0cmluZ192YWx1ZRgGIAEoCUgAUgtzdHJpbmdWYWx1ZRIfCgpudW' + 'xsX3ZhbHVlGAcgASgISABSCW51bGxWYWx1ZUIHCgV2YWx1ZQ=='); @$core.Deprecated('Use listValueDescriptor instead') const ListValue$json = { diff --git a/pkgs/record_use/lib/src/proto/usages_shared.proto b/pkgs/record_use/lib/src/proto/usages_shared.proto index d0430ae6..e3284c1a 100644 --- a/pkgs/record_use/lib/src/proto/usages_shared.proto +++ b/pkgs/record_use/lib/src/proto/usages_shared.proto @@ -37,12 +37,13 @@ message Field { message FieldValue { oneof value { - StringMapValue map = 1; - ListValue list = 2; + StringMapValue map_value = 1; + ListValue list_value = 2; int32 int_value = 3; double double_value = 4; bool bool_value = 5; string string_value = 6; + bool null_value = 7; } } diff --git a/pkgs/record_use/test/testdata/data.dart b/pkgs/record_use/test/testdata/data.dart index e3886de4..7d772999 100644 --- a/pkgs/record_use/test/testdata/data.dart +++ b/pkgs/record_use/test/testdata/data.dart @@ -94,7 +94,7 @@ final Usages recordedUses = Usages( 0: FieldValue(stringValue: 'lib_SHA1'), 2: FieldValue(intValue: 0), 4: FieldValue( - map: StringMapValue( + mapValue: StringMapValue( value: { 'key': FieldValue(intValue: 99), }, @@ -104,7 +104,7 @@ final Usages recordedUses = Usages( named: { 'leroy': FieldValue(stringValue: 'jenkins'), 'albert': FieldValue( - list: ListValue( + listValue: ListValue( value: [ FieldValue(stringValue: 'camus'), FieldValue(stringValue: 'einstein'),