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

Side by Side Diff: pkg/docgen/lib/src/dart2js_mirrors.dart

Issue 16948010: added Command Line Arguments, support for directories, hiding private data, not parsing the SDK, rem (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library dart2js_util; 5 library dart2js_util;
6 6
7 // TODO(tmandel): This is a temporary copy of the dart2js_mirrors.dart 7 // TODO(tmandel): This is a temporary copy of the dart2js_mirrors.dart
8 // file in the dartdoc folder. One of the two should be deleted 8 // file in the dartdoc folder. One of the two should be deleted
9 // when docgen can replace dartdoc. 9 // when docgen can replace dartdoc.
10 10
11 import 'dart:async' show Future; 11 import 'dart:async' show Future;
12 import 'dart:io' show Path; 12 import 'dart:io' show Path;
13 13
14 import '../../../../sdk/lib/_internal/compiler/compiler.dart' as api; 14 import 'package:compiler_unsupported/compiler.dart' as api;
15 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mi rror.dart' 15 import 'package:compiler_unsupported/implementation/mirrors/dart2js_mirror.dart'
16 as dart2js show analyze, Dart2JsMirrorSystem; 16 as dart2js show analyze, Dart2JsMirrorSystem;
17 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.da rt' 17 import 'package:compiler_unsupported/implementation/mirrors/mirrors.dart'
18 show MirrorSystem; 18 show MirrorSystem;
19 import '../../../../sdk/lib/_internal/compiler/implementation/source_file_provid er.dart' 19 import 'package:compiler_unsupported/implementation/source_file_provider.dart'
20 show FormattingDiagnosticHandler, SourceFileProvider; 20 show FormattingDiagnosticHandler, SourceFileProvider;
21 import '../../../../sdk/lib/_internal/compiler/implementation/filenames.dart' 21 import 'package:compiler_unsupported/implementation/filenames.dart'
22 show appendSlash, currentDirectory; 22 show appendSlash, currentDirectory;
23 23
24 // TODO(johnniwinther): Support client configurable providers.
25
26 /**
27 * Returns a future that completes to a non-null String when [script]
28 * has been successfully compiled.
29 */
30 // TODO(amouravski): Remove this method and call dart2js via a process instead.
31 Future<String> compile(Path script,
32 Path libraryRoot,
33 {Path packageRoot,
34 List<String> options: const <String>[],
35 api.DiagnosticHandler diagnosticHandler}) {
36 SourceFileProvider provider = new SourceFileProvider();
37 if (diagnosticHandler == null) {
38 diagnosticHandler =
39 new FormattingDiagnosticHandler(provider).diagnosticHandler;
40 }
41 Uri scriptUri = currentDirectory.resolve(script.toString());
42 Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
43 Uri packageUri = null;
44 if (packageRoot != null) {
45 packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
46 }
47 return api.compile(scriptUri, libraryUri, packageUri,
48 provider.readStringFromUri, diagnosticHandler, options);
49 }
50
51 /** 24 /**
52 * Analyzes set of libraries and provides a mirror system which can be used for 25 * Analyzes set of libraries and provides a mirror system which can be used for
53 * static inspection of the source code. 26 * static inspection of the source code.
54 */ 27 */
55 Future<MirrorSystem> analyze(List<Path> libraries, 28 Future<MirrorSystem> analyze(List<Path> libraries,
56 Path libraryRoot, 29 Path libraryRoot,
57 {Path packageRoot, 30 {Path packageRoot,
58 List<String> options: const <String>[], 31 List<String> options: const <String>[],
59 api.DiagnosticHandler diagnosticHandler}) { 32 api.DiagnosticHandler diagnosticHandler}) {
60 SourceFileProvider provider = new SourceFileProvider(); 33 SourceFileProvider provider = new SourceFileProvider();
61 if (diagnosticHandler == null) { 34 if (diagnosticHandler == null) {
62 diagnosticHandler = 35 diagnosticHandler =
63 new FormattingDiagnosticHandler(provider).diagnosticHandler; 36 new FormattingDiagnosticHandler(provider).diagnosticHandler;
64 } 37 }
65 Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot')); 38 Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
66 Uri packageUri = null; 39 Uri packageUri = null;
67 if (packageRoot != null) { 40 if (packageRoot != null) {
68 packageUri = currentDirectory.resolve(appendSlash('$packageRoot')); 41 packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
69 } 42 }
70 List<Uri> librariesUri = <Uri>[]; 43 List<Uri> librariesUri = <Uri>[];
71 for (Path library in libraries) { 44 for (Path library in libraries) {
72 librariesUri.add(currentDirectory.resolve(library.toString())); 45 librariesUri.add(currentDirectory.resolve(library.toString()));
73 } 46 }
74 return dart2js.analyze(librariesUri, libraryUri, packageUri, 47 return dart2js.analyze(librariesUri, libraryUri, packageUri,
75 provider.readStringFromUri, diagnosticHandler, 48 provider.readStringFromUri, diagnosticHandler,
76 options); 49 options);
77 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698