mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 22:21:18 +00:00
Remove two more deprecated_ methods from BodyBuilder
Change-Id: I89597436a45c937a735e0a511972237a1cfc2378 Reviewed-on: https://dart-review.googlesource.com/67201 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
01e69cc0c4
commit
56bd1fc6f7
|
@ -340,56 +340,6 @@ class StrongModeStaticTypeAnalyzer2Test_Kernel
|
|||
return super.test_notInstantiatedBound_class_error_recursion_typedef();
|
||||
}
|
||||
|
||||
@override
|
||||
@failingTest
|
||||
test_notInstantiatedBound_error_class_argument() {
|
||||
return super.test_notInstantiatedBound_error_class_argument();
|
||||
}
|
||||
|
||||
@override
|
||||
@failingTest
|
||||
test_notInstantiatedBound_error_class_argument2() {
|
||||
return super.test_notInstantiatedBound_error_class_argument2();
|
||||
}
|
||||
|
||||
@override
|
||||
@failingTest
|
||||
test_notInstantiatedBound_error_class_direct() {
|
||||
// Expected 1 errors of type
|
||||
// StrongModeCode.STRONG_MODE_NOT_INSTANTIATED_BOUND, found 0
|
||||
return super.test_notInstantiatedBound_error_class_direct();
|
||||
}
|
||||
|
||||
@override
|
||||
@failingTest
|
||||
test_notInstantiatedBound_error_class_indirect() {
|
||||
return super.test_notInstantiatedBound_error_class_indirect();
|
||||
}
|
||||
|
||||
@override
|
||||
@failingTest
|
||||
test_notInstantiatedBound_error_functionType() {
|
||||
return super.test_notInstantiatedBound_error_functionType();
|
||||
}
|
||||
|
||||
@override
|
||||
@failingTest
|
||||
test_notInstantiatedBound_error_typedef_argument() {
|
||||
return super.test_notInstantiatedBound_error_typedef_argument();
|
||||
}
|
||||
|
||||
@override
|
||||
@failingTest
|
||||
test_notInstantiatedBound_error_typedef_argument2() {
|
||||
return super.test_notInstantiatedBound_error_typedef_argument2();
|
||||
}
|
||||
|
||||
@override
|
||||
@failingTest
|
||||
test_notInstantiatedBound_error_typedef_direct() {
|
||||
return super.test_notInstantiatedBound_error_typedef_direct();
|
||||
}
|
||||
|
||||
@override
|
||||
@failingTest
|
||||
test_setterWithDynamicTypeIsError() async {
|
||||
|
|
|
@ -339,7 +339,7 @@ const Code<Message Function(String name)>
|
|||
const Code<Message Function(String name)>(
|
||||
"BoundIssueViaRawTypeWithNonSimpleBounds",
|
||||
templateBoundIssueViaRawTypeWithNonSimpleBounds,
|
||||
analyzerCode: "SNOT_INSTANTIATED_BOUND",
|
||||
analyzerCode: "NOT_INSTANTIATED_BOUND",
|
||||
dart2jsCode: "*fatal*",
|
||||
severity: Severity.error);
|
||||
|
||||
|
@ -364,6 +364,26 @@ const MessageCode messageBreakOutsideOfLoop = const MessageCode(
|
|||
r"""A break statement can't be used outside of a loop or switch statement.""",
|
||||
tip: r"""Try removing the break statement.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(String name)>
|
||||
templateBreakTargetOutsideFunction =
|
||||
const Template<Message Function(String name)>(
|
||||
messageTemplate: r"""Can't break to '#name' in a different function.""",
|
||||
withArguments: _withArgumentsBreakTargetOutsideFunction);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Message Function(String name)> codeBreakTargetOutsideFunction =
|
||||
const Code<Message Function(String name)>(
|
||||
"BreakTargetOutsideFunction", templateBreakTargetOutsideFunction,
|
||||
analyzerCode: "LABEL_IN_OUTER_SCOPE", dart2jsCode: "*fatal*");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsBreakTargetOutsideFunction(String name) {
|
||||
return new Message(codeBreakTargetOutsideFunction,
|
||||
message: """Can't break to '${name}' in a different function.""",
|
||||
arguments: {'name': name});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(Token token)> templateBuiltInIdentifierAsType =
|
||||
const Template<Message Function(Token token)>(
|
||||
|
@ -454,6 +474,16 @@ const MessageCode messageCannotAssignToParenthesizedExpression =
|
|||
dart2jsCode: "*fatal*",
|
||||
message: r"""Can't assign to a parenthesized expression.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeCannotAssignToSuper = messageCannotAssignToSuper;
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const MessageCode messageCannotAssignToSuper = const MessageCode(
|
||||
"CannotAssignToSuper",
|
||||
analyzerCode: "NOT_AN_LVALUE",
|
||||
dart2jsCode: "*fatal*",
|
||||
message: r"""Can't assign to super.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(String string)> templateCannotReadPackagesFile =
|
||||
const Template<Message Function(String string)>(
|
||||
|
@ -1448,6 +1478,16 @@ Message _withArgumentsConstructorWithWrongNameContext(String name) {
|
|||
arguments: {'name': name});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeContinueLabelNotTarget = messageContinueLabelNotTarget;
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const MessageCode messageContinueLabelNotTarget = const MessageCode(
|
||||
"ContinueLabelNotTarget",
|
||||
analyzerCode: "LABEL_UNDEFINED",
|
||||
dart2jsCode: "*fatal*",
|
||||
message: r"""Target of continue must be a label.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeContinueOutsideOfLoop = messageContinueOutsideOfLoop;
|
||||
|
||||
|
@ -1460,6 +1500,27 @@ const MessageCode messageContinueOutsideOfLoop = const MessageCode(
|
|||
r"""A continue statement can't be used outside of a loop or switch statement.""",
|
||||
tip: r"""Try removing the continue statement.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(String name)>
|
||||
templateContinueTargetOutsideFunction =
|
||||
const Template<Message Function(String name)>(
|
||||
messageTemplate:
|
||||
r"""Can't continue at '#name' in a different function.""",
|
||||
withArguments: _withArgumentsContinueTargetOutsideFunction);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Message Function(String name)> codeContinueTargetOutsideFunction =
|
||||
const Code<Message Function(String name)>(
|
||||
"ContinueTargetOutsideFunction", templateContinueTargetOutsideFunction,
|
||||
analyzerCode: "LABEL_IN_OUTER_SCOPE", dart2jsCode: "*fatal*");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsContinueTargetOutsideFunction(String name) {
|
||||
return new Message(codeContinueTargetOutsideFunction,
|
||||
message: """Can't continue at '${name}' in a different function.""",
|
||||
arguments: {'name': name});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeContinueWithoutLabelInCase =
|
||||
messageContinueWithoutLabelInCase;
|
||||
|
@ -2191,6 +2252,17 @@ const MessageCode messageEnumInClass = const MessageCode("EnumInClass",
|
|||
message: r"""Enums can't be declared inside classes.""",
|
||||
tip: r"""Try moving the enum to the top-level.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeEnumInstantiation = messageEnumInstantiation;
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const MessageCode messageEnumInstantiation = const MessageCode(
|
||||
"EnumInstantiation",
|
||||
analyzerCode: "INSTANTIATE_ENUM",
|
||||
dart2jsCode: "*fatal*",
|
||||
severity: Severity.error,
|
||||
message: r"""Enums can't be instantiated.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeEqualityCannotBeEqualityOperand =
|
||||
messageEqualityCannotBeEqualityOperand;
|
||||
|
@ -2442,6 +2514,16 @@ Message _withArgumentsExpectedIdentifier(Token token) {
|
|||
arguments: {'token': token});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeExpectedNamedArgument = messageExpectedNamedArgument;
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const MessageCode messageExpectedNamedArgument = const MessageCode(
|
||||
"ExpectedNamedArgument",
|
||||
analyzerCode: "EXTRA_POSITIONAL_ARGUMENTS",
|
||||
dart2jsCode: "*fatal*",
|
||||
message: r"""Expected named argument.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeExpectedOneExpression = messageExpectedOneExpression;
|
||||
|
||||
|
@ -4034,6 +4116,24 @@ const MessageCode messageInvalidAwaitFor = const MessageCode("InvalidAwaitFor",
|
|||
r"""The keyword 'await' isn't allowed for a normal 'for' statement.""",
|
||||
tip: r"""Try removing the keyword, or use a for-each statement.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(String name)> templateInvalidBreakTarget =
|
||||
const Template<Message Function(String name)>(
|
||||
messageTemplate: r"""Can't break to '#name'.""",
|
||||
withArguments: _withArgumentsInvalidBreakTarget);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Message Function(String name)> codeInvalidBreakTarget =
|
||||
const Code<Message Function(String name)>(
|
||||
"InvalidBreakTarget", templateInvalidBreakTarget,
|
||||
dart2jsCode: "*fatal*");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsInvalidBreakTarget(String name) {
|
||||
return new Message(codeInvalidBreakTarget,
|
||||
message: """Can't break to '${name}'.""", arguments: {'name': name});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(
|
||||
|
@ -4323,6 +4423,24 @@ const MessageCode messageInvalidCodePoint = const MessageCode(
|
|||
message:
|
||||
r"""The escape sequence starting with '\u' isn't a valid code point.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(String name)> templateInvalidContinueTarget =
|
||||
const Template<Message Function(String name)>(
|
||||
messageTemplate: r"""Can't continue at '#name'.""",
|
||||
withArguments: _withArgumentsInvalidContinueTarget);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Message Function(String name)> codeInvalidContinueTarget =
|
||||
const Code<Message Function(String name)>(
|
||||
"InvalidContinueTarget", templateInvalidContinueTarget,
|
||||
dart2jsCode: "*fatal*");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsInvalidContinueTarget(String name) {
|
||||
return new Message(codeInvalidContinueTarget,
|
||||
message: """Can't continue at '${name}'.""", arguments: {'name': name});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeInvalidHexEscape = messageInvalidHexEscape;
|
||||
|
||||
|
@ -4630,6 +4748,15 @@ Message _withArgumentsMethodNotFound(String name) {
|
|||
message: """Method not found: '${name}'.""", arguments: {'name': name});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeMissingArgumentList = messageMissingArgumentList;
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const MessageCode messageMissingArgumentList = const MessageCode(
|
||||
"MissingArgumentList",
|
||||
severity: Severity.error,
|
||||
message: r"""Constructor invocations must have an argument list.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeMissingAssignableSelector =
|
||||
messageMissingAssignableSelector;
|
||||
|
|
|
@ -953,8 +953,8 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
// TODO(ahe): Change this to a null check.
|
||||
int offset = builder.body?.fileOffset ?? builder.charOffset;
|
||||
constructor.initializers.add(buildInvalidInitializer(
|
||||
deprecated_buildCompileTimeError(
|
||||
null, offset, fasta.messageConstructorNotSync),
|
||||
buildCompileTimeErrorExpression(
|
||||
fasta.messageConstructorNotSync, offset),
|
||||
offset));
|
||||
}
|
||||
if (needsImplicitSuperInitializer) {
|
||||
|
@ -1016,8 +1016,9 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
if (i > firstNamedArgumentIndex) {
|
||||
arguments[i] = new NamedExpression(
|
||||
"#$i",
|
||||
deprecated_buildCompileTimeError(
|
||||
"Expected named argument.", forest.readOffset(argument)))
|
||||
buildCompileTimeErrorExpression(
|
||||
fasta.messageExpectedNamedArgument,
|
||||
forest.readOffset(argument)))
|
||||
..fileOffset = beginToken.charOffset;
|
||||
}
|
||||
}
|
||||
|
@ -1167,8 +1168,9 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
negate = true;
|
||||
}
|
||||
if (!isBinaryOperator(operator) && !isMinusOperator(operator)) {
|
||||
return deprecated_buildCompileTimeError(
|
||||
"Not an operator: '$operator'.", token.charOffset);
|
||||
return buildCompileTimeErrorExpression(
|
||||
fasta.templateInvalidOperator.withArguments(token), token.charOffset,
|
||||
length: token.length);
|
||||
} else {
|
||||
Expression result = buildMethodInvocation(a, new Name(operator),
|
||||
forest.arguments(<Expression>[b], noLocation), token.charOffset,
|
||||
|
@ -1803,17 +1805,17 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
// silent if the next token is `in`. Since a for-in loop can only have
|
||||
// one variable it must be followed by `in`.
|
||||
if (isConst) {
|
||||
initializer = deprecated_buildCompileTimeError(
|
||||
null,
|
||||
token.charOffset,
|
||||
initializer = buildCompileTimeErrorExpression(
|
||||
fasta.templateConstFieldWithoutInitializer
|
||||
.withArguments(token.lexeme));
|
||||
} else if (isFinal) {
|
||||
initializer = deprecated_buildCompileTimeError(
|
||||
null,
|
||||
.withArguments(token.lexeme),
|
||||
token.charOffset,
|
||||
length: token.length);
|
||||
} else if (isFinal) {
|
||||
initializer = buildCompileTimeErrorExpression(
|
||||
fasta.templateFinalFieldWithoutInitializer
|
||||
.withArguments(token.lexeme));
|
||||
.withArguments(token.lexeme),
|
||||
token.charOffset,
|
||||
length: token.length);
|
||||
}
|
||||
}
|
||||
pushNewLocalVariable(initializer);
|
||||
|
@ -3003,8 +3005,9 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
int charOffset,
|
||||
Constness constness) {
|
||||
if (arguments == null) {
|
||||
return deprecated_buildCompileTimeError(
|
||||
"No arguments.", nameToken.charOffset);
|
||||
return buildCompileTimeErrorExpression(
|
||||
fasta.messageMissingArgumentList, nameToken.charOffset,
|
||||
length: nameToken.length);
|
||||
}
|
||||
|
||||
if (typeArguments != null) {
|
||||
|
@ -3015,8 +3018,9 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
String errorName;
|
||||
if (type is ClassBuilder<TypeBuilder, Object>) {
|
||||
if (type is EnumBuilder<TypeBuilder, Object>) {
|
||||
return deprecated_buildCompileTimeError(
|
||||
"An enum class can't be instantiated.", nameToken.charOffset);
|
||||
return buildCompileTimeErrorExpression(
|
||||
fasta.messageEnumInstantiation, nameToken.charOffset,
|
||||
length: nameToken.length);
|
||||
}
|
||||
Declaration b =
|
||||
type.findConstructorOrFactory(name, charOffset, uri, library);
|
||||
|
@ -3312,8 +3316,9 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
..fileOffset = beginToken.charOffset
|
||||
..fileEndOffset = token.charOffset);
|
||||
if (constantContext != ConstantContext.none) {
|
||||
push(deprecated_buildCompileTimeError(
|
||||
null, formals.charOffset, fasta.messageNotAConstantExpression));
|
||||
push(buildCompileTimeErrorExpression(
|
||||
fasta.messageNotAConstantExpression, formals.charOffset,
|
||||
length: formals.charLength));
|
||||
} else {
|
||||
push(new FunctionExpressionJudgment(function)
|
||||
..fileOffset = offsetForToken(beginToken));
|
||||
|
@ -3542,8 +3547,9 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
case Assert.Expression:
|
||||
// The parser has already reported an error indicating that assert
|
||||
// cannot be used in an expression.
|
||||
push(deprecated_buildCompileTimeError(
|
||||
"`assert` can't be used as an expression."));
|
||||
push(buildCompileTimeErrorExpression(
|
||||
fasta.messageAssertAsExpression, assertKeyword.offset,
|
||||
length: assertKeyword.length));
|
||||
break;
|
||||
|
||||
case Assert.Initializer:
|
||||
|
@ -3722,14 +3728,17 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
} else if (target == null ||
|
||||
target is! JumpTarget ||
|
||||
!target.isBreakTarget) {
|
||||
push(compileTimeErrorInLoopOrSwitch =
|
||||
deprecated_buildCompileTimeErrorStatement(
|
||||
"Can't break to '$name'.", breakKeyword.next.charOffset));
|
||||
Token labelToken = breakKeyword.next;
|
||||
push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
||||
fasta.templateInvalidBreakTarget.withArguments(name),
|
||||
labelToken.charOffset,
|
||||
length: labelToken.length));
|
||||
} else if (target.functionNestingLevel != functionNestingLevel) {
|
||||
push(compileTimeErrorInLoopOrSwitch =
|
||||
deprecated_buildCompileTimeErrorStatement(
|
||||
"Can't break to '$name' in a different function.",
|
||||
breakKeyword.next.charOffset));
|
||||
Token labelToken = breakKeyword.next;
|
||||
push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
||||
fasta.templateBreakTargetOutsideFunction.withArguments(name),
|
||||
labelToken.charOffset,
|
||||
length: labelToken.length));
|
||||
} else {
|
||||
Statement statement =
|
||||
forest.breakStatement(breakKeyword, identifier, endToken);
|
||||
|
@ -3750,10 +3759,10 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
name = identifier.name;
|
||||
Declaration namedTarget = scope.lookupLabel(identifier.name);
|
||||
if (namedTarget != null && namedTarget is! JumpTarget) {
|
||||
push(compileTimeErrorInLoopOrSwitch =
|
||||
deprecated_buildCompileTimeErrorStatement(
|
||||
"Target of continue must be a label.",
|
||||
continueKeyword.charOffset));
|
||||
Token labelToken = continueKeyword.next;
|
||||
push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
||||
fasta.messageContinueLabelNotTarget, labelToken.charOffset,
|
||||
length: labelToken.length));
|
||||
return;
|
||||
}
|
||||
target = namedTarget;
|
||||
|
@ -3778,18 +3787,21 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
}
|
||||
}
|
||||
if (target == null) {
|
||||
push(compileTimeErrorInLoopOrSwitch =
|
||||
deprecated_buildCompileTimeErrorStatement(
|
||||
"No target of continue.", continueKeyword.charOffset));
|
||||
push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
||||
fasta.messageContinueWithoutLabelInCase, continueKeyword.charOffset,
|
||||
length: continueKeyword.length));
|
||||
} else if (!target.isContinueTarget) {
|
||||
push(compileTimeErrorInLoopOrSwitch =
|
||||
deprecated_buildCompileTimeErrorStatement(
|
||||
"Can't continue at '$name'.", continueKeyword.next.charOffset));
|
||||
Token labelToken = continueKeyword.next;
|
||||
push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
||||
fasta.templateInvalidContinueTarget.withArguments(name),
|
||||
labelToken.charOffset,
|
||||
length: labelToken.length));
|
||||
} else if (target.functionNestingLevel != functionNestingLevel) {
|
||||
push(compileTimeErrorInLoopOrSwitch =
|
||||
deprecated_buildCompileTimeErrorStatement(
|
||||
"Can't continue at '$name' in a different function.",
|
||||
continueKeyword.next.charOffset));
|
||||
Token labelToken = continueKeyword.next;
|
||||
push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
|
||||
fasta.templateContinueTargetOutsideFunction.withArguments(name),
|
||||
labelToken.charOffset,
|
||||
length: labelToken.length));
|
||||
} else {
|
||||
Statement statement =
|
||||
forest.continueStatement(continueKeyword, identifier, endToken);
|
||||
|
@ -3941,14 +3953,6 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
push(new InvalidStatementJudgment(error, statement));
|
||||
}
|
||||
|
||||
@override
|
||||
Expression deprecated_buildCompileTimeError(String error,
|
||||
[int charOffset = -1, fasta.Message message]) {
|
||||
message ??= fasta.templateUnspecified.withArguments(error);
|
||||
return new SyntheticExpressionJudgment(
|
||||
buildCompileTimeError(message, charOffset, noLength));
|
||||
}
|
||||
|
||||
@override
|
||||
Expression buildCompileTimeError(Message message, int charOffset, int length,
|
||||
{List<LocatedMessage> context}) {
|
||||
|
@ -3958,6 +3962,13 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
library.loader.buildCompileTimeError(message, charOffset, length, uri));
|
||||
}
|
||||
|
||||
@override
|
||||
Expression buildCompileTimeErrorExpression(Message message, int offset,
|
||||
{int length}) {
|
||||
return new SyntheticExpressionJudgment(
|
||||
buildCompileTimeError(message, offset, length ?? noLength));
|
||||
}
|
||||
|
||||
Expression wrapInCompileTimeError(Expression expression, Message message,
|
||||
{List<LocatedMessage> context}) {
|
||||
return wrapInLocatedCompileTimeError(expression,
|
||||
|
@ -4041,17 +4052,11 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
], noLocation)));
|
||||
}
|
||||
|
||||
Statement deprecated_buildCompileTimeErrorStatement(error,
|
||||
[int charOffset = -1, fasta.Message message]) {
|
||||
return new ExpressionStatementJudgment(
|
||||
deprecated_buildCompileTimeError(error, charOffset, message), null);
|
||||
}
|
||||
|
||||
Statement buildCompileTimeErrorStatement(Message message, int charOffset,
|
||||
{List<LocatedMessage> context}) {
|
||||
{List<LocatedMessage> context, int length}) {
|
||||
return new ExpressionStatementJudgment(
|
||||
new SyntheticExpressionJudgment(buildCompileTimeError(
|
||||
message, charOffset, noLength,
|
||||
message, charOffset, length ?? noLength,
|
||||
context: context)),
|
||||
null);
|
||||
}
|
||||
|
@ -4235,8 +4240,10 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
push(forest.block(
|
||||
token,
|
||||
<Statement>[
|
||||
deprecated_buildCompileTimeErrorStatement(null, token.charOffset,
|
||||
fasta.templateExpectedFunctionBody.withArguments(token))
|
||||
buildCompileTimeErrorStatement(
|
||||
fasta.templateExpectedFunctionBody.withArguments(token),
|
||||
token.charOffset,
|
||||
length: token.length)
|
||||
],
|
||||
null));
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import '../fasta_codes.dart'
|
|||
Template,
|
||||
messageCantUsePrefixAsExpression,
|
||||
messageCantUsePrefixWithNullAware,
|
||||
messageIllegalAssignmentToNonAssignable,
|
||||
messageInvalidInitializer,
|
||||
messageNotAConstantExpression,
|
||||
templateCantUseDeferredPrefixAsConstant,
|
||||
|
@ -930,9 +931,9 @@ abstract class ContextAwareGenerator implements Generator {
|
|||
|
||||
@override
|
||||
Expression makeInvalidWrite(Expression value) {
|
||||
return helper.deprecated_buildCompileTimeError(
|
||||
"Can't be used as left-hand side of assignment.",
|
||||
offsetForToken(token));
|
||||
return helper.buildCompileTimeErrorExpression(
|
||||
messageIllegalAssignmentToNonAssignable, offsetForToken(token),
|
||||
length: token?.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -962,8 +963,9 @@ abstract class DelayedAssignment implements ContextAwareGenerator {
|
|||
|
||||
Expression handleAssignment(bool voidContext) {
|
||||
if (helper.constantContext != ConstantContext.none) {
|
||||
return helper.deprecated_buildCompileTimeError(
|
||||
null, offsetForToken(token), messageNotAConstantExpression);
|
||||
return helper.buildCompileTimeErrorExpression(
|
||||
messageNotAConstantExpression, offsetForToken(token),
|
||||
length: token.length);
|
||||
}
|
||||
if (identical("=", assignmentOperator)) {
|
||||
return generator.buildAssignment(value, voidContext: voidContext);
|
||||
|
|
|
@ -75,14 +75,14 @@ abstract class ExpressionGeneratorHelper implements InferenceHelper {
|
|||
Expression buildCompileTimeError(Message message, int charOffset, int length,
|
||||
{List<LocatedMessage> context});
|
||||
|
||||
Expression buildCompileTimeErrorExpression(Message message, int offset,
|
||||
{int length});
|
||||
|
||||
Expression wrapInCompileTimeError(Expression expression, Message message);
|
||||
|
||||
Expression wrapInProblem(Expression expression, Message message, int length,
|
||||
{List<LocatedMessage> context});
|
||||
|
||||
Expression deprecated_buildCompileTimeError(String error,
|
||||
[int offset, Message message]);
|
||||
|
||||
Initializer buildInvalidInitializer(Expression expression, [int offset]);
|
||||
|
||||
Initializer buildFieldInitializer(
|
||||
|
|
|
@ -13,8 +13,10 @@ import '../fasta_codes.dart'
|
|||
show
|
||||
Message,
|
||||
LocatedMessage,
|
||||
messageCannotAssignToSuper,
|
||||
messageLoadLibraryTakesNoArguments,
|
||||
messageNotAConstantExpression,
|
||||
messageNotAnLvalue,
|
||||
messageCannotAssignToParenthesizedExpression,
|
||||
templateNotConstantExpression,
|
||||
messageSuperAsExpression,
|
||||
|
|
|
@ -163,10 +163,10 @@ class ThisAccessGenerator extends KernelGenerator {
|
|||
}
|
||||
|
||||
Expression buildAssignmentError() {
|
||||
String message =
|
||||
isSuper ? "Can't assign to 'super'." : "Can't assign to 'this'.";
|
||||
return helper.deprecated_buildCompileTimeError(
|
||||
message, offsetForToken(token));
|
||||
return helper.buildCompileTimeError(
|
||||
isSuper ? messageCannotAssignToSuper : messageNotAnLvalue,
|
||||
offsetForToken(token),
|
||||
token.length);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -19,9 +19,11 @@ AssertExtraneousArgument/example: Fail
|
|||
AsyncAsIdentifier/example: Fail
|
||||
AwaitAsIdentifier/example: Fail
|
||||
AwaitNotAsync/example: Fail
|
||||
BreakTargetOutsideFunction/example: Fail
|
||||
BuiltInIdentifierAsType/example: Fail
|
||||
BuiltInIdentifierInDeclaration/example: Fail
|
||||
CannotAssignToParenthesizedExpression/example: Fail
|
||||
CannotAssignToSuper/example: Fail
|
||||
CannotReadPackagesFile/analyzerCode: Fail
|
||||
CannotReadPackagesFile/example: Fail
|
||||
CannotReadSdkSpecification/analyzerCode: Fail
|
||||
|
@ -80,7 +82,9 @@ ConstEvalZeroDivisor/example: Fail
|
|||
ConstFieldWithoutInitializer/example: Fail
|
||||
ConstructorNotFound/example: Fail
|
||||
ConstructorNotSync/example: Fail
|
||||
ContinueLabelNotTarget/example: Fail
|
||||
ContinueOutsideOfLoop/script1: Fail
|
||||
ContinueTargetOutsideFunction/example: Fail
|
||||
ContinueWithoutLabelInCase/script1: Fail
|
||||
CouldNotParseUri/analyzerCode: Fail
|
||||
CouldNotParseUri/example: Fail
|
||||
|
@ -111,6 +115,7 @@ DuplicatedNamedArgument/example: Fail
|
|||
DuplicatedParameterName/example: Fail
|
||||
Encoding/analyzerCode: Fail
|
||||
EnumConstantSameNameAsEnclosing/example: Fail
|
||||
EnumInstantiation/example: Fail
|
||||
EqualityCannotBeEqualityOperand/script1: Fail
|
||||
EqualityCannotBeEqualityOperand/script2: Fail
|
||||
ExpectedAnInitializer/script1: Fail
|
||||
|
@ -122,6 +127,7 @@ ExpectedClassBody/example: Fail
|
|||
ExpectedClassMember/example: Fail
|
||||
ExpectedDeclaration/example: Fail
|
||||
ExpectedFunctionBody/example: Fail
|
||||
ExpectedNamedArgument/example: Fail
|
||||
ExpectedOneExpression/analyzerCode: Fail
|
||||
ExpectedOneExpression/example: Fail
|
||||
ExpectedOpenParens/analyzerCode: Fail
|
||||
|
@ -196,6 +202,8 @@ InputFileNotFound/analyzerCode: Fail
|
|||
InputFileNotFound/example: Fail
|
||||
IntegerLiteralIsOutOfRange/example: Fail
|
||||
InterpolationInUri/example: Fail
|
||||
InvalidBreakTarget/analyzerCode: Fail
|
||||
InvalidBreakTarget/example: Fail
|
||||
InvalidCastFunctionExpr/example: Fail
|
||||
InvalidCastLiteralList/example: Fail
|
||||
InvalidCastLiteralMap/example: Fail
|
||||
|
@ -204,6 +212,8 @@ InvalidCastNewExpr/example: Fail
|
|||
InvalidCastStaticMethod/example: Fail
|
||||
InvalidCastTopLevelFunction/example: Fail
|
||||
InvalidCatchArguments/example: Fail
|
||||
InvalidContinueTarget/analyzerCode: Fail
|
||||
InvalidContinueTarget/example: Fail
|
||||
InvalidInitializer/example: Fail
|
||||
InvalidInlineFunctionType/analyzerCode: Fail
|
||||
InvalidPackageUri/analyzerCode: Fail
|
||||
|
@ -221,6 +231,8 @@ MemberWithSameNameAsClass/example: Fail
|
|||
MetadataTypeArguments/example: Fail
|
||||
MethodNotFound/dart2jsCode: Fail
|
||||
MethodNotFound/example: Fail
|
||||
MissingArgumentList/analyzerCode: Fail
|
||||
MissingArgumentList/example: Fail
|
||||
MissingAssignableSelector/script1: Fail
|
||||
MissingAssignmentInInitializer/script1: Fail
|
||||
MissingInput/analyzerCode: Fail
|
||||
|
|
|
@ -745,6 +745,15 @@ BreakOutsideOfLoop:
|
|||
script:
|
||||
- "main() { break; }"
|
||||
|
||||
InvalidBreakTarget:
|
||||
template: "Can't break to '#name'."
|
||||
dart2jsCode: "*fatal*"
|
||||
|
||||
BreakTargetOutsideFunction:
|
||||
template: "Can't break to '#name' in a different function."
|
||||
analyzerCode: LABEL_IN_OUTER_SCOPE
|
||||
dart2jsCode: "*fatal*"
|
||||
|
||||
ContinueOutsideOfLoop:
|
||||
template: "A continue statement can't be used outside of a loop or switch statement."
|
||||
tip: "Try removing the continue statement."
|
||||
|
@ -753,6 +762,20 @@ ContinueOutsideOfLoop:
|
|||
script:
|
||||
- "main() { continue; }"
|
||||
|
||||
InvalidContinueTarget:
|
||||
template: "Can't continue at '#name'."
|
||||
dart2jsCode: "*fatal*"
|
||||
|
||||
ContinueTargetOutsideFunction:
|
||||
template: "Can't continue at '#name' in a different function."
|
||||
analyzerCode: LABEL_IN_OUTER_SCOPE
|
||||
dart2jsCode: "*fatal*"
|
||||
|
||||
ContinueLabelNotTarget:
|
||||
template: "Target of continue must be a label."
|
||||
analyzerCode: LABEL_UNDEFINED
|
||||
dart2jsCode: "*fatal*"
|
||||
|
||||
ContinueWithoutLabelInCase:
|
||||
template: "A continue statement in a switch statement must have a label as a target."
|
||||
tip: "Try adding a label associated with one of the case clauses to the continue statement."
|
||||
|
@ -1087,6 +1110,11 @@ PositionalAfterNamedArgument:
|
|||
analyzerCode: POSITIONAL_AFTER_NAMED_ARGUMENT
|
||||
dart2jsCode: "*ignored*"
|
||||
|
||||
ExpectedNamedArgument:
|
||||
template: "Expected named argument."
|
||||
analyzerCode: EXTRA_POSITIONAL_ARGUMENTS
|
||||
dart2jsCode: "*fatal*"
|
||||
|
||||
AssertAsExpression:
|
||||
template: "`assert` can't be used as an expression."
|
||||
dart2jsCode: "*fatal*"
|
||||
|
@ -1253,6 +1281,10 @@ CandidateFoundIsDefaultConstructor:
|
|||
template: "The class '#name' has a constructor that takes no arguments."
|
||||
severity: CONTEXT
|
||||
|
||||
MissingArgumentList:
|
||||
template: "Constructor invocations must have an argument list."
|
||||
severity: ERROR
|
||||
|
||||
TooFewArguments:
|
||||
template: "Too few positional arguments: #count required, #count2 given."
|
||||
severity: ERROR_LEGACY_WARNING
|
||||
|
@ -1277,6 +1309,12 @@ AbstractClassInstantiation:
|
|||
analyzerCode: NEW_WITH_ABSTRACT_CLASS
|
||||
dart2jsCode: "*fatal*"
|
||||
|
||||
EnumInstantiation:
|
||||
template: "Enums can't be instantiated."
|
||||
severity: ERROR
|
||||
analyzerCode: INSTANTIATE_ENUM
|
||||
dart2jsCode: "*fatal*"
|
||||
|
||||
AbstractRedirectedClassInstantiation:
|
||||
template: "Factory redirects to class '#name', which is abstract and can't be instantiated."
|
||||
severity: ERROR_LEGACY_WARNING
|
||||
|
@ -2310,6 +2348,11 @@ NotAnLvalue:
|
|||
analyzerCode: NOT_AN_LVALUE
|
||||
dart2jsCode: "*fatal*"
|
||||
|
||||
CannotAssignToSuper:
|
||||
template: "Can't assign to super."
|
||||
analyzerCode: NOT_AN_LVALUE
|
||||
dart2jsCode: "*fatal*"
|
||||
|
||||
IllegalAssignmentToNonAssignable:
|
||||
template: "Illegal assignment to non-assignable expression."
|
||||
analyzerCode: ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE
|
||||
|
@ -2634,7 +2677,7 @@ BoundIssueViaRawTypeWithNonSimpleBounds:
|
|||
template: "Generic type '#name' can't be used without type arguments in a type variable bound."
|
||||
tip: "Try providing type arguments to '#name' here."
|
||||
severity: ERROR
|
||||
analyzerCode: SNOT_INSTANTIATED_BOUND
|
||||
analyzerCode: NOT_INSTANTIATED_BOUND
|
||||
dart2jsCode: "*fatal*"
|
||||
script: >
|
||||
class Hest<X extends Hest<X>> {}
|
||||
|
|
Loading…
Reference in a new issue