Skip to content

Commit 84200ca

Browse files
authored
Merge branch 'dart-lang:main' into marinkobabic-patch-1
2 parents 2058ffb + bf77b81 commit 84200ca

File tree

21 files changed

+384
-30
lines changed

21 files changed

+384
-30
lines changed

pkgs/hooks_runner/test_data/manifest_generator.dart

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,19 @@ class Counts {
3939
}
4040

4141
void updateManifests(Counts counts) async {
42-
final packageUri = findPackageRoot('hooks_runner');
43-
final testDataUri = packageUri.resolve('test_data/');
44-
final testDataDirectory = Directory.fromUri(testDataUri);
45-
updateManifest(testDataDirectory, counts, allowPartialProjects: false);
46-
final all = testDataDirectory.listSync(recursive: true);
47-
all.whereType<Directory>().forEach(
48-
(e) => updateManifest(e, counts, allowPartialProjects: true),
49-
);
42+
final packageUris = [
43+
findPackageRoot('hooks_runner'),
44+
findPackageRoot('hooks_runner').resolve('../record_use/'),
45+
];
46+
for (final packageUri in packageUris) {
47+
final testDataUri = packageUri.resolve('test_data/');
48+
final testDataDirectory = Directory.fromUri(testDataUri);
49+
updateManifest(testDataDirectory, counts, allowPartialProjects: false);
50+
final all = testDataDirectory.listSync(recursive: true);
51+
all.whereType<Directory>().forEach(
52+
(e) => updateManifest(e, counts, allowPartialProjects: true),
53+
);
54+
}
5055
}
5156

5257
const denyList = [
@@ -55,6 +60,9 @@ const denyList = [
5560
'manifest',
5661
'README.md',
5762
'.gitignore',
63+
'out.js',
64+
'json/',
65+
'json_dart2js/',
5866
];
5967

6068
/// These just modify other test projects.

pkgs/record_use/lib/src/constant.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ sealed class PrimitiveConstant<T extends Object> extends Constant {
9191

9292
return other is PrimitiveConstant<T> && other.value == value;
9393
}
94+
95+
@override
96+
String toString() => 'PrimitiveConstant($value)';
9497
}
9598

9699
/// Represents a constant boolean value.

pkgs/record_use/lib/src/identifier.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ class Identifier {
7575
: uriMapping(importUri);
7676
return mappedImportUri == other.importUri;
7777
}
78+
79+
@override
80+
String toString() => scope == null
81+
? 'Identifier($importUri, $name)'
82+
: 'Identifier($importUri, $scope, $name)';
7883
}
7984

8085
/// Package private (protected) methods for [Identifier].

pkgs/record_use/lib/src/location.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class Location {
5353
final mappedUri = uriMapping == null ? uri : uriMapping(uri);
5454
return mappedUri == other.uri;
5555
}
56+
57+
@override
58+
String toString() => 'Location(uri: $uri)';
5659
}
5760

5861
/// Package private (protected) methods for [Location].

pkgs/record_use/lib/src/reference.dart

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,29 @@ final class CallWithArguments extends CallReference {
233233
return allowTearOffToStaticPromotion;
234234
}
235235
}
236+
237+
@override
238+
String toString() {
239+
final parts = <String>[];
240+
if (positionalArguments.isNotEmpty) {
241+
parts.add('positional: ${positionalArguments.join(', ')}');
242+
}
243+
if (namedArguments.isNotEmpty) {
244+
final namedString = namedArguments.entries
245+
.map((e) => '${e.key}=${e.value}')
246+
.join(', ');
247+
parts.add(
248+
'named: $namedString',
249+
);
250+
}
251+
if (location != null) {
252+
parts.add('location: $location');
253+
}
254+
if (loadingUnit != null) {
255+
parts.add('loadingUnit: $loadingUnit');
256+
}
257+
return 'CallWithArguments(${parts.join(', ')})';
258+
}
236259
}
237260

238261
/// A reference to a tear-off use of the [Identifier]. This means that we can't
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:record_use/src/location.dart';
6+
import 'package:record_use/src/reference.dart';
7+
import 'package:test/test.dart';
8+
9+
void main() {
10+
group('toString', () {
11+
test('Location', () {
12+
const location = Location(uri: 'package:foo/foo.dart');
13+
expect(location.toString(), 'Location(uri: package:foo/foo.dart)');
14+
});
15+
16+
test('CallWithArguments', () {
17+
const call = CallWithArguments(
18+
positionalArguments: [],
19+
namedArguments: {},
20+
loadingUnit: 'dart.foo',
21+
location: Location(uri: 'package:foo/foo.dart'),
22+
);
23+
expect(
24+
call.toString(),
25+
'CallWithArguments(location: Location(uri: package:foo/foo.dart), loadingUnit: dart.foo)',
26+
);
27+
});
28+
29+
test('CallWithArguments with multiple args', () {
30+
const call = CallWithArguments(
31+
positionalArguments: [null, null],
32+
namedArguments: {'bar': null, 'baz': null},
33+
loadingUnit: 'dart.foo',
34+
location: Location(uri: 'package:foo/foo.dart'),
35+
);
36+
expect(
37+
call.toString(),
38+
'CallWithArguments(positional: null, null, named: bar=null, baz=null, location: Location(uri: package:foo/foo.dart), loadingUnit: dart.foo)',
39+
);
40+
});
41+
});
42+
}

pkgs/record_use/test_data/drop_data_asset/hook/link.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void main(List<String> arguments) async {
1616
final recordedUsagesFile = input.recordedUsagesFile;
1717
if (recordedUsagesFile == null) {
1818
throw ArgumentError(
19-
'Enable the --enable-experiments=record-use experiment'
19+
'Enable the --enable-experiment=record-use experiment'
2020
' to use this app.',
2121
);
2222
}

pkgs/record_use/test_data/drop_dylib_recording/hook/link.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void main(List<String> arguments) async {
1616
final recordedUsagesFile = input.recordedUsagesFile;
1717
if (recordedUsagesFile == null) {
1818
throw ArgumentError(
19-
'Enable the --enable-experiments=record-use experiment'
19+
'Enable the --enable-experiment=record-use experiment'
2020
' to use this app.',
2121
);
2222
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:library_uris/library_uris.dart';
6+
import 'package:library_uris_helper/library_uris_helper.dart';
7+
import 'package:meta/meta.dart';
8+
9+
void main() {
10+
helloFoo();
11+
MyClass.myMethod('bar');
12+
helloBar();
13+
ClassInHelper.methodInHelper('bar');
14+
methodInBin();
15+
}
16+
17+
// ignore: experimental_member_use
18+
@RecordUse()
19+
void methodInBin() {
20+
print('The answer to the universe, life, and everything.');
21+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:hooks/hooks.dart';
6+
7+
void main(List<String> arguments) async {
8+
await build(
9+
arguments,
10+
(input, output) async {
11+
// Do nothing.
12+
},
13+
);
14+
}

0 commit comments

Comments
 (0)