OLD | NEW |
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 EventSink, Future; | 7 import 'dart:async' show EventSink, 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 |
(...skipping 22 matching lines...) Expand all Loading... |
33 * | 33 * |
34 * The actual string is rewritten by a wrapper script when included in the sdk. | 34 * The actual string is rewritten by a wrapper script when included in the sdk. |
35 */ | 35 */ |
36 String BUILD_ID = null; | 36 String BUILD_ID = null; |
37 | 37 |
38 /** | 38 /** |
39 * The data passed to the [HandleOption] callback is either a single | 39 * The data passed to the [HandleOption] callback is either a single |
40 * string argument, or the arguments iterator for multiple arguments | 40 * string argument, or the arguments iterator for multiple arguments |
41 * handlers. | 41 * handlers. |
42 */ | 42 */ |
43 typedef void HandleOption(data); | 43 typedef HandleOption = void <- (dynamic data); |
44 | 44 |
45 class OptionHandler { | 45 class OptionHandler { |
46 final String pattern; | 46 final String pattern; |
47 final HandleOption handle; | 47 final HandleOption handle; |
48 final bool multipleArguments; | 48 final bool multipleArguments; |
49 | 49 |
50 OptionHandler(this.pattern, this.handle, {this.multipleArguments: false}); | 50 OptionHandler(this.pattern, this.handle, {this.multipleArguments: false}); |
51 } | 51 } |
52 | 52 |
53 /** | 53 /** |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 void main(List<String> arguments) { | 753 void main(List<String> arguments) { |
754 // Since the sdk/bin/dart2js script adds its own arguments in front of | 754 // Since the sdk/bin/dart2js script adds its own arguments in front of |
755 // user-supplied arguments we search for '--batch' at the end of the list. | 755 // user-supplied arguments we search for '--batch' at the end of the list. |
756 if (arguments.length > 0 && arguments.last == "--batch") { | 756 if (arguments.length > 0 && arguments.last == "--batch") { |
757 batchMain(arguments.sublist(0, arguments.length - 1)); | 757 batchMain(arguments.sublist(0, arguments.length - 1)); |
758 return; | 758 return; |
759 } | 759 } |
760 internalMain(arguments); | 760 internalMain(arguments); |
761 } | 761 } |
762 | 762 |
763 typedef void ExitFunc(int exitCode); | 763 typedef ExitFunc = void <- (int exitCode); |
764 typedef Future<api.CompilationResult> CompileFunc( | 764 typedef CompileFunc = Future<api.CompilationResult> <- ( |
765 CompilerOptions compilerOptions, | 765 CompilerOptions compilerOptions, |
766 api.CompilerInput compilerInput, | 766 api.CompilerInput compilerInput, |
767 api.CompilerDiagnostics compilerDiagnostics, | 767 api.CompilerDiagnostics compilerDiagnostics, |
768 api.CompilerOutput compilerOutput); | 768 api.CompilerOutput compilerOutput); |
769 | 769 |
770 ExitFunc exitFunc = exit; | 770 ExitFunc exitFunc = exit; |
771 CompileFunc compileFunc = api.compile; | 771 CompileFunc compileFunc = api.compile; |
772 | 772 |
773 Future<api.CompilationResult> internalMain(List<String> arguments) { | 773 Future<api.CompilationResult> internalMain(List<String> arguments) { |
774 Future onError(exception, trace) { | 774 Future onError(exception, trace) { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 @override | 1030 @override |
1031 void close() { | 1031 void close() { |
1032 // Do nothing. | 1032 // Do nothing. |
1033 } | 1033 } |
1034 | 1034 |
1035 @override | 1035 @override |
1036 void addError(errorEvent, [StackTrace stackTrace]) { | 1036 void addError(errorEvent, [StackTrace stackTrace]) { |
1037 // Ignore | 1037 // Ignore |
1038 } | 1038 } |
1039 } | 1039 } |
OLD | NEW |