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

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

Issue 2970273004: Deprecate all diagnostics methods that use strings. (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_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 31458b67c3933eee95dd67707b4f4d90a6fd10f4..5fb5a1df2cc10f74b351cb819a03c4694f71ea51 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -54,8 +54,12 @@ import '../translate_uri.dart' show TranslateUri;
import '../dill/dill_target.dart' show DillTarget;
-import '../errors.dart'
- show InputError, internalError, reportCrash, resetCrashReporting;
+import '../deprecated_problems.dart'
+ show
+ deprecated_InputError,
+ deprecated_internalProblem,
+ reportCrash,
+ resetCrashReporting;
import '../util/relativize.dart' show relativizeUri;
@@ -113,10 +117,11 @@ class KernelTarget extends TargetImplementation {
loader = createLoader();
}
- void addError(file, int charOffset, String message) {
+ void deprecated_addError(file, int charOffset, String message) {
Uri uri = file is String ? Uri.parse(file) : file;
- InputError error = new InputError(uri, charOffset, message);
- String formatterMessage = error.format();
+ deprecated_InputError error =
+ new deprecated_InputError(uri, charOffset, message);
+ String formatterMessage = error.deprecated_format();
print(formatterMessage);
errors.add(formatterMessage);
}
@@ -149,7 +154,7 @@ class KernelTarget extends TargetImplementation {
if (supertype is NamedTypeBuilder) {
f(supertype);
} else if (supertype != null) {
- internalError("Unhandled: ${supertype.runtimeType}");
+ deprecated_internalProblem("Unhandled: ${supertype.runtimeType}");
}
if (cls.interfaces != null) {
for (NamedTypeBuilder t in cls.interfaces) {
@@ -214,10 +219,10 @@ class KernelTarget extends TargetImplementation {
builder.mixedInType = null;
}
- void handleInputError(InputError error,
+ void handleInputError(deprecated_InputError error,
{bool isFullProgram, bool trimDependencies: false}) {
if (error != null) {
- String message = error.format();
+ String message = error.deprecated_format();
print(message);
errors.add(message);
}
@@ -249,7 +254,7 @@ class KernelTarget extends TargetImplementation {
loader.checkOverrides(sourceClasses);
loader.prepareInitializerInference();
loader.performInitializerInference();
- } on InputError catch (e) {
+ } on deprecated_InputError catch (e) {
handleInputError(e, isFullProgram: false);
} catch (e, s) {
return reportCrash(e, s, loader?.currentUriForCrashReporting);
@@ -293,7 +298,7 @@ class KernelTarget extends TargetImplementation {
isFullProgram: true, trimDependencies: trimDependencies);
}
handleRecoverableErrors(loader.unhandledErrors);
- } on InputError catch (e) {
+ } on deprecated_InputError catch (e) {
handleInputError(e,
isFullProgram: true, trimDependencies: trimDependencies);
} catch (e, s) {
@@ -354,7 +359,7 @@ class KernelTarget extends TargetImplementation {
///
/// If there's no main library, this method uses [erroneousProgram] to
/// replace [program].
- void handleRecoverableErrors(List<InputError> recoverableErrors) {
+ void handleRecoverableErrors(List<deprecated_InputError> recoverableErrors) {
if (recoverableErrors.isEmpty) return;
KernelLibraryBuilder mainLibrary = loader.first;
if (mainLibrary == null) {
@@ -362,8 +367,8 @@ class KernelTarget extends TargetImplementation {
return;
}
List<Expression> expressions = <Expression>[];
- for (InputError error in recoverableErrors) {
- String message = error.format();
+ for (deprecated_InputError error in recoverableErrors) {
+ String message = error.deprecated_format();
errors.add(message);
expressions.add(new StringLiteral(message));
}
@@ -477,7 +482,7 @@ class KernelTarget extends TargetImplementation {
if (type is NamedTypeBuilder) {
supertype = type.builder;
} else {
- internalError("Unhandled: ${type.runtimeType}");
+ deprecated_internalProblem("Unhandled: ${type.runtimeType}");
}
}
if (supertype is KernelClassBuilder) {
@@ -497,7 +502,7 @@ class KernelTarget extends TargetImplementation {
} else if (supertype is InvalidTypeBuilder) {
builder.addSyntheticConstructor(makeDefaultConstructor());
} else {
- internalError("Unhandled: ${supertype.runtimeType}");
+ deprecated_internalProblem("Unhandled: ${supertype.runtimeType}");
}
} else {
/// >Iff no constructor is specified for a class C, it implicitly has a
@@ -603,7 +608,7 @@ class KernelTarget extends TargetImplementation {
superTarget ??= defaultSuperConstructor(cls);
Initializer initializer;
if (superTarget == null) {
- addError(
+ deprecated_addError(
constructor.enclosingClass.fileUri,
constructor.fileOffset,
"${cls.superclass.name} has no constructor that takes no"
@@ -631,10 +636,14 @@ class KernelTarget extends TargetImplementation {
}
fieldInitializers[constructor] = myFieldInitializers;
if (constructor.isConst && nonFinalFields.isNotEmpty) {
- addError(constructor.enclosingClass.fileUri, constructor.fileOffset,
+ deprecated_addError(
+ constructor.enclosingClass.fileUri,
+ constructor.fileOffset,
"Constructor is marked 'const' so all fields must be final.");
for (Field field in nonFinalFields) {
- addError(constructor.enclosingClass.fileUri, field.fileOffset,
+ deprecated_addError(
+ constructor.enclosingClass.fileUri,
+ field.fileOffset,
"Field isn't final, but constructor is 'const'.");
}
nonFinalFields.clear();

Powered by Google App Engine
This is Rietveld 408576698