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

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

Issue 1235563003: Add interfaces for a new compiler API. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased Created 5 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 unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/dart2jslib.dart ('k') | pkg/compiler/lib/src/null_compiler_output.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.source_mirrors.analyze; 5 library dart2js.source_mirrors.analyze;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'source_mirrors.dart'; 9 import 'source_mirrors.dart';
10 import 'dart2js_mirrors.dart' show Dart2JsMirrorSystem; 10 import 'dart2js_mirrors.dart' show Dart2JsMirrorSystem;
11 import '../../compiler.dart' as api; 11 import '../../compiler.dart' as api;
12 import '../apiimpl.dart' as apiimpl; 12 import '../apiimpl.dart' as apiimpl;
13 import '../dart2jslib.dart' show Compiler; 13 import '../dart2jslib.dart' show Compiler;
14 import '../old_to_new_api.dart';
14 15
15 //------------------------------------------------------------------------------ 16 //------------------------------------------------------------------------------
16 // Analysis entry point. 17 // Analysis entry point.
17 //------------------------------------------------------------------------------ 18 //------------------------------------------------------------------------------
18 19
19 /** 20 /**
20 * Analyzes set of libraries and provides a mirror system which can be used for 21 * Analyzes set of libraries and provides a mirror system which can be used for
21 * static inspection of the source code. 22 * static inspection of the source code.
22 */ 23 */
23 // TODO(johnniwinther): Move this to [compiler/compiler.dart]. 24 // TODO(johnniwinther): Move this to [compiler/compiler.dart].
(...skipping 22 matching lines...) Expand all
46 bool compilationFailed = false; 47 bool compilationFailed = false;
47 void internalDiagnosticHandler(Uri uri, int begin, int end, 48 void internalDiagnosticHandler(Uri uri, int begin, int end,
48 String message, api.Diagnostic kind) { 49 String message, api.Diagnostic kind) {
49 if (kind == api.Diagnostic.ERROR || 50 if (kind == api.Diagnostic.ERROR ||
50 kind == api.Diagnostic.CRASH) { 51 kind == api.Diagnostic.CRASH) {
51 compilationFailed = true; 52 compilationFailed = true;
52 } 53 }
53 diagnosticHandler(uri, begin, end, message, kind); 54 diagnosticHandler(uri, begin, end, message, kind);
54 } 55 }
55 56
56 Compiler compiler = new apiimpl.Compiler(inputProvider, 57 Compiler compiler = new apiimpl.Compiler(
57 null, 58 new LegacyCompilerInput(inputProvider),
58 internalDiagnosticHandler, 59 new LegacyCompilerOutput(),
59 libraryRoot, 60 new LegacyCompilerDiagnostics(internalDiagnosticHandler),
60 packageRoot, 61 libraryRoot,
61 options, 62 packageRoot,
62 const {}, 63 options,
63 packageConfig, 64 const {},
64 findPackages); 65 packageConfig,
66 findPackages);
65 compiler.librariesToAnalyzeWhenRun = libraries; 67 compiler.librariesToAnalyzeWhenRun = libraries;
66 return compiler.run(null).then((bool success) { 68 return compiler.run(null).then((bool success) {
67 if (success && !compilationFailed) { 69 if (success && !compilationFailed) {
68 return new Dart2JsMirrorSystem(compiler); 70 return new Dart2JsMirrorSystem(compiler);
69 } else { 71 } else {
70 throw new StateError('Failed to create mirror system.'); 72 throw new StateError('Failed to create mirror system.');
71 } 73 }
72 }); 74 });
73 } 75 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart2jslib.dart ('k') | pkg/compiler/lib/src/null_compiler_output.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698