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

Unified Diff: lib/src/analysis_context.dart

Issue 1879373004: Implement modular compilation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 8 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 | « lib/runtime/harmony_feature_check.js ('k') | lib/src/analyzer/context.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/analysis_context.dart
diff --git a/lib/src/analysis_context.dart b/lib/src/analysis_context.dart
deleted file mode 100644
index 8a7c064273f25e6e5c30b85da4ffdbfd7cbfe337..0000000000000000000000000000000000000000
--- a/lib/src/analysis_context.dart
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2015, 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.
-
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/java_io.dart' show JavaFile;
-import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk;
-import 'package:analyzer/src/generated/source.dart' show DartUriResolver;
-import 'package:analyzer/src/generated/source_io.dart';
-
-import 'dart_sdk.dart';
-import 'multi_package_resolver.dart';
-import 'options.dart';
-
-/// Creates an [AnalysisContext] with dev_compiler type rules and inference,
-/// using [createSourceFactory] to set up its [SourceFactory].
-AnalysisContext createAnalysisContextWithSources(
- SourceResolverOptions srcOptions,
- {DartUriResolver sdkResolver,
- List<UriResolver> fileResolvers}) {
- AnalysisEngine.instance.processRequiredPlugins();
- var srcFactory = createSourceFactory(srcOptions,
- sdkResolver: sdkResolver, fileResolvers: fileResolvers);
- return createAnalysisContext()..sourceFactory = srcFactory;
-}
-
-/// Creates an analysis context that contains our restricted typing rules.
-AnalysisContext createAnalysisContext() {
- var res = AnalysisEngine.instance.createAnalysisContext();
- res.analysisOptions.strongMode = true;
- return res;
-}
-
-/// Creates a SourceFactory configured by the [options].
-///
-/// Use [options.useMockSdk] to specify the SDK mode, or use [sdkResolver]
-/// to entirely override the DartUriResolver.
-///
-/// If supplied, [fileResolvers] will override the default `file:` and
-/// `package:` URI resolvers.
-SourceFactory createSourceFactory(SourceResolverOptions options,
- {DartUriResolver sdkResolver, List<UriResolver> fileResolvers}) {
- sdkResolver ??= options.useMockSdk
- ? createMockSdkResolver(mockSdkSources)
- : createSdkPathResolver(options.dartSdkPath);
-
- var resolvers = <UriResolver>[];
- if (options.customUrlMappings.isNotEmpty) {
- resolvers.add(new CustomUriResolver(options.customUrlMappings));
- }
- resolvers.add(sdkResolver);
- if (fileResolvers == null) fileResolvers = createFileResolvers(options);
- resolvers.addAll(fileResolvers);
- return new SourceFactory(resolvers);
-}
-
-List<UriResolver> createFileResolvers(SourceResolverOptions options) {
- return [
- new FileUriResolver(),
- options.useMultiPackage
- ? new MultiPackageResolver(options.packagePaths)
- : new PackageUriResolver([new JavaFile(options.packageRoot)])
- ];
-}
-
-/// Creates a [DartUriResolver] that uses a mock 'dart:' library contents.
-DartUriResolver createMockSdkResolver(Map<String, String> mockSources) =>
- new MockDartSdk(mockSources, reportMissing: true).resolver;
-
-/// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath].
-DartUriResolver createSdkPathResolver(String sdkPath) {
- var sdk = new DirectoryBasedDartSdk(
- new JavaFile(sdkPath), /*useDart2jsPaths:*/ true);
- sdk.context.analysisOptions.strongMode = true;
- return new DartUriResolver(sdk);
-}
« no previous file with comments | « lib/runtime/harmony_feature_check.js ('k') | lib/src/analyzer/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698