OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:io'; | 5 import 'dart:io'; |
6 import 'package:analyzer/src/command_line/arguments.dart' | 6 import 'package:analyzer/src/command_line/arguments.dart' |
7 show | 7 show |
8 defineAnalysisArguments, | 8 defineAnalysisArguments, |
9 filterUnknownArguments, | 9 filterUnknownArguments, |
10 ignoreUnrecognizedFlagsFlag; | 10 ignoreUnrecognizedFlagsFlag; |
11 import 'package:analyzer/src/generated/source.dart' show Source; | 11 import 'package:analyzer/src/generated/source.dart' show Source; |
12 import 'package:analyzer/src/summary/package_bundle_reader.dart' | 12 import 'package:analyzer/src/summary/package_bundle_reader.dart' |
13 show ConflictingSummaryException, InSummarySource; | 13 show InSummarySource; |
14 import 'package:args/args.dart' show ArgParser, ArgResults; | 14 import 'package:args/args.dart' show ArgParser, ArgResults; |
15 import 'package:args/command_runner.dart' show UsageException; | 15 import 'package:args/command_runner.dart' show UsageException; |
16 import 'package:path/path.dart' as path; | 16 import 'package:path/path.dart' as path; |
17 | 17 |
18 import '../analyzer/context.dart' show AnalyzerOptions; | 18 import '../analyzer/context.dart' show AnalyzerOptions; |
19 import 'compiler.dart' show BuildUnit, CompilerOptions, ModuleCompiler; | 19 import 'compiler.dart' show BuildUnit, CompilerOptions, ModuleCompiler; |
20 import 'module_builder.dart'; | 20 import 'module_builder.dart'; |
21 | 21 |
22 const _binaryName = 'dartdevc'; | 22 const _binaryName = 'dartdevc'; |
23 | 23 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return 0; | 56 return 0; |
57 } | 57 } |
58 | 58 |
59 try { | 59 try { |
60 _compile(argResults, analyzerOptions, printFn); | 60 _compile(argResults, analyzerOptions, printFn); |
61 return 0; | 61 return 0; |
62 } on UsageException catch (error) { | 62 } on UsageException catch (error) { |
63 // Incorrect usage, input file not found, etc. | 63 // Incorrect usage, input file not found, etc. |
64 printFn(error); | 64 printFn(error); |
65 return 64; | 65 return 64; |
66 } on ConflictingSummaryException catch (error) { | |
67 // Same input file appears in multiple provided summaries. | |
68 printFn(error); | |
69 return 65; | |
70 } on CompileErrorException catch (error) { | 66 } on CompileErrorException catch (error) { |
71 // Code has error(s) and failed to compile. | 67 // Code has error(s) and failed to compile. |
72 printFn(error); | 68 printFn(error); |
73 return 1; | 69 return 1; |
74 } catch (error, stackTrace) { | 70 } catch (error, stackTrace) { |
75 // Anything else is likely a compiler bug. | 71 // Anything else is likely a compiler bug. |
76 // | 72 // |
77 // --unsafe-force-compile is a bit of a grey area, but it's nice not to | 73 // --unsafe-force-compile is a bit of a grey area, but it's nice not to |
78 // crash while compiling | 74 // crash while compiling |
79 // (of course, output code may crash, if it had errors). | 75 // (of course, output code may crash, if it had errors). |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 250 } |
255 | 251 |
256 void _usageException(String message) { | 252 void _usageException(String message) { |
257 throw new UsageException(message, _usageMessage); | 253 throw new UsageException(message, _usageMessage); |
258 } | 254 } |
259 | 255 |
260 /// Thrown when the input source code has errors. | 256 /// Thrown when the input source code has errors. |
261 class CompileErrorException implements Exception { | 257 class CompileErrorException implements Exception { |
262 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; | 258 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; |
263 } | 259 } |
OLD | NEW |