| 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 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 assert(cls === compiler.objectClass); | 1898 assert(cls === compiler.objectClass); |
| 1899 cls.allSupertypes = const EmptyLink<Type>(); | 1899 cls.allSupertypes = const EmptyLink<Type>(); |
| 1900 } | 1900 } |
| 1901 } | 1901 } |
| 1902 | 1902 |
| 1903 /** | 1903 /** |
| 1904 * Add a synthetic nullary constructor if there are no other | 1904 * Add a synthetic nullary constructor if there are no other |
| 1905 * constructors. | 1905 * constructors. |
| 1906 */ | 1906 */ |
| 1907 void addDefaultConstructorIfNeeded(ClassElement element) { | 1907 void addDefaultConstructorIfNeeded(ClassElement element) { |
| 1908 if (element.constructors.length != 0) return; | 1908 if (element.hasConstructor) return; |
| 1909 SynthesizedConstructorElement constructor = | 1909 SynthesizedConstructorElement constructor = |
| 1910 new SynthesizedConstructorElement(element); | 1910 new SynthesizedConstructorElement(element); |
| 1911 element.constructors[element.name] = constructor; | 1911 element.addToScope(constructor, compiler); |
| 1912 Type returnType = compiler.types.voidType; | 1912 Type returnType = compiler.types.voidType; |
| 1913 constructor.type = new FunctionType(returnType, const EmptyLink<Type>(), | 1913 constructor.type = new FunctionType(returnType, const EmptyLink<Type>(), |
| 1914 constructor); | 1914 constructor); |
| 1915 constructor.cachedNode = | 1915 constructor.cachedNode = |
| 1916 new FunctionExpression(new Identifier(element.position()), | 1916 new FunctionExpression(new Identifier(element.position()), |
| 1917 new NodeList.empty(), | 1917 new NodeList.empty(), |
| 1918 new Block(new NodeList.empty()), | 1918 new Block(new NodeList.empty()), |
| 1919 null, null, null, null); | 1919 null, null, null, null); |
| 1920 } | 1920 } |
| 1921 | 1921 |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2401 TopScope(LibraryElement library) : super(null, library); | 2401 TopScope(LibraryElement library) : super(null, library); |
| 2402 Element lookup(SourceString name) { | 2402 Element lookup(SourceString name) { |
| 2403 return library.find(name); | 2403 return library.find(name); |
| 2404 } | 2404 } |
| 2405 | 2405 |
| 2406 Element add(Element newElement) { | 2406 Element add(Element newElement) { |
| 2407 throw "Cannot add an element in the top scope"; | 2407 throw "Cannot add an element in the top scope"; |
| 2408 } | 2408 } |
| 2409 String toString() => '$element'; | 2409 String toString() => '$element'; |
| 2410 } | 2410 } |
| OLD | NEW |