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

Unified Diff: lib/compiler/implementation/dart2js.dart

Issue 10961019: [dart2js] if --output-type=dart make output file out.dart and print correct info message. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/dart2js.dart
diff --git a/lib/compiler/implementation/dart2js.dart b/lib/compiler/implementation/dart2js.dart
index 13fb048b4d9ac9ea073db4a194d2b02322cfc078..aad9ef92d2cc67209f497666a73c75a8ca803886 100644
--- a/lib/compiler/implementation/dart2js.dart
+++ b/lib/compiler/implementation/dart2js.dart
@@ -78,6 +78,7 @@ void compile(List<String> argv) {
bool explicitOut = false;
bool wantHelp = false;
bool enableColors = false;
+ bool isOutputTypeDart = false;
passThrough(String argument) => options.add(argument);
@@ -95,6 +96,15 @@ void compile(List<String> argv) {
sourceMapOut = new Uri.fromString('$out.map');
}
+ setOutputType(String argument) {
+ if (argument == '--output-type=dart') {
+ isOutputTypeDart = true;
+ out = cwd.resolve('out.dart');
ahe 2012/09/21 14:38:46 This isn't right. You will overwrite user-specifie
Roman 2012/09/21 16:36:07 added a check for explicitOut set.
+ sourceMapOut = cwd.resolve('out.dart.map');
+ }
+ passThrough(argument);
+ }
+
handleShortOptions(String argument) {
var shortOptions = argument.substring(1).splitChars();
for (var shortOption in shortOptions) {
@@ -120,7 +130,7 @@ void compile(List<String> argv) {
new OptionHandler('-[chv?]+', handleShortOptions),
new OptionHandler('--throw-on-error', (_) => throwOnError = true),
new OptionHandler('--suppress-warnings', (_) => showWarnings = false),
- new OptionHandler('--output-type=dart|--output-type=js', passThrough),
+ new OptionHandler('--output-type=dart|--output-type=js', setOutputType),
new OptionHandler('--verbose', (_) => verbose = true),
new OptionHandler('--library-root=.+', setLibraryRoot),
new OptionHandler('--out=.+|-o.+', setOutput),
@@ -254,13 +264,14 @@ void compile(List<String> argv) {
sourceMapOut.path.substring(sourceMapOut.path.lastIndexOf('/') + 1);
code = '$code\n//@ sourceMappingURL=${sourceMapFileName}';
writeString(out, code);
- int jsBytesWritten = code.length;
- info('compiled $dartBytesRead bytes Dart -> $jsBytesWritten bytes JS '
+ int bytesWritten = code.length;
+ String outputLang = isOutputTypeDart ? 'Dart' : 'Javascript';
Anton Muhin 2012/09/20 18:31:44 nit: Java<S>cript
ahe 2012/09/21 14:38:46 Please don't abbreviate, that is, use "language" i
Roman 2012/09/21 16:36:07 Done.
Roman 2012/09/21 16:36:07 Done.
+ info('compiled $dartBytesRead bytes Dart -> $bytesWritten bytes $outputLang '
'in ${relativize(cwd, out, isWindows)}');
if (!explicitOut) {
String input = uriPathToNative(arguments[0]);
String output = relativize(cwd, out, isWindows);
- print('Dart file $input compiled to JavaScript: $output');
+ print('Dart file $input compiled to $outputLang: $output');
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698