| 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 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1877 } else { | 1877 } else { |
| 1878 cls.allSupertypes = const EmptyLink<Type>(); | 1878 cls.allSupertypes = const EmptyLink<Type>(); |
| 1879 } | 1879 } |
| 1880 } | 1880 } |
| 1881 | 1881 |
| 1882 /** | 1882 /** |
| 1883 * Add a synthetic nullary constructor if there are no other | 1883 * Add a synthetic nullary constructor if there are no other |
| 1884 * constructors. | 1884 * constructors. |
| 1885 */ | 1885 */ |
| 1886 void addDefaultConstructorIfNeeded(ClassElement element) { | 1886 void addDefaultConstructorIfNeeded(ClassElement element) { |
| 1887 if (element.constructors.length != 0) return; | 1887 if (element.hasConstructor) return; |
| 1888 SynthesizedConstructorElement constructor = | 1888 SynthesizedConstructorElement constructor = |
| 1889 new SynthesizedConstructorElement(element); | 1889 new SynthesizedConstructorElement(element); |
| 1890 element.constructors[element.name] = constructor; | 1890 element.addToScope(constructor, compiler); |
| 1891 Type returnType = compiler.types.voidType; | 1891 Type returnType = compiler.types.voidType; |
| 1892 constructor.type = new FunctionType(returnType, const EmptyLink<Type>(), | 1892 constructor.type = new FunctionType(returnType, const EmptyLink<Type>(), |
| 1893 constructor); | 1893 constructor); |
| 1894 constructor.cachedNode = | 1894 constructor.cachedNode = |
| 1895 new FunctionExpression(new Identifier(element.position()), | 1895 new FunctionExpression(new Identifier(element.position()), |
| 1896 new NodeList.empty(), | 1896 new NodeList.empty(), |
| 1897 new Block(new NodeList.empty()), | 1897 new Block(new NodeList.empty()), |
| 1898 null, null, null, null); | 1898 null, null, null, null); |
| 1899 } | 1899 } |
| 1900 | 1900 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2310 TopScope(LibraryElement library) : super(null, library); | 2310 TopScope(LibraryElement library) : super(null, library); |
| 2311 Element lookup(SourceString name) { | 2311 Element lookup(SourceString name) { |
| 2312 return library.find(name); | 2312 return library.find(name); |
| 2313 } | 2313 } |
| 2314 | 2314 |
| 2315 Element add(Element newElement) { | 2315 Element add(Element newElement) { |
| 2316 throw "Cannot add an element in the top scope"; | 2316 throw "Cannot add an element in the top scope"; |
| 2317 } | 2317 } |
| 2318 String toString() => '$element'; | 2318 String toString() => '$element'; |
| 2319 } | 2319 } |
| OLD | NEW |