| 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 | 6 |
| 7 library dummy_compiler; | 7 library dummy_compiler; |
| 8 | 8 |
| 9 import '../../sdk/lib/_internal/compiler/compiler.dart'; | 9 import '../../sdk/lib/_internal/compiler/compiler.dart'; |
| 10 import 'dart:uri'; | 10 import 'dart:uri'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class JSString {} | 42 class JSString {} |
| 43 class JSFunction {} | 43 class JSFunction {} |
| 44 class JSInt {} | 44 class JSInt {} |
| 45 class JSDouble {} | 45 class JSDouble {} |
| 46 class JSNumber {} | 46 class JSNumber {} |
| 47 class JSNull {} | 47 class JSNull {} |
| 48 class JSBool {} | 48 class JSBool {} |
| 49 var getInterceptor;"""; | 49 var getInterceptor;"""; |
| 50 } else if (uri.path.endsWith('js_helper.dart')) { | 50 } else if (uri.path.endsWith('js_helper.dart')) { |
| 51 source = 'library jshelper; class JSInvocationMirror {}'; | 51 source = 'library jshelper; class JSInvocationMirror {}'; |
| 52 } else if (uri.path.endsWith('isolate_helper.dart')) { |
| 53 source = 'library isolatehelper; class _WorkerStub {}'; |
| 52 } else { | 54 } else { |
| 53 source = "library lib;"; | 55 source = "library lib;"; |
| 54 } | 56 } |
| 55 } else { | 57 } else { |
| 56 throw "unexpected URI $uri"; | 58 throw "unexpected URI $uri"; |
| 57 } | 59 } |
| 58 completer.complete(source); | 60 completer.complete(source); |
| 59 return completer.future; | 61 return completer.future; |
| 60 } | 62 } |
| 61 | 63 |
| 62 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) { | 64 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) { |
| 63 if (uri == null) { | 65 if (uri == null) { |
| 64 print('$kind: $message'); | 66 print('$kind: $message'); |
| 65 } else { | 67 } else { |
| 66 print('$uri:$begin:$end: $kind: $message'); | 68 print('$uri:$begin:$end: $kind: $message'); |
| 67 } | 69 } |
| 68 } | 70 } |
| 69 | 71 |
| 70 main() { | 72 main() { |
| 71 String code = compile(new Uri.fromComponents(scheme: 'main'), | 73 String code = compile(new Uri.fromComponents(scheme: 'main'), |
| 72 new Uri.fromComponents(scheme: 'lib', path: '/'), | 74 new Uri.fromComponents(scheme: 'lib', path: '/'), |
| 73 new Uri.fromComponents(scheme: 'package', path: '/'), | 75 new Uri.fromComponents(scheme: 'package', path: '/'), |
| 74 provider, handler).value; | 76 provider, handler).value; |
| 75 if (code == null) { | 77 if (code == null) { |
| 76 throw 'Compilation failed'; | 78 throw 'Compilation failed'; |
| 77 } | 79 } |
| 78 } | 80 } |
| OLD | NEW |