| Index: pkg/analyzer/test/src/summary/summary_common.dart
|
| diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
|
| index d3d1bcbc86d8e4b4898c7580391e4116eab0abba..bd6315c27ca6836b736dffa76b0316fdbc478a78 100644
|
| --- a/pkg/analyzer/test/src/summary/summary_common.dart
|
| +++ b/pkg/analyzer/test/src/summary/summary_common.dart
|
| @@ -6129,6 +6129,26 @@ final v = (a.b.c.f = 1);
|
| ]);
|
| }
|
|
|
| + test_expr_assignToRef_postfixDecrement() {
|
| + _assertRefPrefixPostfixIncrementDecrement(
|
| + 'a-- + 2', UnlinkedExprAssignOperator.postfixDecrement);
|
| + }
|
| +
|
| + test_expr_assignToRef_postfixIncrement() {
|
| + _assertRefPrefixPostfixIncrementDecrement(
|
| + 'a++ + 2', UnlinkedExprAssignOperator.postfixIncrement);
|
| + }
|
| +
|
| + test_expr_assignToRef_prefixDecrement() {
|
| + _assertRefPrefixPostfixIncrementDecrement(
|
| + '--a + 2', UnlinkedExprAssignOperator.prefixDecrement);
|
| + }
|
| +
|
| + test_expr_assignToRef_prefixIncrement() {
|
| + _assertRefPrefixPostfixIncrementDecrement(
|
| + '++a + 2', UnlinkedExprAssignOperator.prefixIncrement);
|
| + }
|
| +
|
| test_expr_assignToRef_topLevelVariable() {
|
| if (skipNonConstInitializers) {
|
| return;
|
| @@ -8748,6 +8768,33 @@ final v = $expr;
|
| }
|
|
|
| /**
|
| + * Assert that the [expr] of the form `++a + 2` is serialized with the
|
| + * [expectedAssignmentOperator].
|
| + */
|
| + void _assertRefPrefixPostfixIncrementDecrement(
|
| + String expr, UnlinkedExprAssignOperator expectedAssignmentOperator) {
|
| + if (skipNonConstInitializers) {
|
| + return;
|
| + }
|
| + UnlinkedVariable variable = serializeVariableText('''
|
| +int a = 0;
|
| +final v = $expr;
|
| +''');
|
| + _assertUnlinkedConst(variable.constExpr, operators: [
|
| + UnlinkedConstOperation.assignToRef,
|
| + UnlinkedConstOperation.pushInt,
|
| + UnlinkedConstOperation.add,
|
| + ], assignmentOperators: [
|
| + expectedAssignmentOperator
|
| + ], ints: [
|
| + 2
|
| + ], strings: [], referenceValidators: [
|
| + (EntityRef r) => checkTypeRef(r, null, null, 'a',
|
| + expectedKind: ReferenceKind.topLevelPropertyAccessor)
|
| + ]);
|
| + }
|
| +
|
| + /**
|
| * TODO(scheglov) rename "Const" to "Expr" everywhere
|
| */
|
| void _assertUnlinkedConst(UnlinkedConst constExpr,
|
|
|