@@ -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
0 commit comments