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

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

Issue 19802003: Report an error if a const constructor calls a non-const constructor. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.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
===================================================================
--- sdk/lib/_internal/compiler/implementation/resolution/members.dart (revision 25202)
+++ sdk/lib/_internal/compiler/implementation/resolution/members.dart (working copy)
@@ -1087,7 +1087,8 @@
final bool isImplicitSuperCall = false;
final SourceString className = lookupTarget.name;
- verifyThatConstructorMatchesCall(calledConstructor,
+ verifyThatConstructorMatchesCall(constructor,
+ calledConstructor,
selector,
isImplicitSuperCall,
call,
@@ -1124,7 +1125,8 @@
final SourceString className = lookupTarget.name;
final bool isImplicitSuperCall = true;
- verifyThatConstructorMatchesCall(calledConstructor,
+ verifyThatConstructorMatchesCall(constructor,
+ calledConstructor,
callToMatch,
isImplicitSuperCall,
functionNode,
@@ -1136,6 +1138,7 @@
}
void verifyThatConstructorMatchesCall(
+ FunctionElement caller,
FunctionElement lookedupConstructor,
Selector call,
bool isImplicitSuperCall,
@@ -1159,6 +1162,10 @@
? MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT
: MessageKind.NO_MATCHING_CONSTRUCTOR;
visitor.compiler.reportErrorCode(diagnosticNode, kind);
+ } else if (caller.modifiers.isConst()
+ && !lookedupConstructor.modifiers.isConst()) {
+ visitor.compiler.reportErrorCode(
+ diagnosticNode, MessageKind.CONST_CALLS_NON_CONST);
}
}
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698