mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 11:31:57 +00:00
Shared analysis: update ifCaseElement API to match ifCase.
This change makes the API for the `ifCaseElement` method similar to that of `ifCase`, which should make it easier to write flow analysis unit tests for if-case elements. Bug: https://github.com/dart-lang/sdk/issues/50419 Change-Id: I64c160f3b6df38b0d337f9b8f9c6c9189e9a13ed Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274161 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
759a742c16
commit
3407cdb6ac
|
@ -220,9 +220,9 @@ Statement ifCase(Expression expression, PossiblyGuardedPattern pattern,
|
|||
CollectionElement ifCaseElement(
|
||||
Expression expression,
|
||||
PossiblyGuardedPattern pattern,
|
||||
CollectionElement ifTrue, {
|
||||
CollectionElement ifTrue, [
|
||||
CollectionElement? ifFalse,
|
||||
}) {
|
||||
]) {
|
||||
var location = computeLocation();
|
||||
var guardedPattern = pattern._asGuardedPattern;
|
||||
return new _IfCaseElement(
|
||||
|
|
|
@ -78,7 +78,7 @@ main() {
|
|||
expr('Object'),
|
||||
intLiteral(0).pattern,
|
||||
intLiteral(1).checkContext('int').asCollectionElement,
|
||||
ifFalse: intLiteral(2).checkContext('int').asCollectionElement,
|
||||
intLiteral(2).checkContext('int').asCollectionElement,
|
||||
)
|
||||
.checkIr('if(expression: expr(Object), pattern: '
|
||||
'const(0, matchedType: Object), guard: true, '
|
||||
|
|
Loading…
Reference in a new issue