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

Unified Diff: pkg/polymer/lib/src/instance.dart

Issue 25740006: port polymer data binding tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « pkg/polymer/lib/job.dart ('k') | pkg/polymer/test/bind_mdv_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/instance.dart
diff --git a/pkg/polymer/lib/src/instance.dart b/pkg/polymer/lib/src/instance.dart
index 4dae271e308fa9d849e8ade33849b8c39a5e26c5..815c6bdf49c9b9cd6aa72b166628850cd05fe558 100644
--- a/pkg/polymer/lib/src/instance.dart
+++ b/pkg/polymer/lib/src/instance.dart
@@ -520,15 +520,13 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
}
void observeProperty(String name, Symbol method) {
- final self = reflect(this);
- _observe(name, (value, old) => self.invoke(method, [old]));
+ _observe(name, (value, old) => _invoke(method, [old]));
}
void observeBoth(String name, Symbol methodName) {
- final self = reflect(this);
_observe(name, (value, old) {
reflectPropertyToAttribute(name);
- self.invoke(methodName, [old]);
+ _invoke(methodName, [old]);
});
}
@@ -657,10 +655,15 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
bool log = _eventsLog.isLoggable(Level.FINE);
if (log) _eventsLog.fine('>>> [$localName]: dispatch $methodName');
- // TODO(sigmund): consider making event listeners list all arguments
- // explicitly. Unless VM mirrors are optimized first, this reflectClass call
- // will be expensive once custom elements extend directly from Element (see
- // dartbug.com/11108).
+ _invoke(methodName, args);
+
+ if (log) _eventsLog.info('<<< [$localName]: dispatch $methodName');
+ }
+
+ InstanceMirror _invoke(Symbol methodName, List args) {
+ // TODO(sigmund): consider making callbacks list all arguments
+ // explicitly. Unless VM mirrors are optimized first, this will be expensive
+ // once custom elements extend directly from Element (see issue 11108).
var self = reflect(this);
var method = self.type.methods[methodName];
if (method != null) {
@@ -670,9 +673,7 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
// them appart from named arguments (see http://dartbug.com/11334)
args.length = method.parameters.where((p) => !p.isOptional).length;
}
- self.invoke(methodName, args);
-
- if (log) _eventsLog.fine('<<< [$localName]: dispatch $methodName');
+ return self.invoke(methodName, args);
}
void instanceEventListener(Event event) {
« no previous file with comments | « pkg/polymer/lib/job.dart ('k') | pkg/polymer/test/bind_mdv_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698