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

Commit

Permalink
Version 2.19.0-389.0.dev
Browse files Browse the repository at this point in the history
Merge 4306e07 into dev
  • Loading branch information
Dart CI committed Nov 11, 2022
2 parents 3a02210 + 4306e07 commit 1e37edb
Show file tree
Hide file tree
Showing 53 changed files with 1,414 additions and 606 deletions.
9 changes: 9 additions & 0 deletions WATCHLISTS
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
'^tests/web'
)
},
'dart2wasm': {
'filepath': (
'^pkg/dart2wasm|'
'^pkg/wasm_builder|'
'^sdk/lib/_internal/vm_shared|'
'^sdk/lib/_internal/wasm'
)
},
'dartdevc': {
'filepath': (
'^pkg/dev_compiler|'
Expand Down Expand Up @@ -76,6 +84,7 @@

'WATCHLISTS': {
'dart2js': [ '[email protected]' ],
'dart2wasm': [ '[email protected]' ],
'dartdevc': [ '[email protected]' ],
'experimental_features': [ '[email protected]' ],
'front_end': [ '[email protected]' ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ class NamedType<Type extends Object> {
NamedType(this.name, this.type);
}

/// Information supplied by the client to [TypeAnalyzer.analyzeObjectPattern],
/// [TypeAnalyzer.analyzeRecordPattern], or
/// [TypeAnalyzer.analyzeRecordPatternSchema] about a single field in a record
/// or object pattern.
///
/// The client is free to `implement` or `extend` this class.
class RecordPatternField<Node extends Object, Pattern extends Object> {
/// The client specific node from which this object was created. It can be
/// used for error reporting.
Expand Down
36 changes: 26 additions & 10 deletions pkg/_fe_analyzer_shared/test/mini_ast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ CaseHeads mergedCase(List<CaseHead> cases) => _CaseHeads(cases, const []);

Pattern objectPattern({
required ObjectPatternRequiredType requiredType,
required List<shared.RecordPatternField<Node, Pattern>> fields,
required List<RecordPatternField> fields,
}) {
return _ObjectPattern(
requiredType: requiredType,
Expand All @@ -249,7 +249,7 @@ Pattern objectPattern({
);
}

Pattern recordPattern(List<SharedRecordPatternField> fields) =>
Pattern recordPattern(List<RecordPatternField> fields) =>
_RecordPattern(fields, location: computeLocation());

Pattern relationalPattern(
Expand Down Expand Up @@ -297,8 +297,6 @@ Pattern wildcard(
_VariablePattern(type == null ? null : Type(type), null, expectInferredType,
isFinal: isFinal, location: computeLocation());

typedef SharedRecordPatternField = shared.RecordPatternField<Node, Pattern>;

mixin CaseHead implements CaseHeads, Node {
@override
List<CaseHead> get _caseHeads => [this];
Expand Down Expand Up @@ -1130,6 +1128,14 @@ abstract class Pattern extends Node with CaseHead, CaseHeads {
void preVisit(
PreVisitor visitor, VariableBinder<Node, Var, Type> variableBinder);

RecordPatternField recordField([String? name]) {
return RecordPatternField(
name: name,
pattern: this,
location: computeLocation(),
);
}

@override
String toString() => _debugString(needsKeywordOrType: true);

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

/// TODO(scheglov) This node is used temporary to model 'node'.
class RecordPatternField implements Node {
/// A field in object and record patterns.
class RecordPatternField extends Node
implements shared.RecordPatternField<Node, Pattern> {
final String? name;
final Pattern pattern;

RecordPatternField({
required this.name,
required this.pattern,
required super.location,
}) : super._();

@override
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
Node get node => this;
}

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

class _ObjectPattern extends Pattern {
final ObjectPatternRequiredType requiredType;
final List<SharedRecordPatternField> fields;
final List<RecordPatternField> fields;

_ObjectPattern({
required this.requiredType,
Expand Down Expand Up @@ -3526,7 +3542,7 @@ class _PropertyElement {
}

class _RecordPattern extends Pattern {
final List<SharedRecordPatternField> fields;
final List<RecordPatternField> fields;

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

Expand Down
Loading

0 comments on commit 1e37edb

Please sign in to comment.