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

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: 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
Index: lib/runtime/dart_runtime.js
diff --git a/lib/runtime/dart_runtime.js b/lib/runtime/dart_runtime.js
index 01791fdc06a5c9cc1c9e6bc0251e7edd0d6cdf44..05ad75613f0c1a6197ac0ee22810c1cffb823d80 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) {
Jennifer Messerly 2015/04/23 19:33:53 hmm, not sure this is really worth a helper.
+ 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));
Jennifer Messerly 2015/04/23 19:33:53 short line? it looks like it would fit
}
+
+ /**
+ * Copy symbols from source to destination object.
+ * These are the only properties safe to copy onto an existing public
+ * JavaScript class.
+ */
+ function copyPropertySymbols(to, from) {
+ return copyPropertiesHelper(to, from, getOwnPropertySymbols(from));
+ }
+
dart.copyProperties = copyProperties;
+ dart.copyPropertySymbols = copyPropertySymbols;
/**
* This is called whenever a derived class needs to introduce a new field,

Powered by Google App Engine
This is Rietveld 408576698