| 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 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 import 'package:async_helper/async_helper.dart'; | 10 import 'package:async_helper/async_helper.dart'; |
| 11 import 'package:expect/expect.dart'; | 11 import 'package:expect/expect.dart'; |
| 12 | 12 |
| 13 import 'package:compiler/compiler_new.dart'; | 13 import 'package:compiler/compiler_new.dart'; |
| 14 import 'package:compiler/src/commandline_options.dart'; | 14 import 'package:compiler/src/commandline_options.dart'; |
| 15 import 'package:compiler/src/diagnostics/messages.dart' | 15 import 'package:compiler/src/diagnostics/messages.dart' |
| 16 show MessageKind, MessageTemplate; | 16 show MessageKind, MessageTemplate; |
| 17 import 'package:compiler/src/old_to_new_api.dart'; | 17 import 'package:compiler/src/old_to_new_api.dart'; |
| 18 import 'package:compiler/src/options.dart'; | 18 import 'package:compiler/src/options.dart'; |
| 19 | 19 |
| 20 import 'dummy_compiler_test.dart' as dummy; | 20 import '../dart2js_extra/dummy_compiler_test.dart' as dummy; |
| 21 import 'output_collector.dart'; | 21 import 'output_collector.dart'; |
| 22 | 22 |
| 23 runCompiler(String main, List<String> options, | 23 runCompiler(String main, List<String> options, |
| 24 onValue(String code, List errors, List warnings)) { | 24 onValue(String code, List errors, List warnings)) { |
| 25 List errors = new List(); | 25 List errors = new List(); |
| 26 List warnings = new List(); | 26 List warnings = new List(); |
| 27 | 27 |
| 28 Future<String> localProvider(Uri uri) { | 28 Future<String> localProvider(Uri uri) { |
| 29 if (uri.scheme != 'main') return dummy.provider(uri); | 29 if (uri.scheme != 'main') return dummy.provider(uri); |
| 30 return new Future<String>.value(main); | 30 return new Future<String>.value(main); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 runCompiler( | 183 runCompiler( |
| 184 """main() {} | 184 """main() {} |
| 185 foo() native 'foo';""", | 185 foo() native 'foo';""", |
| 186 [Flags.analyzeOnly], (String code, List errors, List warnings) { | 186 [Flags.analyzeOnly], (String code, List errors, List warnings) { |
| 187 Expect.isNull(code); | 187 Expect.isNull(code); |
| 188 Expect.isTrue( | 188 Expect.isTrue( |
| 189 errors.single.startsWith("'native' modifier is not supported.")); | 189 errors.single.startsWith("'native' modifier is not supported.")); |
| 190 Expect.isTrue(warnings.isEmpty); | 190 Expect.isTrue(warnings.isEmpty); |
| 191 }); | 191 }); |
| 192 } | 192 } |
| OLD | NEW |