Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env node | 1 #!/usr/bin/env node |
| 2 // ********** Library dart:core ************** | 2 // ********** Library dart:core ************** |
| 3 // ********** Natives dart:core ************** | 3 // ********** Natives dart:core ************** |
| 4 /** | 4 /** |
| 5 * Generates a dynamic call stub for a function. | 5 * Generates a dynamic call stub for a function. |
| 6 * Our goal is to create a stub method like this on-the-fly: | 6 * Our goal is to create a stub method like this on-the-fly: |
| 7 * function($0, $1, capture) { this($0, $1, true, capture); } | 7 * function($0, $1, capture) { this($0, $1, true, capture); } |
| 8 * | 8 * |
| 9 * This stub then replaces the dynamic one on Function, with one that is | 9 * This stub then replaces the dynamic one on Function, with one that is |
| 10 * specialized for that particular function, taking into account its default | 10 * specialized for that particular function, taking into account its default |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 res = new StackOverflowException(); | 102 res = new StackOverflowException(); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 // TODO(jmesserly): setting the stack property is not a long term solution. | 105 // TODO(jmesserly): setting the stack property is not a long term solution. |
| 106 // Also it causes the exception to print as if it were a TypeError or | 106 // Also it causes the exception to print as if it were a TypeError or |
| 107 // RangeError, instead of using the proper toString. | 107 // RangeError, instead of using the proper toString. |
| 108 res.stack = e.stack; | 108 res.stack = e.stack; |
| 109 return res; | 109 return res; |
| 110 } | 110 } |
| 111 function $notnull_bool(test) { | 111 function $notnull_bool(test) { |
| 112 return typeof(test) == 'boolean' ? test : test.is$bool(); | 112 return (test === true || test === false) ? test : test.is$bool(); |
| 113 } | 113 } |
| 114 function $assert(test, text, url, line, column) { | 114 function $assert(test, text, url, line, column) { |
| 115 if (typeof test == 'function') test = test(); | 115 if (typeof test == 'function') test = test(); |
| 116 if (!test) $throw(new AssertError(text, url, line, column)); | 116 if (!test) $throw(new AssertError(text, url, line, column)); |
| 117 } | 117 } |
| 118 function $throw(e) { | 118 function $throw(e) { |
| 119 // If e is not a value, we can use V8's captureStackTrace utility method. | 119 // If e is not a value, we can use V8's captureStackTrace utility method. |
| 120 // TODO(jmesserly): capture the stack trace on other JS engines. | 120 // TODO(jmesserly): capture the stack trace on other JS engines. |
| 121 if (e && (typeof e == 'object') && Error.captureStackTrace) { | 121 if (e && (typeof e == 'object') && Error.captureStackTrace) { |
| 122 // TODO(jmesserly): this will clobber the e.stack property | 122 // TODO(jmesserly): this will clobber the e.stack property |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 // ********** Code for NoSuchMethodException ************** | 258 // ********** Code for NoSuchMethodException ************** |
| 259 function NoSuchMethodException(_receiver, _functionName, _arguments) { | 259 function NoSuchMethodException(_receiver, _functionName, _arguments) { |
| 260 this._receiver = _receiver; | 260 this._receiver = _receiver; |
| 261 this._functionName = _functionName; | 261 this._functionName = _functionName; |
| 262 this._arguments = _arguments; | 262 this._arguments = _arguments; |
| 263 // Initializers done | 263 // Initializers done |
| 264 } | 264 } |
| 265 NoSuchMethodException.prototype.toString = function() { | 265 NoSuchMethodException.prototype.toString = function() { |
| 266 var sb = new StringBufferImpl(""); | 266 var sb = new StringBufferImpl(""); |
| 267 for (var i = 0; | 267 for (var i = 0; |
| 268 $notnull_bool(i < this._arguments.length); i++) { | 268 i < this._arguments.length; i++) { |
|
jimhug
2011/11/12 00:26:36
I love the improvements to this file.
| |
| 269 if ($notnull_bool(i > 0)) { | 269 if (i > 0) { |
| 270 sb.add(", "); | 270 sb.add(", "); |
| 271 } | 271 } |
| 272 sb.add(this._arguments.$index(i)); | 272 sb.add(this._arguments.$index(i)); |
| 273 } | 273 } |
| 274 sb.add("]"); | 274 sb.add("]"); |
| 275 return ("NoSuchMethodException - receiver: '" + this._receiver + "' ") + ("fun ction name: '" + this._functionName + "' arguments: [" + sb + "]"); | 275 return ("NoSuchMethodException - receiver: '" + this._receiver + "' ") + ("fun ction name: '" + this._functionName + "' arguments: [" + sb + "]"); |
| 276 } | 276 } |
| 277 // ********** Code for ObjectNotClosureException ************** | 277 // ********** Code for ObjectNotClosureException ************** |
| 278 function ObjectNotClosureException() {} | 278 function ObjectNotClosureException() {} |
| 279 ObjectNotClosureException.prototype.toString = function() { | 279 ObjectNotClosureException.prototype.toString = function() { |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 894 ListFactory = Array; | 894 ListFactory = Array; |
| 895 ListFactory.prototype.is$ListFactory = function(){return this;}; | 895 ListFactory.prototype.is$ListFactory = function(){return this;}; |
| 896 ListFactory.prototype.is$List = function(){return this;}; | 896 ListFactory.prototype.is$List = function(){return this;}; |
| 897 ListFactory.prototype.is$List$ArgumentNode = function(){return this;}; | 897 ListFactory.prototype.is$List$ArgumentNode = function(){return this;}; |
| 898 ListFactory.prototype.is$List$Definition = function(){return this;}; | 898 ListFactory.prototype.is$List$Definition = function(){return this;}; |
| 899 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;}; | 899 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;}; |
| 900 ListFactory.prototype.is$List$String = function(){return this;}; | 900 ListFactory.prototype.is$List$String = function(){return this;}; |
| 901 ListFactory.prototype.is$List$Type = function(){return this;}; | 901 ListFactory.prototype.is$List$Type = function(){return this;}; |
| 902 ListFactory.prototype.is$List$Value = function(){return this;}; | 902 ListFactory.prototype.is$List$Value = function(){return this;}; |
| 903 ListFactory.prototype.is$List$int = function(){return this;}; | 903 ListFactory.prototype.is$List$int = function(){return this;}; |
| 904 ListFactory.prototype.is$Collection$Type = function(){return this;}; | |
| 904 ListFactory.prototype.is$Iterable = function(){return this;}; | 905 ListFactory.prototype.is$Iterable = function(){return this;}; |
| 905 ListFactory.ListFactory$from$factory = function(other) { | 906 ListFactory.ListFactory$from$factory = function(other) { |
| 906 var list = []; | 907 var list = []; |
| 907 for (var $i = other.iterator(); $i.hasNext(); ) { | 908 for (var $i = other.iterator(); $i.hasNext(); ) { |
| 908 var e = $i.next(); | 909 var e = $i.next(); |
| 909 list.add(e); | 910 list.add(e); |
| 910 } | 911 } |
| 911 return (list && list.is$ListFactory()); | 912 return (list && list.is$ListFactory()); |
| 912 } | 913 } |
| 913 ListFactory.prototype.add = function(value) { | 914 ListFactory.prototype.add = function(value) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 957 function ListIterator(array) { | 958 function ListIterator(array) { |
| 958 this._array = array; | 959 this._array = array; |
| 959 this._pos = 0; | 960 this._pos = 0; |
| 960 // Initializers done | 961 // Initializers done |
| 961 } | 962 } |
| 962 ListIterator.prototype.is$Iterator$T = function(){return this;}; | 963 ListIterator.prototype.is$Iterator$T = function(){return this;}; |
| 963 ListIterator.prototype.hasNext = function() { | 964 ListIterator.prototype.hasNext = function() { |
| 964 return this._array.length > this._pos; | 965 return this._array.length > this._pos; |
| 965 } | 966 } |
| 966 ListIterator.prototype.next = function() { | 967 ListIterator.prototype.next = function() { |
| 967 if ($notnull_bool(!$notnull_bool(this.hasNext()))) { | 968 if (!this.hasNext()) { |
| 968 $throw(const$0/*const NoMoreElementsException()*/); | 969 $throw(const$0/*const NoMoreElementsException()*/); |
| 969 } | 970 } |
| 970 return this._array.$index(this._pos++); | 971 return this._array.$index(this._pos++); |
| 971 } | 972 } |
| 972 // ********** Code for ImmutableList ************** | 973 // ********** Code for ImmutableList ************** |
| 973 function ImmutableList(length) { | 974 function ImmutableList(length) { |
| 974 this._length = length; | 975 this._length = length; |
| 975 ListFactory$E.call(this, length); | 976 ListFactory$E.call(this, length); |
| 976 // Initializers done | 977 // Initializers done |
| 977 } | 978 } |
| 978 /** Implements extends for Dart classes on JavaScript prototypes. */ | 979 /** Implements extends for Dart classes on JavaScript prototypes. */ |
| 979 function $inherits(child, parent) { | 980 function $inherits(child, parent) { |
| 980 if (child.prototype.__proto__) { | 981 if (child.prototype.__proto__) { |
| 981 child.prototype.__proto__ = parent.prototype; | 982 child.prototype.__proto__ = parent.prototype; |
| 982 } else { | 983 } else { |
| 983 function tmp() {}; | 984 function tmp() {}; |
| 984 tmp.prototype = parent.prototype; | 985 tmp.prototype = parent.prototype; |
| 985 child.prototype = new tmp(); | 986 child.prototype = new tmp(); |
| 986 child.prototype.constructor = child; | 987 child.prototype.constructor = child; |
| 987 } | 988 } |
| 988 } | 989 } |
| 989 $inherits(ImmutableList, ListFactory$E); | 990 $inherits(ImmutableList, ListFactory$E); |
| 990 ImmutableList.ImmutableList$from$factory = function(other) { | 991 ImmutableList.ImmutableList$from$factory = function(other) { |
| 991 var list = new ImmutableList(other.length); | 992 var list = new ImmutableList(other.length); |
| 992 for (var i = 0; | 993 for (var i = 0; |
| 993 $notnull_bool(i < other.length); i++) { | 994 i < other.length; i++) { |
| 994 list._setindex(i, other.$index(i)); | 995 list._setindex(i, other.$index(i)); |
| 995 } | 996 } |
| 996 return list; | 997 return list; |
| 997 } | 998 } |
| 998 ImmutableList.prototype.get$length = function() { | 999 ImmutableList.prototype.get$length = function() { |
| 999 return this._length; | 1000 return this._length; |
| 1000 } | 1001 } |
| 1001 ImmutableList.prototype.set$length = function(length) { | 1002 ImmutableList.prototype.set$length = function(length) { |
| 1002 $throw(const$14/*const IllegalAccessException()*/); | 1003 $throw(const$14/*const IllegalAccessException()*/); |
| 1003 } | 1004 } |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1033 $throw(const$14/*const IllegalAccessException()*/); | 1034 $throw(const$14/*const IllegalAccessException()*/); |
| 1034 } | 1035 } |
| 1035 ImmutableList.prototype.removeLast = function() { | 1036 ImmutableList.prototype.removeLast = function() { |
| 1036 $throw(const$14/*const IllegalAccessException()*/); | 1037 $throw(const$14/*const IllegalAccessException()*/); |
| 1037 } | 1038 } |
| 1038 // ********** Code for ImmutableMap ************** | 1039 // ********** Code for ImmutableMap ************** |
| 1039 function ImmutableMap(keyValuePairs) { | 1040 function ImmutableMap(keyValuePairs) { |
| 1040 this._internal = $map([]); | 1041 this._internal = $map([]); |
| 1041 // Initializers done | 1042 // Initializers done |
| 1042 for (var i = 0; | 1043 for (var i = 0; |
| 1043 $notnull_bool(i < keyValuePairs.length); i += 2) { | 1044 i < keyValuePairs.length; i += 2) { |
| 1044 this._internal.$setindex(keyValuePairs.$index(i), keyValuePairs.$index(i + 1 )); | 1045 this._internal.$setindex(keyValuePairs.$index(i), keyValuePairs.$index(i + 1 )); |
| 1045 } | 1046 } |
| 1046 } | 1047 } |
| 1047 ImmutableMap.prototype.is$Map$Node$Element = function(){return this;}; | 1048 ImmutableMap.prototype.is$Map$Node$Element = function(){return this;}; |
| 1048 ImmutableMap.prototype.is$Map$String$Member = function(){return this;}; | 1049 ImmutableMap.prototype.is$Map$String$Member = function(){return this;}; |
| 1049 ImmutableMap.prototype.$index = function(key) { | 1050 ImmutableMap.prototype.$index = function(key) { |
| 1050 return this._internal.$index(key); | 1051 return this._internal.$index(key); |
| 1051 } | 1052 } |
| 1052 ImmutableMap.prototype.isEmpty = function() { | 1053 ImmutableMap.prototype.isEmpty = function() { |
| 1053 return this._internal.isEmpty(); | 1054 return this._internal.isEmpty(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1104 var truncated = (this < 0) ? Math.ceil(this) : Math.floor(this); | 1105 var truncated = (this < 0) ? Math.ceil(this) : Math.floor(this); |
| 1105 | 1106 |
| 1106 if (truncated == -0.0) return 0; | 1107 if (truncated == -0.0) return 0; |
| 1107 return truncated; | 1108 return truncated; |
| 1108 } | 1109 } |
| 1109 NumImplementation.prototype.toDouble = function() { | 1110 NumImplementation.prototype.toDouble = function() { |
| 1110 return this + 0; | 1111 return this + 0; |
| 1111 } | 1112 } |
| 1112 NumImplementation.prototype.compareTo = function(other) { | 1113 NumImplementation.prototype.compareTo = function(other) { |
| 1113 var thisValue = this.toDouble(); | 1114 var thisValue = this.toDouble(); |
| 1114 if ($notnull_bool(thisValue < other)) { | 1115 if (thisValue < other) { |
| 1115 return -1; | 1116 return -1; |
| 1116 } | 1117 } |
| 1117 else if ($notnull_bool(thisValue > other)) { | 1118 else if (thisValue > other) { |
| 1118 return 1; | 1119 return 1; |
| 1119 } | 1120 } |
| 1120 else if ($notnull_bool(thisValue == other)) { | 1121 else if (thisValue == other) { |
| 1121 if ($notnull_bool(thisValue == 0)) { | 1122 if (thisValue == 0) { |
| 1122 var thisIsNegative = this.isNegative(); | 1123 var thisIsNegative = this.isNegative(); |
| 1123 var otherIsNegative = other.isNegative(); | 1124 var otherIsNegative = other.isNegative(); |
| 1124 if ($notnull_bool($eq(thisIsNegative, otherIsNegative))) return 0; | 1125 if ($eq(thisIsNegative, otherIsNegative)) return 0; |
| 1125 if ($notnull_bool(thisIsNegative)) return -1; | 1126 if ($notnull_bool(thisIsNegative)) return -1; |
| 1126 return 1; | 1127 return 1; |
| 1127 } | 1128 } |
| 1128 return 0; | 1129 return 0; |
| 1129 } | 1130 } |
| 1130 else if ($notnull_bool(this.isNaN())) { | 1131 else if (this.isNaN()) { |
| 1131 if ($notnull_bool(other.isNaN())) { | 1132 if (other.isNaN()) { |
| 1132 return 0; | 1133 return 0; |
| 1133 } | 1134 } |
| 1134 return 1; | 1135 return 1; |
| 1135 } | 1136 } |
| 1136 else { | 1137 else { |
| 1137 return -1; | 1138 return -1; |
| 1138 } | 1139 } |
| 1139 } | 1140 } |
| 1140 // ********** Code for ExceptionImplementation ************** | 1141 // ********** Code for ExceptionImplementation ************** |
| 1141 function ExceptionImplementation(_msg) { | 1142 function ExceptionImplementation(_msg) { |
| 1142 this._msg = _msg; | 1143 this._msg = _msg; |
| 1143 // Initializers done | 1144 // Initializers done |
| 1144 } | 1145 } |
| 1145 ExceptionImplementation.prototype.toString = function() { | 1146 ExceptionImplementation.prototype.toString = function() { |
| 1146 return $notnull_bool((this._msg == null)) ? "Exception" : ("Exception: " + thi s._msg + ""); | 1147 return (this._msg == null) ? "Exception" : ("Exception: " + this._msg + ""); |
| 1147 } | 1148 } |
| 1148 // ********** Code for HashMapImplementation ************** | 1149 // ********** Code for HashMapImplementation ************** |
| 1149 function HashMapImplementation() { | 1150 function HashMapImplementation() { |
| 1150 // Initializers done | 1151 // Initializers done |
| 1151 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { | 1152 if (HashMapImplementation._deletedKey == null) { |
| 1152 HashMapImplementation._deletedKey = new Object(); | 1153 HashMapImplementation._deletedKey = new Object(); |
| 1153 } | 1154 } |
| 1154 this._numberOfEntries = 0; | 1155 this._numberOfEntries = 0; |
| 1155 this._numberOfDeleted = 0; | 1156 this._numberOfDeleted = 0; |
| 1156 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); | 1157 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); |
| 1157 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1158 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1158 this._values = new ListFactory$V(8/*HashMapImplementation._INITIAL_CAPACITY*/) ; | 1159 this._values = new ListFactory$V(8/*HashMapImplementation._INITIAL_CAPACITY*/) ; |
| 1159 } | 1160 } |
| 1160 HashMapImplementation.prototype.is$HashMapImplementation = function(){return thi s;}; | 1161 HashMapImplementation.prototype.is$HashMapImplementation = function(){return thi s;}; |
| 1161 HashMapImplementation.prototype.is$Map$Node$Element = function(){return this;}; | 1162 HashMapImplementation.prototype.is$Map$Node$Element = function(){return this;}; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1175 return hashCode & (length - 1); | 1176 return hashCode & (length - 1); |
| 1176 } | 1177 } |
| 1177 HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length ) { | 1178 HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length ) { |
| 1178 return (currentProbe + numberOfProbes) & (length - 1); | 1179 return (currentProbe + numberOfProbes) & (length - 1); |
| 1179 } | 1180 } |
| 1180 HashMapImplementation.prototype._probeForAdding = function(key) { | 1181 HashMapImplementation.prototype._probeForAdding = function(key) { |
| 1181 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this ._keys.length); | 1182 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this ._keys.length); |
| 1182 var numberOfProbes = 1; | 1183 var numberOfProbes = 1; |
| 1183 var initialHash = hash; | 1184 var initialHash = hash; |
| 1184 var insertionIndex = -1; | 1185 var insertionIndex = -1; |
| 1185 while ($notnull_bool(true)) { | 1186 while (true) { |
| 1186 var existingKey = this._keys.$index(hash); | 1187 var existingKey = this._keys.$index(hash); |
| 1187 if ($notnull_bool(existingKey == null)) { | 1188 if (existingKey == null) { |
| 1188 if ($notnull_bool(insertionIndex < 0)) return hash; | 1189 if (insertionIndex < 0) return hash; |
| 1189 return insertionIndex; | 1190 return insertionIndex; |
| 1190 } | 1191 } |
| 1191 else if ($notnull_bool($eq(existingKey, key))) { | 1192 else if ($eq(existingKey, key)) { |
| 1192 return hash; | 1193 return hash; |
| 1193 } | 1194 } |
| 1194 else if ($notnull_bool((insertionIndex < 0) && (HashMapImplementation._delet edKey === existingKey))) { | 1195 else if ((insertionIndex < 0) && (HashMapImplementation._deletedKey === exis tingKey)) { |
| 1195 insertionIndex = hash; | 1196 insertionIndex = hash; |
| 1196 } | 1197 } |
| 1197 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength); | 1198 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength); |
| 1198 } | 1199 } |
| 1199 } | 1200 } |
| 1200 HashMapImplementation.prototype._probeForLookup = function(key) { | 1201 HashMapImplementation.prototype._probeForLookup = function(key) { |
| 1201 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this ._keys.length); | 1202 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this ._keys.length); |
| 1202 var numberOfProbes = 1; | 1203 var numberOfProbes = 1; |
| 1203 var initialHash = hash; | 1204 var initialHash = hash; |
| 1204 while ($notnull_bool(true)) { | 1205 while (true) { |
| 1205 var existingKey = this._keys.$index(hash); | 1206 var existingKey = this._keys.$index(hash); |
| 1206 if ($notnull_bool(existingKey == null)) return -1; | 1207 if (existingKey == null) return -1; |
| 1207 if ($notnull_bool($eq(existingKey, key))) return hash; | 1208 if ($eq(existingKey, key)) return hash; |
| 1208 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength); | 1209 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength); |
| 1209 } | 1210 } |
| 1210 } | 1211 } |
| 1211 HashMapImplementation.prototype._ensureCapacity = function() { | 1212 HashMapImplementation.prototype._ensureCapacity = function() { |
| 1212 var newNumberOfEntries = this._numberOfEntries + 1; | 1213 var newNumberOfEntries = this._numberOfEntries + 1; |
| 1213 if ($notnull_bool(newNumberOfEntries >= this._loadLimit)) { | 1214 if (newNumberOfEntries >= this._loadLimit) { |
| 1214 this._grow(this._keys.length * 2); | 1215 this._grow(this._keys.length * 2); |
| 1215 return; | 1216 return; |
| 1216 } | 1217 } |
| 1217 var capacity = this._keys.length; | 1218 var capacity = this._keys.length; |
| 1218 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; | 1219 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; |
| 1219 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; | 1220 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; |
| 1220 if ($notnull_bool(this._numberOfDeleted > numberOfFree)) { | 1221 if (this._numberOfDeleted > numberOfFree) { |
| 1221 this._grow(this._keys.length); | 1222 this._grow(this._keys.length); |
| 1222 } | 1223 } |
| 1223 } | 1224 } |
| 1224 HashMapImplementation._isPowerOfTwo = function(x) { | 1225 HashMapImplementation._isPowerOfTwo = function(x) { |
| 1225 return ((x & (x - 1)) == 0); | 1226 return ((x & (x - 1)) == 0); |
| 1226 } | 1227 } |
| 1227 HashMapImplementation.prototype._grow = function(newCapacity) { | 1228 HashMapImplementation.prototype._grow = function(newCapacity) { |
| 1228 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "hash_map_set.dart", 153, 12); | 1229 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "hash_map_set.dart", 153, 12); |
| 1229 var capacity = this._keys.length; | 1230 var capacity = this._keys.length; |
| 1230 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); | 1231 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); |
| 1231 var oldKeys = this._keys; | 1232 var oldKeys = this._keys; |
| 1232 var oldValues = this._values; | 1233 var oldValues = this._values; |
| 1233 this._keys = new ListFactory(newCapacity); | 1234 this._keys = new ListFactory(newCapacity); |
| 1234 this._values = new ListFactory$V(newCapacity); | 1235 this._values = new ListFactory$V(newCapacity); |
| 1235 for (var i = 0; | 1236 for (var i = 0; |
| 1236 $notnull_bool(i < capacity); i++) { | 1237 i < capacity; i++) { |
| 1237 var key = oldKeys.$index(i); | 1238 var key = oldKeys.$index(i); |
| 1238 if ($notnull_bool(key == null || key === HashMapImplementation._deletedKey)) { | 1239 if (key == null || key === HashMapImplementation._deletedKey) { |
| 1239 continue; | 1240 continue; |
| 1240 } | 1241 } |
| 1241 var value = oldValues.$index(i); | 1242 var value = oldValues.$index(i); |
| 1242 var newIndex = this._probeForAdding(key); | 1243 var newIndex = this._probeForAdding(key); |
| 1243 this._keys.$setindex(newIndex, key); | 1244 this._keys.$setindex(newIndex, key); |
| 1244 this._values.$setindex(newIndex, value); | 1245 this._values.$setindex(newIndex, value); |
| 1245 } | 1246 } |
| 1246 this._numberOfDeleted = 0; | 1247 this._numberOfDeleted = 0; |
| 1247 } | 1248 } |
| 1248 HashMapImplementation.prototype.$setindex = function(key, value) { | 1249 HashMapImplementation.prototype.$setindex = function(key, value) { |
| 1249 this._ensureCapacity(); | 1250 this._ensureCapacity(); |
| 1250 var index = this._probeForAdding(key); | 1251 var index = this._probeForAdding(key); |
| 1251 if ($notnull_bool((this._keys.$index(index) == null) || (this._keys.$index(ind ex) === HashMapImplementation._deletedKey))) { | 1252 if ((this._keys.$index(index) == null) || (this._keys.$index(index) === HashMa pImplementation._deletedKey)) { |
| 1252 this._numberOfEntries++; | 1253 this._numberOfEntries++; |
| 1253 } | 1254 } |
| 1254 this._keys.$setindex(index, key); | 1255 this._keys.$setindex(index, key); |
| 1255 this._values.$setindex(index, value); | 1256 this._values.$setindex(index, value); |
| 1256 } | 1257 } |
| 1257 HashMapImplementation.prototype.$index = function(key) { | 1258 HashMapImplementation.prototype.$index = function(key) { |
| 1258 var index = this._probeForLookup(key); | 1259 var index = this._probeForLookup(key); |
| 1259 if ($notnull_bool(index < 0)) return null; | 1260 if (index < 0) return null; |
| 1260 return this._values.$index(index); | 1261 return this._values.$index(index); |
| 1261 } | 1262 } |
| 1262 HashMapImplementation.prototype.remove = function(key) { | 1263 HashMapImplementation.prototype.remove = function(key) { |
| 1263 var index = this._probeForLookup(key); | 1264 var index = this._probeForLookup(key); |
| 1264 if ($notnull_bool(index >= 0)) { | 1265 if (index >= 0) { |
| 1265 this._numberOfEntries--; | 1266 this._numberOfEntries--; |
| 1266 var value = this._values.$index(index); | 1267 var value = this._values.$index(index); |
| 1267 this._values.$setindex(index); | 1268 this._values.$setindex(index); |
| 1268 this._keys.$setindex(index, HashMapImplementation._deletedKey); | 1269 this._keys.$setindex(index, HashMapImplementation._deletedKey); |
| 1269 this._numberOfDeleted++; | 1270 this._numberOfDeleted++; |
| 1270 return value; | 1271 return value; |
| 1271 } | 1272 } |
| 1272 return null; | 1273 return null; |
| 1273 } | 1274 } |
| 1274 HashMapImplementation.prototype.isEmpty = function() { | 1275 HashMapImplementation.prototype.isEmpty = function() { |
| 1275 return this._numberOfEntries == 0; | 1276 return this._numberOfEntries == 0; |
| 1276 } | 1277 } |
| 1277 HashMapImplementation.prototype.get$length = function() { | 1278 HashMapImplementation.prototype.get$length = function() { |
| 1278 return this._numberOfEntries; | 1279 return this._numberOfEntries; |
| 1279 } | 1280 } |
| 1280 Object.defineProperty(HashMapImplementation.prototype, "length", { | 1281 Object.defineProperty(HashMapImplementation.prototype, "length", { |
| 1281 get: HashMapImplementation.prototype.get$length | 1282 get: HashMapImplementation.prototype.get$length |
| 1282 }); | 1283 }); |
| 1283 HashMapImplementation.prototype.forEach = function(f) { | 1284 HashMapImplementation.prototype.forEach = function(f) { |
| 1284 var length = this._keys.length; | 1285 var length = this._keys.length; |
| 1285 for (var i = 0; | 1286 for (var i = 0; |
| 1286 $notnull_bool(i < length); i++) { | 1287 i < length; i++) { |
| 1287 if ($notnull_bool((this._keys.$index(i) != null) && (this._keys.$index(i) != = HashMapImplementation._deletedKey))) { | 1288 if ((this._keys.$index(i) != null) && (this._keys.$index(i) !== HashMapImple mentation._deletedKey)) { |
| 1288 f(this._keys.$index(i), this._values.$index(i)); | 1289 f(this._keys.$index(i), this._values.$index(i)); |
| 1289 } | 1290 } |
| 1290 } | 1291 } |
| 1291 } | 1292 } |
| 1292 HashMapImplementation.prototype.getKeys = function() { | 1293 HashMapImplementation.prototype.getKeys = function() { |
| 1293 var list = new ListFactory$K(this.get$length()); | 1294 var list = new ListFactory$K(this.get$length()); |
| 1294 var i = 0; | 1295 var i = 0; |
| 1295 this.forEach(function _(key, value) { | 1296 this.forEach(function _(key, value) { |
| 1296 list.$setindex(i++, key); | 1297 list.$setindex(i++, key); |
| 1297 } | 1298 } |
| 1298 ); | 1299 ); |
| 1299 return list; | 1300 return list; |
| 1300 } | 1301 } |
| 1301 HashMapImplementation.prototype.getValues = function() { | 1302 HashMapImplementation.prototype.getValues = function() { |
| 1302 var list = new ListFactory$V(this.get$length()); | 1303 var list = new ListFactory$V(this.get$length()); |
| 1303 var i = 0; | 1304 var i = 0; |
| 1304 this.forEach(function _(key, value) { | 1305 this.forEach(function _(key, value) { |
| 1305 list.$setindex(i++, value); | 1306 list.$setindex(i++, value); |
| 1306 } | 1307 } |
| 1307 ); | 1308 ); |
| 1308 return list; | 1309 return list; |
| 1309 } | 1310 } |
| 1310 HashMapImplementation.prototype.containsKey = function(key) { | 1311 HashMapImplementation.prototype.containsKey = function(key) { |
| 1311 return (this._probeForLookup(key) != -1); | 1312 return (this._probeForLookup(key) != -1); |
| 1312 } | 1313 } |
| 1313 // ********** Code for HashMapImplementation$E$E ************** | 1314 // ********** Code for HashMapImplementation$E$E ************** |
| 1314 function HashMapImplementation$E$E() { | 1315 function HashMapImplementation$E$E() { |
| 1315 // Initializers done | 1316 // Initializers done |
| 1316 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { | 1317 if (HashMapImplementation._deletedKey == null) { |
| 1317 HashMapImplementation._deletedKey = new Object(); | 1318 HashMapImplementation._deletedKey = new Object(); |
| 1318 } | 1319 } |
| 1319 this._numberOfEntries = 0; | 1320 this._numberOfEntries = 0; |
| 1320 this._numberOfDeleted = 0; | 1321 this._numberOfDeleted = 0; |
| 1321 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); | 1322 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); |
| 1322 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1323 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1323 this._values = new ListFactory$E(8/*HashMapImplementation._INITIAL_CAPACITY*/) ; | 1324 this._values = new ListFactory$E(8/*HashMapImplementation._INITIAL_CAPACITY*/) ; |
| 1324 } | 1325 } |
| 1325 $inherits(HashMapImplementation$E$E, HashMapImplementation); | 1326 $inherits(HashMapImplementation$E$E, HashMapImplementation); |
| 1326 HashMapImplementation$E$E.prototype.is$Map$Node$Element = function(){return this ;}; | 1327 HashMapImplementation$E$E.prototype.is$Map$Node$Element = function(){return this ;}; |
| 1327 HashMapImplementation$E$E.prototype.is$Map$String$Member = function(){return thi s;}; | 1328 HashMapImplementation$E$E.prototype.is$Map$String$Member = function(){return thi s;}; |
| 1328 HashMapImplementation$E$E._computeLoadLimit = function(capacity) { | 1329 HashMapImplementation$E$E._computeLoadLimit = function(capacity) { |
| 1329 return $truncdiv((capacity * 3), 4); | 1330 return $truncdiv((capacity * 3), 4); |
| 1330 } | 1331 } |
| 1331 HashMapImplementation$E$E._firstProbe = function(hashCode, length) { | 1332 HashMapImplementation$E$E._firstProbe = function(hashCode, length) { |
| 1332 return hashCode & (length - 1); | 1333 return hashCode & (length - 1); |
| 1333 } | 1334 } |
| 1334 HashMapImplementation$E$E._nextProbe = function(currentProbe, numberOfProbes, le ngth) { | 1335 HashMapImplementation$E$E._nextProbe = function(currentProbe, numberOfProbes, le ngth) { |
| 1335 return (currentProbe + numberOfProbes) & (length - 1); | 1336 return (currentProbe + numberOfProbes) & (length - 1); |
| 1336 } | 1337 } |
| 1337 HashMapImplementation$E$E.prototype._probeForAdding = function(key) { | 1338 HashMapImplementation$E$E.prototype._probeForAdding = function(key) { |
| 1338 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this ._keys.length); | 1339 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this ._keys.length); |
| 1339 var numberOfProbes = 1; | 1340 var numberOfProbes = 1; |
| 1340 var initialHash = hash; | 1341 var initialHash = hash; |
| 1341 var insertionIndex = -1; | 1342 var insertionIndex = -1; |
| 1342 while ($notnull_bool(true)) { | 1343 while (true) { |
| 1343 var existingKey = this._keys.$index(hash); | 1344 var existingKey = this._keys.$index(hash); |
| 1344 if ($notnull_bool(existingKey == null)) { | 1345 if (existingKey == null) { |
| 1345 if ($notnull_bool(insertionIndex < 0)) return hash; | 1346 if (insertionIndex < 0) return hash; |
| 1346 return insertionIndex; | 1347 return insertionIndex; |
| 1347 } | 1348 } |
| 1348 else if ($notnull_bool($eq(existingKey, key))) { | 1349 else if ($eq(existingKey, key)) { |
| 1349 return hash; | 1350 return hash; |
| 1350 } | 1351 } |
| 1351 else if ($notnull_bool((insertionIndex < 0) && (HashMapImplementation._delet edKey === existingKey))) { | 1352 else if ((insertionIndex < 0) && (HashMapImplementation._deletedKey === exis tingKey)) { |
| 1352 insertionIndex = hash; | 1353 insertionIndex = hash; |
| 1353 } | 1354 } |
| 1354 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength); | 1355 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength); |
| 1355 } | 1356 } |
| 1356 } | 1357 } |
| 1357 HashMapImplementation$E$E.prototype._probeForLookup = function(key) { | 1358 HashMapImplementation$E$E.prototype._probeForLookup = function(key) { |
| 1358 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this ._keys.length); | 1359 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this ._keys.length); |
| 1359 var numberOfProbes = 1; | 1360 var numberOfProbes = 1; |
| 1360 var initialHash = hash; | 1361 var initialHash = hash; |
| 1361 while ($notnull_bool(true)) { | 1362 while (true) { |
| 1362 var existingKey = this._keys.$index(hash); | 1363 var existingKey = this._keys.$index(hash); |
| 1363 if ($notnull_bool(existingKey == null)) return -1; | 1364 if (existingKey == null) return -1; |
| 1364 if ($notnull_bool($eq(existingKey, key))) return hash; | 1365 if ($eq(existingKey, key)) return hash; |
| 1365 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength); | 1366 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength); |
| 1366 } | 1367 } |
| 1367 } | 1368 } |
| 1368 HashMapImplementation$E$E.prototype._ensureCapacity = function() { | 1369 HashMapImplementation$E$E.prototype._ensureCapacity = function() { |
| 1369 var newNumberOfEntries = this._numberOfEntries + 1; | 1370 var newNumberOfEntries = this._numberOfEntries + 1; |
| 1370 if ($notnull_bool(newNumberOfEntries >= this._loadLimit)) { | 1371 if (newNumberOfEntries >= this._loadLimit) { |
| 1371 this._grow(this._keys.length * 2); | 1372 this._grow(this._keys.length * 2); |
| 1372 return; | 1373 return; |
| 1373 } | 1374 } |
| 1374 var capacity = this._keys.length; | 1375 var capacity = this._keys.length; |
| 1375 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; | 1376 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; |
| 1376 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; | 1377 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; |
| 1377 if ($notnull_bool(this._numberOfDeleted > numberOfFree)) { | 1378 if (this._numberOfDeleted > numberOfFree) { |
| 1378 this._grow(this._keys.length); | 1379 this._grow(this._keys.length); |
| 1379 } | 1380 } |
| 1380 } | 1381 } |
| 1381 HashMapImplementation$E$E._isPowerOfTwo = function(x) { | 1382 HashMapImplementation$E$E._isPowerOfTwo = function(x) { |
| 1382 return ((x & (x - 1)) == 0); | 1383 return ((x & (x - 1)) == 0); |
| 1383 } | 1384 } |
| 1384 HashMapImplementation$E$E.prototype._grow = function(newCapacity) { | 1385 HashMapImplementation$E$E.prototype._grow = function(newCapacity) { |
| 1385 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "hash_map_set.dart", 153, 12); | 1386 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "hash_map_set.dart", 153, 12); |
| 1386 var capacity = this._keys.length; | 1387 var capacity = this._keys.length; |
| 1387 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); | 1388 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); |
| 1388 var oldKeys = this._keys; | 1389 var oldKeys = this._keys; |
| 1389 var oldValues = this._values; | 1390 var oldValues = this._values; |
| 1390 this._keys = new ListFactory(newCapacity); | 1391 this._keys = new ListFactory(newCapacity); |
| 1391 this._values = new ListFactory$E(newCapacity); | 1392 this._values = new ListFactory$E(newCapacity); |
| 1392 for (var i = 0; | 1393 for (var i = 0; |
| 1393 $notnull_bool(i < capacity); i++) { | 1394 i < capacity; i++) { |
| 1394 var key = oldKeys.$index(i); | 1395 var key = oldKeys.$index(i); |
| 1395 if ($notnull_bool(key == null || key === HashMapImplementation._deletedKey)) { | 1396 if (key == null || key === HashMapImplementation._deletedKey) { |
| 1396 continue; | 1397 continue; |
| 1397 } | 1398 } |
| 1398 var value = oldValues.$index(i); | 1399 var value = oldValues.$index(i); |
| 1399 var newIndex = this._probeForAdding(key); | 1400 var newIndex = this._probeForAdding(key); |
| 1400 this._keys.$setindex(newIndex, key); | 1401 this._keys.$setindex(newIndex, key); |
| 1401 this._values.$setindex(newIndex, value); | 1402 this._values.$setindex(newIndex, value); |
| 1402 } | 1403 } |
| 1403 this._numberOfDeleted = 0; | 1404 this._numberOfDeleted = 0; |
| 1404 } | 1405 } |
| 1405 HashMapImplementation$E$E.prototype.$setindex = function(key, value) { | 1406 HashMapImplementation$E$E.prototype.$setindex = function(key, value) { |
| 1406 this._ensureCapacity(); | 1407 this._ensureCapacity(); |
| 1407 var index = this._probeForAdding(key); | 1408 var index = this._probeForAdding(key); |
| 1408 if ($notnull_bool((this._keys.$index(index) == null) || (this._keys.$index(ind ex) === HashMapImplementation._deletedKey))) { | 1409 if ((this._keys.$index(index) == null) || (this._keys.$index(index) === HashMa pImplementation._deletedKey)) { |
| 1409 this._numberOfEntries++; | 1410 this._numberOfEntries++; |
| 1410 } | 1411 } |
| 1411 this._keys.$setindex(index, key); | 1412 this._keys.$setindex(index, key); |
| 1412 this._values.$setindex(index, value); | 1413 this._values.$setindex(index, value); |
| 1413 } | 1414 } |
| 1414 HashMapImplementation$E$E.prototype.remove = function(key) { | 1415 HashMapImplementation$E$E.prototype.remove = function(key) { |
| 1415 var index = this._probeForLookup(key); | 1416 var index = this._probeForLookup(key); |
| 1416 if ($notnull_bool(index >= 0)) { | 1417 if (index >= 0) { |
| 1417 this._numberOfEntries--; | 1418 this._numberOfEntries--; |
| 1418 var value = this._values.$index(index); | 1419 var value = this._values.$index(index); |
| 1419 this._values.$setindex(index); | 1420 this._values.$setindex(index); |
| 1420 this._keys.$setindex(index, HashMapImplementation._deletedKey); | 1421 this._keys.$setindex(index, HashMapImplementation._deletedKey); |
| 1421 this._numberOfDeleted++; | 1422 this._numberOfDeleted++; |
| 1422 return value; | 1423 return value; |
| 1423 } | 1424 } |
| 1424 return null; | 1425 return null; |
| 1425 } | 1426 } |
| 1426 HashMapImplementation$E$E.prototype.isEmpty = function() { | 1427 HashMapImplementation$E$E.prototype.isEmpty = function() { |
| 1427 return this._numberOfEntries == 0; | 1428 return this._numberOfEntries == 0; |
| 1428 } | 1429 } |
| 1429 HashMapImplementation$E$E.prototype.forEach = function(f) { | 1430 HashMapImplementation$E$E.prototype.forEach = function(f) { |
| 1430 var length = this._keys.length; | 1431 var length = this._keys.length; |
| 1431 for (var i = 0; | 1432 for (var i = 0; |
| 1432 $notnull_bool(i < length); i++) { | 1433 i < length; i++) { |
| 1433 if ($notnull_bool((this._keys.$index(i) != null) && (this._keys.$index(i) != = HashMapImplementation._deletedKey))) { | 1434 if ((this._keys.$index(i) != null) && (this._keys.$index(i) !== HashMapImple mentation._deletedKey)) { |
| 1434 f(this._keys.$index(i), this._values.$index(i)); | 1435 f(this._keys.$index(i), this._values.$index(i)); |
| 1435 } | 1436 } |
| 1436 } | 1437 } |
| 1437 } | 1438 } |
| 1438 HashMapImplementation$E$E.prototype.getKeys = function() { | 1439 HashMapImplementation$E$E.prototype.getKeys = function() { |
| 1439 var list = new ListFactory$E(this.get$length()); | 1440 var list = new ListFactory$E(this.get$length()); |
| 1440 var i = 0; | 1441 var i = 0; |
| 1441 this.forEach(function _(key, value) { | 1442 this.forEach(function _(key, value) { |
| 1442 list.$setindex(i++, key); | 1443 list.$setindex(i++, key); |
| 1443 } | 1444 } |
| 1444 ); | 1445 ); |
| 1445 return list; | 1446 return list; |
| 1446 } | 1447 } |
| 1447 HashMapImplementation$E$E.prototype.containsKey = function(key) { | 1448 HashMapImplementation$E$E.prototype.containsKey = function(key) { |
| 1448 return (this._probeForLookup(key) != -1); | 1449 return (this._probeForLookup(key) != -1); |
| 1449 } | 1450 } |
| 1450 // ********** Code for HashMapImplementation$Element$HInstruction ************** | 1451 // ********** Code for HashMapImplementation$Element$HInstruction ************** |
| 1451 function HashMapImplementation$Element$HInstruction() { | 1452 function HashMapImplementation$Element$HInstruction() { |
| 1452 // Initializers done | 1453 // Initializers done |
| 1453 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { | 1454 if (HashMapImplementation._deletedKey == null) { |
| 1454 HashMapImplementation._deletedKey = new Object(); | 1455 HashMapImplementation._deletedKey = new Object(); |
| 1455 } | 1456 } |
| 1456 this._numberOfEntries = 0; | 1457 this._numberOfEntries = 0; |
| 1457 this._numberOfDeleted = 0; | 1458 this._numberOfDeleted = 0; |
| 1458 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); | 1459 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); |
| 1459 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1460 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1460 this._values = new ListFactory$HInstruction(8/*HashMapImplementation._INITIAL_ CAPACITY*/); | 1461 this._values = new ListFactory$HInstruction(8/*HashMapImplementation._INITIAL_ CAPACITY*/); |
| 1461 } | 1462 } |
| 1462 $inherits(HashMapImplementation$Element$HInstruction, HashMapImplementation); | 1463 $inherits(HashMapImplementation$Element$HInstruction, HashMapImplementation); |
| 1463 HashMapImplementation$Element$HInstruction.prototype.is$Map$Node$Element = false ; | 1464 HashMapImplementation$Element$HInstruction.prototype.is$Map$Node$Element = false ; |
| 1464 HashMapImplementation$Element$HInstruction.prototype.is$Map$String$Member = fals e; | 1465 HashMapImplementation$Element$HInstruction.prototype.is$Map$String$Member = fals e; |
| 1465 HashMapImplementation$Element$HInstruction.HashMapImplementation$from$factory = function(other) { | 1466 HashMapImplementation$Element$HInstruction.HashMapImplementation$from$factory = function(other) { |
| 1466 var result = new HashMapImplementation(); | 1467 var result = new HashMapImplementation(); |
| 1467 other.forEach((function (key, value) { | 1468 other.forEach((function (key, value) { |
| 1468 result.$setindex(key, value); | 1469 result.$setindex(key, value); |
| 1469 }) | 1470 }) |
| 1470 ); | 1471 ); |
| 1471 return (result && result.is$HashMapImplementation()); | 1472 return (result && result.is$HashMapImplementation()); |
| 1472 } | 1473 } |
| 1473 HashMapImplementation$Element$HInstruction._computeLoadLimit = function(capacity ) { | 1474 HashMapImplementation$Element$HInstruction._computeLoadLimit = function(capacity ) { |
| 1474 return $truncdiv((capacity * 3), 4); | 1475 return $truncdiv((capacity * 3), 4); |
| 1475 } | 1476 } |
| 1476 // ********** Code for HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePa ir$K$V ************** | 1477 // ********** Code for HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePa ir$K$V ************** |
| 1477 function HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V() { | 1478 function HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V() { |
| 1478 // Initializers done | 1479 // Initializers done |
| 1479 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { | 1480 if (HashMapImplementation._deletedKey == null) { |
| 1480 HashMapImplementation._deletedKey = new Object(); | 1481 HashMapImplementation._deletedKey = new Object(); |
| 1481 } | 1482 } |
| 1482 this._numberOfEntries = 0; | 1483 this._numberOfEntries = 0; |
| 1483 this._numberOfDeleted = 0; | 1484 this._numberOfDeleted = 0; |
| 1484 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); | 1485 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); |
| 1485 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1486 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1486 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$K$V(8/*Hash MapImplementation._INITIAL_CAPACITY*/); | 1487 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$K$V(8/*Hash MapImplementation._INITIAL_CAPACITY*/); |
| 1487 } | 1488 } |
| 1488 $inherits(HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V, HashM apImplementation); | 1489 $inherits(HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V, HashM apImplementation); |
| 1489 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$Map $Node$Element = false; | 1490 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$Map $Node$Element = false; |
| 1490 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$Map $String$Member = false; | 1491 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$Map $String$Member = false; |
| 1491 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V._computeLoadLimi t = function(capacity) { | 1492 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V._computeLoadLimi t = function(capacity) { |
| 1492 return $truncdiv((capacity * 3), 4); | 1493 return $truncdiv((capacity * 3), 4); |
| 1493 } | 1494 } |
| 1494 // ********** Code for HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValu ePair$Node$Element ************** | 1495 // ********** Code for HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValu ePair$Node$Element ************** |
| 1495 function HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Ele ment() { | 1496 function HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Ele ment() { |
| 1496 // Initializers done | 1497 // Initializers done |
| 1497 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { | 1498 if (HashMapImplementation._deletedKey == null) { |
| 1498 HashMapImplementation._deletedKey = new Object(); | 1499 HashMapImplementation._deletedKey = new Object(); |
| 1499 } | 1500 } |
| 1500 this._numberOfEntries = 0; | 1501 this._numberOfEntries = 0; |
| 1501 this._numberOfDeleted = 0; | 1502 this._numberOfDeleted = 0; |
| 1502 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); | 1503 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); |
| 1503 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1504 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1504 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$Node$Elemen t(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1505 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$Node$Elemen t(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1505 } | 1506 } |
| 1506 $inherits(HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$El ement, HashMapImplementation); | 1507 $inherits(HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$El ement, HashMapImplementation); |
| 1507 HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Element.prot otype.is$Map$Node$Element = false; | 1508 HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Element.prot otype.is$Map$Node$Element = false; |
| 1508 HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Element.prot otype.is$Map$String$Member = false; | 1509 HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Element.prot otype.is$Map$String$Member = false; |
| 1509 HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Element._com puteLoadLimit = function(capacity) { | 1510 HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Element._com puteLoadLimit = function(capacity) { |
| 1510 return $truncdiv((capacity * 3), 4); | 1511 return $truncdiv((capacity * 3), 4); |
| 1511 } | 1512 } |
| 1512 // ********** Code for HashMapImplementation$String$DoubleLinkedQueueEntry$KeyVa luePair$String$Keyword ************** | 1513 // ********** Code for HashMapImplementation$String$DoubleLinkedQueueEntry$KeyVa luePair$String$Keyword ************** |
| 1513 function HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String $Keyword() { | 1514 function HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String $Keyword() { |
| 1514 // Initializers done | 1515 // Initializers done |
| 1515 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { | 1516 if (HashMapImplementation._deletedKey == null) { |
| 1516 HashMapImplementation._deletedKey = new Object(); | 1517 HashMapImplementation._deletedKey = new Object(); |
| 1517 } | 1518 } |
| 1518 this._numberOfEntries = 0; | 1519 this._numberOfEntries = 0; |
| 1519 this._numberOfDeleted = 0; | 1520 this._numberOfDeleted = 0; |
| 1520 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); | 1521 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); |
| 1521 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1522 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1522 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$String$Keyw ord(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1523 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$String$Keyw ord(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1523 } | 1524 } |
| 1524 $inherits(HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$Strin g$Keyword, HashMapImplementation); | 1525 $inherits(HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$Strin g$Keyword, HashMapImplementation); |
| 1525 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword. prototype.is$Map$Node$Element = false; | 1526 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword. prototype.is$Map$Node$Element = false; |
| 1526 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword. prototype.is$Map$String$Member = false; | 1527 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword. prototype.is$Map$String$Member = false; |
| 1527 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword. _computeLoadLimit = function(capacity) { | 1528 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword. _computeLoadLimit = function(capacity) { |
| 1528 return $truncdiv((capacity * 3), 4); | 1529 return $truncdiv((capacity * 3), 4); |
| 1529 } | 1530 } |
| 1530 // ********** Code for HashMapImplementation$String$EvaluatedValue ************* * | 1531 // ********** Code for HashMapImplementation$String$EvaluatedValue ************* * |
| 1531 function HashMapImplementation$String$EvaluatedValue() { | 1532 function HashMapImplementation$String$EvaluatedValue() { |
| 1532 // Initializers done | 1533 // Initializers done |
| 1533 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { | 1534 if (HashMapImplementation._deletedKey == null) { |
| 1534 HashMapImplementation._deletedKey = new Object(); | 1535 HashMapImplementation._deletedKey = new Object(); |
| 1535 } | 1536 } |
| 1536 this._numberOfEntries = 0; | 1537 this._numberOfEntries = 0; |
| 1537 this._numberOfDeleted = 0; | 1538 this._numberOfDeleted = 0; |
| 1538 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); | 1539 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); |
| 1539 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1540 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1540 this._values = new ListFactory$EvaluatedValue(8/*HashMapImplementation._INITIA L_CAPACITY*/); | 1541 this._values = new ListFactory$EvaluatedValue(8/*HashMapImplementation._INITIA L_CAPACITY*/); |
| 1541 } | 1542 } |
| 1542 $inherits(HashMapImplementation$String$EvaluatedValue, HashMapImplementation); | 1543 $inherits(HashMapImplementation$String$EvaluatedValue, HashMapImplementation); |
| 1543 HashMapImplementation$String$EvaluatedValue.prototype.is$Map$Node$Element = fals e; | 1544 HashMapImplementation$String$EvaluatedValue.prototype.is$Map$Node$Element = fals e; |
| 1544 HashMapImplementation$String$EvaluatedValue.prototype.is$Map$String$Member = fal se; | 1545 HashMapImplementation$String$EvaluatedValue.prototype.is$Map$String$Member = fal se; |
| 1545 HashMapImplementation$String$EvaluatedValue._computeLoadLimit = function(capacit y) { | 1546 HashMapImplementation$String$EvaluatedValue._computeLoadLimit = function(capacit y) { |
| 1546 return $truncdiv((capacity * 3), 4); | 1547 return $truncdiv((capacity * 3), 4); |
| 1547 } | 1548 } |
| 1548 // ********** Code for HashMapImplementation$String$String ************** | 1549 // ********** Code for HashMapImplementation$String$String ************** |
| 1549 function HashMapImplementation$String$String() { | 1550 function HashMapImplementation$String$String() { |
| 1550 // Initializers done | 1551 // Initializers done |
| 1551 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { | 1552 if (HashMapImplementation._deletedKey == null) { |
| 1552 HashMapImplementation._deletedKey = new Object(); | 1553 HashMapImplementation._deletedKey = new Object(); |
| 1553 } | 1554 } |
| 1554 this._numberOfEntries = 0; | 1555 this._numberOfEntries = 0; |
| 1555 this._numberOfDeleted = 0; | 1556 this._numberOfDeleted = 0; |
| 1556 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); | 1557 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); |
| 1557 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1558 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1558 this._values = new ListFactory$String(8/*HashMapImplementation._INITIAL_CAPACI TY*/); | 1559 this._values = new ListFactory$String(8/*HashMapImplementation._INITIAL_CAPACI TY*/); |
| 1559 } | 1560 } |
| 1560 $inherits(HashMapImplementation$String$String, HashMapImplementation); | 1561 $inherits(HashMapImplementation$String$String, HashMapImplementation); |
| 1561 HashMapImplementation$String$String.prototype.is$Map$Node$Element = false; | 1562 HashMapImplementation$String$String.prototype.is$Map$Node$Element = false; |
| 1562 HashMapImplementation$String$String.prototype.is$Map$String$Member = false; | 1563 HashMapImplementation$String$String.prototype.is$Map$String$Member = false; |
| 1563 HashMapImplementation$String$String._computeLoadLimit = function(capacity) { | 1564 HashMapImplementation$String$String._computeLoadLimit = function(capacity) { |
| 1564 return $truncdiv((capacity * 3), 4); | 1565 return $truncdiv((capacity * 3), 4); |
| 1565 } | 1566 } |
| 1566 // ********** Code for HashMapImplementation$Type$Type ************** | 1567 // ********** Code for HashMapImplementation$Type$Type ************** |
| 1567 function HashMapImplementation$Type$Type() { | 1568 function HashMapImplementation$Type$Type() { |
| 1568 // Initializers done | 1569 // Initializers done |
| 1569 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { | 1570 if (HashMapImplementation._deletedKey == null) { |
| 1570 HashMapImplementation._deletedKey = new Object(); | 1571 HashMapImplementation._deletedKey = new Object(); |
| 1571 } | 1572 } |
| 1572 this._numberOfEntries = 0; | 1573 this._numberOfEntries = 0; |
| 1573 this._numberOfDeleted = 0; | 1574 this._numberOfDeleted = 0; |
| 1574 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); | 1575 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); |
| 1575 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1576 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1576 this._values = new ListFactory$Type(8/*HashMapImplementation._INITIAL_CAPACITY */); | 1577 this._values = new ListFactory$Type(8/*HashMapImplementation._INITIAL_CAPACITY */); |
| 1577 } | 1578 } |
| 1578 $inherits(HashMapImplementation$Type$Type, HashMapImplementation); | 1579 $inherits(HashMapImplementation$Type$Type, HashMapImplementation); |
| 1579 HashMapImplementation$Type$Type.prototype.is$Map$Node$Element = false; | 1580 HashMapImplementation$Type$Type.prototype.is$Map$Node$Element = false; |
| 1580 HashMapImplementation$Type$Type.prototype.is$Map$String$Member = false; | 1581 HashMapImplementation$Type$Type.prototype.is$Map$String$Member = false; |
| 1581 HashMapImplementation$Type$Type._computeLoadLimit = function(capacity) { | 1582 HashMapImplementation$Type$Type._computeLoadLimit = function(capacity) { |
| 1582 return $truncdiv((capacity * 3), 4); | 1583 return $truncdiv((capacity * 3), 4); |
| 1583 } | 1584 } |
| 1584 // ********** Code for HashSetImplementation ************** | 1585 // ********** Code for HashSetImplementation ************** |
| 1585 function HashSetImplementation() { | 1586 function HashSetImplementation() { |
| 1586 // Initializers done | 1587 // Initializers done |
| 1587 this._backingMap = new HashMapImplementation$E$E(); | 1588 this._backingMap = new HashMapImplementation$E$E(); |
| 1588 } | 1589 } |
| 1589 HashSetImplementation.prototype.is$HashSetImplementation = function(){return thi s;}; | 1590 HashSetImplementation.prototype.is$HashSetImplementation = function(){return thi s;}; |
| 1591 HashSetImplementation.prototype.is$Collection$Type = function(){return this;}; | |
| 1590 HashSetImplementation.prototype.is$Iterable = function(){return this;}; | 1592 HashSetImplementation.prototype.is$Iterable = function(){return this;}; |
| 1591 HashSetImplementation.HashSetImplementation$from$factory = function(other) { | 1593 HashSetImplementation.HashSetImplementation$from$factory = function(other) { |
| 1592 var set = new HashSetImplementation(); | 1594 var set = new HashSetImplementation(); |
| 1593 for (var $i = other.iterator(); $i.hasNext(); ) { | 1595 for (var $i = other.iterator(); $i.hasNext(); ) { |
| 1594 var e = $i.next(); | 1596 var e = $i.next(); |
| 1595 set.add(e); | 1597 set.add(e); |
| 1596 } | 1598 } |
| 1597 return (set && set.is$HashSetImplementation()); | 1599 return (set && set.is$HashSetImplementation()); |
| 1598 } | 1600 } |
| 1599 HashSetImplementation.prototype.add = function(value) { | 1601 HashSetImplementation.prototype.add = function(value) { |
| 1600 this._backingMap.$setindex(value, value); | 1602 this._backingMap.$setindex(value, value); |
| 1601 } | 1603 } |
| 1602 HashSetImplementation.prototype.contains = function(value) { | 1604 HashSetImplementation.prototype.contains = function(value) { |
| 1603 return this._backingMap.containsKey(value); | 1605 return this._backingMap.containsKey(value); |
| 1604 } | 1606 } |
| 1605 HashSetImplementation.prototype.remove = function(value) { | 1607 HashSetImplementation.prototype.remove = function(value) { |
| 1606 if ($notnull_bool(!$notnull_bool(this._backingMap.containsKey(value)))) return false; | 1608 if (!this._backingMap.containsKey(value)) return false; |
| 1607 this._backingMap.remove(value); | 1609 this._backingMap.remove(value); |
| 1608 return true; | 1610 return true; |
| 1609 } | 1611 } |
| 1610 HashSetImplementation.prototype.addAll = function(collection) { | 1612 HashSetImplementation.prototype.addAll = function(collection) { |
| 1611 var $this = this; // closure support | 1613 var $this = this; // closure support |
| 1612 collection.forEach(function _(value) { | 1614 collection.forEach(function _(value) { |
| 1613 $this.add(value); | 1615 $this.add(value); |
| 1614 } | 1616 } |
| 1615 ); | 1617 ); |
| 1616 } | 1618 } |
| 1617 HashSetImplementation.prototype.forEach = function(f) { | 1619 HashSetImplementation.prototype.forEach = function(f) { |
| 1618 this._backingMap.forEach(function _(key, value) { | 1620 this._backingMap.forEach(function _(key, value) { |
| 1619 f(key); | 1621 f(key); |
| 1620 } | 1622 } |
| 1621 ); | 1623 ); |
| 1622 } | 1624 } |
| 1623 HashSetImplementation.prototype.filter = function(f) { | 1625 HashSetImplementation.prototype.filter = function(f) { |
| 1624 var result = new HashSetImplementation$E(); | 1626 var result = new HashSetImplementation$E(); |
| 1625 this._backingMap.forEach(function _(key, value) { | 1627 this._backingMap.forEach(function _(key, value) { |
| 1626 if ($notnull_bool(f(key))) result.add(key); | 1628 if (f(key)) result.add(key); |
| 1627 } | 1629 } |
| 1628 ); | 1630 ); |
| 1629 return result; | 1631 return result; |
| 1630 } | 1632 } |
| 1631 HashSetImplementation.prototype.some = function(f) { | 1633 HashSetImplementation.prototype.some = function(f) { |
| 1632 var keys = this._backingMap.getKeys(); | 1634 var keys = this._backingMap.getKeys(); |
| 1633 return keys.some(f); | 1635 return $assert_bool(keys.some(f)); |
| 1634 } | 1636 } |
| 1635 HashSetImplementation.prototype.isEmpty = function() { | 1637 HashSetImplementation.prototype.isEmpty = function() { |
| 1636 return this._backingMap.isEmpty(); | 1638 return this._backingMap.isEmpty(); |
| 1637 } | 1639 } |
| 1638 HashSetImplementation.prototype.get$length = function() { | 1640 HashSetImplementation.prototype.get$length = function() { |
| 1639 return this._backingMap.get$length(); | 1641 return this._backingMap.get$length(); |
| 1640 } | 1642 } |
| 1641 Object.defineProperty(HashSetImplementation.prototype, "length", { | 1643 Object.defineProperty(HashSetImplementation.prototype, "length", { |
| 1642 get: HashSetImplementation.prototype.get$length | 1644 get: HashSetImplementation.prototype.get$length |
| 1643 }); | 1645 }); |
| 1644 HashSetImplementation.prototype.iterator = function() { | 1646 HashSetImplementation.prototype.iterator = function() { |
| 1645 return new HashSetIterator$E(this); | 1647 return new HashSetIterator$E(this); |
| 1646 } | 1648 } |
| 1647 // ********** Code for HashSetImplementation$E ************** | 1649 // ********** Code for HashSetImplementation$E ************** |
| 1648 function HashSetImplementation$E() { | 1650 function HashSetImplementation$E() { |
| 1649 // Initializers done | 1651 // Initializers done |
| 1650 this._backingMap = new HashMapImplementation$E$E(); | 1652 this._backingMap = new HashMapImplementation$E$E(); |
| 1651 } | 1653 } |
| 1652 $inherits(HashSetImplementation$E, HashSetImplementation); | 1654 $inherits(HashSetImplementation$E, HashSetImplementation); |
| 1655 HashSetImplementation$E.prototype.is$Collection$Type = function(){return this;}; | |
| 1653 HashSetImplementation$E.prototype.is$Iterable = function(){return this;}; | 1656 HashSetImplementation$E.prototype.is$Iterable = function(){return this;}; |
| 1654 // ********** Code for HashSetImplementation$String ************** | 1657 // ********** Code for HashSetImplementation$String ************** |
| 1655 function HashSetImplementation$String() { | 1658 function HashSetImplementation$String() { |
| 1656 // Initializers done | 1659 // Initializers done |
| 1657 this._backingMap = new HashMapImplementation$String$String(); | 1660 this._backingMap = new HashMapImplementation$String$String(); |
| 1658 } | 1661 } |
| 1659 $inherits(HashSetImplementation$String, HashSetImplementation); | 1662 $inherits(HashSetImplementation$String, HashSetImplementation); |
| 1663 HashSetImplementation$String.prototype.is$Collection$Type = false; | |
| 1660 HashSetImplementation$String.prototype.is$Iterable = function(){return this;}; | 1664 HashSetImplementation$String.prototype.is$Iterable = function(){return this;}; |
| 1661 // ********** Code for HashSetImplementation$Type ************** | 1665 // ********** Code for HashSetImplementation$Type ************** |
| 1662 function HashSetImplementation$Type() { | 1666 function HashSetImplementation$Type() { |
| 1663 // Initializers done | 1667 // Initializers done |
| 1664 this._backingMap = new HashMapImplementation$Type$Type(); | 1668 this._backingMap = new HashMapImplementation$Type$Type(); |
| 1665 } | 1669 } |
| 1666 $inherits(HashSetImplementation$Type, HashSetImplementation); | 1670 $inherits(HashSetImplementation$Type, HashSetImplementation); |
| 1671 HashSetImplementation$Type.prototype.is$Collection$Type = function(){return this ;}; | |
| 1667 HashSetImplementation$Type.prototype.is$Iterable = function(){return this;}; | 1672 HashSetImplementation$Type.prototype.is$Iterable = function(){return this;}; |
| 1668 // ********** Code for HashSetIterator ************** | 1673 // ********** Code for HashSetIterator ************** |
| 1669 function HashSetIterator(set_) { | 1674 function HashSetIterator(set_) { |
| 1670 this._nextValidIndex = -1; | 1675 this._nextValidIndex = -1; |
| 1671 this._entries = set_._backingMap._keys; | 1676 this._entries = set_._backingMap._keys; |
| 1672 // Initializers done | 1677 // Initializers done |
| 1673 this._advance(); | 1678 this._advance(); |
| 1674 } | 1679 } |
| 1675 HashSetIterator.prototype.is$Iterator$T = function(){return this;}; | 1680 HashSetIterator.prototype.is$Iterator$T = function(){return this;}; |
| 1676 HashSetIterator.prototype.hasNext = function() { | 1681 HashSetIterator.prototype.hasNext = function() { |
| 1677 if ($notnull_bool(this._nextValidIndex >= this._entries.length)) return false; | 1682 if (this._nextValidIndex >= this._entries.length) return false; |
| 1678 if ($notnull_bool(this._entries.$index(this._nextValidIndex) === HashMapImplem entation._deletedKey)) { | 1683 if (this._entries.$index(this._nextValidIndex) === HashMapImplementation._dele tedKey) { |
| 1679 this._advance(); | 1684 this._advance(); |
| 1680 } | 1685 } |
| 1681 return this._nextValidIndex < this._entries.length; | 1686 return this._nextValidIndex < this._entries.length; |
| 1682 } | 1687 } |
| 1683 HashSetIterator.prototype.next = function() { | 1688 HashSetIterator.prototype.next = function() { |
| 1684 if ($notnull_bool(!$notnull_bool(this.hasNext()))) { | 1689 if (!this.hasNext()) { |
| 1685 $throw(const$0/*const NoMoreElementsException()*/); | 1690 $throw(const$0/*const NoMoreElementsException()*/); |
| 1686 } | 1691 } |
| 1687 var res = this._entries.$index(this._nextValidIndex); | 1692 var res = this._entries.$index(this._nextValidIndex); |
| 1688 this._advance(); | 1693 this._advance(); |
| 1689 return res; | 1694 return res; |
| 1690 } | 1695 } |
| 1691 HashSetIterator.prototype._advance = function() { | 1696 HashSetIterator.prototype._advance = function() { |
| 1692 var length = this._entries.length; | 1697 var length = this._entries.length; |
| 1693 var entry; | 1698 var entry; |
| 1694 var deletedKey = HashMapImplementation._deletedKey; | 1699 var deletedKey = HashMapImplementation._deletedKey; |
| 1695 do { | 1700 do { |
| 1696 if ($notnull_bool(++this._nextValidIndex >= length)) break; | 1701 if (++this._nextValidIndex >= length) break; |
| 1697 entry = this._entries.$index(this._nextValidIndex); | 1702 entry = this._entries.$index(this._nextValidIndex); |
| 1698 } | 1703 } |
| 1699 while ($notnull_bool((entry == null) || (entry === deletedKey))) | 1704 while ((entry == null) || (entry === deletedKey)) |
| 1700 } | 1705 } |
| 1701 // ********** Code for HashSetIterator$E ************** | 1706 // ********** Code for HashSetIterator$E ************** |
| 1702 function HashSetIterator$E(set_) { | 1707 function HashSetIterator$E(set_) { |
| 1703 this._nextValidIndex = -1; | 1708 this._nextValidIndex = -1; |
| 1704 this._entries = set_._backingMap._keys; | 1709 this._entries = set_._backingMap._keys; |
| 1705 // Initializers done | 1710 // Initializers done |
| 1706 this._advance(); | 1711 this._advance(); |
| 1707 } | 1712 } |
| 1708 $inherits(HashSetIterator$E, HashSetIterator); | 1713 $inherits(HashSetIterator$E, HashSetIterator); |
| 1709 HashSetIterator$E.prototype.is$Iterator$T = function(){return this;}; | 1714 HashSetIterator$E.prototype.is$Iterator$T = function(){return this;}; |
| 1710 HashSetIterator$E.prototype._advance = function() { | 1715 HashSetIterator$E.prototype._advance = function() { |
| 1711 var length = this._entries.length; | 1716 var length = this._entries.length; |
| 1712 var entry; | 1717 var entry; |
| 1713 var deletedKey = HashMapImplementation._deletedKey; | 1718 var deletedKey = HashMapImplementation._deletedKey; |
| 1714 do { | 1719 do { |
| 1715 if ($notnull_bool(++this._nextValidIndex >= length)) break; | 1720 if (++this._nextValidIndex >= length) break; |
| 1716 entry = this._entries.$index(this._nextValidIndex); | 1721 entry = this._entries.$index(this._nextValidIndex); |
| 1717 } | 1722 } |
| 1718 while ($notnull_bool((entry == null) || (entry === deletedKey))) | 1723 while ((entry == null) || (entry === deletedKey)) |
| 1719 } | 1724 } |
| 1720 // ********** Code for KeyValuePair ************** | 1725 // ********** Code for KeyValuePair ************** |
| 1721 function KeyValuePair(key, value) { | 1726 function KeyValuePair(key, value) { |
| 1722 this.key = key; | 1727 this.key = key; |
| 1723 this.value = value; | 1728 this.value = value; |
| 1724 // Initializers done | 1729 // Initializers done |
| 1725 } | 1730 } |
| 1726 KeyValuePair.prototype.get$value = function() { return this.value; }; | 1731 KeyValuePair.prototype.get$value = function() { return this.value; }; |
| 1727 KeyValuePair.prototype.set$value = function(value) { return this.value = value; }; | 1732 KeyValuePair.prototype.set$value = function(value) { return this.value = value; }; |
| 1728 // ********** Code for KeyValuePair$K$V ************** | 1733 // ********** Code for KeyValuePair$K$V ************** |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1740 $inherits(KeyValuePair$String$Keyword, KeyValuePair); | 1745 $inherits(KeyValuePair$String$Keyword, KeyValuePair); |
| 1741 // ********** Code for LinkedHashMapImplementation ************** | 1746 // ********** Code for LinkedHashMapImplementation ************** |
| 1742 function LinkedHashMapImplementation() { | 1747 function LinkedHashMapImplementation() { |
| 1743 // Initializers done | 1748 // Initializers done |
| 1744 this._map = new HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$ V(); | 1749 this._map = new HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$ V(); |
| 1745 this._list = new DoubleLinkedQueue$KeyValuePair$K$V(); | 1750 this._list = new DoubleLinkedQueue$KeyValuePair$K$V(); |
| 1746 } | 1751 } |
| 1747 LinkedHashMapImplementation.prototype.is$Map$Node$Element = function(){return th is;}; | 1752 LinkedHashMapImplementation.prototype.is$Map$Node$Element = function(){return th is;}; |
| 1748 LinkedHashMapImplementation.prototype.is$Map$String$Member = function(){return t his;}; | 1753 LinkedHashMapImplementation.prototype.is$Map$String$Member = function(){return t his;}; |
| 1749 LinkedHashMapImplementation.prototype.$setindex = function(key, value) { | 1754 LinkedHashMapImplementation.prototype.$setindex = function(key, value) { |
| 1750 if ($notnull_bool(this._map.containsKey(key))) { | 1755 if (this._map.containsKey(key)) { |
| 1751 this._map.$index(key).get$element().value = value; | 1756 this._map.$index(key).get$element().value = value; |
| 1752 } | 1757 } |
| 1753 else { | 1758 else { |
| 1754 this._list.addLast(new KeyValuePair$K$V(key, value)); | 1759 this._list.addLast(new KeyValuePair$K$V(key, value)); |
| 1755 this._map.$setindex(key, this._list.lastEntry()); | 1760 this._map.$setindex(key, this._list.lastEntry()); |
| 1756 } | 1761 } |
| 1757 } | 1762 } |
| 1758 LinkedHashMapImplementation.prototype.$index = function(key) { | 1763 LinkedHashMapImplementation.prototype.$index = function(key) { |
| 1759 var $0; | 1764 var $0; |
| 1760 var entry = (($0 = this._map.$index(key)) && $0.is$DoubleLinkedQueueEntry$KeyV aluePair$K$V()); | 1765 var entry = (($0 = this._map.$index(key)) && $0.is$DoubleLinkedQueueEntry$KeyV aluePair$K$V()); |
| 1761 if ($notnull_bool(entry == null)) return null; | 1766 if (entry == null) return null; |
| 1762 return entry.get$element().get$value(); | 1767 return entry.get$element().get$value(); |
| 1763 } | 1768 } |
| 1764 LinkedHashMapImplementation.prototype.getKeys = function() { | 1769 LinkedHashMapImplementation.prototype.getKeys = function() { |
| 1765 var list = new ListFactory$K(this.get$length()); | 1770 var list = new ListFactory$K(this.get$length()); |
| 1766 var index = 0; | 1771 var index = 0; |
| 1767 this._list.forEach(function _(entry) { | 1772 this._list.forEach(function _(entry) { |
| 1768 list.$setindex(index++, entry.key); | 1773 list.$setindex(index++, entry.key); |
| 1769 } | 1774 } |
| 1770 ); | 1775 ); |
| 1771 $assert(index == this.get$length(), "index == length", "linked_hash_map.dart", 75, 12); | 1776 $assert(index == this.get$length(), "index == length", "linked_hash_map.dart", 75, 12); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1975 this._previous = p; | 1980 this._previous = p; |
| 1976 p._next = this; | 1981 p._next = this; |
| 1977 n._previous = this; | 1982 n._previous = this; |
| 1978 } | 1983 } |
| 1979 // ********** Code for DoubleLinkedQueue ************** | 1984 // ********** Code for DoubleLinkedQueue ************** |
| 1980 function DoubleLinkedQueue() { | 1985 function DoubleLinkedQueue() { |
| 1981 // Initializers done | 1986 // Initializers done |
| 1982 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); | 1987 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); |
| 1983 } | 1988 } |
| 1984 DoubleLinkedQueue.prototype.is$DoubleLinkedQueue = function(){return this;}; | 1989 DoubleLinkedQueue.prototype.is$DoubleLinkedQueue = function(){return this;}; |
| 1990 DoubleLinkedQueue.prototype.is$Collection$Type = function(){return this;}; | |
| 1985 DoubleLinkedQueue.prototype.is$Iterable = function(){return this;}; | 1991 DoubleLinkedQueue.prototype.is$Iterable = function(){return this;}; |
| 1986 DoubleLinkedQueue.DoubleLinkedQueue$from$factory = function(other) { | 1992 DoubleLinkedQueue.DoubleLinkedQueue$from$factory = function(other) { |
| 1987 var list = new DoubleLinkedQueue(); | 1993 var list = new DoubleLinkedQueue(); |
| 1988 for (var $i = other.iterator(); $i.hasNext(); ) { | 1994 for (var $i = other.iterator(); $i.hasNext(); ) { |
| 1989 var e = $i.next(); | 1995 var e = $i.next(); |
| 1990 list.addLast(e); | 1996 list.addLast(e); |
| 1991 } | 1997 } |
| 1992 return (list && list.is$DoubleLinkedQueue()); | 1998 return (list && list.is$DoubleLinkedQueue()); |
| 1993 } | 1999 } |
| 1994 DoubleLinkedQueue.prototype.addLast = function(value) { | 2000 DoubleLinkedQueue.prototype.addLast = function(value) { |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 2021 return counter; | 2027 return counter; |
| 2022 } | 2028 } |
| 2023 Object.defineProperty(DoubleLinkedQueue.prototype, "length", { | 2029 Object.defineProperty(DoubleLinkedQueue.prototype, "length", { |
| 2024 get: DoubleLinkedQueue.prototype.get$length | 2030 get: DoubleLinkedQueue.prototype.get$length |
| 2025 }); | 2031 }); |
| 2026 DoubleLinkedQueue.prototype.isEmpty = function() { | 2032 DoubleLinkedQueue.prototype.isEmpty = function() { |
| 2027 return (this._sentinel._next === this._sentinel); | 2033 return (this._sentinel._next === this._sentinel); |
| 2028 } | 2034 } |
| 2029 DoubleLinkedQueue.prototype.forEach = function(f) { | 2035 DoubleLinkedQueue.prototype.forEach = function(f) { |
| 2030 var entry = this._sentinel._next; | 2036 var entry = this._sentinel._next; |
| 2031 while ($notnull_bool(entry !== this._sentinel)) { | 2037 while (entry !== this._sentinel) { |
| 2032 f(entry._element); | 2038 f(entry._element); |
| 2033 entry = entry._next; | 2039 entry = entry._next; |
| 2034 } | 2040 } |
| 2035 } | 2041 } |
| 2036 DoubleLinkedQueue.prototype.some = function(f) { | 2042 DoubleLinkedQueue.prototype.some = function(f) { |
| 2037 var entry = this._sentinel._next; | 2043 var entry = this._sentinel._next; |
| 2038 while ($notnull_bool(entry !== this._sentinel)) { | 2044 while (entry !== this._sentinel) { |
| 2039 if ($notnull_bool(f(entry._element))) return true; | 2045 if (f(entry._element)) return true; |
| 2040 entry = entry._next; | 2046 entry = entry._next; |
| 2041 } | 2047 } |
| 2042 return false; | 2048 return false; |
| 2043 } | 2049 } |
| 2044 DoubleLinkedQueue.prototype.filter = function(f) { | 2050 DoubleLinkedQueue.prototype.filter = function(f) { |
| 2045 var other = new DoubleLinkedQueue$E(); | 2051 var other = new DoubleLinkedQueue$E(); |
| 2046 var entry = this._sentinel._next; | 2052 var entry = this._sentinel._next; |
| 2047 while ($notnull_bool(entry !== this._sentinel)) { | 2053 while (entry !== this._sentinel) { |
| 2048 if ($notnull_bool(f(entry._element))) other.addLast(entry._element); | 2054 if (f(entry._element)) other.addLast(entry._element); |
| 2049 entry = entry._next; | 2055 entry = entry._next; |
| 2050 } | 2056 } |
| 2051 return other; | 2057 return other; |
| 2052 } | 2058 } |
| 2053 DoubleLinkedQueue.prototype.iterator = function() { | 2059 DoubleLinkedQueue.prototype.iterator = function() { |
| 2054 return new _DoubleLinkedQueueIterator$E(this._sentinel); | 2060 return new _DoubleLinkedQueueIterator$E(this._sentinel); |
| 2055 } | 2061 } |
| 2056 // ********** Code for DoubleLinkedQueue$E ************** | 2062 // ********** Code for DoubleLinkedQueue$E ************** |
| 2057 function DoubleLinkedQueue$E() { | 2063 function DoubleLinkedQueue$E() { |
| 2058 // Initializers done | 2064 // Initializers done |
| 2059 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); | 2065 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); |
| 2060 } | 2066 } |
| 2061 $inherits(DoubleLinkedQueue$E, DoubleLinkedQueue); | 2067 $inherits(DoubleLinkedQueue$E, DoubleLinkedQueue); |
| 2068 DoubleLinkedQueue$E.prototype.is$Collection$Type = function(){return this;}; | |
| 2062 DoubleLinkedQueue$E.prototype.is$Iterable = function(){return this;}; | 2069 DoubleLinkedQueue$E.prototype.is$Iterable = function(){return this;}; |
| 2063 // ********** Code for DoubleLinkedQueue$KeyValuePair$K$V ************** | 2070 // ********** Code for DoubleLinkedQueue$KeyValuePair$K$V ************** |
| 2064 function DoubleLinkedQueue$KeyValuePair$K$V() { | 2071 function DoubleLinkedQueue$KeyValuePair$K$V() { |
| 2065 // Initializers done | 2072 // Initializers done |
| 2066 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V(); | 2073 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V(); |
| 2067 } | 2074 } |
| 2068 $inherits(DoubleLinkedQueue$KeyValuePair$K$V, DoubleLinkedQueue); | 2075 $inherits(DoubleLinkedQueue$KeyValuePair$K$V, DoubleLinkedQueue); |
| 2076 DoubleLinkedQueue$KeyValuePair$K$V.prototype.is$Collection$Type = false; | |
| 2069 DoubleLinkedQueue$KeyValuePair$K$V.prototype.is$Iterable = function(){return thi s;}; | 2077 DoubleLinkedQueue$KeyValuePair$K$V.prototype.is$Iterable = function(){return thi s;}; |
| 2070 DoubleLinkedQueue$KeyValuePair$K$V.prototype.addLast = function(value) { | 2078 DoubleLinkedQueue$KeyValuePair$K$V.prototype.addLast = function(value) { |
| 2071 this._sentinel.prepend(value); | 2079 this._sentinel.prepend(value); |
| 2072 } | 2080 } |
| 2073 DoubleLinkedQueue$KeyValuePair$K$V.prototype.lastEntry = function() { | 2081 DoubleLinkedQueue$KeyValuePair$K$V.prototype.lastEntry = function() { |
| 2074 return this._sentinel.previousEntry(); | 2082 return this._sentinel.previousEntry(); |
| 2075 } | 2083 } |
| 2076 DoubleLinkedQueue$KeyValuePair$K$V.prototype.forEach = function(f) { | 2084 DoubleLinkedQueue$KeyValuePair$K$V.prototype.forEach = function(f) { |
| 2077 var entry = this._sentinel._next; | 2085 var entry = this._sentinel._next; |
| 2078 while ($notnull_bool(entry !== this._sentinel)) { | 2086 while (entry !== this._sentinel) { |
| 2079 f(entry._element); | 2087 f(entry._element); |
| 2080 entry = entry._next; | 2088 entry = entry._next; |
| 2081 } | 2089 } |
| 2082 } | 2090 } |
| 2083 // ********** Code for DoubleLinkedQueue$KeyValuePair$Node$Element ************* * | 2091 // ********** Code for DoubleLinkedQueue$KeyValuePair$Node$Element ************* * |
| 2084 function DoubleLinkedQueue$KeyValuePair$Node$Element() { | 2092 function DoubleLinkedQueue$KeyValuePair$Node$Element() { |
| 2085 // Initializers done | 2093 // Initializers done |
| 2086 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$Node$Element (); | 2094 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$Node$Element (); |
| 2087 } | 2095 } |
| 2088 $inherits(DoubleLinkedQueue$KeyValuePair$Node$Element, DoubleLinkedQueue); | 2096 $inherits(DoubleLinkedQueue$KeyValuePair$Node$Element, DoubleLinkedQueue); |
| 2097 DoubleLinkedQueue$KeyValuePair$Node$Element.prototype.is$Collection$Type = false ; | |
| 2089 DoubleLinkedQueue$KeyValuePair$Node$Element.prototype.is$Iterable = function(){r eturn this;}; | 2098 DoubleLinkedQueue$KeyValuePair$Node$Element.prototype.is$Iterable = function(){r eturn this;}; |
| 2090 // ********** Code for DoubleLinkedQueue$KeyValuePair$String$Keyword *********** *** | 2099 // ********** Code for DoubleLinkedQueue$KeyValuePair$String$Keyword *********** *** |
| 2091 function DoubleLinkedQueue$KeyValuePair$String$Keyword() { | 2100 function DoubleLinkedQueue$KeyValuePair$String$Keyword() { |
| 2092 // Initializers done | 2101 // Initializers done |
| 2093 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$String$Keywo rd(); | 2102 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$String$Keywo rd(); |
| 2094 } | 2103 } |
| 2095 $inherits(DoubleLinkedQueue$KeyValuePair$String$Keyword, DoubleLinkedQueue); | 2104 $inherits(DoubleLinkedQueue$KeyValuePair$String$Keyword, DoubleLinkedQueue); |
| 2105 DoubleLinkedQueue$KeyValuePair$String$Keyword.prototype.is$Collection$Type = fal se; | |
| 2096 DoubleLinkedQueue$KeyValuePair$String$Keyword.prototype.is$Iterable = function() {return this;}; | 2106 DoubleLinkedQueue$KeyValuePair$String$Keyword.prototype.is$Iterable = function() {return this;}; |
| 2097 // ********** Code for DoubleLinkedQueue$SourceString ************** | 2107 // ********** Code for DoubleLinkedQueue$SourceString ************** |
| 2098 function DoubleLinkedQueue$SourceString() {} | 2108 function DoubleLinkedQueue$SourceString() {} |
| 2099 $inherits(DoubleLinkedQueue$SourceString, DoubleLinkedQueue); | 2109 $inherits(DoubleLinkedQueue$SourceString, DoubleLinkedQueue); |
| 2110 DoubleLinkedQueue$SourceString.prototype.is$Collection$Type = false; | |
| 2100 DoubleLinkedQueue$SourceString.prototype.is$Iterable = function(){return this;}; | 2111 DoubleLinkedQueue$SourceString.prototype.is$Iterable = function(){return this;}; |
| 2101 DoubleLinkedQueue$SourceString.DoubleLinkedQueue$from$factory = function(other) { | 2112 DoubleLinkedQueue$SourceString.DoubleLinkedQueue$from$factory = function(other) { |
| 2102 var list = new DoubleLinkedQueue(); | 2113 var list = new DoubleLinkedQueue(); |
| 2103 for (var $i = other.iterator(); $i.hasNext(); ) { | 2114 for (var $i = other.iterator(); $i.hasNext(); ) { |
| 2104 var e = $i.next(); | 2115 var e = $i.next(); |
| 2105 list.addLast(e); | 2116 list.addLast(e); |
| 2106 } | 2117 } |
| 2107 return (list && list.is$DoubleLinkedQueue()); | 2118 return (list && list.is$DoubleLinkedQueue()); |
| 2108 } | 2119 } |
| 2109 // ********** Code for _DoubleLinkedQueueIterator ************** | 2120 // ********** Code for _DoubleLinkedQueueIterator ************** |
| 2110 function _DoubleLinkedQueueIterator(_sentinel) { | 2121 function _DoubleLinkedQueueIterator(_sentinel) { |
| 2111 this._sentinel = _sentinel; | 2122 this._sentinel = _sentinel; |
| 2112 // Initializers done | 2123 // Initializers done |
| 2113 this._currentEntry = this._sentinel; | 2124 this._currentEntry = this._sentinel; |
| 2114 } | 2125 } |
| 2115 _DoubleLinkedQueueIterator.prototype.is$Iterator$T = function(){return this;}; | 2126 _DoubleLinkedQueueIterator.prototype.is$Iterator$T = function(){return this;}; |
| 2116 _DoubleLinkedQueueIterator.prototype.hasNext = function() { | 2127 _DoubleLinkedQueueIterator.prototype.hasNext = function() { |
| 2117 return this._currentEntry._next !== this._sentinel; | 2128 return this._currentEntry._next !== this._sentinel; |
| 2118 } | 2129 } |
| 2119 _DoubleLinkedQueueIterator.prototype.next = function() { | 2130 _DoubleLinkedQueueIterator.prototype.next = function() { |
| 2120 if ($notnull_bool(!$notnull_bool(this.hasNext()))) { | 2131 if (!this.hasNext()) { |
| 2121 $throw(const$0/*const NoMoreElementsException()*/); | 2132 $throw(const$0/*const NoMoreElementsException()*/); |
| 2122 } | 2133 } |
| 2123 this._currentEntry = this._currentEntry._next; | 2134 this._currentEntry = this._currentEntry._next; |
| 2124 return this._currentEntry.get$element(); | 2135 return this._currentEntry.get$element(); |
| 2125 } | 2136 } |
| 2126 // ********** Code for _DoubleLinkedQueueIterator$E ************** | 2137 // ********** Code for _DoubleLinkedQueueIterator$E ************** |
| 2127 function _DoubleLinkedQueueIterator$E(_sentinel) { | 2138 function _DoubleLinkedQueueIterator$E(_sentinel) { |
| 2128 this._sentinel = _sentinel; | 2139 this._sentinel = _sentinel; |
| 2129 // Initializers done | 2140 // Initializers done |
| 2130 this._currentEntry = this._sentinel; | 2141 this._currentEntry = this._sentinel; |
| 2131 } | 2142 } |
| 2132 $inherits(_DoubleLinkedQueueIterator$E, _DoubleLinkedQueueIterator); | 2143 $inherits(_DoubleLinkedQueueIterator$E, _DoubleLinkedQueueIterator); |
| 2133 _DoubleLinkedQueueIterator$E.prototype.is$Iterator$T = function(){return this;}; | 2144 _DoubleLinkedQueueIterator$E.prototype.is$Iterator$T = function(){return this;}; |
| 2134 // ********** Code for StopWatchImplementation ************** | 2145 // ********** Code for StopWatchImplementation ************** |
| 2135 function StopWatchImplementation() { | 2146 function StopWatchImplementation() { |
| 2136 this._start = null; | 2147 this._start = null; |
| 2137 this._stop = null; | 2148 this._stop = null; |
| 2138 // Initializers done | 2149 // Initializers done |
| 2139 } | 2150 } |
| 2140 StopWatchImplementation.prototype.start = function() { | 2151 StopWatchImplementation.prototype.start = function() { |
| 2141 if ($notnull_bool(this._start == null)) { | 2152 if (this._start == null) { |
| 2142 this._start = Clock.now(); | 2153 this._start = Clock.now(); |
| 2143 } | 2154 } |
| 2144 else { | 2155 else { |
| 2145 if ($notnull_bool(this._stop == null)) { | 2156 if (this._stop == null) { |
| 2146 return; | 2157 return; |
| 2147 } | 2158 } |
| 2148 this._start = Clock.now() - (this._stop - this._start); | 2159 this._start = Clock.now() - (this._stop - this._start); |
| 2149 } | 2160 } |
| 2150 } | 2161 } |
| 2151 StopWatchImplementation.prototype.stop = function() { | 2162 StopWatchImplementation.prototype.stop = function() { |
| 2152 if ($notnull_bool(this._start == null)) { | 2163 if (this._start == null) { |
| 2153 return; | 2164 return; |
| 2154 } | 2165 } |
| 2155 this._stop = Clock.now(); | 2166 this._stop = Clock.now(); |
| 2156 } | 2167 } |
| 2157 StopWatchImplementation.prototype.elapsed = function() { | 2168 StopWatchImplementation.prototype.elapsed = function() { |
| 2158 if ($notnull_bool(this._start == null)) { | 2169 if (this._start == null) { |
| 2159 return 0; | 2170 return 0; |
| 2160 } | 2171 } |
| 2161 return $notnull_bool((this._stop == null)) ? (Clock.now() - this._start) : (th is._stop - this._start); | 2172 return (this._stop == null) ? (Clock.now() - this._start) : (this._stop - this ._start); |
| 2162 } | 2173 } |
| 2163 StopWatchImplementation.prototype.elapsedInMs = function() { | 2174 StopWatchImplementation.prototype.elapsedInMs = function() { |
| 2164 return $truncdiv((this.elapsed() * 1000), this.frequency()); | 2175 return $truncdiv((this.elapsed() * 1000), this.frequency()); |
| 2165 } | 2176 } |
| 2166 StopWatchImplementation.prototype.frequency = function() { | 2177 StopWatchImplementation.prototype.frequency = function() { |
| 2167 return Clock.frequency(); | 2178 return Clock.frequency(); |
| 2168 } | 2179 } |
| 2169 // ********** Code for StringBufferImpl ************** | 2180 // ********** Code for StringBufferImpl ************** |
| 2170 function StringBufferImpl(content) { | 2181 function StringBufferImpl(content) { |
| 2171 // Initializers done | 2182 // Initializers done |
| 2172 this.clear(); | 2183 this.clear(); |
| 2173 this.add(content); | 2184 this.add(content); |
| 2174 } | 2185 } |
| 2175 StringBufferImpl.prototype.get$length = function() { | 2186 StringBufferImpl.prototype.get$length = function() { |
| 2176 return this._length; | 2187 return this._length; |
| 2177 } | 2188 } |
| 2178 Object.defineProperty(StringBufferImpl.prototype, "length", { | 2189 Object.defineProperty(StringBufferImpl.prototype, "length", { |
| 2179 get: StringBufferImpl.prototype.get$length | 2190 get: StringBufferImpl.prototype.get$length |
| 2180 }); | 2191 }); |
| 2181 StringBufferImpl.prototype.isEmpty = function() { | 2192 StringBufferImpl.prototype.isEmpty = function() { |
| 2182 return this._length == 0; | 2193 return this._length == 0; |
| 2183 } | 2194 } |
| 2184 StringBufferImpl.prototype.add = function(obj) { | 2195 StringBufferImpl.prototype.add = function(obj) { |
| 2185 var str = obj.toString(); | 2196 var str = obj.toString(); |
| 2186 if ($notnull_bool(str == null || str.isEmpty())) return this; | 2197 if (str == null || str.isEmpty()) return this; |
| 2187 this._buffer.add(str); | 2198 this._buffer.add(str); |
| 2188 this._length += str.length; | 2199 this._length += str.length; |
| 2189 return this; | 2200 return this; |
| 2190 } | 2201 } |
| 2191 StringBufferImpl.prototype.addAll = function(objects) { | 2202 StringBufferImpl.prototype.addAll = function(objects) { |
| 2192 for (var $i = objects.iterator(); $i.hasNext(); ) { | 2203 for (var $i = objects.iterator(); $i.hasNext(); ) { |
| 2193 var obj = $i.next(); | 2204 var obj = $i.next(); |
| 2194 this.add(obj); | 2205 this.add(obj); |
| 2195 } | 2206 } |
| 2196 return this; | 2207 return this; |
| 2197 } | 2208 } |
| 2198 StringBufferImpl.prototype.clear = function() { | 2209 StringBufferImpl.prototype.clear = function() { |
| 2199 this._buffer = new ListFactory$String(); | 2210 this._buffer = new ListFactory$String(); |
| 2200 this._length = 0; | 2211 this._length = 0; |
| 2201 return this; | 2212 return this; |
| 2202 } | 2213 } |
| 2203 StringBufferImpl.prototype.toString = function() { | 2214 StringBufferImpl.prototype.toString = function() { |
| 2204 if ($notnull_bool(this._buffer.length == 0)) return ""; | 2215 if (this._buffer.length == 0) return ""; |
| 2205 if ($notnull_bool(this._buffer.length == 1)) return $assert_String(this._buffe r.$index(0)); | 2216 if (this._buffer.length == 1) return $assert_String(this._buffer.$index(0)); |
| 2206 var result = StringBase.concatAll(this._buffer); | 2217 var result = StringBase.concatAll(this._buffer); |
| 2207 this._buffer.clear(); | 2218 this._buffer.clear(); |
| 2208 this._buffer.add(result); | 2219 this._buffer.add(result); |
| 2209 return result; | 2220 return result; |
| 2210 } | 2221 } |
| 2211 // ********** Code for StringBase ************** | 2222 // ********** Code for StringBase ************** |
| 2212 function StringBase() {} | 2223 function StringBase() {} |
| 2213 StringBase.createFromCharCodes = function(charCodes) { | 2224 StringBase.createFromCharCodes = function(charCodes) { |
| 2214 if (Object.getPrototypeOf(charCodes) !== Array.prototype) { | 2225 if (Object.getPrototypeOf(charCodes) !== Array.prototype) { |
| 2215 var length = charCodes.length; | 2226 var length = charCodes.length; |
| 2216 var tmp = new Array(length); | 2227 var tmp = new Array(length); |
| 2217 for (var i = 0; i < length; i++) { | 2228 for (var i = 0; i < length; i++) { |
| 2218 tmp[i] = charCodes.$index(i); | 2229 tmp[i] = charCodes.$index(i); |
| 2219 } | 2230 } |
| 2220 charCodes = tmp; | 2231 charCodes = tmp; |
| 2221 } | 2232 } |
| 2222 return String.fromCharCode.apply(null, charCodes); | 2233 return String.fromCharCode.apply(null, charCodes); |
| 2223 } | 2234 } |
| 2224 StringBase.join = function(strings, separator) { | 2235 StringBase.join = function(strings, separator) { |
| 2225 if ($notnull_bool(strings.length == 0)) return ''; | 2236 if (strings.length == 0) return ''; |
| 2226 var s = $assert_String(strings.$index(0)); | 2237 var s = $assert_String(strings.$index(0)); |
| 2227 for (var i = 1; | 2238 for (var i = 1; |
| 2228 $notnull_bool(i < strings.length); i++) { | 2239 i < strings.length; i++) { |
| 2229 s = s + separator + strings.$index(i); | 2240 s = s + separator + strings.$index(i); |
| 2230 } | 2241 } |
| 2231 return s; | 2242 return s; |
| 2232 } | 2243 } |
| 2233 StringBase.concatAll = function(strings) { | 2244 StringBase.concatAll = function(strings) { |
| 2234 return StringBase.join(strings, ""); | 2245 return StringBase.join(strings, ""); |
| 2235 } | 2246 } |
| 2236 // ********** Code for StringImplementation ************** | 2247 // ********** Code for StringImplementation ************** |
| 2237 StringImplementation = String; | 2248 StringImplementation = String; |
| 2238 StringImplementation.prototype.endsWith = function(other) { | 2249 StringImplementation.prototype.endsWith = function(other) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2278 function Collections() {} | 2289 function Collections() {} |
| 2279 Collections.forEach = function(iterable, f) { | 2290 Collections.forEach = function(iterable, f) { |
| 2280 for (var $i = iterable.iterator(); $i.hasNext(); ) { | 2291 for (var $i = iterable.iterator(); $i.hasNext(); ) { |
| 2281 var e = $i.next(); | 2292 var e = $i.next(); |
| 2282 f(e); | 2293 f(e); |
| 2283 } | 2294 } |
| 2284 } | 2295 } |
| 2285 Collections.some = function(iterable, f) { | 2296 Collections.some = function(iterable, f) { |
| 2286 for (var $i = iterable.iterator(); $i.hasNext(); ) { | 2297 for (var $i = iterable.iterator(); $i.hasNext(); ) { |
| 2287 var e = $i.next(); | 2298 var e = $i.next(); |
| 2288 if ($notnull_bool(f(e))) return true; | 2299 if (f(e)) return true; |
| 2289 } | 2300 } |
| 2290 return false; | 2301 return false; |
| 2291 } | 2302 } |
| 2292 Collections.filter = function(source, destination, f) { | 2303 Collections.filter = function(source, destination, f) { |
| 2293 for (var $i = source.iterator(); $i.hasNext(); ) { | 2304 for (var $i = source.iterator(); $i.hasNext(); ) { |
| 2294 var e = $i.next(); | 2305 var e = $i.next(); |
| 2295 if ($notnull_bool(f(e))) destination.add(e); | 2306 if (f(e)) destination.add(e); |
| 2296 } | 2307 } |
| 2297 return destination; | 2308 return destination; |
| 2298 } | 2309 } |
| 2299 // ********** Code for DateImplementation ************** | 2310 // ********** Code for DateImplementation ************** |
| 2300 function DateImplementation() {} | 2311 function DateImplementation() {} |
| 2301 DateImplementation.fromEpoch$ctor = function(value, timeZone) { | 2312 DateImplementation.fromEpoch$ctor = function(value, timeZone) { |
| 2302 this.value = value; | 2313 this.value = value; |
| 2303 this.timeZone = timeZone; | 2314 this.timeZone = timeZone; |
| 2304 // Initializers done | 2315 // Initializers done |
| 2305 } | 2316 } |
| 2306 DateImplementation.fromEpoch$ctor.prototype = DateImplementation.prototype; | 2317 DateImplementation.fromEpoch$ctor.prototype = DateImplementation.prototype; |
| 2307 DateImplementation.now$ctor = function() { | 2318 DateImplementation.now$ctor = function() { |
| 2308 this.timeZone = new TimeZoneImplementation.local$ctor(); | 2319 this.timeZone = new TimeZoneImplementation.local$ctor(); |
| 2309 this.value = DateImplementation._now(); | 2320 this.value = DateImplementation._now(); |
| 2310 // Initializers done | 2321 // Initializers done |
| 2311 this._asJs(); | 2322 this._asJs(); |
| 2312 } | 2323 } |
| 2313 DateImplementation.now$ctor.prototype = DateImplementation.prototype; | 2324 DateImplementation.now$ctor.prototype = DateImplementation.prototype; |
| 2314 DateImplementation.prototype.get$value = function() { return this.value; }; | 2325 DateImplementation.prototype.get$value = function() { return this.value; }; |
| 2315 DateImplementation.prototype.$eq = function(other) { | 2326 DateImplementation.prototype.$eq = function(other) { |
| 2316 if ($notnull_bool(!$notnull_bool(((other instanceof DateImplementation))))) re turn false; | 2327 if (!((other instanceof DateImplementation))) return false; |
| 2317 return $notnull_bool((this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone))); | 2328 return (this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone )); |
| 2318 } | 2329 } |
| 2319 DateImplementation.prototype.compareTo = function(other) { | 2330 DateImplementation.prototype.compareTo = function(other) { |
| 2320 return this.value.compareTo(other.value); | 2331 return this.value.compareTo(other.value); |
| 2321 } | 2332 } |
| 2322 DateImplementation.prototype.get$year = function() { | 2333 DateImplementation.prototype.get$year = function() { |
| 2323 return this.isUtc ? this._asJs().getUTCFullYear() : | 2334 return this.isUtc ? this._asJs().getUTCFullYear() : |
| 2324 this._asJs().getFullYear(); | 2335 this._asJs().getFullYear(); |
| 2325 } | 2336 } |
| 2326 DateImplementation.prototype.get$month = function() { | 2337 DateImplementation.prototype.get$month = function() { |
| 2327 return this.isUtc ? this._asJs().getMonth() + 1 : | 2338 return this.isUtc ? this._asJs().getMonth() + 1 : |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 2338 } | 2349 } |
| 2339 DateImplementation.prototype.get$seconds = function() { | 2350 DateImplementation.prototype.get$seconds = function() { |
| 2340 return this.isUtc ? this._asJs().getUTCSeconds() : this._asJs().getSeconds() | 2351 return this.isUtc ? this._asJs().getUTCSeconds() : this._asJs().getSeconds() |
| 2341 } | 2352 } |
| 2342 DateImplementation.prototype.get$milliseconds = function() { | 2353 DateImplementation.prototype.get$milliseconds = function() { |
| 2343 return this.isUtc ? this._asJs().getUTCMilliseconds() : | 2354 return this.isUtc ? this._asJs().getUTCMilliseconds() : |
| 2344 this._asJs().getMilliseconds(); | 2355 this._asJs().getMilliseconds(); |
| 2345 } | 2356 } |
| 2346 DateImplementation.prototype.toString = function() { | 2357 DateImplementation.prototype.toString = function() { |
| 2347 function threeDigits(n) { | 2358 function threeDigits(n) { |
| 2348 if ($notnull_bool(n >= 100)) return ("" + n + ""); | 2359 if (n >= 100) return ("" + n + ""); |
| 2349 if ($notnull_bool(n > 10)) return ("0" + n + ""); | 2360 if (n > 10) return ("0" + n + ""); |
| 2350 return ("00" + n + ""); | 2361 return ("00" + n + ""); |
| 2351 } | 2362 } |
| 2352 function twoDigits(n) { | 2363 function twoDigits(n) { |
| 2353 if ($notnull_bool(n >= 10)) return ("" + n + ""); | 2364 if (n >= 10) return ("" + n + ""); |
| 2354 return ("0" + n + ""); | 2365 return ("0" + n + ""); |
| 2355 } | 2366 } |
| 2356 var m = twoDigits(this.get$month()); | 2367 var m = twoDigits(this.get$month()); |
| 2357 var d = twoDigits(this.get$day()); | 2368 var d = twoDigits(this.get$day()); |
| 2358 var h = twoDigits(this.get$hours()); | 2369 var h = twoDigits(this.get$hours()); |
| 2359 var min = twoDigits(this.get$minutes()); | 2370 var min = twoDigits(this.get$minutes()); |
| 2360 var sec = twoDigits(this.get$seconds()); | 2371 var sec = twoDigits(this.get$seconds()); |
| 2361 var ms = threeDigits(this.get$milliseconds()); | 2372 var ms = threeDigits(this.get$milliseconds()); |
| 2362 if ($notnull_bool(this.timeZone.isUtc)) { | 2373 if ($notnull_bool(this.timeZone.isUtc)) { |
| 2363 return ("" + this.get$year() + "-" + m + "-" + d + " " + h + ":" + min + ":" + sec + "." + ms + "Z"); | 2374 return ("" + this.get$year() + "-" + m + "-" + d + " " + h + ":" + min + ":" + sec + "." + ms + "Z"); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 2379 return this.date; | 2390 return this.date; |
| 2380 } | 2391 } |
| 2381 // ********** Code for TimeZoneImplementation ************** | 2392 // ********** Code for TimeZoneImplementation ************** |
| 2382 function TimeZoneImplementation() {} | 2393 function TimeZoneImplementation() {} |
| 2383 TimeZoneImplementation.local$ctor = function() { | 2394 TimeZoneImplementation.local$ctor = function() { |
| 2384 this.isUtc = false; | 2395 this.isUtc = false; |
| 2385 // Initializers done | 2396 // Initializers done |
| 2386 } | 2397 } |
| 2387 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype; | 2398 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype; |
| 2388 TimeZoneImplementation.prototype.$eq = function(other) { | 2399 TimeZoneImplementation.prototype.$eq = function(other) { |
| 2389 if ($notnull_bool(!$notnull_bool(((other instanceof TimeZoneImplementation)))) ) return false; | 2400 if (!((other instanceof TimeZoneImplementation))) return false; |
| 2390 return $eq(this.isUtc, other.isUtc); | 2401 return $eq(this.isUtc, other.isUtc); |
| 2391 } | 2402 } |
| 2392 TimeZoneImplementation.prototype.toString = function() { | 2403 TimeZoneImplementation.prototype.toString = function() { |
| 2393 if ($notnull_bool(this.isUtc)) return "TimeZone (UTC)"; | 2404 if ($notnull_bool(this.isUtc)) return "TimeZone (UTC)"; |
| 2394 return "TimeZone (Local)"; | 2405 return "TimeZone (Local)"; |
| 2395 } | 2406 } |
| 2396 // ********** Code for top level ************** | 2407 // ********** Code for top level ************** |
| 2397 // ********** Library node ************** | 2408 // ********** Library node ************** |
| 2398 // ********** Natives io_node.js ************** | 2409 // ********** Natives io_node.js ************** |
| 2399 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2410 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 2425 return {'require': require, 'process': process, 'console': console, | 2436 return {'require': require, 'process': process, 'console': console, |
| 2426 'setTimeout': setTimeout, 'clearTimeout': clearTimeout}; | 2437 'setTimeout': setTimeout, 'clearTimeout': clearTimeout}; |
| 2427 } | 2438 } |
| 2428 // ********** Library file_system ************** | 2439 // ********** Library file_system ************** |
| 2429 // ********** Code for top level ************** | 2440 // ********** Code for top level ************** |
| 2430 function joinPaths(path1, path2) { | 2441 function joinPaths(path1, path2) { |
| 2431 var pieces = path1.split('/'); | 2442 var pieces = path1.split('/'); |
| 2432 var $list = path2.split('/'); | 2443 var $list = path2.split('/'); |
| 2433 for (var $i = 0;$i < $list.length; $i++) { | 2444 for (var $i = 0;$i < $list.length; $i++) { |
| 2434 var piece = $list.$index($i); | 2445 var piece = $list.$index($i); |
| 2435 if ($notnull_bool($eq(piece, '..') && pieces.length > 0) && $ne(pieces.last( ), '.') && $ne(pieces.last(), '..')) { | 2446 if ($notnull_bool($notnull_bool($notnull_bool($eq(piece, '..') && pieces.len gth > 0) && $ne(pieces.last(), '.')) && $ne(pieces.last(), '..'))) { |
| 2436 pieces.removeLast(); | 2447 pieces.removeLast(); |
| 2437 } | 2448 } |
| 2438 else if ($notnull_bool($ne(piece, ''))) { | 2449 else if ($notnull_bool($ne(piece, ''))) { |
| 2439 if ($notnull_bool(pieces.length > 0 && $eq(pieces.last(), '.'))) { | 2450 if ($notnull_bool(pieces.length > 0 && $eq(pieces.last(), '.'))) { |
| 2440 pieces.removeLast(); | 2451 pieces.removeLast(); |
| 2441 } | 2452 } |
| 2442 pieces.add(piece); | 2453 pieces.add(piece); |
| 2443 } | 2454 } |
| 2444 } | 2455 } |
| 2445 return Strings.join((pieces && pieces.is$List$String()), '/'); | 2456 return Strings.join((pieces && pieces.is$List$String()), '/'); |
| 2446 } | 2457 } |
| 2447 function dirname(path) { | 2458 function dirname(path) { |
| 2448 var lastSlash = path.lastIndexOf('/', path.length); | 2459 var lastSlash = path.lastIndexOf('/', path.length); |
| 2449 if ($notnull_bool(lastSlash == -1)) { | 2460 if (lastSlash == -1) { |
| 2450 return '.'; | 2461 return '.'; |
| 2451 } | 2462 } |
| 2452 else { | 2463 else { |
| 2453 return path.substring(0, lastSlash); | 2464 return path.substring(0, lastSlash); |
| 2454 } | 2465 } |
| 2455 } | 2466 } |
| 2456 function basename(path) { | 2467 function basename(path) { |
| 2457 var lastSlash = path.lastIndexOf('/', path.length); | 2468 var lastSlash = path.lastIndexOf('/', path.length); |
| 2458 if ($notnull_bool(lastSlash == -1)) { | 2469 if (lastSlash == -1) { |
| 2459 return path; | 2470 return path; |
| 2460 } | 2471 } |
| 2461 else { | 2472 else { |
| 2462 return path.substring(lastSlash + 1); | 2473 return path.substring(lastSlash + 1); |
| 2463 } | 2474 } |
| 2464 } | 2475 } |
| 2465 // ********** Library file_system_node ************** | 2476 // ********** Library file_system_node ************** |
| 2466 // ********** Code for NodeFileSystem ************** | 2477 // ********** Code for NodeFileSystem ************** |
| 2467 function NodeFileSystem() { | 2478 function NodeFileSystem() { |
| 2468 // Initializers done | 2479 // Initializers done |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 2481 // ********** Code for top level ************** | 2492 // ********** Code for top level ************** |
| 2482 function join(strings) { | 2493 function join(strings) { |
| 2483 return Strings.join(strings, '/'); | 2494 return Strings.join(strings, '/'); |
| 2484 } | 2495 } |
| 2485 function readSync(fileName) { | 2496 function readSync(fileName) { |
| 2486 return new SourceFile(fileName, world.files.readAll(fileName)); | 2497 return new SourceFile(fileName, world.files.readAll(fileName)); |
| 2487 } | 2498 } |
| 2488 // ********** Library util_implementation ************** | 2499 // ********** Library util_implementation ************** |
| 2489 // ********** Code for LinkFactory ************** | 2500 // ********** Code for LinkFactory ************** |
| 2490 function LinkFactory() {} | 2501 function LinkFactory() {} |
| 2491 LinkFactory.Link$factory = function(head, tail) { | 2502 LinkFactory.createLink = function(head, tail) { |
| 2492 var $0; | 2503 var $0; |
| 2493 return new LinkEntry(head, (($0 = $notnull_bool((tail == null)) ? const$16/*co nst EmptyLink()*/ : tail) && $0.is$Link$T())); | 2504 return new LinkEntry(head, (($0 = (tail == null) ? const$16/*const EmptyLink() */ : tail) && $0.is$Link$T())); |
| 2494 } | 2505 } |
| 2495 // ********** Code for AbstractLink ************** | 2506 // ********** Code for AbstractLink ************** |
| 2496 function AbstractLink() {} | 2507 function AbstractLink() {} |
| 2497 AbstractLink.prototype.is$Link = function(){return this;}; | 2508 AbstractLink.prototype.is$Link = function(){return this;}; |
| 2498 AbstractLink.prototype.is$Link$Element = function(){return this;}; | 2509 AbstractLink.prototype.is$Link$Element = function(){return this;}; |
| 2499 AbstractLink.prototype.is$Link$Node = function(){return this;}; | 2510 AbstractLink.prototype.is$Link$Node = function(){return this;}; |
| 2500 AbstractLink.prototype.is$Link$T = function(){return this;}; | 2511 AbstractLink.prototype.is$Link$T = function(){return this;}; |
| 2501 AbstractLink.prototype.is$Link$Token = function(){return this;}; | 2512 AbstractLink.prototype.is$Link$Token = function(){return this;}; |
| 2502 AbstractLink.prototype.is$Link$Type = function(){return this;}; | 2513 AbstractLink.prototype.is$Link$Type = function(){return this;}; |
| 2503 AbstractLink.prototype.is$Iterable = function(){return this;}; | 2514 AbstractLink.prototype.is$Iterable = function(){return this;}; |
| 2504 AbstractLink.prototype.get$head = function() { | 2515 AbstractLink.prototype.get$head = function() { |
| 2505 $throw("bug"); | 2516 $throw("bug"); |
| 2506 } | 2517 } |
| 2507 AbstractLink.prototype.get$tail = function() { | 2518 AbstractLink.prototype.get$tail = function() { |
| 2508 $throw("bug"); | 2519 $throw("bug"); |
| 2509 } | 2520 } |
| 2510 AbstractLink.prototype.prepend = function(element) { | 2521 AbstractLink.prototype.prepend = function(element) { |
| 2511 return LinkFactory.Link$factory(element, this); | 2522 return LinkFactory.createLink(element, this); |
| 2512 } | 2523 } |
| 2513 AbstractLink.prototype.iterator = function() { | 2524 AbstractLink.prototype.iterator = function() { |
| 2514 var $0; | 2525 var $0; |
| 2515 return (($0 = this.toList().iterator()) && $0.is$Iterator$T()); | 2526 return (($0 = this.toList().iterator()) && $0.is$Iterator$T()); |
| 2516 } | 2527 } |
| 2517 AbstractLink.prototype.printOn = function(buffer, separatedBy) { | 2528 AbstractLink.prototype.printOn = function(buffer, separatedBy) { |
| 2518 var $0; | 2529 var $0; |
| 2519 if ($notnull_bool(this.isEmpty())) return; | 2530 if ($notnull_bool(this.isEmpty())) return; |
| 2520 buffer.add($notnull_bool(this.get$head() == null) ? 'null' : this.get$head()); | 2531 buffer.add(this.get$head() == null ? 'null' : this.get$head()); |
| 2521 if ($notnull_bool(separatedBy == null)) separatedBy = ''; | 2532 if (separatedBy == null) separatedBy = ''; |
| 2522 for (var link = (($0 = this.get$tail()) && $0.is$Link()); | 2533 for (var link = (($0 = this.get$tail()) && $0.is$Link()); |
| 2523 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link())) { | 2534 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link( ))) { |
| 2524 buffer.add(separatedBy); | 2535 buffer.add(separatedBy); |
| 2525 buffer.add($notnull_bool(link.get$head() == null) ? 'null' : link.get$head() ); | 2536 buffer.add(link.get$head() == null ? 'null' : link.get$head()); |
| 2526 } | 2537 } |
| 2527 } | 2538 } |
| 2528 AbstractLink.prototype.toString = function() { | 2539 AbstractLink.prototype.toString = function() { |
| 2529 var buffer = new StringBufferImpl(""); | 2540 var buffer = new StringBufferImpl(""); |
| 2530 buffer.add('[ '); | 2541 buffer.add('[ '); |
| 2531 this.printOn(buffer, ', '); | 2542 this.printOn(buffer, ', '); |
| 2532 buffer.add(' ]'); | 2543 buffer.add(' ]'); |
| 2533 return buffer.toString(); | 2544 return buffer.toString(); |
| 2534 } | 2545 } |
| 2535 // ********** Code for AbstractLink$T ************** | 2546 // ********** Code for AbstractLink$T ************** |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2593 LinkEntry.prototype.get$tail = function() { | 2604 LinkEntry.prototype.get$tail = function() { |
| 2594 return this.realTail; | 2605 return this.realTail; |
| 2595 } | 2606 } |
| 2596 LinkEntry.prototype.isEmpty = function() { | 2607 LinkEntry.prototype.isEmpty = function() { |
| 2597 return false; | 2608 return false; |
| 2598 } | 2609 } |
| 2599 LinkEntry.prototype.toList = function() { | 2610 LinkEntry.prototype.toList = function() { |
| 2600 var $0; | 2611 var $0; |
| 2601 var list = new ListFactory$T(); | 2612 var list = new ListFactory$T(); |
| 2602 for (var link = this; | 2613 for (var link = this; |
| 2603 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$T())) { | 2614 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ T())) { |
| 2604 list.addLast(link.get$head()); | 2615 list.addLast(link.get$head()); |
| 2605 } | 2616 } |
| 2606 return list; | 2617 return list; |
| 2607 } | 2618 } |
| 2608 // ********** Code for LinkEntry$T ************** | 2619 // ********** Code for LinkEntry$T ************** |
| 2609 function LinkEntry$T(head, realTail) { | 2620 function LinkEntry$T(head, realTail) { |
| 2610 this.head = head; | 2621 this.head = head; |
| 2611 this.realTail = realTail; | 2622 this.realTail = realTail; |
| 2612 // Initializers done | 2623 // Initializers done |
| 2613 } | 2624 } |
| 2614 $inherits(LinkEntry$T, LinkEntry); | 2625 $inherits(LinkEntry$T, LinkEntry); |
| 2615 // ********** Code for LinkBuilderImplementation ************** | 2626 // ********** Code for LinkBuilderImplementation ************** |
| 2616 function LinkBuilderImplementation() { | 2627 function LinkBuilderImplementation() { |
| 2617 this.head = null | 2628 this.head = null |
| 2618 this.lastLink = null | 2629 this.lastLink = null |
| 2619 // Initializers done | 2630 // Initializers done |
| 2620 } | 2631 } |
| 2621 LinkBuilderImplementation.prototype.get$head = function() { return this.head; }; | 2632 LinkBuilderImplementation.prototype.get$head = function() { return this.head; }; |
| 2622 LinkBuilderImplementation.prototype.set$head = function(value) { return this.hea d = value; }; | 2633 LinkBuilderImplementation.prototype.set$head = function(value) { return this.hea d = value; }; |
| 2623 LinkBuilderImplementation.prototype.toLink = function() { | 2634 LinkBuilderImplementation.prototype.toLink = function() { |
| 2624 if ($notnull_bool(this.head == null)) return const$16/*const EmptyLink()*/; | 2635 if (this.head == null) return const$16/*const EmptyLink()*/; |
| 2625 this.lastLink.realTail = const$16/*const EmptyLink()*/; | 2636 this.lastLink.realTail = const$16/*const EmptyLink()*/; |
| 2626 var link = this.head; | 2637 var link = this.head; |
| 2627 this.lastLink = null; | 2638 this.lastLink = null; |
| 2628 this.head = null; | 2639 this.head = null; |
| 2629 return link; | 2640 return link; |
| 2630 } | 2641 } |
| 2631 LinkBuilderImplementation.prototype.addLast = function(t) { | 2642 LinkBuilderImplementation.prototype.addLast = function(t) { |
| 2632 var entry = new LinkEntry$T(t, null); | 2643 var entry = new LinkEntry$T(t, null); |
| 2633 if ($notnull_bool(this.head == null)) { | 2644 if (this.head == null) { |
| 2634 this.head = entry; | 2645 this.head = entry; |
| 2635 } | 2646 } |
| 2636 else { | 2647 else { |
| 2637 this.lastLink.realTail = entry; | 2648 this.lastLink.realTail = entry; |
| 2638 } | 2649 } |
| 2639 this.lastLink = entry; | 2650 this.lastLink = entry; |
| 2640 } | 2651 } |
| 2641 // ********** Code for LinkBuilderImplementation$Type ************** | 2652 // ********** Code for LinkBuilderImplementation$Type ************** |
| 2642 function LinkBuilderImplementation$Type() { | 2653 function LinkBuilderImplementation$Type() { |
| 2643 this.head = null | 2654 this.head = null |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 2666 ArrayBasedScanner.prototype.get$tail = function() { return this.tail; }; | 2677 ArrayBasedScanner.prototype.get$tail = function() { return this.tail; }; |
| 2667 ArrayBasedScanner.prototype.set$tail = function(value) { return this.tail = valu e; }; | 2678 ArrayBasedScanner.prototype.set$tail = function(value) { return this.tail = valu e; }; |
| 2668 ArrayBasedScanner.prototype.get$byteOffset = function() { return this.byteOffset ; }; | 2679 ArrayBasedScanner.prototype.get$byteOffset = function() { return this.byteOffset ; }; |
| 2669 ArrayBasedScanner.prototype.set$byteOffset = function(value) { return this.byteO ffset = value; }; | 2680 ArrayBasedScanner.prototype.set$byteOffset = function(value) { return this.byteO ffset = value; }; |
| 2670 ArrayBasedScanner.prototype.advance = function() { | 2681 ArrayBasedScanner.prototype.advance = function() { |
| 2671 var next = this.nextByte(); | 2682 var next = this.nextByte(); |
| 2672 return next; | 2683 return next; |
| 2673 } | 2684 } |
| 2674 ArrayBasedScanner.prototype.select = function(choice, yes, no) { | 2685 ArrayBasedScanner.prototype.select = function(choice, yes, no) { |
| 2675 var next = this.advance(); | 2686 var next = this.advance(); |
| 2676 if ($notnull_bool(next === choice)) { | 2687 if (next === choice) { |
| 2677 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, yes); | 2688 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, yes); |
| 2678 return this.advance(); | 2689 return this.advance(); |
| 2679 } | 2690 } |
| 2680 else { | 2691 else { |
| 2681 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, no); | 2692 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, no); |
| 2682 return next; | 2693 return next; |
| 2683 } | 2694 } |
| 2684 } | 2695 } |
| 2685 ArrayBasedScanner.prototype.appendStringToken = function(kind, value) { | 2696 ArrayBasedScanner.prototype.appendStringToken = function(kind, value) { |
| 2686 this.tail.next = new StringToken(kind, value, this.tokenStart); | 2697 this.tail.next = new StringToken(kind, value, this.tokenStart); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 2704 this.extraCharOffset += offset; | 2715 this.extraCharOffset += offset; |
| 2705 } | 2716 } |
| 2706 ArrayBasedScanner.prototype.appendWhiteSpace = function(next) { | 2717 ArrayBasedScanner.prototype.appendWhiteSpace = function(next) { |
| 2707 | 2718 |
| 2708 } | 2719 } |
| 2709 ArrayBasedScanner.prototype.appendBeginGroup = function(kind, value) { | 2720 ArrayBasedScanner.prototype.appendBeginGroup = function(kind, value) { |
| 2710 var $0; | 2721 var $0; |
| 2711 var token = new BeginGroupToken(kind, value, this.tokenStart); | 2722 var token = new BeginGroupToken(kind, value, this.tokenStart); |
| 2712 this.tail.next = token; | 2723 this.tail.next = token; |
| 2713 this.tail = this.tail.next; | 2724 this.tail = this.tail.next; |
| 2714 while ($notnull_bool(kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.group ingStack.isEmpty())) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN */) { | 2725 while (kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.isEmp ty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { |
| 2715 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); | 2726 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); |
| 2716 } | 2727 } |
| 2717 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken()); | 2728 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken()); |
| 2718 } | 2729 } |
| 2719 ArrayBasedScanner.prototype.appendEndGroup = function(kind, value, openKind) { | 2730 ArrayBasedScanner.prototype.appendEndGroup = function(kind, value, openKind) { |
| 2720 var $0; | 2731 var $0; |
| 2721 var oldTail = this.tail; | 2732 var oldTail = this.tail; |
| 2722 this.appendStringToken(kind, value); | 2733 this.appendStringToken(kind, value); |
| 2723 if ($notnull_bool(this.groupingStack.isEmpty())) { | 2734 if ($notnull_bool(this.groupingStack.isEmpty())) { |
| 2724 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return; | 2735 if (openKind === 60/*null.LT_TOKEN*/) return; |
| 2725 $throw(new MalformedInputException(('Unmatched ' + value + ''))); | 2736 $throw(new MalformedInputException(('Unmatched ' + value + ''))); |
| 2726 } | 2737 } |
| 2727 while ($notnull_bool(openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.g roupingStack.isEmpty())) && this.groupingStack.get$head().kind === 60/*null.LT_T OKEN*/) { | 2738 while (openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.i sEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { |
| 2728 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); | 2739 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); |
| 2729 } | 2740 } |
| 2730 if ($notnull_bool(this.groupingStack.get$head().kind !== openKind)) { | 2741 if (this.groupingStack.get$head().kind !== openKind) { |
| 2731 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return; | 2742 if (openKind === 60/*null.LT_TOKEN*/) return; |
| 2732 $throw(new MalformedInputException(('Unmatched ' + value + ''))); | 2743 $throw(new MalformedInputException(('Unmatched ' + value + ''))); |
| 2733 } | 2744 } |
| 2734 this.groupingStack.get$head().endGroup = oldTail.next; | 2745 this.groupingStack.get$head().endGroup = oldTail.next; |
| 2735 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ()); | 2746 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ()); |
| 2736 } | 2747 } |
| 2737 ArrayBasedScanner.prototype.appendGtGt = function(kind, value) { | 2748 ArrayBasedScanner.prototype.appendGtGt = function(kind, value) { |
| 2738 var $0; | 2749 var $0; |
| 2739 var oldTail = this.tail; | 2750 var oldTail = this.tail; |
| 2740 this.appendStringToken(kind, value); | 2751 this.appendStringToken(kind, value); |
| 2741 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 2752 if ($notnull_bool(this.groupingStack.isEmpty())) return; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2776 // Initializers done | 2787 // Initializers done |
| 2777 this.tail = this.tokens; | 2788 this.tail = this.tokens; |
| 2778 } | 2789 } |
| 2779 $inherits(ArrayBasedScanner$SourceString, ArrayBasedScanner); | 2790 $inherits(ArrayBasedScanner$SourceString, ArrayBasedScanner); |
| 2780 ArrayBasedScanner$SourceString.prototype.advance = function() { | 2791 ArrayBasedScanner$SourceString.prototype.advance = function() { |
| 2781 var next = this.nextByte(); | 2792 var next = this.nextByte(); |
| 2782 return next; | 2793 return next; |
| 2783 } | 2794 } |
| 2784 ArrayBasedScanner$SourceString.prototype.select = function(choice, yes, no) { | 2795 ArrayBasedScanner$SourceString.prototype.select = function(choice, yes, no) { |
| 2785 var next = this.advance(); | 2796 var next = this.advance(); |
| 2786 if ($notnull_bool(next === choice)) { | 2797 if (next === choice) { |
| 2787 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, yes); | 2798 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, yes); |
| 2788 return this.advance(); | 2799 return this.advance(); |
| 2789 } | 2800 } |
| 2790 else { | 2801 else { |
| 2791 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, no); | 2802 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, no); |
| 2792 return next; | 2803 return next; |
| 2793 } | 2804 } |
| 2794 } | 2805 } |
| 2795 ArrayBasedScanner$SourceString.prototype.appendStringToken = function(kind, valu e) { | 2806 ArrayBasedScanner$SourceString.prototype.appendStringToken = function(kind, valu e) { |
| 2796 this.tail.next = new StringToken(kind, value, this.tokenStart); | 2807 this.tail.next = new StringToken(kind, value, this.tokenStart); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 2814 this.extraCharOffset += offset; | 2825 this.extraCharOffset += offset; |
| 2815 } | 2826 } |
| 2816 ArrayBasedScanner$SourceString.prototype.appendWhiteSpace = function(next) { | 2827 ArrayBasedScanner$SourceString.prototype.appendWhiteSpace = function(next) { |
| 2817 | 2828 |
| 2818 } | 2829 } |
| 2819 ArrayBasedScanner$SourceString.prototype.appendBeginGroup = function(kind, value ) { | 2830 ArrayBasedScanner$SourceString.prototype.appendBeginGroup = function(kind, value ) { |
| 2820 var $0; | 2831 var $0; |
| 2821 var token = new BeginGroupToken(kind, value, this.tokenStart); | 2832 var token = new BeginGroupToken(kind, value, this.tokenStart); |
| 2822 this.tail.next = token; | 2833 this.tail.next = token; |
| 2823 this.tail = this.tail.next; | 2834 this.tail = this.tail.next; |
| 2824 while ($notnull_bool(kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.group ingStack.isEmpty())) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN */) { | 2835 while (kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.isEmp ty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { |
| 2825 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); | 2836 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); |
| 2826 } | 2837 } |
| 2827 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken()); | 2838 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken()); |
| 2828 } | 2839 } |
| 2829 ArrayBasedScanner$SourceString.prototype.appendEndGroup = function(kind, value, openKind) { | 2840 ArrayBasedScanner$SourceString.prototype.appendEndGroup = function(kind, value, openKind) { |
| 2830 var $0; | 2841 var $0; |
| 2831 var oldTail = this.tail; | 2842 var oldTail = this.tail; |
| 2832 this.appendStringToken(kind, value); | 2843 this.appendStringToken(kind, value); |
| 2833 if ($notnull_bool(this.groupingStack.isEmpty())) { | 2844 if ($notnull_bool(this.groupingStack.isEmpty())) { |
| 2834 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return; | 2845 if (openKind === 60/*null.LT_TOKEN*/) return; |
| 2835 $throw(new MalformedInputException(('Unmatched ' + value + ''))); | 2846 $throw(new MalformedInputException(('Unmatched ' + value + ''))); |
| 2836 } | 2847 } |
| 2837 while ($notnull_bool(openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.g roupingStack.isEmpty())) && this.groupingStack.get$head().kind === 60/*null.LT_T OKEN*/) { | 2848 while (openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.i sEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { |
| 2838 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); | 2849 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); |
| 2839 } | 2850 } |
| 2840 if ($notnull_bool(this.groupingStack.get$head().kind !== openKind)) { | 2851 if (this.groupingStack.get$head().kind !== openKind) { |
| 2841 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return; | 2852 if (openKind === 60/*null.LT_TOKEN*/) return; |
| 2842 $throw(new MalformedInputException(('Unmatched ' + value + ''))); | 2853 $throw(new MalformedInputException(('Unmatched ' + value + ''))); |
| 2843 } | 2854 } |
| 2844 this.groupingStack.get$head().endGroup = oldTail.next; | 2855 this.groupingStack.get$head().endGroup = oldTail.next; |
| 2845 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ()); | 2856 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ()); |
| 2846 } | 2857 } |
| 2847 ArrayBasedScanner$SourceString.prototype.appendGtGt = function(kind, value) { | 2858 ArrayBasedScanner$SourceString.prototype.appendGtGt = function(kind, value) { |
| 2848 var $0; | 2859 var $0; |
| 2849 var oldTail = this.tail; | 2860 var oldTail = this.tail; |
| 2850 this.appendStringToken(kind, value); | 2861 this.appendStringToken(kind, value); |
| 2851 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 2862 if ($notnull_bool(this.groupingStack.isEmpty())) return; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 2871 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); | 2882 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); |
| 2872 } | 2883 } |
| 2873 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 2884 if ($notnull_bool(this.groupingStack.isEmpty())) return; |
| 2874 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { | 2885 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { |
| 2875 this.groupingStack.get$head().endGroup = oldTail.next; | 2886 this.groupingStack.get$head().endGroup = oldTail.next; |
| 2876 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); | 2887 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); |
| 2877 } | 2888 } |
| 2878 } | 2889 } |
| 2879 ArrayBasedScanner$SourceString.prototype.tokenize = function() { | 2890 ArrayBasedScanner$SourceString.prototype.tokenize = function() { |
| 2880 var next = this.advance(); | 2891 var next = this.advance(); |
| 2881 while ($notnull_bool(next != -1)) { | 2892 while (next != -1) { |
| 2882 next = this.bigSwitch(next); | 2893 next = this.bigSwitch(next); |
| 2883 } | 2894 } |
| 2884 this.appendEofToken(); | 2895 this.appendEofToken(); |
| 2885 return this.firstToken(); | 2896 return this.firstToken(); |
| 2886 } | 2897 } |
| 2887 ArrayBasedScanner$SourceString.prototype.bigSwitch = function(next) { | 2898 ArrayBasedScanner$SourceString.prototype.bigSwitch = function(next) { |
| 2888 this.beginToken(); | 2899 this.beginToken(); |
| 2889 switch (next) { | 2900 switch (next) { |
| 2890 case 9/*null.$TAB*/: | 2901 case 9/*null.$TAB*/: |
| 2891 case 10/*null.$LF*/: | 2902 case 10/*null.$LF*/: |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3091 case 118/*null.$v*/: | 3102 case 118/*null.$v*/: |
| 3092 case 119/*null.$w*/: | 3103 case 119/*null.$w*/: |
| 3093 case 120/*null.$x*/: | 3104 case 120/*null.$x*/: |
| 3094 case 121/*null.$y*/: | 3105 case 121/*null.$y*/: |
| 3095 case 122/*null.$z*/: | 3106 case 122/*null.$z*/: |
| 3096 | 3107 |
| 3097 return this.tokenizeIdentifier(next); | 3108 return this.tokenizeIdentifier(next); |
| 3098 | 3109 |
| 3099 default: | 3110 default: |
| 3100 | 3111 |
| 3101 if ($notnull_bool(next == -1)) { | 3112 if (next == -1) { |
| 3102 return -1; | 3113 return -1; |
| 3103 } | 3114 } |
| 3104 if ($notnull_bool(next < 0x1f)) { | 3115 if (next < 0x1f) { |
| 3105 $throw(new MalformedInputException(this.get$charOffset())); | 3116 $throw(new MalformedInputException(this.get$charOffset())); |
| 3106 } | 3117 } |
| 3107 return this.tokenizeIdentifier(next); | 3118 return this.tokenizeIdentifier(next); |
| 3108 | 3119 |
| 3109 } | 3120 } |
| 3110 } | 3121 } |
| 3111 ArrayBasedScanner$SourceString.prototype.tokenizeTag = function(next) { | 3122 ArrayBasedScanner$SourceString.prototype.tokenizeTag = function(next) { |
| 3112 if ($notnull_bool(this.byteOffset == 0)) { | 3123 if (this.byteOffset == 0) { |
| 3113 if ($notnull_bool(this.peek() == 33/*null.$BANG*/)) { | 3124 if (this.peek() == 33/*null.$BANG*/) { |
| 3114 do { | 3125 do { |
| 3115 next = this.advance(); | 3126 next = this.advance(); |
| 3116 } | 3127 } |
| 3117 while ($notnull_bool(next != 10/*null.$LF*/ && next != 13/*null.$CR*/)) | 3128 while (next != 10/*null.$LF*/ && next != 13/*null.$CR*/) |
| 3118 return next; | 3129 return next; |
| 3119 } | 3130 } |
| 3120 } | 3131 } |
| 3121 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); | 3132 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); |
| 3122 return this.advance(); | 3133 return this.advance(); |
| 3123 } | 3134 } |
| 3124 ArrayBasedScanner$SourceString.prototype.tokenizeTilde = function(next) { | 3135 ArrayBasedScanner$SourceString.prototype.tokenizeTilde = function(next) { |
| 3125 next = this.advance(); | 3136 next = this.advance(); |
| 3126 if ($notnull_bool(next == 47/*null.$SLASH*/)) { | 3137 if (next == 47/*null.$SLASH*/) { |
| 3127 return this.select(61/*null.$EQ*/, "~/=", "~/"); | 3138 return this.select(61/*null.$EQ*/, "~/=", "~/"); |
| 3128 } | 3139 } |
| 3129 else { | 3140 else { |
| 3130 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); | 3141 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); |
| 3131 return next; | 3142 return next; |
| 3132 } | 3143 } |
| 3133 } | 3144 } |
| 3134 ArrayBasedScanner$SourceString.prototype.tokenizeOpenBracket = function(next) { | 3145 ArrayBasedScanner$SourceString.prototype.tokenizeOpenBracket = function(next) { |
| 3135 next = this.advance(); | 3146 next = this.advance(); |
| 3136 if ($notnull_bool(next == 93/*null.$RBRACKET*/)) { | 3147 if (next == 93/*null.$RBRACKET*/) { |
| 3137 return this.select(61/*null.$EQ*/, "[]=", "[]"); | 3148 return this.select(61/*null.$EQ*/, "[]=", "[]"); |
| 3138 } | 3149 } |
| 3139 else { | 3150 else { |
| 3140 this.appendBeginGroup(91/*null.LBRACKET_TOKEN*/, "["); | 3151 this.appendBeginGroup(91/*null.LBRACKET_TOKEN*/, "["); |
| 3141 return next; | 3152 return next; |
| 3142 } | 3153 } |
| 3143 } | 3154 } |
| 3144 ArrayBasedScanner$SourceString.prototype.tokenizeCaret = function(next) { | 3155 ArrayBasedScanner$SourceString.prototype.tokenizeCaret = function(next) { |
| 3145 return this.select(61/*null.$EQ*/, "^=", "^"); | 3156 return this.select(61/*null.$EQ*/, "^=", "^"); |
| 3146 } | 3157 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3225 | 3236 |
| 3226 default: | 3237 default: |
| 3227 | 3238 |
| 3228 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); | 3239 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); |
| 3229 return next; | 3240 return next; |
| 3230 | 3241 |
| 3231 } | 3242 } |
| 3232 } | 3243 } |
| 3233 ArrayBasedScanner$SourceString.prototype.tokenizeExclamation = function(next) { | 3244 ArrayBasedScanner$SourceString.prototype.tokenizeExclamation = function(next) { |
| 3234 next = this.advance(); | 3245 next = this.advance(); |
| 3235 if ($notnull_bool(next == 61/*null.$EQ*/)) { | 3246 if (next == 61/*null.$EQ*/) { |
| 3236 return this.select(61/*null.$EQ*/, "!==", "!="); | 3247 return this.select(61/*null.$EQ*/, "!==", "!="); |
| 3237 } | 3248 } |
| 3238 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); | 3249 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); |
| 3239 return next; | 3250 return next; |
| 3240 } | 3251 } |
| 3241 ArrayBasedScanner$SourceString.prototype.tokenizeEquals = function(next) { | 3252 ArrayBasedScanner$SourceString.prototype.tokenizeEquals = function(next) { |
| 3242 next = this.advance(); | 3253 next = this.advance(); |
| 3243 if ($notnull_bool(next == 61/*null.$EQ*/)) { | 3254 if (next == 61/*null.$EQ*/) { |
| 3244 return this.select(61/*null.$EQ*/, "===", "=="); | 3255 return this.select(61/*null.$EQ*/, "===", "=="); |
| 3245 } | 3256 } |
| 3246 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); | 3257 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); |
| 3247 return next; | 3258 return next; |
| 3248 } | 3259 } |
| 3249 ArrayBasedScanner$SourceString.prototype.tokenizeGreaterThan = function(next) { | 3260 ArrayBasedScanner$SourceString.prototype.tokenizeGreaterThan = function(next) { |
| 3250 next = this.advance(); | 3261 next = this.advance(); |
| 3251 switch (next) { | 3262 switch (next) { |
| 3252 case 61/*null.$EQ*/: | 3263 case 61/*null.$EQ*/: |
| 3253 | 3264 |
| 3254 this.appendStringToken(62/*null.GT_TOKEN*/, ">="); | 3265 this.appendStringToken(62/*null.GT_TOKEN*/, ">="); |
| 3255 return this.advance(); | 3266 return this.advance(); |
| 3256 | 3267 |
| 3257 case 62/*null.$GT*/: | 3268 case 62/*null.$GT*/: |
| 3258 | 3269 |
| 3259 next = this.advance(); | 3270 next = this.advance(); |
| 3260 switch (next) { | 3271 switch (next) { |
| 3261 case 61/*null.$EQ*/: | 3272 case 61/*null.$EQ*/: |
| 3262 | 3273 |
| 3263 this.appendStringToken(62/*null.GT_TOKEN*/, ">>="); | 3274 this.appendStringToken(62/*null.GT_TOKEN*/, ">>="); |
| 3264 return this.advance(); | 3275 return this.advance(); |
| 3265 | 3276 |
| 3266 case 62/*null.$GT*/: | 3277 case 62/*null.$GT*/: |
| 3267 | 3278 |
| 3268 { | 3279 { |
| 3269 next = this.advance(); | 3280 next = this.advance(); |
| 3270 if ($notnull_bool(next === 61/*null.$EQ*/)) { | 3281 if (next === 61/*null.$EQ*/) { |
| 3271 this.appendStringToken(62/*null.GT_TOKEN*/, ">>>="); | 3282 this.appendStringToken(62/*null.GT_TOKEN*/, ">>>="); |
| 3272 return this.advance(); | 3283 return this.advance(); |
| 3273 } | 3284 } |
| 3274 else { | 3285 else { |
| 3275 this.appendGtGtGt(62/*null.GT_TOKEN*/, ">>>"); | 3286 this.appendGtGtGt(62/*null.GT_TOKEN*/, ">>>"); |
| 3276 return next; | 3287 return next; |
| 3277 } | 3288 } |
| 3278 } | 3289 } |
| 3279 | 3290 |
| 3280 default: | 3291 default: |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 3306 | 3317 |
| 3307 default: | 3318 default: |
| 3308 | 3319 |
| 3309 this.appendBeginGroup(60/*null.LT_TOKEN*/, "<"); | 3320 this.appendBeginGroup(60/*null.LT_TOKEN*/, "<"); |
| 3310 return next; | 3321 return next; |
| 3311 | 3322 |
| 3312 } | 3323 } |
| 3313 } | 3324 } |
| 3314 ArrayBasedScanner$SourceString.prototype.tokenizeNumber = function(next) { | 3325 ArrayBasedScanner$SourceString.prototype.tokenizeNumber = function(next) { |
| 3315 var start = this.byteOffset; | 3326 var start = this.byteOffset; |
| 3316 while ($notnull_bool(true)) { | 3327 while (true) { |
| 3317 next = this.advance(); | 3328 next = this.advance(); |
| 3318 switch (next) { | 3329 switch (next) { |
| 3319 case 48/*null.$0*/: | 3330 case 48/*null.$0*/: |
| 3320 case 49/*null.$1*/: | 3331 case 49/*null.$1*/: |
| 3321 case 50/*null.$2*/: | 3332 case 50/*null.$2*/: |
| 3322 case 51/*null.$3*/: | 3333 case 51/*null.$3*/: |
| 3323 case 52/*null.$4*/: | 3334 case 52/*null.$4*/: |
| 3324 case 53/*null.$5*/: | 3335 case 53/*null.$5*/: |
| 3325 case 54/*null.$6*/: | 3336 case 54/*null.$6*/: |
| 3326 case 55/*null.$7*/: | 3337 case 55/*null.$7*/: |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 3343 default: | 3354 default: |
| 3344 | 3355 |
| 3345 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start )); | 3356 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start )); |
| 3346 return next; | 3357 return next; |
| 3347 | 3358 |
| 3348 } | 3359 } |
| 3349 } | 3360 } |
| 3350 } | 3361 } |
| 3351 ArrayBasedScanner$SourceString.prototype.tokenizeHexOrNumber = function(next) { | 3362 ArrayBasedScanner$SourceString.prototype.tokenizeHexOrNumber = function(next) { |
| 3352 var x = this.peek(); | 3363 var x = this.peek(); |
| 3353 if ($notnull_bool(x == 120/*null.$x*/ || x == 88/*null.$X*/)) { | 3364 if (x == 120/*null.$x*/ || x == 88/*null.$X*/) { |
| 3354 this.advance(); | 3365 this.advance(); |
| 3355 return this.tokenizeHex(x); | 3366 return this.tokenizeHex(x); |
| 3356 } | 3367 } |
| 3357 return this.tokenizeNumber(next); | 3368 return this.tokenizeNumber(next); |
| 3358 } | 3369 } |
| 3359 ArrayBasedScanner$SourceString.prototype.tokenizeHex = function(next) { | 3370 ArrayBasedScanner$SourceString.prototype.tokenizeHex = function(next) { |
| 3360 var start = this.byteOffset; | 3371 var start = this.byteOffset; |
| 3361 var hasDigits = false; | 3372 var hasDigits = false; |
| 3362 while ($notnull_bool(true)) { | 3373 while (true) { |
| 3363 next = this.advance(); | 3374 next = this.advance(); |
| 3364 switch (next) { | 3375 switch (next) { |
| 3365 case 48/*null.$0*/: | 3376 case 48/*null.$0*/: |
| 3366 case 49/*null.$1*/: | 3377 case 49/*null.$1*/: |
| 3367 case 50/*null.$2*/: | 3378 case 50/*null.$2*/: |
| 3368 case 51/*null.$3*/: | 3379 case 51/*null.$3*/: |
| 3369 case 52/*null.$4*/: | 3380 case 52/*null.$4*/: |
| 3370 case 53/*null.$5*/: | 3381 case 53/*null.$5*/: |
| 3371 case 54/*null.$6*/: | 3382 case 54/*null.$6*/: |
| 3372 case 55/*null.$7*/: | 3383 case 55/*null.$7*/: |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 3383 case 99/*null.$c*/: | 3394 case 99/*null.$c*/: |
| 3384 case 100/*null.$d*/: | 3395 case 100/*null.$d*/: |
| 3385 case 101/*null.$e*/: | 3396 case 101/*null.$e*/: |
| 3386 case 102/*null.$f*/: | 3397 case 102/*null.$f*/: |
| 3387 | 3398 |
| 3388 hasDigits = true; | 3399 hasDigits = true; |
| 3389 break; | 3400 break; |
| 3390 | 3401 |
| 3391 default: | 3402 default: |
| 3392 | 3403 |
| 3393 if ($notnull_bool(!$notnull_bool(hasDigits))) { | 3404 if (!$notnull_bool(hasDigits)) { |
| 3394 $throw(new MalformedInputException(this.get$charOffset())); | 3405 $throw(new MalformedInputException(this.get$charOffset())); |
| 3395 } | 3406 } |
| 3396 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri ng(start)); | 3407 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri ng(start)); |
| 3397 return next; | 3408 return next; |
| 3398 | 3409 |
| 3399 } | 3410 } |
| 3400 } | 3411 } |
| 3401 } | 3412 } |
| 3402 ArrayBasedScanner$SourceString.prototype.tokenizeDotOrNumber = function(next) { | 3413 ArrayBasedScanner$SourceString.prototype.tokenizeDotOrNumber = function(next) { |
| 3403 var start = this.byteOffset; | 3414 var start = this.byteOffset; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 3425 default: | 3436 default: |
| 3426 | 3437 |
| 3427 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 3438 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 3428 return next; | 3439 return next; |
| 3429 | 3440 |
| 3430 } | 3441 } |
| 3431 } | 3442 } |
| 3432 ArrayBasedScanner$SourceString.prototype.tokenizeFractionPart = function(next, s tart) { | 3443 ArrayBasedScanner$SourceString.prototype.tokenizeFractionPart = function(next, s tart) { |
| 3433 var done = false; | 3444 var done = false; |
| 3434 LOOP: | 3445 LOOP: |
| 3435 while ($notnull_bool(!$notnull_bool(done))) { | 3446 while (!$notnull_bool(done)) { |
| 3436 switch (next) { | 3447 switch (next) { |
| 3437 case 48/*null.$0*/: | 3448 case 48/*null.$0*/: |
| 3438 case 49/*null.$1*/: | 3449 case 49/*null.$1*/: |
| 3439 case 50/*null.$2*/: | 3450 case 50/*null.$2*/: |
| 3440 case 51/*null.$3*/: | 3451 case 51/*null.$3*/: |
| 3441 case 52/*null.$4*/: | 3452 case 52/*null.$4*/: |
| 3442 case 53/*null.$5*/: | 3453 case 53/*null.$5*/: |
| 3443 case 54/*null.$6*/: | 3454 case 54/*null.$6*/: |
| 3444 case 55/*null.$7*/: | 3455 case 55/*null.$7*/: |
| 3445 case 56/*null.$8*/: | 3456 case 56/*null.$8*/: |
| 3446 case 57/*null.$9*/: | 3457 case 57/*null.$9*/: |
| 3447 | 3458 |
| 3448 break; | 3459 break; |
| 3449 | 3460 |
| 3450 case 101/*null.$e*/: | 3461 case 101/*null.$e*/: |
| 3451 case 69/*null.$E*/: | 3462 case 69/*null.$E*/: |
| 3452 | 3463 |
| 3453 next = this.tokenizeExponent(this.advance()); | 3464 next = this.tokenizeExponent(this.advance()); |
| 3454 done = true; | 3465 done = true; |
| 3455 continue LOOP; | 3466 continue LOOP; |
| 3456 | 3467 |
| 3457 default: | 3468 default: |
| 3458 | 3469 |
| 3459 done = true; | 3470 done = true; |
| 3460 continue LOOP; | 3471 continue LOOP; |
| 3461 | 3472 |
| 3462 } | 3473 } |
| 3463 next = this.advance(); | 3474 next = this.advance(); |
| 3464 } | 3475 } |
| 3465 if ($notnull_bool(next == 100/*null.$d*/ || next == 68/*null.$D*/)) { | 3476 if (next == 100/*null.$d*/ || next == 68/*null.$D*/) { |
| 3466 next = this.advance(); | 3477 next = this.advance(); |
| 3467 } | 3478 } |
| 3468 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); | 3479 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); |
| 3469 return next; | 3480 return next; |
| 3470 } | 3481 } |
| 3471 ArrayBasedScanner$SourceString.prototype.tokenizeExponent = function(next) { | 3482 ArrayBasedScanner$SourceString.prototype.tokenizeExponent = function(next) { |
| 3472 if ($notnull_bool(next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/)) { | 3483 if (next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/) { |
| 3473 next = this.advance(); | 3484 next = this.advance(); |
| 3474 } | 3485 } |
| 3475 var hasDigits = false; | 3486 var hasDigits = false; |
| 3476 while ($notnull_bool(true)) { | 3487 while (true) { |
| 3477 switch (next) { | 3488 switch (next) { |
| 3478 case 48/*null.$0*/: | 3489 case 48/*null.$0*/: |
| 3479 case 49/*null.$1*/: | 3490 case 49/*null.$1*/: |
| 3480 case 50/*null.$2*/: | 3491 case 50/*null.$2*/: |
| 3481 case 51/*null.$3*/: | 3492 case 51/*null.$3*/: |
| 3482 case 52/*null.$4*/: | 3493 case 52/*null.$4*/: |
| 3483 case 53/*null.$5*/: | 3494 case 53/*null.$5*/: |
| 3484 case 54/*null.$6*/: | 3495 case 54/*null.$6*/: |
| 3485 case 55/*null.$7*/: | 3496 case 55/*null.$7*/: |
| 3486 case 56/*null.$8*/: | 3497 case 56/*null.$8*/: |
| 3487 case 57/*null.$9*/: | 3498 case 57/*null.$9*/: |
| 3488 | 3499 |
| 3489 hasDigits = true; | 3500 hasDigits = true; |
| 3490 break; | 3501 break; |
| 3491 | 3502 |
| 3492 default: | 3503 default: |
| 3493 | 3504 |
| 3494 if ($notnull_bool(!$notnull_bool(hasDigits))) { | 3505 if (!$notnull_bool(hasDigits)) { |
| 3495 $throw(new MalformedInputException(this.get$charOffset())); | 3506 $throw(new MalformedInputException(this.get$charOffset())); |
| 3496 } | 3507 } |
| 3497 return next; | 3508 return next; |
| 3498 | 3509 |
| 3499 } | 3510 } |
| 3500 next = this.advance(); | 3511 next = this.advance(); |
| 3501 } | 3512 } |
| 3502 } | 3513 } |
| 3503 ArrayBasedScanner$SourceString.prototype.tokenizeSlashOrComment = function(next) { | 3514 ArrayBasedScanner$SourceString.prototype.tokenizeSlashOrComment = function(next) { |
| 3504 next = this.advance(); | 3515 next = this.advance(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 3517 return this.advance(); | 3528 return this.advance(); |
| 3518 | 3529 |
| 3519 default: | 3530 default: |
| 3520 | 3531 |
| 3521 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); | 3532 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); |
| 3522 return next; | 3533 return next; |
| 3523 | 3534 |
| 3524 } | 3535 } |
| 3525 } | 3536 } |
| 3526 ArrayBasedScanner$SourceString.prototype.tokenizeSingleLineComment = function(ne xt) { | 3537 ArrayBasedScanner$SourceString.prototype.tokenizeSingleLineComment = function(ne xt) { |
| 3527 while ($notnull_bool(true)) { | 3538 while (true) { |
| 3528 next = this.advance(); | 3539 next = this.advance(); |
| 3529 switch (next) { | 3540 switch (next) { |
| 3530 case -1: | 3541 case -1: |
| 3531 case 10/*null.$LF*/: | 3542 case 10/*null.$LF*/: |
| 3532 case 13/*null.$CR*/: | 3543 case 13/*null.$CR*/: |
| 3533 | 3544 |
| 3534 return next; | 3545 return next; |
| 3535 | 3546 |
| 3536 } | 3547 } |
| 3537 } | 3548 } |
| 3538 } | 3549 } |
| 3539 ArrayBasedScanner$SourceString.prototype.tokenizeMultiLineComment = function(nex t) { | 3550 ArrayBasedScanner$SourceString.prototype.tokenizeMultiLineComment = function(nex t) { |
| 3540 next = this.advance(); | 3551 next = this.advance(); |
| 3541 while ($notnull_bool(true)) { | 3552 while (true) { |
| 3542 switch (next) { | 3553 switch (next) { |
| 3543 case -1: | 3554 case -1: |
| 3544 | 3555 |
| 3545 return next; | 3556 return next; |
| 3546 | 3557 |
| 3547 case 42/*null.$STAR*/: | 3558 case 42/*null.$STAR*/: |
| 3548 | 3559 |
| 3549 next = this.advance(); | 3560 next = this.advance(); |
| 3550 if ($notnull_bool(next == 47/*null.$SLASH*/)) { | 3561 if (next == 47/*null.$SLASH*/) { |
| 3551 return this.advance(); | 3562 return this.advance(); |
| 3552 } | 3563 } |
| 3553 else if ($notnull_bool(next == -1)) { | 3564 else if (next == -1) { |
| 3554 return next; | 3565 return next; |
| 3555 } | 3566 } |
| 3556 break; | 3567 break; |
| 3557 | 3568 |
| 3558 default: | 3569 default: |
| 3559 | 3570 |
| 3560 next = this.advance(); | 3571 next = this.advance(); |
| 3561 break; | 3572 break; |
| 3562 | 3573 |
| 3563 } | 3574 } |
| 3564 } | 3575 } |
| 3565 } | 3576 } |
| 3566 ArrayBasedScanner$SourceString.prototype.tokenizeIdentifier = function(next) { | 3577 ArrayBasedScanner$SourceString.prototype.tokenizeIdentifier = function(next) { |
| 3567 var start = this.byteOffset; | 3578 var start = this.byteOffset; |
| 3568 var state = null; | 3579 var state = null; |
| 3569 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { | 3580 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { |
| 3570 state = KeywordState.get$KEYWORD_STATE().next(next); | 3581 state = KeywordState.get$KEYWORD_STATE().next(next); |
| 3571 next = this.advance(); | 3582 next = this.advance(); |
| 3572 } | 3583 } |
| 3573 var isAscii = true; | 3584 var isAscii = true; |
| 3574 while ($notnull_bool(true)) { | 3585 while (true) { |
| 3575 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { | 3586 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { |
| 3576 if ($notnull_bool(state != null)) { | 3587 if (state != null) { |
| 3577 state = state.next(next); | 3588 state = state.next(next); |
| 3578 } | 3589 } |
| 3579 } | 3590 } |
| 3580 else if ($notnull_bool(($notnull_bool(48/*null.$0*/ <= next && next <= 57/*n ull.$9*/)) || ($notnull_bool(65/*null.$A*/ <= next && next <= 90/*null.$Z*/))) | | next == 95/*null.$_*/ || next == 36/*null.$DOLLAR*/) { | 3591 else if ((48/*null.$0*/ <= next && next <= 57/*null.$9*/) || (65/*null.$A*/ <= next && next <= 90/*null.$Z*/) || next == 95/*null.$_*/ || next == 36/*null.$ DOLLAR*/) { |
| 3581 state = null; | 3592 state = null; |
| 3582 } | 3593 } |
| 3583 else if ($notnull_bool(next < 128)) { | 3594 else if (next < 128) { |
| 3584 if ($notnull_bool(state != null && state.isLeaf())) { | 3595 if ($notnull_bool(state != null && state.isLeaf())) { |
| 3585 this.appendKeywordToken(state.get$keyword()); | 3596 this.appendKeywordToken(state.get$keyword()); |
| 3586 } | 3597 } |
| 3587 else if ($notnull_bool(isAscii)) { | 3598 else if ($notnull_bool(isAscii)) { |
| 3588 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start)); | 3599 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start)); |
| 3589 } | 3600 } |
| 3590 else { | 3601 else { |
| 3591 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String( start, -1)); | 3602 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String( start, -1)); |
| 3592 } | 3603 } |
| 3593 return next; | 3604 return next; |
| 3594 } | 3605 } |
| 3595 else { | 3606 else { |
| 3596 var nonAsciiStart = this.byteOffset; | 3607 var nonAsciiStart = this.byteOffset; |
| 3597 do { | 3608 do { |
| 3598 next = this.nextByte(); | 3609 next = this.nextByte(); |
| 3599 } | 3610 } |
| 3600 while ($notnull_bool(next > 127)) | 3611 while (next > 127) |
| 3601 var string = this.utf8String(nonAsciiStart, -1).toString(); | 3612 var string = this.utf8String(nonAsciiStart, -1).toString(); |
| 3602 isAscii = false; | 3613 isAscii = false; |
| 3603 this.addToCharOffset(string.length); | 3614 this.addToCharOffset(string.length); |
| 3604 return next; | 3615 return next; |
| 3605 } | 3616 } |
| 3606 next = this.advance(); | 3617 next = this.advance(); |
| 3607 } | 3618 } |
| 3608 } | 3619 } |
| 3609 ArrayBasedScanner$SourceString.prototype.tokenizeRawString = function(next) { | 3620 ArrayBasedScanner$SourceString.prototype.tokenizeRawString = function(next) { |
| 3610 var start = this.byteOffset; | 3621 var start = this.byteOffset; |
| 3611 next = this.advance(); | 3622 next = this.advance(); |
| 3612 if ($notnull_bool(next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/)) { | 3623 if (next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/) { |
| 3613 return this.tokenizeString(next, start, true); | 3624 return this.tokenizeString(next, start, true); |
| 3614 } | 3625 } |
| 3615 else { | 3626 else { |
| 3616 $throw(new MalformedInputException(this.get$charOffset())); | 3627 $throw(new MalformedInputException(this.get$charOffset())); |
| 3617 } | 3628 } |
| 3618 } | 3629 } |
| 3619 ArrayBasedScanner$SourceString.prototype.tokenizeString = function(next, start, raw) { | 3630 ArrayBasedScanner$SourceString.prototype.tokenizeString = function(next, start, raw) { |
| 3620 var q = next; | 3631 var q = next; |
| 3621 next = this.advance(); | 3632 next = this.advance(); |
| 3622 if ($notnull_bool(q == next)) { | 3633 if (q == next) { |
| 3623 next = this.advance(); | 3634 next = this.advance(); |
| 3624 if ($notnull_bool(q == next)) { | 3635 if (q == next) { |
| 3625 return this.tokenizeMultiLineString(q, start, raw); | 3636 return this.tokenizeMultiLineString(q, start, raw); |
| 3626 } | 3637 } |
| 3627 else { | 3638 else { |
| 3628 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, -1)); | 3639 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, -1)); |
| 3629 return next; | 3640 return next; |
| 3630 } | 3641 } |
| 3631 } | 3642 } |
| 3632 if ($notnull_bool(raw)) { | 3643 if ($notnull_bool(raw)) { |
| 3633 return this.tokenizeSingleLineRawString(next, q, start); | 3644 return this.tokenizeSingleLineRawString(next, q, start); |
| 3634 } | 3645 } |
| 3635 else { | 3646 else { |
| 3636 return this.tokenizeSingleLineString(next, q, start); | 3647 return this.tokenizeSingleLineString(next, q, start); |
| 3637 } | 3648 } |
| 3638 } | 3649 } |
| 3639 ArrayBasedScanner$SourceString.prototype.tokenizeSingleLineString = function(nex t, q1, start) { | 3650 ArrayBasedScanner$SourceString.prototype.tokenizeSingleLineString = function(nex t, q1, start) { |
| 3640 while ($notnull_bool(next != -1)) { | 3651 while (next != -1) { |
| 3641 if ($notnull_bool(next == q1)) { | 3652 if (next == q1) { |
| 3642 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); | 3653 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); |
| 3643 return this.advance(); | 3654 return this.advance(); |
| 3644 } | 3655 } |
| 3645 else if ($notnull_bool(next == 92/*null.$BACKSLASH*/)) { | 3656 else if (next == 92/*null.$BACKSLASH*/) { |
| 3646 next = this.advance(); | 3657 next = this.advance(); |
| 3647 if ($notnull_bool(next == -1)) { | 3658 if (next == -1) { |
| 3648 $throw(new MalformedInputException(this.get$charOffset())); | 3659 $throw(new MalformedInputException(this.get$charOffset())); |
| 3649 } | 3660 } |
| 3650 } | 3661 } |
| 3651 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { | 3662 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { |
| 3652 $throw(new MalformedInputException(this.get$charOffset())); | 3663 $throw(new MalformedInputException(this.get$charOffset())); |
| 3653 } | 3664 } |
| 3654 next = this.advance(); | 3665 next = this.advance(); |
| 3655 } | 3666 } |
| 3656 $throw(new MalformedInputException(this.get$charOffset())); | 3667 $throw(new MalformedInputException(this.get$charOffset())); |
| 3657 } | 3668 } |
| 3658 ArrayBasedScanner$SourceString.prototype.tokenizeSingleLineRawString = function( next, q1, start) { | 3669 ArrayBasedScanner$SourceString.prototype.tokenizeSingleLineRawString = function( next, q1, start) { |
| 3659 next = this.advance(); | 3670 next = this.advance(); |
| 3660 while ($notnull_bool(next != -1)) { | 3671 while (next != -1) { |
| 3661 if ($notnull_bool(next == q1)) { | 3672 if (next == q1) { |
| 3662 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); | 3673 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); |
| 3663 return this.advance(); | 3674 return this.advance(); |
| 3664 } | 3675 } |
| 3665 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { | 3676 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { |
| 3666 $throw(new MalformedInputException(this.get$charOffset())); | 3677 $throw(new MalformedInputException(this.get$charOffset())); |
| 3667 } | 3678 } |
| 3668 next = this.advance(); | 3679 next = this.advance(); |
| 3669 } | 3680 } |
| 3670 $throw(new MalformedInputException(this.get$charOffset())); | 3681 $throw(new MalformedInputException(this.get$charOffset())); |
| 3671 } | 3682 } |
| 3672 ArrayBasedScanner$SourceString.prototype.tokenizeMultiLineString = function(q, s tart, raw) { | 3683 ArrayBasedScanner$SourceString.prototype.tokenizeMultiLineString = function(q, s tart, raw) { |
| 3673 var next = this.advance(); | 3684 var next = this.advance(); |
| 3674 while ($notnull_bool(next != -1)) { | 3685 while (next != -1) { |
| 3675 if ($notnull_bool(next == q)) { | 3686 if (next == q) { |
| 3676 next = this.advance(); | 3687 next = this.advance(); |
| 3677 if ($notnull_bool(next == q)) { | 3688 if (next == q) { |
| 3678 next = this.advance(); | 3689 next = this.advance(); |
| 3679 if ($notnull_bool(next == q)) { | 3690 if (next == q) { |
| 3680 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st art, 0)); | 3691 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st art, 0)); |
| 3681 return this.advance(); | 3692 return this.advance(); |
| 3682 } | 3693 } |
| 3683 } | 3694 } |
| 3684 } | 3695 } |
| 3685 next = this.advance(); | 3696 next = this.advance(); |
| 3686 } | 3697 } |
| 3687 return next; | 3698 return next; |
| 3688 } | 3699 } |
| 3689 // ********** Code for top level ************** | 3700 // ********** Code for top level ************** |
| 3690 // ********** Library scanner ************** | 3701 // ********** Library scanner ************** |
| 3691 // ********** Code for AbstractScanner ************** | 3702 // ********** Code for AbstractScanner ************** |
| 3692 function AbstractScanner() {} | 3703 function AbstractScanner() {} |
| 3693 AbstractScanner.prototype.tokenize = function() { | 3704 AbstractScanner.prototype.tokenize = function() { |
| 3694 var next = this.advance(); | 3705 var next = this.advance(); |
| 3695 while ($notnull_bool(next != -1)) { | 3706 while (next != -1) { |
| 3696 next = this.bigSwitch(next); | 3707 next = this.bigSwitch(next); |
| 3697 } | 3708 } |
| 3698 this.appendEofToken(); | 3709 this.appendEofToken(); |
| 3699 return this.firstToken(); | 3710 return this.firstToken(); |
| 3700 } | 3711 } |
| 3701 AbstractScanner.prototype.bigSwitch = function(next) { | 3712 AbstractScanner.prototype.bigSwitch = function(next) { |
| 3702 this.beginToken(); | 3713 this.beginToken(); |
| 3703 switch (next) { | 3714 switch (next) { |
| 3704 case 9/*null.$TAB*/: | 3715 case 9/*null.$TAB*/: |
| 3705 case 10/*null.$LF*/: | 3716 case 10/*null.$LF*/: |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3905 case 118/*null.$v*/: | 3916 case 118/*null.$v*/: |
| 3906 case 119/*null.$w*/: | 3917 case 119/*null.$w*/: |
| 3907 case 120/*null.$x*/: | 3918 case 120/*null.$x*/: |
| 3908 case 121/*null.$y*/: | 3919 case 121/*null.$y*/: |
| 3909 case 122/*null.$z*/: | 3920 case 122/*null.$z*/: |
| 3910 | 3921 |
| 3911 return this.tokenizeIdentifier(next); | 3922 return this.tokenizeIdentifier(next); |
| 3912 | 3923 |
| 3913 default: | 3924 default: |
| 3914 | 3925 |
| 3915 if ($notnull_bool(next == -1)) { | 3926 if (next == -1) { |
| 3916 return -1; | 3927 return -1; |
| 3917 } | 3928 } |
| 3918 if ($notnull_bool(next < 0x1f)) { | 3929 if (next < 0x1f) { |
| 3919 $throw(new MalformedInputException(this.get$charOffset())); | 3930 $throw(new MalformedInputException(this.get$charOffset())); |
| 3920 } | 3931 } |
| 3921 return this.tokenizeIdentifier(next); | 3932 return this.tokenizeIdentifier(next); |
| 3922 | 3933 |
| 3923 } | 3934 } |
| 3924 } | 3935 } |
| 3925 AbstractScanner.prototype.tokenizeTag = function(next) { | 3936 AbstractScanner.prototype.tokenizeTag = function(next) { |
| 3926 if ($notnull_bool(this.get$byteOffset() == 0)) { | 3937 if (this.get$byteOffset() == 0) { |
| 3927 if ($notnull_bool(this.peek() == 33/*null.$BANG*/)) { | 3938 if (this.peek() == 33/*null.$BANG*/) { |
| 3928 do { | 3939 do { |
| 3929 next = this.advance(); | 3940 next = this.advance(); |
| 3930 } | 3941 } |
| 3931 while ($notnull_bool(next != 10/*null.$LF*/ && next != 13/*null.$CR*/)) | 3942 while (next != 10/*null.$LF*/ && next != 13/*null.$CR*/) |
| 3932 return next; | 3943 return next; |
| 3933 } | 3944 } |
| 3934 } | 3945 } |
| 3935 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); | 3946 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); |
| 3936 return this.advance(); | 3947 return this.advance(); |
| 3937 } | 3948 } |
| 3938 AbstractScanner.prototype.tokenizeTilde = function(next) { | 3949 AbstractScanner.prototype.tokenizeTilde = function(next) { |
| 3939 next = this.advance(); | 3950 next = this.advance(); |
| 3940 if ($notnull_bool(next == 47/*null.$SLASH*/)) { | 3951 if (next == 47/*null.$SLASH*/) { |
| 3941 return this.select(61/*null.$EQ*/, "~/=", "~/"); | 3952 return this.select(61/*null.$EQ*/, "~/=", "~/"); |
| 3942 } | 3953 } |
| 3943 else { | 3954 else { |
| 3944 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); | 3955 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); |
| 3945 return next; | 3956 return next; |
| 3946 } | 3957 } |
| 3947 } | 3958 } |
| 3948 AbstractScanner.prototype.tokenizeOpenBracket = function(next) { | 3959 AbstractScanner.prototype.tokenizeOpenBracket = function(next) { |
| 3949 next = this.advance(); | 3960 next = this.advance(); |
| 3950 if ($notnull_bool(next == 93/*null.$RBRACKET*/)) { | 3961 if (next == 93/*null.$RBRACKET*/) { |
| 3951 return this.select(61/*null.$EQ*/, "[]=", "[]"); | 3962 return this.select(61/*null.$EQ*/, "[]=", "[]"); |
| 3952 } | 3963 } |
| 3953 else { | 3964 else { |
| 3954 this.appendBeginGroup(91/*null.LBRACKET_TOKEN*/, "["); | 3965 this.appendBeginGroup(91/*null.LBRACKET_TOKEN*/, "["); |
| 3955 return next; | 3966 return next; |
| 3956 } | 3967 } |
| 3957 } | 3968 } |
| 3958 AbstractScanner.prototype.tokenizeCaret = function(next) { | 3969 AbstractScanner.prototype.tokenizeCaret = function(next) { |
| 3959 return this.select(61/*null.$EQ*/, "^=", "^"); | 3970 return this.select(61/*null.$EQ*/, "^=", "^"); |
| 3960 } | 3971 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4039 | 4050 |
| 4040 default: | 4051 default: |
| 4041 | 4052 |
| 4042 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); | 4053 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); |
| 4043 return next; | 4054 return next; |
| 4044 | 4055 |
| 4045 } | 4056 } |
| 4046 } | 4057 } |
| 4047 AbstractScanner.prototype.tokenizeExclamation = function(next) { | 4058 AbstractScanner.prototype.tokenizeExclamation = function(next) { |
| 4048 next = this.advance(); | 4059 next = this.advance(); |
| 4049 if ($notnull_bool(next == 61/*null.$EQ*/)) { | 4060 if (next == 61/*null.$EQ*/) { |
| 4050 return this.select(61/*null.$EQ*/, "!==", "!="); | 4061 return this.select(61/*null.$EQ*/, "!==", "!="); |
| 4051 } | 4062 } |
| 4052 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); | 4063 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); |
| 4053 return next; | 4064 return next; |
| 4054 } | 4065 } |
| 4055 AbstractScanner.prototype.tokenizeEquals = function(next) { | 4066 AbstractScanner.prototype.tokenizeEquals = function(next) { |
| 4056 next = this.advance(); | 4067 next = this.advance(); |
| 4057 if ($notnull_bool(next == 61/*null.$EQ*/)) { | 4068 if (next == 61/*null.$EQ*/) { |
| 4058 return this.select(61/*null.$EQ*/, "===", "=="); | 4069 return this.select(61/*null.$EQ*/, "===", "=="); |
| 4059 } | 4070 } |
| 4060 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); | 4071 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); |
| 4061 return next; | 4072 return next; |
| 4062 } | 4073 } |
| 4063 AbstractScanner.prototype.tokenizeGreaterThan = function(next) { | 4074 AbstractScanner.prototype.tokenizeGreaterThan = function(next) { |
| 4064 next = this.advance(); | 4075 next = this.advance(); |
| 4065 switch (next) { | 4076 switch (next) { |
| 4066 case 61/*null.$EQ*/: | 4077 case 61/*null.$EQ*/: |
| 4067 | 4078 |
| 4068 this.appendStringToken(62/*null.GT_TOKEN*/, ">="); | 4079 this.appendStringToken(62/*null.GT_TOKEN*/, ">="); |
| 4069 return this.advance(); | 4080 return this.advance(); |
| 4070 | 4081 |
| 4071 case 62/*null.$GT*/: | 4082 case 62/*null.$GT*/: |
| 4072 | 4083 |
| 4073 next = this.advance(); | 4084 next = this.advance(); |
| 4074 switch (next) { | 4085 switch (next) { |
| 4075 case 61/*null.$EQ*/: | 4086 case 61/*null.$EQ*/: |
| 4076 | 4087 |
| 4077 this.appendStringToken(62/*null.GT_TOKEN*/, ">>="); | 4088 this.appendStringToken(62/*null.GT_TOKEN*/, ">>="); |
| 4078 return this.advance(); | 4089 return this.advance(); |
| 4079 | 4090 |
| 4080 case 62/*null.$GT*/: | 4091 case 62/*null.$GT*/: |
| 4081 | 4092 |
| 4082 { | 4093 { |
| 4083 next = this.advance(); | 4094 next = this.advance(); |
| 4084 if ($notnull_bool(next === 61/*null.$EQ*/)) { | 4095 if (next === 61/*null.$EQ*/) { |
| 4085 this.appendStringToken(62/*null.GT_TOKEN*/, ">>>="); | 4096 this.appendStringToken(62/*null.GT_TOKEN*/, ">>>="); |
| 4086 return this.advance(); | 4097 return this.advance(); |
| 4087 } | 4098 } |
| 4088 else { | 4099 else { |
| 4089 this.appendGtGtGt(62/*null.GT_TOKEN*/, ">>>"); | 4100 this.appendGtGtGt(62/*null.GT_TOKEN*/, ">>>"); |
| 4090 return next; | 4101 return next; |
| 4091 } | 4102 } |
| 4092 } | 4103 } |
| 4093 | 4104 |
| 4094 default: | 4105 default: |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 4120 | 4131 |
| 4121 default: | 4132 default: |
| 4122 | 4133 |
| 4123 this.appendBeginGroup(60/*null.LT_TOKEN*/, "<"); | 4134 this.appendBeginGroup(60/*null.LT_TOKEN*/, "<"); |
| 4124 return next; | 4135 return next; |
| 4125 | 4136 |
| 4126 } | 4137 } |
| 4127 } | 4138 } |
| 4128 AbstractScanner.prototype.tokenizeNumber = function(next) { | 4139 AbstractScanner.prototype.tokenizeNumber = function(next) { |
| 4129 var start = this.get$byteOffset(); | 4140 var start = this.get$byteOffset(); |
| 4130 while ($notnull_bool(true)) { | 4141 while (true) { |
| 4131 next = this.advance(); | 4142 next = this.advance(); |
| 4132 switch (next) { | 4143 switch (next) { |
| 4133 case 48/*null.$0*/: | 4144 case 48/*null.$0*/: |
| 4134 case 49/*null.$1*/: | 4145 case 49/*null.$1*/: |
| 4135 case 50/*null.$2*/: | 4146 case 50/*null.$2*/: |
| 4136 case 51/*null.$3*/: | 4147 case 51/*null.$3*/: |
| 4137 case 52/*null.$4*/: | 4148 case 52/*null.$4*/: |
| 4138 case 53/*null.$5*/: | 4149 case 53/*null.$5*/: |
| 4139 case 54/*null.$6*/: | 4150 case 54/*null.$6*/: |
| 4140 case 55/*null.$7*/: | 4151 case 55/*null.$7*/: |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 4157 default: | 4168 default: |
| 4158 | 4169 |
| 4159 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start )); | 4170 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start )); |
| 4160 return next; | 4171 return next; |
| 4161 | 4172 |
| 4162 } | 4173 } |
| 4163 } | 4174 } |
| 4164 } | 4175 } |
| 4165 AbstractScanner.prototype.tokenizeHexOrNumber = function(next) { | 4176 AbstractScanner.prototype.tokenizeHexOrNumber = function(next) { |
| 4166 var x = this.peek(); | 4177 var x = this.peek(); |
| 4167 if ($notnull_bool(x == 120/*null.$x*/ || x == 88/*null.$X*/)) { | 4178 if (x == 120/*null.$x*/ || x == 88/*null.$X*/) { |
| 4168 this.advance(); | 4179 this.advance(); |
| 4169 return this.tokenizeHex(x); | 4180 return this.tokenizeHex(x); |
| 4170 } | 4181 } |
| 4171 return this.tokenizeNumber(next); | 4182 return this.tokenizeNumber(next); |
| 4172 } | 4183 } |
| 4173 AbstractScanner.prototype.tokenizeHex = function(next) { | 4184 AbstractScanner.prototype.tokenizeHex = function(next) { |
| 4174 var start = this.get$byteOffset(); | 4185 var start = this.get$byteOffset(); |
| 4175 var hasDigits = false; | 4186 var hasDigits = false; |
| 4176 while ($notnull_bool(true)) { | 4187 while (true) { |
| 4177 next = this.advance(); | 4188 next = this.advance(); |
| 4178 switch (next) { | 4189 switch (next) { |
| 4179 case 48/*null.$0*/: | 4190 case 48/*null.$0*/: |
| 4180 case 49/*null.$1*/: | 4191 case 49/*null.$1*/: |
| 4181 case 50/*null.$2*/: | 4192 case 50/*null.$2*/: |
| 4182 case 51/*null.$3*/: | 4193 case 51/*null.$3*/: |
| 4183 case 52/*null.$4*/: | 4194 case 52/*null.$4*/: |
| 4184 case 53/*null.$5*/: | 4195 case 53/*null.$5*/: |
| 4185 case 54/*null.$6*/: | 4196 case 54/*null.$6*/: |
| 4186 case 55/*null.$7*/: | 4197 case 55/*null.$7*/: |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 4197 case 99/*null.$c*/: | 4208 case 99/*null.$c*/: |
| 4198 case 100/*null.$d*/: | 4209 case 100/*null.$d*/: |
| 4199 case 101/*null.$e*/: | 4210 case 101/*null.$e*/: |
| 4200 case 102/*null.$f*/: | 4211 case 102/*null.$f*/: |
| 4201 | 4212 |
| 4202 hasDigits = true; | 4213 hasDigits = true; |
| 4203 break; | 4214 break; |
| 4204 | 4215 |
| 4205 default: | 4216 default: |
| 4206 | 4217 |
| 4207 if ($notnull_bool(!$notnull_bool(hasDigits))) { | 4218 if (!$notnull_bool(hasDigits)) { |
| 4208 $throw(new MalformedInputException(this.get$charOffset())); | 4219 $throw(new MalformedInputException(this.get$charOffset())); |
| 4209 } | 4220 } |
| 4210 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri ng(start)); | 4221 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri ng(start)); |
| 4211 return next; | 4222 return next; |
| 4212 | 4223 |
| 4213 } | 4224 } |
| 4214 } | 4225 } |
| 4215 } | 4226 } |
| 4216 AbstractScanner.prototype.tokenizeDotOrNumber = function(next) { | 4227 AbstractScanner.prototype.tokenizeDotOrNumber = function(next) { |
| 4217 var start = this.get$byteOffset(); | 4228 var start = this.get$byteOffset(); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 4239 default: | 4250 default: |
| 4240 | 4251 |
| 4241 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 4252 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 4242 return next; | 4253 return next; |
| 4243 | 4254 |
| 4244 } | 4255 } |
| 4245 } | 4256 } |
| 4246 AbstractScanner.prototype.tokenizeFractionPart = function(next, start) { | 4257 AbstractScanner.prototype.tokenizeFractionPart = function(next, start) { |
| 4247 var done = false; | 4258 var done = false; |
| 4248 LOOP: | 4259 LOOP: |
| 4249 while ($notnull_bool(!$notnull_bool(done))) { | 4260 while (!$notnull_bool(done)) { |
| 4250 switch (next) { | 4261 switch (next) { |
| 4251 case 48/*null.$0*/: | 4262 case 48/*null.$0*/: |
| 4252 case 49/*null.$1*/: | 4263 case 49/*null.$1*/: |
| 4253 case 50/*null.$2*/: | 4264 case 50/*null.$2*/: |
| 4254 case 51/*null.$3*/: | 4265 case 51/*null.$3*/: |
| 4255 case 52/*null.$4*/: | 4266 case 52/*null.$4*/: |
| 4256 case 53/*null.$5*/: | 4267 case 53/*null.$5*/: |
| 4257 case 54/*null.$6*/: | 4268 case 54/*null.$6*/: |
| 4258 case 55/*null.$7*/: | 4269 case 55/*null.$7*/: |
| 4259 case 56/*null.$8*/: | 4270 case 56/*null.$8*/: |
| 4260 case 57/*null.$9*/: | 4271 case 57/*null.$9*/: |
| 4261 | 4272 |
| 4262 break; | 4273 break; |
| 4263 | 4274 |
| 4264 case 101/*null.$e*/: | 4275 case 101/*null.$e*/: |
| 4265 case 69/*null.$E*/: | 4276 case 69/*null.$E*/: |
| 4266 | 4277 |
| 4267 next = this.tokenizeExponent(this.advance()); | 4278 next = this.tokenizeExponent(this.advance()); |
| 4268 done = true; | 4279 done = true; |
| 4269 continue LOOP; | 4280 continue LOOP; |
| 4270 | 4281 |
| 4271 default: | 4282 default: |
| 4272 | 4283 |
| 4273 done = true; | 4284 done = true; |
| 4274 continue LOOP; | 4285 continue LOOP; |
| 4275 | 4286 |
| 4276 } | 4287 } |
| 4277 next = this.advance(); | 4288 next = this.advance(); |
| 4278 } | 4289 } |
| 4279 if ($notnull_bool(next == 100/*null.$d*/ || next == 68/*null.$D*/)) { | 4290 if (next == 100/*null.$d*/ || next == 68/*null.$D*/) { |
| 4280 next = this.advance(); | 4291 next = this.advance(); |
| 4281 } | 4292 } |
| 4282 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); | 4293 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); |
| 4283 return next; | 4294 return next; |
| 4284 } | 4295 } |
| 4285 AbstractScanner.prototype.tokenizeExponent = function(next) { | 4296 AbstractScanner.prototype.tokenizeExponent = function(next) { |
| 4286 if ($notnull_bool(next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/)) { | 4297 if (next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/) { |
| 4287 next = this.advance(); | 4298 next = this.advance(); |
| 4288 } | 4299 } |
| 4289 var hasDigits = false; | 4300 var hasDigits = false; |
| 4290 while ($notnull_bool(true)) { | 4301 while (true) { |
| 4291 switch (next) { | 4302 switch (next) { |
| 4292 case 48/*null.$0*/: | 4303 case 48/*null.$0*/: |
| 4293 case 49/*null.$1*/: | 4304 case 49/*null.$1*/: |
| 4294 case 50/*null.$2*/: | 4305 case 50/*null.$2*/: |
| 4295 case 51/*null.$3*/: | 4306 case 51/*null.$3*/: |
| 4296 case 52/*null.$4*/: | 4307 case 52/*null.$4*/: |
| 4297 case 53/*null.$5*/: | 4308 case 53/*null.$5*/: |
| 4298 case 54/*null.$6*/: | 4309 case 54/*null.$6*/: |
| 4299 case 55/*null.$7*/: | 4310 case 55/*null.$7*/: |
| 4300 case 56/*null.$8*/: | 4311 case 56/*null.$8*/: |
| 4301 case 57/*null.$9*/: | 4312 case 57/*null.$9*/: |
| 4302 | 4313 |
| 4303 hasDigits = true; | 4314 hasDigits = true; |
| 4304 break; | 4315 break; |
| 4305 | 4316 |
| 4306 default: | 4317 default: |
| 4307 | 4318 |
| 4308 if ($notnull_bool(!$notnull_bool(hasDigits))) { | 4319 if (!$notnull_bool(hasDigits)) { |
| 4309 $throw(new MalformedInputException(this.get$charOffset())); | 4320 $throw(new MalformedInputException(this.get$charOffset())); |
| 4310 } | 4321 } |
| 4311 return next; | 4322 return next; |
| 4312 | 4323 |
| 4313 } | 4324 } |
| 4314 next = this.advance(); | 4325 next = this.advance(); |
| 4315 } | 4326 } |
| 4316 } | 4327 } |
| 4317 AbstractScanner.prototype.tokenizeSlashOrComment = function(next) { | 4328 AbstractScanner.prototype.tokenizeSlashOrComment = function(next) { |
| 4318 next = this.advance(); | 4329 next = this.advance(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 4331 return this.advance(); | 4342 return this.advance(); |
| 4332 | 4343 |
| 4333 default: | 4344 default: |
| 4334 | 4345 |
| 4335 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); | 4346 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); |
| 4336 return next; | 4347 return next; |
| 4337 | 4348 |
| 4338 } | 4349 } |
| 4339 } | 4350 } |
| 4340 AbstractScanner.prototype.tokenizeSingleLineComment = function(next) { | 4351 AbstractScanner.prototype.tokenizeSingleLineComment = function(next) { |
| 4341 while ($notnull_bool(true)) { | 4352 while (true) { |
| 4342 next = this.advance(); | 4353 next = this.advance(); |
| 4343 switch (next) { | 4354 switch (next) { |
| 4344 case -1: | 4355 case -1: |
| 4345 case 10/*null.$LF*/: | 4356 case 10/*null.$LF*/: |
| 4346 case 13/*null.$CR*/: | 4357 case 13/*null.$CR*/: |
| 4347 | 4358 |
| 4348 return next; | 4359 return next; |
| 4349 | 4360 |
| 4350 } | 4361 } |
| 4351 } | 4362 } |
| 4352 } | 4363 } |
| 4353 AbstractScanner.prototype.tokenizeMultiLineComment = function(next) { | 4364 AbstractScanner.prototype.tokenizeMultiLineComment = function(next) { |
| 4354 next = this.advance(); | 4365 next = this.advance(); |
| 4355 while ($notnull_bool(true)) { | 4366 while (true) { |
| 4356 switch (next) { | 4367 switch (next) { |
| 4357 case -1: | 4368 case -1: |
| 4358 | 4369 |
| 4359 return next; | 4370 return next; |
| 4360 | 4371 |
| 4361 case 42/*null.$STAR*/: | 4372 case 42/*null.$STAR*/: |
| 4362 | 4373 |
| 4363 next = this.advance(); | 4374 next = this.advance(); |
| 4364 if ($notnull_bool(next == 47/*null.$SLASH*/)) { | 4375 if (next == 47/*null.$SLASH*/) { |
| 4365 return this.advance(); | 4376 return this.advance(); |
| 4366 } | 4377 } |
| 4367 else if ($notnull_bool(next == -1)) { | 4378 else if (next == -1) { |
| 4368 return next; | 4379 return next; |
| 4369 } | 4380 } |
| 4370 break; | 4381 break; |
| 4371 | 4382 |
| 4372 default: | 4383 default: |
| 4373 | 4384 |
| 4374 next = this.advance(); | 4385 next = this.advance(); |
| 4375 break; | 4386 break; |
| 4376 | 4387 |
| 4377 } | 4388 } |
| 4378 } | 4389 } |
| 4379 } | 4390 } |
| 4380 AbstractScanner.prototype.tokenizeIdentifier = function(next) { | 4391 AbstractScanner.prototype.tokenizeIdentifier = function(next) { |
| 4381 var start = this.get$byteOffset(); | 4392 var start = this.get$byteOffset(); |
| 4382 var state = null; | 4393 var state = null; |
| 4383 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { | 4394 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { |
| 4384 state = KeywordState.get$KEYWORD_STATE().next(next); | 4395 state = KeywordState.get$KEYWORD_STATE().next(next); |
| 4385 next = this.advance(); | 4396 next = this.advance(); |
| 4386 } | 4397 } |
| 4387 var isAscii = true; | 4398 var isAscii = true; |
| 4388 while ($notnull_bool(true)) { | 4399 while (true) { |
| 4389 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { | 4400 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { |
| 4390 if ($notnull_bool(state != null)) { | 4401 if (state != null) { |
| 4391 state = state.next(next); | 4402 state = state.next(next); |
| 4392 } | 4403 } |
| 4393 } | 4404 } |
| 4394 else if ($notnull_bool(($notnull_bool(48/*null.$0*/ <= next && next <= 57/*n ull.$9*/)) || ($notnull_bool(65/*null.$A*/ <= next && next <= 90/*null.$Z*/))) | | next == 95/*null.$_*/ || next == 36/*null.$DOLLAR*/) { | 4405 else if ((48/*null.$0*/ <= next && next <= 57/*null.$9*/) || (65/*null.$A*/ <= next && next <= 90/*null.$Z*/) || next == 95/*null.$_*/ || next == 36/*null.$ DOLLAR*/) { |
| 4395 state = null; | 4406 state = null; |
| 4396 } | 4407 } |
| 4397 else if ($notnull_bool(next < 128)) { | 4408 else if (next < 128) { |
| 4398 if ($notnull_bool(state != null && state.isLeaf())) { | 4409 if ($notnull_bool(state != null && state.isLeaf())) { |
| 4399 this.appendKeywordToken(state.get$keyword()); | 4410 this.appendKeywordToken(state.get$keyword()); |
| 4400 } | 4411 } |
| 4401 else if ($notnull_bool(isAscii)) { | 4412 else if ($notnull_bool(isAscii)) { |
| 4402 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start)); | 4413 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start)); |
| 4403 } | 4414 } |
| 4404 else { | 4415 else { |
| 4405 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String( start, -1)); | 4416 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String( start, -1)); |
| 4406 } | 4417 } |
| 4407 return next; | 4418 return next; |
| 4408 } | 4419 } |
| 4409 else { | 4420 else { |
| 4410 var nonAsciiStart = this.get$byteOffset(); | 4421 var nonAsciiStart = this.get$byteOffset(); |
| 4411 do { | 4422 do { |
| 4412 next = this.nextByte(); | 4423 next = this.nextByte(); |
| 4413 } | 4424 } |
| 4414 while ($notnull_bool(next > 127)) | 4425 while (next > 127) |
| 4415 var string = $assert_String(this.utf8String(nonAsciiStart, -1).toString()) ; | 4426 var string = $assert_String(this.utf8String(nonAsciiStart, -1).toString()) ; |
| 4416 isAscii = false; | 4427 isAscii = false; |
| 4417 this.addToCharOffset(string.length); | 4428 this.addToCharOffset(string.length); |
| 4418 return next; | 4429 return next; |
| 4419 } | 4430 } |
| 4420 next = this.advance(); | 4431 next = this.advance(); |
| 4421 } | 4432 } |
| 4422 } | 4433 } |
| 4423 AbstractScanner.prototype.tokenizeRawString = function(next) { | 4434 AbstractScanner.prototype.tokenizeRawString = function(next) { |
| 4424 var start = this.get$byteOffset(); | 4435 var start = this.get$byteOffset(); |
| 4425 next = this.advance(); | 4436 next = this.advance(); |
| 4426 if ($notnull_bool(next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/)) { | 4437 if (next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/) { |
| 4427 return this.tokenizeString(next, start, true); | 4438 return this.tokenizeString(next, start, true); |
| 4428 } | 4439 } |
| 4429 else { | 4440 else { |
| 4430 $throw(new MalformedInputException(this.get$charOffset())); | 4441 $throw(new MalformedInputException(this.get$charOffset())); |
| 4431 } | 4442 } |
| 4432 } | 4443 } |
| 4433 AbstractScanner.prototype.tokenizeString = function(next, start, raw) { | 4444 AbstractScanner.prototype.tokenizeString = function(next, start, raw) { |
| 4434 var q = next; | 4445 var q = next; |
| 4435 next = this.advance(); | 4446 next = this.advance(); |
| 4436 if ($notnull_bool(q == next)) { | 4447 if (q == next) { |
| 4437 next = this.advance(); | 4448 next = this.advance(); |
| 4438 if ($notnull_bool(q == next)) { | 4449 if (q == next) { |
| 4439 return this.tokenizeMultiLineString(q, start, raw); | 4450 return this.tokenizeMultiLineString(q, start, raw); |
| 4440 } | 4451 } |
| 4441 else { | 4452 else { |
| 4442 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, -1)); | 4453 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, -1)); |
| 4443 return next; | 4454 return next; |
| 4444 } | 4455 } |
| 4445 } | 4456 } |
| 4446 if ($notnull_bool(raw)) { | 4457 if ($notnull_bool(raw)) { |
| 4447 return this.tokenizeSingleLineRawString(next, q, start); | 4458 return this.tokenizeSingleLineRawString(next, q, start); |
| 4448 } | 4459 } |
| 4449 else { | 4460 else { |
| 4450 return this.tokenizeSingleLineString(next, q, start); | 4461 return this.tokenizeSingleLineString(next, q, start); |
| 4451 } | 4462 } |
| 4452 } | 4463 } |
| 4453 AbstractScanner.prototype.tokenizeSingleLineString = function(next, q1, start) { | 4464 AbstractScanner.prototype.tokenizeSingleLineString = function(next, q1, start) { |
| 4454 while ($notnull_bool(next != -1)) { | 4465 while (next != -1) { |
| 4455 if ($notnull_bool(next == q1)) { | 4466 if (next == q1) { |
| 4456 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); | 4467 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); |
| 4457 return this.advance(); | 4468 return this.advance(); |
| 4458 } | 4469 } |
| 4459 else if ($notnull_bool(next == 92/*null.$BACKSLASH*/)) { | 4470 else if (next == 92/*null.$BACKSLASH*/) { |
| 4460 next = this.advance(); | 4471 next = this.advance(); |
| 4461 if ($notnull_bool(next == -1)) { | 4472 if (next == -1) { |
| 4462 $throw(new MalformedInputException(this.get$charOffset())); | 4473 $throw(new MalformedInputException(this.get$charOffset())); |
| 4463 } | 4474 } |
| 4464 } | 4475 } |
| 4465 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { | 4476 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { |
| 4466 $throw(new MalformedInputException(this.get$charOffset())); | 4477 $throw(new MalformedInputException(this.get$charOffset())); |
| 4467 } | 4478 } |
| 4468 next = this.advance(); | 4479 next = this.advance(); |
| 4469 } | 4480 } |
| 4470 $throw(new MalformedInputException(this.get$charOffset())); | 4481 $throw(new MalformedInputException(this.get$charOffset())); |
| 4471 } | 4482 } |
| 4472 AbstractScanner.prototype.tokenizeSingleLineRawString = function(next, q1, start ) { | 4483 AbstractScanner.prototype.tokenizeSingleLineRawString = function(next, q1, start ) { |
| 4473 next = this.advance(); | 4484 next = this.advance(); |
| 4474 while ($notnull_bool(next != -1)) { | 4485 while (next != -1) { |
| 4475 if ($notnull_bool(next == q1)) { | 4486 if (next == q1) { |
| 4476 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); | 4487 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); |
| 4477 return this.advance(); | 4488 return this.advance(); |
| 4478 } | 4489 } |
| 4479 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { | 4490 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { |
| 4480 $throw(new MalformedInputException(this.get$charOffset())); | 4491 $throw(new MalformedInputException(this.get$charOffset())); |
| 4481 } | 4492 } |
| 4482 next = this.advance(); | 4493 next = this.advance(); |
| 4483 } | 4494 } |
| 4484 $throw(new MalformedInputException(this.get$charOffset())); | 4495 $throw(new MalformedInputException(this.get$charOffset())); |
| 4485 } | 4496 } |
| 4486 AbstractScanner.prototype.tokenizeMultiLineString = function(q, start, raw) { | 4497 AbstractScanner.prototype.tokenizeMultiLineString = function(q, start, raw) { |
| 4487 var next = this.advance(); | 4498 var next = this.advance(); |
| 4488 while ($notnull_bool(next != -1)) { | 4499 while (next != -1) { |
| 4489 if ($notnull_bool(next == q)) { | 4500 if (next == q) { |
| 4490 next = this.advance(); | 4501 next = this.advance(); |
| 4491 if ($notnull_bool(next == q)) { | 4502 if (next == q) { |
| 4492 next = this.advance(); | 4503 next = this.advance(); |
| 4493 if ($notnull_bool(next == q)) { | 4504 if (next == q) { |
| 4494 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st art, 0)); | 4505 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st art, 0)); |
| 4495 return this.advance(); | 4506 return this.advance(); |
| 4496 } | 4507 } |
| 4497 } | 4508 } |
| 4498 } | 4509 } |
| 4499 next = this.advance(); | 4510 next = this.advance(); |
| 4500 } | 4511 } |
| 4501 return next; | 4512 return next; |
| 4502 } | 4513 } |
| 4503 // ********** Code for AbstractScanner$S ************** | 4514 // ********** Code for AbstractScanner$S ************** |
| 4504 function AbstractScanner$S() {} | 4515 function AbstractScanner$S() {} |
| 4505 $inherits(AbstractScanner$S, AbstractScanner); | 4516 $inherits(AbstractScanner$S, AbstractScanner); |
| 4506 AbstractScanner$S.prototype.tokenize = function() { | 4517 AbstractScanner$S.prototype.tokenize = function() { |
| 4507 var next = this.advance(); | 4518 var next = this.advance(); |
| 4508 while ($notnull_bool(next != -1)) { | 4519 while (next != -1) { |
| 4509 next = this.bigSwitch(next); | 4520 next = this.bigSwitch(next); |
| 4510 } | 4521 } |
| 4511 this.appendEofToken(); | 4522 this.appendEofToken(); |
| 4512 return this.firstToken(); | 4523 return this.firstToken(); |
| 4513 } | 4524 } |
| 4514 AbstractScanner$S.prototype.bigSwitch = function(next) { | 4525 AbstractScanner$S.prototype.bigSwitch = function(next) { |
| 4515 this.beginToken(); | 4526 this.beginToken(); |
| 4516 switch (next) { | 4527 switch (next) { |
| 4517 case 9/*null.$TAB*/: | 4528 case 9/*null.$TAB*/: |
| 4518 case 10/*null.$LF*/: | 4529 case 10/*null.$LF*/: |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4718 case 118/*null.$v*/: | 4729 case 118/*null.$v*/: |
| 4719 case 119/*null.$w*/: | 4730 case 119/*null.$w*/: |
| 4720 case 120/*null.$x*/: | 4731 case 120/*null.$x*/: |
| 4721 case 121/*null.$y*/: | 4732 case 121/*null.$y*/: |
| 4722 case 122/*null.$z*/: | 4733 case 122/*null.$z*/: |
| 4723 | 4734 |
| 4724 return this.tokenizeIdentifier(next); | 4735 return this.tokenizeIdentifier(next); |
| 4725 | 4736 |
| 4726 default: | 4737 default: |
| 4727 | 4738 |
| 4728 if ($notnull_bool(next == -1)) { | 4739 if (next == -1) { |
| 4729 return -1; | 4740 return -1; |
| 4730 } | 4741 } |
| 4731 if ($notnull_bool(next < 0x1f)) { | 4742 if (next < 0x1f) { |
| 4732 $throw(new MalformedInputException(this.get$charOffset())); | 4743 $throw(new MalformedInputException(this.get$charOffset())); |
| 4733 } | 4744 } |
| 4734 return this.tokenizeIdentifier(next); | 4745 return this.tokenizeIdentifier(next); |
| 4735 | 4746 |
| 4736 } | 4747 } |
| 4737 } | 4748 } |
| 4738 AbstractScanner$S.prototype.tokenizeTag = function(next) { | 4749 AbstractScanner$S.prototype.tokenizeTag = function(next) { |
| 4739 if ($notnull_bool(this.get$byteOffset() == 0)) { | 4750 if (this.get$byteOffset() == 0) { |
| 4740 if ($notnull_bool(this.peek() == 33/*null.$BANG*/)) { | 4751 if (this.peek() == 33/*null.$BANG*/) { |
| 4741 do { | 4752 do { |
| 4742 next = this.advance(); | 4753 next = this.advance(); |
| 4743 } | 4754 } |
| 4744 while ($notnull_bool(next != 10/*null.$LF*/ && next != 13/*null.$CR*/)) | 4755 while (next != 10/*null.$LF*/ && next != 13/*null.$CR*/) |
| 4745 return next; | 4756 return next; |
| 4746 } | 4757 } |
| 4747 } | 4758 } |
| 4748 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); | 4759 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); |
| 4749 return this.advance(); | 4760 return this.advance(); |
| 4750 } | 4761 } |
| 4751 AbstractScanner$S.prototype.tokenizeTilde = function(next) { | 4762 AbstractScanner$S.prototype.tokenizeTilde = function(next) { |
| 4752 next = this.advance(); | 4763 next = this.advance(); |
| 4753 if ($notnull_bool(next == 47/*null.$SLASH*/)) { | 4764 if (next == 47/*null.$SLASH*/) { |
| 4754 return this.select(61/*null.$EQ*/, "~/=", "~/"); | 4765 return this.select(61/*null.$EQ*/, "~/=", "~/"); |
| 4755 } | 4766 } |
| 4756 else { | 4767 else { |
| 4757 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); | 4768 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); |
| 4758 return next; | 4769 return next; |
| 4759 } | 4770 } |
| 4760 } | 4771 } |
| 4761 AbstractScanner$S.prototype.tokenizeOpenBracket = function(next) { | 4772 AbstractScanner$S.prototype.tokenizeOpenBracket = function(next) { |
| 4762 next = this.advance(); | 4773 next = this.advance(); |
| 4763 if ($notnull_bool(next == 93/*null.$RBRACKET*/)) { | 4774 if (next == 93/*null.$RBRACKET*/) { |
| 4764 return this.select(61/*null.$EQ*/, "[]=", "[]"); | 4775 return this.select(61/*null.$EQ*/, "[]=", "[]"); |
| 4765 } | 4776 } |
| 4766 else { | 4777 else { |
| 4767 this.appendBeginGroup(91/*null.LBRACKET_TOKEN*/, "["); | 4778 this.appendBeginGroup(91/*null.LBRACKET_TOKEN*/, "["); |
| 4768 return next; | 4779 return next; |
| 4769 } | 4780 } |
| 4770 } | 4781 } |
| 4771 AbstractScanner$S.prototype.tokenizeCaret = function(next) { | 4782 AbstractScanner$S.prototype.tokenizeCaret = function(next) { |
| 4772 return this.select(61/*null.$EQ*/, "^=", "^"); | 4783 return this.select(61/*null.$EQ*/, "^=", "^"); |
| 4773 } | 4784 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4852 | 4863 |
| 4853 default: | 4864 default: |
| 4854 | 4865 |
| 4855 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); | 4866 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); |
| 4856 return next; | 4867 return next; |
| 4857 | 4868 |
| 4858 } | 4869 } |
| 4859 } | 4870 } |
| 4860 AbstractScanner$S.prototype.tokenizeExclamation = function(next) { | 4871 AbstractScanner$S.prototype.tokenizeExclamation = function(next) { |
| 4861 next = this.advance(); | 4872 next = this.advance(); |
| 4862 if ($notnull_bool(next == 61/*null.$EQ*/)) { | 4873 if (next == 61/*null.$EQ*/) { |
| 4863 return this.select(61/*null.$EQ*/, "!==", "!="); | 4874 return this.select(61/*null.$EQ*/, "!==", "!="); |
| 4864 } | 4875 } |
| 4865 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); | 4876 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); |
| 4866 return next; | 4877 return next; |
| 4867 } | 4878 } |
| 4868 AbstractScanner$S.prototype.tokenizeEquals = function(next) { | 4879 AbstractScanner$S.prototype.tokenizeEquals = function(next) { |
| 4869 next = this.advance(); | 4880 next = this.advance(); |
| 4870 if ($notnull_bool(next == 61/*null.$EQ*/)) { | 4881 if (next == 61/*null.$EQ*/) { |
| 4871 return this.select(61/*null.$EQ*/, "===", "=="); | 4882 return this.select(61/*null.$EQ*/, "===", "=="); |
| 4872 } | 4883 } |
| 4873 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); | 4884 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); |
| 4874 return next; | 4885 return next; |
| 4875 } | 4886 } |
| 4876 AbstractScanner$S.prototype.tokenizeGreaterThan = function(next) { | 4887 AbstractScanner$S.prototype.tokenizeGreaterThan = function(next) { |
| 4877 next = this.advance(); | 4888 next = this.advance(); |
| 4878 switch (next) { | 4889 switch (next) { |
| 4879 case 61/*null.$EQ*/: | 4890 case 61/*null.$EQ*/: |
| 4880 | 4891 |
| 4881 this.appendStringToken(62/*null.GT_TOKEN*/, ">="); | 4892 this.appendStringToken(62/*null.GT_TOKEN*/, ">="); |
| 4882 return this.advance(); | 4893 return this.advance(); |
| 4883 | 4894 |
| 4884 case 62/*null.$GT*/: | 4895 case 62/*null.$GT*/: |
| 4885 | 4896 |
| 4886 next = this.advance(); | 4897 next = this.advance(); |
| 4887 switch (next) { | 4898 switch (next) { |
| 4888 case 61/*null.$EQ*/: | 4899 case 61/*null.$EQ*/: |
| 4889 | 4900 |
| 4890 this.appendStringToken(62/*null.GT_TOKEN*/, ">>="); | 4901 this.appendStringToken(62/*null.GT_TOKEN*/, ">>="); |
| 4891 return this.advance(); | 4902 return this.advance(); |
| 4892 | 4903 |
| 4893 case 62/*null.$GT*/: | 4904 case 62/*null.$GT*/: |
| 4894 | 4905 |
| 4895 { | 4906 { |
| 4896 next = this.advance(); | 4907 next = this.advance(); |
| 4897 if ($notnull_bool(next === 61/*null.$EQ*/)) { | 4908 if (next === 61/*null.$EQ*/) { |
| 4898 this.appendStringToken(62/*null.GT_TOKEN*/, ">>>="); | 4909 this.appendStringToken(62/*null.GT_TOKEN*/, ">>>="); |
| 4899 return this.advance(); | 4910 return this.advance(); |
| 4900 } | 4911 } |
| 4901 else { | 4912 else { |
| 4902 this.appendGtGtGt(62/*null.GT_TOKEN*/, ">>>"); | 4913 this.appendGtGtGt(62/*null.GT_TOKEN*/, ">>>"); |
| 4903 return next; | 4914 return next; |
| 4904 } | 4915 } |
| 4905 } | 4916 } |
| 4906 | 4917 |
| 4907 default: | 4918 default: |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 4933 | 4944 |
| 4934 default: | 4945 default: |
| 4935 | 4946 |
| 4936 this.appendBeginGroup(60/*null.LT_TOKEN*/, "<"); | 4947 this.appendBeginGroup(60/*null.LT_TOKEN*/, "<"); |
| 4937 return next; | 4948 return next; |
| 4938 | 4949 |
| 4939 } | 4950 } |
| 4940 } | 4951 } |
| 4941 AbstractScanner$S.prototype.tokenizeNumber = function(next) { | 4952 AbstractScanner$S.prototype.tokenizeNumber = function(next) { |
| 4942 var start = this.get$byteOffset(); | 4953 var start = this.get$byteOffset(); |
| 4943 while ($notnull_bool(true)) { | 4954 while (true) { |
| 4944 next = this.advance(); | 4955 next = this.advance(); |
| 4945 switch (next) { | 4956 switch (next) { |
| 4946 case 48/*null.$0*/: | 4957 case 48/*null.$0*/: |
| 4947 case 49/*null.$1*/: | 4958 case 49/*null.$1*/: |
| 4948 case 50/*null.$2*/: | 4959 case 50/*null.$2*/: |
| 4949 case 51/*null.$3*/: | 4960 case 51/*null.$3*/: |
| 4950 case 52/*null.$4*/: | 4961 case 52/*null.$4*/: |
| 4951 case 53/*null.$5*/: | 4962 case 53/*null.$5*/: |
| 4952 case 54/*null.$6*/: | 4963 case 54/*null.$6*/: |
| 4953 case 55/*null.$7*/: | 4964 case 55/*null.$7*/: |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 4970 default: | 4981 default: |
| 4971 | 4982 |
| 4972 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start )); | 4983 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start )); |
| 4973 return next; | 4984 return next; |
| 4974 | 4985 |
| 4975 } | 4986 } |
| 4976 } | 4987 } |
| 4977 } | 4988 } |
| 4978 AbstractScanner$S.prototype.tokenizeHexOrNumber = function(next) { | 4989 AbstractScanner$S.prototype.tokenizeHexOrNumber = function(next) { |
| 4979 var x = this.peek(); | 4990 var x = this.peek(); |
| 4980 if ($notnull_bool(x == 120/*null.$x*/ || x == 88/*null.$X*/)) { | 4991 if (x == 120/*null.$x*/ || x == 88/*null.$X*/) { |
| 4981 this.advance(); | 4992 this.advance(); |
| 4982 return this.tokenizeHex(x); | 4993 return this.tokenizeHex(x); |
| 4983 } | 4994 } |
| 4984 return this.tokenizeNumber(next); | 4995 return this.tokenizeNumber(next); |
| 4985 } | 4996 } |
| 4986 AbstractScanner$S.prototype.tokenizeHex = function(next) { | 4997 AbstractScanner$S.prototype.tokenizeHex = function(next) { |
| 4987 var start = this.get$byteOffset(); | 4998 var start = this.get$byteOffset(); |
| 4988 var hasDigits = false; | 4999 var hasDigits = false; |
| 4989 while ($notnull_bool(true)) { | 5000 while (true) { |
| 4990 next = this.advance(); | 5001 next = this.advance(); |
| 4991 switch (next) { | 5002 switch (next) { |
| 4992 case 48/*null.$0*/: | 5003 case 48/*null.$0*/: |
| 4993 case 49/*null.$1*/: | 5004 case 49/*null.$1*/: |
| 4994 case 50/*null.$2*/: | 5005 case 50/*null.$2*/: |
| 4995 case 51/*null.$3*/: | 5006 case 51/*null.$3*/: |
| 4996 case 52/*null.$4*/: | 5007 case 52/*null.$4*/: |
| 4997 case 53/*null.$5*/: | 5008 case 53/*null.$5*/: |
| 4998 case 54/*null.$6*/: | 5009 case 54/*null.$6*/: |
| 4999 case 55/*null.$7*/: | 5010 case 55/*null.$7*/: |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 5010 case 99/*null.$c*/: | 5021 case 99/*null.$c*/: |
| 5011 case 100/*null.$d*/: | 5022 case 100/*null.$d*/: |
| 5012 case 101/*null.$e*/: | 5023 case 101/*null.$e*/: |
| 5013 case 102/*null.$f*/: | 5024 case 102/*null.$f*/: |
| 5014 | 5025 |
| 5015 hasDigits = true; | 5026 hasDigits = true; |
| 5016 break; | 5027 break; |
| 5017 | 5028 |
| 5018 default: | 5029 default: |
| 5019 | 5030 |
| 5020 if ($notnull_bool(!$notnull_bool(hasDigits))) { | 5031 if (!$notnull_bool(hasDigits)) { |
| 5021 $throw(new MalformedInputException(this.get$charOffset())); | 5032 $throw(new MalformedInputException(this.get$charOffset())); |
| 5022 } | 5033 } |
| 5023 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri ng(start)); | 5034 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri ng(start)); |
| 5024 return next; | 5035 return next; |
| 5025 | 5036 |
| 5026 } | 5037 } |
| 5027 } | 5038 } |
| 5028 } | 5039 } |
| 5029 AbstractScanner$S.prototype.tokenizeDotOrNumber = function(next) { | 5040 AbstractScanner$S.prototype.tokenizeDotOrNumber = function(next) { |
| 5030 var start = this.get$byteOffset(); | 5041 var start = this.get$byteOffset(); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 5052 default: | 5063 default: |
| 5053 | 5064 |
| 5054 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 5065 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 5055 return next; | 5066 return next; |
| 5056 | 5067 |
| 5057 } | 5068 } |
| 5058 } | 5069 } |
| 5059 AbstractScanner$S.prototype.tokenizeFractionPart = function(next, start) { | 5070 AbstractScanner$S.prototype.tokenizeFractionPart = function(next, start) { |
| 5060 var done = false; | 5071 var done = false; |
| 5061 LOOP: | 5072 LOOP: |
| 5062 while ($notnull_bool(!$notnull_bool(done))) { | 5073 while (!$notnull_bool(done)) { |
| 5063 switch (next) { | 5074 switch (next) { |
| 5064 case 48/*null.$0*/: | 5075 case 48/*null.$0*/: |
| 5065 case 49/*null.$1*/: | 5076 case 49/*null.$1*/: |
| 5066 case 50/*null.$2*/: | 5077 case 50/*null.$2*/: |
| 5067 case 51/*null.$3*/: | 5078 case 51/*null.$3*/: |
| 5068 case 52/*null.$4*/: | 5079 case 52/*null.$4*/: |
| 5069 case 53/*null.$5*/: | 5080 case 53/*null.$5*/: |
| 5070 case 54/*null.$6*/: | 5081 case 54/*null.$6*/: |
| 5071 case 55/*null.$7*/: | 5082 case 55/*null.$7*/: |
| 5072 case 56/*null.$8*/: | 5083 case 56/*null.$8*/: |
| 5073 case 57/*null.$9*/: | 5084 case 57/*null.$9*/: |
| 5074 | 5085 |
| 5075 break; | 5086 break; |
| 5076 | 5087 |
| 5077 case 101/*null.$e*/: | 5088 case 101/*null.$e*/: |
| 5078 case 69/*null.$E*/: | 5089 case 69/*null.$E*/: |
| 5079 | 5090 |
| 5080 next = this.tokenizeExponent(this.advance()); | 5091 next = this.tokenizeExponent(this.advance()); |
| 5081 done = true; | 5092 done = true; |
| 5082 continue LOOP; | 5093 continue LOOP; |
| 5083 | 5094 |
| 5084 default: | 5095 default: |
| 5085 | 5096 |
| 5086 done = true; | 5097 done = true; |
| 5087 continue LOOP; | 5098 continue LOOP; |
| 5088 | 5099 |
| 5089 } | 5100 } |
| 5090 next = this.advance(); | 5101 next = this.advance(); |
| 5091 } | 5102 } |
| 5092 if ($notnull_bool(next == 100/*null.$d*/ || next == 68/*null.$D*/)) { | 5103 if (next == 100/*null.$d*/ || next == 68/*null.$D*/) { |
| 5093 next = this.advance(); | 5104 next = this.advance(); |
| 5094 } | 5105 } |
| 5095 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); | 5106 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); |
| 5096 return next; | 5107 return next; |
| 5097 } | 5108 } |
| 5098 AbstractScanner$S.prototype.tokenizeExponent = function(next) { | 5109 AbstractScanner$S.prototype.tokenizeExponent = function(next) { |
| 5099 if ($notnull_bool(next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/)) { | 5110 if (next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/) { |
| 5100 next = this.advance(); | 5111 next = this.advance(); |
| 5101 } | 5112 } |
| 5102 var hasDigits = false; | 5113 var hasDigits = false; |
| 5103 while ($notnull_bool(true)) { | 5114 while (true) { |
| 5104 switch (next) { | 5115 switch (next) { |
| 5105 case 48/*null.$0*/: | 5116 case 48/*null.$0*/: |
| 5106 case 49/*null.$1*/: | 5117 case 49/*null.$1*/: |
| 5107 case 50/*null.$2*/: | 5118 case 50/*null.$2*/: |
| 5108 case 51/*null.$3*/: | 5119 case 51/*null.$3*/: |
| 5109 case 52/*null.$4*/: | 5120 case 52/*null.$4*/: |
| 5110 case 53/*null.$5*/: | 5121 case 53/*null.$5*/: |
| 5111 case 54/*null.$6*/: | 5122 case 54/*null.$6*/: |
| 5112 case 55/*null.$7*/: | 5123 case 55/*null.$7*/: |
| 5113 case 56/*null.$8*/: | 5124 case 56/*null.$8*/: |
| 5114 case 57/*null.$9*/: | 5125 case 57/*null.$9*/: |
| 5115 | 5126 |
| 5116 hasDigits = true; | 5127 hasDigits = true; |
| 5117 break; | 5128 break; |
| 5118 | 5129 |
| 5119 default: | 5130 default: |
| 5120 | 5131 |
| 5121 if ($notnull_bool(!$notnull_bool(hasDigits))) { | 5132 if (!$notnull_bool(hasDigits)) { |
| 5122 $throw(new MalformedInputException(this.get$charOffset())); | 5133 $throw(new MalformedInputException(this.get$charOffset())); |
| 5123 } | 5134 } |
| 5124 return next; | 5135 return next; |
| 5125 | 5136 |
| 5126 } | 5137 } |
| 5127 next = this.advance(); | 5138 next = this.advance(); |
| 5128 } | 5139 } |
| 5129 } | 5140 } |
| 5130 AbstractScanner$S.prototype.tokenizeSlashOrComment = function(next) { | 5141 AbstractScanner$S.prototype.tokenizeSlashOrComment = function(next) { |
| 5131 next = this.advance(); | 5142 next = this.advance(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 5144 return this.advance(); | 5155 return this.advance(); |
| 5145 | 5156 |
| 5146 default: | 5157 default: |
| 5147 | 5158 |
| 5148 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); | 5159 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); |
| 5149 return next; | 5160 return next; |
| 5150 | 5161 |
| 5151 } | 5162 } |
| 5152 } | 5163 } |
| 5153 AbstractScanner$S.prototype.tokenizeSingleLineComment = function(next) { | 5164 AbstractScanner$S.prototype.tokenizeSingleLineComment = function(next) { |
| 5154 while ($notnull_bool(true)) { | 5165 while (true) { |
| 5155 next = this.advance(); | 5166 next = this.advance(); |
| 5156 switch (next) { | 5167 switch (next) { |
| 5157 case -1: | 5168 case -1: |
| 5158 case 10/*null.$LF*/: | 5169 case 10/*null.$LF*/: |
| 5159 case 13/*null.$CR*/: | 5170 case 13/*null.$CR*/: |
| 5160 | 5171 |
| 5161 return next; | 5172 return next; |
| 5162 | 5173 |
| 5163 } | 5174 } |
| 5164 } | 5175 } |
| 5165 } | 5176 } |
| 5166 AbstractScanner$S.prototype.tokenizeMultiLineComment = function(next) { | 5177 AbstractScanner$S.prototype.tokenizeMultiLineComment = function(next) { |
| 5167 next = this.advance(); | 5178 next = this.advance(); |
| 5168 while ($notnull_bool(true)) { | 5179 while (true) { |
| 5169 switch (next) { | 5180 switch (next) { |
| 5170 case -1: | 5181 case -1: |
| 5171 | 5182 |
| 5172 return next; | 5183 return next; |
| 5173 | 5184 |
| 5174 case 42/*null.$STAR*/: | 5185 case 42/*null.$STAR*/: |
| 5175 | 5186 |
| 5176 next = this.advance(); | 5187 next = this.advance(); |
| 5177 if ($notnull_bool(next == 47/*null.$SLASH*/)) { | 5188 if (next == 47/*null.$SLASH*/) { |
| 5178 return this.advance(); | 5189 return this.advance(); |
| 5179 } | 5190 } |
| 5180 else if ($notnull_bool(next == -1)) { | 5191 else if (next == -1) { |
| 5181 return next; | 5192 return next; |
| 5182 } | 5193 } |
| 5183 break; | 5194 break; |
| 5184 | 5195 |
| 5185 default: | 5196 default: |
| 5186 | 5197 |
| 5187 next = this.advance(); | 5198 next = this.advance(); |
| 5188 break; | 5199 break; |
| 5189 | 5200 |
| 5190 } | 5201 } |
| 5191 } | 5202 } |
| 5192 } | 5203 } |
| 5193 AbstractScanner$S.prototype.tokenizeIdentifier = function(next) { | 5204 AbstractScanner$S.prototype.tokenizeIdentifier = function(next) { |
| 5194 var start = this.get$byteOffset(); | 5205 var start = this.get$byteOffset(); |
| 5195 var state = null; | 5206 var state = null; |
| 5196 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { | 5207 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { |
| 5197 state = KeywordState.get$KEYWORD_STATE().next(next); | 5208 state = KeywordState.get$KEYWORD_STATE().next(next); |
| 5198 next = this.advance(); | 5209 next = this.advance(); |
| 5199 } | 5210 } |
| 5200 var isAscii = true; | 5211 var isAscii = true; |
| 5201 while ($notnull_bool(true)) { | 5212 while (true) { |
| 5202 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { | 5213 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { |
| 5203 if ($notnull_bool(state != null)) { | 5214 if (state != null) { |
| 5204 state = state.next(next); | 5215 state = state.next(next); |
| 5205 } | 5216 } |
| 5206 } | 5217 } |
| 5207 else if ($notnull_bool(($notnull_bool(48/*null.$0*/ <= next && next <= 57/*n ull.$9*/)) || ($notnull_bool(65/*null.$A*/ <= next && next <= 90/*null.$Z*/))) | | next == 95/*null.$_*/ || next == 36/*null.$DOLLAR*/) { | 5218 else if ((48/*null.$0*/ <= next && next <= 57/*null.$9*/) || (65/*null.$A*/ <= next && next <= 90/*null.$Z*/) || next == 95/*null.$_*/ || next == 36/*null.$ DOLLAR*/) { |
| 5208 state = null; | 5219 state = null; |
| 5209 } | 5220 } |
| 5210 else if ($notnull_bool(next < 128)) { | 5221 else if (next < 128) { |
| 5211 if ($notnull_bool(state != null && state.isLeaf())) { | 5222 if ($notnull_bool(state != null && state.isLeaf())) { |
| 5212 this.appendKeywordToken(state.get$keyword()); | 5223 this.appendKeywordToken(state.get$keyword()); |
| 5213 } | 5224 } |
| 5214 else if ($notnull_bool(isAscii)) { | 5225 else if ($notnull_bool(isAscii)) { |
| 5215 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start)); | 5226 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start)); |
| 5216 } | 5227 } |
| 5217 else { | 5228 else { |
| 5218 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String( start, -1)); | 5229 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String( start, -1)); |
| 5219 } | 5230 } |
| 5220 return next; | 5231 return next; |
| 5221 } | 5232 } |
| 5222 else { | 5233 else { |
| 5223 var nonAsciiStart = this.get$byteOffset(); | 5234 var nonAsciiStart = this.get$byteOffset(); |
| 5224 do { | 5235 do { |
| 5225 next = this.nextByte(); | 5236 next = this.nextByte(); |
| 5226 } | 5237 } |
| 5227 while ($notnull_bool(next > 127)) | 5238 while (next > 127) |
| 5228 var string = $assert_String(this.utf8String(nonAsciiStart, -1).toString()) ; | 5239 var string = $assert_String(this.utf8String(nonAsciiStart, -1).toString()) ; |
| 5229 isAscii = false; | 5240 isAscii = false; |
| 5230 this.addToCharOffset(string.length); | 5241 this.addToCharOffset(string.length); |
| 5231 return next; | 5242 return next; |
| 5232 } | 5243 } |
| 5233 next = this.advance(); | 5244 next = this.advance(); |
| 5234 } | 5245 } |
| 5235 } | 5246 } |
| 5236 AbstractScanner$S.prototype.tokenizeRawString = function(next) { | 5247 AbstractScanner$S.prototype.tokenizeRawString = function(next) { |
| 5237 var start = this.get$byteOffset(); | 5248 var start = this.get$byteOffset(); |
| 5238 next = this.advance(); | 5249 next = this.advance(); |
| 5239 if ($notnull_bool(next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/)) { | 5250 if (next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/) { |
| 5240 return this.tokenizeString(next, start, true); | 5251 return this.tokenizeString(next, start, true); |
| 5241 } | 5252 } |
| 5242 else { | 5253 else { |
| 5243 $throw(new MalformedInputException(this.get$charOffset())); | 5254 $throw(new MalformedInputException(this.get$charOffset())); |
| 5244 } | 5255 } |
| 5245 } | 5256 } |
| 5246 AbstractScanner$S.prototype.tokenizeString = function(next, start, raw) { | 5257 AbstractScanner$S.prototype.tokenizeString = function(next, start, raw) { |
| 5247 var q = next; | 5258 var q = next; |
| 5248 next = this.advance(); | 5259 next = this.advance(); |
| 5249 if ($notnull_bool(q == next)) { | 5260 if (q == next) { |
| 5250 next = this.advance(); | 5261 next = this.advance(); |
| 5251 if ($notnull_bool(q == next)) { | 5262 if (q == next) { |
| 5252 return this.tokenizeMultiLineString(q, start, raw); | 5263 return this.tokenizeMultiLineString(q, start, raw); |
| 5253 } | 5264 } |
| 5254 else { | 5265 else { |
| 5255 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, -1)); | 5266 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, -1)); |
| 5256 return next; | 5267 return next; |
| 5257 } | 5268 } |
| 5258 } | 5269 } |
| 5259 if ($notnull_bool(raw)) { | 5270 if ($notnull_bool(raw)) { |
| 5260 return this.tokenizeSingleLineRawString(next, q, start); | 5271 return this.tokenizeSingleLineRawString(next, q, start); |
| 5261 } | 5272 } |
| 5262 else { | 5273 else { |
| 5263 return this.tokenizeSingleLineString(next, q, start); | 5274 return this.tokenizeSingleLineString(next, q, start); |
| 5264 } | 5275 } |
| 5265 } | 5276 } |
| 5266 AbstractScanner$S.prototype.tokenizeSingleLineString = function(next, q1, start) { | 5277 AbstractScanner$S.prototype.tokenizeSingleLineString = function(next, q1, start) { |
| 5267 while ($notnull_bool(next != -1)) { | 5278 while (next != -1) { |
| 5268 if ($notnull_bool(next == q1)) { | 5279 if (next == q1) { |
| 5269 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); | 5280 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); |
| 5270 return this.advance(); | 5281 return this.advance(); |
| 5271 } | 5282 } |
| 5272 else if ($notnull_bool(next == 92/*null.$BACKSLASH*/)) { | 5283 else if (next == 92/*null.$BACKSLASH*/) { |
| 5273 next = this.advance(); | 5284 next = this.advance(); |
| 5274 if ($notnull_bool(next == -1)) { | 5285 if (next == -1) { |
| 5275 $throw(new MalformedInputException(this.get$charOffset())); | 5286 $throw(new MalformedInputException(this.get$charOffset())); |
| 5276 } | 5287 } |
| 5277 } | 5288 } |
| 5278 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { | 5289 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { |
| 5279 $throw(new MalformedInputException(this.get$charOffset())); | 5290 $throw(new MalformedInputException(this.get$charOffset())); |
| 5280 } | 5291 } |
| 5281 next = this.advance(); | 5292 next = this.advance(); |
| 5282 } | 5293 } |
| 5283 $throw(new MalformedInputException(this.get$charOffset())); | 5294 $throw(new MalformedInputException(this.get$charOffset())); |
| 5284 } | 5295 } |
| 5285 AbstractScanner$S.prototype.tokenizeSingleLineRawString = function(next, q1, sta rt) { | 5296 AbstractScanner$S.prototype.tokenizeSingleLineRawString = function(next, q1, sta rt) { |
| 5286 next = this.advance(); | 5297 next = this.advance(); |
| 5287 while ($notnull_bool(next != -1)) { | 5298 while (next != -1) { |
| 5288 if ($notnull_bool(next == q1)) { | 5299 if (next == q1) { |
| 5289 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); | 5300 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0)); |
| 5290 return this.advance(); | 5301 return this.advance(); |
| 5291 } | 5302 } |
| 5292 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { | 5303 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { |
| 5293 $throw(new MalformedInputException(this.get$charOffset())); | 5304 $throw(new MalformedInputException(this.get$charOffset())); |
| 5294 } | 5305 } |
| 5295 next = this.advance(); | 5306 next = this.advance(); |
| 5296 } | 5307 } |
| 5297 $throw(new MalformedInputException(this.get$charOffset())); | 5308 $throw(new MalformedInputException(this.get$charOffset())); |
| 5298 } | 5309 } |
| 5299 AbstractScanner$S.prototype.tokenizeMultiLineString = function(q, start, raw) { | 5310 AbstractScanner$S.prototype.tokenizeMultiLineString = function(q, start, raw) { |
| 5300 var next = this.advance(); | 5311 var next = this.advance(); |
| 5301 while ($notnull_bool(next != -1)) { | 5312 while (next != -1) { |
| 5302 if ($notnull_bool(next == q)) { | 5313 if (next == q) { |
| 5303 next = this.advance(); | 5314 next = this.advance(); |
| 5304 if ($notnull_bool(next == q)) { | 5315 if (next == q) { |
| 5305 next = this.advance(); | 5316 next = this.advance(); |
| 5306 if ($notnull_bool(next == q)) { | 5317 if (next == q) { |
| 5307 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st art, 0)); | 5318 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st art, 0)); |
| 5308 return this.advance(); | 5319 return this.advance(); |
| 5309 } | 5320 } |
| 5310 } | 5321 } |
| 5311 } | 5322 } |
| 5312 next = this.advance(); | 5323 next = this.advance(); |
| 5313 } | 5324 } |
| 5314 return next; | 5325 return next; |
| 5315 } | 5326 } |
| 5316 // ********** Code for MalformedInputException ************** | 5327 // ********** Code for MalformedInputException ************** |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 5329 $inherits(ScannerTask, CompilerTask); | 5340 $inherits(ScannerTask, CompilerTask); |
| 5330 ScannerTask.prototype.get$name = function() { | 5341 ScannerTask.prototype.get$name = function() { |
| 5331 return 'Scanner'; | 5342 return 'Scanner'; |
| 5332 } | 5343 } |
| 5333 ScannerTask.prototype.scan = function(script) { | 5344 ScannerTask.prototype.scan = function(script) { |
| 5334 var $this = this; // closure support | 5345 var $this = this; // closure support |
| 5335 this.measure((function () { | 5346 this.measure((function () { |
| 5336 var $0; | 5347 var $0; |
| 5337 var elements = $this.scanElements(script.get$text()); | 5348 var elements = $this.scanElements(script.get$text()); |
| 5338 for (var link = elements; | 5349 for (var link = elements; |
| 5339 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail( )) && $0.is$Link$Element())) { | 5350 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Lin k$Element())) { |
| 5340 $this.compiler.universe.define((($0 = link.get$head()) && $0.is$Element()) ); | 5351 $this.compiler.universe.define((($0 = link.get$head()) && $0.is$Element()) ); |
| 5341 } | 5352 } |
| 5342 }) | 5353 }) |
| 5343 ); | 5354 ); |
| 5344 } | 5355 } |
| 5345 ScannerTask.prototype.scanElements = function(text) { | 5356 ScannerTask.prototype.scanElements = function(text) { |
| 5346 var tokens = new StringScanner(text).tokenize(); | 5357 var tokens = new StringScanner(text).tokenize(); |
| 5347 var listener = new ElementListener(this.compiler); | 5358 var listener = new ElementListener(this.compiler); |
| 5348 var parser = new PartialParser(listener); | 5359 var parser = new PartialParser(listener); |
| 5349 parser.parseUnit(tokens); | 5360 parser.parseUnit(tokens); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5384 ; | 5395 ; |
| 5385 this.handleNoTypeVariables = (function (t) { | 5396 this.handleNoTypeVariables = (function (t) { |
| 5386 return $this.listener.handleNoTypeVariables$1(t); | 5397 return $this.listener.handleNoTypeVariables$1(t); |
| 5387 }) | 5398 }) |
| 5388 ; | 5399 ; |
| 5389 } | 5400 } |
| 5390 PartialParser.prototype.next = function(token) { | 5401 PartialParser.prototype.next = function(token) { |
| 5391 return this.checkEof(token.next); | 5402 return this.checkEof(token.next); |
| 5392 } | 5403 } |
| 5393 PartialParser.prototype.checkEof = function(token) { | 5404 PartialParser.prototype.checkEof = function(token) { |
| 5394 if ($notnull_bool(token.kind === 0/*null.EOF_TOKEN*/)) { | 5405 if (token.kind === 0/*null.EOF_TOKEN*/) { |
| 5395 this.listener.unexpectedEof(); | 5406 this.listener.unexpectedEof(); |
| 5396 $throw('Unexpected EOF'); | 5407 $throw('Unexpected EOF'); |
| 5397 } | 5408 } |
| 5398 return token; | 5409 return token; |
| 5399 } | 5410 } |
| 5400 PartialParser.prototype.parseUnit = function(token) { | 5411 PartialParser.prototype.parseUnit = function(token) { |
| 5401 while ($notnull_bool(token.kind !== 0/*null.EOF_TOKEN*/)) { | 5412 while (token.kind !== 0/*null.EOF_TOKEN*/) { |
| 5402 var value = token.get$stringValue(); | 5413 var value = token.get$stringValue(); |
| 5403 switch (true) { | 5414 switch (true) { |
| 5404 case value === 'interface': | 5415 case value === 'interface': |
| 5405 | 5416 |
| 5406 token = this.parseInterface(token); | 5417 token = this.parseInterface(token); |
| 5407 break; | 5418 break; |
| 5408 | 5419 |
| 5409 case value === 'class': | 5420 case value === 'class': |
| 5410 | 5421 |
| 5411 token = this.parseClass(token); | 5422 token = this.parseClass(token); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5445 PartialParser.prototype.parseNamedFunctionAlias = function(token) { | 5456 PartialParser.prototype.parseNamedFunctionAlias = function(token) { |
| 5446 this.listener.beginFunctionTypeAlias(token); | 5457 this.listener.beginFunctionTypeAlias(token); |
| 5447 token = this.parseReturnTypeOpt(this.next(token)); | 5458 token = this.parseReturnTypeOpt(this.next(token)); |
| 5448 token = this.parseIdentifier(token); | 5459 token = this.parseIdentifier(token); |
| 5449 token = this.parseTypeVariablesOpt(token); | 5460 token = this.parseTypeVariablesOpt(token); |
| 5450 token = this.parseFormalParameters(token); | 5461 token = this.parseFormalParameters(token); |
| 5451 this.listener.endFunctionTypeAlias(token); | 5462 this.listener.endFunctionTypeAlias(token); |
| 5452 return this.expect(';', token); | 5463 return this.expect(';', token); |
| 5453 } | 5464 } |
| 5454 PartialParser.prototype.parseReturnTypeOpt = function(token) { | 5465 PartialParser.prototype.parseReturnTypeOpt = function(token) { |
| 5455 if ($notnull_bool(token.get$stringValue() === 'void')) { | 5466 if (token.get$stringValue() === 'void') { |
| 5456 this.listener.handleVoidKeyword(token); | 5467 this.listener.handleVoidKeyword(token); |
| 5457 return this.next(token); | 5468 return this.next(token); |
| 5458 } | 5469 } |
| 5459 else { | 5470 else { |
| 5460 return this.parseTypeOpt(token); | 5471 return this.parseTypeOpt(token); |
| 5461 } | 5472 } |
| 5462 } | 5473 } |
| 5463 PartialParser.prototype.parseFormalParameters = function(token) { | 5474 PartialParser.prototype.parseFormalParameters = function(token) { |
| 5464 var begin = token; | 5475 var begin = token; |
| 5465 this.listener.beginFormalParameters(begin); | 5476 this.listener.beginFormalParameters(begin); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5522 } | 5533 } |
| 5523 return token; | 5534 return token; |
| 5524 } | 5535 } |
| 5525 PartialParser.prototype.parseFactoryClauseOpt = function(token) { | 5536 PartialParser.prototype.parseFactoryClauseOpt = function(token) { |
| 5526 if ($notnull_bool(this.optional('factory', token))) { | 5537 if ($notnull_bool(this.optional('factory', token))) { |
| 5527 return this.parseType(this.next(token)); | 5538 return this.parseType(this.next(token)); |
| 5528 } | 5539 } |
| 5529 return token; | 5540 return token; |
| 5530 } | 5541 } |
| 5531 PartialParser.prototype.skipBlock = function(token) { | 5542 PartialParser.prototype.skipBlock = function(token) { |
| 5532 if ($notnull_bool(!$notnull_bool(this.optional('{', token)))) { | 5543 if (!$notnull_bool(this.optional('{', token))) { |
| 5533 return this.listener.expectedBlock(token); | 5544 return this.listener.expectedBlock(token); |
| 5534 } | 5545 } |
| 5535 var beginGroupToken = (token && token.is$BeginGroupToken()); | 5546 var beginGroupToken = (token && token.is$BeginGroupToken()); |
| 5536 $assert($notnull_bool(beginGroupToken.endGroup == null || beginGroupToken.endG roup.kind === 125/*null.$RBRACE*/), "beginGroupToken.endGroup === null ||\n beginGroupToken.endGroup.kind === $RBRACE", "parser.dart", 171, 12); | 5547 $assert(beginGroupToken.endGroup == null || beginGroupToken.endGroup.kind === 125/*null.$RBRACE*/, "beginGroupToken.endGroup === null ||\n beginGrou pToken.endGroup.kind === $RBRACE", "parser.dart", 171, 12); |
| 5537 return beginGroupToken.endGroup; | 5548 return beginGroupToken.endGroup; |
| 5538 } | 5549 } |
| 5539 PartialParser.prototype.skipArguments = function(token) { | 5550 PartialParser.prototype.skipArguments = function(token) { |
| 5540 return token.endGroup; | 5551 return token.endGroup; |
| 5541 } | 5552 } |
| 5542 PartialParser.prototype.parseClass = function(token) { | 5553 PartialParser.prototype.parseClass = function(token) { |
| 5543 var begin = token; | 5554 var begin = token; |
| 5544 this.listener.beginClass(token); | 5555 this.listener.beginClass(token); |
| 5545 token = this.parseIdentifier(this.next(token)); | 5556 token = this.parseIdentifier(this.next(token)); |
| 5546 token = this.parseTypeVariablesOpt(token); | 5557 token = this.parseTypeVariablesOpt(token); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 5567 this.listener.endClass(interfacesCount, begin, extendsKeyword, implementsKeywo rd, token); | 5578 this.listener.endClass(interfacesCount, begin, extendsKeyword, implementsKeywo rd, token); |
| 5568 return token.next; | 5579 return token.next; |
| 5569 } | 5580 } |
| 5570 PartialParser.prototype.parseNativeClassClauseOpt = function(token) { | 5581 PartialParser.prototype.parseNativeClassClauseOpt = function(token) { |
| 5571 if ($notnull_bool(this.optional('native', token))) { | 5582 if ($notnull_bool(this.optional('native', token))) { |
| 5572 return this.parseString(this.next(token)); | 5583 return this.parseString(this.next(token)); |
| 5573 } | 5584 } |
| 5574 return token; | 5585 return token; |
| 5575 } | 5586 } |
| 5576 PartialParser.prototype.parseString = function(token) { | 5587 PartialParser.prototype.parseString = function(token) { |
| 5577 if ($notnull_bool(token.kind === 39/*null.STRING_TOKEN*/)) { | 5588 if (token.kind === 39/*null.STRING_TOKEN*/) { |
| 5578 return this.next(token); | 5589 return this.next(token); |
| 5579 } | 5590 } |
| 5580 else { | 5591 else { |
| 5581 return this.listener.expected('string', token); | 5592 return this.listener.expected('string', token); |
| 5582 } | 5593 } |
| 5583 } | 5594 } |
| 5584 PartialParser.prototype.parseIdentifier = function(token) { | 5595 PartialParser.prototype.parseIdentifier = function(token) { |
| 5585 if ($notnull_bool(this.isIdentifier(token))) { | 5596 if ($notnull_bool(this.isIdentifier(token))) { |
| 5586 this.listener.handleIdentifier(token); | 5597 this.listener.handleIdentifier(token); |
| 5587 } | 5598 } |
| 5588 else { | 5599 else { |
| 5589 this.listener.expectedIdentifier(token); | 5600 this.listener.expectedIdentifier(token); |
| 5590 } | 5601 } |
| 5591 return this.next(token); | 5602 return this.next(token); |
| 5592 } | 5603 } |
| 5593 PartialParser.prototype.expect = function(string, token) { | 5604 PartialParser.prototype.expect = function(string, token) { |
| 5594 if ($notnull_bool(string !== token.get$stringValue())) { | 5605 if (string !== token.get$stringValue()) { |
| 5595 if ($notnull_bool(string === '>')) { | 5606 if (string === '>') { |
| 5596 if ($notnull_bool(token.get$stringValue() === '>>')) { | 5607 if (token.get$stringValue() === '>>') { |
| 5597 var gt = new StringToken(62/*null.GT_TOKEN*/, '>', token.charOffset + 1) ; | 5608 var gt = new StringToken(62/*null.GT_TOKEN*/, '>', token.charOffset + 1) ; |
| 5598 gt.next = token.next; | 5609 gt.next = token.next; |
| 5599 return gt; | 5610 return gt; |
| 5600 } | 5611 } |
| 5601 else if ($notnull_bool(token.get$stringValue() === '>>>')) { | 5612 else if (token.get$stringValue() === '>>>') { |
| 5602 var gtgt = new StringToken(1024/*null.UNKNOWN_TOKEN*/, '>>', token.charO ffset + 1); | 5613 var gtgt = new StringToken(1024/*null.UNKNOWN_TOKEN*/, '>>', token.charO ffset + 1); |
| 5603 gtgt.next = token.next; | 5614 gtgt.next = token.next; |
| 5604 return gtgt; | 5615 return gtgt; |
| 5605 } | 5616 } |
| 5606 } | 5617 } |
| 5607 return this.listener.expected(string, token); | 5618 return this.listener.expected(string, token); |
| 5608 } | 5619 } |
| 5609 return token.next; | 5620 return token.next; |
| 5610 } | 5621 } |
| 5611 PartialParser.prototype.parseTypeVariable = function(token) { | 5622 PartialParser.prototype.parseTypeVariable = function(token) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5671 return token; | 5682 return token; |
| 5672 } | 5683 } |
| 5673 PartialParser.prototype.parseClassBody = function(token) { | 5684 PartialParser.prototype.parseClassBody = function(token) { |
| 5674 return this.skipBlock(token); | 5685 return this.skipBlock(token); |
| 5675 } | 5686 } |
| 5676 PartialParser.prototype.parseTopLevelMember = function(token) { | 5687 PartialParser.prototype.parseTopLevelMember = function(token) { |
| 5677 var start = token; | 5688 var start = token; |
| 5678 this.listener.beginTopLevelMember(token); | 5689 this.listener.beginTopLevelMember(token); |
| 5679 var previous = token; | 5690 var previous = token; |
| 5680 LOOP: | 5691 LOOP: |
| 5681 while ($notnull_bool(token != null)) { | 5692 while (token != null) { |
| 5682 var kind = token.kind; | 5693 var kind = token.kind; |
| 5683 switch (true) { | 5694 switch (true) { |
| 5684 case kind === 123/*null.LBRACE_TOKEN*/: | 5695 case kind === 123/*null.LBRACE_TOKEN*/: |
| 5685 case kind === 59/*null.SEMICOLON_TOKEN*/: | 5696 case kind === 59/*null.SEMICOLON_TOKEN*/: |
| 5686 case kind === 40/*null.LPAREN_TOKEN*/: | 5697 case kind === 40/*null.LPAREN_TOKEN*/: |
| 5687 case kind === 61/*null.EQ_TOKEN*/: | 5698 case kind === 61/*null.EQ_TOKEN*/: |
| 5688 | 5699 |
| 5689 break LOOP; | 5700 break LOOP; |
| 5690 | 5701 |
| 5691 default: | 5702 default: |
| 5692 | 5703 |
| 5693 previous = token; | 5704 previous = token; |
| 5694 token = this.next(token); | 5705 token = this.next(token); |
| 5695 break; | 5706 break; |
| 5696 | 5707 |
| 5697 } | 5708 } |
| 5698 } | 5709 } |
| 5699 token = this.parseIdentifier(previous); | 5710 token = this.parseIdentifier(previous); |
| 5700 var isField; | 5711 var isField; |
| 5701 while ($notnull_bool(true)) { | 5712 while (true) { |
| 5702 if ($notnull_bool(this.optional('(', token))) { | 5713 if ($notnull_bool(this.optional('(', token))) { |
| 5703 isField = false; | 5714 isField = false; |
| 5704 break; | 5715 break; |
| 5705 } | 5716 } |
| 5706 else if ($notnull_bool(this.optional('=', token) || this.optional(';', token ))) { | 5717 else if ($notnull_bool(this.optional('=', token) || this.optional(';', token ))) { |
| 5707 isField = true; | 5718 isField = true; |
| 5708 break; | 5719 break; |
| 5709 } | 5720 } |
| 5710 else { | 5721 else { |
| 5711 token = this.listener.unexpected(token); | 5722 token = this.listener.unexpected(token); |
| 5712 } | 5723 } |
| 5713 } | 5724 } |
| 5714 if ($notnull_bool(!$notnull_bool(isField))) { | 5725 if (!$notnull_bool(isField)) { |
| 5715 token = this.next(this.skipArguments((token && token.is$BeginGroupToken()))) ; | 5726 token = this.next(this.skipArguments((token && token.is$BeginGroupToken()))) ; |
| 5716 } | 5727 } |
| 5717 while ($notnull_bool(token != null && token.kind !== 123/*null.LBRACE_TOKEN*/) && token.kind !== 59/*null.SEMICOLON_TOKEN*/) { | 5728 while (token != null && token.kind !== 123/*null.LBRACE_TOKEN*/ && token.kind !== 59/*null.SEMICOLON_TOKEN*/) { |
| 5718 token = this.next(token); | 5729 token = this.next(token); |
| 5719 } | 5730 } |
| 5720 if ($notnull_bool(!$notnull_bool(this.optional(';', token)))) { | 5731 if (!$notnull_bool(this.optional(';', token))) { |
| 5721 token = this.skipBlock(token); | 5732 token = this.skipBlock(token); |
| 5722 } | 5733 } |
| 5723 if ($notnull_bool(isField)) { | 5734 if ($notnull_bool(isField)) { |
| 5724 this.listener.endTopLevelField(start, token); | 5735 this.listener.endTopLevelField(start, token); |
| 5725 } | 5736 } |
| 5726 else { | 5737 else { |
| 5727 this.listener.endTopLevelMethod(start, token); | 5738 this.listener.endTopLevelMethod(start, token); |
| 5728 } | 5739 } |
| 5729 return token.next; | 5740 return token.next; |
| 5730 } | 5741 } |
| 5731 PartialParser.prototype.parseLibraryTags = function(token) { | 5742 PartialParser.prototype.parseLibraryTags = function(token) { |
| 5732 this.listener.beginLibraryTag(token); | 5743 this.listener.beginLibraryTag(token); |
| 5733 token = this.parseIdentifier(this.next(token)); | 5744 token = this.parseIdentifier(this.next(token)); |
| 5734 token = this.expect('(', token); | 5745 token = this.expect('(', token); |
| 5735 while ($notnull_bool(token != null && token.kind !== 40/*null.LPAREN_TOKEN*/) && token.kind !== 41/*null.RPAREN_TOKEN*/) { | 5746 while (token != null && token.kind !== 40/*null.LPAREN_TOKEN*/ && token.kind ! == 41/*null.RPAREN_TOKEN*/) { |
| 5736 token = this.next(token); | 5747 token = this.next(token); |
| 5737 } | 5748 } |
| 5738 token = this.expect(')', token); | 5749 token = this.expect(')', token); |
| 5739 return this.expect(';', token); | 5750 return this.expect(';', token); |
| 5740 } | 5751 } |
| 5741 PartialParser.prototype.beginTypeArguments$1 = function($0) { | 5752 PartialParser.prototype.beginTypeArguments$1 = function($0) { |
| 5742 return this.beginTypeArguments.call$1($0); | 5753 return this.beginTypeArguments.call$1($0); |
| 5743 } | 5754 } |
| 5744 ; | 5755 ; |
| 5745 PartialParser.prototype.beginTypeVariables$1 = function($0) { | 5756 PartialParser.prototype.beginTypeVariables$1 = function($0) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5779 } | 5790 } |
| 5780 Parser.prototype.parseFunctionBody = function(token) { | 5791 Parser.prototype.parseFunctionBody = function(token) { |
| 5781 if ($notnull_bool(this.optional(';', token))) { | 5792 if ($notnull_bool(this.optional(';', token))) { |
| 5782 this.listener.endFunctionBody(0, null, token); | 5793 this.listener.endFunctionBody(0, null, token); |
| 5783 return token.next; | 5794 return token.next; |
| 5784 } | 5795 } |
| 5785 var begin = token; | 5796 var begin = token; |
| 5786 var statementCount = 0; | 5797 var statementCount = 0; |
| 5787 this.listener.beginFunctionBody(begin); | 5798 this.listener.beginFunctionBody(begin); |
| 5788 token = this.checkEof(this.expect('{', token)); | 5799 token = this.checkEof(this.expect('{', token)); |
| 5789 while ($notnull_bool(!$notnull_bool(this.optional('}', token)))) { | 5800 while (!$notnull_bool(this.optional('}', token))) { |
| 5790 token = this.parseStatement(token); | 5801 token = this.parseStatement(token); |
| 5791 ++statementCount; | 5802 ++statementCount; |
| 5792 } | 5803 } |
| 5793 this.listener.endFunctionBody(statementCount, begin, token); | 5804 this.listener.endFunctionBody(statementCount, begin, token); |
| 5794 return this.expect('}', token); | 5805 return this.expect('}', token); |
| 5795 } | 5806 } |
| 5796 Parser.prototype.parseStatement = function(token) { | 5807 Parser.prototype.parseStatement = function(token) { |
| 5797 this.checkEof(token); | 5808 this.checkEof(token); |
| 5798 var value = token.get$stringValue(); | 5809 var value = token.get$stringValue(); |
| 5799 switch (true) { | 5810 switch (true) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5844 } | 5855 } |
| 5845 else { | 5856 else { |
| 5846 token = this.parseExpression(token); | 5857 token = this.parseExpression(token); |
| 5847 this.listener.endReturnStatement(true, begin, token); | 5858 this.listener.endReturnStatement(true, begin, token); |
| 5848 } | 5859 } |
| 5849 return this.expectSemicolon(token); | 5860 return this.expectSemicolon(token); |
| 5850 } | 5861 } |
| 5851 Parser.prototype.parseExpressionStatementOrDeclaration = function(token) { | 5862 Parser.prototype.parseExpressionStatementOrDeclaration = function(token) { |
| 5852 $assert(token.kind === 97/*null.IDENTIFIER_TOKEN*/, "token.kind === IDENTIFIER _TOKEN", "parser.dart", 464, 12); | 5863 $assert(token.kind === 97/*null.IDENTIFIER_TOKEN*/, "token.kind === IDENTIFIER _TOKEN", "parser.dart", 464, 12); |
| 5853 var peek1 = this.next(token); | 5864 var peek1 = this.next(token); |
| 5854 if ($notnull_bool(peek1.kind === 97/*null.IDENTIFIER_TOKEN*/)) { | 5865 if (peek1.kind === 97/*null.IDENTIFIER_TOKEN*/) { |
| 5855 return this.parseLocalDeclaration(token, peek1); | 5866 return this.parseLocalDeclaration(token, peek1); |
| 5856 } | 5867 } |
| 5857 else if ($notnull_bool(peek1.kind === 60/*null.LT_TOKEN*/)) { | 5868 else if (peek1.kind === 60/*null.LT_TOKEN*/) { |
| 5858 var beginGroupToken = (peek1 && peek1.is$BeginGroupToken()); | 5869 var beginGroupToken = (peek1 && peek1.is$BeginGroupToken()); |
| 5859 var gtToken = beginGroupToken.endGroup; | 5870 var gtToken = beginGroupToken.endGroup; |
| 5860 if ($notnull_bool(gtToken != null && gtToken.next.kind === 97/*null.IDENTIFI ER_TOKEN*/)) { | 5871 if (gtToken != null && gtToken.next.kind === 97/*null.IDENTIFIER_TOKEN*/) { |
| 5861 var identifier = gtToken.next; | 5872 var identifier = gtToken.next; |
| 5862 var afterId = identifier.next; | 5873 var afterId = identifier.next; |
| 5863 var afterIdKind = afterId.kind; | 5874 var afterIdKind = afterId.kind; |
| 5864 if ($notnull_bool(afterIdKind === 61/*null.EQ_TOKEN*/ || afterIdKind === 5 9/*null.SEMICOLON_TOKEN*/)) { | 5875 if (afterIdKind === 61/*null.EQ_TOKEN*/ || afterIdKind === 59/*null.SEMICO LON_TOKEN*/) { |
| 5865 return this.parseLocalDeclaration(token, identifier); | 5876 return this.parseLocalDeclaration(token, identifier); |
| 5866 } | 5877 } |
| 5867 else if ($notnull_bool(afterIdKind === 41/*null.RPAREN_TOKEN*/)) { | 5878 else if (afterIdKind === 41/*null.RPAREN_TOKEN*/) { |
| 5868 var beginParen = (afterId && afterId.is$BeginGroupToken()); | 5879 var beginParen = (afterId && afterId.is$BeginGroupToken()); |
| 5869 var endParen = beginParen.endGroup; | 5880 var endParen = beginParen.endGroup; |
| 5870 var afterParens = endParen.next; | 5881 var afterParens = endParen.next; |
| 5871 if ($notnull_bool(this.optional('{', afterParens) || this.optional('=>', afterParens))) { | 5882 if ($notnull_bool(this.optional('{', afterParens) || this.optional('=>', afterParens))) { |
| 5872 return this.parseLocalDeclaration(token, identifier); | 5883 return this.parseLocalDeclaration(token, identifier); |
| 5873 } | 5884 } |
| 5874 } | 5885 } |
| 5875 } | 5886 } |
| 5876 } | 5887 } |
| 5877 return this.parseExpressionStatement(token); | 5888 return this.parseExpressionStatement(token); |
| 5878 } | 5889 } |
| 5879 Parser.prototype.parseLocalDeclaration = function(token, peek1) { | 5890 Parser.prototype.parseLocalDeclaration = function(token, peek1) { |
| 5880 var peek2 = this.next(peek1); | 5891 var peek2 = this.next(peek1); |
| 5881 if ($notnull_bool(peek2.get$stringValue() === '(')) { | 5892 if (peek2.get$stringValue() === '(') { |
| 5882 return this.parseFunction(token); | 5893 return this.parseFunction(token); |
| 5883 } | 5894 } |
| 5884 else { | 5895 else { |
| 5885 return this.parseVariablesDeclaration(token); | 5896 return this.parseVariablesDeclaration(token); |
| 5886 } | 5897 } |
| 5887 } | 5898 } |
| 5888 Parser.prototype.parseExpressionStatement = function(token) { | 5899 Parser.prototype.parseExpressionStatement = function(token) { |
| 5889 this.listener.beginExpressionStatement(token); | 5900 this.listener.beginExpressionStatement(token); |
| 5890 token = this.parseExpression(token); | 5901 token = this.parseExpression(token); |
| 5891 this.listener.endExpressionStatement(token); | 5902 this.listener.endExpressionStatement(token); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 5913 token = this.parseExpression(token); | 5924 token = this.parseExpression(token); |
| 5914 this.listener.handleConditionalExpression(question, colon); | 5925 this.listener.handleConditionalExpression(question, colon); |
| 5915 } | 5926 } |
| 5916 return token; | 5927 return token; |
| 5917 } | 5928 } |
| 5918 Parser.prototype.parseBinaryExpression = function(token, precedence) { | 5929 Parser.prototype.parseBinaryExpression = function(token, precedence) { |
| 5919 $assert(precedence >= 4, "precedence >= 4", "parser.dart", 544, 12); | 5930 $assert(precedence >= 4, "precedence >= 4", "parser.dart", 544, 12); |
| 5920 token = this.parsePrimary(token); | 5931 token = this.parsePrimary(token); |
| 5921 var tokenLevel = this.getPrecedence(token); | 5932 var tokenLevel = this.getPrecedence(token); |
| 5922 for (var level = $assert_num(tokenLevel); | 5933 for (var level = $assert_num(tokenLevel); |
| 5923 $notnull_bool(level >= precedence); --level) { | 5934 level >= precedence; --level) { |
| 5924 while ($notnull_bool(tokenLevel === level)) { | 5935 while (tokenLevel === level) { |
| 5925 var operator = token; | 5936 var operator = token; |
| 5926 token = this.parseBinaryExpression(this.next(token), level + 1); | 5937 token = this.parseBinaryExpression(this.next(token), level + 1); |
| 5927 this.listener.handleBinaryExpression(operator); | 5938 this.listener.handleBinaryExpression(operator); |
| 5928 tokenLevel = this.getPrecedence(token); | 5939 tokenLevel = this.getPrecedence(token); |
| 5929 } | 5940 } |
| 5930 } | 5941 } |
| 5931 return token; | 5942 return token; |
| 5932 } | 5943 } |
| 5933 Parser.prototype.getPrecedence = function(token) { | 5944 Parser.prototype.getPrecedence = function(token) { |
| 5934 if ($notnull_bool(token == null)) return 0; | 5945 if (token == null) return 0; |
| 5935 var value = token.get$stringValue(); | 5946 var value = token.get$stringValue(); |
| 5936 if ($notnull_bool(value == null)) return 0; | 5947 if (value == null) return 0; |
| 5937 switch (true) { | 5948 switch (true) { |
| 5938 case value === '(': | 5949 case value === '(': |
| 5939 | 5950 |
| 5940 return 0; | 5951 return 0; |
| 5941 | 5952 |
| 5942 case value === '+': | 5953 case value === '+': |
| 5943 | 5954 |
| 5944 return 12; | 5955 return 12; |
| 5945 | 5956 |
| 5946 case value === ')': | 5957 case value === ')': |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6163 return token.next; | 6174 return token.next; |
| 6164 } | 6175 } |
| 6165 Parser.prototype.parseSend = function(token) { | 6176 Parser.prototype.parseSend = function(token) { |
| 6166 this.listener.beginSend(token); | 6177 this.listener.beginSend(token); |
| 6167 token = this.parseIdentifier(token); | 6178 token = this.parseIdentifier(token); |
| 6168 token = this.parseArgumentsOpt(token); | 6179 token = this.parseArgumentsOpt(token); |
| 6169 this.listener.endSend(token); | 6180 this.listener.endSend(token); |
| 6170 return token; | 6181 return token; |
| 6171 } | 6182 } |
| 6172 Parser.prototype.parseArgumentsOpt = function(token) { | 6183 Parser.prototype.parseArgumentsOpt = function(token) { |
| 6173 if ($notnull_bool(!$notnull_bool(this.optional('(', token)))) { | 6184 if (!$notnull_bool(this.optional('(', token))) { |
| 6174 this.listener.handleNoArguments(token); | 6185 this.listener.handleNoArguments(token); |
| 6175 return token; | 6186 return token; |
| 6176 } | 6187 } |
| 6177 else { | 6188 else { |
| 6178 return this.parseArguments(token); | 6189 return this.parseArguments(token); |
| 6179 } | 6190 } |
| 6180 } | 6191 } |
| 6181 Parser.prototype.parseArguments = function(token) { | 6192 Parser.prototype.parseArguments = function(token) { |
| 6182 var begin = token; | 6193 var begin = token; |
| 6183 this.listener.beginArguments(begin); | 6194 this.listener.beginArguments(begin); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6259 token = this.expect(')', token); | 6270 token = this.expect(')', token); |
| 6260 token = this.parseStatement(token); | 6271 token = this.parseStatement(token); |
| 6261 this.listener.endForStatement(forToken, token); | 6272 this.listener.endForStatement(forToken, token); |
| 6262 return token; | 6273 return token; |
| 6263 } | 6274 } |
| 6264 Parser.prototype.parseBlock = function(token) { | 6275 Parser.prototype.parseBlock = function(token) { |
| 6265 var begin = token; | 6276 var begin = token; |
| 6266 this.listener.beginBlock(begin); | 6277 this.listener.beginBlock(begin); |
| 6267 var statementCount = 0; | 6278 var statementCount = 0; |
| 6268 token = this.expect('{', token); | 6279 token = this.expect('{', token); |
| 6269 while ($notnull_bool(!$notnull_bool(this.optional('}', token)))) { | 6280 while (!$notnull_bool(this.optional('}', token))) { |
| 6270 token = this.parseStatement(token); | 6281 token = this.parseStatement(token); |
| 6271 ++statementCount; | 6282 ++statementCount; |
| 6272 } | 6283 } |
| 6273 this.listener.endBlock(statementCount, begin, token); | 6284 this.listener.endBlock(statementCount, begin, token); |
| 6274 return this.expect('}', token); | 6285 return this.expect('}', token); |
| 6275 } | 6286 } |
| 6276 Parser.prototype.parseThrowStatement = function(token) { | 6287 Parser.prototype.parseThrowStatement = function(token) { |
| 6277 var throwToken = token; | 6288 var throwToken = token; |
| 6278 this.listener.beginThrowStatement(throwToken); | 6289 this.listener.beginThrowStatement(throwToken); |
| 6279 token = this.expect('throw', token); | 6290 token = this.expect('throw', token); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6552 this.topLevelElements = const$16/*const EmptyLink()*/ | 6563 this.topLevelElements = const$16/*const EmptyLink()*/ |
| 6553 this.canceler = canceler; | 6564 this.canceler = canceler; |
| 6554 // Initializers done | 6565 // Initializers done |
| 6555 } | 6566 } |
| 6556 $inherits(ElementListener, Listener); | 6567 $inherits(ElementListener, Listener); |
| 6557 ElementListener.prototype.beginLibraryTag = function(token) { | 6568 ElementListener.prototype.beginLibraryTag = function(token) { |
| 6558 this.canceler.cancel("Cannot handle library tags"); | 6569 this.canceler.cancel("Cannot handle library tags"); |
| 6559 } | 6570 } |
| 6560 ElementListener.prototype.endClass = function(interfacesCount, beginToken, exten dsKeyword, implementsKeyword, endToken) { | 6571 ElementListener.prototype.endClass = function(interfacesCount, beginToken, exten dsKeyword, implementsKeyword, endToken) { |
| 6561 var $0; | 6572 var $0; |
| 6562 for (; $notnull_bool(interfacesCount > 0); --interfacesCount) { | 6573 for (; interfacesCount > 0; --interfacesCount) { |
| 6563 this.popNode(); | 6574 this.popNode(); |
| 6564 } | 6575 } |
| 6565 var supertype = (($0 = this.popNode()) && $0.is$TypeAnnotation()); | 6576 var supertype = (($0 = this.popNode()) && $0.is$TypeAnnotation()); |
| 6566 var name = (($0 = this.popNode()) && $0.is$Identifier()); | 6577 var name = (($0 = this.popNode()) && $0.is$Identifier()); |
| 6567 this.pushElement(new PartialClassElement(name.get$source(), beginToken, endTok en)); | 6578 this.pushElement(new PartialClassElement(name.get$source(), beginToken, endTok en)); |
| 6568 } | 6579 } |
| 6569 ElementListener.prototype.endInterface = function(token) { | 6580 ElementListener.prototype.endInterface = function(token) { |
| 6570 this.canceler.cancel("Cannot handle interfaces"); | 6581 this.canceler.cancel("Cannot handle interfaces"); |
| 6571 } | 6582 } |
| 6572 ElementListener.prototype.endFunctionTypeAlias = function(token) { | 6583 ElementListener.prototype.endFunctionTypeAlias = function(token) { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 6585 } | 6596 } |
| 6586 ElementListener.prototype.handleNoType = function(token) { | 6597 ElementListener.prototype.handleNoType = function(token) { |
| 6587 this.pushNode(null); | 6598 this.pushNode(null); |
| 6588 } | 6599 } |
| 6589 ElementListener.prototype.endTypeVariable = function(token) { | 6600 ElementListener.prototype.endTypeVariable = function(token) { |
| 6590 var $0; | 6601 var $0; |
| 6591 var bound = (($0 = this.popNode()) && $0.is$TypeAnnotation()); | 6602 var bound = (($0 = this.popNode()) && $0.is$TypeAnnotation()); |
| 6592 var name = (($0 = this.popNode()) && $0.is$Identifier()); | 6603 var name = (($0 = this.popNode()) && $0.is$Identifier()); |
| 6593 } | 6604 } |
| 6594 ElementListener.prototype.endTypeArguments = function(count, beginToken, endToke n) { | 6605 ElementListener.prototype.endTypeArguments = function(count, beginToken, endToke n) { |
| 6595 for (; $notnull_bool(count > 0); --count) { | 6606 for (; count > 0; --count) { |
| 6596 this.popNode(); | 6607 this.popNode(); |
| 6597 } | 6608 } |
| 6598 } | 6609 } |
| 6599 ElementListener.prototype.expected = function(string, token) { | 6610 ElementListener.prototype.expected = function(string, token) { |
| 6600 this.canceler.cancel(("Expected '" + string + "', but got '" + token + "' ") + ("@ " + token.charOffset + "")); | 6611 this.canceler.cancel(("Expected '" + string + "', but got '" + token + "' ") + ("@ " + token.charOffset + "")); |
| 6601 } | 6612 } |
| 6602 ElementListener.prototype.unexpectedEof = function() { | 6613 ElementListener.prototype.unexpectedEof = function() { |
| 6603 this.canceler.cancel("Unexpected end of file"); | 6614 this.canceler.cancel("Unexpected end of file"); |
| 6604 } | 6615 } |
| 6605 ElementListener.prototype.expectedIdentifier = function(token) { | 6616 ElementListener.prototype.expectedIdentifier = function(token) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6688 NodeListener.prototype.handleLiteralDouble = function(token) { | 6699 NodeListener.prototype.handleLiteralDouble = function(token) { |
| 6689 this.pushNode(new LiteralDouble(token, to$call$2(this.onError))); | 6700 this.pushNode(new LiteralDouble(token, to$call$2(this.onError))); |
| 6690 } | 6701 } |
| 6691 NodeListener.prototype.handleLiteralBool = function(token) { | 6702 NodeListener.prototype.handleLiteralBool = function(token) { |
| 6692 this.pushNode(new LiteralBool(token, to$call$2(this.onError))); | 6703 this.pushNode(new LiteralBool(token, to$call$2(this.onError))); |
| 6693 } | 6704 } |
| 6694 NodeListener.prototype.handleLiteralString = function(token) { | 6705 NodeListener.prototype.handleLiteralString = function(token) { |
| 6695 this.pushNode(new LiteralString(token)); | 6706 this.pushNode(new LiteralString(token)); |
| 6696 } | 6707 } |
| 6697 NodeListener.prototype.handleBinaryExpression = function(token) { | 6708 NodeListener.prototype.handleBinaryExpression = function(token) { |
| 6698 var arguments = new NodeList(null, LinkFactory.Link$factory(this.popNode()), n ull, null); | 6709 var arguments = new NodeList(null, LinkFactory.createLink(this.popNode()), nul l, null); |
| 6699 this.pushNode(new Send(this.popNode(), new Operator(token), arguments)); | 6710 this.pushNode(new Send(this.popNode(), new Operator(token), arguments)); |
| 6700 } | 6711 } |
| 6701 NodeListener.prototype.handleAssignmentExpression = function(token) { | 6712 NodeListener.prototype.handleAssignmentExpression = function(token) { |
| 6702 var arguments = new NodeList.singleton$ctor(this.popNode()); | 6713 var arguments = new NodeList.singleton$ctor(this.popNode()); |
| 6703 var node = this.popNode(); | 6714 var node = this.popNode(); |
| 6704 if ($notnull_bool(!(node instanceof Send))) this.canceler.cancel(('not assigna ble: ' + node + '')); | 6715 if (!(node instanceof Send)) this.canceler.cancel(('not assignable: ' + node + '')); |
| 6705 var send = (node && node.is$Send()); | 6716 var send = (node && node.is$Send()); |
| 6706 if ($notnull_bool(!$notnull_bool(send.get$isPropertyAccess()))) this.canceler. cancel(('not assignable: ' + node + '')); | 6717 if (!$notnull_bool(send.get$isPropertyAccess())) this.canceler.cancel(('not as signable: ' + node + '')); |
| 6707 if ($notnull_bool((send instanceof SendSet))) this.canceler.cancel('chained as signment'); | 6718 if ((send instanceof SendSet)) this.canceler.cancel('chained assignment'); |
| 6708 this.pushNode(new SendSet(send.receiver, send.selector, token, arguments)); | 6719 this.pushNode(new SendSet(send.receiver, send.selector, token, arguments)); |
| 6709 } | 6720 } |
| 6710 NodeListener.prototype.handleConditionalExpression = function(question, colon) { | 6721 NodeListener.prototype.handleConditionalExpression = function(question, colon) { |
| 6711 var elseExpression = this.popNode(); | 6722 var elseExpression = this.popNode(); |
| 6712 var thenExpression = this.popNode(); | 6723 var thenExpression = this.popNode(); |
| 6713 var condition = this.popNode(); | 6724 var condition = this.popNode(); |
| 6714 this.canceler.cancel('conditional expression not implemented yet'); | 6725 this.canceler.cancel('conditional expression not implemented yet'); |
| 6715 } | 6726 } |
| 6716 NodeListener.prototype.endSend = function(token) { | 6727 NodeListener.prototype.endSend = function(token) { |
| 6717 var $0; | 6728 var $0; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 6744 } | 6755 } |
| 6745 NodeListener.prototype.endInitializer = function(assignmentOperator) { | 6756 NodeListener.prototype.endInitializer = function(assignmentOperator) { |
| 6746 var $0; | 6757 var $0; |
| 6747 var initializer = (($0 = this.popNode()) && $0.is$Expression()); | 6758 var initializer = (($0 = this.popNode()) && $0.is$Expression()); |
| 6748 var arguments = new NodeList.singleton$ctor(initializer); | 6759 var arguments = new NodeList.singleton$ctor(initializer); |
| 6749 var name = (($0 = this.popNode()) && $0.is$Expression()); | 6760 var name = (($0 = this.popNode()) && $0.is$Expression()); |
| 6750 this.pushNode(new SendSet(null, name, assignmentOperator, arguments)); | 6761 this.pushNode(new SendSet(null, name, assignmentOperator, arguments)); |
| 6751 } | 6762 } |
| 6752 NodeListener.prototype.endIfStatement = function(ifToken, elseToken) { | 6763 NodeListener.prototype.endIfStatement = function(ifToken, elseToken) { |
| 6753 var $0; | 6764 var $0; |
| 6754 var elsePart = (($0 = $notnull_bool((elseToken == null)) ? null : this.popNode ()) && $0.is$Statement()); | 6765 var elsePart = (($0 = (elseToken == null) ? null : this.popNode()) && $0.is$St atement()); |
| 6755 var thenPart = (($0 = this.popNode()) && $0.is$Statement()); | 6766 var thenPart = (($0 = this.popNode()) && $0.is$Statement()); |
| 6756 var condition = (($0 = this.popNode()) && $0.is$NodeList()); | 6767 var condition = (($0 = this.popNode()) && $0.is$NodeList()); |
| 6757 this.pushNode(new If(condition, thenPart, elsePart, ifToken, elseToken)); | 6768 this.pushNode(new If(condition, thenPart, elsePart, ifToken, elseToken)); |
| 6758 } | 6769 } |
| 6759 NodeListener.prototype.endForStatement = function(beginToken, endToken) { | 6770 NodeListener.prototype.endForStatement = function(beginToken, endToken) { |
| 6760 var $0; | 6771 var $0; |
| 6761 var body = (($0 = this.popNode()) && $0.is$Statement()); | 6772 var body = (($0 = this.popNode()) && $0.is$Statement()); |
| 6762 var update = (($0 = this.popNode()) && $0.is$Expression()); | 6773 var update = (($0 = this.popNode()) && $0.is$Expression()); |
| 6763 var condition = (($0 = this.popNode()) && $0.is$ExpressionStatement()); | 6774 var condition = (($0 = this.popNode()) && $0.is$ExpressionStatement()); |
| 6764 var initializer = (($0 = this.popNode()) && $0.is$VariableDefinitions()); | 6775 var initializer = (($0 = this.popNode()) && $0.is$VariableDefinitions()); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 6775 var $0; | 6786 var $0; |
| 6776 var expression = (($0 = this.popNode()) && $0.is$Expression()); | 6787 var expression = (($0 = this.popNode()) && $0.is$Expression()); |
| 6777 this.pushNode(new Throw(expression, throwToken, endToken)); | 6788 this.pushNode(new Throw(expression, throwToken, endToken)); |
| 6778 } | 6789 } |
| 6779 NodeListener.prototype.endRethrowStatement = function(throwToken, endToken) { | 6790 NodeListener.prototype.endRethrowStatement = function(throwToken, endToken) { |
| 6780 this.pushNode(new Throw(null, throwToken, endToken)); | 6791 this.pushNode(new Throw(null, throwToken, endToken)); |
| 6781 } | 6792 } |
| 6782 NodeListener.prototype.makeNodeList = function(count, beginToken, endToken, deli miter) { | 6793 NodeListener.prototype.makeNodeList = function(count, beginToken, endToken, deli miter) { |
| 6783 var $0; | 6794 var $0; |
| 6784 var nodes = const$16/*const EmptyLink()*/; | 6795 var nodes = const$16/*const EmptyLink()*/; |
| 6785 for (; $notnull_bool(count > 0); --count) { | 6796 for (; count > 0; --count) { |
| 6786 nodes = (($0 = nodes.prepend(this.popNode())) && $0.is$Link$Node()); | 6797 nodes = (($0 = nodes.prepend(this.popNode())) && $0.is$Link$Node()); |
| 6787 } | 6798 } |
| 6788 var sourceDelimiter = (($0 = $notnull_bool((delimiter == null)) ? null : new S tringWrapper(delimiter)) && $0.is$SourceString()); | 6799 var sourceDelimiter = (($0 = (delimiter == null) ? null : new StringWrapper(de limiter)) && $0.is$SourceString()); |
| 6789 return new NodeList(beginToken, nodes, endToken, sourceDelimiter); | 6800 return new NodeList(beginToken, nodes, endToken, sourceDelimiter); |
| 6790 } | 6801 } |
| 6791 NodeListener.prototype.log = function(message) { | 6802 NodeListener.prototype.log = function(message) { |
| 6792 this.logger.log(message); | 6803 this.logger.log(message); |
| 6793 } | 6804 } |
| 6794 // ********** Code for PartialFunctionElement ************** | 6805 // ********** Code for PartialFunctionElement ************** |
| 6795 function PartialFunctionElement(name, beginToken, endToken) { | 6806 function PartialFunctionElement(name, beginToken, endToken) { |
| 6796 this.beginToken = beginToken; | 6807 this.beginToken = beginToken; |
| 6797 this.endToken = endToken; | 6808 this.endToken = endToken; |
| 6798 FunctionElement.call(this, name); | 6809 FunctionElement.call(this, name); |
| 6799 // Initializers done | 6810 // Initializers done |
| 6800 } | 6811 } |
| 6801 $inherits(PartialFunctionElement, FunctionElement); | 6812 $inherits(PartialFunctionElement, FunctionElement); |
| 6802 PartialFunctionElement.prototype.parseNode = function(canceler, logger) { | 6813 PartialFunctionElement.prototype.parseNode = function(canceler, logger) { |
| 6803 var $this = this; // closure support | 6814 var $this = this; // closure support |
| 6804 var $0; | 6815 var $0; |
| 6805 if ($notnull_bool(this.node != null)) return this.node; | 6816 if (this.node != null) return this.node; |
| 6806 this.node = (($0 = parse(canceler, logger, (function (p) { | 6817 this.node = (($0 = parse(canceler, logger, (function (p) { |
| 6807 return p.parseFunction($this.beginToken); | 6818 return p.parseFunction($this.beginToken); |
| 6808 }) | 6819 }) |
| 6809 )) && $0.is$FunctionExpression()); | 6820 )) && $0.is$FunctionExpression()); |
| 6810 return this.node; | 6821 return this.node; |
| 6811 } | 6822 } |
| 6812 // ********** Code for PartialClassElement ************** | 6823 // ********** Code for PartialClassElement ************** |
| 6813 function PartialClassElement(name, beginToken, endToken) { | 6824 function PartialClassElement(name, beginToken, endToken) { |
| 6814 this.beginToken = beginToken; | 6825 this.beginToken = beginToken; |
| 6815 this.endToken = endToken; | 6826 this.endToken = endToken; |
| 6816 ClassElement.call(this, name); | 6827 ClassElement.call(this, name); |
| 6817 // Initializers done | 6828 // Initializers done |
| 6818 } | 6829 } |
| 6819 $inherits(PartialClassElement, ClassElement); | 6830 $inherits(PartialClassElement, ClassElement); |
| 6820 PartialClassElement.prototype.parseNode = function(canceler, logger) { | 6831 PartialClassElement.prototype.parseNode = function(canceler, logger) { |
| 6821 var $this = this; // closure support | 6832 var $this = this; // closure support |
| 6822 var $0; | 6833 var $0; |
| 6823 if ($notnull_bool(this.node != null)) return this.node; | 6834 if (this.node != null) return this.node; |
| 6824 this.node = (($0 = parse(canceler, logger, (function (p) { | 6835 this.node = (($0 = parse(canceler, logger, (function (p) { |
| 6825 return p.parseClass($this.beginToken); | 6836 return p.parseClass($this.beginToken); |
| 6826 }) | 6837 }) |
| 6827 )) && $0.is$ClassNode()); | 6838 )) && $0.is$ClassNode()); |
| 6828 return this.node; | 6839 return this.node; |
| 6829 } | 6840 } |
| 6830 // ********** Code for StringScanner ************** | 6841 // ********** Code for StringScanner ************** |
| 6831 function StringScanner(string) { | 6842 function StringScanner(string) { |
| 6832 this.string = string; | 6843 this.string = string; |
| 6833 ArrayBasedScanner$SourceString.call(this); | 6844 ArrayBasedScanner$SourceString.call(this); |
| 6834 // Initializers done | 6845 // Initializers done |
| 6835 } | 6846 } |
| 6836 $inherits(StringScanner, ArrayBasedScanner$SourceString); | 6847 $inherits(StringScanner, ArrayBasedScanner$SourceString); |
| 6837 StringScanner.prototype.nextByte = function() { | 6848 StringScanner.prototype.nextByte = function() { |
| 6838 return this.charAt(++this.byteOffset); | 6849 return this.charAt(++this.byteOffset); |
| 6839 } | 6850 } |
| 6840 StringScanner.prototype.peek = function() { | 6851 StringScanner.prototype.peek = function() { |
| 6841 return this.charAt(this.byteOffset + 1); | 6852 return this.charAt(this.byteOffset + 1); |
| 6842 } | 6853 } |
| 6843 StringScanner.prototype.charAt = function(index) { | 6854 StringScanner.prototype.charAt = function(index) { |
| 6844 return $notnull_bool((this.string.length > $assert_num(index))) ? this.string. charCodeAt(index) : -1; | 6855 return (this.string.length > $assert_num(index)) ? this.string.charCodeAt(inde x) : -1; |
| 6845 } | 6856 } |
| 6846 StringScanner.prototype.asciiString = function(start) { | 6857 StringScanner.prototype.asciiString = function(start) { |
| 6847 return new SubstringWrapper(this.string, start, this.byteOffset); | 6858 return new SubstringWrapper(this.string, start, this.byteOffset); |
| 6848 } | 6859 } |
| 6849 StringScanner.prototype.utf8String = function(start, offset) { | 6860 StringScanner.prototype.utf8String = function(start, offset) { |
| 6850 return new SubstringWrapper(this.string, start, this.byteOffset + offset + 1); | 6861 return new SubstringWrapper(this.string, start, this.byteOffset + offset + 1); |
| 6851 } | 6862 } |
| 6852 StringScanner.prototype.appendByteStringToken = function(kind, value) { | 6863 StringScanner.prototype.appendByteStringToken = function(kind, value) { |
| 6853 this.tail.next = new StringToken.fromSource$ctor(kind, value, this.tokenStart) ; | 6864 this.tail.next = new StringToken.fromSource$ctor(kind, value, this.tokenStart) ; |
| 6854 this.tail = this.tail.next; | 6865 this.tail = this.tail.next; |
| 6855 } | 6866 } |
| 6856 // ********** Code for SubstringWrapper ************** | 6867 // ********** Code for SubstringWrapper ************** |
| 6857 function SubstringWrapper(internalString, begin, end) { | 6868 function SubstringWrapper(internalString, begin, end) { |
| 6858 this.internalString = internalString; | 6869 this.internalString = internalString; |
| 6859 this.begin = begin; | 6870 this.begin = begin; |
| 6860 this.end = end; | 6871 this.end = end; |
| 6861 // Initializers done | 6872 // Initializers done |
| 6862 } | 6873 } |
| 6863 SubstringWrapper.prototype.is$SourceString = function(){return this;}; | 6874 SubstringWrapper.prototype.is$SourceString = function(){return this;}; |
| 6864 SubstringWrapper.prototype.hashCode = function() { | 6875 SubstringWrapper.prototype.hashCode = function() { |
| 6865 return this.toString().hashCode(); | 6876 return this.toString().hashCode(); |
| 6866 } | 6877 } |
| 6867 SubstringWrapper.prototype.$eq = function(other) { | 6878 SubstringWrapper.prototype.$eq = function(other) { |
| 6868 return $notnull_bool(!!(other && other.is$SourceString) && this.toString() == other.toString()); | 6879 return !!(other && other.is$SourceString) && this.toString() == other.toString (); |
| 6869 } | 6880 } |
| 6870 SubstringWrapper.prototype.printOn = function(sb) { | 6881 SubstringWrapper.prototype.printOn = function(sb) { |
| 6871 sb.add(this); | 6882 sb.add(this); |
| 6872 } | 6883 } |
| 6873 SubstringWrapper.prototype.toString = function() { | 6884 SubstringWrapper.prototype.toString = function() { |
| 6874 return this.internalString.substring(this.begin, this.end); | 6885 return this.internalString.substring(this.begin, this.end); |
| 6875 } | 6886 } |
| 6876 SubstringWrapper.prototype.get$stringValue = function() { | 6887 SubstringWrapper.prototype.get$stringValue = function() { |
| 6877 return null; | 6888 return null; |
| 6878 } | 6889 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6929 // ********** Code for StringWrapper ************** | 6940 // ********** Code for StringWrapper ************** |
| 6930 function StringWrapper(internalString) { | 6941 function StringWrapper(internalString) { |
| 6931 this.internalString = internalString; | 6942 this.internalString = internalString; |
| 6932 // Initializers done | 6943 // Initializers done |
| 6933 } | 6944 } |
| 6934 StringWrapper.prototype.is$SourceString = function(){return this;}; | 6945 StringWrapper.prototype.is$SourceString = function(){return this;}; |
| 6935 StringWrapper.prototype.hashCode = function() { | 6946 StringWrapper.prototype.hashCode = function() { |
| 6936 return this.toString().hashCode(); | 6947 return this.toString().hashCode(); |
| 6937 } | 6948 } |
| 6938 StringWrapper.prototype.$eq = function(other) { | 6949 StringWrapper.prototype.$eq = function(other) { |
| 6939 return $notnull_bool(!!(other && other.is$SourceString) && this.toString() == other.toString()); | 6950 return !!(other && other.is$SourceString) && this.toString() == other.toString (); |
| 6940 } | 6951 } |
| 6941 StringWrapper.prototype.printOn = function(sb) { | 6952 StringWrapper.prototype.printOn = function(sb) { |
| 6942 sb.add(this.internalString); | 6953 sb.add(this.internalString); |
| 6943 } | 6954 } |
| 6944 StringWrapper.prototype.toString = function() { | 6955 StringWrapper.prototype.toString = function() { |
| 6945 return this.internalString; | 6956 return this.internalString; |
| 6946 } | 6957 } |
| 6947 StringWrapper.prototype.get$stringValue = function() { | 6958 StringWrapper.prototype.get$stringValue = function() { |
| 6948 return this.internalString; | 6959 return this.internalString; |
| 6949 } | 6960 } |
| 6950 // ********** Code for BeginGroupToken ************** | 6961 // ********** Code for BeginGroupToken ************** |
| 6951 function BeginGroupToken(kind, value, charOffset) { | 6962 function BeginGroupToken(kind, value, charOffset) { |
| 6952 StringToken.call(this, kind, value, charOffset); | 6963 StringToken.call(this, kind, value, charOffset); |
| 6953 // Initializers done | 6964 // Initializers done |
| 6954 } | 6965 } |
| 6955 $inherits(BeginGroupToken, StringToken); | 6966 $inherits(BeginGroupToken, StringToken); |
| 6956 BeginGroupToken.prototype.is$BeginGroupToken = function(){return this;}; | 6967 BeginGroupToken.prototype.is$BeginGroupToken = function(){return this;}; |
| 6957 // ********** Code for Keyword ************** | 6968 // ********** Code for Keyword ************** |
| 6958 function Keyword(syntax, isPseudo) { | 6969 function Keyword(syntax, isPseudo) { |
| 6959 this.syntax = syntax; | 6970 this.syntax = syntax; |
| 6960 this.isPseudo = isPseudo; | 6971 this.isPseudo = isPseudo; |
| 6961 // Initializers done | 6972 // Initializers done |
| 6962 } | 6973 } |
| 6963 Keyword.prototype.is$Keyword = function(){return this;}; | 6974 Keyword.prototype.is$Keyword = function(){return this;}; |
| 6964 Keyword.prototype.is$SourceString = function(){return this;}; | 6975 Keyword.prototype.is$SourceString = function(){return this;}; |
| 6965 Keyword.get$keywords = function() { | 6976 Keyword.get$keywords = function() { |
| 6966 if ($notnull_bool(Keyword._keywords == null)) { | 6977 if (Keyword._keywords == null) { |
| 6967 Keyword._keywords = Keyword.computeKeywordMap(); | 6978 Keyword._keywords = Keyword.computeKeywordMap(); |
| 6968 } | 6979 } |
| 6969 return Keyword._keywords; | 6980 return Keyword._keywords; |
| 6970 } | 6981 } |
| 6971 Keyword.computeKeywordMap = function() { | 6982 Keyword.computeKeywordMap = function() { |
| 6972 var result = new LinkedHashMapImplementation$String$Keyword(); | 6983 var result = new LinkedHashMapImplementation$String$Keyword(); |
| 6973 for (var $i0 = const$234/*Keyword.values*/.iterator(); $i0.hasNext(); ) { | 6984 for (var $i0 = const$234/*Keyword.values*/.iterator(); $i0.hasNext(); ) { |
| 6974 var keyword = $i0.next(); | 6985 var keyword = $i0.next(); |
| 6975 result.$setindex(keyword.syntax, keyword); | 6986 result.$setindex(keyword.syntax, keyword); |
| 6976 } | 6987 } |
| 6977 return result; | 6988 return result; |
| 6978 } | 6989 } |
| 6979 Keyword.prototype.hashCode = function() { | 6990 Keyword.prototype.hashCode = function() { |
| 6980 return this.syntax.hashCode(); | 6991 return this.syntax.hashCode(); |
| 6981 } | 6992 } |
| 6982 Keyword.prototype.$eq = function(other) { | 6993 Keyword.prototype.$eq = function(other) { |
| 6983 return $notnull_bool(!!(other && other.is$SourceString) && this.toString() == other.toString()); | 6994 return !!(other && other.is$SourceString) && this.toString() == other.toString (); |
| 6984 } | 6995 } |
| 6985 Keyword.prototype.printOn = function(sb) { | 6996 Keyword.prototype.printOn = function(sb) { |
| 6986 sb.add(this.syntax); | 6997 sb.add(this.syntax); |
| 6987 } | 6998 } |
| 6988 Keyword.prototype.toString = function() { | 6999 Keyword.prototype.toString = function() { |
| 6989 return this.syntax; | 7000 return this.syntax; |
| 6990 } | 7001 } |
| 6991 Keyword.prototype.get$stringValue = function() { | 7002 Keyword.prototype.get$stringValue = function() { |
| 6992 return this.syntax; | 7003 return this.syntax; |
| 6993 } | 7004 } |
| 6994 // ********** Code for KeywordState ************** | 7005 // ********** Code for KeywordState ************** |
| 6995 function KeywordState() {} | 7006 function KeywordState() {} |
| 6996 KeywordState.prototype.is$KeywordState = function(){return this;}; | 7007 KeywordState.prototype.is$KeywordState = function(){return this;}; |
| 6997 KeywordState.get$KEYWORD_STATE = function() { | 7008 KeywordState.get$KEYWORD_STATE = function() { |
| 6998 if ($notnull_bool(KeywordState._KEYWORD_STATE == null)) { | 7009 if (KeywordState._KEYWORD_STATE == null) { |
| 6999 var strings = new ListFactory$String(const$234/*Keyword.values*/.get$length( )); | 7010 var strings = new ListFactory$String(const$234/*Keyword.values*/.get$length( )); |
| 7000 for (var i = 0; | 7011 for (var i = 0; |
| 7001 $notnull_bool(i < const$234/*Keyword.values*/.get$length()); i++) { | 7012 i < const$234/*Keyword.values*/.get$length(); i++) { |
| 7002 strings.$setindex(i, const$234/*Keyword.values*/[i].syntax); | 7013 strings.$setindex(i, const$234/*Keyword.values*/[i].syntax); |
| 7003 } | 7014 } |
| 7004 strings.sort((function (a, b) { | 7015 strings.sort((function (a, b) { |
| 7005 return a.compareTo(b); | 7016 return a.compareTo(b); |
| 7006 }) | 7017 }) |
| 7007 ); | 7018 ); |
| 7008 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin gs, 0, strings.length); | 7019 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin gs, 0, strings.length); |
| 7009 } | 7020 } |
| 7010 return KeywordState._KEYWORD_STATE; | 7021 return KeywordState._KEYWORD_STATE; |
| 7011 } | 7022 } |
| 7012 KeywordState.computeKeywordStateTable = function(start, strings, offset, length) { | 7023 KeywordState.computeKeywordStateTable = function(start, strings, offset, length) { |
| 7013 var result = new ListFactory$KeywordState(26); | 7024 var result = new ListFactory$KeywordState(26); |
| 7014 $assert(length != 0, "length != 0", "keyword.dart", 161, 12); | 7025 $assert(length != 0, "length != 0", "keyword.dart", 161, 12); |
| 7015 var chunk = 0; | 7026 var chunk = 0; |
| 7016 var chunkStart = -1; | 7027 var chunkStart = -1; |
| 7017 for (var i = offset; | 7028 for (var i = offset; |
| 7018 $notnull_bool(i < offset + length); i++) { | 7029 i < offset + length; i++) { |
| 7019 if ($notnull_bool(strings.$index(i).length > start)) { | 7030 if (strings.$index(i).length > start) { |
| 7020 var c = strings.$index(i).charCodeAt(start); | 7031 var c = strings.$index(i).charCodeAt(start); |
| 7021 if ($notnull_bool(chunk != c)) { | 7032 if (chunk != c) { |
| 7022 if ($notnull_bool(chunkStart != -1)) { | 7033 if (chunkStart != -1) { |
| 7023 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordSta teTable(start + 1, strings, chunkStart, i - chunkStart)); | 7034 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordSta teTable(start + 1, strings, chunkStart, i - chunkStart)); |
| 7024 } | 7035 } |
| 7025 chunkStart = i; | 7036 chunkStart = i; |
| 7026 chunk = c; | 7037 chunk = c; |
| 7027 } | 7038 } |
| 7028 } | 7039 } |
| 7029 } | 7040 } |
| 7030 if ($notnull_bool(chunkStart != -1)) { | 7041 if (chunkStart != -1) { |
| 7031 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordStateTabl e(start + 1, strings, chunkStart, offset + length - chunkStart)); | 7042 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordStateTabl e(start + 1, strings, chunkStart, offset + length - chunkStart)); |
| 7032 } | 7043 } |
| 7033 else { | 7044 else { |
| 7034 $assert(length == 1, "length == 1", "keyword.dart", 183, 14); | 7045 $assert(length == 1, "length == 1", "keyword.dart", 183, 14); |
| 7035 return new LeafKeywordState($assert_String(strings.$index(offset))); | 7046 return new LeafKeywordState($assert_String(strings.$index(offset))); |
| 7036 } | 7047 } |
| 7037 return new ArrayKeywordState(result); | 7048 return new ArrayKeywordState(result); |
| 7038 } | 7049 } |
| 7039 // ********** Code for ArrayKeywordState ************** | 7050 // ********** Code for ArrayKeywordState ************** |
| 7040 function ArrayKeywordState(table) { | 7051 function ArrayKeywordState(table) { |
| 7041 this.table = table; | 7052 this.table = table; |
| 7042 // Initializers done | 7053 // Initializers done |
| 7043 } | 7054 } |
| 7044 $inherits(ArrayKeywordState, KeywordState); | 7055 $inherits(ArrayKeywordState, KeywordState); |
| 7045 ArrayKeywordState.prototype.isLeaf = function() { | 7056 ArrayKeywordState.prototype.isLeaf = function() { |
| 7046 return false; | 7057 return false; |
| 7047 } | 7058 } |
| 7048 ArrayKeywordState.prototype.next = function(c) { | 7059 ArrayKeywordState.prototype.next = function(c) { |
| 7049 var $0; | 7060 var $0; |
| 7050 return (($0 = this.table.$index(c - 97/*null.$a*/)) && $0.is$KeywordState()); | 7061 return (($0 = this.table.$index(c - 97/*null.$a*/)) && $0.is$KeywordState()); |
| 7051 } | 7062 } |
| 7052 ArrayKeywordState.prototype.get$keyword = function() { | 7063 ArrayKeywordState.prototype.get$keyword = function() { |
| 7053 $throw("should not be called"); | 7064 $throw("should not be called"); |
| 7054 } | 7065 } |
| 7055 ArrayKeywordState.prototype.toString = function() { | 7066 ArrayKeywordState.prototype.toString = function() { |
| 7056 var sb = new StringBufferImpl(""); | 7067 var sb = new StringBufferImpl(""); |
| 7057 sb.add("["); | 7068 sb.add("["); |
| 7058 var foo = this.table; | 7069 var foo = this.table; |
| 7059 for (var i = 0; | 7070 for (var i = 0; |
| 7060 $notnull_bool(i < foo.length); i++) { | 7071 i < foo.length; i++) { |
| 7061 if ($notnull_bool($ne(foo.$index(i), null))) { | 7072 if ($notnull_bool($ne(foo.$index(i), null))) { |
| 7062 sb.add(("" + (i + 97/*null.$a*/) + ": " + foo.$index(i) + "; ")); | 7073 sb.add(("" + (i + 97/*null.$a*/) + ": " + foo.$index(i) + "; ")); |
| 7063 } | 7074 } |
| 7064 } | 7075 } |
| 7065 sb.add("]"); | 7076 sb.add("]"); |
| 7066 return sb.toString(); | 7077 return sb.toString(); |
| 7067 } | 7078 } |
| 7068 // ********** Code for LeafKeywordState ************** | 7079 // ********** Code for LeafKeywordState ************** |
| 7069 function LeafKeywordState(syntax) { | 7080 function LeafKeywordState(syntax) { |
| 7070 var $0; | 7081 var $0; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7170 } | 7181 } |
| 7171 Send.prototype.get$isFunctionObjectInvocation = function() { | 7182 Send.prototype.get$isFunctionObjectInvocation = function() { |
| 7172 return this.selector == null; | 7183 return this.selector == null; |
| 7173 } | 7184 } |
| 7174 Send.prototype.getBeginToken = function() { | 7185 Send.prototype.getBeginToken = function() { |
| 7175 return firstBeginToken(this.receiver, this.selector); | 7186 return firstBeginToken(this.receiver, this.selector); |
| 7176 } | 7187 } |
| 7177 Send.prototype.getEndToken = function() { | 7188 Send.prototype.getEndToken = function() { |
| 7178 var $0; | 7189 var $0; |
| 7179 var token; | 7190 var token; |
| 7180 if ($notnull_bool(this.argumentsNode != null)) token = this.argumentsNode.getE ndToken(); | 7191 if (this.argumentsNode != null) token = this.argumentsNode.getEndToken(); |
| 7181 if ($notnull_bool(token != null)) return token; | 7192 if (token != null) return token; |
| 7182 if ($notnull_bool(this.selector != null)) { | 7193 if (this.selector != null) { |
| 7183 return (($0 = this.selector.getEndToken()) && $0.is$Token()); | 7194 return (($0 = this.selector.getEndToken()) && $0.is$Token()); |
| 7184 } | 7195 } |
| 7185 return (($0 = this.receiver.getBeginToken()) && $0.is$Token()); | 7196 return (($0 = this.receiver.getBeginToken()) && $0.is$Token()); |
| 7186 } | 7197 } |
| 7187 // ********** Code for SendSet ************** | 7198 // ********** Code for SendSet ************** |
| 7188 function SendSet(receiver, selector, assignmentOperator, argumentsNode) { | 7199 function SendSet(receiver, selector, assignmentOperator, argumentsNode) { |
| 7189 this.assignmentOperator = assignmentOperator; | 7200 this.assignmentOperator = assignmentOperator; |
| 7190 Send.call(this, receiver, selector, argumentsNode); | 7201 Send.call(this, receiver, selector, argumentsNode); |
| 7191 // Initializers done | 7202 // Initializers done |
| 7192 } | 7203 } |
| 7193 $inherits(SendSet, Send); | 7204 $inherits(SendSet, Send); |
| 7194 SendSet.prototype.is$SendSet = function(){return this;}; | 7205 SendSet.prototype.is$SendSet = function(){return this;}; |
| 7195 SendSet.prototype.accept = function(visitor) { | 7206 SendSet.prototype.accept = function(visitor) { |
| 7196 return visitor.visitSendSet(this); | 7207 return visitor.visitSendSet(this); |
| 7197 } | 7208 } |
| 7198 // ********** Code for NodeList ************** | 7209 // ********** Code for NodeList ************** |
| 7199 function NodeList(beginToken, nodes, endToken, delimiter) { | 7210 function NodeList(beginToken, nodes, endToken, delimiter) { |
| 7200 this.beginToken = beginToken; | 7211 this.beginToken = beginToken; |
| 7201 this.nodes = nodes; | 7212 this.nodes = nodes; |
| 7202 this.endToken = endToken; | 7213 this.endToken = endToken; |
| 7203 this.delimiter = delimiter; | 7214 this.delimiter = delimiter; |
| 7204 // Initializers done | 7215 // Initializers done |
| 7205 } | 7216 } |
| 7206 NodeList.singleton$ctor = function(node) { | 7217 NodeList.singleton$ctor = function(node) { |
| 7207 NodeList.call(this, null, LinkFactory.Link$factory(node)); | 7218 NodeList.call(this, null, LinkFactory.createLink(node)); |
| 7208 // Initializers done | 7219 // Initializers done |
| 7209 } | 7220 } |
| 7210 NodeList.singleton$ctor.prototype = NodeList.prototype; | 7221 NodeList.singleton$ctor.prototype = NodeList.prototype; |
| 7211 $inherits(NodeList, Node); | 7222 $inherits(NodeList, Node); |
| 7212 NodeList.prototype.is$NodeList = function(){return this;}; | 7223 NodeList.prototype.is$NodeList = function(){return this;}; |
| 7213 NodeList.prototype.accept = function(visitor) { | 7224 NodeList.prototype.accept = function(visitor) { |
| 7214 return visitor.visitNodeList(this); | 7225 return visitor.visitNodeList(this); |
| 7215 } | 7226 } |
| 7216 NodeList.prototype.getBeginToken = function() { | 7227 NodeList.prototype.getBeginToken = function() { |
| 7217 var $0; | 7228 var $0; |
| 7218 if ($notnull_bool(this.beginToken != null)) return this.beginToken; | 7229 if (this.beginToken != null) return this.beginToken; |
| 7219 if ($notnull_bool(this.nodes != null)) { | 7230 if (this.nodes != null) { |
| 7220 for (var link = this.nodes; | 7231 for (var link = this.nodes; |
| 7221 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail( )) && $0.is$Link$Node())) { | 7232 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Lin k$Node())) { |
| 7222 if ($notnull_bool(link.get$head().getBeginToken() != null)) { | 7233 if (link.get$head().getBeginToken() != null) { |
| 7223 return (($0 = link.get$head().getBeginToken()) && $0.is$Token()); | 7234 return (($0 = link.get$head().getBeginToken()) && $0.is$Token()); |
| 7224 } | 7235 } |
| 7225 if ($notnull_bool(link.get$head().getEndToken() != null)) { | 7236 if (link.get$head().getEndToken() != null) { |
| 7226 return (($0 = link.get$head().getEndToken()) && $0.is$Token()); | 7237 return (($0 = link.get$head().getEndToken()) && $0.is$Token()); |
| 7227 } | 7238 } |
| 7228 } | 7239 } |
| 7229 } | 7240 } |
| 7230 return this.endToken; | 7241 return this.endToken; |
| 7231 } | 7242 } |
| 7232 NodeList.prototype.getEndToken = function() { | 7243 NodeList.prototype.getEndToken = function() { |
| 7233 var $0; | 7244 var $0; |
| 7234 if ($notnull_bool(this.endToken != null)) return this.endToken; | 7245 if (this.endToken != null) return this.endToken; |
| 7235 if ($notnull_bool(this.nodes != null)) { | 7246 if (this.nodes != null) { |
| 7236 var link = this.nodes; | 7247 var link = this.nodes; |
| 7237 while ($notnull_bool(!$notnull_bool(link.get$tail().isEmpty()))) link = (($0 = link.get$tail()) && $0.is$Link$Node()); | 7248 while (!$notnull_bool(link.get$tail().isEmpty())) link = (($0 = link.get$tai l()) && $0.is$Link$Node()); |
| 7238 if ($notnull_bool(link.get$head().getEndToken() != null)) return (($0 = link .get$head().getEndToken()) && $0.is$Token()); | 7249 if (link.get$head().getEndToken() != null) return (($0 = link.get$head().get EndToken()) && $0.is$Token()); |
| 7239 if ($notnull_bool(link.get$head().getBeginToken() != null)) return (($0 = li nk.get$head().getBeginToken()) && $0.is$Token()); | 7250 if (link.get$head().getBeginToken() != null) return (($0 = link.get$head().g etBeginToken()) && $0.is$Token()); |
| 7240 } | 7251 } |
| 7241 return this.beginToken; | 7252 return this.beginToken; |
| 7242 } | 7253 } |
| 7243 // ********** Code for Block ************** | 7254 // ********** Code for Block ************** |
| 7244 function Block(statements) { | 7255 function Block(statements) { |
| 7245 this.statements = statements; | 7256 this.statements = statements; |
| 7246 // Initializers done | 7257 // Initializers done |
| 7247 } | 7258 } |
| 7248 $inherits(Block, Statement); | 7259 $inherits(Block, Statement); |
| 7249 Block.prototype.accept = function(visitor) { | 7260 Block.prototype.accept = function(visitor) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 7268 If.prototype.get$hasElsePart = function() { | 7279 If.prototype.get$hasElsePart = function() { |
| 7269 return this.elsePart != null; | 7280 return this.elsePart != null; |
| 7270 } | 7281 } |
| 7271 If.prototype.accept = function(visitor) { | 7282 If.prototype.accept = function(visitor) { |
| 7272 return visitor.visitIf(this); | 7283 return visitor.visitIf(this); |
| 7273 } | 7284 } |
| 7274 If.prototype.getBeginToken = function() { | 7285 If.prototype.getBeginToken = function() { |
| 7275 return this.ifToken; | 7286 return this.ifToken; |
| 7276 } | 7287 } |
| 7277 If.prototype.getEndToken = function() { | 7288 If.prototype.getEndToken = function() { |
| 7278 if ($notnull_bool(this.elsePart == null)) return this.thenPart.getEndToken(); | 7289 if (this.elsePart == null) return this.thenPart.getEndToken(); |
| 7279 return this.elsePart.getEndToken(); | 7290 return this.elsePart.getEndToken(); |
| 7280 } | 7291 } |
| 7281 // ********** Code for For ************** | 7292 // ********** Code for For ************** |
| 7282 function For(initializer, condition, update, body, forToken) { | 7293 function For(initializer, condition, update, body, forToken) { |
| 7283 this.initializer = initializer; | 7294 this.initializer = initializer; |
| 7284 this.condition = condition; | 7295 this.condition = condition; |
| 7285 this.update = update; | 7296 this.update = update; |
| 7286 this.body = body; | 7297 this.body = body; |
| 7287 this.forToken = forToken; | 7298 this.forToken = forToken; |
| 7288 // Initializers done | 7299 // Initializers done |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7565 } | 7576 } |
| 7566 Unparser.prototype.unparse = function(node) { | 7577 Unparser.prototype.unparse = function(node) { |
| 7567 this.sb = new StringBufferImpl(""); | 7578 this.sb = new StringBufferImpl(""); |
| 7568 this.visit(node); | 7579 this.visit(node); |
| 7569 return this.sb.toString(); | 7580 return this.sb.toString(); |
| 7570 } | 7581 } |
| 7571 Unparser.prototype.add = function(string) { | 7582 Unparser.prototype.add = function(string) { |
| 7572 string.printOn(this.sb); | 7583 string.printOn(this.sb); |
| 7573 } | 7584 } |
| 7574 Unparser.prototype.visit = function(node) { | 7585 Unparser.prototype.visit = function(node) { |
| 7575 if ($notnull_bool(node != null)) { | 7586 if (node != null) { |
| 7576 if ($notnull_bool(this.printDebugInfo)) this.sb.add(('[' + node.getObjectDes cription() + ': ')); | 7587 if ($notnull_bool(this.printDebugInfo)) this.sb.add(('[' + node.getObjectDes cription() + ': ')); |
| 7577 node.accept(this); | 7588 node.accept(this); |
| 7578 if ($notnull_bool(this.printDebugInfo)) this.sb.add(']'); | 7589 if ($notnull_bool(this.printDebugInfo)) this.sb.add(']'); |
| 7579 } | 7590 } |
| 7580 else if ($notnull_bool(this.printDebugInfo)) { | 7591 else if ($notnull_bool(this.printDebugInfo)) { |
| 7581 this.sb.add('[null]'); | 7592 this.sb.add('[null]'); |
| 7582 } | 7593 } |
| 7583 } | 7594 } |
| 7584 Unparser.prototype.visitBlock = function(node) { | 7595 Unparser.prototype.visitBlock = function(node) { |
| 7585 this.visit(node.statements); | 7596 this.visit(node.statements); |
| 7586 } | 7597 } |
| 7587 Unparser.prototype.visitExpressionStatement = function(node) { | 7598 Unparser.prototype.visitExpressionStatement = function(node) { |
| 7588 var $0; | 7599 var $0; |
| 7589 this.visit(node.expression); | 7600 this.visit(node.expression); |
| 7590 this.add((($0 = node.endToken.get$value()) && $0.is$SourceString())); | 7601 this.add((($0 = node.endToken.get$value()) && $0.is$SourceString())); |
| 7591 } | 7602 } |
| 7592 Unparser.prototype.visitFor = function(node) { | 7603 Unparser.prototype.visitFor = function(node) { |
| 7593 node.forToken.get$value().printOn(this.sb); | 7604 node.forToken.get$value().printOn(this.sb); |
| 7594 this.sb.add('('); | 7605 this.sb.add('('); |
| 7595 this.visit(node.initializer); | 7606 this.visit(node.initializer); |
| 7596 this.visit(node.condition); | 7607 this.visit(node.condition); |
| 7597 this.visit(node.update); | 7608 this.visit(node.update); |
| 7598 this.sb.add(')'); | 7609 this.sb.add(')'); |
| 7599 this.visit(node.body); | 7610 this.visit(node.body); |
| 7600 } | 7611 } |
| 7601 Unparser.prototype.visitFunctionExpression = function(node) { | 7612 Unparser.prototype.visitFunctionExpression = function(node) { |
| 7602 if ($notnull_bool(node.returnType != null)) { | 7613 if (node.returnType != null) { |
| 7603 this.visit(node.returnType); | 7614 this.visit(node.returnType); |
| 7604 this.sb.add(' '); | 7615 this.sb.add(' '); |
| 7605 } | 7616 } |
| 7606 this.visit(node.name); | 7617 this.visit(node.name); |
| 7607 this.visit(node.parameters); | 7618 this.visit(node.parameters); |
| 7608 this.visit(node.body); | 7619 this.visit(node.body); |
| 7609 } | 7620 } |
| 7610 Unparser.prototype.visitIdentifier = function(node) { | 7621 Unparser.prototype.visitIdentifier = function(node) { |
| 7611 var $0; | 7622 var $0; |
| 7612 this.add((($0 = node.token.get$value()) && $0.is$SourceString())); | 7623 this.add((($0 = node.token.get$value()) && $0.is$SourceString())); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 7632 Unparser.prototype.visitLiteralInt = function(node) { | 7643 Unparser.prototype.visitLiteralInt = function(node) { |
| 7633 var $0; | 7644 var $0; |
| 7634 this.add((($0 = node.token.get$value()) && $0.is$SourceString())); | 7645 this.add((($0 = node.token.get$value()) && $0.is$SourceString())); |
| 7635 } | 7646 } |
| 7636 Unparser.prototype.visitLiteralString = function(node) { | 7647 Unparser.prototype.visitLiteralString = function(node) { |
| 7637 var $0; | 7648 var $0; |
| 7638 this.add((($0 = node.token.get$value()) && $0.is$SourceString())); | 7649 this.add((($0 = node.token.get$value()) && $0.is$SourceString())); |
| 7639 } | 7650 } |
| 7640 Unparser.prototype.visitNodeList = function(node) { | 7651 Unparser.prototype.visitNodeList = function(node) { |
| 7641 var $0; | 7652 var $0; |
| 7642 if ($notnull_bool(node.beginToken != null)) this.add((($0 = node.beginToken.ge t$value()) && $0.is$SourceString())); | 7653 if (node.beginToken != null) this.add((($0 = node.beginToken.get$value()) && $ 0.is$SourceString())); |
| 7643 if ($notnull_bool(node.nodes != null)) { | 7654 if (node.nodes != null) { |
| 7644 node.nodes.printOn(this.sb, node.delimiter); | 7655 node.nodes.printOn(this.sb, node.delimiter); |
| 7645 } | 7656 } |
| 7646 if ($notnull_bool(node.endToken != null)) this.add((($0 = node.endToken.get$va lue()) && $0.is$SourceString())); | 7657 if (node.endToken != null) this.add((($0 = node.endToken.get$value()) && $0.is $SourceString())); |
| 7647 } | 7658 } |
| 7648 Unparser.prototype.visitOperator = function(node) { | 7659 Unparser.prototype.visitOperator = function(node) { |
| 7649 this.visitIdentifier(node); | 7660 this.visitIdentifier(node); |
| 7650 } | 7661 } |
| 7651 Unparser.prototype.visitReturn = function(node) { | 7662 Unparser.prototype.visitReturn = function(node) { |
| 7652 var $0; | 7663 var $0; |
| 7653 this.add((($0 = node.beginToken.get$value()) && $0.is$SourceString())); | 7664 this.add((($0 = node.beginToken.get$value()) && $0.is$SourceString())); |
| 7654 if ($notnull_bool(node.get$hasExpression())) { | 7665 if ($notnull_bool(node.get$hasExpression())) { |
| 7655 this.sb.add(' '); | 7666 this.sb.add(' '); |
| 7656 this.visit(node.expression); | 7667 this.visit(node.expression); |
| 7657 } | 7668 } |
| 7658 this.add((($0 = node.endToken.get$value()) && $0.is$SourceString())); | 7669 this.add((($0 = node.endToken.get$value()) && $0.is$SourceString())); |
| 7659 } | 7670 } |
| 7660 Unparser.prototype.visitSend = function(node) { | 7671 Unparser.prototype.visitSend = function(node) { |
| 7661 if ($notnull_bool(node.receiver != null)) { | 7672 if (node.receiver != null) { |
| 7662 this.visit(node.receiver); | 7673 this.visit(node.receiver); |
| 7663 if ($notnull_bool(!(node.selector instanceof Operator))) this.sb.add('.'); | 7674 if (!(node.selector instanceof Operator)) this.sb.add('.'); |
| 7664 } | 7675 } |
| 7665 this.visit(node.selector); | 7676 this.visit(node.selector); |
| 7666 this.visit(node.argumentsNode); | 7677 this.visit(node.argumentsNode); |
| 7667 } | 7678 } |
| 7668 Unparser.prototype.visitSendSet = function(node) { | 7679 Unparser.prototype.visitSendSet = function(node) { |
| 7669 var $0; | 7680 var $0; |
| 7670 if ($notnull_bool(node.receiver != null)) { | 7681 if (node.receiver != null) { |
| 7671 this.visit(node.receiver); | 7682 this.visit(node.receiver); |
| 7672 this.sb.add('.'); | 7683 this.sb.add('.'); |
| 7673 } | 7684 } |
| 7674 this.visit(node.selector); | 7685 this.visit(node.selector); |
| 7675 this.add((($0 = node.assignmentOperator.get$value()) && $0.is$SourceString())) ; | 7686 this.add((($0 = node.assignmentOperator.get$value()) && $0.is$SourceString())) ; |
| 7676 this.visit(node.argumentsNode); | 7687 this.visit(node.argumentsNode); |
| 7677 } | 7688 } |
| 7678 Unparser.prototype.visitThrow = function(node) { | 7689 Unparser.prototype.visitThrow = function(node) { |
| 7679 node.throwToken.get$value().printOn(this.sb); | 7690 node.throwToken.get$value().printOn(this.sb); |
| 7680 if ($notnull_bool(node.expression != null)) { | 7691 if (node.expression != null) { |
| 7681 this.visit(node.expression); | 7692 this.visit(node.expression); |
| 7682 } | 7693 } |
| 7683 node.endToken.get$value().printOn(this.sb); | 7694 node.endToken.get$value().printOn(this.sb); |
| 7684 } | 7695 } |
| 7685 Unparser.prototype.visitTypeAnnotation = function(node) { | 7696 Unparser.prototype.visitTypeAnnotation = function(node) { |
| 7686 this.visit(node.typeName); | 7697 this.visit(node.typeName); |
| 7687 } | 7698 } |
| 7688 Unparser.prototype.visitVariableDefinitions = function(node) { | 7699 Unparser.prototype.visitVariableDefinitions = function(node) { |
| 7689 var $0; | 7700 var $0; |
| 7690 if ($notnull_bool(node.type != null)) { | 7701 if (node.type != null) { |
| 7691 this.visit(node.type); | 7702 this.visit(node.type); |
| 7692 } | 7703 } |
| 7693 else { | 7704 else { |
| 7694 this.sb.add('var'); | 7705 this.sb.add('var'); |
| 7695 } | 7706 } |
| 7696 this.sb.add(' '); | 7707 this.sb.add(' '); |
| 7697 this.visit(node.definitions); | 7708 this.visit(node.definitions); |
| 7698 if ($notnull_bool(node.endToken != null)) this.add((($0 = node.endToken.get$va lue()) && $0.is$SourceString())); | 7709 if (node.endToken != null) this.add((($0 = node.endToken.get$value()) && $0.is $SourceString())); |
| 7699 } | 7710 } |
| 7700 // ********** Code for top level ************** | 7711 // ********** Code for top level ************** |
| 7701 function firstBeginToken(first, second) { | 7712 function firstBeginToken(first, second) { |
| 7702 var $0; | 7713 var $0; |
| 7703 return (($0 = $notnull_bool((first != null)) ? first.getBeginToken() : second. getBeginToken()) && $0.is$Token()); | 7714 return (($0 = (first != null) ? first.getBeginToken() : second.getBeginToken() ) && $0.is$Token()); |
| 7704 } | 7715 } |
| 7705 // ********** Library elements ************** | 7716 // ********** Library elements ************** |
| 7706 // ********** Code for ElementKind ************** | 7717 // ********** Code for ElementKind ************** |
| 7707 function ElementKind(id) { | 7718 function ElementKind(id) { |
| 7708 this.id = id; | 7719 this.id = id; |
| 7709 // Initializers done | 7720 // Initializers done |
| 7710 } | 7721 } |
| 7711 // ********** Code for Element ************** | 7722 // ********** Code for Element ************** |
| 7712 function Element(name, kind, enclosingElement) { | 7723 function Element(name, kind, enclosingElement) { |
| 7713 this.name = name; | 7724 this.name = name; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 7744 return types.dynamicType; | 7755 return types.dynamicType; |
| 7745 } | 7756 } |
| 7746 // ********** Code for FunctionElement ************** | 7757 // ********** Code for FunctionElement ************** |
| 7747 function FunctionElement(name) { | 7758 function FunctionElement(name) { |
| 7748 Element.call(this, name, const$241, null); | 7759 Element.call(this, name, const$241, null); |
| 7749 // Initializers done | 7760 // Initializers done |
| 7750 } | 7761 } |
| 7751 $inherits(FunctionElement, Element); | 7762 $inherits(FunctionElement, Element); |
| 7752 FunctionElement.prototype.computeType = function(compiler, types) { | 7763 FunctionElement.prototype.computeType = function(compiler, types) { |
| 7753 var $0; | 7764 var $0; |
| 7754 if ($notnull_bool(this.type != null)) return (($0 = this.type) && $0.is$Functi onType()); | 7765 if (this.type != null) return (($0 = this.type) && $0.is$FunctionType()); |
| 7755 var node = (($0 = this.parseNode(compiler, compiler)) && $0.is$FunctionExpress ion()); | 7766 var node = (($0 = this.parseNode(compiler, compiler)) && $0.is$FunctionExpress ion()); |
| 7756 var returnType = getType(node.returnType, types); | 7767 var returnType = getType(node.returnType, types); |
| 7757 if ($notnull_bool(returnType == null)) compiler.cancel(('unknown type ' + retu rnType + '')); | 7768 if (returnType == null) compiler.cancel(('unknown type ' + returnType + '')); |
| 7758 var parameterTypes = new LinkBuilderImplementation$Type(); | 7769 var parameterTypes = new LinkBuilderImplementation$Type(); |
| 7759 for (var link = node.parameters.nodes; | 7770 for (var link = node.parameters.nodes; |
| 7760 $notnull_bool(!$notnull_bool(link.isEmpty())); link = link.get$tail()) { | 7771 !$notnull_bool(link.isEmpty()); link = link.get$tail()) { |
| 7761 var parameter = (($0 = link.get$head()) && $0.is$VariableDefinitions()); | 7772 var parameter = (($0 = link.get$head()) && $0.is$VariableDefinitions()); |
| 7762 parameterTypes.addLast(getType(parameter.type, types)); | 7773 parameterTypes.addLast(getType(parameter.type, types)); |
| 7763 } | 7774 } |
| 7764 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0 .is$Link$Type())); | 7775 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0 .is$Link$Type())); |
| 7765 return (($0 = this.type) && $0.is$FunctionType()); | 7776 return (($0 = this.type) && $0.is$FunctionType()); |
| 7766 } | 7777 } |
| 7767 // ********** Code for ClassElement ************** | 7778 // ********** Code for ClassElement ************** |
| 7768 function ClassElement(name) { | 7779 function ClassElement(name) { |
| 7769 Element.call(this, name, const$239, null); | 7780 Element.call(this, name, const$239, null); |
| 7770 // Initializers done | 7781 // Initializers done |
| 7771 } | 7782 } |
| 7772 $inherits(ClassElement, Element); | 7783 $inherits(ClassElement, Element); |
| 7773 ClassElement.prototype.computeType = function(compiler, types) { | 7784 ClassElement.prototype.computeType = function(compiler, types) { |
| 7774 compiler.unimplemented('ClassElement.computeType'); | 7785 compiler.unimplemented('ClassElement.computeType'); |
| 7775 } | 7786 } |
| 7776 // ********** Code for top level ************** | 7787 // ********** Code for top level ************** |
| 7777 function getType(annotation, types) { | 7788 function getType(annotation, types) { |
| 7778 var $0; | 7789 var $0; |
| 7779 if ($notnull_bool(annotation == null || annotation.typeName == null)) { | 7790 if (annotation == null || annotation.typeName == null) { |
| 7780 return (($0 = types.dynamicType) && $0.is$Type()); | 7791 return (($0 = types.dynamicType) && $0.is$Type()); |
| 7781 } | 7792 } |
| 7782 return (($0 = types.lookup(annotation.typeName.get$source())) && $0.is$Type()) ; | 7793 return (($0 = types.lookup(annotation.typeName.get$source())) && $0.is$Type()) ; |
| 7783 } | 7794 } |
| 7784 // ********** Library ssa ************** | 7795 // ********** Library ssa ************** |
| 7785 // ********** Code for SsaBuilderTask ************** | 7796 // ********** Code for SsaBuilderTask ************** |
| 7786 function SsaBuilderTask(compiler) { | 7797 function SsaBuilderTask(compiler) { |
| 7787 CompilerTask.call(this, compiler); | 7798 CompilerTask.call(this, compiler); |
| 7788 // Initializers done | 7799 // Initializers done |
| 7789 } | 7800 } |
| 7790 $inherits(SsaBuilderTask, CompilerTask); | 7801 $inherits(SsaBuilderTask, CompilerTask); |
| 7791 SsaBuilderTask.prototype.get$name = function() { | 7802 SsaBuilderTask.prototype.get$name = function() { |
| 7792 return 'SSA builder'; | 7803 return 'SSA builder'; |
| 7793 } | 7804 } |
| 7794 SsaBuilderTask.prototype.build = function(tree, elements) { | 7805 SsaBuilderTask.prototype.build = function(tree, elements) { |
| 7795 var $this = this; // closure support | 7806 var $this = this; // closure support |
| 7796 var $0; | 7807 var $0; |
| 7797 return (($0 = this.measure((function () { | 7808 return (($0 = this.measure((function () { |
| 7798 var $0; | 7809 var $0; |
| 7799 var function_ = (tree && tree.is$FunctionExpression()); | 7810 var function_ = (tree && tree.is$FunctionExpression()); |
| 7800 var graph = $this.compileMethod(function_.parameters, function_.body, elemen ts); | 7811 var graph = $this.compileMethod(function_.parameters, function_.body, elemen ts); |
| 7801 $assert(graph.isValid(), "graph.isValid()", "builder.dart", 14, 14); | 7812 $assert(graph.isValid(), "graph.isValid()", "builder.dart", 14, 14); |
| 7802 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) { | 7813 if (false/*null.GENERATE_SSA_TRACE*/) { |
| 7803 var name = (($0 = function_.name) && $0.is$Identifier()); | 7814 var name = (($0 = function_.name) && $0.is$Identifier()); |
| 7804 HTracer.HTracer$singleton$factory().traceCompilation(name.get$source().toS tring()); | 7815 HTracer.HTracer$singleton$factory().traceCompilation(name.get$source().toS tring()); |
| 7805 HTracer.HTracer$singleton$factory().traceGraph('builder', graph); | 7816 HTracer.HTracer$singleton$factory().traceGraph('builder', graph); |
| 7806 } | 7817 } |
| 7807 return graph; | 7818 return graph; |
| 7808 }) | 7819 }) |
| 7809 )) && $0.is$HGraph()); | 7820 )) && $0.is$HGraph()); |
| 7810 } | 7821 } |
| 7811 SsaBuilderTask.prototype.compileMethod = function(parameters, body, elements) { | 7822 SsaBuilderTask.prototype.compileMethod = function(parameters, body, elements) { |
| 7812 var builder = new SsaBuilder(this.compiler, elements); | 7823 var builder = new SsaBuilder(this.compiler, elements); |
| 7813 var graph = builder.build(parameters, body); | 7824 var graph = builder.build(parameters, body); |
| 7814 return graph; | 7825 return graph; |
| 7815 } | 7826 } |
| 7816 // ********** Code for SsaBuilder ************** | 7827 // ********** Code for SsaBuilder ************** |
| 7817 function SsaBuilder(compiler, elements) { | 7828 function SsaBuilder(compiler, elements) { |
| 7818 this.compiler = compiler; | 7829 this.compiler = compiler; |
| 7819 this.elements = elements; | 7830 this.elements = elements; |
| 7820 // Initializers done | 7831 // Initializers done |
| 7821 } | 7832 } |
| 7822 SsaBuilder.prototype.build = function(parameters, body) { | 7833 SsaBuilder.prototype.build = function(parameters, body) { |
| 7823 this.stack = new ListFactory$HInstruction(); | 7834 this.stack = new ListFactory$HInstruction(); |
| 7824 this.definitions = new HashMapImplementation$Element$HInstruction(); | 7835 this.definitions = new HashMapImplementation$Element$HInstruction(); |
| 7825 this.graph = new HGraph(); | 7836 this.graph = new HGraph(); |
| 7826 var block = this.graph.addNewBlock(); | 7837 var block = this.graph.addNewBlock(); |
| 7827 this.open(this.graph.entry); | 7838 this.open(this.graph.entry); |
| 7828 this.visitParameters(parameters); | 7839 this.visitParameters(parameters); |
| 7829 this.close(new HGoto()).addSuccessor(block); | 7840 this.close(new HGoto()).addSuccessor(block); |
| 7830 this.open(block); | 7841 this.open(block); |
| 7831 body.accept(this); | 7842 body.accept(this); |
| 7832 if ($notnull_bool(!$notnull_bool(this.isAborted()))) this.close(new HGoto()).a ddSuccessor(this.graph.exit); | 7843 if (!$notnull_bool(this.isAborted())) this.close(new HGoto()).addSuccessor(thi s.graph.exit); |
| 7833 this.graph.finalize(); | 7844 this.graph.finalize(); |
| 7834 return this.graph; | 7845 return this.graph; |
| 7835 } | 7846 } |
| 7836 SsaBuilder.prototype.open = function(block) { | 7847 SsaBuilder.prototype.open = function(block) { |
| 7837 block.open(); | 7848 block.open(); |
| 7838 this.current = block; | 7849 this.current = block; |
| 7839 } | 7850 } |
| 7840 SsaBuilder.prototype.close = function(end) { | 7851 SsaBuilder.prototype.close = function(end) { |
| 7841 var result = this.current; | 7852 var result = this.current; |
| 7842 this.current.close(end); | 7853 this.current.close(end); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 7855 } | 7866 } |
| 7856 SsaBuilder.prototype.push = function(instruction) { | 7867 SsaBuilder.prototype.push = function(instruction) { |
| 7857 this.add(instruction); | 7868 this.add(instruction); |
| 7858 this.stack.add(instruction); | 7869 this.stack.add(instruction); |
| 7859 } | 7870 } |
| 7860 SsaBuilder.prototype.pop = function() { | 7871 SsaBuilder.prototype.pop = function() { |
| 7861 var $0; | 7872 var $0; |
| 7862 return (($0 = this.stack.removeLast()) && $0.is$HInstruction()); | 7873 return (($0 = this.stack.removeLast()) && $0.is$HInstruction()); |
| 7863 } | 7874 } |
| 7864 SsaBuilder.prototype.visit = function(node) { | 7875 SsaBuilder.prototype.visit = function(node) { |
| 7865 if ($notnull_bool(node != null)) node.accept(this); | 7876 if (node != null) node.accept(this); |
| 7866 } | 7877 } |
| 7867 SsaBuilder.prototype.visitParameters = function(parameters) { | 7878 SsaBuilder.prototype.visitParameters = function(parameters) { |
| 7868 var $0; | 7879 var $0; |
| 7869 var parameterIndex = 0; | 7880 var parameterIndex = 0; |
| 7870 for (var link = parameters.nodes; | 7881 for (var link = parameters.nodes; |
| 7871 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { | 7882 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ Node())) { |
| 7872 var container = (($0 = link.get$head()) && $0.is$VariableDefinitions()); | 7883 var container = (($0 = link.get$head()) && $0.is$VariableDefinitions()); |
| 7873 var identifierLink = container.definitions.nodes; | 7884 var identifierLink = container.definitions.nodes; |
| 7874 $assert($notnull_bool(!$notnull_bool(identifierLink.isEmpty()) && identifier Link.get$tail().isEmpty()), "!identifierLink.isEmpty() && identifierLink.tail.is Empty()", "builder.dart", 115, 14); | 7885 $assert($notnull_bool(!$notnull_bool(identifierLink.isEmpty()) && identifier Link.get$tail().isEmpty()), "!identifierLink.isEmpty() && identifierLink.tail.is Empty()", "builder.dart", 115, 14); |
| 7875 if ($notnull_bool(!(identifierLink.get$head() instanceof Identifier))) { | 7886 if (!(identifierLink.get$head() instanceof Identifier)) { |
| 7876 this.compiler.unimplemented("SsaBuilder.visitParameters non-identifier"); | 7887 this.compiler.unimplemented("SsaBuilder.visitParameters non-identifier"); |
| 7877 } | 7888 } |
| 7878 var parameterId = (($0 = identifierLink.get$head()) && $0.is$Identifier()); | 7889 var parameterId = (($0 = identifierLink.get$head()) && $0.is$Identifier()); |
| 7879 var element = (($0 = this.elements.$index(parameterId)) && $0.is$Element()); | 7890 var element = (($0 = this.elements.$index(parameterId)) && $0.is$Element()); |
| 7880 var parameterInstruction = new HParameter(parameterIndex++); | 7891 var parameterInstruction = new HParameter(parameterIndex++); |
| 7881 this.definitions.$setindex(element, parameterInstruction); | 7892 this.definitions.$setindex(element, parameterInstruction); |
| 7882 this.add(parameterInstruction); | 7893 this.add(parameterInstruction); |
| 7883 } | 7894 } |
| 7884 } | 7895 } |
| 7885 SsaBuilder.prototype.visitBlock = function(node) { | 7896 SsaBuilder.prototype.visitBlock = function(node) { |
| 7886 var $0; | 7897 var $0; |
| 7887 for (var link = node.statements.nodes; | 7898 for (var link = node.statements.nodes; |
| 7888 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { | 7899 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ Node())) { |
| 7889 this.visit((($0 = link.get$head()) && $0.is$Node())); | 7900 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 7890 if ($notnull_bool(this.isAborted())) { | 7901 if ($notnull_bool(this.isAborted())) { |
| 7891 if ($notnull_bool(!$notnull_bool(this.stack.isEmpty()))) this.compiler.can cel('non-empty instruction stack'); | 7902 if (!this.stack.isEmpty()) this.compiler.cancel('non-empty instruction sta ck'); |
| 7892 return; | 7903 return; |
| 7893 } | 7904 } |
| 7894 } | 7905 } |
| 7895 $assert($notnull_bool(!(this.current.last instanceof HGoto) && !(this.current. last instanceof HReturn)), "current.last is !HGoto && current.last is !HReturn", "builder.dart", 138, 12); | 7906 $assert(!(this.current.last instanceof HGoto) && !(this.current.last instanceo f HReturn), "current.last is !HGoto && current.last is !HReturn", "builder.dart" , 138, 12); |
| 7896 if ($notnull_bool(!$notnull_bool(this.stack.isEmpty()))) this.compiler.cancel( 'non-empty instruction stack'); | 7907 if (!this.stack.isEmpty()) this.compiler.cancel('non-empty instruction stack') ; |
| 7897 } | 7908 } |
| 7898 SsaBuilder.prototype.visitClassNode = function(node) { | 7909 SsaBuilder.prototype.visitClassNode = function(node) { |
| 7899 this.compiler.unimplemented("SsaBuilder.visitClassNode"); | 7910 this.compiler.unimplemented("SsaBuilder.visitClassNode"); |
| 7900 } | 7911 } |
| 7901 SsaBuilder.prototype.visitExpressionStatement = function(node) { | 7912 SsaBuilder.prototype.visitExpressionStatement = function(node) { |
| 7902 this.visit(node.expression); | 7913 this.visit(node.expression); |
| 7903 this.pop(); | 7914 this.pop(); |
| 7904 } | 7915 } |
| 7905 SsaBuilder.prototype.visitFor = function(node) { | 7916 SsaBuilder.prototype.visitFor = function(node) { |
| 7906 var $this = this; // closure support | 7917 var $this = this; // closure support |
| 7907 $assert($notnull_bool(node.initializer != null && node.condition != null) && n ode.update != null && node.body != null, "node.initializer !== null && node.cond ition !== null &&\n node.update !== null && node.body !== null", "buil der.dart", 152, 12); | 7918 $assert(node.initializer != null && node.condition != null && node.update != n ull && node.body != null, "node.initializer !== null && node.condition !== null &&\n node.update !== null && node.body !== null", "builder.dart", 152, 12); |
| 7908 this.visit(node.initializer); | 7919 this.visit(node.initializer); |
| 7909 $assert(!$notnull_bool(this.isAborted()), "!isAborted()", "builder.dart", 156, 12); | 7920 $assert(!$notnull_bool(this.isAborted()), "!isAborted()", "builder.dart", 156, 12); |
| 7910 var initializerBlock = this.close(new HGoto()); | 7921 var initializerBlock = this.close(new HGoto()); |
| 7911 var initializerDefinitions = HashMapImplementation.HashMapImplementation$from$ factory(this.definitions); | 7922 var initializerDefinitions = HashMapImplementation.HashMapImplementation$from$ factory(this.definitions); |
| 7912 var conditionBlock = this.graph.addNewBlock(); | 7923 var conditionBlock = this.graph.addNewBlock(); |
| 7913 conditionBlock.isLoopHeader = true; | 7924 conditionBlock.isLoopHeader = true; |
| 7914 initializerBlock.addSuccessor(conditionBlock); | 7925 initializerBlock.addSuccessor(conditionBlock); |
| 7915 this.open(conditionBlock); | 7926 this.open(conditionBlock); |
| 7916 initializerDefinitions.forEach((function (element, instruction) { | 7927 initializerDefinitions.forEach((function (element, instruction) { |
| 7917 var phi = new HPhi(instruction, instruction); | 7928 var phi = new HPhi(instruction, instruction); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 7938 var updateInstruction = this.pop(); | 7949 var updateInstruction = this.pop(); |
| 7939 updateBlock = this.close(new HGoto()); | 7950 updateBlock = this.close(new HGoto()); |
| 7940 updateBlock.addSuccessor(conditionBlock); | 7951 updateBlock.addSuccessor(conditionBlock); |
| 7941 var currentInstruction = conditionBlock.first; | 7952 var currentInstruction = conditionBlock.first; |
| 7942 initializerDefinitions.forEach((function (element, instruction) { | 7953 initializerDefinitions.forEach((function (element, instruction) { |
| 7943 var $0; | 7954 var $0; |
| 7944 var currentPhi = (currentInstruction && currentInstruction.is$HPhi()); | 7955 var currentPhi = (currentInstruction && currentInstruction.is$HPhi()); |
| 7945 $assert(currentPhi.inputs.$index(0) === currentPhi.inputs.$index(1), "curren tPhi.inputs[0] === currentPhi.inputs[1]", "builder.dart", 208, 14); | 7956 $assert(currentPhi.inputs.$index(0) === currentPhi.inputs.$index(1), "curren tPhi.inputs[0] === currentPhi.inputs[1]", "builder.dart", 208, 14); |
| 7946 $assert(currentPhi.inputs.$index(0) === instruction, "currentPhi.inputs[0] = == instruction", "builder.dart", 209, 14); | 7957 $assert(currentPhi.inputs.$index(0) === instruction, "currentPhi.inputs[0] = == instruction", "builder.dart", 209, 14); |
| 7947 var afterBodyInstruction = (($0 = $this.definitions.$index(element)) && $0.i s$HInstruction()); | 7958 var afterBodyInstruction = (($0 = $this.definitions.$index(element)) && $0.i s$HInstruction()); |
| 7948 if ($notnull_bool(afterBodyInstruction !== currentPhi)) { | 7959 if (afterBodyInstruction !== currentPhi) { |
| 7949 var oldInput = (($0 = currentPhi.inputs.$index(0)) && $0.is$HInstruction() ); | 7960 var oldInput = (($0 = currentPhi.inputs.$index(0)) && $0.is$HInstruction() ); |
| 7950 for (var i = 0; | 7961 for (var i = 0; |
| 7951 $notnull_bool(i < oldInput.get$usedBy().length); i++) { | 7962 i < oldInput.get$usedBy().length; i++) { |
| 7952 if ($notnull_bool(oldInput.get$usedBy().$index(i) === currentPhi)) { | 7963 if (oldInput.get$usedBy().$index(i) === currentPhi) { |
| 7953 oldInput.get$usedBy().$setindex(i, oldInput.get$usedBy().$index(oldInp ut.get$usedBy().length - 1)); | 7964 oldInput.get$usedBy().$setindex(i, oldInput.get$usedBy().$index(oldInp ut.get$usedBy().length - 1)); |
| 7954 oldInput.get$usedBy().length = oldInput.get$usedBy().length - 1; | 7965 oldInput.get$usedBy().length = oldInput.get$usedBy().length - 1; |
| 7955 break; | 7966 break; |
| 7956 } | 7967 } |
| 7957 } | 7968 } |
| 7958 currentPhi.inputs.$setindex(1, afterBodyInstruction); | 7969 currentPhi.inputs.$setindex(1, afterBodyInstruction); |
| 7959 afterBodyInstruction.get$usedBy().add(currentPhi); | 7970 afterBodyInstruction.get$usedBy().add(currentPhi); |
| 7960 } | 7971 } |
| 7961 else { | 7972 else { |
| 7962 conditionBlock.rewrite(currentPhi, (($0 = currentPhi.inputs.$index(0)) && $0.is$HInstruction())); | 7973 conditionBlock.rewrite(currentPhi, (($0 = currentPhi.inputs.$index(0)) && $0.is$HInstruction())); |
| 7963 conditionBlock.remove(currentPhi); | 7974 conditionBlock.remove(currentPhi); |
| 7964 if ($notnull_bool($this.definitions.$index(element) === currentPhi)) { | 7975 if ($this.definitions.$index(element) === currentPhi) { |
| 7965 $this.definitions.$setindex(element, currentPhi.inputs.$index(0)); | 7976 $this.definitions.$setindex(element, currentPhi.inputs.$index(0)); |
| 7966 } | 7977 } |
| 7967 if ($notnull_bool(conditionDefinitions.$index(element) === currentPhi)) { | 7978 if (conditionDefinitions.$index(element) === currentPhi) { |
| 7968 conditionDefinitions.$setindex(element, currentPhi.inputs.$index(0)); | 7979 conditionDefinitions.$setindex(element, currentPhi.inputs.$index(0)); |
| 7969 } | 7980 } |
| 7970 } | 7981 } |
| 7971 currentInstruction = currentInstruction.next; | 7982 currentInstruction = currentInstruction.next; |
| 7972 }) | 7983 }) |
| 7973 ); | 7984 ); |
| 7974 var joinBlock = this.graph.addNewBlock(); | 7985 var joinBlock = this.graph.addNewBlock(); |
| 7975 conditionExitBlock.addSuccessor(joinBlock); | 7986 conditionExitBlock.addSuccessor(joinBlock); |
| 7976 this.open(joinBlock); | 7987 this.open(joinBlock); |
| 7977 this.definitions = this.joinDefinitions(joinBlock, conditionDefinitions, this. definitions); | 7988 this.definitions = this.joinDefinitions(joinBlock, conditionDefinitions, this. definitions); |
| 7978 } | 7989 } |
| 7979 SsaBuilder.prototype.visitFunctionExpression = function(node) { | 7990 SsaBuilder.prototype.visitFunctionExpression = function(node) { |
| 7980 this.compiler.unimplemented('SsaBuilder.visitFunctionExpression'); | 7991 this.compiler.unimplemented('SsaBuilder.visitFunctionExpression'); |
| 7981 } | 7992 } |
| 7982 SsaBuilder.prototype.visitIdentifier = function(node) { | 7993 SsaBuilder.prototype.visitIdentifier = function(node) { |
| 7983 var $0; | 7994 var $0; |
| 7984 var element = (($0 = this.elements.$index(node)) && $0.is$Element()); | 7995 var element = (($0 = this.elements.$index(node)) && $0.is$Element()); |
| 7985 this.compiler.ensure(element != null); | 7996 this.compiler.ensure(element != null); |
| 7986 var def = (($0 = this.definitions.$index(element)) && $0.is$HInstruction()); | 7997 var def = (($0 = this.definitions.$index(element)) && $0.is$HInstruction()); |
| 7987 $assert(def != null, "def !== null", "builder.dart", 253, 12); | 7998 $assert(def != null, "def !== null", "builder.dart", 253, 12); |
| 7988 this.stack.add(def); | 7999 this.stack.add(def); |
| 7989 } | 8000 } |
| 7990 SsaBuilder.prototype.joinDefinitions = function(joinBlock, incoming1, incoming2) { | 8001 SsaBuilder.prototype.joinDefinitions = function(joinBlock, incoming1, incoming2) { |
| 7991 if ($notnull_bool(incoming1.get$length() > incoming2.get$length())) { | 8002 if (incoming1.get$length() > incoming2.get$length()) { |
| 7992 return this.joinDefinitions(joinBlock, incoming2, incoming1); | 8003 return this.joinDefinitions(joinBlock, incoming2, incoming1); |
| 7993 } | 8004 } |
| 7994 var joinedDefinitions = new HashMapImplementation$Element$HInstruction(); | 8005 var joinedDefinitions = new HashMapImplementation$Element$HInstruction(); |
| 7995 $assert(incoming1.get$length() <= incoming2.get$length(), "incoming1.length <= incoming2.length", "builder.dart", 272, 12); | 8006 $assert(incoming1.get$length() <= incoming2.get$length(), "incoming1.length <= incoming2.length", "builder.dart", 272, 12); |
| 7996 incoming1.forEach((function (element, instruction) { | 8007 incoming1.forEach((function (element, instruction) { |
| 7997 var $0; | 8008 var $0; |
| 7998 var other = (($0 = incoming2.$index(element)) && $0.is$HInstruction()); | 8009 var other = (($0 = incoming2.$index(element)) && $0.is$HInstruction()); |
| 7999 if ($notnull_bool(other == null)) return; | 8010 if (other == null) return; |
| 8000 if ($notnull_bool(instruction === other)) { | 8011 if (instruction === other) { |
| 8001 joinedDefinitions.$setindex(element, instruction); | 8012 joinedDefinitions.$setindex(element, instruction); |
| 8002 } | 8013 } |
| 8003 else { | 8014 else { |
| 8004 var phi = new HPhi((instruction && instruction.is$HInstruction()), other); | 8015 var phi = new HPhi((instruction && instruction.is$HInstruction()), other); |
| 8005 joinBlock.add(phi); | 8016 joinBlock.add(phi); |
| 8006 joinedDefinitions.$setindex(element, phi); | 8017 joinedDefinitions.$setindex(element, phi); |
| 8007 } | 8018 } |
| 8008 }) | 8019 }) |
| 8009 ); | 8020 ); |
| 8010 return joinedDefinitions; | 8021 return joinedDefinitions; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 8022 var thenDefinitions = this.definitions; | 8033 var thenDefinitions = this.definitions; |
| 8023 this.definitions = conditionDefinitions; | 8034 this.definitions = conditionDefinitions; |
| 8024 var elseBlock = null; | 8035 var elseBlock = null; |
| 8025 if ($notnull_bool(hasElse)) { | 8036 if ($notnull_bool(hasElse)) { |
| 8026 elseBlock = this.graph.addNewBlock(); | 8037 elseBlock = this.graph.addNewBlock(); |
| 8027 conditionBlock.addSuccessor(elseBlock); | 8038 conditionBlock.addSuccessor(elseBlock); |
| 8028 this.open(elseBlock); | 8039 this.open(elseBlock); |
| 8029 this.visit(node.elsePart); | 8040 this.visit(node.elsePart); |
| 8030 elseBlock = this.current; | 8041 elseBlock = this.current; |
| 8031 } | 8042 } |
| 8032 if ($notnull_bool(thenBlock == null && elseBlock == null) && hasElse) { | 8043 if ($notnull_bool(thenBlock == null && elseBlock == null && hasElse)) { |
| 8033 this.current = null; | 8044 this.current = null; |
| 8034 } | 8045 } |
| 8035 else { | 8046 else { |
| 8036 var joinBlock = this.graph.addNewBlock(); | 8047 var joinBlock = this.graph.addNewBlock(); |
| 8037 if ($notnull_bool(thenBlock != null)) this.goto(thenBlock, joinBlock); | 8048 if (thenBlock != null) this.goto(thenBlock, joinBlock); |
| 8038 if ($notnull_bool(elseBlock != null)) this.goto(elseBlock, joinBlock); | 8049 if (elseBlock != null) this.goto(elseBlock, joinBlock); |
| 8039 else if ($notnull_bool(!$notnull_bool(hasElse))) conditionBlock.addSuccessor (joinBlock); | 8050 else if (!$notnull_bool(hasElse)) conditionBlock.addSuccessor(joinBlock); |
| 8040 this.open(joinBlock); | 8051 this.open(joinBlock); |
| 8041 if ($notnull_bool(joinBlock.predecessors.length == 2)) { | 8052 if (joinBlock.predecessors.length == 2) { |
| 8042 this.definitions = this.joinDefinitions(joinBlock, this.definitions, thenD efinitions); | 8053 this.definitions = this.joinDefinitions(joinBlock, this.definitions, thenD efinitions); |
| 8043 } | 8054 } |
| 8044 } | 8055 } |
| 8045 } | 8056 } |
| 8046 SsaBuilder.prototype.unquote = function(literal) { | 8057 SsaBuilder.prototype.unquote = function(literal) { |
| 8047 var str = ('' + literal.get$value() + ''); | 8058 var str = ('' + literal.get$value() + ''); |
| 8048 this.compiler.ensure(str[0] == '@'); | 8059 this.compiler.ensure(str[0] == '@'); |
| 8049 var quotes = 1; | 8060 var quotes = 1; |
| 8050 var quote = str[1]; | 8061 var quote = str[1]; |
| 8051 while ($notnull_bool(str[quotes + 1] === quote)) quotes++; | 8062 while (str[quotes + 1] === quote) quotes++; |
| 8052 return new StringWrapper(str.substring(quotes + 1, str.length - quotes)); | 8063 return new StringWrapper(str.substring(quotes + 1, str.length - quotes)); |
| 8053 } | 8064 } |
| 8054 SsaBuilder.prototype.visitSend = function(node) { | 8065 SsaBuilder.prototype.visitSend = function(node) { |
| 8055 var $0; | 8066 var $0; |
| 8056 if ($notnull_bool((node.selector instanceof Operator))) { | 8067 if ((node.selector instanceof Operator)) { |
| 8057 this.visit(node.receiver); | 8068 this.visit(node.receiver); |
| 8058 this.visit(node.argumentsNode); | 8069 this.visit(node.argumentsNode); |
| 8059 var right = this.pop(); | 8070 var right = this.pop(); |
| 8060 var left = this.pop(); | 8071 var left = this.pop(); |
| 8061 var op = (($0 = node.selector) && $0.is$Operator()); | 8072 var op = (($0 = node.selector) && $0.is$Operator()); |
| 8062 if ($notnull_bool($eq(const$266/*const SourceString("+")*/, op.get$source()) )) { | 8073 if ($notnull_bool($eq(const$266/*const SourceString("+")*/, op.get$source()) )) { |
| 8063 this.push(new HAdd([left, right])); | 8074 this.push(new HAdd([left, right])); |
| 8064 } | 8075 } |
| 8065 else if ($notnull_bool($eq(const$267/*const SourceString("-")*/, op.get$sour ce()))) { | 8076 else if ($notnull_bool($eq(const$267/*const SourceString("-")*/, op.get$sour ce()))) { |
| 8066 this.push(new HSubtract([left, right])); | 8077 this.push(new HSubtract([left, right])); |
| 8067 } | 8078 } |
| 8068 else if ($notnull_bool($eq(const$268/*const SourceString("*")*/, op.get$sour ce()))) { | 8079 else if ($notnull_bool($eq(const$268/*const SourceString("*")*/, op.get$sour ce()))) { |
| 8069 this.push(new HMultiply([left, right])); | 8080 this.push(new HMultiply([left, right])); |
| 8070 } | 8081 } |
| 8071 else if ($notnull_bool($eq(const$269/*const SourceString("/")*/, op.get$sour ce()))) { | 8082 else if ($notnull_bool($eq(const$269/*const SourceString("/")*/, op.get$sour ce()))) { |
| 8072 this.push(new HDivide([left, right])); | 8083 this.push(new HDivide([left, right])); |
| 8073 } | 8084 } |
| 8074 else if ($notnull_bool($eq(const$270/*const SourceString("~/")*/, op.get$sou rce()))) { | 8085 else if ($notnull_bool($eq(const$270/*const SourceString("~/")*/, op.get$sou rce()))) { |
| 8075 this.push(new HTruncatingDivide([left, right])); | 8086 this.push(new HTruncatingDivide([left, right])); |
| 8076 } | 8087 } |
| 8077 else if ($notnull_bool($eq(const$271/*const SourceString("==")*/, op.get$sou rce()))) { | 8088 else if ($notnull_bool($eq(const$271/*const SourceString("==")*/, op.get$sou rce()))) { |
| 8078 this.push(new HEquals([left, right])); | 8089 this.push(new HEquals([left, right])); |
| 8079 } | 8090 } |
| 8080 } | 8091 } |
| 8081 else if ($notnull_bool(node.get$isPropertyAccess())) { | 8092 else if ($notnull_bool(node.get$isPropertyAccess())) { |
| 8082 if ($notnull_bool(node.receiver != null)) { | 8093 if (node.receiver != null) { |
| 8083 this.compiler.unimplemented("SsaBuilder.visitSend with receiver"); | 8094 this.compiler.unimplemented("SsaBuilder.visitSend with receiver"); |
| 8084 } | 8095 } |
| 8085 var element = (($0 = this.elements.$index(node)) && $0.is$Element()); | 8096 var element = (($0 = this.elements.$index(node)) && $0.is$Element()); |
| 8086 this.stack.add(this.definitions.$index(element)); | 8097 this.stack.add(this.definitions.$index(element)); |
| 8087 } | 8098 } |
| 8088 else { | 8099 else { |
| 8089 var link = node.get$arguments(); | 8100 var link = node.get$arguments(); |
| 8090 if ($notnull_bool(this.elements.$index(node).kind === const$244/*ElementKind .FOREIGN*/)) { | 8101 if (this.elements.$index(node).kind === const$244/*ElementKind.FOREIGN*/) { |
| 8091 link = (($0 = link.get$tail()) && $0.is$Link$Node()); | 8102 link = (($0 = link.get$tail()) && $0.is$Link$Node()); |
| 8092 } | 8103 } |
| 8093 var arguments = []; | 8104 var arguments = []; |
| 8094 for (; $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get $tail()) && $0.is$Link$Node())) { | 8105 for (; !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0. is$Link$Node())) { |
| 8095 this.visit((($0 = link.get$head()) && $0.is$Node())); | 8106 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 8096 arguments.add(this.pop()); | 8107 arguments.add(this.pop()); |
| 8097 } | 8108 } |
| 8098 if ($notnull_bool(this.elements.$index(node).kind === const$244/*ElementKind .FOREIGN*/)) { | 8109 if (this.elements.$index(node).kind === const$244/*ElementKind.FOREIGN*/) { |
| 8099 var literal = (($0 = node.get$arguments().get$head()) && $0.is$LiteralStri ng()); | 8110 var literal = (($0 = node.get$arguments().get$head()) && $0.is$LiteralStri ng()); |
| 8100 this.compiler.ensure((literal instanceof LiteralString)); | 8111 this.compiler.ensure((literal instanceof LiteralString)); |
| 8101 this.push(new HInvokeForeign(this.unquote(literal), arguments)); | 8112 this.push(new HInvokeForeign(this.unquote(literal), arguments)); |
| 8102 } | 8113 } |
| 8103 else { | 8114 else { |
| 8104 var selector = (($0 = node.selector) && $0.is$Identifier()); | 8115 var selector = (($0 = node.selector) && $0.is$Identifier()); |
| 8105 this.push(new HInvoke(selector.get$source(), arguments)); | 8116 this.push(new HInvoke(selector.get$source(), arguments)); |
| 8106 } | 8117 } |
| 8107 } | 8118 } |
| 8108 } | 8119 } |
| 8109 SsaBuilder.prototype.visitSendSet = function(node) { | 8120 SsaBuilder.prototype.visitSendSet = function(node) { |
| 8110 this.stack.add(this.updateDefinition(node)); | 8121 this.stack.add(this.updateDefinition(node)); |
| 8111 } | 8122 } |
| 8112 SsaBuilder.prototype.visitLiteralInt = function(node) { | 8123 SsaBuilder.prototype.visitLiteralInt = function(node) { |
| 8113 this.push(new HLiteral(node.get$value())); | 8124 this.push(new HLiteral(node.get$value())); |
| 8114 } | 8125 } |
| 8115 SsaBuilder.prototype.visitLiteralDouble = function(node) { | 8126 SsaBuilder.prototype.visitLiteralDouble = function(node) { |
| 8116 this.push(new HLiteral(node.get$value())); | 8127 this.push(new HLiteral(node.get$value())); |
| 8117 } | 8128 } |
| 8118 SsaBuilder.prototype.visitLiteralBool = function(node) { | 8129 SsaBuilder.prototype.visitLiteralBool = function(node) { |
| 8119 this.push(new HLiteral(node.get$value())); | 8130 this.push(new HLiteral(node.get$value())); |
| 8120 } | 8131 } |
| 8121 SsaBuilder.prototype.visitLiteralString = function(node) { | 8132 SsaBuilder.prototype.visitLiteralString = function(node) { |
| 8122 this.push(new HLiteral(node.get$value())); | 8133 this.push(new HLiteral(node.get$value())); |
| 8123 } | 8134 } |
| 8124 SsaBuilder.prototype.visitNodeList = function(node) { | 8135 SsaBuilder.prototype.visitNodeList = function(node) { |
| 8125 var $0; | 8136 var $0; |
| 8126 for (var link = node.nodes; | 8137 for (var link = node.nodes; |
| 8127 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { | 8138 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ Node())) { |
| 8128 this.visit((($0 = link.get$head()) && $0.is$Node())); | 8139 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 8129 } | 8140 } |
| 8130 } | 8141 } |
| 8131 SsaBuilder.prototype.visitOperator = function(node) { | 8142 SsaBuilder.prototype.visitOperator = function(node) { |
| 8132 this.compiler.unimplemented("SsaBuilder.visitOperator"); | 8143 this.compiler.unimplemented("SsaBuilder.visitOperator"); |
| 8133 } | 8144 } |
| 8134 SsaBuilder.prototype.visitReturn = function(node) { | 8145 SsaBuilder.prototype.visitReturn = function(node) { |
| 8135 if ($notnull_bool(node.expression == null)) { | 8146 if (node.expression == null) { |
| 8136 this.compiler.unimplemented("SsaBuilder: return without expression"); | 8147 this.compiler.unimplemented("SsaBuilder: return without expression"); |
| 8137 } | 8148 } |
| 8138 this.visit(node.expression); | 8149 this.visit(node.expression); |
| 8139 var value = this.pop(); | 8150 var value = this.pop(); |
| 8140 this.close(new HReturn(value)).addSuccessor(this.graph.exit); | 8151 this.close(new HReturn(value)).addSuccessor(this.graph.exit); |
| 8141 } | 8152 } |
| 8142 SsaBuilder.prototype.visitThrow = function(node) { | 8153 SsaBuilder.prototype.visitThrow = function(node) { |
| 8143 if ($notnull_bool(node.expression == null)) { | 8154 if (node.expression == null) { |
| 8144 this.compiler.unimplemented("SsaBuilder: throw without expression"); | 8155 this.compiler.unimplemented("SsaBuilder: throw without expression"); |
| 8145 } | 8156 } |
| 8146 this.visit(node.expression); | 8157 this.visit(node.expression); |
| 8147 this.close(new HThrow(this.pop())); | 8158 this.close(new HThrow(this.pop())); |
| 8148 } | 8159 } |
| 8149 SsaBuilder.prototype.visitTypeAnnotation = function(node) { | 8160 SsaBuilder.prototype.visitTypeAnnotation = function(node) { |
| 8150 | 8161 |
| 8151 } | 8162 } |
| 8152 SsaBuilder.prototype.updateDefinition = function(node) { | 8163 SsaBuilder.prototype.updateDefinition = function(node) { |
| 8153 var $0; | 8164 var $0; |
| 8154 if ($notnull_bool(node.receiver != null)) { | 8165 if (node.receiver != null) { |
| 8155 this.compiler.unimplemented("SsaBuilder: property access"); | 8166 this.compiler.unimplemented("SsaBuilder: property access"); |
| 8156 } | 8167 } |
| 8157 var link = node.get$arguments(); | 8168 var link = node.get$arguments(); |
| 8158 $assert($notnull_bool(!$notnull_bool(link.isEmpty()) && link.get$tail().isEmpt y()), "!link.isEmpty() && link.tail.isEmpty()", "builder.dart", 456, 12); | 8169 $assert($notnull_bool(!$notnull_bool(link.isEmpty()) && link.get$tail().isEmpt y()), "!link.isEmpty() && link.tail.isEmpty()", "builder.dart", 456, 12); |
| 8159 this.visit((($0 = link.get$head()) && $0.is$Node())); | 8170 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 8160 var value = this.pop(); | 8171 var value = this.pop(); |
| 8161 this.definitions.$setindex(this.elements.$index(node), value); | 8172 this.definitions.$setindex(this.elements.$index(node), value); |
| 8162 return value; | 8173 return value; |
| 8163 } | 8174 } |
| 8164 SsaBuilder.prototype.visitVariableDefinitions = function(node) { | 8175 SsaBuilder.prototype.visitVariableDefinitions = function(node) { |
| 8165 var $0; | 8176 var $0; |
| 8166 for (var link = node.definitions.nodes; | 8177 for (var link = node.definitions.nodes; |
| 8167 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { | 8178 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ Node())) { |
| 8168 var definition = (($0 = link.get$head()) && $0.is$Node()); | 8179 var definition = (($0 = link.get$head()) && $0.is$Node()); |
| 8169 if ($notnull_bool((definition instanceof Identifier))) { | 8180 if ((definition instanceof Identifier)) { |
| 8170 this.compiler.unimplemented("SsaBuilder.visitVariableDefinitions without i nitial value"); | 8181 this.compiler.unimplemented("SsaBuilder.visitVariableDefinitions without i nitial value"); |
| 8171 } | 8182 } |
| 8172 else { | 8183 else { |
| 8173 $assert((definition instanceof SendSet), "definition is SendSet", "builder .dart", 472, 16); | 8184 $assert((definition instanceof SendSet), "definition is SendSet", "builder .dart", 472, 16); |
| 8174 this.updateDefinition((definition && definition.is$SendSet())); | 8185 this.updateDefinition((definition && definition.is$SendSet())); |
| 8175 } | 8186 } |
| 8176 } | 8187 } |
| 8177 } | 8188 } |
| 8178 // ********** Code for SsaCodeGeneratorTask ************** | 8189 // ********** Code for SsaCodeGeneratorTask ************** |
| 8179 function SsaCodeGeneratorTask(compiler) { | 8190 function SsaCodeGeneratorTask(compiler) { |
| 8180 CompilerTask.call(this, compiler); | 8191 CompilerTask.call(this, compiler); |
| 8181 // Initializers done | 8192 // Initializers done |
| 8182 } | 8193 } |
| 8183 $inherits(SsaCodeGeneratorTask, CompilerTask); | 8194 $inherits(SsaCodeGeneratorTask, CompilerTask); |
| 8184 SsaCodeGeneratorTask.prototype.get$name = function() { | 8195 SsaCodeGeneratorTask.prototype.get$name = function() { |
| 8185 return 'SSA code generator'; | 8196 return 'SSA code generator'; |
| 8186 } | 8197 } |
| 8187 SsaCodeGeneratorTask.prototype.generate = function(tree, graph) { | 8198 SsaCodeGeneratorTask.prototype.generate = function(tree, graph) { |
| 8188 var $this = this; // closure support | 8199 var $this = this; // closure support |
| 8189 return $assert_String(this.measure((function () { | 8200 return $assert_String(this.measure((function () { |
| 8190 var $0; | 8201 var $0; |
| 8191 var function_ = (tree && tree.is$FunctionExpression()); | 8202 var function_ = (tree && tree.is$FunctionExpression()); |
| 8192 var name = (($0 = function_.name) && $0.is$Identifier()); | 8203 var name = (($0 = function_.name) && $0.is$Identifier()); |
| 8193 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) { | 8204 if (false/*null.GENERATE_SSA_TRACE*/) { |
| 8194 HTracer.HTracer$singleton$factory().traceGraph("codegen", graph); | 8205 HTracer.HTracer$singleton$factory().traceGraph("codegen", graph); |
| 8195 } | 8206 } |
| 8196 var code = $this.generateMethod(name.get$source(), SsaCodeGeneratorTask.coun tParameters(function_), graph); | 8207 var code = $this.generateMethod(name.get$source(), SsaCodeGeneratorTask.coun tParameters(function_), graph); |
| 8197 return code; | 8208 return code; |
| 8198 }) | 8209 }) |
| 8199 )); | 8210 )); |
| 8200 } | 8211 } |
| 8201 SsaCodeGeneratorTask.prototype.generateMethod = function(methodName, parameterCo unt, graph) { | 8212 SsaCodeGeneratorTask.prototype.generateMethod = function(methodName, parameterCo unt, graph) { |
| 8202 var buffer = new StringBufferImpl(""); | 8213 var buffer = new StringBufferImpl(""); |
| 8203 var codegen = new SsaCodeGenerator(this.compiler, buffer); | 8214 var codegen = new SsaCodeGenerator(this.compiler, buffer); |
| 8204 graph.assignInstructionIds(); | 8215 graph.assignInstructionIds(); |
| 8205 codegen.visitGraph(graph); | 8216 codegen.visitGraph(graph); |
| 8206 var parameters = new StringBufferImpl(""); | 8217 var parameters = new StringBufferImpl(""); |
| 8207 for (var i = 0; | 8218 for (var i = 0; |
| 8208 $notnull_bool(i < parameterCount); i++) { | 8219 i < parameterCount; i++) { |
| 8209 if ($notnull_bool(i != 0)) parameters.add(', '); | 8220 if (i != 0) parameters.add(', '); |
| 8210 parameters.add(SsaCodeGenerator.parameter(i)); | 8221 parameters.add(SsaCodeGenerator.parameter(i)); |
| 8211 } | 8222 } |
| 8212 return ('function ' + methodName + '(' + parameters + ') {\n' + buffer + '}\n' ); | 8223 return ('function ' + methodName + '(' + parameters + ') {\n' + buffer + '}\n' ); |
| 8213 } | 8224 } |
| 8214 SsaCodeGeneratorTask.countParameters = function(function_) { | 8225 SsaCodeGeneratorTask.countParameters = function(function_) { |
| 8215 var $0; | 8226 var $0; |
| 8216 var result = 0; | 8227 var result = 0; |
| 8217 for (var link = function_.parameters.nodes; | 8228 for (var link = function_.parameters.nodes; |
| 8218 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { | 8229 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ Node())) { |
| 8219 result++; | 8230 result++; |
| 8220 } | 8231 } |
| 8221 return result; | 8232 return result; |
| 8222 } | 8233 } |
| 8223 // ********** Code for SsaCodeGenerator ************** | 8234 // ********** Code for SsaCodeGenerator ************** |
| 8224 function SsaCodeGenerator(compiler, buffer) { | 8235 function SsaCodeGenerator(compiler, buffer) { |
| 8225 this.indent = 0 | 8236 this.indent = 0 |
| 8226 this.compiler = compiler; | 8237 this.compiler = compiler; |
| 8227 this.buffer = buffer; | 8238 this.buffer = buffer; |
| 8228 // Initializers done | 8239 // Initializers done |
| 8229 } | 8240 } |
| 8230 SsaCodeGenerator.prototype.visitGraph = function(graph) { | 8241 SsaCodeGenerator.prototype.visitGraph = function(graph) { |
| 8231 this.currentGraph = graph; | 8242 this.currentGraph = graph; |
| 8232 this.indent++; | 8243 this.indent++; |
| 8233 this.visitBasicBlock(graph.entry); | 8244 this.visitBasicBlock(graph.entry); |
| 8234 } | 8245 } |
| 8235 SsaCodeGenerator.temporary = function(instruction) { | 8246 SsaCodeGenerator.temporary = function(instruction) { |
| 8236 return ('t' + instruction.id + ''); | 8247 return ('t' + instruction.id + ''); |
| 8237 } | 8248 } |
| 8238 SsaCodeGenerator.parameter = function(index) { | 8249 SsaCodeGenerator.parameter = function(index) { |
| 8239 return ('p' + index + ''); | 8250 return ('p' + index + ''); |
| 8240 } | 8251 } |
| 8241 SsaCodeGenerator.prototype.invoke = function(selector, arguments) { | 8252 SsaCodeGenerator.prototype.invoke = function(selector, arguments) { |
| 8242 var $0; | 8253 var $0; |
| 8243 this.buffer.add(('' + selector + '(')); | 8254 this.buffer.add(('' + selector + '(')); |
| 8244 for (var i = 0; | 8255 for (var i = 0; |
| 8245 $notnull_bool(i < arguments.length); i++) { | 8256 i < arguments.length; i++) { |
| 8246 if ($notnull_bool(i != 0)) this.buffer.add(', '); | 8257 if (i != 0) this.buffer.add(', '); |
| 8247 this.use((($0 = arguments.$index(i)) && $0.is$HInstruction())); | 8258 this.use((($0 = arguments.$index(i)) && $0.is$HInstruction())); |
| 8248 } | 8259 } |
| 8249 this.buffer.add(")"); | 8260 this.buffer.add(")"); |
| 8250 } | 8261 } |
| 8251 SsaCodeGenerator.prototype.define = function(instruction) { | 8262 SsaCodeGenerator.prototype.define = function(instruction) { |
| 8252 var $0; | 8263 var $0; |
| 8253 var usedBy = instruction.get$usedBy(); | 8264 var usedBy = instruction.get$usedBy(); |
| 8254 if ($notnull_bool(usedBy.length == 1 && (usedBy.$index(0) instanceof HPhi))) { | 8265 if (usedBy.length == 1 && (usedBy.$index(0) instanceof HPhi)) { |
| 8255 this.buffer.add(('var ' + SsaCodeGenerator.temporary((($0 = usedBy.$index(0) ) && $0.is$HInstruction())) + ' = ')); | 8266 this.buffer.add(('var ' + SsaCodeGenerator.temporary((($0 = usedBy.$index(0) ) && $0.is$HInstruction())) + ' = ')); |
| 8256 this.visit(instruction); | 8267 this.visit(instruction); |
| 8257 } | 8268 } |
| 8258 else { | 8269 else { |
| 8259 var instructionId = SsaCodeGenerator.temporary(instruction); | 8270 var instructionId = SsaCodeGenerator.temporary(instruction); |
| 8260 this.buffer.add(('var ' + instructionId + ' = ')); | 8271 this.buffer.add(('var ' + instructionId + ' = ')); |
| 8261 this.visit(instruction); | 8272 this.visit(instruction); |
| 8262 for (var i = 0; | 8273 for (var i = 0; |
| 8263 $notnull_bool(i < usedBy.length); i++) { | 8274 i < usedBy.length; i++) { |
| 8264 if ($notnull_bool((usedBy.$index(i) instanceof HPhi))) { | 8275 if ((usedBy.$index(i) instanceof HPhi)) { |
| 8265 this.buffer.add(';\n'); | 8276 this.buffer.add(';\n'); |
| 8266 this.addIndentation(); | 8277 this.addIndentation(); |
| 8267 this.buffer.add(('var ' + SsaCodeGenerator.temporary((($0 = usedBy.$inde x(i)) && $0.is$HInstruction())) + ' = ' + instructionId + '')); | 8278 this.buffer.add(('var ' + SsaCodeGenerator.temporary((($0 = usedBy.$inde x(i)) && $0.is$HInstruction())) + ' = ' + instructionId + '')); |
| 8268 } | 8279 } |
| 8269 } | 8280 } |
| 8270 } | 8281 } |
| 8271 } | 8282 } |
| 8272 SsaCodeGenerator.prototype.use = function(argument) { | 8283 SsaCodeGenerator.prototype.use = function(argument) { |
| 8273 if ($notnull_bool(argument.generateAtUseSite())) { | 8284 if ($notnull_bool(argument.generateAtUseSite())) { |
| 8274 this.visit(argument); | 8285 this.visit(argument); |
| 8275 } | 8286 } |
| 8276 else { | 8287 else { |
| 8277 this.buffer.add(SsaCodeGenerator.temporary(argument)); | 8288 this.buffer.add(SsaCodeGenerator.temporary(argument)); |
| 8278 } | 8289 } |
| 8279 } | 8290 } |
| 8280 SsaCodeGenerator.prototype.visit = function(node) { | 8291 SsaCodeGenerator.prototype.visit = function(node) { |
| 8281 return node.accept(this); | 8292 return node.accept(this); |
| 8282 } | 8293 } |
| 8283 SsaCodeGenerator.prototype.visitAdd = function(node) { | 8294 SsaCodeGenerator.prototype.visitAdd = function(node) { |
| 8284 this.invoke(const$274/*const SourceString('\$add')*/, node.inputs); | 8295 this.invoke(const$274/*const SourceString('\$add')*/, node.inputs); |
| 8285 } | 8296 } |
| 8286 SsaCodeGenerator.prototype.visitBasicBlock = function(node) { | 8297 SsaCodeGenerator.prototype.visitBasicBlock = function(node) { |
| 8287 if ($notnull_bool(node.isLoopHeader)) { | 8298 if ($notnull_bool(node.isLoopHeader)) { |
| 8288 this.buffer.add('while(true) {\n'); | 8299 this.buffer.add('while(true) {\n'); |
| 8289 this.indent++; | 8300 this.indent++; |
| 8290 } | 8301 } |
| 8291 this.currentBlock = node; | 8302 this.currentBlock = node; |
| 8292 var instruction = node.first; | 8303 var instruction = node.first; |
| 8293 while ($notnull_bool(instruction != null)) { | 8304 while (instruction != null) { |
| 8294 if ($notnull_bool(!$notnull_bool(instruction.generateAtUseSite()))) { | 8305 if (!$notnull_bool(instruction.generateAtUseSite())) { |
| 8295 this.addIndentation(); | 8306 this.addIndentation(); |
| 8296 if ($notnull_bool(instruction.get$usedBy().isEmpty() || (instruction insta nceof HPhi))) { | 8307 if (instruction.get$usedBy().isEmpty() || (instruction instanceof HPhi)) { |
| 8297 this.visit(instruction); | 8308 this.visit(instruction); |
| 8298 } | 8309 } |
| 8299 else { | 8310 else { |
| 8300 this.define(instruction); | 8311 this.define(instruction); |
| 8301 } | 8312 } |
| 8302 this.buffer.add(';\n'); | 8313 this.buffer.add(';\n'); |
| 8303 } | 8314 } |
| 8304 instruction = instruction.next; | 8315 instruction = instruction.next; |
| 8305 } | 8316 } |
| 8306 } | 8317 } |
| 8307 SsaCodeGenerator.prototype.visitDivide = function(node) { | 8318 SsaCodeGenerator.prototype.visitDivide = function(node) { |
| 8308 this.invoke(const$276/*const SourceString('\$div')*/, node.inputs); | 8319 this.invoke(const$276/*const SourceString('\$div')*/, node.inputs); |
| 8309 } | 8320 } |
| 8310 SsaCodeGenerator.prototype.visitEquals = function(node) { | 8321 SsaCodeGenerator.prototype.visitEquals = function(node) { |
| 8311 this.invoke(const$277/*const SourceString('\$eq')*/, node.inputs); | 8322 this.invoke(const$277/*const SourceString('\$eq')*/, node.inputs); |
| 8312 } | 8323 } |
| 8313 SsaCodeGenerator.prototype.visitExit = function(node) { | 8324 SsaCodeGenerator.prototype.visitExit = function(node) { |
| 8314 | 8325 |
| 8315 } | 8326 } |
| 8316 SsaCodeGenerator.prototype.visitGoto = function(node) { | 8327 SsaCodeGenerator.prototype.visitGoto = function(node) { |
| 8317 var $0; | 8328 var $0; |
| 8318 $assert(this.currentBlock.successors.length == 1, "currentBlock.successors.len gth == 1", "codegen.dart", 155, 12); | 8329 $assert(this.currentBlock.successors.length == 1, "currentBlock.successors.len gth == 1", "codegen.dart", 155, 12); |
| 8319 var dominated = this.currentBlock.dominatedBlocks; | 8330 var dominated = this.currentBlock.dominatedBlocks; |
| 8320 if ($notnull_bool(dominated.isEmpty())) return; | 8331 if (dominated.isEmpty()) return; |
| 8321 if ($notnull_bool(dominated.length > 2)) unreachable(); | 8332 if (dominated.length > 2) unreachable(); |
| 8322 if ($notnull_bool(dominated.length == 2 && this.currentBlock !== this.currentG raph.entry)) { | 8333 if (dominated.length == 2 && this.currentBlock !== this.currentGraph.entry) { |
| 8323 unreachable(); | 8334 unreachable(); |
| 8324 } | 8335 } |
| 8325 $assert($eq(dominated.$index(0), this.currentBlock.successors.$index(0)), "dom inated[0] == currentBlock.successors[0]", "codegen.dart", 167, 12); | 8336 $assert($eq(dominated.$index(0), this.currentBlock.successors.$index(0)), "dom inated[0] == currentBlock.successors[0]", "codegen.dart", 167, 12); |
| 8326 this.visitBasicBlock((($0 = dominated.$index(0)) && $0.is$HBasicBlock())); | 8337 this.visitBasicBlock((($0 = dominated.$index(0)) && $0.is$HBasicBlock())); |
| 8327 } | 8338 } |
| 8328 SsaCodeGenerator.prototype.visitIf = function(node) { | 8339 SsaCodeGenerator.prototype.visitIf = function(node) { |
| 8329 var $0; | 8340 var $0; |
| 8330 var ifBlock = this.currentBlock; | 8341 var ifBlock = this.currentBlock; |
| 8331 this.buffer.add('if ('); | 8342 this.buffer.add('if ('); |
| 8332 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); | 8343 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 8346 this.indent--; | 8357 this.indent--; |
| 8347 nextDominatedIndex = 2; | 8358 nextDominatedIndex = 2; |
| 8348 this.addIndentation(); | 8359 this.addIndentation(); |
| 8349 this.buffer.add("}\n"); | 8360 this.buffer.add("}\n"); |
| 8350 } | 8361 } |
| 8351 else { | 8362 else { |
| 8352 this.buffer.add("}\n"); | 8363 this.buffer.add("}\n"); |
| 8353 nextDominatedIndex = 1; | 8364 nextDominatedIndex = 1; |
| 8354 } | 8365 } |
| 8355 $assert(dominated.length <= nextDominatedIndex + 1, "dominated.length <= nextD ominatedIndex + 1", "codegen.dart", 198, 12); | 8366 $assert(dominated.length <= nextDominatedIndex + 1, "dominated.length <= nextD ominatedIndex + 1", "codegen.dart", 198, 12); |
| 8356 if ($notnull_bool(dominated.length == nextDominatedIndex + 1)) { | 8367 if (dominated.length == nextDominatedIndex + 1) { |
| 8357 this.visitBasicBlock((($0 = dominated.$index(nextDominatedIndex)) && $0.is$H BasicBlock())); | 8368 this.visitBasicBlock((($0 = dominated.$index(nextDominatedIndex)) && $0.is$H BasicBlock())); |
| 8358 } | 8369 } |
| 8359 } | 8370 } |
| 8360 SsaCodeGenerator.prototype.visitInvoke = function(node) { | 8371 SsaCodeGenerator.prototype.visitInvoke = function(node) { |
| 8361 this.compiler.worklist.add(node.selector); | 8372 this.compiler.worklist.add(node.selector); |
| 8362 this.invoke(node.selector, node.inputs); | 8373 this.invoke(node.selector, node.inputs); |
| 8363 } | 8374 } |
| 8364 SsaCodeGenerator.prototype.visitInvokeForeign = function(node) { | 8375 SsaCodeGenerator.prototype.visitInvokeForeign = function(node) { |
| 8365 var $0; | 8376 var $0; |
| 8366 for (var i = 0; | 8377 for (var i = 0; |
| 8367 $notnull_bool(i < node.inputs.length); i++) { | 8378 i < node.inputs.length; i++) { |
| 8368 this.buffer.add(('var \$' + i + ' = ')); | 8379 this.buffer.add(('var \$' + i + ' = ')); |
| 8369 this.use((($0 = node.inputs.$index(i)) && $0.is$HInstruction())); | 8380 this.use((($0 = node.inputs.$index(i)) && $0.is$HInstruction())); |
| 8370 this.buffer.add(';\n'); | 8381 this.buffer.add(';\n'); |
| 8371 } | 8382 } |
| 8372 this.addIndentation(); | 8383 this.addIndentation(); |
| 8373 this.buffer.add(node.selector); | 8384 this.buffer.add(node.selector); |
| 8374 } | 8385 } |
| 8375 SsaCodeGenerator.prototype.visitLiteral = function(node) { | 8386 SsaCodeGenerator.prototype.visitLiteral = function(node) { |
| 8376 this.buffer.add(node.value); | 8387 this.buffer.add(node.value); |
| 8377 } | 8388 } |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 8395 this.invoke(const$278/*const SourceString('\$mul')*/, node.inputs); | 8406 this.invoke(const$278/*const SourceString('\$mul')*/, node.inputs); |
| 8396 } | 8407 } |
| 8397 SsaCodeGenerator.prototype.visitParameter = function(node) { | 8408 SsaCodeGenerator.prototype.visitParameter = function(node) { |
| 8398 this.buffer.add(SsaCodeGenerator.parameter(node.parameterIndex)); | 8409 this.buffer.add(SsaCodeGenerator.parameter(node.parameterIndex)); |
| 8399 } | 8410 } |
| 8400 SsaCodeGenerator.prototype.visitPhi = function(node) { | 8411 SsaCodeGenerator.prototype.visitPhi = function(node) { |
| 8401 var $0; | 8412 var $0; |
| 8402 var usedBy = node.get$usedBy(); | 8413 var usedBy = node.get$usedBy(); |
| 8403 var firstPhi = true; | 8414 var firstPhi = true; |
| 8404 for (var i = 0; | 8415 for (var i = 0; |
| 8405 $notnull_bool(i < usedBy.length); i++) { | 8416 i < usedBy.length; i++) { |
| 8406 if ($notnull_bool((usedBy.$index(i) instanceof HPhi))) { | 8417 if ((usedBy.$index(i) instanceof HPhi)) { |
| 8407 if ($notnull_bool(!$notnull_bool(firstPhi))) { | 8418 if (!$notnull_bool(firstPhi)) { |
| 8408 this.buffer.add(";\n"); | 8419 this.buffer.add(";\n"); |
| 8409 this.addIndentation(); | 8420 this.addIndentation(); |
| 8410 } | 8421 } |
| 8411 this.buffer.add(("var " + SsaCodeGenerator.temporary((($0 = usedBy.$index( i)) && $0.is$HInstruction())) + " = " + SsaCodeGenerator.temporary(node) + "")); | 8422 this.buffer.add(("var " + SsaCodeGenerator.temporary((($0 = usedBy.$index( i)) && $0.is$HInstruction())) + " = " + SsaCodeGenerator.temporary(node) + "")); |
| 8412 firstPhi = false; | 8423 firstPhi = false; |
| 8413 } | 8424 } |
| 8414 } | 8425 } |
| 8415 } | 8426 } |
| 8416 SsaCodeGenerator.prototype.visitReturn = function(node) { | 8427 SsaCodeGenerator.prototype.visitReturn = function(node) { |
| 8417 var $0; | 8428 var $0; |
| 8418 this.buffer.add('return '); | 8429 this.buffer.add('return '); |
| 8419 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); | 8430 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); |
| 8420 } | 8431 } |
| 8421 SsaCodeGenerator.prototype.visitSubtract = function(node) { | 8432 SsaCodeGenerator.prototype.visitSubtract = function(node) { |
| 8422 this.invoke(const$279/*const SourceString('\$sub')*/, node.inputs); | 8433 this.invoke(const$279/*const SourceString('\$sub')*/, node.inputs); |
| 8423 } | 8434 } |
| 8424 SsaCodeGenerator.prototype.visitThrow = function(node) { | 8435 SsaCodeGenerator.prototype.visitThrow = function(node) { |
| 8425 var $0; | 8436 var $0; |
| 8426 this.buffer.add('throw '); | 8437 this.buffer.add('throw '); |
| 8427 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); | 8438 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); |
| 8428 } | 8439 } |
| 8429 SsaCodeGenerator.prototype.visitTruncatingDivide = function(node) { | 8440 SsaCodeGenerator.prototype.visitTruncatingDivide = function(node) { |
| 8430 this.invoke(const$280/*const SourceString('\$tdiv')*/, node.inputs); | 8441 this.invoke(const$280/*const SourceString('\$tdiv')*/, node.inputs); |
| 8431 } | 8442 } |
| 8432 SsaCodeGenerator.prototype.addIndentation = function() { | 8443 SsaCodeGenerator.prototype.addIndentation = function() { |
| 8433 for (var i = 0; | 8444 for (var i = 0; |
| 8434 $notnull_bool(i < this.indent); i++) { | 8445 i < this.indent; i++) { |
| 8435 this.buffer.add(' '); | 8446 this.buffer.add(' '); |
| 8436 } | 8447 } |
| 8437 } | 8448 } |
| 8438 // ********** Code for HGraphVisitor ************** | 8449 // ********** Code for HGraphVisitor ************** |
| 8439 function HGraphVisitor() { | 8450 function HGraphVisitor() { |
| 8440 // Initializers done | 8451 // Initializers done |
| 8441 } | 8452 } |
| 8442 HGraphVisitor.prototype.visitDominatorTree = function(graph) { | 8453 HGraphVisitor.prototype.visitDominatorTree = function(graph) { |
| 8443 var $this = this; // closure support | 8454 var $this = this; // closure support |
| 8444 function visitBasicBlockAndSuccessors(block) { | 8455 function visitBasicBlockAndSuccessors(block) { |
| 8445 var $0; | 8456 var $0; |
| 8446 $this.visitBasicBlock(block); | 8457 $this.visitBasicBlock(block); |
| 8447 var dominated = block.dominatedBlocks; | 8458 var dominated = block.dominatedBlocks; |
| 8448 for (var i = 0; | 8459 for (var i = 0; |
| 8449 $notnull_bool(i < dominated.length); i++) { | 8460 i < dominated.length; i++) { |
| 8450 visitBasicBlockAndSuccessors((($0 = dominated.$index(i)) && $0.is$HBasicBl ock())); | 8461 visitBasicBlockAndSuccessors((($0 = dominated.$index(i)) && $0.is$HBasicBl ock())); |
| 8451 } | 8462 } |
| 8452 } | 8463 } |
| 8453 visitBasicBlockAndSuccessors(graph.entry); | 8464 visitBasicBlockAndSuccessors(graph.entry); |
| 8454 } | 8465 } |
| 8455 HGraphVisitor.prototype.visitPostDominatorTree = function(graph) { | 8466 HGraphVisitor.prototype.visitPostDominatorTree = function(graph) { |
| 8456 var $this = this; // closure support | 8467 var $this = this; // closure support |
| 8457 function visitBasicBlockAndSuccessors(block) { | 8468 function visitBasicBlockAndSuccessors(block) { |
| 8458 var $0; | 8469 var $0; |
| 8459 var dominated = block.dominatedBlocks; | 8470 var dominated = block.dominatedBlocks; |
| 8460 for (var i = dominated.length - 1; | 8471 for (var i = dominated.length - 1; |
| 8461 $notnull_bool(i >= 0); i--) { | 8472 i >= 0; i--) { |
| 8462 visitBasicBlockAndSuccessors((($0 = dominated.$index(i)) && $0.is$HBasicBl ock())); | 8473 visitBasicBlockAndSuccessors((($0 = dominated.$index(i)) && $0.is$HBasicBl ock())); |
| 8463 } | 8474 } |
| 8464 $this.visitBasicBlock(block); | 8475 $this.visitBasicBlock(block); |
| 8465 } | 8476 } |
| 8466 visitBasicBlockAndSuccessors(graph.entry); | 8477 visitBasicBlockAndSuccessors(graph.entry); |
| 8467 } | 8478 } |
| 8468 // ********** Code for HInstructionVisitor ************** | 8479 // ********** Code for HInstructionVisitor ************** |
| 8469 function HInstructionVisitor() { | 8480 function HInstructionVisitor() { |
| 8470 HGraphVisitor.call(this); | 8481 HGraphVisitor.call(this); |
| 8471 // Initializers done | 8482 // Initializers done |
| 8472 } | 8483 } |
| 8473 $inherits(HInstructionVisitor, HGraphVisitor); | 8484 $inherits(HInstructionVisitor, HGraphVisitor); |
| 8474 HInstructionVisitor.prototype.visitBasicBlock = function(node) { | 8485 HInstructionVisitor.prototype.visitBasicBlock = function(node) { |
| 8475 this.currentBlock = node; | 8486 this.currentBlock = node; |
| 8476 var instruction = node.first; | 8487 var instruction = node.first; |
| 8477 while ($notnull_bool(instruction != null)) { | 8488 while (instruction != null) { |
| 8478 this.visitInstruction(instruction); | 8489 this.visitInstruction(instruction); |
| 8479 instruction = instruction.next; | 8490 instruction = instruction.next; |
| 8480 } | 8491 } |
| 8481 } | 8492 } |
| 8482 // ********** Code for HGraph ************** | 8493 // ********** Code for HGraph ************** |
| 8483 function HGraph() { | 8494 function HGraph() { |
| 8484 this.blocks = new ListFactory$HBasicBlock(); | 8495 this.blocks = new ListFactory$HBasicBlock(); |
| 8485 // Initializers done | 8496 // Initializers done |
| 8486 this.entry = this.addNewBlock(); | 8497 this.entry = this.addNewBlock(); |
| 8487 this.exit = new HBasicBlock(); | 8498 this.exit = new HBasicBlock(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 8500 } | 8511 } |
| 8501 HGraph.prototype.finalize = function() { | 8512 HGraph.prototype.finalize = function() { |
| 8502 this.addBlock(this.exit); | 8513 this.addBlock(this.exit); |
| 8503 this.exit.open(); | 8514 this.exit.open(); |
| 8504 this.exit.close(new HExit()); | 8515 this.exit.close(new HExit()); |
| 8505 this.assignDominators(); | 8516 this.assignDominators(); |
| 8506 } | 8517 } |
| 8507 HGraph.prototype.assignDominators = function() { | 8518 HGraph.prototype.assignDominators = function() { |
| 8508 var $0; | 8519 var $0; |
| 8509 for (var i = 0, length = this.blocks.length; | 8520 for (var i = 0, length = this.blocks.length; |
| 8510 $notnull_bool(i < length); i++) { | 8521 i < length; i++) { |
| 8511 var block = (($0 = this.blocks.$index(i)) && $0.is$HBasicBlock()); | 8522 var block = (($0 = this.blocks.$index(i)) && $0.is$HBasicBlock()); |
| 8512 var predecessors = block.predecessors; | 8523 var predecessors = block.predecessors; |
| 8513 if ($notnull_bool(block.isLoopHeader)) { | 8524 if ($notnull_bool(block.isLoopHeader)) { |
| 8514 $assert(predecessors.length >= 2, "predecessors.length >= 2", "nodes.dart" , 109, 16); | 8525 $assert(predecessors.length >= 2, "predecessors.length >= 2", "nodes.dart" , 109, 16); |
| 8515 block.assignCommonDominator((($0 = predecessors.$index(0)) && $0.is$HBasic Block())); | 8526 block.assignCommonDominator((($0 = predecessors.$index(0)) && $0.is$HBasic Block())); |
| 8516 } | 8527 } |
| 8517 else { | 8528 else { |
| 8518 for (var j = predecessors.length - 1; | 8529 for (var j = predecessors.length - 1; |
| 8519 $notnull_bool(j >= 0); j--) { | 8530 j >= 0; j--) { |
| 8520 block.assignCommonDominator((($0 = predecessors.$index(j)) && $0.is$HBas icBlock())); | 8531 block.assignCommonDominator((($0 = predecessors.$index(j)) && $0.is$HBas icBlock())); |
| 8521 } | 8532 } |
| 8522 } | 8533 } |
| 8523 } | 8534 } |
| 8524 } | 8535 } |
| 8525 HGraph.prototype.assignInstructionIds = function() { | 8536 HGraph.prototype.assignInstructionIds = function() { |
| 8526 function handleDominatorTree(root, id) { | 8537 function handleDominatorTree(root, id) { |
| 8527 var $0; | 8538 var $0; |
| 8528 id = root.assignInstructionIds(id); | 8539 id = root.assignInstructionIds(id); |
| 8529 var dominatedBlocks = root.dominatedBlocks; | 8540 var dominatedBlocks = root.dominatedBlocks; |
| 8530 for (var i = 0, length = dominatedBlocks.length; | 8541 for (var i = 0, length = dominatedBlocks.length; |
| 8531 $notnull_bool(i < length); i++) { | 8542 i < length; i++) { |
| 8532 id = handleDominatorTree((($0 = dominatedBlocks.$index(i)) && $0.is$HBasic Block()), id); | 8543 id = handleDominatorTree((($0 = dominatedBlocks.$index(i)) && $0.is$HBasic Block()), id); |
| 8533 } | 8544 } |
| 8534 return id; | 8545 return id; |
| 8535 } | 8546 } |
| 8536 handleDominatorTree(this.entry, 0); | 8547 handleDominatorTree(this.entry, 0); |
| 8537 } | 8548 } |
| 8538 HGraph.prototype.isValid = function() { | 8549 HGraph.prototype.isValid = function() { |
| 8539 var validator = new HValidator(); | 8550 var validator = new HValidator(); |
| 8540 validator.visitGraph(this); | 8551 validator.visitGraph(this); |
| 8541 return validator.isValid; | 8552 return validator.isValid; |
| 8542 } | 8553 } |
| 8543 // ********** Code for HBaseVisitor ************** | 8554 // ********** Code for HBaseVisitor ************** |
| 8544 function HBaseVisitor() { | 8555 function HBaseVisitor() { |
| 8545 HGraphVisitor.call(this); | 8556 HGraphVisitor.call(this); |
| 8546 // Initializers done | 8557 // Initializers done |
| 8547 } | 8558 } |
| 8548 $inherits(HBaseVisitor, HGraphVisitor); | 8559 $inherits(HBaseVisitor, HGraphVisitor); |
| 8549 HBaseVisitor.prototype.visitBasicBlock = function(node) { | 8560 HBaseVisitor.prototype.visitBasicBlock = function(node) { |
| 8550 this.currentBlock = node; | 8561 this.currentBlock = node; |
| 8551 var instruction = node.first; | 8562 var instruction = node.first; |
| 8552 while ($notnull_bool(instruction != null)) { | 8563 while (instruction != null) { |
| 8553 instruction.accept(this); | 8564 instruction.accept(this); |
| 8554 instruction = instruction.next; | 8565 instruction = instruction.next; |
| 8555 } | 8566 } |
| 8556 } | 8567 } |
| 8557 HBaseVisitor.prototype.visitInstruction = function(HInstruction) { | 8568 HBaseVisitor.prototype.visitInstruction = function(HInstruction) { |
| 8558 | 8569 |
| 8559 } | 8570 } |
| 8560 HBaseVisitor.prototype.visitArithmetic = function(node) { | 8571 HBaseVisitor.prototype.visitArithmetic = function(node) { |
| 8561 return this.visitInvoke(node); | 8572 return this.visitInvoke(node); |
| 8562 } | 8573 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8654 $assert(this.isNew(), "isNew()", "nodes.dart", 205, 12); | 8665 $assert(this.isNew(), "isNew()", "nodes.dart", 205, 12); |
| 8655 this.status = 1/*HBasicBlock.STATUS_OPEN*/; | 8666 this.status = 1/*HBasicBlock.STATUS_OPEN*/; |
| 8656 } | 8667 } |
| 8657 HBasicBlock.prototype.close = function(end) { | 8668 HBasicBlock.prototype.close = function(end) { |
| 8658 $assert(this.isOpen(), "isOpen()", "nodes.dart", 210, 12); | 8669 $assert(this.isOpen(), "isOpen()", "nodes.dart", 210, 12); |
| 8659 this.addAfter(this.last, end); | 8670 this.addAfter(this.last, end); |
| 8660 this.status = 2/*HBasicBlock.STATUS_CLOSED*/; | 8671 this.status = 2/*HBasicBlock.STATUS_CLOSED*/; |
| 8661 } | 8672 } |
| 8662 HBasicBlock.prototype.assignInstructionIds = function(id) { | 8673 HBasicBlock.prototype.assignInstructionIds = function(id) { |
| 8663 var instruction = this.first; | 8674 var instruction = this.first; |
| 8664 while ($notnull_bool(instruction != null)) { | 8675 while (instruction != null) { |
| 8665 instruction.id = id++; | 8676 instruction.id = id++; |
| 8666 instruction = instruction.next; | 8677 instruction = instruction.next; |
| 8667 } | 8678 } |
| 8668 return id; | 8679 return id; |
| 8669 } | 8680 } |
| 8670 HBasicBlock.prototype.accept = function(visitor) { | 8681 HBasicBlock.prototype.accept = function(visitor) { |
| 8671 return visitor.visitBasicBlock(this); | 8682 return visitor.visitBasicBlock(this); |
| 8672 } | 8683 } |
| 8673 HBasicBlock.prototype.add = function(instruction) { | 8684 HBasicBlock.prototype.add = function(instruction) { |
| 8674 $assert(!(instruction instanceof HControlFlow), "instruction is !HControlFlow" , "nodes.dart", 238, 12); | 8685 $assert(!(instruction instanceof HControlFlow), "instruction is !HControlFlow" , "nodes.dart", 238, 12); |
| 8675 this.addAfter(this.last, instruction); | 8686 this.addAfter(this.last, instruction); |
| 8676 } | 8687 } |
| 8677 HBasicBlock.prototype.addSuccessor = function(block) { | 8688 HBasicBlock.prototype.addSuccessor = function(block) { |
| 8678 $assert($notnull_bool(this.isClosed() && ($notnull_bool(block.isNew() || block .id < this.id))), "isClosed() && (block.isNew() || block.id < id)", "nodes.dart" , 244, 12); | 8689 $assert($notnull_bool(this.isClosed() && ($notnull_bool(block.isNew() || block .id < this.id))), "isClosed() && (block.isNew() || block.id < id)", "nodes.dart" , 244, 12); |
| 8679 if ($notnull_bool(this.successors.isEmpty())) { | 8690 if (this.successors.isEmpty()) { |
| 8680 this.successors = [block]; | 8691 this.successors = [block]; |
| 8681 } | 8692 } |
| 8682 else { | 8693 else { |
| 8683 this.successors.add(block); | 8694 this.successors.add(block); |
| 8684 } | 8695 } |
| 8685 block.predecessors.add(this); | 8696 block.predecessors.add(this); |
| 8686 } | 8697 } |
| 8687 HBasicBlock.prototype.addAfter = function(cursor, instruction) { | 8698 HBasicBlock.prototype.addAfter = function(cursor, instruction) { |
| 8688 $assert($notnull_bool(this.isOpen() || this.isClosed()), "isOpen() || isClosed ()", "nodes.dart", 254, 12); | 8699 $assert($notnull_bool(this.isOpen() || this.isClosed()), "isOpen() || isClosed ()", "nodes.dart", 254, 12); |
| 8689 if ($notnull_bool(cursor == null)) { | 8700 if (cursor == null) { |
| 8690 this.first = this.last = instruction; | 8701 this.first = this.last = instruction; |
| 8691 } | 8702 } |
| 8692 else if ($notnull_bool(cursor === this.last)) { | 8703 else if (cursor === this.last) { |
| 8693 this.last.next = instruction; | 8704 this.last.next = instruction; |
| 8694 instruction.previous = this.last; | 8705 instruction.previous = this.last; |
| 8695 this.last = instruction; | 8706 this.last = instruction; |
| 8696 } | 8707 } |
| 8697 else { | 8708 else { |
| 8698 instruction.previous = cursor; | 8709 instruction.previous = cursor; |
| 8699 instruction.next = cursor.next; | 8710 instruction.next = cursor.next; |
| 8700 cursor.next.previous = instruction; | 8711 cursor.next.previous = instruction; |
| 8701 cursor.next = instruction; | 8712 cursor.next = instruction; |
| 8702 } | 8713 } |
| 8703 instruction.notifyAddedToBlock(); | 8714 instruction.notifyAddedToBlock(); |
| 8704 } | 8715 } |
| 8705 HBasicBlock.prototype.remove = function(instruction) { | 8716 HBasicBlock.prototype.remove = function(instruction) { |
| 8706 $assert($notnull_bool(this.isOpen() || this.isClosed()), "isOpen() || isClosed ()", "nodes.dart", 271, 12); | 8717 $assert($notnull_bool(this.isOpen() || this.isClosed()), "isOpen() || isClosed ()", "nodes.dart", 271, 12); |
| 8707 $assert(instruction.isInBasicBlock(), "instruction.isInBasicBlock()", "nodes.d art", 272, 12); | 8718 $assert(instruction.isInBasicBlock(), "instruction.isInBasicBlock()", "nodes.d art", 272, 12); |
| 8708 $assert(instruction.get$usedBy().isEmpty(), "instruction.usedBy.isEmpty()", "n odes.dart", 273, 12); | 8719 $assert(instruction.get$usedBy().isEmpty(), "instruction.usedBy.isEmpty()", "n odes.dart", 273, 12); |
| 8709 if ($notnull_bool(instruction.previous == null)) { | 8720 if (instruction.previous == null) { |
| 8710 this.first = instruction.next; | 8721 this.first = instruction.next; |
| 8711 } | 8722 } |
| 8712 else { | 8723 else { |
| 8713 instruction.previous.next = instruction.next; | 8724 instruction.previous.next = instruction.next; |
| 8714 } | 8725 } |
| 8715 if ($notnull_bool(instruction.next == null)) { | 8726 if (instruction.next == null) { |
| 8716 this.last = instruction.previous; | 8727 this.last = instruction.previous; |
| 8717 } | 8728 } |
| 8718 else { | 8729 else { |
| 8719 instruction.next.previous = instruction.previous; | 8730 instruction.next.previous = instruction.previous; |
| 8720 } | 8731 } |
| 8721 instruction.notifyRemovedFromBlock(); | 8732 instruction.notifyRemovedFromBlock(); |
| 8722 } | 8733 } |
| 8723 HBasicBlock.prototype.rewrite = function(from, to) { | 8734 HBasicBlock.prototype.rewrite = function(from, to) { |
| 8724 var $list = from.get$usedBy(); | 8735 var $list = from.get$usedBy(); |
| 8725 for (var $i = 0;$i < $list.length; $i++) { | 8736 for (var $i = 0;$i < $list.length; $i++) { |
| 8726 var use = $list.$index($i); | 8737 var use = $list.$index($i); |
| 8727 HBasicBlock.rewriteInput(use, from, to); | 8738 HBasicBlock.rewriteInput(use, from, to); |
| 8728 } | 8739 } |
| 8729 to.get$usedBy().addAll(from.get$usedBy()); | 8740 to.get$usedBy().addAll(from.get$usedBy()); |
| 8730 from._usedBy = []; | 8741 from._usedBy = []; |
| 8731 } | 8742 } |
| 8732 HBasicBlock.rewriteInput = function(instruction, from, to) { | 8743 HBasicBlock.rewriteInput = function(instruction, from, to) { |
| 8733 var inputs = instruction.inputs; | 8744 var inputs = instruction.inputs; |
| 8734 for (var i = 0; | 8745 for (var i = 0; |
| 8735 $notnull_bool(i < inputs.length); i++) { | 8746 i < inputs.length; i++) { |
| 8736 if ($notnull_bool(inputs.$index(i) === from)) inputs.$setindex(i, to); | 8747 if (inputs.$index(i) === from) inputs.$setindex(i, to); |
| 8737 } | 8748 } |
| 8738 } | 8749 } |
| 8739 HBasicBlock.prototype.isExitBlock = function() { | 8750 HBasicBlock.prototype.isExitBlock = function() { |
| 8740 return $notnull_bool(this.first === this.last && (this.first instanceof HExit) ); | 8751 return this.first === this.last && (this.first instanceof HExit); |
| 8741 } | 8752 } |
| 8742 HBasicBlock.prototype.addDominatedBlock = function(block) { | 8753 HBasicBlock.prototype.addDominatedBlock = function(block) { |
| 8743 $assert(this.isClosed(), "isClosed()", "nodes.dart", 313, 12); | 8754 $assert(this.isClosed(), "isClosed()", "nodes.dart", 313, 12); |
| 8744 $assert($notnull_bool(this.id != null && block.id != null), "id !== null && bl ock.id !== null", "nodes.dart", 314, 12); | 8755 $assert(this.id != null && block.id != null, "id !== null && block.id !== null ", "nodes.dart", 314, 12); |
| 8745 $assert(this.dominatedBlocks.indexOf(block) < 0, "dominatedBlocks.indexOf(bloc k) < 0", "nodes.dart", 315, 12); | 8756 $assert(this.dominatedBlocks.indexOf(block) < 0, "dominatedBlocks.indexOf(bloc k) < 0", "nodes.dart", 315, 12); |
| 8746 var index = this.dominatedBlocks.length; | 8757 var index = this.dominatedBlocks.length; |
| 8747 while ($notnull_bool(index > 0 && this.dominatedBlocks.$index(index - 1).id > block.id)) { | 8758 while (index > 0 && this.dominatedBlocks.$index(index - 1).id > block.id) { |
| 8748 index--; | 8759 index--; |
| 8749 } | 8760 } |
| 8750 if ($notnull_bool(index == this.dominatedBlocks.length)) { | 8761 if (index == this.dominatedBlocks.length) { |
| 8751 this.dominatedBlocks.add(block); | 8762 this.dominatedBlocks.add(block); |
| 8752 } | 8763 } |
| 8753 else { | 8764 else { |
| 8754 this.dominatedBlocks.insertRange(index, 1, block); | 8765 this.dominatedBlocks.insertRange(index, 1, block); |
| 8755 } | 8766 } |
| 8756 $assert(block.dominator == null, "block.dominator === null", "nodes.dart", 328 , 12); | 8767 $assert(block.dominator == null, "block.dominator === null", "nodes.dart", 328 , 12); |
| 8757 block.dominator = this; | 8768 block.dominator = this; |
| 8758 } | 8769 } |
| 8759 HBasicBlock.prototype.removeDominatedBlock = function(block) { | 8770 HBasicBlock.prototype.removeDominatedBlock = function(block) { |
| 8760 $assert(this.isClosed(), "isClosed()", "nodes.dart", 333, 12); | 8771 $assert(this.isClosed(), "isClosed()", "nodes.dart", 333, 12); |
| 8761 $assert($notnull_bool(this.id != null && block.id != null), "id !== null && bl ock.id !== null", "nodes.dart", 334, 12); | 8772 $assert(this.id != null && block.id != null, "id !== null && block.id !== null ", "nodes.dart", 334, 12); |
| 8762 var index = this.dominatedBlocks.indexOf(block); | 8773 var index = this.dominatedBlocks.indexOf(block); |
| 8763 $assert(index >= 0, "index >= 0", "nodes.dart", 336, 12); | 8774 $assert(index >= 0, "index >= 0", "nodes.dart", 336, 12); |
| 8764 if ($notnull_bool(index == this.dominatedBlocks.length - 1)) { | 8775 if (index == this.dominatedBlocks.length - 1) { |
| 8765 this.dominatedBlocks.removeLast(); | 8776 this.dominatedBlocks.removeLast(); |
| 8766 } | 8777 } |
| 8767 else { | 8778 else { |
| 8768 this.dominatedBlocks.removeRange(index, 1); | 8779 this.dominatedBlocks.removeRange(index, 1); |
| 8769 } | 8780 } |
| 8770 $assert(block.dominator === this, "block.dominator === this", "nodes.dart", 34 2, 12); | 8781 $assert(block.dominator === this, "block.dominator === this", "nodes.dart", 34 2, 12); |
| 8771 block.dominator = null; | 8782 block.dominator = null; |
| 8772 } | 8783 } |
| 8773 HBasicBlock.prototype.assignCommonDominator = function(predecessor) { | 8784 HBasicBlock.prototype.assignCommonDominator = function(predecessor) { |
| 8774 $assert(this.isClosed(), "isClosed()", "nodes.dart", 347, 12); | 8785 $assert(this.isClosed(), "isClosed()", "nodes.dart", 347, 12); |
| 8775 if ($notnull_bool(this.dominator == null)) { | 8786 if (this.dominator == null) { |
| 8776 predecessor.addDominatedBlock(this); | 8787 predecessor.addDominatedBlock(this); |
| 8777 } | 8788 } |
| 8778 else if ($notnull_bool(predecessor.dominator != null)) { | 8789 else if (predecessor.dominator != null) { |
| 8779 var first = this.dominator; | 8790 var first = this.dominator; |
| 8780 var second = predecessor; | 8791 var second = predecessor; |
| 8781 while ($notnull_bool(first !== second)) { | 8792 while (first !== second) { |
| 8782 if ($notnull_bool(first.id > second.id)) { | 8793 if (first.id > second.id) { |
| 8783 first = first.dominator; | 8794 first = first.dominator; |
| 8784 } | 8795 } |
| 8785 else { | 8796 else { |
| 8786 second = second.dominator; | 8797 second = second.dominator; |
| 8787 } | 8798 } |
| 8788 $assert($notnull_bool(first != null && second != null), "first !== null && second !== null", "nodes.dart", 364, 16); | 8799 $assert(first != null && second != null, "first !== null && second !== nul l", "nodes.dart", 364, 16); |
| 8789 } | 8800 } |
| 8790 if ($notnull_bool(this.dominator !== first)) { | 8801 if (this.dominator !== first) { |
| 8791 this.dominator.removeDominatedBlock(this); | 8802 this.dominator.removeDominatedBlock(this); |
| 8792 first.addDominatedBlock(this); | 8803 first.addDominatedBlock(this); |
| 8793 } | 8804 } |
| 8794 } | 8805 } |
| 8795 } | 8806 } |
| 8796 // ********** Code for HInstruction ************** | 8807 // ********** Code for HInstruction ************** |
| 8797 function HInstruction(inputs) { | 8808 function HInstruction(inputs) { |
| 8798 this._usedBy = null | 8809 this._usedBy = null |
| 8799 this.previous = null | 8810 this.previous = null |
| 8800 this.next = null | 8811 this.next = null |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 8828 HInstruction.prototype.generateAtUseSite = function() { | 8839 HInstruction.prototype.generateAtUseSite = function() { |
| 8829 return this.getFlag(2/*HInstruction.FLAG_GENERATE_AT_USE_SITE*/); | 8840 return this.getFlag(2/*HInstruction.FLAG_GENERATE_AT_USE_SITE*/); |
| 8830 } | 8841 } |
| 8831 HInstruction.prototype.setGenerateAtUseSite = function() { | 8842 HInstruction.prototype.setGenerateAtUseSite = function() { |
| 8832 this.setFlag(2/*HInstruction.FLAG_GENERATE_AT_USE_SITE*/); | 8843 this.setFlag(2/*HInstruction.FLAG_GENERATE_AT_USE_SITE*/); |
| 8833 } | 8844 } |
| 8834 HInstruction.prototype.setUseGvn = function() { | 8845 HInstruction.prototype.setUseGvn = function() { |
| 8835 this.setFlag(3/*HInstruction.FLAG_USE_GVN*/); | 8846 this.setFlag(3/*HInstruction.FLAG_USE_GVN*/); |
| 8836 } | 8847 } |
| 8837 HInstruction.prototype.get$usedBy = function() { | 8848 HInstruction.prototype.get$usedBy = function() { |
| 8838 if ($notnull_bool(this._usedBy == null)) return const$15/*const []*/; | 8849 if (this._usedBy == null) return const$15/*const []*/; |
| 8839 return this._usedBy; | 8850 return this._usedBy; |
| 8840 } | 8851 } |
| 8841 HInstruction.prototype.isInBasicBlock = function() { | 8852 HInstruction.prototype.isInBasicBlock = function() { |
| 8842 return this._usedBy != null; | 8853 return this._usedBy != null; |
| 8843 } | 8854 } |
| 8844 HInstruction.prototype.notifyAddedToBlock = function() { | 8855 HInstruction.prototype.notifyAddedToBlock = function() { |
| 8845 $assert(!$notnull_bool(this.isInBasicBlock()), "!isInBasicBlock()", "nodes.dar t", 472, 12); | 8856 $assert(!$notnull_bool(this.isInBasicBlock()), "!isInBasicBlock()", "nodes.dar t", 472, 12); |
| 8846 this._usedBy = []; | 8857 this._usedBy = []; |
| 8847 for (var i = 0; | 8858 for (var i = 0; |
| 8848 $notnull_bool(i < this.inputs.length); i++) { | 8859 i < this.inputs.length; i++) { |
| 8849 $assert(this.inputs.$index(i).isInBasicBlock(), "inputs[i].isInBasicBlock()" , "nodes.dart", 476, 14); | 8860 $assert(this.inputs.$index(i).isInBasicBlock(), "inputs[i].isInBasicBlock()" , "nodes.dart", 476, 14); |
| 8850 this.inputs.$index(i).get$usedBy().add(this); | 8861 this.inputs.$index(i).get$usedBy().add(this); |
| 8851 } | 8862 } |
| 8852 $assert(this.isValid(), "isValid()", "nodes.dart", 479, 12); | 8863 $assert(this.isValid(), "isValid()", "nodes.dart", 479, 12); |
| 8853 } | 8864 } |
| 8854 HInstruction.prototype.notifyRemovedFromBlock = function() { | 8865 HInstruction.prototype.notifyRemovedFromBlock = function() { |
| 8855 $assert(this.isInBasicBlock(), "isInBasicBlock()", "nodes.dart", 483, 12); | 8866 $assert(this.isInBasicBlock(), "isInBasicBlock()", "nodes.dart", 483, 12); |
| 8856 $assert(this.get$usedBy().isEmpty(), "usedBy.isEmpty()", "nodes.dart", 484, 12 ); | 8867 $assert(this.get$usedBy().isEmpty(), "usedBy.isEmpty()", "nodes.dart", 484, 12 ); |
| 8857 for (var i = 0; | 8868 for (var i = 0; |
| 8858 $notnull_bool(i < this.inputs.length); i++) { | 8869 i < this.inputs.length; i++) { |
| 8859 var inputUsedBy = this.inputs.$index(i).get$usedBy(); | 8870 var inputUsedBy = this.inputs.$index(i).get$usedBy(); |
| 8860 for (var j = 0; | 8871 for (var j = 0; |
| 8861 $notnull_bool(j < inputUsedBy.length); j++) { | 8872 j < inputUsedBy.length; j++) { |
| 8862 if ($notnull_bool(inputUsedBy.$index(j) === this)) { | 8873 if (inputUsedBy.$index(j) === this) { |
| 8863 inputUsedBy.$setindex(j, inputUsedBy.$index(inputUsedBy.length - 1)); | 8874 inputUsedBy.$setindex(j, inputUsedBy.$index(inputUsedBy.length - 1)); |
| 8864 inputUsedBy.removeLast(); | 8875 inputUsedBy.removeLast(); |
| 8865 break; | 8876 break; |
| 8866 } | 8877 } |
| 8867 } | 8878 } |
| 8868 } | 8879 } |
| 8869 this._usedBy = null; | 8880 this._usedBy = null; |
| 8870 $assert(this.isValid(), "isValid()", "nodes.dart", 498, 12); | 8881 $assert(this.isValid(), "isValid()", "nodes.dart", 498, 12); |
| 8871 } | 8882 } |
| 8872 HInstruction.prototype.isLiteralNumber = function() { | 8883 HInstruction.prototype.isLiteralNumber = function() { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8914 HInvokeForeign.prototype.accept = function(visitor) { | 8925 HInvokeForeign.prototype.accept = function(visitor) { |
| 8915 return visitor.visitInvokeForeign(this); | 8926 return visitor.visitInvokeForeign(this); |
| 8916 } | 8927 } |
| 8917 // ********** Code for HArithmetic ************** | 8928 // ********** Code for HArithmetic ************** |
| 8918 function HArithmetic(selector, inputs) { | 8929 function HArithmetic(selector, inputs) { |
| 8919 HInvoke.call(this, selector, inputs); | 8930 HInvoke.call(this, selector, inputs); |
| 8920 // Initializers done | 8931 // Initializers done |
| 8921 } | 8932 } |
| 8922 $inherits(HArithmetic, HInvoke); | 8933 $inherits(HArithmetic, HInvoke); |
| 8923 HArithmetic.prototype.prepareGvn = function() { | 8934 HArithmetic.prototype.prepareGvn = function() { |
| 8924 if ($notnull_bool(!(this.inputs.$index(0) instanceof HLiteral))) return; | 8935 if (!(this.inputs.$index(0) instanceof HLiteral)) return; |
| 8925 this.clearAllSideEffects(); | 8936 this.clearAllSideEffects(); |
| 8926 this.setUseGvn(); | 8937 this.setUseGvn(); |
| 8927 } | 8938 } |
| 8928 // ********** Code for HAdd ************** | 8939 // ********** Code for HAdd ************** |
| 8929 function HAdd(inputs) { | 8940 function HAdd(inputs) { |
| 8930 HArithmetic.call(this, const$247/*const SourceString('+')*/, inputs); | 8941 HArithmetic.call(this, const$247/*const SourceString('+')*/, inputs); |
| 8931 // Initializers done | 8942 // Initializers done |
| 8932 } | 8943 } |
| 8933 $inherits(HAdd, HArithmetic); | 8944 $inherits(HAdd, HArithmetic); |
| 8934 HAdd.prototype.prepareGvn = function() { | 8945 HAdd.prototype.prepareGvn = function() { |
| 8935 if ($notnull_bool(!$notnull_bool(this.inputs.$index(0).isLiteralNumber()))) re turn; | 8946 if (!$notnull_bool(this.inputs.$index(0).isLiteralNumber())) return; |
| 8936 this.clearAllSideEffects(); | 8947 this.clearAllSideEffects(); |
| 8937 this.setUseGvn(); | 8948 this.setUseGvn(); |
| 8938 } | 8949 } |
| 8939 HAdd.prototype.accept = function(visitor) { | 8950 HAdd.prototype.accept = function(visitor) { |
| 8940 return visitor.visitAdd(this); | 8951 return visitor.visitAdd(this); |
| 8941 } | 8952 } |
| 8942 HAdd.prototype.evaluate = function(a, b) { | 8953 HAdd.prototype.evaluate = function(a, b) { |
| 8943 return a + b; | 8954 return a + b; |
| 8944 } | 8955 } |
| 8945 // ********** Code for HDivide ************** | 8956 // ********** Code for HDivide ************** |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8990 HTruncatingDivide.prototype.evaluate = function(a, b) { | 9001 HTruncatingDivide.prototype.evaluate = function(a, b) { |
| 8991 return $truncdiv(a, b); | 9002 return $truncdiv(a, b); |
| 8992 } | 9003 } |
| 8993 // ********** Code for HEquals ************** | 9004 // ********** Code for HEquals ************** |
| 8994 function HEquals(inputs) { | 9005 function HEquals(inputs) { |
| 8995 HInvoke.call(this, const$253/*const SourceString('==')*/, inputs); | 9006 HInvoke.call(this, const$253/*const SourceString('==')*/, inputs); |
| 8996 // Initializers done | 9007 // Initializers done |
| 8997 } | 9008 } |
| 8998 $inherits(HEquals, HInvoke); | 9009 $inherits(HEquals, HInvoke); |
| 8999 HEquals.prototype.prepareGvn = function() { | 9010 HEquals.prototype.prepareGvn = function() { |
| 9000 if ($notnull_bool(!(this.inputs.$index(0) instanceof HLiteral))) return; | 9011 if (!(this.inputs.$index(0) instanceof HLiteral)) return; |
| 9001 this.clearAllSideEffects(); | 9012 this.clearAllSideEffects(); |
| 9002 this.setUseGvn(); | 9013 this.setUseGvn(); |
| 9003 } | 9014 } |
| 9004 HEquals.prototype.accept = function(visitor) { | 9015 HEquals.prototype.accept = function(visitor) { |
| 9005 return visitor.visitEquals(this); | 9016 return visitor.visitEquals(this); |
| 9006 } | 9017 } |
| 9007 // ********** Code for HExit ************** | 9018 // ********** Code for HExit ************** |
| 9008 function HExit() { | 9019 function HExit() { |
| 9009 HControlFlow.call(this, const$15/*const []*/); | 9020 HControlFlow.call(this, const$15/*const []*/); |
| 9010 // Initializers done | 9021 // Initializers done |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9153 function SsaConstantFolder() { | 9164 function SsaConstantFolder() { |
| 9154 HBaseVisitor.call(this); | 9165 HBaseVisitor.call(this); |
| 9155 // Initializers done | 9166 // Initializers done |
| 9156 } | 9167 } |
| 9157 $inherits(SsaConstantFolder, HBaseVisitor); | 9168 $inherits(SsaConstantFolder, HBaseVisitor); |
| 9158 SsaConstantFolder.prototype.visitGraph = function(graph) { | 9169 SsaConstantFolder.prototype.visitGraph = function(graph) { |
| 9159 this.visitDominatorTree(graph); | 9170 this.visitDominatorTree(graph); |
| 9160 } | 9171 } |
| 9161 SsaConstantFolder.prototype.visitBasicBlock = function(block) { | 9172 SsaConstantFolder.prototype.visitBasicBlock = function(block) { |
| 9162 var instruction = block.first; | 9173 var instruction = block.first; |
| 9163 while ($notnull_bool(instruction != null)) { | 9174 while (instruction != null) { |
| 9164 var replacement = instruction.accept(this); | 9175 var replacement = instruction.accept(this); |
| 9165 if ($notnull_bool(replacement !== instruction)) { | 9176 if (replacement !== instruction) { |
| 9166 block.addAfter(instruction, (replacement && replacement.is$HInstruction()) ); | 9177 block.addAfter(instruction, (replacement && replacement.is$HInstruction()) ); |
| 9167 block.rewrite(instruction, (replacement && replacement.is$HInstruction())) ; | 9178 block.rewrite(instruction, (replacement && replacement.is$HInstruction())) ; |
| 9168 block.remove(instruction); | 9179 block.remove(instruction); |
| 9169 } | 9180 } |
| 9170 instruction = instruction.next; | 9181 instruction = instruction.next; |
| 9171 } | 9182 } |
| 9172 } | 9183 } |
| 9173 SsaConstantFolder.prototype.visitInstruction = function(node) { | 9184 SsaConstantFolder.prototype.visitInstruction = function(node) { |
| 9174 return node; | 9185 return node; |
| 9175 } | 9186 } |
| 9176 SsaConstantFolder.prototype.visitEquals = function(node) { | 9187 SsaConstantFolder.prototype.visitEquals = function(node) { |
| 9177 var $0; | 9188 var $0; |
| 9178 var inputs = node.inputs; | 9189 var inputs = node.inputs; |
| 9179 if ($notnull_bool((inputs.$index(0) instanceof HLiteral) && (inputs.$index(1) instanceof HLiteral))) { | 9190 if ((inputs.$index(0) instanceof HLiteral) && (inputs.$index(1) instanceof HLi teral)) { |
| 9180 var op1 = (($0 = inputs.$index(0)) && $0.is$HLiteral()); | 9191 var op1 = (($0 = inputs.$index(0)) && $0.is$HLiteral()); |
| 9181 var op2 = (($0 = inputs.$index(1)) && $0.is$HLiteral()); | 9192 var op2 = (($0 = inputs.$index(1)) && $0.is$HLiteral()); |
| 9182 return new HLiteral($eq(op1.value, op2.value)); | 9193 return new HLiteral($eq(op1.value, op2.value)); |
| 9183 } | 9194 } |
| 9184 return node; | 9195 return node; |
| 9185 } | 9196 } |
| 9186 SsaConstantFolder.prototype.visitArithmetic = function(node) { | 9197 SsaConstantFolder.prototype.visitArithmetic = function(node) { |
| 9187 var $0; | 9198 var $0; |
| 9188 var inputs = node.inputs; | 9199 var inputs = node.inputs; |
| 9189 $assert(inputs.length == 2, "inputs.length == 2", "optimize.dart", 57, 12); | 9200 $assert(inputs.length == 2, "inputs.length == 2", "optimize.dart", 57, 12); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 9210 } | 9221 } |
| 9211 return this.visitArithmetic(node); | 9222 return this.visitArithmetic(node); |
| 9212 } | 9223 } |
| 9213 // ********** Code for SsaDeadCodeEliminator ************** | 9224 // ********** Code for SsaDeadCodeEliminator ************** |
| 9214 function SsaDeadCodeEliminator() { | 9225 function SsaDeadCodeEliminator() { |
| 9215 HGraphVisitor.call(this); | 9226 HGraphVisitor.call(this); |
| 9216 // Initializers done | 9227 // Initializers done |
| 9217 } | 9228 } |
| 9218 $inherits(SsaDeadCodeEliminator, HGraphVisitor); | 9229 $inherits(SsaDeadCodeEliminator, HGraphVisitor); |
| 9219 SsaDeadCodeEliminator.isDeadCode = function(instruction) { | 9230 SsaDeadCodeEliminator.isDeadCode = function(instruction) { |
| 9220 return $notnull_bool(!$notnull_bool(instruction.hasSideEffects()) && instructi on.get$usedBy().isEmpty()); | 9231 return !$notnull_bool(instruction.hasSideEffects()) && instruction.get$usedBy( ).isEmpty(); |
| 9221 } | 9232 } |
| 9222 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) { | 9233 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) { |
| 9223 this.visitPostDominatorTree(graph); | 9234 this.visitPostDominatorTree(graph); |
| 9224 } | 9235 } |
| 9225 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) { | 9236 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) { |
| 9226 var instruction = block.last; | 9237 var instruction = block.last; |
| 9227 while ($notnull_bool(instruction != null)) { | 9238 while (instruction != null) { |
| 9228 var previous = instruction.previous; | 9239 var previous = instruction.previous; |
| 9229 if ($notnull_bool(SsaDeadCodeEliminator.isDeadCode(instruction))) block.remo ve(instruction); | 9240 if ($notnull_bool(SsaDeadCodeEliminator.isDeadCode(instruction))) block.remo ve(instruction); |
| 9230 instruction = (previous && previous.is$HInstruction()); | 9241 instruction = (previous && previous.is$HInstruction()); |
| 9231 } | 9242 } |
| 9232 } | 9243 } |
| 9233 // ********** Code for SsaInstructionMerger ************** | 9244 // ********** Code for SsaInstructionMerger ************** |
| 9234 function SsaInstructionMerger() { | 9245 function SsaInstructionMerger() { |
| 9235 HInstructionVisitor.call(this); | 9246 HInstructionVisitor.call(this); |
| 9236 // Initializers done | 9247 // Initializers done |
| 9237 } | 9248 } |
| 9238 $inherits(SsaInstructionMerger, HInstructionVisitor); | 9249 $inherits(SsaInstructionMerger, HInstructionVisitor); |
| 9239 SsaInstructionMerger.prototype.visitGraph = function(graph) { | 9250 SsaInstructionMerger.prototype.visitGraph = function(graph) { |
| 9240 this.visitDominatorTree(graph); | 9251 this.visitDominatorTree(graph); |
| 9241 } | 9252 } |
| 9242 SsaInstructionMerger.prototype.visitInstruction = function(node) { | 9253 SsaInstructionMerger.prototype.visitInstruction = function(node) { |
| 9243 var inputs = node.inputs; | 9254 var inputs = node.inputs; |
| 9244 var previousUnused = node.previous; | 9255 var previousUnused = node.previous; |
| 9245 for (var i = inputs.length - 1; | 9256 for (var i = inputs.length - 1; |
| 9246 $notnull_bool(i >= 0); i--) { | 9257 i >= 0; i--) { |
| 9247 if ($notnull_bool(previousUnused == null)) return; | 9258 if (previousUnused == null) return; |
| 9248 if ($notnull_bool((previousUnused instanceof HPhi))) return; | 9259 if ((previousUnused instanceof HPhi)) return; |
| 9249 if ($notnull_bool(inputs.$index(i).get$usedBy().length != 1)) return; | 9260 if (inputs.$index(i).get$usedBy().length != 1) return; |
| 9250 if ($notnull_bool(inputs.$index(i) !== previousUnused)) return; | 9261 if (inputs.$index(i) !== previousUnused) return; |
| 9251 inputs.$index(i).setGenerateAtUseSite(); | 9262 inputs.$index(i).setGenerateAtUseSite(); |
| 9252 previousUnused = previousUnused.previous; | 9263 previousUnused = previousUnused.previous; |
| 9253 } | 9264 } |
| 9254 } | 9265 } |
| 9255 // ********** Code for HTracer ************** | 9266 // ********** Code for HTracer ************** |
| 9256 function HTracer() {} | 9267 function HTracer() {} |
| 9257 HTracer._internal$ctor = function() { | 9268 HTracer._internal$ctor = function() { |
| 9258 this.indent = 0 | 9269 this.indent = 0 |
| 9259 this.output = new StringBufferImpl(""); | 9270 this.output = new StringBufferImpl(""); |
| 9260 // Initializers done | 9271 // Initializers done |
| 9261 } | 9272 } |
| 9262 HTracer._internal$ctor.prototype = HTracer.prototype; | 9273 HTracer._internal$ctor.prototype = HTracer.prototype; |
| 9263 $inherits(HTracer, HGraphVisitor); | 9274 $inherits(HTracer, HGraphVisitor); |
| 9264 HTracer.HTracer$singleton$factory = function() { | 9275 HTracer.HTracer$singleton$factory = function() { |
| 9265 if ($notnull_bool(HTracer._singleton == null)) HTracer._singleton = new HTrace r._internal$ctor(); | 9276 if (HTracer._singleton == null) HTracer._singleton = new HTracer._internal$cto r(); |
| 9266 return HTracer._singleton; | 9277 return HTracer._singleton; |
| 9267 } | 9278 } |
| 9268 HTracer.prototype.traceCompilation = function(methodName) { | 9279 HTracer.prototype.traceCompilation = function(methodName) { |
| 9269 var $this = this; // closure support | 9280 var $this = this; // closure support |
| 9270 this.tag("compilation", (function () { | 9281 this.tag("compilation", (function () { |
| 9271 $this.printProperty("name", methodName); | 9282 $this.printProperty("name", methodName); |
| 9272 $this.printProperty("method", methodName); | 9283 $this.printProperty("method", methodName); |
| 9273 $this.printProperty("date", new DateImplementation.now$ctor().value); | 9284 $this.printProperty("date", new DateImplementation.now$ctor().value); |
| 9274 }) | 9285 }) |
| 9275 ); | 9286 ); |
| 9276 } | 9287 } |
| 9277 HTracer.prototype.traceGraph = function(name, graph) { | 9288 HTracer.prototype.traceGraph = function(name, graph) { |
| 9278 var $this = this; // closure support | 9289 var $this = this; // closure support |
| 9279 graph.assignInstructionIds(); | 9290 graph.assignInstructionIds(); |
| 9280 this.tag("cfg", (function () { | 9291 this.tag("cfg", (function () { |
| 9281 $this.printProperty("name", name); | 9292 $this.printProperty("name", name); |
| 9282 $this.visitDominatorTree(graph); | 9293 $this.visitDominatorTree(graph); |
| 9283 }) | 9294 }) |
| 9284 ); | 9295 ); |
| 9285 } | 9296 } |
| 9286 HTracer.prototype.addPredecessors = function(block) { | 9297 HTracer.prototype.addPredecessors = function(block) { |
| 9287 if ($notnull_bool(block.predecessors.isEmpty())) { | 9298 if (block.predecessors.isEmpty()) { |
| 9288 this.printEmptyProperty("predecessors"); | 9299 this.printEmptyProperty("predecessors"); |
| 9289 } | 9300 } |
| 9290 else { | 9301 else { |
| 9291 this.addIndent(); | 9302 this.addIndent(); |
| 9292 this.add("predecessors"); | 9303 this.add("predecessors"); |
| 9293 var $list = block.predecessors; | 9304 var $list = block.predecessors; |
| 9294 for (var $i = 0;$i < $list.length; $i++) { | 9305 for (var $i = 0;$i < $list.length; $i++) { |
| 9295 var predecessor = $list.$index($i); | 9306 var predecessor = $list.$index($i); |
| 9296 this.add((' "B' + predecessor.id + '"')); | 9307 this.add((' "B' + predecessor.id + '"')); |
| 9297 } | 9308 } |
| 9298 this.add("\n"); | 9309 this.add("\n"); |
| 9299 } | 9310 } |
| 9300 } | 9311 } |
| 9301 HTracer.prototype.addSuccessors = function(block) { | 9312 HTracer.prototype.addSuccessors = function(block) { |
| 9302 if ($notnull_bool(block.successors.isEmpty())) { | 9313 if (block.successors.isEmpty()) { |
| 9303 this.printEmptyProperty("successors"); | 9314 this.printEmptyProperty("successors"); |
| 9304 } | 9315 } |
| 9305 else { | 9316 else { |
| 9306 this.addIndent(); | 9317 this.addIndent(); |
| 9307 this.add("successors"); | 9318 this.add("successors"); |
| 9308 var $list = block.successors; | 9319 var $list = block.successors; |
| 9309 for (var $i = 0;$i < $list.length; $i++) { | 9320 for (var $i = 0;$i < $list.length; $i++) { |
| 9310 var successor = $list.$index($i); | 9321 var successor = $list.$index($i); |
| 9311 this.add((' "B' + successor.id + '"')); | 9322 this.add((' "B' + successor.id + '"')); |
| 9312 } | 9323 } |
| 9313 this.add("\n"); | 9324 this.add("\n"); |
| 9314 } | 9325 } |
| 9315 } | 9326 } |
| 9316 HTracer.prototype.addInstructions = function(block) { | 9327 HTracer.prototype.addInstructions = function(block) { |
| 9317 var stringifier = new HInstructionStringifier(block); | 9328 var stringifier = new HInstructionStringifier(block); |
| 9318 for (var instruction = block.first; | 9329 for (var instruction = block.first; |
| 9319 $notnull_bool(instruction != null); instruction = instruction.next) { | 9330 instruction != null; instruction = instruction.next) { |
| 9320 var bci = 0; | 9331 var bci = 0; |
| 9321 var uses = instruction.get$usedBy().length; | 9332 var uses = instruction.get$usedBy().length; |
| 9322 this.addIndent(); | 9333 this.addIndent(); |
| 9323 var temporaryId = stringifier.temporaryId(instruction); | 9334 var temporaryId = stringifier.temporaryId(instruction); |
| 9324 var instructionString = $assert_String(stringifier.visit(instruction)); | 9335 var instructionString = $assert_String(stringifier.visit(instruction)); |
| 9325 this.add(("" + bci + " " + uses + " " + temporaryId + " " + instructionStrin g + " <|@\n")); | 9336 this.add(("" + bci + " " + uses + " " + temporaryId + " " + instructionStrin g + " <|@\n")); |
| 9326 } | 9337 } |
| 9327 } | 9338 } |
| 9328 HTracer.prototype.visitBasicBlock = function(block) { | 9339 HTracer.prototype.visitBasicBlock = function(block) { |
| 9329 var $this = this; // closure support | 9340 var $this = this; // closure support |
| 9330 $assert(block.id != null, "block.id !== null", "tracer.dart", 75, 12); | 9341 $assert(block.id != null, "block.id !== null", "tracer.dart", 75, 12); |
| 9331 this.tag("block", (function () { | 9342 this.tag("block", (function () { |
| 9332 $this.printProperty("name", ("B" + block.id + "")); | 9343 $this.printProperty("name", ("B" + block.id + "")); |
| 9333 $this.printProperty("from_bci", -1); | 9344 $this.printProperty("from_bci", -1); |
| 9334 $this.printProperty("to_bci", -1); | 9345 $this.printProperty("to_bci", -1); |
| 9335 $this.addPredecessors(block); | 9346 $this.addPredecessors(block); |
| 9336 $this.addSuccessors(block); | 9347 $this.addSuccessors(block); |
| 9337 $this.printEmptyProperty("xhandlers"); | 9348 $this.printEmptyProperty("xhandlers"); |
| 9338 $this.printEmptyProperty("flags"); | 9349 $this.printEmptyProperty("flags"); |
| 9339 if ($notnull_bool(block.dominator != null)) { | 9350 if (block.dominator != null) { |
| 9340 $this.printProperty("dominator", ("B" + block.dominator.id + "")); | 9351 $this.printProperty("dominator", ("B" + block.dominator.id + "")); |
| 9341 } | 9352 } |
| 9342 $this.tag("states", (function () { | 9353 $this.tag("states", (function () { |
| 9343 $this.tag("locals", (function () { | 9354 $this.tag("locals", (function () { |
| 9344 $this.printProperty("size", 0); | 9355 $this.printProperty("size", 0); |
| 9345 $this.printProperty("method", "None"); | 9356 $this.printProperty("method", "None"); |
| 9346 }) | 9357 }) |
| 9347 ); | 9358 ); |
| 9348 }) | 9359 }) |
| 9349 ); | 9360 ); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 9363 } | 9374 } |
| 9364 HTracer.prototype.print = function(string) { | 9375 HTracer.prototype.print = function(string) { |
| 9365 this.addIndent(); | 9376 this.addIndent(); |
| 9366 this.add(string); | 9377 this.add(string); |
| 9367 this.add("\n"); | 9378 this.add("\n"); |
| 9368 } | 9379 } |
| 9369 HTracer.prototype.printEmptyProperty = function(propertyName) { | 9380 HTracer.prototype.printEmptyProperty = function(propertyName) { |
| 9370 this.print(propertyName); | 9381 this.print(propertyName); |
| 9371 } | 9382 } |
| 9372 HTracer.prototype.printProperty = function(propertyName, value) { | 9383 HTracer.prototype.printProperty = function(propertyName, value) { |
| 9373 if ($notnull_bool((typeof(value) == 'number'))) { | 9384 if ((typeof(value) == 'number')) { |
| 9374 this.print(("" + propertyName + " " + value + "")); | 9385 this.print(("" + propertyName + " " + value + "")); |
| 9375 } | 9386 } |
| 9376 else { | 9387 else { |
| 9377 this.print(('' + propertyName + ' "' + value + '"')); | 9388 this.print(('' + propertyName + ' "' + value + '"')); |
| 9378 } | 9389 } |
| 9379 } | 9390 } |
| 9380 HTracer.prototype.add = function(string) { | 9391 HTracer.prototype.add = function(string) { |
| 9381 this.output.add(string); | 9392 this.output.add(string); |
| 9382 } | 9393 } |
| 9383 HTracer.prototype.addIndent = function() { | 9394 HTracer.prototype.addIndent = function() { |
| 9384 for (var i = 0; | 9395 for (var i = 0; |
| 9385 $notnull_bool(i < this.indent); i++) { | 9396 i < this.indent; i++) { |
| 9386 this.add(" "); | 9397 this.add(" "); |
| 9387 } | 9398 } |
| 9388 } | 9399 } |
| 9389 HTracer.prototype.toString = function() { | 9400 HTracer.prototype.toString = function() { |
| 9390 return this.output.toString(); | 9401 return this.output.toString(); |
| 9391 } | 9402 } |
| 9392 // ********** Code for HInstructionStringifier ************** | 9403 // ********** Code for HInstructionStringifier ************** |
| 9393 function HInstructionStringifier(currentBlock) { | 9404 function HInstructionStringifier(currentBlock) { |
| 9394 this.currentBlock = currentBlock; | 9405 this.currentBlock = currentBlock; |
| 9395 // Initializers done | 9406 // Initializers done |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 9424 var $0; | 9435 var $0; |
| 9425 var thenBlock = (($0 = this.currentBlock.successors.$index(0)) && $0.is$HBasic Block()); | 9436 var thenBlock = (($0 = this.currentBlock.successors.$index(0)) && $0.is$HBasic Block()); |
| 9426 var elseBlock = (($0 = this.currentBlock.successors.$index(1)) && $0.is$HBasic Block()); | 9437 var elseBlock = (($0 = this.currentBlock.successors.$index(1)) && $0.is$HBasic Block()); |
| 9427 var conditionId = this.temporaryId((($0 = node.inputs.$index(0)) && $0.is$HIns truction())); | 9438 var conditionId = this.temporaryId((($0 = node.inputs.$index(0)) && $0.is$HIns truction())); |
| 9428 return ("If (" + conditionId + "): (B" + thenBlock.id + ") else (B" + elseBloc k.id + ")"); | 9439 return ("If (" + conditionId + "): (B" + thenBlock.id + ") else (B" + elseBloc k.id + ")"); |
| 9429 } | 9440 } |
| 9430 HInstructionStringifier.prototype.visitGenericInvoke = function(invokeType, invo ke) { | 9441 HInstructionStringifier.prototype.visitGenericInvoke = function(invokeType, invo ke) { |
| 9431 var $0; | 9442 var $0; |
| 9432 var arguments = new StringBufferImpl(""); | 9443 var arguments = new StringBufferImpl(""); |
| 9433 for (var i = 0; | 9444 for (var i = 0; |
| 9434 $notnull_bool(i < invoke.inputs.length); i++) { | 9445 i < invoke.inputs.length; i++) { |
| 9435 if ($notnull_bool(i != 0)) arguments.add(", "); | 9446 if (i != 0) arguments.add(", "); |
| 9436 arguments.add(this.temporaryId((($0 = invoke.inputs.$index(i)) && $0.is$HIns truction()))); | 9447 arguments.add(this.temporaryId((($0 = invoke.inputs.$index(i)) && $0.is$HIns truction()))); |
| 9437 } | 9448 } |
| 9438 return ("" + invokeType + ": " + invoke.selector + "(" + arguments + ")"); | 9449 return ("" + invokeType + ": " + invoke.selector + "(" + arguments + ")"); |
| 9439 } | 9450 } |
| 9440 HInstructionStringifier.prototype.visitInvoke = function(invoke) { | 9451 HInstructionStringifier.prototype.visitInvoke = function(invoke) { |
| 9441 return this.visitGenericInvoke("Invoke", invoke); | 9452 return this.visitGenericInvoke("Invoke", invoke); |
| 9442 } | 9453 } |
| 9443 HInstructionStringifier.prototype.visitInvokeForeign = function(invoke) { | 9454 HInstructionStringifier.prototype.visitInvokeForeign = function(invoke) { |
| 9444 return this.visitGenericInvoke("InvokeForeign", invoke); | 9455 return this.visitGenericInvoke("InvokeForeign", invoke); |
| 9445 } | 9456 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9486 $inherits(HValidator, HInstructionVisitor); | 9497 $inherits(HValidator, HInstructionVisitor); |
| 9487 HValidator.prototype.visitGraph = function(graph) { | 9498 HValidator.prototype.visitGraph = function(graph) { |
| 9488 this.graph = graph; | 9499 this.graph = graph; |
| 9489 this.visitDominatorTree(graph); | 9500 this.visitDominatorTree(graph); |
| 9490 } | 9501 } |
| 9491 HValidator.prototype.markInvalid = function(reason) { | 9502 HValidator.prototype.markInvalid = function(reason) { |
| 9492 print(reason); | 9503 print(reason); |
| 9493 this.isValid = false; | 9504 this.isValid = false; |
| 9494 } | 9505 } |
| 9495 HValidator.prototype.visitBasicBlock = function(block) { | 9506 HValidator.prototype.visitBasicBlock = function(block) { |
| 9496 if ($notnull_bool(!$notnull_bool(this.isValid))) return; | 9507 if (!$notnull_bool(this.isValid)) return; |
| 9497 if ($notnull_bool(block.first == null || block.last == null)) { | 9508 if (block.first == null || block.last == null) { |
| 9498 this.markInvalid("empty block"); | 9509 this.markInvalid("empty block"); |
| 9499 } | 9510 } |
| 9500 if ($notnull_bool(!(block.last instanceof HControlFlow))) { | 9511 if (!(block.last instanceof HControlFlow)) { |
| 9501 this.markInvalid("block ends with non-tail node."); | 9512 this.markInvalid("block ends with non-tail node."); |
| 9502 } | 9513 } |
| 9503 if ($notnull_bool((block.last instanceof HIf) && block.successors.length != 2) ) { | 9514 if ((block.last instanceof HIf) && block.successors.length != 2) { |
| 9504 this.markInvalid("If node without two successors"); | 9515 this.markInvalid("If node without two successors"); |
| 9505 } | 9516 } |
| 9506 if ($notnull_bool((block.last instanceof HConditionalBranch) && block.successo rs.length != 2)) { | 9517 if ((block.last instanceof HConditionalBranch) && block.successors.length != 2 ) { |
| 9507 this.markInvalid("Conditional node without two successors"); | 9518 this.markInvalid("Conditional node without two successors"); |
| 9508 } | 9519 } |
| 9509 if ($notnull_bool((block.last instanceof HGoto) && block.successors.length != 1)) { | 9520 if ((block.last instanceof HGoto) && block.successors.length != 1) { |
| 9510 this.markInvalid("Goto node without one successor"); | 9521 this.markInvalid("Goto node without one successor"); |
| 9511 } | 9522 } |
| 9512 if ($notnull_bool((block.last instanceof HReturn) && ($notnull_bool(block.succ essors.length != 1 || !$notnull_bool(block.successors.$index(0).isExitBlock()))) )) { | 9523 if ((block.last instanceof HReturn) && (block.successors.length != 1 || !$notn ull_bool(block.successors.$index(0).isExitBlock()))) { |
| 9513 this.markInvalid("Return node with > 1 succesor or not going to exit-block") ; | 9524 this.markInvalid("Return node with > 1 succesor or not going to exit-block") ; |
| 9514 } | 9525 } |
| 9515 if ($notnull_bool((block.last instanceof HExit) && !$notnull_bool(block.succes sors.isEmpty()))) { | 9526 if ((block.last instanceof HExit) && !block.successors.isEmpty()) { |
| 9516 this.markInvalid("Exit block with successor"); | 9527 this.markInvalid("Exit block with successor"); |
| 9517 } | 9528 } |
| 9518 if ($notnull_bool((block.last instanceof HThrow) && !$notnull_bool(block.succe ssors.isEmpty()))) { | 9529 if ((block.last instanceof HThrow) && !block.successors.isEmpty()) { |
| 9519 this.markInvalid("Throw block with successor"); | 9530 this.markInvalid("Throw block with successor"); |
| 9520 } | 9531 } |
| 9521 if ($notnull_bool(block.successors.isEmpty() && !(block.last instanceof HThrow )) && !$notnull_bool(block.isExitBlock())) { | 9532 if (block.successors.isEmpty() && !(block.last instanceof HThrow) && !$notnull _bool(block.isExitBlock())) { |
| 9522 this.markInvalid("Non-exit or throw block without successor"); | 9533 this.markInvalid("Non-exit or throw block without successor"); |
| 9523 } | 9534 } |
| 9524 if ($notnull_bool(block.id == null)) this.markInvalid("block without id"); | 9535 if (block.id == null) this.markInvalid("block without id"); |
| 9525 var $list = block.successors; | 9536 var $list = block.successors; |
| 9526 for (var $i = 0;$i < $list.length; $i++) { | 9537 for (var $i = 0;$i < $list.length; $i++) { |
| 9527 var successor = $list.$index($i); | 9538 var successor = $list.$index($i); |
| 9528 if ($notnull_bool(!$notnull_bool(this.isValid))) break; | 9539 if (!$notnull_bool(this.isValid)) break; |
| 9529 if ($notnull_bool(successor.id == null)) this.markInvalid("successor without id"); | 9540 if (successor.id == null) this.markInvalid("successor without id"); |
| 9530 if ($notnull_bool(successor.id <= block.id && !$notnull_bool(successor.isLoo pHeader))) { | 9541 if (successor.id <= block.id && !$notnull_bool(successor.isLoopHeader)) { |
| 9531 this.markInvalid("successor with lower id, but not a loop-header"); | 9542 this.markInvalid("successor with lower id, but not a loop-header"); |
| 9532 } | 9543 } |
| 9533 } | 9544 } |
| 9534 var lastId = 0; | 9545 var lastId = 0; |
| 9535 var $list = block.dominatedBlocks; | 9546 var $list = block.dominatedBlocks; |
| 9536 for (var $i = 0;$i < $list.length; $i++) { | 9547 for (var $i = 0;$i < $list.length; $i++) { |
| 9537 var dominated = $list.$index($i); | 9548 var dominated = $list.$index($i); |
| 9538 if ($notnull_bool(!$notnull_bool(this.isValid))) break; | 9549 if (!$notnull_bool(this.isValid)) break; |
| 9539 if ($notnull_bool(dominated.dominator !== block)) { | 9550 if (dominated.dominator !== block) { |
| 9540 this.markInvalid("dominated block not pointing back"); | 9551 this.markInvalid("dominated block not pointing back"); |
| 9541 } | 9552 } |
| 9542 if ($notnull_bool(dominated.id == null || dominated.id <= lastId)) { | 9553 if (dominated.id == null || dominated.id <= lastId) { |
| 9543 this.markInvalid("dominated.id === null or dominated has <= id"); | 9554 this.markInvalid("dominated.id === null or dominated has <= id"); |
| 9544 } | 9555 } |
| 9545 lastId = dominated.id; | 9556 lastId = dominated.id; |
| 9546 } | 9557 } |
| 9547 if ($notnull_bool(!$notnull_bool(this.isValid))) return; | 9558 if (!$notnull_bool(this.isValid)) return; |
| 9548 HInstructionVisitor.prototype.visitBasicBlock.call(this, block); | 9559 HInstructionVisitor.prototype.visitBasicBlock.call(this, block); |
| 9549 } | 9560 } |
| 9550 HValidator.countInstruction = function(instructions, instruction) { | 9561 HValidator.countInstruction = function(instructions, instruction) { |
| 9551 var result = 0; | 9562 var result = 0; |
| 9552 for (var i = 0; | 9563 for (var i = 0; |
| 9553 $notnull_bool(i < instructions.length); i++) { | 9564 i < instructions.length; i++) { |
| 9554 if ($notnull_bool(instructions.$index(i) === instruction)) result++; | 9565 if (instructions.$index(i) === instruction) result++; |
| 9555 } | 9566 } |
| 9556 return result; | 9567 return result; |
| 9557 } | 9568 } |
| 9558 HValidator.everyInstruction = function(instructions, f) { | 9569 HValidator.everyInstruction = function(instructions, f) { |
| 9559 var copy = ListFactory.ListFactory$from$factory(instructions); | 9570 var copy = ListFactory.ListFactory$from$factory(instructions); |
| 9560 for (var i = 0; | 9571 for (var i = 0; |
| 9561 $notnull_bool(i < copy.length); i++) { | 9572 i < copy.length; i++) { |
| 9562 var current = copy.$index(i); | 9573 var current = copy.$index(i); |
| 9563 if ($notnull_bool(current == null)) continue; | 9574 if (current == null) continue; |
| 9564 var count = 1; | 9575 var count = 1; |
| 9565 for (var j = i + 1; | 9576 for (var j = i + 1; |
| 9566 $notnull_bool(j < copy.length); j++) { | 9577 j < copy.length; j++) { |
| 9567 if ($notnull_bool(copy.$index(j) === current)) { | 9578 if (copy.$index(j) === current) { |
| 9568 copy.$setindex(j); | 9579 copy.$setindex(j); |
| 9569 count++; | 9580 count++; |
| 9570 } | 9581 } |
| 9571 } | 9582 } |
| 9572 if ($notnull_bool(!$notnull_bool(f.call$2(current, count)))) return false; | 9583 if (!$notnull_bool(f.call$2(current, count))) return false; |
| 9573 } | 9584 } |
| 9574 return true; | 9585 return true; |
| 9575 } | 9586 } |
| 9576 HValidator.prototype.visitInstruction = function(instruction) { | 9587 HValidator.prototype.visitInstruction = function(instruction) { |
| 9577 var $this = this; // closure support | 9588 var $this = this; // closure support |
| 9578 function hasCorrectInputs(instruction) { | 9589 function hasCorrectInputs(instruction) { |
| 9579 var inBasicBlock = instruction.isInBasicBlock(); | 9590 var inBasicBlock = instruction.isInBasicBlock(); |
| 9580 return HValidator.everyInstruction(instruction.inputs, (function (input, cou nt) { | 9591 return HValidator.everyInstruction(instruction.inputs, (function (input, cou nt) { |
| 9581 if ($notnull_bool(inBasicBlock)) { | 9592 if ($notnull_bool(inBasicBlock)) { |
| 9582 return HValidator.countInstruction(input.get$usedBy(), (instruction && i nstruction.is$HInstruction())) == count; | 9593 return HValidator.countInstruction(input.get$usedBy(), (instruction && i nstruction.is$HInstruction())) == count; |
| 9583 } | 9594 } |
| 9584 else { | 9595 else { |
| 9585 return HValidator.countInstruction(input.get$usedBy(), (instruction && i nstruction.is$HInstruction())) == 0; | 9596 return HValidator.countInstruction(input.get$usedBy(), (instruction && i nstruction.is$HInstruction())) == 0; |
| 9586 } | 9597 } |
| 9587 }) | 9598 }) |
| 9588 ); | 9599 ); |
| 9589 } | 9600 } |
| 9590 function hasCorrectUses(instruction) { | 9601 function hasCorrectUses(instruction) { |
| 9591 if ($notnull_bool(!$notnull_bool(instruction.isInBasicBlock()))) return true ; | 9602 if (!$notnull_bool(instruction.isInBasicBlock())) return true; |
| 9592 return HValidator.everyInstruction(instruction.get$usedBy(), (function (use, count) { | 9603 return HValidator.everyInstruction(instruction.get$usedBy(), (function (use, count) { |
| 9593 return HValidator.countInstruction(use.inputs, (instruction && instruction .is$HInstruction())) == count; | 9604 return HValidator.countInstruction(use.inputs, (instruction && instruction .is$HInstruction())) == count; |
| 9594 }) | 9605 }) |
| 9595 ); | 9606 ); |
| 9596 } | 9607 } |
| 9597 this.isValid = $notnull_bool(this.isValid && hasCorrectInputs(instruction)) && hasCorrectUses(instruction); | 9608 this.isValid = $notnull_bool($notnull_bool(this.isValid && hasCorrectInputs(in struction)) && hasCorrectUses(instruction)); |
| 9598 } | 9609 } |
| 9599 // ********** Code for top level ************** | 9610 // ********** Code for top level ************** |
| 9600 // ********** Library leg ************** | 9611 // ********** Library leg ************** |
| 9601 // ********** Code for WorldCompiler ************** | 9612 // ********** Code for WorldCompiler ************** |
| 9602 function WorldCompiler(world, script) { | 9613 function WorldCompiler(world, script) { |
| 9603 this.world = world; | 9614 this.world = world; |
| 9604 Compiler.call(this, script); | 9615 Compiler.call(this, script); |
| 9605 // Initializers done | 9616 // Initializers done |
| 9606 } | 9617 } |
| 9607 $inherits(WorldCompiler, Compiler); | 9618 $inherits(WorldCompiler, Compiler); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 9620 for (var $i0 = 0;$i0 < $list.length; $i0++) { | 9631 for (var $i0 = 0;$i0 < $list.length; $i0++) { |
| 9621 var task = $list.$index($i0); | 9632 var task = $list.$index($i0); |
| 9622 this.log(('' + task.get$name() + ' took ' + task.get$timing() + 'msec')); | 9633 this.log(('' + task.get$name() + ' took ' + task.get$timing() + 'msec')); |
| 9623 } | 9634 } |
| 9624 } | 9635 } |
| 9625 return success; | 9636 return success; |
| 9626 } | 9637 } |
| 9627 WorldCompiler.prototype.spanFromNode = function(node) { | 9638 WorldCompiler.prototype.spanFromNode = function(node) { |
| 9628 var begin = node.getBeginToken(); | 9639 var begin = node.getBeginToken(); |
| 9629 var end = node.getEndToken(); | 9640 var end = node.getEndToken(); |
| 9630 if ($notnull_bool(begin == null || end == null)) { | 9641 if (begin == null || end == null) { |
| 9631 this.cancel(('cannot find tokens to produce error message for ' + node + '.' )); | 9642 this.cancel(('cannot find tokens to produce error message for ' + node + '.' )); |
| 9632 } | 9643 } |
| 9633 var startOffset = begin.get$charOffset(); | 9644 var startOffset = begin.get$charOffset(); |
| 9634 var endOffset = end.get$charOffset() + end.toString().length; | 9645 var endOffset = end.get$charOffset() + end.toString().length; |
| 9635 return new SourceSpan(this.script.file, startOffset, endOffset); | 9646 return new SourceSpan(this.script.file, startOffset, endOffset); |
| 9636 } | 9647 } |
| 9637 WorldCompiler.prototype.reportWarning = function(node, message) { | 9648 WorldCompiler.prototype.reportWarning = function(node, message) { |
| 9638 var $0; | 9649 var $0; |
| 9639 this.world.warning(('' + message + '.'), (($0 = this.spanFromNode(node)) && $0 .is$SourceSpan())); | 9650 this.world.warning(('' + message + '.'), (($0 = this.spanFromNode(node)) && $0 .is$SourceSpan())); |
| 9640 } | 9651 } |
| 9641 // ********** Code for Compiler ************** | 9652 // ********** Code for Compiler ************** |
| 9642 function Compiler(script) { | 9653 function Compiler(script) { |
| 9643 this.script = script; | 9654 this.script = script; |
| 9644 // Initializers done | 9655 // Initializers done |
| 9645 this.universe = new Universe(); | 9656 this.universe = new Universe(); |
| 9646 this.worklist = DoubleLinkedQueue.DoubleLinkedQueue$from$factory([const$3/*Com piler.MAIN*/]); | 9657 this.worklist = DoubleLinkedQueue.DoubleLinkedQueue$from$factory([const$3/*Com piler.MAIN*/]); |
| 9647 this.scanner = new ScannerTask(this); | 9658 this.scanner = new ScannerTask(this); |
| 9648 this.parser = new ParserTask(this); | 9659 this.parser = new ParserTask(this); |
| 9649 this.resolver = new ResolverTask(this); | 9660 this.resolver = new ResolverTask(this); |
| 9650 this.checker = new TypeCheckerTask(this); | 9661 this.checker = new TypeCheckerTask(this); |
| 9651 this.builder = new SsaBuilderTask(this); | 9662 this.builder = new SsaBuilderTask(this); |
| 9652 this.optimizer = new SsaOptimizerTask(this); | 9663 this.optimizer = new SsaOptimizerTask(this); |
| 9653 this.generator = new SsaCodeGeneratorTask(this); | 9664 this.generator = new SsaCodeGeneratorTask(this); |
| 9654 this.tasks = [this.scanner, this.parser, this.resolver, this.checker, this.bui lder, this.optimizer, this.generator]; | 9665 this.tasks = [this.scanner, this.parser, this.resolver, this.checker, this.bui lder, this.optimizer, this.generator]; |
| 9655 } | 9666 } |
| 9656 Compiler.prototype.ensure = function(condition) { | 9667 Compiler.prototype.ensure = function(condition) { |
| 9657 if ($notnull_bool(!$notnull_bool(condition))) this.cancel('failed assertion in leg'); | 9668 if (!$notnull_bool(condition)) this.cancel('failed assertion in leg'); |
| 9658 } | 9669 } |
| 9659 Compiler.prototype.unimplemented = function(methodName) { | 9670 Compiler.prototype.unimplemented = function(methodName) { |
| 9660 this.cancel(("" + methodName + " not implemented")); | 9671 this.cancel(("" + methodName + " not implemented")); |
| 9661 } | 9672 } |
| 9662 Compiler.prototype.cancel = function(reason) { | 9673 Compiler.prototype.cancel = function(reason) { |
| 9663 $throw(new CompilerCancelledException(reason)); | 9674 $throw(new CompilerCancelledException(reason)); |
| 9664 } | 9675 } |
| 9665 Compiler.prototype.log = function(message) { | 9676 Compiler.prototype.log = function(message) { |
| 9666 | 9677 |
| 9667 } | 9678 } |
| 9668 Compiler.prototype.run = function() { | 9679 Compiler.prototype.run = function() { |
| 9669 try { | 9680 try { |
| 9670 this.runCompiler(); | 9681 this.runCompiler(); |
| 9671 } catch (exception) { | 9682 } catch (exception) { |
| 9672 exception = $toDartException(exception); | 9683 exception = $toDartException(exception); |
| 9673 if (!(exception instanceof CompilerCancelledException)) throw exception; | 9684 if (!(exception instanceof CompilerCancelledException)) throw exception; |
| 9674 this.log(exception.toString()); | 9685 this.log(exception.toString()); |
| 9675 this.log('compilation failed'); | 9686 this.log('compilation failed'); |
| 9676 return false; | 9687 return false; |
| 9677 } | 9688 } |
| 9678 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) { | 9689 if (false/*null.GENERATE_SSA_TRACE*/) { |
| 9679 print("------------------"); | 9690 print("------------------"); |
| 9680 print(HTracer.HTracer$singleton$factory()); | 9691 print(HTracer.HTracer$singleton$factory()); |
| 9681 print("------------------"); | 9692 print("------------------"); |
| 9682 } | 9693 } |
| 9683 this.log('compilation succeeded'); | 9694 this.log('compilation succeeded'); |
| 9684 return true; | 9695 return true; |
| 9685 } | 9696 } |
| 9686 Compiler.prototype.scanCoreLibrary = function() { | 9697 Compiler.prototype.scanCoreLibrary = function() { |
| 9687 var fileName = join([options.libDir, '..', 'leg', 'lib', 'core.dart']); | 9698 var fileName = join([options.libDir, '..', 'leg', 'lib', 'core.dart']); |
| 9688 var file = readSync(fileName); | 9699 var file = readSync(fileName); |
| 9689 this.scanner.scan(new leg_Script(file)); | 9700 this.scanner.scan(new leg_Script(file)); |
| 9690 var element = new ForeignElement(const$243/*const SourceString('JS')*/); | 9701 var element = new ForeignElement(const$243/*const SourceString('JS')*/); |
| 9691 this.universe.define(element); | 9702 this.universe.define(element); |
| 9692 } | 9703 } |
| 9693 Compiler.prototype.runCompiler = function() { | 9704 Compiler.prototype.runCompiler = function() { |
| 9694 var $0; | 9705 var $0; |
| 9695 this.scanCoreLibrary(); | 9706 this.scanCoreLibrary(); |
| 9696 this.scanner.scan(this.script); | 9707 this.scanner.scan(this.script); |
| 9697 while ($notnull_bool(!$notnull_bool(this.worklist.isEmpty()))) { | 9708 while (!this.worklist.isEmpty()) { |
| 9698 this.compileMethod((($0 = this.worklist.removeLast()) && $0.is$SourceString( ))); | 9709 this.compileMethod((($0 = this.worklist.removeLast()) && $0.is$SourceString( ))); |
| 9699 } | 9710 } |
| 9700 } | 9711 } |
| 9701 Compiler.prototype.compileMethod = function(name) { | 9712 Compiler.prototype.compileMethod = function(name) { |
| 9702 var element = this.universe.find(name); | 9713 var element = this.universe.find(name); |
| 9703 if ($notnull_bool(element == null)) this.cancel(('Could not find ' + name + '' )); | 9714 if (element == null) this.cancel(('Could not find ' + name + '')); |
| 9704 var tree = this.parser.parse(element); | 9715 var tree = this.parser.parse(element); |
| 9705 var elements = this.resolver.resolve(tree); | 9716 var elements = this.resolver.resolve(tree); |
| 9706 this.checker.check(tree, elements); | 9717 this.checker.check(tree, elements); |
| 9707 var graph = this.builder.build(tree, elements); | 9718 var graph = this.builder.build(tree, elements); |
| 9708 this.optimizer.optimize(graph); | 9719 this.optimizer.optimize(graph); |
| 9709 var code = this.generator.generate(tree, graph); | 9720 var code = this.generator.generate(tree, graph); |
| 9710 this.universe.addGeneratedCode(element, code); | 9721 this.universe.addGeneratedCode(element, code); |
| 9711 return code; | 9722 return code; |
| 9712 } | 9723 } |
| 9713 Compiler.prototype.getGeneratedCode = function() { | 9724 Compiler.prototype.getGeneratedCode = function() { |
| 9714 var $0; | 9725 var $0; |
| 9715 var buffer = new StringBufferImpl(""); | 9726 var buffer = new StringBufferImpl(""); |
| 9716 buffer.add("function $add(a, b) {\n return a + b;\n}\n"/*null.ADD_SUPPORT*/); | 9727 buffer.add("function $add(a, b) {\n return a + b;\n}\n"/*null.ADD_SUPPORT*/); |
| 9717 buffer.add("function $div(a, b) {\n return a / b;\n}\n"/*null.DIV_SUPPORT*/); | 9728 buffer.add("function $div(a, b) {\n return a / b;\n}\n"/*null.DIV_SUPPORT*/); |
| 9718 buffer.add("function $eq(a, b) {\n return a === b;\n}\n"/*null.EQ_SUPPORT*/); | 9729 buffer.add("function $eq(a, b) {\n return a === b;\n}\n"/*null.EQ_SUPPORT*/); |
| 9719 buffer.add("function $sub(a, b) {\n return a - b;\n}\n"/*null.SUB_SUPPORT*/); | 9730 buffer.add("function $sub(a, b) {\n return a - b;\n}\n"/*null.SUB_SUPPORT*/); |
| 9720 buffer.add("function $mul(a, b) {\n return a * b;\n}\n"/*null.MUL_SUPPORT*/); | 9731 buffer.add("function $mul(a, b) {\n return a * b;\n}\n"/*null.MUL_SUPPORT*/); |
| 9721 buffer.add("function $tdiv(a, b) {\n var tmp = this / other;\n if (tmp < 0) {\n return Math.ceil(tmp);\n } else {\n return Math.floor(tmp);\n }\n}\n "/*null.TDIV_SUPPORT*/); | 9732 buffer.add("function $tdiv(a, b) {\n var tmp = this / other;\n if (tmp < 0) {\n return Math.ceil(tmp);\n } else {\n return Math.floor(tmp);\n }\n}\n "/*null.TDIV_SUPPORT*/); |
| 9722 var codeBlocks = (($0 = this.universe.generatedCode.getValues()) && $0.is$List $String()); | 9733 var codeBlocks = (($0 = this.universe.generatedCode.getValues()) && $0.is$List $String()); |
| 9723 for (var i = codeBlocks.length - 1; | 9734 for (var i = codeBlocks.length - 1; |
| 9724 $notnull_bool(i >= 0); i--) { | 9735 i >= 0; i--) { |
| 9725 buffer.add(codeBlocks.$index(i)); | 9736 buffer.add(codeBlocks.$index(i)); |
| 9726 } | 9737 } |
| 9727 buffer.add('main();\n'); | 9738 buffer.add('main();\n'); |
| 9728 return buffer.toString(); | 9739 return buffer.toString(); |
| 9729 } | 9740 } |
| 9730 Compiler.prototype.reportWarning = function(node, message) { | 9741 Compiler.prototype.reportWarning = function(node, message) { |
| 9731 | 9742 |
| 9732 } | 9743 } |
| 9733 // ********** Code for CompilerTask ************** | 9744 // ********** Code for CompilerTask ************** |
| 9734 function CompilerTask(compiler) { | 9745 function CompilerTask(compiler) { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 9748 this.watch.stop(); | 9759 this.watch.stop(); |
| 9749 return result; | 9760 return result; |
| 9750 } | 9761 } |
| 9751 // ********** Code for CompilerCancelledException ************** | 9762 // ********** Code for CompilerCancelledException ************** |
| 9752 function CompilerCancelledException(reason) { | 9763 function CompilerCancelledException(reason) { |
| 9753 this.reason = reason; | 9764 this.reason = reason; |
| 9754 // Initializers done | 9765 // Initializers done |
| 9755 } | 9766 } |
| 9756 CompilerCancelledException.prototype.toString = function() { | 9767 CompilerCancelledException.prototype.toString = function() { |
| 9757 var banner = 'compiler cancelled'; | 9768 var banner = 'compiler cancelled'; |
| 9758 return $notnull_bool((this.reason != null)) ? ('' + banner + ': ' + this.reaso n + '') : ('' + banner + ''); | 9769 return (this.reason != null) ? ('' + banner + ': ' + this.reason + '') : ('' + banner + ''); |
| 9759 } | 9770 } |
| 9760 // ********** Code for ResolverTask ************** | 9771 // ********** Code for ResolverTask ************** |
| 9761 function ResolverTask(compiler) { | 9772 function ResolverTask(compiler) { |
| 9762 CompilerTask.call(this, compiler); | 9773 CompilerTask.call(this, compiler); |
| 9763 // Initializers done | 9774 // Initializers done |
| 9764 } | 9775 } |
| 9765 $inherits(ResolverTask, CompilerTask); | 9776 $inherits(ResolverTask, CompilerTask); |
| 9766 ResolverTask.prototype.get$name = function() { | 9777 ResolverTask.prototype.get$name = function() { |
| 9767 return 'Resolver'; | 9778 return 'Resolver'; |
| 9768 } | 9779 } |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 9794 this.context = new Scope(new TopScope(compiler.universe)); | 9805 this.context = new Scope(new TopScope(compiler.universe)); |
| 9795 // Initializers done | 9806 // Initializers done |
| 9796 } | 9807 } |
| 9797 ResolverVisitor.prototype.fail = function(node, message) { | 9808 ResolverVisitor.prototype.fail = function(node, message) { |
| 9798 this.compiler.cancel(message); | 9809 this.compiler.cancel(message); |
| 9799 } | 9810 } |
| 9800 ResolverVisitor.prototype.warning = function(node, message) { | 9811 ResolverVisitor.prototype.warning = function(node, message) { |
| 9801 this.compiler.reportWarning(node, message); | 9812 this.compiler.reportWarning(node, message); |
| 9802 } | 9813 } |
| 9803 ResolverVisitor.prototype.visit = function(node) { | 9814 ResolverVisitor.prototype.visit = function(node) { |
| 9804 if ($notnull_bool(node == null)) return null; | 9815 if (node == null) return null; |
| 9805 return node.accept(this); | 9816 return node.accept(this); |
| 9806 } | 9817 } |
| 9807 ResolverVisitor.prototype.visitIn = function(node, scope) { | 9818 ResolverVisitor.prototype.visitIn = function(node, scope) { |
| 9808 var $0; | 9819 var $0; |
| 9809 this.context = scope; | 9820 this.context = scope; |
| 9810 var element = (($0 = this.visit(node)) && $0.is$Element()); | 9821 var element = (($0 = this.visit(node)) && $0.is$Element()); |
| 9811 this.context = this.context.parent; | 9822 this.context = this.context.parent; |
| 9812 return element; | 9823 return element; |
| 9813 } | 9824 } |
| 9814 ResolverVisitor.prototype.visitBlock = function(node) { | 9825 ResolverVisitor.prototype.visitBlock = function(node) { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 9827 ResolverVisitor.prototype.visitFunctionExpression = function(node) { | 9838 ResolverVisitor.prototype.visitFunctionExpression = function(node) { |
| 9828 var $0; | 9839 var $0; |
| 9829 var enclosingElement = (($0 = this.visit(node.name)) && $0.is$Element()); | 9840 var enclosingElement = (($0 = this.visit(node.name)) && $0.is$Element()); |
| 9830 var newScope = new Scope.enclosing$ctor(this.context, enclosingElement); | 9841 var newScope = new Scope.enclosing$ctor(this.context, enclosingElement); |
| 9831 this.visitIn(node.parameters, newScope); | 9842 this.visitIn(node.parameters, newScope); |
| 9832 this.visitIn(node.body, newScope); | 9843 this.visitIn(node.body, newScope); |
| 9833 return enclosingElement; | 9844 return enclosingElement; |
| 9834 } | 9845 } |
| 9835 ResolverVisitor.prototype.visitIdentifier = function(node) { | 9846 ResolverVisitor.prototype.visitIdentifier = function(node) { |
| 9836 var element = this.context.lookup(node.get$source()); | 9847 var element = this.context.lookup(node.get$source()); |
| 9837 if ($notnull_bool(element == null)) this.fail(node, ErrorMessages.cannotResolv e(node)); | 9848 if (element == null) this.fail(node, ErrorMessages.cannotResolve(node)); |
| 9838 return this.useElement(node, element); | 9849 return this.useElement(node, element); |
| 9839 } | 9850 } |
| 9840 ResolverVisitor.prototype.visitIf = function(node) { | 9851 ResolverVisitor.prototype.visitIf = function(node) { |
| 9841 this.visit(node.condition); | 9852 this.visit(node.condition); |
| 9842 this.visit(node.thenPart); | 9853 this.visit(node.thenPart); |
| 9843 this.visit(node.elsePart); | 9854 this.visit(node.elsePart); |
| 9844 } | 9855 } |
| 9845 ResolverVisitor.prototype.visitSend = function(node) { | 9856 ResolverVisitor.prototype.visitSend = function(node) { |
| 9846 var $0; | 9857 var $0; |
| 9847 var target = null; | 9858 var target = null; |
| 9848 this.visit(node.receiver); | 9859 this.visit(node.receiver); |
| 9849 var selector = (($0 = node.selector) && $0.is$Identifier()); | 9860 var selector = (($0 = node.selector) && $0.is$Identifier()); |
| 9850 var name = selector.get$source(); | 9861 var name = selector.get$source(); |
| 9851 if ($notnull_bool($eq(name, const$247/*const SourceString('+')*/) || $eq(name, const$248/*const SourceString('-')*/)) || $eq(name, const$249/*const SourceStri ng('*')*/) || $eq(name, const$250/*const SourceString('/')*/) || $eq(name, const $251/*const SourceString('<')*/) || $eq(name, const$252/*const SourceString('~/' )*/) || $eq(name, const$253/*const SourceString('==')*/)) { | 9862 if ($notnull_bool($notnull_bool($notnull_bool($notnull_bool($notnull_bool($not null_bool($eq(name, const$247/*const SourceString('+')*/) || $eq(name, const$248 /*const SourceString('-')*/)) || $eq(name, const$249/*const SourceString('*')*/) ) || $eq(name, const$250/*const SourceString('/')*/)) || $eq(name, const$251/*co nst SourceString('<')*/)) || $eq(name, const$252/*const SourceString('~/')*/)) | | $eq(name, const$253/*const SourceString('==')*/))) { |
| 9852 } | 9863 } |
| 9853 else { | 9864 else { |
| 9854 target = this.context.lookup(name); | 9865 target = this.context.lookup(name); |
| 9855 if ($notnull_bool(target == null)) this.fail(node, ErrorMessages.cannotResol ve(name)); | 9866 if (target == null) this.fail(node, ErrorMessages.cannotResolve(name)); |
| 9856 } | 9867 } |
| 9857 this.visit(node.argumentsNode); | 9868 this.visit(node.argumentsNode); |
| 9858 return this.useElement(node, target); | 9869 return this.useElement(node, target); |
| 9859 } | 9870 } |
| 9860 ResolverVisitor.prototype.visitSendSet = function(node) { | 9871 ResolverVisitor.prototype.visitSendSet = function(node) { |
| 9861 var $0; | 9872 var $0; |
| 9862 var receiver = (($0 = this.visit(node.receiver)) && $0.is$Element()); | 9873 var receiver = (($0 = this.visit(node.receiver)) && $0.is$Element()); |
| 9863 var selector = (($0 = node.selector) && $0.is$Identifier()); | 9874 var selector = (($0 = node.selector) && $0.is$Identifier()); |
| 9864 if ($notnull_bool(receiver != null)) { | 9875 if (receiver != null) { |
| 9865 this.compiler.unimplemented('Resolver: property access'); | 9876 this.compiler.unimplemented('Resolver: property access'); |
| 9866 } | 9877 } |
| 9867 var target = this.context.lookup(selector.get$source()); | 9878 var target = this.context.lookup(selector.get$source()); |
| 9868 if ($notnull_bool(target == null)) this.fail(node, ErrorMessages.cannotResolve (node)); | 9879 if (target == null) this.fail(node, ErrorMessages.cannotResolve(node)); |
| 9869 this.visit(node.argumentsNode); | 9880 this.visit(node.argumentsNode); |
| 9870 return this.useElement(node, target); | 9881 return this.useElement(node, target); |
| 9871 } | 9882 } |
| 9872 ResolverVisitor.prototype.visitLiteralInt = function(node) { | 9883 ResolverVisitor.prototype.visitLiteralInt = function(node) { |
| 9873 | 9884 |
| 9874 } | 9885 } |
| 9875 ResolverVisitor.prototype.visitLiteralDouble = function(node) { | 9886 ResolverVisitor.prototype.visitLiteralDouble = function(node) { |
| 9876 | 9887 |
| 9877 } | 9888 } |
| 9878 ResolverVisitor.prototype.visitLiteralBool = function(node) { | 9889 ResolverVisitor.prototype.visitLiteralBool = function(node) { |
| 9879 | 9890 |
| 9880 } | 9891 } |
| 9881 ResolverVisitor.prototype.visitLiteralString = function(node) { | 9892 ResolverVisitor.prototype.visitLiteralString = function(node) { |
| 9882 | 9893 |
| 9883 } | 9894 } |
| 9884 ResolverVisitor.prototype.visitNodeList = function(node) { | 9895 ResolverVisitor.prototype.visitNodeList = function(node) { |
| 9885 var $0; | 9896 var $0; |
| 9886 for (var link = node.nodes; | 9897 for (var link = node.nodes; |
| 9887 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { | 9898 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ Node())) { |
| 9888 this.visit((($0 = link.get$head()) && $0.is$Node())); | 9899 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 9889 } | 9900 } |
| 9890 } | 9901 } |
| 9891 ResolverVisitor.prototype.visitOperator = function(node) { | 9902 ResolverVisitor.prototype.visitOperator = function(node) { |
| 9892 this.fail(node, "Unimplemented in the resolver"); | 9903 this.fail(node, "Unimplemented in the resolver"); |
| 9893 } | 9904 } |
| 9894 ResolverVisitor.prototype.visitReturn = function(node) { | 9905 ResolverVisitor.prototype.visitReturn = function(node) { |
| 9895 this.visit(node.expression); | 9906 this.visit(node.expression); |
| 9896 } | 9907 } |
| 9897 ResolverVisitor.prototype.visitThrow = function(node) { | 9908 ResolverVisitor.prototype.visitThrow = function(node) { |
| 9898 this.visit(node.expression); | 9909 this.visit(node.expression); |
| 9899 } | 9910 } |
| 9900 ResolverVisitor.prototype.visitTypeAnnotation = function(node) { | 9911 ResolverVisitor.prototype.visitTypeAnnotation = function(node) { |
| 9901 var name = node.typeName; | 9912 var name = node.typeName; |
| 9902 if ($notnull_bool($eq(name.get$source(), const$254/*const SourceString('var')* /))) return null; | 9913 if ($notnull_bool($eq(name.get$source(), const$254/*const SourceString('var')* /))) return null; |
| 9903 var element = this.context.lookup(name.get$source()); | 9914 var element = this.context.lookup(name.get$source()); |
| 9904 if ($notnull_bool(element == null)) { | 9915 if (element == null) { |
| 9905 this.warning(node, ErrorMessages.cannotResolveType(name)); | 9916 this.warning(node, ErrorMessages.cannotResolveType(name)); |
| 9906 } | 9917 } |
| 9907 return this.useElement(node, element); | 9918 return this.useElement(node, element); |
| 9908 } | 9919 } |
| 9909 ResolverVisitor.prototype.visitVariableDefinitions = function(node) { | 9920 ResolverVisitor.prototype.visitVariableDefinitions = function(node) { |
| 9910 this.visit(node.type); | 9921 this.visit(node.type); |
| 9911 var visitor = new VariableDefinitionsVisitor(node, this); | 9922 var visitor = new VariableDefinitionsVisitor(node, this); |
| 9912 visitor.visit(node.definitions); | 9923 visitor.visit(node.definitions); |
| 9913 } | 9924 } |
| 9914 ResolverVisitor.prototype.defineElement = function(node, element) { | 9925 ResolverVisitor.prototype.defineElement = function(node, element) { |
| 9915 var $0; | 9926 var $0; |
| 9916 this.compiler.ensure(element != null); | 9927 this.compiler.ensure(element != null); |
| 9917 this.mapping.$setindex(node, element); | 9928 this.mapping.$setindex(node, element); |
| 9918 return (($0 = this.context.add(element)) && $0.is$Element()); | 9929 return (($0 = this.context.add(element)) && $0.is$Element()); |
| 9919 } | 9930 } |
| 9920 ResolverVisitor.prototype.useElement = function(node, element) { | 9931 ResolverVisitor.prototype.useElement = function(node, element) { |
| 9921 if ($notnull_bool(element == null)) return null; | 9932 if (element == null) return null; |
| 9922 this.mapping.$setindex(node, element); | 9933 this.mapping.$setindex(node, element); |
| 9923 return element; | 9934 return element; |
| 9924 } | 9935 } |
| 9925 // ********** Code for VariableDefinitionsVisitor ************** | 9936 // ********** Code for VariableDefinitionsVisitor ************** |
| 9926 function VariableDefinitionsVisitor(definitions, resolver) { | 9937 function VariableDefinitionsVisitor(definitions, resolver) { |
| 9927 this.definitions = definitions; | 9938 this.definitions = definitions; |
| 9928 this.resolver = resolver; | 9939 this.resolver = resolver; |
| 9929 // Initializers done | 9940 // Initializers done |
| 9930 } | 9941 } |
| 9931 VariableDefinitionsVisitor.prototype.visitSendSet = function(node) { | 9942 VariableDefinitionsVisitor.prototype.visitSendSet = function(node) { |
| 9932 var $0; | 9943 var $0; |
| 9933 $assert(node.get$arguments().get$tail().isEmpty(), "node.arguments.tail.isEmpt y()", "resolver.dart", 200, 12); | 9944 $assert(node.get$arguments().get$tail().isEmpty(), "node.arguments.tail.isEmpt y()", "resolver.dart", 200, 12); |
| 9934 if ($notnull_bool(node.receiver != null)) { | 9945 if (node.receiver != null) { |
| 9935 this.resolver.compiler.unimplemented("receiver on a variable definition"); | 9946 this.resolver.compiler.unimplemented("receiver on a variable definition"); |
| 9936 } | 9947 } |
| 9937 var selector = (($0 = node.selector) && $0.is$Identifier()); | 9948 var selector = (($0 = node.selector) && $0.is$Identifier()); |
| 9938 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node())); | 9949 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node())); |
| 9939 return (($0 = this.visit(node.selector)) && $0.is$SourceString()); | 9950 return (($0 = this.visit(node.selector)) && $0.is$SourceString()); |
| 9940 } | 9951 } |
| 9941 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { | 9952 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { |
| 9942 return node.get$source(); | 9953 return node.get$source(); |
| 9943 } | 9954 } |
| 9944 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { | 9955 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { |
| 9945 var $0; | 9956 var $0; |
| 9946 for (var link = node.nodes; | 9957 for (var link = node.nodes; |
| 9947 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { | 9958 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ Node())) { |
| 9948 var name = (($0 = this.visit((($0 = link.get$head()) && $0.is$Node()))) && $ 0.is$SourceString()); | 9959 var name = (($0 = this.visit((($0 = link.get$head()) && $0.is$Node()))) && $ 0.is$SourceString()); |
| 9949 var element = new VariableElement((($0 = link.get$head()) && $0.is$Node()), this.definitions.type, name, this.resolver.context.enclosingElement); | 9960 var element = new VariableElement((($0 = link.get$head()) && $0.is$Node()), this.definitions.type, name, this.resolver.context.enclosingElement); |
| 9950 var existing = this.resolver.defineElement((($0 = link.get$head()) && $0.is$ Node()), element); | 9961 var existing = this.resolver.defineElement((($0 = link.get$head()) && $0.is$ Node()), element); |
| 9951 if ($notnull_bool($ne(existing, element))) { | 9962 if ($ne(existing, element)) { |
| 9952 this.resolver.fail(node, ErrorMessages.duplicateDefinition(link.get$head() )); | 9963 this.resolver.fail(node, ErrorMessages.duplicateDefinition(link.get$head() )); |
| 9953 } | 9964 } |
| 9954 } | 9965 } |
| 9955 } | 9966 } |
| 9956 VariableDefinitionsVisitor.prototype.visit = function(node) { | 9967 VariableDefinitionsVisitor.prototype.visit = function(node) { |
| 9957 return node.accept(this); | 9968 return node.accept(this); |
| 9958 } | 9969 } |
| 9959 // ********** Code for Scope ************** | 9970 // ********** Code for Scope ************** |
| 9960 function Scope(parent) { | 9971 function Scope(parent) { |
| 9961 Scope.enclosing$ctor.call(this, parent, parent.enclosingElement); | 9972 Scope.enclosing$ctor.call(this, parent, parent.enclosingElement); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 9972 this.parent = parent; | 9983 this.parent = parent; |
| 9973 this.enclosingElement = enclosingElement; | 9984 this.enclosingElement = enclosingElement; |
| 9974 this.elements = $map([]); | 9985 this.elements = $map([]); |
| 9975 // Initializers done | 9986 // Initializers done |
| 9976 } | 9987 } |
| 9977 Scope.enclosing$ctor.prototype = Scope.prototype; | 9988 Scope.enclosing$ctor.prototype = Scope.prototype; |
| 9978 Scope.prototype.get$parent = function() { return this.parent; }; | 9989 Scope.prototype.get$parent = function() { return this.parent; }; |
| 9979 Scope.prototype.lookup = function(name) { | 9990 Scope.prototype.lookup = function(name) { |
| 9980 var $0; | 9991 var $0; |
| 9981 var element = (($0 = this.elements.$index(name)) && $0.is$Element()); | 9992 var element = (($0 = this.elements.$index(name)) && $0.is$Element()); |
| 9982 if ($notnull_bool(element != null)) return element; | 9993 if (element != null) return element; |
| 9983 return this.parent.lookup(name); | 9994 return this.parent.lookup(name); |
| 9984 } | 9995 } |
| 9985 Scope.prototype.add = function(element) { | 9996 Scope.prototype.add = function(element) { |
| 9986 var $0; | 9997 var $0; |
| 9987 if ($notnull_bool(this.elements.containsKey(element.name))) return (($0 = this .elements.$index(element.name)) && $0.is$Element()); | 9998 if (this.elements.containsKey(element.name)) return (($0 = this.elements.$inde x(element.name)) && $0.is$Element()); |
| 9988 this.elements.$setindex(element.name, element); | 9999 this.elements.$setindex(element.name, element); |
| 9989 return element; | 10000 return element; |
| 9990 } | 10001 } |
| 9991 // ********** Code for TopScope ************** | 10002 // ********** Code for TopScope ************** |
| 9992 function TopScope(universe) { | 10003 function TopScope(universe) { |
| 9993 this.universe = universe; | 10004 this.universe = universe; |
| 9994 Scope.top$ctor.call(this); | 10005 Scope.top$ctor.call(this); |
| 9995 // Initializers done | 10006 // Initializers done |
| 9996 } | 10007 } |
| 9997 $inherits(TopScope, Scope); | 10008 $inherits(TopScope, Scope); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10098 } | 10109 } |
| 10099 else if ($notnull_bool($eq(const$10/*Types.DYNAMIC*/, s) || s.get$stringValue( ) === 'var')) { | 10110 else if ($notnull_bool($eq(const$10/*Types.DYNAMIC*/, s) || s.get$stringValue( ) === 'var')) { |
| 10100 return this.dynamicType; | 10111 return this.dynamicType; |
| 10101 } | 10112 } |
| 10102 else if ($notnull_bool($eq(const$12/*Types.STRING*/, s))) { | 10113 else if ($notnull_bool($eq(const$12/*Types.STRING*/, s))) { |
| 10103 return this.stringType; | 10114 return this.stringType; |
| 10104 } | 10115 } |
| 10105 return null; | 10116 return null; |
| 10106 } | 10117 } |
| 10107 Types.prototype.isSubtype = function(r, s) { | 10118 Types.prototype.isSubtype = function(r, s) { |
| 10108 return $notnull_bool(r === s || r === this.dynamicType) || s === this.dynamicT ype; | 10119 return r === s || r === this.dynamicType || s === this.dynamicType; |
| 10109 } | 10120 } |
| 10110 Types.prototype.isAssignable = function(r, s) { | 10121 Types.prototype.isAssignable = function(r, s) { |
| 10111 return $notnull_bool(this.isSubtype(r, s) || this.isSubtype(s, r)); | 10122 return $notnull_bool(this.isSubtype(r, s) || this.isSubtype(s, r)); |
| 10112 } | 10123 } |
| 10113 // ********** Code for CancelTypeCheckException ************** | 10124 // ********** Code for CancelTypeCheckException ************** |
| 10114 function CancelTypeCheckException(node, reason) { | 10125 function CancelTypeCheckException(node, reason) { |
| 10115 this.node = node; | 10126 this.node = node; |
| 10116 this.reason = reason; | 10127 this.reason = reason; |
| 10117 // Initializers done | 10128 // Initializers done |
| 10118 } | 10129 } |
| 10119 // ********** Code for TypeCheckerVisitor ************** | 10130 // ********** Code for TypeCheckerVisitor ************** |
| 10120 function TypeCheckerVisitor(compiler, elements, types) { | 10131 function TypeCheckerVisitor(compiler, elements, types) { |
| 10121 this.compiler = compiler; | 10132 this.compiler = compiler; |
| 10122 this.elements = elements; | 10133 this.elements = elements; |
| 10123 this.types = types; | 10134 this.types = types; |
| 10124 // Initializers done | 10135 // Initializers done |
| 10125 } | 10136 } |
| 10126 TypeCheckerVisitor.prototype.fail = function(node, reason) { | 10137 TypeCheckerVisitor.prototype.fail = function(node, reason) { |
| 10127 var message = 'cannot type-check'; | 10138 var message = 'cannot type-check'; |
| 10128 if ($notnull_bool(reason != null)) { | 10139 if (reason != null) { |
| 10129 message = ('' + message + ': ' + reason + ''); | 10140 message = ('' + message + ': ' + reason + ''); |
| 10130 } | 10141 } |
| 10131 $throw(new CancelTypeCheckException(node, message)); | 10142 $throw(new CancelTypeCheckException(node, message)); |
| 10132 } | 10143 } |
| 10133 TypeCheckerVisitor.prototype.nonVoidType = function(node) { | 10144 TypeCheckerVisitor.prototype.nonVoidType = function(node) { |
| 10134 var type = this.type(node); | 10145 var type = this.type(node); |
| 10135 if ($notnull_bool($eq(type, this.types.voidType))) { | 10146 if ($eq(type, this.types.voidType)) { |
| 10136 this.compiler.reportWarning(node, CompilerError.voidExpression()); | 10147 this.compiler.reportWarning(node, CompilerError.voidExpression()); |
| 10137 } | 10148 } |
| 10138 return type; | 10149 return type; |
| 10139 } | 10150 } |
| 10140 TypeCheckerVisitor.prototype.typeWithDefault = function(node, defaultValue) { | 10151 TypeCheckerVisitor.prototype.typeWithDefault = function(node, defaultValue) { |
| 10141 return $notnull_bool(node != null) ? this.type(node) : defaultValue; | 10152 return node != null ? this.type(node) : defaultValue; |
| 10142 } | 10153 } |
| 10143 TypeCheckerVisitor.prototype.type = function(node) { | 10154 TypeCheckerVisitor.prototype.type = function(node) { |
| 10144 var $0; | 10155 var $0; |
| 10145 if ($notnull_bool(node == null)) this.fail(null, 'unexpected node: null'); | 10156 if (node == null) this.fail(null, 'unexpected node: null'); |
| 10146 var result = (($0 = node.accept(this)) && $0.is$Type()); | 10157 var result = (($0 = node.accept(this)) && $0.is$Type()); |
| 10147 return result; | 10158 return result; |
| 10148 } | 10159 } |
| 10149 TypeCheckerVisitor.prototype.checkAssignable = function(node, s, t) { | 10160 TypeCheckerVisitor.prototype.checkAssignable = function(node, s, t) { |
| 10150 if ($notnull_bool(!$notnull_bool(this.types.isAssignable(s, t)))) { | 10161 if (!$notnull_bool(this.types.isAssignable(s, t))) { |
| 10151 var error = CompilerError.notAssignable(s, t); | 10162 var error = CompilerError.notAssignable(s, t); |
| 10152 this.compiler.reportWarning(node, error); | 10163 this.compiler.reportWarning(node, error); |
| 10153 } | 10164 } |
| 10154 } | 10165 } |
| 10155 TypeCheckerVisitor.prototype.visitBlock = function(node) { | 10166 TypeCheckerVisitor.prototype.visitBlock = function(node) { |
| 10156 this.type(node.statements); | 10167 this.type(node.statements); |
| 10157 return this.types.voidType; | 10168 return this.types.voidType; |
| 10158 } | 10169 } |
| 10159 TypeCheckerVisitor.prototype.visitClassNode = function(node) { | 10170 TypeCheckerVisitor.prototype.visitClassNode = function(node) { |
| 10160 this.fail(node); | 10171 this.fail(node); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 10180 } | 10191 } |
| 10181 TypeCheckerVisitor.prototype.visitIf = function(node) { | 10192 TypeCheckerVisitor.prototype.visitIf = function(node) { |
| 10182 this.type(node.condition); | 10193 this.type(node.condition); |
| 10183 this.type(node.thenPart); | 10194 this.type(node.thenPart); |
| 10184 if ($notnull_bool(node.get$hasElsePart())) this.type(node.elsePart); | 10195 if ($notnull_bool(node.get$hasElsePart())) this.type(node.elsePart); |
| 10185 return this.types.voidType; | 10196 return this.types.voidType; |
| 10186 } | 10197 } |
| 10187 TypeCheckerVisitor.prototype.visitSend = function(node) { | 10198 TypeCheckerVisitor.prototype.visitSend = function(node) { |
| 10188 var $0; | 10199 var $0; |
| 10189 var target = this.elements.$index(node); | 10200 var target = this.elements.$index(node); |
| 10190 if ($notnull_bool(target != null)) { | 10201 if (target != null) { |
| 10191 var targetType = target.computeType(this.compiler, this.types); | 10202 var targetType = target.computeType(this.compiler, this.types); |
| 10192 if ($notnull_bool(node.get$isPropertyAccess())) { | 10203 if ($notnull_bool(node.get$isPropertyAccess())) { |
| 10193 return (targetType && targetType.is$Type()); | 10204 return (targetType && targetType.is$Type()); |
| 10194 } | 10205 } |
| 10195 else if ($notnull_bool(node.get$isFunctionObjectInvocation())) { | 10206 else if ($notnull_bool(node.get$isFunctionObjectInvocation())) { |
| 10196 this.fail(node); | 10207 this.fail(node); |
| 10197 } | 10208 } |
| 10198 else { | 10209 else { |
| 10199 if ($notnull_bool(!(targetType instanceof FunctionType))) { | 10210 if (!(targetType instanceof FunctionType)) { |
| 10200 if ($notnull_bool((target instanceof ForeignElement))) { | 10211 if ((target instanceof ForeignElement)) { |
| 10201 return this.types.dynamicType; | 10212 return this.types.dynamicType; |
| 10202 } | 10213 } |
| 10203 this.fail(node, 'can only handle function types'); | 10214 this.fail(node, 'can only handle function types'); |
| 10204 } | 10215 } |
| 10205 var funType = (targetType && targetType.is$FunctionType()); | 10216 var funType = (targetType && targetType.is$FunctionType()); |
| 10206 var formals = funType.parameterTypes; | 10217 var formals = funType.parameterTypes; |
| 10207 var arguments = node.get$arguments(); | 10218 var arguments = node.get$arguments(); |
| 10208 while ($notnull_bool((!$notnull_bool(formals.isEmpty())) && (!$notnull_boo l(arguments.isEmpty())))) { | 10219 while ((!$notnull_bool(formals.isEmpty())) && (!$notnull_bool(arguments.is Empty()))) { |
| 10209 var argument = (($0 = arguments.get$head()) && $0.is$Node()); | 10220 var argument = (($0 = arguments.get$head()) && $0.is$Node()); |
| 10210 var argumentType = this.type(argument); | 10221 var argumentType = this.type(argument); |
| 10211 this.checkAssignable(argument, argumentType, (($0 = formals.get$head()) && $0.is$Type())); | 10222 this.checkAssignable(argument, argumentType, (($0 = formals.get$head()) && $0.is$Type())); |
| 10212 formals = (($0 = formals.get$tail()) && $0.is$Link$Type()); | 10223 formals = (($0 = formals.get$tail()) && $0.is$Link$Type()); |
| 10213 arguments = (($0 = arguments.get$tail()) && $0.is$Link$Node()); | 10224 arguments = (($0 = arguments.get$tail()) && $0.is$Link$Node()); |
| 10214 } | 10225 } |
| 10215 if ($notnull_bool(!$notnull_bool(formals.isEmpty()))) { | 10226 if (!$notnull_bool(formals.isEmpty())) { |
| 10216 this.compiler.reportWarning(node, 'missing argument'); | 10227 this.compiler.reportWarning(node, 'missing argument'); |
| 10217 } | 10228 } |
| 10218 if ($notnull_bool(!$notnull_bool(arguments.isEmpty()))) { | 10229 if (!$notnull_bool(arguments.isEmpty())) { |
| 10219 this.compiler.reportWarning(arguments.get$head(), 'additional arguments' ); | 10230 this.compiler.reportWarning(arguments.get$head(), 'additional arguments' ); |
| 10220 } | 10231 } |
| 10221 return funType.returnType; | 10232 return funType.returnType; |
| 10222 } | 10233 } |
| 10223 } | 10234 } |
| 10224 else { | 10235 else { |
| 10225 var selector = (($0 = node.selector) && $0.is$Identifier()); | 10236 var selector = (($0 = node.selector) && $0.is$Identifier()); |
| 10226 var name = selector.get$source(); | 10237 var name = selector.get$source(); |
| 10227 if ($notnull_bool($eq(name, const$247/*const SourceString('+')*/) || $eq(nam e, const$257/*const SourceString('=')*/)) || $eq(name, const$248/*const SourceSt ring('-')*/) || $eq(name, const$249/*const SourceString('*')*/) || $eq(name, con st$250/*const SourceString('/')*/) || $eq(name, const$251/*const SourceString('< ')*/) || $eq(name, const$252/*const SourceString('~/')*/)) { | 10238 if ($notnull_bool($notnull_bool($notnull_bool($notnull_bool($notnull_bool($n otnull_bool($eq(name, const$247/*const SourceString('+')*/) || $eq(name, const$2 57/*const SourceString('=')*/)) || $eq(name, const$248/*const SourceString('-')* /)) || $eq(name, const$249/*const SourceString('*')*/)) || $eq(name, const$250/* const SourceString('/')*/)) || $eq(name, const$251/*const SourceString('<')*/)) || $eq(name, const$252/*const SourceString('~/')*/))) { |
| 10228 return this.types.dynamicType; | 10239 return this.types.dynamicType; |
| 10229 } | 10240 } |
| 10230 this.fail(node, ('unresolved send ' + name + '')); | 10241 this.fail(node, ('unresolved send ' + name + '')); |
| 10231 } | 10242 } |
| 10232 } | 10243 } |
| 10233 TypeCheckerVisitor.prototype.visitSendSet = function(node) { | 10244 TypeCheckerVisitor.prototype.visitSendSet = function(node) { |
| 10234 var $0; | 10245 var $0; |
| 10235 this.compiler.ensure($notnull_bool(node.get$arguments() != null && !$notnull_b ool(node.get$arguments().isEmpty()))); | 10246 this.compiler.ensure(node.get$arguments() != null && !$notnull_bool(node.get$a rguments().isEmpty())); |
| 10236 var targetType = (($0 = this.elements.$index(node).computeType(this.compiler, this.types)) && $0.is$Type()); | 10247 var targetType = (($0 = this.elements.$index(node).computeType(this.compiler, this.types)) && $0.is$Type()); |
| 10237 var value = (($0 = node.get$arguments().get$head()) && $0.is$Node()); | 10248 var value = (($0 = node.get$arguments().get$head()) && $0.is$Node()); |
| 10238 this.checkAssignable(value, this.type(value), targetType); | 10249 this.checkAssignable(value, this.type(value), targetType); |
| 10239 return targetType; | 10250 return targetType; |
| 10240 } | 10251 } |
| 10241 TypeCheckerVisitor.prototype.visitLiteralInt = function(node) { | 10252 TypeCheckerVisitor.prototype.visitLiteralInt = function(node) { |
| 10242 return this.types.intType; | 10253 return this.types.intType; |
| 10243 } | 10254 } |
| 10244 TypeCheckerVisitor.prototype.visitLiteralDouble = function(node) { | 10255 TypeCheckerVisitor.prototype.visitLiteralDouble = function(node) { |
| 10245 return this.types.dynamicType; | 10256 return this.types.dynamicType; |
| 10246 } | 10257 } |
| 10247 TypeCheckerVisitor.prototype.visitLiteralBool = function(node) { | 10258 TypeCheckerVisitor.prototype.visitLiteralBool = function(node) { |
| 10248 return this.types.dynamicType; | 10259 return this.types.dynamicType; |
| 10249 } | 10260 } |
| 10250 TypeCheckerVisitor.prototype.visitLiteralString = function(node) { | 10261 TypeCheckerVisitor.prototype.visitLiteralString = function(node) { |
| 10251 return this.types.stringType; | 10262 return this.types.stringType; |
| 10252 } | 10263 } |
| 10253 TypeCheckerVisitor.prototype.visitNodeList = function(node) { | 10264 TypeCheckerVisitor.prototype.visitNodeList = function(node) { |
| 10254 var $0; | 10265 var $0; |
| 10255 for (var link = node.nodes; | 10266 for (var link = node.nodes; |
| 10256 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { | 10267 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ Node())) { |
| 10257 this.type((($0 = link.get$head()) && $0.is$Node())); | 10268 this.type((($0 = link.get$head()) && $0.is$Node())); |
| 10258 } | 10269 } |
| 10259 return null; | 10270 return null; |
| 10260 } | 10271 } |
| 10261 TypeCheckerVisitor.prototype.visitOperator = function(node) { | 10272 TypeCheckerVisitor.prototype.visitOperator = function(node) { |
| 10262 return this.types.dynamicType; | 10273 return this.types.dynamicType; |
| 10263 } | 10274 } |
| 10264 TypeCheckerVisitor.prototype.visitReturn = function(node) { | 10275 TypeCheckerVisitor.prototype.visitReturn = function(node) { |
| 10265 var expression = node.expression; | 10276 var expression = node.expression; |
| 10266 var isVoidFunction = (this.expectedReturnType === this.types.voidType); | 10277 var isVoidFunction = (this.expectedReturnType === this.types.voidType); |
| 10267 if ($notnull_bool(expression != null)) { | 10278 if (expression != null) { |
| 10268 var expressionType = this.type(expression); | 10279 var expressionType = this.type(expression); |
| 10269 if ($notnull_bool(isVoidFunction && !$notnull_bool(this.types.isAssignable(e xpressionType, this.types.voidType)))) { | 10280 if (isVoidFunction && !$notnull_bool(this.types.isAssignable(expressionType, this.types.voidType))) { |
| 10270 this.compiler.reportWarning(expression, CompilerError.returnValueInVoid()) ; | 10281 this.compiler.reportWarning(expression, CompilerError.returnValueInVoid()) ; |
| 10271 } | 10282 } |
| 10272 else { | 10283 else { |
| 10273 this.checkAssignable(expression, expressionType, this.expectedReturnType); | 10284 this.checkAssignable(expression, expressionType, this.expectedReturnType); |
| 10274 } | 10285 } |
| 10275 } | 10286 } |
| 10276 else if ($notnull_bool(!$notnull_bool(this.types.isAssignable(this.expectedRet urnType, this.types.voidType)))) { | 10287 else if (!$notnull_bool(this.types.isAssignable(this.expectedReturnType, this. types.voidType))) { |
| 10277 var error = CompilerError.returnNothing(this.expectedReturnType); | 10288 var error = CompilerError.returnNothing(this.expectedReturnType); |
| 10278 this.compiler.reportWarning(node, error); | 10289 this.compiler.reportWarning(node, error); |
| 10279 } | 10290 } |
| 10280 return null; | 10291 return null; |
| 10281 } | 10292 } |
| 10282 TypeCheckerVisitor.prototype.visitThrow = function(node) { | 10293 TypeCheckerVisitor.prototype.visitThrow = function(node) { |
| 10283 if ($notnull_bool(node.expression != null)) this.type(node.expression); | 10294 if (node.expression != null) this.type(node.expression); |
| 10284 return this.types.voidType; | 10295 return this.types.voidType; |
| 10285 } | 10296 } |
| 10286 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) { | 10297 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) { |
| 10287 if ($notnull_bool(node.typeName == null)) return this.types.dynamicType; | 10298 if (node.typeName == null) return this.types.dynamicType; |
| 10288 var name = node.typeName.get$source(); | 10299 var name = node.typeName.get$source(); |
| 10289 var type = this.types.lookup(name); | 10300 var type = this.types.lookup(name); |
| 10290 if ($notnull_bool(type == null)) this.fail(node, ('unsupported type ' + name + '')); | 10301 if (type == null) this.fail(node, ('unsupported type ' + name + '')); |
| 10291 return type; | 10302 return type; |
| 10292 } | 10303 } |
| 10293 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) { | 10304 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) { |
| 10294 var $0; | 10305 var $0; |
| 10295 var type = this.typeWithDefault(node.type, this.types.dynamicType); | 10306 var type = this.typeWithDefault(node.type, this.types.dynamicType); |
| 10296 if ($notnull_bool($eq(type, this.types.voidType))) { | 10307 if ($eq(type, this.types.voidType)) { |
| 10297 this.compiler.reportWarning(node.type, CompilerError.voidVariable()); | 10308 this.compiler.reportWarning(node.type, CompilerError.voidVariable()); |
| 10298 type = this.types.dynamicType; | 10309 type = this.types.dynamicType; |
| 10299 } | 10310 } |
| 10300 for (var link = node.definitions.nodes; | 10311 for (var link = node.definitions.nodes; |
| 10301 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { | 10312 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ Node())) { |
| 10302 var initialization = (($0 = link.get$head()) && $0.is$Node()); | 10313 var initialization = (($0 = link.get$head()) && $0.is$Node()); |
| 10303 this.compiler.ensure($notnull_bool((initialization instanceof Identifier) || (initialization instanceof Send))); | 10314 this.compiler.ensure((initialization instanceof Identifier) || (initializati on instanceof Send)); |
| 10304 if ($notnull_bool((initialization instanceof Send))) { | 10315 if ((initialization instanceof Send)) { |
| 10305 var initializer = this.nonVoidType((($0 = link.get$head()) && $0.is$Node() )); | 10316 var initializer = this.nonVoidType((($0 = link.get$head()) && $0.is$Node() )); |
| 10306 this.checkAssignable(node, type, initializer); | 10317 this.checkAssignable(node, type, initializer); |
| 10307 } | 10318 } |
| 10308 } | 10319 } |
| 10309 return null; | 10320 return null; |
| 10310 } | 10321 } |
| 10311 // ********** Code for Universe ************** | 10322 // ********** Code for Universe ************** |
| 10312 function Universe() { | 10323 function Universe() { |
| 10313 this.elements = $map([]); | 10324 this.elements = $map([]); |
| 10314 this.generatedCode = $map([]); | 10325 this.generatedCode = $map([]); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 10345 this._buf = new StringBufferImpl(""); | 10356 this._buf = new StringBufferImpl(""); |
| 10346 // Initializers done | 10357 // Initializers done |
| 10347 } | 10358 } |
| 10348 CodeWriter.prototype.is$CodeWriter = function(){return this;}; | 10359 CodeWriter.prototype.is$CodeWriter = function(){return this;}; |
| 10349 CodeWriter.prototype.get$text = function() { | 10360 CodeWriter.prototype.get$text = function() { |
| 10350 return this._buf.toString(); | 10361 return this._buf.toString(); |
| 10351 } | 10362 } |
| 10352 CodeWriter.prototype._indent = function() { | 10363 CodeWriter.prototype._indent = function() { |
| 10353 this._pendingIndent = false; | 10364 this._pendingIndent = false; |
| 10354 for (var i = 0; | 10365 for (var i = 0; |
| 10355 $notnull_bool(i < this._indentation); i++) { | 10366 i < this._indentation; i++) { |
| 10356 this._buf.add(' '/*CodeWriter.INDENTATION*/); | 10367 this._buf.add(' '/*CodeWriter.INDENTATION*/); |
| 10357 } | 10368 } |
| 10358 } | 10369 } |
| 10359 CodeWriter.prototype.comment = function(text) { | 10370 CodeWriter.prototype.comment = function(text) { |
| 10360 if ($notnull_bool(this.writeComments)) { | 10371 if ($notnull_bool(this.writeComments)) { |
| 10361 this.writeln(text); | 10372 this.writeln(text); |
| 10362 } | 10373 } |
| 10363 } | 10374 } |
| 10364 CodeWriter.prototype.write = function(text) { | 10375 CodeWriter.prototype.write = function(text) { |
| 10365 if ($notnull_bool(text.length == 0)) return; | 10376 if (text.length == 0) return; |
| 10366 if ($notnull_bool(this._pendingIndent)) this._indent(); | 10377 if ($notnull_bool(this._pendingIndent)) this._indent(); |
| 10367 if ($notnull_bool(text.indexOf('\n', 0) != -1)) { | 10378 if (text.indexOf('\n', 0) != -1) { |
| 10368 var lines = text.split('\n'); | 10379 var lines = text.split('\n'); |
| 10369 for (var i = 0; | 10380 for (var i = 0; |
| 10370 $notnull_bool(i < lines.length - 1); i++) { | 10381 i < lines.length - 1; i++) { |
| 10371 this.writeln($assert_String(lines.$index(i))); | 10382 this.writeln($assert_String(lines.$index(i))); |
| 10372 } | 10383 } |
| 10373 this.write($assert_String(lines.$index(lines.length - 1))); | 10384 this.write($assert_String(lines.$index(lines.length - 1))); |
| 10374 } | 10385 } |
| 10375 else { | 10386 else { |
| 10376 this._buf.add(text); | 10387 this._buf.add(text); |
| 10377 } | 10388 } |
| 10378 } | 10389 } |
| 10379 CodeWriter.prototype.writeln = function(text) { | 10390 CodeWriter.prototype.writeln = function(text) { |
| 10380 if ($notnull_bool(text != null)) { | 10391 if (text != null) { |
| 10381 this.write(text); | 10392 this.write(text); |
| 10382 } | 10393 } |
| 10383 if ($notnull_bool(!$notnull_bool(text.endsWith('\n')))) this._buf.add('\n'/*Co deWriter.NEWLINE*/); | 10394 if (!text.endsWith('\n')) this._buf.add('\n'/*CodeWriter.NEWLINE*/); |
| 10384 this._pendingIndent = true; | 10395 this._pendingIndent = true; |
| 10385 } | 10396 } |
| 10386 CodeWriter.prototype.enterBlock = function(text) { | 10397 CodeWriter.prototype.enterBlock = function(text) { |
| 10387 this.writeln(text); | 10398 this.writeln(text); |
| 10388 this._indentation++; | 10399 this._indentation++; |
| 10389 } | 10400 } |
| 10390 CodeWriter.prototype.exitBlock = function(text) { | 10401 CodeWriter.prototype.exitBlock = function(text) { |
| 10391 this._indentation--; | 10402 this._indentation--; |
| 10392 this.writeln(text); | 10403 this.writeln(text); |
| 10393 } | 10404 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10472 w.writeln("/**\n * Generates a dynamic call stub for a function.\n * Our goa l is to create a stub method like this on-the-fly:\n * function($0, $1, captur e) { this($0, $1, true, capture); }\n *\n * This stub then replaces the dynamic one on Function, with one that is\n * specialized for that particular function, taking into account its default\n * arguments.\n */\nFunction.prototype.$genStub = function(argsLength, names) {\n // TODO(jmesserly): only emit $genStub if ac tually needed\n\n // Fast path: if no named arguments and arg count matches\n if (this.length == argsLength && !names) {\n return this;\n }\n\n function $throwArgMismatch() {\n // TODO(jmesserly): better error message\n $throw( new ClosureArgumentMismatchException());\n }\n\n var paramsNamed = this.$optio nal ? (this.$optional.length / 2) : 0;\n var paramsBare = this.length - paramsN amed;\n var argsNamed = names ? names.length : 0;\n var argsBare = argsLength - argsNamed;\n\n // Check we got the right number of arguments\n if (argsBare < paramsBare || argsLength > this.length ||\n argsNamed > paramsNamed) {\n return $throwArgMismatch;\n }\n\n // First, fill in all of the default valu es\n var p = new Array(paramsBare);\n if (paramsNamed) {\n p = p.concat(thi s.$optional.slice(paramsNamed));\n }\n // Fill in positional args\n var a = n ew Array(argsLength);\n for (var i = 0; i < argsBare; i++) {\n p[i] = a[i] = '$' + i;\n }\n // Then overwrite with supplied values for optional args\n va r lastParameterIndex;\n var namesInOrder = true;\n for (var i = 0; i < argsNam ed; i++) {\n var name = names[i];\n a[i + argsBare] = name;\n var j = t his.$optional.indexOf(name, 0);\n if (j < 0 || j >= paramsNamed) {\n ret urn $throwArgMismatch;\n } else if (lastParameterIndex && lastParameterIndex > j) {\n namesInOrder = false;\n }\n p[j + paramsBare] = name;\n l astParameterIndex = j;\n }\n\n if (this.length == argsLength && namesInOrder) {\n // Fast path #2: named arguments, but they're in order.\n return this; \n }\n\n // Note: using Function instead of 'eval' to get a clean scope.\n // TODO(jmesserly): evaluate the performance of these stubs.\n var f = 'function( ' + a.join(',') + '){return $f(' + p.join(',') + ');}';\n return new Function(' $f', 'return ' + f + '').call(null, this);\n}"); | 10483 w.writeln("/**\n * Generates a dynamic call stub for a function.\n * Our goa l is to create a stub method like this on-the-fly:\n * function($0, $1, captur e) { this($0, $1, true, capture); }\n *\n * This stub then replaces the dynamic one on Function, with one that is\n * specialized for that particular function, taking into account its default\n * arguments.\n */\nFunction.prototype.$genStub = function(argsLength, names) {\n // TODO(jmesserly): only emit $genStub if ac tually needed\n\n // Fast path: if no named arguments and arg count matches\n if (this.length == argsLength && !names) {\n return this;\n }\n\n function $throwArgMismatch() {\n // TODO(jmesserly): better error message\n $throw( new ClosureArgumentMismatchException());\n }\n\n var paramsNamed = this.$optio nal ? (this.$optional.length / 2) : 0;\n var paramsBare = this.length - paramsN amed;\n var argsNamed = names ? names.length : 0;\n var argsBare = argsLength - argsNamed;\n\n // Check we got the right number of arguments\n if (argsBare < paramsBare || argsLength > this.length ||\n argsNamed > paramsNamed) {\n return $throwArgMismatch;\n }\n\n // First, fill in all of the default valu es\n var p = new Array(paramsBare);\n if (paramsNamed) {\n p = p.concat(thi s.$optional.slice(paramsNamed));\n }\n // Fill in positional args\n var a = n ew Array(argsLength);\n for (var i = 0; i < argsBare; i++) {\n p[i] = a[i] = '$' + i;\n }\n // Then overwrite with supplied values for optional args\n va r lastParameterIndex;\n var namesInOrder = true;\n for (var i = 0; i < argsNam ed; i++) {\n var name = names[i];\n a[i + argsBare] = name;\n var j = t his.$optional.indexOf(name, 0);\n if (j < 0 || j >= paramsNamed) {\n ret urn $throwArgMismatch;\n } else if (lastParameterIndex && lastParameterIndex > j) {\n namesInOrder = false;\n }\n p[j + paramsBare] = name;\n l astParameterIndex = j;\n }\n\n if (this.length == argsLength && namesInOrder) {\n // Fast path #2: named arguments, but they're in order.\n return this; \n }\n\n // Note: using Function instead of 'eval' to get a clean scope.\n // TODO(jmesserly): evaluate the performance of these stubs.\n var f = 'function( ' + a.join(',') + '){return $f(' + p.join(',') + ');}';\n return new Function(' $f', 'return ' + f + '').call(null, this);\n}"); |
| 10473 } | 10484 } |
| 10474 if ($notnull_bool(this.useStackTraceOf)) { | 10485 if ($notnull_bool(this.useStackTraceOf)) { |
| 10475 w.writeln("function $stackTraceOf(e) {\n // TODO(jmesserly): we shouldn't b e relying on the e.stack property.\n // Need to mangle it.\n return e.stack ? e.stack : null;\n}"); | 10486 w.writeln("function $stackTraceOf(e) {\n // TODO(jmesserly): we shouldn't b e relying on the e.stack property.\n // Need to mangle it.\n return e.stack ? e.stack : null;\n}"); |
| 10476 } | 10487 } |
| 10477 if ($notnull_bool(this.useToDartException)) { | 10488 if ($notnull_bool(this.useToDartException)) { |
| 10478 w.writeln("// Translate a JavaScript exception to a Dart exception\n// TODO( jmesserly): cross browser support. This is Chrome specific.\nfunction $toDartExc eption(e) {\n var res = e;\n if (e instanceof TypeError) {\n switch(e.type) {\n case 'property_not_function':\n case 'called_non_callable':\n if (e.arguments[0] == null) {\n res = new NullPointerException();\n } else {\n res = new ObjectNotClosureException();\n }\n break;\n case 'non_object_property_call':\n case 'non_object_pr operty_load':\n res = new NullPointerException();\n break;\n case 'undefined_method':\n if (e.arguments[0] == 'call' || e.arguments[0] == 'apply') {\n res = new ObjectNotClosureException();\n } else {\n // TODO(jmesserly): can this ever happen?\n res = new NoS uchMethodException('', e.arguments[0], []);\n }\n break;\n }\n } else if (e instanceof RangeError) {\n if (e.message.indexOf('call stack') >= 0) {\n res = new StackOverflowException();\n }\n }\n // TODO(jmesse rly): setting the stack property is not a long term solution.\n // Also it caus es the exception to print as if it were a TypeError or\n // RangeError, instead of using the proper toString.\n res.stack = e.stack;\n return res;\n}"); | 10489 w.writeln("// Translate a JavaScript exception to a Dart exception\n// TODO( jmesserly): cross browser support. This is Chrome specific.\nfunction $toDartExc eption(e) {\n var res = e;\n if (e instanceof TypeError) {\n switch(e.type) {\n case 'property_not_function':\n case 'called_non_callable':\n if (e.arguments[0] == null) {\n res = new NullPointerException();\n } else {\n res = new ObjectNotClosureException();\n }\n break;\n case 'non_object_property_call':\n case 'non_object_pr operty_load':\n res = new NullPointerException();\n break;\n case 'undefined_method':\n if (e.arguments[0] == 'call' || e.arguments[0] == 'apply') {\n res = new ObjectNotClosureException();\n } else {\n // TODO(jmesserly): can this ever happen?\n res = new NoS uchMethodException('', e.arguments[0], []);\n }\n break;\n }\n } else if (e instanceof RangeError) {\n if (e.message.indexOf('call stack') >= 0) {\n res = new StackOverflowException();\n }\n }\n // TODO(jmesse rly): setting the stack property is not a long term solution.\n // Also it caus es the exception to print as if it were a TypeError or\n // RangeError, instead of using the proper toString.\n res.stack = e.stack;\n return res;\n}"); |
| 10479 } | 10490 } |
| 10480 if ($notnull_bool(this.useNotNullBool)) { | 10491 if ($notnull_bool(this.useNotNullBool)) { |
| 10481 this.useThrow = true; | 10492 this.useThrow = true; |
| 10482 w.writeln("function $notnull_bool(test) {\n return typeof(test) == 'boolean ' ? test : test.is$bool();\n}"); | 10493 w.writeln("function $notnull_bool(test) {\n return (test === true || test = == false) ? test : test.is$bool();\n}"); |
| 10483 } | 10494 } |
| 10484 if ($notnull_bool(this.useAssert)) { | 10495 if ($notnull_bool(this.useAssert)) { |
| 10485 this.useThrow = true; | 10496 this.useThrow = true; |
| 10486 w.writeln("function $assert(test, text, url, line, column) {\n if (typeof t est == 'function') test = test();\n if (!test) $throw(new AssertError(text, url , line, column));\n}"); | 10497 w.writeln("function $assert(test, text, url, line, column) {\n if (typeof t est == 'function') test = test();\n if (!test) $throw(new AssertError(text, url , line, column));\n}"); |
| 10487 } | 10498 } |
| 10488 if ($notnull_bool(this.useThrow)) { | 10499 if ($notnull_bool(this.useThrow)) { |
| 10489 w.writeln("function $throw(e) {\n // If e is not a value, we can use V8's c aptureStackTrace utility method.\n // TODO(jmesserly): capture the stack trace on other JS engines.\n if (e && (typeof e == 'object') && Error.captureStackTra ce) {\n // TODO(jmesserly): this will clobber the e.stack property\n Error .captureStackTrace(e, $throw);\n }\n throw e;\n}"); | 10500 w.writeln("function $throw(e) {\n // If e is not a value, we can use V8's c aptureStackTrace utility method.\n // TODO(jmesserly): capture the stack trace on other JS engines.\n if (e && (typeof e == 'object') && Error.captureStackTra ce) {\n // TODO(jmesserly): this will clobber the e.stack property\n Error .captureStackTrace(e, $throw);\n }\n throw e;\n}"); |
| 10490 } | 10501 } |
| 10491 if ($notnull_bool(this.useMap)) { | 10502 if ($notnull_bool(this.useMap)) { |
| 10492 w.writeln("function $map(items) {\n var ret = new HashMapImplementation();\ n for (var i=0; i < items.length;) {\n ret.$setindex(items[i++], items[i++]) ;\n }\n return ret;\n}"); | 10503 w.writeln("function $map(items) {\n var ret = new HashMapImplementation();\ n for (var i=0; i < items.length;) {\n ret.$setindex(items[i++], items[i++]) ;\n }\n return ret;\n}"); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10530 this.genMethod((($0 = world.get$coreimpl().types.$index('MatchImplementation') .getConstructor('')) && $0.is$Member())); | 10541 this.genMethod((($0 = world.get$coreimpl().types.$index('MatchImplementation') .getConstructor('')) && $0.is$Member())); |
| 10531 this.writeTypes(world.get$coreimpl()); | 10542 this.writeTypes(world.get$coreimpl()); |
| 10532 this.writeTypes(world.corelib); | 10543 this.writeTypes(world.corelib); |
| 10533 this.writeTypes(this.main.declaringType.get$library()); | 10544 this.writeTypes(this.main.declaringType.get$library()); |
| 10534 this._writeGlobals(); | 10545 this._writeGlobals(); |
| 10535 this.writer.writeln(('RunEntry(function () {' + mainCall.code + ';}, []);')); | 10546 this.writer.writeln(('RunEntry(function () {' + mainCall.code + ';}, []);')); |
| 10536 } | 10547 } |
| 10537 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe ndencies) { | 10548 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe ndencies) { |
| 10538 var $0; | 10549 var $0; |
| 10539 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + ""); | 10550 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + ""); |
| 10540 if ($notnull_bool(!$notnull_bool(this.globals.containsKey(fullname)))) { | 10551 if (!this.globals.containsKey(fullname)) { |
| 10541 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory( field, fieldValue, dependencies)); | 10552 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory( field, fieldValue, dependencies)); |
| 10542 } | 10553 } |
| 10543 return (($0 = this.globals.$index(fullname)) && $0.is$GlobalValue()); | 10554 return (($0 = this.globals.$index(fullname)) && $0.is$GlobalValue()); |
| 10544 } | 10555 } |
| 10545 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { | 10556 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { |
| 10546 var $0; | 10557 var $0; |
| 10547 var code = exp.canonicalCode; | 10558 var code = exp.canonicalCode; |
| 10548 if ($notnull_bool(!$notnull_bool(this.globals.containsKey(code)))) { | 10559 if (!this.globals.containsKey(code)) { |
| 10549 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this. globals.get$length(), exp, dependencies)); | 10560 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this. globals.get$length(), exp, dependencies)); |
| 10550 } | 10561 } |
| 10551 return (($0 = this.globals.$index(code)) && $0.is$GlobalValue()); | 10562 return (($0 = this.globals.$index(code)) && $0.is$GlobalValue()); |
| 10552 } | 10563 } |
| 10553 WorldGenerator.prototype.writeTypes = function(lib) { | 10564 WorldGenerator.prototype.writeTypes = function(lib) { |
| 10554 if ($notnull_bool(lib.isWritten)) return; | 10565 if ($notnull_bool(lib.isWritten)) return; |
| 10555 lib.isWritten = true; | 10566 lib.isWritten = true; |
| 10556 var $list = lib.imports; | 10567 var $list = lib.imports; |
| 10557 for (var $i = 0;$i < $list.length; $i++) { | 10568 for (var $i = 0;$i < $list.length; $i++) { |
| 10558 var import_ = $list.$index($i); | 10569 var import_ = $list.$index($i); |
| 10559 this.writeTypes(import_.get$library()); | 10570 this.writeTypes(import_.get$library()); |
| 10560 } | 10571 } |
| 10561 for (var i = 0; | 10572 for (var i = 0; |
| 10562 $notnull_bool(i < lib.sources.length); i++) { | 10573 i < lib.sources.length; i++) { |
| 10563 lib.sources.$index(i).orderInLibrary = i; | 10574 lib.sources.$index(i).orderInLibrary = i; |
| 10564 } | 10575 } |
| 10565 this.writer.comment(('// ********** Library ' + lib.name + ' **************') ); | 10576 this.writer.comment(('// ********** Library ' + lib.name + ' **************') ); |
| 10566 if ($notnull_bool(lib.get$isCore())) { | 10577 if ($notnull_bool(lib.get$isCore())) { |
| 10567 this.writer.comment('// ********** Natives dart:core **************'); | 10578 this.writer.comment('// ********** Natives dart:core **************'); |
| 10568 this.corejs.generate(this.writer); | 10579 this.corejs.generate(this.writer); |
| 10569 } | 10580 } |
| 10570 var $list = lib.natives; | 10581 var $list = lib.natives; |
| 10571 for (var $i = 0;$i < $list.length; $i++) { | 10582 for (var $i = 0;$i < $list.length; $i++) { |
| 10572 var file = $list.$index($i); | 10583 var file = $list.$index($i); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 10585 for (var $i0 = 0;$i0 < $list0.length; $i0++) { | 10596 for (var $i0 = 0;$i0 < $list0.length; $i0++) { |
| 10586 var ct = $list0.$index($i0); | 10597 var ct = $list0.$index($i0); |
| 10587 this.writeType((ct && ct.is$lang_Type())); | 10598 this.writeType((ct && ct.is$lang_Type())); |
| 10588 } | 10599 } |
| 10589 } | 10600 } |
| 10590 } | 10601 } |
| 10591 if ($notnull_bool(type.get$isFunction() && type.varStubs != null)) { | 10602 if ($notnull_bool(type.get$isFunction() && type.varStubs != null)) { |
| 10592 this.writer.comment(('// ********** Code for ' + type.get$jsname() + ' *** ***********')); | 10603 this.writer.comment(('// ********** Code for ' + type.get$jsname() + ' *** ***********')); |
| 10593 this._writeDynamicStubs((type && type.is$lang_Type())); | 10604 this._writeDynamicStubs((type && type.is$lang_Type())); |
| 10594 } | 10605 } |
| 10595 if ($notnull_bool(type.typeCheckCode != null)) { | 10606 if (type.typeCheckCode != null) { |
| 10596 this.writer.writeln(type.typeCheckCode); | 10607 this.writer.writeln(type.typeCheckCode); |
| 10597 } | 10608 } |
| 10598 } | 10609 } |
| 10599 } | 10610 } |
| 10600 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { | 10611 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { |
| 10601 if ($notnull_bool(!$notnull_bool(meth.isGenerated) && !$notnull_bool(meth.get$ isAbstract())) && $ne(meth.get$definition(), null)) { | 10612 if ($notnull_bool(!$notnull_bool(meth.isGenerated) && !$notnull_bool(meth.get$ isAbstract()) && $ne(meth.get$definition(), null))) { |
| 10602 new MethodGenerator(meth, enclosingMethod).run(); | 10613 new MethodGenerator(meth, enclosingMethod).run(); |
| 10603 } | 10614 } |
| 10604 } | 10615 } |
| 10605 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { | 10616 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { |
| 10606 if ($notnull_bool(!$notnull_bool(checkType.isTested))) return; | 10617 if (!$notnull_bool(checkType.isTested)) return; |
| 10607 var value = 'false'; | 10618 var value = 'false'; |
| 10608 if ($notnull_bool(onType.isSubtypeOf(checkType))) { | 10619 if ($notnull_bool(onType.isSubtypeOf(checkType))) { |
| 10609 value = 'function(){return this;}'; | 10620 value = 'function(){return this;}'; |
| 10610 } | 10621 } |
| 10611 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType. get$jsname() + ' = ') + ('' + value + ';')); | 10622 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType. get$jsname() + ' = ') + ('' + value + ';')); |
| 10612 } | 10623 } |
| 10613 WorldGenerator.prototype.writeType = function(type) { | 10624 WorldGenerator.prototype.writeType = function(type) { |
| 10614 var $0; | 10625 var $0; |
| 10615 if ($notnull_bool(type.name != null && (type instanceof ConcreteType)) && $eq( type.get$library(), world.get$coreimpl()) && type.name.startsWith('ListFactory') ) { | 10626 if (type.name != null && (type instanceof ConcreteType) && $eq(type.get$librar y(), world.get$coreimpl()) && type.name.startsWith('ListFactory')) { |
| 10616 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType() .get$jsname() + ';')); | 10627 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType() .get$jsname() + ';')); |
| 10617 return; | 10628 return; |
| 10618 } | 10629 } |
| 10619 var typeName = $notnull_bool(type.get$jsname() != null) ? type.get$jsname() : 'top level'; | 10630 var typeName = type.get$jsname() != null ? type.get$jsname() : 'top level'; |
| 10620 this.writer.comment(('// ********** Code for ' + typeName + ' **************') ); | 10631 this.writer.comment(('// ********** Code for ' + typeName + ' **************') ); |
| 10621 if ($notnull_bool(type.get$isNativeType() && !$notnull_bool(type.get$isTop())) ) { | 10632 if ($notnull_bool(type.get$isNativeType() && !$notnull_bool(type.get$isTop())) ) { |
| 10622 var nativeName = type.get$definition().get$nativeType(); | 10633 var nativeName = type.get$definition().get$nativeType(); |
| 10623 if ($notnull_bool($eq(nativeName, ''))) { | 10634 if ($notnull_bool($eq(nativeName, ''))) { |
| 10624 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 10635 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 10625 } | 10636 } |
| 10626 else if ($notnull_bool(type.get$jsname() != nativeName)) { | 10637 else if (type.get$jsname() != nativeName) { |
| 10627 this.writer.writeln(('' + type.get$jsname() + ' = ' + nativeName + ';')); | 10638 this.writer.writeln(('' + type.get$jsname() + ' = ' + nativeName + ';')); |
| 10628 } | 10639 } |
| 10629 } | 10640 } |
| 10630 if ($notnull_bool(type.get$isTop())) { | 10641 if ($notnull_bool(type.get$isTop())) { |
| 10631 } | 10642 } |
| 10632 else if ($notnull_bool(type.get$constructors().get$length() == 0)) { | 10643 else if (type.get$constructors().get$length() == 0) { |
| 10633 if ($notnull_bool(!$notnull_bool(type.get$isNativeType()))) { | 10644 if (!$notnull_bool(type.get$isNativeType())) { |
| 10634 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 10645 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 10635 } | 10646 } |
| 10636 } | 10647 } |
| 10637 else { | 10648 else { |
| 10638 var standardConstructor = (($0 = type.get$constructors().$index('')) && $0.i s$Member()); | 10649 var standardConstructor = (($0 = type.get$constructors().$index('')) && $0.i s$Member()); |
| 10639 if ($notnull_bool(standardConstructor == null || standardConstructor.generat or == null)) { | 10650 if (standardConstructor == null || standardConstructor.generator == null) { |
| 10640 if ($notnull_bool(!$notnull_bool(type.get$isNativeType()))) { | 10651 if (!$notnull_bool(type.get$isNativeType())) { |
| 10641 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 10652 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 10642 } | 10653 } |
| 10643 } | 10654 } |
| 10644 else { | 10655 else { |
| 10645 standardConstructor.generator.writeDefinition(this.writer, null); | 10656 standardConstructor.generator.writeDefinition(this.writer, null); |
| 10646 } | 10657 } |
| 10647 var $list = type.get$constructors().getValues(); | 10658 var $list = type.get$constructors().getValues(); |
| 10648 for (var $i = type.get$constructors().getValues().iterator(); $i.hasNext(); ) { | 10659 for (var $i = type.get$constructors().getValues().iterator(); $i.hasNext(); ) { |
| 10649 var c = $i.next(); | 10660 var c = $i.next(); |
| 10650 if ($notnull_bool($ne(c.generator, null) && $ne(c, standardConstructor))) { | 10661 if ($notnull_bool($ne(c.generator, null) && $ne(c, standardConstructor))) { |
| 10651 c.generator.writeDefinition(this.writer, null); | 10662 c.generator.writeDefinition(this.writer, null); |
| 10652 } | 10663 } |
| 10653 } | 10664 } |
| 10654 } | 10665 } |
| 10655 if ($notnull_bool(!$notnull_bool(type.get$isTop()))) { | 10666 if (!$notnull_bool(type.get$isTop())) { |
| 10656 if ($notnull_bool((type instanceof ConcreteType))) { | 10667 if ((type instanceof ConcreteType)) { |
| 10657 this._ensureInheritsHelper(); | 10668 this._ensureInheritsHelper(); |
| 10658 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g enericType().get$jsname() + ');')); | 10669 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g enericType().get$jsname() + ');')); |
| 10659 } | 10670 } |
| 10660 else if ($notnull_bool(!$notnull_bool(type.get$isNativeType()))) { | 10671 else if (!$notnull_bool(type.get$isNativeType())) { |
| 10661 if ($notnull_bool(type.get$parent() != null && !$notnull_bool(type.get$par ent().get$isObject()))) { | 10672 if (type.get$parent() != null && !$notnull_bool(type.get$parent().get$isOb ject())) { |
| 10662 this._ensureInheritsHelper(); | 10673 this._ensureInheritsHelper(); |
| 10663 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get $parent().get$jsname() + ');')); | 10674 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get $parent().get$jsname() + ');')); |
| 10664 } | 10675 } |
| 10665 } | 10676 } |
| 10666 } | 10677 } |
| 10667 if ($notnull_bool(!(type instanceof ConcreteType))) { | 10678 if (!(type instanceof ConcreteType)) { |
| 10668 this._maybeIsTest(type, type); | 10679 this._maybeIsTest(type, type); |
| 10669 } | 10680 } |
| 10670 if ($notnull_bool(type.get$genericType()._concreteTypes != null)) { | 10681 if (type.get$genericType()._concreteTypes != null) { |
| 10671 var $list = this._orderValues(type.get$genericType()._concreteTypes); | 10682 var $list = this._orderValues(type.get$genericType()._concreteTypes); |
| 10672 for (var $i = 0;$i < $list.length; $i++) { | 10683 for (var $i = 0;$i < $list.length; $i++) { |
| 10673 var ct = $list.$index($i); | 10684 var ct = $list.$index($i); |
| 10674 this._maybeIsTest(type, (ct && ct.is$lang_Type())); | 10685 this._maybeIsTest(type, (ct && ct.is$lang_Type())); |
| 10675 } | 10686 } |
| 10676 } | 10687 } |
| 10677 if ($notnull_bool(type.get$interfaces() != null)) { | 10688 if (type.get$interfaces() != null) { |
| 10678 var seen = new HashSetImplementation(); | 10689 var seen = new HashSetImplementation(); |
| 10679 var worklist = []; | 10690 var worklist = []; |
| 10680 worklist.addAll(type.get$interfaces()); | 10691 worklist.addAll(type.get$interfaces()); |
| 10681 seen.addAll(type.get$interfaces()); | 10692 seen.addAll(type.get$interfaces()); |
| 10682 while ($notnull_bool(!$notnull_bool(worklist.isEmpty()))) { | 10693 while (!worklist.isEmpty()) { |
| 10683 var interface_ = worklist.removeLast(); | 10694 var interface_ = worklist.removeLast(); |
| 10684 this._maybeIsTest(type, interface_.get$genericType()); | 10695 this._maybeIsTest(type, interface_.get$genericType()); |
| 10685 if ($notnull_bool(interface_.get$genericType()._concreteTypes != null)) { | 10696 if (interface_.get$genericType()._concreteTypes != null) { |
| 10686 var $list = this._orderValues(interface_.get$genericType()._concreteType s); | 10697 var $list = this._orderValues(interface_.get$genericType()._concreteType s); |
| 10687 for (var $i = 0;$i < $list.length; $i++) { | 10698 for (var $i = 0;$i < $list.length; $i++) { |
| 10688 var ct = $list.$index($i); | 10699 var ct = $list.$index($i); |
| 10689 this._maybeIsTest(type, (ct && ct.is$lang_Type())); | 10700 this._maybeIsTest(type, (ct && ct.is$lang_Type())); |
| 10690 } | 10701 } |
| 10691 } | 10702 } |
| 10692 var $list = interface_.get$interfaces(); | 10703 var $list = interface_.get$interfaces(); |
| 10693 for (var $i = interface_.get$interfaces().iterator(); $i.hasNext(); ) { | 10704 for (var $i = interface_.get$interfaces().iterator(); $i.hasNext(); ) { |
| 10694 var other = $i.next(); | 10705 var other = $i.next(); |
| 10695 if ($notnull_bool(!$notnull_bool(seen.contains(other)))) { | 10706 if (!seen.contains(other)) { |
| 10696 worklist.addLast(other); | 10707 worklist.addLast(other); |
| 10697 seen.add(other); | 10708 seen.add(other); |
| 10698 } | 10709 } |
| 10699 } | 10710 } |
| 10700 } | 10711 } |
| 10701 } | 10712 } |
| 10702 type.get$factories().forEach(this.get$_writeMethod()); | 10713 type.get$factories().forEach(this.get$_writeMethod()); |
| 10703 var $list = this._orderValues(type.get$members()); | 10714 var $list = this._orderValues(type.get$members()); |
| 10704 for (var $i = 0;$i < $list.length; $i++) { | 10715 for (var $i = 0;$i < $list.length; $i++) { |
| 10705 var member = $list.$index($i); | 10716 var member = $list.$index($i); |
| 10706 if ($notnull_bool((member instanceof FieldMember))) { | 10717 if ((member instanceof FieldMember)) { |
| 10707 this._writeField((member && member.is$FieldMember())); | 10718 this._writeField((member && member.is$FieldMember())); |
| 10708 } | 10719 } |
| 10709 if ($notnull_bool((member instanceof PropertyMember))) { | 10720 if ((member instanceof PropertyMember)) { |
| 10710 this._writeProperty((member && member.is$PropertyMember())); | 10721 this._writeProperty((member && member.is$PropertyMember())); |
| 10711 } | 10722 } |
| 10712 if ($notnull_bool(member.get$isMethod())) { | 10723 if ($notnull_bool(member.get$isMethod())) { |
| 10713 this._writeMethod((member && member.is$Member())); | 10724 this._writeMethod((member && member.is$Member())); |
| 10714 } | 10725 } |
| 10715 } | 10726 } |
| 10716 this._writeDynamicStubs(type); | 10727 this._writeDynamicStubs(type); |
| 10717 } | 10728 } |
| 10718 WorldGenerator.prototype._ensureInheritsHelper = function() { | 10729 WorldGenerator.prototype._ensureInheritsHelper = function() { |
| 10719 if ($notnull_bool(this._inheritsGenerated)) return; | 10730 if ($notnull_bool(this._inheritsGenerated)) return; |
| 10720 this._inheritsGenerated = true; | 10731 this._inheritsGenerated = true; |
| 10721 this.writer.writeln("/** Implements extends for Dart classes on JavaScript pro totypes. */\nfunction $inherits(child, parent) {\n if (child.prototype.__proto_ _) {\n child.prototype.__proto__ = parent.prototype;\n } else {\n functio n tmp() {};\n tmp.prototype = parent.prototype;\n child.prototype = new tm p();\n child.prototype.constructor = child;\n }\n}"); | 10732 this.writer.writeln("/** Implements extends for Dart classes on JavaScript pro totypes. */\nfunction $inherits(child, parent) {\n if (child.prototype.__proto_ _) {\n child.prototype.__proto__ = parent.prototype;\n } else {\n functio n tmp() {};\n tmp.prototype = parent.prototype;\n child.prototype = new tm p();\n child.prototype.constructor = child;\n }\n}"); |
| 10722 } | 10733 } |
| 10723 WorldGenerator.prototype._writeDynamicStubs = function(type) { | 10734 WorldGenerator.prototype._writeDynamicStubs = function(type) { |
| 10724 if ($notnull_bool(type.varStubs != null)) { | 10735 if (type.varStubs != null) { |
| 10725 var $list = orderValuesByKeys(type.varStubs); | 10736 var $list = orderValuesByKeys(type.varStubs); |
| 10726 for (var $i = 0;$i < $list.length; $i++) { | 10737 for (var $i = 0;$i < $list.length; $i++) { |
| 10727 var stub = $list.$index($i); | 10738 var stub = $list.$index($i); |
| 10728 stub.generate(this.writer); | 10739 stub.generate(this.writer); |
| 10729 } | 10740 } |
| 10730 } | 10741 } |
| 10731 } | 10742 } |
| 10732 WorldGenerator.prototype._writeStaticField = function(field) { | 10743 WorldGenerator.prototype._writeStaticField = function(field) { |
| 10733 if ($notnull_bool(field.isFinal)) return; | 10744 if ($notnull_bool(field.isFinal)) return; |
| 10734 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + ""); | 10745 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + ""); |
| 10735 if ($notnull_bool(this.globals.containsKey(fullname))) { | 10746 if (this.globals.containsKey(fullname)) { |
| 10736 var value = this.globals.$index(fullname); | 10747 var value = this.globals.$index(fullname); |
| 10737 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.is Native))) { | 10748 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.is Native))) { |
| 10738 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code + ';')); | 10749 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code + ';')); |
| 10739 } | 10750 } |
| 10740 else { | 10751 else { |
| 10741 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g et$jsname() + ' = ' + value.exp.code + ';')); | 10752 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g et$jsname() + ' = ' + value.exp.code + ';')); |
| 10742 } | 10753 } |
| 10743 } | 10754 } |
| 10744 } | 10755 } |
| 10745 WorldGenerator.prototype._writeField = function(field) { | 10756 WorldGenerator.prototype._writeField = function(field) { |
| 10746 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.isNa tive)) && field.value == null) { | 10757 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.isNa tive)) && field.value == null) { |
| 10747 this.writer.writeln(('var ' + field.get$jsname() + ';')); | 10758 this.writer.writeln(('var ' + field.get$jsname() + ';')); |
| 10748 } | 10759 } |
| 10749 if ($notnull_bool(field._providePropertySyntax)) { | 10760 if ($notnull_bool(field._providePropertySyntax)) { |
| 10750 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get \$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn ame() + '; };')); | 10761 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get \$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn ame() + '; };')); |
| 10751 if ($notnull_bool(!$notnull_bool(field.isFinal))) { | 10762 if (!$notnull_bool(field.isFinal)) { |
| 10752 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.s et\$' + field.get$jsname() + ' = ') + ('function(value) { return this.' + field. get$jsname() + ' = value; };')); | 10763 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.s et\$' + field.get$jsname() + ' = ') + ('function(value) { return this.' + field. get$jsname() + ' = value; };')); |
| 10753 } | 10764 } |
| 10754 } | 10765 } |
| 10755 } | 10766 } |
| 10756 WorldGenerator.prototype._writeProperty = function(property) { | 10767 WorldGenerator.prototype._writeProperty = function(property) { |
| 10757 if ($notnull_bool(property.getter != null)) this._writeMethod(property.getter) ; | 10768 if (property.getter != null) this._writeMethod(property.getter); |
| 10758 if ($notnull_bool(property.setter != null)) this._writeMethod(property.setter) ; | 10769 if (property.setter != null) this._writeMethod(property.setter); |
| 10759 if ($notnull_bool(property._provideFieldSyntax)) { | 10770 if ($notnull_bool(property._provideFieldSyntax)) { |
| 10760 this.writer.enterBlock('Object.defineProperty(' + ('' + property.declaringTy pe.get$jsname() + '.prototype, "' + property.get$jsname() + '", {')); | 10771 this.writer.enterBlock('Object.defineProperty(' + ('' + property.declaringTy pe.get$jsname() + '.prototype, "' + property.get$jsname() + '", {')); |
| 10761 if ($notnull_bool(property.getter != null)) { | 10772 if (property.getter != null) { |
| 10762 this.writer.write(('get: ' + property.declaringType.get$jsname() + '.proto type.' + property.getter.get$jsname() + '')); | 10773 this.writer.write(('get: ' + property.declaringType.get$jsname() + '.proto type.' + property.getter.get$jsname() + '')); |
| 10763 this.writer.writeln($notnull_bool(property.setter == null) ? '' : ','); | 10774 this.writer.writeln(property.setter == null ? '' : ','); |
| 10764 } | 10775 } |
| 10765 if ($notnull_bool(property.setter != null)) { | 10776 if (property.setter != null) { |
| 10766 this.writer.writeln(('set: ' + property.declaringType.get$jsname() + '.pro totype.' + property.setter.get$jsname() + '')); | 10777 this.writer.writeln(('set: ' + property.declaringType.get$jsname() + '.pro totype.' + property.setter.get$jsname() + '')); |
| 10767 } | 10778 } |
| 10768 this.writer.exitBlock('});'); | 10779 this.writer.exitBlock('});'); |
| 10769 } | 10780 } |
| 10770 } | 10781 } |
| 10771 WorldGenerator.prototype._writeMethod = function(method) { | 10782 WorldGenerator.prototype._writeMethod = function(method) { |
| 10772 if ($notnull_bool(method.generator != null)) { | 10783 if (method.generator != null) { |
| 10773 method.generator.writeDefinition(this.writer, null); | 10784 method.generator.writeDefinition(this.writer, null); |
| 10774 } | 10785 } |
| 10775 } | 10786 } |
| 10776 WorldGenerator.prototype.get$_writeMethod = function() { | 10787 WorldGenerator.prototype.get$_writeMethod = function() { |
| 10777 return WorldGenerator.prototype._writeMethod.bind(this); | 10788 return WorldGenerator.prototype._writeMethod.bind(this); |
| 10778 } | 10789 } |
| 10779 WorldGenerator.prototype._writeGlobals = function() { | 10790 WorldGenerator.prototype._writeGlobals = function() { |
| 10780 if ($notnull_bool(this.globals.get$length() > 0)) { | 10791 if (this.globals.get$length() > 0) { |
| 10781 this.writer.comment('// ********** Globals **************'); | 10792 this.writer.comment('// ********** Globals **************'); |
| 10782 } | 10793 } |
| 10783 var list = this.globals.getValues(); | 10794 var list = this.globals.getValues(); |
| 10784 list.sort((function (a, b) { | 10795 list.sort((function (a, b) { |
| 10785 return a.compareTo(b); | 10796 return a.compareTo(b); |
| 10786 }) | 10797 }) |
| 10787 ); | 10798 ); |
| 10788 for (var $i = list.iterator(); $i.hasNext(); ) { | 10799 for (var $i = list.iterator(); $i.hasNext(); ) { |
| 10789 var global = $i.next(); | 10800 var global = $i.next(); |
| 10790 if ($notnull_bool(global.field != null)) { | 10801 if (global.field != null) { |
| 10791 this._writeStaticField(global.field); | 10802 this._writeStaticField(global.field); |
| 10792 } | 10803 } |
| 10793 else { | 10804 else { |
| 10794 this.writer.writeln(('var ' + global.get$name() + ' = ' + global.exp.code + ';')); | 10805 this.writer.writeln(('var ' + global.get$name() + ' = ' + global.exp.code + ';')); |
| 10795 } | 10806 } |
| 10796 } | 10807 } |
| 10797 } | 10808 } |
| 10798 WorldGenerator.prototype._orderValues = function(map) { | 10809 WorldGenerator.prototype._orderValues = function(map) { |
| 10799 var $0; | 10810 var $0; |
| 10800 var values = (($0 = map.getValues()) && $0.is$List()); | 10811 var values = (($0 = map.getValues()) && $0.is$List()); |
| 10801 values.sort(this.get$_compareMembers()); | 10812 values.sort(this.get$_compareMembers()); |
| 10802 return values; | 10813 return values; |
| 10803 } | 10814 } |
| 10804 WorldGenerator.prototype._compareMembers = function(x, y) { | 10815 WorldGenerator.prototype._compareMembers = function(x, y) { |
| 10805 if ($notnull_bool(x.get$span() != null && y.get$span() != null)) { | 10816 if (x.get$span() != null && y.get$span() != null) { |
| 10806 var spans = x.get$span().compareTo(y.get$span()); | 10817 var spans = x.get$span().compareTo(y.get$span()); |
| 10807 if ($notnull_bool(spans != 0)) return spans; | 10818 if (spans != 0) return spans; |
| 10808 } | 10819 } |
| 10809 if ($notnull_bool(x.get$span() == null)) return 1; | 10820 if (x.get$span() == null) return 1; |
| 10810 if ($notnull_bool(y.get$span() == null)) return -1; | 10821 if (y.get$span() == null) return -1; |
| 10811 return x.get$name().compareTo(y.get$name()); | 10822 return x.get$name().compareTo(y.get$name()); |
| 10812 } | 10823 } |
| 10813 WorldGenerator.prototype.get$_compareMembers = function() { | 10824 WorldGenerator.prototype.get$_compareMembers = function() { |
| 10814 return WorldGenerator.prototype._compareMembers.bind(this); | 10825 return WorldGenerator.prototype._compareMembers.bind(this); |
| 10815 } | 10826 } |
| 10816 WorldGenerator.prototype.useMapFactory = function() { | 10827 WorldGenerator.prototype.useMapFactory = function() { |
| 10817 var $0; | 10828 var $0; |
| 10818 this.corejs.useMap = true; | 10829 this.corejs.useMap = true; |
| 10819 var factType = world.get$coreimpl().types.$index('HashMapImplementation'); | 10830 var factType = world.get$coreimpl().types.$index('HashMapImplementation'); |
| 10820 var m = factType.resolveMember('\$setindex'); | 10831 var m = factType.resolveMember('\$setindex'); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 10834 this._closedOver = new HashSetImplementation$String(); | 10845 this._closedOver = new HashSetImplementation$String(); |
| 10835 } | 10846 } |
| 10836 else { | 10847 else { |
| 10837 this.reentrant = $notnull_bool(this.reentrant || this.parent.reentrant); | 10848 this.reentrant = $notnull_bool(this.reentrant || this.parent.reentrant); |
| 10838 } | 10849 } |
| 10839 } | 10850 } |
| 10840 BlockScope.prototype.is$BlockScope = function(){return this;}; | 10851 BlockScope.prototype.is$BlockScope = function(){return this;}; |
| 10841 BlockScope.prototype.get$parent = function() { return this.parent; }; | 10852 BlockScope.prototype.get$parent = function() { return this.parent; }; |
| 10842 BlockScope.prototype.set$parent = function(value) { return this.parent = value; }; | 10853 BlockScope.prototype.set$parent = function(value) { return this.parent = value; }; |
| 10843 BlockScope.prototype.get$isMethodScope = function() { | 10854 BlockScope.prototype.get$isMethodScope = function() { |
| 10844 return $notnull_bool(this.parent == null || $ne(this.parent.enclosingMethod, t his.enclosingMethod)); | 10855 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM ethod); |
| 10845 } | 10856 } |
| 10846 BlockScope.prototype.get$methodScope = function() { | 10857 BlockScope.prototype.get$methodScope = function() { |
| 10847 var s = this; | 10858 var s = this; |
| 10848 while ($notnull_bool(!$notnull_bool(s.get$isMethodScope()))) s = s.get$parent( ); | 10859 while (!$notnull_bool(s.get$isMethodScope())) s = s.get$parent(); |
| 10849 return (s && s.is$BlockScope()); | 10860 return (s && s.is$BlockScope()); |
| 10850 } | 10861 } |
| 10851 BlockScope.prototype.lookup = function(name) { | 10862 BlockScope.prototype.lookup = function(name) { |
| 10852 var ret = this._vars.$index(name); | 10863 var ret = this._vars.$index(name); |
| 10853 if ($notnull_bool($ne(ret, null))) return ret; | 10864 if ($notnull_bool($ne(ret, null))) return ret; |
| 10854 for (var s = this.parent; | 10865 for (var s = this.parent; |
| 10855 $notnull_bool($ne(s, null)); s = s.get$parent()) { | 10866 $notnull_bool($ne(s, null)); s = s.get$parent()) { |
| 10856 ret = s._vars.$index(name); | 10867 ret = s._vars.$index(name); |
| 10857 if ($notnull_bool($ne(ret, null))) { | 10868 if ($notnull_bool($ne(ret, null))) { |
| 10858 if ($notnull_bool($ne(s.enclosingMethod, this.enclosingMethod))) { | 10869 if ($ne(s.enclosingMethod, this.enclosingMethod)) { |
| 10859 s.get$methodScope()._closedOver.add(ret.code); | 10870 s.get$methodScope()._closedOver.add(ret.code); |
| 10860 if ($notnull_bool(this.enclosingMethod.captures != null && s.reentrant)) { | 10871 if ($notnull_bool(this.enclosingMethod.captures != null && s.reentrant)) { |
| 10861 this.enclosingMethod.captures.add(ret.code); | 10872 this.enclosingMethod.captures.add(ret.code); |
| 10862 } | 10873 } |
| 10863 } | 10874 } |
| 10864 return ret; | 10875 return ret; |
| 10865 } | 10876 } |
| 10866 } | 10877 } |
| 10867 } | 10878 } |
| 10868 BlockScope.prototype._isDefinedInParent = function(name) { | 10879 BlockScope.prototype._isDefinedInParent = function(name) { |
| 10869 if ($notnull_bool(this.get$isMethodScope() && this._closedOver.contains(name)) ) return true; | 10880 if ($notnull_bool(this.get$isMethodScope() && this._closedOver.contains(name)) ) return true; |
| 10870 for (var s = this.parent; | 10881 for (var s = this.parent; |
| 10871 $notnull_bool($ne(s, null)); s = s.get$parent()) { | 10882 $notnull_bool($ne(s, null)); s = s.get$parent()) { |
| 10872 if ($notnull_bool(s._vars.containsKey(name))) return true; | 10883 if (s._vars.containsKey(name)) return true; |
| 10873 if ($notnull_bool(s.get$isMethodScope() && s._closedOver.contains(name))) re turn true; | 10884 if ($notnull_bool(s.get$isMethodScope() && s._closedOver.contains(name))) re turn true; |
| 10874 } | 10885 } |
| 10875 var type = this.enclosingMethod.method.declaringType; | 10886 var type = this.enclosingMethod.method.declaringType; |
| 10876 if ($notnull_bool(type.get$library().lookup(name, null) != null)) return true; | 10887 if (type.get$library().lookup(name, null) != null) return true; |
| 10877 return false; | 10888 return false; |
| 10878 } | 10889 } |
| 10879 BlockScope.prototype.create = function(name, type, span, isParameter) { | 10890 BlockScope.prototype.create = function(name, type, span, isParameter) { |
| 10880 var jsName = world.toJsIdentifier(name); | 10891 var jsName = world.toJsIdentifier(name); |
| 10881 if ($notnull_bool(this._vars.containsKey(name))) { | 10892 if (this._vars.containsKey(name)) { |
| 10882 world.error(('duplicate name "' + name + '"'), span); | 10893 world.error(('duplicate name "' + name + '"'), span); |
| 10883 } | 10894 } |
| 10884 if ($notnull_bool(!$notnull_bool(isParameter))) { | 10895 if (!$notnull_bool(isParameter)) { |
| 10885 var index = 0; | 10896 var index = 0; |
| 10886 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) { | 10897 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) { |
| 10887 jsName = ('' + name + '' + index++ + ''); | 10898 jsName = ('' + name + '' + index++ + ''); |
| 10888 } | 10899 } |
| 10889 } | 10900 } |
| 10890 var ret = new Value(type, jsName, span, false); | 10901 var ret = new Value(type, jsName, span, false); |
| 10891 this._vars.$setindex(name, ret); | 10902 this._vars.$setindex(name, ret); |
| 10892 return (ret && ret.is$Value()); | 10903 return (ret && ret.is$Value()); |
| 10893 } | 10904 } |
| 10894 BlockScope.prototype.declareParameter = function(p) { | 10905 BlockScope.prototype.declareParameter = function(p) { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 10906 return scope.rethrow; | 10917 return scope.rethrow; |
| 10907 } | 10918 } |
| 10908 // ********** Code for MethodGenerator ************** | 10919 // ********** Code for MethodGenerator ************** |
| 10909 function MethodGenerator(method, enclosingMethod) { | 10920 function MethodGenerator(method, enclosingMethod) { |
| 10910 var $0; | 10921 var $0; |
| 10911 this.method = method; | 10922 this.method = method; |
| 10912 this.enclosingMethod = enclosingMethod; | 10923 this.enclosingMethod = enclosingMethod; |
| 10913 this.writer = new CodeWriter(); | 10924 this.writer = new CodeWriter(); |
| 10914 this.needsThis = false; | 10925 this.needsThis = false; |
| 10915 // Initializers done | 10926 // Initializers done |
| 10916 if ($notnull_bool(this.enclosingMethod != null)) { | 10927 if (this.enclosingMethod != null) { |
| 10917 this._scope = new BlockScope(this, this.enclosingMethod._scope, false); | 10928 this._scope = new BlockScope(this, this.enclosingMethod._scope, false); |
| 10918 this.captures = new HashSetImplementation(); | 10929 this.captures = new HashSetImplementation(); |
| 10919 } | 10930 } |
| 10920 else { | 10931 else { |
| 10921 this._scope = new BlockScope(this, null, false); | 10932 this._scope = new BlockScope(this, null, false); |
| 10922 } | 10933 } |
| 10923 if ($notnull_bool(this.enclosingMethod != null && this.method.name != '')) { | 10934 if (this.enclosingMethod != null && this.method.name != '') { |
| 10924 var m = (($0 = this.method) && $0.is$MethodMember()); | 10935 var m = (($0 = this.method) && $0.is$MethodMember()); |
| 10925 this._scope.create(m.name, m.get$functionType(), m.definition.span, false); | 10936 this._scope.create(m.name, m.get$functionType(), m.definition.span, false); |
| 10926 } | 10937 } |
| 10927 this._usedTemps = new HashSetImplementation(); | 10938 this._usedTemps = new HashSetImplementation(); |
| 10928 this._freeTemps = []; | 10939 this._freeTemps = []; |
| 10929 } | 10940 } |
| 10930 MethodGenerator.prototype.is$MethodGenerator = function(){return this;}; | 10941 MethodGenerator.prototype.is$MethodGenerator = function(){return this;}; |
| 10931 MethodGenerator.prototype.get$library = function() { | 10942 MethodGenerator.prototype.get$library = function() { |
| 10932 return this.method.get$library(); | 10943 return this.method.get$library(); |
| 10933 } | 10944 } |
| 10934 MethodGenerator.prototype.findMembers = function(name) { | 10945 MethodGenerator.prototype.findMembers = function(name) { |
| 10935 return this.get$library()._findMembers(name); | 10946 return this.get$library()._findMembers(name); |
| 10936 } | 10947 } |
| 10937 MethodGenerator.prototype.get$isClosure = function() { | 10948 MethodGenerator.prototype.get$isClosure = function() { |
| 10938 return (this.enclosingMethod != null); | 10949 return (this.enclosingMethod != null); |
| 10939 } | 10950 } |
| 10940 MethodGenerator.prototype.get$isStatic = function() { | 10951 MethodGenerator.prototype.get$isStatic = function() { |
| 10941 return this.method.get$isStatic(); | 10952 return this.method.get$isStatic(); |
| 10942 } | 10953 } |
| 10943 MethodGenerator.prototype.getTemp = function(value) { | 10954 MethodGenerator.prototype.getTemp = function(value) { |
| 10944 return $notnull_bool(value.needsTemp) ? this.forceTemp(value) : value; | 10955 return $notnull_bool(value.needsTemp) ? this.forceTemp(value) : value; |
| 10945 } | 10956 } |
| 10946 MethodGenerator.prototype.forceTemp = function(value) { | 10957 MethodGenerator.prototype.forceTemp = function(value) { |
| 10947 var name; | 10958 var name; |
| 10948 if ($notnull_bool(this._freeTemps.length > 0)) { | 10959 if (this._freeTemps.length > 0) { |
| 10949 name = $assert_String(this._freeTemps.removeLast()); | 10960 name = $assert_String(this._freeTemps.removeLast()); |
| 10950 } | 10961 } |
| 10951 else { | 10962 else { |
| 10952 name = '\$' + this._usedTemps.get$length(); | 10963 name = '\$' + this._usedTemps.get$length(); |
| 10953 } | 10964 } |
| 10954 this._usedTemps.add(name); | 10965 this._usedTemps.add(name); |
| 10955 return new Value(value.type, name, value.span, false); | 10966 return new Value(value.type, name, value.span, false); |
| 10956 } | 10967 } |
| 10957 MethodGenerator.prototype.assignTemp = function(tmp, v) { | 10968 MethodGenerator.prototype.assignTemp = function(tmp, v) { |
| 10958 if ($notnull_bool($eq(tmp, v))) { | 10969 if ($eq(tmp, v)) { |
| 10959 return v; | 10970 return v; |
| 10960 } | 10971 } |
| 10961 else { | 10972 else { |
| 10962 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), v.span, tr ue); | 10973 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), v.span, tr ue); |
| 10963 } | 10974 } |
| 10964 } | 10975 } |
| 10965 MethodGenerator.prototype.freeTemp = function(value) { | 10976 MethodGenerator.prototype.freeTemp = function(value) { |
| 10966 if ($notnull_bool(this._usedTemps.remove(value.code))) { | 10977 if (this._usedTemps.remove(value.code)) { |
| 10967 this._freeTemps.add(value.code); | 10978 this._freeTemps.add(value.code); |
| 10968 } | 10979 } |
| 10969 else { | 10980 else { |
| 10970 world.internalError(('tried to free unused value or non-temp "' + value.code + '"')); | 10981 world.internalError(('tried to free unused value or non-temp "' + value.code + '"')); |
| 10971 } | 10982 } |
| 10972 } | 10983 } |
| 10973 MethodGenerator.prototype.run = function() { | 10984 MethodGenerator.prototype.run = function() { |
| 10974 if ($notnull_bool(this.method.isGenerated)) return; | 10985 if ($notnull_bool(this.method.isGenerated)) return; |
| 10975 this.method.isGenerated = true; | 10986 this.method.isGenerated = true; |
| 10976 this.method.generator = this; | 10987 this.method.generator = this; |
| 10977 if ($notnull_bool((this.method.get$definition().body instanceof NativeStatemen t))) { | 10988 if ((this.method.get$definition().body instanceof NativeStatement)) { |
| 10978 if ($notnull_bool(this.method.get$definition().body.body == null)) { | 10989 if ($notnull_bool(this.method.get$definition().body.body == null)) { |
| 10979 this.method.generator = null; | 10990 this.method.generator = null; |
| 10980 } | 10991 } |
| 10981 else { | 10992 else { |
| 10982 this._paramCode = map(this.method.get$parameters(), (function (p) { | 10993 this._paramCode = map(this.method.get$parameters(), (function (p) { |
| 10983 return p.get$name(); | 10994 return p.get$name(); |
| 10984 }) | 10995 }) |
| 10985 ); | 10996 ); |
| 10986 this.writer.write($assert_String(this.method.get$definition().body.body)); | 10997 this.writer.write($assert_String(this.method.get$definition().body.body)); |
| 10987 } | 10998 } |
| 10988 } | 10999 } |
| 10989 else { | 11000 else { |
| 10990 this.writeBody(); | 11001 this.writeBody(); |
| 10991 } | 11002 } |
| 10992 } | 11003 } |
| 10993 MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { | 11004 MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { |
| 10994 var $0; | 11005 var $0; |
| 10995 var paramCode = this._paramCode; | 11006 var paramCode = this._paramCode; |
| 10996 var names = null; | 11007 var names = null; |
| 10997 if ($notnull_bool(this.captures != null && this.captures.get$length() > 0)) { | 11008 if (this.captures != null && this.captures.get$length() > 0) { |
| 10998 names = ListFactory.ListFactory$from$factory(this.captures); | 11009 names = ListFactory.ListFactory$from$factory(this.captures); |
| 10999 names.sort((function (x, y) { | 11010 names.sort((function (x, y) { |
| 11000 return x.compareTo(y); | 11011 return x.compareTo(y); |
| 11001 }) | 11012 }) |
| 11002 ); | 11013 ); |
| 11003 paramCode = ListFactory.ListFactory$from$factory((names && names.is$Iterable ())); | 11014 paramCode = ListFactory.ListFactory$from$factory((names && names.is$Iterable ())); |
| 11004 paramCode.addAll(this._paramCode); | 11015 paramCode.addAll(this._paramCode); |
| 11005 } | 11016 } |
| 11006 var _params = ('(' + Strings.join(this._paramCode, ", ") + ')'); | 11017 var _params = ('(' + Strings.join(this._paramCode, ", ") + ')'); |
| 11007 var params = ('(' + Strings.join((paramCode && paramCode.is$List$String()), ", ") + ')'); | 11018 var params = ('(' + Strings.join((paramCode && paramCode.is$List$String()), ", ") + ')'); |
| 11008 if ($notnull_bool(this.method.declaringType.get$isTop() && !$notnull_bool(this .get$isClosure()))) { | 11019 if ($notnull_bool(this.method.declaringType.get$isTop() && !$notnull_bool(this .get$isClosure()))) { |
| 11009 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params + ' {')); | 11020 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params + ' {')); |
| 11010 } | 11021 } |
| 11011 else if ($notnull_bool(this.get$isClosure())) { | 11022 else if ($notnull_bool(this.get$isClosure())) { |
| 11012 if ($notnull_bool(this.method.name == '')) { | 11023 if (this.method.name == '') { |
| 11013 defWriter.enterBlock(('(function ' + params + ' {')); | 11024 defWriter.enterBlock(('(function ' + params + ' {')); |
| 11014 } | 11025 } |
| 11015 else if ($notnull_bool($ne(names, null))) { | 11026 else if ($notnull_bool($ne(names, null))) { |
| 11016 if ($notnull_bool(lambda == null)) { | 11027 if (lambda == null) { |
| 11017 defWriter.enterBlock(('var ' + this.method.get$jsname() + ' = (function' + params + ' {')); | 11028 defWriter.enterBlock(('var ' + this.method.get$jsname() + ' = (function' + params + ' {')); |
| 11018 } | 11029 } |
| 11019 else { | 11030 else { |
| 11020 defWriter.enterBlock(('(function ' + this.method.get$jsname() + '' + par ams + ' {')); | 11031 defWriter.enterBlock(('(function ' + this.method.get$jsname() + '' + par ams + ' {')); |
| 11021 } | 11032 } |
| 11022 } | 11033 } |
| 11023 else { | 11034 else { |
| 11024 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params + ' {')); | 11035 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params + ' {')); |
| 11025 } | 11036 } |
| 11026 } | 11037 } |
| 11027 else if ($notnull_bool(this.method.get$isConstructor())) { | 11038 else if ($notnull_bool(this.method.get$isConstructor())) { |
| 11028 if ($notnull_bool(this.method.get$constructorName() == '')) { | 11039 if (this.method.get$constructorName() == '') { |
| 11029 defWriter.enterBlock(('function ' + this.method.declaringType.get$jsname() + '' + params + ' {')); | 11040 defWriter.enterBlock(('function ' + this.method.declaringType.get$jsname() + '' + params + ' {')); |
| 11030 } | 11041 } |
| 11031 else { | 11042 else { |
| 11032 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + this.method.get$constructorName() + '\$ctor = function' + params + ' {')); | 11043 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + this.method.get$constructorName() + '\$ctor = function' + params + ' {')); |
| 11033 } | 11044 } |
| 11034 } | 11045 } |
| 11035 else if ($notnull_bool(this.method.get$isFactory())) { | 11046 else if ($notnull_bool(this.method.get$isFactory())) { |
| 11036 defWriter.enterBlock(('' + this.method.get$generatedFactoryName() + ' = func tion' + _params + ' {')); | 11047 defWriter.enterBlock(('' + this.method.get$generatedFactoryName() + ' = func tion' + _params + ' {')); |
| 11037 } | 11048 } |
| 11038 else if ($notnull_bool(this.method.get$isStatic())) { | 11049 else if ($notnull_bool(this.method.get$isStatic())) { |
| 11039 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th is.method.get$jsname() + ' = function' + _params + ' {')); | 11050 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th is.method.get$jsname() + ' = function' + _params + ' {')); |
| 11040 } | 11051 } |
| 11041 else { | 11052 else { |
| 11042 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {')); | 11053 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {')); |
| 11043 } | 11054 } |
| 11044 if ($notnull_bool(this.needsThis)) { | 11055 if ($notnull_bool(this.needsThis)) { |
| 11045 defWriter.writeln('var \$this = this; // closure support'); | 11056 defWriter.writeln('var \$this = this; // closure support'); |
| 11046 } | 11057 } |
| 11047 if ($notnull_bool(this._usedTemps.get$length() > 0 || this._freeTemps.length > 0)) { | 11058 if (this._usedTemps.get$length() > 0 || this._freeTemps.length > 0) { |
| 11048 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da rt", 695, 14); | 11059 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da rt", 695, 14); |
| 11049 this._freeTemps.addAll(this._usedTemps); | 11060 this._freeTemps.addAll(this._usedTemps); |
| 11050 this._freeTemps.sort((function (x, y) { | 11061 this._freeTemps.sort((function (x, y) { |
| 11051 return x.compareTo(y); | 11062 return x.compareTo(y); |
| 11052 }) | 11063 }) |
| 11053 ); | 11064 ); |
| 11054 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); | 11065 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); |
| 11055 } | 11066 } |
| 11056 defWriter.writeln(this.writer.get$text()); | 11067 defWriter.writeln(this.writer.get$text()); |
| 11057 if ($notnull_bool($ne(names, null))) { | 11068 if ($notnull_bool($ne(names, null))) { |
| 11058 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List $String()), ", ") + ')')); | 11069 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List $String()), ", ") + ')')); |
| 11059 } | 11070 } |
| 11060 else if ($notnull_bool(this.get$isClosure() && this.method.name == '')) { | 11071 else if ($notnull_bool(this.get$isClosure() && this.method.name == '')) { |
| 11061 defWriter.exitBlock('})'); | 11072 defWriter.exitBlock('})'); |
| 11062 } | 11073 } |
| 11063 else { | 11074 else { |
| 11064 defWriter.exitBlock('}'); | 11075 defWriter.exitBlock('}'); |
| 11065 } | 11076 } |
| 11066 if ($notnull_bool(this.method.get$isConstructor() && this.method.get$construct orName() != '')) { | 11077 if ($notnull_bool(this.method.get$isConstructor() && this.method.get$construct orName() != '')) { |
| 11067 defWriter.writeln(('' + this.method.declaringType.get$jsname() + '.' + this. method.get$constructorName() + '\$ctor.prototype = ') + ('' + this.method.declar ingType.get$jsname() + '.prototype;')); | 11078 defWriter.writeln(('' + this.method.declaringType.get$jsname() + '.' + this. method.get$constructorName() + '\$ctor.prototype = ') + ('' + this.method.declar ingType.get$jsname() + '.prototype;')); |
| 11068 } | 11079 } |
| 11069 this._provideOptionalParamInfo(defWriter); | 11080 this._provideOptionalParamInfo(defWriter); |
| 11070 if ($notnull_bool((this.method instanceof MethodMember))) { | 11081 if ((this.method instanceof MethodMember)) { |
| 11071 var m = (($0 = this.method) && $0.is$MethodMember()); | 11082 var m = (($0 = this.method) && $0.is$MethodMember()); |
| 11072 if ($notnull_bool(m._providePropertySyntax)) { | 11083 if ($notnull_bool(m._providePropertySyntax)) { |
| 11073 defWriter.enterBlock(('' + m.declaringType.get$jsname() + '.prototype') + ('.get\$' + m.get$jsname() + ' = function() {')); | 11084 defWriter.enterBlock(('' + m.declaringType.get$jsname() + '.prototype') + ('.get\$' + m.get$jsname() + ' = function() {')); |
| 11074 defWriter.writeln(('return ' + m.declaringType.get$jsname() + '.prototype. ') + ('' + m.get$jsname() + '.bind(this);')); | 11085 defWriter.writeln(('return ' + m.declaringType.get$jsname() + '.prototype. ') + ('' + m.get$jsname() + '.bind(this);')); |
| 11075 defWriter.exitBlock('}'); | 11086 defWriter.exitBlock('}'); |
| 11076 if ($notnull_bool(m._provideFieldSyntax)) { | 11087 if ($notnull_bool(m._provideFieldSyntax)) { |
| 11077 world.internalError('bound m accessed with field syntax'); | 11088 world.internalError('bound m accessed with field syntax'); |
| 11078 } | 11089 } |
| 11079 } | 11090 } |
| 11080 } | 11091 } |
| 11081 } | 11092 } |
| 11082 MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) { | 11093 MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) { |
| 11083 var $0; | 11094 var $0; |
| 11084 if ($notnull_bool((this.method instanceof MethodMember))) { | 11095 if ((this.method instanceof MethodMember)) { |
| 11085 var meth = (($0 = this.method) && $0.is$MethodMember()); | 11096 var meth = (($0 = this.method) && $0.is$MethodMember()); |
| 11086 if ($notnull_bool(meth._provideOptionalParamInfo)) { | 11097 if ($notnull_bool(meth._provideOptionalParamInfo)) { |
| 11087 var optNames = []; | 11098 var optNames = []; |
| 11088 var optValues = []; | 11099 var optValues = []; |
| 11089 meth.genParameterValues(); | 11100 meth.genParameterValues(); |
| 11090 var $list = meth.parameters; | 11101 var $list = meth.parameters; |
| 11091 for (var $i = 0;$i < $list.length; $i++) { | 11102 for (var $i = 0;$i < $list.length; $i++) { |
| 11092 var param = $list.$index($i); | 11103 var param = $list.$index($i); |
| 11093 if ($notnull_bool(param.get$isOptional())) { | 11104 if ($notnull_bool(param.get$isOptional())) { |
| 11094 optNames.add(param.get$name()); | 11105 optNames.add(param.get$name()); |
| 11095 optValues.add(MethodGenerator._escapeString(param.get$value().code)); | 11106 optValues.add(MethodGenerator._escapeString(param.get$value().code)); |
| 11096 } | 11107 } |
| 11097 } | 11108 } |
| 11098 if ($notnull_bool(optNames.length > 0)) { | 11109 if (optNames.length > 0) { |
| 11099 var start = ''; | 11110 var start = ''; |
| 11100 if ($notnull_bool(meth.isStatic)) { | 11111 if ($notnull_bool(meth.isStatic)) { |
| 11101 if ($notnull_bool(!$notnull_bool(meth.declaringType.get$isTop()))) { | 11112 if (!$notnull_bool(meth.declaringType.get$isTop())) { |
| 11102 start = meth.declaringType.get$jsname() + '.'; | 11113 start = meth.declaringType.get$jsname() + '.'; |
| 11103 } | 11114 } |
| 11104 } | 11115 } |
| 11105 else { | 11116 else { |
| 11106 start = meth.declaringType.get$jsname() + '.prototype.'; | 11117 start = meth.declaringType.get$jsname() + '.prototype.'; |
| 11107 } | 11118 } |
| 11108 optNames.addAll(optValues); | 11119 optNames.addAll(optValues); |
| 11109 var optional = "['" + Strings.join((optNames && optNames.is$List$String( )), "', '") + "']"; | 11120 var optional = "['" + Strings.join((optNames && optNames.is$List$String( )), "', '") + "']"; |
| 11110 defWriter.writeln(('' + start + '' + meth.get$jsname() + '.\$optional = ' + optional + '')); | 11121 defWriter.writeln(('' + start + '' + meth.get$jsname() + '.\$optional = ' + optional + '')); |
| 11111 } | 11122 } |
| 11112 } | 11123 } |
| 11113 } | 11124 } |
| 11114 } | 11125 } |
| 11115 MethodGenerator.prototype.writeBody = function() { | 11126 MethodGenerator.prototype.writeBody = function() { |
| 11116 var $0; | 11127 var $0; |
| 11117 var initializers = null; | 11128 var initializers = null; |
| 11118 var initializedFields = null; | 11129 var initializedFields = null; |
| 11119 if ($notnull_bool(this.method.get$isConstructor())) { | 11130 if ($notnull_bool(this.method.get$isConstructor())) { |
| 11120 initializers = []; | 11131 initializers = []; |
| 11121 initializedFields = new HashSetImplementation(); | 11132 initializedFields = new HashSetImplementation(); |
| 11122 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers() ); | 11133 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers() ); |
| 11123 for (var $i = 0;$i < $list.length; $i++) { | 11134 for (var $i = 0;$i < $list.length; $i++) { |
| 11124 var f = $list.$index($i); | 11135 var f = $list.$index($i); |
| 11125 if ($notnull_bool((f instanceof FieldMember) && !$notnull_bool(f.get$isSta tic()))) { | 11136 if ((f instanceof FieldMember) && !$notnull_bool(f.get$isStatic())) { |
| 11126 var cv = f.computeValue(); | 11137 var cv = f.computeValue(); |
| 11127 if ($notnull_bool($ne(cv, null))) { | 11138 if ($notnull_bool($ne(cv, null))) { |
| 11128 initializers.add(('this.' + f.get$jsname() + ' = ' + cv.code + '')); | 11139 initializers.add(('this.' + f.get$jsname() + ' = ' + cv.code + '')); |
| 11129 initializedFields.add(f.get$name()); | 11140 initializedFields.add(f.get$name()); |
| 11130 } | 11141 } |
| 11131 } | 11142 } |
| 11132 } | 11143 } |
| 11133 } | 11144 } |
| 11134 this._paramCode = []; | 11145 this._paramCode = []; |
| 11135 var $list = this.method.get$parameters(); | 11146 var $list = this.method.get$parameters(); |
| 11136 for (var $i = 0;$i < $list.length; $i++) { | 11147 for (var $i = 0;$i < $list.length; $i++) { |
| 11137 var p = $list.$index($i); | 11148 var p = $list.$index($i); |
| 11138 if ($notnull_bool($ne(initializers, null) && p.isInitializer)) { | 11149 if ($notnull_bool($ne(initializers, null) && p.isInitializer)) { |
| 11139 var field = this.method.declaringType.getMember(p.get$name()); | 11150 var field = this.method.declaringType.getMember(p.get$name()); |
| 11140 if ($notnull_bool(field == null)) { | 11151 if ($notnull_bool(field == null)) { |
| 11141 world.error('bad this parameter - no matching field', p.get$definition() .get$span()); | 11152 world.error('bad this parameter - no matching field', p.get$definition() .get$span()); |
| 11142 } | 11153 } |
| 11143 if ($notnull_bool(!$notnull_bool(field.get$isField()))) { | 11154 if (!$notnull_bool(field.get$isField())) { |
| 11144 world.error(('"this.' + p.get$name() + '" does not refer to a field'), p .get$definition().get$span()); | 11155 world.error(('"this.' + p.get$name() + '" does not refer to a field'), p .get$definition().get$span()); |
| 11145 } | 11156 } |
| 11146 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def inition().get$span(), false); | 11157 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def inition().get$span(), false); |
| 11147 this._paramCode.add(paramValue.code); | 11158 this._paramCode.add(paramValue.code); |
| 11148 initializers.add(('this.' + field.get$jsname() + ' = ' + paramValue.code + ';')); | 11159 initializers.add(('this.' + field.get$jsname() + ' = ' + paramValue.code + ';')); |
| 11149 initializedFields.add(p.get$name()); | 11160 initializedFields.add(p.get$name()); |
| 11150 } | 11161 } |
| 11151 else { | 11162 else { |
| 11152 var paramValue = this._scope.declareParameter((p && p.is$Parameter())); | 11163 var paramValue = this._scope.declareParameter((p && p.is$Parameter())); |
| 11153 this._paramCode.add(paramValue.code); | 11164 this._paramCode.add(paramValue.code); |
| 11154 } | 11165 } |
| 11155 } | 11166 } |
| 11156 var body = this.method.get$definition().body; | 11167 var body = this.method.get$definition().body; |
| 11157 if ($notnull_bool(body == null && !$notnull_bool(this.method.get$isConstructor ()))) { | 11168 if ($notnull_bool(body == null && !$notnull_bool(this.method.get$isConstructor ()))) { |
| 11158 world.error(('unexpected empty body for ' + this.method.name + ''), this.met hod.get$definition().get$span()); | 11169 world.error(('unexpected empty body for ' + this.method.name + ''), this.met hod.get$definition().get$span()); |
| 11159 } | 11170 } |
| 11160 if ($notnull_bool($ne(initializers, null))) { | 11171 if ($notnull_bool($ne(initializers, null))) { |
| 11161 for (var $i = initializers.iterator(); $i.hasNext(); ) { | 11172 for (var $i = initializers.iterator(); $i.hasNext(); ) { |
| 11162 var i = $i.next(); | 11173 var i = $i.next(); |
| 11163 this.writer.writeln($assert_String(i)); | 11174 this.writer.writeln($assert_String(i)); |
| 11164 } | 11175 } |
| 11165 var declaredInitializers = this.method.get$definition().initializers; | 11176 var declaredInitializers = this.method.get$definition().initializers; |
| 11166 if ($notnull_bool(declaredInitializers != null)) { | 11177 if (declaredInitializers != null) { |
| 11167 var initializerCall = null; | 11178 var initializerCall = null; |
| 11168 for (var $i = 0;$i < declaredInitializers.length; $i++) { | 11179 for (var $i = 0;$i < declaredInitializers.length; $i++) { |
| 11169 var init = declaredInitializers.$index($i); | 11180 var init = declaredInitializers.$index($i); |
| 11170 if ($notnull_bool((init instanceof CallExpression))) { | 11181 if ((init instanceof CallExpression)) { |
| 11171 if ($notnull_bool($ne(initializerCall, null))) { | 11182 if ($notnull_bool($ne(initializerCall, null))) { |
| 11172 world.error('only one initializer redirecting call is allowed', init .get$span()); | 11183 world.error('only one initializer redirecting call is allowed', init .get$span()); |
| 11173 } | 11184 } |
| 11174 initializerCall = init; | 11185 initializerCall = init; |
| 11175 } | 11186 } |
| 11176 else if ($notnull_bool((init instanceof BinaryExpression) && TokenKind.k indFromAssign(init.op.kind) == 0)) { | 11187 else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign( init.op.kind) == 0) { |
| 11177 var left = init.x; | 11188 var left = init.x; |
| 11178 if ($notnull_bool(!$notnull_bool(($notnull_bool((left instanceof DotEx pression) && (left.self instanceof ThisExpression)) || (left instanceof VarExpre ssion))))) { | 11189 if (!((left instanceof DotExpression) && (left.self instanceof ThisExp ression) || (left instanceof VarExpression))) { |
| 11179 world.error('invalid left side of initializer', left.get$span()); | 11190 world.error('invalid left side of initializer', left.get$span()); |
| 11180 continue; | 11191 continue; |
| 11181 } | 11192 } |
| 11182 initializedFields.add(left.get$name().get$name()); | 11193 initializedFields.add(left.get$name().get$name()); |
| 11183 var assign = this._makeThisValue(null).set_(this, $assert_String(left. get$name().get$name()), (($0 = left.get$name()) && $0.is$lang_Node()), (($0 = th is.visitValue(init.y)) && $0.is$Value()), false); | 11194 var assign = this._makeThisValue(null).set_(this, $assert_String(left. get$name().get$name()), (($0 = left.get$name()) && $0.is$lang_Node()), (($0 = th is.visitValue(init.y)) && $0.is$Value()), false); |
| 11184 this.writer.writeln(('' + assign.code + ';')); | 11195 this.writer.writeln(('' + assign.code + ';')); |
| 11185 } | 11196 } |
| 11186 else { | 11197 else { |
| 11187 world.error('invalid initializer', init.get$span()); | 11198 world.error('invalid initializer', init.get$span()); |
| 11188 } | 11199 } |
| 11189 } | 11200 } |
| 11190 if ($notnull_bool($ne(initializerCall, null))) { | 11201 if ($notnull_bool($ne(initializerCall, null))) { |
| 11191 var target = this._writeInitializerCall((initializerCall && initializerC all.is$CallExpression())); | 11202 var target = this._writeInitializerCall((initializerCall && initializerC all.is$CallExpression())); |
| 11192 if ($notnull_bool(!$notnull_bool(target.isSuper))) { | 11203 if (!$notnull_bool(target.isSuper)) { |
| 11193 if ($notnull_bool(initializers.length > 0)) { | 11204 if (initializers.length > 0) { |
| 11194 var $list = this.method.get$parameters(); | 11205 var $list = this.method.get$parameters(); |
| 11195 for (var $i = 0;$i < $list.length; $i++) { | 11206 for (var $i = 0;$i < $list.length; $i++) { |
| 11196 var p = $list.$index($i); | 11207 var p = $list.$index($i); |
| 11197 if ($notnull_bool(p.isInitializer)) { | 11208 if ($notnull_bool(p.isInitializer)) { |
| 11198 world.error('no initialization allowed on redirecting constructo rs', p.get$definition().get$span()); | 11209 world.error('no initialization allowed on redirecting constructo rs', p.get$definition().get$span()); |
| 11199 break; | 11210 break; |
| 11200 } | 11211 } |
| 11201 } | 11212 } |
| 11202 } | 11213 } |
| 11203 if ($notnull_bool(declaredInitializers.length > 1)) { | 11214 if (declaredInitializers.length > 1) { |
| 11204 var init = $notnull_bool($eq(declaredInitializers.$index(0), initial izerCall)) ? declaredInitializers.$index(1) : declaredInitializers.$index(0); | 11215 var init = $notnull_bool($eq(declaredInitializers.$index(0), initial izerCall)) ? declaredInitializers.$index(1) : declaredInitializers.$index(0); |
| 11205 world.error('no initialization allowed on redirecting constructors', init.get$span()); | 11216 world.error('no initialization allowed on redirecting constructors', init.get$span()); |
| 11206 } | 11217 } |
| 11207 initializedFields = null; | 11218 initializedFields = null; |
| 11208 } | 11219 } |
| 11209 } | 11220 } |
| 11210 else { | 11221 else { |
| 11211 } | 11222 } |
| 11212 } | 11223 } |
| 11213 this.writer.comment('// Initializers done'); | 11224 this.writer.comment('// Initializers done'); |
| 11214 } | 11225 } |
| 11215 if ($notnull_bool($ne(initializedFields, null))) { | 11226 if ($notnull_bool($ne(initializedFields, null))) { |
| 11216 var $list = this.method.declaringType.get$members().getKeys(); | 11227 var $list = this.method.declaringType.get$members().getKeys(); |
| 11217 for (var $i = this.method.declaringType.get$members().getKeys().iterator(); $i.hasNext(); ) { | 11228 for (var $i = this.method.declaringType.get$members().getKeys().iterator(); $i.hasNext(); ) { |
| 11218 var name = $i.next(); | 11229 var name = $i.next(); |
| 11219 var member = this.method.declaringType.get$members().$index(name); | 11230 var member = this.method.declaringType.get$members().$index(name); |
| 11220 if ($notnull_bool((member instanceof FieldMember) && member.isFinal) && !$ notnull_bool(member.get$isStatic()) && !$notnull_bool(initializedFields.contains (name))) { | 11231 if ($notnull_bool((member instanceof FieldMember) && member.isFinal) && !$ notnull_bool(member.get$isStatic()) && !initializedFields.contains(name)) { |
| 11221 world.error(('Field "' + name + '" is final and was not initialized'), t his.method.get$definition().get$span()); | 11232 world.error(('Field "' + name + '" is final and was not initialized'), t his.method.get$definition().get$span()); |
| 11222 } | 11233 } |
| 11223 } | 11234 } |
| 11224 } | 11235 } |
| 11225 this.visitStatementsInBlock((body && body.is$lang_Statement())); | 11236 this.visitStatementsInBlock((body && body.is$lang_Statement())); |
| 11226 } | 11237 } |
| 11227 MethodGenerator.prototype._writeInitializerCall = function(node) { | 11238 MethodGenerator.prototype._writeInitializerCall = function(node) { |
| 11228 var contructorName = ''; | 11239 var contructorName = ''; |
| 11229 var targetExp = node.target; | 11240 var targetExp = node.target; |
| 11230 if ($notnull_bool((targetExp instanceof DotExpression))) { | 11241 if ((targetExp instanceof DotExpression)) { |
| 11231 var dot = (targetExp && targetExp.is$DotExpression()); | 11242 var dot = (targetExp && targetExp.is$DotExpression()); |
| 11232 targetExp = dot.self; | 11243 targetExp = dot.self; |
| 11233 contructorName = dot.name.name; | 11244 contructorName = dot.name.name; |
| 11234 } | 11245 } |
| 11235 var target = null; | 11246 var target = null; |
| 11236 if ($notnull_bool((targetExp instanceof SuperExpression))) { | 11247 if ((targetExp instanceof SuperExpression)) { |
| 11237 target = this._makeSuperValue((targetExp && targetExp.is$lang_Node())); | 11248 target = this._makeSuperValue((targetExp && targetExp.is$lang_Node())); |
| 11238 } | 11249 } |
| 11239 else if ($notnull_bool((targetExp instanceof ThisExpression))) { | 11250 else if ((targetExp instanceof ThisExpression)) { |
| 11240 target = this._makeThisValue((targetExp && targetExp.is$lang_Node())); | 11251 target = this._makeThisValue((targetExp && targetExp.is$lang_Node())); |
| 11241 } | 11252 } |
| 11242 else { | 11253 else { |
| 11243 world.error('bad call in initializers', node.span); | 11254 world.error('bad call in initializers', node.span); |
| 11244 } | 11255 } |
| 11245 var m = target.type.getConstructor(contructorName); | 11256 var m = target.type.getConstructor(contructorName); |
| 11246 this.method.set$initDelegate(m); | 11257 this.method.set$initDelegate(m); |
| 11247 var other = m; | 11258 var other = m; |
| 11248 while ($notnull_bool($ne(other, null))) { | 11259 while ($notnull_bool($ne(other, null))) { |
| 11249 if ($notnull_bool($eq(other, this.method))) { | 11260 if ($notnull_bool($eq(other, this.method))) { |
| 11250 world.error('initialization cycle', node.span); | 11261 world.error('initialization cycle', node.span); |
| 11251 break; | 11262 break; |
| 11252 } | 11263 } |
| 11253 other = other.get$initDelegate(); | 11264 other = other.get$initDelegate(); |
| 11254 } | 11265 } |
| 11255 world.gen.genMethod((m && m.is$Member())); | 11266 world.gen.genMethod((m && m.is$Member())); |
| 11256 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments)); | 11267 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments)); |
| 11257 if ($notnull_bool($ne(target.type, world.objectType))) { | 11268 if ($notnull_bool($ne(target.type, world.objectType))) { |
| 11258 this.writer.writeln(('' + value.code + ';')); | 11269 this.writer.writeln(('' + value.code + ';')); |
| 11259 } | 11270 } |
| 11260 return (target && target.is$Value()); | 11271 return (target && target.is$Value()); |
| 11261 } | 11272 } |
| 11262 MethodGenerator.prototype._makeArgs = function(arguments) { | 11273 MethodGenerator.prototype._makeArgs = function(arguments) { |
| 11263 var $0; | 11274 var $0; |
| 11264 var args = []; | 11275 var args = []; |
| 11265 var seenLabel = false; | 11276 var seenLabel = false; |
| 11266 for (var $i = 0;$i < arguments.length; $i++) { | 11277 for (var $i = 0;$i < arguments.length; $i++) { |
| 11267 var arg = arguments.$index($i); | 11278 var arg = arguments.$index($i); |
| 11268 if ($notnull_bool(arg.label != null)) { | 11279 if (arg.label != null) { |
| 11269 seenLabel = true; | 11280 seenLabel = true; |
| 11270 } | 11281 } |
| 11271 else if ($notnull_bool(seenLabel)) { | 11282 else if ($notnull_bool(seenLabel)) { |
| 11272 world.error('bare argument can not follow named arguments', arg.get$span() ); | 11283 world.error('bare argument can not follow named arguments', arg.get$span() ); |
| 11273 } | 11284 } |
| 11274 args.add(this.visitValue((($0 = arg.get$value()) && $0.is$lang_Expression()) )); | 11285 args.add(this.visitValue((($0 = arg.get$value()) && $0.is$lang_Expression()) )); |
| 11275 } | 11286 } |
| 11276 return new Arguments(arguments, args); | 11287 return new Arguments(arguments, args); |
| 11277 } | 11288 } |
| 11278 MethodGenerator._escapeString = function(text) { | 11289 MethodGenerator._escapeString = function(text) { |
| 11279 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', ' \\n').replaceAll('\r', '\\r'); | 11290 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', ' \\n').replaceAll('\r', '\\r'); |
| 11280 } | 11291 } |
| 11281 MethodGenerator.prototype.visitStatementsInBlock = function(body) { | 11292 MethodGenerator.prototype.visitStatementsInBlock = function(body) { |
| 11282 if ($notnull_bool((body instanceof BlockStatement))) { | 11293 if ((body instanceof BlockStatement)) { |
| 11283 var block = (body && body.is$BlockStatement()); | 11294 var block = (body && body.is$BlockStatement()); |
| 11284 var $list = block.body; | 11295 var $list = block.body; |
| 11285 for (var $i = 0;$i < $list.length; $i++) { | 11296 for (var $i = 0;$i < $list.length; $i++) { |
| 11286 var stmt = $list.$index($i); | 11297 var stmt = $list.$index($i); |
| 11287 stmt.visit(this); | 11298 stmt.visit(this); |
| 11288 } | 11299 } |
| 11289 } | 11300 } |
| 11290 else { | 11301 else { |
| 11291 if ($notnull_bool(body != null)) body.visit(this); | 11302 if (body != null) body.visit(this); |
| 11292 } | 11303 } |
| 11293 return false; | 11304 return false; |
| 11294 } | 11305 } |
| 11295 MethodGenerator.prototype._pushBlock = function(reentrant) { | 11306 MethodGenerator.prototype._pushBlock = function(reentrant) { |
| 11296 this._scope = new BlockScope(this, this._scope, reentrant); | 11307 this._scope = new BlockScope(this, this._scope, reentrant); |
| 11297 } | 11308 } |
| 11298 MethodGenerator.prototype._popBlock = function() { | 11309 MethodGenerator.prototype._popBlock = function() { |
| 11299 this._scope = this._scope.parent; | 11310 this._scope = this._scope.parent; |
| 11300 } | 11311 } |
| 11301 MethodGenerator.prototype._makeLambdaMethod = function(name, func) { | 11312 MethodGenerator.prototype._makeLambdaMethod = function(name, func) { |
| 11302 var meth = new MethodMember(name, this.method.declaringType, func); | 11313 var meth = new MethodMember(name, this.method.declaringType, func); |
| 11303 meth.isLambda = true; | 11314 meth.isLambda = true; |
| 11304 meth.resolve(this.method.declaringType); | 11315 meth.resolve(this.method.declaringType); |
| 11305 world.gen.genMethod((meth && meth.is$Member()), this); | 11316 world.gen.genMethod((meth && meth.is$Member()), this); |
| 11306 return (meth && meth.is$MethodMember()); | 11317 return (meth && meth.is$MethodMember()); |
| 11307 } | 11318 } |
| 11308 MethodGenerator.prototype.visitBool = function(node) { | 11319 MethodGenerator.prototype.visitBool = function(node) { |
| 11309 return this.visitValue(node).convertToNonNullBool(this, node); | 11320 return this.visitValue(node).convertTo(this, world.nonNullBool, node, false); |
| 11310 } | 11321 } |
| 11311 MethodGenerator.prototype.visitValue = function(node) { | 11322 MethodGenerator.prototype.visitValue = function(node) { |
| 11312 if ($notnull_bool(node == null)) return null; | 11323 if (node == null) return null; |
| 11313 var value = node.visit(this); | 11324 var value = node.visit(this); |
| 11314 value.checkFirstClass(node.span); | 11325 value.checkFirstClass(node.span); |
| 11315 return value; | 11326 return value; |
| 11316 } | 11327 } |
| 11317 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) { | 11328 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) { |
| 11318 return this.visitValue(node).convertTo(this, expectedType, node, false); | 11329 return this.visitValue(node).convertTo(this, expectedType, node, false); |
| 11319 } | 11330 } |
| 11320 MethodGenerator.prototype.visitVoid = function(node) { | 11331 MethodGenerator.prototype.visitVoid = function(node) { |
| 11321 if ($notnull_bool((node instanceof PostfixExpression))) { | 11332 if ((node instanceof PostfixExpression)) { |
| 11322 var value = this.visitPostfixExpression((node && node.is$PostfixExpression() ), true); | 11333 var value = this.visitPostfixExpression((node && node.is$PostfixExpression() ), true); |
| 11323 value.checkFirstClass(node.span); | 11334 value.checkFirstClass(node.span); |
| 11324 return value; | 11335 return value; |
| 11325 } | 11336 } |
| 11326 return this.visitValue(node); | 11337 return this.visitValue(node); |
| 11327 } | 11338 } |
| 11328 MethodGenerator.prototype.visitDietStatement = function(node) { | 11339 MethodGenerator.prototype.visitDietStatement = function(node) { |
| 11329 var parser = new lang_Parser(node.span.file, false, false, false, node.span.st art); | 11340 var parser = new lang_Parser(node.span.file, false, false, false, node.span.st art); |
| 11330 this.visitStatementsInBlock(parser.block()); | 11341 this.visitStatementsInBlock(parser.block()); |
| 11331 return false; | 11342 return false; |
| 11332 } | 11343 } |
| 11333 MethodGenerator.prototype.visitVariableDefinition = function(node) { | 11344 MethodGenerator.prototype.visitVariableDefinition = function(node) { |
| 11334 var $0; | 11345 var $0; |
| 11335 var isFinal = false; | 11346 var isFinal = false; |
| 11336 if ($notnull_bool(node.modifiers != null && $eq(node.modifiers.$index(0).kind, 97/*TokenKind.FINAL*/))) { | 11347 if ($notnull_bool(node.modifiers != null && $eq(node.modifiers.$index(0).kind, 97/*TokenKind.FINAL*/))) { |
| 11337 isFinal = true; | 11348 isFinal = true; |
| 11338 } | 11349 } |
| 11339 this.writer.write('var '); | 11350 this.writer.write('var '); |
| 11340 var type = this.method.resolveType(node.type, false); | 11351 var type = this.method.resolveType(node.type, false); |
| 11341 for (var i = 0; | 11352 for (var i = 0; |
| 11342 $notnull_bool(i < node.names.length); i++) { | 11353 i < node.names.length; i++) { |
| 11343 var thisType = type; | 11354 var thisType = type; |
| 11344 if ($notnull_bool(i > 0)) { | 11355 if (i > 0) { |
| 11345 this.writer.write(', '); | 11356 this.writer.write(', '); |
| 11346 } | 11357 } |
| 11347 var name = node.names.$index(i).get$name(); | 11358 var name = node.names.$index(i).get$name(); |
| 11348 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr ession())); | 11359 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr ession())); |
| 11349 if ($notnull_bool(isFinal)) { | 11360 if ($notnull_bool(isFinal)) { |
| 11350 if ($notnull_bool(value == null)) { | 11361 if ($notnull_bool(value == null)) { |
| 11351 world.error('no value specified for final variable', node.span); | 11362 world.error('no value specified for final variable', node.span); |
| 11352 } | 11363 } |
| 11353 else { | 11364 else { |
| 11354 if ($notnull_bool(thisType.get$isVar())) thisType = value.type; | 11365 if ($notnull_bool(thisType.get$isVar())) thisType = value.type; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 11368 } | 11379 } |
| 11369 MethodGenerator.prototype.visitFunctionDefinition = function(node) { | 11380 MethodGenerator.prototype.visitFunctionDefinition = function(node) { |
| 11370 var $0; | 11381 var $0; |
| 11371 var name = world.toJsIdentifier(node.name.name); | 11382 var name = world.toJsIdentifier(node.name.name); |
| 11372 var meth = this._makeLambdaMethod($assert_String(name), node); | 11383 var meth = this._makeLambdaMethod($assert_String(name), node); |
| 11373 var funcValue = this._scope.create($assert_String(name), (($0 = meth.get$funct ionType()) && $0.is$lang_Type()), this.method.get$definition().get$span(), false ); | 11384 var funcValue = this._scope.create($assert_String(name), (($0 = meth.get$funct ionType()) && $0.is$lang_Type()), this.method.get$definition().get$span(), false ); |
| 11374 meth.generator.writeDefinition(this.writer, null); | 11385 meth.generator.writeDefinition(this.writer, null); |
| 11375 return false; | 11386 return false; |
| 11376 } | 11387 } |
| 11377 MethodGenerator.prototype.visitReturnStatement = function(node) { | 11388 MethodGenerator.prototype.visitReturnStatement = function(node) { |
| 11378 if ($notnull_bool(node.value == null)) { | 11389 if (node.value == null) { |
| 11379 this.writer.writeln('return;'); | 11390 this.writer.writeln('return;'); |
| 11380 } | 11391 } |
| 11381 else { | 11392 else { |
| 11382 if ($notnull_bool(this.method.get$isConstructor())) { | 11393 if ($notnull_bool(this.method.get$isConstructor())) { |
| 11383 world.error('return of value not allowed from constructor', node.span); | 11394 world.error('return of value not allowed from constructor', node.span); |
| 11384 } | 11395 } |
| 11385 var value = this.visitTypedValue(node.value, this.method.get$returnType()); | 11396 var value = this.visitTypedValue(node.value, this.method.get$returnType()); |
| 11386 this.writer.writeln(('return ' + value.code + ';')); | 11397 this.writer.writeln(('return ' + value.code + ';')); |
| 11387 } | 11398 } |
| 11388 return true; | 11399 return true; |
| 11389 } | 11400 } |
| 11390 MethodGenerator.prototype.visitThrowStatement = function(node) { | 11401 MethodGenerator.prototype.visitThrowStatement = function(node) { |
| 11391 if ($notnull_bool(node.value != null)) { | 11402 if (node.value != null) { |
| 11392 var value = this.visitValue(node.value); | 11403 var value = this.visitValue(node.value); |
| 11393 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY()); | 11404 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY()); |
| 11394 this.writer.writeln(('\$throw(' + value.code + ');')); | 11405 this.writer.writeln(('\$throw(' + value.code + ');')); |
| 11395 world.gen.corejs.useThrow = true; | 11406 world.gen.corejs.useThrow = true; |
| 11396 } | 11407 } |
| 11397 else { | 11408 else { |
| 11398 var rethrow = this._scope.getRethrow(); | 11409 var rethrow = this._scope.getRethrow(); |
| 11399 if ($notnull_bool(rethrow == null)) { | 11410 if ($notnull_bool(rethrow == null)) { |
| 11400 world.error('rethrow outside of catch', node.span); | 11411 world.error('rethrow outside of catch', node.span); |
| 11401 } | 11412 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 11414 world.gen.genMethod((($0 = err.get$members().$index('toString')) && $0.is$Me mber())); | 11425 world.gen.genMethod((($0 = err.get$members().$index('toString')) && $0.is$Me mber())); |
| 11415 var span = node.test.span; | 11426 var span = node.test.span; |
| 11416 var line = span.file.getLine(span.start); | 11427 var line = span.file.getLine(span.start); |
| 11417 var column = span.file.getColumn($assert_num(line), span.start); | 11428 var column = span.file.getColumn($assert_num(line), span.start); |
| 11418 this.writer.writeln(('\$assert(' + test.code + ', "' + MethodGenerator._esca peString(span.get$text()) + '",') + (' "' + basename(span.file.filename) + '", ' + (line + 1) + ', ' + (column + 1) + ');')); | 11429 this.writer.writeln(('\$assert(' + test.code + ', "' + MethodGenerator._esca peString(span.get$text()) + '",') + (' "' + basename(span.file.filename) + '", ' + (line + 1) + ', ' + (column + 1) + ');')); |
| 11419 world.gen.corejs.useAssert = true; | 11430 world.gen.corejs.useAssert = true; |
| 11420 } | 11431 } |
| 11421 return false; | 11432 return false; |
| 11422 } | 11433 } |
| 11423 MethodGenerator.prototype.visitBreakStatement = function(node) { | 11434 MethodGenerator.prototype.visitBreakStatement = function(node) { |
| 11424 if ($notnull_bool(node.label == null)) { | 11435 if (node.label == null) { |
| 11425 this.writer.writeln('break;'); | 11436 this.writer.writeln('break;'); |
| 11426 } | 11437 } |
| 11427 else { | 11438 else { |
| 11428 this.writer.writeln(('break ' + node.label.name + ';')); | 11439 this.writer.writeln(('break ' + node.label.name + ';')); |
| 11429 } | 11440 } |
| 11430 return true; | 11441 return true; |
| 11431 } | 11442 } |
| 11432 MethodGenerator.prototype.visitContinueStatement = function(node) { | 11443 MethodGenerator.prototype.visitContinueStatement = function(node) { |
| 11433 if ($notnull_bool(node.label == null)) { | 11444 if (node.label == null) { |
| 11434 this.writer.writeln('continue;'); | 11445 this.writer.writeln('continue;'); |
| 11435 } | 11446 } |
| 11436 else { | 11447 else { |
| 11437 this.writer.writeln(('continue ' + node.label.name + ';')); | 11448 this.writer.writeln(('continue ' + node.label.name + ';')); |
| 11438 } | 11449 } |
| 11439 return true; | 11450 return true; |
| 11440 } | 11451 } |
| 11441 MethodGenerator.prototype.visitIfStatement = function(node) { | 11452 MethodGenerator.prototype.visitIfStatement = function(node) { |
| 11442 var test = this.visitBool(node.test); | 11453 var test = this.visitBool(node.test); |
| 11443 this.writer.write(('if (' + test.code + ') ')); | 11454 this.writer.write(('if (' + test.code + ') ')); |
| 11444 var exit1 = node.trueBranch.visit(this); | 11455 var exit1 = node.trueBranch.visit(this); |
| 11445 if ($notnull_bool(node.falseBranch != null)) { | 11456 if (node.falseBranch != null) { |
| 11446 this.writer.write('else '); | 11457 this.writer.write('else '); |
| 11447 if ($notnull_bool(node.falseBranch.visit(this) && exit1)) { | 11458 if ($notnull_bool(node.falseBranch.visit(this) && exit1)) { |
| 11448 return true; | 11459 return true; |
| 11449 } | 11460 } |
| 11450 } | 11461 } |
| 11451 return false; | 11462 return false; |
| 11452 } | 11463 } |
| 11453 MethodGenerator.prototype.visitWhileStatement = function(node) { | 11464 MethodGenerator.prototype.visitWhileStatement = function(node) { |
| 11454 var test = this.visitBool(node.test); | 11465 var test = this.visitBool(node.test); |
| 11455 this.writer.write(('while (' + test.code + ') ')); | 11466 this.writer.write(('while (' + test.code + ') ')); |
| 11456 this._pushBlock(true); | 11467 this._pushBlock(true); |
| 11457 node.body.visit(this); | 11468 node.body.visit(this); |
| 11458 this._popBlock(); | 11469 this._popBlock(); |
| 11459 return false; | 11470 return false; |
| 11460 } | 11471 } |
| 11461 MethodGenerator.prototype.visitDoStatement = function(node) { | 11472 MethodGenerator.prototype.visitDoStatement = function(node) { |
| 11462 this.writer.write('do '); | 11473 this.writer.write('do '); |
| 11463 this._pushBlock(true); | 11474 this._pushBlock(true); |
| 11464 node.body.visit(this); | 11475 node.body.visit(this); |
| 11465 this._popBlock(); | 11476 this._popBlock(); |
| 11466 var test = this.visitBool(node.test); | 11477 var test = this.visitBool(node.test); |
| 11467 this.writer.writeln(('while (' + test.code + ')')); | 11478 this.writer.writeln(('while (' + test.code + ')')); |
| 11468 return false; | 11479 return false; |
| 11469 } | 11480 } |
| 11470 MethodGenerator.prototype.visitForStatement = function(node) { | 11481 MethodGenerator.prototype.visitForStatement = function(node) { |
| 11471 this._pushBlock(false); | 11482 this._pushBlock(false); |
| 11472 this.writer.write('for ('); | 11483 this.writer.write('for ('); |
| 11473 if ($notnull_bool(node.init != null)) node.init.visit(this); | 11484 if (node.init != null) node.init.visit(this); |
| 11474 else this.writer.write(';'); | 11485 else this.writer.write(';'); |
| 11475 if ($notnull_bool(node.test != null)) { | 11486 if (node.test != null) { |
| 11476 var test = this.visitBool(node.test); | 11487 var test = this.visitBool(node.test); |
| 11477 this.writer.write((' ' + test.code + '; ')); | 11488 this.writer.write((' ' + test.code + '; ')); |
| 11478 } | 11489 } |
| 11479 else { | 11490 else { |
| 11480 this.writer.write('; '); | 11491 this.writer.write('; '); |
| 11481 } | 11492 } |
| 11482 var needsComma = false; | 11493 var needsComma = false; |
| 11483 var $list = node.step; | 11494 var $list = node.step; |
| 11484 for (var $i = 0;$i < $list.length; $i++) { | 11495 for (var $i = 0;$i < $list.length; $i++) { |
| 11485 var s = $list.$index($i); | 11496 var s = $list.$index($i); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11539 } | 11550 } |
| 11540 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');')); | 11551 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');')); |
| 11541 world.gen.corejs.useToDartException = true; | 11552 world.gen.corejs.useToDartException = true; |
| 11542 } | 11553 } |
| 11543 MethodGenerator.prototype.visitTryStatement = function(node) { | 11554 MethodGenerator.prototype.visitTryStatement = function(node) { |
| 11544 var $0; | 11555 var $0; |
| 11545 this.writer.enterBlock('try {'); | 11556 this.writer.enterBlock('try {'); |
| 11546 this._pushBlock(false); | 11557 this._pushBlock(false); |
| 11547 this.visitStatementsInBlock(node.body); | 11558 this.visitStatementsInBlock(node.body); |
| 11548 this._popBlock(); | 11559 this._popBlock(); |
| 11549 if ($notnull_bool(node.catches.length == 1)) { | 11560 if (node.catches.length == 1) { |
| 11550 var catch_ = node.catches.$index(0); | 11561 var catch_ = node.catches.$index(0); |
| 11551 this._pushBlock(false); | 11562 this._pushBlock(false); |
| 11552 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare dIdentifier())); | 11563 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare dIdentifier())); |
| 11553 this._scope.rethrow = (ex && ex.is$Value()); | 11564 this._scope.rethrow = (ex && ex.is$Value()); |
| 11554 this.writer.nextBlock(('} catch (' + ex.code + ') {')); | 11565 this.writer.nextBlock(('} catch (' + ex.code + ') {')); |
| 11555 if ($notnull_bool(catch_.trace != null)) { | 11566 if (catch_.trace != null) { |
| 11556 var trace = this._scope.declare(catch_.trace); | 11567 var trace = this._scope.declare(catch_.trace); |
| 11557 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); | 11568 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); |
| 11558 world.gen.corejs.useStackTraceOf = true; | 11569 world.gen.corejs.useStackTraceOf = true; |
| 11559 } | 11570 } |
| 11560 this._genToDartException(ex.code, node); | 11571 this._genToDartException(ex.code, node); |
| 11561 if ($notnull_bool(!$notnull_bool(ex.type.get$isVar()))) { | 11572 if (!$notnull_bool(ex.type.get$isVar())) { |
| 11562 var test = ex.instanceOf(this, (($0 = ex.type) && $0.is$lang_Type()), catc h_.get$exception().get$span(), false, true); | 11573 var test = ex.instanceOf(this, (($0 = ex.type) && $0.is$lang_Type()), catc h_.get$exception().get$span(), false, true); |
| 11563 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';')); | 11574 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';')); |
| 11564 } | 11575 } |
| 11565 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan g_Statement())); | 11576 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan g_Statement())); |
| 11566 this._popBlock(); | 11577 this._popBlock(); |
| 11567 } | 11578 } |
| 11568 else if ($notnull_bool(node.catches.length > 0)) { | 11579 else if (node.catches.length > 0) { |
| 11569 this._pushBlock(false); | 11580 this._pushBlock(false); |
| 11570 var ex = this._scope.create('\$ex', world.varType, null, false); | 11581 var ex = this._scope.create('\$ex', world.varType, null, false); |
| 11571 this._scope.rethrow = (ex && ex.is$Value()); | 11582 this._scope.rethrow = (ex && ex.is$Value()); |
| 11572 this.writer.nextBlock(('} catch (' + ex.code + ') {')); | 11583 this.writer.nextBlock(('} catch (' + ex.code + ') {')); |
| 11573 var trace = null; | 11584 var trace = null; |
| 11574 if ($notnull_bool(node.catches.some((function (c) { | 11585 if (node.catches.some((function (c) { |
| 11575 return c.trace != null; | 11586 return c.trace != null; |
| 11576 }) | 11587 }) |
| 11577 ))) { | 11588 )) { |
| 11578 trace = this._scope.create('\$trace', world.varType, null, false); | 11589 trace = this._scope.create('\$trace', world.varType, null, false); |
| 11579 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); | 11590 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); |
| 11580 world.gen.corejs.useStackTraceOf = true; | 11591 world.gen.corejs.useStackTraceOf = true; |
| 11581 } | 11592 } |
| 11582 this._genToDartException(ex.code, node); | 11593 this._genToDartException(ex.code, node); |
| 11583 var needsRethrow = true; | 11594 var needsRethrow = true; |
| 11584 for (var i = 0; | 11595 for (var i = 0; |
| 11585 $notnull_bool(i < node.catches.length); i++) { | 11596 i < node.catches.length; i++) { |
| 11586 var catch_ = node.catches.$index(i); | 11597 var catch_ = node.catches.$index(i); |
| 11587 this._pushBlock(false); | 11598 this._pushBlock(false); |
| 11588 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl aredIdentifier())); | 11599 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl aredIdentifier())); |
| 11589 if ($notnull_bool(!$notnull_bool(tmp.type.get$isVar()))) { | 11600 if (!$notnull_bool(tmp.type.get$isVar())) { |
| 11590 var test = ex.instanceOf(this, (($0 = tmp.type) && $0.is$lang_Type()), c atch_.get$exception().get$span(), true, true); | 11601 var test = ex.instanceOf(this, (($0 = tmp.type) && $0.is$lang_Type()), c atch_.get$exception().get$span(), true, true); |
| 11591 if ($notnull_bool(i == 0)) { | 11602 if (i == 0) { |
| 11592 this.writer.enterBlock(('if (' + test.code + ') {')); | 11603 this.writer.enterBlock(('if (' + test.code + ') {')); |
| 11593 } | 11604 } |
| 11594 else { | 11605 else { |
| 11595 this.writer.nextBlock(('} else if (' + test.code + ') {')); | 11606 this.writer.nextBlock(('} else if (' + test.code + ') {')); |
| 11596 } | 11607 } |
| 11597 } | 11608 } |
| 11598 else if ($notnull_bool(i > 0)) { | 11609 else if (i > 0) { |
| 11599 this.writer.nextBlock('} else {'); | 11610 this.writer.nextBlock('} else {'); |
| 11600 } | 11611 } |
| 11601 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';')); | 11612 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';')); |
| 11602 if ($notnull_bool(catch_.trace != null)) { | 11613 if (catch_.trace != null) { |
| 11603 var tmptrace = this._scope.declare(catch_.trace); | 11614 var tmptrace = this._scope.declare(catch_.trace); |
| 11604 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';')) ; | 11615 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';')) ; |
| 11605 } | 11616 } |
| 11606 this.visitStatementsInBlock((($0 = catch_.body) && $0.is$lang_Statement()) ); | 11617 this.visitStatementsInBlock((($0 = catch_.body) && $0.is$lang_Statement()) ); |
| 11607 this._popBlock(); | 11618 this._popBlock(); |
| 11608 if ($notnull_bool(tmp.type.get$isVar())) { | 11619 if ($notnull_bool(tmp.type.get$isVar())) { |
| 11609 if ($notnull_bool(i + 1 < node.catches.length)) { | 11620 if (i + 1 < node.catches.length) { |
| 11610 world.warning('Unreachable catch clause', (($0 = node.catches.$index(i + 1)) && $0.is$SourceSpan())); | 11621 world.warning('Unreachable catch clause', (($0 = node.catches.$index(i + 1)) && $0.is$SourceSpan())); |
| 11611 } | 11622 } |
| 11612 if ($notnull_bool(i > 0)) { | 11623 if (i > 0) { |
| 11613 this.writer.exitBlock('}'); | 11624 this.writer.exitBlock('}'); |
| 11614 } | 11625 } |
| 11615 needsRethrow = false; | 11626 needsRethrow = false; |
| 11616 break; | 11627 break; |
| 11617 } | 11628 } |
| 11618 } | 11629 } |
| 11619 if ($notnull_bool(needsRethrow)) { | 11630 if ($notnull_bool(needsRethrow)) { |
| 11620 this.writer.nextBlock('} else {'); | 11631 this.writer.nextBlock('} else {'); |
| 11621 this.writer.writeln(('throw ' + ex.code + ';')); | 11632 this.writer.writeln(('throw ' + ex.code + ';')); |
| 11622 this.writer.exitBlock('}'); | 11633 this.writer.exitBlock('}'); |
| 11623 } | 11634 } |
| 11624 this._popBlock(); | 11635 this._popBlock(); |
| 11625 } | 11636 } |
| 11626 if ($notnull_bool(node.finallyBlock != null)) { | 11637 if (node.finallyBlock != null) { |
| 11627 this.writer.nextBlock('} finally {'); | 11638 this.writer.nextBlock('} finally {'); |
| 11628 this._pushBlock(false); | 11639 this._pushBlock(false); |
| 11629 this.visitStatementsInBlock(node.finallyBlock); | 11640 this.visitStatementsInBlock(node.finallyBlock); |
| 11630 this._popBlock(); | 11641 this._popBlock(); |
| 11631 } | 11642 } |
| 11632 this.writer.exitBlock('}'); | 11643 this.writer.exitBlock('}'); |
| 11633 return false; | 11644 return false; |
| 11634 } | 11645 } |
| 11635 MethodGenerator.prototype.visitSwitchStatement = function(node) { | 11646 MethodGenerator.prototype.visitSwitchStatement = function(node) { |
| 11636 var test = this.visitValue(node.test); | 11647 var test = this.visitValue(node.test); |
| 11637 this.writer.enterBlock(('switch (' + test.code + ') {')); | 11648 this.writer.enterBlock(('switch (' + test.code + ') {')); |
| 11638 var $list = node.cases; | 11649 var $list = node.cases; |
| 11639 for (var $i = 0;$i < $list.length; $i++) { | 11650 for (var $i = 0;$i < $list.length; $i++) { |
| 11640 var case_ = $list.$index($i); | 11651 var case_ = $list.$index($i); |
| 11641 if ($notnull_bool(case_.label != null)) { | 11652 if (case_.label != null) { |
| 11642 world.error('unimplemented: labeled case statement', case_.get$span()); | 11653 world.error('unimplemented: labeled case statement', case_.get$span()); |
| 11643 } | 11654 } |
| 11644 this._pushBlock(false); | 11655 this._pushBlock(false); |
| 11645 for (var i = 0; | 11656 for (var i = 0; |
| 11646 $notnull_bool(i < case_.cases.length); i++) { | 11657 i < case_.cases.length; i++) { |
| 11647 var expr = case_.cases.$index(i); | 11658 var expr = case_.cases.$index(i); |
| 11648 if ($notnull_bool(expr == null)) { | 11659 if ($notnull_bool(expr == null)) { |
| 11649 if ($notnull_bool(i < case_.cases.length - 1)) { | 11660 if (i < case_.cases.length - 1) { |
| 11650 world.error('default clause must be the last case', case_.get$span()); | 11661 world.error('default clause must be the last case', case_.get$span()); |
| 11651 } | 11662 } |
| 11652 this.writer.writeln('default:'); | 11663 this.writer.writeln('default:'); |
| 11653 } | 11664 } |
| 11654 else { | 11665 else { |
| 11655 var value = this.visitValue((expr && expr.is$lang_Expression())); | 11666 var value = this.visitValue((expr && expr.is$lang_Expression())); |
| 11656 this.writer.writeln(('case ' + value.code + ':')); | 11667 this.writer.writeln(('case ' + value.code + ':')); |
| 11657 } | 11668 } |
| 11658 } | 11669 } |
| 11659 this.writer.enterBlock(''); | 11670 this.writer.enterBlock(''); |
| 11660 var caseExits = this._visitAllStatements(case_.statements, false); | 11671 var caseExits = this._visitAllStatements(case_.statements, false); |
| 11661 if ($notnull_bool($ne(case_, node.cases.$index(node.cases.length - 1)) && !$ notnull_bool(caseExits))) { | 11672 if ($notnull_bool($ne(case_, node.cases.$index(node.cases.length - 1)) && !$ notnull_bool(caseExits))) { |
| 11662 var span = case_.statements.$index(case_.statements.length - 1).get$span() ; | 11673 var span = case_.statements.$index(case_.statements.length - 1).get$span() ; |
| 11663 this.writer.writeln('\$throw(new FallThroughError());'); | 11674 this.writer.writeln('\$throw(new FallThroughError());'); |
| 11664 world.gen.corejs.useThrow = true; | 11675 world.gen.corejs.useThrow = true; |
| 11665 } | 11676 } |
| 11666 this.writer.exitBlock(''); | 11677 this.writer.exitBlock(''); |
| 11667 this._popBlock(); | 11678 this._popBlock(); |
| 11668 } | 11679 } |
| 11669 this.writer.exitBlock('}'); | 11680 this.writer.exitBlock('}'); |
| 11670 return false; | 11681 return false; |
| 11671 } | 11682 } |
| 11672 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { | 11683 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { |
| 11673 for (var i = 0; | 11684 for (var i = 0; |
| 11674 $notnull_bool(i < statementList.length); i++) { | 11685 i < statementList.length; i++) { |
| 11675 var stmt = statementList.$index(i); | 11686 var stmt = statementList.$index(i); |
| 11676 exits = stmt.visit(this); | 11687 exits = stmt.visit(this); |
| 11677 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1)) && exits)) { | 11688 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1)) && exits)) { |
| 11678 world.warning('unreachable code', statementList.$index(i + 1).get$span()); | 11689 world.warning('unreachable code', statementList.$index(i + 1).get$span()); |
| 11679 } | 11690 } |
| 11680 } | 11691 } |
| 11681 return $assert_bool(exits); | 11692 return $assert_bool(exits); |
| 11682 } | 11693 } |
| 11683 MethodGenerator.prototype.visitBlockStatement = function(node) { | 11694 MethodGenerator.prototype.visitBlockStatement = function(node) { |
| 11684 this._pushBlock(false); | 11695 this._pushBlock(false); |
| 11685 this.writer.enterBlock('{'); | 11696 this.writer.enterBlock('{'); |
| 11686 var exits = this._visitAllStatements(node.body, false); | 11697 var exits = this._visitAllStatements(node.body, false); |
| 11687 this.writer.exitBlock('}'); | 11698 this.writer.exitBlock('}'); |
| 11688 this._popBlock(); | 11699 this._popBlock(); |
| 11689 return $assert_bool(exits); | 11700 return $assert_bool(exits); |
| 11690 } | 11701 } |
| 11691 MethodGenerator.prototype.visitLabeledStatement = function(node) { | 11702 MethodGenerator.prototype.visitLabeledStatement = function(node) { |
| 11692 this.writer.writeln(('' + node.name.name + ':')); | 11703 this.writer.writeln(('' + node.name.name + ':')); |
| 11693 node.body.visit(this); | 11704 node.body.visit(this); |
| 11694 return false; | 11705 return false; |
| 11695 } | 11706 } |
| 11696 MethodGenerator.prototype.visitExpressionStatement = function(node) { | 11707 MethodGenerator.prototype.visitExpressionStatement = function(node) { |
| 11697 if ($notnull_bool((node.body instanceof VarExpression) || (node.body instanceo f ThisExpression))) { | 11708 if ((node.body instanceof VarExpression) || (node.body instanceof ThisExpressi on)) { |
| 11698 world.warning('variable used as statement', node.span); | 11709 world.warning('variable used as statement', node.span); |
| 11699 } | 11710 } |
| 11700 var value = this.visitVoid(node.body); | 11711 var value = this.visitVoid(node.body); |
| 11701 this.writer.writeln(('' + value.code + ';')); | 11712 this.writer.writeln(('' + value.code + ';')); |
| 11702 return false; | 11713 return false; |
| 11703 } | 11714 } |
| 11704 MethodGenerator.prototype.visitEmptyStatement = function(node) { | 11715 MethodGenerator.prototype.visitEmptyStatement = function(node) { |
| 11705 this.writer.writeln(';'); | 11716 this.writer.writeln(';'); |
| 11706 return false; | 11717 return false; |
| 11707 } | 11718 } |
| 11708 MethodGenerator.prototype._checkNonStatic = function(node) { | 11719 MethodGenerator.prototype._checkNonStatic = function(node) { |
| 11709 if ($notnull_bool(this.get$isStatic())) { | 11720 if ($notnull_bool(this.get$isStatic())) { |
| 11710 world.warning('not allowed in static method', node.span); | 11721 world.warning('not allowed in static method', node.span); |
| 11711 } | 11722 } |
| 11712 } | 11723 } |
| 11713 MethodGenerator.prototype._makeSuperValue = function(node) { | 11724 MethodGenerator.prototype._makeSuperValue = function(node) { |
| 11714 var parentType = this.method.declaringType.get$parent(); | 11725 var parentType = this.method.declaringType.get$parent(); |
| 11715 this._checkNonStatic(node); | 11726 this._checkNonStatic(node); |
| 11716 if ($notnull_bool(parentType == null)) { | 11727 if ($notnull_bool(parentType == null)) { |
| 11717 world.error('no super class', node.span); | 11728 world.error('no super class', node.span); |
| 11718 } | 11729 } |
| 11719 var ret = new Value(parentType, 'this', node.span, false); | 11730 var ret = new Value(parentType, 'this', node.span, false); |
| 11720 ret.isSuper = true; | 11731 ret.isSuper = true; |
| 11721 return ret; | 11732 return ret; |
| 11722 } | 11733 } |
| 11723 MethodGenerator.prototype._getOutermostMethod = function() { | 11734 MethodGenerator.prototype._getOutermostMethod = function() { |
| 11724 var result = this; | 11735 var result = this; |
| 11725 while ($notnull_bool(result.enclosingMethod != null)) { | 11736 while (result.enclosingMethod != null) { |
| 11726 result = result.enclosingMethod; | 11737 result = result.enclosingMethod; |
| 11727 } | 11738 } |
| 11728 return result; | 11739 return result; |
| 11729 } | 11740 } |
| 11730 MethodGenerator.prototype._makeThisCode = function() { | 11741 MethodGenerator.prototype._makeThisCode = function() { |
| 11731 if ($notnull_bool(this.enclosingMethod != null)) { | 11742 if (this.enclosingMethod != null) { |
| 11732 this._getOutermostMethod().needsThis = true; | 11743 this._getOutermostMethod().needsThis = true; |
| 11733 return '\$this'; | 11744 return '\$this'; |
| 11734 } | 11745 } |
| 11735 else { | 11746 else { |
| 11736 return 'this'; | 11747 return 'this'; |
| 11737 } | 11748 } |
| 11738 } | 11749 } |
| 11739 MethodGenerator.prototype._makeThisValue = function(node) { | 11750 MethodGenerator.prototype._makeThisValue = function(node) { |
| 11740 if ($notnull_bool(this.enclosingMethod != null)) { | 11751 if (this.enclosingMethod != null) { |
| 11741 var outermostMethod = this._getOutermostMethod(); | 11752 var outermostMethod = this._getOutermostMethod(); |
| 11742 outermostMethod._checkNonStatic(node); | 11753 outermostMethod._checkNonStatic(node); |
| 11743 outermostMethod.needsThis = true; | 11754 outermostMethod.needsThis = true; |
| 11744 return new Value(outermostMethod.method.declaringType, '\$this', $notnull_bo ol(node != null) ? node.span : null, false); | 11755 return new Value(outermostMethod.method.declaringType, '\$this', node != nul l ? node.span : null, false); |
| 11745 } | 11756 } |
| 11746 else { | 11757 else { |
| 11747 this._checkNonStatic(node); | 11758 this._checkNonStatic(node); |
| 11748 return new Value(this.method.declaringType, 'this', $notnull_bool(node != nu ll) ? node.span : null, false); | 11759 return new Value(this.method.declaringType, 'this', node != null ? node.span : null, false); |
| 11749 } | 11760 } |
| 11750 } | 11761 } |
| 11751 MethodGenerator.prototype.visitLambdaExpression = function(node) { | 11762 MethodGenerator.prototype.visitLambdaExpression = function(node) { |
| 11752 var name = ''; | 11763 var name = ''; |
| 11753 if ($notnull_bool(node.func.name != null)) { | 11764 if (node.func.name != null) { |
| 11754 name = world.toJsIdentifier(node.func.name.name); | 11765 name = world.toJsIdentifier(node.func.name.name); |
| 11755 } | 11766 } |
| 11756 var meth = this._makeLambdaMethod($assert_String(name), node.func); | 11767 var meth = this._makeLambdaMethod($assert_String(name), node.func); |
| 11757 var w = new CodeWriter(); | 11768 var w = new CodeWriter(); |
| 11758 meth.generator.writeDefinition((w && w.is$CodeWriter()), node); | 11769 meth.generator.writeDefinition((w && w.is$CodeWriter()), node); |
| 11759 return new Value(meth.get$functionType(), w.get$text(), node.span, true); | 11770 return new Value(meth.get$functionType(), w.get$text(), node.span, true); |
| 11760 } | 11771 } |
| 11761 MethodGenerator.prototype.visitCallExpression = function(node) { | 11772 MethodGenerator.prototype.visitCallExpression = function(node) { |
| 11762 var $0; | 11773 var $0; |
| 11763 var target; | 11774 var target; |
| 11764 var position = node.target; | 11775 var position = node.target; |
| 11765 var name = '\$call'; | 11776 var name = '\$call'; |
| 11766 if ($notnull_bool((node.target instanceof DotExpression))) { | 11777 if ((node.target instanceof DotExpression)) { |
| 11767 var dot = (($0 = node.target) && $0.is$DotExpression()); | 11778 var dot = (($0 = node.target) && $0.is$DotExpression()); |
| 11768 target = dot.self.visit(this); | 11779 target = dot.self.visit(this); |
| 11769 name = dot.name.name; | 11780 name = dot.name.name; |
| 11770 position = dot.name; | 11781 position = dot.name; |
| 11771 } | 11782 } |
| 11772 else if ($notnull_bool((node.target instanceof VarExpression))) { | 11783 else if ((node.target instanceof VarExpression)) { |
| 11773 var varExpr = (($0 = node.target) && $0.is$VarExpression()); | 11784 var varExpr = (($0 = node.target) && $0.is$VarExpression()); |
| 11774 name = varExpr.name.name; | 11785 name = varExpr.name.name; |
| 11775 target = this._scope.lookup($assert_String(name)); | 11786 target = this._scope.lookup($assert_String(name)); |
| 11776 if ($notnull_bool($ne(target, null))) { | 11787 if ($notnull_bool($ne(target, null))) { |
| 11777 return target.invoke$4(this, '\$call', node, this._makeArgs(node.arguments )); | 11788 return target.invoke$4(this, '\$call', node, this._makeArgs(node.arguments )); |
| 11778 } | 11789 } |
| 11779 target = this._makeThisOrType(varExpr.span); | 11790 target = this._makeThisOrType(varExpr.span); |
| 11780 return target.invoke$4(this, name, node, this._makeArgs(node.arguments)); | 11791 return target.invoke$4(this, name, node, this._makeArgs(node.arguments)); |
| 11781 } | 11792 } |
| 11782 else { | 11793 else { |
| 11783 target = node.target.visit(this); | 11794 target = node.target.visit(this); |
| 11784 } | 11795 } |
| 11785 return target.invoke$4(this, name, position, this._makeArgs(node.arguments)); | 11796 return target.invoke$4(this, name, position, this._makeArgs(node.arguments)); |
| 11786 } | 11797 } |
| 11787 MethodGenerator.prototype.visitIndexExpression = function(node) { | 11798 MethodGenerator.prototype.visitIndexExpression = function(node) { |
| 11788 var target = this.visitValue(node.target); | 11799 var target = this.visitValue(node.target); |
| 11789 var index = this.visitValue(node.index); | 11800 var index = this.visitValue(node.index); |
| 11790 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); | 11801 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); |
| 11791 } | 11802 } |
| 11792 MethodGenerator.prototype.visitBinaryExpression = function(node) { | 11803 MethodGenerator.prototype.visitBinaryExpression = function(node) { |
| 11793 var $0; | 11804 var $0; |
| 11794 var kind = node.op.kind; | 11805 var kind = node.op.kind; |
| 11795 if ($notnull_bool(kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/)) { | 11806 if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) { |
| 11796 var x = this.visitValue(node.x); | 11807 var x = this.visitValue(node.x); |
| 11797 var y = this.visitValue(node.y); | 11808 var y = this.visitValue(node.y); |
| 11798 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); | 11809 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); |
| 11799 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { | 11810 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { |
| 11800 var value = $notnull_bool((kind == 35/*TokenKind.AND*/)) ? $notnull_bool(x .get$actualValue() && y.get$actualValue()) : $notnull_bool(x.get$actualValue() | | y.get$actualValue()); | 11811 var value = (kind == 35/*TokenKind.AND*/) ? $notnull_bool(x.get$actualValu e() && y.get$actualValue()) : $notnull_bool(x.get$actualValue() || y.get$actualV alue()); |
| 11801 return EvaluatedValue.EvaluatedValue$factory((($0 = x.type) && $0.is$lang_ Type()), value, ('' + value + ''), node.span); | 11812 return EvaluatedValue.EvaluatedValue$factory((($0 = x.type) && $0.is$lang_ Type()), value, ('' + value + ''), node.span); |
| 11802 } | 11813 } |
| 11803 var ret = new Value(lang_Type.union((($0 = x.type) && $0.is$lang_Type()), (( $0 = y.type) && $0.is$lang_Type())), code, node.span, true); | 11814 var ret = new Value(lang_Type.union((($0 = x.type) && $0.is$lang_Type()), (( $0 = y.type) && $0.is$lang_Type())), code, node.span, true); |
| 11804 return ret.convertToNonNullBool(this, node); | 11815 return ret.convertTo(this, world.nonNullBool, node, false); |
| 11805 } | 11816 } |
| 11806 else if ($notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenK ind.NE_STRICT*/)) { | 11817 else if (kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenKind.NE_STRICT* /) { |
| 11807 var x = this.visitValue(node.x); | 11818 var x = this.visitValue(node.x); |
| 11808 var y = this.visitValue(node.y); | 11819 var y = this.visitValue(node.y); |
| 11809 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { | 11820 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { |
| 11810 var value = $notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/) ? $eq(x.get$a ctualValue(), y.get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue( )); | 11821 var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(x.get$actualValue(), y .get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue()); |
| 11811 return EvaluatedValue.EvaluatedValue$factory(world.boolType, value, ("" + value + ""), node.span); | 11822 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, value, ("" + value + ""), node.span); |
| 11812 } | 11823 } |
| 11813 if ($notnull_bool(x.code == 'null' || y.code == 'null')) { | 11824 if (x.code == 'null' || y.code == 'null') { |
| 11814 var op = node.op.toString().substring(0, 2); | 11825 var op = node.op.toString().substring(0, 2); |
| 11815 return new Value(world.boolType, ('' + x.code + ' ' + op + ' ' + y.code + ''), node.span, true); | 11826 return new Value(world.nonNullBool, ('' + x.code + ' ' + op + ' ' + y.code + ''), node.span, true); |
| 11816 } | 11827 } |
| 11817 else { | 11828 else { |
| 11818 return new Value(world.boolType, ('' + x.code + ' ' + node.op + ' ' + y.co de + ''), node.span, true); | 11829 return new Value(world.nonNullBool, ('' + x.code + ' ' + node.op + ' ' + y .code + ''), node.span, true); |
| 11819 } | 11830 } |
| 11820 } | 11831 } |
| 11821 var assignKind = TokenKind.kindFromAssign(node.op.kind); | 11832 var assignKind = TokenKind.kindFromAssign(node.op.kind); |
| 11822 if ($notnull_bool(assignKind == -1)) { | 11833 if (assignKind == -1) { |
| 11823 var x = this.visitValue(node.x); | 11834 var x = this.visitValue(node.x); |
| 11824 var y = this.visitValue(node.y); | 11835 var y = this.visitValue(node.y); |
| 11825 var name = TokenKind.binaryMethodName(node.op.kind); | 11836 var name = TokenKind.binaryMethodName(node.op.kind); |
| 11826 if ($notnull_bool(node.op.kind == 49/*TokenKind.NE*/)) { | 11837 if (node.op.kind == 49/*TokenKind.NE*/) { |
| 11827 name = '\$ne'; | 11838 name = '\$ne'; |
| 11828 } | 11839 } |
| 11829 if ($notnull_bool(name == null)) { | 11840 if ($notnull_bool(name == null)) { |
| 11830 world.internalError(('unimplemented binary op ' + node.op + ''), node.span ); | 11841 world.internalError(('unimplemented binary op ' + node.op + ''), node.span ); |
| 11831 return; | 11842 return; |
| 11832 } | 11843 } |
| 11833 return x.invoke$4(this, name, node, new Arguments(null, [y])); | 11844 return x.invoke$4(this, name, node, new Arguments(null, [y])); |
| 11834 } | 11845 } |
| 11835 else { | 11846 else { |
| 11836 return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null)); | 11847 return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null)); |
| 11837 } | 11848 } |
| 11838 } | 11849 } |
| 11839 MethodGenerator.prototype._visitAssign = function(kind, xn, yn, position, captur eOriginal) { | 11850 MethodGenerator.prototype._visitAssign = function(kind, xn, yn, position, captur eOriginal) { |
| 11840 if ($notnull_bool(captureOriginal == null)) { | 11851 if (captureOriginal == null) { |
| 11841 captureOriginal = (function (x) { | 11852 captureOriginal = (function (x) { |
| 11842 return x; | 11853 return x; |
| 11843 }) | 11854 }) |
| 11844 ; | 11855 ; |
| 11845 } | 11856 } |
| 11846 if ($notnull_bool((xn instanceof VarExpression))) { | 11857 if ((xn instanceof VarExpression)) { |
| 11847 return this._visitVarAssign(kind, (xn && xn.is$VarExpression()), yn, positio n, captureOriginal); | 11858 return this._visitVarAssign(kind, (xn && xn.is$VarExpression()), yn, positio n, captureOriginal); |
| 11848 } | 11859 } |
| 11849 else if ($notnull_bool((xn instanceof IndexExpression))) { | 11860 else if ((xn instanceof IndexExpression)) { |
| 11850 return this._visitIndexAssign(kind, (xn && xn.is$IndexExpression()), yn, pos ition, captureOriginal); | 11861 return this._visitIndexAssign(kind, (xn && xn.is$IndexExpression()), yn, pos ition, captureOriginal); |
| 11851 } | 11862 } |
| 11852 else if ($notnull_bool((xn instanceof DotExpression))) { | 11863 else if ((xn instanceof DotExpression)) { |
| 11853 return this._visitDotAssign(kind, (xn && xn.is$DotExpression()), yn, positio n, captureOriginal); | 11864 return this._visitDotAssign(kind, (xn && xn.is$DotExpression()), yn, positio n, captureOriginal); |
| 11854 } | 11865 } |
| 11855 else { | 11866 else { |
| 11856 world.error('illegal lhs', position.span); | 11867 world.error('illegal lhs', position.span); |
| 11857 } | 11868 } |
| 11858 } | 11869 } |
| 11859 MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap tureOriginal) { | 11870 MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap tureOriginal) { |
| 11860 var $0; | 11871 var $0; |
| 11861 var name = xn.name.name; | 11872 var name = xn.name.name; |
| 11862 var x = this._scope.lookup(name); | 11873 var x = this._scope.lookup(name); |
| 11863 var y = this.visitValue(yn); | 11874 var y = this.visitValue(yn); |
| 11864 if ($notnull_bool(x == null)) { | 11875 if ($notnull_bool(x == null)) { |
| 11865 var members = this.method.declaringType.resolveMember(name); | 11876 var members = this.method.declaringType.resolveMember(name); |
| 11866 if ($notnull_bool($ne(members, null))) { | 11877 if ($notnull_bool($ne(members, null))) { |
| 11867 x = this._makeThisOrType(position.span); | 11878 x = this._makeThisOrType(position.span); |
| 11868 if ($notnull_bool(kind == 0)) { | 11879 if (kind == 0) { |
| 11869 return x.set_(this, name, position, (y && y.is$Value()), false); | 11880 return x.set_(this, name, position, (y && y.is$Value()), false); |
| 11870 } | 11881 } |
| 11871 else if ($notnull_bool(!$notnull_bool(members.get$treatAsField()) || membe rs.get$containsMethods())) { | 11882 else if ($notnull_bool(!$notnull_bool(members.get$treatAsField()) || membe rs.get$containsMethods())) { |
| 11872 var right = x.get_(this, name, position); | 11883 var right = x.get_(this, name, position); |
| 11873 right = captureOriginal((right && right.is$Value())); | 11884 right = captureOriginal((right && right.is$Value())); |
| 11874 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arguments(null, [y])); | 11885 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arguments(null, [y])); |
| 11875 return x.set_(this, name, position, (y && y.is$Value()), false); | 11886 return x.set_(this, name, position, (y && y.is$Value()), false); |
| 11876 } | 11887 } |
| 11877 else { | 11888 else { |
| 11878 x = x.get_(this, name, position); | 11889 x = x.get_(this, name, position); |
| 11879 } | 11890 } |
| 11880 } | 11891 } |
| 11881 else { | 11892 else { |
| 11882 var member = this.get$library().lookup(name, xn.name.span); | 11893 var member = this.get$library().lookup(name, xn.name.span); |
| 11883 if ($notnull_bool(member == null)) { | 11894 if (member == null) { |
| 11884 world.warning(('can not resolve ' + name + ''), xn.span); | 11895 world.warning(('can not resolve ' + name + ''), xn.span); |
| 11885 return this._makeMissingValue(name); | 11896 return this._makeMissingValue(name); |
| 11886 } | 11897 } |
| 11887 members = new MemberSet(member); | 11898 members = new MemberSet(member); |
| 11888 if ($notnull_bool(!$notnull_bool(members.get$treatAsField()) || members.ge t$containsMethods())) { | 11899 if ($notnull_bool(!$notnull_bool(members.get$treatAsField()) || members.ge t$containsMethods())) { |
| 11889 if ($notnull_bool(kind != 0)) { | 11900 if (kind != 0) { |
| 11890 var right = members._get$3(this, position, x); | 11901 var right = members._get$3(this, position, x); |
| 11891 right = captureOriginal((right && right.is$Value())); | 11902 right = captureOriginal((right && right.is$Value())); |
| 11892 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, n ew Arguments(null, [y])); | 11903 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, n ew Arguments(null, [y])); |
| 11893 } | 11904 } |
| 11894 return members._set$4(this, position, x, y); | 11905 return members._set$4(this, position, x, y); |
| 11895 } | 11906 } |
| 11896 else { | 11907 else { |
| 11897 x = members._get$3(this, position, x); | 11908 x = members._get$3(this, position, x); |
| 11898 } | 11909 } |
| 11899 } | 11910 } |
| 11900 } | 11911 } |
| 11901 y = y.convertTo(this, (($0 = x.type) && $0.is$lang_Type()), yn, false); | 11912 y = y.convertTo(this, (($0 = x.type) && $0.is$lang_Type()), yn, false); |
| 11902 if ($notnull_bool(kind == 0)) { | 11913 if (kind == 0) { |
| 11903 x = captureOriginal((x && x.is$Value())); | 11914 x = captureOriginal((x && x.is$Value())); |
| 11904 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, true); | 11915 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, true); |
| 11905 } | 11916 } |
| 11906 else if ($notnull_bool(x.type.get$isNum() && y.type.get$isNum()) && (kind != 4 6/*TokenKind.TRUNCDIV*/)) { | 11917 else if ($notnull_bool(x.type.get$isNum() && y.type.get$isNum()) && (kind != 4 6/*TokenKind.TRUNCDIV*/)) { |
| 11907 x = captureOriginal((x && x.is$Value())); | 11918 x = captureOriginal((x && x.is$Value())); |
| 11908 var op = TokenKind.kindToString(kind); | 11919 var op = TokenKind.kindToString(kind); |
| 11909 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), posi tion.span, true); | 11920 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), posi tion.span, true); |
| 11910 } | 11921 } |
| 11911 else { | 11922 else { |
| 11912 var right = x; | 11923 var right = x; |
| 11913 right = captureOriginal((right && right.is$Value())); | 11924 right = captureOriginal((right && right.is$Value())); |
| 11914 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); | 11925 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); |
| 11915 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, true); | 11926 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, true); |
| 11916 } | 11927 } |
| 11917 } | 11928 } |
| 11918 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c aptureOriginal) { | 11929 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c aptureOriginal) { |
| 11919 var target = this.visitValue(xn.target); | 11930 var target = this.visitValue(xn.target); |
| 11920 var index = this.visitValue(xn.index); | 11931 var index = this.visitValue(xn.index); |
| 11921 var y = this.visitValue(yn); | 11932 var y = this.visitValue(yn); |
| 11922 var tmptarget = target; | 11933 var tmptarget = target; |
| 11923 var tmpindex = index; | 11934 var tmpindex = index; |
| 11924 if ($notnull_bool(kind != 0)) { | 11935 if (kind != 0) { |
| 11925 tmptarget = this.getTemp((target && target.is$Value())); | 11936 tmptarget = this.getTemp((target && target.is$Value())); |
| 11926 tmpindex = this.getTemp((index && index.is$Value())); | 11937 tmpindex = this.getTemp((index && index.is$Value())); |
| 11927 index = this.assignTemp((tmpindex && tmpindex.is$Value()), (index && index.i s$Value())); | 11938 index = this.assignTemp((tmpindex && tmpindex.is$Value()), (index && index.i s$Value())); |
| 11928 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null , [tmpindex])); | 11939 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null , [tmpindex])); |
| 11929 right = captureOriginal((right && right.is$Value())); | 11940 right = captureOriginal((right && right.is$Value())); |
| 11930 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); | 11941 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); |
| 11931 } | 11942 } |
| 11932 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ et.is$Value())).invoke(this, '\$setindex', position, new Arguments(null, [index, y]), false); | 11943 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ et.is$Value())).invoke(this, '\$setindex', position, new Arguments(null, [index, y]), false); |
| 11933 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg et.is$Value())); | 11944 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg et.is$Value())); |
| 11934 if ($notnull_bool($ne(tmpindex, index))) this.freeTemp((tmpindex && tmpindex.i s$Value())); | 11945 if ($notnull_bool($ne(tmpindex, index))) this.freeTemp((tmpindex && tmpindex.i s$Value())); |
| 11935 return ret; | 11946 return ret; |
| 11936 } | 11947 } |
| 11937 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap tureOriginal) { | 11948 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap tureOriginal) { |
| 11938 var target = xn.self.visit(this); | 11949 var target = xn.self.visit(this); |
| 11939 var y = this.visitValue(yn); | 11950 var y = this.visitValue(yn); |
| 11940 var tmptarget = target; | 11951 var tmptarget = target; |
| 11941 if ($notnull_bool(kind != 0)) { | 11952 if (kind != 0) { |
| 11942 tmptarget = this.getTemp((target && target.is$Value())); | 11953 tmptarget = this.getTemp((target && target.is$Value())); |
| 11943 var right = tmptarget.get_(this, xn.name.name, xn.name); | 11954 var right = tmptarget.get_(this, xn.name.name, xn.name); |
| 11944 right = captureOriginal((right && right.is$Value())); | 11955 right = captureOriginal((right && right.is$Value())); |
| 11945 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); | 11956 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); |
| 11946 } | 11957 } |
| 11947 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ et.is$Value())).set_(this, xn.name.name, xn.name, (y && y.is$Value()), false); | 11958 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ et.is$Value())).set_(this, xn.name.name, xn.name, (y && y.is$Value()), false); |
| 11948 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg et.is$Value())); | 11959 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg et.is$Value())); |
| 11949 return ret; | 11960 return ret; |
| 11950 } | 11961 } |
| 11951 MethodGenerator.prototype.visitUnaryExpression = function(node) { | 11962 MethodGenerator.prototype.visitUnaryExpression = function(node) { |
| 11952 var $0; | 11963 var $0; |
| 11953 var value = this.visitValue(node.self); | 11964 var value = this.visitValue(node.self); |
| 11954 switch (node.op.kind) { | 11965 switch (node.op.kind) { |
| 11955 case 16/*TokenKind.INCR*/: | 11966 case 16/*TokenKind.INCR*/: |
| 11956 case 17/*TokenKind.DECR*/: | 11967 case 17/*TokenKind.DECR*/: |
| 11957 | 11968 |
| 11958 if ($notnull_bool(value.type.get$isNum())) { | 11969 if ($notnull_bool(value.type.get$isNum())) { |
| 11959 return new Value(value.type, ('' + node.op + '' + value.code + ''), node .span, true); | 11970 return new Value(value.type, ('' + node.op + '' + value.code + ''), node .span, true); |
| 11960 } | 11971 } |
| 11961 else { | 11972 else { |
| 11962 var kind = ($notnull_bool(16/*TokenKind.INCR*/ == node.op.kind) ? 42/*To kenKind.ADD*/ : 43/*TokenKind.SUB*/); | 11973 var kind = (16/*TokenKind.INCR*/ == node.op.kind ? 42/*TokenKind.ADD*/ : 43/*TokenKind.SUB*/); |
| 11963 var operand = new LiteralExpression(1, new TypeReference(node.span, worl d.numType), '1', node.span); | 11974 var operand = new LiteralExpression(1, new TypeReference(node.span, worl d.numType), '1', node.span); |
| 11964 return this._visitAssign($assert_num(kind), node.self, (operand && opera nd.is$lang_Expression()), node, to$call$1(null)); | 11975 return this._visitAssign($assert_num(kind), node.self, (operand && opera nd.is$lang_Expression()), node, to$call$1(null)); |
| 11965 } | 11976 } |
| 11966 | 11977 |
| 11967 case 19/*TokenKind.NOT*/: | 11978 case 19/*TokenKind.NOT*/: |
| 11968 | 11979 |
| 11969 if ($notnull_bool(value.type.get$isBool() && value.get$isConst())) { | 11980 if ($notnull_bool(value.type.get$isBool() && value.get$isConst())) { |
| 11970 var newVal = !$notnull_bool(value.get$actualValue()); | 11981 var newVal = !$notnull_bool(value.get$actualValue()); |
| 11971 return EvaluatedValue.EvaluatedValue$factory((($0 = value.type) && $0.is $lang_Type()), newVal, ('' + newVal + ''), node.span); | 11982 return EvaluatedValue.EvaluatedValue$factory((($0 = value.type) && $0.is $lang_Type()), newVal, ('' + newVal + ''), node.span); |
| 11972 } | 11983 } |
| 11973 else { | 11984 else { |
| 11974 var newVal = value.convertToNonNullBool(this, node); | 11985 var newVal = value.convertTo(this, world.nonNullBool, node, false); |
| 11975 return new Value(world.boolType, ('!' + newVal.code + ''), node.span, tr ue); | 11986 return new Value(newVal.type, ('!' + newVal.code + ''), node.span, true) ; |
| 11976 } | 11987 } |
| 11977 | 11988 |
| 11978 case 42/*TokenKind.ADD*/: | 11989 case 42/*TokenKind.ADD*/: |
| 11979 | 11990 |
| 11980 return value.convertTo(this, world.numType, node, false); | 11991 return value.convertTo(this, world.numType, node, false); |
| 11981 | 11992 |
| 11982 case 43/*TokenKind.SUB*/: | 11993 case 43/*TokenKind.SUB*/: |
| 11983 case 18/*TokenKind.BIT_NOT*/: | 11994 case 18/*TokenKind.BIT_NOT*/: |
| 11984 | 11995 |
| 11985 if ($notnull_bool(node.op.kind == 18/*TokenKind.BIT_NOT*/)) { | 11996 if (node.op.kind == 18/*TokenKind.BIT_NOT*/) { |
| 11986 return value.invoke$4(this, '\$bit_not', node, Arguments.get$EMPTY()); | 11997 return value.invoke$4(this, '\$bit_not', node, Arguments.get$EMPTY()); |
| 11987 } | 11998 } |
| 11988 else if ($notnull_bool(node.op.kind == 43/*TokenKind.SUB*/)) { | 11999 else if (node.op.kind == 43/*TokenKind.SUB*/) { |
| 11989 return value.invoke$4(this, '\$negate', node, Arguments.get$EMPTY()); | 12000 return value.invoke$4(this, '\$negate', node, Arguments.get$EMPTY()); |
| 11990 } | 12001 } |
| 11991 else { | 12002 else { |
| 11992 world.internalError(('unimplemented: unary ' + node.op + ''), node.span) ; | 12003 world.internalError(('unimplemented: unary ' + node.op + ''), node.span) ; |
| 11993 } | 12004 } |
| 11994 $throw(new FallThroughError()); | 12005 $throw(new FallThroughError()); |
| 11995 | 12006 |
| 11996 default: | 12007 default: |
| 11997 | 12008 |
| 11998 world.internalError(('unimplemented: ' + node.op + ''), node.span); | 12009 world.internalError(('unimplemented: ' + node.op + ''), node.span); |
| 11999 | 12010 |
| 12000 } | 12011 } |
| 12001 } | 12012 } |
| 12002 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { | 12013 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { |
| 12003 var $this = this; // closure support | 12014 var $this = this; // closure support |
| 12004 var value = this.visitValue(node.body); | 12015 var value = this.visitValue(node.body); |
| 12005 if ($notnull_bool(value.type.get$isNum())) { | 12016 if ($notnull_bool(value.type.get$isNum())) { |
| 12006 return new Value(value.type, ('' + value.code + '' + node.op + ''), node.spa n, true); | 12017 return new Value(value.type, ('' + value.code + '' + node.op + ''), node.spa n, true); |
| 12007 } | 12018 } |
| 12008 var kind = $notnull_bool((16/*TokenKind.INCR*/ == node.op.kind)) ? 42/*TokenKi nd.ADD*/ : 43/*TokenKind.SUB*/; | 12019 var kind = (16/*TokenKind.INCR*/ == node.op.kind) ? 42/*TokenKind.ADD*/ : 43/* TokenKind.SUB*/; |
| 12009 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT ype), '1', node.span); | 12020 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT ype), '1', node.span); |
| 12010 var tmpleft = null, left = null; | 12021 var tmpleft = null, left = null; |
| 12011 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand. is$lang_Expression()), node, (function (l) { | 12022 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand. is$lang_Expression()), node, (function (l) { |
| 12012 if ($notnull_bool(isVoid)) { | 12023 if ($notnull_bool(isVoid)) { |
| 12013 return l; | 12024 return l; |
| 12014 } | 12025 } |
| 12015 else { | 12026 else { |
| 12016 left = l; | 12027 left = l; |
| 12017 tmpleft = $this.forceTemp((l && l.is$Value())); | 12028 tmpleft = $this.forceTemp((l && l.is$Value())); |
| 12018 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$ Value())); | 12029 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$ Value())); |
| 12019 } | 12030 } |
| 12020 }) | 12031 }) |
| 12021 ); | 12032 ); |
| 12022 if ($notnull_bool($ne(tmpleft, null))) { | 12033 if ($notnull_bool($ne(tmpleft, null))) { |
| 12023 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), node .span, true); | 12034 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), node .span, true); |
| 12024 } | 12035 } |
| 12025 if ($notnull_bool($ne(tmpleft, left))) { | 12036 if ($notnull_bool($ne(tmpleft, left))) { |
| 12026 this.freeTemp((tmpleft && tmpleft.is$Value())); | 12037 this.freeTemp((tmpleft && tmpleft.is$Value())); |
| 12027 } | 12038 } |
| 12028 return ret; | 12039 return ret; |
| 12029 } | 12040 } |
| 12030 MethodGenerator.prototype.visitNewExpression = function(node) { | 12041 MethodGenerator.prototype.visitNewExpression = function(node) { |
| 12031 var $0; | 12042 var $0; |
| 12032 var typeRef = node.type; | 12043 var typeRef = node.type; |
| 12033 var constructorName = ''; | 12044 var constructorName = ''; |
| 12034 if ($notnull_bool(node.name != null)) { | 12045 if (node.name != null) { |
| 12035 constructorName = node.name.name; | 12046 constructorName = node.name.name; |
| 12036 } | 12047 } |
| 12037 if ($notnull_bool($eq(constructorName, '') && !(typeRef instanceof GenericType Reference)) && typeRef.names != null) { | 12048 if ($notnull_bool($eq(constructorName, '') && !(typeRef instanceof GenericType Reference)) && typeRef.names != null) { |
| 12038 var names = ListFactory.ListFactory$from$factory(typeRef.names); | 12049 var names = ListFactory.ListFactory$from$factory(typeRef.names); |
| 12039 constructorName = names.removeLast().get$name(); | 12050 constructorName = names.removeLast().get$name(); |
| 12040 if ($notnull_bool(names.length == 0)) names = null; | 12051 if (names.length == 0) names = null; |
| 12041 typeRef = new NameTypeReference(typeRef.isFinal, typeRef.get$name(), names, typeRef.get$span()); | 12052 typeRef = new NameTypeReference(typeRef.isFinal, typeRef.get$name(), names, typeRef.get$span()); |
| 12042 } | 12053 } |
| 12043 var type = this.method.resolveType(typeRef, true); | 12054 var type = this.method.resolveType(typeRef, true); |
| 12044 if ($notnull_bool(type.get$isTop())) { | 12055 if ($notnull_bool(type.get$isTop())) { |
| 12045 type = type.get$library().findTypeByName($assert_String(constructorName)); | 12056 type = type.get$library().findTypeByName($assert_String(constructorName)); |
| 12046 constructorName = ''; | 12057 constructorName = ''; |
| 12047 } | 12058 } |
| 12048 var m = type.getConstructor(constructorName); | 12059 var m = type.getConstructor(constructorName); |
| 12049 if ($notnull_bool(m == null)) { | 12060 if ($notnull_bool(m == null)) { |
| 12050 var name = type.get$jsname(); | 12061 var name = type.get$jsname(); |
| 12051 if ($notnull_bool(type.get$isVar())) { | 12062 if ($notnull_bool(type.get$isVar())) { |
| 12052 name = typeRef.get$name().get$name(); | 12063 name = typeRef.get$name().get$name(); |
| 12053 } | 12064 } |
| 12054 world.error(('no matching constructor for ' + name + ''), node.span); | 12065 world.error(('no matching constructor for ' + name + ''), node.span); |
| 12055 return this._makeMissingValue($assert_String(name)); | 12066 return this._makeMissingValue($assert_String(name)); |
| 12056 } | 12067 } |
| 12057 if ($notnull_bool(node.isConst)) { | 12068 if ($notnull_bool(node.isConst)) { |
| 12058 if ($notnull_bool(!$notnull_bool(m.get$isConst()))) { | 12069 if (!$notnull_bool(m.get$isConst())) { |
| 12059 world.error('can\'t use const on a non-const constructor', node.span); | 12070 world.error('can\'t use const on a non-const constructor', node.span); |
| 12060 } | 12071 } |
| 12061 var $list = node.arguments; | 12072 var $list = node.arguments; |
| 12062 for (var $i = 0;$i < $list.length; $i++) { | 12073 for (var $i = 0;$i < $list.length; $i++) { |
| 12063 var arg = $list.$index($i); | 12074 var arg = $list.$index($i); |
| 12064 if ($notnull_bool(!$notnull_bool(this.visitValue((($0 = arg.get$value()) & & $0.is$lang_Expression())).get$isConst()))) { | 12075 if (!$notnull_bool(this.visitValue((($0 = arg.get$value()) && $0.is$lang_E xpression())).get$isConst())) { |
| 12065 world.error('const constructor expects const arguments', arg.get$span()) ; | 12076 world.error('const constructor expects const arguments', arg.get$span()) ; |
| 12066 } | 12077 } |
| 12067 } | 12078 } |
| 12068 } | 12079 } |
| 12069 return m.invoke$4(this, node, null, this._makeArgs(node.arguments)); | 12080 return m.invoke$4(this, node, null, this._makeArgs(node.arguments)); |
| 12070 } | 12081 } |
| 12071 MethodGenerator.prototype.visitListExpression = function(node) { | 12082 MethodGenerator.prototype.visitListExpression = function(node) { |
| 12072 var argsCode = []; | 12083 var argsCode = []; |
| 12073 var argValues = []; | 12084 var argValues = []; |
| 12074 var $list = node.values; | 12085 var $list = node.values; |
| 12075 for (var $i = 0;$i < $list.length; $i++) { | 12086 for (var $i = 0;$i < $list.length; $i++) { |
| 12076 var item = $list.$index($i); | 12087 var item = $list.$index($i); |
| 12077 var arg = this.visitValue((item && item.is$lang_Expression())); | 12088 var arg = this.visitValue((item && item.is$lang_Expression())); |
| 12078 argValues.add(arg); | 12089 argValues.add(arg); |
| 12079 if ($notnull_bool(node.isConst)) { | 12090 if ($notnull_bool(node.isConst)) { |
| 12080 if ($notnull_bool(!$notnull_bool(arg.get$isConst()))) { | 12091 if (!$notnull_bool(arg.get$isConst())) { |
| 12081 world.error('const list can only contain const values', item.get$span()) ; | 12092 world.error('const list can only contain const values', item.get$span()) ; |
| 12082 argsCode.add(arg.code); | 12093 argsCode.add(arg.code); |
| 12083 } | 12094 } |
| 12084 else { | 12095 else { |
| 12085 argsCode.add(arg.get$canonicalCode()); | 12096 argsCode.add(arg.get$canonicalCode()); |
| 12086 } | 12097 } |
| 12087 } | 12098 } |
| 12088 else { | 12099 else { |
| 12089 argsCode.add(arg.code); | 12100 argsCode.add(arg.code); |
| 12090 } | 12101 } |
| 12091 } | 12102 } |
| 12092 world.get$coreimpl().types.$index('ListFactory').markUsed(); | 12103 world.get$coreimpl().types.$index('ListFactory').markUsed(); |
| 12093 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); | 12104 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); |
| 12094 var value = new Value(world.listType, code, node.span, true); | 12105 var value = new Value(world.listType, code, node.span, true); |
| 12095 if ($notnull_bool(node.isConst)) { | 12106 if ($notnull_bool(node.isConst)) { |
| 12096 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); | 12107 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); |
| 12097 var immutableListCtor = immutableList.getConstructor('from'); | 12108 var immutableListCtor = immutableList.getConstructor('from'); |
| 12098 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null , [value])); | 12109 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null , [value])); |
| 12099 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory((immu tableList && immutableList.is$lang_Type()), (argValues && argValues.is$List$Eval uatedValue()), ('const ' + code + ''), result.code, node.span), (argValues && ar gValues.is$List$Value())); | 12110 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory((immu tableList && immutableList.is$lang_Type()), (argValues && argValues.is$List$Eval uatedValue()), ('const ' + code + ''), result.code, node.span), (argValues && ar gValues.is$List$Value())); |
| 12100 } | 12111 } |
| 12101 return value; | 12112 return value; |
| 12102 } | 12113 } |
| 12103 MethodGenerator.prototype.visitMapExpression = function(node) { | 12114 MethodGenerator.prototype.visitMapExpression = function(node) { |
| 12104 var $0; | 12115 var $0; |
| 12105 var mapImplType = world.gen.useMapFactory(); | 12116 var mapImplType = world.gen.useMapFactory(); |
| 12106 var argValues = []; | 12117 var argValues = []; |
| 12107 var argsCode = []; | 12118 var argsCode = []; |
| 12108 for (var i = 0; | 12119 for (var i = 0; |
| 12109 $notnull_bool(i < node.items.length); i += 2) { | 12120 i < node.items.length; i += 2) { |
| 12110 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex pression()), world.stringType); | 12121 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex pression()), world.stringType); |
| 12111 var valueItem = node.items.$index(i + 1); | 12122 var valueItem = node.items.$index(i + 1); |
| 12112 var value = this.visitValue((valueItem && valueItem.is$lang_Expression())); | 12123 var value = this.visitValue((valueItem && valueItem.is$lang_Expression())); |
| 12113 argValues.add(key); | 12124 argValues.add(key); |
| 12114 argValues.add(value); | 12125 argValues.add(value); |
| 12115 if ($notnull_bool(node.isConst)) { | 12126 if ($notnull_bool(node.isConst)) { |
| 12116 if ($notnull_bool(!$notnull_bool(key.get$isConst()) || !$notnull_bool(valu e.get$isConst()))) { | 12127 if (!$notnull_bool(key.get$isConst()) || !$notnull_bool(value.get$isConst( ))) { |
| 12117 world.error('const map can only contain const values', valueItem.get$spa n()); | 12128 world.error('const map can only contain const values', valueItem.get$spa n()); |
| 12118 argsCode.add(key.code); | 12129 argsCode.add(key.code); |
| 12119 argsCode.add(value.code); | 12130 argsCode.add(value.code); |
| 12120 } | 12131 } |
| 12121 else { | 12132 else { |
| 12122 argsCode.add(key.get$canonicalCode()); | 12133 argsCode.add(key.get$canonicalCode()); |
| 12123 argsCode.add(value.get$canonicalCode()); | 12134 argsCode.add(value.get$canonicalCode()); |
| 12124 } | 12135 } |
| 12125 } | 12136 } |
| 12126 else { | 12137 else { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12183 } | 12194 } |
| 12184 MethodGenerator.prototype.visitSuperExpression = function(node) { | 12195 MethodGenerator.prototype.visitSuperExpression = function(node) { |
| 12185 return this._makeSuperValue(node); | 12196 return this._makeSuperValue(node); |
| 12186 } | 12197 } |
| 12187 MethodGenerator.prototype.visitNullExpression = function(node) { | 12198 MethodGenerator.prototype.visitNullExpression = function(node) { |
| 12188 return EvaluatedValue.EvaluatedValue$factory(world.varType, null, 'null', null ); | 12199 return EvaluatedValue.EvaluatedValue$factory(world.varType, null, 'null', null ); |
| 12189 } | 12200 } |
| 12190 MethodGenerator.prototype.visitLiteralExpression = function(node) { | 12201 MethodGenerator.prototype.visitLiteralExpression = function(node) { |
| 12191 var $0; | 12202 var $0; |
| 12192 var type = node.type.type; | 12203 var type = node.type.type; |
| 12193 $assert($ne(type, null), "type != null", "gen.dart", 2073, 12); | 12204 $assert($ne(type, null), "type != null", "gen.dart", 2075, 12); |
| 12194 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { | 12205 if (!!(($0 = node.value) && $0.is$List)) { |
| 12195 var items = []; | 12206 var items = []; |
| 12196 var $list = node.value; | 12207 var $list = node.value; |
| 12197 for (var $i = node.value.iterator(); $i.hasNext(); ) { | 12208 for (var $i = node.value.iterator(); $i.hasNext(); ) { |
| 12198 var item = $i.next(); | 12209 var item = $i.next(); |
| 12199 var val = this.visitValue((item && item.is$lang_Expression())); | 12210 var val = this.visitValue((item && item.is$lang_Expression())); |
| 12200 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); | 12211 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); |
| 12201 var code = val.code; | 12212 var code = val.code; |
| 12202 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C onditionalExpression))) { | 12213 if ((item instanceof BinaryExpression) || (item instanceof ConditionalExpr ession)) { |
| 12203 code = ('(' + code + ')'); | 12214 code = ('(' + code + ')'); |
| 12204 } | 12215 } |
| 12205 items.add(code); | 12216 items.add(code); |
| 12206 } | 12217 } |
| 12207 return new Value(type, ('(' + Strings.join((items && items.is$List$String()) , " + ") + ')'), node.span, true); | 12218 return new Value(type, ('(' + Strings.join((items && items.is$List$String()) , " + ") + ')'), node.span, true); |
| 12208 } | 12219 } |
| 12209 var text = node.text; | 12220 var text = node.text; |
| 12210 if ($notnull_bool(type.get$isString())) { | 12221 if ($notnull_bool(type.get$isString())) { |
| 12211 if ($notnull_bool(text.startsWith('@'))) { | 12222 if (text.startsWith('@')) { |
| 12212 text = MethodGenerator._escapeString(parseStringLiteral($assert_String(tex t))); | 12223 text = MethodGenerator._escapeString(parseStringLiteral($assert_String(tex t))); |
| 12213 text = ('"' + text + '"'); | 12224 text = ('"' + text + '"'); |
| 12214 } | 12225 } |
| 12215 else if ($notnull_bool(isMultilineString($assert_String(text)))) { | 12226 else if ($notnull_bool(isMultilineString($assert_String(text)))) { |
| 12216 text = parseStringLiteral($assert_String(text)); | 12227 text = parseStringLiteral($assert_String(text)); |
| 12217 text = text.replaceAll('\n', '\\n'); | 12228 text = text.replaceAll('\n', '\\n'); |
| 12218 text = text.replaceAll('"', '\\"'); | 12229 text = text.replaceAll('"', '\\"'); |
| 12219 text = ('"' + text + '"'); | 12230 text = ('"' + text + '"'); |
| 12220 } | 12231 } |
| 12221 if ($notnull_bool(text !== node.text)) { | 12232 if (text !== node.text) { |
| 12222 node.value = text; | 12233 node.value = text; |
| 12223 node.text = $assert_String(text); | 12234 node.text = $assert_String(text); |
| 12224 } | 12235 } |
| 12225 } | 12236 } |
| 12226 return EvaluatedValue.EvaluatedValue$factory((type && type.is$lang_Type()), no de.value, node.text, null); | 12237 return EvaluatedValue.EvaluatedValue$factory((type && type.is$lang_Type()), no de.value, node.text, null); |
| 12227 } | 12238 } |
| 12228 MethodGenerator.prototype.visitPostfixExpression$1 = function($0) { | 12239 MethodGenerator.prototype.visitPostfixExpression$1 = function($0) { |
| 12229 return this.visitPostfixExpression(($0 && $0.is$PostfixExpression()), false); | 12240 return this.visitPostfixExpression(($0 && $0.is$PostfixExpression()), false); |
| 12230 } | 12241 } |
| 12231 ; | 12242 ; |
| 12232 // ********** Code for Arguments ************** | 12243 // ********** Code for Arguments ************** |
| 12233 function Arguments(nodes, values) { | 12244 function Arguments(nodes, values) { |
| 12234 this.nodes = nodes; | 12245 this.nodes = nodes; |
| 12235 this.values = values; | 12246 this.values = values; |
| 12236 // Initializers done | 12247 // Initializers done |
| 12237 } | 12248 } |
| 12238 Arguments.prototype.is$Arguments = function(){return this;}; | 12249 Arguments.prototype.is$Arguments = function(){return this;}; |
| 12239 Arguments.Arguments$bare$factory = function(arity) { | 12250 Arguments.Arguments$bare$factory = function(arity) { |
| 12240 var values = []; | 12251 var values = []; |
| 12241 for (var i = 0; | 12252 for (var i = 0; |
| 12242 $notnull_bool(i < arity); i++) { | 12253 i < arity; i++) { |
| 12243 values.add(new Value(world.varType, ('\$' + i + ''), null, false)); | 12254 values.add(new Value(world.varType, ('\$' + i + ''), null, false)); |
| 12244 } | 12255 } |
| 12245 return new Arguments(null, values); | 12256 return new Arguments(null, values); |
| 12246 } | 12257 } |
| 12247 Arguments.get$EMPTY = function() { | 12258 Arguments.get$EMPTY = function() { |
| 12248 if ($notnull_bool(Arguments._empty == null)) { | 12259 if (Arguments._empty == null) { |
| 12249 Arguments._empty = new Arguments(null, []); | 12260 Arguments._empty = new Arguments(null, []); |
| 12250 } | 12261 } |
| 12251 return Arguments._empty; | 12262 return Arguments._empty; |
| 12252 } | 12263 } |
| 12253 Arguments.prototype.get$nameCount = function() { | 12264 Arguments.prototype.get$nameCount = function() { |
| 12254 return this.get$length() - this.get$bareCount(); | 12265 return this.get$length() - this.get$bareCount(); |
| 12255 } | 12266 } |
| 12256 Arguments.prototype.get$hasNames = function() { | 12267 Arguments.prototype.get$hasNames = function() { |
| 12257 return this.get$bareCount() < this.get$length(); | 12268 return this.get$bareCount() < this.get$length(); |
| 12258 } | 12269 } |
| 12259 Arguments.prototype.get$length = function() { | 12270 Arguments.prototype.get$length = function() { |
| 12260 return this.values.length; | 12271 return this.values.length; |
| 12261 } | 12272 } |
| 12262 Object.defineProperty(Arguments.prototype, "length", { | 12273 Object.defineProperty(Arguments.prototype, "length", { |
| 12263 get: Arguments.prototype.get$length | 12274 get: Arguments.prototype.get$length |
| 12264 }); | 12275 }); |
| 12265 Arguments.prototype.getName = function(i) { | 12276 Arguments.prototype.getName = function(i) { |
| 12266 return this.nodes.$index(i).label.name; | 12277 return this.nodes.$index(i).label.name; |
| 12267 } | 12278 } |
| 12268 Arguments.prototype.getIndexOfName = function(name) { | 12279 Arguments.prototype.getIndexOfName = function(name) { |
| 12269 for (var i = this.get$bareCount(); | 12280 for (var i = this.get$bareCount(); |
| 12270 $notnull_bool(i < this.get$length()); i++) { | 12281 i < this.get$length(); i++) { |
| 12271 if ($notnull_bool(this.getName(i) == name)) { | 12282 if (this.getName(i) == name) { |
| 12272 return i; | 12283 return i; |
| 12273 } | 12284 } |
| 12274 } | 12285 } |
| 12275 return -1; | 12286 return -1; |
| 12276 } | 12287 } |
| 12277 Arguments.prototype.getValue = function(name) { | 12288 Arguments.prototype.getValue = function(name) { |
| 12278 var $0; | 12289 var $0; |
| 12279 var i = this.getIndexOfName(name); | 12290 var i = this.getIndexOfName(name); |
| 12280 return (($0 = $notnull_bool(i >= 0) ? this.values.$index(i) : null) && $0.is$V alue()); | 12291 return (($0 = i >= 0 ? this.values.$index(i) : null) && $0.is$Value()); |
| 12281 } | 12292 } |
| 12282 Arguments.prototype.get$bareCount = function() { | 12293 Arguments.prototype.get$bareCount = function() { |
| 12283 if ($notnull_bool(this._bareCount == null)) { | 12294 if (this._bareCount == null) { |
| 12284 this._bareCount = this.get$length(); | 12295 this._bareCount = this.get$length(); |
| 12285 if ($notnull_bool(this.nodes != null)) { | 12296 if (this.nodes != null) { |
| 12286 for (var i = 0; | 12297 for (var i = 0; |
| 12287 $notnull_bool(i < this.nodes.length); i++) { | 12298 i < this.nodes.length; i++) { |
| 12288 if ($notnull_bool(this.nodes.$index(i).label != null)) { | 12299 if (this.nodes.$index(i).label != null) { |
| 12289 this._bareCount = i; | 12300 this._bareCount = i; |
| 12290 break; | 12301 break; |
| 12291 } | 12302 } |
| 12292 } | 12303 } |
| 12293 } | 12304 } |
| 12294 } | 12305 } |
| 12295 return this._bareCount; | 12306 return this._bareCount; |
| 12296 } | 12307 } |
| 12297 Arguments.prototype.getCode = function() { | 12308 Arguments.prototype.getCode = function() { |
| 12298 var argsCode = []; | 12309 var argsCode = []; |
| 12299 for (var i = 0; | 12310 for (var i = 0; |
| 12300 $notnull_bool(i < this.get$length()); i++) { | 12311 i < this.get$length(); i++) { |
| 12301 argsCode.add(this.values.$index(i).code); | 12312 argsCode.add(this.values.$index(i).code); |
| 12302 } | 12313 } |
| 12303 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); | 12314 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); |
| 12304 return Strings.join((argsCode && argsCode.is$List$String()), ", "); | 12315 return Strings.join((argsCode && argsCode.is$List$String()), ", "); |
| 12305 } | 12316 } |
| 12306 Arguments.removeTrailingNulls = function(argsCode) { | 12317 Arguments.removeTrailingNulls = function(argsCode) { |
| 12307 while ($notnull_bool(argsCode.length > 0 && $eq(argsCode.last(), 'null'))) { | 12318 while ($notnull_bool(argsCode.length > 0 && $eq(argsCode.last(), 'null'))) { |
| 12308 argsCode.removeLast(); | 12319 argsCode.removeLast(); |
| 12309 } | 12320 } |
| 12310 } | 12321 } |
| 12311 Arguments.prototype.getNames = function() { | 12322 Arguments.prototype.getNames = function() { |
| 12312 var names = []; | 12323 var names = []; |
| 12313 for (var i = this.get$bareCount(); | 12324 for (var i = this.get$bareCount(); |
| 12314 $notnull_bool(i < this.get$length()); i++) { | 12325 i < this.get$length(); i++) { |
| 12315 names.add(this.getName(i)); | 12326 names.add(this.getName(i)); |
| 12316 } | 12327 } |
| 12317 return (names && names.is$List$String()); | 12328 return (names && names.is$List$String()); |
| 12318 } | 12329 } |
| 12319 Arguments.prototype.toCallStubArgs = function() { | 12330 Arguments.prototype.toCallStubArgs = function() { |
| 12320 var result = []; | 12331 var result = []; |
| 12321 for (var i = 0; | 12332 for (var i = 0; |
| 12322 $notnull_bool(i < this.get$bareCount()); i++) { | 12333 i < this.get$bareCount(); i++) { |
| 12323 result.add(new Value(world.varType, ('\$' + i + ''), null, false)); | 12334 result.add(new Value(world.varType, ('\$' + i + ''), null, false)); |
| 12324 } | 12335 } |
| 12325 for (var i = this.get$bareCount(); | 12336 for (var i = this.get$bareCount(); |
| 12326 $notnull_bool(i < this.get$length()); i++) { | 12337 i < this.get$length(); i++) { |
| 12327 var name = this.getName(i); | 12338 var name = this.getName(i); |
| 12328 if ($notnull_bool(name == null)) name = ('\$' + i + ''); | 12339 if ($notnull_bool(name == null)) name = ('\$' + i + ''); |
| 12329 result.add(new Value(world.varType, name, null, false)); | 12340 result.add(new Value(world.varType, name, null, false)); |
| 12330 } | 12341 } |
| 12331 return new Arguments(this.nodes, result); | 12342 return new Arguments(this.nodes, result); |
| 12332 } | 12343 } |
| 12333 // ********** Code for LibraryImport ************** | 12344 // ********** Code for LibraryImport ************** |
| 12334 function LibraryImport(library, prefix) { | 12345 function LibraryImport(library, prefix) { |
| 12335 this.library = library; | 12346 this.library = library; |
| 12336 this.prefix = prefix; | 12347 this.prefix = prefix; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 12354 Library.prototype.is$Library = function(){return this;}; | 12365 Library.prototype.is$Library = function(){return this;}; |
| 12355 Library.prototype.get$name = function() { return this.name; }; | 12366 Library.prototype.get$name = function() { return this.name; }; |
| 12356 Library.prototype.set$name = function(value) { return this.name = value; }; | 12367 Library.prototype.set$name = function(value) { return this.name = value; }; |
| 12357 Library.prototype.get$isCore = function() { | 12368 Library.prototype.get$isCore = function() { |
| 12358 return $eq(this, world.corelib); | 12369 return $eq(this, world.corelib); |
| 12359 } | 12370 } |
| 12360 Library.prototype.get$isCoreImpl = function() { | 12371 Library.prototype.get$isCoreImpl = function() { |
| 12361 return $eq(this, world.get$coreimpl()); | 12372 return $eq(this, world.get$coreimpl()); |
| 12362 } | 12373 } |
| 12363 Library.prototype.get$jsname = function() { | 12374 Library.prototype.get$jsname = function() { |
| 12364 if ($notnull_bool(this._jsname == null)) { | 12375 if (this._jsname == null) { |
| 12365 this._jsname = this.name.replaceAll('.', '_').replaceAll(':', '_').replaceAl l(' ', '_'); | 12376 this._jsname = this.name.replaceAll('.', '_').replaceAll(':', '_').replaceAl l(' ', '_'); |
| 12366 } | 12377 } |
| 12367 return this._jsname; | 12378 return this._jsname; |
| 12368 } | 12379 } |
| 12369 Library.prototype.get$span = function() { | 12380 Library.prototype.get$span = function() { |
| 12370 return new SourceSpan(this.baseSource, 0, 0); | 12381 return new SourceSpan(this.baseSource, 0, 0); |
| 12371 } | 12382 } |
| 12372 Library.prototype.makeFullPath = function(filename) { | 12383 Library.prototype.makeFullPath = function(filename) { |
| 12373 if ($notnull_bool(filename.startsWith('dart:'))) return filename; | 12384 if (filename.startsWith('dart:')) return filename; |
| 12374 if ($notnull_bool(filename.startsWith('/'))) return filename; | 12385 if (filename.startsWith('/')) return filename; |
| 12375 if ($notnull_bool(filename.startsWith('file:///'))) return filename; | 12386 if (filename.startsWith('file:///')) return filename; |
| 12376 if ($notnull_bool(filename.startsWith('http://'))) return filename; | 12387 if (filename.startsWith('http://')) return filename; |
| 12377 return joinPaths(this.sourceDir, filename); | 12388 return joinPaths(this.sourceDir, filename); |
| 12378 } | 12389 } |
| 12379 Library.prototype.addImport = function(fullname, prefix) { | 12390 Library.prototype.addImport = function(fullname, prefix) { |
| 12380 var newLib = world.getOrAddLibrary(fullname); | 12391 var newLib = world.getOrAddLibrary(fullname); |
| 12381 this.imports.add(new LibraryImport(newLib, prefix)); | 12392 this.imports.add(new LibraryImport(newLib, prefix)); |
| 12382 return newLib; | 12393 return newLib; |
| 12383 } | 12394 } |
| 12384 Library.prototype.addNative = function(fullname) { | 12395 Library.prototype.addNative = function(fullname) { |
| 12385 this.natives.add(world.reader.readFile(fullname)); | 12396 this.natives.add(world.reader.readFile(fullname)); |
| 12386 } | 12397 } |
| 12387 Library.prototype._findMembers = function(name) { | 12398 Library.prototype._findMembers = function(name) { |
| 12388 var $0; | 12399 var $0; |
| 12389 if ($notnull_bool(name.startsWith('_'))) { | 12400 if (name.startsWith('_')) { |
| 12390 return (($0 = this._privateMembers.$index(name)) && $0.is$MemberSet()); | 12401 return (($0 = this._privateMembers.$index(name)) && $0.is$MemberSet()); |
| 12391 } | 12402 } |
| 12392 else { | 12403 else { |
| 12393 return (($0 = world._members.$index(name)) && $0.is$MemberSet()); | 12404 return (($0 = world._members.$index(name)) && $0.is$MemberSet()); |
| 12394 } | 12405 } |
| 12395 } | 12406 } |
| 12396 Library.prototype._addMember = function(member) { | 12407 Library.prototype._addMember = function(member) { |
| 12397 if ($notnull_bool(member.get$isPrivate())) { | 12408 if ($notnull_bool(member.get$isPrivate())) { |
| 12398 if ($notnull_bool(member.get$isStatic())) { | 12409 if ($notnull_bool(member.get$isStatic())) { |
| 12399 if ($notnull_bool(member.declaringType.get$isTop())) { | 12410 if ($notnull_bool(member.declaringType.get$isTop())) { |
| 12400 world._addTopName(member); | 12411 world._addTopName(member); |
| 12401 } | 12412 } |
| 12402 return; | 12413 return; |
| 12403 } | 12414 } |
| 12404 var mset = this._privateMembers.$index(member.name); | 12415 var mset = this._privateMembers.$index(member.name); |
| 12405 if ($notnull_bool(mset == null)) { | 12416 if ($notnull_bool(mset == null)) { |
| 12406 var $list = world.libraries.getValues(); | 12417 var $list = world.libraries.getValues(); |
| 12407 for (var $i = world.libraries.getValues().iterator(); $i.hasNext(); ) { | 12418 for (var $i = world.libraries.getValues().iterator(); $i.hasNext(); ) { |
| 12408 var lib = $i.next(); | 12419 var lib = $i.next(); |
| 12409 if ($notnull_bool(lib._privateMembers.containsKey(member.name))) { | 12420 if (lib._privateMembers.containsKey(member.name)) { |
| 12410 member.set$jsname(('_' + this.get$jsname() + '' + member.name + '')); | 12421 member.set$jsname(('_' + this.get$jsname() + '' + member.name + '')); |
| 12411 break; | 12422 break; |
| 12412 } | 12423 } |
| 12413 } | 12424 } |
| 12414 mset = new MemberSet(member); | 12425 mset = new MemberSet(member); |
| 12415 this._privateMembers.$setindex(member.name, mset); | 12426 this._privateMembers.$setindex(member.name, mset); |
| 12416 } | 12427 } |
| 12417 else { | 12428 else { |
| 12418 mset.get$members().add(member); | 12429 mset.get$members().add(member); |
| 12419 } | 12430 } |
| 12420 } | 12431 } |
| 12421 else { | 12432 else { |
| 12422 world._addMember(member); | 12433 world._addMember(member); |
| 12423 } | 12434 } |
| 12424 } | 12435 } |
| 12425 Library.prototype.getOrAddFunctionType = function(name, func, inType) { | 12436 Library.prototype.getOrAddFunctionType = function(name, func, inType) { |
| 12426 var def = new FunctionTypeDefinition(func, null, func.span); | 12437 var def = new FunctionTypeDefinition(func, null, func.span); |
| 12427 var type = new DefinedType(name, this, def, false); | 12438 var type = new DefinedType(name, this, def, false); |
| 12428 type.addMethod('\$call', func); | 12439 type.addMethod('\$call', func); |
| 12429 type.members.$index('\$call').resolve(inType); | 12440 type.members.$index('\$call').resolve(inType); |
| 12430 type.interfaces = [world.functionType]; | 12441 type.interfaces = [world.functionType]; |
| 12431 return type; | 12442 return type; |
| 12432 } | 12443 } |
| 12433 Library.prototype.addType = function(name, definition, isClass) { | 12444 Library.prototype.addType = function(name, definition, isClass) { |
| 12434 var $0; | 12445 var $0; |
| 12435 if ($notnull_bool(this.types.containsKey(name))) { | 12446 if (this.types.containsKey(name)) { |
| 12436 var existingType = this.types.$index(name); | 12447 var existingType = this.types.$index(name); |
| 12437 if ($notnull_bool(this.get$isCore() && existingType.get$definition() == null )) { | 12448 if ($notnull_bool(this.get$isCore() && existingType.get$definition() == null )) { |
| 12438 existingType.setDefinition((definition && definition.is$Definition())); | 12449 existingType.setDefinition((definition && definition.is$Definition())); |
| 12439 } | 12450 } |
| 12440 else { | 12451 else { |
| 12441 world.warning(('duplicate definition of ' + name + ''), definition.span); | 12452 world.warning(('duplicate definition of ' + name + ''), definition.span); |
| 12442 } | 12453 } |
| 12443 } | 12454 } |
| 12444 else { | 12455 else { |
| 12445 this.types.$setindex(name, new DefinedType(name, this, (definition && defini tion.is$Definition()), isClass)); | 12456 this.types.$setindex(name, new DefinedType(name, this, (definition && defini tion.is$Definition()), isClass)); |
| 12446 } | 12457 } |
| 12447 return (($0 = this.types.$index(name)) && $0.is$DefinedType()); | 12458 return (($0 = this.types.$index(name)) && $0.is$DefinedType()); |
| 12448 } | 12459 } |
| 12449 Library.prototype.findType = function(type) { | 12460 Library.prototype.findType = function(type) { |
| 12450 var result = this.findTypeByName(type.name.name); | 12461 var result = this.findTypeByName(type.name.name); |
| 12451 if ($notnull_bool(result == null)) return null; | 12462 if (result == null) return null; |
| 12452 if ($notnull_bool(type.names != null)) { | 12463 if (type.names != null) { |
| 12453 if ($notnull_bool(type.names.length > 1)) { | 12464 if (type.names.length > 1) { |
| 12454 return null; | 12465 return null; |
| 12455 } | 12466 } |
| 12456 if ($notnull_bool(!$notnull_bool(result.get$isTop()))) { | 12467 if (!$notnull_bool(result.get$isTop())) { |
| 12457 return null; | 12468 return null; |
| 12458 } | 12469 } |
| 12459 return result.get$library().findTypeByName($assert_String(type.names.$index( 0).get$name())); | 12470 return result.get$library().findTypeByName($assert_String(type.names.$index( 0).get$name())); |
| 12460 } | 12471 } |
| 12461 return result; | 12472 return result; |
| 12462 } | 12473 } |
| 12463 Library.prototype.findTypeByName = function(name) { | 12474 Library.prototype.findTypeByName = function(name) { |
| 12464 var ret = this.types.$index(name); | 12475 var ret = this.types.$index(name); |
| 12465 var $list = this.imports; | 12476 var $list = this.imports; |
| 12466 for (var $i = 0;$i < $list.length; $i++) { | 12477 for (var $i = 0;$i < $list.length; $i++) { |
| 12467 var imported = $list.$index($i); | 12478 var imported = $list.$index($i); |
| 12468 var newRet = null; | 12479 var newRet = null; |
| 12469 if ($notnull_bool(imported.prefix == null)) { | 12480 if (imported.prefix == null) { |
| 12470 newRet = imported.get$library().types.$index(name); | 12481 newRet = imported.get$library().types.$index(name); |
| 12471 } | 12482 } |
| 12472 else if ($notnull_bool(imported.prefix == name)) { | 12483 else if (imported.prefix == name) { |
| 12473 newRet = imported.get$library().topType; | 12484 newRet = imported.get$library().topType; |
| 12474 } | 12485 } |
| 12475 if ($notnull_bool($ne(newRet, null))) { | 12486 if ($notnull_bool($ne(newRet, null))) { |
| 12476 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { | 12487 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { |
| 12477 world.error(('conflicting types for "' + name + '"'), ret.get$span(), ne wRet.get$span()); | 12488 world.error(('conflicting types for "' + name + '"'), ret.get$span(), ne wRet.get$span()); |
| 12478 } | 12489 } |
| 12479 else { | 12490 else { |
| 12480 ret = newRet; | 12491 ret = newRet; |
| 12481 } | 12492 } |
| 12482 } | 12493 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 12494 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { | 12505 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { |
| 12495 world.error(('conflicting members for "' + name + '"'), span, ret.get$span (), newRet.get$span()); | 12506 world.error(('conflicting members for "' + name + '"'), span, ret.get$span (), newRet.get$span()); |
| 12496 } | 12507 } |
| 12497 else { | 12508 else { |
| 12498 ret = newRet; | 12509 ret = newRet; |
| 12499 } | 12510 } |
| 12500 } | 12511 } |
| 12501 var $list = this.imports; | 12512 var $list = this.imports; |
| 12502 for (var $i = 0;$i < $list.length; $i++) { | 12513 for (var $i = 0;$i < $list.length; $i++) { |
| 12503 var imported = $list.$index($i); | 12514 var imported = $list.$index($i); |
| 12504 if ($notnull_bool(imported.prefix == null)) { | 12515 if (imported.prefix == null) { |
| 12505 newRet = imported.get$library().topType.getMember(name); | 12516 newRet = imported.get$library().topType.getMember(name); |
| 12506 if ($notnull_bool($ne(newRet, null))) { | 12517 if ($notnull_bool($ne(newRet, null))) { |
| 12507 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { | 12518 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { |
| 12508 world.error(('conflicting members for "' + name + '"'), span, ret.get$ span(), newRet.get$span()); | 12519 world.error(('conflicting members for "' + name + '"'), span, ret.get$ span(), newRet.get$span()); |
| 12509 } | 12520 } |
| 12510 else { | 12521 else { |
| 12511 ret = newRet; | 12522 ret = newRet; |
| 12512 } | 12523 } |
| 12513 } | 12524 } |
| 12514 } | 12525 } |
| 12515 } | 12526 } |
| 12516 return (ret && ret.is$Member()); | 12527 return (ret && ret.is$Member()); |
| 12517 } | 12528 } |
| 12518 Library.prototype.resolve = function() { | 12529 Library.prototype.resolve = function() { |
| 12519 if ($notnull_bool(this.name == null)) { | 12530 if (this.name == null) { |
| 12520 this.name = this.baseSource.filename; | 12531 this.name = this.baseSource.filename; |
| 12521 var index = this.name.lastIndexOf('/', this.name.length); | 12532 var index = this.name.lastIndexOf('/', this.name.length); |
| 12522 if ($notnull_bool(index >= 0)) { | 12533 if (index >= 0) { |
| 12523 this.name = this.name.substring(index + 1); | 12534 this.name = this.name.substring(index + 1); |
| 12524 } | 12535 } |
| 12525 index = this.name.indexOf('.', 0); | 12536 index = this.name.indexOf('.', 0); |
| 12526 if ($notnull_bool(index > 0)) { | 12537 if (index > 0) { |
| 12527 this.name = this.name.substring(0, index); | 12538 this.name = this.name.substring(0, index); |
| 12528 } | 12539 } |
| 12529 } | 12540 } |
| 12530 var $list = this.types.getValues(); | 12541 var $list = this.types.getValues(); |
| 12531 for (var $i = this.types.getValues().iterator(); $i.hasNext(); ) { | 12542 for (var $i = this.types.getValues().iterator(); $i.hasNext(); ) { |
| 12532 var type = $i.next(); | 12543 var type = $i.next(); |
| 12533 type.resolve(); | 12544 type.resolve(); |
| 12534 } | 12545 } |
| 12535 } | 12546 } |
| 12536 Library.prototype.visitSources = function() { | 12547 Library.prototype.visitSources = function() { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 12553 } | 12564 } |
| 12554 _LibraryVisitor.prototype.get$library = function() { return this.library; }; | 12565 _LibraryVisitor.prototype.get$library = function() { return this.library; }; |
| 12555 _LibraryVisitor.prototype.get$isTop = function() { return this.isTop; }; | 12566 _LibraryVisitor.prototype.get$isTop = function() { return this.isTop; }; |
| 12556 _LibraryVisitor.prototype.set$isTop = function(value) { return this.isTop = valu e; }; | 12567 _LibraryVisitor.prototype.set$isTop = function(value) { return this.isTop = valu e; }; |
| 12557 _LibraryVisitor.prototype.addSourceFromName = function(name, span) { | 12568 _LibraryVisitor.prototype.addSourceFromName = function(name, span) { |
| 12558 var filename = this.library.makeFullPath(name); | 12569 var filename = this.library.makeFullPath(name); |
| 12559 if ($notnull_bool($eq(filename, this.library.baseSource.filename))) { | 12570 if ($notnull_bool($eq(filename, this.library.baseSource.filename))) { |
| 12560 world.error('library can not source itself', span); | 12571 world.error('library can not source itself', span); |
| 12561 return; | 12572 return; |
| 12562 } | 12573 } |
| 12563 else if ($notnull_bool(this.sources.some((function (s) { | 12574 else if (this.sources.some((function (s) { |
| 12564 return s.filename == filename; | 12575 return s.filename == filename; |
| 12565 }) | 12576 }) |
| 12566 ))) { | 12577 )) { |
| 12567 world.error(('file "' + filename + '" has already been sourced'), span); | 12578 world.error(('file "' + filename + '" has already been sourced'), span); |
| 12568 return; | 12579 return; |
| 12569 } | 12580 } |
| 12570 var source = world.readFile(this.library.makeFullPath(name)); | 12581 var source = world.readFile(this.library.makeFullPath(name)); |
| 12571 this.sources.add(source); | 12582 this.sources.add(source); |
| 12572 } | 12583 } |
| 12573 _LibraryVisitor.prototype.addSource = function(source) { | 12584 _LibraryVisitor.prototype.addSource = function(source) { |
| 12574 var $this = this; // closure support | 12585 var $this = this; // closure support |
| 12575 if ($notnull_bool(this.library.sources.some((function (s) { | 12586 if (this.library.sources.some((function (s) { |
| 12576 return s.filename == source.filename; | 12587 return s.filename == source.filename; |
| 12577 }) | 12588 }) |
| 12578 ))) { | 12589 )) { |
| 12579 world.error(('duplicate source file "' + source.filename + '"')); | 12590 world.error(('duplicate source file "' + source.filename + '"')); |
| 12580 return; | 12591 return; |
| 12581 } | 12592 } |
| 12582 this.library.sources.add(source); | 12593 this.library.sources.add(source); |
| 12583 var parser = new lang_Parser(source, options.dietParse, false, false, 0); | 12594 var parser = new lang_Parser(source, options.dietParse, false, false, 0); |
| 12584 var unit = parser.compilationUnit(); | 12595 var unit = parser.compilationUnit(); |
| 12585 unit.forEach((function (def) { | 12596 unit.forEach((function (def) { |
| 12586 return def.visit($this); | 12597 return def.visit($this); |
| 12587 }) | 12598 }) |
| 12588 ); | 12599 ); |
| 12589 $assert($notnull_bool(this.sources.length == 0 || this.isTop), "sources.length == 0 || isTop", "library.dart", 293, 12); | 12600 $assert($notnull_bool(this.sources.length == 0 || this.isTop), "sources.length == 0 || isTop", "library.dart", 293, 12); |
| 12590 this.isTop = false; | 12601 this.isTop = false; |
| 12591 var newSources = this.sources; | 12602 var newSources = this.sources; |
| 12592 this.sources = []; | 12603 this.sources = []; |
| 12593 for (var $i = newSources.iterator(); $i.hasNext(); ) { | 12604 for (var $i = newSources.iterator(); $i.hasNext(); ) { |
| 12594 var source0 = $i.next(); | 12605 var source0 = $i.next(); |
| 12595 this.addSource((source0 && source0.is$SourceFile())); | 12606 this.addSource((source0 && source0.is$SourceFile())); |
| 12596 } | 12607 } |
| 12597 } | 12608 } |
| 12598 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { | 12609 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { |
| 12599 if ($notnull_bool(!$notnull_bool(this.isTop))) { | 12610 if (!$notnull_bool(this.isTop)) { |
| 12600 world.error('directives not allowed in sourced file', node.span); | 12611 world.error('directives not allowed in sourced file', node.span); |
| 12601 return; | 12612 return; |
| 12602 } | 12613 } |
| 12603 var name; | 12614 var name; |
| 12604 switch (node.name.name) { | 12615 switch (node.name.name) { |
| 12605 case "library": | 12616 case "library": |
| 12606 | 12617 |
| 12607 name = this.getSingleStringArg(node); | 12618 name = this.getSingleStringArg(node); |
| 12608 if ($notnull_bool(this.library.name == null)) { | 12619 if (this.library.name == null) { |
| 12609 this.library.name = $assert_String(name); | 12620 this.library.name = $assert_String(name); |
| 12610 if ($notnull_bool($eq(name, 'node') || $eq(name, 'dom'))) { | 12621 if ($notnull_bool($eq(name, 'node') || $eq(name, 'dom'))) { |
| 12611 this.library.topType.isNativeType = true; | 12622 this.library.topType.isNativeType = true; |
| 12612 } | 12623 } |
| 12613 if ($notnull_bool(this.seenImport || this.seenSource) || this.seenResour ce) { | 12624 if ($notnull_bool($notnull_bool(this.seenImport || this.seenSource) || t his.seenResource)) { |
| 12614 world.error('#library must be first directive in file', node.span); | 12625 world.error('#library must be first directive in file', node.span); |
| 12615 } | 12626 } |
| 12616 } | 12627 } |
| 12617 else { | 12628 else { |
| 12618 world.error('already specified library name', node.span); | 12629 world.error('already specified library name', node.span); |
| 12619 } | 12630 } |
| 12620 break; | 12631 break; |
| 12621 | 12632 |
| 12622 case "import": | 12633 case "import": |
| 12623 | 12634 |
| 12624 this.seenImport = true; | 12635 this.seenImport = true; |
| 12625 name = this.getFirstStringArg(node); | 12636 name = this.getFirstStringArg(node); |
| 12626 var prefix = this.tryGetNamedStringArg(node, 'prefix'); | 12637 var prefix = this.tryGetNamedStringArg(node, 'prefix'); |
| 12627 if ($notnull_bool(node.arguments.length > 2 || $notnull_bool(node.argument s.length == 2 && prefix == null))) { | 12638 if (node.arguments.length > 2 || $notnull_bool(node.arguments.length == 2 && prefix == null)) { |
| 12628 world.error('expected at most one "name" argument and one optional "pref ix"' + (' but found ' + node.arguments.length + ''), node.span); | 12639 world.error('expected at most one "name" argument and one optional "pref ix"' + (' but found ' + node.arguments.length + ''), node.span); |
| 12629 } | 12640 } |
| 12630 else if ($notnull_bool($ne(prefix, null) && prefix.indexOf('.', 0) >= 0)) { | 12641 else if ($notnull_bool($ne(prefix, null) && prefix.indexOf('.', 0) >= 0)) { |
| 12631 world.error('library prefix canot contain "."', node.span); | 12642 world.error('library prefix canot contain "."', node.span); |
| 12632 } | 12643 } |
| 12633 else if ($notnull_bool(this.seenSource || this.seenResource)) { | 12644 else if ($notnull_bool(this.seenSource || this.seenResource)) { |
| 12634 world.error('#imports must come before any #source or #resource', node.s pan); | 12645 world.error('#imports must come before any #source or #resource', node.s pan); |
| 12635 } | 12646 } |
| 12636 if ($notnull_bool($eq(prefix, ''))) prefix = null; | 12647 if ($notnull_bool($eq(prefix, ''))) prefix = null; |
| 12637 var filename = this.library.makeFullPath($assert_String(name)); | 12648 var filename = this.library.makeFullPath($assert_String(name)); |
| 12638 if ($notnull_bool(this.library.imports.some((function (li) { | 12649 if (this.library.imports.some((function (li) { |
| 12639 return $eq(li.get$library().baseSource, filename); | 12650 return $eq(li.get$library().baseSource, filename); |
| 12640 }) | 12651 }) |
| 12641 ))) { | 12652 )) { |
| 12642 world.error(('duplicate import of "' + name + '"'), node.span); | 12653 world.error(('duplicate import of "' + name + '"'), node.span); |
| 12643 return; | 12654 return; |
| 12644 } | 12655 } |
| 12645 var newLib = this.library.addImport($assert_String(filename), $assert_Stri ng(prefix)); | 12656 var newLib = this.library.addImport($assert_String(filename), $assert_Stri ng(prefix)); |
| 12646 break; | 12657 break; |
| 12647 | 12658 |
| 12648 case "source": | 12659 case "source": |
| 12649 | 12660 |
| 12650 this.seenSource = true; | 12661 this.seenSource = true; |
| 12651 name = this.getSingleStringArg(node); | 12662 name = this.getSingleStringArg(node); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 12667 this.getFirstStringArg(node); | 12678 this.getFirstStringArg(node); |
| 12668 break; | 12679 break; |
| 12669 | 12680 |
| 12670 default: | 12681 default: |
| 12671 | 12682 |
| 12672 world.error(('unknown directive: ' + node.name.name + ''), node.span); | 12683 world.error(('unknown directive: ' + node.name.name + ''), node.span); |
| 12673 | 12684 |
| 12674 } | 12685 } |
| 12675 } | 12686 } |
| 12676 _LibraryVisitor.prototype.getSingleStringArg = function(node) { | 12687 _LibraryVisitor.prototype.getSingleStringArg = function(node) { |
| 12677 if ($notnull_bool(node.arguments.length != 1)) { | 12688 if (node.arguments.length != 1) { |
| 12678 world.error(('expected exactly one argument but found ' + node.arguments.len gth + ''), node.span); | 12689 world.error(('expected exactly one argument but found ' + node.arguments.len gth + ''), node.span); |
| 12679 } | 12690 } |
| 12680 return this.getFirstStringArg(node); | 12691 return this.getFirstStringArg(node); |
| 12681 } | 12692 } |
| 12682 _LibraryVisitor.prototype.getFirstStringArg = function(node) { | 12693 _LibraryVisitor.prototype.getFirstStringArg = function(node) { |
| 12683 if ($notnull_bool(node.arguments.length < 1)) { | 12694 if (node.arguments.length < 1) { |
| 12684 world.error(('expected at least one argument but found ' + node.arguments.le ngth + ''), node.span); | 12695 world.error(('expected at least one argument but found ' + node.arguments.le ngth + ''), node.span); |
| 12685 } | 12696 } |
| 12686 var arg = node.arguments.$index(0); | 12697 var arg = node.arguments.$index(0); |
| 12687 if ($notnull_bool(arg.label != null)) { | 12698 if (arg.label != null) { |
| 12688 world.error('label not allowed for directive', node.span); | 12699 world.error('label not allowed for directive', node.span); |
| 12689 } | 12700 } |
| 12690 return this._parseStringArgument((arg && arg.is$ArgumentNode())); | 12701 return this._parseStringArgument((arg && arg.is$ArgumentNode())); |
| 12691 } | 12702 } |
| 12692 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { | 12703 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { |
| 12693 var args = node.arguments.filter((function (a) { | 12704 var args = node.arguments.filter((function (a) { |
| 12694 return $notnull_bool(a.label != null && a.label.name == argName); | 12705 return a.label != null && a.label.name == argName; |
| 12695 }) | 12706 }) |
| 12696 ); | 12707 ); |
| 12697 if ($notnull_bool(args.length == 0)) { | 12708 if (args.length == 0) { |
| 12698 return null; | 12709 return null; |
| 12699 } | 12710 } |
| 12700 if ($notnull_bool(args.length > 1)) { | 12711 if (args.length > 1) { |
| 12701 world.error(('expected at most one "' + argName + '" argument but found ') + node.arguments.length, node.span); | 12712 world.error(('expected at most one "' + argName + '" argument but found ') + node.arguments.length, node.span); |
| 12702 } | 12713 } |
| 12703 for (var $i = args.iterator(); $i.hasNext(); ) { | 12714 for (var $i = args.iterator(); $i.hasNext(); ) { |
| 12704 var arg = $i.next(); | 12715 var arg = $i.next(); |
| 12705 return this._parseStringArgument((arg && arg.is$ArgumentNode())); | 12716 return this._parseStringArgument((arg && arg.is$ArgumentNode())); |
| 12706 } | 12717 } |
| 12707 } | 12718 } |
| 12708 _LibraryVisitor.prototype._parseStringArgument = function(arg) { | 12719 _LibraryVisitor.prototype._parseStringArgument = function(arg) { |
| 12709 var expr = arg.value; | 12720 var expr = arg.value; |
| 12710 if ($notnull_bool(!(expr instanceof LiteralExpression) || !$notnull_bool(expr. type.type.get$isString()))) { | 12721 if (!(expr instanceof LiteralExpression) || !$notnull_bool(expr.type.type.get$ isString())) { |
| 12711 world.error('expected string', expr.get$span()); | 12722 world.error('expected string', expr.get$span()); |
| 12712 } | 12723 } |
| 12713 return parseStringLiteral($assert_String(expr.get$value())); | 12724 return parseStringLiteral($assert_String(expr.get$value())); |
| 12714 } | 12725 } |
| 12715 _LibraryVisitor.prototype.visitTypeDefinition = function(node) { | 12726 _LibraryVisitor.prototype.visitTypeDefinition = function(node) { |
| 12716 var oldType = this.currentType; | 12727 var oldType = this.currentType; |
| 12717 this.currentType = this.library.addType(node.name.name, node, node.isClass); | 12728 this.currentType = this.library.addType(node.name.name, node, node.isClass); |
| 12718 var $list = node.body; | 12729 var $list = node.body; |
| 12719 for (var $i = 0;$i < $list.length; $i++) { | 12730 for (var $i = 0;$i < $list.length; $i++) { |
| 12720 var member = $list.$index($i); | 12731 var member = $list.$index($i); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 12740 } | 12751 } |
| 12741 Parameter.prototype.is$Parameter = function(){return this;}; | 12752 Parameter.prototype.is$Parameter = function(){return this;}; |
| 12742 Parameter.prototype.get$definition = function() { return this.definition; }; | 12753 Parameter.prototype.get$definition = function() { return this.definition; }; |
| 12743 Parameter.prototype.set$definition = function(value) { return this.definition = value; }; | 12754 Parameter.prototype.set$definition = function(value) { return this.definition = value; }; |
| 12744 Parameter.prototype.get$name = function() { return this.name; }; | 12755 Parameter.prototype.get$name = function() { return this.name; }; |
| 12745 Parameter.prototype.set$name = function(value) { return this.name = value; }; | 12756 Parameter.prototype.set$name = function(value) { return this.name = value; }; |
| 12746 Parameter.prototype.get$value = function() { return this.value; }; | 12757 Parameter.prototype.get$value = function() { return this.value; }; |
| 12747 Parameter.prototype.set$value = function(value) { return this.value = value; }; | 12758 Parameter.prototype.set$value = function(value) { return this.value = value; }; |
| 12748 Parameter.prototype.resolve = function(method, inType) { | 12759 Parameter.prototype.resolve = function(method, inType) { |
| 12749 this.name = this.definition.name.name; | 12760 this.name = this.definition.name.name; |
| 12750 if ($notnull_bool(this.name.startsWith('this.'))) { | 12761 if (this.name.startsWith('this.')) { |
| 12751 this.name = this.name.substring(5); | 12762 this.name = this.name.substring(5); |
| 12752 this.isInitializer = true; | 12763 this.isInitializer = true; |
| 12753 } | 12764 } |
| 12754 this.type = inType.resolveType(this.definition.type, false); | 12765 this.type = inType.resolveType(this.definition.type, false); |
| 12755 if ($notnull_bool(method.get$isStatic() && this.type.get$hasTypeParams())) { | 12766 if ($notnull_bool(method.get$isStatic() && this.type.get$hasTypeParams())) { |
| 12756 world.error('using type parameter in static context', this.definition.span); | 12767 world.error('using type parameter in static context', this.definition.span); |
| 12757 } | 12768 } |
| 12758 if ($notnull_bool(this.definition.value != null)) { | 12769 if (this.definition.value != null) { |
| 12759 if ($notnull_bool((this.definition.value instanceof NullExpression) && this. definition.value.span.start == this.definition.span.start)) { | 12770 if ((this.definition.value instanceof NullExpression) && this.definition.val ue.span.start == this.definition.span.start) { |
| 12760 return; | 12771 return; |
| 12761 } | 12772 } |
| 12762 if ($notnull_bool(method.get$isAbstract())) { | 12773 if ($notnull_bool(method.get$isAbstract())) { |
| 12763 world.error('default value not allowed on abstract methods', this.definiti on.span); | 12774 world.error('default value not allowed on abstract methods', this.definiti on.span); |
| 12764 } | 12775 } |
| 12765 else if ($notnull_bool(method.name == '\$call' && method.get$definition().bo dy == null)) { | 12776 else if ($notnull_bool(method.name == '\$call' && method.get$definition().bo dy == null)) { |
| 12766 world.error('default value not allowed on function type', this.definition. span); | 12777 world.error('default value not allowed on function type', this.definition. span); |
| 12767 } | 12778 } |
| 12768 } | 12779 } |
| 12769 else if ($notnull_bool(this.isInitializer && !$notnull_bool(method.get$isConst ructor()))) { | 12780 else if ($notnull_bool(this.isInitializer && !$notnull_bool(method.get$isConst ructor()))) { |
| 12770 world.error('initializer parameters only allowed on constructors', this.defi nition.span); | 12781 world.error('initializer parameters only allowed on constructors', this.defi nition.span); |
| 12771 } | 12782 } |
| 12772 } | 12783 } |
| 12773 Parameter.prototype.genValue = function(method, context) { | 12784 Parameter.prototype.genValue = function(method, context) { |
| 12774 var $0; | 12785 var $0; |
| 12775 if ($notnull_bool(this.definition.value == null || this.value != null)) return ; | 12786 if (this.definition.value == null || this.value != null) return; |
| 12776 if ($notnull_bool(context == null)) { | 12787 if (context == null) { |
| 12777 context = new MethodGenerator(method, null); | 12788 context = new MethodGenerator(method, null); |
| 12778 } | 12789 } |
| 12779 this.value = (($0 = this.definition.value.visit(context)) && $0.is$Value()); | 12790 this.value = (($0 = this.definition.value.visit(context)) && $0.is$Value()); |
| 12780 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse); | 12791 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse); |
| 12781 } | 12792 } |
| 12782 Parameter.prototype.copyWithNewType = function(newType) { | 12793 Parameter.prototype.copyWithNewType = function(newType) { |
| 12783 var ret = new Parameter(this.definition); | 12794 var ret = new Parameter(this.definition); |
| 12784 ret.type = newType; | 12795 ret.type = newType; |
| 12785 ret.name = this.name; | 12796 ret.name = this.name; |
| 12786 ret.isInitializer = this.isInitializer; | 12797 ret.isInitializer = this.isInitializer; |
| 12787 return (ret && ret.is$Parameter()); | 12798 return (ret && ret.is$Parameter()); |
| 12788 } | 12799 } |
| 12789 Parameter.prototype.get$isOptional = function() { | 12800 Parameter.prototype.get$isOptional = function() { |
| 12790 return $notnull_bool(this.definition != null && this.definition.value != null) ; | 12801 return this.definition != null && this.definition.value != null; |
| 12791 } | 12802 } |
| 12792 // ********** Code for Member ************** | 12803 // ********** Code for Member ************** |
| 12793 function Member(name, declaringType) { | 12804 function Member(name, declaringType) { |
| 12794 this.name = name; | 12805 this.name = name; |
| 12795 this.declaringType = declaringType; | 12806 this.declaringType = declaringType; |
| 12796 this.isGenerated = false; | 12807 this.isGenerated = false; |
| 12797 // Initializers done | 12808 // Initializers done |
| 12798 } | 12809 } |
| 12799 Member.prototype.is$Member = function(){return this;}; | 12810 Member.prototype.is$Member = function(){return this;}; |
| 12800 Member.prototype.is$Named = function(){return this;}; | 12811 Member.prototype.is$Named = function(){return this;}; |
| 12801 Member.prototype.get$name = function() { return this.name; }; | 12812 Member.prototype.get$name = function() { return this.name; }; |
| 12802 Member.prototype.get$jsname = function() { | 12813 Member.prototype.get$jsname = function() { |
| 12803 return $notnull_bool(this._jsname == null) ? this.name : this._jsname; | 12814 return this._jsname == null ? this.name : this._jsname; |
| 12804 } | 12815 } |
| 12805 Member.prototype.set$jsname = function(name) { | 12816 Member.prototype.set$jsname = function(name) { |
| 12806 return this._jsname = name; | 12817 return this._jsname = name; |
| 12807 } | 12818 } |
| 12808 Member.prototype.get$library = function() { | 12819 Member.prototype.get$library = function() { |
| 12809 return this.declaringType.get$library(); | 12820 return this.declaringType.get$library(); |
| 12810 } | 12821 } |
| 12811 Member.prototype.get$isPrivate = function() { | 12822 Member.prototype.get$isPrivate = function() { |
| 12812 return this.name.startsWith('_'); | 12823 return this.name.startsWith('_'); |
| 12813 } | 12824 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12849 } | 12860 } |
| 12850 Member.prototype.providePropertySyntax = function() { | 12861 Member.prototype.providePropertySyntax = function() { |
| 12851 return world.internalError('can not be property', this.get$span()); | 12862 return world.internalError('can not be property', this.get$span()); |
| 12852 } | 12863 } |
| 12853 Member.prototype.get$initDelegate = function() { | 12864 Member.prototype.get$initDelegate = function() { |
| 12854 world.internalError('cannot have initializers', this.get$span()); | 12865 world.internalError('cannot have initializers', this.get$span()); |
| 12855 } | 12866 } |
| 12856 Member.prototype.set$initDelegate = function(ctor) { | 12867 Member.prototype.set$initDelegate = function(ctor) { |
| 12857 world.internalError('cannot have initializers', this.get$span()); | 12868 world.internalError('cannot have initializers', this.get$span()); |
| 12858 } | 12869 } |
| 12870 Member.prototype.get$inferredResult = function() { | |
| 12871 var t = this.get$returnType(); | |
| 12872 if ($notnull_bool(t.get$isBool() && ($notnull_bool(this.get$library().get$isCo re() || this.get$library().get$isCoreImpl())))) { | |
| 12873 return world.nonNullBool; | |
| 12874 } | |
| 12875 return (t && t.is$lang_Type()); | |
| 12876 } | |
| 12859 Member.prototype.get$definition = function() { | 12877 Member.prototype.get$definition = function() { |
| 12860 return null; | 12878 return null; |
| 12861 } | 12879 } |
| 12862 Member.prototype.get$parameters = function() { | 12880 Member.prototype.get$parameters = function() { |
| 12863 return []; | 12881 return []; |
| 12864 } | 12882 } |
| 12865 Member.prototype.canInvoke = function(context, args) { | 12883 Member.prototype.canInvoke = function(context, args) { |
| 12866 return $notnull_bool(this.get$canGet() && new Value(this.get$returnType(), nul l, null, true).canInvoke(context, '\$call', args)); | 12884 return $notnull_bool(this.get$canGet() && new Value(this.get$returnType(), nul l, null, true).canInvoke(context, '\$call', args)); |
| 12867 } | 12885 } |
| 12868 Member.prototype.invoke = function(context, node, target, args, isDynamic) { | 12886 Member.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 12869 var newTarget = this._get(context, node, target, isDynamic); | 12887 var newTarget = this._get(context, node, target, isDynamic); |
| 12870 return newTarget.invoke(context, '\$call', node, args, isDynamic); | 12888 return newTarget.invoke(context, '\$call', node, args, isDynamic); |
| 12871 } | 12889 } |
| 12872 Member.prototype.override = function(other) { | 12890 Member.prototype.override = function(other) { |
| 12873 if ($notnull_bool(this.get$isStatic())) { | 12891 if ($notnull_bool(this.get$isStatic())) { |
| 12874 world.error('static members can not hide parent members', this.get$span(), o ther.get$span()); | 12892 world.error('static members can not hide parent members', this.get$span(), o ther.get$span()); |
| 12875 return false; | 12893 return false; |
| 12876 } | 12894 } |
| 12877 else if ($notnull_bool(other.get$isStatic())) { | 12895 else if ($notnull_bool(other.get$isStatic())) { |
| 12878 world.error('can not override static member', this.get$span(), other.get$spa n()); | 12896 world.error('can not override static member', this.get$span(), other.get$spa n()); |
| 12879 return false; | 12897 return false; |
| 12880 } | 12898 } |
| 12881 return true; | 12899 return true; |
| 12882 } | 12900 } |
| 12883 Member.prototype.get$generatedFactoryName = function() { | 12901 Member.prototype.get$generatedFactoryName = function() { |
| 12884 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 178, 12); | 12902 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 192, 12); |
| 12885 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo rName() + '\$'); | 12903 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo rName() + '\$'); |
| 12886 if ($notnull_bool(this.name == '')) { | 12904 if (this.name == '') { |
| 12887 return ('' + prefix + 'factory'); | 12905 return ('' + prefix + 'factory'); |
| 12888 } | 12906 } |
| 12889 else { | 12907 else { |
| 12890 return ('' + prefix + '' + this.name + '\$factory'); | 12908 return ('' + prefix + '' + this.name + '\$factory'); |
| 12891 } | 12909 } |
| 12892 } | 12910 } |
| 12893 Member.prototype.resolveType = function(node, isRequired) { | 12911 Member.prototype.resolveType = function(node, isRequired) { |
| 12894 var type = this.declaringType.resolveType(node, isRequired); | 12912 var type = this.declaringType.resolveType(node, isRequired); |
| 12895 if ($notnull_bool(this.get$isStatic() && type.get$hasTypeParams())) { | 12913 if ($notnull_bool(this.get$isStatic() && type.get$hasTypeParams())) { |
| 12896 world.error('using type parameter in static context', node.span); | 12914 world.error('using type parameter in static context', node.span); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12973 } | 12991 } |
| 12974 $inherits(FieldMember, Member); | 12992 $inherits(FieldMember, Member); |
| 12975 FieldMember.prototype.is$FieldMember = function(){return this;}; | 12993 FieldMember.prototype.is$FieldMember = function(){return this;}; |
| 12976 FieldMember.prototype.get$definition = function() { return this.definition; }; | 12994 FieldMember.prototype.get$definition = function() { return this.definition; }; |
| 12977 FieldMember.prototype.get$value = function() { return this.value; }; | 12995 FieldMember.prototype.get$value = function() { return this.value; }; |
| 12978 FieldMember.prototype.get$isStatic = function() { return this.isStatic; }; | 12996 FieldMember.prototype.get$isStatic = function() { return this.isStatic; }; |
| 12979 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va lue; }; | 12997 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va lue; }; |
| 12980 FieldMember.prototype.get$isNative = function() { return this.isNative; }; | 12998 FieldMember.prototype.get$isNative = function() { return this.isNative; }; |
| 12981 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va lue; }; | 12999 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va lue; }; |
| 12982 FieldMember.prototype.override = function(other) { | 13000 FieldMember.prototype.override = function(other) { |
| 12983 if ($notnull_bool(!$notnull_bool(Member.prototype.override.call(this, other))) ) return false; | 13001 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false; |
| 12984 if ($notnull_bool(other.get$isProperty())) { | 13002 if ($notnull_bool(other.get$isProperty())) { |
| 12985 return true; | 13003 return true; |
| 12986 } | 13004 } |
| 12987 else { | 13005 else { |
| 12988 world.error('field can not override anything but property', this.get$span(), other.get$span()); | 13006 world.error('field can not override anything but property', this.get$span(), other.get$span()); |
| 12989 return false; | 13007 return false; |
| 12990 } | 13008 } |
| 12991 } | 13009 } |
| 12992 FieldMember.prototype.get$prefersPropertySyntax = function() { | 13010 FieldMember.prototype.get$prefersPropertySyntax = function() { |
| 12993 return false; | 13011 return false; |
| 12994 } | 13012 } |
| 12995 FieldMember.prototype.get$requiresFieldSyntax = function() { | 13013 FieldMember.prototype.get$requiresFieldSyntax = function() { |
| 12996 return this.isNative; | 13014 return this.isNative; |
| 12997 } | 13015 } |
| 12998 FieldMember.prototype.provideFieldSyntax = function() { | 13016 FieldMember.prototype.provideFieldSyntax = function() { |
| 12999 | 13017 |
| 13000 } | 13018 } |
| 13001 FieldMember.prototype.providePropertySyntax = function() { | 13019 FieldMember.prototype.providePropertySyntax = function() { |
| 13002 this._providePropertySyntax = true; | 13020 this._providePropertySyntax = true; |
| 13003 } | 13021 } |
| 13004 FieldMember.prototype.get$span = function() { | 13022 FieldMember.prototype.get$span = function() { |
| 13005 var $0; | 13023 var $0; |
| 13006 return (($0 = $notnull_bool(this.definition == null) ? null : this.definition. span) && $0.is$SourceSpan()); | 13024 return (($0 = this.definition == null ? null : this.definition.span) && $0.is$ SourceSpan()); |
| 13007 } | 13025 } |
| 13008 FieldMember.prototype.get$returnType = function() { | 13026 FieldMember.prototype.get$returnType = function() { |
| 13009 return this.type; | 13027 return this.type; |
| 13010 } | 13028 } |
| 13011 FieldMember.prototype.get$canGet = function() { | 13029 FieldMember.prototype.get$canGet = function() { |
| 13012 return true; | 13030 return true; |
| 13013 } | 13031 } |
| 13014 FieldMember.prototype.get$canSet = function() { | 13032 FieldMember.prototype.get$canSet = function() { |
| 13015 return !$notnull_bool(this.isFinal); | 13033 return !$notnull_bool(this.isFinal); |
| 13016 } | 13034 } |
| 13017 FieldMember.prototype.get$isField = function() { | 13035 FieldMember.prototype.get$isField = function() { |
| 13018 return true; | 13036 return true; |
| 13019 } | 13037 } |
| 13020 FieldMember.prototype.resolve = function(inType) { | 13038 FieldMember.prototype.resolve = function(inType) { |
| 13021 this.isStatic = this.declaringType.get$isTop(); | 13039 this.isStatic = this.declaringType.get$isTop(); |
| 13022 this.isFinal = false; | 13040 this.isFinal = false; |
| 13023 if ($notnull_bool(this.definition.modifiers != null)) { | 13041 if (this.definition.modifiers != null) { |
| 13024 var $list = this.definition.modifiers; | 13042 var $list = this.definition.modifiers; |
| 13025 for (var $i = 0;$i < $list.length; $i++) { | 13043 for (var $i = 0;$i < $list.length; $i++) { |
| 13026 var mod = $list.$index($i); | 13044 var mod = $list.$index($i); |
| 13027 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { | 13045 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { |
| 13028 if ($notnull_bool(this.isStatic)) { | 13046 if ($notnull_bool(this.isStatic)) { |
| 13029 world.error('duplicate static modifier', mod.get$span()); | 13047 world.error('duplicate static modifier', mod.get$span()); |
| 13030 } | 13048 } |
| 13031 this.isStatic = true; | 13049 this.isStatic = true; |
| 13032 } | 13050 } |
| 13033 else if ($notnull_bool($eq(mod.kind, 97/*TokenKind.FINAL*/))) { | 13051 else if ($notnull_bool($eq(mod.kind, 97/*TokenKind.FINAL*/))) { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 13045 if ($notnull_bool(this.isStatic && this.type.get$hasTypeParams())) { | 13063 if ($notnull_bool(this.isStatic && this.type.get$hasTypeParams())) { |
| 13046 world.error('using type parameter in static context', this.definition.type.s pan); | 13064 world.error('using type parameter in static context', this.definition.type.s pan); |
| 13047 } | 13065 } |
| 13048 if ($notnull_bool(this.isStatic && this.isFinal) && this.value == null) { | 13066 if ($notnull_bool(this.isStatic && this.isFinal) && this.value == null) { |
| 13049 world.error('static final field is missing initializer', this.get$span()); | 13067 world.error('static final field is missing initializer', this.get$span()); |
| 13050 } | 13068 } |
| 13051 this.get$library()._addMember(this); | 13069 this.get$library()._addMember(this); |
| 13052 } | 13070 } |
| 13053 FieldMember.prototype.computeValue = function() { | 13071 FieldMember.prototype.computeValue = function() { |
| 13054 var $0; | 13072 var $0; |
| 13055 if ($notnull_bool(this.value == null)) return null; | 13073 if (this.value == null) return null; |
| 13056 if ($notnull_bool(this._computedValue == null)) { | 13074 if (this._computedValue == null) { |
| 13057 if ($notnull_bool(this._computing)) { | 13075 if ($notnull_bool(this._computing)) { |
| 13058 world.error('circular reference', this.value.span); | 13076 world.error('circular reference', this.value.span); |
| 13059 return null; | 13077 return null; |
| 13060 } | 13078 } |
| 13061 this._computing = true; | 13079 this._computing = true; |
| 13062 var finalMethod = new MethodMember('final_context', this.declaringType, null ); | 13080 var finalMethod = new MethodMember('final_context', this.declaringType, null ); |
| 13063 finalMethod.isStatic = true; | 13081 finalMethod.isStatic = true; |
| 13064 var finalGen = new MethodGenerator(finalMethod, null); | 13082 var finalGen = new MethodGenerator(finalMethod, null); |
| 13065 this._computedValue = (($0 = this.value.visit(finalGen)) && $0.is$Value()); | 13083 this._computedValue = (($0 = this.value.visit(finalGen)) && $0.is$Value()); |
| 13066 if ($notnull_bool(!$notnull_bool(this._computedValue.get$isConst()))) { | 13084 if (!$notnull_bool(this._computedValue.get$isConst())) { |
| 13067 if ($notnull_bool(this.isStatic)) { | 13085 if ($notnull_bool(this.isStatic)) { |
| 13068 world.error('non constant static field must be initialized in functions' , this.value.span); | 13086 world.error('non constant static field must be initialized in functions' , this.value.span); |
| 13069 } | 13087 } |
| 13070 else { | 13088 else { |
| 13071 world.error('non constant field must be initialized in constructor', thi s.value.span); | 13089 world.error('non constant field must be initialized in constructor', thi s.value.span); |
| 13072 } | 13090 } |
| 13073 } | 13091 } |
| 13074 if ($notnull_bool(this.isStatic)) { | 13092 if ($notnull_bool(this.isStatic)) { |
| 13075 this._computedValue = world.gen.globalForStaticField(this, this._computedV alue, [this._computedValue]); | 13093 this._computedValue = world.gen.globalForStaticField(this, this._computedV alue, [this._computedValue]); |
| 13076 } | 13094 } |
| 13077 this._computing = false; | 13095 this._computing = false; |
| 13078 } | 13096 } |
| 13079 return this._computedValue; | 13097 return this._computedValue; |
| 13080 } | 13098 } |
| 13081 FieldMember.prototype._get = function(context, node, target, isDynamic) { | 13099 FieldMember.prototype._get = function(context, node, target, isDynamic) { |
| 13082 var $0; | 13100 var $0; |
| 13083 if ($notnull_bool(!$notnull_bool(isDynamic))) { | 13101 if (!$notnull_bool(isDynamic)) { |
| 13084 this.declaringType.markUsed(); | 13102 this.declaringType.markUsed(); |
| 13085 } | 13103 } |
| 13086 if ($notnull_bool(this.isStatic)) { | 13104 if ($notnull_bool(this.isStatic)) { |
| 13087 var cv = this.computeValue(); | 13105 var cv = this.computeValue(); |
| 13088 if ($notnull_bool(this.isFinal)) { | 13106 if ($notnull_bool(this.isFinal)) { |
| 13089 return (cv && cv.is$Value()); | 13107 return (cv && cv.is$Value()); |
| 13090 } | 13108 } |
| 13091 if ($notnull_bool(this.declaringType.get$isTop())) { | 13109 if ($notnull_bool(this.declaringType.get$isTop())) { |
| 13092 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, true ); | 13110 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, true ); |
| 13093 } | 13111 } |
| 13094 else { | 13112 else { |
| 13095 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, true); | 13113 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, true); |
| 13096 } | 13114 } |
| 13097 } | 13115 } |
| 13098 else if ($notnull_bool(target.get$isConst() && this.isFinal)) { | 13116 else if ($notnull_bool(target.get$isConst() && this.isFinal)) { |
| 13099 var constTarget = $notnull_bool((target instanceof GlobalValue)) ? target.ge t$dynamic().exp : target; | 13117 var constTarget = (target instanceof GlobalValue) ? target.get$dynamic().exp : target; |
| 13100 if ($notnull_bool((constTarget instanceof ConstObjectValue))) { | 13118 if ((constTarget instanceof ConstObjectValue)) { |
| 13101 return (($0 = constTarget.fields.$index(this.name)) && $0.is$Value()); | 13119 return (($0 = constTarget.fields.$index(this.name)) && $0.is$Value()); |
| 13102 } | 13120 } |
| 13103 else if ($notnull_bool($eq(constTarget.type, world.stringType) && this.name == 'length')) { | 13121 else if ($notnull_bool($eq(constTarget.type, world.stringType) && this.name == 'length')) { |
| 13104 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), node.span, true); | 13122 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), node.span, true); |
| 13105 } | 13123 } |
| 13106 } | 13124 } |
| 13107 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, true); | 13125 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, true); |
| 13108 } | 13126 } |
| 13109 FieldMember.prototype._set = function(context, node, target, value, isDynamic) { | 13127 FieldMember.prototype._set = function(context, node, target, value, isDynamic) { |
| 13110 var lhs = this._get(context, node, target, isDynamic); | 13128 var lhs = this._get(context, node, target, isDynamic); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 13122 // ********** Code for PropertyMember ************** | 13140 // ********** Code for PropertyMember ************** |
| 13123 function PropertyMember(name, declaringType) { | 13141 function PropertyMember(name, declaringType) { |
| 13124 this._provideFieldSyntax = false | 13142 this._provideFieldSyntax = false |
| 13125 Member.call(this, name, declaringType); | 13143 Member.call(this, name, declaringType); |
| 13126 // Initializers done | 13144 // Initializers done |
| 13127 } | 13145 } |
| 13128 $inherits(PropertyMember, Member); | 13146 $inherits(PropertyMember, Member); |
| 13129 PropertyMember.prototype.is$PropertyMember = function(){return this;}; | 13147 PropertyMember.prototype.is$PropertyMember = function(){return this;}; |
| 13130 PropertyMember.prototype.get$span = function() { | 13148 PropertyMember.prototype.get$span = function() { |
| 13131 var $0; | 13149 var $0; |
| 13132 return (($0 = $notnull_bool(this.getter != null) ? this.getter.get$span() : nu ll) && $0.is$SourceSpan()); | 13150 return (($0 = this.getter != null ? this.getter.get$span() : null) && $0.is$So urceSpan()); |
| 13133 } | 13151 } |
| 13134 PropertyMember.prototype.get$canGet = function() { | 13152 PropertyMember.prototype.get$canGet = function() { |
| 13135 return this.getter != null; | 13153 return this.getter != null; |
| 13136 } | 13154 } |
| 13137 PropertyMember.prototype.get$canSet = function() { | 13155 PropertyMember.prototype.get$canSet = function() { |
| 13138 return this.setter != null; | 13156 return this.setter != null; |
| 13139 } | 13157 } |
| 13140 PropertyMember.prototype.get$prefersPropertySyntax = function() { | 13158 PropertyMember.prototype.get$prefersPropertySyntax = function() { |
| 13141 return true; | 13159 return true; |
| 13142 } | 13160 } |
| 13143 PropertyMember.prototype.get$requiresFieldSyntax = function() { | 13161 PropertyMember.prototype.get$requiresFieldSyntax = function() { |
| 13144 return false; | 13162 return false; |
| 13145 } | 13163 } |
| 13146 PropertyMember.prototype.provideFieldSyntax = function() { | 13164 PropertyMember.prototype.provideFieldSyntax = function() { |
| 13147 this._provideFieldSyntax = true; | 13165 this._provideFieldSyntax = true; |
| 13148 } | 13166 } |
| 13149 PropertyMember.prototype.providePropertySyntax = function() { | 13167 PropertyMember.prototype.providePropertySyntax = function() { |
| 13150 | 13168 |
| 13151 } | 13169 } |
| 13152 PropertyMember.prototype.get$isStatic = function() { | 13170 PropertyMember.prototype.get$isStatic = function() { |
| 13153 return $notnull_bool(this.getter == null) ? this.setter.isStatic : this.getter .isStatic; | 13171 return this.getter == null ? this.setter.isStatic : this.getter.isStatic; |
| 13154 } | 13172 } |
| 13155 PropertyMember.prototype.get$isProperty = function() { | 13173 PropertyMember.prototype.get$isProperty = function() { |
| 13156 return true; | 13174 return true; |
| 13157 } | 13175 } |
| 13158 PropertyMember.prototype.get$returnType = function() { | 13176 PropertyMember.prototype.get$returnType = function() { |
| 13159 return $notnull_bool(this.getter == null) ? this.setter.returnType : this.gett er.returnType; | 13177 return this.getter == null ? this.setter.returnType : this.getter.returnType; |
| 13160 } | 13178 } |
| 13161 PropertyMember.prototype.override = function(other) { | 13179 PropertyMember.prototype.override = function(other) { |
| 13162 if ($notnull_bool(!$notnull_bool(Member.prototype.override.call(this, other))) ) return false; | 13180 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false; |
| 13163 if ($notnull_bool(other.get$isProperty() || other.get$isField())) { | 13181 if ($notnull_bool(other.get$isProperty() || other.get$isField())) { |
| 13164 if ($notnull_bool(other.get$isProperty())) this.addFromParent(other); | 13182 if ($notnull_bool(other.get$isProperty())) this.addFromParent(other); |
| 13165 else this._overriddenField = other; | 13183 else this._overriddenField = other; |
| 13166 return true; | 13184 return true; |
| 13167 } | 13185 } |
| 13168 else { | 13186 else { |
| 13169 world.error('property can only override field or property', this.get$span(), other.get$span()); | 13187 world.error('property can only override field or property', this.get$span(), other.get$span()); |
| 13170 return false; | 13188 return false; |
| 13171 } | 13189 } |
| 13172 } | 13190 } |
| 13173 PropertyMember.prototype._get = function(context, node, target, isDynamic) { | 13191 PropertyMember.prototype._get = function(context, node, target, isDynamic) { |
| 13174 if ($notnull_bool(this.getter == null)) { | 13192 if (this.getter == null) { |
| 13175 if ($notnull_bool(this._overriddenField != null)) { | 13193 if (this._overriddenField != null) { |
| 13176 return this._overriddenField._get(context, node, target, isDynamic); | 13194 return this._overriddenField._get(context, node, target, isDynamic); |
| 13177 } | 13195 } |
| 13178 return target.invokeNoSuchMethod(context, ('get:' + this.name + ''), node); | 13196 return target.invokeNoSuchMethod(context, ('get:' + this.name + ''), node); |
| 13179 } | 13197 } |
| 13180 return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), false) ; | 13198 return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), false) ; |
| 13181 } | 13199 } |
| 13182 PropertyMember.prototype._set = function(context, node, target, value, isDynamic ) { | 13200 PropertyMember.prototype._set = function(context, node, target, value, isDynamic ) { |
| 13183 if ($notnull_bool(this.setter == null)) { | 13201 if (this.setter == null) { |
| 13184 if ($notnull_bool(this._overriddenField != null)) { | 13202 if (this._overriddenField != null) { |
| 13185 return this._overriddenField._set(context, node, target, value, isDynamic) ; | 13203 return this._overriddenField._set(context, node, target, value, isDynamic) ; |
| 13186 } | 13204 } |
| 13187 return target.invokeNoSuchMethod(context, ('set:' + this.name + ''), node, n ew Arguments(null, [value])); | 13205 return target.invokeNoSuchMethod(context, ('set:' + this.name + ''), node, n ew Arguments(null, [value])); |
| 13188 } | 13206 } |
| 13189 return this.setter.invoke(context, node, target, new Arguments(null, [value]), isDynamic); | 13207 return this.setter.invoke(context, node, target, new Arguments(null, [value]), isDynamic); |
| 13190 } | 13208 } |
| 13191 PropertyMember.prototype.addFromParent = function(parentMember) { | 13209 PropertyMember.prototype.addFromParent = function(parentMember) { |
| 13192 var $0; | 13210 var $0; |
| 13193 var parent; | 13211 var parent; |
| 13194 if ($notnull_bool((parentMember instanceof ConcreteMember))) { | 13212 if ((parentMember instanceof ConcreteMember)) { |
| 13195 var c = (parentMember && parentMember.is$ConcreteMember()); | 13213 var c = (parentMember && parentMember.is$ConcreteMember()); |
| 13196 parent = (($0 = c.baseMember) && $0.is$PropertyMember()); | 13214 parent = (($0 = c.baseMember) && $0.is$PropertyMember()); |
| 13197 } | 13215 } |
| 13198 else { | 13216 else { |
| 13199 parent = (parentMember && parentMember.is$PropertyMember()); | 13217 parent = (parentMember && parentMember.is$PropertyMember()); |
| 13200 } | 13218 } |
| 13201 if ($notnull_bool(this.getter == null)) this.getter = parent.getter; | 13219 if (this.getter == null) this.getter = parent.getter; |
| 13202 if ($notnull_bool(this.setter == null)) this.setter = parent.setter; | 13220 if (this.setter == null) this.setter = parent.setter; |
| 13203 } | 13221 } |
| 13204 PropertyMember.prototype.resolve = function(inType) { | 13222 PropertyMember.prototype.resolve = function(inType) { |
| 13205 if ($notnull_bool(this.getter != null)) this.getter.resolve(inType); | 13223 if (this.getter != null) this.getter.resolve(inType); |
| 13206 if ($notnull_bool(this.setter != null)) this.setter.resolve(inType); | 13224 if (this.setter != null) this.setter.resolve(inType); |
| 13207 this.get$library()._addMember(this); | 13225 this.get$library()._addMember(this); |
| 13208 } | 13226 } |
| 13209 PropertyMember.prototype._get$3 = function($0, $1, $2) { | 13227 PropertyMember.prototype._get$3 = function($0, $1, $2) { |
| 13210 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); | 13228 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); |
| 13211 } | 13229 } |
| 13212 ; | 13230 ; |
| 13213 PropertyMember.prototype._set$4 = function($0, $1, $2, $3) { | 13231 PropertyMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 13214 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); | 13232 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 13215 } | 13233 } |
| 13216 ; | 13234 ; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13309 } | 13327 } |
| 13310 ConcreteMember.prototype.resolveType = function(node, isRequired) { | 13328 ConcreteMember.prototype.resolveType = function(node, isRequired) { |
| 13311 var type = this.baseMember.resolveType(node, isRequired); | 13329 var type = this.baseMember.resolveType(node, isRequired); |
| 13312 return type.resolveTypeParams(this.declaringType); | 13330 return type.resolveTypeParams(this.declaringType); |
| 13313 } | 13331 } |
| 13314 ConcreteMember.prototype.override = function(other) { | 13332 ConcreteMember.prototype.override = function(other) { |
| 13315 return this.baseMember.override(other); | 13333 return this.baseMember.override(other); |
| 13316 } | 13334 } |
| 13317 ConcreteMember.prototype._get = function(context, node, target, isDynamic) { | 13335 ConcreteMember.prototype._get = function(context, node, target, isDynamic) { |
| 13318 var ret = this.baseMember._get(context, node, target, isDynamic); | 13336 var ret = this.baseMember._get(context, node, target, isDynamic); |
| 13319 return new Value(this.returnType, ret.code, node.span, true); | 13337 return new Value(this.get$inferredResult(), ret.code, node.span, true); |
| 13320 } | 13338 } |
| 13321 ConcreteMember.prototype._set = function(context, node, target, value, isDynamic ) { | 13339 ConcreteMember.prototype._set = function(context, node, target, value, isDynamic ) { |
| 13322 var ret = this.baseMember._set(context, node, target, value, isDynamic); | 13340 var ret = this.baseMember._set(context, node, target, value, isDynamic); |
| 13323 return new Value(this.returnType, ret.code, node.span, true); | 13341 return new Value(this.returnType, ret.code, node.span, true); |
| 13324 } | 13342 } |
| 13325 ConcreteMember.prototype.invoke = function(context, node, target, args, isDynami c) { | 13343 ConcreteMember.prototype.invoke = function(context, node, target, args, isDynami c) { |
| 13326 var ret = this.baseMember.invoke(context, node, target, args, isDynamic); | 13344 var ret = this.baseMember.invoke(context, node, target, args, isDynamic); |
| 13327 var code = ret.code; | 13345 var code = ret.code; |
| 13328 if ($notnull_bool(this.get$isConstructor())) { | 13346 if ($notnull_bool(this.get$isConstructor())) { |
| 13329 code = code.replaceFirst(this.declaringType.get$genericType().get$jsname(), this.declaringType.get$jsname()); | 13347 code = code.replaceFirst(this.declaringType.get$genericType().get$jsname(), this.declaringType.get$jsname()); |
| 13330 } | 13348 } |
| 13331 this.declaringType.genMethod(this); | 13349 this.declaringType.genMethod(this); |
| 13332 return new Value(this.returnType, code, node.span, true); | 13350 return new Value(this.get$inferredResult(), code, node.span, true); |
| 13333 } | 13351 } |
| 13334 ConcreteMember.prototype._get$3 = function($0, $1, $2) { | 13352 ConcreteMember.prototype._get$3 = function($0, $1, $2) { |
| 13335 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); | 13353 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); |
| 13336 } | 13354 } |
| 13337 ; | 13355 ; |
| 13338 ConcreteMember.prototype._set$4 = function($0, $1, $2, $3) { | 13356 ConcreteMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 13339 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); | 13357 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 13340 } | 13358 } |
| 13341 ; | 13359 ; |
| 13342 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 13360 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13385 return (this.definition.body instanceof NativeStatement); | 13403 return (this.definition.body instanceof NativeStatement); |
| 13386 } | 13404 } |
| 13387 MethodMember.prototype.get$canGet = function() { | 13405 MethodMember.prototype.get$canGet = function() { |
| 13388 return false; | 13406 return false; |
| 13389 } | 13407 } |
| 13390 MethodMember.prototype.get$canSet = function() { | 13408 MethodMember.prototype.get$canSet = function() { |
| 13391 return false; | 13409 return false; |
| 13392 } | 13410 } |
| 13393 MethodMember.prototype.get$span = function() { | 13411 MethodMember.prototype.get$span = function() { |
| 13394 var $0; | 13412 var $0; |
| 13395 return (($0 = $notnull_bool(this.definition == null) ? null : this.definition. span) && $0.is$SourceSpan()); | 13413 return (($0 = this.definition == null ? null : this.definition.span) && $0.is$ SourceSpan()); |
| 13396 } | 13414 } |
| 13397 MethodMember.prototype.get$constructorName = function() { | 13415 MethodMember.prototype.get$constructorName = function() { |
| 13398 var $0; | 13416 var $0; |
| 13399 var returnType = (($0 = this.definition.returnType) && $0.is$NameTypeReference ()); | 13417 var returnType = (($0 = this.definition.returnType) && $0.is$NameTypeReference ()); |
| 13400 if ($notnull_bool(returnType == null)) return ''; | 13418 if (returnType == null) return ''; |
| 13401 if ($notnull_bool(returnType.names != null)) { | 13419 if (returnType.names != null) { |
| 13402 return $assert_String(returnType.names.$index(0).get$name()); | 13420 return $assert_String(returnType.names.$index(0).get$name()); |
| 13403 } | 13421 } |
| 13404 else if ($notnull_bool(returnType.name != null)) { | 13422 else if (returnType.name != null) { |
| 13405 return returnType.name.name; | 13423 return returnType.name.name; |
| 13406 } | 13424 } |
| 13407 world.internalError('no valid constructor name', this.definition.span); | 13425 world.internalError('no valid constructor name', this.definition.span); |
| 13408 } | 13426 } |
| 13409 MethodMember.prototype.get$functionType = function() { | 13427 MethodMember.prototype.get$functionType = function() { |
| 13410 if ($notnull_bool(this._functionType == null)) { | 13428 if (this._functionType == null) { |
| 13411 this._functionType = this.get$library().getOrAddFunctionType(this.name, this .definition, this.declaringType); | 13429 this._functionType = this.get$library().getOrAddFunctionType(this.name, this .definition, this.declaringType); |
| 13412 if ($notnull_bool(this.parameters == null)) { | 13430 if (this.parameters == null) { |
| 13413 this.resolve(this.declaringType); | 13431 this.resolve(this.declaringType); |
| 13414 } | 13432 } |
| 13415 } | 13433 } |
| 13416 return this._functionType; | 13434 return this._functionType; |
| 13417 } | 13435 } |
| 13418 MethodMember.prototype.override = function(other) { | 13436 MethodMember.prototype.override = function(other) { |
| 13419 if ($notnull_bool(!$notnull_bool(Member.prototype.override.call(this, other))) ) return false; | 13437 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false; |
| 13420 if ($notnull_bool(other.get$isMethod())) { | 13438 if ($notnull_bool(other.get$isMethod())) { |
| 13421 return true; | 13439 return true; |
| 13422 } | 13440 } |
| 13423 else { | 13441 else { |
| 13424 world.error('method can only override methods', this.get$span(), other.get$s pan()); | 13442 world.error('method can only override methods', this.get$span(), other.get$s pan()); |
| 13425 return false; | 13443 return false; |
| 13426 } | 13444 } |
| 13427 } | 13445 } |
| 13428 MethodMember.prototype.canInvoke = function(context, args) { | 13446 MethodMember.prototype.canInvoke = function(context, args) { |
| 13429 var bareCount = args.get$bareCount(); | 13447 var bareCount = args.get$bareCount(); |
| 13430 if ($notnull_bool(bareCount > this.parameters.length)) return false; | 13448 if (bareCount > this.parameters.length) return false; |
| 13431 if ($notnull_bool(bareCount == this.parameters.length)) { | 13449 if (bareCount == this.parameters.length) { |
| 13432 if ($notnull_bool(bareCount != args.get$length())) return false; | 13450 if (bareCount != args.get$length()) return false; |
| 13433 } | 13451 } |
| 13434 else { | 13452 else { |
| 13435 if ($notnull_bool(!$notnull_bool(this.parameters.$index(bareCount).get$isOpt ional()))) return false; | 13453 if (!$notnull_bool(this.parameters.$index(bareCount).get$isOptional())) retu rn false; |
| 13436 for (var i = bareCount; | 13454 for (var i = bareCount; |
| 13437 $notnull_bool(i < args.get$length()); i++) { | 13455 i < args.get$length(); i++) { |
| 13438 if ($notnull_bool(this.indexOfParameter(args.getName(i)) < 0)) { | 13456 if (this.indexOfParameter(args.getName(i)) < 0) { |
| 13439 return false; | 13457 return false; |
| 13440 } | 13458 } |
| 13441 } | 13459 } |
| 13442 } | 13460 } |
| 13443 return true; | 13461 return true; |
| 13444 } | 13462 } |
| 13445 MethodMember.prototype.indexOfParameter = function(name) { | 13463 MethodMember.prototype.indexOfParameter = function(name) { |
| 13446 for (var i = 0; | 13464 for (var i = 0; |
| 13447 $notnull_bool(i < this.parameters.length); i++) { | 13465 i < this.parameters.length; i++) { |
| 13448 var p = this.parameters.$index(i); | 13466 var p = this.parameters.$index(i); |
| 13449 if ($notnull_bool(p.get$isOptional() && $eq(p.get$name(), name))) { | 13467 if ($notnull_bool(p.get$isOptional() && $eq(p.get$name(), name))) { |
| 13450 return i; | 13468 return i; |
| 13451 } | 13469 } |
| 13452 } | 13470 } |
| 13453 return -1; | 13471 return -1; |
| 13454 } | 13472 } |
| 13455 MethodMember.prototype.get$prefersPropertySyntax = function() { | 13473 MethodMember.prototype.get$prefersPropertySyntax = function() { |
| 13456 return true; | 13474 return true; |
| 13457 } | 13475 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 13471 this.declaringType.genMethod(this); | 13489 this.declaringType.genMethod(this); |
| 13472 this._provideOptionalParamInfo = true; | 13490 this._provideOptionalParamInfo = true; |
| 13473 if ($notnull_bool(this.isStatic)) { | 13491 if ($notnull_bool(this.isStatic)) { |
| 13474 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d eclaringType.get$jsname() + '.'); | 13492 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d eclaringType.get$jsname() + '.'); |
| 13475 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname( ) + ''), node.span, true); | 13493 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname( ) + ''), node.span, true); |
| 13476 } | 13494 } |
| 13477 this._providePropertySyntax = true; | 13495 this._providePropertySyntax = true; |
| 13478 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), node.span, true); | 13496 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), node.span, true); |
| 13479 } | 13497 } |
| 13480 MethodMember.prototype.namesInOrder = function(args) { | 13498 MethodMember.prototype.namesInOrder = function(args) { |
| 13481 if ($notnull_bool(!$notnull_bool(args.get$hasNames()))) return true; | 13499 if (!$notnull_bool(args.get$hasNames())) return true; |
| 13482 var lastParameter = null; | 13500 var lastParameter = null; |
| 13483 for (var i = args.get$bareCount(); | 13501 for (var i = args.get$bareCount(); |
| 13484 $notnull_bool(i < this.parameters.length); i++) { | 13502 i < this.parameters.length; i++) { |
| 13485 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam e())); | 13503 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam e())); |
| 13486 if ($notnull_bool(p >= 0 && args.values.$index(p).needsTemp)) { | 13504 if ($notnull_bool(p >= 0 && args.values.$index(p).needsTemp)) { |
| 13487 if ($notnull_bool(lastParameter != null && lastParameter > $assert_num(p)) ) { | 13505 if (lastParameter != null && lastParameter > $assert_num(p)) { |
| 13488 return false; | 13506 return false; |
| 13489 } | 13507 } |
| 13490 lastParameter = $assert_num(p); | 13508 lastParameter = $assert_num(p); |
| 13491 } | 13509 } |
| 13492 } | 13510 } |
| 13493 return true; | 13511 return true; |
| 13494 } | 13512 } |
| 13495 MethodMember.prototype.needsArgumentConversion = function(args) { | 13513 MethodMember.prototype.needsArgumentConversion = function(args) { |
| 13496 var $0; | 13514 var $0; |
| 13497 var bareCount = args.get$bareCount(); | 13515 var bareCount = args.get$bareCount(); |
| 13498 for (var i = 0; | 13516 for (var i = 0; |
| 13499 $notnull_bool(i < bareCount); i++) { | 13517 i < bareCount; i++) { |
| 13500 var arg = args.values.$index(i); | 13518 var arg = args.values.$index(i); |
| 13501 if ($notnull_bool(arg.needsConversion((($0 = this.parameters.$index(i).type) && $0.is$lang_Type())))) { | 13519 if ($notnull_bool(arg.needsConversion((($0 = this.parameters.$index(i).type) && $0.is$lang_Type())))) { |
| 13502 return false; | 13520 return false; |
| 13503 } | 13521 } |
| 13504 } | 13522 } |
| 13505 if ($notnull_bool(bareCount < this.parameters.length)) { | 13523 if (bareCount < this.parameters.length) { |
| 13506 this.genParameterValues(); | 13524 this.genParameterValues(); |
| 13507 for (var i = bareCount; | 13525 for (var i = bareCount; |
| 13508 $notnull_bool(i < this.parameters.length); i++) { | 13526 i < this.parameters.length; i++) { |
| 13509 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( ))); | 13527 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( ))); |
| 13510 if ($notnull_bool($ne(arg, null) && arg.needsConversion((($0 = this.parame ters.$index(i).type) && $0.is$lang_Type())))) { | 13528 if ($notnull_bool($ne(arg, null) && arg.needsConversion((($0 = this.parame ters.$index(i).type) && $0.is$lang_Type())))) { |
| 13511 return false; | 13529 return false; |
| 13512 } | 13530 } |
| 13513 } | 13531 } |
| 13514 } | 13532 } |
| 13515 return true; | 13533 return true; |
| 13516 } | 13534 } |
| 13517 MethodMember._argCountMsg = function(actual, expected, atLeast) { | 13535 MethodMember._argCountMsg = function(actual, expected, atLeast) { |
| 13518 return 'wrong number of arguments, expected ' + ('' + ($notnull_bool(atLeast) ? "at least " : "") + '' + expected + ' but found ' + actual + ''); | 13536 return 'wrong number of arguments, expected ' + ('' + ($notnull_bool(atLeast) ? "at least " : "") + '' + expected + ' but found ' + actual + ''); |
| 13519 } | 13537 } |
| 13520 MethodMember.prototype._argError = function(context, node, target, args, msg) { | 13538 MethodMember.prototype._argError = function(context, node, target, args, msg) { |
| 13521 if ($notnull_bool(this.isStatic || this.get$isConstructor())) { | 13539 if ($notnull_bool(this.isStatic || this.get$isConstructor())) { |
| 13522 world.error(msg, node.span); | 13540 world.error(msg, node.span); |
| 13523 } | 13541 } |
| 13524 else { | 13542 else { |
| 13525 world.warning(msg, node.span); | 13543 world.warning(msg, node.span); |
| 13526 } | 13544 } |
| 13527 return target.invokeNoSuchMethod(context, this.name, node, args); | 13545 return target.invokeNoSuchMethod(context, this.name, node, args); |
| 13528 } | 13546 } |
| 13529 MethodMember.prototype.genParameterValues = function() { | 13547 MethodMember.prototype.genParameterValues = function() { |
| 13530 var $list = this.parameters; | 13548 var $list = this.parameters; |
| 13531 for (var $i = 0;$i < $list.length; $i++) { | 13549 for (var $i = 0;$i < $list.length; $i++) { |
| 13532 var p = $list.$index($i); | 13550 var p = $list.$index($i); |
| 13533 p.genValue(this, this.generator); | 13551 p.genValue(this, this.generator); |
| 13534 } | 13552 } |
| 13535 } | 13553 } |
| 13536 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) { | 13554 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 13537 var $0; | 13555 var $0; |
| 13538 if ($notnull_bool(this.parameters == null)) { | 13556 if (this.parameters == null) { |
| 13539 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.' + this.name + '')); | 13557 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.' + this.name + '')); |
| 13540 this.resolve(this.declaringType); | 13558 this.resolve(this.declaringType); |
| 13541 } | 13559 } |
| 13542 this.declaringType.genMethod(this); | 13560 this.declaringType.genMethod(this); |
| 13543 if ($notnull_bool(this.isStatic || this.isFactory)) { | 13561 if ($notnull_bool(this.isStatic || this.isFactory)) { |
| 13544 this.declaringType.markUsed(); | 13562 this.declaringType.markUsed(); |
| 13545 } | 13563 } |
| 13546 if ($notnull_bool(!$notnull_bool(this.namesInOrder(args)))) { | 13564 if (!$notnull_bool(this.namesInOrder(args))) { |
| 13547 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s); | 13565 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s); |
| 13548 } | 13566 } |
| 13549 var argsCode = []; | 13567 var argsCode = []; |
| 13550 if ($notnull_bool(target != null && ($notnull_bool(this.get$isConstructor() || target.isSuper)))) { | 13568 if (target != null && ($notnull_bool(this.get$isConstructor() || target.isSupe r))) { |
| 13551 argsCode.add('this'); | 13569 argsCode.add('this'); |
| 13552 } | 13570 } |
| 13553 var bareCount = args.get$bareCount(); | 13571 var bareCount = args.get$bareCount(); |
| 13554 for (var i = 0; | 13572 for (var i = 0; |
| 13555 $notnull_bool(i < bareCount); i++) { | 13573 i < bareCount; i++) { |
| 13556 var arg = args.values.$index(i); | 13574 var arg = args.values.$index(i); |
| 13557 if ($notnull_bool(i >= this.parameters.length)) { | 13575 if (i >= this.parameters.length) { |
| 13558 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false); | 13576 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false); |
| 13559 return this._argError(context, node, target, args, $assert_String(msg)); | 13577 return this._argError(context, node, target, args, $assert_String(msg)); |
| 13560 } | 13578 } |
| 13561 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $0.is $lang_Type()), node, isDynamic); | 13579 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $0.is $lang_Type()), node, isDynamic); |
| 13562 if ($notnull_bool(this.isConst && arg.get$isConst())) { | 13580 if ($notnull_bool(this.isConst && arg.get$isConst())) { |
| 13563 argsCode.add(arg.get$canonicalCode()); | 13581 argsCode.add(arg.get$canonicalCode()); |
| 13564 } | 13582 } |
| 13565 else { | 13583 else { |
| 13566 argsCode.add(arg.code); | 13584 argsCode.add(arg.code); |
| 13567 } | 13585 } |
| 13568 } | 13586 } |
| 13569 if ($notnull_bool(bareCount < this.parameters.length)) { | 13587 if (bareCount < this.parameters.length) { |
| 13570 this.genParameterValues(); | 13588 this.genParameterValues(); |
| 13571 var namedArgsUsed = 0; | 13589 var namedArgsUsed = 0; |
| 13572 for (var i = bareCount; | 13590 for (var i = bareCount; |
| 13573 $notnull_bool(i < this.parameters.length); i++) { | 13591 i < this.parameters.length; i++) { |
| 13574 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( ))); | 13592 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( ))); |
| 13575 if ($notnull_bool(arg == null)) { | 13593 if ($notnull_bool(arg == null)) { |
| 13576 arg = this.parameters.$index(i).get$value(); | 13594 arg = this.parameters.$index(i).get$value(); |
| 13577 } | 13595 } |
| 13578 else { | 13596 else { |
| 13579 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $ 0.is$lang_Type()), node, isDynamic); | 13597 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $ 0.is$lang_Type()), node, isDynamic); |
| 13580 namedArgsUsed++; | 13598 namedArgsUsed++; |
| 13581 } | 13599 } |
| 13582 if ($notnull_bool(arg == null || !$notnull_bool(this.parameters.$index(i). get$isOptional()))) { | 13600 if ($notnull_bool(arg == null || !$notnull_bool(this.parameters.$index(i). get$isOptional()))) { |
| 13583 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + 1, true); | 13601 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + 1, true); |
| 13584 return this._argError(context, node, target, args, $assert_String(msg)); | 13602 return this._argError(context, node, target, args, $assert_String(msg)); |
| 13585 } | 13603 } |
| 13586 else { | 13604 else { |
| 13587 argsCode.add($notnull_bool(this.isConst && arg.get$isConst()) ? arg.get$ canonicalCode() : arg.code); | 13605 argsCode.add($notnull_bool(this.isConst && arg.get$isConst()) ? arg.get$ canonicalCode() : arg.code); |
| 13588 } | 13606 } |
| 13589 } | 13607 } |
| 13590 if ($notnull_bool(namedArgsUsed < args.get$nameCount())) { | 13608 if (namedArgsUsed < args.get$nameCount()) { |
| 13591 var seen = new HashSetImplementation$String(); | 13609 var seen = new HashSetImplementation$String(); |
| 13592 for (var i = bareCount; | 13610 for (var i = bareCount; |
| 13593 $notnull_bool(i < args.get$length()); i++) { | 13611 i < args.get$length(); i++) { |
| 13594 var name = args.getName(i); | 13612 var name = args.getName(i); |
| 13595 if ($notnull_bool(seen.contains(name))) { | 13613 if (seen.contains(name)) { |
| 13596 return this._argError(context, node, target, args, ('duplicate argumen t "' + name + '"')); | 13614 return this._argError(context, node, target, args, ('duplicate argumen t "' + name + '"')); |
| 13597 } | 13615 } |
| 13598 seen.add(name); | 13616 seen.add(name); |
| 13599 var p = this.indexOfParameter($assert_String(name)); | 13617 var p = this.indexOfParameter($assert_String(name)); |
| 13600 if ($notnull_bool(p < 0)) { | 13618 if (p < 0) { |
| 13601 return this._argError(context, node, target, args, ('method does not h ave optional parameter "' + name + '"')); | 13619 return this._argError(context, node, target, args, ('method does not h ave optional parameter "' + name + '"')); |
| 13602 } | 13620 } |
| 13603 else if ($notnull_bool(p < bareCount)) { | 13621 else if (p < bareCount) { |
| 13604 return this._argError(context, node, target, args, ('argument "' + nam e + '" passed as positional and named')); | 13622 return this._argError(context, node, target, args, ('argument "' + nam e + '" passed as positional and named')); |
| 13605 } | 13623 } |
| 13606 } | 13624 } |
| 13607 world.internalError(('wrong named arguments calling ' + this.name + ''), n ode.span); | 13625 world.internalError(('wrong named arguments calling ' + this.name + ''), n ode.span); |
| 13608 } | 13626 } |
| 13609 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); | 13627 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); |
| 13610 } | 13628 } |
| 13611 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); | 13629 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); |
| 13612 if ($notnull_bool(this.get$isConstructor())) { | 13630 if ($notnull_bool(this.get$isConstructor())) { |
| 13613 return this._invokeConstructor(context, node, target, args, argsString); | 13631 return this._invokeConstructor(context, node, target, args, argsString); |
| 13614 } | 13632 } |
| 13615 if ($notnull_bool(target != null && target.isSuper)) { | 13633 if ($notnull_bool(target != null && target.isSuper)) { |
| 13616 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '. prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.span, true) ; | 13634 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn ame() + '.prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.s pan, true); |
| 13617 } | 13635 } |
| 13618 if ($notnull_bool(this.name.startsWith('\$'))) { | 13636 if (this.name.startsWith('\$')) { |
| 13619 return this._invokeBuiltin(context, node, target, args, argsCode); | 13637 return this._invokeBuiltin(context, node, target, args, argsCode, isDynamic) ; |
| 13620 } | 13638 } |
| 13621 if ($notnull_bool(this.isFactory)) { | 13639 if ($notnull_bool(this.isFactory)) { |
| 13622 return new Value(this.returnType, ('' + this.get$generatedFactoryName() + '( ' + argsString + ')'), node.span, true); | 13640 return new Value(this.get$inferredResult(), ('' + this.get$generatedFactoryN ame() + '(' + argsString + ')'), node.span, true); |
| 13623 } | 13641 } |
| 13624 if ($notnull_bool(this.isStatic)) { | 13642 if ($notnull_bool(this.isStatic)) { |
| 13625 if ($notnull_bool(this.declaringType.get$isTop())) { | 13643 if ($notnull_bool(this.declaringType.get$isTop())) { |
| 13626 return new Value(this.returnType, ('' + this.get$jsname() + '(' + argsStri ng + ')'), $notnull_bool(node != null) ? node.span : node, true); | 13644 return new Value(this.get$inferredResult(), ('' + this.get$jsname() + '(' + argsString + ')'), node != null ? node.span : node, true); |
| 13627 } | 13645 } |
| 13628 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '. ' + this.get$jsname() + '(' + argsString + ')'), node.span, true); | 13646 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn ame() + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true); |
| 13629 } | 13647 } |
| 13630 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ') '); | 13648 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ') '); |
| 13631 if ($notnull_bool(target.get$isConst())) { | 13649 if ($notnull_bool(target.get$isConst())) { |
| 13632 if ($notnull_bool((target instanceof GlobalValue))) { | 13650 if ((target instanceof GlobalValue)) { |
| 13633 target = target.get$dynamic().exp; | 13651 target = target.get$dynamic().exp; |
| 13634 } | 13652 } |
| 13635 if ($notnull_bool(this.name == 'get\$length')) { | 13653 if (this.name == 'get\$length') { |
| 13636 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof ConstMapValue))) { | 13654 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) { |
| 13637 code = ('' + target.get$dynamic().values.length + ''); | 13655 code = ('' + target.get$dynamic().values.length + ''); |
| 13638 } | 13656 } |
| 13639 } | 13657 } |
| 13640 else if ($notnull_bool(this.name == 'isEmpty')) { | 13658 else if (this.name == 'isEmpty') { |
| 13641 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof ConstMapValue))) { | 13659 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) { |
| 13642 code = ('' + target.get$dynamic().values.isEmpty() + ''); | 13660 code = ('' + target.get$dynamic().values.isEmpty() + ''); |
| 13643 } | 13661 } |
| 13644 } | 13662 } |
| 13645 } | 13663 } |
| 13646 if ($notnull_bool(this.name == 'get\$typeName' && $eq(this.declaringType.get$l ibrary(), world.get$dom()))) { | 13664 if (this.name == 'get\$typeName' && $eq(this.declaringType.get$library(), worl d.get$dom())) { |
| 13647 world.gen.corejs.useTypeNameOf = true; | 13665 world.gen.corejs.useTypeNameOf = true; |
| 13648 } | 13666 } |
| 13649 return new Value(this.returnType, code, node.span, true); | 13667 return new Value(this.get$inferredResult(), code, node.span, true); |
| 13650 } | 13668 } |
| 13651 MethodMember.prototype._invokeConstructor = function(context, node, target, args , argsString) { | 13669 MethodMember.prototype._invokeConstructor = function(context, node, target, args , argsString) { |
| 13652 this.declaringType.markUsed(); | 13670 this.declaringType.markUsed(); |
| 13653 if ($notnull_bool(target != null)) { | 13671 if (target != null) { |
| 13654 var code = $notnull_bool((this.get$constructorName() != '')) ? ('' + this.de claringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + a rgsString + ')') : ('' + this.declaringType.get$jsname() + '.call(' + argsString + ')'); | 13672 var code = (this.get$constructorName() != '') ? ('' + this.declaringType.get $jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + argsString + ')' ) : ('' + this.declaringType.get$jsname() + '.call(' + argsString + ')'); |
| 13655 return new Value(this.declaringType, code, node.span, true); | 13673 return new Value(this.declaringType, code, node.span, true); |
| 13656 } | 13674 } |
| 13657 else { | 13675 else { |
| 13658 var code = $notnull_bool((this.get$constructorName() != '')) ? ('new ' + thi s.declaringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + ar gsString + ')') : ('new ' + this.declaringType.get$jsname() + '(' + argsString + ')'); | 13676 var code = (this.get$constructorName() != '') ? ('new ' + this.declaringType .get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + argsString + ')') : ('new ' + this.declaringType.get$jsname() + '(' + argsString + ')'); |
| 13659 if ($notnull_bool(this.isConst && (node instanceof lang_NewExpression)) && n ode.get$dynamic().get$isConst()) { | 13677 if ($notnull_bool($notnull_bool(this.isConst && (node instanceof lang_NewExp ression)) && node.get$dynamic().get$isConst())) { |
| 13660 return this._invokeConstConstructor(node, $assert_String(code), target, ar gs); | 13678 return this._invokeConstConstructor(node, $assert_String(code), target, ar gs); |
| 13661 } | 13679 } |
| 13662 else { | 13680 else { |
| 13663 return new Value(this.declaringType, code, node.span, true); | 13681 return new Value(this.declaringType, code, node.span, true); |
| 13664 } | 13682 } |
| 13665 } | 13683 } |
| 13666 } | 13684 } |
| 13667 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar gs) { | 13685 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar gs) { |
| 13668 var $0; | 13686 var $0; |
| 13669 var fields = new HashMapImplementation$String$EvaluatedValue(); | 13687 var fields = new HashMapImplementation$String$EvaluatedValue(); |
| 13670 for (var i = 0; | 13688 for (var i = 0; |
| 13671 $notnull_bool(i < this.parameters.length); i++) { | 13689 i < this.parameters.length; i++) { |
| 13672 var param = this.parameters.$index(i); | 13690 var param = this.parameters.$index(i); |
| 13673 if ($notnull_bool(param.isInitializer)) { | 13691 if ($notnull_bool(param.isInitializer)) { |
| 13674 var value = null; | 13692 var value = null; |
| 13675 if ($notnull_bool(i < args.get$length())) { | 13693 if (i < args.get$length()) { |
| 13676 value = args.values.$index(i); | 13694 value = args.values.$index(i); |
| 13677 } | 13695 } |
| 13678 else { | 13696 else { |
| 13679 value = args.getValue($assert_String(param.get$name())); | 13697 value = args.getValue($assert_String(param.get$name())); |
| 13680 if ($notnull_bool(value == null)) { | 13698 if ($notnull_bool(value == null)) { |
| 13681 value = param.get$value(); | 13699 value = param.get$value(); |
| 13682 } | 13700 } |
| 13683 } | 13701 } |
| 13684 fields.$setindex(param.get$name(), value); | 13702 fields.$setindex(param.get$name(), value); |
| 13685 } | 13703 } |
| 13686 } | 13704 } |
| 13687 if ($notnull_bool(this.definition.initializers != null)) { | 13705 if (this.definition.initializers != null) { |
| 13688 this.generator._pushBlock(false); | 13706 this.generator._pushBlock(false); |
| 13689 for (var j = 0; | 13707 for (var j = 0; |
| 13690 $notnull_bool(j < this.definition.formals.length); j++) { | 13708 j < this.definition.formals.length; j++) { |
| 13691 var name = this.definition.formals.$index(j).get$name().get$name(); | 13709 var name = this.definition.formals.$index(j).get$name().get$name(); |
| 13692 var value = null; | 13710 var value = null; |
| 13693 if ($notnull_bool(j < args.get$length())) { | 13711 if (j < args.get$length()) { |
| 13694 value = args.values.$index(j); | 13712 value = args.values.$index(j); |
| 13695 } | 13713 } |
| 13696 else { | 13714 else { |
| 13697 value = args.getValue($assert_String(this.parameters.$index(j).get$name( ))); | 13715 value = args.getValue($assert_String(this.parameters.$index(j).get$name( ))); |
| 13698 if ($notnull_bool(value == null)) { | 13716 if ($notnull_bool(value == null)) { |
| 13699 value = this.parameters.$index(j).get$value(); | 13717 value = this.parameters.$index(j).get$value(); |
| 13700 } | 13718 } |
| 13701 } | 13719 } |
| 13702 this.generator._scope._vars.$setindex(name, value); | 13720 this.generator._scope._vars.$setindex(name, value); |
| 13703 } | 13721 } |
| 13704 var $list = this.definition.initializers; | 13722 var $list = this.definition.initializers; |
| 13705 for (var $i = 0;$i < $list.length; $i++) { | 13723 for (var $i = 0;$i < $list.length; $i++) { |
| 13706 var init = $list.$index($i); | 13724 var init = $list.$index($i); |
| 13707 if ($notnull_bool((init instanceof CallExpression))) { | 13725 if ((init instanceof CallExpression)) { |
| 13708 var delegateArgs = this.generator._makeArgs((($0 = init.get$arguments()) && $0.is$List$ArgumentNode())); | 13726 var delegateArgs = this.generator._makeArgs((($0 = init.get$arguments()) && $0.is$List$ArgumentNode())); |
| 13709 var value = this.initDelegate.invoke(this.generator, node, target, deleg ateArgs, false); | 13727 var value = this.initDelegate.invoke(this.generator, node, target, deleg ateArgs, false); |
| 13710 if ($notnull_bool((init.target instanceof ThisExpression))) { | 13728 if ((init.target instanceof ThisExpression)) { |
| 13711 return (value && value.is$Value()); | 13729 return (value && value.is$Value()); |
| 13712 } | 13730 } |
| 13713 else { | 13731 else { |
| 13714 if ($notnull_bool((value instanceof GlobalValue))) { | 13732 if ((value instanceof GlobalValue)) { |
| 13715 value = value.exp; | 13733 value = value.exp; |
| 13716 } | 13734 } |
| 13717 var $list0 = value.fields.getKeys(); | 13735 var $list0 = value.fields.getKeys(); |
| 13718 for (var $i0 = value.fields.getKeys().iterator(); $i0.hasNext(); ) { | 13736 for (var $i0 = value.fields.getKeys().iterator(); $i0.hasNext(); ) { |
| 13719 var fname = $i0.next(); | 13737 var fname = $i0.next(); |
| 13720 fields.$setindex(fname, value.fields.$index(fname)); | 13738 fields.$setindex(fname, value.fields.$index(fname)); |
| 13721 } | 13739 } |
| 13722 } | 13740 } |
| 13723 } | 13741 } |
| 13724 else { | 13742 else { |
| 13725 var assign = (init && init.is$BinaryExpression()); | 13743 var assign = (init && init.is$BinaryExpression()); |
| 13726 var x = (($0 = assign.x) && $0.is$VarExpression()); | 13744 var x = (($0 = assign.x) && $0.is$VarExpression()); |
| 13727 var fname = x.name.name; | 13745 var fname = x.name.name; |
| 13728 var val = this.generator.visitValue(assign.y); | 13746 var val = this.generator.visitValue(assign.y); |
| 13729 fields.$setindex(fname, val); | 13747 fields.$setindex(fname, val); |
| 13730 } | 13748 } |
| 13731 } | 13749 } |
| 13732 this.generator._popBlock(); | 13750 this.generator._popBlock(); |
| 13733 } | 13751 } |
| 13734 var $list = this.declaringType.get$members().getValues(); | 13752 var $list = this.declaringType.get$members().getValues(); |
| 13735 for (var $i = this.declaringType.get$members().getValues().iterator(); $i.hasN ext(); ) { | 13753 for (var $i = this.declaringType.get$members().getValues().iterator(); $i.hasN ext(); ) { |
| 13736 var f = $i.next(); | 13754 var f = $i.next(); |
| 13737 if ($notnull_bool((f instanceof FieldMember) && !$notnull_bool(f.get$isStati c())) && $ne(f.get$value(), null) && !$notnull_bool(fields.containsKey(f.get$nam e()))) { | 13755 if ($notnull_bool((f instanceof FieldMember) && !$notnull_bool(f.get$isStati c()) && $ne(f.get$value(), null)) && !fields.containsKey(f.get$name())) { |
| 13738 fields.$setindex(f.get$name(), f.computeValue()); | 13756 fields.$setindex(f.get$name(), f.computeValue()); |
| 13739 } | 13757 } |
| 13740 } | 13758 } |
| 13741 return world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(this .declaringType, fields, code, node.span), args.values); | 13759 return world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(this .declaringType, fields, code, node.span), args.values); |
| 13742 } | 13760 } |
| 13743 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar gsCode) { | 13761 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar gsCode, isDynamic) { |
| 13744 var allConst = $notnull_bool(target.get$isConst() && args.values.every((functi on (arg) { | 13762 var allConst = $notnull_bool(target.get$isConst() && args.values.every((functi on (arg) { |
| 13745 return arg.get$isConst(); | 13763 return arg.get$isConst(); |
| 13746 }) | 13764 }) |
| 13747 )); | 13765 )); |
| 13748 if ($notnull_bool(this.declaringType.get$isNum())) { | 13766 if ($notnull_bool(this.declaringType.get$isNum())) { |
| 13749 if ($notnull_bool(!$notnull_bool(allConst))) { | 13767 if (!$notnull_bool(allConst)) { |
| 13750 var code; | 13768 var code; |
| 13751 if ($notnull_bool(this.name == '\$negate')) { | 13769 if (this.name == '\$negate') { |
| 13752 code = ('-' + target.code + ''); | 13770 code = ('-' + target.code + ''); |
| 13753 } | 13771 } |
| 13754 else if ($notnull_bool(this.name == '\$bit_not')) { | 13772 else if (this.name == '\$bit_not') { |
| 13755 code = ('~' + target.code + ''); | 13773 code = ('~' + target.code + ''); |
| 13756 } | 13774 } |
| 13757 else if ($notnull_bool(this.name == '\$truncdiv' || this.name == '\$mod')) { | 13775 else if (this.name == '\$truncdiv' || this.name == '\$mod') { |
| 13758 world.gen.corejs.useOperator(this.name); | 13776 world.gen.corejs.useOperator(this.name); |
| 13759 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) + ')'); | 13777 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) + ')'); |
| 13760 } | 13778 } |
| 13761 else { | 13779 else { |
| 13762 var op = TokenKind.rawOperatorFromMethod(this.name); | 13780 var op = TokenKind.rawOperatorFromMethod(this.name); |
| 13763 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''); | 13781 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''); |
| 13764 } | 13782 } |
| 13765 return new Value(this.returnType, code, node.span, true); | 13783 return new Value(this.get$inferredResult(), code, node.span, true); |
| 13766 } | 13784 } |
| 13767 else { | 13785 else { |
| 13768 var value; | 13786 var value; |
| 13769 var val0, val1, ival0, ival1; | 13787 var val0, val1, ival0, ival1; |
| 13770 val0 = $assert_num(target.get$dynamic().get$actualValue()); | 13788 val0 = $assert_num(target.get$dynamic().get$actualValue()); |
| 13771 ival0 = val0.toInt(); | 13789 ival0 = val0.toInt(); |
| 13772 if ($notnull_bool(args.values.length > 0)) { | 13790 if (args.values.length > 0) { |
| 13773 val1 = $assert_num(args.values.$index(0).get$dynamic().get$actualValue() ); | 13791 val1 = $assert_num(args.values.$index(0).get$dynamic().get$actualValue() ); |
| 13774 ival1 = val1.toInt(); | 13792 ival1 = val1.toInt(); |
| 13775 } | 13793 } |
| 13776 switch (this.name) { | 13794 switch (this.name) { |
| 13777 case '\$negate': | 13795 case '\$negate': |
| 13778 | 13796 |
| 13779 value = -val0; | 13797 value = -val0; |
| 13780 break; | 13798 break; |
| 13781 | 13799 |
| 13782 case '\$add': | 13800 case '\$add': |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13868 | 13886 |
| 13869 value = (ival0 >> ival1).toDouble(); | 13887 value = (ival0 >> ival1).toDouble(); |
| 13870 break; | 13888 break; |
| 13871 | 13889 |
| 13872 case '\$shr': | 13890 case '\$shr': |
| 13873 | 13891 |
| 13874 value = (ival0 >>> ival1).toDouble(); | 13892 value = (ival0 >>> ival1).toDouble(); |
| 13875 break; | 13893 break; |
| 13876 | 13894 |
| 13877 } | 13895 } |
| 13878 return EvaluatedValue.EvaluatedValue$factory(this.returnType, value, ("" + value + ""), node.span); | 13896 return EvaluatedValue.EvaluatedValue$factory(this.get$inferredResult(), va lue, ("" + value + ""), node.span); |
| 13879 } | 13897 } |
| 13880 } | 13898 } |
| 13881 else if ($notnull_bool(this.declaringType.get$isString())) { | 13899 else if ($notnull_bool(this.declaringType.get$isString())) { |
| 13882 if ($notnull_bool(this.name == '\$index')) { | 13900 if (this.name == '\$index') { |
| 13883 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i ndex(0) + ']'), node.span, true); | 13901 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i ndex(0) + ']'), node.span, true); |
| 13884 } | 13902 } |
| 13885 else if ($notnull_bool(this.name == '\$add')) { | 13903 else if (this.name == '\$add') { |
| 13886 if ($notnull_bool(allConst)) { | 13904 if ($notnull_bool(allConst)) { |
| 13887 var val0 = target.get$dynamic().get$actualValue(); | 13905 var val0 = target.get$dynamic().get$actualValue(); |
| 13888 val0 = val0.substring(1, val0.length - 1); | 13906 val0 = val0.substring(1, val0.length - 1); |
| 13889 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); | 13907 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); |
| 13890 if ($notnull_bool(args.values.$index(0).type.get$isString())) { | 13908 if ($notnull_bool(args.values.$index(0).type.get$isString())) { |
| 13891 val1 = val1.substring(1, val1.length - 1); | 13909 val1 = val1.substring(1, val1.length - 1); |
| 13892 } | 13910 } |
| 13893 var value = ('' + val0 + '' + val1 + ''); | 13911 var value = ('' + val0 + '' + val1 + ''); |
| 13894 value = '"' + value.replaceAll('"', '\\"') + '"'; | 13912 value = '"' + value.replaceAll('"', '\\"') + '"'; |
| 13895 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, $a ssert_String(value), node.span); | 13913 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, $a ssert_String(value), node.span); |
| 13896 } | 13914 } |
| 13897 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM PTY()); | 13915 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM PTY()); |
| 13898 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode. $index(0) + ''), node.span, true); | 13916 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode. $index(0) + ''), node.span, true); |
| 13899 } | 13917 } |
| 13900 } | 13918 } |
| 13901 else if ($notnull_bool(this.declaringType.get$isNativeType())) { | 13919 else if ($notnull_bool(this.declaringType.get$isNativeType())) { |
| 13902 if ($notnull_bool(this.name == '\$index')) { | 13920 if (this.name == '\$index') { |
| 13903 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde x(0) + ']'), node.span, true); | 13921 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde x(0) + ']'), node.span, true); |
| 13904 } | 13922 } |
| 13905 else if ($notnull_bool(this.name == '\$setindex')) { | 13923 else if (this.name == '\$setindex') { |
| 13906 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde x(0) + '] = ' + argsCode.$index(1) + ''), node.span, true); | 13924 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde x(0) + '] = ' + argsCode.$index(1) + ''), node.span, true); |
| 13907 } | 13925 } |
| 13908 } | 13926 } |
| 13909 if ($notnull_bool(this.name == '\$eq' || this.name == '\$ne')) { | 13927 if (this.name == '\$eq' || this.name == '\$ne') { |
| 13910 var op = $notnull_bool(this.name == '\$eq') ? '==' : '!='; | 13928 var op = this.name == '\$eq' ? '==' : '!='; |
| 13929 if (this.name == '\$ne') { | |
| 13930 target.invoke(context, '\$eq', node, args, isDynamic); | |
| 13931 } | |
| 13911 if ($notnull_bool(allConst)) { | 13932 if ($notnull_bool(allConst)) { |
| 13912 var val0 = target.get$dynamic().get$actualValue(); | 13933 var val0 = target.get$dynamic().get$actualValue(); |
| 13913 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); | 13934 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); |
| 13914 var newVal = $notnull_bool(this.name == '\$eq') ? $eq(val0, val1) : $ne(va l0, val1); | 13935 var newVal = this.name == '\$eq' ? $eq(val0, val1) : $ne(val0, val1); |
| 13915 return EvaluatedValue.EvaluatedValue$factory(world.boolType, newVal, ("" + newVal + ""), node.span); | 13936 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, newVal, (" " + newVal + ""), node.span); |
| 13916 } | 13937 } |
| 13917 if ($notnull_bool($eq(argsCode.$index(0), 'null'))) { | 13938 if ($notnull_bool($eq(argsCode.$index(0), 'null'))) { |
| 13918 return new Value(this.returnType, ('' + target.code + ' ' + op + ' null'), node.span, true); | 13939 return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op + ' null'), node.span, true); |
| 13919 } | 13940 } |
| 13920 else if ($notnull_bool(target.type.get$isNum() || target.type.get$isString() )) { | 13941 else if ($notnull_bool(target.type.get$isNum() || target.type.get$isString() )) { |
| 13921 return new Value(this.returnType, ('' + target.code + ' ' + op + ' ' + arg sCode.$index(0) + ''), node.span, true); | 13942 return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''), node.span, true); |
| 13922 } | 13943 } |
| 13923 world.gen.corejs.useOperator(this.name); | 13944 world.gen.corejs.useOperator(this.name); |
| 13924 return new Value(this.returnType, ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) + ')'), node.span, true); | 13945 return new Value(this.get$inferredResult(), ('' + this.name + '(' + target.c ode + ', ' + argsCode.$index(0) + ')'), node.span, true); |
| 13925 } | 13946 } |
| 13926 if ($notnull_bool(this.name == '\$call')) { | 13947 if (this.name == '\$call') { |
| 13927 this.declaringType.markUsed(); | 13948 this.declaringType.markUsed(); |
| 13928 return new Value(this.returnType, ('' + target.code + '(' + Strings.join((ar gsCode && argsCode.is$List$String()), ", ") + ')'), node.span, true); | 13949 return new Value(this.get$inferredResult(), ('' + target.code + '(' + String s.join((argsCode && argsCode.is$List$String()), ", ") + ')'), node.span, true); |
| 13929 } | 13950 } |
| 13930 if ($notnull_bool(this.name == '\$index')) { | 13951 if (this.name == '\$index') { |
| 13931 world.gen.corejs.useIndex = true; | 13952 world.gen.corejs.useIndex = true; |
| 13932 } | 13953 } |
| 13933 else if ($notnull_bool(this.name == '\$setindex')) { | 13954 else if (this.name == '\$setindex') { |
| 13934 world.gen.corejs.useSetIndex = true; | 13955 world.gen.corejs.useSetIndex = true; |
| 13935 } | 13956 } |
| 13936 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); | 13957 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); |
| 13937 return new Value(this.returnType, ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true); | 13958 return new Value(this.get$inferredResult(), ('' + target.code + '.' + this.get $jsname() + '(' + argsString + ')'), node.span, true); |
| 13938 } | 13959 } |
| 13939 MethodMember.prototype.resolve = function(inType) { | 13960 MethodMember.prototype.resolve = function(inType) { |
| 13940 this.isStatic = inType.get$isTop(); | 13961 this.isStatic = inType.get$isTop(); |
| 13941 this.isConst = false; | 13962 this.isConst = false; |
| 13942 this.isFactory = false; | 13963 this.isFactory = false; |
| 13943 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass()); | 13964 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass()); |
| 13944 if ($notnull_bool(this.definition.modifiers != null)) { | 13965 if (this.definition.modifiers != null) { |
| 13945 var $list = this.definition.modifiers; | 13966 var $list = this.definition.modifiers; |
| 13946 for (var $i = 0;$i < $list.length; $i++) { | 13967 for (var $i = 0;$i < $list.length; $i++) { |
| 13947 var mod = $list.$index($i); | 13968 var mod = $list.$index($i); |
| 13948 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { | 13969 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { |
| 13949 if ($notnull_bool(this.isStatic)) { | 13970 if ($notnull_bool(this.isStatic)) { |
| 13950 world.error('duplicate static modifier', mod.get$span()); | 13971 world.error('duplicate static modifier', mod.get$span()); |
| 13951 } | 13972 } |
| 13952 this.isStatic = true; | 13973 this.isStatic = true; |
| 13953 } | 13974 } |
| 13954 else if ($notnull_bool(this.get$isConstructor() && $eq(mod.kind, 91/*Token Kind.CONST*/))) { | 13975 else if ($notnull_bool(this.get$isConstructor() && $eq(mod.kind, 91/*Token Kind.CONST*/))) { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 13975 this.isAbstract = true; | 13996 this.isAbstract = true; |
| 13976 } | 13997 } |
| 13977 else { | 13998 else { |
| 13978 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span ()); | 13999 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span ()); |
| 13979 } | 14000 } |
| 13980 } | 14001 } |
| 13981 } | 14002 } |
| 13982 if ($notnull_bool(this.isFactory)) { | 14003 if ($notnull_bool(this.isFactory)) { |
| 13983 this.isStatic = true; | 14004 this.isStatic = true; |
| 13984 } | 14005 } |
| 13985 if ($notnull_bool(this.name.startsWith('\$') && !$notnull_bool(this.name.start sWith('\$call'))) && this.isStatic) { | 14006 if ($notnull_bool(this.name.startsWith('\$') && !this.name.startsWith('\$call' ) && this.isStatic)) { |
| 13986 world.error(('operator method may not be static "' + this.name + '"'), this. get$span()); | 14007 world.error(('operator method may not be static "' + this.name + '"'), this. get$span()); |
| 13987 } | 14008 } |
| 13988 if ($notnull_bool(this.isAbstract)) { | 14009 if ($notnull_bool(this.isAbstract)) { |
| 13989 if ($notnull_bool(this.definition.body != null && !(this.declaringType.get$d efinition() instanceof FunctionTypeDefinition))) { | 14010 if (this.definition.body != null && !(this.declaringType.get$definition() in stanceof FunctionTypeDefinition)) { |
| 13990 world.error('abstract method can not have a body', this.get$span()); | 14011 world.error('abstract method can not have a body', this.get$span()); |
| 13991 } | 14012 } |
| 13992 if ($notnull_bool(this.isStatic && !(this.declaringType.get$definition() ins tanceof FunctionTypeDefinition))) { | 14013 if ($notnull_bool(this.isStatic && !(this.declaringType.get$definition() ins tanceof FunctionTypeDefinition))) { |
| 13993 world.error('static method can not be abstract', this.get$span()); | 14014 world.error('static method can not be abstract', this.get$span()); |
| 13994 } | 14015 } |
| 13995 } | 14016 } |
| 13996 else { | 14017 else { |
| 13997 if ($notnull_bool(this.definition.body == null && !$notnull_bool(this.get$is Constructor()))) { | 14018 if (this.definition.body == null && !$notnull_bool(this.get$isConstructor()) ) { |
| 13998 world.error('method needs a body', this.get$span()); | 14019 world.error('method needs a body', this.get$span()); |
| 13999 } | 14020 } |
| 14000 } | 14021 } |
| 14001 if ($notnull_bool(this.get$isConstructor())) { | 14022 if ($notnull_bool(this.get$isConstructor())) { |
| 14002 this.returnType = this.declaringType; | 14023 this.returnType = this.declaringType; |
| 14003 } | 14024 } |
| 14004 else { | 14025 else { |
| 14005 this.returnType = inType.resolveType(this.definition.returnType, false); | 14026 this.returnType = inType.resolveType(this.definition.returnType, false); |
| 14006 if ($notnull_bool(this.isStatic && this.returnType.get$hasTypeParams())) { | 14027 if ($notnull_bool(this.isStatic && this.returnType.get$hasTypeParams())) { |
| 14007 world.error('using type parameter in static context', this.definition.retu rnType.span); | 14028 world.error('using type parameter in static context', this.definition.retu rnType.span); |
| 14008 } | 14029 } |
| 14009 } | 14030 } |
| 14010 this.parameters = []; | 14031 this.parameters = []; |
| 14011 var $list = this.definition.formals; | 14032 var $list = this.definition.formals; |
| 14012 for (var $i = 0;$i < $list.length; $i++) { | 14033 for (var $i = 0;$i < $list.length; $i++) { |
| 14013 var formal = $list.$index($i); | 14034 var formal = $list.$index($i); |
| 14014 var param = new Parameter(formal); | 14035 var param = new Parameter(formal); |
| 14015 param.resolve(this, inType); | 14036 param.resolve(this, inType); |
| 14016 this.parameters.add(param); | 14037 this.parameters.add(param); |
| 14017 } | 14038 } |
| 14018 if ($notnull_bool(!$notnull_bool(this.isLambda))) { | 14039 if (!$notnull_bool(this.isLambda)) { |
| 14019 this.get$library()._addMember(this); | 14040 this.get$library()._addMember(this); |
| 14020 } | 14041 } |
| 14021 } | 14042 } |
| 14022 MethodMember.prototype._get$3 = function($0, $1, $2) { | 14043 MethodMember.prototype._get$3 = function($0, $1, $2) { |
| 14023 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); | 14044 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); |
| 14024 } | 14045 } |
| 14025 ; | 14046 ; |
| 14026 MethodMember.prototype._set$4 = function($0, $1, $2, $3) { | 14047 MethodMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 14027 return this._set(($0 && $0.is$MethodGenerator()), $1, ($2 && $2.is$Value()), ( $3 && $3.is$Value()), false); | 14048 return this._set(($0 && $0.is$MethodGenerator()), $1, ($2 && $2.is$Value()), ( $3 && $3.is$Value()), false); |
| 14028 } | 14049 } |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 14057 MemberSet.prototype.get$isStatic = function() { | 14078 MemberSet.prototype.get$isStatic = function() { |
| 14058 return $notnull_bool(this.members.length == 1 && this.members.$index(0).get$is Static()); | 14079 return $notnull_bool(this.members.length == 1 && this.members.$index(0).get$is Static()); |
| 14059 } | 14080 } |
| 14060 MemberSet.prototype.canInvoke = function(context, args) { | 14081 MemberSet.prototype.canInvoke = function(context, args) { |
| 14061 return this.members.some((function (m) { | 14082 return this.members.some((function (m) { |
| 14062 return m.canInvoke(context, args); | 14083 return m.canInvoke(context, args); |
| 14063 }) | 14084 }) |
| 14064 ); | 14085 ); |
| 14065 } | 14086 } |
| 14066 MemberSet.prototype._makeError = function(node, target, action) { | 14087 MemberSet.prototype._makeError = function(node, target, action) { |
| 14067 if ($notnull_bool(!$notnull_bool(target.type.get$isVar()))) { | 14088 if (!$notnull_bool(target.type.get$isVar())) { |
| 14068 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span); | 14089 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span); |
| 14069 } | 14090 } |
| 14070 return new Value(world.varType, ('' + target.code + '.' + this.jsname + '() /* no applicable ' + action + '*/'), node.span, true); | 14091 return new Value(world.varType, ('' + target.code + '.' + this.jsname + '() /* no applicable ' + action + '*/'), node.span, true); |
| 14071 } | 14092 } |
| 14072 MemberSet.prototype.get$treatAsField = function() { | 14093 MemberSet.prototype.get$treatAsField = function() { |
| 14073 if ($notnull_bool(this._treatAsField == null)) { | 14094 if (this._treatAsField == null) { |
| 14074 this._treatAsField = true; | 14095 this._treatAsField = true; |
| 14075 var $list = this.members; | 14096 var $list = this.members; |
| 14076 for (var $i = 0;$i < $list.length; $i++) { | 14097 for (var $i = 0;$i < $list.length; $i++) { |
| 14077 var member = $list.$index($i); | 14098 var member = $list.$index($i); |
| 14078 if ($notnull_bool(member.get$requiresFieldSyntax())) { | 14099 if ($notnull_bool(member.get$requiresFieldSyntax())) { |
| 14079 this._treatAsField = true; | 14100 this._treatAsField = true; |
| 14080 break; | 14101 break; |
| 14081 } | 14102 } |
| 14082 if ($notnull_bool(member.get$prefersPropertySyntax())) { | 14103 if ($notnull_bool(member.get$prefersPropertySyntax())) { |
| 14083 this._treatAsField = false; | 14104 this._treatAsField = false; |
| 14084 } | 14105 } |
| 14085 } | 14106 } |
| 14086 var $list = this.members; | 14107 var $list = this.members; |
| 14087 for (var $i = 0;$i < $list.length; $i++) { | 14108 for (var $i = 0;$i < $list.length; $i++) { |
| 14088 var member = $list.$index($i); | 14109 var member = $list.$index($i); |
| 14089 if ($notnull_bool(this._treatAsField)) { | 14110 if ($notnull_bool(this._treatAsField)) { |
| 14090 member.provideFieldSyntax(); | 14111 member.provideFieldSyntax(); |
| 14091 } | 14112 } |
| 14092 else { | 14113 else { |
| 14093 member.providePropertySyntax(); | 14114 member.providePropertySyntax(); |
| 14094 } | 14115 } |
| 14095 } | 14116 } |
| 14096 } | 14117 } |
| 14097 return this._treatAsField; | 14118 return this._treatAsField; |
| 14098 } | 14119 } |
| 14099 MemberSet.prototype._get = function(context, node, target, isDynamic) { | 14120 MemberSet.prototype._get = function(context, node, target, isDynamic) { |
| 14100 if ($notnull_bool(this.members.length == 1)) { | 14121 if (this.members.length == 1) { |
| 14101 return this.members.$index(0)._get(context, node, target, isDynamic); | 14122 return this.members.$index(0)._get(context, node, target, isDynamic); |
| 14102 } | 14123 } |
| 14103 var targets = this.members.filter((function (m) { | 14124 var targets = this.members.filter((function (m) { |
| 14104 return m.get$canGet(); | 14125 return m.get$canGet(); |
| 14105 }) | 14126 }) |
| 14106 ); | 14127 ); |
| 14107 if ($notnull_bool(targets.length == 1)) { | 14128 if (targets.length == 1) { |
| 14108 return targets.$index(0)._get(context, node, target, isDynamic); | 14129 return targets.$index(0)._get(context, node, target, isDynamic); |
| 14109 } | 14130 } |
| 14110 var returnValue = null; | 14131 var returnValue = null; |
| 14111 for (var $i = targets.iterator(); $i.hasNext(); ) { | 14132 for (var $i = targets.iterator(); $i.hasNext(); ) { |
| 14112 var member = $i.next(); | 14133 var member = $i.next(); |
| 14113 var value = member._get(context, node, target, true); | 14134 var value = member._get(context, node, target, true); |
| 14114 returnValue = this._tryUnion(returnValue, value, node); | 14135 returnValue = this._tryUnion(returnValue, value, node); |
| 14115 } | 14136 } |
| 14116 if ($notnull_bool(returnValue == null)) { | 14137 if (returnValue == null) { |
| 14117 return this._makeError(node, target, 'getter'); | 14138 return this._makeError(node, target, 'getter'); |
| 14118 } | 14139 } |
| 14119 if ($notnull_bool(returnValue.code == null)) { | 14140 if (returnValue.code == null) { |
| 14120 if ($notnull_bool(this.get$treatAsField())) { | 14141 if ($notnull_bool(this.get$treatAsField())) { |
| 14121 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ''), node.span, true); | 14142 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ''), node.span, true); |
| 14122 } | 14143 } |
| 14123 else { | 14144 else { |
| 14124 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn ame + '()'), node.span, true); | 14145 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn ame + '()'), node.span, true); |
| 14125 } | 14146 } |
| 14126 } | 14147 } |
| 14127 return returnValue; | 14148 return returnValue; |
| 14128 } | 14149 } |
| 14129 MemberSet.prototype._set = function(context, node, target, value, isDynamic) { | 14150 MemberSet.prototype._set = function(context, node, target, value, isDynamic) { |
| 14130 if ($notnull_bool(this.members.length == 1)) { | 14151 if (this.members.length == 1) { |
| 14131 return this.members.$index(0)._set(context, node, target, value, isDynamic); | 14152 return this.members.$index(0)._set(context, node, target, value, isDynamic); |
| 14132 } | 14153 } |
| 14133 var targets = this.members.filter((function (m) { | 14154 var targets = this.members.filter((function (m) { |
| 14134 return m.get$canSet(); | 14155 return m.get$canSet(); |
| 14135 }) | 14156 }) |
| 14136 ); | 14157 ); |
| 14137 if ($notnull_bool(targets.length == 1)) { | 14158 if (targets.length == 1) { |
| 14138 return targets.$index(0)._set(context, node, target, value, isDynamic); | 14159 return targets.$index(0)._set(context, node, target, value, isDynamic); |
| 14139 } | 14160 } |
| 14140 var returnValue = null; | 14161 var returnValue = null; |
| 14141 for (var $i = targets.iterator(); $i.hasNext(); ) { | 14162 for (var $i = targets.iterator(); $i.hasNext(); ) { |
| 14142 var member = $i.next(); | 14163 var member = $i.next(); |
| 14143 var res = member._set(context, node, target, value, true); | 14164 var res = member._set(context, node, target, value, true); |
| 14144 returnValue = this._tryUnion(returnValue, res, node); | 14165 returnValue = this._tryUnion(returnValue, res, node); |
| 14145 } | 14166 } |
| 14146 if ($notnull_bool(returnValue == null)) { | 14167 if (returnValue == null) { |
| 14147 return this._makeError(node, target, 'setter'); | 14168 return this._makeError(node, target, 'setter'); |
| 14148 } | 14169 } |
| 14149 if ($notnull_bool(returnValue.code == null)) { | 14170 if (returnValue.code == null) { |
| 14150 if ($notnull_bool(this.get$treatAsField())) { | 14171 if ($notnull_bool(this.get$treatAsField())) { |
| 14151 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ' = ' + value.code + ''), node.span, true); | 14172 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ' = ' + value.code + ''), node.span, true); |
| 14152 } | 14173 } |
| 14153 else { | 14174 else { |
| 14154 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn ame + '(' + value.code + ')'), node.span, true); | 14175 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn ame + '(' + value.code + ')'), node.span, true); |
| 14155 } | 14176 } |
| 14156 } | 14177 } |
| 14157 return returnValue; | 14178 return returnValue; |
| 14158 } | 14179 } |
| 14159 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { | 14180 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 14160 if ($notnull_bool(this.members.length == 1)) { | 14181 if (this.members.length == 1) { |
| 14161 return this.members.$index(0).invoke(context, node, target, args, isDynamic) ; | 14182 return this.members.$index(0).invoke(context, node, target, args, isDynamic) ; |
| 14162 } | 14183 } |
| 14163 var targets = this.members.filter((function (m) { | 14184 var targets = this.members.filter((function (m) { |
| 14164 return m.canInvoke(context, args); | 14185 return m.canInvoke(context, args); |
| 14165 }) | 14186 }) |
| 14166 ); | 14187 ); |
| 14167 if ($notnull_bool(targets.length == 1)) { | 14188 if (targets.length == 1) { |
| 14168 return targets.$index(0).invoke(context, node, target, args, isDynamic); | 14189 return targets.$index(0).invoke(context, node, target, args, isDynamic); |
| 14169 } | 14190 } |
| 14170 var returnValue = null; | 14191 var returnValue = null; |
| 14171 for (var $i = targets.iterator(); $i.hasNext(); ) { | 14192 for (var $i = targets.iterator(); $i.hasNext(); ) { |
| 14172 var member = $i.next(); | 14193 var member = $i.next(); |
| 14173 var res = member.invoke(context, node, target, args, true); | 14194 var res = member.invoke(context, node, target, args, true); |
| 14174 returnValue = this._tryUnion(returnValue, res, node); | 14195 returnValue = this._tryUnion(returnValue, res, node); |
| 14175 } | 14196 } |
| 14176 if ($notnull_bool(returnValue == null)) { | 14197 if (returnValue == null) { |
| 14177 return this._makeError(node, target, 'method'); | 14198 return this._makeError(node, target, 'method'); |
| 14178 } | 14199 } |
| 14179 if ($notnull_bool(returnValue.code == null)) { | 14200 if (returnValue.code == null) { |
| 14180 if ($notnull_bool(this.name.startsWith('\$'))) { | 14201 if (this.name.startsWith('\$')) { |
| 14181 return target.invokeSpecial(this.name, args, returnValue.type); | 14202 return target.invokeSpecial(this.name, args, returnValue.type); |
| 14182 } | 14203 } |
| 14183 else { | 14204 else { |
| 14184 return this.invokeOnVar(context, node, target, args); | 14205 return this.invokeOnVar(context, node, target, args); |
| 14185 } | 14206 } |
| 14186 } | 14207 } |
| 14187 return returnValue; | 14208 return returnValue; |
| 14188 } | 14209 } |
| 14189 MemberSet.prototype.invokeOnVar = function(context, node, target, args) { | 14210 MemberSet.prototype.invokeOnVar = function(context, node, target, args) { |
| 14190 return this.getVarMember(context, node, args).invoke(context, node, target, ar gs); | 14211 return this.getVarMember(context, node, args).invoke(context, node, target, ar gs); |
| 14191 } | 14212 } |
| 14192 MemberSet.prototype._tryUnion = function(x, y, node) { | 14213 MemberSet.prototype._tryUnion = function(x, y, node) { |
| 14193 if ($notnull_bool(x == null)) return y; | 14214 if (x == null) return y; |
| 14194 var type = lang_Type.union(x.type, y.type); | 14215 var type = lang_Type.union(x.type, y.type); |
| 14195 if ($notnull_bool(x.code == y.code)) { | 14216 if (x.code == y.code) { |
| 14196 if ($notnull_bool($eq(type, x.type))) { | 14217 if ($notnull_bool($eq(type, x.type))) { |
| 14197 return x; | 14218 return x; |
| 14198 } | 14219 } |
| 14199 else if ($notnull_bool(x.get$isConst() || y.get$isConst())) { | 14220 else if ($notnull_bool(x.get$isConst() || y.get$isConst())) { |
| 14200 world.internalError("unexpected: union of const values "); | 14221 world.internalError("unexpected: union of const values "); |
| 14201 } | 14222 } |
| 14202 else { | 14223 else { |
| 14203 var ret = new Value(type, x.code, node.span, true); | 14224 var ret = new Value(type, x.code, node.span, true); |
| 14204 ret.isSuper = $notnull_bool(x.isSuper && y.isSuper); | 14225 ret.isSuper = $notnull_bool(x.isSuper && y.isSuper); |
| 14205 ret.needsTemp = $notnull_bool(x.needsTemp || y.needsTemp); | 14226 ret.needsTemp = $notnull_bool(x.needsTemp || y.needsTemp); |
| 14206 ret.isType = $notnull_bool(x.isType && y.isType); | 14227 ret.isType = $notnull_bool(x.isType && y.isType); |
| 14207 return (ret && ret.is$Value()); | 14228 return (ret && ret.is$Value()); |
| 14208 } | 14229 } |
| 14209 } | 14230 } |
| 14210 else { | 14231 else { |
| 14211 return new Value(type, null, node.span, true); | 14232 return new Value(type, null, node.span, true); |
| 14212 } | 14233 } |
| 14213 } | 14234 } |
| 14214 MemberSet.prototype.getVarMember = function(context, node, args) { | 14235 MemberSet.prototype.getVarMember = function(context, node, args) { |
| 14215 if ($notnull_bool(world.objectType.varStubs == null)) { | 14236 if (world.objectType.varStubs == null) { |
| 14216 world.objectType.varStubs = $map([]); | 14237 world.objectType.varStubs = $map([]); |
| 14217 } | 14238 } |
| 14218 var stubName = _getCallStubName(this.name, args); | 14239 var stubName = _getCallStubName(this.name, args); |
| 14219 var stub = world.objectType.varStubs.$index(stubName); | 14240 var stub = world.objectType.varStubs.$index(stubName); |
| 14220 if ($notnull_bool(stub == null)) { | 14241 if ($notnull_bool(stub == null)) { |
| 14221 var mset = context.findMembers(this.name).members; | 14242 var mset = context.findMembers(this.name).members; |
| 14222 var targets = mset.filter((function (m) { | 14243 var targets = mset.filter((function (m) { |
| 14223 return m.canInvoke(context, args); | 14244 return m.canInvoke(context, args); |
| 14224 }) | 14245 }) |
| 14225 ); | 14246 ); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14281 this.end = end; | 14302 this.end = end; |
| 14282 // Initializers done | 14303 // Initializers done |
| 14283 } | 14304 } |
| 14284 lang_Token.prototype.get$text = function() { | 14305 lang_Token.prototype.get$text = function() { |
| 14285 return this.source.get$text().substring(this.start, this.end); | 14306 return this.source.get$text().substring(this.start, this.end); |
| 14286 } | 14307 } |
| 14287 lang_Token.prototype.toString = function() { | 14308 lang_Token.prototype.toString = function() { |
| 14288 var kindText = TokenKind.kindToString(this.kind); | 14309 var kindText = TokenKind.kindToString(this.kind); |
| 14289 var actualText = this.get$text(); | 14310 var actualText = this.get$text(); |
| 14290 if ($notnull_bool($ne(kindText, actualText))) { | 14311 if ($notnull_bool($ne(kindText, actualText))) { |
| 14291 if ($notnull_bool(actualText.length > 10)) { | 14312 if (actualText.length > 10) { |
| 14292 actualText = actualText.substring(0, 8) + '...'; | 14313 actualText = actualText.substring(0, 8) + '...'; |
| 14293 } | 14314 } |
| 14294 return ('' + kindText + '(' + actualText + ')'); | 14315 return ('' + kindText + '(' + actualText + ')'); |
| 14295 } | 14316 } |
| 14296 else { | 14317 else { |
| 14297 return $assert_String(kindText); | 14318 return $assert_String(kindText); |
| 14298 } | 14319 } |
| 14299 } | 14320 } |
| 14300 lang_Token.prototype.get$span = function() { | 14321 lang_Token.prototype.get$span = function() { |
| 14301 return new SourceSpan(this.source, this.start, this.end); | 14322 return new SourceSpan(this.source, this.start, this.end); |
| 14302 } | 14323 } |
| 14303 // ********** Code for SourceFile ************** | 14324 // ********** Code for SourceFile ************** |
| 14304 function SourceFile(filename, _text) { | 14325 function SourceFile(filename, _text) { |
| 14305 this.filename = filename; | 14326 this.filename = filename; |
| 14306 this._text = _text; | 14327 this._text = _text; |
| 14307 // Initializers done | 14328 // Initializers done |
| 14308 } | 14329 } |
| 14309 SourceFile.prototype.is$SourceFile = function(){return this;}; | 14330 SourceFile.prototype.is$SourceFile = function(){return this;}; |
| 14310 SourceFile.prototype.get$text = function() { | 14331 SourceFile.prototype.get$text = function() { |
| 14311 return this._text; | 14332 return this._text; |
| 14312 } | 14333 } |
| 14313 SourceFile.prototype.get$lineStarts = function() { | 14334 SourceFile.prototype.get$lineStarts = function() { |
| 14314 if ($notnull_bool(this._lineStarts == null)) { | 14335 if (this._lineStarts == null) { |
| 14315 var starts = [0]; | 14336 var starts = [0]; |
| 14316 var index = 0; | 14337 var index = 0; |
| 14317 while ($notnull_bool(index < this.get$text().length)) { | 14338 while (index < this.get$text().length) { |
| 14318 index = this.get$text().indexOf('\n', index) + 1; | 14339 index = this.get$text().indexOf('\n', index) + 1; |
| 14319 if ($notnull_bool(index <= 0)) break; | 14340 if (index <= 0) break; |
| 14320 starts.add(index); | 14341 starts.add(index); |
| 14321 } | 14342 } |
| 14322 starts.add(this.get$text().length + 1); | 14343 starts.add(this.get$text().length + 1); |
| 14323 this._lineStarts = (starts && starts.is$List$int()); | 14344 this._lineStarts = (starts && starts.is$List$int()); |
| 14324 } | 14345 } |
| 14325 return this._lineStarts; | 14346 return this._lineStarts; |
| 14326 } | 14347 } |
| 14327 SourceFile.prototype.getLine = function(position) { | 14348 SourceFile.prototype.getLine = function(position) { |
| 14328 var starts = this.get$lineStarts(); | 14349 var starts = this.get$lineStarts(); |
| 14329 for (var i = 0; | 14350 for (var i = 0; |
| 14330 $notnull_bool(i < starts.length); i++) { | 14351 i < starts.length; i++) { |
| 14331 if ($notnull_bool(starts.$index(i) > position)) return i - 1; | 14352 if (starts.$index(i) > position) return i - 1; |
| 14332 } | 14353 } |
| 14333 world.internalError('bad position'); | 14354 world.internalError('bad position'); |
| 14334 } | 14355 } |
| 14335 SourceFile.prototype.getColumn = function(line, position) { | 14356 SourceFile.prototype.getColumn = function(line, position) { |
| 14336 return position - $assert_num(this.get$lineStarts().$index(line)); | 14357 return position - $assert_num(this.get$lineStarts().$index(line)); |
| 14337 } | 14358 } |
| 14338 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT ext) { | 14359 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT ext) { |
| 14339 var line = this.getLine(start); | 14360 var line = this.getLine(start); |
| 14340 var column = this.getColumn($assert_num(line), start); | 14361 var column = this.getColumn($assert_num(line), start); |
| 14341 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' + (column + 1) + ': ' + message + '')); | 14362 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' + (column + 1) + ': ' + message + '')); |
| 14342 if ($notnull_bool(includeText)) { | 14363 if ($notnull_bool(includeText)) { |
| 14343 buf.add('\n'); | 14364 buf.add('\n'); |
| 14344 var textLine; | 14365 var textLine; |
| 14345 if ($notnull_bool((line + 2) < this._lineStarts.length)) { | 14366 if ((line + 2) < this._lineStarts.length) { |
| 14346 textLine = this.get$text().substring(this._lineStarts.$index(line), this._ lineStarts.$index(line + 1)); | 14367 textLine = this.get$text().substring(this._lineStarts.$index(line), this._ lineStarts.$index(line + 1)); |
| 14347 } | 14368 } |
| 14348 else { | 14369 else { |
| 14349 textLine = this.get$text().substring(this._lineStarts.$index(line)) + '\n' ; | 14370 textLine = this.get$text().substring(this._lineStarts.$index(line)) + '\n' ; |
| 14350 } | 14371 } |
| 14351 buf.add(textLine); | 14372 buf.add(textLine); |
| 14352 var i = 0; | 14373 var i = 0; |
| 14353 for (; $notnull_bool(i < $assert_num(column)); i++) { | 14374 for (; i < $assert_num(column); i++) { |
| 14354 buf.add(' '); | 14375 buf.add(' '); |
| 14355 } | 14376 } |
| 14356 var toColumn = Math.min($assert_num(column + (end - start)), textLine.length ); | 14377 var toColumn = Math.min($assert_num(column + (end - start)), textLine.length ); |
| 14357 for (; $notnull_bool(i < toColumn); i++) { | 14378 for (; i < toColumn; i++) { |
| 14358 buf.add('^'); | 14379 buf.add('^'); |
| 14359 } | 14380 } |
| 14360 } | 14381 } |
| 14361 return $assert_String(buf.toString()); | 14382 return $assert_String(buf.toString()); |
| 14362 } | 14383 } |
| 14363 SourceFile.prototype.compareTo = function(other) { | 14384 SourceFile.prototype.compareTo = function(other) { |
| 14364 if ($notnull_bool(this.orderInLibrary != null && other.orderInLibrary != null) ) { | 14385 if (this.orderInLibrary != null && other.orderInLibrary != null) { |
| 14365 return this.orderInLibrary - other.orderInLibrary; | 14386 return this.orderInLibrary - other.orderInLibrary; |
| 14366 } | 14387 } |
| 14367 else { | 14388 else { |
| 14368 return this.filename.compareTo(other.filename); | 14389 return this.filename.compareTo(other.filename); |
| 14369 } | 14390 } |
| 14370 } | 14391 } |
| 14371 // ********** Code for SourceSpan ************** | 14392 // ********** Code for SourceSpan ************** |
| 14372 function SourceSpan(file, start, end) { | 14393 function SourceSpan(file, start, end) { |
| 14373 this.file = file; | 14394 this.file = file; |
| 14374 this.start = start; | 14395 this.start = start; |
| 14375 this.end = end; | 14396 this.end = end; |
| 14376 // Initializers done | 14397 // Initializers done |
| 14377 } | 14398 } |
| 14378 SourceSpan.prototype.is$SourceSpan = function(){return this;}; | 14399 SourceSpan.prototype.is$SourceSpan = function(){return this;}; |
| 14379 SourceSpan.prototype.get$text = function() { | 14400 SourceSpan.prototype.get$text = function() { |
| 14380 return this.file.get$text().substring(this.start, this.end); | 14401 return this.file.get$text().substring(this.start, this.end); |
| 14381 } | 14402 } |
| 14382 SourceSpan.prototype.toMessageString = function(message) { | 14403 SourceSpan.prototype.toMessageString = function(message) { |
| 14383 return this.file.getLocationMessage(message, this.start, this.end, true); | 14404 return this.file.getLocationMessage(message, this.start, this.end, true); |
| 14384 } | 14405 } |
| 14385 SourceSpan.prototype.get$locationText = function() { | 14406 SourceSpan.prototype.get$locationText = function() { |
| 14386 var line = this.file.getLine(this.start); | 14407 var line = this.file.getLine(this.start); |
| 14387 var column = this.file.getColumn($assert_num(line), this.start); | 14408 var column = this.file.getColumn($assert_num(line), this.start); |
| 14388 return ('' + this.file.filename + ':' + (line + 1) + ':' + (column + 1) + ''); | 14409 return ('' + this.file.filename + ':' + (line + 1) + ':' + (column + 1) + ''); |
| 14389 } | 14410 } |
| 14390 SourceSpan.prototype.compareTo = function(other) { | 14411 SourceSpan.prototype.compareTo = function(other) { |
| 14391 if ($notnull_bool($eq(this.file, other.file))) { | 14412 if ($eq(this.file, other.file)) { |
| 14392 var d = this.start - other.start; | 14413 var d = this.start - other.start; |
| 14393 return $notnull_bool(d == 0) ? (this.end - other.end) : d; | 14414 return d == 0 ? (this.end - other.end) : d; |
| 14394 } | 14415 } |
| 14395 return this.file.compareTo(other.file); | 14416 return this.file.compareTo(other.file); |
| 14396 } | 14417 } |
| 14397 // ********** Code for InterpStack ************** | 14418 // ********** Code for InterpStack ************** |
| 14398 function InterpStack(previous, quote, isMultiline) { | 14419 function InterpStack(previous, quote, isMultiline) { |
| 14399 this.previous = previous; | 14420 this.previous = previous; |
| 14400 this.quote = quote; | 14421 this.quote = quote; |
| 14401 this.isMultiline = isMultiline; | 14422 this.isMultiline = isMultiline; |
| 14402 this.depth = -1; | 14423 this.depth = -1; |
| 14403 // Initializers done | 14424 // Initializers done |
| 14404 } | 14425 } |
| 14405 InterpStack.prototype.is$InterpStack = function(){return this;}; | 14426 InterpStack.prototype.is$InterpStack = function(){return this;}; |
| 14406 InterpStack.prototype.pop = function() { | 14427 InterpStack.prototype.pop = function() { |
| 14407 return this.previous; | 14428 return this.previous; |
| 14408 } | 14429 } |
| 14409 InterpStack.push = function(stack, quote, isMultiline) { | 14430 InterpStack.push = function(stack, quote, isMultiline) { |
| 14410 var newStack = new InterpStack(stack, quote, isMultiline); | 14431 var newStack = new InterpStack(stack, quote, isMultiline); |
| 14411 if ($notnull_bool(stack != null)) newStack.previous = stack; | 14432 if (stack != null) newStack.previous = stack; |
| 14412 return (newStack && newStack.is$InterpStack()); | 14433 return (newStack && newStack.is$InterpStack()); |
| 14413 } | 14434 } |
| 14414 // ********** Code for TokenizerBase ************** | 14435 // ********** Code for TokenizerBase ************** |
| 14415 function TokenizerBase(_source, _skipWhitespace, _index) { | 14436 function TokenizerBase(_source, _skipWhitespace, _index) { |
| 14416 this._source = _source; | 14437 this._source = _source; |
| 14417 this._skipWhitespace = _skipWhitespace; | 14438 this._skipWhitespace = _skipWhitespace; |
| 14418 this._lang_index = _index; | 14439 this._lang_index = _index; |
| 14419 // Initializers done | 14440 // Initializers done |
| 14420 this._text = this._source.get$text(); | 14441 this._text = this._source.get$text(); |
| 14421 } | 14442 } |
| 14422 $inherits(TokenizerBase, TokenizerHelpers); | 14443 $inherits(TokenizerBase, TokenizerHelpers); |
| 14423 TokenizerBase.prototype._nextChar = function() { | 14444 TokenizerBase.prototype._nextChar = function() { |
| 14424 if ($notnull_bool(this._lang_index < this._text.length)) { | 14445 if (this._lang_index < this._text.length) { |
| 14425 return this._text.charCodeAt(this._lang_index++); | 14446 return this._text.charCodeAt(this._lang_index++); |
| 14426 } | 14447 } |
| 14427 else { | 14448 else { |
| 14428 return 0; | 14449 return 0; |
| 14429 } | 14450 } |
| 14430 } | 14451 } |
| 14431 TokenizerBase.prototype._peekChar = function() { | 14452 TokenizerBase.prototype._peekChar = function() { |
| 14432 if ($notnull_bool(this._lang_index < this._text.length)) { | 14453 if (this._lang_index < this._text.length) { |
| 14433 return this._text.charCodeAt(this._lang_index); | 14454 return this._text.charCodeAt(this._lang_index); |
| 14434 } | 14455 } |
| 14435 else { | 14456 else { |
| 14436 return 0; | 14457 return 0; |
| 14437 } | 14458 } |
| 14438 } | 14459 } |
| 14439 TokenizerBase.prototype._maybeEatChar = function(ch) { | 14460 TokenizerBase.prototype._maybeEatChar = function(ch) { |
| 14440 if ($notnull_bool(this._lang_index < this._text.length)) { | 14461 if (this._lang_index < this._text.length) { |
| 14441 if ($notnull_bool(this._text.charCodeAt(this._lang_index) == ch)) { | 14462 if (this._text.charCodeAt(this._lang_index) == ch) { |
| 14442 this._lang_index++; | 14463 this._lang_index++; |
| 14443 return true; | 14464 return true; |
| 14444 } | 14465 } |
| 14445 else { | 14466 else { |
| 14446 return false; | 14467 return false; |
| 14447 } | 14468 } |
| 14448 } | 14469 } |
| 14449 else { | 14470 else { |
| 14450 return false; | 14471 return false; |
| 14451 } | 14472 } |
| 14452 } | 14473 } |
| 14453 TokenizerBase.prototype._finishToken = function(kind) { | 14474 TokenizerBase.prototype._finishToken = function(kind) { |
| 14454 return new lang_Token(kind, this._source, this._startIndex, this._lang_index); | 14475 return new lang_Token(kind, this._source, this._startIndex, this._lang_index); |
| 14455 } | 14476 } |
| 14456 TokenizerBase.prototype._errorToken = function() { | 14477 TokenizerBase.prototype._errorToken = function() { |
| 14457 return this._finishToken(65/*TokenKind.ERROR*/); | 14478 return this._finishToken(65/*TokenKind.ERROR*/); |
| 14458 } | 14479 } |
| 14459 TokenizerBase.prototype.finishWhitespace = function() { | 14480 TokenizerBase.prototype.finishWhitespace = function() { |
| 14460 while ($notnull_bool(this._lang_index < this._text.length)) { | 14481 while (this._lang_index < this._text.length) { |
| 14461 if ($notnull_bool(!$notnull_bool(TokenizerHelpers.isWhitespace(this._text.ch arCodeAt(this._lang_index++))))) { | 14482 if (!$notnull_bool(TokenizerHelpers.isWhitespace(this._text.charCodeAt(this. _lang_index++)))) { |
| 14462 this._lang_index--; | 14483 this._lang_index--; |
| 14463 if ($notnull_bool(this._skipWhitespace)) { | 14484 if ($notnull_bool(this._skipWhitespace)) { |
| 14464 return this.next(); | 14485 return this.next(); |
| 14465 } | 14486 } |
| 14466 else { | 14487 else { |
| 14467 return this._finishToken(63/*TokenKind.WHITESPACE*/); | 14488 return this._finishToken(63/*TokenKind.WHITESPACE*/); |
| 14468 } | 14489 } |
| 14469 } | 14490 } |
| 14470 } | 14491 } |
| 14471 return this._finishToken(1/*TokenKind.END_OF_FILE*/); | 14492 return this._finishToken(1/*TokenKind.END_OF_FILE*/); |
| 14472 } | 14493 } |
| 14473 TokenizerBase.prototype.finishHashBang = function() { | 14494 TokenizerBase.prototype.finishHashBang = function() { |
| 14474 while ($notnull_bool(true)) { | 14495 while (true) { |
| 14475 var ch = this._nextChar(); | 14496 var ch = this._nextChar(); |
| 14476 if ($notnull_bool(ch == 0 || ch == 10) || ch == 13) { | 14497 if (ch == 0 || ch == 10 || ch == 13) { |
| 14477 return this._finishToken(13/*TokenKind.HASHBANG*/); | 14498 return this._finishToken(13/*TokenKind.HASHBANG*/); |
| 14478 } | 14499 } |
| 14479 } | 14500 } |
| 14480 } | 14501 } |
| 14481 TokenizerBase.prototype.finishSingleLineComment = function() { | 14502 TokenizerBase.prototype.finishSingleLineComment = function() { |
| 14482 while ($notnull_bool(true)) { | 14503 while (true) { |
| 14483 var ch = this._nextChar(); | 14504 var ch = this._nextChar(); |
| 14484 if ($notnull_bool(ch == 0 || ch == 10) || ch == 13) { | 14505 if (ch == 0 || ch == 10 || ch == 13) { |
| 14485 if ($notnull_bool(this._skipWhitespace)) { | 14506 if ($notnull_bool(this._skipWhitespace)) { |
| 14486 return this.next(); | 14507 return this.next(); |
| 14487 } | 14508 } |
| 14488 else { | 14509 else { |
| 14489 return this._finishToken(64/*TokenKind.COMMENT*/); | 14510 return this._finishToken(64/*TokenKind.COMMENT*/); |
| 14490 } | 14511 } |
| 14491 } | 14512 } |
| 14492 } | 14513 } |
| 14493 } | 14514 } |
| 14494 TokenizerBase.prototype.finishMultiLineComment = function() { | 14515 TokenizerBase.prototype.finishMultiLineComment = function() { |
| 14495 while ($notnull_bool(true)) { | 14516 while (true) { |
| 14496 var ch = this._nextChar(); | 14517 var ch = this._nextChar(); |
| 14497 if ($notnull_bool(ch == 0)) { | 14518 if (ch == 0) { |
| 14498 return this._finishToken(67/*TokenKind.INCOMPLETE_COMMENT*/); | 14519 return this._finishToken(67/*TokenKind.INCOMPLETE_COMMENT*/); |
| 14499 } | 14520 } |
| 14500 else if ($notnull_bool(ch == 42)) { | 14521 else if (ch == 42) { |
| 14501 if ($notnull_bool(this._maybeEatChar(47))) { | 14522 if ($notnull_bool(this._maybeEatChar(47))) { |
| 14502 if ($notnull_bool(this._skipWhitespace)) { | 14523 if ($notnull_bool(this._skipWhitespace)) { |
| 14503 return this.next(); | 14524 return this.next(); |
| 14504 } | 14525 } |
| 14505 else { | 14526 else { |
| 14506 return this._finishToken(64/*TokenKind.COMMENT*/); | 14527 return this._finishToken(64/*TokenKind.COMMENT*/); |
| 14507 } | 14528 } |
| 14508 } | 14529 } |
| 14509 } | 14530 } |
| 14510 } | 14531 } |
| 14511 return this._errorToken(); | 14532 return this._errorToken(); |
| 14512 } | 14533 } |
| 14513 TokenizerBase.prototype.eatDigits = function() { | 14534 TokenizerBase.prototype.eatDigits = function() { |
| 14514 while ($notnull_bool(this._lang_index < this._text.length)) { | 14535 while (this._lang_index < this._text.length) { |
| 14515 if ($notnull_bool(TokenizerHelpers.isDigit(this._text.charCodeAt(this._lang_ index)))) { | 14536 if ($notnull_bool(TokenizerHelpers.isDigit(this._text.charCodeAt(this._lang_ index)))) { |
| 14516 this._lang_index++; | 14537 this._lang_index++; |
| 14517 } | 14538 } |
| 14518 else { | 14539 else { |
| 14519 return; | 14540 return; |
| 14520 } | 14541 } |
| 14521 } | 14542 } |
| 14522 } | 14543 } |
| 14523 TokenizerBase.prototype.eatHexDigits = function() { | 14544 TokenizerBase.prototype.eatHexDigits = function() { |
| 14524 while ($notnull_bool(this._lang_index < this._text.length)) { | 14545 while (this._lang_index < this._text.length) { |
| 14525 if ($notnull_bool(TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._la ng_index)))) { | 14546 if ($notnull_bool(TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._la ng_index)))) { |
| 14526 this._lang_index++; | 14547 this._lang_index++; |
| 14527 } | 14548 } |
| 14528 else { | 14549 else { |
| 14529 return; | 14550 return; |
| 14530 } | 14551 } |
| 14531 } | 14552 } |
| 14532 } | 14553 } |
| 14533 TokenizerBase.prototype.maybeEatHexDigit = function() { | 14554 TokenizerBase.prototype.maybeEatHexDigit = function() { |
| 14534 if ($notnull_bool(this._lang_index < this._text.length && TokenizerHelpers.isH exDigit(this._text.charCodeAt(this._lang_index)))) { | 14555 if ($notnull_bool(this._lang_index < this._text.length && TokenizerHelpers.isH exDigit(this._text.charCodeAt(this._lang_index)))) { |
| 14535 this._lang_index++; | 14556 this._lang_index++; |
| 14536 return true; | 14557 return true; |
| 14537 } | 14558 } |
| 14538 return false; | 14559 return false; |
| 14539 } | 14560 } |
| 14540 TokenizerBase.prototype.finishHex = function() { | 14561 TokenizerBase.prototype.finishHex = function() { |
| 14541 this.eatHexDigits(); | 14562 this.eatHexDigits(); |
| 14542 return this._finishToken(61/*TokenKind.HEX_INTEGER*/); | 14563 return this._finishToken(61/*TokenKind.HEX_INTEGER*/); |
| 14543 } | 14564 } |
| 14544 TokenizerBase.prototype.finishNumber = function() { | 14565 TokenizerBase.prototype.finishNumber = function() { |
| 14545 this.eatDigits(); | 14566 this.eatDigits(); |
| 14546 if ($notnull_bool(this._peekChar() == 46)) { | 14567 if (this._peekChar() == 46) { |
| 14547 this._nextChar(); | 14568 this._nextChar(); |
| 14548 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { | 14569 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { |
| 14549 this.eatDigits(); | 14570 this.eatDigits(); |
| 14550 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); | 14571 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); |
| 14551 } | 14572 } |
| 14552 else { | 14573 else { |
| 14553 this._lang_index--; | 14574 this._lang_index--; |
| 14554 } | 14575 } |
| 14555 } | 14576 } |
| 14556 return this.finishNumberExtra(60/*TokenKind.INTEGER*/); | 14577 return this.finishNumberExtra(60/*TokenKind.INTEGER*/); |
| 14557 } | 14578 } |
| 14558 TokenizerBase.prototype.finishNumberExtra = function(kind) { | 14579 TokenizerBase.prototype.finishNumberExtra = function(kind) { |
| 14559 if ($notnull_bool(this._maybeEatChar(101) || this._maybeEatChar(69))) { | 14580 if ($notnull_bool(this._maybeEatChar(101) || this._maybeEatChar(69))) { |
| 14560 kind = 62/*TokenKind.DOUBLE*/; | 14581 kind = 62/*TokenKind.DOUBLE*/; |
| 14561 this._maybeEatChar(45); | 14582 this._maybeEatChar(45); |
| 14562 this._maybeEatChar(43); | 14583 this._maybeEatChar(43); |
| 14563 this.eatDigits(); | 14584 this.eatDigits(); |
| 14564 } | 14585 } |
| 14565 if ($notnull_bool(this._peekChar() != 0 && TokenizerHelpers.isIdentifierStart( this._peekChar()))) { | 14586 if ($notnull_bool(this._peekChar() != 0 && TokenizerHelpers.isIdentifierStart( this._peekChar()))) { |
| 14566 this._nextChar(); | 14587 this._nextChar(); |
| 14567 return this._errorToken(); | 14588 return this._errorToken(); |
| 14568 } | 14589 } |
| 14569 return this._finishToken(kind); | 14590 return this._finishToken(kind); |
| 14570 } | 14591 } |
| 14571 TokenizerBase.prototype.finishMultilineString = function(quote) { | 14592 TokenizerBase.prototype.finishMultilineString = function(quote) { |
| 14572 while ($notnull_bool(true)) { | 14593 while (true) { |
| 14573 var ch = this._nextChar(); | 14594 var ch = this._nextChar(); |
| 14574 if ($notnull_bool(ch == 0)) { | 14595 if (ch == 0) { |
| 14575 var kind = $notnull_bool(quote == 34) ? 68/*TokenKind.INCOMPLETE_MULTILINE _STRING_DQ*/ : 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; | 14596 var kind = quote == 34 ? 68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/ : 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; |
| 14576 return this._finishToken(kind); | 14597 return this._finishToken(kind); |
| 14577 } | 14598 } |
| 14578 else if ($notnull_bool(ch == quote)) { | 14599 else if (ch == quote) { |
| 14579 if ($notnull_bool(this._maybeEatChar(quote))) { | 14600 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 14580 if ($notnull_bool(this._maybeEatChar(quote))) { | 14601 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 14581 return this._finishToken(58/*TokenKind.STRING*/); | 14602 return this._finishToken(58/*TokenKind.STRING*/); |
| 14582 } | 14603 } |
| 14583 } | 14604 } |
| 14584 } | 14605 } |
| 14585 else if ($notnull_bool(ch == 36)) { | 14606 else if (ch == 36) { |
| 14586 this._interpStack = InterpStack.push(this._interpStack, quote, true); | 14607 this._interpStack = InterpStack.push(this._interpStack, quote, true); |
| 14587 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); | 14608 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 14588 } | 14609 } |
| 14589 else if ($notnull_bool(ch == 92)) { | 14610 else if (ch == 92) { |
| 14590 if ($notnull_bool(!$notnull_bool(this.eatEscapeSequence()))) { | 14611 if (!$notnull_bool(this.eatEscapeSequence())) { |
| 14591 return this._errorToken(); | 14612 return this._errorToken(); |
| 14592 } | 14613 } |
| 14593 } | 14614 } |
| 14594 } | 14615 } |
| 14595 } | 14616 } |
| 14596 TokenizerBase.prototype._finishOpenBrace = function() { | 14617 TokenizerBase.prototype._finishOpenBrace = function() { |
| 14597 var $0; | 14618 var $0; |
| 14598 if ($notnull_bool(this._interpStack != null)) { | 14619 if (this._interpStack != null) { |
| 14599 if ($notnull_bool(this._interpStack.depth == -1)) { | 14620 if (this._interpStack.depth == -1) { |
| 14600 this._interpStack.depth = 1; | 14621 this._interpStack.depth = 1; |
| 14601 } | 14622 } |
| 14602 else { | 14623 else { |
| 14603 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenize r.dart", 261, 16); | 14624 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenize r.dart", 261, 16); |
| 14604 ($0 = this._interpStack).depth = $0.depth + 1; | 14625 ($0 = this._interpStack).depth = $0.depth + 1; |
| 14605 } | 14626 } |
| 14606 } | 14627 } |
| 14607 return this._finishToken(6/*TokenKind.LBRACE*/); | 14628 return this._finishToken(6/*TokenKind.LBRACE*/); |
| 14608 } | 14629 } |
| 14609 TokenizerBase.prototype._finishCloseBrace = function() { | 14630 TokenizerBase.prototype._finishCloseBrace = function() { |
| 14610 var $0; | 14631 var $0; |
| 14611 if ($notnull_bool(this._interpStack != null)) { | 14632 if (this._interpStack != null) { |
| 14612 ($0 = this._interpStack).depth = $0.depth - 1; | 14633 ($0 = this._interpStack).depth = $0.depth - 1; |
| 14613 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenizer. dart", 271, 14); | 14634 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenizer. dart", 271, 14); |
| 14614 } | 14635 } |
| 14615 return this._finishToken(7/*TokenKind.RBRACE*/); | 14636 return this._finishToken(7/*TokenKind.RBRACE*/); |
| 14616 } | 14637 } |
| 14617 TokenizerBase.prototype.finishString = function(quote) { | 14638 TokenizerBase.prototype.finishString = function(quote) { |
| 14618 if ($notnull_bool(this._maybeEatChar(quote))) { | 14639 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 14619 if ($notnull_bool(this._maybeEatChar(quote))) { | 14640 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 14620 return this.finishMultilineString(quote); | 14641 return this.finishMultilineString(quote); |
| 14621 } | 14642 } |
| 14622 else { | 14643 else { |
| 14623 return this._finishToken(58/*TokenKind.STRING*/); | 14644 return this._finishToken(58/*TokenKind.STRING*/); |
| 14624 } | 14645 } |
| 14625 } | 14646 } |
| 14626 return this.finishStringBody(quote); | 14647 return this.finishStringBody(quote); |
| 14627 } | 14648 } |
| 14628 TokenizerBase.prototype.finishRawString = function(quote) { | 14649 TokenizerBase.prototype.finishRawString = function(quote) { |
| 14629 if ($notnull_bool(this._maybeEatChar(quote))) { | 14650 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 14630 if ($notnull_bool(this._maybeEatChar(quote))) { | 14651 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 14631 return this.finishMultilineRawString(quote); | 14652 return this.finishMultilineRawString(quote); |
| 14632 } | 14653 } |
| 14633 else { | 14654 else { |
| 14634 return this._finishToken(58/*TokenKind.STRING*/); | 14655 return this._finishToken(58/*TokenKind.STRING*/); |
| 14635 } | 14656 } |
| 14636 } | 14657 } |
| 14637 while ($notnull_bool(true)) { | 14658 while (true) { |
| 14638 var ch = this._nextChar(); | 14659 var ch = this._nextChar(); |
| 14639 if ($notnull_bool(ch == quote)) { | 14660 if (ch == quote) { |
| 14640 return this._finishToken(58/*TokenKind.STRING*/); | 14661 return this._finishToken(58/*TokenKind.STRING*/); |
| 14641 } | 14662 } |
| 14642 else if ($notnull_bool(ch == 0)) { | 14663 else if (ch == 0) { |
| 14643 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); | 14664 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 14644 } | 14665 } |
| 14645 } | 14666 } |
| 14646 } | 14667 } |
| 14647 TokenizerBase.prototype.finishMultilineRawString = function(quote) { | 14668 TokenizerBase.prototype.finishMultilineRawString = function(quote) { |
| 14648 while ($notnull_bool(true)) { | 14669 while (true) { |
| 14649 var ch = this._nextChar(); | 14670 var ch = this._nextChar(); |
| 14650 if ($notnull_bool(ch == 0)) { | 14671 if (ch == 0) { |
| 14651 var kind = $notnull_bool(quote == 34) ? 68/*TokenKind.INCOMPLETE_MULTILINE _STRING_DQ*/ : 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; | 14672 var kind = quote == 34 ? 68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/ : 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; |
| 14652 return this._finishToken(kind); | 14673 return this._finishToken(kind); |
| 14653 } | 14674 } |
| 14654 else if ($notnull_bool(ch == quote && this._maybeEatChar(quote)) && this._ma ybeEatChar(quote)) { | 14675 else if ($notnull_bool($notnull_bool(ch == quote && this._maybeEatChar(quote )) && this._maybeEatChar(quote))) { |
| 14655 return this._finishToken(58/*TokenKind.STRING*/); | 14676 return this._finishToken(58/*TokenKind.STRING*/); |
| 14656 } | 14677 } |
| 14657 } | 14678 } |
| 14658 } | 14679 } |
| 14659 TokenizerBase.prototype.finishStringBody = function(quote) { | 14680 TokenizerBase.prototype.finishStringBody = function(quote) { |
| 14660 while ($notnull_bool(true)) { | 14681 while (true) { |
| 14661 var ch = this._nextChar(); | 14682 var ch = this._nextChar(); |
| 14662 if ($notnull_bool(ch == quote)) { | 14683 if (ch == quote) { |
| 14663 return this._finishToken(58/*TokenKind.STRING*/); | 14684 return this._finishToken(58/*TokenKind.STRING*/); |
| 14664 } | 14685 } |
| 14665 else if ($notnull_bool(ch == 36)) { | 14686 else if (ch == 36) { |
| 14666 this._interpStack = InterpStack.push(this._interpStack, quote, false); | 14687 this._interpStack = InterpStack.push(this._interpStack, quote, false); |
| 14667 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); | 14688 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 14668 } | 14689 } |
| 14669 else if ($notnull_bool(ch == 0)) { | 14690 else if (ch == 0) { |
| 14670 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); | 14691 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 14671 } | 14692 } |
| 14672 else if ($notnull_bool(ch == 92)) { | 14693 else if (ch == 92) { |
| 14673 if ($notnull_bool(!$notnull_bool(this.eatEscapeSequence()))) { | 14694 if (!$notnull_bool(this.eatEscapeSequence())) { |
| 14674 return this._errorToken(); | 14695 return this._errorToken(); |
| 14675 } | 14696 } |
| 14676 } | 14697 } |
| 14677 } | 14698 } |
| 14678 } | 14699 } |
| 14679 TokenizerBase.prototype.eatEscapeSequence = function() { | 14700 TokenizerBase.prototype.eatEscapeSequence = function() { |
| 14680 var hex; | 14701 var hex; |
| 14681 switch (this._nextChar()) { | 14702 switch (this._nextChar()) { |
| 14682 case 120: | 14703 case 120: |
| 14683 | 14704 |
| 14684 return $notnull_bool(this.maybeEatHexDigit() && this.maybeEatHexDigit()); | 14705 return $notnull_bool(this.maybeEatHexDigit() && this.maybeEatHexDigit()); |
| 14685 | 14706 |
| 14686 case 117: | 14707 case 117: |
| 14687 | 14708 |
| 14688 if ($notnull_bool(this._maybeEatChar(123))) { | 14709 if ($notnull_bool(this._maybeEatChar(123))) { |
| 14689 var start = this._lang_index; | 14710 var start = this._lang_index; |
| 14690 this.eatHexDigits(); | 14711 this.eatHexDigits(); |
| 14691 var chars = this._lang_index - start; | 14712 var chars = this._lang_index - start; |
| 14692 if ($notnull_bool(chars > 0 && chars <= 6) && this._maybeEatChar(125)) { | 14713 if ($notnull_bool(chars > 0 && chars <= 6 && this._maybeEatChar(125))) { |
| 14693 hex = this._text.substring(start, start + chars); | 14714 hex = this._text.substring(start, start + chars); |
| 14694 break; | 14715 break; |
| 14695 } | 14716 } |
| 14696 else { | 14717 else { |
| 14697 return false; | 14718 return false; |
| 14698 } | 14719 } |
| 14699 } | 14720 } |
| 14700 else { | 14721 else { |
| 14701 if ($notnull_bool(this.maybeEatHexDigit() && this.maybeEatHexDigit()) && this.maybeEatHexDigit() && this.maybeEatHexDigit()) { | 14722 if ($notnull_bool($notnull_bool($notnull_bool(this.maybeEatHexDigit() && this.maybeEatHexDigit()) && this.maybeEatHexDigit()) && this.maybeEatHexDigit() )) { |
| 14702 hex = this._text.substring(this._lang_index - 4, this._lang_index); | 14723 hex = this._text.substring(this._lang_index - 4, this._lang_index); |
| 14703 break; | 14724 break; |
| 14704 } | 14725 } |
| 14705 else { | 14726 else { |
| 14706 return false; | 14727 return false; |
| 14707 } | 14728 } |
| 14708 } | 14729 } |
| 14709 | 14730 |
| 14710 default: | 14731 default: |
| 14711 | 14732 |
| 14712 return true; | 14733 return true; |
| 14713 | 14734 |
| 14714 } | 14735 } |
| 14715 var n = lang_Parser.parseHex(hex); | 14736 var n = lang_Parser.parseHex(hex); |
| 14716 return $notnull_bool(n < 0xD800 || $notnull_bool(n > 0xDFFF && n <= 0x10FFFF)) ; | 14737 return n < 0xD800 || n > 0xDFFF && n <= 0x10FFFF; |
| 14717 } | 14738 } |
| 14718 TokenizerBase.prototype.finishDot = function() { | 14739 TokenizerBase.prototype.finishDot = function() { |
| 14719 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { | 14740 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { |
| 14720 this.eatDigits(); | 14741 this.eatDigits(); |
| 14721 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); | 14742 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); |
| 14722 } | 14743 } |
| 14723 else { | 14744 else { |
| 14724 return this._finishToken(14/*TokenKind.DOT*/); | 14745 return this._finishToken(14/*TokenKind.DOT*/); |
| 14725 } | 14746 } |
| 14726 } | 14747 } |
| 14727 TokenizerBase.prototype.finishIdentifier = function() { | 14748 TokenizerBase.prototype.finishIdentifier = function() { |
| 14728 while ($notnull_bool(this._lang_index < this._text.length)) { | 14749 while (this._lang_index < this._text.length) { |
| 14729 if ($notnull_bool(!$notnull_bool(TokenizerHelpers.isIdentifierPart(this._tex t.charCodeAt(this._lang_index++))))) { | 14750 if (!$notnull_bool(TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(t his._lang_index++)))) { |
| 14730 this._lang_index--; | 14751 this._lang_index--; |
| 14731 break; | 14752 break; |
| 14732 } | 14753 } |
| 14733 } | 14754 } |
| 14734 var kind = this.getIdentifierKind(); | 14755 var kind = this.getIdentifierKind(); |
| 14735 if ($notnull_bool(this._interpStack != null && this._interpStack.depth == -1)) { | 14756 if (this._interpStack != null && this._interpStack.depth == -1) { |
| 14736 this._interpStack.depth = 0; | 14757 this._interpStack.depth = 0; |
| 14737 } | 14758 } |
| 14738 if ($notnull_bool(kind == 70/*TokenKind.IDENTIFIER*/)) { | 14759 if (kind == 70/*TokenKind.IDENTIFIER*/) { |
| 14739 return this._finishToken(70/*TokenKind.IDENTIFIER*/); | 14760 return this._finishToken(70/*TokenKind.IDENTIFIER*/); |
| 14740 } | 14761 } |
| 14741 else { | 14762 else { |
| 14742 return this._finishToken(kind); | 14763 return this._finishToken(kind); |
| 14743 } | 14764 } |
| 14744 } | 14765 } |
| 14745 // ********** Code for Tokenizer ************** | 14766 // ********** Code for Tokenizer ************** |
| 14746 function Tokenizer(source, skipWhitespace, index) { | 14767 function Tokenizer(source, skipWhitespace, index) { |
| 14747 TokenizerBase.call(this, source, skipWhitespace, index); | 14768 TokenizerBase.call(this, source, skipWhitespace, index); |
| 14748 // Initializers done | 14769 // Initializers done |
| 14749 } | 14770 } |
| 14750 $inherits(Tokenizer, TokenizerBase); | 14771 $inherits(Tokenizer, TokenizerBase); |
| 14751 Tokenizer.prototype.next = function() { | 14772 Tokenizer.prototype.next = function() { |
| 14752 this._startIndex = this._lang_index; | 14773 this._startIndex = this._lang_index; |
| 14753 if ($notnull_bool(this._interpStack != null && this._interpStack.depth == 0)) { | 14774 if (this._interpStack != null && this._interpStack.depth == 0) { |
| 14754 var istack = this._interpStack; | 14775 var istack = this._interpStack; |
| 14755 this._interpStack = this._interpStack.pop(); | 14776 this._interpStack = this._interpStack.pop(); |
| 14756 if ($notnull_bool(istack.isMultiline)) { | 14777 if ($notnull_bool(istack.isMultiline)) { |
| 14757 return this.finishMultilineString(istack.quote); | 14778 return this.finishMultilineString(istack.quote); |
| 14758 } | 14779 } |
| 14759 else { | 14780 else { |
| 14760 return this.finishStringBody(istack.quote); | 14781 return this.finishStringBody(istack.quote); |
| 14761 } | 14782 } |
| 14762 } | 14783 } |
| 14763 var ch; | 14784 var ch; |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15080 return this._errorToken(); | 15101 return this._errorToken(); |
| 15081 } | 15102 } |
| 15082 | 15103 |
| 15083 } | 15104 } |
| 15084 } | 15105 } |
| 15085 Tokenizer.prototype.getIdentifierKind = function() { | 15106 Tokenizer.prototype.getIdentifierKind = function() { |
| 15086 var i0 = this._startIndex; | 15107 var i0 = this._startIndex; |
| 15087 switch (this._lang_index - i0) { | 15108 switch (this._lang_index - i0) { |
| 15088 case 2: | 15109 case 2: |
| 15089 | 15110 |
| 15090 if ($notnull_bool(this._text.charCodeAt(i0) == 100)) { | 15111 if (this._text.charCodeAt(i0) == 100) { |
| 15091 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111)) return 94/*Toke nKind.DO*/; | 15112 if (this._text.charCodeAt(i0 + 1) == 111) return 94/*TokenKind.DO*/; |
| 15092 } | 15113 } |
| 15093 else if ($notnull_bool(this._text.charCodeAt(i0) == 105)) { | 15114 else if (this._text.charCodeAt(i0) == 105) { |
| 15094 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 102)) { | 15115 if (this._text.charCodeAt(i0 + 1) == 102) { |
| 15095 return 100/*TokenKind.IF*/; | 15116 return 100/*TokenKind.IF*/; |
| 15096 } | 15117 } |
| 15097 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 110)) { | 15118 else if (this._text.charCodeAt(i0 + 1) == 110) { |
| 15098 return 101/*TokenKind.IN*/; | 15119 return 101/*TokenKind.IN*/; |
| 15099 } | 15120 } |
| 15100 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 115)) { | 15121 else if (this._text.charCodeAt(i0 + 1) == 115) { |
| 15101 return 102/*TokenKind.IS*/; | 15122 return 102/*TokenKind.IS*/; |
| 15102 } | 15123 } |
| 15103 } | 15124 } |
| 15104 return 70/*TokenKind.IDENTIFIER*/; | 15125 return 70/*TokenKind.IDENTIFIER*/; |
| 15105 | 15126 |
| 15106 case 3: | 15127 case 3: |
| 15107 | 15128 |
| 15108 if ($notnull_bool(this._text.charCodeAt(i0) == 102)) { | 15129 if (this._text.charCodeAt(i0) == 102) { |
| 15109 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111 && this._text.cha rCodeAt(i0 + 2) == 114)) return 99/*TokenKind.FOR*/; | 15130 if (this._text.charCodeAt(i0 + 1) == 111 && this._text.charCodeAt(i0 + 2 ) == 114) return 99/*TokenKind.FOR*/; |
| 15110 } | 15131 } |
| 15111 else if ($notnull_bool(this._text.charCodeAt(i0) == 103)) { | 15132 else if (this._text.charCodeAt(i0) == 103) { |
| 15112 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha rCodeAt(i0 + 2) == 116)) return 76/*TokenKind.GET*/; | 15133 if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2 ) == 116) return 76/*TokenKind.GET*/; |
| 15113 } | 15134 } |
| 15114 else if ($notnull_bool(this._text.charCodeAt(i0) == 110)) { | 15135 else if (this._text.charCodeAt(i0) == 110) { |
| 15115 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha rCodeAt(i0 + 2) == 119)) return 103/*TokenKind.NEW*/; | 15136 if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2 ) == 119) return 103/*TokenKind.NEW*/; |
| 15116 } | 15137 } |
| 15117 else if ($notnull_bool(this._text.charCodeAt(i0) == 115)) { | 15138 else if (this._text.charCodeAt(i0) == 115) { |
| 15118 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha rCodeAt(i0 + 2) == 116)) return 84/*TokenKind.SET*/; | 15139 if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2 ) == 116) return 84/*TokenKind.SET*/; |
| 15119 } | 15140 } |
| 15120 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) { | 15141 else if (this._text.charCodeAt(i0) == 116) { |
| 15121 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114 && this._text.cha rCodeAt(i0 + 2) == 121)) return 111/*TokenKind.TRY*/; | 15142 if (this._text.charCodeAt(i0 + 1) == 114 && this._text.charCodeAt(i0 + 2 ) == 121) return 111/*TokenKind.TRY*/; |
| 15122 } | 15143 } |
| 15123 else if ($notnull_bool(this._text.charCodeAt(i0) == 118)) { | 15144 else if (this._text.charCodeAt(i0) == 118) { |
| 15124 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97 && this._text.char CodeAt(i0 + 2) == 114)) return 112/*TokenKind.VAR*/; | 15145 if (this._text.charCodeAt(i0 + 1) == 97 && this._text.charCodeAt(i0 + 2) == 114) return 112/*TokenKind.VAR*/; |
| 15125 } | 15146 } |
| 15126 return 70/*TokenKind.IDENTIFIER*/; | 15147 return 70/*TokenKind.IDENTIFIER*/; |
| 15127 | 15148 |
| 15128 case 4: | 15149 case 4: |
| 15129 | 15150 |
| 15130 if ($notnull_bool(this._text.charCodeAt(i0) == 99)) { | 15151 if (this._text.charCodeAt(i0) == 99) { |
| 15131 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97 && this._text.char CodeAt(i0 + 2) == 115) && this._text.charCodeAt(i0 + 3) == 101) return 89/*Token Kind.CASE*/; | 15152 if (this._text.charCodeAt(i0 + 1) == 97 && this._text.charCodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 101) return 89/*TokenKind.CASE*/; |
| 15132 } | 15153 } |
| 15133 else if ($notnull_bool(this._text.charCodeAt(i0) == 101)) { | 15154 else if (this._text.charCodeAt(i0) == 101) { |
| 15134 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 108 && this._text.cha rCodeAt(i0 + 2) == 115) && this._text.charCodeAt(i0 + 3) == 101) return 95/*Toke nKind.ELSE*/; | 15155 if (this._text.charCodeAt(i0 + 1) == 108 && this._text.charCodeAt(i0 + 2 ) == 115 && this._text.charCodeAt(i0 + 3) == 101) return 95/*TokenKind.ELSE*/; |
| 15135 } | 15156 } |
| 15136 else if ($notnull_bool(this._text.charCodeAt(i0) == 110)) { | 15157 else if (this._text.charCodeAt(i0) == 110) { |
| 15137 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 117 && this._text.cha rCodeAt(i0 + 2) == 108) && this._text.charCodeAt(i0 + 3) == 108) return 104/*Tok enKind.NULL*/; | 15158 if (this._text.charCodeAt(i0 + 1) == 117 && this._text.charCodeAt(i0 + 2 ) == 108 && this._text.charCodeAt(i0 + 3) == 108) return 104/*TokenKind.NULL*/; |
| 15138 } | 15159 } |
| 15139 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) { | 15160 else if (this._text.charCodeAt(i0) == 116) { |
| 15140 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104)) { | 15161 if (this._text.charCodeAt(i0 + 1) == 104) { |
| 15141 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 105 && this._text.c harCodeAt(i0 + 3) == 115)) return 108/*TokenKind.THIS*/; | 15162 if (this._text.charCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 + 3) == 115) return 108/*TokenKind.THIS*/; |
| 15142 } | 15163 } |
| 15143 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114)) { | 15164 else if (this._text.charCodeAt(i0 + 1) == 114) { |
| 15144 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 117 && this._text.c harCodeAt(i0 + 3) == 101)) return 110/*TokenKind.TRUE*/; | 15165 if (this._text.charCodeAt(i0 + 2) == 117 && this._text.charCodeAt(i0 + 3) == 101) return 110/*TokenKind.TRUE*/; |
| 15145 } | 15166 } |
| 15146 } | 15167 } |
| 15147 else if ($notnull_bool(this._text.charCodeAt(i0) == 118)) { | 15168 else if (this._text.charCodeAt(i0) == 118) { |
| 15148 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111 && this._text.cha rCodeAt(i0 + 2) == 105) && this._text.charCodeAt(i0 + 3) == 100) return 113/*Tok enKind.VOID*/; | 15169 if (this._text.charCodeAt(i0 + 1) == 111 && this._text.charCodeAt(i0 + 2 ) == 105 && this._text.charCodeAt(i0 + 3) == 100) return 113/*TokenKind.VOID*/; |
| 15149 } | 15170 } |
| 15150 return 70/*TokenKind.IDENTIFIER*/; | 15171 return 70/*TokenKind.IDENTIFIER*/; |
| 15151 | 15172 |
| 15152 case 5: | 15173 case 5: |
| 15153 | 15174 |
| 15154 if ($notnull_bool(this._text.charCodeAt(i0) == 98)) { | 15175 if (this._text.charCodeAt(i0) == 98) { |
| 15155 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114 && this._text.cha rCodeAt(i0 + 2) == 101) && this._text.charCodeAt(i0 + 3) == 97 && this._text.cha rCodeAt(i0 + 4) == 107) return 88/*TokenKind.BREAK*/; | 15176 if (this._text.charCodeAt(i0 + 1) == 114 && this._text.charCodeAt(i0 + 2 ) == 101 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 107) return 88/*TokenKind.BREAK*/; |
| 15156 } | 15177 } |
| 15157 else if ($notnull_bool(this._text.charCodeAt(i0) == 99)) { | 15178 else if (this._text.charCodeAt(i0) == 99) { |
| 15158 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { | 15179 if (this._text.charCodeAt(i0 + 1) == 97) { |
| 15159 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 116 && this._text.c harCodeAt(i0 + 3) == 99) && this._text.charCodeAt(i0 + 4) == 104) return 90/*Tok enKind.CATCH*/; | 15180 if (this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 99 && this._text.charCodeAt(i0 + 4) == 104) return 90/*TokenKind.CATCH*/; |
| 15160 } | 15181 } |
| 15161 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 108)) { | 15182 else if (this._text.charCodeAt(i0 + 1) == 108) { |
| 15162 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 97 && this._text.ch arCodeAt(i0 + 3) == 115) && this._text.charCodeAt(i0 + 4) == 115) return 73/*Tok enKind.CLASS*/; | 15183 if (this._text.charCodeAt(i0 + 2) == 97 && this._text.charCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 115) return 73/*TokenKind.CLASS*/; |
| 15163 } | 15184 } |
| 15164 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111)) { | 15185 else if (this._text.charCodeAt(i0 + 1) == 111) { |
| 15165 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c harCodeAt(i0 + 3) == 115) && this._text.charCodeAt(i0 + 4) == 116) return 91/*To kenKind.CONST*/; | 15186 if (this._text.charCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 116) return 91/*TokenKind.CONST*/ ; |
| 15166 } | 15187 } |
| 15167 } | 15188 } |
| 15168 else if ($notnull_bool(this._text.charCodeAt(i0) == 102)) { | 15189 else if (this._text.charCodeAt(i0) == 102) { |
| 15169 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { | 15190 if (this._text.charCodeAt(i0 + 1) == 97) { |
| 15170 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 108 && this._text.c harCodeAt(i0 + 3) == 115) && this._text.charCodeAt(i0 + 4) == 101) return 96/*To kenKind.FALSE*/; | 15191 if (this._text.charCodeAt(i0 + 2) == 108 && this._text.charCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 101) return 96/*TokenKind.FALSE*/ ; |
| 15171 } | 15192 } |
| 15172 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105)) { | 15193 else if (this._text.charCodeAt(i0 + 1) == 105) { |
| 15173 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c harCodeAt(i0 + 3) == 97) && this._text.charCodeAt(i0 + 4) == 108) return 97/*Tok enKind.FINAL*/; | 15194 if (this._text.charCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 108) return 97/*TokenKind.FINAL*/; |
| 15174 } | 15195 } |
| 15175 } | 15196 } |
| 15176 else if ($notnull_bool(this._text.charCodeAt(i0) == 115)) { | 15197 else if (this._text.charCodeAt(i0) == 115) { |
| 15177 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 117 && this._text.cha rCodeAt(i0 + 2) == 112) && this._text.charCodeAt(i0 + 3) == 101 && this._text.ch arCodeAt(i0 + 4) == 114) return 106/*TokenKind.SUPER*/; | 15198 if (this._text.charCodeAt(i0 + 1) == 117 && this._text.charCodeAt(i0 + 2 ) == 112 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4 ) == 114) return 106/*TokenKind.SUPER*/; |
| 15178 } | 15199 } |
| 15179 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) { | 15200 else if (this._text.charCodeAt(i0) == 116) { |
| 15180 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104 && this._text.cha rCodeAt(i0 + 2) == 114) && this._text.charCodeAt(i0 + 3) == 111 && this._text.ch arCodeAt(i0 + 4) == 119) return 109/*TokenKind.THROW*/; | 15201 if (this._text.charCodeAt(i0 + 1) == 104 && this._text.charCodeAt(i0 + 2 ) == 114 && this._text.charCodeAt(i0 + 3) == 111 && this._text.charCodeAt(i0 + 4 ) == 119) return 109/*TokenKind.THROW*/; |
| 15181 } | 15202 } |
| 15182 else if ($notnull_bool(this._text.charCodeAt(i0) == 119)) { | 15203 else if (this._text.charCodeAt(i0) == 119) { |
| 15183 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104 && this._text.cha rCodeAt(i0 + 2) == 105) && this._text.charCodeAt(i0 + 3) == 108 && this._text.ch arCodeAt(i0 + 4) == 101) return 114/*TokenKind.WHILE*/; | 15204 if (this._text.charCodeAt(i0 + 1) == 104 && this._text.charCodeAt(i0 + 2 ) == 105 && this._text.charCodeAt(i0 + 3) == 108 && this._text.charCodeAt(i0 + 4 ) == 101) return 114/*TokenKind.WHILE*/; |
| 15184 } | 15205 } |
| 15185 return 70/*TokenKind.IDENTIFIER*/; | 15206 return 70/*TokenKind.IDENTIFIER*/; |
| 15186 | 15207 |
| 15187 case 6: | 15208 case 6: |
| 15188 | 15209 |
| 15189 if ($notnull_bool(this._text.charCodeAt(i0) == 97)) { | 15210 if (this._text.charCodeAt(i0) == 97) { |
| 15190 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 115 && this._text.cha rCodeAt(i0 + 2) == 115) && this._text.charCodeAt(i0 + 3) == 101 && this._text.ch arCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 116) return 72/*Toke nKind.ASSERT*/; | 15211 if (this._text.charCodeAt(i0 + 1) == 115 && this._text.charCodeAt(i0 + 2 ) == 115 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4 ) == 114 && this._text.charCodeAt(i0 + 5) == 116) return 72/*TokenKind.ASSERT*/; |
| 15191 } | 15212 } |
| 15192 else if ($notnull_bool(this._text.charCodeAt(i0) == 105)) { | 15213 else if (this._text.charCodeAt(i0) == 105) { |
| 15193 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 109 && this._text.cha rCodeAt(i0 + 2) == 112) && this._text.charCodeAt(i0 + 3) == 111 && this._text.ch arCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 116) return 78/*Toke nKind.IMPORT*/; | 15214 if (this._text.charCodeAt(i0 + 1) == 109 && this._text.charCodeAt(i0 + 2 ) == 112 && this._text.charCodeAt(i0 + 3) == 111 && this._text.charCodeAt(i0 + 4 ) == 114 && this._text.charCodeAt(i0 + 5) == 116) return 78/*TokenKind.IMPORT*/; |
| 15194 } | 15215 } |
| 15195 else if ($notnull_bool(this._text.charCodeAt(i0) == 110)) { | 15216 else if (this._text.charCodeAt(i0) == 110) { |
| 15196 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { | 15217 if (this._text.charCodeAt(i0 + 1) == 97) { |
| 15197 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 116 && this._text.c harCodeAt(i0 + 3) == 105) && this._text.charCodeAt(i0 + 4) == 118 && this._text. charCodeAt(i0 + 5) == 101) return 81/*TokenKind.NATIVE*/; | 15218 if (this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 105 && this._text.charCodeAt(i0 + 4) == 118 && this._text.charCodeAt(i0 + 5) == 101) return 81/*TokenKind.NATIVE*/; |
| 15198 } | 15219 } |
| 15199 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101)) { | 15220 else if (this._text.charCodeAt(i0 + 1) == 101) { |
| 15200 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 103 && this._text.c harCodeAt(i0 + 3) == 97) && this._text.charCodeAt(i0 + 4) == 116 && this._text.c harCodeAt(i0 + 5) == 101) return 82/*TokenKind.NEGATE*/; | 15221 if (this._text.charCodeAt(i0 + 2) == 103 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 116 && this._text.charCodeAt(i0 + 5) == 101) return 82/*TokenKind.NEGATE*/; |
| 15201 } | 15222 } |
| 15202 } | 15223 } |
| 15203 else if ($notnull_bool(this._text.charCodeAt(i0) == 114)) { | 15224 else if (this._text.charCodeAt(i0) == 114) { |
| 15204 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha rCodeAt(i0 + 2) == 116) && this._text.charCodeAt(i0 + 3) == 117 && this._text.ch arCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 110) return 105/*Tok enKind.RETURN*/; | 15225 if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2 ) == 116 && this._text.charCodeAt(i0 + 3) == 117 && this._text.charCodeAt(i0 + 4 ) == 114 && this._text.charCodeAt(i0 + 5) == 110) return 105/*TokenKind.RETURN*/ ; |
| 15205 } | 15226 } |
| 15206 else if ($notnull_bool(this._text.charCodeAt(i0) == 115)) { | 15227 else if (this._text.charCodeAt(i0) == 115) { |
| 15207 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111)) { | 15228 if (this._text.charCodeAt(i0 + 1) == 111) { |
| 15208 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 117 && this._text.c harCodeAt(i0 + 3) == 114) && this._text.charCodeAt(i0 + 4) == 99 && this._text.c harCodeAt(i0 + 5) == 101) return 85/*TokenKind.SOURCE*/; | 15229 if (this._text.charCodeAt(i0 + 2) == 117 && this._text.charCodeAt(i0 + 3) == 114 && this._text.charCodeAt(i0 + 4) == 99 && this._text.charCodeAt(i0 + 5) == 101) return 85/*TokenKind.SOURCE*/; |
| 15209 } | 15230 } |
| 15210 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 116)) { | 15231 else if (this._text.charCodeAt(i0 + 1) == 116) { |
| 15211 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 97 && this._text.ch arCodeAt(i0 + 3) == 116) && this._text.charCodeAt(i0 + 4) == 105 && this._text.c harCodeAt(i0 + 5) == 99) return 86/*TokenKind.STATIC*/; | 15232 if (this._text.charCodeAt(i0 + 2) == 97 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 105 && this._text.charCodeAt(i0 + 5) == 99) return 86/*TokenKind.STATIC*/; |
| 15212 } | 15233 } |
| 15213 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 119)) { | 15234 else if (this._text.charCodeAt(i0 + 1) == 119) { |
| 15214 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 105 && this._text.c harCodeAt(i0 + 3) == 116) && this._text.charCodeAt(i0 + 4) == 99 && this._text.c harCodeAt(i0 + 5) == 104) return 107/*TokenKind.SWITCH*/; | 15235 if (this._text.charCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 99 && this._text.charCodeAt(i0 + 5) == 104) return 107/*TokenKind.SWITCH*/; |
| 15215 } | 15236 } |
| 15216 } | 15237 } |
| 15217 return 70/*TokenKind.IDENTIFIER*/; | 15238 return 70/*TokenKind.IDENTIFIER*/; |
| 15218 | 15239 |
| 15219 case 7: | 15240 case 7: |
| 15220 | 15241 |
| 15221 if ($notnull_bool(this._text.charCodeAt(i0) == 100)) { | 15242 if (this._text.charCodeAt(i0) == 100) { |
| 15222 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha rCodeAt(i0 + 2) == 102) && this._text.charCodeAt(i0 + 3) == 97 && this._text.cha rCodeAt(i0 + 4) == 117 && this._text.charCodeAt(i0 + 5) == 108 && this._text.cha rCodeAt(i0 + 6) == 116) return 93/*TokenKind.DEFAULT*/; | 15243 if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2 ) == 102 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 117 && this._text.charCodeAt(i0 + 5) == 108 && this._text.charCodeAt(i0 + 6) == 116) return 93/*TokenKind.DEFAULT*/; |
| 15223 } | 15244 } |
| 15224 else if ($notnull_bool(this._text.charCodeAt(i0) == 101)) { | 15245 else if (this._text.charCodeAt(i0) == 101) { |
| 15225 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 120 && this._text.cha rCodeAt(i0 + 2) == 116) && this._text.charCodeAt(i0 + 3) == 101 && this._text.ch arCodeAt(i0 + 4) == 110 && this._text.charCodeAt(i0 + 5) == 100 && this._text.ch arCodeAt(i0 + 6) == 115) return 74/*TokenKind.EXTENDS*/; | 15246 if (this._text.charCodeAt(i0 + 1) == 120 && this._text.charCodeAt(i0 + 2 ) == 116 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4 ) == 110 && this._text.charCodeAt(i0 + 5) == 100 && this._text.charCodeAt(i0 + 6 ) == 115) return 74/*TokenKind.EXTENDS*/; |
| 15226 } | 15247 } |
| 15227 else if ($notnull_bool(this._text.charCodeAt(i0) == 102)) { | 15248 else if (this._text.charCodeAt(i0) == 102) { |
| 15228 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { | 15249 if (this._text.charCodeAt(i0 + 1) == 97) { |
| 15229 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 99 && this._text.ch arCodeAt(i0 + 3) == 116) && this._text.charCodeAt(i0 + 4) == 111 && this._text.c harCodeAt(i0 + 5) == 114 && this._text.charCodeAt(i0 + 6) == 121) return 75/*Tok enKind.FACTORY*/; | 15250 if (this._text.charCodeAt(i0 + 2) == 99 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 111 && this._text.charCodeAt(i0 + 5) == 114 && this._text.charCodeAt(i0 + 6) == 121) return 75/*TokenKind.FACTORY* /; |
| 15230 } | 15251 } |
| 15231 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105)) { | 15252 else if (this._text.charCodeAt(i0 + 1) == 105) { |
| 15232 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c harCodeAt(i0 + 3) == 97) && this._text.charCodeAt(i0 + 4) == 108 && this._text.c harCodeAt(i0 + 5) == 108 && this._text.charCodeAt(i0 + 6) == 121) return 98/*Tok enKind.FINALLY*/; | 15253 if (this._text.charCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 108 && this._text.charCodeAt(i0 + 5) == 108 && this._text.charCodeAt(i0 + 6) == 121) return 98/*TokenKind.FINALLY* /; |
| 15233 } | 15254 } |
| 15234 } | 15255 } |
| 15235 else if ($notnull_bool(this._text.charCodeAt(i0) == 108)) { | 15256 else if (this._text.charCodeAt(i0) == 108) { |
| 15236 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105 && this._text.cha rCodeAt(i0 + 2) == 98) && this._text.charCodeAt(i0 + 3) == 114 && this._text.cha rCodeAt(i0 + 4) == 97 && this._text.charCodeAt(i0 + 5) == 114 && this._text.char CodeAt(i0 + 6) == 121) return 80/*TokenKind.LIBRARY*/; | 15257 if (this._text.charCodeAt(i0 + 1) == 105 && this._text.charCodeAt(i0 + 2 ) == 98 && this._text.charCodeAt(i0 + 3) == 114 && this._text.charCodeAt(i0 + 4) == 97 && this._text.charCodeAt(i0 + 5) == 114 && this._text.charCodeAt(i0 + 6) == 121) return 80/*TokenKind.LIBRARY*/; |
| 15237 } | 15258 } |
| 15238 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) { | 15259 else if (this._text.charCodeAt(i0) == 116) { |
| 15239 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 121 && this._text.cha rCodeAt(i0 + 2) == 112) && this._text.charCodeAt(i0 + 3) == 101 && this._text.ch arCodeAt(i0 + 4) == 100 && this._text.charCodeAt(i0 + 5) == 101 && this._text.ch arCodeAt(i0 + 6) == 102) return 87/*TokenKind.TYPEDEF*/; | 15260 if (this._text.charCodeAt(i0 + 1) == 121 && this._text.charCodeAt(i0 + 2 ) == 112 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4 ) == 100 && this._text.charCodeAt(i0 + 5) == 101 && this._text.charCodeAt(i0 + 6 ) == 102) return 87/*TokenKind.TYPEDEF*/; |
| 15240 } | 15261 } |
| 15241 return 70/*TokenKind.IDENTIFIER*/; | 15262 return 70/*TokenKind.IDENTIFIER*/; |
| 15242 | 15263 |
| 15243 case 8: | 15264 case 8: |
| 15244 | 15265 |
| 15245 if ($notnull_bool(this._text.charCodeAt(i0) == 97)) { | 15266 if (this._text.charCodeAt(i0) == 97) { |
| 15246 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 98 && this._text.char CodeAt(i0 + 2) == 115) && this._text.charCodeAt(i0 + 3) == 116 && this._text.cha rCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 97 && this._text.char CodeAt(i0 + 6) == 99 && this._text.charCodeAt(i0 + 7) == 116) return 71/*TokenKi nd.ABSTRACT*/; | 15267 if (this._text.charCodeAt(i0 + 1) == 98 && this._text.charCodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 97 && this._text.charCodeAt(i0 + 6) == 99 && this._text.charCodeAt(i0 + 7) == 116) return 71/*TokenKind.ABSTRACT*/; |
| 15247 } | 15268 } |
| 15248 else if ($notnull_bool(this._text.charCodeAt(i0) == 99)) { | 15269 else if (this._text.charCodeAt(i0) == 99) { |
| 15249 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111 && this._text.cha rCodeAt(i0 + 2) == 110) && this._text.charCodeAt(i0 + 3) == 116 && this._text.ch arCodeAt(i0 + 4) == 105 && this._text.charCodeAt(i0 + 5) == 110 && this._text.ch arCodeAt(i0 + 6) == 117 && this._text.charCodeAt(i0 + 7) == 101) return 92/*Toke nKind.CONTINUE*/; | 15270 if (this._text.charCodeAt(i0 + 1) == 111 && this._text.charCodeAt(i0 + 2 ) == 110 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4 ) == 105 && this._text.charCodeAt(i0 + 5) == 110 && this._text.charCodeAt(i0 + 6 ) == 117 && this._text.charCodeAt(i0 + 7) == 101) return 92/*TokenKind.CONTINUE* /; |
| 15250 } | 15271 } |
| 15251 else if ($notnull_bool(this._text.charCodeAt(i0) == 111)) { | 15272 else if (this._text.charCodeAt(i0) == 111) { |
| 15252 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 112 && this._text.cha rCodeAt(i0 + 2) == 101) && this._text.charCodeAt(i0 + 3) == 114 && this._text.ch arCodeAt(i0 + 4) == 97 && this._text.charCodeAt(i0 + 5) == 116 && this._text.cha rCodeAt(i0 + 6) == 111 && this._text.charCodeAt(i0 + 7) == 114) return 83/*Token Kind.OPERATOR*/; | 15273 if (this._text.charCodeAt(i0 + 1) == 112 && this._text.charCodeAt(i0 + 2 ) == 101 && this._text.charCodeAt(i0 + 3) == 114 && this._text.charCodeAt(i0 + 4 ) == 97 && this._text.charCodeAt(i0 + 5) == 116 && this._text.charCodeAt(i0 + 6) == 111 && this._text.charCodeAt(i0 + 7) == 114) return 83/*TokenKind.OPERATOR*/ ; |
| 15253 } | 15274 } |
| 15254 return 70/*TokenKind.IDENTIFIER*/; | 15275 return 70/*TokenKind.IDENTIFIER*/; |
| 15255 | 15276 |
| 15256 case 9: | 15277 case 9: |
| 15257 | 15278 |
| 15258 if ($notnull_bool(this._text.charCodeAt(i0) == 105 && this._text.charCodeA t(i0 + 1) == 110) && this._text.charCodeAt(i0 + 2) == 116 && this._text.charCode At(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCode At(i0 + 5) == 102 && this._text.charCodeAt(i0 + 6) == 97 && this._text.charCodeA t(i0 + 7) == 99 && this._text.charCodeAt(i0 + 8) == 101) return 79/*TokenKind.IN TERFACE*/; | 15279 if (this._text.charCodeAt(i0) == 105 && this._text.charCodeAt(i0 + 1) == 1 10 && this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 1 01 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 1 02 && this._text.charCodeAt(i0 + 6) == 97 && this._text.charCodeAt(i0 + 7) == 99 && this._text.charCodeAt(i0 + 8) == 101) return 79/*TokenKind.INTERFACE*/; |
| 15259 return 70/*TokenKind.IDENTIFIER*/; | 15280 return 70/*TokenKind.IDENTIFIER*/; |
| 15260 | 15281 |
| 15261 case 10: | 15282 case 10: |
| 15262 | 15283 |
| 15263 if ($notnull_bool(this._text.charCodeAt(i0) == 105 && this._text.charCodeA t(i0 + 1) == 109) && this._text.charCodeAt(i0 + 2) == 112 && this._text.charCode At(i0 + 3) == 108 && this._text.charCodeAt(i0 + 4) == 101 && this._text.charCode At(i0 + 5) == 109 && this._text.charCodeAt(i0 + 6) == 101 && this._text.charCode At(i0 + 7) == 110 && this._text.charCodeAt(i0 + 8) == 116 && this._text.charCode At(i0 + 9) == 115) return 77/*TokenKind.IMPLEMENTS*/; | 15284 if (this._text.charCodeAt(i0) == 105 && this._text.charCodeAt(i0 + 1) == 1 09 && this._text.charCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 1 08 && this._text.charCodeAt(i0 + 4) == 101 && this._text.charCodeAt(i0 + 5) == 1 09 && this._text.charCodeAt(i0 + 6) == 101 && this._text.charCodeAt(i0 + 7) == 1 10 && this._text.charCodeAt(i0 + 8) == 116 && this._text.charCodeAt(i0 + 9) == 1 15) return 77/*TokenKind.IMPLEMENTS*/; |
| 15264 return 70/*TokenKind.IDENTIFIER*/; | 15285 return 70/*TokenKind.IDENTIFIER*/; |
| 15265 | 15286 |
| 15266 default: | 15287 default: |
| 15267 | 15288 |
| 15268 return 70/*TokenKind.IDENTIFIER*/; | 15289 return 70/*TokenKind.IDENTIFIER*/; |
| 15269 | 15290 |
| 15270 } | 15291 } |
| 15271 } | 15292 } |
| 15272 // ********** Code for TokenizerHelpers ************** | 15293 // ********** Code for TokenizerHelpers ************** |
| 15273 function TokenizerHelpers() {} | 15294 function TokenizerHelpers() {} |
| 15274 TokenizerHelpers.isIdentifierStart = function(c) { | 15295 TokenizerHelpers.isIdentifierStart = function(c) { |
| 15275 return ($notnull_bool(($notnull_bool(c >= 97 && c <= 122)) || ($notnull_bool(c >= 65 && c <= 90))) || c == 95); | 15296 return ((c >= 97 && c <= 122) || (c >= 65 && c <= 90) || c == 95); |
| 15276 } | 15297 } |
| 15277 TokenizerHelpers.isDigit = function(c) { | 15298 TokenizerHelpers.isDigit = function(c) { |
| 15278 return ($notnull_bool(c >= 48 && c <= 57)); | 15299 return (c >= 48 && c <= 57); |
| 15279 } | 15300 } |
| 15280 TokenizerHelpers.isHexDigit = function(c) { | 15301 TokenizerHelpers.isHexDigit = function(c) { |
| 15281 return ($notnull_bool(TokenizerHelpers.isDigit(c) || ($notnull_bool(c >= 97 && c <= 102))) || ($notnull_bool(c >= 65 && c <= 70))); | 15302 return ($notnull_bool(TokenizerHelpers.isDigit(c) || (c >= 97 && c <= 102)) || (c >= 65 && c <= 70)); |
| 15282 } | 15303 } |
| 15283 TokenizerHelpers.isWhitespace = function(c) { | 15304 TokenizerHelpers.isWhitespace = function(c) { |
| 15284 return ($notnull_bool(c == 32 || c == 9) || c == 10 || c == 13); | 15305 return (c == 32 || c == 9 || c == 10 || c == 13); |
| 15285 } | 15306 } |
| 15286 TokenizerHelpers.isIdentifierPart = function(c) { | 15307 TokenizerHelpers.isIdentifierPart = function(c) { |
| 15287 return ($notnull_bool(TokenizerHelpers.isIdentifierStart(c) || TokenizerHelper s.isDigit(c))); | 15308 return ($notnull_bool(TokenizerHelpers.isIdentifierStart(c) || TokenizerHelper s.isDigit(c))); |
| 15288 } | 15309 } |
| 15289 // ********** Code for TokenKind ************** | 15310 // ********** Code for TokenKind ************** |
| 15290 function TokenKind() {} | 15311 function TokenKind() {} |
| 15291 TokenKind.kindToString = function(kind) { | 15312 TokenKind.kindToString = function(kind) { |
| 15292 switch (kind) { | 15313 switch (kind) { |
| 15293 case 1/*TokenKind.END_OF_FILE*/: | 15314 case 1/*TokenKind.END_OF_FILE*/: |
| 15294 | 15315 |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15746 | 15767 |
| 15747 return "keyword 'while'"; | 15768 return "keyword 'while'"; |
| 15748 | 15769 |
| 15749 default: | 15770 default: |
| 15750 | 15771 |
| 15751 return "TokenKind(" + kind.toString() + ")"; | 15772 return "TokenKind(" + kind.toString() + ")"; |
| 15752 | 15773 |
| 15753 } | 15774 } |
| 15754 } | 15775 } |
| 15755 TokenKind.isIdentifier = function(kind) { | 15776 TokenKind.isIdentifier = function(kind) { |
| 15756 return $notnull_bool(kind >= 70/*TokenKind.IDENTIFIER*/ && kind < 88/*TokenKin d.BREAK*/); | 15777 return kind >= 70/*TokenKind.IDENTIFIER*/ && kind < 88/*TokenKind.BREAK*/; |
| 15757 } | 15778 } |
| 15758 TokenKind.infixPrecedence = function(kind) { | 15779 TokenKind.infixPrecedence = function(kind) { |
| 15759 switch (kind) { | 15780 switch (kind) { |
| 15760 case 20/*TokenKind.ASSIGN*/: | 15781 case 20/*TokenKind.ASSIGN*/: |
| 15761 | 15782 |
| 15762 return 2; | 15783 return 2; |
| 15763 | 15784 |
| 15764 case 21/*TokenKind.ASSIGN_OR*/: | 15785 case 21/*TokenKind.ASSIGN_OR*/: |
| 15765 | 15786 |
| 15766 return 2; | 15787 return 2; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16077 | 16098 |
| 16078 return '\$index'; | 16099 return '\$index'; |
| 16079 | 16100 |
| 16080 case 57/*TokenKind.SETINDEX*/: | 16101 case 57/*TokenKind.SETINDEX*/: |
| 16081 | 16102 |
| 16082 return '\$setindex'; | 16103 return '\$setindex'; |
| 16083 | 16104 |
| 16084 } | 16105 } |
| 16085 } | 16106 } |
| 16086 TokenKind.kindFromAssign = function(kind) { | 16107 TokenKind.kindFromAssign = function(kind) { |
| 16087 if ($notnull_bool(kind == 20/*TokenKind.ASSIGN*/)) return 0; | 16108 if (kind == 20/*TokenKind.ASSIGN*/) return 0; |
| 16088 if ($notnull_bool(kind > 20/*TokenKind.ASSIGN*/ && kind <= 32/*TokenKind.ASSIG N_MOD*/)) { | 16109 if (kind > 20/*TokenKind.ASSIGN*/ && kind <= 32/*TokenKind.ASSIGN_MOD*/) { |
| 16089 return kind + (15)/*(ADD - ASSIGN_ADD)*/; | 16110 return kind + (15)/*(ADD - ASSIGN_ADD)*/; |
| 16090 } | 16111 } |
| 16091 return -1; | 16112 return -1; |
| 16092 } | 16113 } |
| 16093 // ********** Code for lang_Parser ************** | 16114 // ********** Code for lang_Parser ************** |
| 16094 function lang_Parser(source, diet, throwOnIncomplete, optionalSemicolons, startO ffset) { | 16115 function lang_Parser(source, diet, throwOnIncomplete, optionalSemicolons, startO ffset) { |
| 16095 this.source = source; | 16116 this.source = source; |
| 16096 this.diet = diet; | 16117 this.diet = diet; |
| 16097 this.throwOnIncomplete = throwOnIncomplete; | 16118 this.throwOnIncomplete = throwOnIncomplete; |
| 16098 this.optionalSemicolons = optionalSemicolons; | 16119 this.optionalSemicolons = optionalSemicolons; |
| 16099 // Initializers done | 16120 // Initializers done |
| 16100 this.tokenizer = new Tokenizer(this.source, true, startOffset); | 16121 this.tokenizer = new Tokenizer(this.source, true, startOffset); |
| 16101 this._peekToken = this.tokenizer.next(); | 16122 this._peekToken = this.tokenizer.next(); |
| 16102 this._previousToken = null; | 16123 this._previousToken = null; |
| 16103 this._inInitializers = false; | 16124 this._inInitializers = false; |
| 16104 } | 16125 } |
| 16105 lang_Parser.prototype.isPrematureEndOfFile = function() { | 16126 lang_Parser.prototype.isPrematureEndOfFile = function() { |
| 16106 if ($notnull_bool(this.throwOnIncomplete && this._maybeEat(1/*TokenKind.END_OF _FILE*/)) || this._maybeEat(68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/) || t his._maybeEat(69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/)) { | 16127 if ($notnull_bool($notnull_bool($notnull_bool(this.throwOnIncomplete && this._ maybeEat(1/*TokenKind.END_OF_FILE*/)) || this._maybeEat(68/*TokenKind.INCOMPLETE _MULTILINE_STRING_DQ*/)) || this._maybeEat(69/*TokenKind.INCOMPLETE_MULTILINE_ST RING_SQ*/))) { |
| 16107 $throw(new IncompleteSourceException(this._previousToken)); | 16128 $throw(new IncompleteSourceException(this._previousToken)); |
| 16108 } | 16129 } |
| 16109 else if ($notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/))) { | 16130 else if ($notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/))) { |
| 16110 this._lang_error('unexpected end of file', this._peekToken.get$span()); | 16131 this._lang_error('unexpected end of file', this._peekToken.get$span()); |
| 16111 return true; | 16132 return true; |
| 16112 } | 16133 } |
| 16113 else { | 16134 else { |
| 16114 return false; | 16135 return false; |
| 16115 } | 16136 } |
| 16116 } | 16137 } |
| 16117 lang_Parser.prototype._peek = function() { | 16138 lang_Parser.prototype._peek = function() { |
| 16118 return this._peekToken.kind; | 16139 return this._peekToken.kind; |
| 16119 } | 16140 } |
| 16120 lang_Parser.prototype._lang_next = function() { | 16141 lang_Parser.prototype._lang_next = function() { |
| 16121 this._previousToken = this._peekToken; | 16142 this._previousToken = this._peekToken; |
| 16122 this._peekToken = this.tokenizer.next(); | 16143 this._peekToken = this.tokenizer.next(); |
| 16123 return this._previousToken; | 16144 return this._previousToken; |
| 16124 } | 16145 } |
| 16125 lang_Parser.prototype._peekKind = function(kind) { | 16146 lang_Parser.prototype._peekKind = function(kind) { |
| 16126 return this._peekToken.kind == kind; | 16147 return this._peekToken.kind == kind; |
| 16127 } | 16148 } |
| 16128 lang_Parser.prototype._peekIdentifier = function() { | 16149 lang_Parser.prototype._peekIdentifier = function() { |
| 16129 return TokenKind.isIdentifier(this._peekToken.kind); | 16150 return TokenKind.isIdentifier(this._peekToken.kind); |
| 16130 } | 16151 } |
| 16131 lang_Parser.prototype._maybeEat = function(kind) { | 16152 lang_Parser.prototype._maybeEat = function(kind) { |
| 16132 if ($notnull_bool(this._peekToken.kind == kind)) { | 16153 if (this._peekToken.kind == kind) { |
| 16133 this._previousToken = this._peekToken; | 16154 this._previousToken = this._peekToken; |
| 16134 this._peekToken = this.tokenizer.next(); | 16155 this._peekToken = this.tokenizer.next(); |
| 16135 return true; | 16156 return true; |
| 16136 } | 16157 } |
| 16137 else { | 16158 else { |
| 16138 return false; | 16159 return false; |
| 16139 } | 16160 } |
| 16140 } | 16161 } |
| 16141 lang_Parser.prototype._eat = function(kind) { | 16162 lang_Parser.prototype._eat = function(kind) { |
| 16142 if ($notnull_bool(!$notnull_bool(this._maybeEat(kind)))) { | 16163 if (!$notnull_bool(this._maybeEat(kind))) { |
| 16143 this._errorExpected(TokenKind.kindToString(kind)); | 16164 this._errorExpected(TokenKind.kindToString(kind)); |
| 16144 } | 16165 } |
| 16145 } | 16166 } |
| 16146 lang_Parser.prototype._eatSemicolon = function() { | 16167 lang_Parser.prototype._eatSemicolon = function() { |
| 16147 if ($notnull_bool(this.optionalSemicolons && this._peekKind(1/*TokenKind.END_O F_FILE*/))) return; | 16168 if ($notnull_bool(this.optionalSemicolons && this._peekKind(1/*TokenKind.END_O F_FILE*/))) return; |
| 16148 this._eat(10/*TokenKind.SEMICOLON*/); | 16169 this._eat(10/*TokenKind.SEMICOLON*/); |
| 16149 } | 16170 } |
| 16150 lang_Parser.prototype._errorExpected = function(expected) { | 16171 lang_Parser.prototype._errorExpected = function(expected) { |
| 16151 if ($notnull_bool(this.throwOnIncomplete)) this.isPrematureEndOfFile(); | 16172 if ($notnull_bool(this.throwOnIncomplete)) this.isPrematureEndOfFile(); |
| 16152 var tok = this._lang_next(); | 16173 var tok = this._lang_next(); |
| 16153 var message = ('expected ' + expected + ', but found ' + tok + ''); | 16174 var message = ('expected ' + expected + ', but found ' + tok + ''); |
| 16154 this._lang_error($assert_String(message), tok.get$span()); | 16175 this._lang_error($assert_String(message), tok.get$span()); |
| 16155 } | 16176 } |
| 16156 lang_Parser.prototype._lang_error = function(message, location) { | 16177 lang_Parser.prototype._lang_error = function(message, location) { |
| 16157 if ($notnull_bool(location == null)) { | 16178 if (location == null) { |
| 16158 location = this._peekToken.get$span(); | 16179 location = this._peekToken.get$span(); |
| 16159 } | 16180 } |
| 16160 world.fatal(message, location); | 16181 world.fatal(message, location); |
| 16161 } | 16182 } |
| 16162 lang_Parser.prototype._skipBlock = function() { | 16183 lang_Parser.prototype._skipBlock = function() { |
| 16163 var depth = 1; | 16184 var depth = 1; |
| 16164 this._eat(6/*TokenKind.LBRACE*/); | 16185 this._eat(6/*TokenKind.LBRACE*/); |
| 16165 while ($notnull_bool(true)) { | 16186 while (true) { |
| 16166 var tok = this._lang_next(); | 16187 var tok = this._lang_next(); |
| 16167 if ($notnull_bool($eq(tok.kind, 6/*TokenKind.LBRACE*/))) { | 16188 if ($notnull_bool($eq(tok.kind, 6/*TokenKind.LBRACE*/))) { |
| 16168 depth += 1; | 16189 depth += 1; |
| 16169 } | 16190 } |
| 16170 else if ($notnull_bool($eq(tok.kind, 7/*TokenKind.RBRACE*/))) { | 16191 else if ($notnull_bool($eq(tok.kind, 7/*TokenKind.RBRACE*/))) { |
| 16171 depth -= 1; | 16192 depth -= 1; |
| 16172 if ($notnull_bool(depth == 0)) return; | 16193 if (depth == 0) return; |
| 16173 } | 16194 } |
| 16174 else if ($notnull_bool($eq(tok.kind, 1/*TokenKind.END_OF_FILE*/))) { | 16195 else if ($notnull_bool($eq(tok.kind, 1/*TokenKind.END_OF_FILE*/))) { |
| 16175 this._lang_error('unexpected end of file during diet parse', tok.get$span( )); | 16196 this._lang_error('unexpected end of file during diet parse', tok.get$span( )); |
| 16176 return; | 16197 return; |
| 16177 } | 16198 } |
| 16178 } | 16199 } |
| 16179 } | 16200 } |
| 16180 lang_Parser.prototype._makeSpan = function(start) { | 16201 lang_Parser.prototype._makeSpan = function(start) { |
| 16181 return new SourceSpan(this.source, start, this._previousToken.end); | 16202 return new SourceSpan(this.source, start, this._previousToken.end); |
| 16182 } | 16203 } |
| 16183 lang_Parser.prototype.compilationUnit = function() { | 16204 lang_Parser.prototype.compilationUnit = function() { |
| 16184 var ret = []; | 16205 var ret = []; |
| 16185 this._maybeEat(13/*TokenKind.HASHBANG*/); | 16206 this._maybeEat(13/*TokenKind.HASHBANG*/); |
| 16186 while ($notnull_bool(this._peekKind(12/*TokenKind.HASH*/))) { | 16207 while ($notnull_bool(this._peekKind(12/*TokenKind.HASH*/))) { |
| 16187 ret.add(this.directive()); | 16208 ret.add(this.directive()); |
| 16188 } | 16209 } |
| 16189 while ($notnull_bool(!$notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/) ))) { | 16210 while (!$notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/))) { |
| 16190 ret.add(this.topLevelDefinition()); | 16211 ret.add(this.topLevelDefinition()); |
| 16191 } | 16212 } |
| 16192 return (ret && ret.is$List$Definition()); | 16213 return (ret && ret.is$List$Definition()); |
| 16193 } | 16214 } |
| 16194 lang_Parser.prototype.directive = function() { | 16215 lang_Parser.prototype.directive = function() { |
| 16195 var start = this._peekToken.start; | 16216 var start = this._peekToken.start; |
| 16196 this._eat(12/*TokenKind.HASH*/); | 16217 this._eat(12/*TokenKind.HASH*/); |
| 16197 var name = this.identifier(); | 16218 var name = this.identifier(); |
| 16198 var args = this.arguments(); | 16219 var args = this.arguments(); |
| 16199 this._eatSemicolon(); | 16220 this._eatSemicolon(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16238 var _native = null; | 16259 var _native = null; |
| 16239 if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { | 16260 if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { |
| 16240 _native = this.maybeStringLiteral(); | 16261 _native = this.maybeStringLiteral(); |
| 16241 } | 16262 } |
| 16242 var _factory = null; | 16263 var _factory = null; |
| 16243 if ($notnull_bool(this._maybeEat(75/*TokenKind.FACTORY*/))) { | 16264 if ($notnull_bool(this._maybeEat(75/*TokenKind.FACTORY*/))) { |
| 16244 _factory = this.type(0); | 16265 _factory = this.type(0); |
| 16245 } | 16266 } |
| 16246 var body = []; | 16267 var body = []; |
| 16247 if ($notnull_bool(this._maybeEat(6/*TokenKind.LBRACE*/))) { | 16268 if ($notnull_bool(this._maybeEat(6/*TokenKind.LBRACE*/))) { |
| 16248 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/)))) { | 16269 while (!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/))) { |
| 16249 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 16270 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 16250 body.add(this.declaration(true)); | 16271 body.add(this.declaration(true)); |
| 16251 } | 16272 } |
| 16252 } | 16273 } |
| 16253 else { | 16274 else { |
| 16254 this._errorExpected('block starting with "{" or ";"'); | 16275 this._errorExpected('block starting with "{" or ";"'); |
| 16255 } | 16276 } |
| 16256 return new TypeDefinition(kind == 73/*TokenKind.CLASS*/, name, typeParams, _ex tends, _implements, _native, _factory, body, this._makeSpan(start)); | 16277 return new TypeDefinition(kind == 73/*TokenKind.CLASS*/, name, typeParams, _ex tends, _implements, _native, _factory, body, this._makeSpan(start)); |
| 16257 } | 16278 } |
| 16258 lang_Parser.prototype.functionTypeAlias = function() { | 16279 lang_Parser.prototype.functionTypeAlias = function() { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 16275 ret.add(this.expression()); | 16296 ret.add(this.expression()); |
| 16276 } | 16297 } |
| 16277 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 16298 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 16278 this._inInitializers = false; | 16299 this._inInitializers = false; |
| 16279 return ret; | 16300 return ret; |
| 16280 } | 16301 } |
| 16281 lang_Parser.prototype.functionBody = function(inExpression) { | 16302 lang_Parser.prototype.functionBody = function(inExpression) { |
| 16282 var start = this._peekToken.start; | 16303 var start = this._peekToken.start; |
| 16283 if ($notnull_bool(this._maybeEat(9/*TokenKind.ARROW*/))) { | 16304 if ($notnull_bool(this._maybeEat(9/*TokenKind.ARROW*/))) { |
| 16284 var expr = this.expression(); | 16305 var expr = this.expression(); |
| 16285 if ($notnull_bool(!$notnull_bool(inExpression))) { | 16306 if (!$notnull_bool(inExpression)) { |
| 16286 this._eatSemicolon(); | 16307 this._eatSemicolon(); |
| 16287 } | 16308 } |
| 16288 return new ReturnStatement(expr, this._makeSpan(start)); | 16309 return new ReturnStatement(expr, this._makeSpan(start)); |
| 16289 } | 16310 } |
| 16290 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { | 16311 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { |
| 16291 if ($notnull_bool(this.diet)) { | 16312 if ($notnull_bool(this.diet)) { |
| 16292 this._skipBlock(); | 16313 this._skipBlock(); |
| 16293 return new DietStatement(this._makeSpan(start)); | 16314 return new DietStatement(this._makeSpan(start)); |
| 16294 } | 16315 } |
| 16295 else { | 16316 else { |
| 16296 return this.block(); | 16317 return this.block(); |
| 16297 } | 16318 } |
| 16298 } | 16319 } |
| 16299 else if ($notnull_bool(!$notnull_bool(inExpression))) { | 16320 else if (!$notnull_bool(inExpression)) { |
| 16300 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { | 16321 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { |
| 16301 return null; | 16322 return null; |
| 16302 } | 16323 } |
| 16303 else if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { | 16324 else if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { |
| 16304 var nativeBody = this.maybeStringLiteral(); | 16325 var nativeBody = this.maybeStringLiteral(); |
| 16305 if ($notnull_bool(this._peekKind(10/*TokenKind.SEMICOLON*/))) { | 16326 if ($notnull_bool(this._peekKind(10/*TokenKind.SEMICOLON*/))) { |
| 16306 this._eatSemicolon(); | 16327 this._eatSemicolon(); |
| 16307 return new NativeStatement(nativeBody, this._makeSpan(start)); | 16328 return new NativeStatement(nativeBody, this._makeSpan(start)); |
| 16308 } | 16329 } |
| 16309 else { | 16330 else { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16379 var typeParams = null; | 16400 var typeParams = null; |
| 16380 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { | 16401 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { |
| 16381 typeParams = this.typeParameters(); | 16402 typeParams = this.typeParameters(); |
| 16382 } | 16403 } |
| 16383 var name = null; | 16404 var name = null; |
| 16384 var type = null; | 16405 var type = null; |
| 16385 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { | 16406 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { |
| 16386 name = this.identifier(); | 16407 name = this.identifier(); |
| 16387 } | 16408 } |
| 16388 else if ($notnull_bool(typeParams == null)) { | 16409 else if ($notnull_bool(typeParams == null)) { |
| 16389 if ($notnull_bool(names.length > 1)) { | 16410 if (names.length > 1) { |
| 16390 name = names.removeLast(); | 16411 name = names.removeLast(); |
| 16391 } | 16412 } |
| 16392 else { | 16413 else { |
| 16393 name = new lang_Identifier('', names.$index(0).get$span()); | 16414 name = new lang_Identifier('', names.$index(0).get$span()); |
| 16394 } | 16415 } |
| 16395 } | 16416 } |
| 16396 else { | 16417 else { |
| 16397 name = new lang_Identifier('', names.$index(0).get$span()); | 16418 name = new lang_Identifier('', names.$index(0).get$span()); |
| 16398 } | 16419 } |
| 16399 if ($notnull_bool(names.length > 1)) { | 16420 if (names.length > 1) { |
| 16400 this._lang_error('unsupported qualified name for factory', names.$index(0).g et$span()); | 16421 this._lang_error('unsupported qualified name for factory', names.$index(0).g et$span()); |
| 16401 } | 16422 } |
| 16402 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get $span()); | 16423 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get $span()); |
| 16403 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); | 16424 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); |
| 16404 return this.finishDefinition(start, [factoryToken], di); | 16425 return this.finishDefinition(start, [factoryToken], di); |
| 16405 } | 16426 } |
| 16406 lang_Parser.prototype.statement = function() { | 16427 lang_Parser.prototype.statement = function() { |
| 16407 var $0; | 16428 var $0; |
| 16408 switch (this._peek()) { | 16429 switch (this._peek()) { |
| 16409 case 88/*TokenKind.BREAK*/: | 16430 case 88/*TokenKind.BREAK*/: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16472 | 16493 |
| 16473 } | 16494 } |
| 16474 } | 16495 } |
| 16475 lang_Parser.prototype.finishExpressionAsStatement = function(expr) { | 16496 lang_Parser.prototype.finishExpressionAsStatement = function(expr) { |
| 16476 var $0; | 16497 var $0; |
| 16477 var start = expr.get$span().start; | 16498 var start = expr.get$span().start; |
| 16478 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { | 16499 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { |
| 16479 var label = this._makeLabel(expr); | 16500 var label = this._makeLabel(expr); |
| 16480 return new LabeledStatement(label, this.statement(), this._makeSpan(start)); | 16501 return new LabeledStatement(label, this.statement(), this._makeSpan(start)); |
| 16481 } | 16502 } |
| 16482 if ($notnull_bool((expr instanceof LambdaExpression))) { | 16503 if ((expr instanceof LambdaExpression)) { |
| 16483 if ($notnull_bool(!(expr.func.body instanceof BlockStatement))) { | 16504 if (!(expr.func.body instanceof BlockStatement)) { |
| 16484 this._eatSemicolon(); | 16505 this._eatSemicolon(); |
| 16485 expr.func.span = this._makeSpan(start); | 16506 expr.func.span = this._makeSpan(start); |
| 16486 } | 16507 } |
| 16487 return expr.func; | 16508 return expr.func; |
| 16488 } | 16509 } |
| 16489 else if ($notnull_bool((expr instanceof DeclaredIdentifier))) { | 16510 else if ((expr instanceof DeclaredIdentifier)) { |
| 16490 var value = null; | 16511 var value = null; |
| 16491 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { | 16512 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { |
| 16492 value = this.expression(); | 16513 value = this.expression(); |
| 16493 } | 16514 } |
| 16494 return this.finishField(start, null, expr.type, expr.get$name(), value); | 16515 return this.finishField(start, null, expr.type, expr.get$name(), value); |
| 16495 } | 16516 } |
| 16496 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x i nstanceof DeclaredIdentifier)))) { | 16517 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x i nstanceof DeclaredIdentifier)))) { |
| 16497 var di = (($0 = expr.x) && $0.is$DeclaredIdentifier()); | 16518 var di = (($0 = expr.x) && $0.is$DeclaredIdentifier()); |
| 16498 return this.finishField(start, null, di.type, di.name, expr.y); | 16519 return this.finishField(start, null, di.type, di.name, expr.y); |
| 16499 } | 16520 } |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 16516 lang_Parser.prototype.testCondition = function() { | 16537 lang_Parser.prototype.testCondition = function() { |
| 16517 this._eat(2/*TokenKind.LPAREN*/); | 16538 this._eat(2/*TokenKind.LPAREN*/); |
| 16518 var ret = this.expression(); | 16539 var ret = this.expression(); |
| 16519 this._eat(3/*TokenKind.RPAREN*/); | 16540 this._eat(3/*TokenKind.RPAREN*/); |
| 16520 return (ret && ret.is$lang_Expression()); | 16541 return (ret && ret.is$lang_Expression()); |
| 16521 } | 16542 } |
| 16522 lang_Parser.prototype.block = function() { | 16543 lang_Parser.prototype.block = function() { |
| 16523 var start = this._peekToken.start; | 16544 var start = this._peekToken.start; |
| 16524 this._eat(6/*TokenKind.LBRACE*/); | 16545 this._eat(6/*TokenKind.LBRACE*/); |
| 16525 var stmts = []; | 16546 var stmts = []; |
| 16526 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/)))) { | 16547 while (!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/))) { |
| 16527 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 16548 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 16528 stmts.add(this.statement()); | 16549 stmts.add(this.statement()); |
| 16529 } | 16550 } |
| 16530 return new BlockStatement(stmts, this._makeSpan(start)); | 16551 return new BlockStatement(stmts, this._makeSpan(start)); |
| 16531 } | 16552 } |
| 16532 lang_Parser.prototype.emptyStatement = function() { | 16553 lang_Parser.prototype.emptyStatement = function() { |
| 16533 var start = this._peekToken.start; | 16554 var start = this._peekToken.start; |
| 16534 this._eat(10/*TokenKind.SEMICOLON*/); | 16555 this._eat(10/*TokenKind.SEMICOLON*/); |
| 16535 return new EmptyStatement(this._makeSpan(start)); | 16556 return new EmptyStatement(this._makeSpan(start)); |
| 16536 } | 16557 } |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 16559 this._eat(114/*TokenKind.WHILE*/); | 16580 this._eat(114/*TokenKind.WHILE*/); |
| 16560 var test = this.testCondition(); | 16581 var test = this.testCondition(); |
| 16561 this._eatSemicolon(); | 16582 this._eatSemicolon(); |
| 16562 return new DoStatement(body, test, this._makeSpan(start)); | 16583 return new DoStatement(body, test, this._makeSpan(start)); |
| 16563 } | 16584 } |
| 16564 lang_Parser.prototype.forStatement = function() { | 16585 lang_Parser.prototype.forStatement = function() { |
| 16565 var start = this._peekToken.start; | 16586 var start = this._peekToken.start; |
| 16566 this._eat(99/*TokenKind.FOR*/); | 16587 this._eat(99/*TokenKind.FOR*/); |
| 16567 this._eat(2/*TokenKind.LPAREN*/); | 16588 this._eat(2/*TokenKind.LPAREN*/); |
| 16568 var init = this.forInitializerStatement(start); | 16589 var init = this.forInitializerStatement(start); |
| 16569 if ($notnull_bool((init instanceof ForInStatement))) { | 16590 if ((init instanceof ForInStatement)) { |
| 16570 return init; | 16591 return init; |
| 16571 } | 16592 } |
| 16572 var test = null; | 16593 var test = null; |
| 16573 if ($notnull_bool(!$notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/)))) { | 16594 if (!$notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { |
| 16574 test = this.expression(); | 16595 test = this.expression(); |
| 16575 this._eatSemicolon(); | 16596 this._eatSemicolon(); |
| 16576 } | 16597 } |
| 16577 var step = []; | 16598 var step = []; |
| 16578 if ($notnull_bool(!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/)))) { | 16599 if (!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/))) { |
| 16579 step.add(this.expression()); | 16600 step.add(this.expression()); |
| 16580 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 16601 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 16581 step.add(this.expression()); | 16602 step.add(this.expression()); |
| 16582 } | 16603 } |
| 16583 this._eat(3/*TokenKind.RPAREN*/); | 16604 this._eat(3/*TokenKind.RPAREN*/); |
| 16584 } | 16605 } |
| 16585 var body = this.statement(); | 16606 var body = this.statement(); |
| 16586 return new ForStatement(init, test, step, body, this._makeSpan(start)); | 16607 return new ForStatement(init, test, step, body, this._makeSpan(start)); |
| 16587 } | 16608 } |
| 16588 lang_Parser.prototype.forInitializerStatement = function(start) { | 16609 lang_Parser.prototype.forInitializerStatement = function(start) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16640 this._eat(3/*TokenKind.RPAREN*/); | 16661 this._eat(3/*TokenKind.RPAREN*/); |
| 16641 var body = this.block(); | 16662 var body = this.block(); |
| 16642 return new CatchNode(exc, trace, body, this._makeSpan(start)); | 16663 return new CatchNode(exc, trace, body, this._makeSpan(start)); |
| 16643 } | 16664 } |
| 16644 lang_Parser.prototype.switchStatement = function() { | 16665 lang_Parser.prototype.switchStatement = function() { |
| 16645 var start = this._peekToken.start; | 16666 var start = this._peekToken.start; |
| 16646 this._eat(107/*TokenKind.SWITCH*/); | 16667 this._eat(107/*TokenKind.SWITCH*/); |
| 16647 var test = this.testCondition(); | 16668 var test = this.testCondition(); |
| 16648 var cases = []; | 16669 var cases = []; |
| 16649 this._eat(6/*TokenKind.LBRACE*/); | 16670 this._eat(6/*TokenKind.LBRACE*/); |
| 16650 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/)))) { | 16671 while (!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/))) { |
| 16651 cases.add(this.caseNode()); | 16672 cases.add(this.caseNode()); |
| 16652 } | 16673 } |
| 16653 return new SwitchStatement(test, cases, this._makeSpan(start)); | 16674 return new SwitchStatement(test, cases, this._makeSpan(start)); |
| 16654 } | 16675 } |
| 16655 lang_Parser.prototype._peekCaseEnd = function() { | 16676 lang_Parser.prototype._peekCaseEnd = function() { |
| 16656 var kind = this._peek(); | 16677 var kind = this._peek(); |
| 16657 return $notnull_bool($eq(kind, 7/*TokenKind.RBRACE*/) || $eq(kind, 89/*TokenKi nd.CASE*/)) || $eq(kind, 93/*TokenKind.DEFAULT*/); | 16678 return $notnull_bool($notnull_bool($eq(kind, 7/*TokenKind.RBRACE*/) || $eq(kin d, 89/*TokenKind.CASE*/)) || $eq(kind, 93/*TokenKind.DEFAULT*/)); |
| 16658 } | 16679 } |
| 16659 lang_Parser.prototype.caseNode = function() { | 16680 lang_Parser.prototype.caseNode = function() { |
| 16660 var start = this._peekToken.start; | 16681 var start = this._peekToken.start; |
| 16661 var label = null; | 16682 var label = null; |
| 16662 if ($notnull_bool(this._peekIdentifier())) { | 16683 if ($notnull_bool(this._peekIdentifier())) { |
| 16663 label = this.identifier(); | 16684 label = this.identifier(); |
| 16664 this._eat(8/*TokenKind.COLON*/); | 16685 this._eat(8/*TokenKind.COLON*/); |
| 16665 } | 16686 } |
| 16666 var cases = []; | 16687 var cases = []; |
| 16667 while ($notnull_bool(true)) { | 16688 while (true) { |
| 16668 if ($notnull_bool(this._maybeEat(89/*TokenKind.CASE*/))) { | 16689 if ($notnull_bool(this._maybeEat(89/*TokenKind.CASE*/))) { |
| 16669 cases.add(this.expression()); | 16690 cases.add(this.expression()); |
| 16670 this._eat(8/*TokenKind.COLON*/); | 16691 this._eat(8/*TokenKind.COLON*/); |
| 16671 } | 16692 } |
| 16672 else if ($notnull_bool(this._maybeEat(93/*TokenKind.DEFAULT*/))) { | 16693 else if ($notnull_bool(this._maybeEat(93/*TokenKind.DEFAULT*/))) { |
| 16673 cases.add(null); | 16694 cases.add(null); |
| 16674 this._eat(8/*TokenKind.COLON*/); | 16695 this._eat(8/*TokenKind.COLON*/); |
| 16675 } | 16696 } |
| 16676 else { | 16697 else { |
| 16677 break; | 16698 break; |
| 16678 } | 16699 } |
| 16679 } | 16700 } |
| 16680 if ($notnull_bool(cases.length == 0)) { | 16701 if (cases.length == 0) { |
| 16681 this._lang_error('case or default'); | 16702 this._lang_error('case or default'); |
| 16682 } | 16703 } |
| 16683 var stmts = []; | 16704 var stmts = []; |
| 16684 while ($notnull_bool(!$notnull_bool(this._peekCaseEnd()))) { | 16705 while (!$notnull_bool(this._peekCaseEnd())) { |
| 16685 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 16706 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 16686 stmts.add(this.statement()); | 16707 stmts.add(this.statement()); |
| 16687 } | 16708 } |
| 16688 return new CaseNode(label, cases, stmts, this._makeSpan(start)); | 16709 return new CaseNode(label, cases, stmts, this._makeSpan(start)); |
| 16689 } | 16710 } |
| 16690 lang_Parser.prototype.returnStatement = function() { | 16711 lang_Parser.prototype.returnStatement = function() { |
| 16691 var start = this._peekToken.start; | 16712 var start = this._peekToken.start; |
| 16692 this._eat(105/*TokenKind.RETURN*/); | 16713 this._eat(105/*TokenKind.RETURN*/); |
| 16693 var expr; | 16714 var expr; |
| 16694 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { | 16715 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16739 if ($notnull_bool(this._peekIdentifier())) { | 16760 if ($notnull_bool(this._peekIdentifier())) { |
| 16740 name = this.identifier(); | 16761 name = this.identifier(); |
| 16741 } | 16762 } |
| 16742 this._eatSemicolon(); | 16763 this._eatSemicolon(); |
| 16743 return new ContinueStatement(name, this._makeSpan(start)); | 16764 return new ContinueStatement(name, this._makeSpan(start)); |
| 16744 } | 16765 } |
| 16745 lang_Parser.prototype.expression = function() { | 16766 lang_Parser.prototype.expression = function() { |
| 16746 return this.infixExpression(0); | 16767 return this.infixExpression(0); |
| 16747 } | 16768 } |
| 16748 lang_Parser.prototype._makeType = function(expr) { | 16769 lang_Parser.prototype._makeType = function(expr) { |
| 16749 if ($notnull_bool((expr instanceof VarExpression))) { | 16770 if ((expr instanceof VarExpression)) { |
| 16750 return new NameTypeReference(false, expr.get$name(), null, expr.get$span()); | 16771 return new NameTypeReference(false, expr.get$name(), null, expr.get$span()); |
| 16751 } | 16772 } |
| 16752 else if ($notnull_bool((expr instanceof DotExpression))) { | 16773 else if ((expr instanceof DotExpression)) { |
| 16753 var type = this._makeType(expr.self); | 16774 var type = this._makeType(expr.self); |
| 16754 if ($notnull_bool(type.names == null)) { | 16775 if (type.names == null) { |
| 16755 type.names = [expr.get$name()]; | 16776 type.names = [expr.get$name()]; |
| 16756 } | 16777 } |
| 16757 else { | 16778 else { |
| 16758 type.names.add(expr.get$name()); | 16779 type.names.add(expr.get$name()); |
| 16759 } | 16780 } |
| 16760 type.span = expr.get$span(); | 16781 type.span = expr.get$span(); |
| 16761 return type; | 16782 return type; |
| 16762 } | 16783 } |
| 16763 else { | 16784 else { |
| 16764 this._lang_error('expected type reference'); | 16785 this._lang_error('expected type reference'); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 16780 var typeParam = this._makeType(x.y); | 16801 var typeParam = this._makeType(x.y); |
| 16781 var type = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.s pan.start)); | 16802 var type = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.s pan.start)); |
| 16782 return this._finishDeclaredId(type); | 16803 return this._finishDeclaredId(type); |
| 16783 } | 16804 } |
| 16784 else { | 16805 else { |
| 16785 $assert(this._peekKind(52/*TokenKind.LT*/), "_peekKind(TokenKind.LT)", "pars er.dart", 801, 14); | 16806 $assert(this._peekKind(52/*TokenKind.LT*/), "_peekKind(TokenKind.LT)", "pars er.dart", 801, 14); |
| 16786 var base = this._makeType(x.x); | 16807 var base = this._makeType(x.x); |
| 16787 var paramBase = this._makeType(x.y); | 16808 var paramBase = this._makeType(x.y); |
| 16788 var firstParam = this.addTypeArguments((paramBase && paramBase.is$TypeRefere nce()), 1); | 16809 var firstParam = this.addTypeArguments((paramBase && paramBase.is$TypeRefere nce()), 1); |
| 16789 var type; | 16810 var type; |
| 16790 if ($notnull_bool(firstParam.depth <= 0)) { | 16811 if (firstParam.depth <= 0) { |
| 16791 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start)); | 16812 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start)); |
| 16792 } | 16813 } |
| 16793 else if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 16814 else if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 16794 type = this._finishTypeArguments((base && base.is$TypeReference()), 0, [fi rstParam]); | 16815 type = this._finishTypeArguments((base && base.is$TypeReference()), 0, [fi rstParam]); |
| 16795 } | 16816 } |
| 16796 else { | 16817 else { |
| 16797 this._eat(53/*TokenKind.GT*/); | 16818 this._eat(53/*TokenKind.GT*/); |
| 16798 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start)); | 16819 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start)); |
| 16799 } | 16820 } |
| 16800 return this._finishDeclaredId(type); | 16821 return this._finishDeclaredId(type); |
| 16801 } | 16822 } |
| 16802 } | 16823 } |
| 16803 lang_Parser.prototype.finishInfixExpression = function(x, precedence) { | 16824 lang_Parser.prototype.finishInfixExpression = function(x, precedence) { |
| 16804 while ($notnull_bool(true)) { | 16825 while (true) { |
| 16805 var kind = this._peek(); | 16826 var kind = this._peek(); |
| 16806 var prec = TokenKind.infixPrecedence(this._peek()); | 16827 var prec = TokenKind.infixPrecedence(this._peek()); |
| 16807 if ($notnull_bool(prec >= precedence)) { | 16828 if (prec >= precedence) { |
| 16808 if ($notnull_bool(kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/ )) { | 16829 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) { |
| 16809 if ($notnull_bool(this._isBin(x, 52/*TokenKind.LT*/))) { | 16830 if ($notnull_bool(this._isBin(x, 52/*TokenKind.LT*/))) { |
| 16810 return this._fixAsType((x && x.is$BinaryExpression())); | 16831 return this._fixAsType((x && x.is$BinaryExpression())); |
| 16811 } | 16832 } |
| 16812 } | 16833 } |
| 16813 var op = this._lang_next(); | 16834 var op = this._lang_next(); |
| 16814 if ($notnull_bool($eq(op.kind, 102/*TokenKind.IS*/))) { | 16835 if ($notnull_bool($eq(op.kind, 102/*TokenKind.IS*/))) { |
| 16815 var isTrue = !$notnull_bool(this._maybeEat(19/*TokenKind.NOT*/)); | 16836 var isTrue = !$notnull_bool(this._maybeEat(19/*TokenKind.NOT*/)); |
| 16816 var typeRef = this.type(0); | 16837 var typeRef = this.type(0); |
| 16817 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); | 16838 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); |
| 16818 continue; | 16839 continue; |
| 16819 } | 16840 } |
| 16820 var y = this.infixExpression($assert_num($notnull_bool($eq(prec, 2)) ? pre c : prec + 1)); | 16841 var y = this.infixExpression($assert_num($notnull_bool($eq(prec, 2)) ? pre c : prec + 1)); |
| 16821 if ($notnull_bool($eq(op.kind, 33/*TokenKind.CONDITIONAL*/))) { | 16842 if ($notnull_bool($eq(op.kind, 33/*TokenKind.CONDITIONAL*/))) { |
| 16822 this._eat(8/*TokenKind.COLON*/); | 16843 this._eat(8/*TokenKind.COLON*/); |
| 16823 var z = this.infixExpression($assert_num(prec + 1)); | 16844 var z = this.infixExpression($assert_num(prec)); |
| 16824 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start)); | 16845 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start)); |
| 16825 } | 16846 } |
| 16826 else { | 16847 else { |
| 16827 x = new BinaryExpression(op, x, y, this._makeSpan(x.span.start)); | 16848 x = new BinaryExpression(op, x, y, this._makeSpan(x.span.start)); |
| 16828 } | 16849 } |
| 16829 } | 16850 } |
| 16830 else { | 16851 else { |
| 16831 break; | 16852 break; |
| 16832 } | 16853 } |
| 16833 } | 16854 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16869 expr = this.expression(); | 16890 expr = this.expression(); |
| 16870 if ($notnull_bool(label == null && this._maybeEat(8/*TokenKind.COLON*/))) { | 16891 if ($notnull_bool(label == null && this._maybeEat(8/*TokenKind.COLON*/))) { |
| 16871 label = this._makeLabel(expr); | 16892 label = this._makeLabel(expr); |
| 16872 expr = this.expression(); | 16893 expr = this.expression(); |
| 16873 } | 16894 } |
| 16874 return new ArgumentNode(label, expr, this._makeSpan(start)); | 16895 return new ArgumentNode(label, expr, this._makeSpan(start)); |
| 16875 } | 16896 } |
| 16876 lang_Parser.prototype.arguments = function() { | 16897 lang_Parser.prototype.arguments = function() { |
| 16877 var args = []; | 16898 var args = []; |
| 16878 this._eat(2/*TokenKind.LPAREN*/); | 16899 this._eat(2/*TokenKind.LPAREN*/); |
| 16879 if ($notnull_bool(!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/)))) { | 16900 if (!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/))) { |
| 16880 do { | 16901 do { |
| 16881 args.add(this.argument()); | 16902 args.add(this.argument()); |
| 16882 } | 16903 } |
| 16883 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 16904 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 16884 this._eat(3/*TokenKind.RPAREN*/); | 16905 this._eat(3/*TokenKind.RPAREN*/); |
| 16885 } | 16906 } |
| 16886 return args; | 16907 return args; |
| 16887 } | 16908 } |
| 16888 lang_Parser.prototype.get$arguments = function() { | 16909 lang_Parser.prototype.get$arguments = function() { |
| 16889 return lang_Parser.prototype.arguments.bind(this); | 16910 return lang_Parser.prototype.arguments.bind(this); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16926 if ($notnull_bool(this._peekIdentifier())) { | 16947 if ($notnull_bool(this._peekIdentifier())) { |
| 16927 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp e(expr), this.identifier(), this._makeSpan(expr.get$span().start))); | 16948 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp e(expr), this.identifier(), this._makeSpan(expr.get$span().start))); |
| 16928 } | 16949 } |
| 16929 else { | 16950 else { |
| 16930 return expr; | 16951 return expr; |
| 16931 } | 16952 } |
| 16932 | 16953 |
| 16933 } | 16954 } |
| 16934 } | 16955 } |
| 16935 lang_Parser.prototype._isBin = function(expr, kind) { | 16956 lang_Parser.prototype._isBin = function(expr, kind) { |
| 16936 return $notnull_bool((expr instanceof BinaryExpression) && expr.op.kind == kin d); | 16957 return (expr instanceof BinaryExpression) && expr.op.kind == kind; |
| 16937 } | 16958 } |
| 16938 lang_Parser.prototype._boolTypeRef = function(span) { | 16959 lang_Parser.prototype._boolTypeRef = function(span) { |
| 16939 return new TypeReference(span, world.boolType); | 16960 return new TypeReference(span, world.nonNullBool); |
| 16940 } | 16961 } |
| 16941 lang_Parser.prototype._intTypeRef = function(span) { | 16962 lang_Parser.prototype._intTypeRef = function(span) { |
| 16942 return new TypeReference(span, world.intType); | 16963 return new TypeReference(span, world.intType); |
| 16943 } | 16964 } |
| 16944 lang_Parser.prototype._doubleTypeRef = function(span) { | 16965 lang_Parser.prototype._doubleTypeRef = function(span) { |
| 16945 return new TypeReference(span, world.doubleType); | 16966 return new TypeReference(span, world.doubleType); |
| 16946 } | 16967 } |
| 16947 lang_Parser.prototype._stringTypeRef = function(span) { | 16968 lang_Parser.prototype._stringTypeRef = function(span) { |
| 16948 return new TypeReference(span, world.stringType); | 16969 return new TypeReference(span, world.stringType); |
| 16949 } | 16970 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 17037 return this.finishTypedLiteral(start, false); | 17058 return this.finishTypedLiteral(start, false); |
| 17038 | 17059 |
| 17039 case 113/*TokenKind.VOID*/: | 17060 case 113/*TokenKind.VOID*/: |
| 17040 case 112/*TokenKind.VAR*/: | 17061 case 112/*TokenKind.VAR*/: |
| 17041 case 97/*TokenKind.FINAL*/: | 17062 case 97/*TokenKind.FINAL*/: |
| 17042 | 17063 |
| 17043 return this.declaredIdentifier(false); | 17064 return this.declaredIdentifier(false); |
| 17044 | 17065 |
| 17045 default: | 17066 default: |
| 17046 | 17067 |
| 17047 if ($notnull_bool(!$notnull_bool(this._peekIdentifier()))) { | 17068 if (!$notnull_bool(this._peekIdentifier())) { |
| 17048 this._errorExpected('expression'); | 17069 this._errorExpected('expression'); |
| 17049 } | 17070 } |
| 17050 return new VarExpression(this.identifier(), this._makeSpan(start)); | 17071 return new VarExpression(this.identifier(), this._makeSpan(start)); |
| 17051 | 17072 |
| 17052 } | 17073 } |
| 17053 } | 17074 } |
| 17054 lang_Parser.prototype.stringInterpolation = function() { | 17075 lang_Parser.prototype.stringInterpolation = function() { |
| 17055 var start = this._peekToken.start; | 17076 var start = this._peekToken.start; |
| 17056 var lits = []; | 17077 var lits = []; |
| 17057 var startQuote = null, endQuote = null; | 17078 var startQuote = null, endQuote = null; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 17108 } | 17129 } |
| 17109 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) { | 17130 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) { |
| 17110 this._lang_next(); | 17131 this._lang_next(); |
| 17111 this._errorExpected('string literal, but found incomplete string'); | 17132 this._errorExpected('string literal, but found incomplete string'); |
| 17112 } | 17133 } |
| 17113 return null; | 17134 return null; |
| 17114 } | 17135 } |
| 17115 lang_Parser.prototype._parenOrLambda = function() { | 17136 lang_Parser.prototype._parenOrLambda = function() { |
| 17116 var start = this._peekToken.start; | 17137 var start = this._peekToken.start; |
| 17117 var args = this.arguments(); | 17138 var args = this.arguments(); |
| 17118 if ($notnull_bool(!$notnull_bool(this._inInitializers) && ($notnull_bool(this. _peekKind(9/*TokenKind.ARROW*/) || this._peekKind(6/*TokenKind.LBRACE*/))))) { | 17139 if (!$notnull_bool(this._inInitializers) && ($notnull_bool(this._peekKind(9/*T okenKind.ARROW*/) || this._peekKind(6/*TokenKind.LBRACE*/)))) { |
| 17119 var body = this.functionBody(true); | 17140 var body = this.functionBody(true); |
| 17120 var formals = this._makeFormals(args); | 17141 var formals = this._makeFormals(args); |
| 17121 var func = new FunctionDefinition(null, null, null, formals, null, body, thi s._makeSpan(start)); | 17142 var func = new FunctionDefinition(null, null, null, formals, null, body, thi s._makeSpan(start)); |
| 17122 return new LambdaExpression(func, func.get$span()); | 17143 return new LambdaExpression(func, func.get$span()); |
| 17123 } | 17144 } |
| 17124 else { | 17145 else { |
| 17125 if ($notnull_bool(args.length == 1)) { | 17146 if (args.length == 1) { |
| 17126 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star t)); | 17147 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star t)); |
| 17127 } | 17148 } |
| 17128 else { | 17149 else { |
| 17129 this._lang_error('unexpected comma expression'); | 17150 this._lang_error('unexpected comma expression'); |
| 17130 return args.$index(0).get$value(); | 17151 return args.$index(0).get$value(); |
| 17131 } | 17152 } |
| 17132 } | 17153 } |
| 17133 } | 17154 } |
| 17134 lang_Parser.prototype._typeAsIdentifier = function(type) { | 17155 lang_Parser.prototype._typeAsIdentifier = function(type) { |
| 17135 return type.get$name(); | 17156 return type.get$name(); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 17147 | 17168 |
| 17148 case 108/*TokenKind.THIS*/: | 17169 case 108/*TokenKind.THIS*/: |
| 17149 | 17170 |
| 17150 this._eat(108/*TokenKind.THIS*/); | 17171 this._eat(108/*TokenKind.THIS*/); |
| 17151 this._eat(14/*TokenKind.DOT*/); | 17172 this._eat(14/*TokenKind.DOT*/); |
| 17152 name = ('this.' + this.identifier().get$name() + ''); | 17173 name = ('this.' + this.identifier().get$name() + ''); |
| 17153 break; | 17174 break; |
| 17154 | 17175 |
| 17155 case 76/*TokenKind.GET*/: | 17176 case 76/*TokenKind.GET*/: |
| 17156 | 17177 |
| 17157 if ($notnull_bool(!$notnull_bool(includeOperators))) return null; | 17178 if (!$notnull_bool(includeOperators)) return null; |
| 17158 this._eat(76/*TokenKind.GET*/); | 17179 this._eat(76/*TokenKind.GET*/); |
| 17159 if ($notnull_bool(this._peekIdentifier())) { | 17180 if ($notnull_bool(this._peekIdentifier())) { |
| 17160 name = ('get\$' + this.identifier().get$name() + ''); | 17181 name = ('get\$' + this.identifier().get$name() + ''); |
| 17161 } | 17182 } |
| 17162 else { | 17183 else { |
| 17163 name = 'get'; | 17184 name = 'get'; |
| 17164 } | 17185 } |
| 17165 break; | 17186 break; |
| 17166 | 17187 |
| 17167 case 84/*TokenKind.SET*/: | 17188 case 84/*TokenKind.SET*/: |
| 17168 | 17189 |
| 17169 if ($notnull_bool(!$notnull_bool(includeOperators))) return null; | 17190 if (!$notnull_bool(includeOperators)) return null; |
| 17170 this._eat(84/*TokenKind.SET*/); | 17191 this._eat(84/*TokenKind.SET*/); |
| 17171 if ($notnull_bool(this._peekIdentifier())) { | 17192 if ($notnull_bool(this._peekIdentifier())) { |
| 17172 name = ('set\$' + this.identifier().get$name() + ''); | 17193 name = ('set\$' + this.identifier().get$name() + ''); |
| 17173 } | 17194 } |
| 17174 else { | 17195 else { |
| 17175 name = 'set'; | 17196 name = 'set'; |
| 17176 } | 17197 } |
| 17177 break; | 17198 break; |
| 17178 | 17199 |
| 17179 case 83/*TokenKind.OPERATOR*/: | 17200 case 83/*TokenKind.OPERATOR*/: |
| 17180 | 17201 |
| 17181 if ($notnull_bool(!$notnull_bool(includeOperators))) return null; | 17202 if (!$notnull_bool(includeOperators)) return null; |
| 17182 this._eat(83/*TokenKind.OPERATOR*/); | 17203 this._eat(83/*TokenKind.OPERATOR*/); |
| 17183 var kind = this._peek(); | 17204 var kind = this._peek(); |
| 17184 if ($notnull_bool($eq(kind, 82/*TokenKind.NEGATE*/))) { | 17205 if ($notnull_bool($eq(kind, 82/*TokenKind.NEGATE*/))) { |
| 17185 name = '\$negate'; | 17206 name = '\$negate'; |
| 17186 this._lang_next(); | 17207 this._lang_next(); |
| 17187 } | 17208 } |
| 17188 else { | 17209 else { |
| 17189 name = TokenKind.binaryMethodName($assert_num(kind)); | 17210 name = TokenKind.binaryMethodName($assert_num(kind)); |
| 17190 if ($notnull_bool(name == null)) { | 17211 if (name == null) { |
| 17191 name = 'operator'; | 17212 name = 'operator'; |
| 17192 } | 17213 } |
| 17193 else { | 17214 else { |
| 17194 this._lang_next(); | 17215 this._lang_next(); |
| 17195 } | 17216 } |
| 17196 } | 17217 } |
| 17197 break; | 17218 break; |
| 17198 | 17219 |
| 17199 default: | 17220 default: |
| 17200 | 17221 |
| 17201 return null; | 17222 return null; |
| 17202 | 17223 |
| 17203 } | 17224 } |
| 17204 return new lang_Identifier(name, this._makeSpan(start)); | 17225 return new lang_Identifier(name, this._makeSpan(start)); |
| 17205 } | 17226 } |
| 17206 lang_Parser.prototype.declaredIdentifier = function(includeOperators) { | 17227 lang_Parser.prototype.declaredIdentifier = function(includeOperators) { |
| 17207 var start = this._peekToken.start; | 17228 var start = this._peekToken.start; |
| 17208 var myType = null; | 17229 var myType = null; |
| 17209 var name = this._specialIdentifier(includeOperators); | 17230 var name = this._specialIdentifier(includeOperators); |
| 17210 if ($notnull_bool(name == null)) { | 17231 if (name == null) { |
| 17211 myType = this.type(0); | 17232 myType = this.type(0); |
| 17212 name = this._specialIdentifier(includeOperators); | 17233 name = this._specialIdentifier(includeOperators); |
| 17213 if ($notnull_bool(name == null)) { | 17234 if (name == null) { |
| 17214 if ($notnull_bool(this._peekIdentifier())) { | 17235 if ($notnull_bool(this._peekIdentifier())) { |
| 17215 name = this.identifier(); | 17236 name = this.identifier(); |
| 17216 } | 17237 } |
| 17217 else if ($notnull_bool((myType instanceof NameTypeReference) && myType.nam es == null)) { | 17238 else if ((myType instanceof NameTypeReference) && myType.names == null) { |
| 17218 name = this._typeAsIdentifier(myType); | 17239 name = this._typeAsIdentifier(myType); |
| 17219 myType = null; | 17240 myType = null; |
| 17220 } | 17241 } |
| 17221 else { | 17242 else { |
| 17222 } | 17243 } |
| 17223 } | 17244 } |
| 17224 } | 17245 } |
| 17225 return new DeclaredIdentifier(myType, name, this._makeSpan(start)); | 17246 return new DeclaredIdentifier(myType, name, this._makeSpan(start)); |
| 17226 } | 17247 } |
| 17227 lang_Parser._hexDigit = function(c) { | 17248 lang_Parser._hexDigit = function(c) { |
| 17228 if ($notnull_bool(c >= 48 && c <= 57)) { | 17249 if (c >= 48 && c <= 57) { |
| 17229 return c - 48; | 17250 return c - 48; |
| 17230 } | 17251 } |
| 17231 else if ($notnull_bool(c >= 97 && c <= 102)) { | 17252 else if (c >= 97 && c <= 102) { |
| 17232 return c - 87; | 17253 return c - 87; |
| 17233 } | 17254 } |
| 17234 else if ($notnull_bool(c >= 65 && c <= 70)) { | 17255 else if (c >= 65 && c <= 70) { |
| 17235 return c - 55; | 17256 return c - 55; |
| 17236 } | 17257 } |
| 17237 else { | 17258 else { |
| 17238 return -1; | 17259 return -1; |
| 17239 } | 17260 } |
| 17240 } | 17261 } |
| 17241 lang_Parser.parseHex = function(hex) { | 17262 lang_Parser.parseHex = function(hex) { |
| 17242 var result = 0; | 17263 var result = 0; |
| 17243 for (var i = 0; | 17264 for (var i = 0; |
| 17244 $notnull_bool(i < hex.length); i++) { | 17265 i < hex.length; i++) { |
| 17245 var digit = lang_Parser._hexDigit(hex.charCodeAt(i)); | 17266 var digit = lang_Parser._hexDigit(hex.charCodeAt(i)); |
| 17246 $assert($ne(digit, -1), "digit != -1", "parser.dart", 1257, 14); | 17267 $assert($ne(digit, -1), "digit != -1", "parser.dart", 1259, 14); |
| 17247 result = (result << 4) + $assert_num(digit); | 17268 result = (result << 4) + $assert_num(digit); |
| 17248 } | 17269 } |
| 17249 return $assert_num(result); | 17270 return $assert_num(result); |
| 17250 } | 17271 } |
| 17251 lang_Parser.prototype.finishNewExpression = function(start, isConst) { | 17272 lang_Parser.prototype.finishNewExpression = function(start, isConst) { |
| 17252 var type = this.type(0); | 17273 var type = this.type(0); |
| 17253 var name = null; | 17274 var name = null; |
| 17254 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { | 17275 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { |
| 17255 name = this.identifier(); | 17276 name = this.identifier(); |
| 17256 } | 17277 } |
| 17257 var args = this.arguments(); | 17278 var args = this.arguments(); |
| 17258 return new lang_NewExpression(isConst, type, name, args, this._makeSpan(start) ); | 17279 return new lang_NewExpression(isConst, type, name, args, this._makeSpan(start) ); |
| 17259 } | 17280 } |
| 17260 lang_Parser.prototype.finishListLiteral = function(start, isConst, type) { | 17281 lang_Parser.prototype.finishListLiteral = function(start, isConst, type) { |
| 17261 if ($notnull_bool(this._maybeEat(56/*TokenKind.INDEX*/))) { | 17282 if ($notnull_bool(this._maybeEat(56/*TokenKind.INDEX*/))) { |
| 17262 return new ListExpression(isConst, type, [], this._makeSpan(start)); | 17283 return new ListExpression(isConst, type, [], this._makeSpan(start)); |
| 17263 } | 17284 } |
| 17264 var values = []; | 17285 var values = []; |
| 17265 this._eat(4/*TokenKind.LBRACK*/); | 17286 this._eat(4/*TokenKind.LBRACK*/); |
| 17266 while ($notnull_bool(!$notnull_bool(this._maybeEat(5/*TokenKind.RBRACK*/)))) { | 17287 while (!$notnull_bool(this._maybeEat(5/*TokenKind.RBRACK*/))) { |
| 17267 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 17288 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 17268 values.add(this.expression()); | 17289 values.add(this.expression()); |
| 17269 if ($notnull_bool(!$notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/)))) { | 17290 if (!$notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 17270 this._eat(5/*TokenKind.RBRACK*/); | 17291 this._eat(5/*TokenKind.RBRACK*/); |
| 17271 break; | 17292 break; |
| 17272 } | 17293 } |
| 17273 } | 17294 } |
| 17274 return new ListExpression(isConst, type, values, this._makeSpan(start)); | 17295 return new ListExpression(isConst, type, values, this._makeSpan(start)); |
| 17275 } | 17296 } |
| 17276 lang_Parser.prototype.finishMapLiteral = function(start, isConst, type) { | 17297 lang_Parser.prototype.finishMapLiteral = function(start, isConst, type) { |
| 17277 var items = []; | 17298 var items = []; |
| 17278 this._eat(6/*TokenKind.LBRACE*/); | 17299 this._eat(6/*TokenKind.LBRACE*/); |
| 17279 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/)))) { | 17300 while (!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/))) { |
| 17280 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 17301 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 17281 items.add(this.expression()); | 17302 items.add(this.expression()); |
| 17282 this._eat(8/*TokenKind.COLON*/); | 17303 this._eat(8/*TokenKind.COLON*/); |
| 17283 items.add(this.expression()); | 17304 items.add(this.expression()); |
| 17284 if ($notnull_bool(!$notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/)))) { | 17305 if (!$notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 17285 this._eat(7/*TokenKind.RBRACE*/); | 17306 this._eat(7/*TokenKind.RBRACE*/); |
| 17286 break; | 17307 break; |
| 17287 } | 17308 } |
| 17288 } | 17309 } |
| 17289 return new MapExpression(isConst, type, items, this._makeSpan(start)); | 17310 return new MapExpression(isConst, type, items, this._makeSpan(start)); |
| 17290 } | 17311 } |
| 17291 lang_Parser.prototype.finishTypedLiteral = function(start, isConst) { | 17312 lang_Parser.prototype.finishTypedLiteral = function(start, isConst) { |
| 17292 var span = this._makeSpan(start); | 17313 var span = this._makeSpan(start); |
| 17293 var typeToBeNamedLater = new NameTypeReference(false, null, null, (span && spa n.is$SourceSpan())); | 17314 var typeToBeNamedLater = new NameTypeReference(false, null, null, (span && spa n.is$SourceSpan())); |
| 17294 var genericType = this.addTypeArguments((typeToBeNamedLater && typeToBeNamedLa ter.is$TypeReference()), 0); | 17315 var genericType = this.addTypeArguments((typeToBeNamedLater && typeToBeNamedLa ter.is$TypeReference()), 0); |
| 17295 if ($notnull_bool(this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/* TokenKind.INDEX*/))) { | 17316 if ($notnull_bool(this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/* TokenKind.INDEX*/))) { |
| 17296 return this.finishListLiteral(start, isConst, (genericType && genericType.is $TypeReference())); | 17317 return this.finishListLiteral(start, isConst, (genericType && genericType.is $TypeReference())); |
| 17297 } | 17318 } |
| 17298 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { | 17319 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { |
| 17299 return this.finishMapLiteral(start, isConst, (genericType && genericType.is$ TypeReference())); | 17320 return this.finishMapLiteral(start, isConst, (genericType && genericType.is$ TypeReference())); |
| 17300 } | 17321 } |
| 17301 else { | 17322 else { |
| 17302 this._errorExpected('array or map literal'); | 17323 this._errorExpected('array or map literal'); |
| 17303 } | 17324 } |
| 17304 } | 17325 } |
| 17305 lang_Parser.prototype._readModifiers = function() { | 17326 lang_Parser.prototype._readModifiers = function() { |
| 17306 var modifiers = null; | 17327 var modifiers = null; |
| 17307 while ($notnull_bool(true)) { | 17328 while (true) { |
| 17308 switch (this._peek()) { | 17329 switch (this._peek()) { |
| 17309 case 86/*TokenKind.STATIC*/: | 17330 case 86/*TokenKind.STATIC*/: |
| 17310 case 97/*TokenKind.FINAL*/: | 17331 case 97/*TokenKind.FINAL*/: |
| 17311 case 91/*TokenKind.CONST*/: | 17332 case 91/*TokenKind.CONST*/: |
| 17312 case 71/*TokenKind.ABSTRACT*/: | 17333 case 71/*TokenKind.ABSTRACT*/: |
| 17313 case 75/*TokenKind.FACTORY*/: | 17334 case 75/*TokenKind.FACTORY*/: |
| 17314 | 17335 |
| 17315 if ($notnull_bool(modifiers == null)) modifiers = []; | 17336 if (modifiers == null) modifiers = []; |
| 17316 modifiers.add(this._lang_next()); | 17337 modifiers.add(this._lang_next()); |
| 17317 break; | 17338 break; |
| 17318 | 17339 |
| 17319 default: | 17340 default: |
| 17320 | 17341 |
| 17321 return modifiers; | 17342 return modifiers; |
| 17322 | 17343 |
| 17323 } | 17344 } |
| 17324 } | 17345 } |
| 17325 return null; | 17346 return null; |
| 17326 } | 17347 } |
| 17327 lang_Parser.prototype.typeParameter = function() { | 17348 lang_Parser.prototype.typeParameter = function() { |
| 17328 var start = this._peekToken.start; | 17349 var start = this._peekToken.start; |
| 17329 var name = this.identifier(); | 17350 var name = this.identifier(); |
| 17330 var myType = null; | 17351 var myType = null; |
| 17331 if ($notnull_bool(this._maybeEat(74/*TokenKind.EXTENDS*/))) { | 17352 if ($notnull_bool(this._maybeEat(74/*TokenKind.EXTENDS*/))) { |
| 17332 myType = this.type(1); | 17353 myType = this.type(1); |
| 17333 } | 17354 } |
| 17334 return new TypeParameter(name, myType, this._makeSpan(start)); | 17355 return new TypeParameter(name, myType, this._makeSpan(start)); |
| 17335 } | 17356 } |
| 17336 lang_Parser.prototype.typeParameters = function() { | 17357 lang_Parser.prototype.typeParameters = function() { |
| 17337 this._eat(52/*TokenKind.LT*/); | 17358 this._eat(52/*TokenKind.LT*/); |
| 17338 var closed = false; | 17359 var closed = false; |
| 17339 var ret = []; | 17360 var ret = []; |
| 17340 do { | 17361 do { |
| 17341 var tp = this.typeParameter(); | 17362 var tp = this.typeParameter(); |
| 17342 ret.add(tp); | 17363 ret.add(tp); |
| 17343 if ($notnull_bool((tp.extendsType instanceof GenericTypeReference) && tp.ext endsType.depth == 0)) { | 17364 if ((tp.extendsType instanceof GenericTypeReference) && tp.extendsType.depth == 0) { |
| 17344 closed = true; | 17365 closed = true; |
| 17345 break; | 17366 break; |
| 17346 } | 17367 } |
| 17347 } | 17368 } |
| 17348 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 17369 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 17349 if ($notnull_bool(!$notnull_bool(closed))) { | 17370 if (!$notnull_bool(closed)) { |
| 17350 this._eat(53/*TokenKind.GT*/); | 17371 this._eat(53/*TokenKind.GT*/); |
| 17351 } | 17372 } |
| 17352 return ret; | 17373 return ret; |
| 17353 } | 17374 } |
| 17354 lang_Parser.prototype.get$typeParameters = function() { | 17375 lang_Parser.prototype.get$typeParameters = function() { |
| 17355 return lang_Parser.prototype.typeParameters.bind(this); | 17376 return lang_Parser.prototype.typeParameters.bind(this); |
| 17356 } | 17377 } |
| 17357 lang_Parser.prototype._eatClosingAngle = function(depth) { | 17378 lang_Parser.prototype._eatClosingAngle = function(depth) { |
| 17358 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { | 17379 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { |
| 17359 return depth; | 17380 return depth; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 17371 } | 17392 } |
| 17372 lang_Parser.prototype.addTypeArguments = function(baseType, depth) { | 17393 lang_Parser.prototype.addTypeArguments = function(baseType, depth) { |
| 17373 this._eat(52/*TokenKind.LT*/); | 17394 this._eat(52/*TokenKind.LT*/); |
| 17374 return this._finishTypeArguments(baseType, depth, []); | 17395 return this._finishTypeArguments(baseType, depth, []); |
| 17375 } | 17396 } |
| 17376 lang_Parser.prototype._finishTypeArguments = function(baseType, depth, types) { | 17397 lang_Parser.prototype._finishTypeArguments = function(baseType, depth, types) { |
| 17377 var delta = -1; | 17398 var delta = -1; |
| 17378 do { | 17399 do { |
| 17379 var myType = this.type(depth + 1); | 17400 var myType = this.type(depth + 1); |
| 17380 types.add(myType); | 17401 types.add(myType); |
| 17381 if ($notnull_bool((myType instanceof GenericTypeReference) && myType.depth < = depth)) { | 17402 if ((myType instanceof GenericTypeReference) && myType.depth <= depth) { |
| 17382 delta = depth - myType.depth; | 17403 delta = depth - myType.depth; |
| 17383 break; | 17404 break; |
| 17384 } | 17405 } |
| 17385 } | 17406 } |
| 17386 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 17407 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 17387 if ($notnull_bool(delta >= 0)) { | 17408 if (delta >= 0) { |
| 17388 depth -= $assert_num(delta); | 17409 depth -= $assert_num(delta); |
| 17389 } | 17410 } |
| 17390 else { | 17411 else { |
| 17391 depth = this._eatClosingAngle(depth); | 17412 depth = this._eatClosingAngle(depth); |
| 17392 } | 17413 } |
| 17393 var span = this._makeSpan(baseType.span.start); | 17414 var span = this._makeSpan(baseType.span.start); |
| 17394 return new GenericTypeReference(baseType, types, depth, (span && span.is$Sourc eSpan())); | 17415 return new GenericTypeReference(baseType, types, depth, (span && span.is$Sourc eSpan())); |
| 17395 } | 17416 } |
| 17396 lang_Parser.prototype.typeList = function() { | 17417 lang_Parser.prototype.typeList = function() { |
| 17397 var types = []; | 17418 var types = []; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 17423 name = this.identifier(); | 17444 name = this.identifier(); |
| 17424 break; | 17445 break; |
| 17425 | 17446 |
| 17426 default: | 17447 default: |
| 17427 | 17448 |
| 17428 name = this.identifier(); | 17449 name = this.identifier(); |
| 17429 break; | 17450 break; |
| 17430 | 17451 |
| 17431 } | 17452 } |
| 17432 while ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { | 17453 while ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { |
| 17433 if ($notnull_bool(names == null)) names = []; | 17454 if (names == null) names = []; |
| 17434 names.add(this.identifier()); | 17455 names.add(this.identifier()); |
| 17435 } | 17456 } |
| 17436 var typeRef = new NameTypeReference(isFinal, name, names, this._makeSpan(start )); | 17457 var typeRef = new NameTypeReference(isFinal, name, names, this._makeSpan(start )); |
| 17437 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { | 17458 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { |
| 17438 return this.addTypeArguments((typeRef && typeRef.is$TypeReference()), depth) ; | 17459 return this.addTypeArguments((typeRef && typeRef.is$TypeReference()), depth) ; |
| 17439 } | 17460 } |
| 17440 else { | 17461 else { |
| 17441 return typeRef; | 17462 return typeRef; |
| 17442 } | 17463 } |
| 17443 } | 17464 } |
| 17444 lang_Parser.prototype.formalParameter = function(inOptionalBlock) { | 17465 lang_Parser.prototype.formalParameter = function(inOptionalBlock) { |
| 17445 var start = this._peekToken.start; | 17466 var start = this._peekToken.start; |
| 17446 var isThis = false; | 17467 var isThis = false; |
| 17447 var isRest = false; | 17468 var isRest = false; |
| 17448 var di = this.declaredIdentifier(false); | 17469 var di = this.declaredIdentifier(false); |
| 17449 var type = di.type; | 17470 var type = di.type; |
| 17450 var name = di.get$name(); | 17471 var name = di.get$name(); |
| 17451 var value = null; | 17472 var value = null; |
| 17452 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { | 17473 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { |
| 17453 if ($notnull_bool(!$notnull_bool(inOptionalBlock))) { | 17474 if (!$notnull_bool(inOptionalBlock)) { |
| 17454 this._lang_error('default values only allowed inside [optional] section'); | 17475 this._lang_error('default values only allowed inside [optional] section'); |
| 17455 } | 17476 } |
| 17456 value = this.expression(); | 17477 value = this.expression(); |
| 17457 } | 17478 } |
| 17458 else if ($notnull_bool(this._peekKind(2/*TokenKind.LPAREN*/))) { | 17479 else if ($notnull_bool(this._peekKind(2/*TokenKind.LPAREN*/))) { |
| 17459 var formals = this.formalParameterList(); | 17480 var formals = this.formalParameterList(); |
| 17460 var func = new FunctionDefinition(null, type, name, formals, null, null, thi s._makeSpan(start)); | 17481 var func = new FunctionDefinition(null, type, name, formals, null, null, thi s._makeSpan(start)); |
| 17461 type = new FunctionTypeReference(false, func, func.get$span()); | 17482 type = new FunctionTypeReference(false, func, func.get$span()); |
| 17462 } | 17483 } |
| 17463 if ($notnull_bool(inOptionalBlock && value == null)) { | 17484 if ($notnull_bool(inOptionalBlock && value == null)) { |
| 17464 value = new NullExpression(this._makeSpan(start)); | 17485 value = new NullExpression(this._makeSpan(start)); |
| 17465 } | 17486 } |
| 17466 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start) ); | 17487 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start) ); |
| 17467 } | 17488 } |
| 17468 lang_Parser.prototype.formalParameterList = function() { | 17489 lang_Parser.prototype.formalParameterList = function() { |
| 17469 this._eat(2/*TokenKind.LPAREN*/); | 17490 this._eat(2/*TokenKind.LPAREN*/); |
| 17470 var formals = []; | 17491 var formals = []; |
| 17471 var inOptionalBlock = false; | 17492 var inOptionalBlock = false; |
| 17472 if ($notnull_bool(!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/)))) { | 17493 if (!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/))) { |
| 17473 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { | 17494 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { |
| 17474 inOptionalBlock = true; | 17495 inOptionalBlock = true; |
| 17475 } | 17496 } |
| 17476 formals.add(this.formalParameter($assert_bool(inOptionalBlock))); | 17497 formals.add(this.formalParameter($assert_bool(inOptionalBlock))); |
| 17477 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 17498 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 17478 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { | 17499 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { |
| 17479 if ($notnull_bool(inOptionalBlock)) { | 17500 if ($notnull_bool(inOptionalBlock)) { |
| 17480 this._lang_error('already inside an optional block', this._previousTok en.get$span()); | 17501 this._lang_error('already inside an optional block', this._previousTok en.get$span()); |
| 17481 } | 17502 } |
| 17482 inOptionalBlock = true; | 17503 inOptionalBlock = true; |
| 17483 } | 17504 } |
| 17484 formals.add(this.formalParameter($assert_bool(inOptionalBlock))); | 17505 formals.add(this.formalParameter($assert_bool(inOptionalBlock))); |
| 17485 } | 17506 } |
| 17486 if ($notnull_bool(inOptionalBlock)) { | 17507 if ($notnull_bool(inOptionalBlock)) { |
| 17487 this._eat(5/*TokenKind.RBRACK*/); | 17508 this._eat(5/*TokenKind.RBRACK*/); |
| 17488 } | 17509 } |
| 17489 this._eat(3/*TokenKind.RPAREN*/); | 17510 this._eat(3/*TokenKind.RPAREN*/); |
| 17490 } | 17511 } |
| 17491 return formals; | 17512 return formals; |
| 17492 } | 17513 } |
| 17493 lang_Parser.prototype.identifier = function() { | 17514 lang_Parser.prototype.identifier = function() { |
| 17494 var tok = this._lang_next(); | 17515 var tok = this._lang_next(); |
| 17495 if ($notnull_bool(!$notnull_bool(TokenKind.isIdentifier($assert_num(tok.kind)) ))) { | 17516 if (!$notnull_bool(TokenKind.isIdentifier($assert_num(tok.kind)))) { |
| 17496 this._lang_error(('expected identifier, but found ' + tok + ''), tok.get$spa n()); | 17517 this._lang_error(('expected identifier, but found ' + tok + ''), tok.get$spa n()); |
| 17497 } | 17518 } |
| 17498 return new lang_Identifier(tok.get$text(), this._makeSpan(tok.start)); | 17519 return new lang_Identifier(tok.get$text(), this._makeSpan(tok.start)); |
| 17499 } | 17520 } |
| 17500 lang_Parser.prototype._makeFunction = function(expr, body) { | 17521 lang_Parser.prototype._makeFunction = function(expr, body) { |
| 17501 var name, type; | 17522 var name, type; |
| 17502 if ($notnull_bool((expr instanceof CallExpression))) { | 17523 if ((expr instanceof CallExpression)) { |
| 17503 if ($notnull_bool((expr.target instanceof VarExpression))) { | 17524 if ((expr.target instanceof VarExpression)) { |
| 17504 name = expr.target.get$name(); | 17525 name = expr.target.get$name(); |
| 17505 type = null; | 17526 type = null; |
| 17506 } | 17527 } |
| 17507 else if ($notnull_bool((expr.target instanceof DeclaredIdentifier))) { | 17528 else if ((expr.target instanceof DeclaredIdentifier)) { |
| 17508 name = expr.target.get$name(); | 17529 name = expr.target.get$name(); |
| 17509 type = expr.target.type; | 17530 type = expr.target.type; |
| 17510 } | 17531 } |
| 17511 else { | 17532 else { |
| 17512 this._lang_error('bad function'); | 17533 this._lang_error('bad function'); |
| 17513 } | 17534 } |
| 17514 var formals = this._makeFormals(expr.get$arguments()); | 17535 var formals = this._makeFormals(expr.get$arguments()); |
| 17515 var span = new SourceSpan(expr.get$span().file, expr.get$span().start, body. get$span().end); | 17536 var span = new SourceSpan(expr.get$span().file, expr.get$span().start, body. get$span().end); |
| 17516 var func = new FunctionDefinition(null, type, name, formals, null, body, (sp an && span.is$SourceSpan())); | 17537 var func = new FunctionDefinition(null, type, name, formals, null, body, (sp an && span.is$SourceSpan())); |
| 17517 return new LambdaExpression(func, func.get$span()); | 17538 return new LambdaExpression(func, func.get$span()); |
| 17518 } | 17539 } |
| 17519 else { | 17540 else { |
| 17520 this._lang_error('expected function'); | 17541 this._lang_error('expected function'); |
| 17521 } | 17542 } |
| 17522 } | 17543 } |
| 17523 lang_Parser.prototype._makeFormal = function(expr) { | 17544 lang_Parser.prototype._makeFormal = function(expr) { |
| 17524 var $0; | 17545 var $0; |
| 17525 if ($notnull_bool((expr instanceof VarExpression))) { | 17546 if ((expr instanceof VarExpression)) { |
| 17526 return new FormalNode(false, false, null, expr.get$name(), null, expr.get$sp an()); | 17547 return new FormalNode(false, false, null, expr.get$name(), null, expr.get$sp an()); |
| 17527 } | 17548 } |
| 17528 else if ($notnull_bool((expr instanceof DeclaredIdentifier))) { | 17549 else if ((expr instanceof DeclaredIdentifier)) { |
| 17529 return new FormalNode(false, false, expr.type, expr.get$name(), null, expr.g et$span()); | 17550 return new FormalNode(false, false, expr.type, expr.get$name(), null, expr.g et$span()); |
| 17530 } | 17551 } |
| 17531 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x i nstanceof DeclaredIdentifier)))) { | 17552 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x i nstanceof DeclaredIdentifier)))) { |
| 17532 var di = (($0 = expr.x) && $0.is$DeclaredIdentifier()); | 17553 var di = (($0 = expr.x) && $0.is$DeclaredIdentifier()); |
| 17533 return new FormalNode(false, false, di.type, di.name, expr.y, expr.get$span( )); | 17554 return new FormalNode(false, false, di.type, di.name, expr.y, expr.get$span( )); |
| 17534 } | 17555 } |
| 17535 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/))) { | 17556 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/))) { |
| 17536 return null; | 17557 return null; |
| 17537 } | 17558 } |
| 17538 else if ($notnull_bool((expr instanceof ListExpression))) { | 17559 else if ((expr instanceof ListExpression)) { |
| 17539 return this._makeFormalsFromList(expr); | 17560 return this._makeFormalsFromList(expr); |
| 17540 } | 17561 } |
| 17541 else { | 17562 else { |
| 17542 this._lang_error('expected formal', expr.get$span()); | 17563 this._lang_error('expected formal', expr.get$span()); |
| 17543 } | 17564 } |
| 17544 } | 17565 } |
| 17545 lang_Parser.prototype._makeFormalsFromList = function(expr) { | 17566 lang_Parser.prototype._makeFormalsFromList = function(expr) { |
| 17546 if ($notnull_bool(expr.get$isConst())) { | 17567 if ($notnull_bool(expr.get$isConst())) { |
| 17547 this._lang_error('expected formal, but found "const"', expr.get$span()); | 17568 this._lang_error('expected formal, but found "const"', expr.get$span()); |
| 17548 } | 17569 } |
| 17549 else if ($notnull_bool($ne(expr.type, null))) { | 17570 else if ($notnull_bool($ne(expr.type, null))) { |
| 17550 this._lang_error('expected formal, but found generic type arguments', expr.t ype.get$span()); | 17571 this._lang_error('expected formal, but found generic type arguments', expr.t ype.get$span()); |
| 17551 } | 17572 } |
| 17552 return this._makeFormalsFromExpressions(expr.values, false); | 17573 return this._makeFormalsFromExpressions(expr.values, false); |
| 17553 } | 17574 } |
| 17554 lang_Parser.prototype._makeFormals = function(arguments) { | 17575 lang_Parser.prototype._makeFormals = function(arguments) { |
| 17555 var expressions = []; | 17576 var expressions = []; |
| 17556 for (var i = 0; | 17577 for (var i = 0; |
| 17557 $notnull_bool(i < arguments.length); i++) { | 17578 i < arguments.length; i++) { |
| 17558 var arg = arguments.$index(i); | 17579 var arg = arguments.$index(i); |
| 17559 if ($notnull_bool(arg.label != null)) { | 17580 if (arg.label != null) { |
| 17560 this._lang_error('expected formal, but found ":"'); | 17581 this._lang_error('expected formal, but found ":"'); |
| 17561 } | 17582 } |
| 17562 expressions.add(arg.get$value()); | 17583 expressions.add(arg.get$value()); |
| 17563 } | 17584 } |
| 17564 return this._makeFormalsFromExpressions(expressions, true); | 17585 return this._makeFormalsFromExpressions(expressions, true); |
| 17565 } | 17586 } |
| 17566 lang_Parser.prototype._makeFormalsFromExpressions = function(expressions, allowO ptional) { | 17587 lang_Parser.prototype._makeFormalsFromExpressions = function(expressions, allowO ptional) { |
| 17567 var $0; | 17588 var $0; |
| 17568 var formals = []; | 17589 var formals = []; |
| 17569 for (var i = 0; | 17590 for (var i = 0; |
| 17570 $notnull_bool(i < expressions.length); i++) { | 17591 i < expressions.length; i++) { |
| 17571 var formal = this._makeFormal(expressions.$index(i)); | 17592 var formal = this._makeFormal(expressions.$index(i)); |
| 17572 if ($notnull_bool(formal == null)) { | 17593 if ($notnull_bool(formal == null)) { |
| 17573 var baseType = this._makeType(expressions.$index(i).x); | 17594 var baseType = this._makeType(expressions.$index(i).x); |
| 17574 var typeParams = [this._makeType(expressions.$index(i).y)]; | 17595 var typeParams = [this._makeType(expressions.$index(i).y)]; |
| 17575 i++; | 17596 i++; |
| 17576 while ($notnull_bool(i < expressions.length)) { | 17597 while (i < expressions.length) { |
| 17577 var expr = expressions.$index(i++); | 17598 var expr = expressions.$index(i++); |
| 17578 if ($notnull_bool(this._isBin(expr, 53/*TokenKind.GT*/))) { | 17599 if ($notnull_bool(this._isBin(expr, 53/*TokenKind.GT*/))) { |
| 17579 typeParams.add(this._makeType(expr.x)); | 17600 typeParams.add(this._makeType(expr.x)); |
| 17580 var type = new GenericTypeReference(baseType, typeParams, 0, this._mak eSpan(baseType.get$span().start)); | 17601 var type = new GenericTypeReference(baseType, typeParams, 0, this._mak eSpan(baseType.get$span().start)); |
| 17581 var name = null; | 17602 var name = null; |
| 17582 if ($notnull_bool((expr.y instanceof VarExpression))) { | 17603 if ((expr.y instanceof VarExpression)) { |
| 17583 var ve = (($0 = expr.y) && $0.is$VarExpression()); | 17604 var ve = (($0 = expr.y) && $0.is$VarExpression()); |
| 17584 name = ve.name; | 17605 name = ve.name; |
| 17585 } | 17606 } |
| 17586 else { | 17607 else { |
| 17587 this._lang_error('expected formal', expr.get$span()); | 17608 this._lang_error('expected formal', expr.get$span()); |
| 17588 } | 17609 } |
| 17589 formal = new FormalNode(false, false, type, name, null, this._makeSpan (expressions.$index(0).get$span().start)); | 17610 formal = new FormalNode(false, false, type, name, null, this._makeSpan (expressions.$index(0).get$span().start)); |
| 17590 break; | 17611 break; |
| 17591 } | 17612 } |
| 17592 else { | 17613 else { |
| 17593 typeParams.add(this._makeType(expr)); | 17614 typeParams.add(this._makeType(expr)); |
| 17594 } | 17615 } |
| 17595 } | 17616 } |
| 17596 formals.add(formal); | 17617 formals.add(formal); |
| 17597 } | 17618 } |
| 17598 else if ($notnull_bool(!!(formal && formal.is$List))) { | 17619 else if (!!(formal && formal.is$List)) { |
| 17599 formals.addAll(formal); | 17620 formals.addAll(formal); |
| 17600 if ($notnull_bool(!$notnull_bool(allowOptional))) { | 17621 if (!$notnull_bool(allowOptional)) { |
| 17601 this._lang_error('unexpected nested optional formal', expressions.$index (i).get$span()); | 17622 this._lang_error('unexpected nested optional formal', expressions.$index (i).get$span()); |
| 17602 } | 17623 } |
| 17603 } | 17624 } |
| 17604 else { | 17625 else { |
| 17605 formals.add(formal); | 17626 formals.add(formal); |
| 17606 } | 17627 } |
| 17607 } | 17628 } |
| 17608 return formals; | 17629 return formals; |
| 17609 } | 17630 } |
| 17610 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { | 17631 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { |
| 17611 if ($notnull_bool((e instanceof VarExpression))) { | 17632 if ((e instanceof VarExpression)) { |
| 17612 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); | 17633 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); |
| 17613 } | 17634 } |
| 17614 else if ($notnull_bool((e instanceof DeclaredIdentifier))) { | 17635 else if ((e instanceof DeclaredIdentifier)) { |
| 17615 return e; | 17636 return e; |
| 17616 } | 17637 } |
| 17617 else { | 17638 else { |
| 17618 this._lang_error('expected declared identifier'); | 17639 this._lang_error('expected declared identifier'); |
| 17619 return new DeclaredIdentifier(null, null, e.get$span()); | 17640 return new DeclaredIdentifier(null, null, e.get$span()); |
| 17620 } | 17641 } |
| 17621 } | 17642 } |
| 17622 lang_Parser.prototype._makeLabel = function(expr) { | 17643 lang_Parser.prototype._makeLabel = function(expr) { |
| 17623 if ($notnull_bool((expr instanceof VarExpression))) { | 17644 if ((expr instanceof VarExpression)) { |
| 17624 return expr.get$name(); | 17645 return expr.get$name(); |
| 17625 } | 17646 } |
| 17626 else { | 17647 else { |
| 17627 this._errorExpected('label'); | 17648 this._errorExpected('label'); |
| 17628 return null; | 17649 return null; |
| 17629 } | 17650 } |
| 17630 } | 17651 } |
| 17631 // ********** Code for IncompleteSourceException ************** | 17652 // ********** Code for IncompleteSourceException ************** |
| 17632 function IncompleteSourceException(token) { | 17653 function IncompleteSourceException(token) { |
| 17633 this.token = token; | 17654 this.token = token; |
| 17634 // Initializers done | 17655 // Initializers done |
| 17635 } | 17656 } |
| 17636 IncompleteSourceException.prototype.toString = function() { | 17657 IncompleteSourceException.prototype.toString = function() { |
| 17637 if ($notnull_bool(this.token.get$span() == null)) return ('Unexpected ' + this .token + ''); | 17658 if (this.token.get$span() == null) return ('Unexpected ' + this.token + ''); |
| 17638 return $assert_String(this.token.get$span().toMessageString(('Unexpected ' + t his.token + ''))); | 17659 return $assert_String(this.token.get$span().toMessageString(('Unexpected ' + t his.token + ''))); |
| 17639 } | 17660 } |
| 17640 // ********** Code for lang_Node ************** | 17661 // ********** Code for lang_Node ************** |
| 17641 function lang_Node(span) { | 17662 function lang_Node(span) { |
| 17642 this.span = span; | 17663 this.span = span; |
| 17643 // Initializers done | 17664 // Initializers done |
| 17644 } | 17665 } |
| 17645 lang_Node.prototype.is$lang_Node = function(){return this;}; | 17666 lang_Node.prototype.is$lang_Node = function(){return this;}; |
| 17646 lang_Node.prototype.get$span = function() { return this.span; }; | 17667 lang_Node.prototype.get$span = function() { return this.span; }; |
| 17647 lang_Node.prototype.set$span = function(value) { return this.span = value; }; | 17668 lang_Node.prototype.set$span = function(value) { return this.span = value; }; |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18335 // Initializers done | 18356 // Initializers done |
| 18336 } | 18357 } |
| 18337 lang_Type.prototype.is$lang_Type = function(){return this;}; | 18358 lang_Type.prototype.is$lang_Type = function(){return this;}; |
| 18338 lang_Type.prototype.is$Named = function(){return this;}; | 18359 lang_Type.prototype.is$Named = function(){return this;}; |
| 18339 lang_Type.prototype.get$name = function() { return this.name; }; | 18360 lang_Type.prototype.get$name = function() { return this.name; }; |
| 18340 lang_Type.prototype.markUsed = function() { | 18361 lang_Type.prototype.markUsed = function() { |
| 18341 | 18362 |
| 18342 } | 18363 } |
| 18343 lang_Type.prototype.get$typeMember = function() { | 18364 lang_Type.prototype.get$typeMember = function() { |
| 18344 var $0; | 18365 var $0; |
| 18345 if ($notnull_bool(this._typeMember == null)) { | 18366 if (this._typeMember == null) { |
| 18346 this._typeMember = new TypeMember((this && this.is$DefinedType())); | 18367 this._typeMember = new TypeMember((this && this.is$DefinedType())); |
| 18347 } | 18368 } |
| 18348 return (($0 = this._typeMember) && $0.is$TypeMember()); | 18369 return (($0 = this._typeMember) && $0.is$TypeMember()); |
| 18349 } | 18370 } |
| 18350 lang_Type.prototype.getMember = function(name) { | 18371 lang_Type.prototype.getMember = function(name) { |
| 18351 return null; | 18372 return null; |
| 18352 } | 18373 } |
| 18353 lang_Type.prototype.get$isVar = function() { | 18374 lang_Type.prototype.get$isVar = function() { |
| 18354 return false; | 18375 return false; |
| 18355 } | 18376 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 18377 lang_Type.prototype.get$isVoid = function() { | 18398 lang_Type.prototype.get$isVoid = function() { |
| 18378 return false; | 18399 return false; |
| 18379 } | 18400 } |
| 18380 lang_Type.prototype.get$isVarOrFunction = function() { | 18401 lang_Type.prototype.get$isVarOrFunction = function() { |
| 18381 return $notnull_bool(this.get$isVar() || this.get$isFunction()); | 18402 return $notnull_bool(this.get$isVar() || this.get$isFunction()); |
| 18382 } | 18403 } |
| 18383 lang_Type.prototype.getCallMethod = function() { | 18404 lang_Type.prototype.getCallMethod = function() { |
| 18384 return null; | 18405 return null; |
| 18385 } | 18406 } |
| 18386 lang_Type.prototype.get$isClosed = function() { | 18407 lang_Type.prototype.get$isClosed = function() { |
| 18387 return $notnull_bool(this.get$isString() || this.get$isBool()) || this.get$isN um() || this.get$isFunction() || this.get$isVar(); | 18408 return $notnull_bool($notnull_bool($notnull_bool($notnull_bool(this.get$isStri ng() || this.get$isBool()) || this.get$isNum()) || this.get$isFunction()) || thi s.get$isVar()); |
| 18388 } | 18409 } |
| 18389 lang_Type.prototype.get$isUsed = function() { | 18410 lang_Type.prototype.get$isUsed = function() { |
| 18390 return false; | 18411 return false; |
| 18391 } | 18412 } |
| 18392 lang_Type.prototype.get$isGeneric = function() { | 18413 lang_Type.prototype.get$isGeneric = function() { |
| 18393 return false; | 18414 return false; |
| 18394 } | 18415 } |
| 18395 lang_Type.prototype.get$isNativeType = function() { | 18416 lang_Type.prototype.get$isNativeType = function() { |
| 18396 return false; | 18417 return false; |
| 18397 } | 18418 } |
| 18398 lang_Type.prototype.get$isNative = function() { | 18419 lang_Type.prototype.get$isNative = function() { |
| 18399 return this.get$isNativeType(); | 18420 return this.get$isNativeType(); |
| 18400 } | 18421 } |
| 18401 lang_Type.prototype.get$hasTypeParams = function() { | 18422 lang_Type.prototype.get$hasTypeParams = function() { |
| 18402 return false; | 18423 return false; |
| 18403 } | 18424 } |
| 18404 lang_Type.prototype.get$typeofName = function() { | 18425 lang_Type.prototype.get$typeofName = function() { |
| 18405 return null; | 18426 return null; |
| 18406 } | 18427 } |
| 18407 lang_Type.prototype.get$jsname = function() { | 18428 lang_Type.prototype.get$jsname = function() { |
| 18408 return $notnull_bool(this._jsname == null) ? this.name : this._jsname; | 18429 return this._jsname == null ? this.name : this._jsname; |
| 18409 } | 18430 } |
| 18410 lang_Type.prototype.set$jsname = function(name) { | 18431 lang_Type.prototype.set$jsname = function(name) { |
| 18411 return this._jsname = name; | 18432 return this._jsname = name; |
| 18412 } | 18433 } |
| 18413 lang_Type.prototype.get$members = function() { | 18434 lang_Type.prototype.get$members = function() { |
| 18414 return null; | 18435 return null; |
| 18415 } | 18436 } |
| 18416 lang_Type.prototype.get$definition = function() { | 18437 lang_Type.prototype.get$definition = function() { |
| 18417 return null; | 18438 return null; |
| 18418 } | 18439 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 18431 lang_Type.prototype.get$parent = function() { | 18452 lang_Type.prototype.get$parent = function() { |
| 18432 return null; | 18453 return null; |
| 18433 } | 18454 } |
| 18434 lang_Type.prototype.getAllMembers = function() { | 18455 lang_Type.prototype.getAllMembers = function() { |
| 18435 return $map([]); | 18456 return $map([]); |
| 18436 } | 18457 } |
| 18437 lang_Type.prototype.hashCode = function() { | 18458 lang_Type.prototype.hashCode = function() { |
| 18438 return this.name.hashCode(); | 18459 return this.name.hashCode(); |
| 18439 } | 18460 } |
| 18440 lang_Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) { | 18461 lang_Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) { |
| 18441 if ($notnull_bool(!$notnull_bool(this.isSubtypeOf(other)))) { | 18462 if (!$notnull_bool(this.isSubtypeOf(other))) { |
| 18442 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name + ''); | 18463 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name + ''); |
| 18443 if ($notnull_bool(typeErrors)) { | 18464 if ($notnull_bool(typeErrors)) { |
| 18444 world.error($assert_String(msg), span); | 18465 world.error($assert_String(msg), span); |
| 18445 } | 18466 } |
| 18446 else { | 18467 else { |
| 18447 world.warning($assert_String(msg), span); | 18468 world.warning($assert_String(msg), span); |
| 18448 } | 18469 } |
| 18449 } | 18470 } |
| 18450 } | 18471 } |
| 18451 lang_Type.prototype.needsVarCall = function(args) { | 18472 lang_Type.prototype.needsVarCall = function(args) { |
| 18452 if ($notnull_bool(this.get$isVarOrFunction())) { | 18473 if ($notnull_bool(this.get$isVarOrFunction())) { |
| 18453 return true; | 18474 return true; |
| 18454 } | 18475 } |
| 18455 var call = this.getCallMethod(); | 18476 var call = this.getCallMethod(); |
| 18456 if ($notnull_bool($ne(call, null))) { | 18477 if ($notnull_bool($ne(call, null))) { |
| 18457 if ($notnull_bool(args.get$length() != call.get$parameters().length || !$not null_bool(call.namesInOrder(args)))) { | 18478 if (args.get$length() != call.get$parameters().length || !$notnull_bool(call .namesInOrder(args))) { |
| 18458 return true; | 18479 return true; |
| 18459 } | 18480 } |
| 18460 } | 18481 } |
| 18461 return false; | 18482 return false; |
| 18462 } | 18483 } |
| 18463 lang_Type.union = function(x, y) { | 18484 lang_Type.union = function(x, y) { |
| 18464 if ($notnull_bool($eq(x, y))) return x; | 18485 if ($eq(x, y)) return x; |
| 18465 if ($notnull_bool(x.get$isNum() && y.get$isNum())) return world.numType; | 18486 if ($notnull_bool(x.get$isNum() && y.get$isNum())) return world.numType; |
| 18466 if ($notnull_bool(x.get$isString() && y.get$isString())) return world.stringTy pe; | 18487 if ($notnull_bool(x.get$isString() && y.get$isString())) return world.stringTy pe; |
| 18467 return world.varType; | 18488 return world.varType; |
| 18468 } | 18489 } |
| 18469 lang_Type.prototype.isAssignable = function(other) { | 18490 lang_Type.prototype.isAssignable = function(other) { |
| 18470 return $notnull_bool(this.isSubtypeOf(other) || other.isSubtypeOf(this)); | 18491 return $notnull_bool(this.isSubtypeOf(other) || other.isSubtypeOf(this)); |
| 18471 } | 18492 } |
| 18472 lang_Type.prototype._isDirectSupertypeOf = function(other) { | 18493 lang_Type.prototype._isDirectSupertypeOf = function(other) { |
| 18473 var $this = this; // closure support | 18494 var $this = this; // closure support |
| 18474 if ($notnull_bool(other.get$isClass())) { | 18495 if ($notnull_bool(other.get$isClass())) { |
| 18475 return $notnull_bool($eq(other.get$parent(), this) || $notnull_bool(this.get $isObject() && other.get$parent() == null)); | 18496 return $eq(other.get$parent(), this) || $notnull_bool(this.get$isObject() && other.get$parent() == null); |
| 18476 } | 18497 } |
| 18477 else { | 18498 else { |
| 18478 if ($notnull_bool(other.get$interfaces() == null || other.get$interfaces().i sEmpty())) { | 18499 if (other.get$interfaces() == null || other.get$interfaces().isEmpty()) { |
| 18479 return this.get$isObject(); | 18500 return this.get$isObject(); |
| 18480 } | 18501 } |
| 18481 else { | 18502 else { |
| 18482 return other.get$interfaces().some((function (i) { | 18503 return other.get$interfaces().some((function (i) { |
| 18483 return $eq(i, $this); | 18504 return $eq(i, $this); |
| 18484 }) | 18505 }) |
| 18485 ); | 18506 ); |
| 18486 } | 18507 } |
| 18487 } | 18508 } |
| 18488 } | 18509 } |
| 18489 lang_Type.prototype.isSubtypeOf = function(other) { | 18510 lang_Type.prototype.isSubtypeOf = function(other) { |
| 18490 if ($notnull_bool((other instanceof ParameterType))) { | 18511 if ((other instanceof ParameterType)) { |
| 18491 return true; | 18512 return true; |
| 18492 } | 18513 } |
| 18493 if ($notnull_bool($eq(this, other))) return true; | 18514 if ($eq(this, other)) return true; |
| 18494 if ($notnull_bool(this.get$isVar())) return true; | 18515 if ($notnull_bool(this.get$isVar())) return true; |
| 18495 if ($notnull_bool(other.get$isVar())) return true; | 18516 if ($notnull_bool(other.get$isVar())) return true; |
| 18496 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true; | 18517 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true; |
| 18497 var call = this.getCallMethod(); | 18518 var call = this.getCallMethod(); |
| 18498 var otherCall = other.getCallMethod(); | 18519 var otherCall = other.getCallMethod(); |
| 18499 if ($notnull_bool($ne(call, null) && $ne(otherCall, null))) { | 18520 if ($notnull_bool($ne(call, null) && $ne(otherCall, null))) { |
| 18500 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth erCall && otherCall.is$MethodMember())); | 18521 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth erCall && otherCall.is$MethodMember())); |
| 18501 } | 18522 } |
| 18502 if ($notnull_bool($eq(this.get$genericType(), other.get$genericType()) && $ne( this.get$typeArgsInOrder(), null)) && $ne(other.get$typeArgsInOrder(), null) && this.get$typeArgsInOrder().length == other.get$typeArgsInOrder().length) { | 18523 if ($notnull_bool($notnull_bool($eq(this.get$genericType(), other.get$genericT ype()) && $ne(this.get$typeArgsInOrder(), null)) && $ne(other.get$typeArgsInOrde r(), null)) && this.get$typeArgsInOrder().length == other.get$typeArgsInOrder(). length) { |
| 18503 var t = this.get$typeArgsInOrder().iterator(); | 18524 var t = this.get$typeArgsInOrder().iterator(); |
| 18504 var s = other.get$typeArgsInOrder().iterator(); | 18525 var s = other.get$typeArgsInOrder().iterator(); |
| 18505 while ($notnull_bool(t.hasNext())) { | 18526 while ($notnull_bool(t.hasNext())) { |
| 18506 if ($notnull_bool(!$notnull_bool(t.next().isSubtypeOf(s.next())))) return false; | 18527 if (!$notnull_bool(t.next().isSubtypeOf(s.next()))) return false; |
| 18507 } | 18528 } |
| 18508 return true; | 18529 return true; |
| 18509 } | 18530 } |
| 18510 if ($notnull_bool(this.get$parent() != null && this.get$parent().isSubtypeOf(o ther))) { | 18531 if ($notnull_bool(this.get$parent() != null && this.get$parent().isSubtypeOf(o ther))) { |
| 18511 return true; | 18532 return true; |
| 18512 } | 18533 } |
| 18513 if ($notnull_bool(this.get$interfaces() != null && this.get$interfaces().some( (function (i) { | 18534 if (this.get$interfaces() != null && this.get$interfaces().some((function (i) { |
| 18514 return i.isSubtypeOf(other); | 18535 return i.isSubtypeOf(other); |
| 18515 }) | 18536 }) |
| 18516 ))) { | 18537 )) { |
| 18517 return true; | 18538 return true; |
| 18518 } | 18539 } |
| 18519 return false; | 18540 return false; |
| 18520 } | 18541 } |
| 18521 lang_Type._isFunctionSubtypeOf = function(t, s) { | 18542 lang_Type._isFunctionSubtypeOf = function(t, s) { |
| 18522 var $0; | 18543 var $0; |
| 18523 if ($notnull_bool(!$notnull_bool(s.returnType.get$isVoid()) && !$notnull_bool( s.returnType.isAssignable(t.returnType)))) { | 18544 if (!$notnull_bool(s.returnType.get$isVoid()) && !$notnull_bool(s.returnType.i sAssignable(t.returnType))) { |
| 18524 return false; | 18545 return false; |
| 18525 } | 18546 } |
| 18526 var tp = t.parameters; | 18547 var tp = t.parameters; |
| 18527 var sp = s.parameters; | 18548 var sp = s.parameters; |
| 18528 if ($notnull_bool(tp.length < sp.length)) return false; | 18549 if (tp.length < sp.length) return false; |
| 18529 for (var i = 0; | 18550 for (var i = 0; |
| 18530 $notnull_bool(i < sp.length); i++) { | 18551 i < sp.length; i++) { |
| 18531 if ($notnull_bool($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOpti onal()))) return false; | 18552 if ($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOptional())) retur n false; |
| 18532 if ($notnull_bool(tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name (), sp.$index(i).get$name()))) return false; | 18553 if ($notnull_bool(tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name (), sp.$index(i).get$name()))) return false; |
| 18533 if ($notnull_bool(!$notnull_bool(tp.$index(i).type.isAssignable((($0 = sp.$i ndex(i).type) && $0.is$lang_Type()))))) return false; | 18554 if (!$notnull_bool(tp.$index(i).type.isAssignable((($0 = sp.$index(i).type) && $0.is$lang_Type())))) return false; |
| 18534 } | 18555 } |
| 18535 if ($notnull_bool(tp.length > sp.length && !$notnull_bool(tp.$index(sp.length) .get$isOptional()))) return false; | 18556 if (tp.length > sp.length && !$notnull_bool(tp.$index(sp.length).get$isOptiona l())) return false; |
| 18536 return true; | 18557 return true; |
| 18537 } | 18558 } |
| 18538 // ********** Code for ParameterType ************** | 18559 // ********** Code for ParameterType ************** |
| 18539 function ParameterType(name, typeParameter) { | 18560 function ParameterType(name, typeParameter) { |
| 18540 this.typeParameter = typeParameter; | 18561 this.typeParameter = typeParameter; |
| 18541 lang_Type.call(this, name); | 18562 lang_Type.call(this, name); |
| 18542 // Initializers done | 18563 // Initializers done |
| 18543 } | 18564 } |
| 18544 $inherits(ParameterType, lang_Type); | 18565 $inherits(ParameterType, lang_Type); |
| 18545 ParameterType.prototype.is$ParameterType = function(){return this;}; | 18566 ParameterType.prototype.is$ParameterType = function(){return this;}; |
| 18546 ParameterType.prototype.get$isClass = function() { | 18567 ParameterType.prototype.get$isClass = function() { |
| 18547 return false; | 18568 return false; |
| 18548 } | 18569 } |
| 18549 ParameterType.prototype.get$library = function() { | 18570 ParameterType.prototype.get$library = function() { |
| 18550 return null; | 18571 return null; |
| 18551 } | 18572 } |
| 18552 ParameterType.prototype.get$span = function() { | 18573 ParameterType.prototype.get$span = function() { |
| 18553 return this.typeParameter.span; | 18574 return this.typeParameter.span; |
| 18554 } | 18575 } |
| 18555 ParameterType.prototype.get$constructors = function() { | 18576 ParameterType.prototype.get$constructors = function() { |
| 18556 world.internalError('no constructors on type parameters yet'); | 18577 world.internalError('no constructors on type parameters yet'); |
| 18557 } | 18578 } |
| 18558 ParameterType.prototype.getCallMethod = function() { | 18579 ParameterType.prototype.getCallMethod = function() { |
| 18559 return this.extendsType.getCallMethod(); | 18580 return this.extendsType.getCallMethod(); |
| 18560 } | 18581 } |
| 18561 ParameterType.prototype.genMethod = function(method) { | 18582 ParameterType.prototype.genMethod = function(method) { |
| 18562 this.extendsType.genMethod(method); | 18583 this.extendsType.genMethod(method); |
| 18563 } | 18584 } |
| 18564 ParameterType.prototype.isSubtypeOf = function(child) { | 18585 ParameterType.prototype.isSubtypeOf = function(other) { |
| 18565 return true; | 18586 return true; |
| 18566 } | 18587 } |
| 18567 ParameterType.prototype.resolveMember = function(memberName) { | 18588 ParameterType.prototype.resolveMember = function(memberName) { |
| 18568 return this.extendsType.resolveMember(memberName); | 18589 return this.extendsType.resolveMember(memberName); |
| 18569 } | 18590 } |
| 18570 ParameterType.prototype.getConstructor = function(constructorName) { | 18591 ParameterType.prototype.getConstructor = function(constructorName) { |
| 18571 world.internalError('no constructors on type parameters yet'); | 18592 world.internalError('no constructors on type parameters yet'); |
| 18572 } | 18593 } |
| 18573 ParameterType.prototype.getOrMakeConcreteType = function(typeArgs) { | 18594 ParameterType.prototype.getOrMakeConcreteType = function(typeArgs) { |
| 18574 world.internalError('no concrete types of type parameters yet', this.get$span( )); | 18595 world.internalError('no concrete types of type parameters yet', this.get$span( )); |
| 18575 } | 18596 } |
| 18576 ParameterType.prototype.resolveTypeParams = function(inType) { | 18597 ParameterType.prototype.resolveTypeParams = function(inType) { |
| 18577 var $0; | 18598 var $0; |
| 18578 return (($0 = inType.typeArguments.$index(this.name)) && $0.is$lang_Type()); | 18599 return (($0 = inType.typeArguments.$index(this.name)) && $0.is$lang_Type()); |
| 18579 } | 18600 } |
| 18580 ParameterType.prototype.addDirectSubtype = function(type) { | 18601 ParameterType.prototype.addDirectSubtype = function(type) { |
| 18581 world.internalError('no subtypes of type parameters yet', this.get$span()); | 18602 world.internalError('no subtypes of type parameters yet', this.get$span()); |
| 18582 } | 18603 } |
| 18583 ParameterType.prototype.resolve = function(inType) { | 18604 ParameterType.prototype.resolve = function(inType) { |
| 18584 if ($notnull_bool(this.typeParameter.extendsType != null)) { | 18605 if (this.typeParameter.extendsType != null) { |
| 18585 this.extendsType = inType.resolveType(this.typeParameter.extendsType, true); | 18606 this.extendsType = inType.resolveType(this.typeParameter.extendsType, true); |
| 18586 } | 18607 } |
| 18587 else { | 18608 else { |
| 18588 this.extendsType = world.objectType; | 18609 this.extendsType = world.objectType; |
| 18589 } | 18610 } |
| 18590 } | 18611 } |
| 18612 // ********** Code for NonNullableType ************** | |
| 18613 function NonNullableType(type) { | |
| 18614 this.type = type; | |
| 18615 lang_Type.call(this, type.name); | |
| 18616 // Initializers done | |
| 18617 } | |
| 18618 $inherits(NonNullableType, lang_Type); | |
| 18619 NonNullableType.prototype.get$isBool = function() { | |
| 18620 return this.type.get$isBool(); | |
| 18621 } | |
| 18622 NonNullableType.prototype.get$isUsed = function() { | |
| 18623 return false; | |
| 18624 } | |
| 18625 NonNullableType.prototype.isSubtypeOf = function(other) { | |
| 18626 return $notnull_bool($eq(this, other) || $eq(this.type, other) || this.type.is SubtypeOf(other)); | |
| 18627 } | |
| 18628 NonNullableType.prototype.resolveType = function(node, isRequired) { | |
| 18629 return this.type.resolveType(node, isRequired); | |
| 18630 } | |
| 18631 NonNullableType.prototype.resolveTypeParams = function(inType) { | |
| 18632 return this.type.resolveTypeParams(inType); | |
| 18633 } | |
| 18634 NonNullableType.prototype.addDirectSubtype = function(subtype) { | |
| 18635 this.type.addDirectSubtype(subtype); | |
| 18636 } | |
| 18637 NonNullableType.prototype.markUsed = function() { | |
| 18638 this.type.markUsed(); | |
| 18639 } | |
| 18640 NonNullableType.prototype.genMethod = function(method) { | |
| 18641 this.type.genMethod(method); | |
| 18642 } | |
| 18643 NonNullableType.prototype.get$span = function() { | |
| 18644 return this.type.get$span(); | |
| 18645 } | |
| 18646 NonNullableType.prototype.resolveMember = function(name) { | |
| 18647 return this.type.resolveMember(name); | |
| 18648 } | |
| 18649 NonNullableType.prototype.getMember = function(name) { | |
| 18650 return this.type.getMember(name); | |
| 18651 } | |
| 18652 NonNullableType.prototype.getConstructor = function(name) { | |
| 18653 var $0; | |
| 18654 return (($0 = this.type.getConstructor(name)) && $0.is$MethodMember()); | |
| 18655 } | |
| 18656 NonNullableType.prototype.getFactory = function(t, name) { | |
| 18657 var $0; | |
| 18658 return (($0 = this.type.getFactory(t, name)) && $0.is$MethodMember()); | |
| 18659 } | |
| 18660 NonNullableType.prototype.getOrMakeConcreteType = function(typeArgs) { | |
| 18661 return this.type.getOrMakeConcreteType(typeArgs); | |
| 18662 } | |
| 18663 NonNullableType.prototype.get$constructors = function() { | |
| 18664 return this.type.get$constructors(); | |
| 18665 } | |
| 18666 NonNullableType.prototype.get$isClass = function() { | |
| 18667 return this.type.get$isClass(); | |
| 18668 } | |
| 18669 NonNullableType.prototype.get$library = function() { | |
| 18670 return this.type.get$library(); | |
| 18671 } | |
| 18672 NonNullableType.prototype.getCallMethod = function() { | |
| 18673 return this.type.getCallMethod(); | |
| 18674 } | |
| 18675 NonNullableType.prototype.get$isGeneric = function() { | |
| 18676 return this.type.get$isGeneric(); | |
| 18677 } | |
| 18678 NonNullableType.prototype.get$hasTypeParams = function() { | |
| 18679 return this.type.get$hasTypeParams(); | |
| 18680 } | |
| 18681 NonNullableType.prototype.get$typeofName = function() { | |
| 18682 return this.type.get$typeofName(); | |
| 18683 } | |
| 18684 NonNullableType.prototype.get$jsname = function() { | |
| 18685 return this.type.get$jsname(); | |
| 18686 } | |
| 18687 NonNullableType.prototype.set$jsname = function(name) { | |
| 18688 return this.type.set$jsname(name); | |
| 18689 } | |
| 18690 NonNullableType.prototype.get$members = function() { | |
| 18691 return this.type.get$members(); | |
| 18692 } | |
| 18693 NonNullableType.prototype.get$definition = function() { | |
| 18694 return this.type.get$definition(); | |
| 18695 } | |
| 18696 NonNullableType.prototype.get$factories = function() { | |
| 18697 return this.type.get$factories(); | |
| 18698 } | |
| 18699 NonNullableType.prototype.get$typeArgsInOrder = function() { | |
| 18700 var $0; | |
| 18701 return (($0 = this.type.get$typeArgsInOrder()) && $0.is$Collection$Type()); | |
| 18702 } | |
| 18703 NonNullableType.prototype.get$genericType = function() { | |
| 18704 return this.type.get$genericType(); | |
| 18705 } | |
| 18706 NonNullableType.prototype.get$interfaces = function() { | |
| 18707 return this.type.get$interfaces(); | |
| 18708 } | |
| 18709 NonNullableType.prototype.get$parent = function() { | |
| 18710 return this.type.get$parent(); | |
| 18711 } | |
| 18712 NonNullableType.prototype.getAllMembers = function() { | |
| 18713 return this.type.getAllMembers(); | |
| 18714 } | |
| 18715 NonNullableType.prototype.get$isNativeType = function() { | |
| 18716 return this.type.get$isNativeType(); | |
| 18717 } | |
| 18591 // ********** Code for ConcreteType ************** | 18718 // ********** Code for ConcreteType ************** |
| 18592 function ConcreteType(name, genericType, typeArguments, typeArgsInOrder) { | 18719 function ConcreteType(name, genericType, typeArguments, typeArgsInOrder) { |
| 18593 this.genericType = genericType; | 18720 this.genericType = genericType; |
| 18594 this.typeArguments = typeArguments; | 18721 this.typeArguments = typeArguments; |
| 18595 this.typeArgsInOrder = typeArgsInOrder; | 18722 this.typeArgsInOrder = typeArgsInOrder; |
| 18596 this.constructors = $map([]); | 18723 this.constructors = $map([]); |
| 18597 this.members = $map([]); | 18724 this.members = $map([]); |
| 18598 this.factories = new FactoryMap(); | 18725 this.factories = new FactoryMap(); |
| 18599 lang_Type.call(this, name); | 18726 lang_Type.call(this, name); |
| 18600 // Initializers done | 18727 // Initializers done |
| 18601 } | 18728 } |
| 18602 $inherits(ConcreteType, lang_Type); | 18729 $inherits(ConcreteType, lang_Type); |
| 18603 ConcreteType.prototype.get$genericType = function() { return this.genericType; } ; | 18730 ConcreteType.prototype.get$genericType = function() { return this.genericType; } ; |
| 18604 ConcreteType.prototype.get$typeArgsInOrder = function() { return this.typeArgsIn Order; }; | 18731 ConcreteType.prototype.get$typeArgsInOrder = function() { return this.typeArgsIn Order; }; |
| 18605 ConcreteType.prototype.set$typeArgsInOrder = function(value) { return this.typeA rgsInOrder = value; }; | 18732 ConcreteType.prototype.set$typeArgsInOrder = function(value) { return this.typeA rgsInOrder = value; }; |
| 18606 ConcreteType.prototype.get$isList = function() { | 18733 ConcreteType.prototype.get$isList = function() { |
| 18607 return this.genericType.get$isList(); | 18734 return this.genericType.get$isList(); |
| 18608 } | 18735 } |
| 18609 ConcreteType.prototype.get$isClass = function() { | 18736 ConcreteType.prototype.get$isClass = function() { |
| 18610 return this.genericType.isClass; | 18737 return this.genericType.isClass; |
| 18611 } | 18738 } |
| 18612 ConcreteType.prototype.get$library = function() { | 18739 ConcreteType.prototype.get$library = function() { |
| 18613 return this.genericType.library; | 18740 return this.genericType.library; |
| 18614 } | 18741 } |
| 18615 ConcreteType.prototype.get$span = function() { | 18742 ConcreteType.prototype.get$span = function() { |
| 18616 return this.genericType.get$span(); | 18743 return this.genericType.get$span(); |
| 18617 } | 18744 } |
| 18618 ConcreteType.prototype.get$hasTypeParams = function() { | 18745 ConcreteType.prototype.get$hasTypeParams = function() { |
| 18619 return this.typeArguments.getValues().some((function (e) { | 18746 return $assert_bool(this.typeArguments.getValues().some((function (e) { |
| 18620 return (e instanceof ParameterType); | 18747 return (e instanceof ParameterType); |
| 18621 }) | 18748 }) |
| 18622 ); | 18749 )); |
| 18623 } | 18750 } |
| 18624 ConcreteType.prototype.get$members = function() { return this.members; }; | 18751 ConcreteType.prototype.get$members = function() { return this.members; }; |
| 18625 ConcreteType.prototype.set$members = function(value) { return this.members = val ue; }; | 18752 ConcreteType.prototype.set$members = function(value) { return this.members = val ue; }; |
| 18626 ConcreteType.prototype.get$constructors = function() { return this.constructors; }; | 18753 ConcreteType.prototype.get$constructors = function() { return this.constructors; }; |
| 18627 ConcreteType.prototype.set$constructors = function(value) { return this.construc tors = value; }; | 18754 ConcreteType.prototype.set$constructors = function(value) { return this.construc tors = value; }; |
| 18628 ConcreteType.prototype.get$factories = function() { return this.factories; }; | 18755 ConcreteType.prototype.get$factories = function() { return this.factories; }; |
| 18629 ConcreteType.prototype.set$factories = function(value) { return this.factories = value; }; | 18756 ConcreteType.prototype.set$factories = function(value) { return this.factories = value; }; |
| 18630 ConcreteType.prototype.resolveTypeParams = function(inType) { | 18757 ConcreteType.prototype.resolveTypeParams = function(inType) { |
| 18631 var newTypeArgs = []; | 18758 var newTypeArgs = []; |
| 18632 var needsNewType = false; | 18759 var needsNewType = false; |
| 18633 var $list = this.typeArgsInOrder; | 18760 var $list = this.typeArgsInOrder; |
| 18634 for (var $i = 0;$i < $list.length; $i++) { | 18761 for (var $i = 0;$i < $list.length; $i++) { |
| 18635 var t = $list.$index($i); | 18762 var t = $list.$index($i); |
| 18636 var newType = t.resolveTypeParams(inType); | 18763 var newType = t.resolveTypeParams(inType); |
| 18637 if ($notnull_bool($ne(newType, t))) needsNewType = true; | 18764 if ($notnull_bool($ne(newType, t))) needsNewType = true; |
| 18638 newTypeArgs.add(newType); | 18765 newTypeArgs.add(newType); |
| 18639 } | 18766 } |
| 18640 if ($notnull_bool(!$notnull_bool(needsNewType))) return this; | 18767 if (!$notnull_bool(needsNewType)) return this; |
| 18641 return this.genericType.getOrMakeConcreteType((newTypeArgs && newTypeArgs.is$L ist$Type())); | 18768 return this.genericType.getOrMakeConcreteType((newTypeArgs && newTypeArgs.is$L ist$Type())); |
| 18642 } | 18769 } |
| 18643 ConcreteType.prototype.getOrMakeConcreteType = function(typeArgs) { | 18770 ConcreteType.prototype.getOrMakeConcreteType = function(typeArgs) { |
| 18644 return this.genericType.getOrMakeConcreteType(typeArgs); | 18771 return this.genericType.getOrMakeConcreteType(typeArgs); |
| 18645 } | 18772 } |
| 18646 ConcreteType.prototype.get$parent = function() { | 18773 ConcreteType.prototype.get$parent = function() { |
| 18647 return this.genericType.get$parent(); | 18774 return this.genericType.get$parent(); |
| 18648 } | 18775 } |
| 18649 ConcreteType.prototype.get$interfaces = function() { | 18776 ConcreteType.prototype.get$interfaces = function() { |
| 18650 if ($notnull_bool(this._interfaces == null && this.genericType.interfaces != n ull)) { | 18777 if (this._interfaces == null && this.genericType.interfaces != null) { |
| 18651 this._interfaces = []; | 18778 this._interfaces = []; |
| 18652 var $list = this.genericType.interfaces; | 18779 var $list = this.genericType.interfaces; |
| 18653 for (var $i = 0;$i < $list.length; $i++) { | 18780 for (var $i = 0;$i < $list.length; $i++) { |
| 18654 var i = $list.$index($i); | 18781 var i = $list.$index($i); |
| 18655 this._interfaces.add(i.resolveTypeParams(this)); | 18782 this._interfaces.add(i.resolveTypeParams(this)); |
| 18656 } | 18783 } |
| 18657 } | 18784 } |
| 18658 return this._interfaces; | 18785 return this._interfaces; |
| 18659 } | 18786 } |
| 18660 ConcreteType.prototype.getCallMethod = function() { | 18787 ConcreteType.prototype.getCallMethod = function() { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 18681 ConcreteType.prototype.getFactory = function(type, constructorName) { | 18808 ConcreteType.prototype.getFactory = function(type, constructorName) { |
| 18682 return this.genericType.getFactory(type, constructorName); | 18809 return this.genericType.getFactory(type, constructorName); |
| 18683 } | 18810 } |
| 18684 ConcreteType.prototype.getConstructor = function(constructorName) { | 18811 ConcreteType.prototype.getConstructor = function(constructorName) { |
| 18685 var ret = this.constructors.$index(constructorName); | 18812 var ret = this.constructors.$index(constructorName); |
| 18686 if ($notnull_bool($ne(ret, null))) return ret; | 18813 if ($notnull_bool($ne(ret, null))) return ret; |
| 18687 ret = this.factories.getFactory(this.name, constructorName); | 18814 ret = this.factories.getFactory(this.name, constructorName); |
| 18688 if ($notnull_bool($ne(ret, null))) return ret; | 18815 if ($notnull_bool($ne(ret, null))) return ret; |
| 18689 var genericMember = this.genericType.getConstructor(constructorName); | 18816 var genericMember = this.genericType.getConstructor(constructorName); |
| 18690 if ($notnull_bool(genericMember == null)) return null; | 18817 if ($notnull_bool(genericMember == null)) return null; |
| 18691 if ($notnull_bool($ne(genericMember.declaringType, this.genericType))) { | 18818 if ($ne(genericMember.declaringType, this.genericType)) { |
| 18692 if ($notnull_bool(!$notnull_bool(genericMember.declaringType.get$isGeneric() ))) return genericMember; | 18819 if (!$notnull_bool(genericMember.declaringType.get$isGeneric())) return gene ricMember; |
| 18693 var newDeclaringType = genericMember.declaringType.getOrMakeConcreteType(thi s.typeArgsInOrder); | 18820 var newDeclaringType = genericMember.declaringType.getOrMakeConcreteType(thi s.typeArgsInOrder); |
| 18694 return newDeclaringType.getConstructor(constructorName); | 18821 return newDeclaringType.getConstructor(constructorName); |
| 18695 } | 18822 } |
| 18696 if ($notnull_bool(genericMember.get$isFactory())) { | 18823 if ($notnull_bool(genericMember.get$isFactory())) { |
| 18697 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gen ericMember); | 18824 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gen ericMember); |
| 18698 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member( ))); | 18825 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member( ))); |
| 18699 } | 18826 } |
| 18700 else { | 18827 else { |
| 18701 ret = new ConcreteMember(this.name, this, genericMember); | 18828 ret = new ConcreteMember(this.name, this, genericMember); |
| 18702 this.constructors.$setindex(constructorName, ret); | 18829 this.constructors.$setindex(constructorName, ret); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18767 DefinedType.prototype.set$constructors = function(value) { return this.construct ors = value; }; | 18894 DefinedType.prototype.set$constructors = function(value) { return this.construct ors = value; }; |
| 18768 DefinedType.prototype.get$members = function() { return this.members; }; | 18895 DefinedType.prototype.get$members = function() { return this.members; }; |
| 18769 DefinedType.prototype.set$members = function(value) { return this.members = valu e; }; | 18896 DefinedType.prototype.set$members = function(value) { return this.members = valu e; }; |
| 18770 DefinedType.prototype.get$factories = function() { return this.factories; }; | 18897 DefinedType.prototype.get$factories = function() { return this.factories; }; |
| 18771 DefinedType.prototype.set$factories = function(value) { return this.factories = value; }; | 18898 DefinedType.prototype.set$factories = function(value) { return this.factories = value; }; |
| 18772 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; | 18899 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; |
| 18773 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value; }; | 18900 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value; }; |
| 18774 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType; }; | 18901 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType; }; |
| 18775 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT ype = value; }; | 18902 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT ype = value; }; |
| 18776 DefinedType.prototype.setDefinition = function(def) { | 18903 DefinedType.prototype.setDefinition = function(def) { |
| 18777 $assert(this.definition == null, "definition == null", "type.dart", 564, 12); | 18904 $assert(this.definition == null, "definition == null", "type.dart", 628, 12); |
| 18778 this.definition = def; | 18905 this.definition = def; |
| 18779 if ($notnull_bool((this.definition instanceof TypeDefinition) && this.definiti on.get$nativeType() != null)) { | 18906 if ((this.definition instanceof TypeDefinition) && this.definition.get$nativeT ype() != null) { |
| 18780 this.isNativeType = true; | 18907 this.isNativeType = true; |
| 18781 } | 18908 } |
| 18782 if ($notnull_bool(this.definition != null && this.definition.get$typeParameter s() != null)) { | 18909 if (this.definition != null && this.definition.get$typeParameters() != null) { |
| 18783 this._concreteTypes = $map([]); | 18910 this._concreteTypes = $map([]); |
| 18784 this.typeParameters = []; | 18911 this.typeParameters = []; |
| 18785 var $list = this.definition.get$typeParameters(); | 18912 var $list = this.definition.get$typeParameters(); |
| 18786 for (var $i = 0;$i < $list.length; $i++) { | 18913 for (var $i = 0;$i < $list.length; $i++) { |
| 18787 var tp = $list.$index($i); | 18914 var tp = $list.$index($i); |
| 18788 var paramName = tp.get$name().get$name(); | 18915 var paramName = tp.get$name().get$name(); |
| 18789 this.typeParameters.add(new ParameterType($assert_String(paramName), tp)); | 18916 this.typeParameters.add(new ParameterType($assert_String(paramName), tp)); |
| 18790 } | 18917 } |
| 18791 } | 18918 } |
| 18792 } | 18919 } |
| 18793 DefinedType.prototype.get$typeArgsInOrder = function() { | 18920 DefinedType.prototype.get$typeArgsInOrder = function() { |
| 18794 if ($notnull_bool(this.typeParameters == null)) return null; | 18921 if (this.typeParameters == null) return null; |
| 18795 if ($notnull_bool(this._typeArgsInOrder == null)) { | 18922 if (this._typeArgsInOrder == null) { |
| 18796 this._typeArgsInOrder = new FixedCollection$Type(world.varType, this.typePar ameters.length); | 18923 this._typeArgsInOrder = new FixedCollection$Type(world.varType, this.typePar ameters.length); |
| 18797 } | 18924 } |
| 18798 return this._typeArgsInOrder; | 18925 return this._typeArgsInOrder; |
| 18799 } | 18926 } |
| 18800 DefinedType.prototype.get$isVar = function() { | 18927 DefinedType.prototype.get$isVar = function() { |
| 18801 return $eq(this, world.varType); | 18928 return $eq(this, world.varType); |
| 18802 } | 18929 } |
| 18803 DefinedType.prototype.get$isVoid = function() { | 18930 DefinedType.prototype.get$isVoid = function() { |
| 18804 return $eq(this, world.voidType); | 18931 return $eq(this, world.voidType); |
| 18805 } | 18932 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 18819 return $notnull_bool(this.library.get$isCore() && this.name == 'Function'); | 18946 return $notnull_bool(this.library.get$isCore() && this.name == 'Function'); |
| 18820 } | 18947 } |
| 18821 DefinedType.prototype.get$isList = function() { | 18948 DefinedType.prototype.get$isList = function() { |
| 18822 return $notnull_bool(this.library.get$isCore() && this.name == 'List'); | 18949 return $notnull_bool(this.library.get$isCore() && this.name == 'List'); |
| 18823 } | 18950 } |
| 18824 DefinedType.prototype.get$isGeneric = function() { | 18951 DefinedType.prototype.get$isGeneric = function() { |
| 18825 return this.typeParameters != null; | 18952 return this.typeParameters != null; |
| 18826 } | 18953 } |
| 18827 DefinedType.prototype.get$span = function() { | 18954 DefinedType.prototype.get$span = function() { |
| 18828 var $0; | 18955 var $0; |
| 18829 return (($0 = $notnull_bool(this.definition == null) ? null : this.definition. span) && $0.is$SourceSpan()); | 18956 return (($0 = this.definition == null ? null : this.definition.span) && $0.is$ SourceSpan()); |
| 18830 } | 18957 } |
| 18831 DefinedType.prototype.get$typeofName = function() { | 18958 DefinedType.prototype.get$typeofName = function() { |
| 18832 if ($notnull_bool(!$notnull_bool(this.library.get$isCore()))) return null; | 18959 if (!$notnull_bool(this.library.get$isCore())) return null; |
| 18833 if ($notnull_bool(this.get$isBool())) return 'boolean'; | 18960 if ($notnull_bool(this.get$isBool())) return 'boolean'; |
| 18834 else if ($notnull_bool(this.get$isNum())) return 'number'; | 18961 else if ($notnull_bool(this.get$isNum())) return 'number'; |
| 18835 else if ($notnull_bool(this.get$isString())) return 'string'; | 18962 else if ($notnull_bool(this.get$isString())) return 'string'; |
| 18836 else if ($notnull_bool(this.get$isFunction())) return 'function'; | 18963 else if ($notnull_bool(this.get$isFunction())) return 'function'; |
| 18837 else return null; | 18964 else return null; |
| 18838 } | 18965 } |
| 18839 DefinedType.prototype.get$isNum = function() { | 18966 DefinedType.prototype.get$isNum = function() { |
| 18840 return $notnull_bool(this.library != null && this.library.get$isCore()) && ($n otnull_bool(this.name == 'num' || this.name == 'int') || this.name == 'double'); | 18967 return $notnull_bool(this.library != null && this.library.get$isCore()) && (th is.name == 'num' || this.name == 'int' || this.name == 'double'); |
| 18841 } | 18968 } |
| 18842 DefinedType.prototype.getCallMethod = function() { | 18969 DefinedType.prototype.getCallMethod = function() { |
| 18843 var $0; | 18970 var $0; |
| 18844 return (($0 = this.members.$index('\$call')) && $0.is$MethodMember()); | 18971 return (($0 = this.members.$index('\$call')) && $0.is$MethodMember()); |
| 18845 } | 18972 } |
| 18846 DefinedType.prototype.getAllMembers = function() { | 18973 DefinedType.prototype.getAllMembers = function() { |
| 18847 return HashMapImplementation.HashMapImplementation$from$factory(this.members); | 18974 return HashMapImplementation.HashMapImplementation$from$factory(this.members); |
| 18848 } | 18975 } |
| 18849 DefinedType.prototype.markUsed = function() { | 18976 DefinedType.prototype.markUsed = function() { |
| 18850 if ($notnull_bool(this.isUsed)) return; | 18977 if ($notnull_bool(this.isUsed)) return; |
| 18851 this.isUsed = true; | 18978 this.isUsed = true; |
| 18852 if ($notnull_bool(this._lazyGenMethods != null)) { | 18979 if (this._lazyGenMethods != null) { |
| 18853 var $list = orderValuesByKeys(this._lazyGenMethods); | 18980 var $list = orderValuesByKeys(this._lazyGenMethods); |
| 18854 for (var $i = 0;$i < $list.length; $i++) { | 18981 for (var $i = 0;$i < $list.length; $i++) { |
| 18855 var method = $list.$index($i); | 18982 var method = $list.$index($i); |
| 18856 world.gen.genMethod((method && method.is$Member())); | 18983 world.gen.genMethod((method && method.is$Member())); |
| 18857 } | 18984 } |
| 18858 this._lazyGenMethods = null; | 18985 this._lazyGenMethods = null; |
| 18859 } | 18986 } |
| 18860 if ($notnull_bool(this.get$parent() != null)) this.get$parent().markUsed(); | 18987 if (this.get$parent() != null) this.get$parent().markUsed(); |
| 18861 } | 18988 } |
| 18862 DefinedType.prototype.genMethod = function(method) { | 18989 DefinedType.prototype.genMethod = function(method) { |
| 18863 if ($notnull_bool(this.isUsed)) { | 18990 if ($notnull_bool(this.isUsed)) { |
| 18864 world.gen.genMethod(method); | 18991 world.gen.genMethod(method); |
| 18865 } | 18992 } |
| 18866 else if ($notnull_bool(this.isClass)) { | 18993 else if ($notnull_bool(this.isClass)) { |
| 18867 if ($notnull_bool(this._lazyGenMethods == null)) this._lazyGenMethods = $map ([]); | 18994 if (this._lazyGenMethods == null) this._lazyGenMethods = $map([]); |
| 18868 this._lazyGenMethods.$setindex(method.name, method); | 18995 this._lazyGenMethods.$setindex(method.name, method); |
| 18869 } | 18996 } |
| 18870 } | 18997 } |
| 18871 DefinedType.prototype._resolveInterfaces = function(types) { | 18998 DefinedType.prototype._resolveInterfaces = function(types) { |
| 18872 if ($notnull_bool(types == null)) return []; | 18999 if (types == null) return []; |
| 18873 var interfaces = []; | 19000 var interfaces = []; |
| 18874 for (var $i = 0;$i < types.length; $i++) { | 19001 for (var $i = 0;$i < types.length; $i++) { |
| 18875 var type = types.$index($i); | 19002 var type = types.$index($i); |
| 18876 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true); | 19003 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true); |
| 18877 if ($notnull_bool(resolvedInterface.get$isClosed() && !$notnull_bool(($notnu ll_bool(this.library.get$isCore() || this.library.get$isCoreImpl()))))) { | 19004 if ($notnull_bool(resolvedInterface.get$isClosed() && !($notnull_bool(this.l ibrary.get$isCore() || this.library.get$isCoreImpl())))) { |
| 18878 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span()); | 19005 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span()); |
| 18879 } | 19006 } |
| 18880 resolvedInterface.addDirectSubtype(this); | 19007 resolvedInterface.addDirectSubtype(this); |
| 18881 interfaces.add(resolvedInterface); | 19008 interfaces.add(resolvedInterface); |
| 18882 } | 19009 } |
| 18883 return (interfaces && interfaces.is$List$Type()); | 19010 return (interfaces && interfaces.is$List$Type()); |
| 18884 } | 19011 } |
| 18885 DefinedType.prototype.addDirectSubtype = function(type) { | 19012 DefinedType.prototype.addDirectSubtype = function(type) { |
| 18886 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 680, 12); | 19013 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 744, 12); |
| 18887 this.directSubtypes.add(type); | 19014 this.directSubtypes.add(type); |
| 18888 } | 19015 } |
| 18889 DefinedType.prototype.get$subtypes = function() { | 19016 DefinedType.prototype.get$subtypes = function() { |
| 18890 if ($notnull_bool(this._subtypes == null)) { | 19017 if (this._subtypes == null) { |
| 18891 this._subtypes = new HashSetImplementation$Type(); | 19018 this._subtypes = new HashSetImplementation$Type(); |
| 18892 var $list = this.directSubtypes; | 19019 var $list = this.directSubtypes; |
| 18893 for (var $i = this.directSubtypes.iterator(); $i.hasNext(); ) { | 19020 for (var $i = this.directSubtypes.iterator(); $i.hasNext(); ) { |
| 18894 var st = $i.next(); | 19021 var st = $i.next(); |
| 18895 this._subtypes.add(st); | 19022 this._subtypes.add(st); |
| 18896 this._subtypes.addAll(st.get$subtypes()); | 19023 this._subtypes.addAll(st.get$subtypes()); |
| 18897 } | 19024 } |
| 18898 } | 19025 } |
| 18899 return this._subtypes; | 19026 return this._subtypes; |
| 18900 } | 19027 } |
| 18901 DefinedType.prototype._cycleInClassExtends = function() { | 19028 DefinedType.prototype._cycleInClassExtends = function() { |
| 18902 var seen = new HashSetImplementation(); | 19029 var seen = new HashSetImplementation(); |
| 18903 seen.add(this); | 19030 seen.add(this); |
| 18904 var ancestor = this.get$parent(); | 19031 var ancestor = this.get$parent(); |
| 18905 while ($notnull_bool($ne(ancestor, null))) { | 19032 while ($notnull_bool($ne(ancestor, null))) { |
| 18906 if ($notnull_bool(ancestor === this)) { | 19033 if (ancestor === this) { |
| 18907 return true; | 19034 return true; |
| 18908 } | 19035 } |
| 18909 if ($notnull_bool(seen.contains(ancestor))) { | 19036 if (seen.contains(ancestor)) { |
| 18910 return false; | 19037 return false; |
| 18911 } | 19038 } |
| 18912 seen.add(ancestor); | 19039 seen.add(ancestor); |
| 18913 ancestor = ancestor.get$parent(); | 19040 ancestor = ancestor.get$parent(); |
| 18914 } | 19041 } |
| 18915 return false; | 19042 return false; |
| 18916 } | 19043 } |
| 18917 DefinedType.prototype._cycleInInterfaceExtends = function() { | 19044 DefinedType.prototype._cycleInInterfaceExtends = function() { |
| 18918 var $this = this; // closure support | 19045 var $this = this; // closure support |
| 18919 var seen = new HashSetImplementation(); | 19046 var seen = new HashSetImplementation(); |
| 18920 seen.add(this); | 19047 seen.add(this); |
| 18921 function _helper(ancestor) { | 19048 function _helper(ancestor) { |
| 18922 if ($notnull_bool(ancestor == null)) return false; | 19049 if ($notnull_bool(ancestor == null)) return false; |
| 18923 if ($notnull_bool(ancestor === $this)) return true; | 19050 if (ancestor === $this) return true; |
| 18924 if ($notnull_bool(seen.contains(ancestor))) { | 19051 if (seen.contains(ancestor)) { |
| 18925 return false; | 19052 return false; |
| 18926 } | 19053 } |
| 18927 seen.add(ancestor); | 19054 seen.add(ancestor); |
| 18928 if ($notnull_bool($ne(ancestor.get$interfaces(), null))) { | 19055 if ($notnull_bool($ne(ancestor.get$interfaces(), null))) { |
| 18929 var $list = ancestor.get$interfaces(); | 19056 var $list = ancestor.get$interfaces(); |
| 18930 for (var $i = ancestor.get$interfaces().iterator(); $i.hasNext(); ) { | 19057 for (var $i = ancestor.get$interfaces().iterator(); $i.hasNext(); ) { |
| 18931 var parent = $i.next(); | 19058 var parent = $i.next(); |
| 18932 if ($notnull_bool(_helper(parent))) return true; | 19059 if ($notnull_bool(_helper(parent))) return true; |
| 18933 } | 19060 } |
| 18934 } | 19061 } |
| 18935 return false; | 19062 return false; |
| 18936 } | 19063 } |
| 18937 for (var i = 0; | 19064 for (var i = 0; |
| 18938 $notnull_bool(i < this.interfaces.length); i++) { | 19065 i < this.interfaces.length; i++) { |
| 18939 if ($notnull_bool(_helper(this.interfaces.$index(i)))) return i; | 19066 if ($notnull_bool(_helper(this.interfaces.$index(i)))) return i; |
| 18940 } | 19067 } |
| 18941 return -1; | 19068 return -1; |
| 18942 } | 19069 } |
| 18943 DefinedType.prototype.resolve = function() { | 19070 DefinedType.prototype.resolve = function() { |
| 18944 var $this = this; // closure support | 19071 var $this = this; // closure support |
| 18945 var $0; | 19072 var $0; |
| 18946 if ($notnull_bool((this.definition instanceof TypeDefinition))) { | 19073 if ((this.definition instanceof TypeDefinition)) { |
| 18947 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition()); | 19074 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition()); |
| 18948 if ($notnull_bool(this.isClass)) { | 19075 if ($notnull_bool(this.isClass)) { |
| 18949 if ($notnull_bool(typeDef.extendsTypes != null && typeDef.extendsTypes.len gth > 0)) { | 19076 if (typeDef.extendsTypes != null && typeDef.extendsTypes.length > 0) { |
| 18950 if ($notnull_bool(typeDef.extendsTypes.length > 1)) { | 19077 if (typeDef.extendsTypes.length > 1) { |
| 18951 world.error('more than one base class', typeDef.extendsTypes.$index(1) .get$span()); | 19078 world.error('more than one base class', typeDef.extendsTypes.$index(1) .get$span()); |
| 18952 } | 19079 } |
| 18953 var extendsTypeRef = typeDef.extendsTypes.$index(0); | 19080 var extendsTypeRef = typeDef.extendsTypes.$index(0); |
| 18954 if ($notnull_bool((extendsTypeRef instanceof GenericTypeReference))) { | 19081 if ((extendsTypeRef instanceof GenericTypeReference)) { |
| 18955 var g = (extendsTypeRef && extendsTypeRef.is$GenericTypeReference()); | 19082 var g = (extendsTypeRef && extendsTypeRef.is$GenericTypeReference()); |
| 18956 this.set$parent(this.resolveType(g.baseType, true)); | 19083 this.set$parent(this.resolveType(g.baseType, true)); |
| 18957 } | 19084 } |
| 18958 this.set$parent(this.resolveType((extendsTypeRef && extendsTypeRef.is$Ty peReference()), true)); | 19085 this.set$parent(this.resolveType((extendsTypeRef && extendsTypeRef.is$Ty peReference()), true)); |
| 18959 if ($notnull_bool(!$notnull_bool(this.get$parent().get$isClass()))) { | 19086 if (!$notnull_bool(this.get$parent().get$isClass())) { |
| 18960 world.error('class may not extend an interface - use implements', type Def.extendsTypes.$index(0).get$span()); | 19087 world.error('class may not extend an interface - use implements', type Def.extendsTypes.$index(0).get$span()); |
| 18961 } | 19088 } |
| 18962 this.get$parent().addDirectSubtype(this); | 19089 this.get$parent().addDirectSubtype(this); |
| 18963 if ($notnull_bool(this._cycleInClassExtends())) { | 19090 if ($notnull_bool(this._cycleInClassExtends())) { |
| 18964 world.error(('class "' + this.name + '" has a cycle in its inheritance chain'), extendsTypeRef.get$span()); | 19091 world.error(('class "' + this.name + '" has a cycle in its inheritance chain'), extendsTypeRef.get$span()); |
| 18965 } | 19092 } |
| 18966 } | 19093 } |
| 18967 else { | 19094 else { |
| 18968 if ($notnull_bool(!$notnull_bool(this.get$isObject()))) { | 19095 if (!$notnull_bool(this.get$isObject())) { |
| 18969 this.set$parent(world.objectType); | 19096 this.set$parent(world.objectType); |
| 18970 } | 19097 } |
| 18971 } | 19098 } |
| 18972 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); | 19099 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); |
| 18973 if ($notnull_bool(typeDef.factoryType != null)) { | 19100 if (typeDef.factoryType != null) { |
| 18974 world.error('factory not allowed on classes', typeDef.factoryType.span); | 19101 world.error('factory not allowed on classes', typeDef.factoryType.span); |
| 18975 } | 19102 } |
| 18976 } | 19103 } |
| 18977 else { | 19104 else { |
| 18978 if ($notnull_bool(typeDef.implementsTypes != null && typeDef.implementsTyp es.length > 0)) { | 19105 if (typeDef.implementsTypes != null && typeDef.implementsTypes.length > 0) { |
| 18979 world.error('implements not allowed on interfaces (use extends)', typeDe f.implementsTypes.$index(0).get$span()); | 19106 world.error('implements not allowed on interfaces (use extends)', typeDe f.implementsTypes.$index(0).get$span()); |
| 18980 } | 19107 } |
| 18981 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes); | 19108 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes); |
| 18982 var res = this._cycleInInterfaceExtends(); | 19109 var res = this._cycleInInterfaceExtends(); |
| 18983 if ($notnull_bool(res >= 0)) { | 19110 if (res >= 0) { |
| 18984 world.error(('interface "' + this.name + '" has a cycle in its inheritan ce chain'), typeDef.extendsTypes.$index(res).get$span()); | 19111 world.error(('interface "' + this.name + '" has a cycle in its inheritan ce chain'), typeDef.extendsTypes.$index(res).get$span()); |
| 18985 } | 19112 } |
| 18986 if ($notnull_bool(typeDef.factoryType != null)) { | 19113 if (typeDef.factoryType != null) { |
| 18987 this.factory_ = this.resolveType(typeDef.factoryType, true); | 19114 this.factory_ = this.resolveType(typeDef.factoryType, true); |
| 18988 if ($notnull_bool(this.factory_ == null)) { | 19115 if (this.factory_ == null) { |
| 18989 world.warning('unresolved factory', typeDef.factoryType.span); | 19116 world.warning('unresolved factory', typeDef.factoryType.span); |
| 18990 } | 19117 } |
| 18991 } | 19118 } |
| 18992 } | 19119 } |
| 18993 } | 19120 } |
| 18994 else if ($notnull_bool((this.definition instanceof FunctionTypeDefinition))) { | 19121 else if ((this.definition instanceof FunctionTypeDefinition)) { |
| 18995 this.interfaces = [world.functionType]; | 19122 this.interfaces = [world.functionType]; |
| 18996 } | 19123 } |
| 18997 if ($notnull_bool(this.typeParameters != null)) { | 19124 if (this.typeParameters != null) { |
| 18998 var $list = this.typeParameters; | 19125 var $list = this.typeParameters; |
| 18999 for (var $i = 0;$i < $list.length; $i++) { | 19126 for (var $i = 0;$i < $list.length; $i++) { |
| 19000 var tp = $list.$index($i); | 19127 var tp = $list.$index($i); |
| 19001 tp.resolve(this); | 19128 tp.resolve(this); |
| 19002 } | 19129 } |
| 19003 } | 19130 } |
| 19004 world._addType(this); | 19131 world._addType(this); |
| 19005 var $list = this.constructors.getValues(); | 19132 var $list = this.constructors.getValues(); |
| 19006 for (var $i = this.constructors.getValues().iterator(); $i.hasNext(); ) { | 19133 for (var $i = this.constructors.getValues().iterator(); $i.hasNext(); ) { |
| 19007 var c = $i.next(); | 19134 var c = $i.next(); |
| 19008 c.resolve(this); | 19135 c.resolve(this); |
| 19009 } | 19136 } |
| 19010 var $list0 = this.members.getValues(); | 19137 var $list0 = this.members.getValues(); |
| 19011 for (var $i = this.members.getValues().iterator(); $i.hasNext(); ) { | 19138 for (var $i = this.members.getValues().iterator(); $i.hasNext(); ) { |
| 19012 var m = $i.next(); | 19139 var m = $i.next(); |
| 19013 m.resolve(this); | 19140 m.resolve(this); |
| 19014 } | 19141 } |
| 19015 this.factories.forEach((function (f) { | 19142 this.factories.forEach((function (f) { |
| 19016 return f.resolve($this); | 19143 return f.resolve($this); |
| 19017 }) | 19144 }) |
| 19018 ); | 19145 ); |
| 19019 } | 19146 } |
| 19020 DefinedType.prototype.addMethod = function(methodName, definition) { | 19147 DefinedType.prototype.addMethod = function(methodName, definition) { |
| 19021 if ($notnull_bool(methodName == null)) methodName = definition.name.name; | 19148 if (methodName == null) methodName = definition.name.name; |
| 19022 var method = new MethodMember(methodName, this, definition); | 19149 var method = new MethodMember(methodName, this, definition); |
| 19023 if ($notnull_bool(method.get$isConstructor())) { | 19150 if ($notnull_bool(method.get$isConstructor())) { |
| 19024 if ($notnull_bool(this.constructors.containsKey(method.get$constructorName() ))) { | 19151 if (this.constructors.containsKey(method.get$constructorName())) { |
| 19025 world.error(('duplicate constructor definition of ' + method.get$name() + ''), definition.span); | 19152 world.error(('duplicate constructor definition of ' + method.get$name() + ''), definition.span); |
| 19026 return; | 19153 return; |
| 19027 } | 19154 } |
| 19028 this.constructors.$setindex(method.get$constructorName(), method); | 19155 this.constructors.$setindex(method.get$constructorName(), method); |
| 19029 return; | 19156 return; |
| 19030 } | 19157 } |
| 19031 if ($notnull_bool(definition.modifiers != null && definition.modifiers.length == 1) && $eq(definition.modifiers.$index(0).kind, 75/*TokenKind.FACTORY*/)) { | 19158 if ($notnull_bool(definition.modifiers != null && definition.modifiers.length == 1 && $eq(definition.modifiers.$index(0).kind, 75/*TokenKind.FACTORY*/))) { |
| 19032 if ($notnull_bool(this.factories.getFactory(method.get$constructorName(), $a ssert_String(method.get$name())) != null)) { | 19159 if (this.factories.getFactory(method.get$constructorName(), $assert_String(m ethod.get$name())) != null) { |
| 19033 world.error(('duplicate factory definition of "' + method.get$name() + '"' ), definition.span); | 19160 world.error(('duplicate factory definition of "' + method.get$name() + '"' ), definition.span); |
| 19034 return; | 19161 return; |
| 19035 } | 19162 } |
| 19036 this.factories.addFactory(method.get$constructorName(), $assert_String(metho d.get$name()), (method && method.is$Member())); | 19163 this.factories.addFactory(method.get$constructorName(), $assert_String(metho d.get$name()), (method && method.is$Member())); |
| 19037 return; | 19164 return; |
| 19038 } | 19165 } |
| 19039 if ($notnull_bool(methodName.startsWith('get\$') || methodName.startsWith('set \$'))) { | 19166 if (methodName.startsWith('get\$') || methodName.startsWith('set\$')) { |
| 19040 var propName = methodName.substring(4); | 19167 var propName = methodName.substring(4); |
| 19041 var prop = this.members.$index(propName); | 19168 var prop = this.members.$index(propName); |
| 19042 if ($notnull_bool(prop == null)) { | 19169 if ($notnull_bool(prop == null)) { |
| 19043 prop = new PropertyMember($assert_String(propName), this); | 19170 prop = new PropertyMember($assert_String(propName), this); |
| 19044 this.members.$setindex(propName, prop); | 19171 this.members.$setindex(propName, prop); |
| 19045 } | 19172 } |
| 19046 if ($notnull_bool(!(prop instanceof PropertyMember))) { | 19173 if (!(prop instanceof PropertyMember)) { |
| 19047 world.error(('property conflicts with field "' + propName + '"'), definiti on.span); | 19174 world.error(('property conflicts with field "' + propName + '"'), definiti on.span); |
| 19048 return; | 19175 return; |
| 19049 } | 19176 } |
| 19050 if ($notnull_bool(methodName[0] == 'g')) { | 19177 if (methodName[0] == 'g') { |
| 19051 if ($notnull_bool(prop.getter != null)) { | 19178 if (prop.getter != null) { |
| 19052 world.error(('duplicate getter definition for "' + propName + '"'), defi nition.span); | 19179 world.error(('duplicate getter definition for "' + propName + '"'), defi nition.span); |
| 19053 } | 19180 } |
| 19054 prop.getter = (method && method.is$MethodMember()); | 19181 prop.getter = (method && method.is$MethodMember()); |
| 19055 } | 19182 } |
| 19056 else { | 19183 else { |
| 19057 if ($notnull_bool(prop.setter != null)) { | 19184 if (prop.setter != null) { |
| 19058 world.error(('duplicate setter definition for "' + propName + '"'), defi nition.span); | 19185 world.error(('duplicate setter definition for "' + propName + '"'), defi nition.span); |
| 19059 } | 19186 } |
| 19060 prop.setter = (method && method.is$MethodMember()); | 19187 prop.setter = (method && method.is$MethodMember()); |
| 19061 } | 19188 } |
| 19062 return; | 19189 return; |
| 19063 } | 19190 } |
| 19064 if ($notnull_bool(this.members.containsKey(methodName))) { | 19191 if (this.members.containsKey(methodName)) { |
| 19065 world.error(('duplicate method definition of "' + method.get$name() + '"'), definition.span); | 19192 world.error(('duplicate method definition of "' + method.get$name() + '"'), definition.span); |
| 19066 return; | 19193 return; |
| 19067 } | 19194 } |
| 19068 this.members.$setindex(methodName, method); | 19195 this.members.$setindex(methodName, method); |
| 19069 } | 19196 } |
| 19070 DefinedType.prototype.addField = function(definition) { | 19197 DefinedType.prototype.addField = function(definition) { |
| 19071 for (var i = 0; | 19198 for (var i = 0; |
| 19072 $notnull_bool(i < definition.names.length); i++) { | 19199 i < definition.names.length; i++) { |
| 19073 var name = definition.names.$index(i).get$name(); | 19200 var name = definition.names.$index(i).get$name(); |
| 19074 if ($notnull_bool(this.members.containsKey(name))) { | 19201 if (this.members.containsKey(name)) { |
| 19075 world.error(('duplicate field definition of "' + name + '"'), definition.s pan); | 19202 world.error(('duplicate field definition of "' + name + '"'), definition.s pan); |
| 19076 return; | 19203 return; |
| 19077 } | 19204 } |
| 19078 var value = null; | 19205 var value = null; |
| 19079 if ($notnull_bool(definition.values != null)) { | 19206 if (definition.values != null) { |
| 19080 value = definition.values.$index(i); | 19207 value = definition.values.$index(i); |
| 19081 } | 19208 } |
| 19082 var field = new FieldMember($assert_String(name), this, definition, value); | 19209 var field = new FieldMember($assert_String(name), this, definition, value); |
| 19083 this.members.$setindex(name, field); | 19210 this.members.$setindex(name, field); |
| 19084 if ($notnull_bool(this.isNativeType)) { | 19211 if ($notnull_bool(this.isNativeType)) { |
| 19085 field.isNative = true; | 19212 field.isNative = true; |
| 19086 } | 19213 } |
| 19087 } | 19214 } |
| 19088 } | 19215 } |
| 19089 DefinedType.prototype.getFactory = function(type, constructorName) { | 19216 DefinedType.prototype.getFactory = function(type, constructorName) { |
| 19090 var ret = this.factories.getFactory(type.name, constructorName); | 19217 var ret = this.factories.getFactory(type.name, constructorName); |
| 19091 if ($notnull_bool($ne(ret, null))) return ret; | 19218 if ($notnull_bool($ne(ret, null))) return ret; |
| 19092 ret = this.factories.getFactory(this.name, constructorName); | 19219 ret = this.factories.getFactory(this.name, constructorName); |
| 19093 if ($notnull_bool($ne(ret, null))) return ret; | 19220 if ($notnull_bool($ne(ret, null))) return ret; |
| 19094 ret = this.constructors.$index(constructorName); | 19221 ret = this.constructors.$index(constructorName); |
| 19095 if ($notnull_bool($ne(ret, null))) return ret; | 19222 if ($notnull_bool($ne(ret, null))) return ret; |
| 19096 return this._tryCreateDefaultConstructor(constructorName); | 19223 return this._tryCreateDefaultConstructor(constructorName); |
| 19097 } | 19224 } |
| 19098 DefinedType.prototype.getConstructor = function(constructorName) { | 19225 DefinedType.prototype.getConstructor = function(constructorName) { |
| 19099 var ret = this.constructors.$index(constructorName); | 19226 var ret = this.constructors.$index(constructorName); |
| 19100 if ($notnull_bool($ne(ret, null))) { | 19227 if ($notnull_bool($ne(ret, null))) { |
| 19101 if ($notnull_bool(this.factory_ != null)) { | 19228 if (this.factory_ != null) { |
| 19102 return this.factory_.getFactory(this, constructorName); | 19229 return this.factory_.getFactory(this, constructorName); |
| 19103 } | 19230 } |
| 19104 return ret; | 19231 return ret; |
| 19105 } | 19232 } |
| 19106 ret = this.factories.getFactory(this.name, constructorName); | 19233 ret = this.factories.getFactory(this.name, constructorName); |
| 19107 if ($notnull_bool($ne(ret, null))) return ret; | 19234 if ($notnull_bool($ne(ret, null))) return ret; |
| 19108 return this._tryCreateDefaultConstructor(constructorName); | 19235 return this._tryCreateDefaultConstructor(constructorName); |
| 19109 } | 19236 } |
| 19110 DefinedType.prototype._tryCreateDefaultConstructor = function(name) { | 19237 DefinedType.prototype._tryCreateDefaultConstructor = function(name) { |
| 19111 var $0; | 19238 var $0; |
| 19112 if ($notnull_bool(name == '' && this.definition != null) && this.isClass && th is.constructors.get$length() == 0) { | 19239 if ($notnull_bool(name == '' && this.definition != null && this.isClass) && th is.constructors.get$length() == 0) { |
| 19113 var span = this.definition.span; | 19240 var span = this.definition.span; |
| 19114 var inits = null, body = null; | 19241 var inits = null, body = null; |
| 19115 if ($notnull_bool(this.isNativeType)) { | 19242 if ($notnull_bool(this.isNativeType)) { |
| 19116 body = new NativeStatement(null, (span && span.is$SourceSpan())); | 19243 body = new NativeStatement(null, (span && span.is$SourceSpan())); |
| 19117 inits = null; | 19244 inits = null; |
| 19118 } | 19245 } |
| 19119 else { | 19246 else { |
| 19120 body = null; | 19247 body = null; |
| 19121 inits = [new CallExpression(new SuperExpression((span && span.is$SourceSpa n())), [], (span && span.is$SourceSpan()))]; | 19248 inits = [new CallExpression(new SuperExpression((span && span.is$SourceSpa n())), [], (span && span.is$SourceSpan()))]; |
| 19122 } | 19249 } |
| 19123 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition()); | 19250 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition()); |
| 19124 var c = new FunctionDefinition(null, null, typeDef.name, [], inits, body, (s pan && span.is$SourceSpan())); | 19251 var c = new FunctionDefinition(null, null, typeDef.name, [], inits, body, (s pan && span.is$SourceSpan())); |
| 19125 this.addMethod(null, (c && c.is$FunctionDefinition())); | 19252 this.addMethod(null, (c && c.is$FunctionDefinition())); |
| 19126 this.constructors.$index('').resolve(this); | 19253 this.constructors.$index('').resolve(this); |
| 19127 return this.constructors.$index(''); | 19254 return this.constructors.$index(''); |
| 19128 } | 19255 } |
| 19129 return null; | 19256 return null; |
| 19130 } | 19257 } |
| 19131 DefinedType.prototype.getMember = function(memberName) { | 19258 DefinedType.prototype.getMember = function(memberName) { |
| 19132 var $0; | 19259 var $0; |
| 19133 var member = (($0 = this.members.$index(memberName)) && $0.is$Member()); | 19260 var member = (($0 = this.members.$index(memberName)) && $0.is$Member()); |
| 19134 if ($notnull_bool(member != null)) { | 19261 if (member != null) { |
| 19135 var parentMember = this.getMemberInParents(memberName); | 19262 var parentMember = this.getMemberInParents(memberName); |
| 19136 if ($notnull_bool($ne(parentMember, null))) { | 19263 if ($notnull_bool($ne(parentMember, null))) { |
| 19137 if ($notnull_bool(!$notnull_bool(member.get$isPrivate()) || $eq(member.get $library(), parentMember.get$library()))) { | 19264 if (!$notnull_bool(member.get$isPrivate()) || $eq(member.get$library(), pa rentMember.get$library())) { |
| 19138 member.override(parentMember); | 19265 member.override(parentMember); |
| 19139 } | 19266 } |
| 19140 } | 19267 } |
| 19141 return member; | 19268 return member; |
| 19142 } | 19269 } |
| 19143 if ($notnull_bool(this.get$isTop())) { | 19270 if ($notnull_bool(this.get$isTop())) { |
| 19144 var libType = this.library.findTypeByName(memberName); | 19271 var libType = this.library.findTypeByName(memberName); |
| 19145 if ($notnull_bool($ne(libType, null))) { | 19272 if ($notnull_bool($ne(libType, null))) { |
| 19146 return libType.get$typeMember(); | 19273 return libType.get$typeMember(); |
| 19147 } | 19274 } |
| 19148 } | 19275 } |
| 19149 return this.getMemberInParents(memberName); | 19276 return this.getMemberInParents(memberName); |
| 19150 } | 19277 } |
| 19151 DefinedType.prototype.getMemberInParents = function(memberName) { | 19278 DefinedType.prototype.getMemberInParents = function(memberName) { |
| 19152 if ($notnull_bool(this.isClass)) { | 19279 if ($notnull_bool(this.isClass)) { |
| 19153 if ($notnull_bool(this.get$parent() != null)) { | 19280 if (this.get$parent() != null) { |
| 19154 return this.get$parent().getMember(memberName); | 19281 return this.get$parent().getMember(memberName); |
| 19155 } | 19282 } |
| 19156 else if ($notnull_bool(this.get$isObject())) { | 19283 else if ($notnull_bool(this.get$isObject())) { |
| 19157 if ($notnull_bool(memberName == '\$ne')) { | 19284 if (memberName == '\$ne') { |
| 19158 var ret = this._createNotEqualMember(); | 19285 var ret = this._createNotEqualMember(); |
| 19159 this.members.$setindex(memberName, ret); | 19286 this.members.$setindex(memberName, ret); |
| 19160 return (ret && ret.is$Member()); | 19287 return (ret && ret.is$Member()); |
| 19161 } | 19288 } |
| 19162 return null; | 19289 return null; |
| 19163 } | 19290 } |
| 19164 } | 19291 } |
| 19165 else { | 19292 else { |
| 19166 if ($notnull_bool(this.interfaces != null && this.interfaces.length > 0)) { | 19293 if (this.interfaces != null && this.interfaces.length > 0) { |
| 19167 var $list = this.interfaces; | 19294 var $list = this.interfaces; |
| 19168 for (var $i = 0;$i < $list.length; $i++) { | 19295 for (var $i = 0;$i < $list.length; $i++) { |
| 19169 var i = $list.$index($i); | 19296 var i = $list.$index($i); |
| 19170 var ret = i.getMember(memberName); | 19297 var ret = i.getMember(memberName); |
| 19171 if ($notnull_bool($ne(ret, null))) { | 19298 if ($notnull_bool($ne(ret, null))) { |
| 19172 return (ret && ret.is$Member()); | 19299 return (ret && ret.is$Member()); |
| 19173 } | 19300 } |
| 19174 } | 19301 } |
| 19175 return null; | 19302 return null; |
| 19176 } | 19303 } |
| 19177 else { | 19304 else { |
| 19178 return world.objectType.getMember(memberName); | 19305 return world.objectType.getMember(memberName); |
| 19179 } | 19306 } |
| 19180 } | 19307 } |
| 19181 } | 19308 } |
| 19182 DefinedType.prototype.resolveMember = function(memberName) { | 19309 DefinedType.prototype.resolveMember = function(memberName) { |
| 19183 var $0; | 19310 var $0; |
| 19184 var ret = (($0 = this._resolvedMembers.$index(memberName)) && $0.is$MemberSet( )); | 19311 var ret = (($0 = this._resolvedMembers.$index(memberName)) && $0.is$MemberSet( )); |
| 19185 if ($notnull_bool(ret != null)) return ret; | 19312 if (ret != null) return ret; |
| 19186 var member = this.getMember(memberName); | 19313 var member = this.getMember(memberName); |
| 19187 if ($notnull_bool(member == null)) { | 19314 if (member == null) { |
| 19188 return null; | 19315 return null; |
| 19189 } | 19316 } |
| 19190 ret = new MemberSet(member); | 19317 ret = new MemberSet(member); |
| 19191 this._resolvedMembers.$setindex(memberName, ret); | 19318 this._resolvedMembers.$setindex(memberName, ret); |
| 19192 if ($notnull_bool(member.get$isStatic())) { | 19319 if ($notnull_bool(member.get$isStatic())) { |
| 19193 return ret; | 19320 return ret; |
| 19194 } | 19321 } |
| 19195 else { | 19322 else { |
| 19196 var $list = this.get$subtypes(); | 19323 var $list = this.get$subtypes(); |
| 19197 for (var $i = this.get$subtypes().iterator(); $i.hasNext(); ) { | 19324 for (var $i = this.get$subtypes().iterator(); $i.hasNext(); ) { |
| 19198 var t = $i.next(); | 19325 var t = $i.next(); |
| 19199 var m; | 19326 var m; |
| 19200 if ($notnull_bool(!$notnull_bool(this.isClass) && t.get$isClass())) { | 19327 if ($notnull_bool(!$notnull_bool(this.isClass) && t.get$isClass())) { |
| 19201 m = t.getMember(memberName); | 19328 m = t.getMember(memberName); |
| 19202 } | 19329 } |
| 19203 else { | 19330 else { |
| 19204 m = t.get$members().$index(memberName); | 19331 m = t.get$members().$index(memberName); |
| 19205 } | 19332 } |
| 19206 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member())); | 19333 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member())); |
| 19207 } | 19334 } |
| 19208 return ret; | 19335 return ret; |
| 19209 } | 19336 } |
| 19210 } | 19337 } |
| 19211 DefinedType.prototype._createNotEqualMember = function() { | 19338 DefinedType.prototype._createNotEqualMember = function() { |
| 19212 var $0; | 19339 var $0; |
| 19213 var eq = (($0 = this.members.$index('\$eq')) && $0.is$MethodMember()); | 19340 var eq = (($0 = this.members.$index('\$eq')) && $0.is$MethodMember()); |
| 19214 if ($notnull_bool(eq == null)) { | 19341 if (eq == null) { |
| 19215 world.internalError('INTERNAL: object does not define ==', this.definition.s pan); | 19342 world.internalError('INTERNAL: object does not define ==', this.definition.s pan); |
| 19216 } | 19343 } |
| 19217 var ne = new MethodMember('\$ne', this, eq.definition); | 19344 var ne = new MethodMember('\$ne', this, eq.definition); |
| 19218 ne.isGenerated = true; | 19345 ne.isGenerated = true; |
| 19219 ne.returnType = eq.returnType; | 19346 ne.returnType = eq.returnType; |
| 19220 ne.parameters = eq.parameters; | 19347 ne.parameters = eq.parameters; |
| 19221 ne.isStatic = eq.isStatic; | 19348 ne.isStatic = eq.isStatic; |
| 19222 ne.isAbstract = eq.isAbstract; | 19349 ne.isAbstract = eq.isAbstract; |
| 19223 return ne; | 19350 return ne; |
| 19224 } | 19351 } |
| 19225 DefinedType._getDottedName = function(type) { | 19352 DefinedType._getDottedName = function(type) { |
| 19226 if ($notnull_bool(type.names != null)) { | 19353 if (type.names != null) { |
| 19227 var names = map(type.names, (function (n) { | 19354 var names = map(type.names, (function (n) { |
| 19228 return n.get$name(); | 19355 return n.get$name(); |
| 19229 }) | 19356 }) |
| 19230 ); | 19357 ); |
| 19231 return type.name.name + '.' + Strings.join((names && names.is$List$String()) , '.'); | 19358 return type.name.name + '.' + Strings.join((names && names.is$List$String()) , '.'); |
| 19232 } | 19359 } |
| 19233 else { | 19360 else { |
| 19234 return type.name.name; | 19361 return type.name.name; |
| 19235 } | 19362 } |
| 19236 } | 19363 } |
| 19237 DefinedType.prototype.resolveType = function(node, typeErrors) { | 19364 DefinedType.prototype.resolveType = function(node, typeErrors) { |
| 19238 var $0; | 19365 var $0; |
| 19239 if ($notnull_bool(node == null)) return world.varType; | 19366 if (node == null) return world.varType; |
| 19240 if ($notnull_bool(node.type != null)) return node.type; | 19367 if (node.type != null) return node.type; |
| 19241 if ($notnull_bool((node instanceof NameTypeReference))) { | 19368 if ((node instanceof NameTypeReference)) { |
| 19242 var typeRef = (node && node.is$NameTypeReference()); | 19369 var typeRef = (node && node.is$NameTypeReference()); |
| 19243 var name; | 19370 var name; |
| 19244 if ($notnull_bool(typeRef.names != null)) { | 19371 if (typeRef.names != null) { |
| 19245 name = $assert_String(typeRef.names.last().get$name()); | 19372 name = $assert_String(typeRef.names.last().get$name()); |
| 19246 } | 19373 } |
| 19247 else { | 19374 else { |
| 19248 name = typeRef.name.name; | 19375 name = typeRef.name.name; |
| 19249 } | 19376 } |
| 19250 if ($notnull_bool(this.typeParameters != null)) { | 19377 if (this.typeParameters != null) { |
| 19251 var $list = this.typeParameters; | 19378 var $list = this.typeParameters; |
| 19252 for (var $i = 0;$i < $list.length; $i++) { | 19379 for (var $i = 0;$i < $list.length; $i++) { |
| 19253 var tp = $list.$index($i); | 19380 var tp = $list.$index($i); |
| 19254 if ($notnull_bool($eq(tp.get$name(), name))) { | 19381 if ($notnull_bool($eq(tp.get$name(), name))) { |
| 19255 typeRef.type = (tp && tp.is$lang_Type()); | 19382 typeRef.type = (tp && tp.is$lang_Type()); |
| 19256 } | 19383 } |
| 19257 } | 19384 } |
| 19258 } | 19385 } |
| 19259 if ($notnull_bool(typeRef.type == null)) { | 19386 if (typeRef.type == null) { |
| 19260 typeRef.type = this.library.findType(typeRef); | 19387 typeRef.type = this.library.findType(typeRef); |
| 19261 } | 19388 } |
| 19262 if ($notnull_bool(typeRef.type == null)) { | 19389 if (typeRef.type == null) { |
| 19263 var message = ('can not find type ' + DefinedType._getDottedName(typeRef) + ''); | 19390 var message = ('can not find type ' + DefinedType._getDottedName(typeRef) + ''); |
| 19264 if ($notnull_bool(typeErrors)) { | 19391 if ($notnull_bool(typeErrors)) { |
| 19265 world.error($assert_String(message), typeRef.span); | 19392 world.error($assert_String(message), typeRef.span); |
| 19266 typeRef.type = world.objectType; | 19393 typeRef.type = world.objectType; |
| 19267 } | 19394 } |
| 19268 else { | 19395 else { |
| 19269 world.warning($assert_String(message), typeRef.span); | 19396 world.warning($assert_String(message), typeRef.span); |
| 19270 typeRef.type = world.varType; | 19397 typeRef.type = world.varType; |
| 19271 } | 19398 } |
| 19272 } | 19399 } |
| 19273 } | 19400 } |
| 19274 else if ($notnull_bool((node instanceof GenericTypeReference))) { | 19401 else if ((node instanceof GenericTypeReference)) { |
| 19275 var typeRef = (node && node.is$GenericTypeReference()); | 19402 var typeRef = (node && node.is$GenericTypeReference()); |
| 19276 var baseType = this.resolveType(typeRef.baseType, typeErrors); | 19403 var baseType = this.resolveType(typeRef.baseType, typeErrors); |
| 19277 if ($notnull_bool(!$notnull_bool(baseType.get$isGeneric()))) { | 19404 if (!$notnull_bool(baseType.get$isGeneric())) { |
| 19278 world.error(('' + baseType.get$name() + ' is not generic'), typeRef.span); | 19405 world.error(('' + baseType.get$name() + ' is not generic'), typeRef.span); |
| 19279 return null; | 19406 return null; |
| 19280 } | 19407 } |
| 19281 if ($notnull_bool(typeRef.typeArguments.length != baseType.get$typeParameter s().length)) { | 19408 if (typeRef.typeArguments.length != baseType.get$typeParameters().length) { |
| 19282 world.error('wrong number of type arguments', typeRef.span); | 19409 world.error('wrong number of type arguments', typeRef.span); |
| 19283 return null; | 19410 return null; |
| 19284 } | 19411 } |
| 19285 var typeArgs = []; | 19412 var typeArgs = []; |
| 19286 for (var i = 0; | 19413 for (var i = 0; |
| 19287 $notnull_bool(i < typeRef.typeArguments.length); i++) { | 19414 i < typeRef.typeArguments.length; i++) { |
| 19288 var extendsType = baseType.get$typeParameters().$index(i).extendsType; | 19415 var extendsType = baseType.get$typeParameters().$index(i).extendsType; |
| 19289 var typeArg = this.resolveType((($0 = typeRef.typeArguments.$index(i)) && $0.is$TypeReference()), typeErrors); | 19416 var typeArg = this.resolveType((($0 = typeRef.typeArguments.$index(i)) && $0.is$TypeReference()), typeErrors); |
| 19290 typeArgs.add(typeArg); | 19417 typeArgs.add(typeArg); |
| 19291 if ($notnull_bool($ne(extendsType, null) && !(typeArg instanceof Parameter Type))) { | 19418 if ($notnull_bool($ne(extendsType, null) && !(typeArg instanceof Parameter Type))) { |
| 19292 typeArg.ensureSubtypeOf((extendsType && extendsType.is$lang_Type()), typ eRef.typeArguments.$index(i).get$span(), typeErrors); | 19419 typeArg.ensureSubtypeOf((extendsType && extendsType.is$lang_Type()), typ eRef.typeArguments.$index(i).get$span(), typeErrors); |
| 19293 } | 19420 } |
| 19294 } | 19421 } |
| 19295 typeRef.type = baseType.getOrMakeConcreteType(typeArgs); | 19422 typeRef.type = baseType.getOrMakeConcreteType(typeArgs); |
| 19296 } | 19423 } |
| 19297 else if ($notnull_bool((node instanceof FunctionTypeReference))) { | 19424 else if ((node instanceof FunctionTypeReference)) { |
| 19298 var typeRef = (node && node.is$FunctionTypeReference()); | 19425 var typeRef = (node && node.is$FunctionTypeReference()); |
| 19299 var name = ''; | 19426 var name = ''; |
| 19300 if ($notnull_bool(typeRef.func.name != null)) name = typeRef.func.name.name; | 19427 if (typeRef.func.name != null) name = typeRef.func.name.name; |
| 19301 typeRef.type = this.library.getOrAddFunctionType($assert_String(name), typeR ef.func, this); | 19428 typeRef.type = this.library.getOrAddFunctionType($assert_String(name), typeR ef.func, this); |
| 19302 } | 19429 } |
| 19303 else { | 19430 else { |
| 19304 world.internalError('unknown type reference', node.span); | 19431 world.internalError('unknown type reference', node.span); |
| 19305 } | 19432 } |
| 19306 return node.type; | 19433 return node.type; |
| 19307 } | 19434 } |
| 19308 DefinedType.prototype.resolveTypeParams = function(inType) { | 19435 DefinedType.prototype.resolveTypeParams = function(inType) { |
| 19309 return this; | 19436 return this; |
| 19310 } | 19437 } |
| 19311 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { | 19438 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { |
| 19312 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1162, 12); | 19439 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1226, 12); |
| 19313 var names = [this.name]; | 19440 var names = [this.name]; |
| 19314 var typeMap = $map([]); | 19441 var typeMap = $map([]); |
| 19315 for (var i = 0; | 19442 for (var i = 0; |
| 19316 $notnull_bool(i < typeArgs.length); i++) { | 19443 i < typeArgs.length; i++) { |
| 19317 var paramName = this.typeParameters.$index(i).get$name(); | 19444 var paramName = this.typeParameters.$index(i).get$name(); |
| 19318 typeMap.$setindex(paramName, typeArgs.$index(i)); | 19445 typeMap.$setindex(paramName, typeArgs.$index(i)); |
| 19319 names.add(typeArgs.$index(i).get$name()); | 19446 names.add(typeArgs.$index(i).get$name()); |
| 19320 } | 19447 } |
| 19321 var concreteName = Strings.join((names && names.is$List$String()), '\$'); | 19448 var concreteName = Strings.join((names && names.is$List$String()), '\$'); |
| 19322 var ret = this._concreteTypes.$index(concreteName); | 19449 var ret = this._concreteTypes.$index(concreteName); |
| 19323 if ($notnull_bool(ret == null)) { | 19450 if ($notnull_bool(ret == null)) { |
| 19324 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs ); | 19451 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs ); |
| 19325 this._concreteTypes.$setindex(concreteName, ret); | 19452 this._concreteTypes.$setindex(concreteName, ret); |
| 19326 } | 19453 } |
| 19327 return (ret && ret.is$lang_Type()); | 19454 return (ret && ret.is$lang_Type()); |
| 19328 } | 19455 } |
| 19329 DefinedType.prototype.getCallStub = function(args) { | 19456 DefinedType.prototype.getCallStub = function(args) { |
| 19330 $assert(this.get$isFunction(), "isFunction", "type.dart", 1182, 12); | 19457 $assert(this.get$isFunction(), "isFunction", "type.dart", 1246, 12); |
| 19331 var name = _getCallStubName('call', args); | 19458 var name = _getCallStubName('call', args); |
| 19332 if ($notnull_bool(this.varStubs == null)) this.varStubs = $map([]); | 19459 if (this.varStubs == null) this.varStubs = $map([]); |
| 19333 var stub = this.varStubs.$index(name); | 19460 var stub = this.varStubs.$index(name); |
| 19334 if ($notnull_bool(stub == null)) { | 19461 if ($notnull_bool(stub == null)) { |
| 19335 stub = new VarFunctionStub($assert_String(name), args); | 19462 stub = new VarFunctionStub($assert_String(name), args); |
| 19336 this.varStubs.$setindex(name, stub); | 19463 this.varStubs.$setindex(name, stub); |
| 19337 } | 19464 } |
| 19338 return (stub && stub.is$VarFunctionStub()); | 19465 return (stub && stub.is$VarFunctionStub()); |
| 19339 } | 19466 } |
| 19340 // ********** Code for FixedCollection ************** | 19467 // ********** Code for FixedCollection ************** |
| 19341 function FixedCollection(value, length) { | 19468 function FixedCollection(value, length) { |
| 19342 this.value = value; | 19469 this.value = value; |
| 19343 this.length = length; | 19470 this.length = length; |
| 19344 // Initializers done | 19471 // Initializers done |
| 19345 } | 19472 } |
| 19473 FixedCollection.prototype.is$Collection$Type = function(){return this;}; | |
| 19346 FixedCollection.prototype.is$Iterable = function(){return this;}; | 19474 FixedCollection.prototype.is$Iterable = function(){return this;}; |
| 19347 FixedCollection.prototype.get$value = function() { return this.value; }; | 19475 FixedCollection.prototype.get$value = function() { return this.value; }; |
| 19348 FixedCollection.prototype.iterator = function() { | 19476 FixedCollection.prototype.iterator = function() { |
| 19349 return new FixedIterator$E(this.value, this.length); | 19477 return new FixedIterator$E(this.value, this.length); |
| 19350 } | 19478 } |
| 19351 FixedCollection.prototype.forEach = function(f) { | 19479 FixedCollection.prototype.forEach = function(f) { |
| 19352 Collections.forEach(this, f); | 19480 Collections.forEach(this, f); |
| 19353 } | 19481 } |
| 19354 FixedCollection.prototype.filter = function(f) { | 19482 FixedCollection.prototype.filter = function(f) { |
| 19355 return Collections.filter(this, new ListFactory$E(), f); | 19483 return Collections.filter(this, new ListFactory$E(), f); |
| 19356 } | 19484 } |
| 19357 FixedCollection.prototype.some = function(f) { | 19485 FixedCollection.prototype.some = function(f) { |
| 19358 return Collections.some(this, f); | 19486 return Collections.some(this, f); |
| 19359 } | 19487 } |
| 19360 FixedCollection.prototype.isEmpty = function() { | 19488 FixedCollection.prototype.isEmpty = function() { |
| 19361 return this.length == 0; | 19489 return this.length == 0; |
| 19362 } | 19490 } |
| 19363 // ********** Code for FixedCollection$Type ************** | 19491 // ********** Code for FixedCollection$Type ************** |
| 19364 function FixedCollection$Type(value, length) { | 19492 function FixedCollection$Type(value, length) { |
| 19365 this.value = value; | 19493 this.value = value; |
| 19366 this.length = length; | 19494 this.length = length; |
| 19367 // Initializers done | 19495 // Initializers done |
| 19368 } | 19496 } |
| 19369 $inherits(FixedCollection$Type, FixedCollection); | 19497 $inherits(FixedCollection$Type, FixedCollection); |
| 19498 FixedCollection$Type.prototype.is$Collection$Type = function(){return this;}; | |
| 19370 FixedCollection$Type.prototype.is$Iterable = function(){return this;}; | 19499 FixedCollection$Type.prototype.is$Iterable = function(){return this;}; |
| 19371 // ********** Code for FixedIterator ************** | 19500 // ********** Code for FixedIterator ************** |
| 19372 function FixedIterator(value, length) { | 19501 function FixedIterator(value, length) { |
| 19373 this._index = 0 | 19502 this._index = 0 |
| 19374 this.value = value; | 19503 this.value = value; |
| 19375 this.length = length; | 19504 this.length = length; |
| 19376 // Initializers done | 19505 // Initializers done |
| 19377 } | 19506 } |
| 19378 FixedIterator.prototype.is$Iterator$T = function(){return this;}; | 19507 FixedIterator.prototype.is$Iterator$T = function(){return this;}; |
| 19379 FixedIterator.prototype.get$value = function() { return this.value; }; | 19508 FixedIterator.prototype.get$value = function() { return this.value; }; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 19395 FixedIterator$E.prototype.is$Iterator$T = function(){return this;}; | 19524 FixedIterator$E.prototype.is$Iterator$T = function(){return this;}; |
| 19396 // ********** Code for Value ************** | 19525 // ********** Code for Value ************** |
| 19397 function Value(type, code, span, needsTemp) { | 19526 function Value(type, code, span, needsTemp) { |
| 19398 this.isSuper = false | 19527 this.isSuper = false |
| 19399 this.isType = false | 19528 this.isType = false |
| 19400 this.type = type; | 19529 this.type = type; |
| 19401 this.code = code; | 19530 this.code = code; |
| 19402 this.span = span; | 19531 this.span = span; |
| 19403 this.needsTemp = needsTemp; | 19532 this.needsTemp = needsTemp; |
| 19404 // Initializers done | 19533 // Initializers done |
| 19405 if ($notnull_bool(this.type == null)) world.internalError('type passed as null ', this.span); | 19534 if (this.type == null) world.internalError('type passed as null', this.span); |
| 19406 } | 19535 } |
| 19407 Value.prototype.is$Value = function(){return this;}; | 19536 Value.prototype.is$Value = function(){return this;}; |
| 19408 Value.prototype.get$span = function() { return this.span; }; | 19537 Value.prototype.get$span = function() { return this.span; }; |
| 19409 Value.prototype.set$span = function(value) { return this.span = value; }; | 19538 Value.prototype.set$span = function(value) { return this.span = value; }; |
| 19410 Value.prototype.get$_typeIsVarOrParameterType = function() { | 19539 Value.prototype.get$_typeIsVarOrParameterType = function() { |
| 19411 return $notnull_bool(this.type.get$isVar() || (this.type instanceof ParameterT ype)); | 19540 return $notnull_bool(this.type.get$isVar() || (this.type instanceof ParameterT ype)); |
| 19412 } | 19541 } |
| 19413 Value.prototype.get$isConst = function() { | 19542 Value.prototype.get$isConst = function() { |
| 19414 return false; | 19543 return false; |
| 19415 } | 19544 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 19429 var member = this._resolveMember(context, name, node, isDynamic); | 19558 var member = this._resolveMember(context, name, node, isDynamic); |
| 19430 if ($notnull_bool($ne(member, null))) { | 19559 if ($notnull_bool($ne(member, null))) { |
| 19431 return member._set(context, node, this, value, isDynamic); | 19560 return member._set(context, node, this, value, isDynamic); |
| 19432 } | 19561 } |
| 19433 else { | 19562 else { |
| 19434 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value])); | 19563 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value])); |
| 19435 } | 19564 } |
| 19436 } | 19565 } |
| 19437 Value.prototype.invoke = function(context, name, node, args, isDynamic) { | 19566 Value.prototype.invoke = function(context, name, node, args, isDynamic) { |
| 19438 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) { | 19567 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) { |
| 19439 if ($notnull_bool(args.values.length != 1)) { | 19568 if (args.values.length != 1) { |
| 19440 world.warning('wrong number of arguments for !=', node.span); | 19569 world.warning('wrong number of arguments for !=', node.span); |
| 19441 } | 19570 } |
| 19571 var eq = this.invoke(context, '\$eq', node, args, isDynamic); | |
| 19442 world.gen.corejs.useOperator('\$ne'); | 19572 world.gen.corejs.useOperator('\$ne'); |
| 19443 return new Value(world.varType, ('\$ne(' + this.code + ', ' + args.values.$i ndex(0).code + ')'), node.span, true); | 19573 return new Value(eq.type, ('\$ne(' + this.code + ', ' + args.values.$index(0 ).code + ')'), node.span, true); |
| 19444 } | 19574 } |
| 19445 if ($notnull_bool(name == '\$call')) { | 19575 if (name == '\$call') { |
| 19446 if ($notnull_bool(this.isType)) { | 19576 if ($notnull_bool(this.isType)) { |
| 19447 world.error('must use "new" or "const" to construct a new instance', node. span); | 19577 world.error('must use "new" or "const" to construct a new instance', node. span); |
| 19448 } | 19578 } |
| 19449 if ($notnull_bool(this.type.needsVarCall(args))) { | 19579 if ($notnull_bool(this.type.needsVarCall(args))) { |
| 19450 return this._varCall(context, args); | 19580 return this._varCall(context, args); |
| 19451 } | 19581 } |
| 19452 } | 19582 } |
| 19453 var member = this._resolveMember(context, name, node, isDynamic); | 19583 var member = this._resolveMember(context, name, node, isDynamic); |
| 19454 if ($notnull_bool(member == null)) { | 19584 if ($notnull_bool(member == null)) { |
| 19455 return this.invokeNoSuchMethod(context, name, node, args); | 19585 return this.invokeNoSuchMethod(context, name, node, args); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 19480 Value.prototype._tryResolveMember = function(context, name) { | 19610 Value.prototype._tryResolveMember = function(context, name) { |
| 19481 if ($notnull_bool(this.isSuper)) { | 19611 if ($notnull_bool(this.isSuper)) { |
| 19482 return this.type.getMember(name); | 19612 return this.type.getMember(name); |
| 19483 } | 19613 } |
| 19484 else { | 19614 else { |
| 19485 return this.type.resolveMember(name); | 19615 return this.type.resolveMember(name); |
| 19486 } | 19616 } |
| 19487 } | 19617 } |
| 19488 Value.prototype._resolveMember = function(context, name, node, isDynamic) { | 19618 Value.prototype._resolveMember = function(context, name, node, isDynamic) { |
| 19489 var member; | 19619 var member; |
| 19490 if ($notnull_bool(!$notnull_bool(this.get$_typeIsVarOrParameterType()))) { | 19620 if (!$notnull_bool(this.get$_typeIsVarOrParameterType())) { |
| 19491 member = this._tryResolveMember(context, name); | 19621 member = this._tryResolveMember(context, name); |
| 19492 if ($notnull_bool($ne(member, null) && this.isType) && !$notnull_bool(member .get$isStatic())) { | 19622 if ($notnull_bool($ne(member, null) && this.isType) && !$notnull_bool(member .get$isStatic())) { |
| 19493 if ($notnull_bool(!$notnull_bool(isDynamic))) { | 19623 if (!$notnull_bool(isDynamic)) { |
| 19494 world.error('can not refer to instance member as static', node.span); | 19624 world.error('can not refer to instance member as static', node.span); |
| 19495 } | 19625 } |
| 19496 return null; | 19626 return null; |
| 19497 } | 19627 } |
| 19498 if ($notnull_bool(member == null && !$notnull_bool(isDynamic)) && !$notnull_ bool(this._hasOverriddenNoSuchMethod())) { | 19628 if ($notnull_bool(member == null && !$notnull_bool(isDynamic)) && !$notnull_ bool(this._hasOverriddenNoSuchMethod())) { |
| 19499 var typeName = $notnull_bool(this.type.name == null) ? this.type.get$libra ry().name : this.type.name; | 19629 var typeName = this.type.name == null ? this.type.get$library().name : thi s.type.name; |
| 19500 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); | 19630 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); |
| 19501 if ($notnull_bool(this.isType)) { | 19631 if ($notnull_bool(this.isType)) { |
| 19502 world.error($assert_String(message), node.span); | 19632 world.error($assert_String(message), node.span); |
| 19503 } | 19633 } |
| 19504 else { | 19634 else { |
| 19505 world.warning($assert_String(message), node.span); | 19635 world.warning($assert_String(message), node.span); |
| 19506 } | 19636 } |
| 19507 } | 19637 } |
| 19508 } | 19638 } |
| 19509 if ($notnull_bool(member == null && !$notnull_bool(this.isSuper)) && !$notnull _bool(this.isType)) { | 19639 if ($notnull_bool(member == null && !$notnull_bool(this.isSuper)) && !$notnull _bool(this.isType)) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 19559 } | 19689 } |
| 19560 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i sDomCallback(this.type)))) { | 19690 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i sDomCallback(this.type)))) { |
| 19561 return this._wrapDomCallback(toType, arity); | 19691 return this._wrapDomCallback(toType, arity); |
| 19562 } | 19692 } |
| 19563 } | 19693 } |
| 19564 var fromType = this.type; | 19694 var fromType = this.type; |
| 19565 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { | 19695 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { |
| 19566 fromType = world.objectType; | 19696 fromType = world.objectType; |
| 19567 } | 19697 } |
| 19568 var bothNum = $notnull_bool(this.type.get$isNum() && toType.get$isNum()); | 19698 var bothNum = $notnull_bool(this.type.get$isNum() && toType.get$isNum()); |
| 19569 if ($notnull_bool(!$notnull_bool(checked) || fromType.isSubtypeOf(toType)) || bothNum) { | 19699 if ($notnull_bool($notnull_bool(!$notnull_bool(checked) || fromType.isSubtypeO f(toType)) || bothNum)) { |
| 19570 return this; | 19700 return this; |
| 19571 } | 19701 } |
| 19572 if ($notnull_bool(!$notnull_bool(toType.isSubtypeOf(this.type)))) { | 19702 if ($notnull_bool(checked && !$notnull_bool(toType.isSubtypeOf(this.type)))) { |
| 19573 this.convertWarning(toType, node); | 19703 this.convertWarning(toType, node); |
| 19574 } | 19704 } |
| 19575 if ($notnull_bool(options.enableTypeChecks)) { | 19705 if ($notnull_bool(options.enableTypeChecks)) { |
| 19576 return this._typeAssert(context, toType, node); | 19706 return this._typeAssert(context, toType, node); |
| 19577 } | 19707 } |
| 19578 else { | 19708 else { |
| 19579 return this; | 19709 return this; |
| 19580 } | 19710 } |
| 19581 } | 19711 } |
| 19582 Value.prototype.convertToNonNullBool = function(context, node) { | |
| 19583 if ($notnull_bool(!$notnull_bool(this.type.isAssignable(world.boolType)))) { | |
| 19584 this.convertWarning(world.boolType, node); | |
| 19585 } | |
| 19586 if ($notnull_bool(!$notnull_bool(options.enableTypeChecks))) { | |
| 19587 return this; | |
| 19588 } | |
| 19589 else { | |
| 19590 if ($notnull_bool(this.code.startsWith('\$notnull_bool'))) { | |
| 19591 return this; | |
| 19592 } | |
| 19593 else { | |
| 19594 world.gen.corejs.useNotNullBool = true; | |
| 19595 return new Value(world.boolType, ('\$notnull_bool(' + this.code + ')'), th is.span, true); | |
| 19596 } | |
| 19597 } | |
| 19598 } | |
| 19599 Value.prototype._isDomCallback = function(toType) { | 19712 Value.prototype._isDomCallback = function(toType) { |
| 19600 return ($notnull_bool((toType.get$definition() instanceof FunctionTypeDefiniti on) && $eq(toType.get$library(), world.get$dom()))); | 19713 return ((toType.get$definition() instanceof FunctionTypeDefinition) && $eq(toT ype.get$library(), world.get$dom())); |
| 19601 } | 19714 } |
| 19602 Value.prototype._wrapDomCallback = function(toType, arity) { | 19715 Value.prototype._wrapDomCallback = function(toType, arity) { |
| 19603 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, true); | 19716 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, true); |
| 19604 } | 19717 } |
| 19605 Value.prototype._typeAssert = function(context, toType, node) { | 19718 Value.prototype._typeAssert = function(context, toType, node) { |
| 19606 if ($notnull_bool((toType instanceof ParameterType))) { | 19719 if ((toType instanceof ParameterType)) { |
| 19607 var p = (toType && toType.is$ParameterType()); | 19720 var p = (toType && toType.is$ParameterType()); |
| 19608 toType = p.extendsType; | 19721 toType = p.extendsType; |
| 19609 } | 19722 } |
| 19610 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) { | 19723 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) { |
| 19611 world.internalError(('We thought ' + this.type.name + ' is not a subtype of ' + toType.name + '?')); | 19724 world.internalError(('We thought ' + this.type.name + ' is not a subtype of ' + toType.name + '?')); |
| 19612 } | 19725 } |
| 19613 if ($notnull_bool(toType.get$isNum())) toType = world.numType; | 19726 if ($notnull_bool(toType.get$isNum())) toType = world.numType; |
| 19614 var check; | 19727 var check; |
| 19615 if ($notnull_bool(toType.get$isVoid())) { | 19728 if ($notnull_bool(toType.get$isVoid())) { |
| 19616 check = ('\$assert_void(' + this.code + ')'); | 19729 check = ('\$assert_void(' + this.code + ')'); |
| 19617 if ($notnull_bool(toType.typeCheckCode == null)) { | 19730 if (toType.typeCheckCode == null) { |
| 19618 toType.typeCheckCode = "function $assert_void(x) {\n return x == null ? x : x.is$void(); // throws TypeError\n}"; | 19731 toType.typeCheckCode = "function $assert_void(x) {\n return x == null ? x : x.is$void(); // throws TypeError\n}"; |
| 19619 } | 19732 } |
| 19620 } | 19733 } |
| 19734 else if ($eq(toType, world.nonNullBool)) { | |
| 19735 world.gen.corejs.useNotNullBool = true; | |
| 19736 check = ('\$notnull_bool(' + this.code + ')'); | |
| 19737 } | |
| 19621 else if ($notnull_bool(toType.get$library().get$isCore() && toType.get$typeofN ame() != null)) { | 19738 else if ($notnull_bool(toType.get$library().get$isCore() && toType.get$typeofN ame() != null)) { |
| 19622 check = ('\$assert_' + toType.name + '(' + this.code + ')'); | 19739 check = ('\$assert_' + toType.name + '(' + this.code + ')'); |
| 19623 if ($notnull_bool(toType.typeCheckCode == null)) { | 19740 if (toType.typeCheckCode == null) { |
| 19624 toType.typeCheckCode = ("function $assert_" + toType.name + "(x) {\n if ( x == null || typeof(x) == \"" + toType.get$typeofName() + "\") return x;\n thro w new TypeError(\"'\" + x + \"' is not a " + toType.name + ".\");\n}"); | 19741 toType.typeCheckCode = ("function $assert_" + toType.name + "(x) {\n if ( x == null || typeof(x) == \"" + toType.get$typeofName() + "\") return x;\n thro w new TypeError(\"'\" + x + \"' is not a " + toType.name + ".\");\n}"); |
| 19625 } | 19742 } |
| 19626 } | 19743 } |
| 19627 else { | 19744 else { |
| 19628 toType.isTested = true; | 19745 toType.isTested = true; |
| 19629 var temp = context.getTemp(this); | 19746 var temp = context.getTemp(this); |
| 19630 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); | 19747 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); |
| 19631 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); | 19748 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); |
| 19632 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value( ))); | 19749 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value())); |
| 19633 } | 19750 } |
| 19634 return new Value(toType, check, this.span, true); | 19751 return new Value(toType, check, this.span, true); |
| 19635 } | 19752 } |
| 19636 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) { | 19753 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) { |
| 19637 if ($notnull_bool(toType.get$isVar())) { | 19754 if ($notnull_bool(toType.get$isVar())) { |
| 19638 world.error('can not resolve type', span); | 19755 world.error('can not resolve type', span); |
| 19639 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n ull); | 19756 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true' , null); |
| 19640 } | 19757 } |
| 19641 if ($notnull_bool((toType instanceof ParameterType))) { | 19758 if ((toType instanceof ParameterType)) { |
| 19642 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n ull); | 19759 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true' , null); |
| 19643 } | 19760 } |
| 19644 var testCode = null; | 19761 var testCode = null; |
| 19645 if ($notnull_bool(toType.get$library().get$isCore())) { | 19762 if ($notnull_bool(toType.get$library().get$isCore())) { |
| 19646 var typeofName = toType.get$typeofName(); | 19763 var typeofName = toType.get$typeofName(); |
| 19647 if ($notnull_bool($ne(typeofName, null))) { | 19764 if ($notnull_bool($ne(typeofName, null))) { |
| 19648 testCode = ("(typeof(" + this.code + ") " + ($notnull_bool(isTrue) ? '==' : '!=') + " '" + typeofName + "')"); | 19765 testCode = ("(typeof(" + this.code + ") " + ($notnull_bool(isTrue) ? '==' : '!=') + " '" + typeofName + "')"); |
| 19649 } | 19766 } |
| 19650 } | 19767 } |
| 19651 if ($notnull_bool(toType.get$isClass() && !(toType instanceof ConcreteType))) { | 19768 if ($notnull_bool(toType.get$isClass() && !(toType instanceof ConcreteType))) { |
| 19652 toType.markUsed(); | 19769 toType.markUsed(); |
| 19653 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); | 19770 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); |
| 19654 if ($notnull_bool(!$notnull_bool(isTrue))) { | 19771 if (!$notnull_bool(isTrue)) { |
| 19655 testCode = '!' + testCode; | 19772 testCode = '!' + testCode; |
| 19656 } | 19773 } |
| 19657 } | 19774 } |
| 19658 if ($notnull_bool(testCode == null)) { | 19775 if (testCode == null) { |
| 19659 toType.isTested = true; | 19776 toType.isTested = true; |
| 19660 var temp = context.getTemp(this); | 19777 var temp = context.getTemp(this); |
| 19661 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); | 19778 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); |
| 19662 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')' ); | 19779 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')' ); |
| 19663 if ($notnull_bool(isTrue)) { | 19780 if ($notnull_bool(isTrue)) { |
| 19664 testCode = '!!' + testCode; | 19781 testCode = '!!' + testCode; |
| 19665 } | 19782 } |
| 19666 else { | 19783 else { |
| 19667 testCode = '!' + testCode; | 19784 testCode = '!' + testCode; |
| 19668 } | 19785 } |
| 19669 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value( ))); | 19786 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value())); |
| 19670 } | 19787 } |
| 19671 return new Value(world.boolType, testCode, span, true); | 19788 return new Value(world.nonNullBool, testCode, span, true); |
| 19672 } | 19789 } |
| 19673 Value.prototype.convertWarning = function(toType, node) { | 19790 Value.prototype.convertWarning = function(toType, node) { |
| 19674 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType .name + '"'), node.span); | 19791 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType .name + '"'), node.span); |
| 19675 } | 19792 } |
| 19676 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { | 19793 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { |
| 19677 var $0; | 19794 var $0; |
| 19678 var pos = ''; | 19795 var pos = ''; |
| 19679 if ($notnull_bool(args != null)) { | 19796 if (args != null) { |
| 19680 var argsCode = []; | 19797 var argsCode = []; |
| 19681 for (var i = 0; | 19798 for (var i = 0; |
| 19682 $notnull_bool(i < args.get$length()); i++) { | 19799 i < args.get$length(); i++) { |
| 19683 argsCode.add(args.values.$index(i).code); | 19800 argsCode.add(args.values.$index(i).code); |
| 19684 } | 19801 } |
| 19685 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); | 19802 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); |
| 19686 } | 19803 } |
| 19687 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, t rue), new Value(world.listType, ('[' + pos + ']'), node.span, true)]; | 19804 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, t rue), new Value(world.listType, ('[' + pos + ']'), node.span, true)]; |
| 19688 return (($0 = this._resolveMember(context, 'noSuchMethod', node, false).invoke $4(context, node, this, new Arguments(null, noSuchArgs))) && $0.is$Value()); | 19805 return (($0 = this._resolveMember(context, 'noSuchMethod', node, false).invoke $4(context, node, this, new Arguments(null, noSuchArgs))) && $0.is$Value()); |
| 19689 } | 19806 } |
| 19690 Value.prototype.invokeSpecial = function(name, args, returnType) { | 19807 Value.prototype.invokeSpecial = function(name, args, returnType) { |
| 19691 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 464, 12 ); | 19808 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 449, 12 ); |
| 19692 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 65, 12); | 19809 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 50, 12); |
| 19693 var argsString = args.getCode(); | 19810 var argsString = args.getCode(); |
| 19694 if ($notnull_bool(name == '\$index' || name == '\$setindex')) { | 19811 if (name == '\$index' || name == '\$setindex') { |
| 19695 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, true); | 19812 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, true); |
| 19696 } | 19813 } |
| 19697 else { | 19814 else { |
| 19698 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString + ''); | 19815 if (argsString.length > 0) argsString = (', ' + argsString + ''); |
| 19699 world.gen.corejs.useOperator(name); | 19816 world.gen.corejs.useOperator(name); |
| 19700 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), this.span, true); | 19817 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), this.span, true); |
| 19701 } | 19818 } |
| 19702 } | 19819 } |
| 19703 Value.prototype.invoke$4 = function($0, $1, $2, $3) { | 19820 Value.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 19704 return this.invoke(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 && $2.is$lang_Node()), ($3 && $3.is$Arguments()), false); | 19821 return this.invoke(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 && $2.is$lang_Node()), ($3 && $3.is$Arguments()), false); |
| 19705 } | 19822 } |
| 19706 ; | 19823 ; |
| 19707 // ********** Code for EvaluatedValue ************** | 19824 // ********** Code for EvaluatedValue ************** |
| 19708 function EvaluatedValue() {} | 19825 function EvaluatedValue() {} |
| 19709 EvaluatedValue._internal$ctor = function(type, actualValue, canonicalCode, span, code) { | 19826 EvaluatedValue._internal$ctor = function(type, actualValue, canonicalCode, span, code) { |
| 19710 this.actualValue = actualValue; | 19827 this.actualValue = actualValue; |
| 19711 this.canonicalCode = canonicalCode; | 19828 this.canonicalCode = canonicalCode; |
| 19712 Value.call(this, type, code, span, false); | 19829 Value.call(this, type, code, span, false); |
| 19713 // Initializers done | 19830 // Initializers done |
| 19714 } | 19831 } |
| 19715 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype; | 19832 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype; |
| 19716 $inherits(EvaluatedValue, Value); | 19833 $inherits(EvaluatedValue, Value); |
| 19717 EvaluatedValue.EvaluatedValue$factory = function(type, actualValue, canonicalCod e, span) { | 19834 EvaluatedValue.EvaluatedValue$factory = function(type, actualValue, canonicalCod e, span) { |
| 19718 return new EvaluatedValue._internal$ctor(type, actualValue, canonicalCode, spa n, EvaluatedValue.codeWithComments(canonicalCode, span)); | 19835 return new EvaluatedValue._internal$ctor(type, actualValue, canonicalCode, spa n, EvaluatedValue.codeWithComments(canonicalCode, span)); |
| 19719 } | 19836 } |
| 19720 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue; }; | 19837 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue; }; |
| 19721 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV alue = value; }; | 19838 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV alue = value; }; |
| 19722 EvaluatedValue.prototype.get$isConst = function() { | 19839 EvaluatedValue.prototype.get$isConst = function() { |
| 19723 return true; | 19840 return true; |
| 19724 } | 19841 } |
| 19725 EvaluatedValue.prototype.get$canonicalCode = function() { return this.canonicalC ode; }; | 19842 EvaluatedValue.prototype.get$canonicalCode = function() { return this.canonicalC ode; }; |
| 19726 EvaluatedValue.prototype.set$canonicalCode = function(value) { return this.canon icalCode = value; }; | 19843 EvaluatedValue.prototype.set$canonicalCode = function(value) { return this.canon icalCode = value; }; |
| 19727 EvaluatedValue.codeWithComments = function(canonicalCode, span) { | 19844 EvaluatedValue.codeWithComments = function(canonicalCode, span) { |
| 19728 return $notnull_bool(($notnull_bool(span != null && span.get$text() != canonic alCode))) ? ('' + canonicalCode + '/*' + span.get$text() + '*/') : canonicalCode ; | 19845 return (span != null && span.get$text() != canonicalCode) ? ('' + canonicalCod e + '/*' + span.get$text() + '*/') : canonicalCode; |
| 19729 } | 19846 } |
| 19730 // ********** Code for ConstListValue ************** | 19847 // ********** Code for ConstListValue ************** |
| 19731 function ConstListValue() {} | 19848 function ConstListValue() {} |
| 19732 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod e, span, code) { | 19849 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod e, span, code) { |
| 19733 this.values = values; | 19850 this.values = values; |
| 19734 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); | 19851 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); |
| 19735 // Initializers done | 19852 // Initializers done |
| 19736 } | 19853 } |
| 19737 ConstListValue._internal$ctor.prototype = ConstListValue.prototype; | 19854 ConstListValue._internal$ctor.prototype = ConstListValue.prototype; |
| 19738 $inherits(ConstListValue, EvaluatedValue); | 19855 $inherits(ConstListValue, EvaluatedValue); |
| 19739 ConstListValue.ConstListValue$factory = function(type, values, actualValue, cano nicalCode, span) { | 19856 ConstListValue.ConstListValue$factory = function(type, values, actualValue, cano nicalCode, span) { |
| 19740 return new ConstListValue._internal$ctor(type, values, actualValue, canonicalC ode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); | 19857 return new ConstListValue._internal$ctor(type, values, actualValue, canonicalC ode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); |
| 19741 } | 19858 } |
| 19742 // ********** Code for ConstMapValue ************** | 19859 // ********** Code for ConstMapValue ************** |
| 19743 function ConstMapValue() {} | 19860 function ConstMapValue() {} |
| 19744 ConstMapValue._internal$ctor = function(type, values, actualValue, canonicalCode , span, code) { | 19861 ConstMapValue._internal$ctor = function(type, values, actualValue, canonicalCode , span, code) { |
| 19745 this.values = values; | 19862 this.values = values; |
| 19746 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); | 19863 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); |
| 19747 // Initializers done | 19864 // Initializers done |
| 19748 } | 19865 } |
| 19749 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype; | 19866 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype; |
| 19750 $inherits(ConstMapValue, EvaluatedValue); | 19867 $inherits(ConstMapValue, EvaluatedValue); |
| 19751 ConstMapValue.ConstMapValue$factory = function(type, keyValuePairs, actualValue, canonicalCode, span) { | 19868 ConstMapValue.ConstMapValue$factory = function(type, keyValuePairs, actualValue, canonicalCode, span) { |
| 19752 var values = new HashMapImplementation$String$EvaluatedValue(); | 19869 var values = new HashMapImplementation$String$EvaluatedValue(); |
| 19753 for (var i = 0; | 19870 for (var i = 0; |
| 19754 $notnull_bool(i < keyValuePairs.length); i += 2) { | 19871 i < keyValuePairs.length; i += 2) { |
| 19755 values.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$i ndex(i + 1)); | 19872 values.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$i ndex(i + 1)); |
| 19756 } | 19873 } |
| 19757 return new ConstMapValue._internal$ctor(type, values, actualValue, canonicalCo de, span, EvaluatedValue.codeWithComments(canonicalCode, span)); | 19874 return new ConstMapValue._internal$ctor(type, values, actualValue, canonicalCo de, span, EvaluatedValue.codeWithComments(canonicalCode, span)); |
| 19758 } | 19875 } |
| 19759 // ********** Code for ConstObjectValue ************** | 19876 // ********** Code for ConstObjectValue ************** |
| 19760 function ConstObjectValue() {} | 19877 function ConstObjectValue() {} |
| 19761 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC ode, span, code) { | 19878 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC ode, span, code) { |
| 19762 this.fields = fields; | 19879 this.fields = fields; |
| 19763 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); | 19880 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); |
| 19764 // Initializers done | 19881 // Initializers done |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 19811 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; | 19928 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; |
| 19812 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode ; }; | 19929 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode ; }; |
| 19813 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica lCode = value; }; | 19930 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica lCode = value; }; |
| 19814 GlobalValue.prototype.get$isConst = function() { | 19931 GlobalValue.prototype.get$isConst = function() { |
| 19815 return $notnull_bool(this.exp.get$isConst() && ($notnull_bool(this.field == nu ll || this.field.isFinal))); | 19932 return $notnull_bool(this.exp.get$isConst() && ($notnull_bool(this.field == nu ll || this.field.isFinal))); |
| 19816 } | 19933 } |
| 19817 GlobalValue.prototype.get$actualValue = function() { | 19934 GlobalValue.prototype.get$actualValue = function() { |
| 19818 return this.exp.get$dynamic().get$actualValue(); | 19935 return this.exp.get$dynamic().get$actualValue(); |
| 19819 } | 19936 } |
| 19820 GlobalValue.prototype.compareTo = function(other) { | 19937 GlobalValue.prototype.compareTo = function(other) { |
| 19821 if ($notnull_bool($eq(other, this))) { | 19938 if ($eq(other, this)) { |
| 19822 return 0; | 19939 return 0; |
| 19823 } | 19940 } |
| 19824 else if ($notnull_bool(this.dependencies.indexOf(other, 0) >= 0)) { | 19941 else if (this.dependencies.indexOf(other, 0) >= 0) { |
| 19825 return 1; | 19942 return 1; |
| 19826 } | 19943 } |
| 19827 else if ($notnull_bool(other.dependencies.indexOf(this, 0) >= 0)) { | 19944 else if (other.dependencies.indexOf(this, 0) >= 0) { |
| 19828 return -1; | 19945 return -1; |
| 19829 } | 19946 } |
| 19830 else if ($notnull_bool(this.dependencies.length > other.dependencies.length)) { | 19947 else if (this.dependencies.length > other.dependencies.length) { |
| 19831 return 1; | 19948 return 1; |
| 19832 } | 19949 } |
| 19833 else if ($notnull_bool(this.dependencies.length < other.dependencies.length)) { | 19950 else if (this.dependencies.length < other.dependencies.length) { |
| 19834 return -1; | 19951 return -1; |
| 19835 } | 19952 } |
| 19836 else if ($notnull_bool(this.name == null && other.name != null)) { | 19953 else if (this.name == null && other.name != null) { |
| 19837 return 1; | 19954 return 1; |
| 19838 } | 19955 } |
| 19839 else if ($notnull_bool(this.name != null && other.name == null)) { | 19956 else if (this.name != null && other.name == null) { |
| 19840 return -1; | 19957 return -1; |
| 19841 } | 19958 } |
| 19842 else if ($notnull_bool(this.name != null)) { | 19959 else if (this.name != null) { |
| 19843 return this.name.compareTo(other.name); | 19960 return this.name.compareTo(other.name); |
| 19844 } | 19961 } |
| 19845 else { | 19962 else { |
| 19846 return this.field.name.compareTo(other.field.name); | 19963 return this.field.name.compareTo(other.field.name); |
| 19847 } | 19964 } |
| 19848 } | 19965 } |
| 19849 // ********** Code for BareValue ************** | 19966 // ********** Code for BareValue ************** |
| 19850 function BareValue(home, outermost, span) { | 19967 function BareValue(home, outermost, span) { |
| 19851 this.home = home; | 19968 this.home = home; |
| 19852 Value.call(this, outermost.method.declaringType, null, span, false); | 19969 Value.call(this, outermost.method.declaringType, null, span, false); |
| 19853 // Initializers done | 19970 // Initializers done |
| 19854 this.isType = outermost.get$isStatic(); | 19971 this.isType = outermost.get$isStatic(); |
| 19855 } | 19972 } |
| 19856 $inherits(BareValue, Value); | 19973 $inherits(BareValue, Value); |
| 19857 BareValue.prototype._tryResolveMember = function(context, name) { | 19974 BareValue.prototype._tryResolveMember = function(context, name) { |
| 19858 $assert($eq(context, this.home), "context == home", "value.dart", 669, 12); | 19975 $assert($eq(context, this.home), "context == home", "value.dart", 654, 12); |
| 19859 var member = this.type.resolveMember(name); | 19976 var member = this.type.resolveMember(name); |
| 19860 if ($notnull_bool($ne(member, null))) { | 19977 if ($notnull_bool($ne(member, null))) { |
| 19861 $assert(this.code == null, "code == null", "value.dart", 674, 14); | 19978 $assert(this.code == null, "code == null", "value.dart", 659, 14); |
| 19862 if ($notnull_bool(this.isType)) { | 19979 if ($notnull_bool(this.isType)) { |
| 19863 this.code = this.type.get$jsname(); | 19980 this.code = this.type.get$jsname(); |
| 19864 } | 19981 } |
| 19865 else { | 19982 else { |
| 19866 this.code = this.home._makeThisCode(); | 19983 this.code = this.home._makeThisCode(); |
| 19867 } | 19984 } |
| 19868 return member; | 19985 return member; |
| 19869 } | 19986 } |
| 19870 member = this.home.get$library().lookup(name, this.span); | 19987 member = this.home.get$library().lookup(name, this.span); |
| 19871 if ($notnull_bool($ne(member, null))) { | 19988 if ($notnull_bool($ne(member, null))) { |
| 19872 return member; | 19989 return member; |
| 19873 } | 19990 } |
| 19874 return null; | 19991 return null; |
| 19875 } | 19992 } |
| 19876 // ********** Code for CompilerException ************** | 19993 // ********** Code for CompilerException ************** |
| 19877 function CompilerException(_message, _location) { | 19994 function CompilerException(_message, _location) { |
| 19878 this._lang_message = _message; | 19995 this._lang_message = _message; |
| 19879 this._location = _location; | 19996 this._location = _location; |
| 19880 // Initializers done | 19997 // Initializers done |
| 19881 } | 19998 } |
| 19882 CompilerException.prototype.toString = function() { | 19999 CompilerException.prototype.toString = function() { |
| 19883 if ($notnull_bool(this._location != null)) { | 20000 if (this._location != null) { |
| 19884 return ('CompilerException: ' + this._location.toMessageString(this._lang_me ssage) + ''); | 20001 return ('CompilerException: ' + this._location.toMessageString(this._lang_me ssage) + ''); |
| 19885 } | 20002 } |
| 19886 else { | 20003 else { |
| 19887 return ('CompilerException: ' + this._lang_message + ''); | 20004 return ('CompilerException: ' + this._lang_message + ''); |
| 19888 } | 20005 } |
| 19889 } | 20006 } |
| 19890 // ********** Code for World ************** | 20007 // ********** Code for World ************** |
| 19891 function World(files) { | 20008 function World(files) { |
| 19892 this.errors = 0 | 20009 this.errors = 0 |
| 19893 this.warnings = 0 | 20010 this.warnings = 0 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 19922 this.varType = this.dynamicType; | 20039 this.varType = this.dynamicType; |
| 19923 this.objectType = (($0 = this._addToCoreLib('Object', true)) && $0.is$DefinedT ype()); | 20040 this.objectType = (($0 = this._addToCoreLib('Object', true)) && $0.is$DefinedT ype()); |
| 19924 this.numType = (($0 = this._addToCoreLib('num', false)) && $0.is$DefinedType() ); | 20041 this.numType = (($0 = this._addToCoreLib('num', false)) && $0.is$DefinedType() ); |
| 19925 this.intType = (($0 = this._addToCoreLib('int', false)) && $0.is$DefinedType() ); | 20042 this.intType = (($0 = this._addToCoreLib('int', false)) && $0.is$DefinedType() ); |
| 19926 this.doubleType = (($0 = this._addToCoreLib('double', false)) && $0.is$Defined Type()); | 20043 this.doubleType = (($0 = this._addToCoreLib('double', false)) && $0.is$Defined Type()); |
| 19927 this.boolType = (($0 = this._addToCoreLib('bool', false)) && $0.is$DefinedType ()); | 20044 this.boolType = (($0 = this._addToCoreLib('bool', false)) && $0.is$DefinedType ()); |
| 19928 this.stringType = (($0 = this._addToCoreLib('String', false)) && $0.is$Defined Type()); | 20045 this.stringType = (($0 = this._addToCoreLib('String', false)) && $0.is$Defined Type()); |
| 19929 this.listType = (($0 = this._addToCoreLib('List', false)) && $0.is$DefinedType ()); | 20046 this.listType = (($0 = this._addToCoreLib('List', false)) && $0.is$DefinedType ()); |
| 19930 this.mapType = (($0 = this._addToCoreLib('Map', false)) && $0.is$DefinedType() ); | 20047 this.mapType = (($0 = this._addToCoreLib('Map', false)) && $0.is$DefinedType() ); |
| 19931 this.functionType = (($0 = this._addToCoreLib('Function', false)) && $0.is$Def inedType()); | 20048 this.functionType = (($0 = this._addToCoreLib('Function', false)) && $0.is$Def inedType()); |
| 20049 this.nonNullBool = new NonNullableType(this.boolType); | |
| 19932 } | 20050 } |
| 19933 World.prototype._addMember = function(member) { | 20051 World.prototype._addMember = function(member) { |
| 19934 $assert(!$notnull_bool(member.get$isPrivate()), "!member.isPrivate", "world.da rt", 141, 12); | 20052 $assert(!$notnull_bool(member.get$isPrivate()), "!member.isPrivate", "world.da rt", 145, 12); |
| 19935 if ($notnull_bool(member.get$isStatic())) { | 20053 if ($notnull_bool(member.get$isStatic())) { |
| 19936 if ($notnull_bool(member.declaringType.get$isTop())) { | 20054 if ($notnull_bool(member.declaringType.get$isTop())) { |
| 19937 this._addTopName(member); | 20055 this._addTopName(member); |
| 19938 } | 20056 } |
| 19939 return; | 20057 return; |
| 19940 } | 20058 } |
| 19941 var mset = this._members.$index(member.name); | 20059 var mset = this._members.$index(member.name); |
| 19942 if ($notnull_bool(mset == null)) { | 20060 if ($notnull_bool(mset == null)) { |
| 19943 mset = new MemberSet(member); | 20061 mset = new MemberSet(member); |
| 19944 this._members.$setindex(mset.get$name(), mset); | 20062 this._members.$setindex(mset.get$name(), mset); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 19979 } | 20097 } |
| 19980 World.prototype._addJavascriptTopName = function(named) { | 20098 World.prototype._addJavascriptTopName = function(named) { |
| 19981 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name () + '')); | 20099 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name () + '')); |
| 19982 var existing = this._topNames.$index(named.get$jsname()); | 20100 var existing = this._topNames.$index(named.get$jsname()); |
| 19983 if ($notnull_bool($ne(existing, null) && $ne(existing, named))) { | 20101 if ($notnull_bool($ne(existing, null) && $ne(existing, named))) { |
| 19984 world.internalError(('name mangling failed for "' + named.get$jsname() + '" ') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$span().get $locationText() + ')'), named.get$span()); | 20102 world.internalError(('name mangling failed for "' + named.get$jsname() + '" ') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$span().get $locationText() + ')'), named.get$span()); |
| 19985 } | 20103 } |
| 19986 this._topNames.$setindex(named.get$jsname(), named); | 20104 this._topNames.$setindex(named.get$jsname(), named); |
| 19987 } | 20105 } |
| 19988 World.prototype._addType = function(type) { | 20106 World.prototype._addType = function(type) { |
| 19989 if ($notnull_bool(!$notnull_bool(type.get$isTop()))) this._addTopName(type); | 20107 if (!$notnull_bool(type.get$isTop())) this._addTopName(type); |
| 19990 } | 20108 } |
| 19991 World.prototype._addToCoreLib = function(name, isClass) { | 20109 World.prototype._addToCoreLib = function(name, isClass) { |
| 19992 var ret = new DefinedType(name, this.corelib, null, isClass); | 20110 var ret = new DefinedType(name, this.corelib, null, isClass); |
| 19993 this.corelib.types.$setindex(name, ret); | 20111 this.corelib.types.$setindex(name, ret); |
| 19994 return ret; | 20112 return ret; |
| 19995 } | 20113 } |
| 19996 World.prototype.toJsIdentifier = function(name) { | 20114 World.prototype.toJsIdentifier = function(name) { |
| 19997 if ($notnull_bool(this._jsKeywords == null)) { | 20115 if (this._jsKeywords == null) { |
| 19998 this._jsKeywords = HashSetImplementation.HashSetImplementation$from$factory( ['break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 'e lse', 'finally', 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', ' switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', 'clas s', 'enum', 'export', 'extends', 'import', 'super', 'implements', 'interface', ' let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'native']) ; | 20116 this._jsKeywords = HashSetImplementation.HashSetImplementation$from$factory( ['break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 'e lse', 'finally', 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', ' switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', 'clas s', 'enum', 'export', 'extends', 'import', 'super', 'implements', 'interface', ' let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'native']) ; |
| 19999 } | 20117 } |
| 20000 if ($notnull_bool(this._jsKeywords.contains(name))) { | 20118 if (this._jsKeywords.contains(name)) { |
| 20001 return name + '_'; | 20119 return name + '_'; |
| 20002 } | 20120 } |
| 20003 else { | 20121 else { |
| 20004 return name; | 20122 return name; |
| 20005 } | 20123 } |
| 20006 } | 20124 } |
| 20007 World.prototype.compile = function() { | 20125 World.prototype.compile = function() { |
| 20008 if ($notnull_bool(options.dartScript == null)) { | 20126 if (options.dartScript == null) { |
| 20009 this.fatal('no script provided to compile'); | 20127 this.fatal('no script provided to compile'); |
| 20010 return false; | 20128 return false; |
| 20011 } | 20129 } |
| 20012 try { | 20130 try { |
| 20013 this.info(('compiling ' + options.dartScript + ' with corelib ' + this.corel ib + '')); | 20131 this.info(('compiling ' + options.dartScript + ' with corelib ' + this.corel ib + '')); |
| 20014 if ($notnull_bool(!$notnull_bool(this.runLeg()))) this.runCompilationPhases( ); | 20132 if (!$notnull_bool(this.runLeg())) this.runCompilationPhases(); |
| 20015 } catch (exc) { | 20133 } catch (exc) { |
| 20016 exc = $toDartException(exc); | 20134 exc = $toDartException(exc); |
| 20017 if ($notnull_bool(this.get$hasErrors() && !$notnull_bool(options.throwOnErro rs))) { | 20135 if ($notnull_bool(this.get$hasErrors() && !$notnull_bool(options.throwOnErro rs))) { |
| 20018 } | 20136 } |
| 20019 else { | 20137 else { |
| 20020 throw exc; | 20138 throw exc; |
| 20021 } | 20139 } |
| 20022 } | 20140 } |
| 20023 this.printStatus(); | 20141 this.printStatus(); |
| 20024 return !$notnull_bool(this.get$hasErrors()); | 20142 return !$notnull_bool(this.get$hasErrors()); |
| 20025 } | 20143 } |
| 20026 World.prototype.runLeg = function() { | 20144 World.prototype.runLeg = function() { |
| 20027 var $this = this; // closure support | 20145 var $this = this; // closure support |
| 20028 if ($notnull_bool(!$notnull_bool(options.enableLeg))) return false; | 20146 if (!$notnull_bool(options.enableLeg)) return false; |
| 20029 var res = $assert_bool(this.withTiming('try leg compile', (function () { | 20147 var res = $assert_bool(this.withTiming('try leg compile', (function () { |
| 20030 return compile($this); | 20148 return compile($this); |
| 20031 }) | 20149 }) |
| 20032 )); | 20150 )); |
| 20033 if ($notnull_bool(!$notnull_bool(res) && options.legOnly)) { | 20151 if ($notnull_bool(!$notnull_bool(res) && options.legOnly)) { |
| 20034 this.fatal(("Leg could not compile " + options.dartScript + "")); | 20152 this.fatal(("Leg could not compile " + options.dartScript + "")); |
| 20035 return true; | 20153 return true; |
| 20036 } | 20154 } |
| 20037 return res; | 20155 return res; |
| 20038 } | 20156 } |
| 20039 World.prototype.runCompilationPhases = function() { | 20157 World.prototype.runCompilationPhases = function() { |
| 20040 var $this = this; // closure support | 20158 var $this = this; // closure support |
| 20041 var lib = this.withTiming('first pass', (function () { | 20159 var lib = this.withTiming('first pass', (function () { |
| 20042 return $this.processScript(options.dartScript); | 20160 return $this.processScript(options.dartScript); |
| 20043 }) | 20161 }) |
| 20044 ); | 20162 ); |
| 20045 this.withTiming('resolve top level', (function () { | 20163 this.withTiming('resolve top level', (function () { |
| 20046 $this.resolveAll(); | 20164 $this.resolveAll(); |
| 20047 }) | 20165 }) |
| 20048 ); | 20166 ); |
| 20049 this.withTiming('generate code', (function () { | 20167 this.withTiming('generate code', (function () { |
| 20050 var mainMembers = lib.topType.resolveMember('main'); | 20168 var mainMembers = lib.topType.resolveMember('main'); |
| 20051 var main = null; | 20169 var main = null; |
| 20052 if ($notnull_bool(mainMembers == null || mainMembers.get$members().length == 0)) { | 20170 if ($notnull_bool(mainMembers == null || mainMembers.get$members().length == 0)) { |
| 20053 $this.fatal('no main method specified'); | 20171 $this.fatal('no main method specified'); |
| 20054 } | 20172 } |
| 20055 else if ($notnull_bool(mainMembers.get$members().length > 1)) { | 20173 else if (mainMembers.get$members().length > 1) { |
| 20056 var $list = mainMembers.get$members(); | 20174 var $list = mainMembers.get$members(); |
| 20057 for (var $i = mainMembers.get$members().iterator(); $i.hasNext(); ) { | 20175 for (var $i = mainMembers.get$members().iterator(); $i.hasNext(); ) { |
| 20058 var m = $i.next(); | 20176 var m = $i.next(); |
| 20059 main = m; | 20177 main = m; |
| 20060 $this.error('more than one main member (using last?)', main.get$span()); | 20178 $this.error('more than one main member (using last?)', main.get$span()); |
| 20061 } | 20179 } |
| 20062 } | 20180 } |
| 20063 else { | 20181 else { |
| 20064 main = mainMembers.get$members().$index(0); | 20182 main = mainMembers.get$members().$index(0); |
| 20065 } | 20183 } |
| 20066 var codeWriter = new CodeWriter(); | 20184 var codeWriter = new CodeWriter(); |
| 20067 $this.gen = new WorldGenerator(main, codeWriter); | 20185 $this.gen = new WorldGenerator(main, codeWriter); |
| 20068 $this.gen.run(); | 20186 $this.gen.run(); |
| 20069 $this.jsBytesWritten = codeWriter.get$text().length; | 20187 $this.jsBytesWritten = codeWriter.get$text().length; |
| 20070 }) | 20188 }) |
| 20071 ); | 20189 ); |
| 20072 } | 20190 } |
| 20073 World.prototype.getGeneratedCode = function() { | 20191 World.prototype.getGeneratedCode = function() { |
| 20074 if ($notnull_bool(this.legCode != null)) { | 20192 if (this.legCode != null) { |
| 20075 $assert(options.enableLeg, "options.enableLeg", "world.dart", 306, 14); | 20193 $assert(options.enableLeg, "options.enableLeg", "world.dart", 310, 14); |
| 20076 return this.legCode; | 20194 return this.legCode; |
| 20077 } | 20195 } |
| 20078 else { | 20196 else { |
| 20079 return this.gen.writer.get$text(); | 20197 return this.gen.writer.get$text(); |
| 20080 } | 20198 } |
| 20081 } | 20199 } |
| 20082 World.prototype.readFile = function(filename) { | 20200 World.prototype.readFile = function(filename) { |
| 20083 try { | 20201 try { |
| 20084 var sourceFile = this.reader.readFile(filename); | 20202 var sourceFile = this.reader.readFile(filename); |
| 20085 this.dartBytesRead += sourceFile.get$text().length; | 20203 this.dartBytesRead += sourceFile.get$text().length; |
| 20086 return sourceFile; | 20204 return sourceFile; |
| 20087 } catch (e) { | 20205 } catch (e) { |
| 20088 e = $toDartException(e); | 20206 e = $toDartException(e); |
| 20089 this.warning(('Error reading file: ' + filename + '')); | 20207 this.warning(('Error reading file: ' + filename + '')); |
| 20090 return new SourceFile(filename, ''); | 20208 return new SourceFile(filename, ''); |
| 20091 } | 20209 } |
| 20092 } | 20210 } |
| 20093 World.prototype.getOrAddLibrary = function(filename) { | 20211 World.prototype.getOrAddLibrary = function(filename) { |
| 20094 var $0; | 20212 var $0; |
| 20095 var library = (($0 = this.libraries.$index(filename)) && $0.is$Library()); | 20213 var library = (($0 = this.libraries.$index(filename)) && $0.is$Library()); |
| 20096 if ($notnull_bool(library == null)) { | 20214 if (library == null) { |
| 20097 library = new Library(this.readFile(filename)); | 20215 library = new Library(this.readFile(filename)); |
| 20098 this.info(('read library ' + filename + '')); | 20216 this.info(('read library ' + filename + '')); |
| 20099 if ($notnull_bool(!$notnull_bool(library.get$isCore()) && !$notnull_bool(lib rary.imports.some((function (li) { | 20217 if (!$notnull_bool(library.get$isCore()) && !library.imports.some((function (li) { |
| 20100 return li.get$library().get$isCore(); | 20218 return li.get$library().get$isCore(); |
| 20101 }) | 20219 }) |
| 20102 )))) { | 20220 )) { |
| 20103 library.imports.add(new LibraryImport(this.corelib)); | 20221 library.imports.add(new LibraryImport(this.corelib)); |
| 20104 } | 20222 } |
| 20105 this.libraries.$setindex(filename, library); | 20223 this.libraries.$setindex(filename, library); |
| 20106 this._todo.add(library); | 20224 this._todo.add(library); |
| 20107 } | 20225 } |
| 20108 return library; | 20226 return library; |
| 20109 } | 20227 } |
| 20110 World.prototype.process = function() { | 20228 World.prototype.process = function() { |
| 20111 while ($notnull_bool(this._todo.length > 0)) { | 20229 while (this._todo.length > 0) { |
| 20112 var todo = this._todo; | 20230 var todo = this._todo; |
| 20113 this._todo = []; | 20231 this._todo = []; |
| 20114 for (var $i = 0;$i < todo.length; $i++) { | 20232 for (var $i = 0;$i < todo.length; $i++) { |
| 20115 var lib = todo.$index($i); | 20233 var lib = todo.$index($i); |
| 20116 lib.visitSources(); | 20234 lib.visitSources(); |
| 20117 } | 20235 } |
| 20118 } | 20236 } |
| 20119 } | 20237 } |
| 20120 World.prototype.processScript = function(filename) { | 20238 World.prototype.processScript = function(filename) { |
| 20121 var library = this.getOrAddLibrary(filename); | 20239 var library = this.getOrAddLibrary(filename); |
| 20122 this.process(); | 20240 this.process(); |
| 20123 return library; | 20241 return library; |
| 20124 } | 20242 } |
| 20125 World.prototype.resolveAll = function() { | 20243 World.prototype.resolveAll = function() { |
| 20126 var $list = this.libraries.getValues(); | 20244 var $list = this.libraries.getValues(); |
| 20127 for (var $i = this.libraries.getValues().iterator(); $i.hasNext(); ) { | 20245 for (var $i = this.libraries.getValues().iterator(); $i.hasNext(); ) { |
| 20128 var lib = $i.next(); | 20246 var lib = $i.next(); |
| 20129 lib.resolve(); | 20247 lib.resolve(); |
| 20130 } | 20248 } |
| 20131 } | 20249 } |
| 20132 World.prototype._message = function(message, span, span1, span2, throwing) { | 20250 World.prototype._message = function(message, span, span1, span2, throwing) { |
| 20133 var text = message; | 20251 var text = message; |
| 20134 if ($notnull_bool(span != null)) { | 20252 if (span != null) { |
| 20135 text = span.toMessageString(message); | 20253 text = span.toMessageString(message); |
| 20136 } | 20254 } |
| 20137 print(text); | 20255 print(text); |
| 20138 if ($notnull_bool(span1 != null)) { | 20256 if (span1 != null) { |
| 20139 print(span1.toMessageString(message)); | 20257 print(span1.toMessageString(message)); |
| 20140 } | 20258 } |
| 20141 if ($notnull_bool(span2 != null)) { | 20259 if (span2 != null) { |
| 20142 print(span2.toMessageString(message)); | 20260 print(span2.toMessageString(message)); |
| 20143 } | 20261 } |
| 20144 if ($notnull_bool(throwing)) { | 20262 if ($notnull_bool(throwing)) { |
| 20145 $throw(new CompilerException(message, span)); | 20263 $throw(new CompilerException(message, span)); |
| 20146 } | 20264 } |
| 20147 } | 20265 } |
| 20148 World.prototype.error = function(message, span, span1, span2) { | 20266 World.prototype.error = function(message, span, span1, span2) { |
| 20149 this.errors++; | 20267 this.errors++; |
| 20150 this._message(('error: ' + message + ''), span, span1, span2, options.throwOnE rrors); | 20268 this._message(('error: ' + message + ''), span, span1, span2, options.throwOnE rrors); |
| 20151 } | 20269 } |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 20170 } | 20288 } |
| 20171 World.prototype.get$hasErrors = function() { | 20289 World.prototype.get$hasErrors = function() { |
| 20172 return this.errors > 0; | 20290 return this.errors > 0; |
| 20173 } | 20291 } |
| 20174 World.prototype.printStatus = function() { | 20292 World.prototype.printStatus = function() { |
| 20175 this.info(('compiled ' + this.dartBytesRead + ' bytes Dart -> ' + this.jsBytes Written + ' bytes JS')); | 20293 this.info(('compiled ' + this.dartBytesRead + ' bytes Dart -> ' + this.jsBytes Written + ' bytes JS')); |
| 20176 if ($notnull_bool(this.get$hasErrors())) { | 20294 if ($notnull_bool(this.get$hasErrors())) { |
| 20177 print(('compilation failed with ' + this.errors + ' errors')); | 20295 print(('compilation failed with ' + this.errors + ' errors')); |
| 20178 } | 20296 } |
| 20179 else { | 20297 else { |
| 20180 if ($notnull_bool(this.warnings > 0)) { | 20298 if (this.warnings > 0) { |
| 20181 this.info(('compilation completed successfully with ' + this.warnings + ' warnings')); | 20299 this.info(('compilation completed successfully with ' + this.warnings + ' warnings')); |
| 20182 } | 20300 } |
| 20183 else { | 20301 else { |
| 20184 this.info('compilation completed sucessfully'); | 20302 this.info('compilation completed sucessfully'); |
| 20185 } | 20303 } |
| 20186 } | 20304 } |
| 20187 } | 20305 } |
| 20188 World.prototype.withTiming = function(name, f) { | 20306 World.prototype.withTiming = function(name, f) { |
| 20189 var sw = new StopWatchImplementation(); | 20307 var sw = new StopWatchImplementation(); |
| 20190 sw.start(); | 20308 sw.start(); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 20209 this.throwOnFatal = false | 20327 this.throwOnFatal = false |
| 20210 this.showInfo = false | 20328 this.showInfo = false |
| 20211 this.showWarnings = true | 20329 this.showWarnings = true |
| 20212 // Initializers done | 20330 // Initializers done |
| 20213 this.libDir = homedir + '/lib'; | 20331 this.libDir = homedir + '/lib'; |
| 20214 var ignoreUnrecognizedFlags = false; | 20332 var ignoreUnrecognizedFlags = false; |
| 20215 var passedLibDir = false; | 20333 var passedLibDir = false; |
| 20216 this.childArgs = []; | 20334 this.childArgs = []; |
| 20217 loop: | 20335 loop: |
| 20218 for (var i = 2; | 20336 for (var i = 2; |
| 20219 $notnull_bool(i < args.length); i++) { | 20337 i < args.length; i++) { |
| 20220 var arg = args.$index(i); | 20338 var arg = args.$index(i); |
| 20221 switch (arg) { | 20339 switch (arg) { |
| 20222 case '--enable_leg': | 20340 case '--enable_leg': |
| 20223 | 20341 |
| 20224 this.enableLeg = true; | 20342 this.enableLeg = true; |
| 20225 continue loop; | 20343 continue loop; |
| 20226 | 20344 |
| 20227 case '--leg_only': | 20345 case '--leg_only': |
| 20228 | 20346 |
| 20229 this.enableLeg = true; | 20347 this.enableLeg = true; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20281 this.throwOnWarnings = true; | 20399 this.throwOnWarnings = true; |
| 20282 continue loop; | 20400 continue loop; |
| 20283 | 20401 |
| 20284 case '--compile-only': | 20402 case '--compile-only': |
| 20285 | 20403 |
| 20286 this.compileOnly = true; | 20404 this.compileOnly = true; |
| 20287 continue loop; | 20405 continue loop; |
| 20288 | 20406 |
| 20289 default: | 20407 default: |
| 20290 | 20408 |
| 20291 if ($notnull_bool(arg.endsWith('.dart'))) { | 20409 if (arg.endsWith('.dart')) { |
| 20292 this.dartScript = $assert_String(arg); | 20410 this.dartScript = $assert_String(arg); |
| 20293 this.childArgs = (($0 = args.getRange(i + 1, args.length - i - 1)) && $0.is$List$String()); | 20411 this.childArgs = (($0 = args.getRange(i + 1, args.length - i - 1)) && $0.is$List$String()); |
| 20294 break loop; | 20412 break loop; |
| 20295 } | 20413 } |
| 20296 else if ($notnull_bool(arg.startsWith('--out='))) { | 20414 else if (arg.startsWith('--out=')) { |
| 20297 this.outfile = arg.substring('--out='.length); | 20415 this.outfile = arg.substring('--out='.length); |
| 20298 } | 20416 } |
| 20299 else if ($notnull_bool(arg.startsWith('--libdir='))) { | 20417 else if (arg.startsWith('--libdir=')) { |
| 20300 this.libDir = arg.substring('--libdir='.length); | 20418 this.libDir = arg.substring('--libdir='.length); |
| 20301 passedLibDir = true; | 20419 passedLibDir = true; |
| 20302 } | 20420 } |
| 20303 else { | 20421 else { |
| 20304 if ($notnull_bool(!$notnull_bool(ignoreUnrecognizedFlags))) { | 20422 if (!$notnull_bool(ignoreUnrecognizedFlags)) { |
| 20305 print(('unrecognized flag: "' + arg + '"')); | 20423 print(('unrecognized flag: "' + arg + '"')); |
| 20306 } | 20424 } |
| 20307 } | 20425 } |
| 20308 | 20426 |
| 20309 } | 20427 } |
| 20310 } | 20428 } |
| 20311 if ($notnull_bool(!$notnull_bool(passedLibDir) && !$notnull_bool(files.fileExi sts(this.libDir)))) { | 20429 if (!$notnull_bool(passedLibDir) && !$notnull_bool(files.fileExists(this.libDi r))) { |
| 20312 var temp = 'frog/lib'; | 20430 var temp = 'frog/lib'; |
| 20313 if ($notnull_bool(files.fileExists(temp))) { | 20431 if ($notnull_bool(files.fileExists(temp))) { |
| 20314 this.libDir = $assert_String(temp); | 20432 this.libDir = $assert_String(temp); |
| 20315 } | 20433 } |
| 20316 else { | 20434 else { |
| 20317 this.libDir = 'lib'; | 20435 this.libDir = 'lib'; |
| 20318 } | 20436 } |
| 20319 } | 20437 } |
| 20320 } | 20438 } |
| 20321 // ********** Code for LibraryReader ************** | 20439 // ********** Code for LibraryReader ************** |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20395 function VarMethodStub(name, member, args, body) { | 20513 function VarMethodStub(name, member, args, body) { |
| 20396 this.member = member; | 20514 this.member = member; |
| 20397 this.args = args; | 20515 this.args = args; |
| 20398 this.body = body; | 20516 this.body = body; |
| 20399 VarMember.call(this, name); | 20517 VarMember.call(this, name); |
| 20400 // Initializers done | 20518 // Initializers done |
| 20401 } | 20519 } |
| 20402 $inherits(VarMethodStub, VarMember); | 20520 $inherits(VarMethodStub, VarMember); |
| 20403 VarMethodStub.prototype.get$returnType = function() { | 20521 VarMethodStub.prototype.get$returnType = function() { |
| 20404 var $0; | 20522 var $0; |
| 20405 return (($0 = $notnull_bool(this.member != null) ? this.member.get$returnType( ) : world.varType) && $0.is$lang_Type()); | 20523 return (($0 = this.member != null ? this.member.get$returnType() : world.varTy pe) && $0.is$lang_Type()); |
| 20406 } | 20524 } |
| 20407 VarMethodStub.prototype.get$typeName = function() { | 20525 VarMethodStub.prototype.get$typeName = function() { |
| 20408 return $notnull_bool(this.member != null) ? this.member.declaringType.get$jsna me() : 'Object'; | 20526 return this.member != null ? this.member.declaringType.get$jsname() : 'Object' ; |
| 20409 } | 20527 } |
| 20410 VarMethodStub.prototype.generate = function(code) { | 20528 VarMethodStub.prototype.generate = function(code) { |
| 20411 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = ')); | 20529 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = ')); |
| 20412 this.generateBody(code); | 20530 this.generateBody(code); |
| 20413 code.writeln(';'); | 20531 code.writeln(';'); |
| 20414 } | 20532 } |
| 20415 VarMethodStub.prototype.generateBody = function(code) { | 20533 VarMethodStub.prototype.generateBody = function(code) { |
| 20416 if ($notnull_bool(this._useDirectCall(this.member, this.args))) { | 20534 if ($notnull_bool(this._useDirectCall(this.member, this.args))) { |
| 20417 code.write(('' + this.get$typeName() + '.prototype.' + this.member.get$jsnam e() + '')); | 20535 code.write(('' + this.get$typeName() + '.prototype.' + this.member.get$jsnam e() + '')); |
| 20418 } | 20536 } |
| 20419 else { | 20537 else { |
| 20420 code.enterBlock(('function(' + this.args.getCode() + ') {')); | 20538 code.enterBlock(('function(' + this.args.getCode() + ') {')); |
| 20421 code.writeln(('return ' + this.body.code + ';')); | 20539 code.writeln(('return ' + this.body.code + ';')); |
| 20422 code.exitBlock('}'); | 20540 code.exitBlock('}'); |
| 20423 } | 20541 } |
| 20424 } | 20542 } |
| 20425 VarMethodStub.prototype._useDirectCall = function(member, args) { | 20543 VarMethodStub.prototype._useDirectCall = function(member, args) { |
| 20426 if ($notnull_bool((member instanceof MethodMember) && $ne(member.declaringType .get$library(), world.get$dom()))) { | 20544 if ((member instanceof MethodMember) && $ne(member.declaringType.get$library() , world.get$dom())) { |
| 20427 var method = (member && member.is$MethodMember()); | 20545 var method = (member && member.is$MethodMember()); |
| 20428 if ($notnull_bool(method.needsArgumentConversion(args))) { | 20546 if ($notnull_bool(method.needsArgumentConversion(args))) { |
| 20429 return false; | 20547 return false; |
| 20430 } | 20548 } |
| 20431 for (var i = args.get$length(); | 20549 for (var i = args.get$length(); |
| 20432 $notnull_bool(i < method.parameters.length); i++) { | 20550 i < method.parameters.length; i++) { |
| 20433 if ($notnull_bool(method.parameters.$index(i).get$value().code != 'null')) { | 20551 if (method.parameters.$index(i).get$value().code != 'null') { |
| 20434 return false; | 20552 return false; |
| 20435 } | 20553 } |
| 20436 } | 20554 } |
| 20437 return method.namesInOrder(args); | 20555 return method.namesInOrder(args); |
| 20438 } | 20556 } |
| 20439 else { | 20557 else { |
| 20440 return false; | 20558 return false; |
| 20441 } | 20559 } |
| 20442 } | 20560 } |
| 20443 // ********** Code for VarMethodSet ************** | 20561 // ********** Code for VarMethodSet ************** |
| 20444 function VarMethodSet(name, members, callArgs, returnType) { | 20562 function VarMethodSet(name, members, callArgs, returnType) { |
| 20445 this.members = members; | 20563 this.members = members; |
| 20446 this.returnType = returnType; | 20564 this.returnType = returnType; |
| 20447 this.args = callArgs.toCallStubArgs(); | 20565 this.args = callArgs.toCallStubArgs(); |
| 20448 VarMember.call(this, name); | 20566 VarMember.call(this, name); |
| 20449 // Initializers done | 20567 // Initializers done |
| 20450 } | 20568 } |
| 20451 $inherits(VarMethodSet, VarMember); | 20569 $inherits(VarMethodSet, VarMember); |
| 20452 VarMethodSet.prototype.get$members = function() { return this.members; }; | 20570 VarMethodSet.prototype.get$members = function() { return this.members; }; |
| 20453 VarMethodSet.prototype.get$returnType = function() { return this.returnType; }; | 20571 VarMethodSet.prototype.get$returnType = function() { return this.returnType; }; |
| 20454 VarMethodSet.prototype.get$baseName = function() { | 20572 VarMethodSet.prototype.get$baseName = function() { |
| 20455 return $assert_String(this.members.$index(0).get$name()); | 20573 return $assert_String(this.members.$index(0).get$name()); |
| 20456 } | 20574 } |
| 20457 VarMethodSet.prototype.invoke = function(context, node, target, args) { | 20575 VarMethodSet.prototype.invoke = function(context, node, target, args) { |
| 20458 this._invokeMembers(context, node); | 20576 this._invokeMembers(context, node); |
| 20459 return VarMember.prototype.invoke.call(this, context, node, target, args); | 20577 return VarMember.prototype.invoke.call(this, context, node, target, args); |
| 20460 } | 20578 } |
| 20461 VarMethodSet.prototype._invokeMembers = function(context, node) { | 20579 VarMethodSet.prototype._invokeMembers = function(context, node) { |
| 20462 if ($notnull_bool(this._fallbackStubs != null)) return; | 20580 if (this._fallbackStubs != null) return; |
| 20463 this._fallbackStubs = []; | 20581 this._fallbackStubs = []; |
| 20464 var $list = this.members; | 20582 var $list = this.members; |
| 20465 for (var $i = 0;$i < $list.length; $i++) { | 20583 for (var $i = 0;$i < $list.length; $i++) { |
| 20466 var member = $list.$index($i); | 20584 var member = $list.$index($i); |
| 20467 var target = new Value(member.declaringType, 'this', node.span, true); | 20585 var target = new Value(member.declaringType, 'this', node.span, true); |
| 20468 var result = member.invoke$4(context, node, target, this.args); | 20586 var result = member.invoke$4(context, node, target, this.args); |
| 20469 var stub = new VarMethodStub(this.name, member, this.args, result); | 20587 var stub = new VarMethodStub(this.name, member, this.args, result); |
| 20470 var type = member.declaringType; | 20588 var type = member.declaringType; |
| 20471 if ($notnull_bool($ne(type.get$library(), world.get$dom()) && !$notnull_bool (type.get$isObject()))) { | 20589 if ($ne(type.get$library(), world.get$dom()) && !$notnull_bool(type.get$isOb ject())) { |
| 20472 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V arMember())); | 20590 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V arMember())); |
| 20473 } | 20591 } |
| 20474 else { | 20592 else { |
| 20475 this._fallbackStubs.add(stub); | 20593 this._fallbackStubs.add(stub); |
| 20476 } | 20594 } |
| 20477 } | 20595 } |
| 20478 var target = new Value(world.objectType, 'this', node.span, true); | 20596 var target = new Value(world.objectType, 'this', node.span, true); |
| 20479 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, thi s.args); | 20597 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, thi s.args); |
| 20480 var stub = new VarMethodStub(this.name, null, this.args, result); | 20598 var stub = new VarMethodStub(this.name, null, this.args, result); |
| 20481 if ($notnull_bool(this._fallbackStubs.length == 0)) { | 20599 if (this._fallbackStubs.length == 0) { |
| 20482 VarMethodSet._addVarStub(world.objectType, (stub && stub.is$VarMember())); | 20600 VarMethodSet._addVarStub(world.objectType, (stub && stub.is$VarMember())); |
| 20483 } | 20601 } |
| 20484 else { | 20602 else { |
| 20485 this._fallbackStubs.add(stub); | 20603 this._fallbackStubs.add(stub); |
| 20486 world.gen.corejs.useVarMethod = true; | 20604 world.gen.corejs.useVarMethod = true; |
| 20487 } | 20605 } |
| 20488 } | 20606 } |
| 20489 VarMethodSet._addVarStub = function(type, stub) { | 20607 VarMethodSet._addVarStub = function(type, stub) { |
| 20490 if ($notnull_bool(type.varStubs == null)) type.varStubs = $map([]); | 20608 if (type.varStubs == null) type.varStubs = $map([]); |
| 20491 type.varStubs.$setindex(stub.name, stub); | 20609 type.varStubs.$setindex(stub.name, stub); |
| 20492 } | 20610 } |
| 20493 VarMethodSet.prototype.generate = function(code) { | 20611 VarMethodSet.prototype.generate = function(code) { |
| 20494 if ($notnull_bool(this._fallbackStubs.length == 0)) return; | 20612 if (this._fallbackStubs.length == 0) return; |
| 20495 code.enterBlock(('\$varMethod("' + this.name + '", {')); | 20613 code.enterBlock(('\$varMethod("' + this.name + '", {')); |
| 20496 var lastOne = this._fallbackStubs.$index(this._fallbackStubs.length - 1); | 20614 var lastOne = this._fallbackStubs.$index(this._fallbackStubs.length - 1); |
| 20497 var $list = this._fallbackStubs; | 20615 var $list = this._fallbackStubs; |
| 20498 for (var $i = 0;$i < $list.length; $i++) { | 20616 for (var $i = 0;$i < $list.length; $i++) { |
| 20499 var stub = $list.$index($i); | 20617 var stub = $list.$index($i); |
| 20500 code.write(('"' + stub.get$typeName() + '": ')); | 20618 code.write(('"' + stub.get$typeName() + '": ')); |
| 20501 stub.generateBody(code); | 20619 stub.generateBody(code); |
| 20502 code.writeln($notnull_bool($eq(stub, lastOne)) ? '' : ','); | 20620 code.writeln($notnull_bool($eq(stub, lastOne)) ? '' : ','); |
| 20503 } | 20621 } |
| 20504 code.exitBlock('});'); | 20622 code.exitBlock('});'); |
| 20505 } | 20623 } |
| 20506 VarMethodSet.prototype.invoke$4 = function($0, $1, $2, $3) { | 20624 VarMethodSet.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 20507 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments())); | 20625 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments())); |
| 20508 } | 20626 } |
| 20509 ; | 20627 ; |
| 20510 // ********** Code for top level ************** | 20628 // ********** Code for top level ************** |
| 20511 function map(source, mapper) { | 20629 function map(source, mapper) { |
| 20512 var result = new ListFactory(); | 20630 var result = new ListFactory(); |
| 20513 if ($notnull_bool(!!(source && source.is$List))) { | 20631 if (!!(source && source.is$List)) { |
| 20514 var list = (source && source.is$List()); | 20632 var list = (source && source.is$List()); |
| 20515 result.length = list.length; | 20633 result.length = list.length; |
| 20516 for (var i = 0; | 20634 for (var i = 0; |
| 20517 $notnull_bool(i < list.length); i++) { | 20635 i < list.length; i++) { |
| 20518 result.$setindex(i, mapper(list.$index(i))); | 20636 result.$setindex(i, mapper(list.$index(i))); |
| 20519 } | 20637 } |
| 20520 } | 20638 } |
| 20521 else { | 20639 else { |
| 20522 for (var $i = source.iterator(); $i.hasNext(); ) { | 20640 for (var $i = source.iterator(); $i.hasNext(); ) { |
| 20523 var item = $i.next(); | 20641 var item = $i.next(); |
| 20524 result.add(mapper(item)); | 20642 result.add(mapper(item)); |
| 20525 } | 20643 } |
| 20526 } | 20644 } |
| 20527 return result; | 20645 return result; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 20545 }) | 20663 }) |
| 20546 ); | 20664 ); |
| 20547 var values = []; | 20665 var values = []; |
| 20548 for (var $i = 0;$i < keys.length; $i++) { | 20666 for (var $i = 0;$i < keys.length; $i++) { |
| 20549 var k = keys.$index($i); | 20667 var k = keys.$index($i); |
| 20550 values.add(map.$index(k)); | 20668 values.add(map.$index(k)); |
| 20551 } | 20669 } |
| 20552 return values; | 20670 return values; |
| 20553 } | 20671 } |
| 20554 function isMultilineString(text) { | 20672 function isMultilineString(text) { |
| 20555 return $notnull_bool(text.startsWith('"""') || text.startsWith("'''")); | 20673 return text.startsWith('"""') || text.startsWith("'''"); |
| 20556 } | 20674 } |
| 20557 function isRawMultilineString(text) { | 20675 function isRawMultilineString(text) { |
| 20558 return $notnull_bool(text.startsWith('@"""') || text.startsWith("@'''")); | 20676 return text.startsWith('@"""') || text.startsWith("@'''"); |
| 20559 } | 20677 } |
| 20560 function parseStringLiteral(lit) { | 20678 function parseStringLiteral(lit) { |
| 20561 if ($notnull_bool(lit.startsWith('@'))) { | 20679 if (lit.startsWith('@')) { |
| 20562 if ($notnull_bool(isRawMultilineString(lit))) { | 20680 if ($notnull_bool(isRawMultilineString(lit))) { |
| 20563 return stripLeadingNewline(lit.substring(4, lit.length - 3)); | 20681 return stripLeadingNewline(lit.substring(4, lit.length - 3)); |
| 20564 } | 20682 } |
| 20565 else { | 20683 else { |
| 20566 return lit.substring(2, lit.length - 1); | 20684 return lit.substring(2, lit.length - 1); |
| 20567 } | 20685 } |
| 20568 } | 20686 } |
| 20569 else if ($notnull_bool(isMultilineString(lit))) { | 20687 else if ($notnull_bool(isMultilineString(lit))) { |
| 20570 lit = lit.substring(3, lit.length - 3).replaceAll('\\\$', '\$'); | 20688 lit = lit.substring(3, lit.length - 3).replaceAll('\\\$', '\$'); |
| 20571 return stripLeadingNewline(lit); | 20689 return stripLeadingNewline(lit); |
| 20572 } | 20690 } |
| 20573 else { | 20691 else { |
| 20574 return lit.substring(1, lit.length - 1).replaceAll('\\\$', '\$'); | 20692 return lit.substring(1, lit.length - 1).replaceAll('\\\$', '\$'); |
| 20575 } | 20693 } |
| 20576 } | 20694 } |
| 20577 function stripLeadingNewline(text) { | 20695 function stripLeadingNewline(text) { |
| 20578 if ($notnull_bool(text.startsWith('\n'))) { | 20696 if (text.startsWith('\n')) { |
| 20579 return text.substring(1); | 20697 return text.substring(1); |
| 20580 } | 20698 } |
| 20581 else if ($notnull_bool(text.startsWith('\r'))) { | 20699 else if (text.startsWith('\r')) { |
| 20582 if ($notnull_bool(text.startsWith('\r\n'))) { | 20700 if (text.startsWith('\r\n')) { |
| 20583 return text.substring(2); | 20701 return text.substring(2); |
| 20584 } | 20702 } |
| 20585 else { | 20703 else { |
| 20586 return text.substring(1); | 20704 return text.substring(1); |
| 20587 } | 20705 } |
| 20588 } | 20706 } |
| 20589 else { | 20707 else { |
| 20590 return text; | 20708 return text; |
| 20591 } | 20709 } |
| 20592 } | 20710 } |
| 20593 var world; | 20711 var world; |
| 20594 function initializeWorld(files) { | 20712 function initializeWorld(files) { |
| 20595 $assert(world == null, "world == null", "world.dart", 13, 10); | 20713 $assert(world == null, "world == null", "world.dart", 13, 10); |
| 20596 world = new World(files); | 20714 world = new World(files); |
| 20597 world.init(); | 20715 world.init(); |
| 20598 } | 20716 } |
| 20599 function lang_compile(homedir, args, files) { | 20717 function lang_compile(homedir, args, files) { |
| 20600 parseOptions(homedir, args, files); | 20718 parseOptions(homedir, args, files); |
| 20601 initializeWorld(files); | 20719 initializeWorld(files); |
| 20602 var success = world.compile(); | 20720 var success = world.compile(); |
| 20603 if ($notnull_bool(options.outfile != null)) { | 20721 if (options.outfile != null) { |
| 20604 if ($notnull_bool(success)) { | 20722 if ($notnull_bool(success)) { |
| 20605 var code = world.getGeneratedCode(); | 20723 var code = world.getGeneratedCode(); |
| 20606 if ($notnull_bool(!$notnull_bool(options.outfile.endsWith('.js')))) { | 20724 if (!options.outfile.endsWith('.js')) { |
| 20607 code = '#!/usr/bin/env node\n' + code; | 20725 code = '#!/usr/bin/env node\n' + code; |
| 20608 } | 20726 } |
| 20609 world.files.writeString(options.outfile, code); | 20727 world.files.writeString(options.outfile, code); |
| 20610 } | 20728 } |
| 20611 else { | 20729 else { |
| 20612 world.files.writeString(options.outfile, "throw 'Sorry, but I could not ge nerate reasonable code to run.\\n';"); | 20730 world.files.writeString(options.outfile, "throw 'Sorry, but I could not ge nerate reasonable code to run.\\n';"); |
| 20613 } | 20731 } |
| 20614 } | 20732 } |
| 20615 return $assert_bool(success); | 20733 return $assert_bool(success); |
| 20616 } | 20734 } |
| 20617 var options; | 20735 var options; |
| 20618 function parseOptions(homedir, args, files) { | 20736 function parseOptions(homedir, args, files) { |
| 20619 $assert(options == null, "options == null", "frog_options.dart", 10, 10); | 20737 $assert(options == null, "options == null", "frog_options.dart", 10, 10); |
| 20620 options = new FrogOptions(homedir, args, files); | 20738 options = new FrogOptions(homedir, args, files); |
| 20621 } | 20739 } |
| 20622 function _getCallStubName(name, args) { | 20740 function _getCallStubName(name, args) { |
| 20623 var nameBuilder = new StringBufferImpl(('' + name + '\$' + args.get$bareCount( ) + '')); | 20741 var nameBuilder = new StringBufferImpl(('' + name + '\$' + args.get$bareCount( ) + '')); |
| 20624 for (var i = args.get$bareCount(); | 20742 for (var i = args.get$bareCount(); |
| 20625 $notnull_bool(i < args.get$length()); i++) { | 20743 i < args.get$length(); i++) { |
| 20626 nameBuilder.add('\$').add(args.getName(i)); | 20744 nameBuilder.add('\$').add(args.getName(i)); |
| 20627 } | 20745 } |
| 20628 return nameBuilder.toString(); | 20746 return nameBuilder.toString(); |
| 20629 } | 20747 } |
| 20630 // ********** Library frog ************** | 20748 // ********** Library frog ************** |
| 20631 // ********** Code for top level ************** | 20749 // ********** Code for top level ************** |
| 20632 function main() { | 20750 function main() { |
| 20633 var homedir = get$path().dirname(get$fs().realpathSync($assert_String(process. argv.$index(1)))); | 20751 var homedir = get$path().dirname(get$fs().realpathSync($assert_String(process. argv.$index(1)))); |
| 20634 var argv = ListFactory.ListFactory$from$factory(process.argv); | 20752 var argv = ListFactory.ListFactory$from$factory(process.argv); |
| 20635 if ($notnull_bool(lang_compile($assert_String(homedir), (argv && argv.is$List$ String()), new NodeFileSystem()))) { | 20753 if ($notnull_bool(lang_compile($assert_String(homedir), (argv && argv.is$List$ String()), new NodeFileSystem()))) { |
| 20636 var code = world.getGeneratedCode(); | 20754 var code = world.getGeneratedCode(); |
| 20637 if ($notnull_bool(!$notnull_bool(options.compileOnly))) { | 20755 if (!$notnull_bool(options.compileOnly)) { |
| 20638 process.argv = [argv.$index(0), argv.$index(1)]; | 20756 process.argv = [argv.$index(0), argv.$index(1)]; |
| 20639 process.argv.addAll(options.childArgs); | 20757 process.argv.addAll(options.childArgs); |
| 20640 get$vm().runInNewContext($assert_String(code), createSandbox()); | 20758 get$vm().runInNewContext($assert_String(code), createSandbox()); |
| 20641 } | 20759 } |
| 20642 } | 20760 } |
| 20643 else { | 20761 else { |
| 20644 process.exit(1); | 20762 process.exit(1); |
| 20645 } | 20763 } |
| 20646 } | 20764 } |
| 20647 // ********** Globals ************** | 20765 // ********** Globals ************** |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20772 INTERFACE, | 20890 INTERFACE, |
| 20773 LIBRARY, | 20891 LIBRARY, |
| 20774 NATIVE, | 20892 NATIVE, |
| 20775 NEGATE, | 20893 NEGATE, |
| 20776 OPERATOR, | 20894 OPERATOR, |
| 20777 SET, | 20895 SET, |
| 20778 SOURCE, | 20896 SOURCE, |
| 20779 STATIC, | 20897 STATIC, |
| 20780 TYPEDEF ]*/; | 20898 TYPEDEF ]*/; |
| 20781 RunEntry(function () {main();}, []); | 20899 RunEntry(function () {main();}, []); |
| OLD | NEW |