Chromium Code Reviews| 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, |