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

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: Add more checking. 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') | tests/language/constructor10_test.dart » ('J')
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..e596b6e9e44ac7caee09a4497b760f010318ff71 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -3879,8 +3879,10 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
calculateAllSupertypes(element);
if (!element.hasConstructor) {
- Element superMember =
- element.superclass.localLookup('');
+ Element superMember = element.superclass.localLookup('');
+ FunctionElement constructor =
+ new SynthesizedConstructorElementX.forDefault(superMember, element);
+ element.setDefaultConstructor(constructor, compiler);
if (superMember == null || !superMember.isGenerativeConstructor()) {
DualKind kind = MessageKind.CANNOT_FIND_CONSTRUCTOR;
Map arguments = {'constructorName': ''};
@@ -3890,10 +3892,16 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
superMember = new ErroneousElementX(
kind.error, arguments, '', element);
compiler.backend.registerThrowNoSuchMethod(mapping);
+ } else {
+ Selector callToMatch = new Selector.call(
+ "",
karlklose 2014/02/12 12:51:58 Can you fit the arguments on one line?
floitsch 2014/02/12 14:04:52 Done.
+ element.getLibrary(),
+ 0);
+ if (!callToMatch.applies(superMember, compiler)) {
+ MessageKind kind = MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT;
+ compiler.reportError(node, kind);
+ }
}
- FunctionElement constructor =
floitsch 2014/02/11 19:30:31 Moved these lines before the tests. Could move the
- new SynthesizedConstructorElementX.forDefault(superMember, element);
- element.setDefaultConstructor(constructor, compiler);
}
return element.computeType(compiler);
}
« no previous file with comments | « no previous file | tests/language/constructor10_test.dart » ('j') | tests/language/constructor10_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698