Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1583)

Unified Diff: pkg/analyzer/test/src/summary/summary_common.dart

Issue 2011323002: Fix handling of identifier sequences starting with a function parameter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix an errant test Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/src/summary/linker_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « pkg/analyzer/test/src/summary/linker_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698