[flutter_tools] rename local functions with _s (#102688)

This commit is contained in:
Phil Quitslund
2022-04-27 16:19:07 -07:00
committed by GitHub
parent a03f59cdc4
commit b5e7fb076c
20 changed files with 341 additions and 341 deletions

View File

@@ -249,7 +249,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
static List<AndroidStudio> _allMacOS() {
final List<FileSystemEntity> candidatePaths = <FileSystemEntity>[];
void _checkForStudio(String path) {
void checkForStudio(String path) {
if (!globals.fs.isDirectorySync(path)) {
return;
}
@@ -264,7 +264,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
if (name.startsWith('Android Studio') && name.endsWith('.app')) {
candidatePaths.add(directory);
} else if (!directory.path.endsWith('.app')) {
_checkForStudio(directory.path);
checkForStudio(directory.path);
}
}
} on Exception catch (e) {
@@ -272,10 +272,10 @@ class AndroidStudio implements Comparable<AndroidStudio> {
}
}
_checkForStudio('/Applications');
checkForStudio('/Applications');
final String? homeDirPath = globals.fsUtils.homeDirPath;
if (homeDirPath != null) {
_checkForStudio(globals.fs.path.join(
checkForStudio(globals.fs.path.join(
homeDirPath,
'Applications',
));
@@ -321,7 +321,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
static List<AndroidStudio> _allLinuxOrWindows() {
final List<AndroidStudio> studios = <AndroidStudio>[];
bool _hasStudioAt(String path, { Version? newerThan }) {
bool hasStudioAt(String path, { Version? newerThan }) {
return studios.any((AndroidStudio studio) {
if (studio.directory != path) {
return false;
@@ -363,7 +363,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
for (final Directory entity in entities) {
final AndroidStudio? studio = AndroidStudio.fromHomeDot(entity);
if (studio != null && !_hasStudioAt(studio.directory, newerThan: studio.version)) {
if (studio != null && !hasStudioAt(studio.directory, newerThan: studio.version)) {
studios.removeWhere((AndroidStudio other) => other.directory == studio.directory);
studios.add(studio);
}
@@ -394,7 +394,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
version: Version.parse(version),
studioAppName: title,
);
if (studio != null && !_hasStudioAt(studio.directory, newerThan: studio.version)) {
if (studio != null && !hasStudioAt(studio.directory, newerThan: studio.version)) {
studios.removeWhere((AndroidStudio other) => other.directory == studio.directory);
studios.add(studio);
}
@@ -405,21 +405,21 @@ class AndroidStudio implements Comparable<AndroidStudio> {
}
final String? configuredStudioDir = globals.config.getValue('android-studio-dir') as String?;
if (configuredStudioDir != null && !_hasStudioAt(configuredStudioDir)) {
if (configuredStudioDir != null && !hasStudioAt(configuredStudioDir)) {
studios.add(AndroidStudio(configuredStudioDir,
configured: configuredStudioDir));
}
if (globals.platform.isLinux) {
void _checkWellKnownPath(String path) {
if (globals.fs.isDirectorySync(path) && !_hasStudioAt(path)) {
void checkWellKnownPath(String path) {
if (globals.fs.isDirectorySync(path) && !hasStudioAt(path)) {
studios.add(AndroidStudio(path));
}
}
// Add /opt/android-studio and $HOME/android-studio, if they exist.
_checkWellKnownPath('/opt/android-studio');
_checkWellKnownPath('${globals.fsUtils.homeDirPath}/android-studio');
checkWellKnownPath('/opt/android-studio');
checkWellKnownPath('${globals.fsUtils.homeDirPath}/android-studio');
}
return studios;
}

View File

@@ -366,7 +366,7 @@ class AndroidLicenseValidator extends DoctorValidator {
Future<LicensesAccepted> get licensesAccepted async {
LicensesAccepted? status;
void _handleLine(String line) {
void handleLine(String line) {
if (licenseCounts.hasMatch(line)) {
final Match? match = licenseCounts.firstMatch(line);
if (match?.group(1) != match?.group(2)) {
@@ -399,12 +399,12 @@ class AndroidLicenseValidator extends DoctorValidator {
final Future<void> output = process.stdout
.transform<String>(const Utf8Decoder(reportErrors: false))
.transform<String>(const LineSplitter())
.listen(_handleLine)
.listen(handleLine)
.asFuture<void>(null);
final Future<void> errors = process.stderr
.transform<String>(const Utf8Decoder(reportErrors: false))
.transform<String>(const LineSplitter())
.listen(_handleLine)
.listen(handleLine)
.asFuture<void>(null);
await Future.wait<void>(<Future<void>>[output, errors]);
return status ?? LicensesAccepted.unknown;

View File

@@ -46,21 +46,21 @@ Future<void> validateBitcode(BuildMode buildMode, TargetPlatform targetPlatform,
Version _parseVersionFromClang(String? clangVersion) {
final RegExp pattern = RegExp(r'Apple (LLVM|clang) version (\d+\.\d+\.\d+) ');
Never _invalid() {
Never invalid() {
throwToolExit('Unable to parse Clang version from "$clangVersion". '
'Expected a string like "Apple (LLVM|clang) #.#.# (clang-####.#.##.#)".');
}
if (clangVersion == null || clangVersion.isEmpty) {
_invalid();
invalid();
}
final RegExpMatch? match = pattern.firstMatch(clangVersion);
if (match == null || match.groupCount != 2) {
_invalid();
invalid();
}
final Version? version = Version.parse(match.group(2));
if (version == null) {
_invalid();
invalid();
}
return version;
}

View File

@@ -301,7 +301,7 @@ class XcodeProjectInterpreter {
const int missingProjectExitCode = 66;
// The exit code returned by 'xcodebuild -list' when the project is corrupted.
const int corruptedProjectExitCode = 74;
bool _allowedFailures(int c) => c == missingProjectExitCode || c == corruptedProjectExitCode;
bool allowedFailures(int c) => c == missingProjectExitCode || c == corruptedProjectExitCode;
final RunResult result = await _processUtils.run(
<String>[
...xcrunCommand(),
@@ -310,10 +310,10 @@ class XcodeProjectInterpreter {
if (projectFilename != null) ...<String>['-project', projectFilename],
],
throwOnError: true,
allowedFailures: _allowedFailures,
allowedFailures: allowedFailures,
workingDirectory: projectPath,
);
if (_allowedFailures(result.exitCode)) {
if (allowedFailures(result.exitCode)) {
// User configuration error, tool exit instead of crashing.
throwToolExit('Unable to get Xcode project information:\n ${result.stderr}');
}

View File

@@ -254,7 +254,7 @@ class WebAssetServer implements AssetReader {
// Return a version string for all active modules. This is populated
// along with the `moduleProvider` update logic.
Future<Map<String, String>> _digestProvider() async => digests;
Future<Map<String, String>> digestProvider() async => digests;
// Ensure dwds is present and provide middleware to avoid trying to
// load the through the isolate APIs.
@@ -295,7 +295,7 @@ class WebAssetServer implements AssetReader {
loadStrategy: FrontendServerRequireStrategyProvider(
ReloadConfiguration.none,
server,
_digestProvider,
digestProvider,
).strategy,
expressionCompiler: expressionCompiler,
spawnDds: enableDds,

View File

@@ -358,7 +358,7 @@ class Message {
if (attributes == null) {
void _throwEmptyAttributes(final RegExp regExp, final String type) {
void throwEmptyAttributes(final RegExp regExp, final String type) {
final RegExpMatch? match = regExp.firstMatch(_value(bundle, resourceId));
final bool isMatch = match != null && match.groupCount == 1;
if (isMatch) {
@@ -369,8 +369,8 @@ class Message {
}
}
_throwEmptyAttributes(_pluralRE, 'plural');
_throwEmptyAttributes(_selectRE, 'select');
throwEmptyAttributes(_pluralRE, 'plural');
throwEmptyAttributes(_selectRE, 'select');
}
return attributes as Map<String, Object?>?;