| 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 InSummarySource; | 13 show ConflictingSummaryException, 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; |
| 66 } on CompileErrorException catch (error) { | 70 } on CompileErrorException catch (error) { |
| 67 // Code has error(s) and failed to compile. | 71 // Code has error(s) and failed to compile. |
| 68 printFn(error); | 72 printFn(error); |
| 69 return 1; | 73 return 1; |
| 70 } catch (error, stackTrace) { | 74 } catch (error, stackTrace) { |
| 71 // Anything else is likely a compiler bug. | 75 // Anything else is likely a compiler bug. |
| 72 // | 76 // |
| 73 // --unsafe-force-compile is a bit of a grey area, but it's nice not to | 77 // --unsafe-force-compile is a bit of a grey area, but it's nice not to |
| 74 // crash while compiling | 78 // crash while compiling |
| 75 // (of course, output code may crash, if it had errors). | 79 // (of course, output code may crash, if it had errors). |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } | 254 } |
| 251 | 255 |
| 252 void _usageException(String message) { | 256 void _usageException(String message) { |
| 253 throw new UsageException(message, _usageMessage); | 257 throw new UsageException(message, _usageMessage); |
| 254 } | 258 } |
| 255 | 259 |
| 256 /// Thrown when the input source code has errors. | 260 /// Thrown when the input source code has errors. |
| 257 class CompileErrorException implements Exception { | 261 class CompileErrorException implements Exception { |
| 258 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; | 262 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; |
| 259 } | 263 } |
| OLD | NEW |