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) { this($0, $1, true, capture); } | 7 * function($0, $1, capture) { 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 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 } | 1085 } |
1086 ImmutableMap.prototype.getValues = function() { | 1086 ImmutableMap.prototype.getValues = function() { |
1087 return this._internal.getValues(); | 1087 return this._internal.getValues(); |
1088 } | 1088 } |
1089 ImmutableMap.prototype.containsKey = function(key) { | 1089 ImmutableMap.prototype.containsKey = function(key) { |
1090 return this._internal.containsKey(key); | 1090 return this._internal.containsKey(key); |
1091 } | 1091 } |
1092 ImmutableMap.prototype.$setindex = function(key, value) { | 1092 ImmutableMap.prototype.$setindex = function(key, value) { |
1093 $throw(const$14/*const IllegalAccessException()*/); | 1093 $throw(const$14/*const IllegalAccessException()*/); |
1094 } | 1094 } |
| 1095 ImmutableMap.prototype.putIfAbsent = function(key, ifAbsent) { |
| 1096 $throw(const$14/*const IllegalAccessException()*/); |
| 1097 } |
1095 ImmutableMap.prototype.forEach$1 = ImmutableMap.prototype.forEach; | 1098 ImmutableMap.prototype.forEach$1 = ImmutableMap.prototype.forEach; |
1096 ImmutableMap.prototype.getKeys$0 = function() { | 1099 ImmutableMap.prototype.getKeys$0 = function() { |
1097 return this.getKeys(); | 1100 return this.getKeys(); |
1098 }; | 1101 }; |
1099 ImmutableMap.prototype.isEmpty$0 = function() { | 1102 ImmutableMap.prototype.isEmpty$0 = function() { |
1100 return this.isEmpty(); | 1103 return this.isEmpty(); |
1101 }; | 1104 }; |
1102 // ********** Code for NumImplementation ************** | 1105 // ********** Code for NumImplementation ************** |
1103 NumImplementation = Number; | 1106 NumImplementation = Number; |
1104 NumImplementation.prototype.is$NumImplementation = function(){return this;}; | 1107 NumImplementation.prototype.is$NumImplementation = function(){return this;}; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 this._numberOfEntries++; | 1287 this._numberOfEntries++; |
1285 } | 1288 } |
1286 this._keys.$setindex(index, key); | 1289 this._keys.$setindex(index, key); |
1287 this._values.$setindex(index, value); | 1290 this._values.$setindex(index, value); |
1288 } | 1291 } |
1289 HashMapImplementation.prototype.$index = function(key) { | 1292 HashMapImplementation.prototype.$index = function(key) { |
1290 var index = this._probeForLookup(key); | 1293 var index = this._probeForLookup(key); |
1291 if (index < 0) return null; | 1294 if (index < 0) return null; |
1292 return this._values.$index(index); | 1295 return this._values.$index(index); |
1293 } | 1296 } |
| 1297 HashMapImplementation.prototype.putIfAbsent = function(key, ifAbsent) { |
| 1298 var index = this._probeForLookup(key); |
| 1299 if (index >= 0) return this._values.$index(index); |
| 1300 var value = ifAbsent(); |
| 1301 this.$setindex(key, value); |
| 1302 return value; |
| 1303 } |
1294 HashMapImplementation.prototype.remove = function(key) { | 1304 HashMapImplementation.prototype.remove = function(key) { |
1295 var index = this._probeForLookup(key); | 1305 var index = this._probeForLookup(key); |
1296 if (index >= 0) { | 1306 if (index >= 0) { |
1297 this._numberOfEntries--; | 1307 this._numberOfEntries--; |
1298 var value = this._values.$index(index); | 1308 var value = this._values.$index(index); |
1299 this._values.$setindex(index); | 1309 this._values.$setindex(index); |
1300 this._keys.$setindex(index, const$1/*HashMapImplementation._DELETED_KEY*/); | 1310 this._keys.$setindex(index, const$1/*HashMapImplementation._DELETED_KEY*/); |
1301 this._numberOfDeleted++; | 1311 this._numberOfDeleted++; |
1302 return value; | 1312 return value; |
1303 } | 1313 } |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 this._list.addLast(new KeyValuePair$K$V(key, value)); | 1732 this._list.addLast(new KeyValuePair$K$V(key, value)); |
1723 this._map.$setindex(key, this._list.lastEntry()); | 1733 this._map.$setindex(key, this._list.lastEntry()); |
1724 } | 1734 } |
1725 } | 1735 } |
1726 LinkedHashMapImplementation.prototype.$index = function(key) { | 1736 LinkedHashMapImplementation.prototype.$index = function(key) { |
1727 var $0; | 1737 var $0; |
1728 var entry = (($0 = this._map.$index(key)) && $0.is$DoubleLinkedQueueEntry$KeyV
aluePair$K$V()); | 1738 var entry = (($0 = this._map.$index(key)) && $0.is$DoubleLinkedQueueEntry$KeyV
aluePair$K$V()); |
1729 if (entry == null) return null; | 1739 if (entry == null) return null; |
1730 return entry.get$element().get$value(); | 1740 return entry.get$element().get$value(); |
1731 } | 1741 } |
| 1742 LinkedHashMapImplementation.prototype.putIfAbsent = function(key, ifAbsent) { |
| 1743 var value = this.$index(key); |
| 1744 if ((this.$index(key) == null) && !(this.containsKey(key))) { |
| 1745 value = ifAbsent(); |
| 1746 this.$setindex(key, value); |
| 1747 } |
| 1748 return value; |
| 1749 } |
1732 LinkedHashMapImplementation.prototype.getKeys = function() { | 1750 LinkedHashMapImplementation.prototype.getKeys = function() { |
1733 var list = new ListFactory(this.get$length()); | 1751 var list = new ListFactory(this.get$length()); |
1734 var index = 0; | 1752 var index = 0; |
1735 this._list.forEach(function _(entry) { | 1753 this._list.forEach(function _(entry) { |
1736 list.$setindex(index++, entry.key); | 1754 list.$setindex(index++, entry.key); |
1737 } | 1755 } |
1738 ); | 1756 ); |
1739 $assert(index == this.get$length(), "index == length", "linked_hash_map.dart",
75, 12); | 1757 $assert(index == this.get$length(), "index == length", "linked_hash_map.dart",
75, 12); |
1740 return list; | 1758 return list; |
1741 } | 1759 } |
(...skipping 12448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14190 code = ('' + target.get$dynamic().get$values().isEmpty$0()); | 14208 code = ('' + target.get$dynamic().get$values().isEmpty$0()); |
14191 } | 14209 } |
14192 } | 14210 } |
14193 } | 14211 } |
14194 if (this.name == 'get\$typeName' && $eq(this.declaringType.get$library(), $glo
bals.world.get$dom())) { | 14212 if (this.name == 'get\$typeName' && $eq(this.declaringType.get$library(), $glo
bals.world.get$dom())) { |
14195 $globals.world.gen.corejs.useTypeNameOf = true; | 14213 $globals.world.gen.corejs.useTypeNameOf = true; |
14196 } | 14214 } |
14197 return new Value(this.get$inferredResult(), code, node.span, true); | 14215 return new Value(this.get$inferredResult(), code, node.span, true); |
14198 } | 14216 } |
14199 MethodMember.prototype._invokeConstructor = function(context, node, target, args
, argsString) { | 14217 MethodMember.prototype._invokeConstructor = function(context, node, target, args
, argsString) { |
| 14218 var $0; |
14200 this.declaringType.markUsed(); | 14219 this.declaringType.markUsed(); |
14201 if (!$notnull_bool(target.isType)) { | 14220 if (!$notnull_bool(target.isType)) { |
14202 var code = (this.get$constructorName() != '') ? ('' + this.declaringType.get
$jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + argsString + ')'
) : ('' + this.declaringType.get$jsname() + '.call(' + argsString + ')'); | 14221 var code = (this.get$constructorName() != '') ? ('' + this.declaringType.get
$jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + argsString + ')'
) : ('' + this.declaringType.get$jsname() + '.call(' + argsString + ')'); |
14203 return new Value(target.type, code, node.span, true); | 14222 return new Value(target.type, code, node.span, true); |
14204 } | 14223 } |
14205 else { | 14224 else { |
| 14225 if ($notnull_bool(this.declaringType.get$isAbstract())) { |
| 14226 $globals.world.warning(('Cannot instantiate abstract class ' + this.declar
ingType.name), node.span); |
| 14227 var members = groupBy((($0 = this.declaringType.get$inheritedMembers().get
Values().filter$1((function (m) { |
| 14228 return m.get$isAbstract(); |
| 14229 }) |
| 14230 )) && $0.is$Iterable()), (function (m) { |
| 14231 return m.get$declaringType(); |
| 14232 }) |
| 14233 ); |
| 14234 var msg = new StringBufferImpl(('Type ' + this.declaringType.name + ' is a
bstract ') + 'because it does not implement the following members'); |
| 14235 var types = members.getKeys$0(); |
| 14236 types.sort$1((function (x, y) { |
| 14237 return x.get$name().compareTo$1(y.get$name()); |
| 14238 }) |
| 14239 ); |
| 14240 for (var $i = types.iterator$0(); $i.hasNext$0(); ) { |
| 14241 var type = $i.next$0(); |
| 14242 if ($notnull_bool($ne(type, types.$index(0)))) msg.add$1(';'); |
| 14243 msg.add$1((' from type ' + type.get$name() + ': ')); |
| 14244 msg.add$1(Strings.join(map((($0 = members.$index(type)) && $0.is$Iterabl
e()), (function (m) { |
| 14245 return m.get$name(); |
| 14246 }) |
| 14247 ), ', ')); |
| 14248 } |
| 14249 $globals.world.warning(msg.toString$0(), this.declaringType.get$span()); |
| 14250 } |
14206 var code = (this.get$constructorName() != '') ? ('new ' + this.declaringType
.get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + argsString + ')')
: ('new ' + this.declaringType.get$jsname() + '(' + argsString + ')'); | 14251 var code = (this.get$constructorName() != '') ? ('new ' + this.declaringType
.get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + argsString + ')')
: ('new ' + this.declaringType.get$jsname() + '(' + argsString + ')'); |
14207 if ($notnull_bool(this.isConst) && (node instanceof lang_NewExpression) && $
notnull_bool(node.get$dynamic().get$isConst())) { | 14252 if ($notnull_bool(this.isConst) && (node instanceof lang_NewExpression) && $
notnull_bool(node.get$dynamic().get$isConst())) { |
14208 return this._invokeConstConstructor(node, $assert_String(code), target, ar
gs); | 14253 return this._invokeConstConstructor(node, $assert_String(code), target, ar
gs); |
14209 } | 14254 } |
14210 else { | 14255 else { |
14211 return new Value(target.type, code, node.span, true); | 14256 return new Value(target.type, code, node.span, true); |
14212 } | 14257 } |
14213 } | 14258 } |
14214 } | 14259 } |
14215 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
gs) { | 14260 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
gs) { |
(...skipping 5232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19448 } | 19493 } |
19449 lang_Type.prototype.get$parent = function() { | 19494 lang_Type.prototype.get$parent = function() { |
19450 return null; | 19495 return null; |
19451 } | 19496 } |
19452 lang_Type.prototype.getAllMembers = function() { | 19497 lang_Type.prototype.getAllMembers = function() { |
19453 return $map([]); | 19498 return $map([]); |
19454 } | 19499 } |
19455 lang_Type.prototype.hashCode = function() { | 19500 lang_Type.prototype.hashCode = function() { |
19456 return this.name.hashCode(); | 19501 return this.name.hashCode(); |
19457 } | 19502 } |
| 19503 lang_Type.prototype.get$isAbstract = function() { |
| 19504 if (this._isAbstract == null) { |
| 19505 if ($notnull_bool(this.get$isClass())) { |
| 19506 this._isAbstract = $assert_bool(this.get$inheritedMembers().getValues().so
me$1((function (m) { |
| 19507 return m.get$isAbstract(); |
| 19508 }) |
| 19509 )); |
| 19510 } |
| 19511 else { |
| 19512 this._isAbstract = true; |
| 19513 } |
| 19514 } |
| 19515 return this._isAbstract; |
| 19516 } |
| 19517 lang_Type.prototype.get$inheritedMembers = function() { |
| 19518 var $0; |
| 19519 if (this._inheritedMembers == null) { |
| 19520 this._inheritedMembers = (($0 = this._getInheritedMembers($map([]))) && $0.i
s$Map$String$Member()); |
| 19521 } |
| 19522 return this._inheritedMembers; |
| 19523 } |
| 19524 lang_Type.prototype._getInheritedMembers = function(flattened) { |
| 19525 if (this.get$interfaces() != null) { |
| 19526 var $list = this.get$interfaces(); |
| 19527 for (var $i = 0;$i < $list.length; $i++) { |
| 19528 var i = $list.$index($i); |
| 19529 i._getInheritedMembers(flattened); |
| 19530 } |
| 19531 } |
| 19532 if (this.get$parent() != null) { |
| 19533 this.get$parent()._getInheritedMembers(flattened); |
| 19534 } |
| 19535 var $list = this.getAllMembers().getValues(); |
| 19536 for (var $i = this.getAllMembers().getValues().iterator$0(); $i.hasNext$0(); )
{ |
| 19537 var m = $i.next$0(); |
| 19538 flattened.$setindex(m.get$name(), m); |
| 19539 } |
| 19540 return flattened; |
| 19541 } |
19458 lang_Type.prototype._checkOverride = function(member) { | 19542 lang_Type.prototype._checkOverride = function(member) { |
19459 var parentMember = this._getMemberInParents(member.name); | 19543 var parentMember = this._getMemberInParents(member.name); |
19460 if ($notnull_bool($ne(parentMember, null))) { | 19544 if ($notnull_bool($ne(parentMember, null))) { |
19461 if (!$notnull_bool(member.get$isPrivate()) || $eq(member.get$library(), pare
ntMember.get$library())) { | 19545 if (!$notnull_bool(member.get$isPrivate()) || $eq(member.get$library(), pare
ntMember.get$library())) { |
19462 member.override((parentMember && parentMember.is$Member())); | 19546 member.override((parentMember && parentMember.is$Member())); |
19463 } | 19547 } |
19464 } | 19548 } |
19465 } | 19549 } |
19466 lang_Type.prototype._createNotEqualMember = function() { | 19550 lang_Type.prototype._createNotEqualMember = function() { |
19467 var $0; | 19551 var $0; |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20069 DefinedType.prototype.set$constructors = function(value) { return this.construct
ors = value; }; | 20153 DefinedType.prototype.set$constructors = function(value) { return this.construct
ors = value; }; |
20070 DefinedType.prototype.get$members = function() { return this.members; }; | 20154 DefinedType.prototype.get$members = function() { return this.members; }; |
20071 DefinedType.prototype.set$members = function(value) { return this.members = valu
e; }; | 20155 DefinedType.prototype.set$members = function(value) { return this.members = valu
e; }; |
20072 DefinedType.prototype.get$factories = function() { return this.factories; }; | 20156 DefinedType.prototype.get$factories = function() { return this.factories; }; |
20073 DefinedType.prototype.set$factories = function(value) { return this.factories =
value; }; | 20157 DefinedType.prototype.set$factories = function(value) { return this.factories =
value; }; |
20074 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; | 20158 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; |
20075 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value;
}; | 20159 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value;
}; |
20076 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType;
}; | 20160 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType;
}; |
20077 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT
ype = value; }; | 20161 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT
ype = value; }; |
20078 DefinedType.prototype.setDefinition = function(def) { | 20162 DefinedType.prototype.setDefinition = function(def) { |
20079 $assert(this.definition == null, "definition == null", "type.dart", 703, 12); | 20163 $assert(this.definition == null, "definition == null", "type.dart", 747, 12); |
20080 this.definition = def; | 20164 this.definition = def; |
20081 if ((this.definition instanceof TypeDefinition) && this.definition.get$nativeT
ype() != null) { | 20165 if ((this.definition instanceof TypeDefinition) && this.definition.get$nativeT
ype() != null) { |
20082 this.isNativeType = true; | 20166 this.isNativeType = true; |
20083 } | 20167 } |
20084 if (this.definition != null && this.definition.get$typeParameters() != null) { | 20168 if (this.definition != null && this.definition.get$typeParameters() != null) { |
20085 this._concreteTypes = $map([]); | 20169 this._concreteTypes = $map([]); |
20086 this.typeParameters = []; | 20170 this.typeParameters = []; |
20087 var $list = this.definition.get$typeParameters(); | 20171 var $list = this.definition.get$typeParameters(); |
20088 for (var $i = 0;$i < $list.length; $i++) { | 20172 for (var $i = 0;$i < $list.length; $i++) { |
20089 var tp = $list.$index($i); | 20173 var tp = $list.$index($i); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20179 var resolvedInterface = this.resolveType((type && type.is$TypeReference()),
true); | 20263 var resolvedInterface = this.resolveType((type && type.is$TypeReference()),
true); |
20180 if ($notnull_bool(resolvedInterface.get$isClosed()) && !($notnull_bool(this.
library.get$isCore()) || $notnull_bool(this.library.get$isCoreImpl()))) { | 20264 if ($notnull_bool(resolvedInterface.get$isClosed()) && !($notnull_bool(this.
library.get$isCore()) || $notnull_bool(this.library.get$isCoreImpl()))) { |
20181 $globals.world.error(('can not implement "' + resolvedInterface.get$name()
+ '": ') + 'only native implementation allowed', (($0 = type.get$span()) && $0.
is$SourceSpan())); | 20265 $globals.world.error(('can not implement "' + resolvedInterface.get$name()
+ '": ') + 'only native implementation allowed', (($0 = type.get$span()) && $0.
is$SourceSpan())); |
20182 } | 20266 } |
20183 resolvedInterface.addDirectSubtype$1(this); | 20267 resolvedInterface.addDirectSubtype$1(this); |
20184 interfaces.add$1(resolvedInterface); | 20268 interfaces.add$1(resolvedInterface); |
20185 } | 20269 } |
20186 return (interfaces && interfaces.is$List$Type()); | 20270 return (interfaces && interfaces.is$List$Type()); |
20187 } | 20271 } |
20188 DefinedType.prototype.addDirectSubtype = function(type) { | 20272 DefinedType.prototype.addDirectSubtype = function(type) { |
20189 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 819, 12); | 20273 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 863, 12); |
20190 this.directSubtypes.add(type); | 20274 this.directSubtypes.add(type); |
20191 } | 20275 } |
20192 DefinedType.prototype.get$subtypes = function() { | 20276 DefinedType.prototype.get$subtypes = function() { |
20193 var $0; | 20277 var $0; |
20194 if (this._subtypes == null) { | 20278 if (this._subtypes == null) { |
20195 this._subtypes = new HashSetImplementation(); | 20279 this._subtypes = new HashSetImplementation(); |
20196 var $list = this.directSubtypes; | 20280 var $list = this.directSubtypes; |
20197 for (var $i = this.directSubtypes.iterator(); $i.hasNext$0(); ) { | 20281 for (var $i = this.directSubtypes.iterator(); $i.hasNext$0(); ) { |
20198 var st = $i.next$0(); | 20282 var st = $i.next$0(); |
20199 this._subtypes.add(st); | 20283 this._subtypes.add(st); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20557 } | 20641 } |
20558 else { | 20642 else { |
20559 $globals.world.internalError('unknown type reference', node.span); | 20643 $globals.world.internalError('unknown type reference', node.span); |
20560 } | 20644 } |
20561 return node.type; | 20645 return node.type; |
20562 } | 20646 } |
20563 DefinedType.prototype.resolveTypeParams = function(inType) { | 20647 DefinedType.prototype.resolveTypeParams = function(inType) { |
20564 return this; | 20648 return this; |
20565 } | 20649 } |
20566 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { | 20650 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { |
20567 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1248, 12); | 20651 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1292, 12); |
20568 var names = [this.name]; | 20652 var names = [this.name]; |
20569 var typeMap = $map([]); | 20653 var typeMap = $map([]); |
20570 for (var i = 0; | 20654 for (var i = 0; |
20571 i < typeArgs.length; i++) { | 20655 i < typeArgs.length; i++) { |
20572 var paramName = this.typeParameters.$index(i).get$name(); | 20656 var paramName = this.typeParameters.$index(i).get$name(); |
20573 typeMap.$setindex(paramName, typeArgs.$index(i)); | 20657 typeMap.$setindex(paramName, typeArgs.$index(i)); |
20574 names.add$1(typeArgs.$index(i).get$name()); | 20658 names.add$1(typeArgs.$index(i).get$name()); |
20575 } | 20659 } |
20576 var concreteName = Strings.join((names && names.is$List$String()), '\$'); | 20660 var concreteName = Strings.join((names && names.is$List$String()), '\$'); |
20577 var ret = this._concreteTypes.$index(concreteName); | 20661 var ret = this._concreteTypes.$index(concreteName); |
20578 if ($notnull_bool(ret == null)) { | 20662 if ($notnull_bool(ret == null)) { |
20579 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs
); | 20663 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs
); |
20580 this._concreteTypes.$setindex(concreteName, ret); | 20664 this._concreteTypes.$setindex(concreteName, ret); |
20581 } | 20665 } |
20582 return (ret && ret.is$lang_Type()); | 20666 return (ret && ret.is$lang_Type()); |
20583 } | 20667 } |
20584 DefinedType.prototype.getCallStub = function(args) { | 20668 DefinedType.prototype.getCallStub = function(args) { |
20585 $assert(this.get$isFunction(), "isFunction", "type.dart", 1268, 12); | 20669 $assert(this.get$isFunction(), "isFunction", "type.dart", 1312, 12); |
20586 var name = _getCallStubName('call', args); | 20670 var name = _getCallStubName('call', args); |
20587 if (this.varStubs == null) this.varStubs = $map([]); | 20671 if (this.varStubs == null) this.varStubs = $map([]); |
20588 var stub = this.varStubs.$index(name); | 20672 var stub = this.varStubs.$index(name); |
20589 if ($notnull_bool(stub == null)) { | 20673 if ($notnull_bool(stub == null)) { |
20590 stub = new VarFunctionStub($assert_String(name), args); | 20674 stub = new VarFunctionStub($assert_String(name), args); |
20591 this.varStubs.$setindex(name, stub); | 20675 this.varStubs.$setindex(name, stub); |
20592 } | 20676 } |
20593 return (stub && stub.is$VarFunctionStub()); | 20677 return (stub && stub.is$VarFunctionStub()); |
20594 } | 20678 } |
20595 DefinedType.prototype.addDirectSubtype$1 = function($0) { | 20679 DefinedType.prototype.addDirectSubtype$1 = function($0) { |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21929 code.exitBlock('});'); | 22013 code.exitBlock('});'); |
21930 } | 22014 } |
21931 VarMethodSet.prototype.generate$1 = function($0) { | 22015 VarMethodSet.prototype.generate$1 = function($0) { |
21932 return this.generate(($0 && $0.is$CodeWriter())); | 22016 return this.generate(($0 && $0.is$CodeWriter())); |
21933 }; | 22017 }; |
21934 VarMethodSet.prototype.invoke$4 = function($0, $1, $2, $3) { | 22018 VarMethodSet.prototype.invoke$4 = function($0, $1, $2, $3) { |
21935 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments())); | 22019 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments())); |
21936 }; | 22020 }; |
21937 // ********** Code for top level ************** | 22021 // ********** Code for top level ************** |
21938 function map(source, mapper) { | 22022 function map(source, mapper) { |
21939 var result = new ListFactory(); | 22023 var result = []; |
21940 if (!!(source && source.is$List)) { | 22024 if (!!(source && source.is$List)) { |
21941 var list = (source && source.is$List()); | 22025 var list = (source && source.is$List()); |
21942 result.length = list.length; | 22026 result.length = list.length; |
21943 for (var i = 0; | 22027 for (var i = 0; |
21944 i < list.length; i++) { | 22028 i < list.length; i++) { |
21945 result.$setindex(i, mapper(list.$index(i))); | 22029 result.$setindex(i, mapper(list.$index(i))); |
21946 } | 22030 } |
21947 } | 22031 } |
21948 else { | 22032 else { |
21949 for (var $i = source.iterator(); $i.hasNext$0(); ) { | 22033 for (var $i = source.iterator(); $i.hasNext$0(); ) { |
21950 var item = $i.next$0(); | 22034 var item = $i.next$0(); |
21951 result.add(mapper(item)); | 22035 result.add(mapper(item)); |
21952 } | 22036 } |
21953 } | 22037 } |
21954 return result; | 22038 return result; |
21955 } | 22039 } |
21956 function reduce(source, callback, initialValue) { | 22040 function reduce(source, callback, initialValue) { |
21957 var i = source.iterator(); | 22041 var i = source.iterator(); |
21958 var current = initialValue; | 22042 var current = initialValue; |
21959 if ($notnull_bool(current == null) && $notnull_bool(i.hasNext$0())) { | 22043 if ($notnull_bool(current == null) && $notnull_bool(i.hasNext$0())) { |
21960 current = i.next$0(); | 22044 current = i.next$0(); |
21961 } | 22045 } |
21962 while ($notnull_bool(i.hasNext$0())) { | 22046 while ($notnull_bool(i.hasNext$0())) { |
21963 current = callback.call$2(current, i.next$0()); | 22047 current = callback.call$2(current, i.next$0()); |
21964 } | 22048 } |
21965 return current; | 22049 return current; |
21966 } | 22050 } |
| 22051 function groupBy(left, keyFn) { |
| 22052 var result = $map([]); |
| 22053 var iter = left.iterator(); |
| 22054 while ($notnull_bool(iter.hasNext$0())) { |
| 22055 var i = iter.next$0(); |
| 22056 result.putIfAbsent(keyFn(i), (function () { |
| 22057 return []; |
| 22058 }) |
| 22059 ).add$1(i); |
| 22060 } |
| 22061 return result; |
| 22062 } |
21967 function orderValuesByKeys(map) { | 22063 function orderValuesByKeys(map) { |
21968 var $0; | 22064 var $0; |
21969 var keys = (($0 = map.getKeys()) && $0.is$List()); | 22065 var keys = (($0 = map.getKeys()) && $0.is$List()); |
21970 keys.sort((function (x, y) { | 22066 keys.sort((function (x, y) { |
21971 return x.compareTo$1(y); | 22067 return x.compareTo$1(y); |
21972 }) | 22068 }) |
21973 ); | 22069 ); |
21974 var values = []; | 22070 var values = []; |
21975 for (var $i = 0;$i < keys.length; $i++) { | 22071 for (var $i = 0;$i < keys.length; $i++) { |
21976 var k = keys.$index($i); | 22072 var k = keys.$index($i); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22384 NATIVE, | 22480 NATIVE, |
22385 NEGATE, | 22481 NEGATE, |
22386 OPERATOR, | 22482 OPERATOR, |
22387 SET, | 22483 SET, |
22388 SOURCE, | 22484 SOURCE, |
22389 STATIC, | 22485 STATIC, |
22390 TYPEDEF ]*/; | 22486 TYPEDEF ]*/; |
22391 var $globals = {}; | 22487 var $globals = {}; |
22392 $static_init(); | 22488 $static_init(); |
22393 main(); | 22489 main(); |
OLD | NEW |