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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 157813005: Check implicit super call in synthetic constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Was not allowed to move the code. Created 6 years, 10 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 | « no previous file | tests/language/constructor10_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index caad7575af1c8ca84bbed69b017c27c7e1c0ca95..4ab41ca0c8b2f627d2196b02a7b7cbe60a7088b0 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -3879,8 +3879,7 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
calculateAllSupertypes(element);
if (!element.hasConstructor) {
- Element superMember =
- element.superclass.localLookup('');
+ Element superMember = element.superclass.localLookup('');
if (superMember == null || !superMember.isGenerativeConstructor()) {
DualKind kind = MessageKind.CANNOT_FIND_CONSTRUCTOR;
Map arguments = {'constructorName': ''};
@@ -3890,6 +3889,13 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
superMember = new ErroneousElementX(
kind.error, arguments, '', element);
compiler.backend.registerThrowNoSuchMethod(mapping);
+ } else {
+ Selector callToMatch = new Selector.call("", element.getLibrary(), 0);
+ if (!callToMatch.applies(superMember, compiler)) {
+ MessageKind kind = MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT;
+ compiler.reportError(node, kind);
+ superMember = new ErroneousElementX(kind, {}, '', element);
+ }
}
FunctionElement constructor =
new SynthesizedConstructorElementX.forDefault(superMember, element);
« no previous file with comments | « no previous file | tests/language/constructor10_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698