Chromium Code Reviews| Index: tool/input_sdk/private/ddc_runtime/classes.dart |
| diff --git a/tool/input_sdk/private/ddc_runtime/classes.dart b/tool/input_sdk/private/ddc_runtime/classes.dart |
| index fdc72a361eeef9dcbcd597e2f592c9da9cc6aeb9..d18f86fbe0df3c2ebbd2a2425e94814a1aea8241 100644 |
| --- a/tool/input_sdk/private/ddc_runtime/classes.dart |
| +++ b/tool/input_sdk/private/ddc_runtime/classes.dart |
| @@ -281,22 +281,24 @@ defineExtensionNames(names) => |
| // Install properties in prototype order. Properties / descriptors from |
| // more specific types should overwrite ones from less specific types. |
| -_installProperties(jsProto, extProto) { |
| - var coreObjProto = JS('', '#.prototype', Object); |
| - if (JS('bool', '# === #', extProto, coreObjProto)) { |
| +_installProperties(jsProto, extProto) => JS('', '''(() => { |
| + let coreObjProto = $Object.prototype; |
| + if (extProto === coreObjProto) { |
| // core.Object members need to be copied from the non-symbol name to the |
| // symbol name. |
| - for (var name in getOwnPropertyNames(coreObjProto)) { |
| - var desc = getOwnPropertyDescriptor(coreObjProto, name); |
| - defineProperty(jsProto, getExtensionSymbol(name), desc); |
| + let names = $getOwnPropertyNames(coreObjProto); |
| + for (var i = 0; i < names.length; ++i) { |
|
Jennifer Messerly
2016/05/11 19:56:26
nit: use `let` if writing JS code
Leaf
2016/05/12 17:00:44
Done.
|
| + let name = names[i]; |
|
Jennifer Messerly
2016/05/11 19:56:26
fyi ... there is a way to write this in Dart witho
Leaf
2016/05/12 17:00:44
Done.
|
| + let desc = $getOwnPropertyDescriptor(coreObjProto, name); |
| + $defineProperty(jsProto, $getExtensionSymbol(name), desc); |
| } |
| return; |
| } |
| - if (JS('bool', '# !== #', jsProto, extProto)) { |
| - _installProperties(jsProto, JS('', '#.__proto__', extProto)); |
| + if (jsProto !== extProto) { |
| + $_installProperties(jsProto, extProto.__proto__); |
| } |
| - copyTheseProperties(jsProto, extProto, getOwnPropertySymbols(extProto)); |
| -} |
| + $copyTheseProperties(jsProto, extProto, $getOwnPropertySymbols(extProto)); |
| +})()'''); |
| /// |
| /// Copy symbols from the prototype of the source to destination. |