| OLD | NEW |
| 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 Loading... |
| 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))) { | 3729 if ((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); | 3730 $globals.world.error('cannot instantiate a type parameter', node.span); |
| 3735 return this._makeMissingValue(constructorName); | 3731 return this._makeMissingValue(constructorName); |
| 3736 } | 3732 } |
| 3737 var m = type.getConstructor$1(constructorName); | 3733 var m = type.getConstructor$1(constructorName); |
| 3738 if (m == null) { | 3734 if (m == null) { |
| 3739 var name = type.get$jsname(); | 3735 var name = type.get$jsname(); |
| 3740 if (type.get$isVar()) { | 3736 if (type.get$isVar()) { |
| 3741 name = typeRef.get$name().get$name(); | 3737 name = typeRef.get$name().get$name(); |
| 3742 } | 3738 } |
| 3743 $globals.world.error(('no matching constructor for ' + name), node.span); | 3739 $globals.world.error(('no matching constructor for ' + name), node.span); |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4498 Parameter.prototype.set$isInitializer = function(value) { return this.isInitiali
zer = value; }; | 4494 Parameter.prototype.set$isInitializer = function(value) { return this.isInitiali
zer = value; }; |
| 4499 Parameter.prototype.get$value = function() { return this.value; }; | 4495 Parameter.prototype.get$value = function() { return this.value; }; |
| 4500 Parameter.prototype.set$value = function(value) { return this.value = value; }; | 4496 Parameter.prototype.set$value = function(value) { return this.value = value; }; |
| 4501 Parameter.prototype.resolve = function() { | 4497 Parameter.prototype.resolve = function() { |
| 4502 this.name = this.definition.name.name; | 4498 this.name = this.definition.name.name; |
| 4503 if (this.name.startsWith('this.')) { | 4499 if (this.name.startsWith('this.')) { |
| 4504 this.name = this.name.substring(5); | 4500 this.name = this.name.substring(5); |
| 4505 this.isInitializer = true; | 4501 this.isInitializer = true; |
| 4506 } | 4502 } |
| 4507 this.type = this.method.resolveType(this.definition.type, false); | 4503 this.type = this.method.resolveType(this.definition.type, false); |
| 4508 if (this.method.get$isStatic() && this.method.get$typeParameters() == null &&
this.type.get$hasTypeParams()) { | |
| 4509 $globals.world.error('using type parameter in static context', this.definiti
on.span); | |
| 4510 } | |
| 4511 if (this.definition.value != null) { | 4504 if (this.definition.value != null) { |
| 4512 if ((this.definition.value instanceof NullExpression) && this.definition.val
ue.span.start == this.definition.span.start) { | 4505 if ((this.definition.value instanceof NullExpression) && this.definition.val
ue.span.start == this.definition.span.start) { |
| 4513 return; | 4506 return; |
| 4514 } | 4507 } |
| 4515 if (this.method.name == ':call') { | 4508 if (this.method.name == ':call') { |
| 4516 if (this.method.get$definition().get$body() == null) { | 4509 if (this.method.get$definition().get$body() == null) { |
| 4517 $globals.world.error('default value not allowed on function type', this.
definition.span); | 4510 $globals.world.error('default value not allowed on function type', this.
definition.span); |
| 4518 } | 4511 } |
| 4519 } | 4512 } |
| 4520 else if (this.method.get$isAbstract()) { | 4513 else if (this.method.get$isAbstract()) { |
| (...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5861 for (var $$i = 0;$$i < $$list.length; $$i++) { | 5854 for (var $$i = 0;$$i < $$list.length; $$i++) { |
| 5862 var formal = $$list.$index($$i); | 5855 var formal = $$list.$index($$i); |
| 5863 var param = new Parameter(formal, this); | 5856 var param = new Parameter(formal, this); |
| 5864 param.resolve$0(); | 5857 param.resolve$0(); |
| 5865 this.parameters.add(param); | 5858 this.parameters.add(param); |
| 5866 } | 5859 } |
| 5867 if (!this.isLambda) { | 5860 if (!this.isLambda) { |
| 5868 this.get$library()._addMember(this); | 5861 this.get$library()._addMember(this); |
| 5869 } | 5862 } |
| 5870 } | 5863 } |
| 5864 MethodMember.prototype.resolveType = function(node, typeErrors) { |
| 5865 var t = Element.prototype.resolveType.call(this, node, typeErrors); |
| 5866 if (this.isStatic && (t instanceof ParameterType) && (this.typeParameters == n
ull || !this.typeParameters.some((function (p) { |
| 5867 return p === t; |
| 5868 }) |
| 5869 ))) { |
| 5870 $globals.world.error('using type parameter in static context.', node.span); |
| 5871 } |
| 5872 return t; |
| 5873 } |
| 5871 MethodMember.prototype._get$3 = function($0, $1, $2) { | 5874 MethodMember.prototype._get$3 = function($0, $1, $2) { |
| 5872 return this._get($0, $1, $2, false); | 5875 return this._get($0, $1, $2, false); |
| 5873 }; | 5876 }; |
| 5874 MethodMember.prototype._get$3$isDynamic = MethodMember.prototype._get; | 5877 MethodMember.prototype._get$3$isDynamic = MethodMember.prototype._get; |
| 5875 MethodMember.prototype._get$4 = MethodMember.prototype._get; | 5878 MethodMember.prototype._get$4 = MethodMember.prototype._get; |
| 5876 MethodMember.prototype._set$4 = function($0, $1, $2, $3) { | 5879 MethodMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 5877 return this._set($0, $1, $2, $3, false); | 5880 return this._set($0, $1, $2, $3, false); |
| 5878 }; | 5881 }; |
| 5879 MethodMember.prototype._set$4$isDynamic = MethodMember.prototype._set; | 5882 MethodMember.prototype._set$4$isDynamic = MethodMember.prototype._set; |
| 5880 MethodMember.prototype._set$5 = MethodMember.prototype._set; | 5883 MethodMember.prototype._set$5 = MethodMember.prototype._set; |
| (...skipping 7244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13125 $globals._MAGENTA_COLOR = '\u001b[35m'; | 13128 $globals._MAGENTA_COLOR = '\u001b[35m'; |
| 13126 $globals._NO_COLOR = '\u001b[0m'; | 13129 $globals._NO_COLOR = '\u001b[0m'; |
| 13127 $globals._RED_COLOR = '\u001b[31m'; | 13130 $globals._RED_COLOR = '\u001b[31m'; |
| 13128 } | 13131 } |
| 13129 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; | 13132 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; |
| 13130 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; | 13133 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; |
| 13131 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; | 13134 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; |
| 13132 var $globals = {}; | 13135 var $globals = {}; |
| 13133 $static_init(); | 13136 $static_init(); |
| 13134 main(); | 13137 main(); |
| OLD | NEW |