Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1659)

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart

Issue 2977713002: Remove deprecated api from LibraryBuilder. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
index bef889cb9d9ab85ffad96dcfff84f88c94e6fa17..49d1143d51553c7eac734301ee8b28d2ea4c23b7 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
@@ -28,7 +28,12 @@ import 'package:kernel/ast.dart'
ThisExpression,
VariableGet;
-import '../fasta_codes.dart' show messageNoUnamedConstructorInObject;
+import '../fasta_codes.dart'
+ show
+ messageEnumDeclartionEmpty,
+ messageNoUnamedConstructorInObject,
+ templateDuplicatedName,
+ templateEnumConstantSameNameAsEnclosing;
import '../modifier.dart' show constMask, finalMask, staticMask;
@@ -159,16 +164,16 @@ class KernelEnumBuilder extends SourceClassBuilder
String name = constantNamesAndOffsets[i];
int charOffset = constantNamesAndOffsets[i + 1];
if (members.containsKey(name)) {
- parent.deprecated_addCompileTimeError(
- charOffset, "Duplicated name: '$name'.");
+ parent.addCompileTimeError(templateDuplicatedName.withArguments(name),
+ charOffset, parent.fileUri);
constantNamesAndOffsets[i] = null;
continue;
}
if (name == className) {
- parent.deprecated_addCompileTimeError(
+ parent.addCompileTimeError(
+ templateEnumConstantSameNameAsEnclosing.withArguments(name),
charOffset,
- "Name of enum constant '$name' can't be the same as the enum's "
- "own name.");
+ parent.fileUri);
constantNamesAndOffsets[i] = null;
continue;
}
@@ -216,8 +221,8 @@ class KernelEnumBuilder extends SourceClassBuilder
@override
Class build(KernelLibraryBuilder libraryBuilder, LibraryBuilder coreLibrary) {
if (constantNamesAndOffsets.isEmpty) {
- libraryBuilder.deprecated_addCompileTimeError(
- -1, "An enum declaration can't be empty.");
+ libraryBuilder.addCompileTimeError(
+ messageEnumDeclartionEmpty, charOffset, fileUri);
}
intType.resolveIn(coreLibrary.scope);
stringType.resolveIn(coreLibrary.scope);

Powered by Google App Engine
This is Rietveld 408576698