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

Unified Diff: lib/compiler/implementation/resolver.dart

Issue 10970006: Correctly handle const constructors with type parameters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « lib/compiler/implementation/lib/math_patch.dart ('k') | lib/compiler/implementation/scanner/listener.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/resolver.dart
===================================================================
--- lib/compiler/implementation/resolver.dart (revision 12694)
+++ lib/compiler/implementation/resolver.dart (working copy)
@@ -2604,10 +2604,12 @@
class ConstructorResolver extends CommonResolverVisitor<Element> {
final ResolverVisitor resolver;
+ // TODO(ngeoffray): have this context at the call site.
final bool inConstContext;
- ConstructorResolver(Compiler compiler, this.resolver,
- [bool this.inConstContext = false])
+ ConstructorResolver(Compiler compiler,
+ this.resolver,
+ this.inConstContext)
: super(compiler);
visitNode(Node node) {
@@ -2627,6 +2629,7 @@
}
}
+ // TODO(ngeoffray): method named lookup should not report errors.
FunctionElement lookupConstructor(ClassElement cls,
Node diagnosticNode,
SourceString constructorName) {
@@ -2642,6 +2645,9 @@
new SourceString(fullConstructorName),
MessageKind.CANNOT_FIND_CONSTRUCTOR,
[fullConstructorName]);
+ } else if (inConstContext &&
+ (result.modifiers == null || !result.modifiers.isConst())) {
+ error(diagnosticNode, MessageKind.CONSTRUCTOR_IS_NOT_CONST);
}
return result;
}
« no previous file with comments | « lib/compiler/implementation/lib/math_patch.dart ('k') | lib/compiler/implementation/scanner/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698