| 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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 compiler.ensure(element !== null); | 1018 compiler.ensure(element !== null); |
| 1019 compiler.ensure(!element.isResolved); | 1019 compiler.ensure(!element.isResolved); |
| 1020 element.supertype = visit(node.superclass); | 1020 element.supertype = visit(node.superclass); |
| 1021 if (element.name != Types.OBJECT && element.supertype === null) { | 1021 if (element.name != Types.OBJECT && element.supertype === null) { |
| 1022 ClassElement objectElement = context.lookup(Types.OBJECT); | 1022 ClassElement objectElement = context.lookup(Types.OBJECT); |
| 1023 if (objectElement !== null && !objectElement.isResolved) { | 1023 if (objectElement !== null && !objectElement.isResolved) { |
| 1024 compiler.resolver.toResolve.add(objectElement); | 1024 compiler.resolver.toResolve.add(objectElement); |
| 1025 } else if (objectElement === null){ | 1025 } else if (objectElement === null){ |
| 1026 error(node, MessageKind.CANNOT_RESOLVE_TYPE, [Types.OBJECT]); | 1026 error(node, MessageKind.CANNOT_RESOLVE_TYPE, [Types.OBJECT]); |
| 1027 } | 1027 } |
| 1028 element.supertype = new SimpleType(Types.OBJECT, | 1028 element.supertype = new SimpleType(Types.OBJECT, objectElement); |
| 1029 objectElement); | |
| 1030 } | 1029 } |
| 1031 if (node.defaultClause !== null) { | 1030 if (node.defaultClause !== null) { |
| 1032 element.defaultClass = visit(node.defaultClause.nodes.head); | 1031 element.defaultClass = visit(node.defaultClause.nodes.head); |
| 1033 } | 1032 } |
| 1034 for (Link<Node> link = node.interfaces.nodes; | 1033 for (Link<Node> link = node.interfaces.nodes; |
| 1035 !link.isEmpty(); | 1034 !link.isEmpty(); |
| 1036 link = link.tail) { | 1035 link = link.tail) { |
| 1037 element.interfaces = element.interfaces.prepend(visit(link.head)); | 1036 element.interfaces = element.interfaces.prepend(visit(link.head)); |
| 1038 } | 1037 } |
| 1039 return element.computeType(compiler); | 1038 return element.computeType(compiler); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 class TopScope extends Scope { | 1291 class TopScope extends Scope { |
| 1293 LibraryElement get library() => element; | 1292 LibraryElement get library() => element; |
| 1294 | 1293 |
| 1295 TopScope(LibraryElement library) : super(null, library); | 1294 TopScope(LibraryElement library) : super(null, library); |
| 1296 Element lookup(SourceString name) => library.find(name); | 1295 Element lookup(SourceString name) => library.find(name); |
| 1297 | 1296 |
| 1298 Element add(Element element) { | 1297 Element add(Element element) { |
| 1299 throw "Cannot add an element in the top scope"; | 1298 throw "Cannot add an element in the top scope"; |
| 1300 } | 1299 } |
| 1301 } | 1300 } |
| OLD | NEW |