| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 library trydart.poi; |
| 6 |
| 7 import 'dart:async' show |
| 8 Future; |
| 9 |
| 10 import 'dart:io' show |
| 11 Platform; |
| 12 |
| 13 import 'package:dart2js_incremental/dart2js_incremental.dart' show |
| 14 reuseCompiler; |
| 15 |
| 16 import 'package:compiler/implementation/source_file_provider.dart' show |
| 17 FormattingDiagnosticHandler, |
| 18 SourceFileProvider; |
| 19 |
| 20 import 'package:compiler/compiler.dart' as api show |
| 21 Diagnostic; |
| 22 |
| 23 Future doneFuture; |
| 24 |
| 25 void main(List<String> arguments) { |
| 26 Uri script = Uri.base.resolve(arguments.first); |
| 27 int position = int.parse(arguments[1]); |
| 28 FormattingDiagnosticHandler handler = new FormattingDiagnosticHandler(); |
| 29 handler |
| 30 ..verbose = true |
| 31 ..enableColors = true; |
| 32 |
| 33 Uri libraryRoot = Uri.base.resolve('sdk/'); |
| 34 Uri packageRoot = Uri.base.resolveUri( |
| 35 new Uri.file('${Platform.packageRoot}/')); |
| 36 |
| 37 var options = [ |
| 38 '--analyze-main', |
| 39 '--analyze-only', |
| 40 '--no-source-maps', |
| 41 '--verbose', |
| 42 '--categories=Client,Server', |
| 43 ]; |
| 44 |
| 45 var cachedCompiler = null; |
| 46 cachedCompiler = reuseCompiler( |
| 47 diagnosticHandler: handler, |
| 48 inputProvider: handler.provider, |
| 49 options: options, |
| 50 cachedCompiler: cachedCompiler, |
| 51 libraryRoot: libraryRoot, |
| 52 packageRoot: packageRoot, |
| 53 packagesAreImmutable: true); |
| 54 |
| 55 doneFuture = cachedCompiler.run(script).then((success) { |
| 56 if (success != true) { |
| 57 throw 'Compilation failed'; |
| 58 } |
| 59 handler( |
| 60 script, position, position + 1, |
| 61 'Point of interest.', api.Diagnostic.HINT); |
| 62 }); |
| 63 } |
| OLD | NEW |