Index: pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart |
diff --git a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart |
index 8b88326a6a9b0d4d641889a213011a45969d631c..84a097d74249f614acbdd79368c7bd1fcb871123 100644 |
--- a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart |
+++ b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart |
@@ -34,6 +34,12 @@ abstract class AbstractScanner implements Scanner { |
bool scanGenericMethodComments = false; |
/** |
+ * A flag indicating whether the lazy compound assignment operators '&&=' and |
+ * '||=' are enabled. |
+ */ |
+ bool scanLazyAssignmentOperators = false; |
+ |
+ /** |
* The string offset for the next token that will be created. |
* |
* Note that in the [Utf8BytesScanner], [stringOffset] and [scanOffset] values |
@@ -486,11 +492,16 @@ abstract class AbstractScanner implements Scanner { |
} |
int tokenizeBar(int next) { |
- // | || |= |
+ // | || |= ||= |
next = advance(); |
if (identical(next, $BAR)) { |
+ next = advance(); |
+ if (scanLazyAssignmentOperators && identical(next, $EQ)) { |
+ appendPrecedenceToken(TokenType.BAR_BAR_EQ); |
+ return advance(); |
+ } |
appendPrecedenceToken(TokenType.BAR_BAR); |
- return advance(); |
+ return next; |
} else if (identical(next, $EQ)) { |
appendPrecedenceToken(TokenType.BAR_EQ); |
return advance(); |
@@ -501,11 +512,16 @@ abstract class AbstractScanner implements Scanner { |
} |
int tokenizeAmpersand(int next) { |
- // && &= & |
+ // && &= & &&= |
next = advance(); |
if (identical(next, $AMPERSAND)) { |
+ next = advance(); |
+ if (scanLazyAssignmentOperators && identical(next, $EQ)) { |
+ appendPrecedenceToken(TokenType.AMPERSAND_AMPERSAND_EQ); |
+ return advance(); |
+ } |
appendPrecedenceToken(TokenType.AMPERSAND_AMPERSAND); |
- return advance(); |
+ return next; |
} else if (identical(next, $EQ)) { |
appendPrecedenceToken(TokenType.AMPERSAND_EQ); |
return advance(); |