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

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

Issue 49793004: Inherit @published from base class (fix issue 13937) (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/pkg.status ('k') | pkg/polymer/test/publish_inherited_properties_test.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 ba2beff948dc25dac4f336ec48368f6e062d1dfb..bb6b225a448f2cd4039a5ee69ddcff78ac81a545 100644
--- a/pkg/polymer/lib/src/declaration.dart
+++ b/pkg/polymer/lib/src/declaration.dart
@@ -242,9 +242,13 @@ class PolymerDeclaration extends HtmlElement {
void publishAttributes(ClassMirror cls, PolymerDeclaration superDecl) {
// get properties to publish
if (superDecl != null && superDecl._publish != null) {
+ // Dart note: even though we walk the type hierarchy in
+ // _getPublishedProperties, this will additionally include any names
+ // published via the `attributes` attribute.
_publish = new Map.from(superDecl._publish);
}
- _publish = _getProperties(cls, _publish, (x) => x is PublishedProperty);
+
+ _publish = _getPublishedProperties(cls, _publish);
// merge names from 'attributes' attribute
var attrs = attributes['attributes'];
@@ -491,12 +495,14 @@ PolymerDeclaration _getDeclaration(String name) => _declarations[name];
final _objectType = reflectClass(Object);
-Map _getProperties(ClassMirror cls, Map props, bool matches(metadata)) {
+Map _getPublishedProperties(ClassMirror cls, Map props) {
+ if (cls == _objectType) return props;
+ props = _getPublishedProperties(cls.superclass, props);
for (var field in cls.variables.values) {
if (field.isFinal || field.isStatic || field.isPrivate) continue;
for (var meta in field.metadata) {
- if (matches(meta.reflectee)) {
+ if (meta.reflectee is PublishedProperty) {
if (props == null) props = {};
props[field.simpleName] = field;
break;
@@ -508,7 +514,7 @@ Map _getProperties(ClassMirror cls, Map props, bool matches(metadata)) {
if (getter.isStatic || getter.isPrivate) continue;
for (var meta in getter.metadata) {
- if (matches(meta.reflectee)) {
+ if (meta.reflectee is PublishedProperty) {
if (_hasSetter(cls, getter)) {
if (props == null) props = {};
props[getter.simpleName] = getter;
« no previous file with comments | « pkg/pkg.status ('k') | pkg/polymer/test/publish_inherited_properties_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698