| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 } | 7 } |
| 8 | 8 |
| 9 class TreeElementMapping implements TreeElements { | 9 class TreeElementMapping implements TreeElements { |
| 10 Map<Node, Element> map; | 10 Map<Node, Element> map; |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 } | 801 } |
| 802 for (Link<Node> link = node.interfaces.nodes; | 802 for (Link<Node> link = node.interfaces.nodes; |
| 803 !link.isEmpty(); | 803 !link.isEmpty(); |
| 804 link = link.tail) { | 804 link = link.tail) { |
| 805 element.interfaces = element.interfaces.prepend(visit(link.head)); | 805 element.interfaces = element.interfaces.prepend(visit(link.head)); |
| 806 } | 806 } |
| 807 return element.computeType(compiler); | 807 return element.computeType(compiler); |
| 808 } | 808 } |
| 809 | 809 |
| 810 Type visitTypeAnnotation(TypeAnnotation node) { | 810 Type visitTypeAnnotation(TypeAnnotation node) { |
| 811 Identifier name = node.typeName; | 811 Identifier name = node.typeName.asIdentifier(); |
| 812 if (name === null) { |
| 813 compiler.unimplemented("prefixes", node: node.typeName); |
| 814 } |
| 812 Element element = context.lookup(name.source); | 815 Element element = context.lookup(name.source); |
| 813 if (element === null) { | 816 if (element === null) { |
| 814 compiler.reportError(node, | 817 compiler.reportError(node, |
| 815 new ResolutionError(MessageKind.CANNOT_RESOLVE_TYPE, [name])); | 818 new ResolutionError(MessageKind.CANNOT_RESOLVE_TYPE, [name])); |
| 816 } else if (element.kind !== ElementKind.CLASS) { | 819 } else if (element.kind !== ElementKind.CLASS) { |
| 817 compiler.reportError(node, | 820 compiler.reportError(node, |
| 818 new ResolutionError(MessageKind.NOT_A_TYPE, [name])); | 821 new ResolutionError(MessageKind.NOT_A_TYPE, [name])); |
| 819 } else { | 822 } else { |
| 820 compiler.resolver.toResolve.add(element); | 823 compiler.resolver.toResolve.add(element); |
| 821 // TODO(ngeoffray): Use type variables. | 824 // TODO(ngeoffray): Use type variables. |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 class TopScope extends Scope { | 1002 class TopScope extends Scope { |
| 1000 Universe universe; | 1003 Universe universe; |
| 1001 | 1004 |
| 1002 TopScope(Universe this.universe) : super(null, null); | 1005 TopScope(Universe this.universe) : super(null, null); |
| 1003 Element lookup(SourceString name) => universe.find(name); | 1006 Element lookup(SourceString name) => universe.find(name); |
| 1004 | 1007 |
| 1005 Element add(Element element) { | 1008 Element add(Element element) { |
| 1006 throw "Cannot add an element in the top scope"; | 1009 throw "Cannot add an element in the top scope"; |
| 1007 } | 1010 } |
| 1008 } | 1011 } |
| OLD | NEW |