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

Unified Diff: lib/compiler/implementation/compile_time_constants.dart

Issue 9930005: Use default values of named arguments when invoking the default super constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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
Index: lib/compiler/implementation/compile_time_constants.dart
diff --git a/lib/compiler/implementation/compile_time_constants.dart b/lib/compiler/implementation/compile_time_constants.dart
index d7cbf87a4afc246991dadaddaa74725ce344c33f..78e3e8ec333a81ccb3d1a0c17c0b6b9b55fbf447 100644
--- a/lib/compiler/implementation/compile_time_constants.dart
+++ b/lib/compiler/implementation/compile_time_constants.dart
@@ -952,6 +952,12 @@ class CompileTimeConstantEvaluator extends AbstractVisitor {
FunctionParameters parameters = target.computeParameters(compiler);
List<Constant> arguments = <Constant>[];
Selector selector = elements.getSelector(send);
+ // For an implicit super call we construct a synthetic send which is not
+ // in the elements.
+ if (selector == null) {
+ assert(send.argumentsNode.isEmpty());
+ selector = Selector.INVOCATION_0;
+ }
Function compileArgument = evaluate;
Function compileConstant = compiler.compileVariable;
@@ -1042,11 +1048,13 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
});
}
- void evaluateSuperOrRedirectSend(FunctionElement targetConstructor,
- List<Constant> targetArguments) {
+ void evaluateSuperOrRedirectSend(Send send,
+ FunctionElement targetConstructor) {
+ List<Constant> arguments =
+ evaluateArgumentsToConstructor(send, targetConstructor);
ConstructorEvaluator evaluator =
new ConstructorEvaluator(targetConstructor, compiler);
- evaluator.evaluateConstructorFieldValues(targetArguments);
+ evaluator.evaluateConstructorFieldValues(arguments);
// Copy over the fieldValues from the super/redirect-constructor.
evaluator.fieldValues.forEach((key, value) => fieldValues[key] = value);
}
@@ -1070,9 +1078,7 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
// A super initializer or constructor redirection.
Send call = link.head;
FunctionElement targetConstructor = elements[call];
- List<Constant> targetArguments =
- evaluateArgumentsToConstructor(call, targetConstructor);
- evaluateSuperOrRedirectSend(targetConstructor, targetArguments);
+ evaluateSuperOrRedirectSend(call, targetConstructor);
foundSuperOrRedirect = true;
} else {
// A field initializer.
@@ -1098,7 +1104,9 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
if (targetConstructor === null) {
compiler.internalError("no default constructor available");
}
- evaluateSuperOrRedirectSend(targetConstructor, const <Constant>[]);
+ NodeList emptyNodeList = new NodeList(nodes: const EmptyLink());
+ Send syntheticSend = new Send(null, null, emptyNodeList);
+ evaluateSuperOrRedirectSend(syntheticSend, targetConstructor);
}
}
}
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/builder.dart » ('j') | lib/compiler/implementation/ssa/builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698