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

Unified Diff: dart/site/try/poi/poi.dart

Issue 386563002: Add "point of interest" app for command-line testing of dart2js type information. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | dart/tests/compiler/dart2js/memory_compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/poi/poi.dart
diff --git a/dart/site/try/poi/poi.dart b/dart/site/try/poi/poi.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4b4bcd9dae57ef2c653c6c8d562f6a6bad138328
--- /dev/null
+++ b/dart/site/try/poi/poi.dart
@@ -0,0 +1,63 @@
+// Copyright (c) 2014, 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.
+
+library trydart.poi;
+
+import 'dart:async' show
+ Future;
+
+import 'dart:io' show
+ Platform;
+
+import 'package:dart2js_incremental/dart2js_incremental.dart' show
+ reuseCompiler;
+
+import 'package:compiler/implementation/source_file_provider.dart' show
+ FormattingDiagnosticHandler,
+ SourceFileProvider;
+
+import 'package:compiler/compiler.dart' as api show
+ Diagnostic;
+
+Future doneFuture;
+
+void main(List<String> arguments) {
+ Uri script = Uri.base.resolve(arguments.first);
+ int position = int.parse(arguments[1]);
+ FormattingDiagnosticHandler handler = new FormattingDiagnosticHandler();
+ handler
+ ..verbose = true
+ ..enableColors = true;
+
+ Uri libraryRoot = Uri.base.resolve('sdk/');
+ Uri packageRoot = Uri.base.resolveUri(
+ new Uri.file('${Platform.packageRoot}/'));
+
+ var options = [
+ '--analyze-main',
+ '--analyze-only',
+ '--no-source-maps',
+ '--verbose',
+ '--categories=Client,Server',
+ ];
+
+ var cachedCompiler = null;
+ cachedCompiler = reuseCompiler(
+ diagnosticHandler: handler,
+ inputProvider: handler.provider,
+ options: options,
+ cachedCompiler: cachedCompiler,
+ libraryRoot: libraryRoot,
+ packageRoot: packageRoot,
+ packagesAreImmutable: true);
+
+ doneFuture = cachedCompiler.run(script).then((success) {
+ if (success != true) {
+ throw 'Compilation failed';
+ }
+ handler(
+ script, position, position + 1,
+ 'Point of interest.', api.Diagnostic.HINT);
+ });
+}
« no previous file with comments | « no previous file | dart/tests/compiler/dart2js/memory_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698