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

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
Index: pkg/polymer/lib/src/instance.dart
diff --git a/pkg/polymer/lib/src/instance.dart b/pkg/polymer/lib/src/instance.dart
index f0bff99c4637274b00dd6c5d15419547f71b76d9..f2f1f873e4e8f1a077fb354c253fcdb7127074f8 100644
--- a/pkg/polymer/lib/src/instance.dart
+++ b/pkg/polymer/lib/src/instance.dart
@@ -509,15 +509,13 @@ class PolymerElement extends CustomElement with ObservableMixin {
}
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]);
});
}
@@ -646,10 +644,18 @@ class PolymerElement extends CustomElement with ObservableMixin {
bool log = _eventsLog.isLoggable(Level.INFO);
if (log) _eventsLog.info('>>> [$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');
+
+ // TODO(jmesserly): workaround for HTML events not supporting zones.
+ performMicrotaskCheckpoint();
+ }
+
+ 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) {
@@ -659,12 +665,7 @@ class PolymerElement extends CustomElement with ObservableMixin {
// 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.info('<<< [$localName]: dispatch $methodName');
-
- // TODO(jmesserly): workaround for HTML events not supporting zones.
- performMicrotaskCheckpoint();
+ return self.invoke(methodName, args);
}
void instanceEventListener(Event event) {

Powered by Google App Engine
This is Rietveld 408576698