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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 return this.noSuchMethod("writeDefinition", [$0, $1]); | 390 return this.noSuchMethod("writeDefinition", [$0, $1]); |
391 }; | 391 }; |
392 // ********** Code for Clock ************** | 392 // ********** Code for Clock ************** |
393 function Clock() {} | 393 function Clock() {} |
394 Clock.now = function() { | 394 Clock.now = function() { |
395 return new Date().getTime(); | 395 return new Date().getTime(); |
396 } | 396 } |
397 Clock.frequency = function() { | 397 Clock.frequency = function() { |
398 return 1000; | 398 return 1000; |
399 } | 399 } |
| 400 // ********** Code for IllegalAccessException ************** |
| 401 function IllegalAccessException() { |
| 402 // Initializers done |
| 403 } |
| 404 IllegalAccessException.prototype.toString = function() { |
| 405 return "Attempt to modify an immutable object"; |
| 406 } |
| 407 IllegalAccessException.prototype.toString$0 = IllegalAccessException.prototype.t
oString; |
400 // ********** Code for NoSuchMethodException ************** | 408 // ********** Code for NoSuchMethodException ************** |
401 function NoSuchMethodException(_receiver, _functionName, _arguments) { | 409 function NoSuchMethodException(_receiver, _functionName, _arguments) { |
402 this._receiver = _receiver; | 410 this._receiver = _receiver; |
403 this._functionName = _functionName; | 411 this._functionName = _functionName; |
404 this._arguments = _arguments; | 412 this._arguments = _arguments; |
405 // Initializers done | 413 // Initializers done |
406 } | 414 } |
407 NoSuchMethodException.prototype.toString = function() { | 415 NoSuchMethodException.prototype.toString = function() { |
408 var sb = new StringBufferImpl(""); | 416 var sb = new StringBufferImpl(""); |
409 for (var i = 0; | 417 for (var i = 0; |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 return this._array.length > this._dart_coreimpl_pos; | 675 return this._array.length > this._dart_coreimpl_pos; |
668 } | 676 } |
669 ListIterator.prototype.next = function() { | 677 ListIterator.prototype.next = function() { |
670 if (!this.hasNext()) { | 678 if (!this.hasNext()) { |
671 $throw(const$8/*const NoMoreElementsException()*/); | 679 $throw(const$8/*const NoMoreElementsException()*/); |
672 } | 680 } |
673 return this._array.$index(this._dart_coreimpl_pos++); | 681 return this._array.$index(this._dart_coreimpl_pos++); |
674 } | 682 } |
675 ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext; | 683 ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext; |
676 ListIterator.prototype.next$0 = ListIterator.prototype.next; | 684 ListIterator.prototype.next$0 = ListIterator.prototype.next; |
| 685 // ********** Code for ImmutableList ************** |
| 686 /** Implements extends for Dart classes on JavaScript prototypes. */ |
| 687 function $inherits(child, parent) { |
| 688 if (child.prototype.__proto__) { |
| 689 child.prototype.__proto__ = parent.prototype; |
| 690 } else { |
| 691 function tmp() {}; |
| 692 tmp.prototype = parent.prototype; |
| 693 child.prototype = new tmp(); |
| 694 child.prototype.constructor = child; |
| 695 } |
| 696 } |
| 697 $inherits(ImmutableList, ListFactory_E); |
| 698 function ImmutableList(length) { |
| 699 this._length = length; |
| 700 // Initializers done |
| 701 ListFactory_E.call(this, length); |
| 702 } |
| 703 ImmutableList.ImmutableList$from$factory = function(other) { |
| 704 var list = new ImmutableList(other.length); |
| 705 for (var i = 0; |
| 706 i < other.length; i++) { |
| 707 list._setindex(i, other.$index(i)); |
| 708 } |
| 709 return list; |
| 710 } |
| 711 ImmutableList.prototype.get$length = function() { |
| 712 return this._length; |
| 713 } |
| 714 ImmutableList.prototype.set$length = function(length) { |
| 715 $throw(const$127/*const IllegalAccessException()*/); |
| 716 } |
| 717 Object.defineProperty(ImmutableList.prototype, "length", { |
| 718 get: ImmutableList.prototype.get$length, |
| 719 set: ImmutableList.prototype.set$length |
| 720 }); |
| 721 ImmutableList.prototype._setindex = function(index, value) { |
| 722 return this[index] = value; |
| 723 } |
| 724 ImmutableList.prototype.$setindex = function(index, value) { |
| 725 $throw(const$127/*const IllegalAccessException()*/); |
| 726 } |
| 727 ImmutableList.prototype.sort = function(compare) { |
| 728 $throw(const$127/*const IllegalAccessException()*/); |
| 729 } |
| 730 ImmutableList.prototype.add = function(element) { |
| 731 $throw(const$127/*const IllegalAccessException()*/); |
| 732 } |
| 733 ImmutableList.prototype.addLast = function(element) { |
| 734 $throw(const$127/*const IllegalAccessException()*/); |
| 735 } |
| 736 ImmutableList.prototype.addAll = function(elements) { |
| 737 $throw(const$127/*const IllegalAccessException()*/); |
| 738 } |
| 739 ImmutableList.prototype.clear = function() { |
| 740 $throw(const$127/*const IllegalAccessException()*/); |
| 741 } |
| 742 ImmutableList.prototype.removeLast = function() { |
| 743 $throw(const$127/*const IllegalAccessException()*/); |
| 744 } |
| 745 ImmutableList.prototype.toString = function() { |
| 746 return ListFactory.ListFactory$from$factory(this).toString(); |
| 747 } |
| 748 ImmutableList.prototype.add$1 = ImmutableList.prototype.add; |
| 749 ImmutableList.prototype.addAll$1 = ImmutableList.prototype.addAll; |
| 750 ImmutableList.prototype.removeLast$0 = ImmutableList.prototype.removeLast; |
| 751 ImmutableList.prototype.sort$1 = function($0) { |
| 752 return this.sort(to$call$2($0)); |
| 753 }; |
| 754 ImmutableList.prototype.toString$0 = ImmutableList.prototype.toString; |
677 // ********** Code for NumImplementation ************** | 755 // ********** Code for NumImplementation ************** |
678 NumImplementation = Number; | 756 NumImplementation = Number; |
679 NumImplementation.prototype.isNaN = function() { | 757 NumImplementation.prototype.isNaN = function() { |
680 return isNaN(this); | 758 return isNaN(this); |
681 } | 759 } |
682 NumImplementation.prototype.isNegative = function() { | 760 NumImplementation.prototype.isNegative = function() { |
683 return this == 0 ? (1 / this) < 0 : this < 0; | 761 return this == 0 ? (1 / this) < 0 : this < 0; |
684 } | 762 } |
685 NumImplementation.prototype.hashCode = function() { | 763 NumImplementation.prototype.hashCode = function() { |
686 return this & 0xFFFFFFF; | 764 return this & 0xFFFFFFF; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 // ********** Code for HashMapImplementation ************** | 809 // ********** Code for HashMapImplementation ************** |
732 function HashMapImplementation() { | 810 function HashMapImplementation() { |
733 // Initializers done | 811 // Initializers done |
734 this._numberOfEntries = 0; | 812 this._numberOfEntries = 0; |
735 this._numberOfDeleted = 0; | 813 this._numberOfDeleted = 0; |
736 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 814 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
737 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 815 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
738 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 816 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
739 } | 817 } |
740 HashMapImplementation.HashMapImplementation$from$factory = function(other) { | 818 HashMapImplementation.HashMapImplementation$from$factory = function(other) { |
741 var result = new HashMapImplementation(); | 819 var result = new HashMapImplementation_K$V(); |
742 other.forEach((function (key, value) { | 820 other.forEach((function (key, value) { |
743 result.$setindex(key, value); | 821 result.$setindex(key, value); |
744 }) | 822 }) |
745 ); | 823 ); |
746 return result; | 824 return result; |
747 } | 825 } |
748 HashMapImplementation._computeLoadLimit = function(capacity) { | 826 HashMapImplementation._computeLoadLimit = function(capacity) { |
749 return $truncdiv((capacity * 3), 4); | 827 return $truncdiv((capacity * 3), 4); |
750 } | 828 } |
751 HashMapImplementation._firstProbe = function(hashCode, length) { | 829 HashMapImplementation._firstProbe = function(hashCode, length) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 return (this._probeForLookup(key) != -1); | 965 return (this._probeForLookup(key) != -1); |
888 } | 966 } |
889 HashMapImplementation.prototype.containsKey$1 = HashMapImplementation.prototype.
containsKey; | 967 HashMapImplementation.prototype.containsKey$1 = HashMapImplementation.prototype.
containsKey; |
890 HashMapImplementation.prototype.forEach$1 = function($0) { | 968 HashMapImplementation.prototype.forEach$1 = function($0) { |
891 return this.forEach(to$call$2($0)); | 969 return this.forEach(to$call$2($0)); |
892 }; | 970 }; |
893 HashMapImplementation.prototype.getKeys$0 = HashMapImplementation.prototype.getK
eys; | 971 HashMapImplementation.prototype.getKeys$0 = HashMapImplementation.prototype.getK
eys; |
894 HashMapImplementation.prototype.getValues$0 = HashMapImplementation.prototype.ge
tValues; | 972 HashMapImplementation.prototype.getValues$0 = HashMapImplementation.prototype.ge
tValues; |
895 HashMapImplementation.prototype.isEmpty$0 = HashMapImplementation.prototype.isEm
pty; | 973 HashMapImplementation.prototype.isEmpty$0 = HashMapImplementation.prototype.isEm
pty; |
896 // ********** Code for HashMapImplementation_E$E ************** | 974 // ********** Code for HashMapImplementation_E$E ************** |
897 /** Implements extends for Dart classes on JavaScript prototypes. */ | |
898 function $inherits(child, parent) { | |
899 if (child.prototype.__proto__) { | |
900 child.prototype.__proto__ = parent.prototype; | |
901 } else { | |
902 function tmp() {}; | |
903 tmp.prototype = parent.prototype; | |
904 child.prototype = new tmp(); | |
905 child.prototype.constructor = child; | |
906 } | |
907 } | |
908 $inherits(HashMapImplementation_E$E, HashMapImplementation); | 975 $inherits(HashMapImplementation_E$E, HashMapImplementation); |
909 function HashMapImplementation_E$E() { | 976 function HashMapImplementation_E$E() { |
910 // Initializers done | 977 // Initializers done |
911 this._numberOfEntries = 0; | 978 this._numberOfEntries = 0; |
912 this._numberOfDeleted = 0; | 979 this._numberOfDeleted = 0; |
913 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 980 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
914 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 981 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
915 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 982 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
916 } | 983 } |
917 HashMapImplementation_E$E._computeLoadLimit = function(capacity) { | 984 HashMapImplementation_E$E._computeLoadLimit = function(capacity) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 } | 1098 } |
1032 ); | 1099 ); |
1033 return list; | 1100 return list; |
1034 } | 1101 } |
1035 HashMapImplementation_E$E.prototype.containsKey = function(key) { | 1102 HashMapImplementation_E$E.prototype.containsKey = function(key) { |
1036 return (this._probeForLookup(key) != -1); | 1103 return (this._probeForLookup(key) != -1); |
1037 } | 1104 } |
1038 // ********** Code for HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePa
ir_K$V ************** | 1105 // ********** Code for HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePa
ir_K$V ************** |
1039 $inherits(HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePair_K$V, HashM
apImplementation); | 1106 $inherits(HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePair_K$V, HashM
apImplementation); |
1040 function HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePair_K$V() {} | 1107 function HashMapImplementation_K$DoubleLinkedQueueEntry_KeyValuePair_K$V() {} |
| 1108 // ********** Code for HashMapImplementation_K$V ************** |
| 1109 $inherits(HashMapImplementation_K$V, HashMapImplementation); |
| 1110 function HashMapImplementation_K$V() { |
| 1111 // Initializers done |
| 1112 this._numberOfEntries = 0; |
| 1113 this._numberOfDeleted = 0; |
| 1114 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 1115 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1116 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1117 } |
| 1118 HashMapImplementation_K$V._computeLoadLimit = function(capacity) { |
| 1119 return $truncdiv((capacity * 3), 4); |
| 1120 } |
1041 // ********** Code for HashMapImplementation_String$EvaluatedValue *************
* | 1121 // ********** Code for HashMapImplementation_String$EvaluatedValue *************
* |
1042 $inherits(HashMapImplementation_String$EvaluatedValue, HashMapImplementation); | 1122 $inherits(HashMapImplementation_String$EvaluatedValue, HashMapImplementation); |
1043 function HashMapImplementation_String$EvaluatedValue() {} | 1123 function HashMapImplementation_String$EvaluatedValue() {} |
1044 // ********** Code for HashSetImplementation ************** | 1124 // ********** Code for HashSetImplementation ************** |
1045 function HashSetImplementation() { | 1125 function HashSetImplementation() { |
1046 // Initializers done | 1126 // Initializers done |
1047 this._backingMap = new HashMapImplementation_E$E(); | 1127 this._backingMap = new HashMapImplementation_E$E(); |
1048 } | 1128 } |
1049 HashSetImplementation.HashSetImplementation$from$factory = function(other) { | 1129 HashSetImplementation.HashSetImplementation$from$factory = function(other) { |
1050 var set = new HashSetImplementation(); | 1130 var set = new HashSetImplementation_E(); |
1051 for (var $$i = other.iterator(); $$i.hasNext$0(); ) { | 1131 for (var $$i = other.iterator(); $$i.hasNext$0(); ) { |
1052 var e = $$i.next$0(); | 1132 var e = $$i.next$0(); |
1053 set.add(e); | 1133 set.add(e); |
1054 } | 1134 } |
1055 return set; | 1135 return set; |
1056 } | 1136 } |
1057 HashSetImplementation.prototype.add = function(value) { | 1137 HashSetImplementation.prototype.add = function(value) { |
1058 this._backingMap.$setindex(value, value); | 1138 this._backingMap.$setindex(value, value); |
1059 } | 1139 } |
1060 HashSetImplementation.prototype.contains = function(value) { | 1140 HashSetImplementation.prototype.contains = function(value) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 HashSetImplementation.prototype.forEach$1 = function($0) { | 1198 HashSetImplementation.prototype.forEach$1 = function($0) { |
1119 return this.forEach(to$call$1($0)); | 1199 return this.forEach(to$call$1($0)); |
1120 }; | 1200 }; |
1121 HashSetImplementation.prototype.isEmpty$0 = HashSetImplementation.prototype.isEm
pty; | 1201 HashSetImplementation.prototype.isEmpty$0 = HashSetImplementation.prototype.isEm
pty; |
1122 HashSetImplementation.prototype.iterator$0 = HashSetImplementation.prototype.ite
rator; | 1202 HashSetImplementation.prototype.iterator$0 = HashSetImplementation.prototype.ite
rator; |
1123 HashSetImplementation.prototype.some$1 = function($0) { | 1203 HashSetImplementation.prototype.some$1 = function($0) { |
1124 return this.some(to$call$1($0)); | 1204 return this.some(to$call$1($0)); |
1125 }; | 1205 }; |
1126 // ********** Code for HashSetImplementation_E ************** | 1206 // ********** Code for HashSetImplementation_E ************** |
1127 $inherits(HashSetImplementation_E, HashSetImplementation); | 1207 $inherits(HashSetImplementation_E, HashSetImplementation); |
1128 function HashSetImplementation_E() {} | 1208 function HashSetImplementation_E() { |
| 1209 // Initializers done |
| 1210 this._backingMap = new HashMapImplementation_E$E(); |
| 1211 } |
1129 // ********** Code for HashSetImplementation_Library ************** | 1212 // ********** Code for HashSetImplementation_Library ************** |
1130 $inherits(HashSetImplementation_Library, HashSetImplementation); | 1213 $inherits(HashSetImplementation_Library, HashSetImplementation); |
1131 function HashSetImplementation_Library() {} | 1214 function HashSetImplementation_Library() {} |
1132 // ********** Code for HashSetImplementation_String ************** | 1215 // ********** Code for HashSetImplementation_String ************** |
1133 $inherits(HashSetImplementation_String, HashSetImplementation); | 1216 $inherits(HashSetImplementation_String, HashSetImplementation); |
1134 function HashSetImplementation_String() {} | 1217 function HashSetImplementation_String() {} |
1135 // ********** Code for HashSetImplementation_Type ************** | 1218 // ********** Code for HashSetImplementation_Type ************** |
1136 $inherits(HashSetImplementation_Type, HashSetImplementation); | 1219 $inherits(HashSetImplementation_Type, HashSetImplementation); |
1137 function HashSetImplementation_Type() {} | 1220 function HashSetImplementation_Type() {} |
1138 // ********** Code for HashSetIterator ************** | 1221 // ********** Code for HashSetIterator ************** |
(...skipping 3777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4916 $globals.world.error('duplicate final modifier', mod.get$span()); | 4999 $globals.world.error('duplicate final modifier', mod.get$span()); |
4917 } | 5000 } |
4918 this.isFinal = true; | 5001 this.isFinal = true; |
4919 } | 5002 } |
4920 else { | 5003 else { |
4921 $globals.world.error(('' + mod + ' modifier not allowed on field'), mod.
get$span()); | 5004 $globals.world.error(('' + mod + ' modifier not allowed on field'), mod.
get$span()); |
4922 } | 5005 } |
4923 } | 5006 } |
4924 } | 5007 } |
4925 this.type = this.resolveType(this.definition.type, false); | 5008 this.type = this.resolveType(this.definition.type, false); |
4926 if (this.isStatic && this.type.get$hasTypeParams()) { | 5009 if (this.isStatic && !this.get$isFactory() && this.type.get$hasTypeParams()) { |
4927 $globals.world.error('using type parameter in static context', this.definiti
on.type.span); | 5010 $globals.world.error('using type parameter in static context', this.definiti
on.type.span); |
4928 } | 5011 } |
4929 if (this.isStatic && this.isFinal && this.value == null) { | 5012 if (this.isStatic && this.isFinal && this.value == null) { |
4930 $globals.world.error('static final field is missing initializer', this.get$s
pan()); | 5013 $globals.world.error('static final field is missing initializer', this.get$s
pan()); |
4931 } | 5014 } |
4932 this.get$library()._addMember(this); | 5015 this.get$library()._addMember(this); |
4933 } | 5016 } |
4934 FieldMember.prototype.computeValue = function() { | 5017 FieldMember.prototype.computeValue = function() { |
4935 if (this.value == null) return null; | 5018 if (this.value == null) return null; |
4936 if (this._computedValue == null) { | 5019 if (this._computedValue == null) { |
(...skipping 18 matching lines...) Expand all Loading... |
4955 this._computedValue = $globals.world.gen.globalForStaticField(this, this._
computedValue, [this._computedValue]); | 5038 this._computedValue = $globals.world.gen.globalForStaticField(this, this._
computedValue, [this._computedValue]); |
4956 } | 5039 } |
4957 this._computing = false; | 5040 this._computing = false; |
4958 } | 5041 } |
4959 return this._computedValue; | 5042 return this._computedValue; |
4960 } | 5043 } |
4961 FieldMember.prototype._get = function(context, node, target, isDynamic) { | 5044 FieldMember.prototype._get = function(context, node, target, isDynamic) { |
4962 if (this.isNative && this.get$returnType() != null) { | 5045 if (this.isNative && this.get$returnType() != null) { |
4963 this.get$returnType().markUsed(); | 5046 this.get$returnType().markUsed(); |
4964 if ((this.get$returnType() instanceof DefinedType)) { | 5047 if ((this.get$returnType() instanceof DefinedType)) { |
4965 var factory_ = this.get$returnType().get$genericType().factory_; | 5048 var defaultType = this.get$returnType().get$genericType().defaultType; |
4966 if (factory_ != null && factory_.get$isNative()) { | 5049 if (defaultType != null && defaultType.get$isNative()) { |
4967 factory_.markUsed$0(); | 5050 defaultType.markUsed$0(); |
4968 } | 5051 } |
4969 } | 5052 } |
4970 } | 5053 } |
4971 if (this.isStatic) { | 5054 if (this.isStatic) { |
4972 this.declaringType.markUsed(); | 5055 this.declaringType.markUsed(); |
4973 var cv = this.computeValue(); | 5056 var cv = this.computeValue(); |
4974 if (this.isFinal) { | 5057 if (this.isFinal) { |
4975 return cv; | 5058 return cv; |
4976 } | 5059 } |
4977 $globals.world.gen.hasStatics = true; | 5060 $globals.world.gen.hasStatics = true; |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5295 this.definition = definition; | 5378 this.definition = definition; |
5296 // Initializers done | 5379 // Initializers done |
5297 Member.call(this, name, declaringType); | 5380 Member.call(this, name, declaringType); |
5298 } | 5381 } |
5299 MethodMember.prototype.get$definition = function() { return this.definition; }; | 5382 MethodMember.prototype.get$definition = function() { return this.definition; }; |
5300 MethodMember.prototype.set$definition = function(value) { return this.definition
= value; }; | 5383 MethodMember.prototype.set$definition = function(value) { return this.definition
= value; }; |
5301 MethodMember.prototype.get$returnType = function() { return this.returnType; }; | 5384 MethodMember.prototype.get$returnType = function() { return this.returnType; }; |
5302 MethodMember.prototype.set$returnType = function(value) { return this.returnType
= value; }; | 5385 MethodMember.prototype.set$returnType = function(value) { return this.returnType
= value; }; |
5303 MethodMember.prototype.get$parameters = function() { return this.parameters; }; | 5386 MethodMember.prototype.get$parameters = function() { return this.parameters; }; |
5304 MethodMember.prototype.set$parameters = function(value) { return this.parameters
= value; }; | 5387 MethodMember.prototype.set$parameters = function(value) { return this.parameters
= value; }; |
5305 MethodMember.prototype.get$typeParameters = function() { return this.typeParamet
ers; }; | |
5306 MethodMember.prototype.set$typeParameters = function(value) { return this.typePa
rameters = value; }; | |
5307 MethodMember.prototype.get$isStatic = function() { return this.isStatic; }; | 5388 MethodMember.prototype.get$isStatic = function() { return this.isStatic; }; |
5308 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v
alue; }; | 5389 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v
alue; }; |
5309 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; }; | 5390 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; }; |
5310 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract
= value; }; | 5391 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract
= value; }; |
5311 MethodMember.prototype.get$isConst = function() { return this.isConst; }; | 5392 MethodMember.prototype.get$isConst = function() { return this.isConst; }; |
5312 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val
ue; }; | 5393 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val
ue; }; |
5313 MethodMember.prototype.get$isFactory = function() { return this.isFactory; }; | 5394 MethodMember.prototype.get$isFactory = function() { return this.isFactory; }; |
5314 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory =
value; }; | 5395 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory =
value; }; |
5315 MethodMember.prototype.get$isLambda = function() { return this.isLambda; }; | 5396 MethodMember.prototype.get$isLambda = function() { return this.isLambda; }; |
5316 MethodMember.prototype.set$isLambda = function(value) { return this.isLambda = v
alue; }; | 5397 MethodMember.prototype.set$isLambda = function(value) { return this.isLambda = v
alue; }; |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5954 this.isAbstract = true; | 6035 this.isAbstract = true; |
5955 } | 6036 } |
5956 else { | 6037 else { |
5957 $globals.world.error(('' + mod + ' modifier not allowed on method'), mod
.get$span()); | 6038 $globals.world.error(('' + mod + ' modifier not allowed on method'), mod
.get$span()); |
5958 } | 6039 } |
5959 } | 6040 } |
5960 } | 6041 } |
5961 if (this.isFactory) { | 6042 if (this.isFactory) { |
5962 this.isStatic = true; | 6043 this.isStatic = true; |
5963 } | 6044 } |
5964 if (this.definition.typeParameters != null) { | |
5965 if (!this.isFactory) { | |
5966 $globals.world.error('Only factories are allowed to have explicit type par
ameters', this.definition.typeParameters.$index(0).get$span()); | |
5967 } | |
5968 else { | |
5969 this.typeParameters = this.definition.typeParameters; | |
5970 var $$list = this.definition.typeParameters; | |
5971 for (var $$i = 0;$$i < $$list.length; $$i++) { | |
5972 var tp = $$list.$index($$i); | |
5973 tp.set$enclosingElement(this); | |
5974 tp.resolve$0(); | |
5975 } | |
5976 } | |
5977 } | |
5978 if (this.get$isOperator() && this.isStatic && !this.get$isCallMethod()) { | 6045 if (this.get$isOperator() && this.isStatic && !this.get$isCallMethod()) { |
5979 $globals.world.error(('operator method may not be static "' + this.name + '"
'), this.get$span()); | 6046 $globals.world.error(('operator method may not be static "' + this.name + '"
'), this.get$span()); |
5980 } | 6047 } |
5981 if (this.isAbstract) { | 6048 if (this.isAbstract) { |
5982 if (this.definition.body != null && !(this.declaringType.get$definition() in
stanceof FunctionTypeDefinition)) { | 6049 if (this.definition.body != null && !(this.declaringType.get$definition() in
stanceof FunctionTypeDefinition)) { |
5983 $globals.world.error('abstract method can not have a body', this.get$span(
)); | 6050 $globals.world.error('abstract method can not have a body', this.get$span(
)); |
5984 } | 6051 } |
5985 if (this.isStatic && !(this.declaringType.get$definition() instanceof Functi
onTypeDefinition)) { | 6052 if (this.isStatic && !(this.declaringType.get$definition() instanceof Functi
onTypeDefinition)) { |
5986 $globals.world.error('static method can not be abstract', this.get$span())
; | 6053 $globals.world.error('static method can not be abstract', this.get$span())
; |
5987 } | 6054 } |
(...skipping 16 matching lines...) Expand all Loading... |
6004 var param = new Parameter(formal, this); | 6071 var param = new Parameter(formal, this); |
6005 param.resolve$0(); | 6072 param.resolve$0(); |
6006 this.parameters.add(param); | 6073 this.parameters.add(param); |
6007 } | 6074 } |
6008 if (!this.isLambda) { | 6075 if (!this.isLambda) { |
6009 this.get$library()._addMember(this); | 6076 this.get$library()._addMember(this); |
6010 } | 6077 } |
6011 } | 6078 } |
6012 MethodMember.prototype.resolveType = function(node, typeErrors) { | 6079 MethodMember.prototype.resolveType = function(node, typeErrors) { |
6013 var t = Element.prototype.resolveType.call(this, node, typeErrors); | 6080 var t = Element.prototype.resolveType.call(this, node, typeErrors); |
6014 if (this.isStatic && (t instanceof ParameterType) && (this.typeParameters == n
ull || !this.typeParameters.some((function (p) { | 6081 if (this.isStatic && !this.isFactory && (t instanceof ParameterType)) { |
6015 return p === t; | |
6016 }) | |
6017 ))) { | |
6018 $globals.world.error('using type parameter in static context.', node.span); | 6082 $globals.world.error('using type parameter in static context.', node.span); |
6019 } | 6083 } |
6020 return t; | 6084 return t; |
6021 } | 6085 } |
6022 MethodMember.prototype._get$3 = function($0, $1, $2) { | 6086 MethodMember.prototype._get$3 = function($0, $1, $2) { |
6023 return this._get($0, $1, $2, false); | 6087 return this._get($0, $1, $2, false); |
6024 }; | 6088 }; |
6025 MethodMember.prototype._get$3$isDynamic = MethodMember.prototype._get; | 6089 MethodMember.prototype._get$3$isDynamic = MethodMember.prototype._get; |
6026 MethodMember.prototype._get$4 = MethodMember.prototype._get; | 6090 MethodMember.prototype._get$4 = MethodMember.prototype._get; |
6027 MethodMember.prototype._set$4 = function($0, $1, $2, $3) { | 6091 MethodMember.prototype._set$4 = function($0, $1, $2, $3) { |
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8401 } | 8465 } |
8402 var _implements = null; | 8466 var _implements = null; |
8403 if (this._maybeEat(77/*TokenKind.IMPLEMENTS*/)) { | 8467 if (this._maybeEat(77/*TokenKind.IMPLEMENTS*/)) { |
8404 _implements = this.typeList(); | 8468 _implements = this.typeList(); |
8405 } | 8469 } |
8406 var _native = null; | 8470 var _native = null; |
8407 if (this._maybeEat(81/*TokenKind.NATIVE*/)) { | 8471 if (this._maybeEat(81/*TokenKind.NATIVE*/)) { |
8408 _native = this.maybeStringLiteral(); | 8472 _native = this.maybeStringLiteral(); |
8409 if (_native != null) _native = new NativeType(_native); | 8473 if (_native != null) _native = new NativeType(_native); |
8410 } | 8474 } |
8411 var _factory = null; | 8475 var oldFactory = this._maybeEat(75/*TokenKind.FACTORY*/); |
8412 if (this._maybeEat(75/*TokenKind.FACTORY*/)) { | 8476 var defaultType = null; |
8413 _factory = this.nameTypeReference(); | 8477 if (oldFactory || this._maybeEat(94/*TokenKind.DEFAULT*/)) { |
| 8478 if (oldFactory) { |
| 8479 $globals.world.warning('factory no longer supported, use "default" instead
', this._previousToken.get$span()); |
| 8480 } |
| 8481 var baseType = this.nameTypeReference(); |
| 8482 var typeParams0 = null; |
8414 if (this._peekKind(52/*TokenKind.LT*/)) { | 8483 if (this._peekKind(52/*TokenKind.LT*/)) { |
8415 this.typeParameters(); | 8484 typeParams0 = this.typeParameters(); |
8416 } | 8485 } |
| 8486 defaultType = new DefaultTypeReference(oldFactory, baseType, typeParams0, th
is._makeSpan(baseType.get$span().get$start())); |
8417 } | 8487 } |
8418 var body = []; | 8488 var body = []; |
8419 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { | 8489 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { |
8420 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { | 8490 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { |
8421 body.add$1(this.declaration(true)); | 8491 body.add$1(this.declaration(true)); |
8422 if (this._recover) { | 8492 if (this._recover) { |
8423 if (!this._recoverTo(7/*TokenKind.RBRACE*/, 10/*TokenKind.SEMICOLON*/))
break; | 8493 if (!this._recoverTo(7/*TokenKind.RBRACE*/, 10/*TokenKind.SEMICOLON*/))
break; |
8424 this._maybeEat(10/*TokenKind.SEMICOLON*/); | 8494 this._maybeEat(10/*TokenKind.SEMICOLON*/); |
8425 } | 8495 } |
8426 } | 8496 } |
8427 } | 8497 } |
8428 else { | 8498 else { |
8429 this._errorExpected('block starting with "{" or ";"'); | 8499 this._errorExpected('block starting with "{" or ";"'); |
8430 } | 8500 } |
8431 return new TypeDefinition(kind == 73/*TokenKind.CLASS*/, name, typeParams, _ex
tends, _implements, _native, _factory, body, this._makeSpan(start)); | 8501 return new TypeDefinition(kind == 73/*TokenKind.CLASS*/, name, typeParams, _ex
tends, _implements, _native, defaultType, body, this._makeSpan(start)); |
8432 } | 8502 } |
8433 Parser.prototype.functionTypeAlias = function() { | 8503 Parser.prototype.functionTypeAlias = function() { |
8434 var start = this._peekToken.start; | 8504 var start = this._peekToken.start; |
8435 this._eat(87/*TokenKind.TYPEDEF*/); | 8505 this._eat(87/*TokenKind.TYPEDEF*/); |
8436 var di = this.declaredIdentifier(false); | 8506 var di = this.declaredIdentifier(false); |
8437 var typeParams = null; | 8507 var typeParams = null; |
8438 if (this._peekKind(52/*TokenKind.LT*/)) { | 8508 if (this._peekKind(52/*TokenKind.LT*/)) { |
8439 typeParams = this.typeParameters(); | 8509 typeParams = this.typeParameters(); |
8440 } | 8510 } |
8441 var formals = this.formalParameterList(); | 8511 var formals = this.formalParameterList(); |
8442 this._eatSemicolon(); | 8512 this._eatSemicolon(); |
8443 var func = new FunctionDefinition(null, di.get$type(), di.get$name(), formals,
null, null, null, null, this._makeSpan(start)); | 8513 var func = new FunctionDefinition(null, di.get$type(), di.get$name(), formals,
null, null, null, this._makeSpan(start)); |
8444 return new FunctionTypeDefinition(func, typeParams, this._makeSpan(start)); | 8514 return new FunctionTypeDefinition(func, typeParams, this._makeSpan(start)); |
8445 } | 8515 } |
8446 Parser.prototype.initializers = function() { | 8516 Parser.prototype.initializers = function() { |
8447 this._inhibitLambda = true; | 8517 this._inhibitLambda = true; |
8448 var ret = []; | 8518 var ret = []; |
8449 do { | 8519 do { |
8450 ret.add$1(this.expression()); | 8520 ret.add$1(this.expression()); |
8451 } | 8521 } |
8452 while (this._maybeEat(11/*TokenKind.COMMA*/)) | 8522 while (this._maybeEat(11/*TokenKind.COMMA*/)) |
8453 this._inhibitLambda = false; | 8523 this._inhibitLambda = false; |
(...skipping 20 matching lines...) Expand all Loading... |
8474 return this.block(); | 8544 return this.block(); |
8475 } | 8545 } |
8476 } | 8546 } |
8477 else if (!inExpression) { | 8547 else if (!inExpression) { |
8478 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { | 8548 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { |
8479 return null; | 8549 return null; |
8480 } | 8550 } |
8481 } | 8551 } |
8482 this._error('Expected function body (neither { nor => found)'); | 8552 this._error('Expected function body (neither { nor => found)'); |
8483 } | 8553 } |
8484 Parser.prototype.finishField = function(start, modifiers, typeParams, type, name
, value) { | 8554 Parser.prototype.finishField = function(start, modifiers, type, name, value) { |
8485 if (typeParams != null) { | |
8486 $globals.world.internalError('trying to create a generic field', this._makeS
pan(start)); | |
8487 } | |
8488 var names = [name]; | 8555 var names = [name]; |
8489 var values = [value]; | 8556 var values = [value]; |
8490 while (this._maybeEat(11/*TokenKind.COMMA*/)) { | 8557 while (this._maybeEat(11/*TokenKind.COMMA*/)) { |
8491 names.add$1(this.identifier()); | 8558 names.add$1(this.identifier()); |
8492 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 8559 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
8493 values.add$1(this.expression()); | 8560 values.add$1(this.expression()); |
8494 } | 8561 } |
8495 else { | 8562 else { |
8496 values.add$1(); | 8563 values.add$1(); |
8497 } | 8564 } |
8498 } | 8565 } |
8499 this._eatSemicolon(); | 8566 this._eatSemicolon(); |
8500 return new VariableDefinition(modifiers, type, names, values, this._makeSpan(s
tart)); | 8567 return new VariableDefinition(modifiers, type, names, values, this._makeSpan(s
tart)); |
8501 } | 8568 } |
8502 Parser.prototype.finishDefinition = function(start, modifiers, di, typeParams) { | 8569 Parser.prototype.finishDefinition = function(start, modifiers, di) { |
8503 switch (this._peek()) { | 8570 switch (this._peek()) { |
8504 case 2/*TokenKind.LPAREN*/: | 8571 case 2/*TokenKind.LPAREN*/: |
8505 | 8572 |
8506 var formals = this.formalParameterList(); | 8573 var formals = this.formalParameterList(); |
8507 var inits = null, native_ = null; | 8574 var inits = null, native_ = null; |
8508 if (this._maybeEat(8/*TokenKind.COLON*/)) { | 8575 if (this._maybeEat(8/*TokenKind.COLON*/)) { |
8509 inits = this.initializers(); | 8576 inits = this.initializers(); |
8510 } | 8577 } |
8511 if (this._maybeEat(81/*TokenKind.NATIVE*/)) { | 8578 if (this._maybeEat(81/*TokenKind.NATIVE*/)) { |
8512 native_ = this.maybeStringLiteral(); | 8579 native_ = this.maybeStringLiteral(); |
8513 if (native_ == null) native_ = ''; | 8580 if (native_ == null) native_ = ''; |
8514 } | 8581 } |
8515 var body = this.functionBody(false); | 8582 var body = this.functionBody(false); |
8516 if (di.get$name() == null) { | 8583 if (di.get$name() == null) { |
8517 di.set$name(di.get$type().get$name()); | 8584 di.set$name(di.get$type().get$name()); |
8518 } | 8585 } |
8519 return new FunctionDefinition(modifiers, di.get$type(), di.get$name(), for
mals, typeParams, inits, native_, body, this._makeSpan(start)); | 8586 return new FunctionDefinition(modifiers, di.get$type(), di.get$name(), for
mals, inits, native_, body, this._makeSpan(start)); |
8520 | 8587 |
8521 case 20/*TokenKind.ASSIGN*/: | 8588 case 20/*TokenKind.ASSIGN*/: |
8522 | 8589 |
8523 this._eat(20/*TokenKind.ASSIGN*/); | 8590 this._eat(20/*TokenKind.ASSIGN*/); |
8524 var value = this.expression(); | 8591 var value = this.expression(); |
8525 return this.finishField(start, modifiers, typeParams, di.get$type(), di.ge
t$name(), value); | 8592 return this.finishField(start, modifiers, di.get$type(), di.get$name(), va
lue); |
8526 | 8593 |
8527 case 11/*TokenKind.COMMA*/: | 8594 case 11/*TokenKind.COMMA*/: |
8528 case 10/*TokenKind.SEMICOLON*/: | 8595 case 10/*TokenKind.SEMICOLON*/: |
8529 | 8596 |
8530 return this.finishField(start, modifiers, typeParams, di.get$type(), di.ge
t$name(), null); | 8597 return this.finishField(start, modifiers, di.get$type(), di.get$name(), nu
ll); |
8531 | 8598 |
8532 default: | 8599 default: |
8533 | 8600 |
8534 this._errorExpected('declaration'); | 8601 this._errorExpected('declaration'); |
8535 return null; | 8602 return null; |
8536 | 8603 |
8537 } | 8604 } |
8538 } | 8605 } |
8539 Parser.prototype.declaration = function(includeOperators) { | 8606 Parser.prototype.declaration = function(includeOperators) { |
8540 var start = this._peekToken.start; | 8607 var start = this._peekToken.start; |
8541 if (this._peekKind(75/*TokenKind.FACTORY*/)) { | 8608 if (this._peekKind(75/*TokenKind.FACTORY*/)) { |
8542 return this.factoryConstructorDeclaration(); | 8609 return this.factoryConstructorDeclaration(); |
8543 } | 8610 } |
8544 var modifiers = this._readModifiers(); | 8611 var modifiers = this._readModifiers(); |
8545 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators), null); | 8612 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators)); |
8546 } | 8613 } |
8547 Parser.prototype.factoryConstructorDeclaration = function() { | 8614 Parser.prototype.factoryConstructorDeclaration = function() { |
8548 var start = this._peekToken.start; | 8615 var start = this._peekToken.start; |
8549 var factoryToken = this._next(); | 8616 var factoryToken = this._next(); |
8550 var names = [this.identifier()]; | 8617 var names = [this.identifier()]; |
8551 while (this._maybeEat(14/*TokenKind.DOT*/)) { | 8618 while (this._maybeEat(14/*TokenKind.DOT*/)) { |
8552 names.add$1(this.identifier()); | 8619 names.add$1(this.identifier()); |
8553 } | 8620 } |
8554 var typeParams = null; | |
8555 if (this._peekKind(52/*TokenKind.LT*/)) { | 8621 if (this._peekKind(52/*TokenKind.LT*/)) { |
8556 typeParams = this.typeParameters(); | 8622 var tp = this.typeParameters(); |
| 8623 $globals.world.warning('type parameters on factories are no longer supported
, place them on the class instead'/*'type parameters on factories are no longer
supported, ' |
| 8624 + 'place them on the class instead'*/, this._makeSpan(tp.$index(0)
.get$span().get$start())); |
8557 } | 8625 } |
8558 var name = null; | 8626 var name = null; |
8559 var type = null; | 8627 var type = null; |
8560 if (this._maybeEat(14/*TokenKind.DOT*/)) { | 8628 if (this._maybeEat(14/*TokenKind.DOT*/)) { |
8561 name = this.identifier(); | 8629 name = this.identifier(); |
8562 } | 8630 } |
8563 else if (typeParams == null) { | 8631 else { |
8564 if (names.length > 1) { | 8632 if (names.length > 1) { |
8565 name = names.removeLast$0(); | 8633 name = names.removeLast$0(); |
8566 } | 8634 } |
8567 else { | 8635 else { |
8568 name = new Identifier('', names.$index(0).get$span()); | 8636 name = new Identifier('', names.$index(0).get$span()); |
8569 } | 8637 } |
8570 } | 8638 } |
8571 else { | |
8572 name = new Identifier('', names.$index(0).get$span()); | |
8573 } | |
8574 if (names.length > 1) { | 8639 if (names.length > 1) { |
8575 this._error('unsupported qualified name for factory', names.$index(0).get$sp
an()); | 8640 this._error('unsupported qualified name for factory', names.$index(0).get$sp
an()); |
8576 } | 8641 } |
8577 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get
$span()); | 8642 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get
$span()); |
8578 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); | 8643 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); |
8579 return this.finishDefinition(start, [factoryToken], di, typeParams); | 8644 return this.finishDefinition(start, [factoryToken], di); |
8580 } | 8645 } |
8581 Parser.prototype.statement = function() { | 8646 Parser.prototype.statement = function() { |
8582 switch (this._peek()) { | 8647 switch (this._peek()) { |
8583 case 89/*TokenKind.BREAK*/: | 8648 case 89/*TokenKind.BREAK*/: |
8584 | 8649 |
8585 return this.breakStatement(); | 8650 return this.breakStatement(); |
8586 | 8651 |
8587 case 93/*TokenKind.CONTINUE*/: | 8652 case 93/*TokenKind.CONTINUE*/: |
8588 | 8653 |
8589 return this.continueStatement(); | 8654 return this.continueStatement(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8657 this._eatSemicolon(); | 8722 this._eatSemicolon(); |
8658 expr.get$func().set$span(this._makeSpan(start)); | 8723 expr.get$func().set$span(this._makeSpan(start)); |
8659 } | 8724 } |
8660 return expr.get$func(); | 8725 return expr.get$func(); |
8661 } | 8726 } |
8662 else if ((expr instanceof DeclaredIdentifier)) { | 8727 else if ((expr instanceof DeclaredIdentifier)) { |
8663 var value = null; | 8728 var value = null; |
8664 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 8729 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
8665 value = this.expression(); | 8730 value = this.expression(); |
8666 } | 8731 } |
8667 return this.finishField(start, null, null, expr.get$type(), expr.get$name(),
value); | 8732 return this.finishField(start, null, expr.get$type(), expr.get$name(), value
); |
8668 } | 8733 } |
8669 else if (this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.get$x() instanceo
f DeclaredIdentifier))) { | 8734 else if (this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.get$x() instanceo
f DeclaredIdentifier))) { |
8670 var di = expr.get$x(); | 8735 var di = expr.get$x(); |
8671 return this.finishField(start, null, null, di.type, di.name, expr.get$y()); | 8736 return this.finishField(start, null, di.type, di.name, expr.get$y()); |
8672 } | 8737 } |
8673 else if (this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat(11/*TokenKind
.COMMA*/)) { | 8738 else if (this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat(11/*TokenKind
.COMMA*/)) { |
8674 var baseType = this._makeType(expr.get$x()); | 8739 var baseType = this._makeType(expr.get$x()); |
8675 var typeArgs = [this._makeType(expr.get$y())]; | 8740 var typeArgs = [this._makeType(expr.get$y())]; |
8676 var gt = this._finishTypeArguments(baseType, 0, typeArgs); | 8741 var gt = this._finishTypeArguments(baseType, 0, typeArgs); |
8677 var name = this.identifier(); | 8742 var name = this.identifier(); |
8678 var value = null; | 8743 var value = null; |
8679 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 8744 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
8680 value = this.expression(); | 8745 value = this.expression(); |
8681 } | 8746 } |
8682 return this.finishField(expr.get$span().get$start(), null, null, gt, name, v
alue); | 8747 return this.finishField(expr.get$span().get$start(), null, gt, name, value); |
8683 } | 8748 } |
8684 else { | 8749 else { |
8685 this._eatSemicolon(); | 8750 this._eatSemicolon(); |
8686 return new ExpressionStatement(expr, this._makeSpan(expr.get$span().get$star
t())); | 8751 return new ExpressionStatement(expr, this._makeSpan(expr.get$span().get$star
t())); |
8687 } | 8752 } |
8688 } | 8753 } |
8689 Parser.prototype.testCondition = function() { | 8754 Parser.prototype.testCondition = function() { |
8690 this._eatLeftParen(); | 8755 this._eatLeftParen(); |
8691 var ret = this.expression(); | 8756 var ret = this.expression(); |
8692 this._eat(3/*TokenKind.RPAREN*/); | 8757 this._eat(3/*TokenKind.RPAREN*/); |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9304 this._next(); | 9369 this._next(); |
9305 this._errorExpected('string literal, but found incomplete string'); | 9370 this._errorExpected('string literal, but found incomplete string'); |
9306 } | 9371 } |
9307 return null; | 9372 return null; |
9308 } | 9373 } |
9309 Parser.prototype._parenOrLambda = function() { | 9374 Parser.prototype._parenOrLambda = function() { |
9310 var start = this._peekToken.start; | 9375 var start = this._peekToken.start; |
9311 if (this._atClosureParameters()) { | 9376 if (this._atClosureParameters()) { |
9312 var formals = this.formalParameterList(); | 9377 var formals = this.formalParameterList(); |
9313 var body = this.functionBody(true); | 9378 var body = this.functionBody(true); |
9314 var func = new FunctionDefinition(null, null, null, formals, null, null, nul
l, body, this._makeSpan(start)); | 9379 var func = new FunctionDefinition(null, null, null, formals, null, null, bod
y, this._makeSpan(start)); |
9315 return new LambdaExpression(func, func.get$span()); | 9380 return new LambdaExpression(func, func.get$span()); |
9316 } | 9381 } |
9317 else { | 9382 else { |
9318 this._eatLeftParen(); | 9383 this._eatLeftParen(); |
9319 var saved = this._inhibitLambda; | 9384 var saved = this._inhibitLambda; |
9320 this._inhibitLambda = false; | 9385 this._inhibitLambda = false; |
9321 var expr = this.expression(); | 9386 var expr = this.expression(); |
9322 this._eat(3/*TokenKind.RPAREN*/); | 9387 this._eat(3/*TokenKind.RPAREN*/); |
9323 this._inhibitLambda = saved; | 9388 this._inhibitLambda = saved; |
9324 return new ParenExpression(expr, this._makeSpan(start)); | 9389 return new ParenExpression(expr, this._makeSpan(start)); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9706 var name = di.get$name(); | 9771 var name = di.get$name(); |
9707 var value = null; | 9772 var value = null; |
9708 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 9773 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
9709 if (!inOptionalBlock) { | 9774 if (!inOptionalBlock) { |
9710 this._error('default values only allowed inside [optional] section'); | 9775 this._error('default values only allowed inside [optional] section'); |
9711 } | 9776 } |
9712 value = this.expression(); | 9777 value = this.expression(); |
9713 } | 9778 } |
9714 else if (this._peekKind(2/*TokenKind.LPAREN*/)) { | 9779 else if (this._peekKind(2/*TokenKind.LPAREN*/)) { |
9715 var formals = this.formalParameterList(); | 9780 var formals = this.formalParameterList(); |
9716 var func = new FunctionDefinition(null, type, name, formals, null, null, nul
l, null, this._makeSpan(start)); | 9781 var func = new FunctionDefinition(null, type, name, formals, null, null, nul
l, this._makeSpan(start)); |
9717 type = new FunctionTypeReference(false, func, func.get$span()); | 9782 type = new FunctionTypeReference(false, func, func.get$span()); |
9718 } | 9783 } |
9719 if (inOptionalBlock && value == null) { | 9784 if (inOptionalBlock && value == null) { |
9720 value = new NullExpression(this._makeSpan(start)); | 9785 value = new NullExpression(this._makeSpan(start)); |
9721 } | 9786 } |
9722 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); | 9787 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); |
9723 } | 9788 } |
9724 Parser.prototype.formalParameterList = function() { | 9789 Parser.prototype.formalParameterList = function() { |
9725 this._eatLeftParen(); | 9790 this._eatLeftParen(); |
9726 var formals = []; | 9791 var formals = []; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9760 type = null; | 9825 type = null; |
9761 } | 9826 } |
9762 else if ((expr instanceof DeclaredIdentifier)) { | 9827 else if ((expr instanceof DeclaredIdentifier)) { |
9763 name = expr.get$name(); | 9828 name = expr.get$name(); |
9764 type = expr.get$type(); | 9829 type = expr.get$type(); |
9765 } | 9830 } |
9766 else { | 9831 else { |
9767 this._error('bad function body', expr.get$span()); | 9832 this._error('bad function body', expr.get$span()); |
9768 } | 9833 } |
9769 var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$star
t(), body.get$span().get$end()); | 9834 var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$star
t(), body.get$span().get$end()); |
9770 var func = new FunctionDefinition(null, type, name, formals, null, null, null,
body, span); | 9835 var func = new FunctionDefinition(null, type, name, formals, null, null, body,
span); |
9771 return new LambdaExpression(func, func.get$span()); | 9836 return new LambdaExpression(func, func.get$span()); |
9772 } | 9837 } |
9773 Parser.prototype._makeDeclaredIdentifier = function(e) { | 9838 Parser.prototype._makeDeclaredIdentifier = function(e) { |
9774 if ((e instanceof VarExpression)) { | 9839 if ((e instanceof VarExpression)) { |
9775 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); | 9840 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); |
9776 } | 9841 } |
9777 else if ((e instanceof DeclaredIdentifier)) { | 9842 else if ((e instanceof DeclaredIdentifier)) { |
9778 return e; | 9843 return e; |
9779 } | 9844 } |
9780 else { | 9845 else { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9878 DirectiveDefinition.prototype.get$name = function() { return this.name; }; | 9943 DirectiveDefinition.prototype.get$name = function() { return this.name; }; |
9879 DirectiveDefinition.prototype.set$name = function(value) { return this.name = va
lue; }; | 9944 DirectiveDefinition.prototype.set$name = function(value) { return this.name = va
lue; }; |
9880 DirectiveDefinition.prototype.get$arguments = function() { return this.arguments
; }; | 9945 DirectiveDefinition.prototype.get$arguments = function() { return this.arguments
; }; |
9881 DirectiveDefinition.prototype.set$arguments = function(value) { return this.argu
ments = value; }; | 9946 DirectiveDefinition.prototype.set$arguments = function(value) { return this.argu
ments = value; }; |
9882 DirectiveDefinition.prototype.visit = function(visitor) { | 9947 DirectiveDefinition.prototype.visit = function(visitor) { |
9883 return visitor.visitDirectiveDefinition(this); | 9948 return visitor.visitDirectiveDefinition(this); |
9884 } | 9949 } |
9885 DirectiveDefinition.prototype.visit$1 = DirectiveDefinition.prototype.visit; | 9950 DirectiveDefinition.prototype.visit$1 = DirectiveDefinition.prototype.visit; |
9886 // ********** Code for TypeDefinition ************** | 9951 // ********** Code for TypeDefinition ************** |
9887 $inherits(TypeDefinition, Definition); | 9952 $inherits(TypeDefinition, Definition); |
9888 function TypeDefinition(isClass, name, typeParameters, extendsTypes, implementsT
ypes, nativeType, factoryType, body, span) { | 9953 function TypeDefinition(isClass, name, typeParameters, extendsTypes, implementsT
ypes, nativeType, defaultType, body, span) { |
9889 this.isClass = isClass; | 9954 this.isClass = isClass; |
9890 this.name = name; | 9955 this.name = name; |
9891 this.typeParameters = typeParameters; | 9956 this.typeParameters = typeParameters; |
9892 this.extendsTypes = extendsTypes; | 9957 this.extendsTypes = extendsTypes; |
9893 this.implementsTypes = implementsTypes; | 9958 this.implementsTypes = implementsTypes; |
9894 this.nativeType = nativeType; | 9959 this.nativeType = nativeType; |
9895 this.factoryType = factoryType; | 9960 this.defaultType = defaultType; |
9896 this.body = body; | 9961 this.body = body; |
9897 // Initializers done | 9962 // Initializers done |
9898 Definition.call(this, span); | 9963 Definition.call(this, span); |
9899 } | 9964 } |
9900 TypeDefinition.prototype.get$isClass = function() { return this.isClass; }; | 9965 TypeDefinition.prototype.get$isClass = function() { return this.isClass; }; |
9901 TypeDefinition.prototype.set$isClass = function(value) { return this.isClass = v
alue; }; | 9966 TypeDefinition.prototype.set$isClass = function(value) { return this.isClass = v
alue; }; |
9902 TypeDefinition.prototype.get$name = function() { return this.name; }; | 9967 TypeDefinition.prototype.get$name = function() { return this.name; }; |
9903 TypeDefinition.prototype.set$name = function(value) { return this.name = value;
}; | 9968 TypeDefinition.prototype.set$name = function(value) { return this.name = value;
}; |
9904 TypeDefinition.prototype.get$typeParameters = function() { return this.typeParam
eters; }; | 9969 TypeDefinition.prototype.get$typeParameters = function() { return this.typeParam
eters; }; |
9905 TypeDefinition.prototype.set$typeParameters = function(value) { return this.type
Parameters = value; }; | 9970 TypeDefinition.prototype.set$typeParameters = function(value) { return this.type
Parameters = value; }; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9942 VariableDefinition.prototype.get$names = function() { return this.names; }; | 10007 VariableDefinition.prototype.get$names = function() { return this.names; }; |
9943 VariableDefinition.prototype.set$names = function(value) { return this.names = v
alue; }; | 10008 VariableDefinition.prototype.set$names = function(value) { return this.names = v
alue; }; |
9944 VariableDefinition.prototype.get$values = function() { return this.values; }; | 10009 VariableDefinition.prototype.get$values = function() { return this.values; }; |
9945 VariableDefinition.prototype.set$values = function(value) { return this.values =
value; }; | 10010 VariableDefinition.prototype.set$values = function(value) { return this.values =
value; }; |
9946 VariableDefinition.prototype.visit = function(visitor) { | 10011 VariableDefinition.prototype.visit = function(visitor) { |
9947 return visitor.visitVariableDefinition(this); | 10012 return visitor.visitVariableDefinition(this); |
9948 } | 10013 } |
9949 VariableDefinition.prototype.visit$1 = VariableDefinition.prototype.visit; | 10014 VariableDefinition.prototype.visit$1 = VariableDefinition.prototype.visit; |
9950 // ********** Code for FunctionDefinition ************** | 10015 // ********** Code for FunctionDefinition ************** |
9951 $inherits(FunctionDefinition, Definition); | 10016 $inherits(FunctionDefinition, Definition); |
9952 function FunctionDefinition(modifiers, returnType, name, formals, typeParameters
, initializers, nativeBody, body, span) { | 10017 function FunctionDefinition(modifiers, returnType, name, formals, initializers,
nativeBody, body, span) { |
9953 this.modifiers = modifiers; | 10018 this.modifiers = modifiers; |
9954 this.returnType = returnType; | 10019 this.returnType = returnType; |
9955 this.name = name; | 10020 this.name = name; |
9956 this.formals = formals; | 10021 this.formals = formals; |
9957 this.typeParameters = typeParameters; | |
9958 this.initializers = initializers; | 10022 this.initializers = initializers; |
9959 this.nativeBody = nativeBody; | 10023 this.nativeBody = nativeBody; |
9960 this.body = body; | 10024 this.body = body; |
9961 // Initializers done | 10025 // Initializers done |
9962 Definition.call(this, span); | 10026 Definition.call(this, span); |
9963 } | 10027 } |
9964 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp
e; }; | 10028 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp
e; }; |
9965 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu
rnType = value; }; | 10029 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu
rnType = value; }; |
9966 FunctionDefinition.prototype.get$name = function() { return this.name; }; | 10030 FunctionDefinition.prototype.get$name = function() { return this.name; }; |
9967 FunctionDefinition.prototype.set$name = function(value) { return this.name = val
ue; }; | 10031 FunctionDefinition.prototype.set$name = function(value) { return this.name = val
ue; }; |
9968 FunctionDefinition.prototype.get$typeParameters = function() { return this.typeP
arameters; }; | |
9969 FunctionDefinition.prototype.set$typeParameters = function(value) { return this.
typeParameters = value; }; | |
9970 FunctionDefinition.prototype.get$initializers = function() { return this.initial
izers; }; | 10032 FunctionDefinition.prototype.get$initializers = function() { return this.initial
izers; }; |
9971 FunctionDefinition.prototype.set$initializers = function(value) { return this.in
itializers = value; }; | 10033 FunctionDefinition.prototype.set$initializers = function(value) { return this.in
itializers = value; }; |
9972 FunctionDefinition.prototype.get$nativeBody = function() { return this.nativeBod
y; }; | 10034 FunctionDefinition.prototype.get$nativeBody = function() { return this.nativeBod
y; }; |
9973 FunctionDefinition.prototype.set$nativeBody = function(value) { return this.nati
veBody = value; }; | 10035 FunctionDefinition.prototype.set$nativeBody = function(value) { return this.nati
veBody = value; }; |
9974 FunctionDefinition.prototype.get$body = function() { return this.body; }; | 10036 FunctionDefinition.prototype.get$body = function() { return this.body; }; |
9975 FunctionDefinition.prototype.set$body = function(value) { return this.body = val
ue; }; | 10037 FunctionDefinition.prototype.set$body = function(value) { return this.body = val
ue; }; |
9976 FunctionDefinition.prototype.visit = function(visitor) { | 10038 FunctionDefinition.prototype.visit = function(visitor) { |
9977 return visitor.visitFunctionDefinition(this); | 10039 return visitor.visitFunctionDefinition(this); |
9978 } | 10040 } |
9979 FunctionDefinition.prototype.visit$1 = FunctionDefinition.prototype.visit; | 10041 FunctionDefinition.prototype.visit$1 = FunctionDefinition.prototype.visit; |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10536 TypeReference.call(this, span); | 10598 TypeReference.call(this, span); |
10537 } | 10599 } |
10538 FunctionTypeReference.prototype.get$isFinal = function() { return this.isFinal;
}; | 10600 FunctionTypeReference.prototype.get$isFinal = function() { return this.isFinal;
}; |
10539 FunctionTypeReference.prototype.set$isFinal = function(value) { return this.isFi
nal = value; }; | 10601 FunctionTypeReference.prototype.set$isFinal = function(value) { return this.isFi
nal = value; }; |
10540 FunctionTypeReference.prototype.get$func = function() { return this.func; }; | 10602 FunctionTypeReference.prototype.get$func = function() { return this.func; }; |
10541 FunctionTypeReference.prototype.set$func = function(value) { return this.func =
value; }; | 10603 FunctionTypeReference.prototype.set$func = function(value) { return this.func =
value; }; |
10542 FunctionTypeReference.prototype.visit = function(visitor) { | 10604 FunctionTypeReference.prototype.visit = function(visitor) { |
10543 return visitor.visitFunctionTypeReference(this); | 10605 return visitor.visitFunctionTypeReference(this); |
10544 } | 10606 } |
10545 FunctionTypeReference.prototype.visit$1 = FunctionTypeReference.prototype.visit; | 10607 FunctionTypeReference.prototype.visit$1 = FunctionTypeReference.prototype.visit; |
| 10608 // ********** Code for DefaultTypeReference ************** |
| 10609 $inherits(DefaultTypeReference, TypeReference); |
| 10610 function DefaultTypeReference(oldFactory, baseType, typeParameters, span) { |
| 10611 this.oldFactory = oldFactory; |
| 10612 this.baseType = baseType; |
| 10613 this.typeParameters = typeParameters; |
| 10614 // Initializers done |
| 10615 TypeReference.call(this, span); |
| 10616 } |
| 10617 DefaultTypeReference.prototype.get$baseType = function() { return this.baseType;
}; |
| 10618 DefaultTypeReference.prototype.set$baseType = function(value) { return this.base
Type = value; }; |
| 10619 DefaultTypeReference.prototype.get$typeParameters = function() { return this.typ
eParameters; }; |
| 10620 DefaultTypeReference.prototype.set$typeParameters = function(value) { return thi
s.typeParameters = value; }; |
| 10621 DefaultTypeReference.prototype.visit = function(visitor) { |
| 10622 return visitor.visitDefaultTypeReference(this); |
| 10623 } |
| 10624 DefaultTypeReference.prototype.visit$1 = DefaultTypeReference.prototype.visit; |
10546 // ********** Code for ArgumentNode ************** | 10625 // ********** Code for ArgumentNode ************** |
10547 $inherits(ArgumentNode, Node); | 10626 $inherits(ArgumentNode, Node); |
10548 function ArgumentNode(label, value, span) { | 10627 function ArgumentNode(label, value, span) { |
10549 this.label = label; | 10628 this.label = label; |
10550 this.value = value; | 10629 this.value = value; |
10551 // Initializers done | 10630 // Initializers done |
10552 Node.call(this, span); | 10631 Node.call(this, span); |
10553 } | 10632 } |
10554 ArgumentNode.prototype.get$label = function() { return this.label; }; | 10633 ArgumentNode.prototype.get$label = function() { return this.label; }; |
10555 ArgumentNode.prototype.set$label = function(value) { return this.label = value;
}; | 10634 ArgumentNode.prototype.set$label = function(value) { return this.label = value;
}; |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11572 $globals.world.error(('class "' + this.name + '" has a cycle in its in
heritance chain'), extendsTypeRef.get$span()); | 11651 $globals.world.error(('class "' + this.name + '" has a cycle in its in
heritance chain'), extendsTypeRef.get$span()); |
11573 } | 11652 } |
11574 } | 11653 } |
11575 else { | 11654 else { |
11576 if (!this.get$isObject()) { | 11655 if (!this.get$isObject()) { |
11577 this.set$parent($globals.world.objectType); | 11656 this.set$parent($globals.world.objectType); |
11578 this.get$parent().addDirectSubtype(this); | 11657 this.get$parent().addDirectSubtype(this); |
11579 } | 11658 } |
11580 } | 11659 } |
11581 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); | 11660 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); |
11582 if (typeDef.factoryType != null) { | 11661 if (typeDef.defaultType != null) { |
11583 $globals.world.error('factory not allowed on classes', typeDef.factoryTy
pe.span); | 11662 $globals.world.error('default not allowed on classes', typeDef.defaultTy
pe.span); |
11584 } | 11663 } |
11585 } | 11664 } |
11586 else { | 11665 else { |
11587 if (typeDef.implementsTypes != null && typeDef.implementsTypes.length > 0)
{ | 11666 if (typeDef.implementsTypes != null && typeDef.implementsTypes.length > 0)
{ |
11588 $globals.world.error('implements not allowed on interfaces (use extends)
', typeDef.implementsTypes.$index(0).get$span()); | 11667 $globals.world.error('implements not allowed on interfaces (use extends)
', typeDef.implementsTypes.$index(0).get$span()); |
11589 } | 11668 } |
11590 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes); | 11669 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes); |
11591 var res = this._cycleInInterfaceExtends(); | 11670 var res = this._cycleInInterfaceExtends(); |
11592 if (res >= 0) { | 11671 if (res >= 0) { |
11593 $globals.world.error(('interface "' + this.name + '" has a cycle in its
inheritance chain'), typeDef.extendsTypes.$index(res).get$span()); | 11672 $globals.world.error(('interface "' + this.name + '" has a cycle in its
inheritance chain'), typeDef.extendsTypes.$index(res).get$span()); |
11594 } | 11673 } |
11595 if (typeDef.factoryType != null) { | 11674 if (typeDef.defaultType != null) { |
11596 this.factory_ = this.resolveType(typeDef.factoryType, true); | 11675 this.defaultType = this.resolveType(typeDef.defaultType.baseType, true); |
11597 if (this.factory_ == null) { | 11676 if (this.defaultType == null) { |
11598 $globals.world.warning('unresolved factory', typeDef.factoryType.span)
; | 11677 $globals.world.warning('unresolved default class', typeDef.defaultType
.span); |
| 11678 } |
| 11679 else { |
| 11680 this.defaultType._resolveTypeParams(typeDef.defaultType.typeParameters
); |
11599 } | 11681 } |
11600 } | 11682 } |
11601 } | 11683 } |
11602 } | 11684 } |
11603 else if ((this.definition instanceof FunctionTypeDefinition)) { | 11685 else if ((this.definition instanceof FunctionTypeDefinition)) { |
11604 this.interfaces = [$globals.world.functionType]; | 11686 this.interfaces = [$globals.world.functionType]; |
11605 } | 11687 } |
11606 if (this.typeParameters != null) { | 11688 this._resolveTypeParams(this.typeParameters); |
11607 var $$list = this.typeParameters; | |
11608 for (var $$i = 0;$$i < $$list.length; $$i++) { | |
11609 var tp = $$list.$index($$i); | |
11610 tp.set$enclosingElement(this); | |
11611 tp.resolve$0(); | |
11612 } | |
11613 } | |
11614 if (this.get$isObject()) this._createNotEqualMember(); | 11689 if (this.get$isObject()) this._createNotEqualMember(); |
11615 $globals.world._addType(this); | 11690 $globals.world._addType(this); |
11616 var $$list = this.constructors.getValues(); | 11691 var $$list = this.constructors.getValues(); |
11617 for (var $$i = this.constructors.getValues().iterator$0(); $$i.hasNext$0(); )
{ | 11692 for (var $$i = this.constructors.getValues().iterator$0(); $$i.hasNext$0(); )
{ |
11618 var c = $$i.next$0(); | 11693 var c = $$i.next$0(); |
11619 c.resolve$0(); | 11694 c.resolve$0(); |
11620 } | 11695 } |
11621 var $list0 = this.members.getValues(); | 11696 var $list0 = this.members.getValues(); |
11622 for (var $$i = this.members.getValues().iterator$0(); $$i.hasNext$0(); ) { | 11697 for (var $$i = this.members.getValues().iterator$0(); $$i.hasNext$0(); ) { |
11623 var m = $$i.next$0(); | 11698 var m = $$i.next$0(); |
11624 m.resolve$0(); | 11699 m.resolve$0(); |
11625 } | 11700 } |
11626 this.factories.forEach((function (f) { | 11701 this.factories.forEach((function (f) { |
11627 return f.resolve$0(); | 11702 return f.resolve$0(); |
11628 }) | 11703 }) |
11629 ); | 11704 ); |
11630 if (this.get$isJsGlobalObject()) { | 11705 if (this.get$isJsGlobalObject()) { |
11631 var $list1 = this.members.getValues(); | 11706 var $list1 = this.members.getValues(); |
11632 for (var $$i = this.members.getValues().iterator$0(); $$i.hasNext$0(); ) { | 11707 for (var $$i = this.members.getValues().iterator$0(); $$i.hasNext$0(); ) { |
11633 var m0 = $$i.next$0(); | 11708 var m0 = $$i.next$0(); |
11634 if (!m0.get$isStatic()) $globals.world._addTopName(m0); | 11709 if (!m0.get$isStatic()) $globals.world._addTopName(m0); |
11635 } | 11710 } |
11636 } | 11711 } |
11637 } | 11712 } |
| 11713 DefinedType.prototype._resolveTypeParams = function(params) { |
| 11714 if (params == null) return; |
| 11715 for (var $$i = 0;$$i < params.length; $$i++) { |
| 11716 var tp = params.$index($$i); |
| 11717 tp.set$enclosingElement(this); |
| 11718 tp.resolve$0(); |
| 11719 } |
| 11720 } |
11638 DefinedType.prototype.addMethod = function(methodName, definition) { | 11721 DefinedType.prototype.addMethod = function(methodName, definition) { |
11639 if (methodName == null) methodName = definition.name.name; | 11722 if (methodName == null) methodName = definition.name.name; |
11640 var method = new MethodMember(methodName, this, definition); | 11723 var method = new MethodMember(methodName, this, definition); |
11641 if (method.get$isConstructor()) { | 11724 if (method.get$isConstructor()) { |
11642 if (this.constructors.containsKey(method.get$constructorName())) { | 11725 if (this.constructors.containsKey(method.get$constructorName())) { |
11643 $globals.world.error(('duplicate constructor definition of ' + method.get$
name()), definition.span); | 11726 $globals.world.error(('duplicate constructor definition of ' + method.get$
name()), definition.span); |
11644 return; | 11727 return; |
11645 } | 11728 } |
11646 this.constructors.$setindex(method.get$constructorName(), method); | 11729 this.constructors.$setindex(method.get$constructorName(), method); |
11647 return; | 11730 return; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11709 if (ret != null) return ret; | 11792 if (ret != null) return ret; |
11710 ret = this.factories.getFactory(this.name, constructorName); | 11793 ret = this.factories.getFactory(this.name, constructorName); |
11711 if (ret != null) return ret; | 11794 if (ret != null) return ret; |
11712 ret = this.constructors.$index(constructorName); | 11795 ret = this.constructors.$index(constructorName); |
11713 if (ret != null) return ret; | 11796 if (ret != null) return ret; |
11714 return this._tryCreateDefaultConstructor(constructorName); | 11797 return this._tryCreateDefaultConstructor(constructorName); |
11715 } | 11798 } |
11716 DefinedType.prototype.getConstructor = function(constructorName) { | 11799 DefinedType.prototype.getConstructor = function(constructorName) { |
11717 var ret = this.constructors.$index(constructorName); | 11800 var ret = this.constructors.$index(constructorName); |
11718 if (ret != null) { | 11801 if (ret != null) { |
11719 if (this.factory_ != null) { | 11802 if (this.defaultType != null) { |
11720 return this.factory_.getFactory(this, constructorName); | 11803 this._checkDefaultTypeParams(); |
| 11804 return this.defaultType.getFactory(this, constructorName); |
11721 } | 11805 } |
11722 return ret; | 11806 return ret; |
11723 } | 11807 } |
11724 ret = this.factories.getFactory(this.name, constructorName); | 11808 ret = this.factories.getFactory(this.name, constructorName); |
11725 if (ret != null) return ret; | 11809 if (ret != null) return ret; |
11726 return this._tryCreateDefaultConstructor(constructorName); | 11810 return this._tryCreateDefaultConstructor(constructorName); |
11727 } | 11811 } |
| 11812 DefinedType.prototype._checkDefaultTypeParams = function() { |
| 11813 function toList(list) { |
| 11814 return (list != null ? list : const$128/*const []*/); |
| 11815 } |
| 11816 var typeDef = this.definition; |
| 11817 if (typeDef.defaultType.oldFactory) { |
| 11818 return; |
| 11819 } |
| 11820 var interfaceParams = toList(this.typeParameters); |
| 11821 var defaultParams = toList(typeDef.defaultType.typeParameters); |
| 11822 var classParams = toList(this.defaultType.typeParameters); |
| 11823 if ($ne(interfaceParams.length, defaultParams.length) || $ne(defaultParams.len
gth, classParams.length)) { |
| 11824 $globals.world.error('"default" must have the same number of type parameters
as the class and interface do'/*'"default" must have the same number of type pa
rameters as ' |
| 11825 + 'the class and interface do'*/, this.get$span(), typeDef.default
Type.span, this.defaultType.get$span()); |
| 11826 return; |
| 11827 } |
| 11828 for (var i = 0; |
| 11829 i < interfaceParams.length; i++) { |
| 11830 var ip = interfaceParams.$index(i); |
| 11831 var dp = defaultParams.$index(i); |
| 11832 var cp = classParams.$index(i); |
| 11833 dp.resolve$0(); |
| 11834 if ($ne(ip.get$name(), dp.get$name()) || $ne(dp.get$name(), cp.get$name()))
{ |
| 11835 $globals.world.error('default class must have the same type parameter name
s as the class and interface'/*'default class must have the same type parameter
names as ' |
| 11836 + 'the class and interface'*/, ip.get$span(), dp.get$span(), c
p.get$span()); |
| 11837 } |
| 11838 else if ($ne(dp.get$extendsType(), cp.get$extendsType())) { |
| 11839 $globals.world.error('default class type parameters must have the same ext
ends as the class does'/*'default class type parameters must have the same exten
ds ' |
| 11840 + 'as the class does'*/, dp.get$span(), cp.get$span()); |
| 11841 } |
| 11842 else if (!dp.get$extendsType().isSubtypeOf$1(ip.get$extendsType())) { |
| 11843 $globals.world.warning('"default" can only have tighter type parameter "ex
tends" than the interface'/*'"default" can only have tighter type parameter "ext
ends"' |
| 11844 + ' than the interface'*/, dp.get$span(), ip.get$span()); |
| 11845 } |
| 11846 } |
| 11847 } |
11728 DefinedType.prototype._tryCreateDefaultConstructor = function(name) { | 11848 DefinedType.prototype._tryCreateDefaultConstructor = function(name) { |
11729 if (name == '' && this.definition != null && this.isClass && this.constructors
.get$length() == 0) { | 11849 if (name == '' && this.definition != null && this.isClass && this.constructors
.get$length() == 0) { |
11730 var span = this.definition.span; | 11850 var span = this.definition.span; |
11731 var inits = null, native_ = null, body = null; | 11851 var inits = null, native_ = null, body = null; |
11732 if (this.isNative) { | 11852 if (this.isNative) { |
11733 native_ = ''; | 11853 native_ = ''; |
11734 inits = null; | 11854 inits = null; |
11735 } | 11855 } |
11736 else { | 11856 else { |
11737 body = null; | 11857 body = null; |
11738 inits = [new CallExpression(new SuperExpression(span), [], span)]; | 11858 inits = [new CallExpression(new SuperExpression(span), [], span)]; |
11739 } | 11859 } |
11740 var typeDef = this.definition; | 11860 var typeDef = this.definition; |
11741 var c = new FunctionDefinition(null, null, typeDef.name, [], null, inits, na
tive_, body, span); | 11861 var c = new FunctionDefinition(null, null, typeDef.name, [], inits, native_,
body, span); |
11742 this.addMethod(null, c); | 11862 this.addMethod(null, c); |
11743 this.constructors.$index('').resolve$0(); | 11863 this.constructors.$index('').resolve$0(); |
11744 return this.constructors.$index(''); | 11864 return this.constructors.$index(''); |
11745 } | 11865 } |
11746 return null; | 11866 return null; |
11747 } | 11867 } |
11748 DefinedType.prototype.getMember = function(memberName) { | 11868 DefinedType.prototype.getMember = function(memberName) { |
11749 var member = this.members.$index(memberName); | 11869 var member = this.members.$index(memberName); |
11750 if (member != null) { | 11870 if (member != null) { |
11751 this._checkOverride(member); | 11871 this._checkOverride(member); |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13334 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_E, DoubleLinkedQueueEntry_E); | 13454 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_E, DoubleLinkedQueueEntry_E); |
13335 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ
ueueEntry_KeyValuePair_K$V); | 13455 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ
ueueEntry_KeyValuePair_K$V); |
13336 // ********** Globals ************** | 13456 // ********** Globals ************** |
13337 function $static_init(){ | 13457 function $static_init(){ |
13338 $globals._GREEN_COLOR = '\u001b[32m'; | 13458 $globals._GREEN_COLOR = '\u001b[32m'; |
13339 $globals._MAGENTA_COLOR = '\u001b[35m'; | 13459 $globals._MAGENTA_COLOR = '\u001b[35m'; |
13340 $globals._NO_COLOR = '\u001b[0m'; | 13460 $globals._NO_COLOR = '\u001b[0m'; |
13341 $globals._RED_COLOR = '\u001b[31m'; | 13461 $globals._RED_COLOR = '\u001b[31m'; |
13342 } | 13462 } |
13343 var const$0 = new EnvMap()/*const EnvMap()*/; | 13463 var const$0 = new EnvMap()/*const EnvMap()*/; |
| 13464 var const$127 = new IllegalAccessException()/*const IllegalAccessException()*/; |
| 13465 var const$128 = ImmutableList.ImmutableList$from$factory([])/*const []*/; |
13344 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; | 13466 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; |
13345 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; | 13467 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; |
13346 var const$8 = new NoMoreElementsException()/*const NoMoreElementsException()*/; | 13468 var const$8 = new NoMoreElementsException()/*const NoMoreElementsException()*/; |
13347 var $globals = {}; | 13469 var $globals = {}; |
13348 $static_init(); | 13470 $static_init(); |
13349 main(); | 13471 main(); |
OLD | NEW |