Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(719)

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart

Issue 2779063002: One more minor mixin fix (Closed)
Patch Set: Fix comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0b117400e1b8ae8cd49f4a09a48330a73184f80d..acb8475bbac36954ce80bbdb94536e73934787f3 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
@@ -29,10 +29,16 @@ mixin(base, @rest mixins) => JS(
// Create a class that will hold all of the mixin methods.
class Mixin extends $base {}
+ // Save the original constructor. For ClassTypeAlias definitions, this
+ // is the concrete type. We embed metadata (e.g., implemented interfaces)
+ // on this constructor and need to access that from runtime instances.
+ var constructor = Mixin.prototype.constructor;
Jacob 2017/05/19 14:31:27 nit: let
// Copy each mixin's methods, with later ones overwriting earlier entries.
for (let m of $mixins) {
$copyProperties(Mixin.prototype, m.prototype);
}
+ // Restore original Mixin constructor.
+ Mixin.prototype.constructor = constructor;
// Initializer methods: run mixin initializers, then the base.
Mixin.prototype.new = function(...args) {
// Run mixin initializers. They cannot have arguments.
@@ -55,6 +61,7 @@ mixin(base, @rest mixins) => JS(
// Run base initializer.
$base.prototype[namedCtor].apply(this, args);
};
+ $defineNamedConstructor(Mixin, namedCtor);
}
}
@@ -626,6 +633,10 @@ defineNamedConstructorCallable(clazz, name, ctor) => JS(
// 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);
})()''');
defineEnumValues(enumClass, names) => JS(
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698