Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
|
ngeoffray
2012/03/23 08:08:40
What is this test about? Please add a comment.
ahe
2012/03/23 11:56:40
Done.
| |
| 4 | |
| 5 #import('../../../frog/leg/api.dart'); | |
| 6 #import('../../../lib/uri/uri.dart'); | |
| 7 | |
| 8 Future<String> provider(Uri uri) { | |
| 9 Completer<String> completer = new Completer<String>(); | |
| 10 String source; | |
| 11 if (uri.scheme == "main") { | |
| 12 source = "main() {}"; | |
| 13 } else { | |
| 14 source = ""; | |
| 15 } | |
| 16 completer.complete(source); | |
| 17 return completer.future; | |
| 18 } | |
| 19 | |
| 20 void handler(Uri uri, int begin, int end, String message, bool fatal) { | |
| 21 print(message); | |
| 22 } | |
| 23 | |
| 24 main() { | |
| 25 String code = compile(new Uri(scheme: 'main'), new Uri(scheme: 'lib'), | |
| 26 provider, handler).value; | |
| 27 if (code === null) { | |
| 28 throw 'Compilation failed'; | |
| 29 } | |
| 30 } | |
| OLD | NEW |