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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
| 9 * from the given element. | 9 * from the given element. |
| 10 */ | 10 */ |
| (...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1826 String mixinName = namer.getName(computeMixinClass(classElement)); | 1826 String mixinName = namer.getName(computeMixinClass(classElement)); |
| 1827 superName = '$superName+$mixinName'; | 1827 superName = '$superName+$mixinName'; |
| 1828 needsMixinSupport = true; | 1828 needsMixinSupport = true; |
| 1829 } | 1829 } |
| 1830 | 1830 |
| 1831 ClassBuilder builder = new ClassBuilder(); | 1831 ClassBuilder builder = new ClassBuilder(); |
| 1832 emitClassConstructor(classElement, builder); | 1832 emitClassConstructor(classElement, builder); |
| 1833 emitSuper(superName, builder); | 1833 emitSuper(superName, builder); |
| 1834 emitRuntimeName(runtimeName, builder); | 1834 emitRuntimeName(runtimeName, builder); |
| 1835 emitClassFields(classElement, builder, superName); | 1835 emitClassFields(classElement, builder, superName); |
| 1836 var metadata = buildMetadataFunction(classElement); | |
| 1837 if (metadata != null) { | |
| 1838 builder.addProperty("@", metadata); | |
| 1839 } | |
| 1840 emitClassGettersSetters(classElement, builder); | 1836 emitClassGettersSetters(classElement, builder); |
| 1841 if (!classElement.isMixinApplication) { | 1837 if (!classElement.isMixinApplication) { |
| 1842 emitInstanceMembers(classElement, builder); | 1838 emitInstanceMembers(classElement, builder); |
| 1843 } | 1839 } |
| 1844 emitIsTests(classElement, builder); | 1840 emitIsTests(classElement, builder); |
| 1845 | 1841 |
| 1842 emitClassBuilderWithReflectionData( | |
| 1843 className, classElement, builder, buffer); | |
| 1844 } | |
| 1845 | |
| 1846 void emitClassBuilderWithReflectionData(String className, | |
| 1847 ClassElement classElement, | |
| 1848 ClassBuilder builder, | |
| 1849 CodeBuffer buffer) { | |
| 1850 var metadata = buildMetadataFunction(classElement); | |
| 1851 if (metadata != null) { | |
| 1852 builder.addProperty("@", metadata); | |
| 1853 } | |
| 1854 | |
| 1846 List<CodeBuffer> classBuffers = elementBuffers[classElement]; | 1855 List<CodeBuffer> classBuffers = elementBuffers[classElement]; |
| 1847 if (classBuffers == null) { | 1856 if (classBuffers == null) { |
| 1848 classBuffers = []; | 1857 classBuffers = []; |
| 1849 } else { | 1858 } else { |
| 1850 elementBuffers.remove(classElement); | 1859 elementBuffers.remove(classElement); |
| 1851 } | 1860 } |
| 1852 CodeBuffer statics = new CodeBuffer(); | 1861 CodeBuffer statics = new CodeBuffer(); |
| 1853 statics.write('{$n'); | 1862 statics.write('{$n'); |
| 1854 bool hasStatics = false; | 1863 bool hasStatics = false; |
| 1855 ClassBuilder staticsBuilder = new ClassBuilder(); | 1864 ClassBuilder staticsBuilder = new ClassBuilder(); |
| 1856 if (emitClassFields( | 1865 if (emitClassFields(classElement, staticsBuilder, '', emitStatics: true)) { |
|
ngeoffray
2013/07/19 09:37:40
I don't understand this change.
ahe
2013/07/19 10:00:00
The superclass is irrelevant for the static field
| |
| 1857 classElement, staticsBuilder, superName, emitStatics: true)) { | |
| 1858 hasStatics = true; | 1866 hasStatics = true; |
| 1859 statics.write('"":$_'); | 1867 statics.write('"":$_'); |
| 1860 statics.write( | 1868 statics.write( |
| 1861 jsAst.prettyPrint(staticsBuilder.properties.single.value, compiler)); | 1869 jsAst.prettyPrint(staticsBuilder.properties.single.value, compiler)); |
| 1862 statics.write(',$n'); | 1870 statics.write(',$n'); |
| 1863 } | 1871 } |
| 1864 for (CodeBuffer classBuffer in classBuffers) { | 1872 for (CodeBuffer classBuffer in classBuffers) { |
| 1865 // TODO(ahe): What about deferred? | 1873 // TODO(ahe): What about deferred? |
| 1866 if (classBuffer != null) { | 1874 if (classBuffer != null) { |
| 1867 hasStatics = true; | 1875 hasStatics = true; |
| (...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3894 | 3902 |
| 3895 const String HOOKS_API_USAGE = """ | 3903 const String HOOKS_API_USAGE = """ |
| 3896 // The code supports the following hooks: | 3904 // The code supports the following hooks: |
| 3897 // dartPrint(message) - if this function is defined it is called | 3905 // dartPrint(message) - if this function is defined it is called |
| 3898 // instead of the Dart [print] method. | 3906 // instead of the Dart [print] method. |
| 3899 // dartMainRunner(main) - if this function is defined, the Dart [main] | 3907 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 3900 // method will not be invoked directly. | 3908 // method will not be invoked directly. |
| 3901 // Instead, a closure that will invoke [main] is | 3909 // Instead, a closure that will invoke [main] is |
| 3902 // passed to [dartMainRunner]. | 3910 // passed to [dartMainRunner]. |
| 3903 """; | 3911 """; |
| OLD | NEW |