OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // This sample demonstrates how to run the compiler in a loop reading | 5 // This sample demonstrates how to run the compiler in a loop reading |
6 // all sources from memory, instead of using dart:io. | 6 // all sources from memory, instead of using dart:io. |
7 library sample.compile_loop; | 7 library sample.compile_loop; |
8 | 8 |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 import 'dart:uri'; | |
11 | 10 |
12 import '../../compiler.dart' as compiler; | 11 import '../../compiler.dart' as compiler; |
13 | 12 |
14 // If this file is missing, generate it using ../jsonify/jsonify.dart. | 13 // If this file is missing, generate it using ../jsonify/jsonify.dart. |
15 import 'sdk.dart'; | 14 import 'sdk.dart'; |
16 | 15 |
17 Future<String> compile(source) { | 16 Future<String> compile(source) { |
18 Future<String> inputProvider(Uri uri) { | 17 Future<String> inputProvider(Uri uri) { |
19 if (uri.scheme == 'sdk') { | 18 if (uri.scheme == 'sdk') { |
20 var value = SDK_SOURCES['$uri']; | 19 var value = SDK_SOURCES['$uri']; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 67 |
69 var greeting = "Hello, World!"; | 68 var greeting = "Hello, World!"; |
70 | 69 |
71 // Displays a greeting. | 70 // Displays a greeting. |
72 void main() { | 71 void main() { |
73 // This example uses HTML to display the greeting and it will appear | 72 // This example uses HTML to display the greeting and it will appear |
74 // in a nested HTML frame (an iframe). | 73 // in a nested HTML frame (an iframe). |
75 document.body.append(new HeadingElement.h1()..appendText(greeting)); | 74 document.body.append(new HeadingElement.h1()..appendText(greeting)); |
76 } | 75 } |
77 '''; | 76 '''; |
OLD | NEW |