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

Unified Diff: pkg/analyzer/lib/src/summary/summarize_const_expr.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 | « no previous file | pkg/analyzer/test/src/summary/linker_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/summarize_const_expr.dart
diff --git a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
index 8be5f212041ba4448f2995942f22994aef0115fc..b777506df39cc9e0809fe3f658ebdba22c942be3 100644
--- a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
@@ -217,6 +217,11 @@ abstract class AbstractConstExprSerializer {
}
_serialize(expr.index);
operations.add(UnlinkedConstOperation.assignToIndex);
+ } else if (expr is PrefixedIdentifier) {
+ strings.add(expr.prefix.name);
+ operations.add(UnlinkedConstOperation.pushParameter);
+ strings.add(expr.identifier.name);
+ operations.add(UnlinkedConstOperation.assignToProperty);
} else {
throw new StateError('Unsupported assignable: $expr');
}
@@ -269,6 +274,11 @@ abstract class AbstractConstExprSerializer {
if (expr is SimpleIdentifier && isParameterName(expr.name)) {
strings.add(expr.name);
operations.add(UnlinkedConstOperation.pushParameter);
+ } else if (expr is PrefixedIdentifier && isParameterName(expr.prefix.name)) {
+ strings.add(expr.prefix.name);
+ operations.add(UnlinkedConstOperation.pushParameter);
+ strings.add(expr.identifier.name);
+ operations.add(UnlinkedConstOperation.extractProperty);
} else {
references.add(serializeIdentifier(expr));
operations.add(UnlinkedConstOperation.pushReference);
@@ -599,7 +609,7 @@ abstract class AbstractConstExprSerializer {
/**
* Return `true` if the given [expr] is a sequence of identifiers.
*/
- static bool _isIdentifierSequence(Expression expr) {
+ bool _isIdentifierSequence(Expression expr) {
while (expr != null) {
if (expr is SimpleIdentifier) {
AstNode parent = expr.parent;
@@ -609,6 +619,9 @@ abstract class AbstractConstExprSerializer {
}
return parent.target == null || _isIdentifierSequence(parent.target);
}
+ if (isParameterName(expr.name)) {
+ return false;
+ }
return true;
} else if (expr is PrefixedIdentifier) {
expr = (expr as PrefixedIdentifier).prefix;
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/linker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698