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

Unified Diff: sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart

Issue 14198010: Revert "Remove dartdoc specific methods from dart2js_mirror." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | sdk/lib/_internal/dartdoc/lib/dartdoc.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
index 7305602b351a21fc2dcdc26c07598291d0a6eae8..f3dce015cc55fc42c11c8323d4d06b3000d67609 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
@@ -6,18 +6,25 @@ library mirrors_dart2js;
import 'dart:async';
import 'dart:collection' show LinkedHashMap;
+import 'dart:io' show Path;
import 'dart:uri';
import '../../compiler.dart' as api;
import '../elements/elements.dart';
+import '../resolution/resolution.dart' show ResolverTask, ResolverVisitor;
import '../apiimpl.dart' as apiimpl;
import '../scanner/scannerlib.dart' hide SourceString;
+import '../ssa/ssa.dart';
import '../dart2jslib.dart';
import '../dart_types.dart';
+import '../filenames.dart';
import '../source_file.dart';
import '../tree/tree.dart';
-import '../util/util.dart' show Spannable, Link;
-import '../util/characters.dart' show $CR, $LF;
+import '../util/util.dart';
+import '../util/uri_extras.dart';
+import '../dart2js.dart';
+import '../util/characters.dart';
+import '../source_file_provider.dart';
import 'mirrors.dart';
import 'mirrors_util.dart';
@@ -185,20 +192,50 @@ String _getOperatorFromOperatorName(String name) {
}
//------------------------------------------------------------------------------
-// Analysis entry point.
+// Compilation implementation
//------------------------------------------------------------------------------
+// TODO(johnniwinther): Support client configurable providers.
+
+/**
+ * Returns a future that completes to a non-null String when [script]
+ * has been successfully compiled.
+ *
+ * TODO(johnniwinther): The method is deprecated but here to support [Path]
+ * which is used through dartdoc.
+ */
+Future<String> compile(Path script,
+ Path libraryRoot,
+ {Path packageRoot,
+ List<String> options: const <String>[],
+ api.DiagnosticHandler diagnosticHandler}) {
+ SourceFileProvider provider = new SourceFileProvider();
+ if (diagnosticHandler == null) {
+ diagnosticHandler =
+ new FormattingDiagnosticHandler(provider).diagnosticHandler;
+ }
+ Uri scriptUri = currentDirectory.resolve(script.toString());
+ Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
+ Uri packageUri = null;
+ if (packageRoot != null) {
+ packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
+ }
+ return api.compile(scriptUri, libraryUri, packageUri,
+ provider.readStringFromUri, diagnosticHandler, options);
+}
+
/**
* Analyzes set of libraries and provides a mirror system which can be used for
* static inspection of the source code.
*/
-// TODO(johnniwinther): Move this to [compiler/compiler.dart].
-Future<MirrorSystem> analyze(List<Uri> libraries,
- Uri libraryRoot,
- Uri packageRoot,
- api.CompilerInputProvider inputProvider,
- api.DiagnosticHandler diagnosticHandler,
- [List<String> options = const <String>[]]) {
+// TODO(johnniwinther): Move this to [compiler/compiler.dart] and rename to
+// [:analyze:].
+Future<MirrorSystem> analyzeUri(List<Uri> libraries,
+ Uri libraryRoot,
+ Uri packageRoot,
+ api.CompilerInputProvider inputProvider,
+ api.DiagnosticHandler diagnosticHandler,
+ [List<String> options = const <String>[]]) {
if (!libraryRoot.path.endsWith("/")) {
throw new ArgumentError("libraryRoot must end with a /");
}
@@ -233,6 +270,35 @@ Future<MirrorSystem> analyze(List<Uri> libraries,
}
}
+/**
+ * Analyzes set of libraries and provides a mirror system which can be used for
+ * static inspection of the source code.
+ */
+// TODO(johnniwinther): Move dart:io dependent parts outside
+// dart2js_mirror.dart.
+Future<MirrorSystem> analyze(List<Path> libraries,
+ Path libraryRoot,
+ {Path packageRoot,
+ List<String> options: const <String>[],
+ api.DiagnosticHandler diagnosticHandler}) {
+ SourceFileProvider provider = new SourceFileProvider();
+ if (diagnosticHandler == null) {
+ diagnosticHandler =
+ new FormattingDiagnosticHandler(provider).diagnosticHandler;
+ }
+ Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
+ Uri packageUri = null;
+ if (packageRoot != null) {
+ packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
+ }
+ List<Uri> librariesUri = <Uri>[];
+ for (Path library in libraries) {
+ librariesUri.add(currentDirectory.resolve(library.toString()));
+ }
+ return analyzeUri(librariesUri, libraryUri, packageUri,
+ provider.readStringFromUri, diagnosticHandler, options);
+}
+
//------------------------------------------------------------------------------
// Dart2Js specific extensions of mirror interfaces
//------------------------------------------------------------------------------
« no previous file with comments | « no previous file | sdk/lib/_internal/dartdoc/lib/dartdoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698