| Index: frog/gen.dart
|
| ===================================================================
|
| --- frog/gen.dart (revision 2270)
|
| +++ frog/gen.dart (working copy)
|
| @@ -228,6 +228,15 @@
|
| }
|
|
|
| writeType(Type type) {
|
| + if (type.isWritten) return;
|
| +
|
| + type.isWritten = true;
|
| + // Ensure parent has been written before the child. Important ordering for
|
| + // IE when we're using $inherits, since we don't have __proto__ available.
|
| + if (type.parent != null && !type.isNative) {
|
| + writeType(type.parent);
|
| + }
|
| +
|
| // TODO(jimhug): Workaround for problems with reified generic Array.
|
| if (type.name != null && type is ConcreteType &&
|
| type.library == world.coreimpl &&
|
| @@ -247,6 +256,31 @@
|
| }
|
| }
|
|
|
| + // We need the $inherits function to be declared before factory constructors
|
| + // so that inheritance ($inherits) will work correctly in IE.
|
| + if (!type.isTop) {
|
| + if (type is ConcreteType) {
|
| + ConcreteType c = type;
|
| + corejs.ensureInheritsHelper();
|
| + writer.writeln('\$inherits(${c.jsname}, ${c.genericType.jsname});');
|
| +
|
| + // Mixin members from concrete specializations of base types too.
|
| + // TODO(jmesserly): emit this sooner instead of at the end.
|
| + // But it needs to come after we've emitted both types.
|
| + // TODO(jmesserly): HACK: using _parent instead of parent so we don't
|
| + // try to inherit things that we didn't actually use.
|
| + for (var p = c._parent; p is ConcreteType; p = p._parent) {
|
| + _ensureInheritMembersHelper();
|
| + _mixins.writeln('\$inheritsMembers(${c.jsname}, ${p.jsname});');
|
| + }
|
| + } else if (!type.isNative) {
|
| + if (type.parent != null && !type.parent.isObject) {
|
| + corejs.ensureInheritsHelper();
|
| + writer.writeln('\$inherits(${type.jsname}, ${type.parent.jsname});');
|
| + }
|
| + }
|
| + }
|
| +
|
| if (type.isTop) {
|
| // no preludes for top type
|
| } else if (type.constructors.length == 0) {
|
| @@ -272,29 +306,6 @@
|
| }
|
| }
|
|
|
| - if (!type.isTop) {
|
| - if (type is ConcreteType) {
|
| - ConcreteType c = type;
|
| - corejs.ensureInheritsHelper();
|
| - writer.writeln('\$inherits(${c.jsname}, ${c.genericType.jsname});');
|
| -
|
| - // Mixin members from concrete specializations of base types too.
|
| - // TODO(jmesserly): emit this sooner instead of at the end.
|
| - // But it needs to come after we've emitted both types.
|
| - // TODO(jmesserly): HACK: using _parent instead of parent so we don't
|
| - // try to inherit things that we didn't actually use.
|
| - for (var p = c._parent; p is ConcreteType; p = p._parent) {
|
| - _ensureInheritMembersHelper();
|
| - _mixins.writeln('\$inheritsMembers(${c.jsname}, ${p.jsname});');
|
| - }
|
| - } else if (!type.isNative) {
|
| - if (type.parent != null && !type.parent.isObject) {
|
| - corejs.ensureInheritsHelper();
|
| - writer.writeln('\$inherits(${type.jsname}, ${type.parent.jsname});');
|
| - }
|
| - }
|
| - }
|
| -
|
| // Concrete types (like List<String>) will have this already defined on
|
| // their prototype from the generic type (like List)
|
| if (type is! ConcreteType) {
|
|
|