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

Unified Diff: frog/member.dart

Issue 8826014: frog: generalize checking that type args aren't used in static methods (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 | « frog/gen.dart ('k') | frog/minfrog » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/member.dart
diff --git a/frog/member.dart b/frog/member.dart
index d93f4aa51a6a9c3c792981202300734c9d2523ee..c6b0c1d0dea7982d35cb6cb8387982b62a35861b 100644
--- a/frog/member.dart
+++ b/frog/member.dart
@@ -24,10 +24,6 @@ class Parameter {
type = method.resolveType(definition.type, false);
- if (method.isStatic && method.typeParameters === null && type.hasTypeParams) {
- world.error('using type parameter in static context', definition.span);
- }
-
if (definition.value != null) {
// To match VM, detect cases where value was not actually specified in
// code and don't signal errors.
@@ -1390,6 +1386,16 @@ class MethodMember extends Member {
library._addMember(this);
}
}
+
+ /** Overriden to ensure that type arguments aren't used in static methods. */
+ Type resolveType(TypeReference node, bool typeErrors) {
+ Type t = super.resolveType(node, typeErrors);
+ if (isStatic && t is ParameterType &&
+ (typeParameters === null || !typeParameters.some((p) => p === t))) {
+ world.error('using type parameter in static context.', node.span);
+ }
+ return t;
+ }
}
« no previous file with comments | « frog/gen.dart ('k') | frog/minfrog » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698