Chromium Code Reviews| 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 Type getType(TypeAnnotation annotation); | 8 Type getType(TypeAnnotation annotation); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1945 return e.computeType(compiler); | 1945 return e.computeType(compiler); |
| 1946 } | 1946 } |
| 1947 | 1947 |
| 1948 void calculateAllSupertypes(ClassElement cls) { | 1948 void calculateAllSupertypes(ClassElement cls) { |
| 1949 // TODO(karlklose): substitute type variables. | 1949 // TODO(karlklose): substitute type variables. |
| 1950 // TODO(karlklose): check if type arguments match, if a classelement occurs | 1950 // TODO(karlklose): check if type arguments match, if a classelement occurs |
| 1951 // more than once in the supertypes. | 1951 // more than once in the supertypes. |
| 1952 if (cls.allSupertypes !== null) return; | 1952 if (cls.allSupertypes !== null) return; |
| 1953 final Type supertype = cls.supertype; | 1953 final Type supertype = cls.supertype; |
| 1954 if (supertype != null) { | 1954 if (supertype != null) { |
| 1955 Link<Type> superSupertypes = supertype.element.allSupertypes; | 1955 ClassElement superelement = supertype.element; |
|
ahe
2012/08/20 15:23:16
superelement -> superElement.
| |
| 1956 Link<Type> superSupertypes = superelement.allSupertypes; | |
| 1956 assert(superSupertypes !== null); | 1957 assert(superSupertypes !== null); |
| 1957 Link<Type> supertypes = new Link<Type>(supertype, superSupertypes); | 1958 Link<Type> supertypes = new Link<Type>(supertype, superSupertypes); |
| 1958 for (Link<Type> interfaces = cls.interfaces; | 1959 for (Link<Type> interfaces = cls.interfaces; |
| 1959 !interfaces.isEmpty(); | 1960 !interfaces.isEmpty(); |
| 1960 interfaces = interfaces.tail) { | 1961 interfaces = interfaces.tail) { |
| 1961 Element element = interfaces.head.element; | 1962 ClassElement element = interfaces.head.element; |
| 1962 Link<Type> interfaceSupertypes = element.allSupertypes; | 1963 Link<Type> interfaceSupertypes = element.allSupertypes; |
| 1963 assert(interfaceSupertypes !== null); | 1964 assert(interfaceSupertypes !== null); |
| 1964 supertypes = supertypes.reversePrependAll(interfaceSupertypes); | 1965 supertypes = supertypes.reversePrependAll(interfaceSupertypes); |
| 1965 supertypes = supertypes.prepend(interfaces.head); | 1966 supertypes = supertypes.prepend(interfaces.head); |
| 1966 } | 1967 } |
| 1967 cls.allSupertypes = supertypes; | 1968 cls.allSupertypes = supertypes; |
| 1968 } else { | 1969 } else { |
| 1969 assert(cls === compiler.objectClass); | 1970 assert(cls === compiler.objectClass); |
| 1970 cls.allSupertypes = const EmptyLink<Type>(); | 1971 cls.allSupertypes = const EmptyLink<Type>(); |
| 1971 } | 1972 } |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2472 TopScope(LibraryElement library) : super(null, library); | 2473 TopScope(LibraryElement library) : super(null, library); |
| 2473 Element lookup(SourceString name) { | 2474 Element lookup(SourceString name) { |
| 2474 return library.find(name); | 2475 return library.find(name); |
| 2475 } | 2476 } |
| 2476 | 2477 |
| 2477 Element add(Element newElement) { | 2478 Element add(Element newElement) { |
| 2478 throw "Cannot add an element in the top scope"; | 2479 throw "Cannot add an element in the top scope"; |
| 2479 } | 2480 } |
| 2480 String toString() => '$element'; | 2481 String toString() => '$element'; |
| 2481 } | 2482 } |
| OLD | NEW |