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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env node 1 #!/usr/bin/env node
2 // ********** Library dart:core ************** 2 // ********** Library dart:core **************
3 // ********** Natives dart:core ************** 3 // ********** Natives dart:core **************
4 /** 4 /**
5 * Generates a dynamic call stub for a function. 5 * Generates a dynamic call stub for a function.
6 * Our goal is to create a stub method like this on-the-fly: 6 * Our goal is to create a stub method like this on-the-fly:
7 * function($0, $1, capture) { return this($0, $1, true, capture); } 7 * function($0, $1, capture) { return this($0, $1, true, capture); }
8 * 8 *
9 * This stub then replaces the dynamic one on Function, with one that is 9 * This stub then replaces the dynamic one on Function, with one that is
10 * specialized for that particular function, taking into account its default 10 * specialized for that particular function, taking into account its default
(...skipping 3708 matching lines...) Expand 10 before | Expand all | Expand 10 after
3719 var names = ListFactory.ListFactory$from$factory(typeRef.get$names()); 3719 var names = ListFactory.ListFactory$from$factory(typeRef.get$names());
3720 constructorName = names.removeLast$0().get$name(); 3720 constructorName = names.removeLast$0().get$name();
3721 if ($eq(names.length, 0)) names = null; 3721 if ($eq(names.length, 0)) names = null;
3722 typeRef = new NameTypeReference(typeRef.get$isFinal(), typeRef.get$name(), n ames, typeRef.get$span()); 3722 typeRef = new NameTypeReference(typeRef.get$isFinal(), typeRef.get$name(), n ames, typeRef.get$span());
3723 } 3723 }
3724 var type = this.method.resolveType(typeRef, true); 3724 var type = this.method.resolveType(typeRef, true);
3725 if (type.get$isTop()) { 3725 if (type.get$isTop()) {
3726 type = type.get$library().findTypeByName$1(constructorName); 3726 type = type.get$library().findTypeByName$1(constructorName);
3727 constructorName = ''; 3727 constructorName = '';
3728 } 3728 }
3729 if (this.method.get$isStatic() && ((this.method.get$typeParameters() == null & & type.get$hasTypeParams()) || (type instanceof ParameterType))) {
3730 $globals.world.error('using type parameter in static context', node.span);
3731 return this._makeMissingValue(constructorName);
3732 }
3733 else if ((type instanceof ParameterType)) {
3734 $globals.world.error('cannot instantiate a type parameter', node.span);
3735 return this._makeMissingValue(constructorName);
3736 }
3729 var m = type.getConstructor$1(constructorName); 3737 var m = type.getConstructor$1(constructorName);
3730 if (m == null) { 3738 if (m == null) {
3731 var name = type.get$jsname(); 3739 var name = type.get$jsname();
3732 if (type.get$isVar()) { 3740 if (type.get$isVar()) {
3733 name = typeRef.get$name().get$name(); 3741 name = typeRef.get$name().get$name();
3734 } 3742 }
3735 $globals.world.error(('no matching constructor for ' + name), node.span); 3743 $globals.world.error(('no matching constructor for ' + name), node.span);
3736 return this._makeMissingValue(name); 3744 return this._makeMissingValue(name);
3737 } 3745 }
3738 if (node.isConst) { 3746 if (node.isConst) {
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
4517 $globals.world.error('initializer parameters only allowed on constructors', this.definition.span); 4525 $globals.world.error('initializer parameters only allowed on constructors', this.definition.span);
4518 } 4526 }
4519 } 4527 }
4520 Parameter.prototype.genValue = function(method, context) { 4528 Parameter.prototype.genValue = function(method, context) {
4521 if (this.definition.value == null || this.value != null) return; 4529 if (this.definition.value == null || this.value != null) return;
4522 if (context == null) { 4530 if (context == null) {
4523 context = new MethodGenerator(method, null); 4531 context = new MethodGenerator(method, null);
4524 } 4532 }
4525 this.value = this.definition.value.visit(context); 4533 this.value = this.definition.value.visit(context);
4526 if (!this.value.get$isConst()) { 4534 if (!this.value.get$isConst()) {
4527 $globals.world.error('default arguments must be constant', this.value.span); 4535 $globals.world.error('default parameter values must be constant', this.value .span);
4528 } 4536 }
4529 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse); 4537 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse);
4530 } 4538 }
4531 Parameter.prototype.copyWithNewType = function(newMethod, newType) { 4539 Parameter.prototype.copyWithNewType = function(newMethod, newType) {
4532 var ret = new Parameter(this.definition, newMethod); 4540 var ret = new Parameter(this.definition, newMethod);
4533 ret.set$type(newType); 4541 ret.set$type(newType);
4534 ret.set$name(this.name); 4542 ret.set$name(this.name);
4535 ret.set$isInitializer(this.isInitializer); 4543 ret.set$isInitializer(this.isInitializer);
4536 return ret; 4544 return ret;
4537 } 4545 }
(...skipping 8549 matching lines...) Expand 10 before | Expand all | Expand 10 after
13087 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ ueueEntry_KeyValuePair_K$V); 13095 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ ueueEntry_KeyValuePair_K$V);
13088 // ********** Globals ************** 13096 // ********** Globals **************
13089 function $static_init(){ 13097 function $static_init(){
13090 } 13098 }
13091 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; 13099 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/;
13092 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; 13100 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/;
13093 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; 13101 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/;
13094 var $globals = {}; 13102 var $globals = {};
13095 $static_init(); 13103 $static_init();
13096 main(); 13104 main();
OLDNEW
« 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