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

Unified Diff: lib/runtime/dart_runtime.js

Issue 1094243007: Fix Array constructor bug impacting dart2js and ddc running on the same page. (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: ptal Created 5 years, 8 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 | « lib/runtime/dart/core.js ('k') | lib/src/codegen/js_codegen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/dart_runtime.js
diff --git a/lib/runtime/dart_runtime.js b/lib/runtime/dart_runtime.js
index 01791fdc06a5c9cc1c9e6bc0251e7edd0d6cdf44..bb9353b2e7b7f08ba8dcb91f82337d55240bb279 100644
--- a/lib/runtime/dart_runtime.js
+++ b/lib/runtime/dart_runtime.js
@@ -611,17 +611,33 @@ var dart, _js_helper;
dart.defineLazyProperties = defineLazy;
dart.defineLazyClassGeneric = defineLazyProperty;
+ function copyPropertiesHelper(to, from, names) {
+ for (let name of names) {
+ defineProperty(to, name, getOwnPropertyDescriptor(from, name));
+ }
+ return to;
+ }
+
/**
* Copy properties from source to destination object.
* This operation is commonly called `mixin` in JS.
*/
function copyProperties(to, from) {
- for (let name of getOwnNamesAndSymbols(from)) {
- defineProperty(to, name, getOwnPropertyDescriptor(from, name));
- }
- return to;
+ return copyPropertiesHelper(to, from, getOwnNamesAndSymbols(from));
}
+
+ /**
+ * Copy symbols from the prototype of the source to destination.
+ * These are the only properties safe to copy onto an existing public
+ * JavaScript class.
+ */
+ function registerExtension(to, from) {
+ return copyPropertiesHelper(to.prototype, from.prototype,
+ getOwnPropertySymbols(from.prototype));
+ }
+
dart.copyProperties = copyProperties;
+ dart.registerExtension = registerExtension;
/**
* This is called whenever a derived class needs to introduce a new field,
« no previous file with comments | « lib/runtime/dart/core.js ('k') | lib/src/codegen/js_codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698