| 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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 TypeAnnotation node = argument.asTypeAnnotation(); | 798 TypeAnnotation node = argument.asTypeAnnotation(); |
| 799 if (node == null) { | 799 if (node == null) { |
| 800 node = argument.asSend().receiver; | 800 node = argument.asSend().receiver; |
| 801 } | 801 } |
| 802 resolveTypeRequired(node); | 802 resolveTypeRequired(node); |
| 803 } | 803 } |
| 804 | 804 |
| 805 void handleArguments(Send node) { | 805 void handleArguments(Send node) { |
| 806 int count = 0; | 806 int count = 0; |
| 807 List<SourceString> namedArguments = <SourceString>[]; | 807 List<SourceString> namedArguments = <SourceString>[]; |
| 808 bool seenNamedArgument = false; |
| 808 for (Link<Node> link = node.argumentsNode.nodes; | 809 for (Link<Node> link = node.argumentsNode.nodes; |
| 809 !link.isEmpty(); | 810 !link.isEmpty(); |
| 810 link = link.tail) { | 811 link = link.tail) { |
| 811 count++; | 812 count++; |
| 812 Expression argument = link.head; | 813 Expression argument = link.head; |
| 813 visit(argument); | 814 visit(argument); |
| 814 if (argument.asNamedArgument() != null) { | 815 if (argument.asNamedArgument() != null) { |
| 816 seenNamedArgument = true; |
| 815 NamedArgument named = argument; | 817 NamedArgument named = argument; |
| 816 namedArguments.add(named.name.source); | 818 namedArguments.add(named.name.source); |
| 819 } else if (seenNamedArgument) { |
| 820 error(argument, MessageKind.INVALID_ARGUMENT_AFTER_NAMED); |
| 817 } | 821 } |
| 818 } | 822 } |
| 819 mapping.setSelector(node, new Invocation(count, namedArguments)); | 823 mapping.setSelector(node, new Invocation(count, namedArguments)); |
| 820 } | 824 } |
| 821 | 825 |
| 822 visitSend(Send node) { | 826 visitSend(Send node) { |
| 823 Element target = resolveSend(node); | 827 Element target = resolveSend(node); |
| 824 if (node.isOperator) { | 828 if (node.isOperator) { |
| 825 Operator op = node.selector.asOperator(); | 829 Operator op = node.selector.asOperator(); |
| 826 if (op.source.stringValue === 'is') { | 830 if (op.source.stringValue === 'is') { |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 class TopScope extends Scope { | 1660 class TopScope extends Scope { |
| 1657 LibraryElement get library() => element; | 1661 LibraryElement get library() => element; |
| 1658 | 1662 |
| 1659 TopScope(LibraryElement library) : super(null, library); | 1663 TopScope(LibraryElement library) : super(null, library); |
| 1660 Element lookup(SourceString name) => library.find(name); | 1664 Element lookup(SourceString name) => library.find(name); |
| 1661 | 1665 |
| 1662 Element add(Element element) { | 1666 Element add(Element element) { |
| 1663 throw "Cannot add an element in the top scope"; | 1667 throw "Cannot add an element in the top scope"; |
| 1664 } | 1668 } |
| 1665 } | 1669 } |
| OLD | NEW |