Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 302893b

Browse files
author
Dart CI
committed
Version 2.10.0-34.0.dev
Merge commit '332aa7d0c5f1cb1fe4c16418cccfbbc229cd019c' into 'dev'
2 parents b854176 + 332aa7d commit 302893b

File tree

4 files changed

+42
-15
lines changed

4 files changed

+42
-15
lines changed

pkg/analyzer/lib/src/dart/analysis/file_state.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import 'package:pub_semver/pub_semver.dart';
4646

4747
var counterFileStateRefresh = 0;
4848
var counterUnlinkedLinkedBytes = 0;
49+
int fileObjectId = 0;
4950
var timerFileStateRefresh = Stopwatch();
5051

5152
/// [FileContentOverlay] is used to temporary override content of files.
@@ -116,6 +117,9 @@ class FileState {
116117
/// The language version for the package that contains this file.
117118
final Version _packageLanguageVersion;
118119

120+
int id = fileObjectId++;
121+
int refreshId;
122+
119123
bool _exists;
120124
String _content;
121125
String _contentHash;
@@ -351,6 +355,7 @@ class FileState {
351355
/// Return `true` if the API signature changed since the last refresh.
352356
bool refresh({bool allowCached = false}) {
353357
counterFileStateRefresh++;
358+
refreshId = fileObjectId++;
354359

355360
var timerWasRunning = timerFileStateRefresh.isRunning;
356361
if (!timerWasRunning) {
@@ -492,7 +497,7 @@ class FileState {
492497
if (path == null) {
493498
return '<unresolved>';
494499
} else {
495-
return '$uri = $path';
500+
return '[id: $id][rid: $refreshId]$uri = $path';
496501
}
497502
}
498503

pkg/analyzer/lib/src/dart/analysis/library_context.dart

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ var timerLoad2 = Stopwatch();
3838
class LibraryContext {
3939
static const _maxLinkedDataInBytes = 64 * 1024 * 1024;
4040

41+
final int id = fileObjectId++;
4142
final LibraryContextTestView testView;
4243
final PerformanceLog logger;
4344
final ByteStore byteStore;
@@ -109,12 +110,18 @@ class LibraryContext {
109110
var bytesGet = 0;
110111
var bytesPut = 0;
111112

112-
void loadBundle(LibraryCycle cycle) {
113+
var thisLoadLogBuffer = StringBuffer();
114+
115+
void loadBundle(LibraryCycle cycle, String debugPrefix) {
113116
if (!loadedBundles.add(cycle)) return;
114117

118+
thisLoadLogBuffer.writeln('$debugPrefix$cycle');
119+
115120
librariesTotal += cycle.libraries.length;
116121

117-
cycle.directDependencies.forEach(loadBundle);
122+
cycle.directDependencies.forEach(
123+
(e) => loadBundle(e, '$debugPrefix '),
124+
);
118125

119126
var key = cycle.transitiveSignature + '.linked_bundle';
120127
var bytes = byteStore.get(key);
@@ -161,21 +168,34 @@ class LibraryContext {
161168
if (existingLibraryReference != null) {
162169
var existingElement = existingLibraryReference.element;
163170
if (existingElement != null) {
171+
var buffer = StringBuffer();
172+
173+
buffer.writeln('[The library is already loaded]');
174+
buffer.writeln();
175+
164176
var existingSource = existingElement?.source;
177+
buffer.writeln('[oldUri: ${existingSource.uri}]');
178+
buffer.writeln('[oldPath: ${existingSource.fullName}]');
179+
buffer.writeln('[newUri: ${libraryFile.uriStr}]');
180+
buffer.writeln('[newPath: ${libraryFile.path}]');
181+
buffer.writeln('[cycle: $cycle]');
182+
buffer.writeln();
183+
184+
buffer.writeln('[loadedBundles: ${loadedBundles.toList()}]');
185+
buffer.writeln();
186+
187+
buffer.writeln('Bundles loaded in this load2() invocation:');
188+
buffer.writeln(thisLoadLogBuffer);
189+
buffer.writeln();
190+
165191
var libraryRefs = elementFactory.rootReference.children;
166192
var libraryUriList = libraryRefs.map((e) => e.name).toList();
167-
var statusText = '[The library is already loaded]'
168-
'[oldUri: ${existingSource.uri}]'
169-
'[oldPath: ${existingSource.fullName}]'
170-
'[newUri: ${libraryFile.uriStr}]'
171-
'[newPath: ${libraryFile.path}]'
172-
'[cycle: $cycle]'
173-
'[loadedBundles: ${loadedBundles.toList()}]'
174-
'[elementFactory.libraries: $libraryUriList]';
193+
buffer.writeln('[elementFactory.libraries: $libraryUriList]');
194+
175195
throw CaughtExceptionWithFiles(
176196
'Cycle loading state error',
177197
StackTrace.current,
178-
{'status': statusText},
198+
{'status': buffer.toString()},
179199
);
180200
}
181201
}
@@ -247,7 +267,7 @@ class LibraryContext {
247267

248268
logger.run('Prepare linked bundles', () {
249269
var libraryCycle = targetLibrary.libraryCycle;
250-
loadBundle(libraryCycle);
270+
loadBundle(libraryCycle, '');
251271
logger.writeln(
252272
'[librariesTotal: $librariesTotal]'
253273
'[librariesLoaded: $librariesLoaded]'

pkg/analyzer/lib/src/dart/analysis/library_graph.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ void computeLibraryCycle(Uint32List salt, FileState file) {
1818

1919
/// Information about libraries that reference each other, so form a cycle.
2020
class LibraryCycle {
21+
final int id = fileObjectId++;
22+
2123
/// The libraries that belong to this cycle.
2224
final List<FileState> libraries = [];
2325

@@ -65,7 +67,7 @@ class LibraryCycle {
6567

6668
@override
6769
String toString() {
68-
return '[' + libraries.join(', ') + ']';
70+
return '[[id: $id] ' + libraries.join(', ') + ']';
6971
}
7072
}
7173

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 2
2828
MINOR 10
2929
PATCH 0
30-
PRERELEASE 33
30+
PRERELEASE 34
3131
PRERELEASE_PATCH 0

0 commit comments

Comments
 (0)