Chromium Code Reviews| Index: lib/src/compiler/code_generator.dart | 
| diff --git a/lib/src/compiler/code_generator.dart b/lib/src/compiler/code_generator.dart | 
| index f758d14bbcabe38bcf874d80a1988036442dae46..372f8157fb89c3c344950278dd983c3a3a38ccc0 100644 | 
| --- a/lib/src/compiler/code_generator.dart | 
| +++ b/lib/src/compiler/code_generator.dart | 
| @@ -1051,7 +1051,8 @@ class CodeGenerator extends GeneralizingAstVisitor | 
| // TODO(jmesserly): we should really just extend Array in the first place. | 
| newBaseClass = js.call('dart.global.#', [jsPeerName]); | 
| } else if (_hasDeferredSupertype.contains(classElem)) { | 
| - newBaseClass = _emitTypeName(classElem.type.superclass); | 
| + newBaseClass = _emitTypeName(classElem.type.superclass, | 
| + subClass: classElem, className: className); | 
| } | 
| if (newBaseClass != null) { | 
| body.add( | 
| @@ -2221,8 +2222,15 @@ class CodeGenerator extends GeneralizingAstVisitor | 
| /// function type. Similarly if [lowerGeneric] is set, the `List$()` form | 
| /// will be used instead of `List`. These flags are used when generating | 
| /// the definitions for typedefs and generic types, respectively. | 
| + /// | 
| + /// If [subClass] is set, then we are setting the base class for the given | 
| + /// class and should emit the given [className], which will already be | 
| + /// defined. | 
| JS.Expression _emitTypeName(DartType type, | 
| - {bool lowerTypedef: false, bool lowerGeneric: false}) { | 
| + {bool lowerTypedef: false, | 
| + bool lowerGeneric: false, | 
| + ClassElement subClass, | 
| 
 
Harry Terkelsen
2016/05/09 18:04:19
had to add 2 named args just for this one case :(
 
Jennifer Messerly
2016/05/09 18:16:36
Hmmm. You could pass it down as a function from `(
 
 | 
| + JS.Expression className}) { | 
| // The void and dynamic types are not defined in core. | 
| if (type.isVoid) { | 
| return js.call('dart.void'); | 
| @@ -2252,11 +2260,16 @@ class CodeGenerator extends GeneralizingAstVisitor | 
| return new JS.Identifier(name); | 
| } | 
| + if (type == subClass?.type) { | 
| + return className; | 
| + } | 
| + | 
| if (type is ParameterizedType) { | 
| var args = type.typeArguments; | 
| Iterable jsArgs = null; | 
| if (args.any((a) => !a.isDynamic)) { | 
| - jsArgs = args.map(_emitTypeName); | 
| + jsArgs = args.map( | 
| + (x) => _emitTypeName(x, subClass: subClass, className: className)); | 
| } else if (lowerGeneric) { | 
| jsArgs = []; | 
| } |