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

Side by Side Diff: pkg/observe/lib/src/observable.dart

Issue 83443007: Remove use of deprecated mirror API from pkg/observe. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: ... Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library observe.src.observable; 5 library observe.src.observable;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 // Note: ObservableProperty is in this list only for the unusual use case of 10 // Note: ObservableProperty is in this list only for the unusual use case of
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // Register this object for dirty checking purposes. 75 // Register this object for dirty checking purposes.
76 registerObservable(this); 76 registerObservable(this);
77 77
78 var mirror = reflect(this); 78 var mirror = reflect(this);
79 var values = new Map<Symbol, Object>(); 79 var values = new Map<Symbol, Object>();
80 80
81 // Note: we scan for @observable regardless of whether the base type 81 // Note: we scan for @observable regardless of whether the base type
82 // actually includes this mixin. While perhaps too inclusive, it lets us 82 // actually includes this mixin. While perhaps too inclusive, it lets us
83 // avoid complex logic that walks "with" and "implements" clauses. 83 // avoid complex logic that walks "with" and "implements" clauses.
84 for (var type = mirror.type; type != objectType; type = type.superclass) { 84 for (var type = mirror.type; type != objectType; type = type.superclass) {
85 for (var field in type.variables.values) { 85 for (var field in type.declarations.values) {
86 if (field.isFinal || field.isStatic || field.isPrivate) continue; 86 if (field is! VariableMirror ||
87 field.isFinal ||
88 field.isStatic ||
89 field.isPrivate) continue;
87 90
88 for (var meta in field.metadata) { 91 for (var meta in field.metadata) {
89 if (meta.reflectee is ObservableProperty) { 92 if (meta.reflectee is ObservableProperty) {
90 var name = field.simpleName; 93 var name = field.simpleName;
91 // Note: since this is a field, getting the value shouldn't execute 94 // Note: since this is a field, getting the value shouldn't execute
92 // user code, so we don't need to worry about errors. 95 // user code, so we don't need to worry about errors.
93 values[name] = mirror.getField(name).reflectee; 96 values[name] = mirror.getField(name).reflectee;
94 break; 97 break;
95 } 98 }
96 } 99 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 Object newValue) { 198 Object newValue) {
196 199
197 if (obj.hasObservers && oldValue != newValue) { 200 if (obj.hasObservers && oldValue != newValue) {
198 obj.notifyChange(new PropertyChangeRecord(obj, field, oldValue, newValue)); 201 obj.notifyChange(new PropertyChangeRecord(obj, field, oldValue, newValue));
199 } 202 }
200 return newValue; 203 return newValue;
201 } 204 }
202 205
203 // NOTE: this is not exported publically. 206 // NOTE: this is not exported publically.
204 final objectType = reflectClass(Object); 207 final objectType = reflectClass(Object);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698