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..c924f044bd006c476ccacc320c57b0e3dfd1d882 100644 |
--- a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart |
+++ b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart |
@@ -12,7 +12,7 @@ class ClassStubGenerator { |
ClassStubGenerator(this.compiler, this.namer, this.backend); |
jsAst.Expression generateClassConstructor( |
- ClassElement classElement, Iterable<jsAst.Name> fields) { |
+ ClassElement classElement, Iterable<jsAst.Name> fields, bool hasRti) { |
// 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 (hasRti) { |
+ String parameterName = r'$ti'; |
+ typeParameters = parameterName; |
+ typeInits = js('this.# = #', [namer.rtiFieldName, parameterName]); |
+ } |
+ return js('function(#, #) { #; #; this.#();}', [ |
fields, |
+ typeParameters, |
Siggi Cherem (dart-lang)
2016/08/19 16:39:46
does js_ast remove the extra argument if typeParam
sra1
2017/02/23 23:46:41
# in most repeated contexts will spread a template
|
fields.map((name) => js('this.# = #', [name, name])), |
+ typeInits, |
namer.deferredAction |
]); |
} |