3660b9ecc7
This reverts commit bc4893a3b3.
The previous attempt failed because when we check if something is a
conditional expression we used a rewriter that didn't actually rewrite.
This further down the line (still checking if we can parse the expression)
results in errors occurring (that wouldn't have occurred if the rewrite
had happened) and the conclusion was thus that it wasn't a conditional
expression and we parsed it as a null-aware index operator (which gave
errors because it wasn't).
This 2nd try solves it by having a rewriter that actually rewrites,
but then allows to undo the rewrites after we're done parsing.
Change-Id: Ide3c0d6a870d4dc18b6d9475b0227d93c733dc7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136624
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
11 lines
156 B
Dart
11 lines
156 B
Dart
f() {
|
|
var a, b, c;
|
|
|
|
a?[b]:c;
|
|
a ? [b] : c;
|
|
a?[b].toString() : c;
|
|
a ? [b].toString() : c;
|
|
|
|
a ? <dynamic>[b] : <dynamic>[c];
|
|
a ? ([b]) : ([c]);
|
|
} |