| OLD | NEW |
| 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 interface TreeElements { | 5 interface TreeElements { |
| 6 Element operator[](Node node); | 6 Element operator[](Node node); |
| 7 Selector getSelector(Send send); | 7 Selector getSelector(Send send); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class TreeElementMapping implements TreeElements { | 10 class TreeElementMapping implements TreeElements { |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 TypeAnnotation node = argument.asTypeAnnotation(); | 806 TypeAnnotation node = argument.asTypeAnnotation(); |
| 807 if (node == null) { | 807 if (node == null) { |
| 808 node = argument.asSend().receiver; | 808 node = argument.asSend().receiver; |
| 809 } | 809 } |
| 810 resolveTypeRequired(node); | 810 resolveTypeRequired(node); |
| 811 } | 811 } |
| 812 | 812 |
| 813 void handleArguments(Send node) { | 813 void handleArguments(Send node) { |
| 814 int count = 0; | 814 int count = 0; |
| 815 List<SourceString> namedArguments = <SourceString>[]; | 815 List<SourceString> namedArguments = <SourceString>[]; |
| 816 bool seenNamedArgument = false; | |
| 817 for (Link<Node> link = node.argumentsNode.nodes; | 816 for (Link<Node> link = node.argumentsNode.nodes; |
| 818 !link.isEmpty(); | 817 !link.isEmpty(); |
| 819 link = link.tail) { | 818 link = link.tail) { |
| 820 count++; | 819 count++; |
| 821 Expression argument = link.head; | 820 Expression argument = link.head; |
| 822 visit(argument); | 821 visit(argument); |
| 823 if (argument.asNamedArgument() != null) { | 822 if (argument.asNamedArgument() != null) { |
| 824 seenNamedArgument = true; | |
| 825 NamedArgument named = argument; | 823 NamedArgument named = argument; |
| 826 namedArguments.add(named.name.source); | 824 namedArguments.add(named.name.source); |
| 827 } else if (seenNamedArgument) { | |
| 828 error(argument, MessageKind.INVALID_ARGUMENT_AFTER_NAMED); | |
| 829 } | 825 } |
| 830 } | 826 } |
| 831 mapping.setSelector(node, new Invocation(count, namedArguments)); | 827 mapping.setSelector(node, new Invocation(count, namedArguments)); |
| 832 } | 828 } |
| 833 | 829 |
| 834 visitSend(Send node) { | 830 visitSend(Send node) { |
| 835 Element target = resolveSend(node); | 831 Element target = resolveSend(node); |
| 836 if (node.isOperator) { | 832 if (node.isOperator) { |
| 837 Operator op = node.selector.asOperator(); | 833 Operator op = node.selector.asOperator(); |
| 838 if (op.source.stringValue === 'is') { | 834 if (op.source.stringValue === 'is') { |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 class TopScope extends Scope { | 1666 class TopScope extends Scope { |
| 1671 LibraryElement get library() => element; | 1667 LibraryElement get library() => element; |
| 1672 | 1668 |
| 1673 TopScope(LibraryElement library) : super(null, library); | 1669 TopScope(LibraryElement library) : super(null, library); |
| 1674 Element lookup(SourceString name) => library.find(name); | 1670 Element lookup(SourceString name) => library.find(name); |
| 1675 | 1671 |
| 1676 Element add(Element element) { | 1672 Element add(Element element) { |
| 1677 throw "Cannot add an element in the top scope"; | 1673 throw "Cannot add an element in the top scope"; |
| 1678 } | 1674 } |
| 1679 } | 1675 } |
| OLD | NEW |