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

Unified Diff: lib/src/codegen.dart

Issue 11275029: Support for specifying an output directory (issue #106) (Closed) Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 years, 2 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/analyzer.dart ('k') | lib/src/compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/codegen.dart
diff --git a/lib/src/codegen.dart b/lib/src/codegen.dart
index 6ab153f0ae5a74478a2e55d6131a5bad62981438..5f63b3be1480e205eb3550dac910adaf41353cae 100644
--- a/lib/src/codegen.dart
+++ b/lib/src/codegen.dart
@@ -134,3 +134,31 @@ String importList(List<Path> imports) =>
/** Generate text for a list of export. */
String exportList(List<Path> exports) =>
Strings.join(exports.map((url) => "export '$url';"), '\n');
+
+/**
+ * Text corresponding to a directive, fixed in case the code is in a different
+ * output location.
+ */
+String directiveText(
+ DartDirectiveInfo directive, LibraryInfo src, PathInfo pathInfo) {
+ var buff = new StringBuffer();
+ var uri = pathInfo.transferDirectiveUrl(src, directive.uri);
+ buff.add(directive.label)
+ .add(" '")
+ .add(uri.replaceAll("'", "\\'"))
+ .add("'");
+ if (directive.prefix != null) {
+ buff.add(' as ')
+ .add(directive.prefix);
+ }
+ if (directive.show != null) {
+ buff.add(' show ')
+ .add(Strings.join(directive.show, ','));
+ }
+ if (directive.hide != null) {
+ buff.add(' hide ')
+ .add(Strings.join(directive.hide, ','));
+ }
+ buff.add(';');
+ return buff.toString();
+}
« no previous file with comments | « lib/src/analyzer.dart ('k') | lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698