| Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
|
| diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
|
| index 7d48033577925893ea6a616c65b1ead567126a62..ca3f810efefff793e7aeace8997be7194b3755f9 100644
|
| --- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
|
| +++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
|
| @@ -33,7 +33,7 @@ mixin(base, @rest mixins) => JS(
|
| for (let m of $mixins) {
|
| $copyProperties(Mixin.prototype, m.prototype);
|
| }
|
| - // Initializer method: run mixin initializers, then the base.
|
| + // Initializer methods: run mixin initializers, then the base.
|
| Mixin.prototype.new = function(...args) {
|
| // Run mixin initializers. They cannot have arguments.
|
| // Run them backwards so most-derived mixin is initialized first.
|
| @@ -43,6 +43,20 @@ mixin(base, @rest mixins) => JS(
|
| // Run base initializer.
|
| $base.prototype.new.apply(this, args);
|
| };
|
| + let namedCtors = ${safeGetOwnProperty(base, _namedConstructors)};
|
| + if ($base[$_namedConstructors] != null) {
|
| + for (let namedCtor of $base[$_namedConstructors]) {
|
| + Mixin.prototype[namedCtor] = function(...args) {
|
| + // Run mixin initializers. They cannot have arguments.
|
| + // Run them backwards so most-derived mixin is initialized first.
|
| + for (let i = $mixins.length - 1; i >= 0; i--) {
|
| + $mixins[i].prototype.new.call(this);
|
| + }
|
| + // Run base initializer.
|
| + $base.prototype[namedCtor].apply(this, args);
|
| + };
|
| + }
|
| + }
|
|
|
| // Set the signature of the Mixin class to be the composition
|
| // of the signatures of the mixins.
|
| @@ -424,13 +438,18 @@ defineNamedConstructor(clazz, name) => JS(
|
| let proto = $clazz.prototype;
|
| let initMethod = proto[$name];
|
| let ctor = function(...args) { initMethod.apply(this, args); };
|
| - ctor[$isNamedConstructor] = true;
|
| ctor.prototype = proto;
|
| // Use defineProperty so we don't hit a property defined on Function,
|
| // like `caller` and `arguments`.
|
| $defineProperty($clazz, $name, { value: ctor, configurable: true });
|
| +
|
| + let namedCtors = ${safeGetOwnProperty(clazz, _namedConstructors)};
|
| + if (namedCtors == null) $clazz[$_namedConstructors] = namedCtors = [];
|
| + namedCtors.push($name);
|
| })()''');
|
|
|
| +final _namedConstructors = JS('', 'Symbol("_namedConstructors")');
|
| +
|
| final _extensionType = JS('', 'Symbol("extensionType")');
|
|
|
| getExtensionType(obj) => JS('', '#[#]', obj, _extensionType);
|
|
|