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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart2js.dart

Issue 50633004: Remove uses of dart:io Options in dart2js and dartdoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use arguments instead of args. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/builtin.dart ('k') | sdk/lib/_internal/compiler/samples/darttags/darttags.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.cmdline; 5 library dart2js.cmdline;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io' 8 import 'dart:io'
9 show exit, File, FileMode, Options, Platform, RandomAccessFile; 9 show exit, File, FileMode, Platform, RandomAccessFile;
10 import 'dart:math' as math; 10 import 'dart:math' as math;
11 11
12 import '../compiler.dart' as api; 12 import '../compiler.dart' as api;
13 import 'source_file.dart'; 13 import 'source_file.dart';
14 import 'source_file_provider.dart'; 14 import 'source_file_provider.dart';
15 import 'filenames.dart'; 15 import 'filenames.dart';
16 import 'util/uri_extras.dart'; 16 import 'util/uri_extras.dart';
17 import 'util/util.dart'; 17 import 'util/util.dart';
18 import '../../libraries.dart'; 18 import '../../libraries.dart';
19 19
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 void fail(String message) { 445 void fail(String message) {
446 if (diagnosticHandler != null) { 446 if (diagnosticHandler != null) {
447 diagnosticHandler.diagnosticHandler( 447 diagnosticHandler.diagnosticHandler(
448 null, -1, -1, message, api.Diagnostic.ERROR); 448 null, -1, -1, message, api.Diagnostic.ERROR);
449 } else { 449 } else {
450 print(message); 450 print(message);
451 } 451 }
452 exit(1); 452 exit(1);
453 } 453 }
454 454
455 Future compilerMain(Options options) { 455 Future compilerMain(List<String> arguments) {
456 var root = uriPathToNative("/$LIBRARY_ROOT"); 456 var root = uriPathToNative("/$LIBRARY_ROOT");
457 List<String> argv = ['--library-root=${options.script}$root']; 457 arguments =
458 argv.addAll(options.arguments); 458 <String>['--library-root=${Platform.script}$root']..addAll(arguments);
459 return compile(argv); 459 return compile(arguments);
460 } 460 }
461 461
462 void help() { 462 void help() {
463 // This message should be no longer than 20 lines. The default 463 // This message should be no longer than 20 lines. The default
464 // terminal size normally 80x24. Two lines are used for the prompts 464 // terminal size normally 80x24. Two lines are used for the prompts
465 // before and after running the compiler. Another two lines may be 465 // before and after running the compiler. Another two lines may be
466 // used to print an error message. 466 // used to print an error message.
467 print(''' 467 print('''
468 Usage: dart2js [options] dartfile 468 Usage: dart2js [options] dartfile
469 469
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 } 582 }
583 exit(0); 583 exit(0);
584 } 584 }
585 585
586 void helpAndFail(String message) { 586 void helpAndFail(String message) {
587 help(); 587 help();
588 print(''); 588 print('');
589 fail(message); 589 fail(message);
590 } 590 }
591 591
592 void mainWithErrorHandler(Options options) { 592 void main(List<String> arguments) {
593 runZoned(() => compilerMain(options), onError: (exception) { 593 runZoned(() => compilerMain(arguments), onError: (exception) {
594 try { 594 try {
595 print('Internal error: $exception'); 595 print('Internal error: $exception');
596 } catch (ignored) { 596 } catch (ignored) {
597 print('Internal error: error while printing exception'); 597 print('Internal error: error while printing exception');
598 } 598 }
599 599
600 try { 600 try {
601 var trace = getAttachedStackTrace(exception); 601 var trace = getAttachedStackTrace(exception);
602 if (trace != null) { 602 if (trace != null) {
603 print(trace); 603 print(trace);
604 } 604 }
605 } finally { 605 } finally {
606 exit(253); // 253 is recognized as a crash by our test scripts. 606 exit(253); // 253 is recognized as a crash by our test scripts.
607 } 607 }
608 }); 608 });
609 } 609 }
610
611 void main() {
612 mainWithErrorHandler(new Options());
613 }
OLDNEW
« no previous file with comments | « runtime/bin/builtin.dart ('k') | sdk/lib/_internal/compiler/samples/darttags/darttags.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698