| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env dart | |
| 2 | |
| 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
| 4 // for details. All rights reserved. Use of this source code is governed by a | |
| 5 // BSD-style license that can be found in the LICENSE file. | |
| 6 | |
| 7 /** The entry point for the analyzer. */ | |
| 8 library analyzer; | |
| 9 | |
| 10 import 'dart:async'; | |
| 11 import 'dart:io'; | |
| 12 | |
| 13 import 'package:analyzer-experimental/options.dart'; | |
| 14 | |
| 15 // Exit status codes. | |
| 16 const OK_EXIT = 0; | |
| 17 const ERROR_EXIT = 1; | |
| 18 | |
| 19 void main() { | |
| 20 run(new Options().arguments).then((result) { | |
| 21 exit(result.error ? ERROR_EXIT : OK_EXIT); | |
| 22 }); | |
| 23 } | |
| 24 | |
| 25 /** The result of an analysis. */ | |
| 26 class AnalysisResult { | |
| 27 final bool error; | |
| 28 AnalysisResult.forFailure() : error = true; | |
| 29 AnalysisResult.forSuccess() : error = false; | |
| 30 } | |
| 31 | |
| 32 | |
| 33 /** | |
| 34 * Runs the dart analyzer with the command-line options in [args]. | |
| 35 * See [CommandLineOptions] for a list of valid arguments. | |
| 36 */ | |
| 37 Future<AnalysisResult> run(List<String> args) { | |
| 38 | |
| 39 var options = new CommandLineOptions.parse(args); | |
| 40 if (options == null) { | |
| 41 return new Future.immediate(new AnalysisResult.forFailure()); | |
| 42 } | |
| 43 | |
| 44 //TODO(pquitslund): call out to analyzer... | |
| 45 | |
| 46 } | |
| OLD | NEW |