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

Unified Diff: pkg/analyzer_cli/lib/src/build_mode.dart

Issue 2355613003: Generate only AST based summaries in build mode. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer_cli/lib/src/options.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_cli/lib/src/build_mode.dart
diff --git a/pkg/analyzer_cli/lib/src/build_mode.dart b/pkg/analyzer_cli/lib/src/build_mode.dart
index af1dbcc963b4ff57ab32af46850fd44f843b9101..a1aa4384d3da98a548bfdaf12bc38f57cdd8b89c 100644
--- a/pkg/analyzer_cli/lib/src/build_mode.dart
+++ b/pkg/analyzer_cli/lib/src/build_mode.dart
@@ -8,7 +8,6 @@ import 'dart:core';
import 'dart:io' as io;
import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit;
-import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/sdk/sdk.dart';
import 'package:analyzer/src/generated/engine.dart';
@@ -137,7 +136,6 @@ class BuildMode {
PackageBundleAssembler assembler;
final Set<Source> processedSources = new Set<Source>();
final Map<Uri, UnlinkedUnit> uriToUnit = <Uri, UnlinkedUnit>{};
- PackageBundle sdkBundle;
BuildMode(this.resourceProvider, this.options, this.stats);
@@ -194,30 +192,13 @@ class BuildMode {
excludeHashes: options.buildSummaryExcludeInformative &&
options.buildSummaryOutputSemantic == null);
if (_shouldOutputSummary) {
- if (options.buildSummaryOnlyAst && !options.buildSummaryFallback) {
+ if (!options.buildSummaryFallback) {
_serializeAstBasedSummary(explicitSources);
} else {
for (Source source in explicitSources) {
- if (context.computeKindOf(source) == SourceKind.LIBRARY) {
- if (options.buildSummaryFallback) {
- assembler.addFallbackLibrary(source);
- } else {
- LibraryElement libraryElement =
- context.computeLibraryElement(source);
- assembler.serializeLibraryElement(libraryElement);
- }
- }
- if (options.buildSummaryFallback) {
- assembler.addFallbackUnit(source);
- }
+ assembler.addFallbackUnit(source);
}
}
- if (!options.buildSummaryOnlyAst) {
- // In non-AST mode, the SDK bundle wasn't added to the summaryDataStore
- // because it is automatically loaded during analysis. However we still
- // want the SDK bundle to be noted as a dependency, so add it now.
- summaryDataStore.addBundle(null, sdkBundle);
- }
// Write the whole package bundle.
assembler.recordDependencies(summaryDataStore);
PackageBundleBuilder bundle = assembler.assemble();
@@ -267,6 +248,7 @@ class BuildMode {
recordDependencyInfo: _shouldOutputSummary);
DartSdk sdk;
+ PackageBundle sdkBundle;
if (options.dartSdkSummaryPath != null) {
SummaryBasedDartSdk summarySdk = new SummaryBasedDartSdk(
options.dartSdkSummaryPath, options.strongMode);
@@ -277,15 +259,13 @@ class BuildMode {
resourceProvider.getFolder(options.dartSdkPath), options.strongMode);
dartSdk.analysisOptions =
Driver.createAnalysisOptionsForCommandLineOptions(options);
- dartSdk.useSummary = !options.buildSummaryOnlyAst;
+ dartSdk.useSummary = false;
sdk = dartSdk;
sdkBundle = dartSdk.getSummarySdkBundle(options.strongMode);
}
- // In AST mode include SDK bundle to avoid parsing SDK sources.
- if (options.buildSummaryOnlyAst) {
- summaryDataStore.addBundle(null, sdkBundle);
- }
+ // Include SDK bundle to avoid parsing SDK sources.
+ summaryDataStore.addBundle(null, sdkBundle);
// Create the context.
context = AnalysisEngine.instance.createAnalysisContext();
@@ -302,13 +282,6 @@ class BuildMode {
contextOptions.analyzeFunctionBodies = false;
}
});
-
- if (!options.buildSummaryOnlyAst) {
- // Configure using summaries.
- context.typeProvider = sdk.context.typeProvider;
- context.resultProvider =
- new InputPackagesResultProvider(context, summaryDataStore);
- }
}
/**
« no previous file with comments | « no previous file | pkg/analyzer_cli/lib/src/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698