| 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 | 11 |
| 12 import '../../sdk/lib/_internal/compiler/compiler.dart'; | 12 import '../../sdk/lib/_internal/compiler/compiler.dart'; |
| 13 | 13 |
| 14 Future<String> provider(Uri uri) { | 14 Future<String> provider(Uri uri) { |
| 15 String source; | 15 String source; |
| 16 if (uri.scheme == "main") { | 16 if (uri.scheme == "main") { |
| 17 source = "main() {}"; | 17 source = "main() {}"; |
| 18 } else if (uri.scheme == "lib") { | 18 } else if (uri.scheme == "lib") { |
| 19 if (uri.path.endsWith("/core.dart")) { | 19 if (uri.path.endsWith("/core.dart")) { |
| 20 source = """ | 20 source = """ |
| 21 library core; | 21 library core; |
| 22 class Object { | 22 class Object { |
| 23 Object(); |
| 23 operator==(other) {} | 24 operator==(other) {} |
| 24 get hashCode => throw 'Object.hashCode not implemented.'; | 25 get hashCode => throw 'Object.hashCode not implemented.'; |
| 25 } | 26 } |
| 26 class Type {} | 27 class Type {} |
| 27 class bool {} | 28 class bool {} |
| 28 class num {} | 29 class num {} |
| 29 class int {} | 30 class int {} |
| 30 class double{} | 31 class double{} |
| 31 class String{} | 32 class String{} |
| 32 class Function{} | 33 class Function{} |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 new Uri(scheme: 'package', path: '/'), | 107 new Uri(scheme: 'package', path: '/'), |
| 107 provider, handler); | 108 provider, handler); |
| 108 result.then((String code) { | 109 result.then((String code) { |
| 109 if (code == null) { | 110 if (code == null) { |
| 110 throw 'Compilation failed'; | 111 throw 'Compilation failed'; |
| 111 } | 112 } |
| 112 }, onError: (e) { | 113 }, onError: (e) { |
| 113 throw 'Compilation failed'; | 114 throw 'Compilation failed'; |
| 114 }); | 115 }); |
| 115 } | 116 } |
| OLD | NEW |