| 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 "package:async_helper/async_helper.dart"; | 10 import "package:async_helper/async_helper.dart"; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 print('options: $options\n'); | 42 print('options: $options\n'); |
| 43 asyncStart(); | 43 asyncStart(); |
| 44 OutputCollector outputCollector = new OutputCollector(); | 44 OutputCollector outputCollector = new OutputCollector(); |
| 45 Future<CompilationResult> result = | 45 Future<CompilationResult> result = |
| 46 compile(new Uri(scheme: 'main'), | 46 compile(new Uri(scheme: 'main'), |
| 47 new Uri(scheme: 'lib', path: '/'), | 47 new Uri(scheme: 'lib', path: '/'), |
| 48 new Uri(scheme: 'package', path: '/'), | 48 new Uri(scheme: 'package', path: '/'), |
| 49 localProvider, localHandler, options, outputCollector); | 49 localProvider, localHandler, options, outputCollector); |
| 50 result.then((_) { | 50 result.then((_) { |
| 51 onValue(outputCollector.getOutput('', 'js'), errors, warnings); | 51 onValue(outputCollector.getOutput('', 'js'), errors, warnings); |
| 52 }, onError: (e) { | 52 }, onError: (e, st) { |
| 53 throw 'Compilation failed: ${Error.safeToString(e)}'; | 53 throw 'Compilation failed: ${e} ${st}'; |
| 54 }).then(asyncSuccess).catchError((error, stack) { | 54 }).then(asyncSuccess).catchError((error, stack) { |
| 55 print('\n\n-----------------------------------------------'); | 55 print('\n\n-----------------------------------------------'); |
| 56 print('main source:\n$main'); | 56 print('main source:\n$main'); |
| 57 print('options: $options\n'); | 57 print('options: $options\n'); |
| 58 print('threw:\n $error\n$stack'); | 58 print('threw:\n $error\n$stack'); |
| 59 print('-----------------------------------------------\n\n'); | 59 print('-----------------------------------------------\n\n'); |
| 60 throw error; | 60 throw error; |
| 61 }); | 61 }); |
| 62 } | 62 } |
| 63 | 63 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // --analyze-signatures-only implies --analyze-only | 177 // --analyze-signatures-only implies --analyze-only |
| 178 runCompiler( | 178 runCompiler( |
| 179 "", | 179 "", |
| 180 [Flags.analyzeSignaturesOnly, Flags.analyzeAll], | 180 [Flags.analyzeSignaturesOnly, Flags.analyzeAll], |
| 181 (String code, List errors, List warnings) { | 181 (String code, List errors, List warnings) { |
| 182 Expect.isNull(code); | 182 Expect.isNull(code); |
| 183 Expect.isTrue(errors.isEmpty); | 183 Expect.isTrue(errors.isEmpty); |
| 184 Expect.isTrue(warnings.isEmpty); | 184 Expect.isTrue(warnings.isEmpty); |
| 185 }); | 185 }); |
| 186 } | 186 } |
| OLD | NEW |