Index: third_party/pkg/angular/lib/change_detection/dirty_checking_change_detector_static.dart |
diff --git a/third_party/pkg/angular/lib/change_detection/dirty_checking_change_detector_static.dart b/third_party/pkg/angular/lib/change_detection/dirty_checking_change_detector_static.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..66bd245f72cd74251026de663764af5995cdf55a |
--- /dev/null |
+++ b/third_party/pkg/angular/lib/change_detection/dirty_checking_change_detector_static.dart |
@@ -0,0 +1,32 @@ |
+library dirty_checking_change_detector_static; |
+ |
+import 'package:angular/change_detection/change_detection.dart'; |
+ |
+class StaticFieldGetterFactory implements FieldGetterFactory { |
+ final isMethodInvoke = false; |
+ Map<String, FieldGetter> getters; |
+ |
+ StaticFieldGetterFactory(this.getters); |
+ |
+ bool isMethod(Object object, String name) { |
+ // We need to know if we are referring to method or field which is a |
+ // function. We can find out by calling it twice and seeing if we get |
+ // the same value. Methods create a new closure each time. |
+ FieldGetter getterFn = getter(object, name); |
+ dynamic property = getterFn(object); |
+ return (property is Function) && |
+ (!identical(property, getterFn(object))); |
+ } |
+ |
+ FieldGetter getter(Object object, String name) { |
+ var getter = getters[name]; |
+ if (getter == null) throw "Missing getter: (o) => o.$name"; |
+ return getter; |
+ } |
+ |
+ Function method(Object object, String name) { |
+ var method = getters[name]; |
+ if (method == null) throw "Missing method: $name"; |
+ return method; |
+ } |
+} |