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

Unified Diff: third_party/pkg/angular/lib/change_detection/dirty_checking_change_detector_dynamic.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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: third_party/pkg/angular/lib/change_detection/dirty_checking_change_detector_dynamic.dart
diff --git a/third_party/pkg/angular/lib/change_detection/dirty_checking_change_detector_dynamic.dart b/third_party/pkg/angular/lib/change_detection/dirty_checking_change_detector_dynamic.dart
new file mode 100644
index 0000000000000000000000000000000000000000..bc03d013dee5219f2da396b99a50eebdfd99d065
--- /dev/null
+++ b/third_party/pkg/angular/lib/change_detection/dirty_checking_change_detector_dynamic.dart
@@ -0,0 +1,35 @@
+library dirty_checking_change_detector_dynamic;
+
+import 'package:angular/change_detection/change_detection.dart';
+export 'package:angular/change_detection/change_detection.dart' show
+ FieldGetterFactory;
+
+/**
+ * We are using mirrors, but there is no need to import anything.
+ */
+@MirrorsUsed(targets: const [ DynamicFieldGetterFactory ], metaTargets: const [] )
+import 'dart:mirrors';
+
+class DynamicFieldGetterFactory implements FieldGetterFactory {
+ final isMethodInvoke = true;
+
+ isMethod(Object object, String name) {
+ var declaration = reflectClass(object.runtimeType).declarations[new Symbol(name)];
+ return declaration != null &&
+ declaration is MethodMirror &&
+ (declaration as MethodMirror).isRegularMethod;
+ }
+
+ Function method(Object object, String name) {
+ Symbol symbol = new Symbol(name);
+ InstanceMirror instanceMirror = reflect(object);
+ return (List args, Map namedArgs) =>
+ instanceMirror.invoke(symbol, args, namedArgs).reflectee;
+ }
+
+ FieldGetter getter(Object object, String name) {
+ Symbol symbol = new Symbol(name);
+ InstanceMirror instanceMirror = reflect(object);
+ return (Object object) => instanceMirror.getField(symbol).reflectee;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698