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

Side by Side Diff: pkg/analyzer2dart/lib/src/driver.dart

Issue 524463006: Use MockSdk to speed-up tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rollback r39701 Created 6 years, 3 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
« no previous file with comments | « pkg/analyzer2dart/bin/analyzer2dart.dart ('k') | pkg/analyzer2dart/test/driver_test.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer2dart.driver; 5 library analyzer2dart.driver;
6 6
7 import 'package:analyzer/src/generated/element.dart'; 7 import 'package:analyzer/src/generated/element.dart';
8 import 'package:analyzer/src/generated/engine.dart'; 8 import 'package:analyzer/src/generated/engine.dart';
9 import 'package:analyzer/src/generated/java_io.dart'; 9 import 'package:analyzer/src/generated/java_io.dart';
10 import 'package:analyzer/src/generated/sdk_io.dart'; 10 import 'package:analyzer/src/generated/sdk.dart';
11 import 'package:analyzer/src/generated/source_io.dart'; 11 import 'package:analyzer/src/generated/source_io.dart';
12 12
13 import 'closed_world.dart'; 13 import 'closed_world.dart';
14 import 'tree_shaker.dart'; 14 import 'tree_shaker.dart';
15 15
16 /** 16 /**
17 * Top level driver for Analyzer2Dart. 17 * Top level driver for Analyzer2Dart.
18 */ 18 */
19 class Driver { 19 class Driver {
20 AnalysisContext context; 20 AnalysisContext context;
21 21
22 Driver() : context = AnalysisEngine.instance.createAnalysisContext() { 22 Driver(DartSdk sdk) : context = AnalysisEngine.instance.createAnalysisContext( ) {
23 // Set up the source factory. 23 // Set up the source factory.
24 // TODO(paulberry): do we want to use ExplicitPackageUriResolver? 24 // TODO(paulberry): do we want to use ExplicitPackageUriResolver?
25 List<UriResolver> uriResolvers = [ 25 List<UriResolver> uriResolvers = [
26 new FileUriResolver(), 26 new FileUriResolver(),
27 new DartUriResolver(DirectoryBasedDartSdk.defaultSdk) /* , 27 new DartUriResolver(sdk) /* ,
28 new PackageUriResolver(packagesDirectories) */ 28 new PackageUriResolver(packagesDirectories) */
29 ]; 29 ];
30 context.sourceFactory = new SourceFactory(uriResolvers); 30 context.sourceFactory = new SourceFactory(uriResolvers);
31 } 31 }
32 32
33 /** 33 /**
34 * Compute the closed world that is reachable from an entry point. 34 * Compute the closed world that is reachable from an entry point.
35 */ 35 */
36 ClosedWorld computeWorld(FunctionElement entryPointElement) { 36 ClosedWorld computeWorld(FunctionElement entryPointElement) {
37 TreeShaker treeShaker = new TreeShaker(); 37 TreeShaker treeShaker = new TreeShaker();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 ChangeSet changeSet = new ChangeSet(); 77 ChangeSet changeSet = new ChangeSet();
78 JavaFile javaFile = new JavaFile(path); 78 JavaFile javaFile = new JavaFile(path);
79 Source source = new FileBasedSource.con1(javaFile); 79 Source source = new FileBasedSource.con1(javaFile);
80 changeSet.addedSource(source); 80 changeSet.addedSource(source);
81 changeSet.changedContent(source, contents); 81 changeSet.changedContent(source, contents);
82 context.applyChanges(changeSet); 82 context.applyChanges(changeSet);
83 return source; 83 return source;
84 } 84 }
85 } 85 }
86 86
OLDNEW
« no previous file with comments | « pkg/analyzer2dart/bin/analyzer2dart.dart ('k') | pkg/analyzer2dart/test/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698