mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 13:08:10 +00:00
Analyzer: Make test fields late, late final, or hinted for migration.
Many fields can be late or late final, so adding hints for the migration tool. In SnippetTester, the fields are all set in the constructor. Added a factory constructor so the fields can be final. Renamed them to be private. Change-Id: I559e7ba92c7c6749038630b03f67f8a77bdc704a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170406 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
e56e5104cf
commit
9e6486fe3f
|
@ -22,8 +22,8 @@ void main() {
|
|||
class FromEnvironmentEvaluatorTest {
|
||||
static const String _defaultValue = 'defaultValue';
|
||||
|
||||
TypeProvider typeProvider;
|
||||
TypeSystemImpl typeSystem;
|
||||
/*late final*/ TypeProvider typeProvider;
|
||||
/*late final*/ TypeSystemImpl typeSystem;
|
||||
|
||||
DartObjectImpl get _boolValueFalse {
|
||||
return DartObjectImpl(
|
||||
|
|
|
@ -59,7 +59,7 @@ void main() => print('Hello, world!')
|
|||
String content = '''
|
||||
void main() => print('Hello, world!')
|
||||
''';
|
||||
String expectedPath;
|
||||
/*late*/ String expectedPath;
|
||||
ParseStringResult result =
|
||||
_withMemoryFile(content, (resourceProvider, path) {
|
||||
expectedPath = path;
|
||||
|
|
|
@ -21,15 +21,15 @@ main() {
|
|||
|
||||
@reflectiveTest
|
||||
class AnalysisSessionImplTest with ResourceProviderMixin {
|
||||
AnalysisContextCollection contextCollection;
|
||||
AnalysisContext context;
|
||||
AnalysisSessionImpl session;
|
||||
/*late final*/ AnalysisContextCollection contextCollection;
|
||||
/*late final*/ AnalysisContext context;
|
||||
/*late final*/ AnalysisSessionImpl session;
|
||||
|
||||
String testContextPath;
|
||||
String aaaContextPath;
|
||||
String bbbContextPath;
|
||||
/*late final*/ String testContextPath;
|
||||
/*late final*/ String aaaContextPath;
|
||||
/*late final*/ String bbbContextPath;
|
||||
|
||||
String testPath;
|
||||
/*late final*/ String testPath;
|
||||
|
||||
void setUp() {
|
||||
MockSdk(resourceProvider: resourceProvider);
|
||||
|
|
|
@ -25,25 +25,28 @@ main() async {
|
|||
}
|
||||
|
||||
class SnippetTester {
|
||||
OverlayResourceProvider provider;
|
||||
Folder docFolder;
|
||||
String snippetDirPath;
|
||||
String snippetPath;
|
||||
final OverlayResourceProvider provider;
|
||||
final Folder docFolder;
|
||||
final String snippetDirPath;
|
||||
final String snippetPath;
|
||||
|
||||
StringBuffer output = StringBuffer();
|
||||
final StringBuffer output = StringBuffer();
|
||||
|
||||
SnippetTester() {
|
||||
provider = OverlayResourceProvider(PhysicalResourceProvider.INSTANCE);
|
||||
String packageRoot =
|
||||
provider.pathContext.normalize(package_root.packageRoot);
|
||||
String analyzerPath = provider.pathContext.join(packageRoot, 'analyzer');
|
||||
String docPath = provider.pathContext.join(analyzerPath, 'doc');
|
||||
docFolder = provider.getFolder(docPath);
|
||||
snippetDirPath =
|
||||
factory SnippetTester() {
|
||||
var provider = OverlayResourceProvider(PhysicalResourceProvider.INSTANCE);
|
||||
var packageRoot = provider.pathContext.normalize(package_root.packageRoot);
|
||||
var analyzerPath = provider.pathContext.join(packageRoot, 'analyzer');
|
||||
var docPath = provider.pathContext.join(analyzerPath, 'doc');
|
||||
var docFolder = provider.getFolder(docPath);
|
||||
var snippetDirPath =
|
||||
provider.pathContext.join(analyzerPath, 'test', 'snippets');
|
||||
snippetPath = provider.pathContext.join(snippetDirPath, 'snippet.dart');
|
||||
var snippetPath = provider.pathContext.join(snippetDirPath, 'snippet.dart');
|
||||
return SnippetTester._(provider, docFolder, snippetDirPath, snippetPath);
|
||||
}
|
||||
|
||||
SnippetTester._(
|
||||
this.provider, this.docFolder, this.snippetDirPath, this.snippetPath);
|
||||
|
||||
Future<void> verify() async {
|
||||
await verifyFolder(docFolder);
|
||||
}
|
||||
|
|
|
@ -177,8 +177,9 @@ class DocumentationGenerator {
|
|||
List<String> includedPaths = [];
|
||||
for (CodePath codePath in codePaths) {
|
||||
includedPaths.add(codePath.documentationPath);
|
||||
if (codePath.declarationPath != null) {
|
||||
includedPaths.add(codePath.declarationPath);
|
||||
var declarationPath = codePath.declarationPath;
|
||||
if (declarationPath != null) {
|
||||
includedPaths.add(declarationPath);
|
||||
}
|
||||
}
|
||||
AnalysisContextCollection collection = AnalysisContextCollection(
|
||||
|
|
Loading…
Reference in a new issue