| 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 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2005 $globals.world.error(('' + baseType.get$name() + ' is not generic'), typeR
ef.span); | 2005 $globals.world.error(('' + baseType.get$name() + ' is not generic'), typeR
ef.span); |
| 2006 return null; | 2006 return null; |
| 2007 } | 2007 } |
| 2008 if (typeRef.typeArguments.length != baseType.get$typeParameters().length) { | 2008 if (typeRef.typeArguments.length != baseType.get$typeParameters().length) { |
| 2009 $globals.world.error('wrong number of type arguments', typeRef.span); | 2009 $globals.world.error('wrong number of type arguments', typeRef.span); |
| 2010 return null; | 2010 return null; |
| 2011 } | 2011 } |
| 2012 var typeArgs = []; | 2012 var typeArgs = []; |
| 2013 for (var i = 0; | 2013 for (var i = 0; |
| 2014 i < typeRef.typeArguments.length; i++) { | 2014 i < typeRef.typeArguments.length; i++) { |
| 2015 var extendsType = baseType.get$typeParameters().$index(i).get$extendsType(
); | 2015 typeArgs.add$1(this.resolveType(typeRef.typeArguments.$index(i), typeError
s)); |
| 2016 var typeArg = this.resolveType(typeRef.typeArguments.$index(i), typeErrors
); | |
| 2017 typeArgs.add$1(typeArg); | |
| 2018 if ($ne(extendsType, null) && !(typeArg instanceof ParameterType)) { | |
| 2019 typeArg.ensureSubtypeOf$3(extendsType, typeRef.typeArguments.$index(i).g
et$span(), typeErrors); | |
| 2020 } | |
| 2021 } | 2016 } |
| 2022 typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs); | 2017 typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs); |
| 2023 } | 2018 } |
| 2024 else if ((node instanceof FunctionTypeReference)) { | 2019 else if ((node instanceof FunctionTypeReference)) { |
| 2025 var typeRef = node; | 2020 var typeRef = node; |
| 2026 var name = ''; | 2021 var name = ''; |
| 2027 if (typeRef.func.name != null) { | 2022 if (typeRef.func.name != null) { |
| 2028 name = typeRef.func.name.name; | 2023 name = typeRef.func.name.name; |
| 2029 } | 2024 } |
| 2030 typeRef.type = this.get$library().getOrAddFunctionType(this, name, typeRef.f
unc); | 2025 typeRef.type = this.get$library().getOrAddFunctionType(this, name, typeRef.f
unc); |
| (...skipping 8447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10478 } | 10473 } |
| 10479 Type.prototype.get$hasNativeSubtypes = function() { | 10474 Type.prototype.get$hasNativeSubtypes = function() { |
| 10480 if (this._hasNativeSubtypes == null) { | 10475 if (this._hasNativeSubtypes == null) { |
| 10481 this._hasNativeSubtypes = this.get$subtypes().some((function (t) { | 10476 this._hasNativeSubtypes = this.get$subtypes().some((function (t) { |
| 10482 return t.get$isNative(); | 10477 return t.get$isNative(); |
| 10483 }) | 10478 }) |
| 10484 ); | 10479 ); |
| 10485 } | 10480 } |
| 10486 return this._hasNativeSubtypes; | 10481 return this._hasNativeSubtypes; |
| 10487 } | 10482 } |
| 10483 Type.prototype._checkExtends = function() { |
| 10484 var typeParams = this.get$genericType().typeParameters; |
| 10485 if ($ne(typeParams, null) && $ne(this.get$typeArgsInOrder(), null)) { |
| 10486 var args = this.get$typeArgsInOrder().iterator$0(); |
| 10487 var params = typeParams.iterator$0(); |
| 10488 while (args.hasNext$0() && params.hasNext$0()) { |
| 10489 var typeParam = params.next$0(); |
| 10490 var typeArg = args.next$0(); |
| 10491 if ($ne(typeParam.get$extendsType(), null) && $ne(typeArg, null)) { |
| 10492 typeArg.ensureSubtypeOf$3(typeParam.get$extendsType(), typeParam.get$spa
n(), true); |
| 10493 } |
| 10494 } |
| 10495 } |
| 10496 if (this.get$interfaces() != null) { |
| 10497 var $$list = this.get$interfaces(); |
| 10498 for (var $$i = 0;$$i < $$list.length; $$i++) { |
| 10499 var i = $$list.$index($$i); |
| 10500 i._checkExtends(); |
| 10501 } |
| 10502 } |
| 10503 } |
| 10488 Type.prototype._checkOverride = function(member) { | 10504 Type.prototype._checkOverride = function(member) { |
| 10489 var parentMember = this._getMemberInParents(member.name); | 10505 var parentMember = this._getMemberInParents(member.name); |
| 10490 if ($ne(parentMember, null)) { | 10506 if ($ne(parentMember, null)) { |
| 10491 if (!member.get$isPrivate() || $eq(member.get$library(), parentMember.get$li
brary())) { | 10507 if (!member.get$isPrivate() || $eq(member.get$library(), parentMember.get$li
brary())) { |
| 10492 member.override(parentMember); | 10508 member.override(parentMember); |
| 10493 } | 10509 } |
| 10494 } | 10510 } |
| 10495 } | 10511 } |
| 10496 Type.prototype._createNotEqualMember = function() { | 10512 Type.prototype._createNotEqualMember = function() { |
| 10497 var eq = this.get$members().$index(':eq'); | 10513 var eq = this.get$members().$index(':eq'); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10842 NonNullableType.prototype.addDirectSubtype$1 = NonNullableType.prototype.addDire
ctSubtype; | 10858 NonNullableType.prototype.addDirectSubtype$1 = NonNullableType.prototype.addDire
ctSubtype; |
| 10843 NonNullableType.prototype.getConstructor$1 = NonNullableType.prototype.getConstr
uctor; | 10859 NonNullableType.prototype.getConstructor$1 = NonNullableType.prototype.getConstr
uctor; |
| 10844 NonNullableType.prototype.getFactory$2 = NonNullableType.prototype.getFactory; | 10860 NonNullableType.prototype.getFactory$2 = NonNullableType.prototype.getFactory; |
| 10845 NonNullableType.prototype.getMember$1 = NonNullableType.prototype.getMember; | 10861 NonNullableType.prototype.getMember$1 = NonNullableType.prototype.getMember; |
| 10846 NonNullableType.prototype.getOrMakeConcreteType$1 = NonNullableType.prototype.ge
tOrMakeConcreteType; | 10862 NonNullableType.prototype.getOrMakeConcreteType$1 = NonNullableType.prototype.ge
tOrMakeConcreteType; |
| 10847 NonNullableType.prototype.isSubtypeOf$1 = NonNullableType.prototype.isSubtypeOf; | 10863 NonNullableType.prototype.isSubtypeOf$1 = NonNullableType.prototype.isSubtypeOf; |
| 10848 NonNullableType.prototype.markUsed$0 = NonNullableType.prototype.markUsed; | 10864 NonNullableType.prototype.markUsed$0 = NonNullableType.prototype.markUsed; |
| 10849 NonNullableType.prototype.resolveTypeParams$1 = NonNullableType.prototype.resolv
eTypeParams; | 10865 NonNullableType.prototype.resolveTypeParams$1 = NonNullableType.prototype.resolv
eTypeParams; |
| 10850 // ********** Code for ConcreteType ************** | 10866 // ********** Code for ConcreteType ************** |
| 10851 function ConcreteType(name, genericType, typeArguments, typeArgsInOrder) { | 10867 function ConcreteType(name, genericType, typeArguments, typeArgsInOrder) { |
| 10868 this.isUsed = false |
| 10852 this.genericType = genericType; | 10869 this.genericType = genericType; |
| 10853 this.typeArguments = typeArguments; | 10870 this.typeArguments = typeArguments; |
| 10854 this.typeArgsInOrder = typeArgsInOrder; | 10871 this.typeArgsInOrder = typeArgsInOrder; |
| 10855 this.constructors = new HashMapImplementation(); | 10872 this.constructors = new HashMapImplementation(); |
| 10856 this.members = new HashMapImplementation(); | 10873 this.members = new HashMapImplementation(); |
| 10857 this.factories = new FactoryMap(); | 10874 this.factories = new FactoryMap(); |
| 10858 // Initializers done | 10875 // Initializers done |
| 10859 Type.call(this, name); | 10876 Type.call(this, name); |
| 10860 } | 10877 } |
| 10861 $inherits(ConcreteType, Type); | 10878 $inherits(ConcreteType, Type); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 10873 } | 10890 } |
| 10874 ConcreteType.prototype.get$span = function() { | 10891 ConcreteType.prototype.get$span = function() { |
| 10875 return this.genericType.get$span(); | 10892 return this.genericType.get$span(); |
| 10876 } | 10893 } |
| 10877 ConcreteType.prototype.get$hasTypeParams = function() { | 10894 ConcreteType.prototype.get$hasTypeParams = function() { |
| 10878 return this.typeArguments.getValues().some$1((function (e) { | 10895 return this.typeArguments.getValues().some$1((function (e) { |
| 10879 return (e instanceof ParameterType); | 10896 return (e instanceof ParameterType); |
| 10880 }) | 10897 }) |
| 10881 ); | 10898 ); |
| 10882 } | 10899 } |
| 10900 ConcreteType.prototype.get$isUsed = function() { return this.isUsed; }; |
| 10901 ConcreteType.prototype.set$isUsed = function(value) { return this.isUsed = value
; }; |
| 10883 ConcreteType.prototype.get$members = function() { return this.members; }; | 10902 ConcreteType.prototype.get$members = function() { return this.members; }; |
| 10884 ConcreteType.prototype.set$members = function(value) { return this.members = val
ue; }; | 10903 ConcreteType.prototype.set$members = function(value) { return this.members = val
ue; }; |
| 10885 ConcreteType.prototype.get$constructors = function() { return this.constructors;
}; | 10904 ConcreteType.prototype.get$constructors = function() { return this.constructors;
}; |
| 10886 ConcreteType.prototype.set$constructors = function(value) { return this.construc
tors = value; }; | 10905 ConcreteType.prototype.set$constructors = function(value) { return this.construc
tors = value; }; |
| 10887 ConcreteType.prototype.get$factories = function() { return this.factories; }; | 10906 ConcreteType.prototype.get$factories = function() { return this.factories; }; |
| 10888 ConcreteType.prototype.set$factories = function(value) { return this.factories =
value; }; | 10907 ConcreteType.prototype.set$factories = function(value) { return this.factories =
value; }; |
| 10889 ConcreteType.prototype.resolveTypeParams = function(inType) { | 10908 ConcreteType.prototype.resolveTypeParams = function(inType) { |
| 10890 var newTypeArgs = []; | 10909 var newTypeArgs = []; |
| 10891 var needsNewType = false; | 10910 var needsNewType = false; |
| 10892 var $$list = this.typeArgsInOrder; | 10911 var $$list = this.typeArgsInOrder; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10939 for (var $$i = result.getKeys$0().iterator$0(); $$i.hasNext$0(); ) { | 10958 for (var $$i = result.getKeys$0().iterator$0(); $$i.hasNext$0(); ) { |
| 10940 var memberName = $$i.next$0(); | 10959 var memberName = $$i.next$0(); |
| 10941 var myMember = this.members.$index(memberName); | 10960 var myMember = this.members.$index(memberName); |
| 10942 if ($ne(myMember, null)) { | 10961 if ($ne(myMember, null)) { |
| 10943 result.$setindex(memberName, myMember); | 10962 result.$setindex(memberName, myMember); |
| 10944 } | 10963 } |
| 10945 } | 10964 } |
| 10946 return result; | 10965 return result; |
| 10947 } | 10966 } |
| 10948 ConcreteType.prototype.markUsed = function() { | 10967 ConcreteType.prototype.markUsed = function() { |
| 10968 if (this.isUsed) return; |
| 10969 this.isUsed = true; |
| 10970 this._checkExtends(); |
| 10949 this.genericType.markUsed(); | 10971 this.genericType.markUsed(); |
| 10950 } | 10972 } |
| 10951 ConcreteType.prototype.genMethod = function(method) { | 10973 ConcreteType.prototype.genMethod = function(method) { |
| 10952 this.genericType.genMethod(method); | 10974 return this.genericType.genMethod(method); |
| 10953 } | 10975 } |
| 10954 ConcreteType.prototype.getFactory = function(type, constructorName) { | 10976 ConcreteType.prototype.getFactory = function(type, constructorName) { |
| 10955 return this.genericType.getFactory(type, constructorName); | 10977 return this.genericType.getFactory(type, constructorName); |
| 10956 } | 10978 } |
| 10957 ConcreteType.prototype.getConstructor = function(constructorName) { | 10979 ConcreteType.prototype.getConstructor = function(constructorName) { |
| 10958 var ret = this.constructors.$index(constructorName); | 10980 var ret = this.constructors.$index(constructorName); |
| 10959 if ($ne(ret, null)) return ret; | 10981 if ($ne(ret, null)) return ret; |
| 10960 ret = this.factories.getFactory(this.name, constructorName); | 10982 ret = this.factories.getFactory(this.name, constructorName); |
| 10961 if ($ne(ret, null)) return ret; | 10983 if ($ne(ret, null)) return ret; |
| 10962 var genericMember = this.genericType.getConstructor(constructorName); | 10984 var genericMember = this.genericType.getConstructor(constructorName); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11108 } | 11130 } |
| 11109 DefinedType.prototype.getCallMethod = function() { | 11131 DefinedType.prototype.getCallMethod = function() { |
| 11110 return this.members.$index(':call'); | 11132 return this.members.$index(':call'); |
| 11111 } | 11133 } |
| 11112 DefinedType.prototype.getAllMembers = function() { | 11134 DefinedType.prototype.getAllMembers = function() { |
| 11113 return HashMapImplementation.HashMapImplementation$from$factory(this.members); | 11135 return HashMapImplementation.HashMapImplementation$from$factory(this.members); |
| 11114 } | 11136 } |
| 11115 DefinedType.prototype.markUsed = function() { | 11137 DefinedType.prototype.markUsed = function() { |
| 11116 if (this.isUsed) return; | 11138 if (this.isUsed) return; |
| 11117 this.isUsed = true; | 11139 this.isUsed = true; |
| 11140 this._checkExtends(); |
| 11118 if (this._lazyGenMethods != null) { | 11141 if (this._lazyGenMethods != null) { |
| 11119 var $$list = orderValuesByKeys(this._lazyGenMethods); | 11142 var $$list = orderValuesByKeys(this._lazyGenMethods); |
| 11120 for (var $$i = 0;$$i < $$list.length; $$i++) { | 11143 for (var $$i = 0;$$i < $$list.length; $$i++) { |
| 11121 var method = $$list.$index($$i); | 11144 var method = $$list.$index($$i); |
| 11122 $globals.world.gen.genMethod(method); | 11145 $globals.world.gen.genMethod(method); |
| 11123 } | 11146 } |
| 11124 this._lazyGenMethods = null; | 11147 this._lazyGenMethods = null; |
| 11125 } | 11148 } |
| 11126 if (this.get$parent() != null) this.get$parent().markUsed(); | 11149 if (this.get$parent() != null) this.get$parent().markUsed(); |
| 11127 } | 11150 } |
| (...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12938 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ
ueueEntry_KeyValuePair_K$V); | 12961 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ
ueueEntry_KeyValuePair_K$V); |
| 12939 // ********** Globals ************** | 12962 // ********** Globals ************** |
| 12940 function $static_init(){ | 12963 function $static_init(){ |
| 12941 } | 12964 } |
| 12942 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; | 12965 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; |
| 12943 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; | 12966 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; |
| 12944 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; | 12967 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; |
| 12945 var $globals = {}; | 12968 var $globals = {}; |
| 12946 $static_init(); | 12969 $static_init(); |
| 12947 main(); | 12970 main(); |
| OLD | NEW |