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

Unified Diff: pkg/analyzer/lib/src/summary/summarize_const_expr.dart

Issue 1616023002: Add named arguments support into constant ASTs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/summary_common.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 92220689c6413dbb170f7beebebeae385c1a4837..49c4dc0b91ec2928d978ad745ec34468a0210dd8 100644
--- a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
@@ -188,16 +188,28 @@ abstract class AbstractConstExprSerializer {
void _serializeInstanceCreation(InstanceCreationExpression expr) {
ConstructorName constructor = expr.constructorName;
List<Expression> arguments = expr.argumentList.arguments;
- arguments.forEach(serialize);
+ // Serialize the arguments.
+ List<String> argumentNames = <String>[];
+ arguments.forEach((arg) {
+ if (arg is NamedExpression) {
+ argumentNames.add(arg.name.label.name);
+ serialize(arg.expression);
+ } else {
+ serialize(arg);
+ }
+ });
+ // Add the op-code and numbers of named and positional arguments.
operations.add(UnlinkedConstOperation.invokeConstructor);
+ ints.add(argumentNames.length);
+ strings.addAll(argumentNames);
+ ints.add(arguments.length - argumentNames.length);
+ // Serialize the reference.
references.add(serializeType(constructor.type));
if (constructor.name != null) {
strings.add(constructor.name.name);
} else {
strings.add('');
}
- // TODO(scheglov) named arguments?
- ints.add(arguments.length);
}
void _serializeListLiteral(ListLiteral expr) {
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698