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

Unified Diff: pkg/analyzer2dart/lib/src/driver.dart

Issue 2037123002: Cleanup: remove package "analyzer2dart". (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 | « pkg/analyzer2dart/lib/src/dart_backend.dart ('k') | pkg/analyzer2dart/lib/src/element_converter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer2dart/lib/src/driver.dart
diff --git a/pkg/analyzer2dart/lib/src/driver.dart b/pkg/analyzer2dart/lib/src/driver.dart
deleted file mode 100644
index 97073560cf22c416ee179fd58247ee6e3e9c8e31..0000000000000000000000000000000000000000
--- a/pkg/analyzer2dart/lib/src/driver.dart
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library analyzer2dart.driver;
-
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/generated/element.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/sdk.dart';
-import 'package:analyzer/src/generated/source_io.dart';
-
-import 'package:compiler/compiler.dart';
-
-import 'closed_world.dart';
-import 'tree_shaker.dart';
-
-/**
- * Top level driver for Analyzer2Dart.
- */
-class Driver {
- final ResourceProvider resourceProvider;
- final AnalysisContext context;
- final CompilerOutputProvider outputProvider;
-
- Driver(this.resourceProvider, DartSdk sdk, this.outputProvider)
- : context = AnalysisEngine.instance.createAnalysisContext() {
- // Set up the source factory.
- // TODO(paulberry): do we want to use ExplicitPackageUriResolver?
- List<UriResolver> uriResolvers = [
- new FileUriResolver(),
- new DartUriResolver(sdk) /* ,
- new PackageUriResolver(packagesDirectories) */
- ];
- context.sourceFactory = new SourceFactory(uriResolvers);
- }
-
- /**
- * Compute the closed world that is reachable from an entry point.
- */
- ClosedWorld computeWorld(FunctionElement entryPointElement) {
- InternalAnalysisContext analysisContext = context;
- TreeShaker treeShaker =
- new TreeShaker(analysisContext.typeProvider, entryPointElement);
- return treeShaker.shake();
- }
-
- /**
- * Given a source, resolve it and return its entry point.
- */
- FunctionElement resolveEntryPoint(Source source) {
- // Get the library element associated with the source.
- LibraryElement libraryElement = context.computeLibraryElement(source);
-
- // Get the resolved AST for main
- FunctionElement entryPointElement = libraryElement.entryPoint;
- if (entryPointElement == null) {
- throw new Exception('No main()!');
- }
- return entryPointElement;
- }
-
- /**
- * Add the given file as the root of analysis, and return the corresponding
- * source.
- */
- Source setRoot(String path) {
- File file = resourceProvider.getResource(path);
- Source source = file.createSource();
- // add the Source
- ChangeSet changeSet = new ChangeSet();
- changeSet.addedSource(source);
- context.applyChanges(changeSet);
- // return the Source
- return source;
- }
-}
« no previous file with comments | « pkg/analyzer2dart/lib/src/dart_backend.dart ('k') | pkg/analyzer2dart/lib/src/element_converter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698