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 dab53e77298e7a9dbdc2dd96c2771ba431ba78f8..95faf3deb3a1c558e3056c7b481178c95f5ac995 100644 |
| --- a/tool/input_sdk/private/ddc_runtime/classes.dart |
| +++ b/tool/input_sdk/private/ddc_runtime/classes.dart |
| @@ -279,10 +279,30 @@ getExtensionSymbol(name) { |
| defineExtensionNames(names) => |
| JS('', '#.forEach(#)', names, getExtensionSymbol); |
| + |
| +int _t1 = 0, _t2 = 0; |
| +void tick1() { |
| + _t1 = JS('int', '# + 1', _t1); |
| + if (JS('bool', '# % 100 == 0', _t1)) JS('', 'console.log([#, #])', _t1, _t2); |
| +} |
| +void tick2() { |
| + _t2 = JS('int', '# + 1', _t2); |
| + if (JS('bool', '# % 100 == 0', _t2)) JS('', 'console.log([#, #])', _t1, _t2); |
| +} |
| + |
| // Install properties in prototype order. Properties / descriptors from |
| // more specific types should overwrite ones from less specific types. |
| _installProperties(jsProto, extProto) { |
| + tick1(); |
| var coreObjProto = JS('', '#.prototype', Object); |
| + _installProperties2(jsProto, extProto, coreObjProto); |
| + // Mark this jsProto as being the prototype for the extension class. |
| + // TODO(sra): Fix the tagging. |
| + JS('', '#._xxx = #', jsProto, extProto); |
| +} |
| + |
| +_installProperties2(jsProto, extProto, coreObjProto) { |
| + tick2(); |
| if (JS('bool', '# === #', extProto, coreObjProto)) { |
| // core.Object members need to be copied from the non-symbol name to the |
| // symbol name. |
| @@ -295,7 +315,12 @@ _installProperties(jsProto, extProto) { |
| return; |
| } |
| if (JS('bool', '# !== #', jsProto, extProto)) { |
| - _installProperties(jsProto, JS('', '#.__proto__', extProto)); |
| + var extParent = JS('', '#.__proto__', extProto); |
| + // If the js parent is the extension class parent, we inherit all the |
| + // extension class methods via prototype inheritance. |
| + if(JS('bool', '#.__proto__._xxx !== #', jsProto, extParent)) { |
|
Leaf
2016/05/16 18:03:07
Maybe use a symbol to be more robust? Or maybe ju
|
| + _installProperties2(jsProto, extParent, coreObjProto); |
| + } |
| } |
| copyTheseProperties(jsProto, extProto, getOwnPropertySymbols(extProto)); |
| } |