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 |
Johnni Winther
2017/07/19 11:29:58
This doesn't work. dummy_compiler_test and recursi
| |
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 dummy_compiler; | 6 library dummy_compiler; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import "package:async_helper/async_helper.dart"; | |
10 | 9 |
10 import 'package:async_helper/async_helper.dart'; | |
11 import 'package:compiler/compiler.dart'; | 11 import 'package:compiler/compiler.dart'; |
12 | 12 |
13 import '../compiler/dart2js/mock_libraries.dart'; | 13 import 'mock_libraries.dart'; |
14 | 14 |
15 String libProvider(Uri uri) { | 15 String libProvider(Uri uri) { |
16 if (uri.path.endsWith(".platform")) { | 16 if (uri.path.endsWith(".platform")) { |
17 return DEFAULT_PLATFORM_CONFIG; | 17 return DEFAULT_PLATFORM_CONFIG; |
18 } | 18 } |
19 if (uri.path.endsWith("/core.dart")) { | 19 if (uri.path.endsWith("/core.dart")) { |
20 return buildLibrarySource(DEFAULT_CORE_LIBRARY); | 20 return buildLibrarySource(DEFAULT_CORE_LIBRARY); |
21 } else if (uri.path.endsWith('core_patch.dart')) { | 21 } else if (uri.path.endsWith('core_patch.dart')) { |
22 return DEFAULT_PATCH_CORE_SOURCE; | 22 return DEFAULT_PATCH_CORE_SOURCE; |
23 } else if (uri.path.endsWith('internal.dart')) { | 23 } else if (uri.path.endsWith('internal.dart')) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 provider, | 64 provider, |
65 handler); | 65 handler); |
66 result.then((CompilationResult result) { | 66 result.then((CompilationResult result) { |
67 if (!result.isSuccess) { | 67 if (!result.isSuccess) { |
68 throw 'Compilation failed'; | 68 throw 'Compilation failed'; |
69 } | 69 } |
70 }, onError: (e, s) { | 70 }, onError: (e, s) { |
71 throw 'Compilation failed: $e\n$s'; | 71 throw 'Compilation failed: $e\n$s'; |
72 }).then(asyncSuccess); | 72 }).then(asyncSuccess); |
73 } | 73 } |
OLD | NEW |