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

Unified Diff: bin/edit_files.dart

Issue 1143683002: cleanup: simplify creation of AnalysisContext (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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 | lib/devc.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/edit_files.dart
diff --git a/bin/edit_files.dart b/bin/edit_files.dart
index b526feece955dd59310f26fdc86cf7d3caebbd16..8e848d9e304790dd235103946b38e14b9f0f1408 100644
--- a/bin/edit_files.dart
+++ b/bin/edit_files.dart
@@ -13,15 +13,16 @@ library dev_compiler.bin.edit_files;
import 'dart:io';
import 'dart:convert';
+import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
import 'package:analyzer/src/generated/source.dart' show Source;
import 'package:args/args.dart';
import 'package:cli_util/cli_util.dart' show getSdkDir;
import 'package:source_maps/refactor.dart';
import 'package:source_span/source_span.dart';
+import 'package:dev_compiler/src/analysis_context.dart';
import 'package:dev_compiler/src/options.dart';
import 'package:dev_compiler/src/summary.dart';
-import 'package:dev_compiler/src/checker/resolver.dart' show TypeResolver;
final ArgParser argParser = new ArgParser()
..addOption('level', help: 'Minimum error level', defaultsTo: "info")
@@ -57,7 +58,7 @@ void _showUsageAndExit() {
class EditFileSummaryVisitor extends RecursiveSummaryVisitor {
var _files = new Map<String, TextEditTransaction>();
- TypeResolver typeResolver;
+ AnalysisContext context;
String level;
String checkoutFilesExecutable;
String checkoutFilesArg;
@@ -66,7 +67,7 @@ class EditFileSummaryVisitor extends RecursiveSummaryVisitor {
final Map<Uri, Source> _sources = <Uri, Source>{};
- EditFileSummaryVisitor(this.typeResolver, this.level,
+ EditFileSummaryVisitor(this.context, this.level,
this.checkoutFilesExecutable, this.checkoutFilesArg, this.includePattern,
this.excludePattern);
@@ -79,7 +80,7 @@ class EditFileSummaryVisitor extends RecursiveSummaryVisitor {
Source findSource(Uri uri) {
var source = _sources[uri];
if (source != null) return source;
- return _sources[uri] = typeResolver.context.sourceFactory.forUri('$uri');
+ return _sources[uri] = context.sourceFactory.forUri('$uri');
}
@override
@@ -135,13 +136,12 @@ void main(List<String> argv) {
}
var filename = args.rest.first;
- var options = new ResolverOptions(
+ var options = new CompilerOptions(
+ dartSdkPath: sdkDir.path,
useMultiPackage: args['use-multi-package'],
packageRoot: args['package-root'],
packagePaths: args['package-paths'].split(','));
- var typeResolver = new TypeResolver.fromDir(sdkDir.path, options);
-
Map json = JSON.decode(new File(filename).readAsStringSync());
var summary = GlobalSummary.parse(json);
var excludePattern = (args['exclude-pattern'] != null)
@@ -151,7 +151,8 @@ void main(List<String> argv) {
? new RegExp(args['include-pattern'])
: null;
- var visitor = new EditFileSummaryVisitor(typeResolver, args['level'],
+ var context = createAnalysisContext(options);
+ var visitor = new EditFileSummaryVisitor(context, args['level'],
args['checkout-files-executable'], args['checkout-files-arg'],
includePattern, excludePattern);
summary.accept(visitor);
« no previous file with comments | « no previous file | lib/devc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698