Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
| 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'batch_util.dart'; | 9 import 'batch_util.dart'; |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 ..addFlag('tolerant', | 68 ..addFlag('tolerant', |
| 69 help: 'Generate kernel even if there are compile-time errors.', | 69 help: 'Generate kernel even if there are compile-time errors.', |
| 70 defaultsTo: false) | 70 defaultsTo: false) |
| 71 ..addOption('D', | 71 ..addOption('D', |
| 72 abbr: 'D', | 72 abbr: 'D', |
| 73 allowMultiple: true, | 73 allowMultiple: true, |
| 74 help: 'Define an environment variable.', | 74 help: 'Define an environment variable.', |
| 75 hide: true) | 75 hide: true) |
| 76 ..addFlag('show-external', | 76 ..addFlag('show-external', |
| 77 help: 'When printing a library as text, also print its dependencies\n' | 77 help: 'When printing a library as text, also print its dependencies\n' |
| 78 'on external libraries.'); | 78 'on external libraries.') |
| 79 ..addFlag('show-offsets', | |
| 80 help: 'When printing a library as text, also print node offsets\n' | |
| 81 'in file.'); | |
|
Kevin Millikin (Google)
2017/01/04 14:36:58
I think 'in file' is implicit. I'd just leave it
jensj
2017/01/05 09:07:55
I'll delete it.
| |
| 79 | 82 |
| 80 String getUsage() => """ | 83 String getUsage() => """ |
| 81 Usage: dartk [options] FILE | 84 Usage: dartk [options] FILE |
| 82 | 85 |
| 83 Convert .dart or .dill files to kernel's IR and print out its textual | 86 Convert .dart or .dill files to kernel's IR and print out its textual |
| 84 or binary form. | 87 or binary form. |
| 85 | 88 |
| 86 Examples: | 89 Examples: |
| 87 dartk foo.dart # print text IR for foo.dart | 90 dartk foo.dart # print text IR for foo.dart |
| 88 dartk foo.dart -ofoo.dill # write binary IR for foo.dart to foo.dill | 91 dartk foo.dart -ofoo.dill # write binary IR for foo.dart to foo.dill |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 return CompilerOutcome.Ok; | 372 return CompilerOutcome.Ok; |
| 370 } | 373 } |
| 371 | 374 |
| 372 watch.reset(); | 375 watch.reset(); |
| 373 | 376 |
| 374 Future ioFuture; | 377 Future ioFuture; |
| 375 if (canContinueCompilation) { | 378 if (canContinueCompilation) { |
| 376 switch (format) { | 379 switch (format) { |
| 377 case 'text': | 380 case 'text': |
| 378 writeProgramToText(program, | 381 writeProgramToText(program, |
| 379 path: outputFile, showExternal: options['show-external']); | 382 path: outputFile, |
| 383 showExternal: options['show-external'], | |
| 384 showOffsets: options['show-offsets']); | |
| 380 break; | 385 break; |
| 381 case 'bin': | 386 case 'bin': |
| 382 ioFuture = writeProgramToBinary(program, outputFile); | 387 ioFuture = writeProgramToBinary(program, outputFile); |
| 383 break; | 388 break; |
| 384 } | 389 } |
| 385 } | 390 } |
| 386 | 391 |
| 387 int time = watch.elapsedMilliseconds; | 392 int time = watch.elapsedMilliseconds; |
| 388 if (shouldReportMetrics) { | 393 if (shouldReportMetrics) { |
| 389 print('writer.time = $time ms'); | 394 print('writer.time = $time ms'); |
| 390 } | 395 } |
| 391 | 396 |
| 392 await ioFuture; | 397 await ioFuture; |
| 393 | 398 |
| 394 if (shouldReportMetrics) { | 399 if (shouldReportMetrics) { |
| 395 int flushTime = watch.elapsedMilliseconds - time; | 400 int flushTime = watch.elapsedMilliseconds - time; |
| 396 print('writer.flush_time = $flushTime ms'); | 401 print('writer.flush_time = $flushTime ms'); |
| 397 } | 402 } |
| 398 | 403 |
| 399 return errors.length > 0 ? CompilerOutcome.Fail : CompilerOutcome.Ok; | 404 return errors.length > 0 ? CompilerOutcome.Fail : CompilerOutcome.Ok; |
| 400 } | 405 } |
| OLD | NEW |