Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0d0a4b1

Browse files
author
Dart CI
committed
Version 2.18.0-234.0.dev
Merge commit '759bb4ca3127119c18f0a8490fe9e72d9b1a44e6' into 'dev'
2 parents e1e7933 + 759bb4c commit 0d0a4b1

File tree

355 files changed

+16769
-8600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

355 files changed

+16769
-8600
lines changed

DEPS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ vars = {
108108
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
109109
"dart_style_rev": "d7b73536a8079331c888b7da539b80e6825270ea", # manually rev'd
110110

111-
"dartdoc_rev": "58348a98b992ce99b95d23131b67227bdb2b4875",
111+
"dartdoc_rev": "d8195107d3e65e20094bb2ca0a8e8576e3a765bf",
112112
"devtools_rev": "0aa619c42a68d6db4c94a7838121811aba8f5eb1",
113113
"ffi_rev": "18b2b549d55009ff594600b04705ff6161681e07",
114114
"file_rev": "0132eeedea2933513bf230513a766a8baeab0c4f",
@@ -135,7 +135,7 @@ vars = {
135135
"path_rev": "7a0ed40280345b1c11df4c700c71e590738f4257",
136136
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
137137
"pool_rev": "fa84ddd0e39f45bf3f09dcc5d6b9fbdda7820fef",
138-
"protobuf_rev": "58f49c50f93d190adaec213ad500d7de5fe20b2f",
138+
"protobuf_rev": "7ac39080eb886e6eec55983dcba76e855c038701",
139139
"pub_rev": "9bf4289d6fd5d6872a8929d6312bbd7098f3ea9c", # manually rev'd
140140
"pub_semver_rev": "5c0b4bfd5ca57fe16f1319c581dc8c882e9b8cb2",
141141
"root_certificates_rev": "692f6d6488af68e0121317a9c2c9eb393eb0ee50",

benchmarks/Omnibus/dart/Omnibus.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import '../../BigIntParsePrint/dart/BigIntParsePrint.dart'
1515
as lib_BigIntParsePrint;
1616
import '../../ListCopy/dart/ListCopy.dart' as lib_ListCopy;
17+
import '../../MapCopy/dart/MapCopy.dart' as lib_MapCopy;
1718
import '../../MD5/dart/md5.dart' as lib_MD5;
1819
import '../../RuntimeType/dart/RuntimeType.dart' as lib_RuntimeType;
1920
import '../../SHA1/dart/sha1.dart' as lib_SHA1;
@@ -28,8 +29,9 @@ import '../../Utf8Decode/dart/Utf8Decode.dart' as lib_Utf8Decode;
2829
import '../../Utf8Encode/dart/Utf8Encode.dart' as lib_Utf8Encode;
2930

3031
final Map<String, Function()> benchmarks = {
31-
'ListCopy': lib_ListCopy.main,
3232
'BigIntParsePrint': lib_BigIntParsePrint.main,
33+
'ListCopy': lib_ListCopy.main,
34+
'MapCopy': () => lib_MapCopy.main([]),
3335
'MD5': lib_MD5.main,
3436
'RuntimeType': lib_RuntimeType.main,
3537
'SHA1': lib_SHA1.main,

benchmarks/Omnibus/dart2/Omnibus.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import '../../BigIntParsePrint/dart2/BigIntParsePrint.dart'
1717
as lib_BigIntParsePrint;
1818
import '../../ListCopy/dart2/ListCopy.dart' as lib_ListCopy;
19+
import '../../MapCopy/dart2/MapCopy.dart' as lib_MapCopy;
1920
import '../../MD5/dart2/md5.dart' as lib_MD5;
2021
import '../../RuntimeType/dart2/RuntimeType.dart' as lib_RuntimeType;
2122
import '../../SHA1/dart2/sha1.dart' as lib_SHA1;
@@ -30,8 +31,9 @@ import '../../Utf8Decode/dart2/Utf8Decode.dart' as lib_Utf8Decode;
3031
import '../../Utf8Encode/dart2/Utf8Encode.dart' as lib_Utf8Encode;
3132

3233
final Map<String, Function()> benchmarks = {
33-
'ListCopy': lib_ListCopy.main,
3434
'BigIntParsePrint': lib_BigIntParsePrint.main,
35+
'ListCopy': lib_ListCopy.main,
36+
'MapCopy': () => lib_MapCopy.main([]),
3537
'MD5': lib_MD5.main,
3638
'RuntimeType': lib_RuntimeType.main,
3739
'SHA1': lib_SHA1.main,

benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import '../../BigIntParsePrint/dart/BigIntParsePrint.dart'
1515
deferred as lib_BigIntParsePrint;
1616
import '../../ListCopy/dart/ListCopy.dart' deferred as lib_ListCopy;
17+
import '../../MapCopy/dart/MapCopy.dart' deferred as lib_MapCopy;
1718
import '../../MD5/dart/md5.dart' deferred as lib_MD5;
1819
import '../../RuntimeType/dart/RuntimeType.dart' deferred as lib_RuntimeType;
1920
import '../../SHA1/dart/sha1.dart' deferred as lib_SHA1;
@@ -34,13 +35,17 @@ class Lib {
3435
}
3536

3637
final Map<String, Lib> benchmarks = {
38+
'BigIntParsePrint': Lib(
39+
lib_BigIntParsePrint.loadLibrary,
40+
() => lib_BigIntParsePrint.main(),
41+
),
3742
'ListCopy': Lib(
3843
lib_ListCopy.loadLibrary,
3944
() => lib_ListCopy.main(),
4045
),
41-
'BigIntParsePrint': Lib(
42-
lib_BigIntParsePrint.loadLibrary,
43-
() => lib_BigIntParsePrint.main(),
46+
'MapCopy': Lib(
47+
lib_MapCopy.loadLibrary,
48+
() => lib_MapCopy.main([]),
4449
),
4550
'MD5': Lib(
4651
lib_MD5.loadLibrary,

benchmarks/OmnibusDeferred/dart2/OmnibusDeferred.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import '../../BigIntParsePrint/dart2/BigIntParsePrint.dart'
1717
deferred as lib_BigIntParsePrint;
1818
import '../../ListCopy/dart2/ListCopy.dart' deferred as lib_ListCopy;
19+
import '../../MapCopy/dart/MapCopy.dart' deferred as lib_MapCopy;
1920
import '../../MD5/dart2/md5.dart' deferred as lib_MD5;
2021
import '../../RuntimeType/dart2/RuntimeType.dart' deferred as lib_RuntimeType;
2122
import '../../SHA1/dart2/sha1.dart' deferred as lib_SHA1;
@@ -36,13 +37,17 @@ class Lib {
3637
}
3738

3839
final Map<String, Lib> benchmarks = {
40+
'BigIntParsePrint': Lib(
41+
lib_BigIntParsePrint.loadLibrary,
42+
() => lib_BigIntParsePrint.main(),
43+
),
3944
'ListCopy': Lib(
4045
lib_ListCopy.loadLibrary,
4146
() => lib_ListCopy.main(),
4247
),
43-
'BigIntParsePrint': Lib(
44-
lib_BigIntParsePrint.loadLibrary,
45-
() => lib_BigIntParsePrint.main(),
48+
'MapCopy': Lib(
49+
lib_MapCopy.loadLibrary,
50+
() => lib_MapCopy.main([]),
4651
),
4752
'MD5': Lib(
4853
lib_MD5.loadLibrary,

pkg/_fe_analyzer_shared/lib/src/macros/api/builders.dart

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -48,48 +48,62 @@ abstract class TypeResolver {
4848
Future<StaticType> resolve(TypeAnnotationCode type);
4949
}
5050

51-
/// The api used to introspect on a [ClassDeclaration].
51+
/// The api used to introspect on any [TypeDeclaration] which also has the
52+
/// marker interface [IntrospectableType].
5253
///
53-
/// Available in the declaration and definition phases, but limited in the
54-
/// declaration phase to immediately annotated [ClassDeclaration]s. This is
55-
/// done by limiting the access to the [TypeDeclarationResolver] to the
56-
/// definition phase.
57-
abstract class ClassIntrospector {
58-
/// The fields available for [clazz].
54+
/// Available in the declaration and definition phases.
55+
abstract class TypeIntrospector {
56+
/// The fields available for [type].
5957
///
60-
/// This may be incomplete if in the declaration phase and additional macros
61-
/// are going to run on this class.
62-
Future<List<FieldDeclaration>> fieldsOf(covariant ClassDeclaration clazz);
58+
/// This may be incomplete if additional declaration macros are going to run
59+
/// on [type].
60+
Future<List<FieldDeclaration>> fieldsOf(covariant IntrospectableType type);
6361

64-
/// The methods available so far for the current class.
62+
/// The methods available for [type].
6563
///
66-
/// This may be incomplete if additional declaration macros are running on
67-
/// this class.
68-
Future<List<MethodDeclaration>> methodsOf(covariant ClassDeclaration clazz);
64+
/// This may be incomplete if additional declaration macros are going to run
65+
/// on [type].
66+
Future<List<MethodDeclaration>> methodsOf(covariant IntrospectableType type);
6967

70-
/// The constructors available so far for the current class.
68+
/// The constructors available for [type].
7169
///
72-
/// This may be incomplete if additional declaration macros are running on
73-
/// this class.
70+
/// This may be incomplete if additional declaration macros are going to run
71+
/// on [type].
7472
Future<List<ConstructorDeclaration>> constructorsOf(
75-
covariant ClassDeclaration clazz);
76-
77-
/// The class that is directly extended via an `extends` clause.
78-
Future<ClassDeclaration?> superclassOf(covariant ClassDeclaration clazz);
79-
80-
/// All of the classes that are mixed in with `with` clauses.
81-
Future<List<ClassDeclaration>> mixinsOf(covariant ClassDeclaration clazz);
73+
covariant IntrospectableType type);
74+
}
8275

83-
/// All of the classes that are implemented with an `implements` clause.
84-
Future<List<ClassDeclaration>> interfacesOf(covariant ClassDeclaration clazz);
76+
/// The interface used by [Macro]s to resolve any [Identifier]s pointing to
77+
/// types to their type declarations.
78+
///
79+
/// Only available in the declaration and definition phases of macro expansion.
80+
abstract class TypeDeclarationResolver {
81+
/// Resolves an [identifier] to its [TypeDeclaration].
82+
///
83+
/// If [identifier] does not resolve to a [TypeDeclaration], then an
84+
/// [ArgumentError] is thrown.
85+
///
86+
/// In the declaration phase, this will return [IntrospectableType] instances
87+
/// only for those types that are introspectable. Specifically, types are only
88+
/// introspectable of the macro is running on a class declaration, and the
89+
/// type appears in the type hierarchy of that class.
90+
///
91+
/// In the definition phase, this will return [IntrospectableType] instances
92+
/// for all type definitions which can have members (ie: not type aliases).
93+
Future<TypeDeclaration> declarationOf(covariant Identifier identifier);
8594
}
8695

8796
/// The api used by [Macro]s to contribute new (non-type)
8897
/// declarations to the current library.
8998
///
9099
/// Can also be used to do subtype checks on types.
91100
abstract class DeclarationBuilder
92-
implements Builder, IdentifierResolver, TypeResolver, ClassIntrospector {
101+
implements
102+
Builder,
103+
IdentifierResolver,
104+
TypeIntrospector,
105+
TypeDeclarationResolver,
106+
TypeResolver {
93107
/// Adds a new regular declaration to the surrounding library.
94108
///
95109
/// Note that type declarations are not supported.
@@ -102,18 +116,6 @@ abstract class ClassMemberDeclarationBuilder implements DeclarationBuilder {
102116
void declareInClass(DeclarationCode declaration);
103117
}
104118

105-
/// The interface used by [Macro]s to resolve any [Identifier]s pointing to
106-
/// types to their type declarations.
107-
///
108-
/// Only available in the definition phase of macro expansion.
109-
abstract class TypeDeclarationResolver {
110-
/// Resolves an [identifier] to its [TypeDeclaration].
111-
///
112-
/// If [identifier] does resolve to a [TypeDeclaration], then an
113-
/// [ArgumentError] is thrown.
114-
Future<TypeDeclaration> declarationOf(covariant Identifier identifier);
115-
}
116-
117119
/// The interface used by [Macro]s to get the inferred type for an
118120
/// [OmittedTypeAnnotation].
119121
///
@@ -133,10 +135,10 @@ abstract class DefinitionBuilder
133135
implements
134136
Builder,
135137
IdentifierResolver,
136-
TypeResolver,
137-
ClassIntrospector,
138+
TypeIntrospector,
138139
TypeDeclarationResolver,
139-
TypeInferrer {}
140+
TypeInferrer,
141+
TypeResolver {}
140142

141143
/// The apis used by [Macro]s that run on classes, to fill in the definitions
142144
/// of any external declarations within that class.

pkg/_fe_analyzer_shared/lib/src/macros/api/code.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ class ParameterCode implements Code {
103103
}
104104

105105
/// A piece of code representing a type annotation.
106-
abstract class TypeAnnotationCode implements Code {
106+
abstract class TypeAnnotationCode implements Code, TypeAnnotation {
107+
@override
108+
TypeAnnotationCode get code => this;
109+
107110
/// Returns a [TypeAnnotationCode] object which is a non-nullable version
108111
/// of this one.
109112
///
@@ -126,6 +129,9 @@ class NullableTypeAnnotationCode implements TypeAnnotationCode {
126129
/// The underlying type that is being made nullable.
127130
TypeAnnotationCode underlyingType;
128131

132+
@override
133+
TypeAnnotationCode get code => this;
134+
129135
@override
130136
CodeKind get kind => CodeKind.nullableTypeAnnotation;
131137

pkg/_fe_analyzer_shared/lib/src/macros/api/introspection.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ abstract class ParameterizedTypeDeclaration implements TypeDeclaration {
113113
Iterable<TypeParameterDeclaration> get typeParameters;
114114
}
115115

116+
/// A marker interface for the type declarations which are introspectable.
117+
///
118+
/// All type declarations which can have members will have a variant which
119+
/// implements this type.
120+
mixin IntrospectableType implements TypeDeclaration {}
121+
116122
/// Class (and enum) introspection information.
117123
///
118124
/// Information about fields, methods, and constructors must be retrieved from
@@ -125,18 +131,22 @@ abstract class ClassDeclaration implements ParameterizedTypeDeclaration {
125131
bool get isExternal;
126132

127133
/// The `extends` type annotation, if present.
128-
TypeAnnotation? get superclass;
134+
NamedTypeAnnotation? get superclass;
129135

130136
/// All the `implements` type annotations.
131-
Iterable<TypeAnnotation> get interfaces;
137+
Iterable<NamedTypeAnnotation> get interfaces;
132138

133139
/// All the `with` type annotations.
134-
Iterable<TypeAnnotation> get mixins;
140+
Iterable<NamedTypeAnnotation> get mixins;
135141

136142
/// All the type arguments, if applicable.
137143
Iterable<TypeParameterDeclaration> get typeParameters;
138144
}
139145

146+
/// An introspectable class declaration.
147+
abstract class IntrospectableClassDeclaration
148+
implements ClassDeclaration, IntrospectableType {}
149+
140150
/// Type alias introspection information.
141151
abstract class TypeAliasDeclaration implements ParameterizedTypeDeclaration {
142152
/// The type annotation this is an alias for.

pkg/_fe_analyzer_shared/lib/src/macros/api/macros.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ abstract class ClassTypesMacro implements Macro {
6464
/// The interface for [Macro]s that can be applied to any class, and wants to
6565
/// contribute new non-type declarations to the program.
6666
abstract class ClassDeclarationsMacro implements Macro {
67-
FutureOr<void> buildDeclarationsForClass(
68-
ClassDeclaration clazz, ClassMemberDeclarationBuilder builder);
67+
FutureOr<void> buildDeclarationsForClass(IntrospectableClassDeclaration clazz,
68+
ClassMemberDeclarationBuilder builder);
6969
}
7070

7171
/// The interface for [Macro]s that can be applied to any class, and wants to
7272
/// augment the definitions of members on the class.
7373
abstract class ClassDefinitionMacro implements Macro {
7474
FutureOr<void> buildDefinitionForClass(
75-
ClassDeclaration clazz, ClassDefinitionBuilder builder);
75+
IntrospectableClassDeclaration clazz, ClassDefinitionBuilder builder);
7676
}
7777

7878
/// The interface for [Macro]s that can be applied to any field, and wants to

pkg/_fe_analyzer_shared/lib/src/macros/bootstrap.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,18 +263,22 @@ Future<SerializableResponse> _executeDeclarationsPhase(
263263
sendRequest,
264264
remoteInstance: request.identifierResolver,
265265
serializationZoneId: request.serializationZoneId);
266-
var classIntrospector = ClientClassIntrospector(
266+
var typeIntrospector = ClientTypeIntrospector(
267267
sendRequest,
268-
remoteInstance: request.classIntrospector,
268+
remoteInstance: request.typeIntrospector,
269+
serializationZoneId: request.serializationZoneId);
270+
var typeDeclarationResolver = ClientTypeDeclarationResolver(
271+
sendRequest,
272+
remoteInstance: request.typeDeclarationResolver,
269273
serializationZoneId: request.serializationZoneId);
270274
var typeResolver = ClientTypeResolver(
271275
sendRequest,
272276
remoteInstance: request.typeResolver,
273277
serializationZoneId: request.serializationZoneId);
274278
275279
var result = await executeDeclarationsMacro(
276-
instance, request.declaration, identifierResolver, classIntrospector,
277-
typeResolver);
280+
instance, request.declaration, identifierResolver, typeIntrospector,
281+
typeDeclarationResolver, typeResolver);
278282
return new SerializableResponse(
279283
responseType: MessageType.macroExecutionResult,
280284
response: result,
@@ -311,17 +315,17 @@ Future<SerializableResponse> _executeDefinitionsPhase(
311315
sendRequest,
312316
remoteInstance: request.typeDeclarationResolver,
313317
serializationZoneId: request.serializationZoneId);
314-
var classIntrospector = ClientClassIntrospector(
318+
var typeIntrospector = ClientTypeIntrospector(
315319
sendRequest,
316-
remoteInstance: request.classIntrospector,
320+
remoteInstance: request.typeIntrospector,
317321
serializationZoneId: request.serializationZoneId);
318322
var typeInferrer = ClientTypeInferrer(
319323
sendRequest,
320324
remoteInstance: request.typeInferrer,
321325
serializationZoneId: request.serializationZoneId);
322326
323327
var result = await executeDefinitionMacro(
324-
instance, request.declaration, identifierResolver, classIntrospector,
328+
instance, request.declaration, identifierResolver, typeIntrospector,
325329
typeResolver, typeDeclarationResolver, typeInferrer);
326330
return new SerializableResponse(
327331
responseType: MessageType.macroExecutionResult,

0 commit comments

Comments
 (0)