| Index: pkg/compiler/lib/src/resolution/operators.dart
|
| diff --git a/pkg/compiler/lib/src/resolution/operators.dart b/pkg/compiler/lib/src/resolution/operators.dart
|
| index e862c30e89d48e06c9562cbbe912bc9cf7e8b839..e903b10281c4876d4a240820099430f8b25c9f5d 100644
|
| --- a/pkg/compiler/lib/src/resolution/operators.dart
|
| +++ b/pkg/compiler/lib/src/resolution/operators.dart
|
| @@ -66,6 +66,7 @@ enum BinaryOperatorKind {
|
| XOR,
|
| LOGICAL_AND,
|
| LOGICAL_OR,
|
| + IF_NULL,
|
| }
|
|
|
| class BinaryOperator {
|
| @@ -161,6 +162,10 @@ class BinaryOperator {
|
| static const BinaryOperator LOGICAL_OR =
|
| const _LogicalOperator(BinaryOperatorKind.LOGICAL_OR, '||');
|
|
|
| + /// The if-null ?? operator.
|
| + static const BinaryOperator IF_NULL =
|
| + const _LogicalOperator(BinaryOperatorKind.IF_NULL, '??');
|
| +
|
| static BinaryOperator parse(String value) {
|
| switch (value) {
|
| case '==': return EQ;
|
| @@ -183,6 +188,7 @@ class BinaryOperator {
|
| case '|': return OR;
|
| case '&&': return LOGICAL_AND;
|
| case '||': return LOGICAL_OR;
|
| + case '??': return IF_NULL;
|
| default: return null;
|
| }
|
| }
|
| @@ -211,6 +217,7 @@ class _LogicalOperator extends BinaryOperator {
|
|
|
| enum AssignmentOperatorKind {
|
| ASSIGN,
|
| + IF_NULL,
|
| ADD,
|
| SUB,
|
| MUL,
|
| @@ -244,6 +251,12 @@ class AssignmentOperator {
|
| const AssignmentOperator._(AssignmentOperatorKind.ASSIGN, '=',
|
| null, isUserDefinable: false);
|
|
|
| + /// The ??= operator.
|
| + static const AssignmentOperator IF_NULL =
|
| + const AssignmentOperator._(AssignmentOperatorKind.IF_NULL, '??=',
|
| + BinaryOperator.IF_NULL,
|
| + isUserDefinable: false);
|
| +
|
| /// The += assignment operator.
|
| static const AssignmentOperator ADD =
|
| const AssignmentOperator._(AssignmentOperatorKind.ADD, '+=',
|
| @@ -302,6 +315,7 @@ class AssignmentOperator {
|
| static AssignmentOperator parse(String value) {
|
| switch (value) {
|
| case '=': return ASSIGN;
|
| + case '??=': return IF_NULL;
|
| case '*=': return MUL;
|
| case '/=': return DIV;
|
| case '%=': return MOD;
|
| @@ -349,4 +363,4 @@ class IncDecOperator {
|
| default: return null;
|
| }
|
| }
|
| -}
|
| +}
|
|
|