Deprecate 'ParameterElement.isNotOptional', use 'isRequired' instead.
Change-Id: I1782f6d9803cf7829489904fe2833b2724f8be6e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241512 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
committed by
Commit Bot
parent
4e6bb1722c
commit
aee65337ec
@@ -64,7 +64,7 @@ class ClassDescriptionRegistry {
|
||||
if (constructor == null) return null;
|
||||
|
||||
for (var parameter in constructor.parameters) {
|
||||
if (parameter.isNotOptional || parameter.hasRequired) {
|
||||
if (parameter.isRequired || parameter.hasRequired) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
## 4.1.0-dev
|
||||
* Deprecated `ParameterElement.isNotOptional`, use `isRequired` instead.
|
||||
|
||||
## 4.0.0
|
||||
* Removed deprecated `UriKind` and `Source.uriKind`.
|
||||
* Removed deprecated `LibraryElement.hasExtUri`.
|
||||
|
||||
@@ -1528,7 +1528,7 @@ abstract class ParameterElement
|
||||
/// meaning of this getter. The parameter `{@required int x}` will return
|
||||
/// `false` and the parameter `{@required required int x}` will return
|
||||
/// `true`
|
||||
// TODO(brianwilkerson) Rename this to `isRequired`.
|
||||
@Deprecated('Use isRequired instead')
|
||||
bool get isNotOptional;
|
||||
|
||||
/// Return `true` if this parameter is an optional parameter. Optional
|
||||
@@ -1552,6 +1552,15 @@ abstract class ParameterElement
|
||||
/// parameters can either be required or optional.
|
||||
bool get isPositional;
|
||||
|
||||
/// Return `true` if this parameter is either a required positional
|
||||
/// parameter, or a named parameter with the `required` keyword.
|
||||
///
|
||||
/// Note: the presence or absence of the `@required` annotation does not
|
||||
/// change the meaning of this getter. The parameter `{@required int x}`
|
||||
/// will return `false` and the parameter `{@required required int x}`
|
||||
/// will return `true`.
|
||||
bool get isRequired;
|
||||
|
||||
/// Return `true` if this parameter is both a required and named parameter.
|
||||
/// Named parameters that are annotated with the `@required` annotation are
|
||||
/// considered optional. Named parameters that are annotated with the
|
||||
|
||||
@@ -1453,7 +1453,7 @@ mixin ConstructorElementMixin implements ConstructorElement {
|
||||
}
|
||||
// no required parameters
|
||||
for (ParameterElement parameter in parameters) {
|
||||
if (parameter.isNotOptional) {
|
||||
if (parameter.isRequired) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -4880,6 +4880,7 @@ mixin ParameterElementMixin implements ParameterElement {
|
||||
@override
|
||||
bool get isNamed => parameterKind.isNamed;
|
||||
|
||||
@Deprecated('Use isRequired instead')
|
||||
@override
|
||||
bool get isNotOptional => parameterKind.isRequired;
|
||||
|
||||
@@ -4895,6 +4896,9 @@ mixin ParameterElementMixin implements ParameterElement {
|
||||
@override
|
||||
bool get isPositional => parameterKind.isPositional;
|
||||
|
||||
@override
|
||||
bool get isRequired => parameterKind.isRequired;
|
||||
|
||||
@override
|
||||
bool get isRequiredNamed => parameterKind.isRequiredNamed;
|
||||
|
||||
|
||||
@@ -802,14 +802,14 @@ class LeastUpperBoundHelper {
|
||||
|
||||
while (fIndex < fParameters.length) {
|
||||
var fParameter = fParameters[fIndex++];
|
||||
if (fParameter.isNotOptional) {
|
||||
if (fParameter.isRequired) {
|
||||
return _interfaceTypeFunctionNone;
|
||||
}
|
||||
}
|
||||
|
||||
while (gIndex < gParameters.length) {
|
||||
var gParameter = gParameters[gIndex++];
|
||||
if (gParameter.isNotOptional) {
|
||||
if (gParameter.isRequired) {
|
||||
return _interfaceTypeFunctionNone;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ class SubtypeHelper {
|
||||
// The supertype must provide all required parameters to the subtype.
|
||||
while (fIndex < fParameters.length) {
|
||||
var fParameter = fParameters[fIndex++];
|
||||
if (fParameter.isNotOptional) {
|
||||
if (fParameter.isRequired) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,7 +506,7 @@ class TypeConstraintGatherer {
|
||||
// The supertype must provide all required parameters to the subtype.
|
||||
while (fIndex < fParameters.length) {
|
||||
var fParameter = fParameters[fIndex++];
|
||||
if (fParameter.isNotOptional) {
|
||||
if (fParameter.isRequired) {
|
||||
_constraints.length = rewind;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: analyzer
|
||||
version: 4.0.0
|
||||
version: 4.1.0-dev
|
||||
description: This package provides a library that performs static analysis of Dart code.
|
||||
homepage: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user