Skip to content

Commit 8546b2e

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer_testing: Move Spelunker into this package
The Spelunker class is only used by analyzer_testing's PubPackageResolutionTest class, and by a utility script. So I believe the best place for this class is in analyzer_testing, for two reasons: * Would we also move the utility script (`pkg/linter/tool/spelunk.dart`)? This is a script that lets you see a visual tree of the syntax nodes of a Dart script. It has been helpful to people writing lint rules, as it helps you understand how you need to walk up or down the tree to check conditions. Therefore, it will be at least as helpful to people writing analysis rules in analyzer plugins (the primary consumers of PubPackageResolutionTest). It doesn't need to live in `bin` (though that's one possibility). It can live in `analyzer_testing/tool`. * Then if the utility script lives in analyzer_testing, and PubPackageResolutionTest lives in analyzer_testing, and these are the sole consumers of Spelunker, it makes sense to move it into analyzer_testing. It does not need to be public API; just live in the source code. Change-Id: Id607091b35ab83c96b8cd73f0ece63923c934fb4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444240 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Paul Berry <[email protected]>
1 parent c3ddf2e commit 8546b2e

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

pkg/analyzer_testing/lib/src/analysis_rule/pub_package_resolution.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import 'package:analyzer/src/dart/analysis/byte_store.dart'; // ignore: implemen
1313
import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart'; // ignore: implementation_imports
1414
import 'package:analyzer/src/dart/analysis/experiments.dart'; // ignore: implementation_imports
1515
import 'package:analyzer/src/error/codes.dart'; // ignore: implementation_imports
16-
import 'package:analyzer/src/lint/util.dart'; // ignore: implementation_imports
1716
import 'package:analyzer/src/test_utilities/mock_sdk.dart'; // ignore: implementation_imports
1817
import 'package:analyzer/utilities/package_config_file_builder.dart';
1918
import 'package:analyzer_testing/experiments/experiments.dart';
2019
import 'package:analyzer_testing/mock_packages/mock_packages.dart';
2120
import 'package:analyzer_testing/resource_provider_mixin.dart';
21+
import 'package:analyzer_testing/src/spelunker.dart';
2222
import 'package:analyzer_testing/utilities/utilities.dart';
2323
import 'package:meta/meta.dart';
2424
import 'package:test/test.dart';

pkg/analyzer/lib/src/lint/util.dart renamed to pkg/analyzer_testing/lib/src/spelunker.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class Spelunker {
2727
}
2828
}
2929

30-
class _SourceVisitor extends GeneralizingAstVisitor {
30+
class _SourceVisitor extends GeneralizingAstVisitor<void> {
3131
int indent = 0;
3232

3333
final StringSink sink;

pkg/analyzer_testing/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ dependencies:
2222
# See also https://dart.dev/tools/pub/dependencies.
2323
dev_dependencies:
2424
analyzer_utilities: any
25+
args: any
2526
lints: any

pkg/linter/tool/spelunk.dart renamed to pkg/analyzer_testing/tool/spelunk.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import 'dart:io';
66

7-
import 'package:analyzer/src/lint/util.dart' show Spelunker;
7+
import 'package:analyzer_testing/src/spelunker.dart';
88
import 'package:args/args.dart';
99

1010
/// AST Spelunker

0 commit comments

Comments
 (0)