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

Unified Diff: frog/leg/resolver.dart

Issue 9454014: Support named parameters for super initializers and redirections. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use addStaticSendArguments. Created 8 years, 10 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 | frog/leg/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/resolver.dart
diff --git a/frog/leg/resolver.dart b/frog/leg/resolver.dart
index 2f564394d28a2b3aa8c0d88f868f494148560d7e..8cb91fbbc0b405fc103401efe3feb87ca5f80420 100644
--- a/frog/leg/resolver.dart
+++ b/frog/leg/resolver.dart
@@ -369,6 +369,9 @@ class InitializerResolver {
}
if (validTarget) {
+ // Resolve the arguments of the call to get a selector.
ngeoffray 2012/02/24 13:43:01 This is not just for getting a selector, but also
+ visitor.inStaticContext( () => visitor.handleArguments(call) );
+ // Lookup constructor and try to match it to the selector.
ResolverTask resolver = visitor.compiler.resolver;
result = resolver.lookupConstructor(lookupTarget, call);
if (result === null) {
@@ -380,19 +383,14 @@ class InitializerResolver {
error(call, MessageKind.CANNOT_RESOLVE_CONSTRUCTOR, [name]);
} else {
final Compiler compiler = visitor.compiler;
+ Selector selector = visitor.mapping.getSelector(call);
// TODO(karlklose): support optional arguments.
- if (result.parameterCount(compiler) != call.argumentCount()) {
+ if (!selector.applies(compiler, result)) {
error(call, MessageKind.NO_MATCHING_CONSTRUCTOR);
}
}
visitor.useElement(call, result);
}
- // Resolve the arguments of the call.
- for (Link<Node> arguments = call.arguments;
- !arguments.isEmpty();
- arguments = arguments.tail) {
- visitor.visitInStaticContext(arguments.head);
- }
return result;
}
@@ -555,13 +553,17 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
return result;
}
- visitInStaticContext(Node node) {
+ inStaticContext(action()) {
bool wasInstanceContext = inInstanceContext;
inInstanceContext = false;
- visit(node);
+ action();
inInstanceContext = wasInstanceContext;
}
+ visitInStaticContext(Node node) {
+ inStaticContext(() => visit(node));
+ }
+
visitIdentifier(Identifier node) {
if (node.isThis()) {
if (!inInstanceContext) {
« no previous file with comments | « no previous file | frog/leg/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698