Skip to content

Commit 17dc720

Browse files
Remove deprecated_warningNotError.
[email protected] Review-Url: https://codereview.chromium.org/2977903002 .
1 parent 2f5bdf9 commit 17dc720

File tree

3 files changed

+75
-12
lines changed

3 files changed

+75
-12
lines changed

pkg/front_end/lib/src/fasta/fasta_codes_generated.dart

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,53 @@ const MessageCode messageFinalFieldWithoutInitializer = const MessageCode(
10211021
message: r"""A 'final' field must be initialized.""",
10221022
tip: r"""Try adding '= <initializer>'.""");
10231023

1024+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
1025+
const Template<Message Function(String name)>
1026+
templateFinalInstanceVariableAlreadyInitialized =
1027+
const Template<Message Function(String name)>(
1028+
messageTemplate:
1029+
r"""'#name' is a final instance variable that has already been initialized.""",
1030+
withArguments: _withArgumentsFinalInstanceVariableAlreadyInitialized);
1031+
1032+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
1033+
const Code<Message Function(String name)>
1034+
codeFinalInstanceVariableAlreadyInitialized =
1035+
const Code<Message Function(String name)>(
1036+
"FinalInstanceVariableAlreadyInitialized",
1037+
templateFinalInstanceVariableAlreadyInitialized,
1038+
);
1039+
1040+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
1041+
Message _withArgumentsFinalInstanceVariableAlreadyInitialized(String name) {
1042+
return new Message(codeFinalInstanceVariableAlreadyInitialized,
1043+
message:
1044+
"""'$name' is a final instance variable that has already been initialized.""",
1045+
arguments: {'name': name});
1046+
}
1047+
1048+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
1049+
const Template<Message Function(String name)>
1050+
templateFinalInstanceVariableAlreadyInitializedCause =
1051+
const Template<Message Function(String name)>(
1052+
messageTemplate: r"""'#name' was initialized here.""",
1053+
withArguments:
1054+
_withArgumentsFinalInstanceVariableAlreadyInitializedCause);
1055+
1056+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
1057+
const Code<Message Function(String name)>
1058+
codeFinalInstanceVariableAlreadyInitializedCause =
1059+
const Code<Message Function(String name)>(
1060+
"FinalInstanceVariableAlreadyInitializedCause",
1061+
templateFinalInstanceVariableAlreadyInitializedCause,
1062+
);
1063+
1064+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
1065+
Message _withArgumentsFinalInstanceVariableAlreadyInitializedCause(
1066+
String name) {
1067+
return new Message(codeFinalInstanceVariableAlreadyInitializedCause,
1068+
message: """'$name' was initialized here.""", arguments: {'name': name});
1069+
}
1070+
10241071
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
10251072
const Code<Null> codeFunctionTypeDefaultValue = messageFunctionTypeDefaultValue;
10261073

@@ -2297,6 +2344,14 @@ Message _withArgumentsSupertypeIsTypeVariable(String name) {
22972344
arguments: {'name': name});
22982345
}
22992346

2347+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
2348+
const Code<Null> codeSwitchCaseFallThrough = messageSwitchCaseFallThrough;
2349+
2350+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
2351+
const MessageCode messageSwitchCaseFallThrough = const MessageCode(
2352+
"SwitchCaseFallThrough",
2353+
message: r"""Switch case may fall through to the next case.""");
2354+
23002355
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
23012356
const Template<Message Function(String name)>
23022357
templateThisAccessInFieldInitializer =

pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3012,7 +3012,9 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
30123012
DartType bound = pop();
30133013
if (bound != null) {
30143014
// TODO(ahe): To handle F-bounded types, this needs to be a TypeBuilder.
3015-
deprecated_warningNotError("Type variable bounds not implemented yet.",
3015+
warningNotError(
3016+
fasta.templateInternalProblemUnimplemented
3017+
.withArguments("bounds on type variables"),
30163018
offsetForToken(extendsOrSuper.next));
30173019
}
30183020
Identifier name = pop();
@@ -3120,8 +3122,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
31203122
}
31213123

31223124
Expression buildFallThroughError(int charOffset) {
3123-
deprecated_warningNotError(
3124-
"Switch case may fall through to next case.", charOffset);
3125+
warningNotError(fasta.messageSwitchCaseFallThrough, charOffset);
31253126

31263127
Location location = messages.getLocationFromUri(uri, charOffset);
31273128

@@ -3182,12 +3183,14 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
31823183
if (builder.isFinal && builder.hasInitializer) {
31833184
// TODO(ahe): If CL 2843733002 is landed, this becomes a compile-time
31843185
// error. Also, this is a compile-time error in strong mode.
3185-
deprecated_warningNotError(
3186-
"'$name' is final instance variable that has already been "
3187-
"initialized.",
3186+
warningNotError(
3187+
fasta.templateFinalInstanceVariableAlreadyInitialized
3188+
.withArguments(name),
31883189
offset);
3189-
deprecated_warningNotError(
3190-
"'$name' was initialized here.", builder.charOffset);
3190+
warningNotError(
3191+
fasta.templateFinalInstanceVariableAlreadyInitializedCause
3192+
.withArguments(name),
3193+
builder.charOffset);
31913194
Builder constructor =
31923195
library.loader.getDuplicatedFieldInitializerError();
31933196
return buildInvalidInitializer(
@@ -3280,10 +3283,6 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
32803283
}
32813284
}
32823285

3283-
void deprecated_warningNotError(String message, [int charOffset = -1]) {
3284-
super.deprecated_warning(message, charOffset);
3285-
}
3286-
32873286
void warningNotError(Message message, int charOffset) {
32883287
super.warning(message, charOffset);
32893288
}

pkg/front_end/messages.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,3 +807,12 @@ ThisAsIdentifier:
807807

808808
SuperAsIdentifier:
809809
template: "Expected identifier, but got 'super'."
810+
811+
SwitchCaseFallThrough:
812+
template: "Switch case may fall through to the next case."
813+
814+
FinalInstanceVariableAlreadyInitialized:
815+
template: "'#name' is a final instance variable that has already been initialized."
816+
817+
FinalInstanceVariableAlreadyInitializedCause:
818+
template: "'#name' was initialized here."

0 commit comments

Comments
 (0)