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

Unified Diff: sdk/lib/_internal/compiler/samples/compile_loop/compile_loop.dart

Issue 694353007: Move dart2js from sdk/lib/_internal/compiler to pkg/compiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
Index: sdk/lib/_internal/compiler/samples/compile_loop/compile_loop.dart
diff --git a/sdk/lib/_internal/compiler/samples/compile_loop/compile_loop.dart b/sdk/lib/_internal/compiler/samples/compile_loop/compile_loop.dart
deleted file mode 100644
index f4920ae77c5dab12b717f311fd5ff3775304eebf..0000000000000000000000000000000000000000
--- a/sdk/lib/_internal/compiler/samples/compile_loop/compile_loop.dart
+++ /dev/null
@@ -1,76 +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 '../../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
- // ../../implementation/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 | « sdk/lib/_internal/compiler/implementation/world.dart ('k') | sdk/lib/_internal/compiler/samples/darttags/darttags.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698