analysis_server: add missing returns to nullably-typed functions

Bug: https://github.com/dart-lang/sdk/issues/46656
Change-Id: I9ea7d4949f8384433dfd8a6cca79e957a4f6e05c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222327
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Sam Rawlins 2021-12-08 06:38:50 +00:00 committed by Commit Bot
parent 4ebab64bef
commit 285eea9338
8 changed files with 19 additions and 0 deletions

View file

@ -500,6 +500,7 @@ abstract class AbstractAnalysisServer {
} catch (e, st) {
instrumentationService.logException(e, st);
}
return null;
}
/// Sends an error notification to the user.

View file

@ -173,6 +173,8 @@ class ColorComputer {
return alpha != null && red != null && green != null && blue != null
? _colorValueForComponents(alpha, red, green, blue)
: null;
} else {
return null;
}
}
@ -187,6 +189,8 @@ class ColorComputer {
if (name == null && args.isNotEmpty) {
final arg0 = args[0];
return arg0 is IntegerLiteral ? arg0.value : null;
} else {
return null;
}
}
@ -208,6 +212,8 @@ class ColorComputer {
return _getSwatchValue(target, shadeNumber);
}
}
return null;
}
/// Extracts a specific shade index from a Flutter SwatchColor.

View file

@ -126,6 +126,8 @@ class ConvertToFieldParameter extends CorrectionProducer {
}
}
}
return null;
}
}

View file

@ -344,6 +344,8 @@ class ImportLibrary extends MultiCorrectionProducer {
return parent.declaredElement?.thisType;
} else if (parent is ExtensionDeclaration) {
return parent.extendedType.type;
} else {
return null;
}
}
@ -361,6 +363,8 @@ class ImportLibrary extends MultiCorrectionProducer {
}
parent = parent.parent;
}
return null;
}
/// Return an instance of this class that will add an import of `dart:async`.

View file

@ -77,6 +77,7 @@ class UpdateSdkConstraints extends CorrectionProducer {
return pubspecFile;
}
}
return null;
}
/// Return an instance of this class that will update the SDK constraints to

View file

@ -62,6 +62,8 @@ class WrapInText extends CorrectionProducer {
}
}
}
return null;
}
}

View file

@ -322,6 +322,8 @@ class PubPackageService {
final json = jsonDecode(contents);
if (json is Map<String, Object?>) {
return PackageDetailsCache.fromJson(json);
} else {
return null;
}
} catch (e) {
_instrumentationService.logError('Error reading pub cache file: $e');

View file

@ -71,6 +71,7 @@ extension AstNodeExtensions on AstNode {
return null;
}
}
return null;
}
/// Return this node and all its parents.