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

Side by Side Diff: pkg/compiler/lib/src/mirrors/analyze.dart

Issue 1805563002: Revert "Delete support for source mirrors" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/mirrors/dart2js_instance_mirrors.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library dart2js.source_mirrors.analyze;
6
7 import 'dart:async';
8
9 import 'source_mirrors.dart';
10 import 'dart2js_mirrors.dart' show Dart2JsMirrorSystem;
11 import '../../compiler.dart' as api;
12 import '../apiimpl.dart' as apiimpl;
13 import '../compiler.dart' show Compiler;
14 import '../old_to_new_api.dart';
15
16 //------------------------------------------------------------------------------
17 // Analysis entry point.
18 //------------------------------------------------------------------------------
19
20 /**
21 * Analyzes set of libraries and provides a mirror system which can be used for
22 * static inspection of the source code.
23 */
24 // TODO(johnniwinther): Move this to [compiler/compiler.dart].
25 Future<MirrorSystem> analyze(List<Uri> libraries,
26 Uri libraryRoot,
27 Uri packageRoot,
28 api.CompilerInputProvider inputProvider,
29 api.DiagnosticHandler diagnosticHandler,
30 [List<String> options = const <String>[],
31 Uri packageConfig,
32 api.PackagesDiscoveryProvider findPackages]) {
33 if (!libraryRoot.path.endsWith("/")) {
34 throw new ArgumentError("libraryRoot must end with a /");
35 }
36 if (packageRoot != null && !packageRoot.path.endsWith("/")) {
37 throw new ArgumentError("packageRoot must end with a /");
38 }
39 options = new List<String>.from(options);
40 options.add('--analyze-only');
41 options.add('--analyze-signatures-only');
42 options.add('--analyze-all');
43 options.add('--categories=Client,Server');
44 options.add('--enable-async');
45 options.add('--allow-native-extensions');
46
47 bool compilationFailed = false;
48 void internalDiagnosticHandler(Uri uri, int begin, int end,
49 String message, api.Diagnostic kind) {
50 if (kind == api.Diagnostic.ERROR ||
51 kind == api.Diagnostic.CRASH) {
52 compilationFailed = true;
53 }
54 diagnosticHandler(uri, begin, end, message, kind);
55 }
56
57 Compiler compiler = new apiimpl.CompilerImpl(
58 new LegacyCompilerInput(inputProvider),
59 new LegacyCompilerOutput(),
60 new LegacyCompilerDiagnostics(internalDiagnosticHandler),
61 libraryRoot,
62 packageRoot,
63 options,
64 const {},
65 packageConfig,
66 findPackages);
67 compiler.librariesToAnalyzeWhenRun = libraries;
68 return compiler.run(null).then((bool success) {
69 if (success && !compilationFailed) {
70 return new Dart2JsMirrorSystem(compiler);
71 } else {
72 throw new StateError('Failed to create mirror system.');
73 }
74 });
75 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/mirrors/dart2js_instance_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698