Skip to content

Commit

Permalink
Version 3.1.0-244.0.dev
Browse files Browse the repository at this point in the history
Merge 5b3f799 into dev
  • Loading branch information
Dart CI committed Jun 23, 2023
2 parents 05d9958 + 5b3f799 commit 7b30bcd
Show file tree
Hide file tree
Showing 60 changed files with 850 additions and 163 deletions.
8 changes: 4 additions & 4 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,17 @@ vars = {
"string_scanner_rev": "6bb314f2176598a5ecc4770a3bbd42626e18b576",
"sync_http_rev": "c3d6ad48ec997c56b7f076bc9f8b4134c4a9225c",
"term_glyph_rev": "4daa34eea4bd6d9780aaeadbf6665af3ebb402fd",
"test_rev": "3d5afedce6fe9643cafbeb89af45ebe9754233c2",
"test_rev": "cdc8178b885e80930d5141ff48daae3af5525ba7",
"test_descriptor_rev": "be7ce0751d85abd1ef605d14d359f499e1ba8fe2",
"test_process_rev": "5ff212250f6cc5f850b26295e7c8123bd5238ea3",
"test_reflective_loader_rev": "40d61b16647cd61b02d806fea46362ef07e7c502",
"tools_rev": "8d6e8b82e3eef8b2f5e3ec9bdd3dd1a2ad3e13f5",
"typed_data_rev": "8d29573ab6fd26a272dc846255eda66a01abae01",
"usage_rev": "6ee09084596f9829371bb836f9d1ca05820f29ea",
"vector_math_rev": "a3aca093bcffdee641dd9ef1f2cf3707cbb843bd",
"vector_math_rev": "c14703830d47818a82ce8a9fcb70029e5e8e6a16",
"watcher_rev": "3f17faa2d09dca3e23bc07a01f2045ec0cd2837d",
"web_socket_channel_rev": "af726526aa3613f5031036eaa64dea47a8428528",
"webdev_rev": "b58edb7d66d2b16c24e7e69e2cf2e9576b9432f1",
"web_socket_channel_rev": "7fb82f2f542400f8ba49546552d6f272fc554694",
"webdev_rev": "6fe17fe80a3580edd41d6d839504c4d90fbce0ea",
"webdriver_rev": "d0f78d004a5ea7bfc8c492639248b0a1b04c1d62",
"webkit_inspection_protocol_rev": "39a3c297ff573635e7936b015ce4f3466e4739d6",
"yaml_rev": "0b9041de94b00bc54e8d38daecfe9075b5623996",
Expand Down
20 changes: 20 additions & 0 deletions pkg/_fe_analyzer_shared/lib/src/macros/api/introspection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ abstract interface class NamedStaticType implements StaticType {}

/// The interface for all declarations.
abstract interface class Declaration {
/// The library in which this declaration is defined.
Library get library;

/// An identifier pointing to this named declaration.
Identifier get identifier;
}
Expand Down Expand Up @@ -346,3 +349,20 @@ abstract interface class RecordFieldDeclaration implements Declaration {
/// The type of this field.
TypeAnnotation get type;
}

/// Introspection information for a Library.
abstract interface class Library {
/// The language version of this library.
LanguageVersion get languageVersion;

/// The uri identifying this library.
Uri get uri;
}

/// The language version of a library, see
/// https://dart.dev/guides/language/evolution#language-version-numbers.
abstract interface class LanguageVersion {
int get major;

int get minor;
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class RecordFieldDeclarationImpl extends DeclarationImpl
RecordFieldDeclarationImpl({
required super.id,
required super.identifier,
required super.library,
required this.name,
required this.type,
});
Expand Down Expand Up @@ -262,13 +263,23 @@ class OmittedTypeAnnotationImpl extends TypeAnnotationImpl

@override
RemoteInstanceKind get kind => RemoteInstanceKind.omittedTypeAnnotation;

@override
void serialize(Serializer serializer) => super.serialize(serializer);
}

abstract class DeclarationImpl extends RemoteInstance implements Declaration {
@override
final IdentifierImpl identifier;

DeclarationImpl({required int id, required this.identifier}) : super(id);
@override
final LibraryImpl library;

DeclarationImpl({
required int id,
required this.identifier,
required this.library,
}) : super(id);

@override
void serialize(Serializer serializer) {
Expand All @@ -277,6 +288,7 @@ abstract class DeclarationImpl extends RemoteInstance implements Declaration {
if (serializationMode.isClient) return;

identifier.serialize(serializer);
library.serialize(serializer);
}
}

Expand All @@ -297,6 +309,7 @@ class ParameterDeclarationImpl extends DeclarationImpl
ParameterDeclarationImpl({
required super.id,
required super.identifier,
required super.library,
required this.isNamed,
required this.isRequired,
required this.type,
Expand Down Expand Up @@ -375,6 +388,7 @@ class TypeParameterDeclarationImpl extends DeclarationImpl
TypeParameterDeclarationImpl({
required super.id,
required super.identifier,
required super.library,
required this.bound,
});

Expand Down Expand Up @@ -432,6 +446,7 @@ class FunctionDeclarationImpl extends DeclarationImpl
FunctionDeclarationImpl({
required super.id,
required super.identifier,
required super.library,
required this.isAbstract,
required this.isExternal,
required this.isGetter,
Expand Down Expand Up @@ -490,6 +505,7 @@ class MethodDeclarationImpl extends FunctionDeclarationImpl
// Declaration fields.
required super.id,
required super.identifier,
required super.library,
// Function fields.
required super.isAbstract,
required super.isExternal,
Expand Down Expand Up @@ -528,6 +544,7 @@ class ConstructorDeclarationImpl extends MethodDeclarationImpl
// Declaration fields.
required super.id,
required super.identifier,
required super.library,
// Function fields.
required super.isAbstract,
required super.isExternal,
Expand Down Expand Up @@ -576,6 +593,7 @@ class VariableDeclarationImpl extends DeclarationImpl
VariableDeclarationImpl({
required super.id,
required super.identifier,
required super.library,
required this.isExternal,
required this.isFinal,
required this.isLate,
Expand Down Expand Up @@ -608,6 +626,7 @@ class FieldDeclarationImpl extends VariableDeclarationImpl
// Declaration fields.
required super.id,
required super.identifier,
required super.library,
// Variable fields.
required super.isExternal,
required super.isFinal,
Expand Down Expand Up @@ -640,6 +659,7 @@ abstract class ParameterizedTypeDeclarationImpl extends DeclarationImpl
ParameterizedTypeDeclarationImpl({
required super.id,
required super.identifier,
required super.library,
required this.typeParameters,
});

Expand All @@ -660,6 +680,7 @@ abstract class ParameterizedTypeDeclarationImpl extends DeclarationImpl
/// TODO: remove this https://github.com/dart-lang/language/issues/3120
mixin _IntrospectableType implements IntrospectableType {}

// ignore: missing_override_of_must_be_overridden
class IntrospectableClassDeclarationImpl = ClassDeclarationImpl
with _IntrospectableType
implements IntrospectableClassDeclaration;
Expand Down Expand Up @@ -705,6 +726,7 @@ class ClassDeclarationImpl extends ParameterizedTypeDeclarationImpl
// Declaration fields.
required super.id,
required super.identifier,
required super.library,
// TypeDeclaration fields.
required super.typeParameters,
// ClassDeclaration fields.
Expand Down Expand Up @@ -751,6 +773,7 @@ class ClassDeclarationImpl extends ParameterizedTypeDeclarationImpl
/// TODO: remove this https://github.com/dart-lang/language/issues/3120
mixin _IntrospectableEnum implements IntrospectableEnum {}

// ignore: missing_override_of_must_be_overridden
class IntrospectableEnumDeclarationImpl = EnumDeclarationImpl
with _IntrospectableEnum
implements IntrospectableEnumDeclaration;
Expand All @@ -772,6 +795,7 @@ class EnumDeclarationImpl extends ParameterizedTypeDeclarationImpl
// Declaration fields.
required super.id,
required super.identifier,
required super.library,
// TypeDeclaration fields.
required super.typeParameters,
// EnumDeclaration fields.
Expand Down Expand Up @@ -810,6 +834,7 @@ class EnumValueDeclarationImpl extends DeclarationImpl
EnumValueDeclarationImpl({
required super.id,
required super.identifier,
required super.library,
required this.definingEnum,
});

Expand All @@ -823,6 +848,7 @@ class EnumValueDeclarationImpl extends DeclarationImpl
}
}

// ignore: missing_override_of_must_be_overridden
class IntrospectableMixinDeclarationImpl = MixinDeclarationImpl
with _IntrospectableType
implements IntrospectableMixinDeclaration;
Expand All @@ -847,6 +873,7 @@ class MixinDeclarationImpl extends ParameterizedTypeDeclarationImpl
// Declaration fields.
required super.id,
required super.identifier,
required super.library,
// TypeDeclaration fields.
required super.typeParameters,
// MixinDeclaration fields.
Expand Down Expand Up @@ -890,6 +917,7 @@ class TypeAliasDeclarationImpl extends ParameterizedTypeDeclarationImpl
// Declaration fields.
required super.id,
required super.identifier,
required super.library,
// TypeDeclaration fields.
required super.typeParameters,
// TypeAlias fields.
Expand All @@ -905,3 +933,44 @@ class TypeAliasDeclarationImpl extends ParameterizedTypeDeclarationImpl
aliasedType.serialize(serializer);
}
}

class LibraryImpl extends RemoteInstance implements Library {
@override
RemoteInstanceKind get kind => RemoteInstanceKind.library;

@override
final LanguageVersionImpl languageVersion;

@override
final Uri uri;

LibraryImpl(
{required int id, required this.languageVersion, required this.uri})
: super(id);

@override
void serialize(Serializer serializer) {
super.serialize(serializer);
languageVersion.serialize(serializer);
serializer.addString(uri.toString());
}
}

/// This class doesn't implement [RemoteInstance] as it is always attached to a
/// [Library] and doesn't need its own kind or ID.
class LanguageVersionImpl implements LanguageVersion, Serializable {
@override
final int major;

@override
final int minor;

LanguageVersionImpl(this.major, this.minor);

@override
void serialize(Serializer serializer) {
serializer
..addInt(major)
..addInt(minor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ abstract class RemoteInstance implements Serializable {
/// They should then return immediately if [serializationMode] is
/// [SerializationMode.client], so that only an ID is sent.
@override
@mustBeOverridden
@mustCallSuper
void serialize(Serializer serializer) {
serializer.addInt(id);
Expand Down Expand Up @@ -86,6 +87,9 @@ class RemoteInstanceImpl extends RemoteInstance {
this.instance,
required this.kind,
}) : super(id);

@override
void serialize(Serializer serializer) => super.serialize(serializer);
}

// The kinds of instances.
Expand All @@ -103,6 +107,7 @@ enum RemoteInstanceKind {
introspectableClassDeclaration,
introspectableEnumDeclaration,
introspectableMixinDeclaration,
library,
methodDeclaration,
mixinDeclaration,
namedStaticType,
Expand Down
Loading

0 comments on commit 7b30bcd

Please sign in to comment.