Remove remaining uses of Null as a type argument from analyzer
Change-Id: I6022fbc18c002447278ec8dc0e2b24d3eb369a49
Reviewed-on: https://dart-review.googlesource.com/c/88436
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer/lib/src/codegen/tools.dart b/pkg/analyzer/lib/src/codegen/tools.dart
index 8cd9293..8b4e96d 100644
--- a/pkg/analyzer/lib/src/codegen/tools.dart
+++ b/pkg/analyzer/lib/src/codegen/tools.dart
@@ -40,6 +40,19 @@
}
/**
+ * Type of functions used to compute the contents of a set of generated files.
+ * [pkgPath] is the path to the current package.
+ */
+typedef Map<String, FileContentsComputer> DirectoryContentsComputer(
+ String pkgPath);
+
+/**
+ * Type of functions used to compute the contents of a generated file.
+ * [pkgPath] is the path to the current package.
+ */
+typedef Future<String> FileContentsComputer(String pkgPath);
+
+/**
* Mixin class for generating code.
*/
class CodeGenerator {
@@ -244,6 +257,255 @@
}
/**
+ * A utility class for invoking dartfmt.
+ */
+class DartFormat {
+ static String get _dartfmtPath {
+ String binName = Platform.isWindows ? 'dartfmt.bat' : 'dartfmt';
+ for (var loc in [binName, join('dart-sdk', 'bin', binName)]) {
+ var candidatePath = join(dirname(Platform.resolvedExecutable), loc);
+ if (new File(candidatePath).existsSync()) {
+ return candidatePath;
+ }
+ }
+ throw new StateError('Could not find dartfmt executable');
+ }
+
+ static void formatFile(File file) {
+ ProcessResult result = Process.runSync(_dartfmtPath, ['-w', file.path]);
+ if (result.exitCode != 0) throw result.stderr;
+ }
+
+ static String formatText(String text) {
+ File file = new File(join(Directory.systemTemp.path, 'gen.dart'));
+ file.writeAsStringSync(text);
+ ProcessResult result = Process.runSync(_dartfmtPath, ['-w', file.path]);
+ if (result.exitCode != 0) throw result.stderr;
+ return file.readAsStringSync();
+ }
+}
+
+/**
+ * Abstract base class representing behaviors common to generated files and
+ * generated directories.
+ */
+abstract class GeneratedContent {
+ /**
+ * Check whether the [output] has the correct contents, and return true if it
+ * does. [pkgPath] is the path to the current package.
+ */
+ Future<bool> check(String pkgPath);
+
+ /**
+ * Replace the [output] with the correct contents. [pkgPath] is the path to
+ * the current package.
+ */
+ Future<void> generate(String pkgPath);
+
+ /**
+ * Get a [FileSystemEntity] representing the output file or directory.
+ * [pkgPath] is the path to the current package.
+ */
+ FileSystemEntity output(String pkgPath);
+
+ /**
+ * Check that all of the [targets] are up to date. If they are not, print
+ * out a message instructing the user to regenerate them, and exit with a
+ * nonzero error code.
+ *
+ * [pkgPath] is the path to the current package. [generatorRelPath] is the
+ * path to a .dart script the user may use to regenerate the targets.
+ *
+ * To avoid mistakes when run on Windows, [generatorRelPath] always uses
+ * POSIX directory separators.
+ */
+ static Future<void> checkAll(String pkgPath, String generatorRelPath,
+ Iterable<GeneratedContent> targets) async {
+ bool generateNeeded = false;
+ for (GeneratedContent target in targets) {
+ bool ok = await target.check(pkgPath);
+ if (!ok) {
+ print("${target.output(pkgPath).absolute}"
+ " doesn't have expected contents.");
+ generateNeeded = true;
+ }
+ }
+ if (generateNeeded) {
+ print('Please regenerate using:');
+ String executable = Platform.executable;
+ String packageRoot = '';
+ // ignore: deprecated_member_use
+ if (Platform.packageRoot != null) {
+ // ignore: deprecated_member_use
+ packageRoot = ' --package-root=${Platform.packageRoot}';
+ }
+ String generateScript =
+ join(pkgPath, joinAll(posix.split(generatorRelPath)));
+ print(' $executable$packageRoot $generateScript');
+ exit(1);
+ } else {
+ print('All generated files up to date.');
+ }
+ }
+
+ /**
+ * Regenerate all of the [targets]. [pkgPath] is the path to the current
+ * package.
+ */
+ static Future<void> generateAll(
+ String pkgPath, Iterable<GeneratedContent> targets) async {
+ print("Generating...");
+ for (GeneratedContent target in targets) {
+ await target.generate(pkgPath);
+ }
+ }
+}
+
+/**
+ * Class representing a single output directory (either generated code or
+ * generated HTML). No other content should exist in the directory.
+ */
+class GeneratedDirectory extends GeneratedContent {
+ /**
+ * The path to the directory that will have the generated content.
+ */
+ final String outputDirPath;
+
+ /**
+ * Callback function that computes the directory contents.
+ */
+ final DirectoryContentsComputer directoryContentsComputer;
+
+ GeneratedDirectory(this.outputDirPath, this.directoryContentsComputer);
+
+ @override
+ Future<bool> check(String pkgPath) async {
+ Directory outputDirectory = output(pkgPath);
+ Map<String, FileContentsComputer> map = directoryContentsComputer(pkgPath);
+ try {
+ for (String file in map.keys) {
+ FileContentsComputer fileContentsComputer = map[file];
+ String expectedContents = await fileContentsComputer(pkgPath);
+ File outputFile = new File(posix.join(outputDirectory.path, file));
+ String actualContents = outputFile.readAsStringSync();
+ // Normalize Windows line endings to Unix line endings so that the
+ // comparison doesn't fail on Windows.
+ actualContents = actualContents.replaceAll('\r\n', '\n');
+ if (expectedContents != actualContents) {
+ return false;
+ }
+ }
+ int nonHiddenFileCount = 0;
+ outputDirectory
+ .listSync(recursive: false, followLinks: false)
+ .forEach((FileSystemEntity fileSystemEntity) {
+ if (fileSystemEntity is File &&
+ !basename(fileSystemEntity.path).startsWith('.')) {
+ nonHiddenFileCount++;
+ }
+ });
+ if (nonHiddenFileCount != map.length) {
+ // The number of files generated doesn't match the number we expected to
+ // generate.
+ return false;
+ }
+ } catch (e) {
+ // There was a problem reading the file (most likely because it didn't
+ // exist). Treat that the same as if the file doesn't have the expected
+ // contents.
+ return false;
+ }
+ return true;
+ }
+
+ @override
+ Future<void> generate(String pkgPath) async {
+ Directory outputDirectory = output(pkgPath);
+ try {
+ // delete the contents of the directory (and the directory itself)
+ outputDirectory.deleteSync(recursive: true);
+ } catch (e) {
+ // Error caught while trying to delete the directory, this can happen if
+ // it didn't yet exist.
+ }
+ // re-create the empty directory
+ outputDirectory.createSync(recursive: true);
+
+ // generate all of the files in the directory
+ Map<String, FileContentsComputer> map = directoryContentsComputer(pkgPath);
+ for (String file in map.keys) {
+ FileContentsComputer fileContentsComputer = map[file];
+ File outputFile = new File(posix.join(outputDirectory.path, file));
+ print(' ${outputFile.path}');
+ String contents = await fileContentsComputer(pkgPath);
+ outputFile.writeAsStringSync(contents);
+ }
+ }
+
+ @override
+ Directory output(String pkgPath) =>
+ new Directory(join(pkgPath, joinAll(posix.split(outputDirPath))));
+}
+
+/**
+ * Class representing a single output file (either generated code or generated
+ * HTML).
+ */
+class GeneratedFile extends GeneratedContent {
+ /**
+ * The output file to which generated output should be written, relative to
+ * the "tool/spec" directory. This filename uses the posix path separator
+ * ('/') regardless of the OS.
+ */
+ final String outputPath;
+
+ /**
+ * Callback function which computes the file.
+ */
+ final FileContentsComputer computeContents;
+
+ GeneratedFile(this.outputPath, this.computeContents);
+
+ bool get isDartFile => outputPath.endsWith('.dart');
+
+ @override
+ Future<bool> check(String pkgPath) async {
+ File outputFile = output(pkgPath);
+ String expectedContents = await computeContents(pkgPath);
+ if (isDartFile) {
+ expectedContents = DartFormat.formatText(expectedContents);
+ }
+ try {
+ String actualContents = outputFile.readAsStringSync();
+ // Normalize Windows line endings to Unix line endings so that the
+ // comparison doesn't fail on Windows.
+ actualContents = actualContents.replaceAll('\r\n', '\n');
+ return expectedContents == actualContents;
+ } catch (e) {
+ // There was a problem reading the file (most likely because it didn't
+ // exist). Treat that the same as if the file doesn't have the expected
+ // contents.
+ return false;
+ }
+ }
+
+ @override
+ Future<void> generate(String pkgPath) async {
+ File outputFile = output(pkgPath);
+ print(' ${outputFile.path}');
+ String contents = await computeContents(pkgPath);
+ outputFile.writeAsStringSync(contents);
+ if (isDartFile) {
+ DartFormat.formatFile(outputFile);
+ }
+ }
+
+ @override
+ File output(String pkgPath) =>
+ new File(join(pkgPath, joinAll(posix.split(outputPath))));
+}
+
+/**
* Mixin class for generating HTML representations of code that are suitable
* for enclosing inside a <pre> element.
*/
@@ -384,265 +646,3 @@
}
}
}
-
-/**
- * Type of functions used to compute the contents of a set of generated files.
- * [pkgPath] is the path to the current package.
- */
-typedef Map<String, FileContentsComputer> DirectoryContentsComputer(
- String pkgPath);
-
-/**
- * Type of functions used to compute the contents of a generated file.
- * [pkgPath] is the path to the current package.
- */
-typedef Future<String> FileContentsComputer(String pkgPath);
-
-/**
- * Abstract base class representing behaviors common to generated files and
- * generated directories.
- */
-abstract class GeneratedContent {
- /**
- * Check whether the [output] has the correct contents, and return true if it
- * does. [pkgPath] is the path to the current package.
- */
- Future<bool> check(String pkgPath);
-
- /**
- * Replace the [output] with the correct contents. [pkgPath] is the path to
- * the current package.
- */
- Future<Null> generate(String pkgPath);
-
- /**
- * Get a [FileSystemEntity] representing the output file or directory.
- * [pkgPath] is the path to the current package.
- */
- FileSystemEntity output(String pkgPath);
-
- /**
- * Check that all of the [targets] are up to date. If they are not, print
- * out a message instructing the user to regenerate them, and exit with a
- * nonzero error code.
- *
- * [pkgPath] is the path to the current package. [generatorRelPath] is the
- * path to a .dart script the user may use to regenerate the targets.
- *
- * To avoid mistakes when run on Windows, [generatorRelPath] always uses
- * POSIX directory separators.
- */
- static Future<Null> checkAll(String pkgPath, String generatorRelPath,
- Iterable<GeneratedContent> targets) async {
- bool generateNeeded = false;
- for (GeneratedContent target in targets) {
- bool ok = await target.check(pkgPath);
- if (!ok) {
- print("${target.output(pkgPath).absolute}"
- " doesn't have expected contents.");
- generateNeeded = true;
- }
- }
- if (generateNeeded) {
- print('Please regenerate using:');
- String executable = Platform.executable;
- String packageRoot = '';
- // ignore: deprecated_member_use
- if (Platform.packageRoot != null) {
- // ignore: deprecated_member_use
- packageRoot = ' --package-root=${Platform.packageRoot}';
- }
- String generateScript =
- join(pkgPath, joinAll(posix.split(generatorRelPath)));
- print(' $executable$packageRoot $generateScript');
- exit(1);
- } else {
- print('All generated files up to date.');
- }
- }
-
- /**
- * Regenerate all of the [targets]. [pkgPath] is the path to the current
- * package.
- */
- static Future<Null> generateAll(
- String pkgPath, Iterable<GeneratedContent> targets) async {
- print("Generating...");
- for (GeneratedContent target in targets) {
- await target.generate(pkgPath);
- }
- }
-}
-
-/**
- * Class representing a single output directory (either generated code or
- * generated HTML). No other content should exist in the directory.
- */
-class GeneratedDirectory extends GeneratedContent {
- /**
- * The path to the directory that will have the generated content.
- */
- final String outputDirPath;
-
- /**
- * Callback function that computes the directory contents.
- */
- final DirectoryContentsComputer directoryContentsComputer;
-
- GeneratedDirectory(this.outputDirPath, this.directoryContentsComputer);
-
- @override
- Future<bool> check(String pkgPath) async {
- Directory outputDirectory = output(pkgPath);
- Map<String, FileContentsComputer> map = directoryContentsComputer(pkgPath);
- try {
- for (String file in map.keys) {
- FileContentsComputer fileContentsComputer = map[file];
- String expectedContents = await fileContentsComputer(pkgPath);
- File outputFile = new File(posix.join(outputDirectory.path, file));
- String actualContents = outputFile.readAsStringSync();
- // Normalize Windows line endings to Unix line endings so that the
- // comparison doesn't fail on Windows.
- actualContents = actualContents.replaceAll('\r\n', '\n');
- if (expectedContents != actualContents) {
- return false;
- }
- }
- int nonHiddenFileCount = 0;
- outputDirectory
- .listSync(recursive: false, followLinks: false)
- .forEach((FileSystemEntity fileSystemEntity) {
- if (fileSystemEntity is File &&
- !basename(fileSystemEntity.path).startsWith('.')) {
- nonHiddenFileCount++;
- }
- });
- if (nonHiddenFileCount != map.length) {
- // The number of files generated doesn't match the number we expected to
- // generate.
- return false;
- }
- } catch (e) {
- // There was a problem reading the file (most likely because it didn't
- // exist). Treat that the same as if the file doesn't have the expected
- // contents.
- return false;
- }
- return true;
- }
-
- @override
- Future<Null> generate(String pkgPath) async {
- Directory outputDirectory = output(pkgPath);
- try {
- // delete the contents of the directory (and the directory itself)
- outputDirectory.deleteSync(recursive: true);
- } catch (e) {
- // Error caught while trying to delete the directory, this can happen if
- // it didn't yet exist.
- }
- // re-create the empty directory
- outputDirectory.createSync(recursive: true);
-
- // generate all of the files in the directory
- Map<String, FileContentsComputer> map = directoryContentsComputer(pkgPath);
- for (String file in map.keys) {
- FileContentsComputer fileContentsComputer = map[file];
- File outputFile = new File(posix.join(outputDirectory.path, file));
- print(' ${outputFile.path}');
- String contents = await fileContentsComputer(pkgPath);
- outputFile.writeAsStringSync(contents);
- }
- }
-
- @override
- Directory output(String pkgPath) =>
- new Directory(join(pkgPath, joinAll(posix.split(outputDirPath))));
-}
-
-/**
- * Class representing a single output file (either generated code or generated
- * HTML).
- */
-class GeneratedFile extends GeneratedContent {
- /**
- * The output file to which generated output should be written, relative to
- * the "tool/spec" directory. This filename uses the posix path separator
- * ('/') regardless of the OS.
- */
- final String outputPath;
-
- /**
- * Callback function which computes the file.
- */
- final FileContentsComputer computeContents;
-
- GeneratedFile(this.outputPath, this.computeContents);
-
- bool get isDartFile => outputPath.endsWith('.dart');
-
- @override
- Future<bool> check(String pkgPath) async {
- File outputFile = output(pkgPath);
- String expectedContents = await computeContents(pkgPath);
- if (isDartFile) {
- expectedContents = DartFormat.formatText(expectedContents);
- }
- try {
- String actualContents = outputFile.readAsStringSync();
- // Normalize Windows line endings to Unix line endings so that the
- // comparison doesn't fail on Windows.
- actualContents = actualContents.replaceAll('\r\n', '\n');
- return expectedContents == actualContents;
- } catch (e) {
- // There was a problem reading the file (most likely because it didn't
- // exist). Treat that the same as if the file doesn't have the expected
- // contents.
- return false;
- }
- }
-
- @override
- Future<Null> generate(String pkgPath) async {
- File outputFile = output(pkgPath);
- print(' ${outputFile.path}');
- String contents = await computeContents(pkgPath);
- outputFile.writeAsStringSync(contents);
- if (isDartFile) {
- DartFormat.formatFile(outputFile);
- }
- }
-
- @override
- File output(String pkgPath) =>
- new File(join(pkgPath, joinAll(posix.split(outputPath))));
-}
-
-/**
- * A utility class for invoking dartfmt.
- */
-class DartFormat {
- static String get _dartfmtPath {
- String binName = Platform.isWindows ? 'dartfmt.bat' : 'dartfmt';
- for (var loc in [binName, join('dart-sdk', 'bin', binName)]) {
- var candidatePath = join(dirname(Platform.resolvedExecutable), loc);
- if (new File(candidatePath).existsSync()) {
- return candidatePath;
- }
- }
- throw new StateError('Could not find dartfmt executable');
- }
-
- static void formatFile(File file) {
- ProcessResult result = Process.runSync(_dartfmtPath, ['-w', file.path]);
- if (result.exitCode != 0) throw result.stderr;
- }
-
- static String formatText(String text) {
- File file = new File(join(Directory.systemTemp.path, 'gen.dart'));
- file.writeAsStringSync(text);
- ProcessResult result = Process.runSync(_dartfmtPath, ['-w', file.path]);
- if (result.exitCode != 0) throw result.stderr;
- return file.readAsStringSync();
- }
-}
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index d78c95c..9369ec0 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, 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.
@@ -1061,7 +1061,7 @@
}
@override
- Future<Null> performWork() async {
+ Future<void> performWork() async {
// TODO(brianwilkerson) Determine whether this await is necessary.
await null;
if (_fileTracker.verifyChangedFilesIfNeeded()) {
@@ -1931,7 +1931,7 @@
/**
* Perform a single chunk of work and produce [results].
*/
- Future<Null> performWork();
+ Future<void> performWork();
}
/**
@@ -2063,13 +2063,13 @@
* If the status is currently idle, the returned future will be signaled
* immediately.
*/
- Future<Null> waitForIdle() => _statusSupport.waitForIdle();
+ Future<void> waitForIdle() => _statusSupport.waitForIdle();
/**
* Run infinitely analysis cycle, selecting the drivers with the highest
* priority first.
*/
- Future<Null> _run() async {
+ Future<void> _run() async {
// Give other microtasks the time to run before doing the analysis cycle.
await null;
Stopwatch timer = new Stopwatch()..start();
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_byte_store.dart b/pkg/analyzer/lib/src/dart/analysis/file_byte_store.dart
index 1aaa47d..eecc2ca 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_byte_store.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_byte_store.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2015, 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.
@@ -62,7 +62,7 @@
/**
* If the cache clean up process has not been requested yet, request it.
*/
- Future<Null> _requestCacheCleanUp() async {
+ Future<void> _requestCacheCleanUp() async {
if (_cleanUpSendPortShouldBePrepared) {
_cleanUpSendPortShouldBePrepared = false;
ReceivePort response = new ReceivePort();
diff --git a/pkg/analyzer/lib/src/dart/analysis/mutex.dart b/pkg/analyzer/lib/src/dart/analysis/mutex.dart
index 864e616..bf7532a 100644
--- a/pkg/analyzer/lib/src/dart/analysis/mutex.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/mutex.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2017, 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.
@@ -18,18 +18,18 @@
/// m.release();
/// }
class Mutex {
- Completer<Null> _lock;
+ Completer<void> _lock;
/// Acquire a lock.
///
/// Returns a [Future] that will be completed when the lock has been acquired.
- Future<Null> acquire() async {
+ Future<void> acquire() async {
// TODO(brianwilkerson) Determine whether this await is necessary.
await null;
while (_lock != null) {
await _lock.future;
}
- _lock = new Completer<Null>();
+ _lock = new Completer<void>();
}
/// Run the given [criticalSection] with acquired mutex.
diff --git a/pkg/analyzer/lib/src/dart/analysis/search.dart b/pkg/analyzer/lib/src/dart/analysis/search.dart
index 38f006e..caa227a 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -479,7 +479,7 @@
return results;
}
- Future<Null> _addResults(
+ Future<void> _addResults(
List<SearchResult> results,
Element element,
SearchedFiles searchedFiles,
@@ -523,7 +523,7 @@
/**
* Add results for [element] usage in the given [file].
*/
- Future<Null> _addResultsInFile(
+ Future<void> _addResultsInFile(
List<SearchResult> results,
Element element,
Map<IndexRelationKind, SearchResultKind> relationToResultKind,
diff --git a/pkg/analyzer/lib/src/dart/analysis/status.dart b/pkg/analyzer/lib/src/dart/analysis/status.dart
index cc2ad45..383de26 100644
--- a/pkg/analyzer/lib/src/dart/analysis/status.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/status.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, 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.
@@ -37,16 +37,16 @@
* after completion and will not complete until [notify] is called next time.
*/
class Monitor {
- Completer<Null> _completer = new Completer<Null>();
+ Completer<void> _completer = new Completer<void>();
/**
* Return a [Future] that completes when [notify] is called at least once.
*/
- Future<Null> get signal async {
+ Future<void> get signal async {
// TODO(brianwilkerson) Determine whether this await is necessary.
await null;
await _completer.future;
- _completer = new Completer<Null>();
+ _completer = new Completer<void>();
}
/**
@@ -78,7 +78,7 @@
* If non-null, a completer which should be completed on the next transition
* to idle.
*/
- Completer<Null> _idleCompleter;
+ Completer<void> _idleCompleter;
/**
* Return the last status sent to the [stream].
@@ -98,7 +98,7 @@
* as a call to [transitionToAnalyzing], but it has no effect on the [stream].
*/
void preTransitionToAnalyzing() {
- _idleCompleter ??= new Completer<Null>();
+ _idleCompleter ??= new Completer<void>();
}
/**
@@ -130,7 +130,7 @@
* If the status is currently idle, the returned future will be signaled
* immediately.
*/
- Future<Null> waitForIdle() {
- return _idleCompleter?.future ?? new Future.value();
+ Future<void> waitForIdle() {
+ return _idleCompleter?.future ?? new Future<void>.value();
}
}
diff --git a/pkg/analyzer/lib/src/generated/testing/element_search.dart b/pkg/analyzer/lib/src/generated/testing/element_search.dart
index 818b56d..c6c7a8f 100644
--- a/pkg/analyzer/lib/src/generated/testing/element_search.dart
+++ b/pkg/analyzer/lib/src/generated/testing/element_search.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2017, 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.
@@ -15,7 +15,7 @@
return finder.elements;
}
-class _ElementsByNameFinder extends RecursiveAstVisitor<Null> {
+class _ElementsByNameFinder extends RecursiveAstVisitor<void> {
final String name;
final List<Element> elements = [];
diff --git a/pkg/analyzer/lib/src/generated/testing/node_search.dart b/pkg/analyzer/lib/src/generated/testing/node_search.dart
index 39889ee..e1fe5f6 100644
--- a/pkg/analyzer/lib/src/generated/testing/node_search.dart
+++ b/pkg/analyzer/lib/src/generated/testing/node_search.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2017, 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.
@@ -15,7 +15,7 @@
return finder.identifiers;
}
-class _DeclaredIdentifiersByNameFinder extends RecursiveAstVisitor<Null> {
+class _DeclaredIdentifiersByNameFinder extends RecursiveAstVisitor<void> {
final String name;
final List<SimpleIdentifier> identifiers = [];
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index 586cf0b..3583fb3 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -1556,7 +1556,7 @@
}
}
-class _TopLevelInitializerValidator extends RecursiveAstVisitor<Null> {
+class _TopLevelInitializerValidator extends RecursiveAstVisitor<void> {
final CodeChecker _codeChecker;
final String _name;
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index 8ecb71f..82008a0 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -6486,7 +6486,7 @@
verify([source]);
}
- Future<Null> _check_constEvalThrowsException_binary_null(
+ Future<void> _check_constEvalThrowsException_binary_null(
String expr, bool resolved) async {
Source source = addSource("const C = $expr;");
await computeAnalysisResult(source);
@@ -6496,7 +6496,7 @@
}
}
- Future<Null> _check_constEvalTypeBool_withParameter_binary(
+ Future<void> _check_constEvalTypeBool_withParameter_binary(
String expr) async {
Source source = addSource('''
class A {
@@ -6511,7 +6511,7 @@
verify([source]);
}
- Future<Null> _check_constEvalTypeBoolOrInt_withParameter_binary(
+ Future<void> _check_constEvalTypeBoolOrInt_withParameter_binary(
String expr) async {
Source source = addSource('''
class A {
@@ -6526,7 +6526,7 @@
verify([source]);
}
- Future<Null> _check_constEvalTypeInt_withParameter_binary(String expr) async {
+ Future<void> _check_constEvalTypeInt_withParameter_binary(String expr) async {
Source source = addSource('''
class A {
final a;
@@ -6540,7 +6540,7 @@
verify([source]);
}
- Future<Null> _check_constEvalTypeNum_withParameter_binary(String expr) async {
+ Future<void> _check_constEvalTypeNum_withParameter_binary(String expr) async {
Source source = addSource('''
class A {
final a;
@@ -6554,7 +6554,7 @@
verify([source]);
}
- Future<Null> _check_wrongNumberOfParametersForOperator(
+ Future<void> _check_wrongNumberOfParametersForOperator(
String name, String parameters) async {
Source source = addSource('''
class A {
@@ -6566,12 +6566,12 @@
verify([source]);
}
- Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {
+ Future<void> _check_wrongNumberOfParametersForOperator1(String name) async {
await _check_wrongNumberOfParametersForOperator(name, "");
await _check_wrongNumberOfParametersForOperator(name, "a, b");
}
- Future<Null> _privateCollisionInMixinApplicationTest(String testCode) async {
+ Future<void> _privateCollisionInMixinApplicationTest(String testCode) async {
addNamedSource('/lib1.dart', '''
class A {
int _x;
diff --git a/pkg/analyzer/test/generated/declaration_resolver_test.dart b/pkg/analyzer/test/generated/declaration_resolver_test.dart
index 0a991f7..26dd5a1 100644
--- a/pkg/analyzer/test/generated/declaration_resolver_test.dart
+++ b/pkg/analyzer/test/generated/declaration_resolver_test.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2015, 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.
@@ -58,7 +58,7 @@
}
}
- Future<Null> setupCode(String code) async {
+ Future<void> setupCode(String code) async {
this.code = code;
unit = await resolveSource(code + ' const a = null;');
unit2 = _cloneResolveUnit(unit);
diff --git a/pkg/analyzer/test/generated/element_resolver_test.dart b/pkg/analyzer/test/generated/element_resolver_test.dart
index 1404256..58c0a5c 100644
--- a/pkg/analyzer/test/generated/element_resolver_test.dart
+++ b/pkg/analyzer/test/generated/element_resolver_test.dart
@@ -277,7 +277,7 @@
});
}
- Future<Null> _validateAnnotation(
+ Future<void> _validateAnnotation(
String annotationPrefix,
String annotationText,
validator(SimpleIdentifier name1, SimpleIdentifier name2,
diff --git a/pkg/analyzer/test/generated/invalid_code_test.dart b/pkg/analyzer/test/generated/invalid_code_test.dart
index 253b063..3d24f99 100644
--- a/pkg/analyzer/test/generated/invalid_code_test.dart
+++ b/pkg/analyzer/test/generated/invalid_code_test.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2017, 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.
@@ -48,7 +48,7 @@
''');
}
- Future<Null> _assertCanBeAnalyzed(String text) async {
+ Future<void> _assertCanBeAnalyzed(String text) async {
Source source = addSource(text);
var analysisResult = await computeAnalysisResult(source);
expect(analysisResult.errors, isNotEmpty);
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index 5b3be54..8ab7c1a 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -6094,7 +6094,7 @@
verify([source]);
}
- Future<Null> _check_wrongNumberOfParametersForOperator(
+ Future<void> _check_wrongNumberOfParametersForOperator(
String name, String parameters) async {
Source source = addSource("""
class A {
@@ -6105,7 +6105,7 @@
verify([source]);
}
- Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {
+ Future<void> _check_wrongNumberOfParametersForOperator1(String name) async {
await _check_wrongNumberOfParametersForOperator(name, "a");
}
}
diff --git a/pkg/analyzer/test/generated/resolver_test_case.dart b/pkg/analyzer/test/generated/resolver_test_case.dart
index c5b0625..485d871 100644
--- a/pkg/analyzer/test/generated/resolver_test_case.dart
+++ b/pkg/analyzer/test/generated/resolver_test_case.dart
@@ -456,7 +456,7 @@
* Like [assertErrors], but takes a string of source code.
*/
// TODO(rnystrom): Use this in more tests that have the same structure.
- Future<Null> assertErrorsInCode(String code, List<ErrorCode> errors,
+ Future<void> assertErrorsInCode(String code, List<ErrorCode> errors,
{bool verify: true}) async {
Source source = addSource(code);
await computeAnalysisResult(source);
@@ -471,7 +471,7 @@
*
* Like [assertErrors], but takes a string of source code.
*/
- Future<Null> assertErrorsInUnverifiedCode(
+ Future<void> assertErrorsInUnverifiedCode(
String code, List<ErrorCode> errors) async {
Source source = addSource(code);
await computeAnalysisResult(source);
@@ -493,7 +493,7 @@
* Asserts that [code] has no errors or warnings.
*/
// TODO(rnystrom): Use this in more tests that have the same structure.
- Future<Null> assertNoErrorsInCode(String code) async {
+ Future<void> assertNoErrorsInCode(String code) async {
Source source = addSource(code);
await computeAnalysisResult(source);
assertNoErrors(source);
@@ -773,7 +773,7 @@
return null;
}
- Future<Null> resolveWithAndWithoutExperimental(
+ Future<void> resolveWithAndWithoutExperimental(
List<String> strSources,
List<ErrorCode> codesWithoutExperimental,
List<ErrorCode> codesWithExperimental) async {
@@ -795,7 +795,7 @@
verify([source]);
}
- Future<Null> resolveWithErrors(
+ Future<void> resolveWithErrors(
List<String> strSources, List<ErrorCode> codes) async {
Source source = await resolveSources(strSources);
assertErrors(source, codes);
@@ -926,7 +926,7 @@
testUnit, testCode, search, (node) => node is SimpleIdentifier);
}
- Future<Null> resolveTestUnit(String code, {bool noErrors: true}) async {
+ Future<void> resolveTestUnit(String code, {bool noErrors: true}) async {
testCode = code;
testSource = addSource(testCode);
TestAnalysisResult analysisResult = await computeAnalysisResult(testSource);
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index b3fed7f..88127b5 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, 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.
@@ -4430,7 +4430,7 @@
expectInitializerType('foo', 'int');
}
- Future<Null> _objectMethodOnFunctions_helper2(String code) async {
+ Future<void> _objectMethodOnFunctions_helper2(String code) async {
await resolveTestUnit(code);
expectIdentifierType('t0', "String");
expectIdentifierType('t1', "() → String");
diff --git a/pkg/analyzer/test/src/dart/analysis/index_test.dart b/pkg/analyzer/test/src/dart/analysis/index_test.dart
index 94fbd94..a4217fe 100644
--- a/pkg/analyzer/test/src/dart/analysis/index_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/index_test.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, 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.
@@ -1336,7 +1336,7 @@
return _getStringId(str);
}
- Future<Null> _indexTestUnit(String code) async {
+ Future<void> _indexTestUnit(String code) async {
addTestFile(code);
ResolvedUnitResult result = await driver.getResult(testFile);
diff --git a/pkg/analyzer/test/src/dart/analysis/search_test.dart b/pkg/analyzer/test/src/dart/analysis/search_test.dart
index 2d67389..8be9b97 100644
--- a/pkg/analyzer/test/src/dart/analysis/search_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/search_test.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, 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.
@@ -2016,7 +2016,7 @@
return ElementLocator.locate(node);
}
- Future<Null> _resolveTestUnit(String code, {bool addToDriver: true}) async {
+ Future<void> _resolveTestUnit(String code, {bool addToDriver: true}) async {
if (addToDriver) {
addTestFile(code);
} else {
@@ -2031,7 +2031,7 @@
}
}
- Future<Null> _verifyNameReferences(
+ Future<void> _verifyNameReferences(
String name, List<ExpectedResult> expectedMatches) async {
var searchedFiles = new SearchedFiles();
List<SearchResult> results =
diff --git a/pkg/analyzer/test/src/summary/top_level_inference_test.dart b/pkg/analyzer/test/src/summary/top_level_inference_test.dart
index ace76cd..9151786 100644
--- a/pkg/analyzer/test/src/summary/top_level_inference_test.dart
+++ b/pkg/analyzer/test/src/summary/top_level_inference_test.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2017, 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.
@@ -354,7 +354,7 @@
await checkFile(content);
}
- Future<Null> _assertErrorOnlyLeft(List<String> operators) async {
+ Future<void> _assertErrorOnlyLeft(List<String> operators) async {
String code = 'var a = 1;\n';
for (var i = 0; i < operators.length; i++) {
String operator = operators[i];