| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
| 6 * Generates the code for all used classes in the program. Static fields (even | 6 * Generates the code for all used classes in the program. Static fields (even |
| 7 * in classes) are ignored, since they can be treated as non-class elements. | 7 * in classes) are ignored, since they can be treated as non-class elements. |
| 8 * | 8 * |
| 9 * The code for the containing (used) methods must exist in the [:universe:]. | 9 * The code for the containing (used) methods must exist in the [:universe:]. |
| 10 */ | 10 */ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 StringBuffer buffer) { | 42 StringBuffer buffer) { |
| 43 assert(member.isInstanceMember()); | 43 assert(member.isInstanceMember()); |
| 44 if (member.kind === ElementKind.FUNCTION | 44 if (member.kind === ElementKind.FUNCTION |
| 45 || member.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { | 45 || member.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { |
| 46 String codeBlock = compiler.universe.generatedCode[member]; | 46 String codeBlock = compiler.universe.generatedCode[member]; |
| 47 if (codeBlock !== null) { | 47 if (codeBlock !== null) { |
| 48 buffer.add('$prototype.${namer.getName(member)} = $codeBlock;\n'); | 48 buffer.add('$prototype.${namer.getName(member)} = $codeBlock;\n'); |
| 49 } | 49 } |
| 50 codeBlock = compiler.universe.generatedBailoutCode[member]; | 50 codeBlock = compiler.universe.generatedBailoutCode[member]; |
| 51 if (codeBlock !== null) { | 51 if (codeBlock !== null) { |
| 52 String name = namer.getBailoutName(member);; | 52 String name = namer.getBailoutName(member); |
| 53 buffer.add('$prototype.$name = $codeBlock;\n'); | 53 buffer.add('$prototype.$name = $codeBlock;\n'); |
| 54 } | 54 } |
| 55 } else { | 55 } else { |
| 56 // TODO(ngeoffray): Have another class generate the code for the | 56 // TODO(ngeoffray): Have another class generate the code for the |
| 57 // fields. | 57 // fields. |
| 58 assert(member.kind === ElementKind.FIELD); | 58 assert(member.kind === ElementKind.FIELD); |
| 59 String setterName = namer.setterName(member.name); | 59 String setterName = namer.setterName(member.name); |
| 60 String getterName = namer.getterName(member.name); | 60 String getterName = namer.getterName(member.name); |
| 61 if (compiler.universe.invokedNames.contains(setterName)) { | 61 if (compiler.universe.invokedNames.contains(setterName)) { |
| 62 buffer.add('$prototype.$setterName = function(v){\n' + | 62 buffer.add('$prototype.$setterName = function(v){\n' + |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 emitClasses(buffer); | 192 emitClasses(buffer); |
| 193 emitStaticFunctions(buffer); | 193 emitStaticFunctions(buffer); |
| 194 emitStaticFinalFieldInitializations(buffer); | 194 emitStaticFinalFieldInitializations(buffer); |
| 195 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); | 195 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); |
| 196 buffer.add('${namer.CURRENT_ISOLATE}.main();\n'); | 196 buffer.add('${namer.CURRENT_ISOLATE}.main();\n'); |
| 197 compiler.assembledCode = buffer.toString(); | 197 compiler.assembledCode = buffer.toString(); |
| 198 }); | 198 }); |
| 199 return compiler.assembledCode; | 199 return compiler.assembledCode; |
| 200 } | 200 } |
| 201 } | 201 } |
| OLD | NEW |