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

Unified Diff: third_party/pkg/angular/lib/core/parser/parser_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/core/parser/parser_dynamic.dart
diff --git a/third_party/pkg/angular/lib/core/parser/parser_dynamic.dart b/third_party/pkg/angular/lib/core/parser/parser_dynamic.dart
new file mode 100644
index 0000000000000000000000000000000000000000..967db7bede7ea4561d9532aea6e000873ef51b4a
--- /dev/null
+++ b/third_party/pkg/angular/lib/core/parser/parser_dynamic.dart
@@ -0,0 +1,58 @@
+library angular.core.parser_dynamic;
+
+@MirrorsUsed(targets: const [ DynamicClosureMap ], metaTargets: const [] )
+import 'dart:mirrors';
+import 'package:angular/core/parser/parser.dart';
+
+class DynamicClosureMap implements ClosureMap {
+ final Map<String, Symbol> symbols = {};
+ Getter lookupGetter(String name) {
+ var symbol = new Symbol(name);
+ return (o) {
+ if (o is Map) {
+ return o[name];
+ } else {
+ return reflect(o).getField(symbol).reflectee;
+ }
+ };
+ }
+
+ Setter lookupSetter(String name) {
+ var symbol = new Symbol(name);
+ return (o, value) {
+ if (o is Map) {
+ return o[name] = value;
+ } else {
+ reflect(o).setField(symbol, value);
+ return value;
+ }
+ };
+ }
+
+ MethodClosure lookupFunction(String name, CallArguments arguments) {
+ var symbol = new Symbol(name);
+ return (o, posArgs, namedArgs) {
+ var sNamedArgs = {};
+ namedArgs.forEach((name, value) {
+ var symbol = symbols.putIfAbsent(name, () => new Symbol(name));
+ sNamedArgs[symbol] = value;
+ });
+ if (o is Map) {
+ var fn = o[name];
+ if (fn is Function) {
+ return Function.apply(fn, posArgs, sNamedArgs);
+ } else {
+ throw "Property '$name' is not of type function.";
+ }
+ } else {
+ try {
+ return reflect(o).invoke(symbol, posArgs, sNamedArgs).reflectee;
+ } on NoSuchMethodError catch (e) {
+ throw 'Undefined function $name';
+ }
+ }
+ };
+ }
+
+ Symbol lookupSymbol(String name) => new Symbol(name);
+}
« no previous file with comments | « third_party/pkg/angular/lib/core/parser/parser.dart ('k') | third_party/pkg/angular/lib/core/parser/parser_static.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698