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

Commit 33c0f62

Browse files
author
Dart CI
committed
Version 2.19.0-223.0.dev
Merge 50ac31f into dev
2 parents 100ad0b + 50ac31f commit 33c0f62

File tree

5 files changed

+30
-56
lines changed

5 files changed

+30
-56
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class CaseHeadInfo<Node extends Object, Expression extends Node> {
1919
/// For a `case` clause, the case pattern. For a `default` clause, `null`.
2020
final Node? pattern;
2121

22-
/// For a `case` clause that has a `when` part, the expression following
22+
/// For a `case` clause that has a guard clause, the expression following
2323
/// `when`. Otherwise `null`.
24-
final Expression? when;
24+
final Expression? guard;
2525

26-
CaseHeadInfo({required this.node, required this.pattern, this.when});
26+
CaseHeadInfo({required this.node, required this.pattern, this.guard});
2727
}
2828

2929
/// Information supplied by the client to [TypeAnalyzer.analyzeSwitchExpression]
@@ -38,7 +38,7 @@ class ExpressionCaseInfo<Node extends Object, Expression extends Node>
3838
ExpressionCaseInfo(
3939
{required super.node,
4040
required super.pattern,
41-
super.when,
41+
super.guard,
4242
required this.body});
4343
}
4444

@@ -334,7 +334,7 @@ mixin TypeAnalyzer<Node extends Object, Statement extends Node,
334334
switchScrutinee: scrutinee,
335335
topPattern: pattern));
336336
// Stack: (Expression, i * ExpressionCase, Pattern)
337-
Expression? guard = caseInfo.when;
337+
Expression? guard = caseInfo.guard;
338338
bool hasGuard = guard != null;
339339
if (hasGuard) {
340340
_checkGuardType(guard, analyzeExpression(guard, boolType));
@@ -410,7 +410,7 @@ mixin TypeAnalyzer<Node extends Object, Statement extends Node,
410410
topPattern: pattern));
411411
// Stack: (Expression, numExecutionPaths * StatementCase,
412412
// numHeads * CaseHead, Pattern),
413-
Expression? guard = head.when;
413+
Expression? guard = head.guard;
414414
bool hasGuard = guard != null;
415415
if (hasGuard) {
416416
_checkGuardType(guard, analyzeExpression(guard, boolType));
@@ -582,7 +582,7 @@ mixin TypeAnalyzer<Node extends Object, Statement extends Node,
582582
void handleCase_afterCaseHeads(Statement node, int caseIndex, int numHeads);
583583

584584
/// Called after visiting a single `case` clause, consisting of a pattern and
585-
/// a `when` condition.
585+
/// an optional guard.
586586
///
587587
/// [node] is the enclosing switch statement or switch expression and
588588
/// [caseIndex] is the index of the `case` clause.
@@ -607,8 +607,8 @@ mixin TypeAnalyzer<Node extends Object, Statement extends Node,
607607
/// Stack effect: pushes (CaseHead).
608608
void handleDefault(Node node, int caseIndex);
609609

610-
/// Called when visiting a `case` that lacks a `when` clause. Since the lack
611-
/// of a `when` clause is semantically equivalent to `when true`, this method
610+
/// Called when visiting a `case` that lacks a guard clause. Since the lack
611+
/// of a guard clause is semantically equivalent to `when true`, this method
612612
/// should behave similarly to visiting the boolean literal `true`.
613613
///
614614
/// [node] is the enclosing switch statement, switch expression, or `if`, and

pkg/_fe_analyzer_shared/test/mini_ast.dart

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,12 @@ class ExpressionCase extends Node
404404
final Pattern? pattern;
405405

406406
@override
407-
final Expression? when;
407+
final Expression? guard;
408408

409409
@override
410410
final Expression body;
411411

412-
ExpressionCase._(this.pattern, this.when, this.body,
412+
ExpressionCase._(this.pattern, this.guard, this.body,
413413
{required super.location})
414414
: super._();
415415

@@ -418,7 +418,7 @@ class ExpressionCase extends Node
418418

419419
String toString() => [
420420
pattern == null ? 'default' : 'case $pattern',
421-
if (when != null) ' when $when',
421+
if (guard != null) ' when $guard',
422422
': $body'
423423
].join('');
424424

@@ -906,8 +906,8 @@ abstract class Pattern extends Node with CaseHead, CaseHeads {
906906

907907
PatternDispatchResult<Node, Expression, Var, Type> visit(Harness h);
908908

909-
CaseHead when(Expression whenExpression) =>
910-
_When(this, whenExpression, location: location);
909+
CaseHead when(Expression guard) =>
910+
_GuardedCaseHead(this, guard, location: location);
911911

912912
String _debugString({required bool needsKeywordOrType});
913913
}
@@ -1741,6 +1741,17 @@ class _ForEach extends Statement {
17411741
}
17421742
}
17431743

1744+
class _GuardedCaseHead extends Node with CaseHead, CaseHeads {
1745+
@override
1746+
final Pattern _pattern;
1747+
1748+
@override
1749+
final Expression _guard;
1750+
1751+
_GuardedCaseHead(this._pattern, this._guard, {required super.location})
1752+
: super._();
1753+
}
1754+
17441755
class _If extends _IfBase {
17451756
final Expression condition;
17461757

@@ -2447,7 +2458,7 @@ class _MiniAstTypeAnalyzer
24472458
return StatementCaseInfo([
24482459
for (var caseHead in case_._caseHeads._caseHeads)
24492460
CaseHeadInfo(
2450-
node: caseHead, pattern: caseHead._pattern, when: caseHead._guard)
2461+
node: caseHead, pattern: caseHead._pattern, guard: caseHead._guard)
24512462
], case_._body.statements, labels: case_._caseHeads._labels);
24522463
}
24532464

@@ -3103,16 +3114,6 @@ class _VariableReference extends LValue {
31033114
}
31043115
}
31053116

3106-
class _When extends Node with CaseHead, CaseHeads {
3107-
@override
3108-
final Pattern _pattern;
3109-
3110-
@override
3111-
final Expression _guard;
3112-
3113-
_When(this._pattern, this._guard, {required super.location}) : super._();
3114-
}
3115-
31163117
class _While extends Statement {
31173118
final Expression condition;
31183119
final Statement body;

runtime/vm/globals.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ const intptr_t kDefaultNewGenSemiMaxSize = (kWordSize <= 4) ? 8 : 16;
113113
#define NOT_IN_PRECOMPILED_RUNTIME(code) code
114114
#endif // defined(DART_PRECOMPILED_RUNTIME)
115115

116-
#if !defined(PRODUCT) || defined(DART_HOST_OS_FUCHSIA) || \
117-
defined(DART_TARGET_OS_FUCHSIA) || defined(DART_TARGET_OS_ANDROID)
116+
#if defined(DART_ENABLE_TIMELINE) || !defined(PRODUCT) || \
117+
defined(DART_HOST_OS_FUCHSIA) || defined(DART_TARGET_OS_FUCHSIA) || \
118+
defined(DART_TARGET_OS_ANDROID)
118119
#define SUPPORT_TIMELINE 1
119120
#endif
120121

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 2
2828
MINOR 19
2929
PATCH 0
30-
PRERELEASE 222
30+
PRERELEASE 223
3131
PRERELEASE_PATCH 0

tools/bots/test_matrix.json

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3200,34 +3200,6 @@
32003200
}
32013201
]
32023202
},
3203-
{
3204-
"builders": [
3205-
"dart-sdk-win"
3206-
],
3207-
"meta": {
3208-
"description": "This configuration is used by the sdk-builders for Windows. It also adds CQ coverage for building on Windows."
3209-
},
3210-
"steps": [
3211-
{
3212-
"name": "build dart",
3213-
"script": "tools/build.py",
3214-
"arguments": [
3215-
"--arch=ia32,x64,arm64",
3216-
"--mode=release",
3217-
"--check-clean",
3218-
"create_sdk",
3219-
"runtime"
3220-
]
3221-
},
3222-
{
3223-
"name": "upload sdk",
3224-
"script": "tools/bots/dart_sdk.py",
3225-
"arguments": [
3226-
"--arch=ia32,x64,arm64"
3227-
]
3228-
}
3229-
]
3230-
},
32313203
{
32323204
"builders": [
32333205
"debianpackage-linux"

0 commit comments

Comments
 (0)