Remove LibrariesLog, we don't use it anymore.
Change-Id: I6e72822b973af383726e53ad7ea11c6ebfc10afc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169522
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/dart/micro/libraries_log.dart b/pkg/analyzer/lib/src/dart/micro/libraries_log.dart
deleted file mode 100644
index a67988b..0000000
--- a/pkg/analyzer/lib/src/dart/micro/libraries_log.dart
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2020, 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:meta/meta.dart';
-
-class ChangeFileLoadEntry extends LibrariesLogEntry {
- /// The path of the file that was reported as changed.
- final String target;
-
- /// The files that depend transitively on the [target]. These files are
- /// removed from the state, and from the element factory.
- final List<LibrariesLogFile> removed = [];
-
- ChangeFileLoadEntry._(this.target);
-
- void addRemoved({
- @required String path,
- @required Uri uri,
- }) {
- removed.add(
- LibrariesLogFile._(path, uri),
- );
- }
-
- @override
- String toString() {
- return 'Change(target: $target, removed: $removed)';
- }
-}
-
-class LibrariesLog {
- final List<LibrariesLogEntry> entries = [];
-
- ChangeFileLoadEntry changeFile(String path) {
- var entry = ChangeFileLoadEntry._(path);
- entries.add(entry);
- return entry;
- }
-
- LoadLibrariesForTargetLogEntry loadForTarget({
- @required String path,
- @required Uri uri,
- }) {
- var entry = LoadLibrariesForTargetLogEntry._(
- LibrariesLogFile._(path, uri),
- );
- entries.add(entry);
- return entry;
- }
-}
-
-abstract class LibrariesLogEntry {
- final DateTime time = DateTime.now();
-}
-
-class LibrariesLogFile {
- final String path;
- final Uri uri;
-
- LibrariesLogFile._(this.path, this.uri);
-
- @override
- String toString() {
- return '(path: $path, uri: $uri)';
- }
-}
-
-class LoadLibrariesForTargetLogEntry extends LibrariesLogEntry {
- final LibrariesLogFile target;
- final List<LibrariesLogFile> loaded = [];
-
- LoadLibrariesForTargetLogEntry._(this.target);
-
- void addLibrary({
- @required String path,
- @required Uri uri,
- }) {
- loaded.add(
- LibrariesLogFile._(path, uri),
- );
- }
-
- @override
- String toString() {
- return 'Load(target: $target, loaded: $loaded)';
- }
-}
diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
index b77c5aa..b0e1808 100644
--- a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
+++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
@@ -20,7 +20,6 @@
import 'package:analyzer/src/dart/analysis/results.dart';
import 'package:analyzer/src/dart/micro/analysis_context.dart';
import 'package:analyzer/src/dart/micro/cider_byte_store.dart';
-import 'package:analyzer/src/dart/micro/libraries_log.dart';
import 'package:analyzer/src/dart/micro/library_analyzer.dart';
import 'package:analyzer/src/dart/micro/library_graph.dart';
import 'package:analyzer/src/exception/exception.dart';
@@ -76,13 +75,11 @@
MicroContextObjects contextObjects;
- final LibrariesLog _librariesLog = LibrariesLog();
-
_LibraryContext libraryContext;
/// List of ids for cache elements that are invalidated. Track elements that
- /// are invalidated during [changeFile]. Used in [releaseAndClearRemovedIds] to
- /// release the cache items and is then cleared.
+ /// are invalidated during [changeFile]. Used in [releaseAndClearRemovedIds]
+ /// to release the cache items and is then cleared.
final Set<int> removedCacheIds = {};
FileResolver(
@@ -124,10 +121,6 @@
this.byteStore = byteStore;
}
- List<LibrariesLogEntry> get librariesLogEntries {
- return _librariesLog.entries;
- }
-
/// Update the resolver to reflect the fact that the file with the given
/// [path] was changed. We need to make sure that when this file, of any file
/// that directly or indirectly referenced it, is resolved, we used the new
@@ -142,13 +135,8 @@
var removedFiles = <FileState>[];
fsState.changeFile(path, removedFiles);
- // Update the log.
- var logEntry = _librariesLog.changeFile(path);
+ // Schedule disposing references to cached unlinked data.
for (var removedFile in removedFiles) {
- logEntry.addRemoved(
- path: removedFile.path,
- uri: removedFile.uri,
- );
removedCacheIds.add(removedFile.id);
}
@@ -474,7 +462,6 @@
resourceProvider,
byteStore,
contextObjects,
- _librariesLog,
);
}
}
@@ -615,7 +602,6 @@
final ResourceProvider resourceProvider;
final CiderByteStore byteStore;
final MicroContextObjects contextObjects;
- final LibrariesLog librariesLog;
LinkedElementFactory elementFactory;
@@ -626,7 +612,6 @@
this.resourceProvider,
this.byteStore,
this.contextObjects,
- this.librariesLog,
) {
elementFactory = LinkedElementFactory(
contextObjects.analysisContext,
@@ -646,21 +631,9 @@
var librariesLinkedTimer = Stopwatch();
var inputsTimer = Stopwatch();
- var logEntry = librariesLog.loadForTarget(
- path: targetLibrary.path,
- uri: targetLibrary.uri,
- );
-
void loadBundle(LibraryCycle cycle) {
if (!loadedBundles.add(cycle)) return;
- for (var library in cycle.libraries) {
- logEntry.addLibrary(
- path: library.path,
- uri: library.uri,
- );
- }
-
performance.getDataInt('cycleCount').increment();
performance.getDataInt('libraryCount').add(cycle.libraries.length);
diff --git a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
index 327276b..549701d 100644
--- a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
+++ b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
-import 'package:analyzer/src/dart/micro/libraries_log.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/lint/registry.dart';
import 'package:matcher/matcher.dart';
@@ -25,10 +24,6 @@
String bPath;
String cPath;
- String get _asyncLibraryPath => futureElement.library.source.fullName;
-
- String get _coreLibraryPath => intElement.library.source.fullName;
-
@override
void setUp() {
super.setUp();
@@ -37,57 +32,6 @@
cPath = convertPath('/workspace/dart/test/lib/c.dart');
}
- test_changeFile_log() async {
- newFile(aPath, content: r'''
-class A {}
-''');
-
- newFile(bPath, content: r'''
-import 'a.dart';
-A a;
-B b;
-''');
-
- result = await resolveFile(bPath);
- assertErrorsInResolvedUnit(result, [
- error(CompileTimeErrorCode.UNDEFINED_CLASS, 22, 1),
- ]);
-
- newFile(aPath, content: r'''
-class A {}
-class B {}
-''');
- fileResolver.changeFile(aPath);
-
- result = await resolveFile(bPath);
- assertErrorsInResolvedUnit(result, []);
-
- // The failure of this check will be reported badly.
- expect(fileResolver.librariesLogEntries, [
- predicate((LoadLibrariesForTargetLogEntry entry) {
- expect(entry.target.path, bPath);
- var loadedPathSet = entry.loaded.map((f) => f.path).toSet();
- expect(loadedPathSet, contains(aPath));
- expect(loadedPathSet, contains(bPath));
- expect(loadedPathSet, contains(_asyncLibraryPath));
- expect(loadedPathSet, contains(_coreLibraryPath));
- return true;
- }),
- predicate((ChangeFileLoadEntry entry) {
- expect(entry.target, aPath);
- var removedPathSet = entry.removed.map((f) => f.path).toSet();
- expect(removedPathSet, {aPath, bPath});
- return true;
- }),
- predicate((LoadLibrariesForTargetLogEntry entry) {
- expect(entry.target.path, bPath);
- var loadedPathSet = entry.loaded.map((f) => f.path).toSet();
- expect(loadedPathSet, {aPath, bPath});
- return true;
- }),
- ]);
- }
-
test_changeFile_refreshedFiles() async {
newFile(aPath, content: r'''
class A {}