Index: pkg/compiler/lib/src/js_emitter/class_stub_generator.dart |
diff --git a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart |
index 447710dca781f2ef0320f282ad342a15fc5cd94f..d07c36fa1a4623f14139c6894447e0edd2a5c8ec 100644 |
--- a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart |
+++ b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart |
@@ -11,8 +11,8 @@ class ClassStubGenerator { |
ClassStubGenerator(this.compiler, this.namer, this.backend); |
- jsAst.Expression generateClassConstructor( |
- ClassElement classElement, Iterable<jsAst.Name> fields) { |
+ jsAst.Expression generateClassConstructor(ClassElement classElement, |
+ Iterable<jsAst.Name> fields, bool hasRtiField) { |
// TODO(sra): Implement placeholders in VariableDeclaration position: |
// |
// String constructorName = namer.getNameOfClass(classElement); |
@@ -20,9 +20,18 @@ class ClassStubGenerator { |
// [ constructorName, fields, |
// fields.map( |
// (name) => js('this.# = #', [name, name]))])); |
- return js('function(#) { #; this.#();}', [ |
+ var typeParameters = const <jsAst.Parameter>[]; |
+ var typeInits = const <jsAst.Expression>[]; |
+ if (hasRtiField) { |
+ String parameterName = r'$ti'; |
+ typeParameters = parameterName; |
+ typeInits = js('this.# = #', [namer.rtiFieldName, parameterName]); |
+ } |
+ return js('function(#, #) { #; #; this.#();}', [ |
fields, |
+ typeParameters, |
fields.map((name) => js('this.# = #', [name, name])), |
+ typeInits, |
namer.deferredAction |
]); |
} |