Skip to content

Commit 26cbe65

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer: Correct 40 comment references
There are fewer than 140 `comment_references` violations after this change. Change-Id: I1d19db7e293b43400a6e076945d84f509862f873 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392501 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent 471c225 commit 26cbe65

File tree

8 files changed

+61
-73
lines changed

8 files changed

+61
-73
lines changed

pkg/analyzer/lib/src/dart/ast/ast.dart

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3222,8 +3222,6 @@ final class CommentImpl extends AstNodeImpl
32223222
///
32233223
/// The list of [tokens] must contain at least one token.
32243224
///
3225-
/// The [type] is the type of the comment.
3226-
///
32273225
/// The list of [references] can be empty if the comment doesn't contain any
32283226
/// embedded references.
32293227
CommentImpl({
@@ -4078,7 +4076,7 @@ abstract final class ConstructorDeclaration
40784076
@override
40794077
ConstructorFragment? get declaredFragment;
40804078

4081-
/// The token for the `external` keyword to the given [token].
4079+
/// The token for the `external` keyword to this constructor declaration.
40824080
Token? get externalKeyword;
40834081

40844082
/// The token for the `factory` keyword, or `null` if the constructor isn't a
@@ -4774,7 +4772,7 @@ sealed class DartPatternImpl extends AstNodeImpl
47744772

47754773
DartType computePatternSchema(ResolverVisitor resolverVisitor);
47764774

4777-
/// Dispatches this pattern to the [resolver], with the given [context]
4775+
/// Dispatches this pattern to the [resolverVisitor], with the given [context]
47784776
/// information.
47794777
///
47804778
/// Note: most code shouldn't call this method directly, but should instead
@@ -7144,8 +7142,6 @@ sealed class ForEachPartsImpl extends ForLoopPartsImpl implements ForEachParts {
71447142

71457143
/// Initializes a newly created for-each statement whose loop control variable
71467144
/// is declared internally (in the for-loop part).
7147-
///
7148-
/// The [awaitKeyword] can be `null` if this isn't an asynchronous for loop.
71497145
ForEachPartsImpl({
71507146
required this.inKeyword,
71517147
required ExpressionImpl iterable,
@@ -7768,8 +7764,6 @@ sealed class ForPartsImpl extends ForLoopPartsImpl implements ForParts {
77687764

77697765
/// Initializes a newly created for statement.
77707766
///
7771-
/// Either the [variableList] or the [initialization] must be `null`.
7772-
///
77737767
/// Either the [condition] and the list of [updaters] can be `null` if the
77747768
/// loop doesn't have the corresponding attribute.
77757769
ForPartsImpl({
@@ -10710,10 +10704,12 @@ abstract final class InvocationExpression implements Expression {
1071010704
///
1071110705
/// For example:
1071210706
///
10713-
/// (o.m)<TArgs>(args); // target is `o.m`
10714-
/// o.m<TArgs>(args); // target is `m`
10707+
/// ```dart
10708+
/// (o.m)<TArgs>(args); // target is `o.m`
10709+
/// o.m<TArgs>(args); // target is `m`
10710+
/// ```
1071510711
///
10716-
/// In either case, the [function.staticType] is the [staticInvokeType] before
10712+
/// In either case, the `function.staticType` is the [staticInvokeType] before
1071710713
/// applying type arguments `TArgs`.
1071810714
Expression get function;
1071910715

@@ -15678,11 +15674,10 @@ final class SetOrMapLiteralImpl extends TypedLiteralImpl
1567815674
/// whether the kind hasn't or can't be determined.
1567915675
_SetOrMapKind _resolvedKind = _SetOrMapKind.unresolved;
1568015676

15681-
/// The context type computed by
15682-
/// [ResolverVisitor._computeSetOrMapContextType].
15677+
/// The context type computed by [TypedLiteralResolver].
1568315678
///
1568415679
/// Note that this isn't the same as the context pushed down by type
15685-
/// inference (which can be obtained via [InferenceContext.getContext]). For
15680+
/// inference (which can be obtained via `InferenceContext.getContext`). For
1568615681
/// example, in the following code:
1568715682
///
1568815683
/// var m = {};
@@ -16828,9 +16823,6 @@ final class SuperFormalParameterImpl extends NormalFormalParameterImpl
1682816823
///
1682916824
/// The [type] must be `null` if the keyword is `var`.
1683016825
///
16831-
/// The [thisKeyword] and [period] can be `null` if the keyword `this` isn't
16832-
/// provided.
16833-
///
1683416826
/// The[parameters] can be `null` if this isn't a function-typed field formal
1683516827
/// parameter.
1683616828
SuperFormalParameterImpl({
@@ -18304,7 +18296,7 @@ sealed class UriBasedDirectiveImpl extends DirectiveImpl
1830418296
}
1830518297
}
1830618298

18307-
/// Validation codes returned by [UriBasedDirective.validate].
18299+
/// Validation codes returned by [UriBasedDirectiveImpl.validateUri].
1830818300
class UriValidationCode {
1830918301
static const UriValidationCode INVALID_URI = UriValidationCode('INVALID_URI');
1831018302

@@ -18717,7 +18709,7 @@ sealed class VariablePatternImpl extends DartPatternImpl
1871718709
/// switchCase ::=
1871818710
/// 'when' [Expression]
1871918711
abstract final class WhenClause implements AstNode {
18720-
/// The condition that is evaluated when the [pattern] matches, that must
18712+
/// The condition that is evaluated when the pattern matches, that must
1872118713
/// evaluate to `true` in order for the [expression] to be executed.
1872218714
Expression get expression;
1872318715

pkg/analyzer/lib/src/dart/constant/evaluation.dart

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ class ConstantEvaluationEngine {
331331
}
332332
}
333333

334-
/// Evaluate the constructor call and format any [InvalidConstants] if found.
334+
/// Evaluates the constructor call and format any [InvalidConstant]s if found.
335335
Constant evaluateAndFormatErrorsInConstructorCall(
336336
LibraryElementImpl library,
337337
AstNode node,
@@ -545,12 +545,11 @@ class ConstantVisitor extends UnifyingAstVisitor<Constant> {
545545
/// Helper class used to compute constant values.
546546
late final DartObjectComputer _dartObjectComputer;
547547

548-
/// Initialize a newly created constant visitor. The [evaluationEngine] is
548+
/// Initializes a newly created constant visitor. The [_evaluationEngine] is
549549
/// used to evaluate instance creation expressions. The [lexicalEnvironment]
550550
/// is a map containing values which should override identifiers, or `null` if
551551
/// no overriding is necessary. The [_errorReporter] is used to report errors
552-
/// found during evaluation. The [validator] is used by unit tests to verify
553-
/// correct dependency analysis.
552+
/// found during evaluation.
554553
///
555554
/// The [substitution] is specified for instance creations.
556555
ConstantVisitor(
@@ -569,11 +568,10 @@ class ConstantVisitor extends UnifyingAstVisitor<Constant> {
569568
);
570569
}
571570

572-
/// Convenience getter to gain access to the [evaluationEngine]'s type system.
571+
/// Convenience getter to access the [_evaluationEngine]'s type system.
573572
TypeSystemImpl get typeSystem => _library.typeSystem;
574573

575-
/// Convenience getter to gain access to the [evaluationEngine]'s type
576-
/// provider.
574+
/// Convenience getter to access the [_evaluationEngine]'s type provider.
577575
TypeProvider get _typeProvider => _library.typeProvider;
578576

579577
/// Evaluates and reports an error if the evaluation result of [node] is an
@@ -2417,9 +2415,9 @@ class _InstanceCreationEvaluator {
24172415
/// An error reporter for errors determined while computing values for field
24182416
/// initializers, or default values for the constructor parameters.
24192417
///
2420-
/// Such errors cannot be reported into [_errorReporter], because they usually
2421-
/// happen in a different source. But they still should cause a constant
2422-
/// evaluation error for the current node.
2418+
/// Such errors cannot be reported into [ConstantVisitor._errorReporter],
2419+
/// because they usually happen in a different source. But they still should
2420+
/// cause a constant evaluation error for the current node.
24232421
late final ErrorReporter _externalErrorReporter = ErrorReporter(
24242422
_externalErrorListener,
24252423
_constructor.source,
@@ -2650,14 +2648,12 @@ class _InstanceCreationEvaluator {
26502648
return null;
26512649
}
26522650

2653-
/// Check that the arguments to a call to `fromEnvironment()` are correct.
2651+
/// Checks that the arguments to a call to `fromEnvironment()` are correct.
26542652
///
2655-
/// The [arguments] are the AST nodes of the arguments. The [argumentValues]
2656-
/// are the values of the unnamed arguments. The [namedArgumentValues] are the
2657-
/// values of the named arguments. The [expectedDefaultValueType] is the
2658-
/// allowed type of the "defaultValue" parameter (if present). Note:
2659-
/// "defaultValue" is always allowed to be `null`. Return `true` if the
2660-
/// arguments are correct, `false` otherwise.
2653+
/// The [arguments] are the AST nodes of the arguments. The
2654+
/// [expectedDefaultValueType] is the allowed type of the "defaultValue"
2655+
/// parameter (if present). Note: "defaultValue" is always allowed to be
2656+
/// `null`. Returns `true` if the arguments are correct, `false` otherwise.
26612657
bool _checkFromEnvironmentArguments(
26622658
List<Expression> arguments,
26632659
InterfaceType expectedDefaultValueType,
@@ -3013,10 +3009,8 @@ class _InstanceCreationEvaluator {
30133009

30143010
/// Checks that the arguments to a call to [Symbol.new] are correct.
30153011
///
3016-
/// The [arguments] are the AST nodes of the arguments. The [argumentValues]
3017-
/// are the values of the unnamed arguments. The [namedArgumentValues] are the
3018-
/// values of the named arguments. Returns `true` if the arguments are
3019-
/// correct, `false` otherwise.
3012+
/// The [arguments] are the AST nodes of the arguments. Returns `true` if the
3013+
/// arguments are correct, `false` otherwise.
30203014
bool _checkSymbolArguments(List<Expression> arguments) {
30213015
if (arguments.length != 1) {
30223016
return false;

pkg/analyzer/lib/src/dart/constant/value.dart

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
/// The implementation of the class [DartObject].
6+
///
7+
/// @docImport 'package:analyzer/src/dart/constant/evaluation.dart';
68
library;
79

810
import 'dart:collection';
@@ -627,8 +629,8 @@ class DartObjectImpl implements DartObject, Constant {
627629
);
628630
}
629631

630-
/// Return the result of invoking the '&&' operator on this object with the
631-
/// [rightOperand].
632+
/// Returns the result of invoking the '&&' operator on this object with the
633+
/// [rightOperandComputer].
632634
///
633635
/// Throws an [EvaluationException] if the operator is not appropriate for an
634636
/// object of this kind.
@@ -641,8 +643,8 @@ class DartObjectImpl implements DartObject, Constant {
641643
);
642644
}
643645

644-
/// Return the result of invoking the '||' operator on this object with the
645-
/// [rightOperand].
646+
/// Returns the result of invoking the '||' operator on this object with the
647+
/// [rightOperandComputer].
646648
///
647649
/// Throws an [EvaluationException] if the operator is not appropriate for an
648650
/// object of this kind.
@@ -1754,8 +1756,8 @@ abstract class InstanceState {
17541756
/// the [rightOperand].
17551757
BoolState isIdentical(TypeSystemImpl typeSystem, InstanceState rightOperand);
17561758

1757-
/// Return the result of invoking the '&&' operator on this object with the
1758-
/// [rightOperand].
1759+
/// Returns the result of invoking the '&&' operator on this object with the
1760+
/// [rightOperandComputer].
17591761
///
17601762
/// Throws an [EvaluationException] if the operator is not appropriate for an
17611763
/// object of this kind.
@@ -1769,8 +1771,8 @@ abstract class InstanceState {
17691771
return rightOperand!.convertToBool();
17701772
}
17711773

1772-
/// Return the result of invoking the '||' operator on this object with the
1773-
/// [rightOperand].
1774+
/// Returns the result of invoking the '||' operator on this object with the
1775+
/// [rightOperandComputer].
17741776
///
17751777
/// Throws an [EvaluationException] if the operator is not appropriate for an
17761778
/// object of this kind.

pkg/analyzer/lib/src/dart/element/element.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,7 +3638,7 @@ class ExtensionElementImpl extends InstanceElementImpl
36383638
late MaybeAugmentedExtensionElementMixin augmentedInternal;
36393639

36403640
/// Initialize a newly created extension element to have the given [name] at
3641-
/// the given [offset] in the file that contains the declaration of this
3641+
/// the given [nameOffset] in the file that contains the declaration of this
36423642
/// element.
36433643
ExtensionElementImpl(super.name, super.nameOffset);
36443644

@@ -5675,7 +5675,7 @@ class LabelElementImpl extends ElementImpl implements LabelElement {
56755675
final bool _onSwitchMember;
56765676

56775677
/// Initialize a newly created label element to have the given [name].
5678-
/// [onSwitchMember] should be `true` if this label is associated with a
5678+
/// [_onSwitchMember] should be `true` if this label is associated with a
56795679
/// `switch` member.
56805680
LabelElementImpl(String super.name, super.nameOffset, this._onSwitchMember);
56815681

@@ -9940,8 +9940,8 @@ class TypeAliasElementImpl extends _ExistingElementImpl
99409940
LibraryFragment? get enclosingFragment =>
99419941
enclosingElement3 as LibraryFragment;
99429942

9943-
/// Returns whether this alias is a "proper rename" of [aliasedClass], as
9944-
/// defined in the constructor-tearoffs specification.
9943+
/// Whether this alias is a "proper rename" of [aliasedType], as defined in
9944+
/// the constructor-tearoffs specification.
99459945
bool get isProperRename {
99469946
var aliasedType_ = aliasedType;
99479947
if (aliasedType_ is! InterfaceType) {
@@ -10212,7 +10212,7 @@ class TypeParameterElementImpl extends ElementImpl
1021210212
TypeParameterElementImpl(String super.name, super.offset);
1021310213

1021410214
/// Initialize a newly created synthetic type parameter element to have the
10215-
/// given [name], and with [synthetic] set to true.
10215+
/// given [name], and with [isSynthetic] set to `true`.
1021610216
TypeParameterElementImpl.synthetic(String name) : super(name, -1) {
1021710217
isSynthetic = true;
1021810218
}
@@ -10325,7 +10325,7 @@ class TypeParameterElementImpl extends ElementImpl
1032510325
builder.writeTypeParameter(this);
1032610326
}
1032710327

10328-
/// Computes the variance of the [typeParameter] in the [type].
10328+
/// Computes the variance of the type parameters in the [type].
1032910329
shared.Variance computeVarianceInType(DartType type) {
1033010330
if (type is TypeParameterType) {
1033110331
if (type.element == this) {

pkg/analyzer/lib/src/dart/element/generic_inferrer.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ import 'package:collection/collection.dart';
3636

3737
/// Tracks upper and lower type bounds for a set of type parameters.
3838
///
39-
/// This class is used by calling [isSubtypeOf]. When it encounters one of
40-
/// the type parameters it is inferring, it will record the constraint, and
41-
/// optimistically assume the constraint will be satisfied.
39+
/// When the methods of this class encounter one of the type parameters it is
40+
/// inferring, it will record the constraint, and optimistically assume the
41+
/// constraint will be satisfied.
4242
///
4343
/// For example if we are inferring type parameter A, and we ask if
4444
/// `A <: num`, this will record that A must be a subtype of `num`. It also
@@ -47,7 +47,7 @@ import 'package:collection/collection.dart';
4747
/// (due to covariant generic types) as would `() -> A <: () -> num`. In
4848
/// contrast `(A) -> void <: (num) -> void`.
4949
///
50-
/// Once the lower/upper bounds are determined, [infer] should be called to
50+
/// Once the lower/upper bounds are determined, `infer` should be called to
5151
/// finish the inference. It will instantiate a generic function type with the
5252
/// inferred types for each type parameter.
5353
///
@@ -154,8 +154,8 @@ class GenericInferrer {
154154
return types;
155155
}
156156

157-
/// Apply an argument constraint, which asserts that the [argument] staticType
158-
/// is a subtype of the [parameterType].
157+
/// Apply an argument constraint, which asserts that the [argumentType] static
158+
/// type is a subtype of the [parameterType].
159159
void constrainArgument(
160160
DartType argumentType, DartType parameterType, String parameterName,
161161
{InterfaceElement? genericClass, required AstNode? nodeForTesting}) {
@@ -386,7 +386,7 @@ class GenericInferrer {
386386
return result;
387387
}
388388

389-
/// Check that inferred [typeArguments] satisfy the [typeParameters] bounds.
389+
/// Check that inferred [typeArguments] satisfy the [_typeParameters] bounds.
390390
void _checkArgumentsNotMatchingBounds({
391391
required SyntacticEntity? errorEntity,
392392
required ErrorReporter? errorReporter,
@@ -490,7 +490,7 @@ class GenericInferrer {
490490
}
491491
}
492492

493-
/// Computes (or recomputes) a set of [inferredTypes] based on the constraints
493+
/// Computes (or recomputes) a set of inferred types based on the constraints
494494
/// that have been recorded so far.
495495
List<DartType> _chooseTypes({required bool preliminary}) {
496496
var inferredTypes = List<DartType>.filled(
@@ -873,11 +873,11 @@ class GenericInferrer {
873873
}
874874
}
875875

876-
/// Tries to make [i1] a subtype of [i2] and accumulate constraints as needed.
876+
/// Tries to make [t1] a subtype of [t2] and accumulate constraints as needed.
877877
///
878878
/// The return value indicates whether the match was successful. If it was
879879
/// unsuccessful, any constraints that were accumulated during the match
880-
/// attempt have been rewound (see [_rewindConstraints]).
880+
/// attempt have been rewound.
881881
bool _tryMatchSubtypeOf(
882882
DartType t1,
883883
DartType t2,

pkg/analyzer/lib/src/dart/element/least_upper_bound.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,11 @@ class InterfaceLeastUpperBoundHelper {
196196
return NullabilitySuffix.none;
197197
}
198198

199-
/// Return the length of the longest inheritance path from a subtype of the
200-
/// given [element] to Object, where the given [depth] is the length of the
201-
/// longest path from the subtype to this type. The set of [visitedElements]
202-
/// is used to prevent infinite recursion in the case of a cyclic type
203-
/// structure.
199+
/// Returns the length of the longest inheritance path from a subtype of the
200+
/// given [type] to `Object`.
201+
///
202+
/// The set of [visitedElements] is used to prevent infinite recursion in the
203+
/// case of a cyclic type structure.
204204
static int _computeLongestInheritancePathToObject(
205205
InterfaceType type, Set<InterfaceElement> visitedElements) {
206206
var element = type.element;

pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import 'package:analyzer/src/dart/element/type_schema.dart';
2020
import 'package:analyzer/src/dart/element/type_system.dart';
2121
import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
2222

23-
/// Creates sets of [TypeConstraint]s for type parameters, based on an attempt
24-
/// to make one type schema a subtype of another.
23+
/// Creates sets of [GeneratedTypeConstraint]s for type parameters, based on an
24+
/// attempt to make one type schema a subtype of another.
2525
class TypeConstraintGatherer extends shared.TypeConstraintGenerator<
2626
DartType,
2727
ParameterElement,

pkg/analyzer/lib/src/dart/micro/utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ ConstructorElement? _getActualConstructorElement(
6262
return constructor;
6363
}
6464

65-
/// Return the [LibraryImportElement] that declared [prefix] and imports [element].
65+
/// Returns the [LibraryImportElement] that declared [prefix] and imports [element].
6666
///
67-
/// [libraryElement] - the [LibraryElement] where reference is.
67+
/// [libraryFragment] - the [CompilationUnitElementImpl] where reference is.
6868
/// [prefix] - the import prefix, maybe `null`.
6969
/// [element] - the referenced element.
7070
/// [importElementsMap] - the cache of [Element]s imported by [LibraryImportElement]s.

0 commit comments

Comments
 (0)