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

Unified Diff: lib/src/js/template.dart

Issue 1069493002: implement opassign, fix bugs in pre/postfix, introduce a let* helper (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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
« no previous file with comments | « lib/src/js/printer.dart ('k') | test/codegen/expect/cascade.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/js/template.dart
diff --git a/lib/src/js/template.dart b/lib/src/js/template.dart
index b19ae4720206117e606e077c14b81080537b828e..9551b7f4694670ca19c30989502ca25e815e9f68 100644
--- a/lib/src/js/template.dart
+++ b/lib/src/js/template.dart
@@ -118,6 +118,15 @@ class Template {
}
return instantiator(arguments);
}
+
+ /// Like [instantiate] but works with free variables.
+ Node safeCreate(Map arguments) {
+ if (holeNames.isEmpty) return ast;
+ return instantiator(new Map.fromIterable(holeNames, value: (name) {
+ var a = arguments[name];
+ return a != null ? a : new InterpolatedExpression(name);
+ }));
+ }
}
/**
« no previous file with comments | « lib/src/js/printer.dart ('k') | test/codegen/expect/cascade.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698