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

Unified Diff: frog/minfrog

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/member.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/minfrog
diff --git a/frog/minfrog b/frog/minfrog
index bec1e7b771fbcfc91d8d4b18b964d7c98c7f1210..1283e510429aab025ba66e2f51b32bf472416fb8 100755
--- a/frog/minfrog
+++ b/frog/minfrog
@@ -3726,11 +3726,7 @@ MethodGenerator.prototype.visitNewExpression = function(node) {
type = type.get$library().findTypeByName$1(constructorName);
constructorName = '';
}
- if (this.method.get$isStatic() && ((this.method.get$typeParameters() == null && type.get$hasTypeParams()) || (type instanceof ParameterType))) {
- $globals.world.error('using type parameter in static context', node.span);
- return this._makeMissingValue(constructorName);
- }
- else if ((type instanceof ParameterType)) {
+ if ((type instanceof ParameterType)) {
$globals.world.error('cannot instantiate a type parameter', node.span);
return this._makeMissingValue(constructorName);
}
@@ -4505,9 +4501,6 @@ Parameter.prototype.resolve = function() {
this.isInitializer = true;
}
this.type = this.method.resolveType(this.definition.type, false);
- if (this.method.get$isStatic() && this.method.get$typeParameters() == null && this.type.get$hasTypeParams()) {
- $globals.world.error('using type parameter in static context', this.definition.span);
- }
if (this.definition.value != null) {
if ((this.definition.value instanceof NullExpression) && this.definition.value.span.start == this.definition.span.start) {
return;
@@ -5868,6 +5861,16 @@ MethodMember.prototype.resolve = function() {
this.get$library()._addMember(this);
}
}
+MethodMember.prototype.resolveType = function(node, typeErrors) {
+ var t = Element.prototype.resolveType.call(this, node, typeErrors);
+ if (this.isStatic && (t instanceof ParameterType) && (this.typeParameters == null || !this.typeParameters.some((function (p) {
+ return p === t;
+ })
+ ))) {
+ $globals.world.error('using type parameter in static context.', node.span);
+ }
+ return t;
+}
MethodMember.prototype._get$3 = function($0, $1, $2) {
return this._get($0, $1, $2, false);
};
« no previous file with comments | « frog/member.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698