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

Unified Diff: tool/input_sdk/private/ddc_runtime/classes.dart

Issue 1979863002: Dont install methods if implementation superclass corresponds to an installed extension class (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: Created 4 years, 7 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_sdk.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « lib/runtime/dart_sdk.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698