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

Side by Side Diff: pkg/compiler/lib/src/dart2js.dart

Issue 1973753004: Change dart2js.dart to use compiler_new.dart (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/source_file_provider.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' show Future; 7 import 'dart:async' show Future;
8 import 'dart:convert' show UTF8, LineSplitter; 8 import 'dart:convert' show UTF8, LineSplitter;
9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr; 9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr;
10 10
11 import 'package:package_config/discovery.dart' show findPackages; 11 import 'package:package_config/discovery.dart' show findPackages;
12 12
13 import '../compiler.dart' as api; 13 import '../compiler_new.dart' as api;
14 import 'commandline_options.dart'; 14 import 'commandline_options.dart';
15 import 'filenames.dart'; 15 import 'filenames.dart';
16 import 'io/source_file.dart'; 16 import 'io/source_file.dart';
17 import 'options.dart' show CompilerOptions;
17 import 'source_file_provider.dart'; 18 import 'source_file_provider.dart';
18 import 'util/command_line.dart'; 19 import 'util/command_line.dart';
19 import 'util/uri_extras.dart'; 20 import 'util/uri_extras.dart';
20 import 'util/util.dart' show stackTraceFilePrefix; 21 import 'util/util.dart' show stackTraceFilePrefix;
21 22
22 const String LIBRARY_ROOT = '../../../../../sdk'; 23 const String LIBRARY_ROOT = '../../../../../sdk';
23 const String OUTPUT_LANGUAGE_DART = 'Dart'; 24 const String OUTPUT_LANGUAGE_DART = 'Dart';
24 25
25 /** 26 /**
26 * A string to identify the revision or build. 27 * A string to identify the revision or build.
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 print(" $filename"); 478 print(" $filename");
478 } 479 }
479 } else if (!explicitOut) { 480 } else if (!explicitOut) {
480 String input = uriPathToNative(arguments[0]); 481 String input = uriPathToNative(arguments[0]);
481 String output = relativize(currentDirectory, out, Platform.isWindows); 482 String output = relativize(currentDirectory, out, Platform.isWindows);
482 print('Dart file ($input) compiled to $outputLanguage: $output'); 483 print('Dart file ($input) compiled to $outputLanguage: $output');
483 } 484 }
484 return result; 485 return result;
485 } 486 }
486 487
487 Uri uri = currentDirectory.resolve(arguments[0]); 488 Uri script = currentDirectory.resolve(arguments[0]);
488 return compileFunc( 489 CompilerOptions compilerOptions = new CompilerOptions.parse(
489 uri, 490 entryPoint: script,
490 libraryRoot, 491 libraryRoot: libraryRoot,
491 packageRoot, 492 packageRoot: packageRoot,
492 inputProvider, 493 packageConfig: packageConfig,
493 diagnosticHandler, 494 packagesDiscoveryProvider: findPackages,
494 options, 495 options: options,
495 outputProvider, 496 environment: environment);
496 environment, 497 return compileFunc(compilerOptions, inputProvider,
497 packageConfig, 498 diagnosticHandler, outputProvider)
498 findPackages)
499 .then(compilationDone); 499 .then(compilationDone);
500 } 500 }
501 501
502 class AbortLeg { 502 class AbortLeg {
503 final message; 503 final message;
504 AbortLeg(this.message); 504 AbortLeg(this.message);
505 toString() => 'Aborted due to --throw-on-error: $message'; 505 toString() => 'Aborted due to --throw-on-error: $message';
506 } 506 }
507 507
508 void writeString(Uri uri, String text) { 508 void writeString(Uri uri, String text) {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 void main(List<String> arguments) { 699 void main(List<String> arguments) {
700 // Since the sdk/bin/dart2js script adds its own arguments in front of 700 // Since the sdk/bin/dart2js script adds its own arguments in front of
701 // user-supplied arguments we search for '--batch' at the end of the list. 701 // user-supplied arguments we search for '--batch' at the end of the list.
702 if (arguments.length > 0 && arguments.last == "--batch") { 702 if (arguments.length > 0 && arguments.last == "--batch") {
703 batchMain(arguments.sublist(0, arguments.length - 1)); 703 batchMain(arguments.sublist(0, arguments.length - 1));
704 return; 704 return;
705 } 705 }
706 internalMain(arguments); 706 internalMain(arguments);
707 } 707 }
708 708
709 var exitFunc = exit; 709 typedef void ExitFunc(int exitCode);
710 var compileFunc = api.compile; 710 typedef Future<api.CompilationResult> CompileFunc(
711 CompilerOptions compilerOptions,
712 api.CompilerInput compilerInput,
713 api.CompilerDiagnostics compilerDiagnostics,
714 api.CompilerOutput compilerOutput);
715
716 ExitFunc exitFunc = exit;
717 CompileFunc compileFunc = api.compile;
711 718
712 Future<api.CompilationResult> internalMain(List<String> arguments) { 719 Future<api.CompilationResult> internalMain(List<String> arguments) {
713 Future onError(exception, trace) { 720 Future onError(exception, trace) {
714 // If we are already trying to exit, just continue exiting. 721 // If we are already trying to exit, just continue exiting.
715 if (exception == _EXIT_SIGNAL) throw exception; 722 if (exception == _EXIT_SIGNAL) throw exception;
716 723
717 try { 724 try {
718 print('The compiler crashed: $exception'); 725 print('The compiler crashed: $exception');
719 } catch (ignored) { 726 } catch (ignored) {
720 print('The compiler crashed: error while printing exception'); 727 print('The compiler crashed: error while printing exception');
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 } else if (exitCode == 253) { 784 } else if (exitCode == 253) {
778 print(">>> TEST CRASH"); 785 print(">>> TEST CRASH");
779 } else { 786 } else {
780 print(">>> TEST FAIL"); 787 print(">>> TEST FAIL");
781 } 788 }
782 stderr.writeln(">>> EOF STDERR"); 789 stderr.writeln(">>> EOF STDERR");
783 subscription.resume(); 790 subscription.resume();
784 }); 791 });
785 }); 792 });
786 } 793 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/source_file_provider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698