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

Unified Diff: frog/leg/resolver.dart

Issue 9301038: Support named arguments for statically resolved calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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 | « frog/leg/namer.dart ('k') | 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
===================================================================
--- frog/leg/resolver.dart (revision 3723)
+++ frog/leg/resolver.dart (working copy)
@@ -591,6 +591,23 @@
}
}
+ void handleArguments(Send node) {
+ int count = 0;
+ List<SourceString> namedArguments = <SourceString>[];
+ for (Link<Node> link = node.argumentsNode.nodes;
+ !link.isEmpty();
+ link = link.tail) {
+ count++;
+ Expression argument = link.head;
+ visit(argument);
+ if (argument.asNamedArgument() != null) {
+ NamedArgument named = argument;
+ namedArguments.add(named.name.source);
+ }
+ }
+ mapping.setSelector(node, new Invocation(count, namedArguments));
+ }
+
visitSend(Send node) {
Element target = resolveSend(node);
if (node.isOperator) {
@@ -611,20 +628,7 @@
} else if (node.isPropertyAccess) {
mapping.setSelector(node, Selector.GETTER);
} else {
- int count = 0;
- List<SourceString> namedArguments = <SourceString>[];
- for (Link<Node> link = node.argumentsNode.nodes;
- !link.isEmpty();
- link = link.tail) {
- count++;
- Expression argument = link.head;
- visit(argument);
- if (argument.asNamedArgument() != null) {
- NamedArgument named = argument;
- namedArguments.add(named.name.source);
- }
- }
- mapping.setSelector(node, new Invocation(count, namedArguments));
+ handleArguments(node);
}
// TODO(ngeoffray): If target is a field, check that there's a
// getter.
@@ -719,8 +723,6 @@
node, 'named constructors with type arguments are not implemented');
}
- visit(node.send.argumentsNode);
-
SourceString constructorName;
Node typeName = node.send.selector.asTypeAnnotation().typeName;
if (typeName.asSend() !== null) {
@@ -756,6 +758,7 @@
Node selector = node.send.selector;
error(selector, MessageKind.CANNOT_RESOLVE_TYPE, [selector]);
}
+ handleArguments(node.send);
useElement(node.send, constructor);
return null;
}
« no previous file with comments | « frog/leg/namer.dart ('k') | frog/leg/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698