Chromium Code Reviews| 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'); |
| } |
| } |