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 4277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4288 type.resolve$0(); | 4288 type.resolve$0(); |
4289 } | 4289 } |
4290 } | 4290 } |
4291 Library.prototype.visitSources = function() { | 4291 Library.prototype.visitSources = function() { |
4292 var visitor = new _LibraryVisitor(this); | 4292 var visitor = new _LibraryVisitor(this); |
4293 visitor.addSource$1(this.baseSource); | 4293 visitor.addSource$1(this.baseSource); |
4294 } | 4294 } |
4295 Library.prototype.toString = function() { | 4295 Library.prototype.toString = function() { |
4296 return this.baseSource.filename; | 4296 return this.baseSource.filename; |
4297 } | 4297 } |
| 4298 Library.prototype.hashCode = function() { |
| 4299 return this.baseSource.filename.hashCode(); |
| 4300 } |
| 4301 Library.prototype.$eq = function(other) { |
| 4302 return (other instanceof Library) && $eq(other.get$baseSource().get$filename()
, this.baseSource.filename); |
| 4303 } |
4298 Library.prototype.findTypeByName$1 = Library.prototype.findTypeByName; | 4304 Library.prototype.findTypeByName$1 = Library.prototype.findTypeByName; |
| 4305 Library.prototype.hashCode$0 = Library.prototype.hashCode; |
4299 Library.prototype.resolve$0 = Library.prototype.resolve; | 4306 Library.prototype.resolve$0 = Library.prototype.resolve; |
4300 Library.prototype.toString$0 = Library.prototype.toString; | 4307 Library.prototype.toString$0 = Library.prototype.toString; |
4301 Library.prototype.visitSources$0 = Library.prototype.visitSources; | 4308 Library.prototype.visitSources$0 = Library.prototype.visitSources; |
4302 // ********** Code for _LibraryVisitor ************** | 4309 // ********** Code for _LibraryVisitor ************** |
4303 function _LibraryVisitor(library) { | 4310 function _LibraryVisitor(library) { |
4304 this.seenImport = false | 4311 this.seenImport = false |
4305 this.seenSource = false | 4312 this.seenSource = false |
4306 this.seenResource = false | 4313 this.seenResource = false |
4307 this.isTop = true | 4314 this.isTop = true |
4308 this.library = library; | 4315 this.library = library; |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4665 Member.prototype.get$generatedFactoryName = function() { | 4672 Member.prototype.get$generatedFactoryName = function() { |
4666 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo
rName() + '\$'); | 4673 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo
rName() + '\$'); |
4667 if (this.name == '') { | 4674 if (this.name == '') { |
4668 return ('' + prefix + 'factory'); | 4675 return ('' + prefix + 'factory'); |
4669 } | 4676 } |
4670 else { | 4677 else { |
4671 return ('' + prefix + this.name + '\$factory'); | 4678 return ('' + prefix + this.name + '\$factory'); |
4672 } | 4679 } |
4673 } | 4680 } |
4674 Member.prototype.hashCode = function() { | 4681 Member.prototype.hashCode = function() { |
4675 return (this.declaringType.hashCode() << 4) ^ this.name.hashCode(); | 4682 var typeCode = this.declaringType == null ? 1 : this.declaringType.hashCode(); |
| 4683 var nameCode = this.get$isConstructor() ? this.get$constructorName().hashCode(
) : this.name.hashCode(); |
| 4684 return (typeCode << 4) ^ nameCode; |
| 4685 } |
| 4686 Member.prototype.$eq = function(other) { |
| 4687 return (other instanceof Member) && $eq(this.get$isConstructor(), other.get$is
Constructor()) && $eq(this.declaringType, other.get$declaringType()) && (this.ge
t$isConstructor() ? this.get$constructorName() == other.get$constructorName() :
this.name == other.get$name()); |
4676 } | 4688 } |
4677 Member.prototype._get$3 = Member.prototype._get; | 4689 Member.prototype._get$3 = Member.prototype._get; |
4678 Member.prototype._get$3$isDynamic = Member.prototype._get; | 4690 Member.prototype._get$3$isDynamic = Member.prototype._get; |
4679 Member.prototype._get$4 = Member.prototype._get; | 4691 Member.prototype._get$4 = Member.prototype._get; |
4680 Member.prototype._set$4 = Member.prototype._set; | 4692 Member.prototype._set$4 = Member.prototype._set; |
4681 Member.prototype._set$4$isDynamic = Member.prototype._set; | 4693 Member.prototype._set$4$isDynamic = Member.prototype._set; |
4682 Member.prototype._set$5 = Member.prototype._set; | 4694 Member.prototype._set$5 = Member.prototype._set; |
4683 Member.prototype.canInvoke$2 = Member.prototype.canInvoke; | 4695 Member.prototype.canInvoke$2 = Member.prototype.canInvoke; |
4684 Member.prototype.computeValue$0 = Member.prototype.computeValue; | 4696 Member.prototype.computeValue$0 = Member.prototype.computeValue; |
4685 Member.prototype.hashCode$0 = Member.prototype.hashCode; | 4697 Member.prototype.hashCode$0 = Member.prototype.hashCode; |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5338 i < this.parameters.length; i++) { | 5350 i < this.parameters.length; i++) { |
5339 var arg = args.getValue(this.parameters.$index(i).get$name()); | 5351 var arg = args.getValue(this.parameters.$index(i).get$name()); |
5340 if (arg != null && arg.needsConversion$1(this.parameters.$index(i).get$typ
e())) { | 5352 if (arg != null && arg.needsConversion$1(this.parameters.$index(i).get$typ
e())) { |
5341 return true; | 5353 return true; |
5342 } | 5354 } |
5343 } | 5355 } |
5344 } | 5356 } |
5345 return false; | 5357 return false; |
5346 } | 5358 } |
5347 MethodMember._argCountMsg = function(actual, expected, atLeast) { | 5359 MethodMember._argCountMsg = function(actual, expected, atLeast) { |
5348 return 'wrong number of arguments, expected ' + ('' + (atLeast ? "at least " :
"") + expected + ' but found ' + actual); | 5360 return 'wrong number of positional arguments, expected ' + ('' + (atLeast ? "a
t least " : "") + expected + ' but found ' + actual); |
5349 } | 5361 } |
5350 MethodMember.prototype._argError = function(context, node, target, args, msg) { | 5362 MethodMember.prototype._argError = function(context, node, target, args, msg, sp
an) { |
5351 if (this.isStatic || this.get$isConstructor()) { | 5363 if (this.isStatic || this.get$isConstructor()) { |
5352 $globals.world.error(msg, node.span); | 5364 $globals.world.error(msg, span); |
5353 } | 5365 } |
5354 else { | 5366 else { |
5355 $globals.world.warning(msg, node.span); | 5367 $globals.world.warning(msg, span); |
5356 } | 5368 } |
5357 return target.invokeNoSuchMethod(context, this.name, node, args); | 5369 return target.invokeNoSuchMethod(context, this.name, node, args); |
5358 } | 5370 } |
5359 MethodMember.prototype.genParameterValues = function() { | 5371 MethodMember.prototype.genParameterValues = function() { |
5360 var $$list = this.parameters; | 5372 var $$list = this.parameters; |
5361 for (var $$i = 0;$$i < $$list.length; $$i++) { | 5373 for (var $$i = 0;$$i < $$list.length; $$i++) { |
5362 var p = $$list.$index($$i); | 5374 var p = $$list.$index($$i); |
5363 p.genValue$2(this, this.generator); | 5375 p.genValue$2(this, this.generator); |
5364 } | 5376 } |
5365 } | 5377 } |
(...skipping 13 matching lines...) Expand all Loading... |
5379 var argsCode = []; | 5391 var argsCode = []; |
5380 if (!target.isType && (this.get$isConstructor() || target.isSuper)) { | 5392 if (!target.isType && (this.get$isConstructor() || target.isSuper)) { |
5381 argsCode.add$1('this'); | 5393 argsCode.add$1('this'); |
5382 } | 5394 } |
5383 var bareCount = args.get$bareCount(); | 5395 var bareCount = args.get$bareCount(); |
5384 for (var i = 0; | 5396 for (var i = 0; |
5385 i < bareCount; i++) { | 5397 i < bareCount; i++) { |
5386 var arg = args.values.$index(i); | 5398 var arg = args.values.$index(i); |
5387 if (i >= this.parameters.length) { | 5399 if (i >= this.parameters.length) { |
5388 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len
gth, false); | 5400 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len
gth, false); |
5389 return this._argError(context, node, target, args, msg); | 5401 return this._argError(context, node, target, args, msg, args.nodes.$index(
i).get$span()); |
5390 } | 5402 } |
5391 arg = arg.convertTo$4(context, this.parameters.$index(i).get$type(), node, i
sDynamic); | 5403 arg = arg.convertTo$4(context, this.parameters.$index(i).get$type(), node, i
sDynamic); |
5392 if (this.isConst && arg.get$isConst()) { | 5404 if (this.isConst && arg.get$isConst()) { |
5393 argsCode.add$1(arg.get$canonicalCode()); | 5405 argsCode.add$1(arg.get$canonicalCode()); |
5394 } | 5406 } |
5395 else { | 5407 else { |
5396 argsCode.add$1(arg.get$code()); | 5408 argsCode.add$1(arg.get$code()); |
5397 } | 5409 } |
5398 } | 5410 } |
| 5411 var namedArgsUsed = 0; |
5399 if (bareCount < this.parameters.length) { | 5412 if (bareCount < this.parameters.length) { |
5400 this.genParameterValues(); | 5413 this.genParameterValues(); |
5401 var namedArgsUsed = 0; | |
5402 for (var i = bareCount; | 5414 for (var i = bareCount; |
5403 i < this.parameters.length; i++) { | 5415 i < this.parameters.length; i++) { |
5404 var arg = args.getValue(this.parameters.$index(i).get$name()); | 5416 var arg = args.getValue(this.parameters.$index(i).get$name()); |
5405 if (arg == null) { | 5417 if (arg == null) { |
5406 arg = this.parameters.$index(i).get$value(); | 5418 arg = this.parameters.$index(i).get$value(); |
5407 } | 5419 } |
5408 else { | 5420 else { |
5409 arg = arg.convertTo$4(context, this.parameters.$index(i).get$type(), nod
e, isDynamic); | 5421 arg = arg.convertTo$4(context, this.parameters.$index(i).get$type(), nod
e, isDynamic); |
5410 namedArgsUsed++; | 5422 namedArgsUsed++; |
5411 } | 5423 } |
5412 if (arg == null || !this.parameters.$index(i).get$isOptional()) { | 5424 if (arg == null || !this.parameters.$index(i).get$isOptional()) { |
5413 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i +
1, true); | 5425 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i +
1, true); |
5414 return this._argError(context, node, target, args, msg); | 5426 return this._argError(context, node, target, args, msg, args.nodes.$inde
x(i).get$span()); |
5415 } | 5427 } |
5416 else { | 5428 else { |
5417 argsCode.add$1(this.isConst && arg.get$isConst() ? arg.get$canonicalCode
() : arg.get$code()); | 5429 argsCode.add$1(this.isConst && arg.get$isConst() ? arg.get$canonicalCode
() : arg.get$code()); |
5418 } | 5430 } |
5419 } | 5431 } |
5420 if (namedArgsUsed < args.get$nameCount()) { | 5432 Arguments.removeTrailingNulls(argsCode); |
5421 var seen = new HashSetImplementation(); | 5433 } |
5422 for (var i = bareCount; | 5434 if (namedArgsUsed < args.get$nameCount()) { |
5423 i < args.get$length(); i++) { | 5435 var seen = new HashSetImplementation(); |
5424 var name = args.getName(i); | 5436 for (var i = bareCount; |
5425 if (seen.contains$1(name)) { | 5437 i < args.get$length(); i++) { |
5426 return this._argError(context, node, target, args, ('duplicate argumen
t "' + name + '"')); | 5438 var name = args.getName(i); |
5427 } | 5439 if (seen.contains$1(name)) { |
5428 seen.add$1(name); | 5440 return this._argError(context, node, target, args, ('duplicate argument
"' + name + '"'), args.nodes.$index(i).get$span()); |
5429 var p = this.indexOfParameter(name); | |
5430 if (p < 0) { | |
5431 return this._argError(context, node, target, args, ('method does not h
ave optional parameter "' + name + '"')); | |
5432 } | |
5433 else if (p < bareCount) { | |
5434 return this._argError(context, node, target, args, ('argument "' + nam
e + '" passed as positional and named')); | |
5435 } | |
5436 } | 5441 } |
5437 $globals.world.internalError(('wrong named arguments calling ' + this.name
), node.span); | 5442 seen.add$1(name); |
| 5443 var p = this.indexOfParameter(name); |
| 5444 if (p < 0) { |
| 5445 return this._argError(context, node, target, args, ('method does not hav
e optional parameter "' + name + '"'), args.nodes.$index(i).get$span()); |
| 5446 } |
| 5447 else if (p < bareCount) { |
| 5448 return this._argError(context, node, target, args, ('argument "' + name
+ '" passed as positional and named'), args.nodes.$index(p).get$span()); |
| 5449 } |
5438 } | 5450 } |
5439 Arguments.removeTrailingNulls(argsCode); | 5451 $globals.world.internalError(('wrong named arguments calling ' + this.name),
node.span); |
5440 } | 5452 } |
5441 var argsString = Strings.join(argsCode, ', '); | 5453 var argsString = Strings.join(argsCode, ', '); |
5442 if (this.get$isConstructor()) { | 5454 if (this.get$isConstructor()) { |
5443 return this._invokeConstructor(context, node, target, args, argsString); | 5455 return this._invokeConstructor(context, node, target, args, argsString); |
5444 } | 5456 } |
5445 if (target.isSuper) { | 5457 if (target.isSuper) { |
5446 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn
ame() + '.prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.s
pan, true); | 5458 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn
ame() + '.prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.s
pan, true); |
5447 } | 5459 } |
5448 if (this.get$isOperator()) { | 5460 if (this.get$isOperator()) { |
5449 return this._invokeBuiltin(context, node, target, args, argsCode, isDynamic)
; | 5461 return this._invokeBuiltin(context, node, target, args, argsCode, isDynamic)
; |
(...skipping 5378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10828 return true; | 10840 return true; |
10829 } | 10841 } |
10830 if (this.get$interfaces() != null && this.get$interfaces().some((function (i)
{ | 10842 if (this.get$interfaces() != null && this.get$interfaces().some((function (i)
{ |
10831 return i.isSubtypeOf$1(other); | 10843 return i.isSubtypeOf$1(other); |
10832 }) | 10844 }) |
10833 )) { | 10845 )) { |
10834 return true; | 10846 return true; |
10835 } | 10847 } |
10836 return false; | 10848 return false; |
10837 } | 10849 } |
| 10850 Type.prototype.hashCode = function() { |
| 10851 var libraryCode = this.get$library() == null ? 1 : this.get$library().hashCode
(); |
| 10852 var nameCode = this.name == null ? 1 : this.name.hashCode(); |
| 10853 return (libraryCode << 4) ^ nameCode; |
| 10854 } |
| 10855 Type.prototype.$eq = function(other) { |
| 10856 return (other instanceof Type) && $eq(other.get$name(), this.name) && $eq(this
.get$library(), other.get$library()); |
| 10857 } |
10838 Type._isFunctionSubtypeOf = function(t, s) { | 10858 Type._isFunctionSubtypeOf = function(t, s) { |
10839 if (!s.returnType.get$isVoid() && !s.returnType.isAssignable(t.returnType)) { | 10859 if (!s.returnType.get$isVoid() && !s.returnType.isAssignable(t.returnType)) { |
10840 return false; | 10860 return false; |
10841 } | 10861 } |
10842 var tp = t.parameters; | 10862 var tp = t.parameters; |
10843 var sp = s.parameters; | 10863 var sp = s.parameters; |
10844 if (tp.length < sp.length) return false; | 10864 if (tp.length < sp.length) return false; |
10845 for (var i = 0; | 10865 for (var i = 0; |
10846 i < sp.length; i++) { | 10866 i < sp.length; i++) { |
10847 if ($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOptional())) retur
n false; | 10867 if ($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOptional())) retur
n false; |
10848 if (tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name(), sp.$index(
i).get$name())) return false; | 10868 if (tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name(), sp.$index(
i).get$name())) return false; |
10849 if (!tp.$index(i).get$type().isAssignable$1(sp.$index(i).get$type())) return
false; | 10869 if (!tp.$index(i).get$type().isAssignable$1(sp.$index(i).get$type())) return
false; |
10850 } | 10870 } |
10851 if (tp.length > sp.length && !tp.$index(sp.length).get$isOptional()) return fa
lse; | 10871 if (tp.length > sp.length && !tp.$index(sp.length).get$isOptional()) return fa
lse; |
10852 return true; | 10872 return true; |
10853 } | 10873 } |
10854 Type.prototype._checkExtends$0 = Type.prototype._checkExtends; | 10874 Type.prototype._checkExtends$0 = Type.prototype._checkExtends; |
10855 Type.prototype.addDirectSubtype$1 = Type.prototype.addDirectSubtype; | 10875 Type.prototype.addDirectSubtype$1 = Type.prototype.addDirectSubtype; |
10856 Type.prototype.ensureSubtypeOf$3 = Type.prototype.ensureSubtypeOf; | 10876 Type.prototype.ensureSubtypeOf$3 = Type.prototype.ensureSubtypeOf; |
10857 Type.prototype.getConstructor$1 = Type.prototype.getConstructor; | 10877 Type.prototype.getConstructor$1 = Type.prototype.getConstructor; |
10858 Type.prototype.getFactory$2 = Type.prototype.getFactory; | 10878 Type.prototype.getFactory$2 = Type.prototype.getFactory; |
10859 Type.prototype.getMember$1 = Type.prototype.getMember; | 10879 Type.prototype.getMember$1 = Type.prototype.getMember; |
10860 Type.prototype.getOrMakeConcreteType$1 = Type.prototype.getOrMakeConcreteType; | 10880 Type.prototype.getOrMakeConcreteType$1 = Type.prototype.getOrMakeConcreteType; |
| 10881 Type.prototype.hashCode$0 = Type.prototype.hashCode; |
10861 Type.prototype.isAssignable$1 = Type.prototype.isAssignable; | 10882 Type.prototype.isAssignable$1 = Type.prototype.isAssignable; |
10862 Type.prototype.isSubtypeOf$1 = Type.prototype.isSubtypeOf; | 10883 Type.prototype.isSubtypeOf$1 = Type.prototype.isSubtypeOf; |
10863 Type.prototype.markUsed$0 = Type.prototype.markUsed; | 10884 Type.prototype.markUsed$0 = Type.prototype.markUsed; |
10864 Type.prototype.resolveTypeParams$1 = Type.prototype.resolveTypeParams; | 10885 Type.prototype.resolveTypeParams$1 = Type.prototype.resolveTypeParams; |
10865 // ********** Code for ParameterType ************** | 10886 // ********** Code for ParameterType ************** |
10866 function ParameterType(name, typeParameter) { | 10887 function ParameterType(name, typeParameter) { |
10867 this.typeParameter = typeParameter; | 10888 this.typeParameter = typeParameter; |
10868 // Initializers done | 10889 // Initializers done |
10869 Type.call(this, name); | 10890 Type.call(this, name); |
10870 } | 10891 } |
(...skipping 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13156 $globals._MAGENTA_COLOR = '\u001b[35m'; | 13177 $globals._MAGENTA_COLOR = '\u001b[35m'; |
13157 $globals._NO_COLOR = '\u001b[0m'; | 13178 $globals._NO_COLOR = '\u001b[0m'; |
13158 $globals._RED_COLOR = '\u001b[31m'; | 13179 $globals._RED_COLOR = '\u001b[31m'; |
13159 } | 13180 } |
13160 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; | 13181 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; |
13161 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; | 13182 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; |
13162 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; | 13183 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; |
13163 var $globals = {}; | 13184 var $globals = {}; |
13164 $static_init(); | 13185 $static_init(); |
13165 main(); | 13186 main(); |
OLD | NEW |