Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Unified Diff: pkg/compiler/samples/compile_loop/compile_loop.dart

Issue 2221243002: pkg/compiler: remove samples (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/samples/darttags/darttags.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/samples/compile_loop/compile_loop.dart
diff --git a/pkg/compiler/samples/compile_loop/compile_loop.dart b/pkg/compiler/samples/compile_loop/compile_loop.dart
deleted file mode 100644
index 097d04692330b42d5992699b13d4eb43bca590d9..0000000000000000000000000000000000000000
--- a/pkg/compiler/samples/compile_loop/compile_loop.dart
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// This sample demonstrates how to run the compiler in a loop reading
-// all sources from memory, instead of using dart:io.
-library sample.compile_loop;
-
-import 'dart:async';
-
-import '../../lib/compiler.dart' as compiler;
-
-// If this file is missing, generate it using ../jsonify/jsonify.dart.
-import 'sdk.dart';
-
-Future<String> compile(source) {
- Future<String> inputProvider(Uri uri) {
- if (uri.scheme == 'sdk') {
- var value = SDK_SOURCES['$uri'];
- if (value == null) {
- // TODO(ahe): Use new Future.error.
- throw new Exception('Error: Cannot read: $uri');
- }
- return new Future.value(value);
- } else if ('$uri' == 'memory:/main.dart') {
- return new Future.value(source);
- }
- // TODO(ahe): Use new Future.error.
- throw new Exception('Error: Cannot read: $uri');
- }
- void handler(
- Uri uri, int begin, int end, String message, compiler.Diagnostic kind) {
- // TODO(ahe): Remove dart:io import from
- // ../../lib/src/source_file_provider.dart and use
- // FormattingDiagnosticHandler instead.
- print({
- 'uri': '$uri',
- 'begin': begin,
- 'end': end,
- 'message': message,
- 'kind': kind.name
- });
- if (kind == compiler.Diagnostic.ERROR) {
- throw new Exception('Unexpected error occurred.');
- }
- }
- return compiler.compile(Uri.parse('memory:/main.dart'),
- Uri.parse('sdk:/sdk/'), null, inputProvider, handler, []);
-}
-
-int iterations = 10;
-
-main() {
- compile(EXAMPLE_HELLO_HTML).then((jsResult) {
- if (jsResult == null) throw 'Compilation failed';
- if (--iterations > 0) main();
- });
-}
-
-const String EXAMPLE_HELLO_HTML = r'''
-// Go ahead and modify this example.
-
-import "dart:html";
-
-var greeting = "Hello, World!";
-
-// Displays a greeting.
-void main() {
- // This example uses HTML to display the greeting and it will appear
- // in a nested HTML frame (an iframe).
- document.body.append(new HeadingElement.h1()..appendText(greeting));
-}
-''';
« no previous file with comments | « no previous file | pkg/compiler/samples/darttags/darttags.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698