| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 if (i != 0) args.add(', '); | 204 if (i != 0) args.add(', '); |
| 205 args.add('arg$i'); | 205 args.add('arg$i'); |
| 206 } | 206 } |
| 207 buffer.add(' ($args) {\n'); | 207 buffer.add(' ($args) {\n'); |
| 208 buffer.add(" return this.$noSuchMethodName('$methodName', [$args]);\n"); | 208 buffer.add(" return this.$noSuchMethodName('$methodName', [$args]);\n"); |
| 209 buffer.add('}\n'); | 209 buffer.add('}\n'); |
| 210 } | 210 } |
| 211 | 211 |
| 212 compiler.universe.invokedNames.forEach((SourceString methodName, | 212 compiler.universe.invokedNames.forEach((SourceString methodName, |
| 213 Set<int> arities) { | 213 Set<int> arities) { |
| 214 if (objectClass.lookupLocalMember(methodName) === null) { | 214 if (objectClass.lookupLocalMember(methodName) === null |
| 215 && methodName != Namer.OPERATOR_EQUALS) { |
| 215 for (int arity in arities) { | 216 for (int arity in arities) { |
| 216 String jsName = namer.instanceMethodName(methodName, arity); | 217 String jsName = namer.instanceMethodName(methodName, arity); |
| 217 generateMethod(methodName.stringValue, jsName, arity); | 218 generateMethod(methodName.stringValue, jsName, arity); |
| 218 } | 219 } |
| 219 } | 220 } |
| 220 }); | 221 }); |
| 221 | 222 |
| 222 compiler.universe.invokedGetters.forEach((SourceString getterName) { | 223 compiler.universe.invokedGetters.forEach((SourceString getterName) { |
| 223 String jsName = namer.getterName(getterName); | 224 String jsName = namer.getterName(getterName); |
| 224 generateMethod('get $getterName', jsName, 0); | 225 generateMethod('get $getterName', jsName, 0); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 241 emitStaticFunctions(buffer); | 242 emitStaticFunctions(buffer); |
| 242 emitStaticFinalFieldInitializations(buffer); | 243 emitStaticFinalFieldInitializations(buffer); |
| 243 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); | 244 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); |
| 244 Element main = compiler.universe.find(Compiler.MAIN); | 245 Element main = compiler.universe.find(Compiler.MAIN); |
| 245 buffer.add('${namer.isolateAccess(main)}();\n'); | 246 buffer.add('${namer.isolateAccess(main)}();\n'); |
| 246 compiler.assembledCode = buffer.toString(); | 247 compiler.assembledCode = buffer.toString(); |
| 247 }); | 248 }); |
| 248 return compiler.assembledCode; | 249 return compiler.assembledCode; |
| 249 } | 250 } |
| 250 } | 251 } |
| OLD | NEW |