| OLD | NEW |
| 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/file_system/file_system.dart'; | 7 import 'package:analyzer/file_system/file_system.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/sdk.dart'; | 10 import 'package:analyzer/src/generated/sdk.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 new DartUriResolver(sdk) /* , | 32 new DartUriResolver(sdk) /* , |
| 33 new PackageUriResolver(packagesDirectories) */ | 33 new PackageUriResolver(packagesDirectories) */ |
| 34 ]; | 34 ]; |
| 35 context.sourceFactory = new SourceFactory(uriResolvers); | 35 context.sourceFactory = new SourceFactory(uriResolvers); |
| 36 } | 36 } |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Compute the closed world that is reachable from an entry point. | 39 * Compute the closed world that is reachable from an entry point. |
| 40 */ | 40 */ |
| 41 ClosedWorld computeWorld(FunctionElement entryPointElement) { | 41 ClosedWorld computeWorld(FunctionElement entryPointElement) { |
| 42 TreeShaker treeShaker = new TreeShaker(entryPointElement); | 42 InternalAnalysisContext analysisContext = context; |
| 43 TreeShaker treeShaker = |
| 44 new TreeShaker(analysisContext.typeProvider, entryPointElement); |
| 43 return treeShaker.shake(); | 45 return treeShaker.shake(); |
| 44 } | 46 } |
| 45 | 47 |
| 46 /** | 48 /** |
| 47 * Given a source, resolve it and return its entry point. | 49 * Given a source, resolve it and return its entry point. |
| 48 */ | 50 */ |
| 49 FunctionElement resolveEntryPoint(Source source) { | 51 FunctionElement resolveEntryPoint(Source source) { |
| 50 // Get the library element associated with the source. | 52 // Get the library element associated with the source. |
| 51 LibraryElement libraryElement = context.computeLibraryElement(source); | 53 LibraryElement libraryElement = context.computeLibraryElement(source); |
| 52 | 54 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 66 File file = resourceProvider.getResource(path); | 68 File file = resourceProvider.getResource(path); |
| 67 Source source = file.createSource(); | 69 Source source = file.createSource(); |
| 68 // add the Source | 70 // add the Source |
| 69 ChangeSet changeSet = new ChangeSet(); | 71 ChangeSet changeSet = new ChangeSet(); |
| 70 changeSet.addedSource(source); | 72 changeSet.addedSource(source); |
| 71 context.applyChanges(changeSet); | 73 context.applyChanges(changeSet); |
| 72 // return the Source | 74 // return the Source |
| 73 return source; | 75 return source; |
| 74 } | 76 } |
| 75 } | 77 } |
| OLD | NEW |