mirror of
https://github.com/dart-lang/sdk
synced 2024-10-07 09:01:03 +00:00
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:
parent
4ebab64bef
commit
285eea9338
|
@ -500,6 +500,7 @@ abstract class AbstractAnalysisServer {
|
|||
} catch (e, st) {
|
||||
instrumentationService.logException(e, st);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Sends an error notification to the user.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -126,6 +126,8 @@ class ConvertToFieldParameter extends CorrectionProducer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -62,6 +62,8 @@ class WrapInText extends CorrectionProducer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -71,6 +71,7 @@ extension AstNodeExtensions on AstNode {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Return this node and all its parents.
|
||||
|
|
Loading…
Reference in a new issue