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

Commit 1e37edb

Browse files
author
Dart CI
committed
Version 2.19.0-389.0.dev
Merge 4306e07 into dev
2 parents 3a02210 + 4306e07 commit 1e37edb

File tree

53 files changed

+1414
-606
lines changed

Some content is hidden

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

53 files changed

+1414
-606
lines changed

WATCHLISTS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
'^tests/web'
3535
)
3636
},
37+
'dart2wasm': {
38+
'filepath': (
39+
'^pkg/dart2wasm|'
40+
'^pkg/wasm_builder|'
41+
'^sdk/lib/_internal/vm_shared|'
42+
'^sdk/lib/_internal/wasm'
43+
)
44+
},
3745
'dartdevc': {
3846
'filepath': (
3947
'^pkg/dev_compiler|'
@@ -76,6 +84,7 @@
7684

7785
'WATCHLISTS': {
7886
'dart2js': [ '[email protected]' ],
87+
'dart2wasm': [ '[email protected]' ],
7988
'dartdevc': [ '[email protected]' ],
8089
'experimental_features': [ '[email protected]' ],
8190
'front_end': [ '[email protected]' ],

pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ class NamedType<Type extends Object> {
2929
NamedType(this.name, this.type);
3030
}
3131

32+
/// Information supplied by the client to [TypeAnalyzer.analyzeObjectPattern],
33+
/// [TypeAnalyzer.analyzeRecordPattern], or
34+
/// [TypeAnalyzer.analyzeRecordPatternSchema] about a single field in a record
35+
/// or object pattern.
36+
///
37+
/// The client is free to `implement` or `extend` this class.
3238
class RecordPatternField<Node extends Object, Pattern extends Object> {
3339
/// The client specific node from which this object was created. It can be
3440
/// used for error reporting.

pkg/_fe_analyzer_shared/test/mini_ast.dart

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ CaseHeads mergedCase(List<CaseHead> cases) => _CaseHeads(cases, const []);
240240

241241
Pattern objectPattern({
242242
required ObjectPatternRequiredType requiredType,
243-
required List<shared.RecordPatternField<Node, Pattern>> fields,
243+
required List<RecordPatternField> fields,
244244
}) {
245245
return _ObjectPattern(
246246
requiredType: requiredType,
@@ -249,7 +249,7 @@ Pattern objectPattern({
249249
);
250250
}
251251

252-
Pattern recordPattern(List<SharedRecordPatternField> fields) =>
252+
Pattern recordPattern(List<RecordPatternField> fields) =>
253253
_RecordPattern(fields, location: computeLocation());
254254

255255
Pattern relationalPattern(
@@ -297,8 +297,6 @@ Pattern wildcard(
297297
_VariablePattern(type == null ? null : Type(type), null, expectInferredType,
298298
isFinal: isFinal, location: computeLocation());
299299

300-
typedef SharedRecordPatternField = shared.RecordPatternField<Node, Pattern>;
301-
302300
mixin CaseHead implements CaseHeads, Node {
303301
@override
304302
List<CaseHead> get _caseHeads => [this];
@@ -1130,6 +1128,14 @@ abstract class Pattern extends Node with CaseHead, CaseHeads {
11301128
void preVisit(
11311129
PreVisitor visitor, VariableBinder<Node, Var, Type> variableBinder);
11321130

1131+
RecordPatternField recordField([String? name]) {
1132+
return RecordPatternField(
1133+
name: name,
1134+
pattern: this,
1135+
location: computeLocation(),
1136+
);
1137+
}
1138+
11331139
@override
11341140
String toString() => _debugString(needsKeywordOrType: true);
11351141

@@ -1175,10 +1181,20 @@ abstract class PromotableLValue extends LValue implements Promotable {
11751181
PromotableLValue._({required super.location}) : super._();
11761182
}
11771183

1178-
/// TODO(scheglov) This node is used temporary to model 'node'.
1179-
class RecordPatternField implements Node {
1184+
/// A field in object and record patterns.
1185+
class RecordPatternField extends Node
1186+
implements shared.RecordPatternField<Node, Pattern> {
1187+
final String? name;
1188+
final Pattern pattern;
1189+
1190+
RecordPatternField({
1191+
required this.name,
1192+
required this.pattern,
1193+
required super.location,
1194+
}) : super._();
1195+
11801196
@override
1181-
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
1197+
Node get node => this;
11821198
}
11831199

11841200
/// Representation of a statement in the pseudo-Dart language used for flow
@@ -3216,7 +3232,7 @@ class _MiniAstTypeAnalyzer
32163232
@override
32173233
Type resolveObjectPatternPropertyGet({
32183234
required Type receiverType,
3219-
required SharedRecordPatternField field,
3235+
required shared.RecordPatternField<Node, Pattern> field,
32203236
}) {
32213237
return _harness.getMember(receiverType, field.name!)._type;
32223238
}
@@ -3390,7 +3406,7 @@ class _NullLiteral extends Expression {
33903406

33913407
class _ObjectPattern extends Pattern {
33923408
final ObjectPatternRequiredType requiredType;
3393-
final List<SharedRecordPatternField> fields;
3409+
final List<RecordPatternField> fields;
33943410

33953411
_ObjectPattern({
33963412
required this.requiredType,
@@ -3526,7 +3542,7 @@ class _PropertyElement {
35263542
}
35273543

35283544
class _RecordPattern extends Pattern {
3529-
final List<SharedRecordPatternField> fields;
3545+
final List<RecordPatternField> fields;
35303546

35313547
_RecordPattern(this.fields, {required super.location}) : super._();
35323548

0 commit comments

Comments
 (0)