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