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

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

Issue 79353003: [polymer.dart] fix *Changed observers inheriting (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | pkg/polymer/lib/src/instance.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/declaration.dart
diff --git a/pkg/polymer/lib/src/declaration.dart b/pkg/polymer/lib/src/declaration.dart
index 030333bb4ebb3abfcce330a5554d1602de1be872..ba5e3e9989242bdc2015c442eef9b62d2a8d6e4b 100644
--- a/pkg/polymer/lib/src/declaration.dart
+++ b/pkg/polymer/lib/src/declaration.dart
@@ -439,6 +439,8 @@ class PolymerDeclaration extends HtmlElement {
// If an element may take 6us to create, getCustomPropertyNames might
// cost 1.6us more.
void inferObservers(ClassMirror cls) {
+ if (cls == _objectType) return;
+ inferObservers(cls.superclass);
for (var method in cls.declarations.values) {
if (method is! MethodMirror || method.isStatic
|| !method.isRegularMethod) continue;
@@ -499,33 +501,26 @@ PolymerDeclaration _getDeclaration(String name) => _declarations[name];
final _objectType = reflectClass(Object);
+
Map _getPublishedProperties(ClassMirror cls, Map props) {
if (cls == _objectType) return props;
props = _getPublishedProperties(cls.superclass, props);
- for (var field in cls.declarations.values) {
- if (field is! VariableMirror ||
- field.isFinal || field.isStatic || field.isPrivate) continue;
-
- for (var meta in field.metadata) {
- if (meta.reflectee is PublishedProperty) {
- if (props == null) props = {};
- props[field.simpleName] = field;
- break;
- }
- }
- }
-
- for (var getter in cls.declarations.values) {
Jennifer Messerly 2013/11/21 00:07:34 with .declarations, we don't need this duplication
- if (getter is! MethodMirror || !getter.isGetter ||
- getter.isStatic || getter.isPrivate) continue;
-
- for (var meta in getter.metadata) {
- if (meta.reflectee is PublishedProperty) {
- if (_hasSetter(cls, getter)) {
- if (props == null) props = {};
- props[getter.simpleName] = getter;
+ for (var member in cls.declarations.values) {
+ if (member.isStatic || member.isPrivate) continue;
+
+ if (member is VariableMirror && !member.isFinal
+ || member is MethodMirror && member.isGetter) {
+
+ for (var meta in member.metadata) {
+ if (meta.reflectee is PublishedProperty) {
+ // Note: we delay the setter check until we find @published because
+ // it's a tad expensive.
+ if (member is! MethodMirror || _hasSetter(cls, member)) {
+ if (props == null) props = {};
+ props[member.simpleName] = member;
+ }
+ break;
}
- break;
}
}
}
« no previous file with comments | « no previous file | pkg/polymer/lib/src/instance.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698