| 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; |
| 816 for (Link<Node> link = node.argumentsNode.nodes; | 817 for (Link<Node> link = node.argumentsNode.nodes; |
| 817 !link.isEmpty(); | 818 !link.isEmpty(); |
| 818 link = link.tail) { | 819 link = link.tail) { |
| 819 count++; | 820 count++; |
| 820 Expression argument = link.head; | 821 Expression argument = link.head; |
| 821 visit(argument); | 822 visit(argument); |
| 822 if (argument.asNamedArgument() != null) { | 823 if (argument.asNamedArgument() != null) { |
| 824 seenNamedArgument = true; |
| 823 NamedArgument named = argument; | 825 NamedArgument named = argument; |
| 824 namedArguments.add(named.name.source); | 826 namedArguments.add(named.name.source); |
| 827 } else if (seenNamedArgument) { |
| 828 error(argument, MessageKind.INVALID_ARGUMENT_AFTER_NAMED); |
| 825 } | 829 } |
| 826 } | 830 } |
| 827 mapping.setSelector(node, new Invocation(count, namedArguments)); | 831 mapping.setSelector(node, new Invocation(count, namedArguments)); |
| 828 } | 832 } |
| 829 | 833 |
| 830 visitSend(Send node) { | 834 visitSend(Send node) { |
| 831 Element target = resolveSend(node); | 835 Element target = resolveSend(node); |
| 832 if (node.isOperator) { | 836 if (node.isOperator) { |
| 833 Operator op = node.selector.asOperator(); | 837 Operator op = node.selector.asOperator(); |
| 834 if (op.source.stringValue === 'is') { | 838 if (op.source.stringValue === 'is') { |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1666 class TopScope extends Scope { | 1670 class TopScope extends Scope { |
| 1667 LibraryElement get library() => element; | 1671 LibraryElement get library() => element; |
| 1668 | 1672 |
| 1669 TopScope(LibraryElement library) : super(null, library); | 1673 TopScope(LibraryElement library) : super(null, library); |
| 1670 Element lookup(SourceString name) => library.find(name); | 1674 Element lookup(SourceString name) => library.find(name); |
| 1671 | 1675 |
| 1672 Element add(Element element) { | 1676 Element add(Element element) { |
| 1673 throw "Cannot add an element in the top scope"; | 1677 throw "Cannot add an element in the top scope"; |
| 1674 } | 1678 } |
| 1675 } | 1679 } |
| OLD | NEW |