69a1a497f1
This is one of several planned batches of changes to transition the front end (and related packages) away from the old `withArgumentsOld` diagnostic reporting method, and to the new `withArguments` method. The difference between the two is that `withArguments` has named parameters rather than positional ones, so (a) it's less likely for parameters to be mixed up, and (b) it's compatible with the calling conventions used by analyzer diagnostics. As part of this transition, I'm taking the opportunity to rename the parameters themselves (since the names previously were restricted to a very small set of possibilities based on type), and to document them in `messages.yaml`. To avoid fatigue (both for myself and code reviewers), I've chosen to break the change into many smaller batches. The only changes in this CL that were manually written are those in `messages.yaml`. The others were produced by running the standard diagnostic message code generator, running the script `use_new_with_arguments.dart`, and then updating front end parser expectations. Change-Id: I6a6a6964699f00e7e91af2e682ce1baa1846ca13 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/478060 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
41 lines
1.5 KiB
Plaintext
41 lines
1.5 KiB
Plaintext
Problems reported:
|
|
|
|
parser/patterns/wildcard_inPatternAssignment_usingFinal:2:13: Variable '_' can't be declared in a pattern assignment.
|
|
[a, final _] = y;
|
|
^
|
|
|
|
beginCompilationUnit(void)
|
|
beginMetadataStar(void)
|
|
endMetadataStar(0)
|
|
beginTopLevelMember(void)
|
|
beginTopLevelMethod(, null, null)
|
|
handleVoidKeyword(void)
|
|
handleIdentifier(f, topLevelFunctionDeclaration)
|
|
handleNoTypeVariables(()
|
|
beginFormalParameters((, MemberKind.TopLevelMethod)
|
|
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
|
|
handleAsyncModifier(null, null)
|
|
beginBlockFunctionBody({)
|
|
beginPattern({)
|
|
handleNoTypeArguments([)
|
|
beginPattern([)
|
|
handleAssignedVariablePattern(a)
|
|
endPattern(a)
|
|
beginPattern(,)
|
|
handleNoType(final)
|
|
handleRecoverableError(Message[Template(PatternAssignmentDeclaresVariable), Variable '_' can't be declared in a pattern assignment., Try using a preexisting variable or changing the assignment to a pattern variable declaration., {variableName: _}], _, _)
|
|
handleWildcardPattern(final, _)
|
|
endPattern(_)
|
|
handleListPattern(2, [, ])
|
|
endPattern(])
|
|
handleIdentifier(y, expression)
|
|
handleNoTypeArguments(;)
|
|
handleNoArguments(;)
|
|
handleSend(y, y)
|
|
handlePatternAssignment(=)
|
|
handleExpressionStatement([, ;)
|
|
endBlockFunctionBody(1, {, })
|
|
endTopLevelMethod(void, null, })
|
|
endTopLevelDeclaration(})
|
|
endCompilationUnit(1, )
|