| 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 24 matching lines...) Expand all Loading... |
| 35 buffer.add('$inheritsName = '); | 35 buffer.add('$inheritsName = '); |
| 36 buffer.add(INHERIT_FUNCTION); | 36 buffer.add(INHERIT_FUNCTION); |
| 37 buffer.add(';\n'); | 37 buffer.add(';\n'); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void addInstanceMember(Element member, | 40 void addInstanceMember(Element member, |
| 41 String prototype, | 41 String prototype, |
| 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.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 } else { | 50 } else { |
| 51 // TODO(ngeoffray): Have another class generate the code for the | 51 // TODO(ngeoffray): Have another class generate the code for the |
| 52 // fields. | 52 // fields. |
| 53 assert(member.kind === ElementKind.FIELD); | 53 assert(member.kind === ElementKind.FIELD); |
| 54 String setterName = namer.setterName(member.name); | 54 String setterName = namer.setterName(member.name); |
| 55 String getterName = namer.getterName(member.name); | 55 String getterName = namer.getterName(member.name); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 buffer.add(';\n\n'); | 144 buffer.add(';\n\n'); |
| 145 } | 145 } |
| 146 }); | 146 }); |
| 147 buffer.add('var ${namer.currentIsolate} = new ${namer.isolate}();\n'); | 147 buffer.add('var ${namer.currentIsolate} = new ${namer.isolate}();\n'); |
| 148 buffer.add('${namer.currentIsolate}.main();\n'); | 148 buffer.add('${namer.currentIsolate}.main();\n'); |
| 149 compiler.assembledCode = buffer.toString(); | 149 compiler.assembledCode = buffer.toString(); |
| 150 }); | 150 }); |
| 151 return compiler.assembledCode; | 151 return compiler.assembledCode; |
| 152 } | 152 } |
| 153 } | 153 } |
| OLD | NEW |