Index: sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart |
index e3856a964693ed5b2519a9b3a41645cbcd99f84a..277917ee30edae6d7943c39a87f29751ad00f2d2 100644 |
--- a/sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart |
+++ b/sdk/lib/_internal/compiler/implementation/js_emitter/class_emitter.dart |
@@ -80,32 +80,10 @@ class ClassEmitter extends CodeEmitterHelper { |
// [ constructorName, fields, |
// fields.map( |
// (name) => js('this.# = #', [name, name]))])); |
- task.precompiledFunction.add( |
- new jsAst.FunctionDeclaration( |
- new jsAst.VariableDeclaration(constructorName), |
- js('function(#) { #; }', |
- [fields, |
- fields.map((name) => js('this.# = #', [name, name]))]))); |
- // TODO(floitsch): do we actually need the name field? |
- // TODO(floitsch): these should all go through the namer. |
- |
- task.precompiledFunction.add( |
- js.statement(r'''{ |
- #.builtin$cls = #; |
- if (!"name" in #) |
- #.name = #; |
- $desc=$collectedClasses.#; |
- if ($desc instanceof Array) $desc = $desc[1]; |
- #.prototype = $desc; |
- }''', |
- [ constructorName, js.string(constructorName), |
- constructorName, |
- constructorName, js.string(constructorName), |
- constructorName, |
- constructorName |
- ])); |
- |
- task.precompiledConstructorNames.add(js('#', constructorName)); |
+ jsAst.Expression constructorAst = js('function(#) { #; }', |
+ [fields, |
+ fields.map((name) => js('this.# = #', [name, name]))]); |
+ task.emitPrecompiledConstructor(constructorName, constructorAst); |
} |
/// Returns `true` if fields added. |