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

Unified Diff: frog/minfrog

Issue 8826001: frog bug 642: type variables can't be used in allocations. (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
« frog/gen.dart ('K') | « frog/gen.dart ('k') | frog/type.dart » ('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 34f489b4461fab4e7620abd762a627a52b40ac4d..69cd4ef05de2e902d6d249d0f978b177e4436ca7 100755
--- a/frog/minfrog
+++ b/frog/minfrog
@@ -3726,6 +3726,14 @@ 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)) {
+ $globals.world.error('cannot instantiate a type parameter', node.span);
+ return this._makeMissingValue(constructorName);
+ }
var m = type.getConstructor$1(constructorName);
if (m == null) {
var name = type.get$jsname();
@@ -4524,7 +4532,7 @@ Parameter.prototype.genValue = function(method, context) {
}
this.value = this.definition.value.visit(context);
if (!this.value.get$isConst()) {
- $globals.world.error('default arguments must be constant', this.value.span);
+ $globals.world.error('default parameter values must be constant', this.value.span);
}
this.value = this.value.convertTo(context, this.type, this.definition.value, false);
}
« frog/gen.dart ('K') | « frog/gen.dart ('k') | frog/type.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698