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

Side by Side Diff: frog/leg/ssa/builder.dart

Issue 9316026: Support named arguments for dynamic calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/leg/namer.dart ('k') | frog/leg/ssa/codegen.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 var left = pop(); 880 var left = pop();
881 visitBinary(left, op, right); 881 visitBinary(left, op, right);
882 } 882 }
883 } 883 }
884 884
885 void addDynamicSendArgumentsToList(Send node, List<HInstruction> list) { 885 void addDynamicSendArgumentsToList(Send node, List<HInstruction> list) {
886 Selector selector = elements.getSelector(node); 886 Selector selector = elements.getSelector(node);
887 if (selector.namedArgumentCount == 0) { 887 if (selector.namedArgumentCount == 0) {
888 addGenericSendArgumentsToList(node.arguments, list); 888 addGenericSendArgumentsToList(node.arguments, list);
889 } else { 889 } else {
890 compiler.cancel( 890 // Visit positional arguments and add them to the list.
891 'Unimplemented named argument for dynamic sends', node: node); 891 Link<Node> arguments = node.arguments;
892 int positionalArgumentCount = selector.positionalArgumentCount;
893 for (int i = 0;
894 i < positionalArgumentCount;
895 arguments = arguments.tail, i++) {
896 visit(arguments.head);
897 list.add(pop());
898 }
899
900 // Visit named arguments and add them into a temporary map.
901 Map<SourceString, HInstruction> instructions =
902 new Map<SourceString, HInstruction>();
903 List<SourceString> namedArguments = selector.namedArguments;
904 int nameIndex = 0;
905 for (; !arguments.isEmpty(); arguments = arguments.tail) {
906 visit(arguments.head);
907 instructions[namedArguments[nameIndex++]] = pop();
908 }
909
910 // Iterate through the named arguments to add them to the list
911 // of instructions, in an order that can be shared with
912 // selectors with the same named arguments.
913 List<SourceString> orderedNames = selector.getOrderedNamedArguments();
914 for (SourceString name in orderedNames) {
915 list.add(instructions[name]);
916 }
892 } 917 }
893 } 918 }
894 919
895 void addStaticSendArgumentsToList(Send node, 920 void addStaticSendArgumentsToList(Send node,
896 FunctionElement element, 921 FunctionElement element,
897 List<HInstruction> list) { 922 List<HInstruction> list) {
898 Selector selector = elements.getSelector(node); 923 Selector selector = elements.getSelector(node);
899 if (!selector.applies(compiler, element)) { 924 if (!selector.applies(compiler, element)) {
900 // TODO(ngeoffray): Match the VM behavior and throw an 925 // TODO(ngeoffray): Match the VM behavior and throw an
901 // exception at runtime. 926 // exception at runtime.
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 } 1527 }
1503 1528
1504 visitCatchBlock(CatchBlock node) { 1529 visitCatchBlock(CatchBlock node) {
1505 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); 1530 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node);
1506 } 1531 }
1507 1532
1508 visitTypedef(Typedef node) { 1533 visitTypedef(Typedef node) {
1509 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); 1534 compiler.unimplemented('SsaBuilder.visitTypedef', node: node);
1510 } 1535 }
1511 } 1536 }
OLDNEW
« no previous file with comments | « frog/leg/namer.dart ('k') | frog/leg/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698