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

Unified Diff: lib/runtime/_classes.js

Issue 1310513013: fixes #314, super method tear offs (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | lib/src/codegen/js_codegen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/_classes.js
diff --git a/lib/runtime/_classes.js b/lib/runtime/_classes.js
index 80ceb56249bf4fa36dca9b9729e255d701391dfd..4497fb7aa54ea81e176ee38b2d3f7f90363f7a8d 100644
--- a/lib/runtime/_classes.js
+++ b/lib/runtime/_classes.js
@@ -192,9 +192,16 @@ dart_library.library('dart_runtime/_classes', null, /* Imports */[
/// Given an object and a method name, tear off the method.
/// Sets the runtime type of the torn off method appropriately,
/// and also binds the object.
+ ///
+ /// If the optional `f` argument is passed in, it will be used as the method.
+ /// This supports cases like `super.foo` where we need to tear off the method
+ /// from the superclass, not from the `obj` directly.
/// TODO(leafp): Consider caching the tearoff on the object?
- function bind(obj, name) {
- let f = obj[name].bind(obj);
+ function bind(obj, name, f) {
+ if (f === void 0) f = obj[name];
+ f = f.bind(obj);
+ // TODO(jmesserly): track the function's signature on the function, instead
+ // of having to go back to the class?
let sig = _getMethodType(obj, name);
assert(sig);
rtti.tag(f, sig);
« no previous file with comments | « no previous file | lib/src/codegen/js_codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698