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

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

Issue 2982673002: Remove deprecated_addError. (Closed)
Patch Set: Add missing comma. 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
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta_codes_generated.dart ('k') | pkg/front_end/messages.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 6c8ecec07096f36d038272f0dca47da25161b9fd..3ca9a1fd9a9676ff7eed822b90572874221ea23c 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -53,7 +53,12 @@ import '../deprecated_problems.dart'
import '../dill/dill_target.dart' show DillTarget;
-import '../messages.dart' show LocatedMessage;
+import '../messages.dart'
+ show
+ LocatedMessage,
+ messageConstConstructorNonFinalField,
+ messageConstConstructorNonFinalFieldCause,
+ templateSuperclassHasNoDefaultConstructor;
import '../problems.dart' show unhandled;
@@ -117,15 +122,6 @@ class KernelTarget extends TargetImplementation {
loader = createLoader();
}
- void deprecated_addError(file, int charOffset, String message) {
- Uri uri = file is String ? Uri.parse(file) : file;
- deprecated_InputError error =
- new deprecated_InputError(uri, charOffset, message);
- String formatterMessage = error.deprecated_format();
- print(formatterMessage);
- errors.add(formatterMessage);
- }
-
SourceLoader<Library> createLoader() =>
new SourceLoader<Library>(fileSystem, this);
@@ -556,11 +552,10 @@ class KernelTarget extends TargetImplementation {
superTarget ??= defaultSuperConstructor(cls);
Initializer initializer;
if (superTarget == null) {
- deprecated_addError(
- constructor.enclosingClass.fileUri,
- constructor.fileOffset,
- "${cls.superclass.name} has no constructor that takes no"
- " arguments.");
+ builder.addCompileTimeError(
+ templateSuperclassHasNoDefaultConstructor
+ .withArguments(cls.superclass.name),
+ constructor.fileOffset);
initializer = new InvalidInitializer();
} else {
initializer =
@@ -584,15 +579,11 @@ class KernelTarget extends TargetImplementation {
}
fieldInitializers[constructor] = myFieldInitializers;
if (constructor.isConst && nonFinalFields.isNotEmpty) {
- deprecated_addError(
- constructor.enclosingClass.fileUri,
- constructor.fileOffset,
- "Constructor is marked 'const' so all fields must be final.");
+ builder.addCompileTimeError(
+ messageConstConstructorNonFinalField, constructor.fileOffset);
for (Field field in nonFinalFields) {
- deprecated_addError(
- constructor.enclosingClass.fileUri,
- field.fileOffset,
- "Field isn't final, but constructor is 'const'.");
+ builder.addCompileTimeError(
+ messageConstConstructorNonFinalFieldCause, field.fileOffset);
}
nonFinalFields.clear();
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta_codes_generated.dart ('k') | pkg/front_end/messages.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698