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

Unified Diff: pkg/compiler/lib/src/resolution/class_hierarchy.dart

Issue 1423623008: Improve messages and static use for super/this-calls. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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/compiler/lib/src/resolution/class_hierarchy.dart
diff --git a/pkg/compiler/lib/src/resolution/class_hierarchy.dart b/pkg/compiler/lib/src/resolution/class_hierarchy.dart
index 1e16d222ba3dd17697e6347e3ea4a5a260c934b5..0166934e494258c491ee17aee2c8eba46d259234 100644
--- a/pkg/compiler/lib/src/resolution/class_hierarchy.dart
+++ b/pkg/compiler/lib/src/resolution/class_hierarchy.dart
@@ -193,15 +193,24 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
if (!element.hasConstructor) {
Element superMember = element.superclass.localLookup('');
- if (superMember == null || !superMember.isGenerativeConstructor) {
- MessageKind kind = MessageKind.CANNOT_FIND_CONSTRUCTOR;
- Map arguments = {'constructorName': ''};
+ if (superMember == null) {
+ MessageKind kind = MessageKind.CANNOT_FIND_UNNAMED_CONSTRUCTOR;
+ Map arguments = {'className': element.superclass.name};
// TODO(ahe): Why is this a compile-time error? Or if it is an error,
// why do we bother to registerThrowNoSuchMethod below?
reporter.reportErrorMessage(node, kind, arguments);
superMember = new ErroneousElementX(
kind, arguments, '', element);
registry.registerThrowNoSuchMethod();
+ } else if (!superMember.isGenerativeConstructor) {
+ MessageKind kind = MessageKind.SUPER_CALL_TO_FACTORY;
+ Map arguments = {'className': element.superclass.name};
+ // TODO(ahe): Why is this a compile-time error? Or if it is an error,
+ // why do we bother to registerThrowNoSuchMethod below?
+ reporter.reportErrorMessage(node, kind, arguments);
+ superMember = new ErroneousElementX(
+ kind, arguments, '', element);
+ registry.registerThrowNoSuchMethod();
} else {
ConstructorElement superConstructor = superMember;
superConstructor.computeType(resolution);

Powered by Google App Engine
This is Rietveld 408576698