| 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 // VMOptions= | 4 // VMOptions= |
| 5 // VMOptions=--print-object-histogram | 5 // VMOptions=--print-object-histogram |
| 6 | 6 |
| 7 // Smoke test of the dart2js compiler API. | 7 // Smoke test of the dart2js compiler API. |
| 8 library dummy_compiler; | 8 library dummy_compiler; |
| 9 | 9 |
| 10 import 'dart:async'; | 10 import 'dart:async'; |
| 11 import "package:async_helper/async_helper.dart"; | 11 import "package:async_helper/async_helper.dart"; |
| 12 | 12 |
| 13 import 'package:compiler/compiler.dart'; | 13 import 'package:compiler/compiler.dart'; |
| 14 | 14 |
| 15 import '../compiler/dart2js/mock_libraries.dart'; | 15 import '../compiler/dart2js/mock_libraries.dart'; |
| 16 | 16 |
| 17 String libProvider(Uri uri) { | 17 String libProvider(Uri uri) { |
| 18 if (uri.path.endsWith("/core.dart")) { | 18 if (uri.path.endsWith(".platform")) { |
| 19 return DEFAULT_PLATFORM_CONFIG; |
| 20 } if (uri.path.endsWith("/core.dart")) { |
| 19 return buildLibrarySource(DEFAULT_CORE_LIBRARY); | 21 return buildLibrarySource(DEFAULT_CORE_LIBRARY); |
| 20 } else if (uri.path.endsWith('core_patch.dart')) { | 22 } else if (uri.path.endsWith('core_patch.dart')) { |
| 21 return DEFAULT_PATCH_CORE_SOURCE; | 23 return DEFAULT_PATCH_CORE_SOURCE; |
| 22 } else if (uri.path.endsWith('interceptors.dart')) { | 24 } else if (uri.path.endsWith('interceptors.dart')) { |
| 23 return buildLibrarySource(DEFAULT_INTERCEPTORS_LIBRARY); | 25 return buildLibrarySource(DEFAULT_INTERCEPTORS_LIBRARY); |
| 24 } else if (uri.path.endsWith('js_helper.dart')) { | 26 } else if (uri.path.endsWith('js_helper.dart')) { |
| 25 return buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY); | 27 return buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY); |
| 26 } else if (uri.path.endsWith('isolate_helper.dart')) { | 28 } else if (uri.path.endsWith('isolate_helper.dart')) { |
| 27 return buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY); | 29 return buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY); |
| 28 } else if (uri.path.endsWith('/async.dart')) { | 30 } else if (uri.path.endsWith('/async.dart')) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 new Uri(scheme: 'package', path: '/'), | 62 new Uri(scheme: 'package', path: '/'), |
| 61 provider, handler); | 63 provider, handler); |
| 62 result.then((CompilationResult result) { | 64 result.then((CompilationResult result) { |
| 63 if (!result.isSuccess) { | 65 if (!result.isSuccess) { |
| 64 throw 'Compilation failed'; | 66 throw 'Compilation failed'; |
| 65 } | 67 } |
| 66 }, onError: (e, s) { | 68 }, onError: (e, s) { |
| 67 throw 'Compilation failed: $e\n$s'; | 69 throw 'Compilation failed: $e\n$s'; |
| 68 }).then(asyncSuccess); | 70 }).then(asyncSuccess); |
| 69 } | 71 } |
| OLD | NEW |