| 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 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 } else { | 1868 } else { |
| 1869 cls.allSupertypes = const EmptyLink<Type>(); | 1869 cls.allSupertypes = const EmptyLink<Type>(); |
| 1870 } | 1870 } |
| 1871 } | 1871 } |
| 1872 | 1872 |
| 1873 /** | 1873 /** |
| 1874 * Add a synthetic nullary constructor if there are no other | 1874 * Add a synthetic nullary constructor if there are no other |
| 1875 * constructors. | 1875 * constructors. |
| 1876 */ | 1876 */ |
| 1877 void addDefaultConstructorIfNeeded(ClassElement element) { | 1877 void addDefaultConstructorIfNeeded(ClassElement element) { |
| 1878 if (element.constructors.length != 0) return; | 1878 if (element.hasConstructor) return; |
| 1879 SynthesizedConstructorElement constructor = | 1879 SynthesizedConstructorElement constructor = |
| 1880 new SynthesizedConstructorElement(element); | 1880 new SynthesizedConstructorElement(element); |
| 1881 element.constructors[element.name] = constructor; | 1881 element.addToScope(constructor, compiler); |
| 1882 Type returnType = compiler.types.voidType; | 1882 Type returnType = compiler.types.voidType; |
| 1883 constructor.type = new FunctionType(returnType, const EmptyLink<Type>(), | 1883 constructor.type = new FunctionType(returnType, const EmptyLink<Type>(), |
| 1884 constructor); | 1884 constructor); |
| 1885 constructor.cachedNode = | 1885 constructor.cachedNode = |
| 1886 new FunctionExpression(new Identifier(element.position()), | 1886 new FunctionExpression(new Identifier(element.position()), |
| 1887 new NodeList.empty(), | 1887 new NodeList.empty(), |
| 1888 new Block(new NodeList.empty()), | 1888 new Block(new NodeList.empty()), |
| 1889 null, null, null, null); | 1889 null, null, null, null); |
| 1890 } | 1890 } |
| 1891 | 1891 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2301 TopScope(LibraryElement library) : super(null, library); | 2301 TopScope(LibraryElement library) : super(null, library); |
| 2302 Element lookup(SourceString name) { | 2302 Element lookup(SourceString name) { |
| 2303 return library.find(name); | 2303 return library.find(name); |
| 2304 } | 2304 } |
| 2305 | 2305 |
| 2306 Element add(Element newElement) { | 2306 Element add(Element newElement) { |
| 2307 throw "Cannot add an element in the top scope"; | 2307 throw "Cannot add an element in the top scope"; |
| 2308 } | 2308 } |
| 2309 String toString() => '$element'; | 2309 String toString() => '$element'; |
| 2310 } | 2310 } |
| OLD | NEW |