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

Unified Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2468583002: Explain why we need SourceFactory.clone(). (Closed)
Patch Set: Created 4 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/analysis/driver.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 20e6958ba1378466092e4fb86e5347b1b328cd7d..b485d8557961b5eb4cbbfcb99d42f964737d2408 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -12,7 +12,6 @@ import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/context/context.dart';
-import 'package:analyzer/src/context/source.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/scanner/reader.dart';
import 'package:analyzer/src/dart/scanner/scanner.dart';
@@ -177,6 +176,12 @@ class AnalysisDriver {
*/
AnalysisStatus _currentStatus = AnalysisStatus.IDLE;
+ /**
+ * Create a new instance of [AnalysisDriver].
+ *
+ * The given [SourceFactory] is cloned to ensure that it does not contain a
+ * reference to a [AnalysisContext] in which it could have been used.
+ */
AnalysisDriver(this._logger, this._resourceProvider, this._byteStore,
this._contentCache, SourceFactory sourceFactory, this._analysisOptions)
: _sourceFactory = sourceFactory.clone() {
@@ -499,8 +504,7 @@ class AnalysisDriver {
AnalysisEngine.instance.createAnalysisContext();
analysisContext.analysisOptions = _analysisOptions;
- analysisContext.sourceFactory =
- new SourceFactory((_sourceFactory as SourceFactoryImpl).resolvers);
+ analysisContext.sourceFactory = _sourceFactory.clone();
analysisContext.resultProvider =
new InputPackagesResultProvider(analysisContext, libraryContext.store);
analysisContext
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698