| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Smoke test of the dart2js compiler API. | 5 // Smoke test of the dart2js compiler API. |
| 6 library analyze_only; | 6 library analyze_only; |
| 7 | 7 |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:uri'; | 10 import 'dart:uri'; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 print('-----------------------------------------------'); | 35 print('-----------------------------------------------'); |
| 36 print('main source:\n$main'); | 36 print('main source:\n$main'); |
| 37 print('options: $options\n'); | 37 print('options: $options\n'); |
| 38 Future<String> result = | 38 Future<String> result = |
| 39 compile(new Uri.fromComponents(scheme: 'main'), | 39 compile(new Uri.fromComponents(scheme: 'main'), |
| 40 new Uri.fromComponents(scheme: 'lib', path: '/'), | 40 new Uri.fromComponents(scheme: 'lib', path: '/'), |
| 41 new Uri.fromComponents(scheme: 'package', path: '/'), | 41 new Uri.fromComponents(scheme: 'package', path: '/'), |
| 42 localProvider, localHandler, options); | 42 localProvider, localHandler, options); |
| 43 result.then((String code) { | 43 result.then((String code) { |
| 44 onValue(code, errors, warnings); | 44 onValue(code, errors, warnings); |
| 45 }, onError: (AsyncError e) { | 45 }, onError: (e) { |
| 46 throw 'Compilation failed'; | 46 throw 'Compilation failed'; |
| 47 }); | 47 }); |
| 48 } | 48 } |
| 49 | 49 |
| 50 main() { | 50 main() { |
| 51 runCompiler( | 51 runCompiler( |
| 52 "", | 52 "", |
| 53 [], | 53 [], |
| 54 (String code, List errors, List warnings) { | 54 (String code, List errors, List warnings) { |
| 55 Expect.isNull(code); | 55 Expect.isNull(code); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // --analyze-signatures-only implies --analyze-only | 151 // --analyze-signatures-only implies --analyze-only |
| 152 runCompiler( | 152 runCompiler( |
| 153 "", | 153 "", |
| 154 ['--analyze-signatures-only', '--analyze-all'], | 154 ['--analyze-signatures-only', '--analyze-all'], |
| 155 (String code, List errors, List warnings) { | 155 (String code, List errors, List warnings) { |
| 156 Expect.isNull(code); | 156 Expect.isNull(code); |
| 157 Expect.isTrue(errors.isEmpty); | 157 Expect.isTrue(errors.isEmpty); |
| 158 Expect.isTrue(warnings.isEmpty); | 158 Expect.isTrue(warnings.isEmpty); |
| 159 }); | 159 }); |
| 160 } | 160 } |
| OLD | NEW |