Index: pkg/front_end/lib/src/fasta/source/source_loader.dart |
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart |
index 727907f2dfa85e00ddcc88c358e5c6bc94ebeb36..34ae3f3f2967b9ce0fd08a0096940eb0377b294d 100644 |
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart |
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart |
@@ -8,18 +8,6 @@ import 'dart:async' show Future; |
import 'dart:typed_data' show Uint8List; |
-import 'package:front_end/file_system.dart'; |
-import 'package:front_end/src/base/instrumentation.dart' show Instrumentation; |
- |
-import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' |
- show KernelTypeInferenceEngine; |
- |
-import 'package:front_end/src/fasta/kernel/kernel_target.dart' |
- show KernelTarget; |
- |
-import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart' |
- show TypeInferenceEngine; |
- |
import 'package:kernel/ast.dart' show Arguments, Expression, Program; |
import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; |
@@ -29,6 +17,10 @@ import 'package:kernel/core_types.dart' show CoreTypes; |
import 'package:kernel/src/incremental_class_hierarchy.dart' |
show IncrementalClassHierarchy; |
+import '../../../file_system.dart'; |
+ |
+import '../../base/instrumentation.dart' show Instrumentation; |
+ |
import '../builder/builder.dart' |
show |
Builder, |
@@ -44,12 +36,27 @@ import '../deprecated_problems.dart' show deprecated_inputError; |
import '../export.dart' show Export; |
+import '../fasta_codes.dart' |
+ show |
+ templateCyclicClassHierarchy, |
+ templateExtendingEnum, |
+ templateExtendingRestricted, |
+ templateIllegalMixin, |
+ templateIllegalMixinDueToConstructors, |
+ templateIllegalMixinDueToConstructorsCause; |
+ |
+import '../kernel/kernel_shadow_ast.dart' show KernelTypeInferenceEngine; |
+ |
+import '../kernel/kernel_target.dart' show KernelTarget; |
+ |
import '../loader.dart' show Loader; |
import '../parser/class_member_parser.dart' show ClassMemberParser; |
import '../scanner.dart' show ErrorToken, ScannerResult, Token, scan; |
+import '../type_inference/type_inference_engine.dart' show TypeInferenceEngine; |
+ |
import 'diet_listener.dart' show DietListener; |
import 'diet_parser.dart' show DietParser; |
@@ -367,10 +374,10 @@ class SourceLoader<L> extends Loader<L> { |
} |
String involvedString = |
involved.map((c) => c.fullNameForErrors).join("', '"); |
- cls.deprecated_addCompileTimeError( |
- cls.charOffset, |
- "'${cls.fullNameForErrors}' is a supertype of itself via " |
- "'$involvedString'."); |
+ cls.addCompileTimeError( |
+ templateCyclicClassHierarchy.withArguments( |
+ cls.fullNameForErrors, involvedString), |
+ cls.charOffset); |
} |
}); |
ticker.logMs("Found cycles"); |
@@ -387,16 +394,14 @@ class SourceLoader<L> extends Loader<L> { |
target.addDirectSupertype(cls, directSupertypes); |
for (ClassBuilder supertype in directSupertypes) { |
if (supertype is EnumBuilder) { |
- cls.deprecated_addCompileTimeError( |
- cls.charOffset, |
- "'${supertype.name}' is an enum and can't be extended or " |
- "implemented."); |
+ cls.addCompileTimeError( |
+ templateExtendingEnum.withArguments(supertype.name), |
+ cls.charOffset); |
} else if (!cls.library.mayImplementRestrictedTypes && |
blackListedClasses.contains(supertype)) { |
- cls.deprecated_addCompileTimeError( |
- cls.charOffset, |
- "'${supertype.name}' is restricted and can't be extended or " |
- "implemented."); |
+ cls.addCompileTimeError( |
+ templateExtendingRestricted.withArguments(supertype.name), |
+ cls.charOffset); |
} |
} |
TypeBuilder mixedInType = cls.mixedInType; |
@@ -408,21 +413,22 @@ class SourceLoader<L> extends Loader<L> { |
isClassBuilder = true; |
for (Builder constructory in builder.constructors.local.values) { |
if (constructory.isConstructor && !constructory.isSynthetic) { |
- cls.deprecated_addCompileTimeError( |
- cls.charOffset, |
- "Can't use '${builder.fullNameForErrors}' as a mixin " |
- "because it has constructors."); |
- builder.deprecated_addCompileTimeError( |
- constructory.charOffset, |
- "This constructor prevents using " |
- "'${builder.fullNameForErrors}' as a mixin."); |
+ cls.addCompileTimeError( |
+ templateIllegalMixinDueToConstructors |
+ .withArguments(builder.fullNameForErrors), |
+ cls.charOffset); |
+ builder.addCompileTimeError( |
+ templateIllegalMixinDueToConstructorsCause |
+ .withArguments(builder.fullNameForErrors), |
+ constructory.charOffset); |
} |
} |
} |
} |
if (!isClassBuilder) { |
- cls.deprecated_addCompileTimeError(cls.charOffset, |
- "The type '${mixedInType.fullNameForErrors}' can't be mixed in."); |
+ cls.addCompileTimeError( |
+ templateIllegalMixin.withArguments(mixedInType.fullNameForErrors), |
+ cls.charOffset); |
} |
} |
} |