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 d50f60dfa65d98d01b35fdba61b7a62325bf9d7f..a2329abe1eea8d9dfadaf7bd16a277ff15185493 100644 |
--- a/pkg/analyzer/test/src/summary/summary_common.dart |
+++ b/pkg/analyzer/test/src/summary/summary_common.dart |
@@ -7101,6 +7101,51 @@ final v = ((a, b) => 42)(1, 2); |
operators: [UnlinkedConstOperation.pushParameter], strings: ['x']); |
} |
+ test_expr_inClosure_refersToParam_methodCall() { |
+ if (skipNonConstInitializers) { |
+ return; |
+ } |
+ UnlinkedVariable variable = serializeVariableText('var v = (x) => x.f();'); |
+ _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr, |
+ isValidConst: false, |
+ operators: [ |
+ UnlinkedConstOperation.pushParameter, |
+ UnlinkedConstOperation.invokeMethod |
+ ], |
+ strings: [ |
+ 'x', |
+ 'f' |
+ ], |
+ ints: [ |
+ 0, |
+ 0 |
+ ]); |
+ } |
+ |
+ test_expr_inClosure_refersToParam_methodCall_prefixed() { |
+ if (skipNonConstInitializers) { |
+ return; |
+ } |
+ UnlinkedVariable variable = |
+ serializeVariableText('var v = (x) => x.y.f();'); |
+ _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr, |
+ isValidConst: false, |
+ operators: [ |
+ UnlinkedConstOperation.pushParameter, |
+ UnlinkedConstOperation.extractProperty, |
+ UnlinkedConstOperation.invokeMethod |
+ ], |
+ strings: [ |
+ 'x', |
+ 'y', |
+ 'f' |
+ ], |
+ ints: [ |
+ 0, |
+ 0 |
+ ]); |
+ } |
+ |
test_expr_inClosure_refersToParam_outOfScope() { |
if (skipNonConstInitializers) { |
return; |
@@ -7128,6 +7173,86 @@ final v = ((a, b) => 42)(1, 2); |
]); |
} |
+ test_expr_inClosure_refersToParam_prefixedIdentifier() { |
+ if (skipNonConstInitializers) { |
+ return; |
+ } |
+ UnlinkedVariable variable = serializeVariableText('var v = (x) => x.y;'); |
+ _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr, |
+ operators: [ |
+ UnlinkedConstOperation.pushParameter, |
+ UnlinkedConstOperation.extractProperty |
+ ], |
+ strings: [ |
+ 'x', |
+ 'y' |
+ ]); |
+ } |
+ |
+ test_expr_inClosure_refersToParam_prefixedIdentifier_assign() { |
+ if (skipNonConstInitializers) { |
+ return; |
+ } |
+ UnlinkedVariable variable = |
+ serializeVariableText('var v = (x) => x.y = null;'); |
+ _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr, |
+ isValidConst: false, |
+ operators: [ |
+ UnlinkedConstOperation.pushNull, |
+ UnlinkedConstOperation.pushParameter, |
+ UnlinkedConstOperation.assignToProperty |
+ ], |
+ strings: [ |
+ 'x', |
+ 'y' |
+ ], |
+ assignmentOperators: [ |
+ UnlinkedExprAssignOperator.assign |
+ ]); |
+ } |
+ |
+ test_expr_inClosure_refersToParam_prefixedPrefixedIdentifier() { |
+ if (skipNonConstInitializers) { |
+ return; |
+ } |
+ UnlinkedVariable variable = serializeVariableText('var v = (x) => x.y.z;'); |
+ _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr, |
+ operators: [ |
+ UnlinkedConstOperation.pushParameter, |
+ UnlinkedConstOperation.extractProperty, |
+ UnlinkedConstOperation.extractProperty |
+ ], |
+ strings: [ |
+ 'x', |
+ 'y', |
+ 'z' |
+ ]); |
+ } |
+ |
+ test_expr_inClosure_refersToParam_prefixedPrefixedIdentifier_assign() { |
+ if (skipNonConstInitializers) { |
+ return; |
+ } |
+ UnlinkedVariable variable = |
+ serializeVariableText('var v = (x) => x.y.z = null;'); |
+ _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr, |
+ isValidConst: false, |
+ operators: [ |
+ UnlinkedConstOperation.pushNull, |
+ UnlinkedConstOperation.pushParameter, |
+ UnlinkedConstOperation.extractProperty, |
+ UnlinkedConstOperation.assignToProperty |
+ ], |
+ strings: [ |
+ 'x', |
+ 'y', |
+ 'z' |
+ ], |
+ assignmentOperators: [ |
+ UnlinkedExprAssignOperator.assign |
+ ]); |
+ } |
+ |
test_expr_invokeMethod_instance() { |
if (skipNonConstInitializers) { |
return; |