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

Side by Side 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, 1 month 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 unified diff | Download patch
« no previous file with comments | « lib/src/analyzer.dart ('k') | lib/src/compiler.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** Collects common snippets of generated code. */ 5 /** Collects common snippets of generated code. */
6 library codegen; 6 library codegen;
7 7
8 import 'file_system/path.dart'; 8 import 'file_system/path.dart';
9 import 'info.dart'; 9 import 'info.dart';
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ${exportList(exports)} 127 ${exportList(exports)}
128 """; 128 """;
129 129
130 /** Generate text for a list of imports. */ 130 /** Generate text for a list of imports. */
131 String importList(List<Path> imports) => 131 String importList(List<Path> imports) =>
132 Strings.join(imports.map((url) => "import '$url';"), '\n'); 132 Strings.join(imports.map((url) => "import '$url';"), '\n');
133 133
134 /** Generate text for a list of export. */ 134 /** Generate text for a list of export. */
135 String exportList(List<Path> exports) => 135 String exportList(List<Path> exports) =>
136 Strings.join(exports.map((url) => "export '$url';"), '\n'); 136 Strings.join(exports.map((url) => "export '$url';"), '\n');
137
138 /**
139 * Text corresponding to a directive, fixed in case the code is in a different
140 * output location.
141 */
142 String directiveText(
143 DartDirectiveInfo directive, LibraryInfo src, PathInfo pathInfo) {
144 var buff = new StringBuffer();
145 var uri = pathInfo.transferDirectiveUrl(src, directive.uri);
146 buff.add(directive.label)
147 .add(" '")
148 .add(uri.replaceAll("'", "\\'"))
149 .add("'");
150 if (directive.prefix != null) {
151 buff.add(' as ')
152 .add(directive.prefix);
153 }
154 if (directive.show != null) {
155 buff.add(' show ')
156 .add(Strings.join(directive.show, ','));
157 }
158 if (directive.hide != null) {
159 buff.add(' hide ')
160 .add(Strings.join(directive.hide, ','));
161 }
162 buff.add(';');
163 return buff.toString();
164 }
OLDNEW
« 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