| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 if (e.message.indexOf('call stack') >= 0) { | 101 if (e.message.indexOf('call stack') >= 0) { |
| 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) { | |
| 112 return (test === true || test === false) ? test : test.is$bool(); // TypeError | |
| 113 } | |
| 114 function $assert(test, text, url, line, column) { | |
| 115 if (typeof test == 'function') test = test(); | |
| 116 if (!test) $throw(new AssertError(text, url, line, column)); | |
| 117 } | |
| 118 function $throw(e) { | 111 function $throw(e) { |
| 119 // If e is not a value, we can use V8's captureStackTrace utility method. | 112 // 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. | 113 // TODO(jmesserly): capture the stack trace on other JS engines. |
| 121 if (e && (typeof e == 'object') && Error.captureStackTrace) { | 114 if (e && (typeof e == 'object') && Error.captureStackTrace) { |
| 122 // TODO(jmesserly): this will clobber the e.stack property | 115 // TODO(jmesserly): this will clobber the e.stack property |
| 123 Error.captureStackTrace(e, $throw); | 116 Error.captureStackTrace(e, $throw); |
| 124 } | 117 } |
| 125 throw e; | 118 throw e; |
| 126 } | 119 } |
| 127 function $map(items) { | 120 function $map(items) { |
| 128 var ret = new HashMapImplementation(); | 121 var ret = new HashMapImplementation(); |
| 129 for (var i=0; i < items.length;) { | 122 for (var i=0; i < items.length;) { |
| 130 ret.$setindex(items[i++], items[i++]); | 123 ret.$setindex(items[i++], items[i++]); |
| 131 } | 124 } |
| 132 return ret; | 125 return ret; |
| 133 } | 126 } |
| 134 Object.prototype.$index = function(i) { return this[i]; } | 127 Object.prototype.$index = function(i) { return this[i]; } |
| 135 Array.prototype.$index = function(i) { return this[i]; } | 128 Array.prototype.$index = function(i) { return this[i]; } |
| 136 String.prototype.$index = function(i) { return this[i]; } | 129 String.prototype.$index = function(i) { return this[i]; } |
| 137 Object.prototype.$setindex = function(i, value) { return this[i] = value; } | 130 Object.prototype.$setindex = function(i, value) { return this[i] = value; } |
| 138 Array.prototype.$setindex = function(i, value) { return this[i] = value; } | 131 Array.prototype.$setindex = function(i, value) { return this[i] = value; } |
| 139 function $add(x, y) { | |
| 140 return ((typeof(x) == 'number' && typeof(y) == 'number') || | |
| 141 (typeof(x) == 'string' && typeof(y) == 'string')) | |
| 142 ? x + y : x.$add(y); | |
| 143 } | |
| 144 function $eq(x, y) { | 132 function $eq(x, y) { |
| 145 if (x == null) return y == null; | 133 if (x == null) return y == null; |
| 146 return (typeof(x) == 'number' && typeof(y) == 'number') || | 134 return (typeof(x) == 'number' && typeof(y) == 'number') || |
| 147 (typeof(x) == 'boolean' && typeof(y) == 'boolean') || | 135 (typeof(x) == 'boolean' && typeof(y) == 'boolean') || |
| 148 (typeof(x) == 'string' && typeof(y) == 'string') | 136 (typeof(x) == 'string' && typeof(y) == 'string') |
| 149 ? x == y : x.$eq(y); | 137 ? x == y : x.$eq(y); |
| 150 } | 138 } |
| 151 // TODO(jimhug): Should this or should it not match equals? | 139 // TODO(jimhug): Should this or should it not match equals? |
| 152 Object.prototype.$eq = function(other) { return this === other; } | 140 Object.prototype.$eq = function(other) { return this === other; } |
| 153 function $mod(x, y) { | 141 function $mod(x, y) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 184 } | 172 } |
| 185 } | 173 } |
| 186 // ********** Code for Clock ************** | 174 // ********** Code for Clock ************** |
| 187 function Clock() {} | 175 function Clock() {} |
| 188 Clock.now = function() { | 176 Clock.now = function() { |
| 189 return new Date().getTime(); | 177 return new Date().getTime(); |
| 190 } | 178 } |
| 191 Clock.frequency = function() { | 179 Clock.frequency = function() { |
| 192 return 1000; | 180 return 1000; |
| 193 } | 181 } |
| 194 // ********** Code for AssertError ************** | |
| 195 function AssertError(failedAssertion, url, line, column) { | |
| 196 this.failedAssertion = failedAssertion; | |
| 197 this.url = url; | |
| 198 this.line = line; | |
| 199 this.column = column; | |
| 200 // Initializers done | |
| 201 } | |
| 202 AssertError.prototype.toString = function() { | |
| 203 return ("Failed assertion: '" + this.failedAssertion + "' is not true ") + ("i
n " + this.url + " at line " + this.line + ", column " + this.column + "."); | |
| 204 } | |
| 205 AssertError.prototype.toString$0 = function() { | |
| 206 return this.toString(); | |
| 207 }; | |
| 208 // ********** Code for Object ************** | 182 // ********** Code for Object ************** |
| 209 Object.prototype.get$dynamic = function() { | 183 Object.prototype.get$dynamic = function() { |
| 210 return this; | 184 return this; |
| 211 } | 185 } |
| 212 Object.prototype.noSuchMethod = function(name, args) { | 186 Object.prototype.noSuchMethod = function(name, args) { |
| 213 $throw(new NoSuchMethodException(this, name, args)); | 187 $throw(new NoSuchMethodException(this, name, args)); |
| 214 } | 188 } |
| 215 Object.prototype._get$3 = function($0, $1, $2) { | 189 Object.prototype._get$3 = function($0, $1, $2) { |
| 216 return this.noSuchMethod("_get", [$0, $1, $2]); | 190 return this.noSuchMethod("_get", [$0, $1, $2]); |
| 217 }; | 191 }; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 229 }; | 203 }; |
| 230 Object.prototype.addDirectSubtype$1 = function($0) { | 204 Object.prototype.addDirectSubtype$1 = function($0) { |
| 231 return this.noSuchMethod("addDirectSubtype", [$0]); | 205 return this.noSuchMethod("addDirectSubtype", [$0]); |
| 232 }; | 206 }; |
| 233 Object.prototype.addMethod$2 = function($0, $1) { | 207 Object.prototype.addMethod$2 = function($0, $1) { |
| 234 return this.noSuchMethod("addMethod", [$0, $1]); | 208 return this.noSuchMethod("addMethod", [$0, $1]); |
| 235 }; | 209 }; |
| 236 Object.prototype.addSource$1 = function($0) { | 210 Object.prototype.addSource$1 = function($0) { |
| 237 return this.noSuchMethod("addSource", [$0]); | 211 return this.noSuchMethod("addSource", [$0]); |
| 238 }; | 212 }; |
| 239 Object.prototype.appendByteStringToken$2 = function($0, $1) { | |
| 240 return this.noSuchMethod("appendByteStringToken", [$0, $1]); | |
| 241 }; | |
| 242 Object.prototype.beginArguments$1 = function($0) { | 213 Object.prototype.beginArguments$1 = function($0) { |
| 243 return this.noSuchMethod("beginArguments", [$0]); | 214 return this.noSuchMethod("beginArguments", [$0]); |
| 244 }; | 215 }; |
| 245 Object.prototype.beginBlock$1 = function($0) { | 216 Object.prototype.beginBlock$1 = function($0) { |
| 246 return this.noSuchMethod("beginBlock", [$0]); | 217 return this.noSuchMethod("beginBlock", [$0]); |
| 247 }; | 218 }; |
| 248 Object.prototype.beginClass$1 = function($0) { | 219 Object.prototype.beginClass$1 = function($0) { |
| 249 return this.noSuchMethod("beginClass", [$0]); | 220 return this.noSuchMethod("beginClass", [$0]); |
| 250 }; | 221 }; |
| 251 Object.prototype.beginExpressionStatement$1 = function($0) { | 222 Object.prototype.beginExpressionStatement$1 = function($0) { |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 }; | 632 }; |
| 662 Object.prototype.visitPostfixExpression$1 = function($0) { | 633 Object.prototype.visitPostfixExpression$1 = function($0) { |
| 663 return this.noSuchMethod("visitPostfixExpression", [$0]); | 634 return this.noSuchMethod("visitPostfixExpression", [$0]); |
| 664 }; | 635 }; |
| 665 Object.prototype.visitSources$0 = function() { | 636 Object.prototype.visitSources$0 = function() { |
| 666 return this.noSuchMethod("visitSources", []); | 637 return this.noSuchMethod("visitSources", []); |
| 667 }; | 638 }; |
| 668 Object.prototype.writeDefinition$2 = function($0, $1) { | 639 Object.prototype.writeDefinition$2 = function($0, $1) { |
| 669 return this.noSuchMethod("writeDefinition", [$0, $1]); | 640 return this.noSuchMethod("writeDefinition", [$0, $1]); |
| 670 }; | 641 }; |
| 671 function $assert_bool(x) { | |
| 672 if (x == null || typeof(x) == "boolean") return x; | |
| 673 throw new TypeError("'" + x + "' is not a bool."); | |
| 674 } | |
| 675 // ********** Code for IllegalAccessException ************** | 642 // ********** Code for IllegalAccessException ************** |
| 676 function IllegalAccessException() { | 643 function IllegalAccessException() { |
| 677 // Initializers done | 644 // Initializers done |
| 678 } | 645 } |
| 679 IllegalAccessException.prototype.toString = function() { | 646 IllegalAccessException.prototype.toString = function() { |
| 680 return "Attempt to modify an immutable object"; | 647 return "Attempt to modify an immutable object"; |
| 681 } | 648 } |
| 682 IllegalAccessException.prototype.toString$0 = function() { | 649 IllegalAccessException.prototype.toString$0 = function() { |
| 683 return this.toString(); | 650 return this.toString(); |
| 684 }; | 651 }; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 } | 781 } |
| 815 Math.min = function(a, b) { | 782 Math.min = function(a, b) { |
| 816 if (a == b) return a; | 783 if (a == b) return a; |
| 817 if (a < b) { | 784 if (a < b) { |
| 818 if (isNaN(b)) return b; | 785 if (isNaN(b)) return b; |
| 819 else return a; | 786 else return a; |
| 820 } | 787 } |
| 821 if (isNaN(a)) return a; | 788 if (isNaN(a)) return a; |
| 822 else return b; | 789 else return b; |
| 823 } | 790 } |
| 824 function $assert_num(x) { | |
| 825 if (x == null || typeof(x) == "number") return x; | |
| 826 throw new TypeError("'" + x + "' is not a num."); | |
| 827 } | |
| 828 function $assert_String(x) { | |
| 829 if (x == null || typeof(x) == "string") return x; | |
| 830 throw new TypeError("'" + x + "' is not a String."); | |
| 831 } | |
| 832 // ********** Code for Strings ************** | 791 // ********** Code for Strings ************** |
| 833 function Strings() {} | 792 function Strings() {} |
| 834 Strings.String$fromCharCodes$factory = function(charCodes) { | 793 Strings.String$fromCharCodes$factory = function(charCodes) { |
| 835 return StringBase.createFromCharCodes(charCodes); | 794 return StringBase.createFromCharCodes(charCodes); |
| 836 } | 795 } |
| 837 Strings.join = function(strings, separator) { | 796 Strings.join = function(strings, separator) { |
| 838 return StringBase.join(strings, separator); | 797 return StringBase.join(strings, separator); |
| 839 } | 798 } |
| 840 // ********** Code for top level ************** | 799 // ********** Code for top level ************** |
| 841 function print(obj) { | 800 function print(obj) { |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 return _IsolateJsUtil._deserializeMessage(message_); | 1295 return _IsolateJsUtil._deserializeMessage(message_); |
| 1337 } else { | 1296 } else { |
| 1338 // Nothing more to do. | 1297 // Nothing more to do. |
| 1339 return message_; | 1298 return message_; |
| 1340 } | 1299 } |
| 1341 } | 1300 } |
| 1342 | 1301 |
| 1343 function _IsolateJsUtil() {} | 1302 function _IsolateJsUtil() {} |
| 1344 // ********** Code for ListFactory ************** | 1303 // ********** Code for ListFactory ************** |
| 1345 ListFactory = Array; | 1304 ListFactory = Array; |
| 1346 ListFactory.prototype.is$ListFactory = function(){return this;}; | |
| 1347 ListFactory.prototype.is$List = function(){return this;}; | 1305 ListFactory.prototype.is$List = function(){return this;}; |
| 1348 ListFactory.prototype.is$List$ArgumentNode = function(){return this;}; | |
| 1349 ListFactory.prototype.is$List$Definition = function(){return this;}; | |
| 1350 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;}; | |
| 1351 ListFactory.prototype.is$List$String = function(){return this;}; | |
| 1352 ListFactory.prototype.is$List$Type = function(){return this;}; | |
| 1353 ListFactory.prototype.is$List$Value = function(){return this;}; | |
| 1354 ListFactory.prototype.is$List$int = function(){return this;}; | |
| 1355 ListFactory.prototype.is$Collection$E = function(){return this;}; | |
| 1356 ListFactory.prototype.is$Collection$Object = function(){return this;}; | |
| 1357 ListFactory.prototype.is$Collection$Type = function(){return this;}; | |
| 1358 ListFactory.prototype.is$Iterable = function(){return this;}; | |
| 1359 ListFactory.ListFactory$from$factory = function(other) { | 1306 ListFactory.ListFactory$from$factory = function(other) { |
| 1360 var list = []; | 1307 var list = []; |
| 1361 for (var $i = other.iterator(); $i.hasNext$0(); ) { | 1308 for (var $i = other.iterator(); $i.hasNext$0(); ) { |
| 1362 var e = $i.next$0(); | 1309 var e = $i.next$0(); |
| 1363 list.add(e); | 1310 list.add(e); |
| 1364 } | 1311 } |
| 1365 return (list && list.is$ListFactory()); | 1312 return list; |
| 1366 } | 1313 } |
| 1367 ListFactory.prototype.add = function(value) { | 1314 ListFactory.prototype.add = function(value) { |
| 1368 this.push(value); | 1315 this.push(value); |
| 1369 } | 1316 } |
| 1370 ListFactory.prototype.addLast = function(value) { | 1317 ListFactory.prototype.addLast = function(value) { |
| 1371 this.push(value); | 1318 this.push(value); |
| 1372 } | 1319 } |
| 1373 ListFactory.prototype.addAll = function(collection) { | 1320 ListFactory.prototype.addAll = function(collection) { |
| 1374 for (var $i = collection.iterator(); $i.hasNext$0(); ) { | 1321 for (var $i = collection.iterator(); $i.hasNext$0(); ) { |
| 1375 var item = $i.next$0(); | 1322 var item = $i.next$0(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1387 } | 1334 } |
| 1388 ListFactory.prototype.getRange = function(start, length) { | 1335 ListFactory.prototype.getRange = function(start, length) { |
| 1389 return this.slice(start, start + length); | 1336 return this.slice(start, start + length); |
| 1390 } | 1337 } |
| 1391 ListFactory.prototype.isEmpty = function() { | 1338 ListFactory.prototype.isEmpty = function() { |
| 1392 return this.length == 0; | 1339 return this.length == 0; |
| 1393 } | 1340 } |
| 1394 ListFactory.prototype.iterator = function() { | 1341 ListFactory.prototype.iterator = function() { |
| 1395 return new ListIterator(this); | 1342 return new ListIterator(this); |
| 1396 } | 1343 } |
| 1397 ListFactory.prototype.add$1 = ListFactory.prototype.add; | 1344 ListFactory.prototype.add$1 = function($0) { |
| 1345 return this.add($0); |
| 1346 }; |
| 1398 ListFactory.prototype.addAll$1 = function($0) { | 1347 ListFactory.prototype.addAll$1 = function($0) { |
| 1399 return this.addAll(($0 && $0.is$Collection$E())); | 1348 return this.addAll($0); |
| 1400 }; | 1349 }; |
| 1401 ListFactory.prototype.filter$1 = ListFactory.prototype.filter; | 1350 ListFactory.prototype.filter$1 = ListFactory.prototype.filter; |
| 1402 ListFactory.prototype.indexOf$2 = ListFactory.prototype.indexOf; | 1351 ListFactory.prototype.indexOf$2 = function($0, $1) { |
| 1352 return this.indexOf($0, $1); |
| 1353 }; |
| 1403 ListFactory.prototype.isEmpty$0 = function() { | 1354 ListFactory.prototype.isEmpty$0 = function() { |
| 1404 return this.isEmpty(); | 1355 return this.isEmpty(); |
| 1405 }; | 1356 }; |
| 1406 ListFactory.prototype.iterator$0 = function() { | 1357 ListFactory.prototype.iterator$0 = function() { |
| 1407 return this.iterator(); | 1358 return this.iterator(); |
| 1408 }; | 1359 }; |
| 1409 ListFactory.prototype.last$0 = function() { | 1360 ListFactory.prototype.last$0 = function() { |
| 1410 return this.last(); | 1361 return this.last(); |
| 1411 }; | 1362 }; |
| 1412 ListFactory.prototype.removeLast$0 = function() { | 1363 ListFactory.prototype.removeLast$0 = function() { |
| 1413 return this.removeLast(); | 1364 return this.removeLast(); |
| 1414 }; | 1365 }; |
| 1415 ListFactory.prototype.some$1 = ListFactory.prototype.some; | 1366 ListFactory.prototype.some$1 = ListFactory.prototype.some; |
| 1416 ListFactory.prototype.sort$1 = ListFactory.prototype.sort; | 1367 ListFactory.prototype.sort$1 = ListFactory.prototype.sort; |
| 1417 ListFactory$E = ListFactory; | 1368 ListFactory$E = ListFactory; |
| 1418 ListFactory$HBasicBlock = ListFactory; | 1369 ListFactory$HBasicBlock = ListFactory; |
| 1419 ListFactory$HInstruction = ListFactory; | 1370 ListFactory$HInstruction = ListFactory; |
| 1420 ListFactory$K = ListFactory; | 1371 ListFactory$K = ListFactory; |
| 1421 ListFactory$KeywordState = ListFactory; | 1372 ListFactory$KeywordState = ListFactory; |
| 1422 ListFactory$String = ListFactory; | 1373 ListFactory$String = ListFactory; |
| 1423 ListFactory$T = ListFactory; | 1374 ListFactory$T = ListFactory; |
| 1424 ListFactory$V = ListFactory; | 1375 ListFactory$V = ListFactory; |
| 1425 // ********** Code for ListIterator ************** | 1376 // ********** Code for ListIterator ************** |
| 1426 function ListIterator(array) { | 1377 function ListIterator(array) { |
| 1427 this._array = array; | 1378 this._array = array; |
| 1428 this._pos = 0; | 1379 this._pos = 0; |
| 1429 // Initializers done | 1380 // Initializers done |
| 1430 } | 1381 } |
| 1431 ListIterator.prototype.is$Iterator$T = function(){return this;}; | |
| 1432 ListIterator.prototype.hasNext = function() { | 1382 ListIterator.prototype.hasNext = function() { |
| 1433 return this._array.length > this._pos; | 1383 return this._array.length > this._pos; |
| 1434 } | 1384 } |
| 1435 ListIterator.prototype.next = function() { | 1385 ListIterator.prototype.next = function() { |
| 1436 if (!this.hasNext()) { | 1386 if (!this.hasNext()) { |
| 1437 $throw(const$0/*const NoMoreElementsException()*/); | 1387 $throw(const$0/*const NoMoreElementsException()*/); |
| 1438 } | 1388 } |
| 1439 return this._array.$index(this._pos++); | 1389 return this._array.$index(this._pos++); |
| 1440 } | 1390 } |
| 1441 ListIterator.prototype.hasNext$0 = function() { | 1391 ListIterator.prototype.hasNext$0 = function() { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 } | 1453 } |
| 1504 ImmutableList.prototype.addAll = function(elements) { | 1454 ImmutableList.prototype.addAll = function(elements) { |
| 1505 $throw(const$12/*const IllegalAccessException()*/); | 1455 $throw(const$12/*const IllegalAccessException()*/); |
| 1506 } | 1456 } |
| 1507 ImmutableList.prototype.clear = function() { | 1457 ImmutableList.prototype.clear = function() { |
| 1508 $throw(const$12/*const IllegalAccessException()*/); | 1458 $throw(const$12/*const IllegalAccessException()*/); |
| 1509 } | 1459 } |
| 1510 ImmutableList.prototype.removeLast = function() { | 1460 ImmutableList.prototype.removeLast = function() { |
| 1511 $throw(const$12/*const IllegalAccessException()*/); | 1461 $throw(const$12/*const IllegalAccessException()*/); |
| 1512 } | 1462 } |
| 1513 ImmutableList.prototype.add$1 = ImmutableList.prototype.add; | 1463 ImmutableList.prototype.add$1 = function($0) { |
| 1464 return this.add($0); |
| 1465 }; |
| 1514 ImmutableList.prototype.addAll$1 = function($0) { | 1466 ImmutableList.prototype.addAll$1 = function($0) { |
| 1515 return this.addAll(($0 && $0.is$Collection$E())); | 1467 return this.addAll($0); |
| 1516 }; | 1468 }; |
| 1517 ImmutableList.prototype.removeLast$0 = function() { | 1469 ImmutableList.prototype.removeLast$0 = function() { |
| 1518 return this.removeLast(); | 1470 return this.removeLast(); |
| 1519 }; | 1471 }; |
| 1520 ImmutableList.prototype.sort$1 = ImmutableList.prototype.sort; | 1472 ImmutableList.prototype.sort$1 = ImmutableList.prototype.sort; |
| 1521 // ********** Code for ImmutableMap ************** | 1473 // ********** Code for ImmutableMap ************** |
| 1522 function ImmutableMap(keyValuePairs) { | 1474 function ImmutableMap(keyValuePairs) { |
| 1523 this._internal = $map([]); | 1475 this._internal = $map([]); |
| 1524 // Initializers done | 1476 // Initializers done |
| 1525 for (var i = 0; | 1477 for (var i = 0; |
| 1526 i < keyValuePairs.length; i += 2) { | 1478 i < keyValuePairs.length; i += 2) { |
| 1527 this._internal.$setindex(keyValuePairs.$index(i), keyValuePairs.$index(i + 1
)); | 1479 this._internal.$setindex(keyValuePairs.$index(i), keyValuePairs.$index(i + 1
)); |
| 1528 } | 1480 } |
| 1529 } | 1481 } |
| 1530 ImmutableMap.prototype.is$Map$Node$Element = function(){return this;}; | |
| 1531 ImmutableMap.prototype.is$Map$String$Member = function(){return this;}; | |
| 1532 ImmutableMap.prototype.$index = function(key) { | 1482 ImmutableMap.prototype.$index = function(key) { |
| 1533 return this._internal.$index(key); | 1483 return this._internal.$index(key); |
| 1534 } | 1484 } |
| 1535 ImmutableMap.prototype.isEmpty = function() { | 1485 ImmutableMap.prototype.isEmpty = function() { |
| 1536 return this._internal.isEmpty(); | 1486 return this._internal.isEmpty(); |
| 1537 } | 1487 } |
| 1538 ImmutableMap.prototype.get$length = function() { | 1488 ImmutableMap.prototype.get$length = function() { |
| 1539 return this._internal.get$length(); | 1489 return this._internal.get$length(); |
| 1540 } | 1490 } |
| 1541 Object.defineProperty(ImmutableMap.prototype, "length", { | 1491 Object.defineProperty(ImmutableMap.prototype, "length", { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1565 // ********** Code for MatchImplementation ************** | 1515 // ********** Code for MatchImplementation ************** |
| 1566 function MatchImplementation(pattern, str, _start, _end, _groups) { | 1516 function MatchImplementation(pattern, str, _start, _end, _groups) { |
| 1567 this.pattern = pattern; | 1517 this.pattern = pattern; |
| 1568 this.str = str; | 1518 this.str = str; |
| 1569 this._start = _start; | 1519 this._start = _start; |
| 1570 this._end = _end; | 1520 this._end = _end; |
| 1571 this._groups = _groups; | 1521 this._groups = _groups; |
| 1572 // Initializers done | 1522 // Initializers done |
| 1573 } | 1523 } |
| 1574 MatchImplementation.prototype.$index = function(group) { | 1524 MatchImplementation.prototype.$index = function(group) { |
| 1575 return $assert_String(this._groups.$index(group)); | 1525 return this._groups.$index(group); |
| 1576 } | 1526 } |
| 1577 // ********** Code for NumImplementation ************** | 1527 // ********** Code for NumImplementation ************** |
| 1578 NumImplementation = Number; | 1528 NumImplementation = Number; |
| 1579 NumImplementation.prototype.is$NumImplementation = function(){return this;}; | |
| 1580 NumImplementation.prototype.is$Comparable = function(){return this;}; | |
| 1581 NumImplementation.prototype.isNaN = function() { | 1529 NumImplementation.prototype.isNaN = function() { |
| 1582 return isNaN(this); | 1530 return isNaN(this); |
| 1583 } | 1531 } |
| 1584 NumImplementation.prototype.isNegative = function() { | 1532 NumImplementation.prototype.isNegative = function() { |
| 1585 return this == 0 ? (1 / this) < 0 : this < 0; | 1533 return this == 0 ? (1 / this) < 0 : this < 0; |
| 1586 } | 1534 } |
| 1587 NumImplementation.prototype.hashCode = function() { | 1535 NumImplementation.prototype.hashCode = function() { |
| 1588 return this & 0xFFFFFFF; | 1536 return this & 0xFFFFFFF; |
| 1589 } | 1537 } |
| 1590 NumImplementation.prototype.toInt = function() { | 1538 NumImplementation.prototype.toInt = function() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1606 return -1; | 1554 return -1; |
| 1607 } | 1555 } |
| 1608 else if (thisValue > other) { | 1556 else if (thisValue > other) { |
| 1609 return 1; | 1557 return 1; |
| 1610 } | 1558 } |
| 1611 else if (thisValue == other) { | 1559 else if (thisValue == other) { |
| 1612 if (thisValue == 0) { | 1560 if (thisValue == 0) { |
| 1613 var thisIsNegative = this.isNegative(); | 1561 var thisIsNegative = this.isNegative(); |
| 1614 var otherIsNegative = other.isNegative(); | 1562 var otherIsNegative = other.isNegative(); |
| 1615 if ($eq(thisIsNegative, otherIsNegative)) return 0; | 1563 if ($eq(thisIsNegative, otherIsNegative)) return 0; |
| 1616 if ($notnull_bool(thisIsNegative)) return -1; | 1564 if (thisIsNegative) return -1; |
| 1617 return 1; | 1565 return 1; |
| 1618 } | 1566 } |
| 1619 return 0; | 1567 return 0; |
| 1620 } | 1568 } |
| 1621 else if (this.isNaN()) { | 1569 else if (this.isNaN()) { |
| 1622 if (other.isNaN()) { | 1570 if (other.isNaN()) { |
| 1623 return 0; | 1571 return 0; |
| 1624 } | 1572 } |
| 1625 return 1; | 1573 return 1; |
| 1626 } | 1574 } |
| 1627 else { | 1575 else { |
| 1628 return -1; | 1576 return -1; |
| 1629 } | 1577 } |
| 1630 } | 1578 } |
| 1631 NumImplementation.prototype.compareTo$1 = function($0) { | 1579 NumImplementation.prototype.compareTo$1 = function($0) { |
| 1632 return this.compareTo(($0 && $0.is$NumImplementation())); | 1580 return this.compareTo($0); |
| 1633 }; | 1581 }; |
| 1634 NumImplementation.prototype.hashCode$0 = function() { | 1582 NumImplementation.prototype.hashCode$0 = function() { |
| 1635 return this.hashCode(); | 1583 return this.hashCode(); |
| 1636 }; | 1584 }; |
| 1637 // ********** Code for ExceptionImplementation ************** | 1585 // ********** Code for ExceptionImplementation ************** |
| 1638 function ExceptionImplementation(_msg) { | 1586 function ExceptionImplementation(_msg) { |
| 1639 this._msg = _msg; | 1587 this._msg = _msg; |
| 1640 // Initializers done | 1588 // Initializers done |
| 1641 } | 1589 } |
| 1642 ExceptionImplementation.prototype.toString = function() { | 1590 ExceptionImplementation.prototype.toString = function() { |
| 1643 return (this._msg == null) ? "Exception" : ("Exception: " + this._msg + ""); | 1591 return (this._msg == null) ? "Exception" : ("Exception: " + this._msg + ""); |
| 1644 } | 1592 } |
| 1645 ExceptionImplementation.prototype.toString$0 = function() { | 1593 ExceptionImplementation.prototype.toString$0 = function() { |
| 1646 return this.toString(); | 1594 return this.toString(); |
| 1647 }; | 1595 }; |
| 1648 // ********** Code for HashMapImplementation ************** | 1596 // ********** Code for HashMapImplementation ************** |
| 1649 function HashMapImplementation() { | 1597 function HashMapImplementation() { |
| 1650 // Initializers done | 1598 // Initializers done |
| 1651 if (HashMapImplementation._deletedKey == null) { | 1599 if (HashMapImplementation._deletedKey == null) { |
| 1652 HashMapImplementation._deletedKey = new Object(); | 1600 HashMapImplementation._deletedKey = new Object(); |
| 1653 } | 1601 } |
| 1654 this._numberOfEntries = 0; | 1602 this._numberOfEntries = 0; |
| 1655 this._numberOfDeleted = 0; | 1603 this._numberOfDeleted = 0; |
| 1656 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 1604 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 1657 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1605 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1658 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1606 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1659 } | 1607 } |
| 1660 HashMapImplementation.prototype.is$HashMapImplementation = function(){return thi
s;}; | |
| 1661 HashMapImplementation.prototype.is$Map$Node$Element = function(){return this;}; | |
| 1662 HashMapImplementation.prototype.is$Map$String$Member = function(){return this;}; | |
| 1663 HashMapImplementation.HashMapImplementation$from$factory = function(other) { | 1608 HashMapImplementation.HashMapImplementation$from$factory = function(other) { |
| 1664 var result = new HashMapImplementation(); | 1609 var result = new HashMapImplementation(); |
| 1665 other.forEach((function (key, value) { | 1610 other.forEach((function (key, value) { |
| 1666 result.$setindex(key, value); | 1611 result.$setindex(key, value); |
| 1667 }) | 1612 }) |
| 1668 ); | 1613 ); |
| 1669 return (result && result.is$HashMapImplementation()); | 1614 return result; |
| 1670 } | 1615 } |
| 1671 HashMapImplementation._computeLoadLimit = function(capacity) { | 1616 HashMapImplementation._computeLoadLimit = function(capacity) { |
| 1672 return $truncdiv((capacity * 3), 4); | 1617 return $truncdiv((capacity * 3), 4); |
| 1673 } | 1618 } |
| 1674 HashMapImplementation._firstProbe = function(hashCode, length) { | 1619 HashMapImplementation._firstProbe = function(hashCode, length) { |
| 1675 return hashCode & (length - 1); | 1620 return hashCode & (length - 1); |
| 1676 } | 1621 } |
| 1677 HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length
) { | 1622 HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length
) { |
| 1678 return (currentProbe + numberOfProbes) & (length - 1); | 1623 return (currentProbe + numberOfProbes) & (length - 1); |
| 1679 } | 1624 } |
| 1680 HashMapImplementation.prototype._probeForAdding = function(key) { | 1625 HashMapImplementation.prototype._probeForAdding = function(key) { |
| 1681 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode$0()), th
is._keys.length); | 1626 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.leng
th); |
| 1682 var numberOfProbes = 1; | 1627 var numberOfProbes = 1; |
| 1683 var initialHash = hash; | 1628 var initialHash = hash; |
| 1684 var insertionIndex = -1; | 1629 var insertionIndex = -1; |
| 1685 while (true) { | 1630 while (true) { |
| 1686 var existingKey = this._keys.$index(hash); | 1631 var existingKey = this._keys.$index(hash); |
| 1687 if (existingKey == null) { | 1632 if (existingKey == null) { |
| 1688 if (insertionIndex < 0) return hash; | 1633 if (insertionIndex < 0) return hash; |
| 1689 return insertionIndex; | 1634 return insertionIndex; |
| 1690 } | 1635 } |
| 1691 else if ($notnull_bool($eq(existingKey, key))) { | 1636 else if ($eq(existingKey, key)) { |
| 1692 return hash; | 1637 return hash; |
| 1693 } | 1638 } |
| 1694 else if ((insertionIndex < 0) && (HashMapImplementation._deletedKey === exis
tingKey)) { | 1639 else if ((insertionIndex < 0) && (HashMapImplementation._deletedKey === exis
tingKey)) { |
| 1695 insertionIndex = hash; | 1640 insertionIndex = hash; |
| 1696 } | 1641 } |
| 1697 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); | 1642 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); |
| 1698 } | 1643 } |
| 1699 } | 1644 } |
| 1700 HashMapImplementation.prototype._probeForLookup = function(key) { | 1645 HashMapImplementation.prototype._probeForLookup = function(key) { |
| 1701 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode$0()), th
is._keys.length); | 1646 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.leng
th); |
| 1702 var numberOfProbes = 1; | 1647 var numberOfProbes = 1; |
| 1703 var initialHash = hash; | 1648 var initialHash = hash; |
| 1704 while (true) { | 1649 while (true) { |
| 1705 var existingKey = this._keys.$index(hash); | 1650 var existingKey = this._keys.$index(hash); |
| 1706 if (existingKey == null) return -1; | 1651 if (existingKey == null) return -1; |
| 1707 if ($notnull_bool($eq(existingKey, key))) return hash; | 1652 if ($eq(existingKey, key)) return hash; |
| 1708 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); | 1653 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); |
| 1709 } | 1654 } |
| 1710 } | 1655 } |
| 1711 HashMapImplementation.prototype._ensureCapacity = function() { | 1656 HashMapImplementation.prototype._ensureCapacity = function() { |
| 1712 var newNumberOfEntries = this._numberOfEntries + 1; | 1657 var newNumberOfEntries = this._numberOfEntries + 1; |
| 1713 if (newNumberOfEntries >= this._loadLimit) { | 1658 if (newNumberOfEntries >= this._loadLimit) { |
| 1714 this._grow(this._keys.length * 2); | 1659 this._grow(this._keys.length * 2); |
| 1715 return; | 1660 return; |
| 1716 } | 1661 } |
| 1717 var capacity = this._keys.length; | 1662 var capacity = this._keys.length; |
| 1718 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; | 1663 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; |
| 1719 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; | 1664 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; |
| 1720 if (this._numberOfDeleted > numberOfFree) { | 1665 if (this._numberOfDeleted > numberOfFree) { |
| 1721 this._grow(this._keys.length); | 1666 this._grow(this._keys.length); |
| 1722 } | 1667 } |
| 1723 } | 1668 } |
| 1724 HashMapImplementation._isPowerOfTwo = function(x) { | 1669 HashMapImplementation._isPowerOfTwo = function(x) { |
| 1725 return ((x & (x - 1)) == 0); | 1670 return ((x & (x - 1)) == 0); |
| 1726 } | 1671 } |
| 1727 HashMapImplementation.prototype._grow = function(newCapacity) { | 1672 HashMapImplementation.prototype._grow = function(newCapacity) { |
| 1728 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa
pacity)", "hash_map_set.dart", 153, 12); | |
| 1729 var capacity = this._keys.length; | 1673 var capacity = this._keys.length; |
| 1730 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); | 1674 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); |
| 1731 var oldKeys = this._keys; | 1675 var oldKeys = this._keys; |
| 1732 var oldValues = this._values; | 1676 var oldValues = this._values; |
| 1733 this._keys = new ListFactory(newCapacity); | 1677 this._keys = new ListFactory(newCapacity); |
| 1734 this._values = new ListFactory(newCapacity); | 1678 this._values = new ListFactory(newCapacity); |
| 1735 for (var i = 0; | 1679 for (var i = 0; |
| 1736 i < capacity; i++) { | 1680 i < capacity; i++) { |
| 1737 var key = oldKeys.$index(i); | 1681 var key = oldKeys.$index(i); |
| 1738 if (key == null || key === HashMapImplementation._deletedKey) { | 1682 if (key == null || key === HashMapImplementation._deletedKey) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 if (HashMapImplementation._deletedKey == null) { | 1766 if (HashMapImplementation._deletedKey == null) { |
| 1823 HashMapImplementation._deletedKey = new Object(); | 1767 HashMapImplementation._deletedKey = new Object(); |
| 1824 } | 1768 } |
| 1825 this._numberOfEntries = 0; | 1769 this._numberOfEntries = 0; |
| 1826 this._numberOfDeleted = 0; | 1770 this._numberOfDeleted = 0; |
| 1827 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 1771 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 1828 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1772 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1829 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1773 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1830 } | 1774 } |
| 1831 $inherits(HashMapImplementation$E$E, HashMapImplementation); | 1775 $inherits(HashMapImplementation$E$E, HashMapImplementation); |
| 1832 HashMapImplementation$E$E.prototype.is$Map$Node$Element = function(){return this
;}; | |
| 1833 HashMapImplementation$E$E.prototype.is$Map$String$Member = function(){return thi
s;}; | |
| 1834 HashMapImplementation$E$E._computeLoadLimit = function(capacity) { | 1776 HashMapImplementation$E$E._computeLoadLimit = function(capacity) { |
| 1835 return $truncdiv((capacity * 3), 4); | 1777 return $truncdiv((capacity * 3), 4); |
| 1836 } | 1778 } |
| 1837 HashMapImplementation$E$E._firstProbe = function(hashCode, length) { | 1779 HashMapImplementation$E$E._firstProbe = function(hashCode, length) { |
| 1838 return hashCode & (length - 1); | 1780 return hashCode & (length - 1); |
| 1839 } | 1781 } |
| 1840 HashMapImplementation$E$E._nextProbe = function(currentProbe, numberOfProbes, le
ngth) { | 1782 HashMapImplementation$E$E._nextProbe = function(currentProbe, numberOfProbes, le
ngth) { |
| 1841 return (currentProbe + numberOfProbes) & (length - 1); | 1783 return (currentProbe + numberOfProbes) & (length - 1); |
| 1842 } | 1784 } |
| 1843 HashMapImplementation$E$E.prototype._probeForAdding = function(key) { | 1785 HashMapImplementation$E$E.prototype._probeForAdding = function(key) { |
| 1844 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode$0()), th
is._keys.length); | 1786 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.leng
th); |
| 1845 var numberOfProbes = 1; | 1787 var numberOfProbes = 1; |
| 1846 var initialHash = hash; | 1788 var initialHash = hash; |
| 1847 var insertionIndex = -1; | 1789 var insertionIndex = -1; |
| 1848 while (true) { | 1790 while (true) { |
| 1849 var existingKey = this._keys.$index(hash); | 1791 var existingKey = this._keys.$index(hash); |
| 1850 if (existingKey == null) { | 1792 if (existingKey == null) { |
| 1851 if (insertionIndex < 0) return hash; | 1793 if (insertionIndex < 0) return hash; |
| 1852 return insertionIndex; | 1794 return insertionIndex; |
| 1853 } | 1795 } |
| 1854 else if ($notnull_bool($eq(existingKey, key))) { | 1796 else if ($eq(existingKey, key)) { |
| 1855 return hash; | 1797 return hash; |
| 1856 } | 1798 } |
| 1857 else if ((insertionIndex < 0) && (HashMapImplementation._deletedKey === exis
tingKey)) { | 1799 else if ((insertionIndex < 0) && (HashMapImplementation._deletedKey === exis
tingKey)) { |
| 1858 insertionIndex = hash; | 1800 insertionIndex = hash; |
| 1859 } | 1801 } |
| 1860 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); | 1802 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); |
| 1861 } | 1803 } |
| 1862 } | 1804 } |
| 1863 HashMapImplementation$E$E.prototype._probeForLookup = function(key) { | 1805 HashMapImplementation$E$E.prototype._probeForLookup = function(key) { |
| 1864 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode$0()), th
is._keys.length); | 1806 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.leng
th); |
| 1865 var numberOfProbes = 1; | 1807 var numberOfProbes = 1; |
| 1866 var initialHash = hash; | 1808 var initialHash = hash; |
| 1867 while (true) { | 1809 while (true) { |
| 1868 var existingKey = this._keys.$index(hash); | 1810 var existingKey = this._keys.$index(hash); |
| 1869 if (existingKey == null) return -1; | 1811 if (existingKey == null) return -1; |
| 1870 if ($notnull_bool($eq(existingKey, key))) return hash; | 1812 if ($eq(existingKey, key)) return hash; |
| 1871 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); | 1813 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); |
| 1872 } | 1814 } |
| 1873 } | 1815 } |
| 1874 HashMapImplementation$E$E.prototype._ensureCapacity = function() { | 1816 HashMapImplementation$E$E.prototype._ensureCapacity = function() { |
| 1875 var newNumberOfEntries = this._numberOfEntries + 1; | 1817 var newNumberOfEntries = this._numberOfEntries + 1; |
| 1876 if (newNumberOfEntries >= this._loadLimit) { | 1818 if (newNumberOfEntries >= this._loadLimit) { |
| 1877 this._grow(this._keys.length * 2); | 1819 this._grow(this._keys.length * 2); |
| 1878 return; | 1820 return; |
| 1879 } | 1821 } |
| 1880 var capacity = this._keys.length; | 1822 var capacity = this._keys.length; |
| 1881 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; | 1823 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; |
| 1882 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; | 1824 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; |
| 1883 if (this._numberOfDeleted > numberOfFree) { | 1825 if (this._numberOfDeleted > numberOfFree) { |
| 1884 this._grow(this._keys.length); | 1826 this._grow(this._keys.length); |
| 1885 } | 1827 } |
| 1886 } | 1828 } |
| 1887 HashMapImplementation$E$E._isPowerOfTwo = function(x) { | 1829 HashMapImplementation$E$E._isPowerOfTwo = function(x) { |
| 1888 return ((x & (x - 1)) == 0); | 1830 return ((x & (x - 1)) == 0); |
| 1889 } | 1831 } |
| 1890 HashMapImplementation$E$E.prototype._grow = function(newCapacity) { | 1832 HashMapImplementation$E$E.prototype._grow = function(newCapacity) { |
| 1891 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa
pacity)", "hash_map_set.dart", 153, 12); | |
| 1892 var capacity = this._keys.length; | 1833 var capacity = this._keys.length; |
| 1893 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); | 1834 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); |
| 1894 var oldKeys = this._keys; | 1835 var oldKeys = this._keys; |
| 1895 var oldValues = this._values; | 1836 var oldValues = this._values; |
| 1896 this._keys = new ListFactory(newCapacity); | 1837 this._keys = new ListFactory(newCapacity); |
| 1897 this._values = new ListFactory(newCapacity); | 1838 this._values = new ListFactory(newCapacity); |
| 1898 for (var i = 0; | 1839 for (var i = 0; |
| 1899 i < capacity; i++) { | 1840 i < capacity; i++) { |
| 1900 var key = oldKeys.$index(i); | 1841 var key = oldKeys.$index(i); |
| 1901 if (key == null || key === HashMapImplementation._deletedKey) { | 1842 if (key == null || key === HashMapImplementation._deletedKey) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1949 } | 1890 } |
| 1950 ); | 1891 ); |
| 1951 return list; | 1892 return list; |
| 1952 } | 1893 } |
| 1953 HashMapImplementation$E$E.prototype.containsKey = function(key) { | 1894 HashMapImplementation$E$E.prototype.containsKey = function(key) { |
| 1954 return (this._probeForLookup(key) != -1); | 1895 return (this._probeForLookup(key) != -1); |
| 1955 } | 1896 } |
| 1956 // ********** Code for HashMapImplementation$Element$HInstruction ************** | 1897 // ********** Code for HashMapImplementation$Element$HInstruction ************** |
| 1957 function HashMapImplementation$Element$HInstruction() {} | 1898 function HashMapImplementation$Element$HInstruction() {} |
| 1958 $inherits(HashMapImplementation$Element$HInstruction, HashMapImplementation); | 1899 $inherits(HashMapImplementation$Element$HInstruction, HashMapImplementation); |
| 1959 HashMapImplementation$Element$HInstruction.prototype.is$Map$Node$Element = false
; | |
| 1960 HashMapImplementation$Element$HInstruction.prototype.is$Map$String$Member = fals
e; | |
| 1961 // ********** Code for HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePa
ir$K$V ************** | 1900 // ********** Code for HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePa
ir$K$V ************** |
| 1962 function HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V() {} | 1901 function HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V() {} |
| 1963 $inherits(HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V, HashM
apImplementation); | 1902 $inherits(HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V, HashM
apImplementation); |
| 1964 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$Map
$Node$Element = false; | |
| 1965 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$Map
$String$Member = false; | |
| 1966 // ********** Code for HashMapImplementation$String$EvaluatedValue *************
* | 1903 // ********** Code for HashMapImplementation$String$EvaluatedValue *************
* |
| 1967 function HashMapImplementation$String$EvaluatedValue() {} | 1904 function HashMapImplementation$String$EvaluatedValue() {} |
| 1968 $inherits(HashMapImplementation$String$EvaluatedValue, HashMapImplementation); | 1905 $inherits(HashMapImplementation$String$EvaluatedValue, HashMapImplementation); |
| 1969 HashMapImplementation$String$EvaluatedValue.prototype.is$Map$Node$Element = fals
e; | |
| 1970 HashMapImplementation$String$EvaluatedValue.prototype.is$Map$String$Member = fal
se; | |
| 1971 // ********** Code for HashSetImplementation ************** | 1906 // ********** Code for HashSetImplementation ************** |
| 1972 function HashSetImplementation() { | 1907 function HashSetImplementation() { |
| 1973 // Initializers done | 1908 // Initializers done |
| 1974 this._backingMap = new HashMapImplementation$E$E(); | 1909 this._backingMap = new HashMapImplementation$E$E(); |
| 1975 } | 1910 } |
| 1976 HashSetImplementation.prototype.is$HashSetImplementation = function(){return thi
s;}; | |
| 1977 HashSetImplementation.prototype.is$Collection$E = function(){return this;}; | |
| 1978 HashSetImplementation.prototype.is$Collection$Object = function(){return this;}; | |
| 1979 HashSetImplementation.prototype.is$Collection$Type = function(){return this;}; | |
| 1980 HashSetImplementation.prototype.is$Iterable = function(){return this;}; | |
| 1981 HashSetImplementation.HashSetImplementation$from$factory = function(other) { | 1911 HashSetImplementation.HashSetImplementation$from$factory = function(other) { |
| 1982 var set = new HashSetImplementation(); | 1912 var set = new HashSetImplementation(); |
| 1983 for (var $i = other.iterator(); $i.hasNext$0(); ) { | 1913 for (var $i = other.iterator(); $i.hasNext$0(); ) { |
| 1984 var e = $i.next$0(); | 1914 var e = $i.next$0(); |
| 1985 set.add(e); | 1915 set.add(e); |
| 1986 } | 1916 } |
| 1987 return (set && set.is$HashSetImplementation()); | 1917 return set; |
| 1988 } | 1918 } |
| 1989 HashSetImplementation.prototype.add = function(value) { | 1919 HashSetImplementation.prototype.add = function(value) { |
| 1990 this._backingMap.$setindex(value, value); | 1920 this._backingMap.$setindex(value, value); |
| 1991 } | 1921 } |
| 1992 HashSetImplementation.prototype.contains = function(value) { | 1922 HashSetImplementation.prototype.contains = function(value) { |
| 1993 return this._backingMap.containsKey(value); | 1923 return this._backingMap.containsKey(value); |
| 1994 } | 1924 } |
| 1995 HashSetImplementation.prototype.remove = function(value) { | 1925 HashSetImplementation.prototype.remove = function(value) { |
| 1996 if (!this._backingMap.containsKey(value)) return false; | 1926 if (!this._backingMap.containsKey(value)) return false; |
| 1997 this._backingMap.remove(value); | 1927 this._backingMap.remove(value); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2013 HashSetImplementation.prototype.filter = function(f) { | 1943 HashSetImplementation.prototype.filter = function(f) { |
| 2014 var result = new HashSetImplementation(); | 1944 var result = new HashSetImplementation(); |
| 2015 this._backingMap.forEach(function _(key, value) { | 1945 this._backingMap.forEach(function _(key, value) { |
| 2016 if (f(key)) result.add(key); | 1946 if (f(key)) result.add(key); |
| 2017 } | 1947 } |
| 2018 ); | 1948 ); |
| 2019 return result; | 1949 return result; |
| 2020 } | 1950 } |
| 2021 HashSetImplementation.prototype.some = function(f) { | 1951 HashSetImplementation.prototype.some = function(f) { |
| 2022 var keys = this._backingMap.getKeys(); | 1952 var keys = this._backingMap.getKeys(); |
| 2023 return $assert_bool(keys.some(f)); | 1953 return keys.some(f); |
| 2024 } | 1954 } |
| 2025 HashSetImplementation.prototype.isEmpty = function() { | 1955 HashSetImplementation.prototype.isEmpty = function() { |
| 2026 return this._backingMap.isEmpty(); | 1956 return this._backingMap.isEmpty(); |
| 2027 } | 1957 } |
| 2028 HashSetImplementation.prototype.get$length = function() { | 1958 HashSetImplementation.prototype.get$length = function() { |
| 2029 return this._backingMap.get$length(); | 1959 return this._backingMap.get$length(); |
| 2030 } | 1960 } |
| 2031 Object.defineProperty(HashSetImplementation.prototype, "length", { | 1961 Object.defineProperty(HashSetImplementation.prototype, "length", { |
| 2032 get: HashSetImplementation.prototype.get$length | 1962 get: HashSetImplementation.prototype.get$length |
| 2033 }); | 1963 }); |
| 2034 HashSetImplementation.prototype.iterator = function() { | 1964 HashSetImplementation.prototype.iterator = function() { |
| 2035 return new HashSetIterator$E(this); | 1965 return new HashSetIterator$E(this); |
| 2036 } | 1966 } |
| 2037 HashSetImplementation.prototype.add$1 = HashSetImplementation.prototype.add; | 1967 HashSetImplementation.prototype.add$1 = function($0) { |
| 1968 return this.add($0); |
| 1969 }; |
| 2038 HashSetImplementation.prototype.addAll$1 = function($0) { | 1970 HashSetImplementation.prototype.addAll$1 = function($0) { |
| 2039 return this.addAll(($0 && $0.is$Collection$E())); | 1971 return this.addAll($0); |
| 2040 }; | 1972 }; |
| 2041 HashSetImplementation.prototype.contains$1 = HashSetImplementation.prototype.con
tains; | 1973 HashSetImplementation.prototype.contains$1 = function($0) { |
| 1974 return this.contains($0); |
| 1975 }; |
| 2042 HashSetImplementation.prototype.filter$1 = HashSetImplementation.prototype.filte
r; | 1976 HashSetImplementation.prototype.filter$1 = HashSetImplementation.prototype.filte
r; |
| 2043 HashSetImplementation.prototype.isEmpty$0 = function() { | 1977 HashSetImplementation.prototype.isEmpty$0 = function() { |
| 2044 return this.isEmpty(); | 1978 return this.isEmpty(); |
| 2045 }; | 1979 }; |
| 2046 HashSetImplementation.prototype.iterator$0 = function() { | 1980 HashSetImplementation.prototype.iterator$0 = function() { |
| 2047 return this.iterator(); | 1981 return this.iterator(); |
| 2048 }; | 1982 }; |
| 2049 HashSetImplementation.prototype.some$1 = HashSetImplementation.prototype.some; | 1983 HashSetImplementation.prototype.some$1 = HashSetImplementation.prototype.some; |
| 2050 // ********** Code for HashSetImplementation$E ************** | 1984 // ********** Code for HashSetImplementation$E ************** |
| 2051 function HashSetImplementation$E() {} | 1985 function HashSetImplementation$E() {} |
| 2052 $inherits(HashSetImplementation$E, HashSetImplementation); | 1986 $inherits(HashSetImplementation$E, HashSetImplementation); |
| 2053 HashSetImplementation$E.prototype.is$Collection$E = function(){return this;}; | |
| 2054 HashSetImplementation$E.prototype.is$Collection$Object = function(){return this;
}; | |
| 2055 HashSetImplementation$E.prototype.is$Collection$Type = function(){return this;}; | |
| 2056 HashSetImplementation$E.prototype.is$Iterable = function(){return this;}; | |
| 2057 // ********** Code for HashSetImplementation$String ************** | 1987 // ********** Code for HashSetImplementation$String ************** |
| 2058 function HashSetImplementation$String() {} | 1988 function HashSetImplementation$String() {} |
| 2059 $inherits(HashSetImplementation$String, HashSetImplementation); | 1989 $inherits(HashSetImplementation$String, HashSetImplementation); |
| 2060 HashSetImplementation$String.prototype.is$Collection$E = function(){return this;
}; | |
| 2061 HashSetImplementation$String.prototype.is$Collection$Object = function(){return
this;}; | |
| 2062 HashSetImplementation$String.prototype.is$Collection$Type = false; | |
| 2063 HashSetImplementation$String.prototype.is$Iterable = function(){return this;}; | |
| 2064 // ********** Code for HashSetImplementation$Type ************** | 1990 // ********** Code for HashSetImplementation$Type ************** |
| 2065 function HashSetImplementation$Type() {} | 1991 function HashSetImplementation$Type() {} |
| 2066 $inherits(HashSetImplementation$Type, HashSetImplementation); | 1992 $inherits(HashSetImplementation$Type, HashSetImplementation); |
| 2067 HashSetImplementation$Type.prototype.is$Collection$E = function(){return this;}; | |
| 2068 HashSetImplementation$Type.prototype.is$Collection$Object = function(){return th
is;}; | |
| 2069 HashSetImplementation$Type.prototype.is$Collection$Type = function(){return this
;}; | |
| 2070 HashSetImplementation$Type.prototype.is$Iterable = function(){return this;}; | |
| 2071 // ********** Code for HashSetIterator ************** | 1993 // ********** Code for HashSetIterator ************** |
| 2072 function HashSetIterator(set_) { | 1994 function HashSetIterator(set_) { |
| 2073 this._nextValidIndex = -1; | 1995 this._nextValidIndex = -1; |
| 2074 this._entries = set_._backingMap._keys; | 1996 this._entries = set_._backingMap._keys; |
| 2075 // Initializers done | 1997 // Initializers done |
| 2076 this._advance(); | 1998 this._advance(); |
| 2077 } | 1999 } |
| 2078 HashSetIterator.prototype.is$Iterator$T = function(){return this;}; | |
| 2079 HashSetIterator.prototype.hasNext = function() { | 2000 HashSetIterator.prototype.hasNext = function() { |
| 2080 if (this._nextValidIndex >= this._entries.length) return false; | 2001 if (this._nextValidIndex >= this._entries.length) return false; |
| 2081 if (this._entries.$index(this._nextValidIndex) === HashMapImplementation._dele
tedKey) { | 2002 if (this._entries.$index(this._nextValidIndex) === HashMapImplementation._dele
tedKey) { |
| 2082 this._advance(); | 2003 this._advance(); |
| 2083 } | 2004 } |
| 2084 return this._nextValidIndex < this._entries.length; | 2005 return this._nextValidIndex < this._entries.length; |
| 2085 } | 2006 } |
| 2086 HashSetIterator.prototype.next = function() { | 2007 HashSetIterator.prototype.next = function() { |
| 2087 if (!this.hasNext()) { | 2008 if (!this.hasNext()) { |
| 2088 $throw(const$0/*const NoMoreElementsException()*/); | 2009 $throw(const$0/*const NoMoreElementsException()*/); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2108 return this.next(); | 2029 return this.next(); |
| 2109 }; | 2030 }; |
| 2110 // ********** Code for HashSetIterator$E ************** | 2031 // ********** Code for HashSetIterator$E ************** |
| 2111 function HashSetIterator$E(set_) { | 2032 function HashSetIterator$E(set_) { |
| 2112 this._nextValidIndex = -1; | 2033 this._nextValidIndex = -1; |
| 2113 this._entries = set_._backingMap._keys; | 2034 this._entries = set_._backingMap._keys; |
| 2114 // Initializers done | 2035 // Initializers done |
| 2115 this._advance(); | 2036 this._advance(); |
| 2116 } | 2037 } |
| 2117 $inherits(HashSetIterator$E, HashSetIterator); | 2038 $inherits(HashSetIterator$E, HashSetIterator); |
| 2118 HashSetIterator$E.prototype.is$Iterator$T = function(){return this;}; | |
| 2119 HashSetIterator$E.prototype._advance = function() { | 2039 HashSetIterator$E.prototype._advance = function() { |
| 2120 var length = this._entries.length; | 2040 var length = this._entries.length; |
| 2121 var entry; | 2041 var entry; |
| 2122 var deletedKey = HashMapImplementation._deletedKey; | 2042 var deletedKey = HashMapImplementation._deletedKey; |
| 2123 do { | 2043 do { |
| 2124 if (++this._nextValidIndex >= length) break; | 2044 if (++this._nextValidIndex >= length) break; |
| 2125 entry = this._entries.$index(this._nextValidIndex); | 2045 entry = this._entries.$index(this._nextValidIndex); |
| 2126 } | 2046 } |
| 2127 while ((entry == null) || (entry === deletedKey)) | 2047 while ((entry == null) || (entry === deletedKey)) |
| 2128 } | 2048 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2140 this.value = value; | 2060 this.value = value; |
| 2141 // Initializers done | 2061 // Initializers done |
| 2142 } | 2062 } |
| 2143 $inherits(KeyValuePair$K$V, KeyValuePair); | 2063 $inherits(KeyValuePair$K$V, KeyValuePair); |
| 2144 // ********** Code for LinkedHashMapImplementation ************** | 2064 // ********** Code for LinkedHashMapImplementation ************** |
| 2145 function LinkedHashMapImplementation() { | 2065 function LinkedHashMapImplementation() { |
| 2146 // Initializers done | 2066 // Initializers done |
| 2147 this._map = new HashMapImplementation(); | 2067 this._map = new HashMapImplementation(); |
| 2148 this._list = new DoubleLinkedQueue$KeyValuePair$K$V(); | 2068 this._list = new DoubleLinkedQueue$KeyValuePair$K$V(); |
| 2149 } | 2069 } |
| 2150 LinkedHashMapImplementation.prototype.is$Map$Node$Element = function(){return th
is;}; | |
| 2151 LinkedHashMapImplementation.prototype.is$Map$String$Member = function(){return t
his;}; | |
| 2152 LinkedHashMapImplementation.prototype.$setindex = function(key, value) { | 2070 LinkedHashMapImplementation.prototype.$setindex = function(key, value) { |
| 2153 if (this._map.containsKey(key)) { | 2071 if (this._map.containsKey(key)) { |
| 2154 this._map.$index(key).get$element().value = value; | 2072 this._map.$index(key).get$element().value = value; |
| 2155 } | 2073 } |
| 2156 else { | 2074 else { |
| 2157 this._list.addLast(new KeyValuePair$K$V(key, value)); | 2075 this._list.addLast(new KeyValuePair$K$V(key, value)); |
| 2158 this._map.$setindex(key, this._list.lastEntry()); | 2076 this._map.$setindex(key, this._list.lastEntry()); |
| 2159 } | 2077 } |
| 2160 } | 2078 } |
| 2161 LinkedHashMapImplementation.prototype.$index = function(key) { | 2079 LinkedHashMapImplementation.prototype.$index = function(key) { |
| 2162 var $0; | 2080 var entry = this._map.$index(key); |
| 2163 var entry = (($0 = this._map.$index(key)) && $0.is$DoubleLinkedQueueEntry$KeyV
aluePair$K$V()); | |
| 2164 if (entry == null) return null; | 2081 if (entry == null) return null; |
| 2165 return entry.get$element().get$value(); | 2082 return entry.get$element().get$value(); |
| 2166 } | 2083 } |
| 2167 LinkedHashMapImplementation.prototype.getKeys = function() { | 2084 LinkedHashMapImplementation.prototype.getKeys = function() { |
| 2168 var list = new ListFactory(this.get$length()); | 2085 var list = new ListFactory(this.get$length()); |
| 2169 var index = 0; | 2086 var index = 0; |
| 2170 this._list.forEach(function _(entry) { | 2087 this._list.forEach(function _(entry) { |
| 2171 list.$setindex(index++, entry.key); | 2088 list.$setindex(index++, entry.key); |
| 2172 } | 2089 } |
| 2173 ); | 2090 ); |
| 2174 $assert(index == this.get$length(), "index == length", "linked_hash_map.dart",
75, 12); | |
| 2175 return list; | 2091 return list; |
| 2176 } | 2092 } |
| 2177 LinkedHashMapImplementation.prototype.getValues = function() { | 2093 LinkedHashMapImplementation.prototype.getValues = function() { |
| 2178 var list = new ListFactory(this.get$length()); | 2094 var list = new ListFactory(this.get$length()); |
| 2179 var index = 0; | 2095 var index = 0; |
| 2180 this._list.forEach(function _(entry) { | 2096 this._list.forEach(function _(entry) { |
| 2181 list.$setindex(index++, entry.value); | 2097 list.$setindex(index++, entry.value); |
| 2182 } | 2098 } |
| 2183 ); | 2099 ); |
| 2184 $assert(index == this.get$length(), "index == length", "linked_hash_map.dart",
86, 12); | |
| 2185 return list; | 2100 return list; |
| 2186 } | 2101 } |
| 2187 LinkedHashMapImplementation.prototype.forEach = function(f) { | 2102 LinkedHashMapImplementation.prototype.forEach = function(f) { |
| 2188 this._list.forEach(function _(entry) { | 2103 this._list.forEach(function _(entry) { |
| 2189 f(entry.key, entry.value); | 2104 f(entry.key, entry.value); |
| 2190 } | 2105 } |
| 2191 ); | 2106 ); |
| 2192 } | 2107 } |
| 2193 LinkedHashMapImplementation.prototype.containsKey = function(key) { | 2108 LinkedHashMapImplementation.prototype.containsKey = function(key) { |
| 2194 return this._map.containsKey(key); | 2109 return this._map.containsKey(key); |
| 2195 } | 2110 } |
| 2196 LinkedHashMapImplementation.prototype.get$length = function() { | 2111 LinkedHashMapImplementation.prototype.get$length = function() { |
| 2197 return this._map.get$length(); | 2112 return this._map.get$length(); |
| 2198 } | 2113 } |
| 2199 Object.defineProperty(LinkedHashMapImplementation.prototype, "length", { | 2114 Object.defineProperty(LinkedHashMapImplementation.prototype, "length", { |
| 2200 get: LinkedHashMapImplementation.prototype.get$length | 2115 get: LinkedHashMapImplementation.prototype.get$length |
| 2201 }); | 2116 }); |
| 2202 LinkedHashMapImplementation.prototype.isEmpty = function() { | 2117 LinkedHashMapImplementation.prototype.isEmpty = function() { |
| 2203 return this.get$length() == 0; | 2118 return this.get$length() == 0; |
| 2204 } | 2119 } |
| 2205 LinkedHashMapImplementation.prototype.getKeys$0 = function() { | 2120 LinkedHashMapImplementation.prototype.getKeys$0 = function() { |
| 2206 return this.getKeys(); | 2121 return this.getKeys(); |
| 2207 }; | 2122 }; |
| 2208 LinkedHashMapImplementation.prototype.isEmpty$0 = function() { | 2123 LinkedHashMapImplementation.prototype.isEmpty$0 = function() { |
| 2209 return this.isEmpty(); | 2124 return this.isEmpty(); |
| 2210 }; | 2125 }; |
| 2211 // ********** Code for LinkedHashMapImplementation$Node$Element ************** | 2126 // ********** Code for LinkedHashMapImplementation$Node$Element ************** |
| 2212 function LinkedHashMapImplementation$Node$Element() {} | 2127 function LinkedHashMapImplementation$Node$Element() {} |
| 2213 $inherits(LinkedHashMapImplementation$Node$Element, LinkedHashMapImplementation)
; | 2128 $inherits(LinkedHashMapImplementation$Node$Element, LinkedHashMapImplementation)
; |
| 2214 LinkedHashMapImplementation$Node$Element.prototype.is$Map$Node$Element = functio
n(){return this;}; | |
| 2215 LinkedHashMapImplementation$Node$Element.prototype.is$Map$String$Member = false; | |
| 2216 // ********** Code for LinkedHashMapImplementation$String$Keyword ************** | 2129 // ********** Code for LinkedHashMapImplementation$String$Keyword ************** |
| 2217 function LinkedHashMapImplementation$String$Keyword() {} | 2130 function LinkedHashMapImplementation$String$Keyword() {} |
| 2218 $inherits(LinkedHashMapImplementation$String$Keyword, LinkedHashMapImplementatio
n); | 2131 $inherits(LinkedHashMapImplementation$String$Keyword, LinkedHashMapImplementatio
n); |
| 2219 LinkedHashMapImplementation$String$Keyword.prototype.is$Map$Node$Element = false
; | |
| 2220 LinkedHashMapImplementation$String$Keyword.prototype.is$Map$String$Member = fals
e; | |
| 2221 // ********** Code for DoubleLinkedQueueEntry ************** | 2132 // ********** Code for DoubleLinkedQueueEntry ************** |
| 2222 function DoubleLinkedQueueEntry(e) { | 2133 function DoubleLinkedQueueEntry(e) { |
| 2223 // Initializers done | 2134 // Initializers done |
| 2224 this._element = e; | 2135 this._element = e; |
| 2225 } | 2136 } |
| 2226 DoubleLinkedQueueEntry.prototype.is$DoubleLinkedQueueEntry$KeyValuePair$K$V = fu
nction(){return this;}; | |
| 2227 DoubleLinkedQueueEntry.prototype._link = function(p, n) { | 2137 DoubleLinkedQueueEntry.prototype._link = function(p, n) { |
| 2228 this._next = n; | 2138 this._next = n; |
| 2229 this._previous = p; | 2139 this._previous = p; |
| 2230 p._next = this; | 2140 p._next = this; |
| 2231 n._previous = this; | 2141 n._previous = this; |
| 2232 } | 2142 } |
| 2233 DoubleLinkedQueueEntry.prototype.prepend = function(e) { | 2143 DoubleLinkedQueueEntry.prototype.prepend = function(e) { |
| 2234 new DoubleLinkedQueueEntry$E(e)._link(this._previous, this); | 2144 new DoubleLinkedQueueEntry$E(e)._link(this._previous, this); |
| 2235 } | 2145 } |
| 2236 DoubleLinkedQueueEntry.prototype.remove = function() { | 2146 DoubleLinkedQueueEntry.prototype.remove = function() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2248 } | 2158 } |
| 2249 DoubleLinkedQueueEntry.prototype.get$element = function() { | 2159 DoubleLinkedQueueEntry.prototype.get$element = function() { |
| 2250 return this._element; | 2160 return this._element; |
| 2251 } | 2161 } |
| 2252 // ********** Code for DoubleLinkedQueueEntry$E ************** | 2162 // ********** Code for DoubleLinkedQueueEntry$E ************** |
| 2253 function DoubleLinkedQueueEntry$E(e) { | 2163 function DoubleLinkedQueueEntry$E(e) { |
| 2254 // Initializers done | 2164 // Initializers done |
| 2255 this._element = e; | 2165 this._element = e; |
| 2256 } | 2166 } |
| 2257 $inherits(DoubleLinkedQueueEntry$E, DoubleLinkedQueueEntry); | 2167 $inherits(DoubleLinkedQueueEntry$E, DoubleLinkedQueueEntry); |
| 2258 DoubleLinkedQueueEntry$E.prototype.is$DoubleLinkedQueueEntry$KeyValuePair$K$V =
function(){return this;}; | |
| 2259 DoubleLinkedQueueEntry$E.prototype._link = function(p, n) { | 2168 DoubleLinkedQueueEntry$E.prototype._link = function(p, n) { |
| 2260 this._next = n; | 2169 this._next = n; |
| 2261 this._previous = p; | 2170 this._previous = p; |
| 2262 p._next = this; | 2171 p._next = this; |
| 2263 n._previous = this; | 2172 n._previous = this; |
| 2264 } | 2173 } |
| 2265 DoubleLinkedQueueEntry$E.prototype.prepend = function(e) { | 2174 DoubleLinkedQueueEntry$E.prototype.prepend = function(e) { |
| 2266 new DoubleLinkedQueueEntry$E(e)._link(this._previous, this); | 2175 new DoubleLinkedQueueEntry$E(e)._link(this._previous, this); |
| 2267 } | 2176 } |
| 2268 DoubleLinkedQueueEntry$E.prototype.remove = function() { | 2177 DoubleLinkedQueueEntry$E.prototype.remove = function() { |
| 2269 this._previous._next = this._next; | 2178 this._previous._next = this._next; |
| 2270 this._next._previous = this._previous; | 2179 this._next._previous = this._previous; |
| 2271 this._next = null; | 2180 this._next = null; |
| 2272 this._previous = null; | 2181 this._previous = null; |
| 2273 return this._element; | 2182 return this._element; |
| 2274 } | 2183 } |
| 2275 DoubleLinkedQueueEntry$E.prototype._asNonSentinelEntry = function() { | 2184 DoubleLinkedQueueEntry$E.prototype._asNonSentinelEntry = function() { |
| 2276 return this; | 2185 return this; |
| 2277 } | 2186 } |
| 2278 DoubleLinkedQueueEntry$E.prototype.previousEntry = function() { | 2187 DoubleLinkedQueueEntry$E.prototype.previousEntry = function() { |
| 2279 return this._previous._asNonSentinelEntry(); | 2188 return this._previous._asNonSentinelEntry(); |
| 2280 } | 2189 } |
| 2281 // ********** Code for DoubleLinkedQueueEntry$KeyValuePair$K$V ************** | 2190 // ********** Code for DoubleLinkedQueueEntry$KeyValuePair$K$V ************** |
| 2282 function DoubleLinkedQueueEntry$KeyValuePair$K$V(e) { | 2191 function DoubleLinkedQueueEntry$KeyValuePair$K$V(e) { |
| 2283 // Initializers done | 2192 // Initializers done |
| 2284 this._element = e; | 2193 this._element = e; |
| 2285 } | 2194 } |
| 2286 $inherits(DoubleLinkedQueueEntry$KeyValuePair$K$V, DoubleLinkedQueueEntry); | 2195 $inherits(DoubleLinkedQueueEntry$KeyValuePair$K$V, DoubleLinkedQueueEntry); |
| 2287 DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$DoubleLinkedQueueEntry$KeyV
aluePair$K$V = function(){return this;}; | |
| 2288 DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype._asNonSentinelEntry = function
() { | 2196 DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype._asNonSentinelEntry = function
() { |
| 2289 return this; | 2197 return this; |
| 2290 } | 2198 } |
| 2291 // ********** Code for _DoubleLinkedQueueEntrySentinel ************** | 2199 // ********** Code for _DoubleLinkedQueueEntrySentinel ************** |
| 2292 function _DoubleLinkedQueueEntrySentinel() { | 2200 function _DoubleLinkedQueueEntrySentinel() { |
| 2293 DoubleLinkedQueueEntry$E.call(this, null); | 2201 DoubleLinkedQueueEntry$E.call(this, null); |
| 2294 // Initializers done | 2202 // Initializers done |
| 2295 this._link(this, this); | 2203 this._link(this, this); |
| 2296 } | 2204 } |
| 2297 $inherits(_DoubleLinkedQueueEntrySentinel, DoubleLinkedQueueEntry$E); | 2205 $inherits(_DoubleLinkedQueueEntrySentinel, DoubleLinkedQueueEntry$E); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2333 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype._link = function(p, n
) { | 2241 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype._link = function(p, n
) { |
| 2334 this._next = n; | 2242 this._next = n; |
| 2335 this._previous = p; | 2243 this._previous = p; |
| 2336 p._next = this; | 2244 p._next = this; |
| 2337 n._previous = this; | 2245 n._previous = this; |
| 2338 } | 2246 } |
| 2339 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype.prepend = function(e)
{ | 2247 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype.prepend = function(e)
{ |
| 2340 new DoubleLinkedQueueEntry$KeyValuePair$K$V(e)._link(this._previous, this); | 2248 new DoubleLinkedQueueEntry$KeyValuePair$K$V(e)._link(this._previous, this); |
| 2341 } | 2249 } |
| 2342 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype.previousEntry = funct
ion() { | 2250 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype.previousEntry = funct
ion() { |
| 2343 var $0; | 2251 return this._previous._asNonSentinelEntry(); |
| 2344 return (($0 = this._previous._asNonSentinelEntry()) && $0.is$DoubleLinkedQueue
Entry$KeyValuePair$K$V()); | |
| 2345 } | 2252 } |
| 2346 // ********** Code for DoubleLinkedQueue ************** | 2253 // ********** Code for DoubleLinkedQueue ************** |
| 2347 function DoubleLinkedQueue() { | 2254 function DoubleLinkedQueue() { |
| 2348 // Initializers done | 2255 // Initializers done |
| 2349 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); | 2256 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); |
| 2350 } | 2257 } |
| 2351 DoubleLinkedQueue.prototype.is$Collection$E = function(){return this;}; | |
| 2352 DoubleLinkedQueue.prototype.is$Collection$Object = function(){return this;}; | |
| 2353 DoubleLinkedQueue.prototype.is$Collection$Type = function(){return this;}; | |
| 2354 DoubleLinkedQueue.prototype.is$Iterable = function(){return this;}; | |
| 2355 DoubleLinkedQueue.prototype.addLast = function(value) { | 2258 DoubleLinkedQueue.prototype.addLast = function(value) { |
| 2356 this._sentinel.prepend(value); | 2259 this._sentinel.prepend(value); |
| 2357 } | 2260 } |
| 2358 DoubleLinkedQueue.prototype.add = function(value) { | 2261 DoubleLinkedQueue.prototype.add = function(value) { |
| 2359 this.addLast(value); | 2262 this.addLast(value); |
| 2360 } | 2263 } |
| 2361 DoubleLinkedQueue.prototype.addAll = function(collection) { | 2264 DoubleLinkedQueue.prototype.addAll = function(collection) { |
| 2362 for (var $i = collection.iterator(); $i.hasNext$0(); ) { | 2265 for (var $i = collection.iterator(); $i.hasNext$0(); ) { |
| 2363 var e = $i.next$0(); | 2266 var e = $i.next$0(); |
| 2364 this.add(e); | 2267 this.add(e); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2413 while (entry !== this._sentinel) { | 2316 while (entry !== this._sentinel) { |
| 2414 var nextEntry = entry._next; | 2317 var nextEntry = entry._next; |
| 2415 if (f(entry._element)) other.addLast(entry._element); | 2318 if (f(entry._element)) other.addLast(entry._element); |
| 2416 entry = nextEntry; | 2319 entry = nextEntry; |
| 2417 } | 2320 } |
| 2418 return other; | 2321 return other; |
| 2419 } | 2322 } |
| 2420 DoubleLinkedQueue.prototype.iterator = function() { | 2323 DoubleLinkedQueue.prototype.iterator = function() { |
| 2421 return new _DoubleLinkedQueueIterator$E(this._sentinel); | 2324 return new _DoubleLinkedQueueIterator$E(this._sentinel); |
| 2422 } | 2325 } |
| 2423 DoubleLinkedQueue.prototype.add$1 = DoubleLinkedQueue.prototype.add; | 2326 DoubleLinkedQueue.prototype.add$1 = function($0) { |
| 2327 return this.add($0); |
| 2328 }; |
| 2424 DoubleLinkedQueue.prototype.addAll$1 = function($0) { | 2329 DoubleLinkedQueue.prototype.addAll$1 = function($0) { |
| 2425 return this.addAll(($0 && $0.is$Collection$E())); | 2330 return this.addAll($0); |
| 2426 }; | 2331 }; |
| 2427 DoubleLinkedQueue.prototype.filter$1 = DoubleLinkedQueue.prototype.filter; | 2332 DoubleLinkedQueue.prototype.filter$1 = DoubleLinkedQueue.prototype.filter; |
| 2428 DoubleLinkedQueue.prototype.isEmpty$0 = function() { | 2333 DoubleLinkedQueue.prototype.isEmpty$0 = function() { |
| 2429 return this.isEmpty(); | 2334 return this.isEmpty(); |
| 2430 }; | 2335 }; |
| 2431 DoubleLinkedQueue.prototype.iterator$0 = function() { | 2336 DoubleLinkedQueue.prototype.iterator$0 = function() { |
| 2432 return this.iterator(); | 2337 return this.iterator(); |
| 2433 }; | 2338 }; |
| 2434 DoubleLinkedQueue.prototype.last$0 = function() { | 2339 DoubleLinkedQueue.prototype.last$0 = function() { |
| 2435 return this.last(); | 2340 return this.last(); |
| 2436 }; | 2341 }; |
| 2437 DoubleLinkedQueue.prototype.removeLast$0 = function() { | 2342 DoubleLinkedQueue.prototype.removeLast$0 = function() { |
| 2438 return this.removeLast(); | 2343 return this.removeLast(); |
| 2439 }; | 2344 }; |
| 2440 DoubleLinkedQueue.prototype.some$1 = DoubleLinkedQueue.prototype.some; | 2345 DoubleLinkedQueue.prototype.some$1 = DoubleLinkedQueue.prototype.some; |
| 2441 // ********** Code for DoubleLinkedQueue$ClassElement ************** | 2346 // ********** Code for DoubleLinkedQueue$ClassElement ************** |
| 2442 function DoubleLinkedQueue$ClassElement() {} | 2347 function DoubleLinkedQueue$ClassElement() {} |
| 2443 $inherits(DoubleLinkedQueue$ClassElement, DoubleLinkedQueue); | 2348 $inherits(DoubleLinkedQueue$ClassElement, DoubleLinkedQueue); |
| 2444 DoubleLinkedQueue$ClassElement.prototype.is$Collection$E = function(){return thi
s;}; | |
| 2445 DoubleLinkedQueue$ClassElement.prototype.is$Collection$Object = function(){retur
n this;}; | |
| 2446 DoubleLinkedQueue$ClassElement.prototype.is$Collection$Type = false; | |
| 2447 DoubleLinkedQueue$ClassElement.prototype.is$Iterable = function(){return this;}; | |
| 2448 // ********** Code for DoubleLinkedQueue$E ************** | 2349 // ********** Code for DoubleLinkedQueue$E ************** |
| 2449 function DoubleLinkedQueue$E() {} | 2350 function DoubleLinkedQueue$E() {} |
| 2450 $inherits(DoubleLinkedQueue$E, DoubleLinkedQueue); | 2351 $inherits(DoubleLinkedQueue$E, DoubleLinkedQueue); |
| 2451 DoubleLinkedQueue$E.prototype.is$Collection$E = function(){return this;}; | |
| 2452 DoubleLinkedQueue$E.prototype.is$Collection$Object = function(){return this;}; | |
| 2453 DoubleLinkedQueue$E.prototype.is$Collection$Type = function(){return this;}; | |
| 2454 DoubleLinkedQueue$E.prototype.is$Iterable = function(){return this;}; | |
| 2455 // ********** Code for DoubleLinkedQueue$Element ************** | 2352 // ********** Code for DoubleLinkedQueue$Element ************** |
| 2456 function DoubleLinkedQueue$Element() {} | 2353 function DoubleLinkedQueue$Element() {} |
| 2457 $inherits(DoubleLinkedQueue$Element, DoubleLinkedQueue); | 2354 $inherits(DoubleLinkedQueue$Element, DoubleLinkedQueue); |
| 2458 DoubleLinkedQueue$Element.prototype.is$Collection$E = function(){return this;}; | |
| 2459 DoubleLinkedQueue$Element.prototype.is$Collection$Object = function(){return thi
s;}; | |
| 2460 DoubleLinkedQueue$Element.prototype.is$Collection$Type = false; | |
| 2461 DoubleLinkedQueue$Element.prototype.is$Iterable = function(){return this;}; | |
| 2462 // ********** Code for DoubleLinkedQueue$KeyValuePair$K$V ************** | 2355 // ********** Code for DoubleLinkedQueue$KeyValuePair$K$V ************** |
| 2463 function DoubleLinkedQueue$KeyValuePair$K$V() { | 2356 function DoubleLinkedQueue$KeyValuePair$K$V() { |
| 2464 // Initializers done | 2357 // Initializers done |
| 2465 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V(); | 2358 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V(); |
| 2466 } | 2359 } |
| 2467 $inherits(DoubleLinkedQueue$KeyValuePair$K$V, DoubleLinkedQueue); | 2360 $inherits(DoubleLinkedQueue$KeyValuePair$K$V, DoubleLinkedQueue); |
| 2468 DoubleLinkedQueue$KeyValuePair$K$V.prototype.is$Collection$E = function(){return
this;}; | |
| 2469 DoubleLinkedQueue$KeyValuePair$K$V.prototype.is$Collection$Object = function(){r
eturn this;}; | |
| 2470 DoubleLinkedQueue$KeyValuePair$K$V.prototype.is$Collection$Type = false; | |
| 2471 DoubleLinkedQueue$KeyValuePair$K$V.prototype.is$Iterable = function(){return thi
s;}; | |
| 2472 DoubleLinkedQueue$KeyValuePair$K$V.prototype.addLast = function(value) { | 2361 DoubleLinkedQueue$KeyValuePair$K$V.prototype.addLast = function(value) { |
| 2473 this._sentinel.prepend(value); | 2362 this._sentinel.prepend(value); |
| 2474 } | 2363 } |
| 2475 DoubleLinkedQueue$KeyValuePair$K$V.prototype.lastEntry = function() { | 2364 DoubleLinkedQueue$KeyValuePair$K$V.prototype.lastEntry = function() { |
| 2476 return this._sentinel.previousEntry(); | 2365 return this._sentinel.previousEntry(); |
| 2477 } | 2366 } |
| 2478 DoubleLinkedQueue$KeyValuePair$K$V.prototype.forEach = function(f) { | 2367 DoubleLinkedQueue$KeyValuePair$K$V.prototype.forEach = function(f) { |
| 2479 var entry = this._sentinel._next; | 2368 var entry = this._sentinel._next; |
| 2480 while (entry !== this._sentinel) { | 2369 while (entry !== this._sentinel) { |
| 2481 var nextEntry = entry._next; | 2370 var nextEntry = entry._next; |
| 2482 f(entry._element); | 2371 f(entry._element); |
| 2483 entry = nextEntry; | 2372 entry = nextEntry; |
| 2484 } | 2373 } |
| 2485 } | 2374 } |
| 2486 // ********** Code for _DoubleLinkedQueueIterator ************** | 2375 // ********** Code for _DoubleLinkedQueueIterator ************** |
| 2487 function _DoubleLinkedQueueIterator(_sentinel) { | 2376 function _DoubleLinkedQueueIterator(_sentinel) { |
| 2488 this._sentinel = _sentinel; | 2377 this._sentinel = _sentinel; |
| 2489 // Initializers done | 2378 // Initializers done |
| 2490 this._currentEntry = this._sentinel; | 2379 this._currentEntry = this._sentinel; |
| 2491 } | 2380 } |
| 2492 _DoubleLinkedQueueIterator.prototype.is$Iterator$T = function(){return this;}; | |
| 2493 _DoubleLinkedQueueIterator.prototype.hasNext = function() { | 2381 _DoubleLinkedQueueIterator.prototype.hasNext = function() { |
| 2494 return this._currentEntry._next !== this._sentinel; | 2382 return this._currentEntry._next !== this._sentinel; |
| 2495 } | 2383 } |
| 2496 _DoubleLinkedQueueIterator.prototype.next = function() { | 2384 _DoubleLinkedQueueIterator.prototype.next = function() { |
| 2497 if (!this.hasNext()) { | 2385 if (!this.hasNext()) { |
| 2498 $throw(const$0/*const NoMoreElementsException()*/); | 2386 $throw(const$0/*const NoMoreElementsException()*/); |
| 2499 } | 2387 } |
| 2500 this._currentEntry = this._currentEntry._next; | 2388 this._currentEntry = this._currentEntry._next; |
| 2501 return this._currentEntry.get$element(); | 2389 return this._currentEntry.get$element(); |
| 2502 } | 2390 } |
| 2503 _DoubleLinkedQueueIterator.prototype.hasNext$0 = function() { | 2391 _DoubleLinkedQueueIterator.prototype.hasNext$0 = function() { |
| 2504 return this.hasNext(); | 2392 return this.hasNext(); |
| 2505 }; | 2393 }; |
| 2506 _DoubleLinkedQueueIterator.prototype.next$0 = function() { | 2394 _DoubleLinkedQueueIterator.prototype.next$0 = function() { |
| 2507 return this.next(); | 2395 return this.next(); |
| 2508 }; | 2396 }; |
| 2509 // ********** Code for _DoubleLinkedQueueIterator$E ************** | 2397 // ********** Code for _DoubleLinkedQueueIterator$E ************** |
| 2510 function _DoubleLinkedQueueIterator$E(_sentinel) { | 2398 function _DoubleLinkedQueueIterator$E(_sentinel) { |
| 2511 this._sentinel = _sentinel; | 2399 this._sentinel = _sentinel; |
| 2512 // Initializers done | 2400 // Initializers done |
| 2513 this._currentEntry = this._sentinel; | 2401 this._currentEntry = this._sentinel; |
| 2514 } | 2402 } |
| 2515 $inherits(_DoubleLinkedQueueIterator$E, _DoubleLinkedQueueIterator); | 2403 $inherits(_DoubleLinkedQueueIterator$E, _DoubleLinkedQueueIterator); |
| 2516 _DoubleLinkedQueueIterator$E.prototype.is$Iterator$T = function(){return this;}; | |
| 2517 // ********** Code for StopwatchImplementation ************** | 2404 // ********** Code for StopwatchImplementation ************** |
| 2518 function StopwatchImplementation() { | 2405 function StopwatchImplementation() { |
| 2519 this._start = null; | 2406 this._start = null; |
| 2520 this._stop = null; | 2407 this._stop = null; |
| 2521 // Initializers done | 2408 // Initializers done |
| 2522 } | 2409 } |
| 2523 StopwatchImplementation.prototype.start = function() { | 2410 StopwatchImplementation.prototype.start = function() { |
| 2524 if (this._start == null) { | 2411 if (this._start == null) { |
| 2525 this._start = Clock.now(); | 2412 this._start = Clock.now(); |
| 2526 } | 2413 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2548 } | 2435 } |
| 2549 StopwatchImplementation.prototype.frequency = function() { | 2436 StopwatchImplementation.prototype.frequency = function() { |
| 2550 return Clock.frequency(); | 2437 return Clock.frequency(); |
| 2551 } | 2438 } |
| 2552 // ********** Code for StringBufferImpl ************** | 2439 // ********** Code for StringBufferImpl ************** |
| 2553 function StringBufferImpl(content) { | 2440 function StringBufferImpl(content) { |
| 2554 // Initializers done | 2441 // Initializers done |
| 2555 this.clear(); | 2442 this.clear(); |
| 2556 this.add(content); | 2443 this.add(content); |
| 2557 } | 2444 } |
| 2558 StringBufferImpl.prototype.is$StringBuffer = function(){return this;}; | |
| 2559 StringBufferImpl.prototype.get$length = function() { | 2445 StringBufferImpl.prototype.get$length = function() { |
| 2560 return this._length; | 2446 return this._length; |
| 2561 } | 2447 } |
| 2562 Object.defineProperty(StringBufferImpl.prototype, "length", { | 2448 Object.defineProperty(StringBufferImpl.prototype, "length", { |
| 2563 get: StringBufferImpl.prototype.get$length | 2449 get: StringBufferImpl.prototype.get$length |
| 2564 }); | 2450 }); |
| 2565 StringBufferImpl.prototype.isEmpty = function() { | 2451 StringBufferImpl.prototype.isEmpty = function() { |
| 2566 return this._length == 0; | 2452 return this._length == 0; |
| 2567 } | 2453 } |
| 2568 StringBufferImpl.prototype.add = function(obj) { | 2454 StringBufferImpl.prototype.add = function(obj) { |
| 2569 var str = $assert_String(obj.toString()); | 2455 var str = obj.toString(); |
| 2570 if (str == null || str.isEmpty()) return this; | 2456 if (str == null || str.isEmpty()) return this; |
| 2571 this._buffer.add(str); | 2457 this._buffer.add(str); |
| 2572 this._length += str.length; | 2458 this._length += str.length; |
| 2573 return this; | 2459 return this; |
| 2574 } | 2460 } |
| 2575 StringBufferImpl.prototype.addAll = function(objects) { | 2461 StringBufferImpl.prototype.addAll = function(objects) { |
| 2576 for (var $i = objects.iterator(); $i.hasNext$0(); ) { | 2462 for (var $i = objects.iterator(); $i.hasNext$0(); ) { |
| 2577 var obj = $i.next$0(); | 2463 var obj = $i.next$0(); |
| 2578 this.add(obj); | 2464 this.add(obj); |
| 2579 } | 2465 } |
| 2580 return this; | 2466 return this; |
| 2581 } | 2467 } |
| 2582 StringBufferImpl.prototype.clear = function() { | 2468 StringBufferImpl.prototype.clear = function() { |
| 2583 this._buffer = new ListFactory(); | 2469 this._buffer = new ListFactory(); |
| 2584 this._length = 0; | 2470 this._length = 0; |
| 2585 return this; | 2471 return this; |
| 2586 } | 2472 } |
| 2587 StringBufferImpl.prototype.toString = function() { | 2473 StringBufferImpl.prototype.toString = function() { |
| 2588 if (this._buffer.length == 0) return ""; | 2474 if (this._buffer.length == 0) return ""; |
| 2589 if (this._buffer.length == 1) return $assert_String(this._buffer.$index(0)); | 2475 if (this._buffer.length == 1) return this._buffer.$index(0); |
| 2590 var result = StringBase.concatAll(this._buffer); | 2476 var result = StringBase.concatAll(this._buffer); |
| 2591 this._buffer.clear(); | 2477 this._buffer.clear(); |
| 2592 this._buffer.add(result); | 2478 this._buffer.add(result); |
| 2593 return result; | 2479 return result; |
| 2594 } | 2480 } |
| 2595 StringBufferImpl.prototype.add$1 = StringBufferImpl.prototype.add; | 2481 StringBufferImpl.prototype.add$1 = function($0) { |
| 2482 return this.add($0); |
| 2483 }; |
| 2596 StringBufferImpl.prototype.addAll$1 = function($0) { | 2484 StringBufferImpl.prototype.addAll$1 = function($0) { |
| 2597 return this.addAll(($0 && $0.is$Collection$Object())); | 2485 return this.addAll($0); |
| 2598 }; | 2486 }; |
| 2599 StringBufferImpl.prototype.isEmpty$0 = function() { | 2487 StringBufferImpl.prototype.isEmpty$0 = function() { |
| 2600 return this.isEmpty(); | 2488 return this.isEmpty(); |
| 2601 }; | 2489 }; |
| 2602 StringBufferImpl.prototype.toString$0 = function() { | 2490 StringBufferImpl.prototype.toString$0 = function() { |
| 2603 return this.toString(); | 2491 return this.toString(); |
| 2604 }; | 2492 }; |
| 2605 // ********** Code for StringBase ************** | 2493 // ********** Code for StringBase ************** |
| 2606 function StringBase() {} | 2494 function StringBase() {} |
| 2607 StringBase.createFromCharCodes = function(charCodes) { | 2495 StringBase.createFromCharCodes = function(charCodes) { |
| 2608 if (Object.getPrototypeOf(charCodes) !== Array.prototype) { | 2496 if (Object.getPrototypeOf(charCodes) !== Array.prototype) { |
| 2609 var length = charCodes.length; | 2497 var length = charCodes.length; |
| 2610 var tmp = new Array(length); | 2498 var tmp = new Array(length); |
| 2611 for (var i = 0; i < length; i++) { | 2499 for (var i = 0; i < length; i++) { |
| 2612 tmp[i] = charCodes.$index(i); | 2500 tmp[i] = charCodes.$index(i); |
| 2613 } | 2501 } |
| 2614 charCodes = tmp; | 2502 charCodes = tmp; |
| 2615 } | 2503 } |
| 2616 return String.fromCharCode.apply(null, charCodes); | 2504 return String.fromCharCode.apply(null, charCodes); |
| 2617 } | 2505 } |
| 2618 StringBase.join = function(strings, separator) { | 2506 StringBase.join = function(strings, separator) { |
| 2619 if (strings.length == 0) return ''; | 2507 if (strings.length == 0) return ''; |
| 2620 var s = $assert_String(strings.$index(0)); | 2508 var s = strings.$index(0); |
| 2621 for (var i = 1; | 2509 for (var i = 1; |
| 2622 i < strings.length; i++) { | 2510 i < strings.length; i++) { |
| 2623 s = s + separator + strings.$index(i); | 2511 s = s + separator + strings.$index(i); |
| 2624 } | 2512 } |
| 2625 return s; | 2513 return s; |
| 2626 } | 2514 } |
| 2627 StringBase.concatAll = function(strings) { | 2515 StringBase.concatAll = function(strings) { |
| 2628 return StringBase.join(strings, ""); | 2516 return StringBase.join(strings, ""); |
| 2629 } | 2517 } |
| 2630 // ********** Code for StringImplementation ************** | 2518 // ********** Code for StringImplementation ************** |
| 2631 StringImplementation = String; | 2519 StringImplementation = String; |
| 2632 StringImplementation.prototype.is$Pattern = function(){return this;}; | |
| 2633 StringImplementation.prototype.is$Comparable = function(){return this;}; | |
| 2634 StringImplementation.prototype.endsWith = function(other) { | 2520 StringImplementation.prototype.endsWith = function(other) { |
| 2635 if (other.length > this.length) return false; | 2521 if (other.length > this.length) return false; |
| 2636 return other == this.substring(this.length - other.length); | 2522 return other == this.substring(this.length - other.length); |
| 2637 } | 2523 } |
| 2638 StringImplementation.prototype.startsWith = function(other) { | 2524 StringImplementation.prototype.startsWith = function(other) { |
| 2639 if (other.length > this.length) return false; | 2525 if (other.length > this.length) return false; |
| 2640 return other == this.substring(0, other.length); | 2526 return other == this.substring(0, other.length); |
| 2641 } | 2527 } |
| 2642 StringImplementation.prototype.isEmpty = function() { | 2528 StringImplementation.prototype.isEmpty = function() { |
| 2643 return this.length == 0; | 2529 return this.length == 0; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2664 this.hash_ ^= this.hash_ >> 11; | 2550 this.hash_ ^= this.hash_ >> 11; |
| 2665 this.hash_ += this.hash_ << 15; | 2551 this.hash_ += this.hash_ << 15; |
| 2666 this.hash_ = this.hash_ & ((1 << 29) - 1); | 2552 this.hash_ = this.hash_ & ((1 << 29) - 1); |
| 2667 } | 2553 } |
| 2668 return this.hash_; | 2554 return this.hash_; |
| 2669 } | 2555 } |
| 2670 StringImplementation.prototype.compareTo = function(other) { | 2556 StringImplementation.prototype.compareTo = function(other) { |
| 2671 return this == other ? 0 : this < other ? -1 : 1; | 2557 return this == other ? 0 : this < other ? -1 : 1; |
| 2672 } | 2558 } |
| 2673 StringImplementation.prototype.charCodeAt$1 = function($0) { | 2559 StringImplementation.prototype.charCodeAt$1 = function($0) { |
| 2674 return this.charCodeAt($assert_num($0)); | 2560 return this.charCodeAt($0); |
| 2675 }; | 2561 }; |
| 2676 StringImplementation.prototype.compareTo$1 = function($0) { | 2562 StringImplementation.prototype.compareTo$1 = function($0) { |
| 2677 return this.compareTo($assert_String($0)); | 2563 return this.compareTo($0); |
| 2678 }; | 2564 }; |
| 2679 StringImplementation.prototype.endsWith$1 = function($0) { | 2565 StringImplementation.prototype.endsWith$1 = function($0) { |
| 2680 return this.endsWith($assert_String($0)); | 2566 return this.endsWith($0); |
| 2681 }; | 2567 }; |
| 2682 StringImplementation.prototype.hashCode$0 = function() { | 2568 StringImplementation.prototype.hashCode$0 = function() { |
| 2683 return this.hashCode(); | 2569 return this.hashCode(); |
| 2684 }; | 2570 }; |
| 2685 StringImplementation.prototype.indexOf$2 = function($0, $1) { | 2571 StringImplementation.prototype.indexOf$2 = function($0, $1) { |
| 2686 return this.indexOf($assert_String($0), $assert_num($1)); | 2572 return this.indexOf($0, $1); |
| 2687 }; | 2573 }; |
| 2688 StringImplementation.prototype.isEmpty$0 = function() { | 2574 StringImplementation.prototype.isEmpty$0 = function() { |
| 2689 return this.isEmpty(); | 2575 return this.isEmpty(); |
| 2690 }; | 2576 }; |
| 2691 StringImplementation.prototype.replaceAll$2 = function($0, $1) { | 2577 StringImplementation.prototype.replaceAll$2 = function($0, $1) { |
| 2692 return this.replaceAll(($0 && $0.is$Pattern()), $assert_String($1)); | 2578 return this.replaceAll($0, $1); |
| 2693 }; | 2579 }; |
| 2694 StringImplementation.prototype.replaceFirst$2 = function($0, $1) { | 2580 StringImplementation.prototype.replaceFirst$2 = function($0, $1) { |
| 2695 return this.replaceFirst(($0 && $0.is$Pattern()), $assert_String($1)); | 2581 return this.replaceFirst($0, $1); |
| 2696 }; | 2582 }; |
| 2697 StringImplementation.prototype.startsWith$1 = function($0) { | 2583 StringImplementation.prototype.startsWith$1 = function($0) { |
| 2698 return this.startsWith($assert_String($0)); | 2584 return this.startsWith($0); |
| 2699 }; | 2585 }; |
| 2700 StringImplementation.prototype.substring$1 = function($0) { | 2586 StringImplementation.prototype.substring$1 = function($0) { |
| 2701 return this.substring($assert_num($0)); | 2587 return this.substring($0); |
| 2702 }; | 2588 }; |
| 2703 StringImplementation.prototype.substring$2 = function($0, $1) { | 2589 StringImplementation.prototype.substring$2 = function($0, $1) { |
| 2704 return this.substring($assert_num($0), $assert_num($1)); | 2590 return this.substring($0, $1); |
| 2705 }; | 2591 }; |
| 2706 // ********** Code for Collections ************** | 2592 // ********** Code for Collections ************** |
| 2707 function Collections() {} | 2593 function Collections() {} |
| 2708 Collections.forEach = function(iterable, f) { | 2594 Collections.forEach = function(iterable, f) { |
| 2709 for (var $i = iterable.iterator(); $i.hasNext$0(); ) { | 2595 for (var $i = iterable.iterator(); $i.hasNext$0(); ) { |
| 2710 var e = $i.next$0(); | 2596 var e = $i.next$0(); |
| 2711 f(e); | 2597 f(e); |
| 2712 } | 2598 } |
| 2713 } | 2599 } |
| 2714 Collections.some = function(iterable, f) { | 2600 Collections.some = function(iterable, f) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2733 // Initializers done | 2619 // Initializers done |
| 2734 } | 2620 } |
| 2735 DateImplementation.fromEpoch$ctor.prototype = DateImplementation.prototype; | 2621 DateImplementation.fromEpoch$ctor.prototype = DateImplementation.prototype; |
| 2736 DateImplementation.now$ctor = function() { | 2622 DateImplementation.now$ctor = function() { |
| 2737 this.timeZone = new TimeZoneImplementation.local$ctor(); | 2623 this.timeZone = new TimeZoneImplementation.local$ctor(); |
| 2738 this.value = DateImplementation._now(); | 2624 this.value = DateImplementation._now(); |
| 2739 // Initializers done | 2625 // Initializers done |
| 2740 this._asJs(); | 2626 this._asJs(); |
| 2741 } | 2627 } |
| 2742 DateImplementation.now$ctor.prototype = DateImplementation.prototype; | 2628 DateImplementation.now$ctor.prototype = DateImplementation.prototype; |
| 2743 DateImplementation.prototype.is$Date = function(){return this;}; | |
| 2744 DateImplementation.prototype.is$Comparable = function(){return this;}; | |
| 2745 DateImplementation.prototype.get$value = function() { return this.value; }; | 2629 DateImplementation.prototype.get$value = function() { return this.value; }; |
| 2746 DateImplementation.prototype.$eq = function(other) { | 2630 DateImplementation.prototype.$eq = function(other) { |
| 2747 if (!((other instanceof DateImplementation))) return false; | 2631 if (!((other instanceof DateImplementation))) return false; |
| 2748 return (this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone
)); | 2632 return (this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone
)); |
| 2749 } | 2633 } |
| 2750 DateImplementation.prototype.compareTo = function(other) { | 2634 DateImplementation.prototype.compareTo = function(other) { |
| 2751 var $0; | 2635 return this.value.compareTo(other.value); |
| 2752 return $assert_num(this.value.compareTo$1(other.value)); | |
| 2753 } | 2636 } |
| 2754 DateImplementation.prototype.get$year = function() { | 2637 DateImplementation.prototype.get$year = function() { |
| 2755 return this.isUtc ? this._asJs().getUTCFullYear() : | 2638 return this.isUtc ? this._asJs().getUTCFullYear() : |
| 2756 this._asJs().getFullYear(); | 2639 this._asJs().getFullYear(); |
| 2757 } | 2640 } |
| 2758 DateImplementation.prototype.get$month = function() { | 2641 DateImplementation.prototype.get$month = function() { |
| 2759 return this.isUtc ? this._asJs().getMonth() + 1 : | 2642 return this.isUtc ? this._asJs().getMonth() + 1 : |
| 2760 this._asJs().getMonth() + 1; | 2643 this._asJs().getMonth() + 1; |
| 2761 } | 2644 } |
| 2762 DateImplementation.prototype.get$day = function() { | 2645 DateImplementation.prototype.get$day = function() { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2784 function twoDigits(n) { | 2667 function twoDigits(n) { |
| 2785 if (n >= 10) return ("" + n + ""); | 2668 if (n >= 10) return ("" + n + ""); |
| 2786 return ("0" + n + ""); | 2669 return ("0" + n + ""); |
| 2787 } | 2670 } |
| 2788 var m = twoDigits(this.get$month()); | 2671 var m = twoDigits(this.get$month()); |
| 2789 var d = twoDigits(this.get$day()); | 2672 var d = twoDigits(this.get$day()); |
| 2790 var h = twoDigits(this.get$hours()); | 2673 var h = twoDigits(this.get$hours()); |
| 2791 var min = twoDigits(this.get$minutes()); | 2674 var min = twoDigits(this.get$minutes()); |
| 2792 var sec = twoDigits(this.get$seconds()); | 2675 var sec = twoDigits(this.get$seconds()); |
| 2793 var ms = threeDigits(this.get$milliseconds()); | 2676 var ms = threeDigits(this.get$milliseconds()); |
| 2794 if ($notnull_bool(this.timeZone.isUtc)) { | 2677 if (this.timeZone.isUtc) { |
| 2795 return ("" + this.get$year() + "-" + m + "-" + d + " " + h + ":" + min + ":"
+ sec + "." + ms + "Z"); | 2678 return ("" + this.get$year() + "-" + m + "-" + d + " " + h + ":" + min + ":"
+ sec + "." + ms + "Z"); |
| 2796 } | 2679 } |
| 2797 else { | 2680 else { |
| 2798 return ("" + this.get$year() + "-" + m + "-" + d + " " + h + ":" + min + ":"
+ sec + "." + ms + ""); | 2681 return ("" + this.get$year() + "-" + m + "-" + d + " " + h + ":" + min + ":"
+ sec + "." + ms + ""); |
| 2799 } | 2682 } |
| 2800 } | 2683 } |
| 2801 DateImplementation.prototype.add = function(duration) { | 2684 DateImplementation.prototype.add = function(duration) { |
| 2802 return new DateImplementation.fromEpoch$ctor(this.value + duration.inMilliseco
nds, this.timeZone); | 2685 return new DateImplementation.fromEpoch$ctor(this.value + duration.inMilliseco
nds, this.timeZone); |
| 2803 } | 2686 } |
| 2804 DateImplementation._now = function() { | 2687 DateImplementation._now = function() { |
| 2805 return new Date().valueOf(); | 2688 return new Date().valueOf(); |
| 2806 } | 2689 } |
| 2807 DateImplementation.prototype._asJs = function() { | 2690 DateImplementation.prototype._asJs = function() { |
| 2808 if (!this.date) { | 2691 if (!this.date) { |
| 2809 this.date = new Date(this.value); | 2692 this.date = new Date(this.value); |
| 2810 } | 2693 } |
| 2811 return this.date; | 2694 return this.date; |
| 2812 } | 2695 } |
| 2813 DateImplementation.prototype.add$1 = function($0) { | 2696 DateImplementation.prototype.add$1 = function($0) { |
| 2814 return this.add(($0 && $0.is$Duration())); | 2697 return this.add($0); |
| 2815 }; | 2698 }; |
| 2816 DateImplementation.prototype.compareTo$1 = function($0) { | 2699 DateImplementation.prototype.compareTo$1 = function($0) { |
| 2817 return this.compareTo(($0 && $0.is$Date())); | 2700 return this.compareTo($0); |
| 2818 }; | 2701 }; |
| 2819 DateImplementation.prototype.toString$0 = function() { | 2702 DateImplementation.prototype.toString$0 = function() { |
| 2820 return this.toString(); | 2703 return this.toString(); |
| 2821 }; | 2704 }; |
| 2822 // ********** Code for TimeZoneImplementation ************** | 2705 // ********** Code for TimeZoneImplementation ************** |
| 2823 function TimeZoneImplementation() {} | 2706 function TimeZoneImplementation() {} |
| 2824 TimeZoneImplementation.local$ctor = function() { | 2707 TimeZoneImplementation.local$ctor = function() { |
| 2825 this.isUtc = false; | 2708 this.isUtc = false; |
| 2826 // Initializers done | 2709 // Initializers done |
| 2827 } | 2710 } |
| 2828 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype; | 2711 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype; |
| 2829 TimeZoneImplementation.prototype.$eq = function(other) { | 2712 TimeZoneImplementation.prototype.$eq = function(other) { |
| 2830 if (!((other instanceof TimeZoneImplementation))) return false; | 2713 if (!((other instanceof TimeZoneImplementation))) return false; |
| 2831 return $eq(this.isUtc, other.isUtc); | 2714 return $eq(this.isUtc, other.isUtc); |
| 2832 } | 2715 } |
| 2833 TimeZoneImplementation.prototype.toString = function() { | 2716 TimeZoneImplementation.prototype.toString = function() { |
| 2834 if ($notnull_bool(this.isUtc)) return "TimeZone (UTC)"; | 2717 if (this.isUtc) return "TimeZone (UTC)"; |
| 2835 return "TimeZone (Local)"; | 2718 return "TimeZone (Local)"; |
| 2836 } | 2719 } |
| 2837 TimeZoneImplementation.prototype.toString$0 = function() { | 2720 TimeZoneImplementation.prototype.toString$0 = function() { |
| 2838 return this.toString(); | 2721 return this.toString(); |
| 2839 }; | 2722 }; |
| 2840 // ********** Code for top level ************** | 2723 // ********** Code for top level ************** |
| 2841 // ********** Library node ************** | 2724 // ********** Library node ************** |
| 2842 // ********** Code for process ************** | 2725 // ********** Code for process ************** |
| 2843 // ********** Code for vm ************** | 2726 // ********** Code for vm ************** |
| 2844 vm = require('vm'); | 2727 vm = require('vm'); |
| 2845 // ********** Code for fs ************** | 2728 // ********** Code for fs ************** |
| 2846 fs = require('fs'); | 2729 fs = require('fs'); |
| 2847 // ********** Code for path ************** | 2730 // ********** Code for path ************** |
| 2848 path = require('path'); | 2731 path = require('path'); |
| 2849 // ********** Code for top level ************** | 2732 // ********** Code for top level ************** |
| 2850 function createSandbox() { | 2733 function createSandbox() { |
| 2851 return {'require': require, 'process': process, 'console': console, | 2734 return {'require': require, 'process': process, 'console': console, |
| 2852 'setTimeout': setTimeout, 'clearTimeout': clearTimeout}; | 2735 'setTimeout': setTimeout, 'clearTimeout': clearTimeout}; |
| 2853 } | 2736 } |
| 2854 // ********** Library file_system ************** | 2737 // ********** Library file_system ************** |
| 2855 // ********** Code for top level ************** | 2738 // ********** Code for top level ************** |
| 2856 function joinPaths(path1, path2) { | 2739 function joinPaths(path1, path2) { |
| 2857 var pieces = path1.split('/'); | 2740 var pieces = path1.split('/'); |
| 2858 var $list = path2.split('/'); | 2741 var $list = path2.split('/'); |
| 2859 for (var $i = 0;$i < $list.length; $i++) { | 2742 for (var $i = 0;$i < $list.length; $i++) { |
| 2860 var piece = $list.$index($i); | 2743 var piece = $list.$index($i); |
| 2861 if ($notnull_bool($eq(piece, '..')) && pieces.length > 0 && $notnull_bool($n
e(pieces.last$0(), '.')) && $notnull_bool($ne(pieces.last$0(), '..'))) { | 2744 if ($eq(piece, '..') && pieces.length > 0 && $ne(pieces.last$0(), '.') && $n
e(pieces.last$0(), '..')) { |
| 2862 pieces.removeLast$0(); | 2745 pieces.removeLast$0(); |
| 2863 } | 2746 } |
| 2864 else if ($notnull_bool($ne(piece, ''))) { | 2747 else if ($ne(piece, '')) { |
| 2865 if (pieces.length > 0 && $notnull_bool($eq(pieces.last$0(), '.'))) { | 2748 if (pieces.length > 0 && $eq(pieces.last$0(), '.')) { |
| 2866 pieces.removeLast$0(); | 2749 pieces.removeLast$0(); |
| 2867 } | 2750 } |
| 2868 pieces.add$1(piece); | 2751 pieces.add$1(piece); |
| 2869 } | 2752 } |
| 2870 } | 2753 } |
| 2871 return Strings.join((pieces && pieces.is$List$String()), '/'); | 2754 return Strings.join(pieces, '/'); |
| 2872 } | 2755 } |
| 2873 function dirname(path) { | 2756 function dirname(path) { |
| 2874 var lastSlash = path.lastIndexOf('/', path.length); | 2757 var lastSlash = path.lastIndexOf('/', path.length); |
| 2875 if (lastSlash == -1) { | 2758 if (lastSlash == -1) { |
| 2876 return '.'; | 2759 return '.'; |
| 2877 } | 2760 } |
| 2878 else { | 2761 else { |
| 2879 return path.substring(0, lastSlash); | 2762 return path.substring(0, lastSlash); |
| 2880 } | 2763 } |
| 2881 } | 2764 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2908 function join(strings) { | 2791 function join(strings) { |
| 2909 return Strings.join(strings, '/'); | 2792 return Strings.join(strings, '/'); |
| 2910 } | 2793 } |
| 2911 function readSync(fileName) { | 2794 function readSync(fileName) { |
| 2912 return new SourceFile(fileName, world.files.readAll(fileName)); | 2795 return new SourceFile(fileName, world.files.readAll(fileName)); |
| 2913 } | 2796 } |
| 2914 // ********** Library util_implementation ************** | 2797 // ********** Library util_implementation ************** |
| 2915 // ********** Code for LinkFactory ************** | 2798 // ********** Code for LinkFactory ************** |
| 2916 function LinkFactory() {} | 2799 function LinkFactory() {} |
| 2917 LinkFactory.Link$factory = function(head, tail) { | 2800 LinkFactory.Link$factory = function(head, tail) { |
| 2918 var $0; | 2801 return new LinkEntry(head, (tail == null) ? const$14/*const EmptyLink()*/ : ta
il); |
| 2919 return new LinkEntry(head, (($0 = (tail == null) ? const$14/*const EmptyLink()
*/ : tail) && $0.is$Link$T())); | |
| 2920 } | 2802 } |
| 2921 // ********** Code for LinkFactory$Node ************** | 2803 // ********** Code for LinkFactory$Node ************** |
| 2922 function LinkFactory$Node() {} | 2804 function LinkFactory$Node() {} |
| 2923 $inherits(LinkFactory$Node, LinkFactory); | 2805 $inherits(LinkFactory$Node, LinkFactory); |
| 2924 // ********** Code for LinkFactory$T ************** | 2806 // ********** Code for LinkFactory$T ************** |
| 2925 function LinkFactory$T() {} | 2807 function LinkFactory$T() {} |
| 2926 $inherits(LinkFactory$T, LinkFactory); | 2808 $inherits(LinkFactory$T, LinkFactory); |
| 2927 // ********** Code for AbstractLink ************** | 2809 // ********** Code for AbstractLink ************** |
| 2928 function AbstractLink() {} | 2810 function AbstractLink() {} |
| 2929 AbstractLink.prototype.is$Link = function(){return this;}; | |
| 2930 AbstractLink.prototype.is$Link$Element = function(){return this;}; | |
| 2931 AbstractLink.prototype.is$Link$Node = function(){return this;}; | |
| 2932 AbstractLink.prototype.is$Link$T = function(){return this;}; | |
| 2933 AbstractLink.prototype.is$Link$Token = function(){return this;}; | |
| 2934 AbstractLink.prototype.is$Link$Type = function(){return this;}; | |
| 2935 AbstractLink.prototype.is$Iterable = function(){return this;}; | |
| 2936 AbstractLink.prototype.get$head = function() { | 2811 AbstractLink.prototype.get$head = function() { |
| 2937 $throw("bug"); | 2812 $throw("bug"); |
| 2938 } | 2813 } |
| 2939 AbstractLink.prototype.get$tail = function() { | 2814 AbstractLink.prototype.get$tail = function() { |
| 2940 $throw("bug"); | 2815 $throw("bug"); |
| 2941 } | 2816 } |
| 2942 AbstractLink.prototype.prepend = function(element) { | 2817 AbstractLink.prototype.prepend = function(element) { |
| 2943 return LinkFactory.Link$factory(element, this); | 2818 return LinkFactory.Link$factory(element, this); |
| 2944 } | 2819 } |
| 2945 AbstractLink.prototype.iterator = function() { | 2820 AbstractLink.prototype.iterator = function() { |
| 2946 var $0; | 2821 return this.toList().iterator$0(); |
| 2947 return (($0 = this.toList().iterator$0()) && $0.is$Iterator$T()); | |
| 2948 } | 2822 } |
| 2949 AbstractLink.prototype.printOn = function(buffer, separatedBy) { | 2823 AbstractLink.prototype.printOn = function(buffer, separatedBy) { |
| 2950 var $0; | 2824 if (this.isEmpty()) return; |
| 2951 if ($notnull_bool(this.isEmpty())) return; | |
| 2952 buffer.add(this.get$head() == null ? 'null' : this.get$head()); | 2825 buffer.add(this.get$head() == null ? 'null' : this.get$head()); |
| 2953 if (separatedBy == null) separatedBy = ''; | 2826 if (separatedBy == null) separatedBy = ''; |
| 2954 for (var link = (($0 = this.get$tail()) && $0.is$Link()); | 2827 for (var link = this.get$tail(); |
| 2955 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link(
))) { | 2828 !link.isEmpty(); link = link.get$tail()) { |
| 2956 buffer.add(separatedBy); | 2829 buffer.add(separatedBy); |
| 2957 buffer.add(link.get$head() == null ? 'null' : link.get$head()); | 2830 buffer.add(link.get$head() == null ? 'null' : link.get$head()); |
| 2958 } | 2831 } |
| 2959 } | 2832 } |
| 2960 AbstractLink.prototype.toString = function() { | 2833 AbstractLink.prototype.toString = function() { |
| 2961 var buffer = new StringBufferImpl(""); | 2834 var buffer = new StringBufferImpl(""); |
| 2962 buffer.add('[ '); | 2835 buffer.add('[ '); |
| 2963 this.printOn(buffer, ', '); | 2836 this.printOn(buffer, ', '); |
| 2964 buffer.add(' ]'); | 2837 buffer.add(' ]'); |
| 2965 return buffer.toString(); | 2838 return buffer.toString(); |
| 2966 } | 2839 } |
| 2967 AbstractLink.prototype.isEmpty$0 = function() { | 2840 AbstractLink.prototype.isEmpty$0 = function() { |
| 2968 return this.isEmpty(); | 2841 return this.isEmpty(); |
| 2969 }; | 2842 }; |
| 2970 AbstractLink.prototype.iterator$0 = function() { | 2843 AbstractLink.prototype.iterator$0 = function() { |
| 2971 return this.iterator(); | 2844 return this.iterator(); |
| 2972 }; | 2845 }; |
| 2973 AbstractLink.prototype.printOn$1 = function($0) { | 2846 AbstractLink.prototype.printOn$1 = function($0) { |
| 2974 return this.printOn(($0 && $0.is$StringBuffer())); | 2847 return this.printOn($0); |
| 2975 }; | 2848 }; |
| 2976 AbstractLink.prototype.toString$0 = function() { | 2849 AbstractLink.prototype.toString$0 = function() { |
| 2977 return this.toString(); | 2850 return this.toString(); |
| 2978 }; | 2851 }; |
| 2979 // ********** Code for AbstractLink$T ************** | 2852 // ********** Code for AbstractLink$T ************** |
| 2980 function AbstractLink$T() {} | 2853 function AbstractLink$T() {} |
| 2981 $inherits(AbstractLink$T, AbstractLink); | 2854 $inherits(AbstractLink$T, AbstractLink); |
| 2982 AbstractLink$T.prototype.is$Link = function(){return this;}; | |
| 2983 AbstractLink$T.prototype.is$Link$Element = function(){return this;}; | |
| 2984 AbstractLink$T.prototype.is$Link$Node = function(){return this;}; | |
| 2985 AbstractLink$T.prototype.is$Link$T = function(){return this;}; | |
| 2986 AbstractLink$T.prototype.is$Link$Token = function(){return this;}; | |
| 2987 AbstractLink$T.prototype.is$Link$Type = function(){return this;}; | |
| 2988 AbstractLink$T.prototype.is$Iterable = function(){return this;}; | |
| 2989 AbstractLink$T.prototype.iterator = function() { | 2855 AbstractLink$T.prototype.iterator = function() { |
| 2990 var $0; | 2856 return this.toList().iterator$0(); |
| 2991 return (($0 = this.toList().iterator$0()) && $0.is$Iterator$T()); | |
| 2992 } | 2857 } |
| 2993 // ********** Code for LinkTail ************** | 2858 // ********** Code for LinkTail ************** |
| 2994 function LinkTail() { | 2859 function LinkTail() { |
| 2995 // Initializers done | 2860 // Initializers done |
| 2996 } | 2861 } |
| 2997 $inherits(LinkTail, AbstractLink$T); | 2862 $inherits(LinkTail, AbstractLink$T); |
| 2998 LinkTail.prototype.is$Link = function(){return this;}; | |
| 2999 LinkTail.prototype.is$Link$Element = function(){return this;}; | |
| 3000 LinkTail.prototype.is$Link$Node = function(){return this;}; | |
| 3001 LinkTail.prototype.is$Link$T = function(){return this;}; | |
| 3002 LinkTail.prototype.is$Link$Token = function(){return this;}; | |
| 3003 LinkTail.prototype.is$Link$Type = function(){return this;}; | |
| 3004 LinkTail.prototype.is$Iterable = function(){return this;}; | |
| 3005 LinkTail.prototype.get$head = function() { | 2863 LinkTail.prototype.get$head = function() { |
| 3006 return null; | 2864 return null; |
| 3007 } | 2865 } |
| 3008 LinkTail.prototype.get$tail = function() { | 2866 LinkTail.prototype.get$tail = function() { |
| 3009 return null; | 2867 return null; |
| 3010 } | 2868 } |
| 3011 LinkTail.prototype.toList = function() { | 2869 LinkTail.prototype.toList = function() { |
| 3012 return const$13/*const []*/; | 2870 return const$13/*const []*/; |
| 3013 } | 2871 } |
| 3014 LinkTail.prototype.isEmpty = function() { | 2872 LinkTail.prototype.isEmpty = function() { |
| 3015 return true; | 2873 return true; |
| 3016 } | 2874 } |
| 3017 LinkTail.prototype.isEmpty$0 = function() { | 2875 LinkTail.prototype.isEmpty$0 = function() { |
| 3018 return this.isEmpty(); | 2876 return this.isEmpty(); |
| 3019 }; | 2877 }; |
| 3020 // ********** Code for LinkTail$Node ************** | 2878 // ********** Code for LinkTail$Node ************** |
| 3021 function LinkTail$Node() {} | 2879 function LinkTail$Node() {} |
| 3022 $inherits(LinkTail$Node, LinkTail); | 2880 $inherits(LinkTail$Node, LinkTail); |
| 3023 LinkTail$Node.prototype.is$Link = function(){return this;}; | |
| 3024 LinkTail$Node.prototype.is$Link$Element = function(){return this;}; | |
| 3025 LinkTail$Node.prototype.is$Link$Node = function(){return this;}; | |
| 3026 LinkTail$Node.prototype.is$Link$T = function(){return this;}; | |
| 3027 LinkTail$Node.prototype.is$Link$Token = function(){return this;}; | |
| 3028 LinkTail$Node.prototype.is$Link$Type = function(){return this;}; | |
| 3029 LinkTail$Node.prototype.is$Iterable = function(){return this;}; | |
| 3030 // ********** Code for LinkTail$Type ************** | 2881 // ********** Code for LinkTail$Type ************** |
| 3031 function LinkTail$Type() {} | 2882 function LinkTail$Type() {} |
| 3032 $inherits(LinkTail$Type, LinkTail); | 2883 $inherits(LinkTail$Type, LinkTail); |
| 3033 LinkTail$Type.prototype.is$Link = function(){return this;}; | |
| 3034 LinkTail$Type.prototype.is$Link$Element = function(){return this;}; | |
| 3035 LinkTail$Type.prototype.is$Link$Node = function(){return this;}; | |
| 3036 LinkTail$Type.prototype.is$Link$T = function(){return this;}; | |
| 3037 LinkTail$Type.prototype.is$Link$Token = function(){return this;}; | |
| 3038 LinkTail$Type.prototype.is$Link$Type = function(){return this;}; | |
| 3039 LinkTail$Type.prototype.is$Iterable = function(){return this;}; | |
| 3040 // ********** Code for LinkEntry ************** | 2884 // ********** Code for LinkEntry ************** |
| 3041 function LinkEntry(head, realTail) { | 2885 function LinkEntry(head, realTail) { |
| 3042 this.head = head; | 2886 this.head = head; |
| 3043 this.realTail = realTail; | 2887 this.realTail = realTail; |
| 3044 // Initializers done | 2888 // Initializers done |
| 3045 } | 2889 } |
| 3046 $inherits(LinkEntry, AbstractLink$T); | 2890 $inherits(LinkEntry, AbstractLink$T); |
| 3047 LinkEntry.prototype.get$head = function() { return this.head; }; | 2891 LinkEntry.prototype.get$head = function() { return this.head; }; |
| 3048 LinkEntry.prototype.get$tail = function() { | 2892 LinkEntry.prototype.get$tail = function() { |
| 3049 return this.realTail; | 2893 return this.realTail; |
| 3050 } | 2894 } |
| 3051 LinkEntry.prototype.isEmpty = function() { | 2895 LinkEntry.prototype.isEmpty = function() { |
| 3052 return false; | 2896 return false; |
| 3053 } | 2897 } |
| 3054 LinkEntry.prototype.toList = function() { | 2898 LinkEntry.prototype.toList = function() { |
| 3055 var $0; | |
| 3056 var list = new ListFactory(); | 2899 var list = new ListFactory(); |
| 3057 for (var link = this; | 2900 for (var link = this; |
| 3058 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
T())) { | 2901 !link.isEmpty(); link = link.get$tail()) { |
| 3059 list.addLast(link.get$head()); | 2902 list.addLast(link.get$head()); |
| 3060 } | 2903 } |
| 3061 return list; | 2904 return list; |
| 3062 } | 2905 } |
| 3063 LinkEntry.prototype.isEmpty$0 = function() { | 2906 LinkEntry.prototype.isEmpty$0 = function() { |
| 3064 return this.isEmpty(); | 2907 return this.isEmpty(); |
| 3065 }; | 2908 }; |
| 3066 // ********** Code for LinkEntry$T ************** | 2909 // ********** Code for LinkEntry$T ************** |
| 3067 function LinkEntry$T(head, realTail) { | 2910 function LinkEntry$T(head, realTail) { |
| 3068 this.head = head; | 2911 this.head = head; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3154 ArrayBasedScanner.prototype.firstToken = function() { | 2997 ArrayBasedScanner.prototype.firstToken = function() { |
| 3155 return this.tokens.next; | 2998 return this.tokens.next; |
| 3156 } | 2999 } |
| 3157 ArrayBasedScanner.prototype.addToCharOffset = function(offset) { | 3000 ArrayBasedScanner.prototype.addToCharOffset = function(offset) { |
| 3158 this.extraCharOffset += offset; | 3001 this.extraCharOffset += offset; |
| 3159 } | 3002 } |
| 3160 ArrayBasedScanner.prototype.appendWhiteSpace = function(next) { | 3003 ArrayBasedScanner.prototype.appendWhiteSpace = function(next) { |
| 3161 | 3004 |
| 3162 } | 3005 } |
| 3163 ArrayBasedScanner.prototype.appendBeginGroup = function(kind, value) { | 3006 ArrayBasedScanner.prototype.appendBeginGroup = function(kind, value) { |
| 3164 var $0; | |
| 3165 var token = new BeginGroupToken(kind, value, this.tokenStart); | 3007 var token = new BeginGroupToken(kind, value, this.tokenStart); |
| 3166 this.tail.next = token; | 3008 this.tail.next = token; |
| 3167 this.tail = this.tail.next; | 3009 this.tail = this.tail.next; |
| 3168 while (kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.isEmp
ty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { | 3010 while (kind !== 60/*null.LT_TOKEN*/ && !this.groupingStack.isEmpty() && this.g
roupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { |
| 3169 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3011 this.groupingStack = this.groupingStack.get$tail(); |
| 3170 } | 3012 } |
| 3171 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T
oken()); | 3013 this.groupingStack = this.groupingStack.prepend(token); |
| 3172 } | 3014 } |
| 3173 ArrayBasedScanner.prototype.appendEndGroup = function(kind, value, openKind) { | 3015 ArrayBasedScanner.prototype.appendEndGroup = function(kind, value, openKind) { |
| 3174 var $0; | |
| 3175 var oldTail = this.tail; | 3016 var oldTail = this.tail; |
| 3176 this.appendStringToken(kind, value); | 3017 this.appendStringToken(kind, value); |
| 3177 if ($notnull_bool(this.groupingStack.isEmpty())) { | 3018 if (this.groupingStack.isEmpty()) { |
| 3178 if (openKind === 60/*null.LT_TOKEN*/) return; | 3019 if (openKind === 60/*null.LT_TOKEN*/) return; |
| 3179 $throw(new MalformedInputException(('Unmatched ' + value + ''))); | 3020 $throw(new MalformedInputException(('Unmatched ' + value + ''))); |
| 3180 } | 3021 } |
| 3181 while (openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.i
sEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { | 3022 while (openKind !== 60/*null.LT_TOKEN*/ && !this.groupingStack.isEmpty() && th
is.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { |
| 3182 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3023 this.groupingStack = this.groupingStack.get$tail(); |
| 3183 } | 3024 } |
| 3184 if (this.groupingStack.get$head().kind !== openKind) { | 3025 if (this.groupingStack.get$head().kind !== openKind) { |
| 3185 if (openKind === 60/*null.LT_TOKEN*/) return; | 3026 if (openKind === 60/*null.LT_TOKEN*/) return; |
| 3186 $throw(new MalformedInputException(('Unmatched ' + value + ''))); | 3027 $throw(new MalformedInputException(('Unmatched ' + value + ''))); |
| 3187 } | 3028 } |
| 3188 this.groupingStack.get$head().endGroup = oldTail.next; | 3029 this.groupingStack.get$head().endGroup = oldTail.next; |
| 3189 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token
()); | 3030 this.groupingStack = this.groupingStack.get$tail(); |
| 3190 } | 3031 } |
| 3191 ArrayBasedScanner.prototype.appendGtGt = function(kind, value) { | 3032 ArrayBasedScanner.prototype.appendGtGt = function(kind, value) { |
| 3192 var $0; | |
| 3193 var oldTail = this.tail; | 3033 var oldTail = this.tail; |
| 3194 this.appendStringToken(kind, value); | 3034 this.appendStringToken(kind, value); |
| 3195 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 3035 if (this.groupingStack.isEmpty()) return; |
| 3196 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)
)) { | 3036 if ($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)) { |
| 3197 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3037 this.groupingStack = this.groupingStack.get$tail(); |
| 3198 } | 3038 } |
| 3199 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 3039 if (this.groupingStack.isEmpty()) return; |
| 3200 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)
)) { | 3040 if ($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)) { |
| 3201 this.groupingStack.get$head().endGroup = oldTail.next; | 3041 this.groupingStack.get$head().endGroup = oldTail.next; |
| 3202 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3042 this.groupingStack = this.groupingStack.get$tail(); |
| 3203 } | 3043 } |
| 3204 } | 3044 } |
| 3205 ArrayBasedScanner.prototype.appendGtGtGt = function(kind, value) { | 3045 ArrayBasedScanner.prototype.appendGtGtGt = function(kind, value) { |
| 3206 var $0; | |
| 3207 var oldTail = this.tail; | 3046 var oldTail = this.tail; |
| 3208 this.appendStringToken(kind, value); | 3047 this.appendStringToken(kind, value); |
| 3209 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 3048 if (this.groupingStack.isEmpty()) return; |
| 3210 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)
)) { | 3049 if ($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)) { |
| 3211 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3050 this.groupingStack = this.groupingStack.get$tail(); |
| 3212 } | 3051 } |
| 3213 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 3052 if (this.groupingStack.isEmpty()) return; |
| 3214 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)
)) { | 3053 if ($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)) { |
| 3215 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3054 this.groupingStack = this.groupingStack.get$tail(); |
| 3216 } | 3055 } |
| 3217 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 3056 if (this.groupingStack.isEmpty()) return; |
| 3218 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)
)) { | 3057 if ($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)) { |
| 3219 this.groupingStack.get$head().endGroup = oldTail.next; | 3058 this.groupingStack.get$head().endGroup = oldTail.next; |
| 3220 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3059 this.groupingStack = this.groupingStack.get$tail(); |
| 3221 } | 3060 } |
| 3222 } | 3061 } |
| 3223 // ********** Code for ArrayBasedScanner$SourceString ************** | 3062 // ********** Code for ArrayBasedScanner$SourceString ************** |
| 3224 function ArrayBasedScanner$SourceString() { | 3063 function ArrayBasedScanner$SourceString() { |
| 3225 this.groupingStack = const$14/*const EmptyLink()*/ | 3064 this.groupingStack = const$14/*const EmptyLink()*/ |
| 3226 this.extraCharOffset = 0; | 3065 this.extraCharOffset = 0; |
| 3227 this.tokenStart = -1; | 3066 this.tokenStart = -1; |
| 3228 this.byteOffset = -1; | 3067 this.byteOffset = -1; |
| 3229 this.tokens = new Token(0/*null.EOF_TOKEN*/, -1); | 3068 this.tokens = new Token(0/*null.EOF_TOKEN*/, -1); |
| 3230 // Initializers done | 3069 // Initializers done |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3264 ArrayBasedScanner$SourceString.prototype.firstToken = function() { | 3103 ArrayBasedScanner$SourceString.prototype.firstToken = function() { |
| 3265 return this.tokens.next; | 3104 return this.tokens.next; |
| 3266 } | 3105 } |
| 3267 ArrayBasedScanner$SourceString.prototype.addToCharOffset = function(offset) { | 3106 ArrayBasedScanner$SourceString.prototype.addToCharOffset = function(offset) { |
| 3268 this.extraCharOffset += offset; | 3107 this.extraCharOffset += offset; |
| 3269 } | 3108 } |
| 3270 ArrayBasedScanner$SourceString.prototype.appendWhiteSpace = function(next) { | 3109 ArrayBasedScanner$SourceString.prototype.appendWhiteSpace = function(next) { |
| 3271 | 3110 |
| 3272 } | 3111 } |
| 3273 ArrayBasedScanner$SourceString.prototype.appendBeginGroup = function(kind, value
) { | 3112 ArrayBasedScanner$SourceString.prototype.appendBeginGroup = function(kind, value
) { |
| 3274 var $0; | |
| 3275 var token = new BeginGroupToken(kind, value, this.tokenStart); | 3113 var token = new BeginGroupToken(kind, value, this.tokenStart); |
| 3276 this.tail.next = token; | 3114 this.tail.next = token; |
| 3277 this.tail = this.tail.next; | 3115 this.tail = this.tail.next; |
| 3278 while (kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.isEmp
ty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { | 3116 while (kind !== 60/*null.LT_TOKEN*/ && !this.groupingStack.isEmpty() && this.g
roupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { |
| 3279 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3117 this.groupingStack = this.groupingStack.get$tail(); |
| 3280 } | 3118 } |
| 3281 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T
oken()); | 3119 this.groupingStack = this.groupingStack.prepend(token); |
| 3282 } | 3120 } |
| 3283 ArrayBasedScanner$SourceString.prototype.appendEndGroup = function(kind, value,
openKind) { | 3121 ArrayBasedScanner$SourceString.prototype.appendEndGroup = function(kind, value,
openKind) { |
| 3284 var $0; | |
| 3285 var oldTail = this.tail; | 3122 var oldTail = this.tail; |
| 3286 this.appendStringToken(kind, value); | 3123 this.appendStringToken(kind, value); |
| 3287 if ($notnull_bool(this.groupingStack.isEmpty())) { | 3124 if (this.groupingStack.isEmpty()) { |
| 3288 if (openKind === 60/*null.LT_TOKEN*/) return; | 3125 if (openKind === 60/*null.LT_TOKEN*/) return; |
| 3289 $throw(new MalformedInputException(('Unmatched ' + value + ''))); | 3126 $throw(new MalformedInputException(('Unmatched ' + value + ''))); |
| 3290 } | 3127 } |
| 3291 while (openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.i
sEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { | 3128 while (openKind !== 60/*null.LT_TOKEN*/ && !this.groupingStack.isEmpty() && th
is.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { |
| 3292 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3129 this.groupingStack = this.groupingStack.get$tail(); |
| 3293 } | 3130 } |
| 3294 if (this.groupingStack.get$head().kind !== openKind) { | 3131 if (this.groupingStack.get$head().kind !== openKind) { |
| 3295 if (openKind === 60/*null.LT_TOKEN*/) return; | 3132 if (openKind === 60/*null.LT_TOKEN*/) return; |
| 3296 $throw(new MalformedInputException(('Unmatched ' + value + ''))); | 3133 $throw(new MalformedInputException(('Unmatched ' + value + ''))); |
| 3297 } | 3134 } |
| 3298 this.groupingStack.get$head().endGroup = oldTail.next; | 3135 this.groupingStack.get$head().endGroup = oldTail.next; |
| 3299 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token
()); | 3136 this.groupingStack = this.groupingStack.get$tail(); |
| 3300 } | 3137 } |
| 3301 ArrayBasedScanner$SourceString.prototype.appendGtGt = function(kind, value) { | 3138 ArrayBasedScanner$SourceString.prototype.appendGtGt = function(kind, value) { |
| 3302 var $0; | |
| 3303 var oldTail = this.tail; | 3139 var oldTail = this.tail; |
| 3304 this.appendStringToken(kind, value); | 3140 this.appendStringToken(kind, value); |
| 3305 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 3141 if (this.groupingStack.isEmpty()) return; |
| 3306 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)
)) { | 3142 if ($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)) { |
| 3307 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3143 this.groupingStack = this.groupingStack.get$tail(); |
| 3308 } | 3144 } |
| 3309 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 3145 if (this.groupingStack.isEmpty()) return; |
| 3310 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)
)) { | 3146 if ($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)) { |
| 3311 this.groupingStack.get$head().endGroup = oldTail.next; | 3147 this.groupingStack.get$head().endGroup = oldTail.next; |
| 3312 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3148 this.groupingStack = this.groupingStack.get$tail(); |
| 3313 } | 3149 } |
| 3314 } | 3150 } |
| 3315 ArrayBasedScanner$SourceString.prototype.appendGtGtGt = function(kind, value) { | 3151 ArrayBasedScanner$SourceString.prototype.appendGtGtGt = function(kind, value) { |
| 3316 var $0; | |
| 3317 var oldTail = this.tail; | 3152 var oldTail = this.tail; |
| 3318 this.appendStringToken(kind, value); | 3153 this.appendStringToken(kind, value); |
| 3319 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 3154 if (this.groupingStack.isEmpty()) return; |
| 3320 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)
)) { | 3155 if ($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)) { |
| 3321 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3156 this.groupingStack = this.groupingStack.get$tail(); |
| 3322 } | 3157 } |
| 3323 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 3158 if (this.groupingStack.isEmpty()) return; |
| 3324 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)
)) { | 3159 if ($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)) { |
| 3325 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3160 this.groupingStack = this.groupingStack.get$tail(); |
| 3326 } | 3161 } |
| 3327 if ($notnull_bool(this.groupingStack.isEmpty())) return; | 3162 if (this.groupingStack.isEmpty()) return; |
| 3328 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)
)) { | 3163 if ($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/)) { |
| 3329 this.groupingStack.get$head().endGroup = oldTail.next; | 3164 this.groupingStack.get$head().endGroup = oldTail.next; |
| 3330 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok
en()); | 3165 this.groupingStack = this.groupingStack.get$tail(); |
| 3331 } | 3166 } |
| 3332 } | 3167 } |
| 3333 ArrayBasedScanner$SourceString.prototype.tokenize = function() { | 3168 ArrayBasedScanner$SourceString.prototype.tokenize = function() { |
| 3334 var next = this.advance(); | 3169 var next = this.advance(); |
| 3335 while (next != -1) { | 3170 while (next != -1) { |
| 3336 next = this.bigSwitch(next); | 3171 next = this.bigSwitch(next); |
| 3337 } | 3172 } |
| 3338 this.appendEofToken(); | 3173 this.appendEofToken(); |
| 3339 return this.firstToken(); | 3174 return this.firstToken(); |
| 3340 } | 3175 } |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3837 case 99/*null.$c*/: | 3672 case 99/*null.$c*/: |
| 3838 case 100/*null.$d*/: | 3673 case 100/*null.$d*/: |
| 3839 case 101/*null.$e*/: | 3674 case 101/*null.$e*/: |
| 3840 case 102/*null.$f*/: | 3675 case 102/*null.$f*/: |
| 3841 | 3676 |
| 3842 hasDigits = true; | 3677 hasDigits = true; |
| 3843 break; | 3678 break; |
| 3844 | 3679 |
| 3845 default: | 3680 default: |
| 3846 | 3681 |
| 3847 if (!$notnull_bool(hasDigits)) { | 3682 if (!hasDigits) { |
| 3848 $throw(new MalformedInputException(this.get$charOffset())); | 3683 $throw(new MalformedInputException(this.get$charOffset())); |
| 3849 } | 3684 } |
| 3850 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); | 3685 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); |
| 3851 return next; | 3686 return next; |
| 3852 | 3687 |
| 3853 } | 3688 } |
| 3854 } | 3689 } |
| 3855 } | 3690 } |
| 3856 ArrayBasedScanner$SourceString.prototype.tokenizeDotOrNumber = function(next) { | 3691 ArrayBasedScanner$SourceString.prototype.tokenizeDotOrNumber = function(next) { |
| 3857 var start = this.byteOffset; | 3692 var start = this.byteOffset; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3879 default: | 3714 default: |
| 3880 | 3715 |
| 3881 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 3716 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 3882 return next; | 3717 return next; |
| 3883 | 3718 |
| 3884 } | 3719 } |
| 3885 } | 3720 } |
| 3886 ArrayBasedScanner$SourceString.prototype.tokenizeFractionPart = function(next, s
tart) { | 3721 ArrayBasedScanner$SourceString.prototype.tokenizeFractionPart = function(next, s
tart) { |
| 3887 var done = false; | 3722 var done = false; |
| 3888 LOOP: | 3723 LOOP: |
| 3889 while (!$notnull_bool(done)) { | 3724 while (!done) { |
| 3890 switch (next) { | 3725 switch (next) { |
| 3891 case 48/*null.$0*/: | 3726 case 48/*null.$0*/: |
| 3892 case 49/*null.$1*/: | 3727 case 49/*null.$1*/: |
| 3893 case 50/*null.$2*/: | 3728 case 50/*null.$2*/: |
| 3894 case 51/*null.$3*/: | 3729 case 51/*null.$3*/: |
| 3895 case 52/*null.$4*/: | 3730 case 52/*null.$4*/: |
| 3896 case 53/*null.$5*/: | 3731 case 53/*null.$5*/: |
| 3897 case 54/*null.$6*/: | 3732 case 54/*null.$6*/: |
| 3898 case 55/*null.$7*/: | 3733 case 55/*null.$7*/: |
| 3899 case 56/*null.$8*/: | 3734 case 56/*null.$8*/: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3938 case 54/*null.$6*/: | 3773 case 54/*null.$6*/: |
| 3939 case 55/*null.$7*/: | 3774 case 55/*null.$7*/: |
| 3940 case 56/*null.$8*/: | 3775 case 56/*null.$8*/: |
| 3941 case 57/*null.$9*/: | 3776 case 57/*null.$9*/: |
| 3942 | 3777 |
| 3943 hasDigits = true; | 3778 hasDigits = true; |
| 3944 break; | 3779 break; |
| 3945 | 3780 |
| 3946 default: | 3781 default: |
| 3947 | 3782 |
| 3948 if (!$notnull_bool(hasDigits)) { | 3783 if (!hasDigits) { |
| 3949 $throw(new MalformedInputException(this.get$charOffset())); | 3784 $throw(new MalformedInputException(this.get$charOffset())); |
| 3950 } | 3785 } |
| 3951 return next; | 3786 return next; |
| 3952 | 3787 |
| 3953 } | 3788 } |
| 3954 next = this.advance(); | 3789 next = this.advance(); |
| 3955 } | 3790 } |
| 3956 } | 3791 } |
| 3957 ArrayBasedScanner$SourceString.prototype.tokenizeSlashOrComment = function(next)
{ | 3792 ArrayBasedScanner$SourceString.prototype.tokenizeSlashOrComment = function(next)
{ |
| 3958 next = this.advance(); | 3793 next = this.advance(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4028 while (true) { | 3863 while (true) { |
| 4029 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { | 3864 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { |
| 4030 if (state != null) { | 3865 if (state != null) { |
| 4031 state = state.next(next); | 3866 state = state.next(next); |
| 4032 } | 3867 } |
| 4033 } | 3868 } |
| 4034 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*/) { | 3869 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*/) { |
| 4035 state = null; | 3870 state = null; |
| 4036 } | 3871 } |
| 4037 else if (next < 128) { | 3872 else if (next < 128) { |
| 4038 if (state != null && $notnull_bool(state.isLeaf())) { | 3873 if (state != null && state.isLeaf()) { |
| 4039 this.appendKeywordToken(state.get$keyword()); | 3874 this.appendKeywordToken(state.get$keyword()); |
| 4040 } | 3875 } |
| 4041 else if ($notnull_bool(isAscii)) { | 3876 else if (isAscii) { |
| 4042 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString
(start)); | 3877 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString
(start)); |
| 4043 } | 3878 } |
| 4044 else { | 3879 else { |
| 4045 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String(
start, -1)); | 3880 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String(
start, -1)); |
| 4046 } | 3881 } |
| 4047 return next; | 3882 return next; |
| 4048 } | 3883 } |
| 4049 else { | 3884 else { |
| 4050 var nonAsciiStart = this.byteOffset; | 3885 var nonAsciiStart = this.byteOffset; |
| 4051 do { | 3886 do { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 4076 if (q == next) { | 3911 if (q == next) { |
| 4077 next = this.advance(); | 3912 next = this.advance(); |
| 4078 if (q == next) { | 3913 if (q == next) { |
| 4079 return this.tokenizeMultiLineString(q, start, raw); | 3914 return this.tokenizeMultiLineString(q, start, raw); |
| 4080 } | 3915 } |
| 4081 else { | 3916 else { |
| 4082 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
-1)); | 3917 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
-1)); |
| 4083 return next; | 3918 return next; |
| 4084 } | 3919 } |
| 4085 } | 3920 } |
| 4086 if ($notnull_bool(raw)) { | 3921 if (raw) { |
| 4087 return this.tokenizeSingleLineRawString(next, q, start); | 3922 return this.tokenizeSingleLineRawString(next, q, start); |
| 4088 } | 3923 } |
| 4089 else { | 3924 else { |
| 4090 return this.tokenizeSingleLineString(next, q, start); | 3925 return this.tokenizeSingleLineString(next, q, start); |
| 4091 } | 3926 } |
| 4092 } | 3927 } |
| 4093 ArrayBasedScanner$SourceString.prototype.tokenizeSingleLineString = function(nex
t, q1, start) { | 3928 ArrayBasedScanner$SourceString.prototype.tokenizeSingleLineString = function(nex
t, q1, start) { |
| 4094 while (next != -1) { | 3929 while (next != -1) { |
| 4095 if (next == q1) { | 3930 if (next == q1) { |
| 4096 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); | 3931 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4573 return this.select(61/*null.$EQ*/, "<<=", "<<"); | 4408 return this.select(61/*null.$EQ*/, "<<=", "<<"); |
| 4574 | 4409 |
| 4575 default: | 4410 default: |
| 4576 | 4411 |
| 4577 this.appendBeginGroup(60/*null.LT_TOKEN*/, "<"); | 4412 this.appendBeginGroup(60/*null.LT_TOKEN*/, "<"); |
| 4578 return next; | 4413 return next; |
| 4579 | 4414 |
| 4580 } | 4415 } |
| 4581 } | 4416 } |
| 4582 AbstractScanner.prototype.tokenizeNumber = function(next) { | 4417 AbstractScanner.prototype.tokenizeNumber = function(next) { |
| 4583 var $0; | |
| 4584 var start = this.get$byteOffset(); | 4418 var start = this.get$byteOffset(); |
| 4585 while (true) { | 4419 while (true) { |
| 4586 next = this.advance(); | 4420 next = this.advance(); |
| 4587 switch (next) { | 4421 switch (next) { |
| 4588 case 48/*null.$0*/: | 4422 case 48/*null.$0*/: |
| 4589 case 49/*null.$1*/: | 4423 case 49/*null.$1*/: |
| 4590 case 50/*null.$2*/: | 4424 case 50/*null.$2*/: |
| 4591 case 51/*null.$3*/: | 4425 case 51/*null.$3*/: |
| 4592 case 52/*null.$4*/: | 4426 case 52/*null.$4*/: |
| 4593 case 53/*null.$5*/: | 4427 case 53/*null.$5*/: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4604 | 4438 |
| 4605 case 101/*null.$e*/: | 4439 case 101/*null.$e*/: |
| 4606 case 69/*null.$E*/: | 4440 case 69/*null.$E*/: |
| 4607 case 100/*null.$d*/: | 4441 case 100/*null.$d*/: |
| 4608 case 68/*null.$D*/: | 4442 case 68/*null.$D*/: |
| 4609 | 4443 |
| 4610 return this.tokenizeFractionPart(next, start); | 4444 return this.tokenizeFractionPart(next, start); |
| 4611 | 4445 |
| 4612 default: | 4446 default: |
| 4613 | 4447 |
| 4614 this.appendByteStringToken$2(105/*null.INT_TOKEN*/, this.asciiString(sta
rt)); | 4448 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start
)); |
| 4615 return next; | 4449 return next; |
| 4616 | 4450 |
| 4617 } | 4451 } |
| 4618 } | 4452 } |
| 4619 } | 4453 } |
| 4620 AbstractScanner.prototype.tokenizeHexOrNumber = function(next) { | 4454 AbstractScanner.prototype.tokenizeHexOrNumber = function(next) { |
| 4621 var x = this.peek(); | 4455 var x = this.peek(); |
| 4622 if (x == 120/*null.$x*/ || x == 88/*null.$X*/) { | 4456 if (x == 120/*null.$x*/ || x == 88/*null.$X*/) { |
| 4623 this.advance(); | 4457 this.advance(); |
| 4624 return this.tokenizeHex(x); | 4458 return this.tokenizeHex(x); |
| 4625 } | 4459 } |
| 4626 return this.tokenizeNumber(next); | 4460 return this.tokenizeNumber(next); |
| 4627 } | 4461 } |
| 4628 AbstractScanner.prototype.tokenizeHex = function(next) { | 4462 AbstractScanner.prototype.tokenizeHex = function(next) { |
| 4629 var $0; | |
| 4630 var start = this.get$byteOffset(); | 4463 var start = this.get$byteOffset(); |
| 4631 var hasDigits = false; | 4464 var hasDigits = false; |
| 4632 while (true) { | 4465 while (true) { |
| 4633 next = this.advance(); | 4466 next = this.advance(); |
| 4634 switch (next) { | 4467 switch (next) { |
| 4635 case 48/*null.$0*/: | 4468 case 48/*null.$0*/: |
| 4636 case 49/*null.$1*/: | 4469 case 49/*null.$1*/: |
| 4637 case 50/*null.$2*/: | 4470 case 50/*null.$2*/: |
| 4638 case 51/*null.$3*/: | 4471 case 51/*null.$3*/: |
| 4639 case 52/*null.$4*/: | 4472 case 52/*null.$4*/: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4653 case 99/*null.$c*/: | 4486 case 99/*null.$c*/: |
| 4654 case 100/*null.$d*/: | 4487 case 100/*null.$d*/: |
| 4655 case 101/*null.$e*/: | 4488 case 101/*null.$e*/: |
| 4656 case 102/*null.$f*/: | 4489 case 102/*null.$f*/: |
| 4657 | 4490 |
| 4658 hasDigits = true; | 4491 hasDigits = true; |
| 4659 break; | 4492 break; |
| 4660 | 4493 |
| 4661 default: | 4494 default: |
| 4662 | 4495 |
| 4663 if (!$notnull_bool(hasDigits)) { | 4496 if (!hasDigits) { |
| 4664 $throw(new MalformedInputException(this.get$charOffset())); | 4497 $throw(new MalformedInputException(this.get$charOffset())); |
| 4665 } | 4498 } |
| 4666 this.appendByteStringToken$2(120/*null.HEXADECIMAL_TOKEN*/, this.asciiSt
ring(start)); | 4499 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); |
| 4667 return next; | 4500 return next; |
| 4668 | 4501 |
| 4669 } | 4502 } |
| 4670 } | 4503 } |
| 4671 } | 4504 } |
| 4672 AbstractScanner.prototype.tokenizeDotOrNumber = function(next) { | 4505 AbstractScanner.prototype.tokenizeDotOrNumber = function(next) { |
| 4673 var start = this.get$byteOffset(); | 4506 var start = this.get$byteOffset(); |
| 4674 next = this.advance(); | 4507 next = this.advance(); |
| 4675 switch (next) { | 4508 switch (next) { |
| 4676 case 48/*null.$0*/: | 4509 case 48/*null.$0*/: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4693 return this.select(46/*null.$PERIOD*/, "...", ".."); | 4526 return this.select(46/*null.$PERIOD*/, "...", ".."); |
| 4694 | 4527 |
| 4695 default: | 4528 default: |
| 4696 | 4529 |
| 4697 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 4530 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 4698 return next; | 4531 return next; |
| 4699 | 4532 |
| 4700 } | 4533 } |
| 4701 } | 4534 } |
| 4702 AbstractScanner.prototype.tokenizeFractionPart = function(next, start) { | 4535 AbstractScanner.prototype.tokenizeFractionPart = function(next, start) { |
| 4703 var $0; | |
| 4704 var done = false; | 4536 var done = false; |
| 4705 LOOP: | 4537 LOOP: |
| 4706 while (!$notnull_bool(done)) { | 4538 while (!done) { |
| 4707 switch (next) { | 4539 switch (next) { |
| 4708 case 48/*null.$0*/: | 4540 case 48/*null.$0*/: |
| 4709 case 49/*null.$1*/: | 4541 case 49/*null.$1*/: |
| 4710 case 50/*null.$2*/: | 4542 case 50/*null.$2*/: |
| 4711 case 51/*null.$3*/: | 4543 case 51/*null.$3*/: |
| 4712 case 52/*null.$4*/: | 4544 case 52/*null.$4*/: |
| 4713 case 53/*null.$5*/: | 4545 case 53/*null.$5*/: |
| 4714 case 54/*null.$6*/: | 4546 case 54/*null.$6*/: |
| 4715 case 55/*null.$7*/: | 4547 case 55/*null.$7*/: |
| 4716 case 56/*null.$8*/: | 4548 case 56/*null.$8*/: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4729 | 4561 |
| 4730 done = true; | 4562 done = true; |
| 4731 continue LOOP; | 4563 continue LOOP; |
| 4732 | 4564 |
| 4733 } | 4565 } |
| 4734 next = this.advance(); | 4566 next = this.advance(); |
| 4735 } | 4567 } |
| 4736 if (next == 100/*null.$d*/ || next == 68/*null.$D*/) { | 4568 if (next == 100/*null.$d*/ || next == 68/*null.$D*/) { |
| 4737 next = this.advance(); | 4569 next = this.advance(); |
| 4738 } | 4570 } |
| 4739 this.appendByteStringToken$2(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)
); | 4571 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); |
| 4740 return next; | 4572 return next; |
| 4741 } | 4573 } |
| 4742 AbstractScanner.prototype.tokenizeExponent = function(next) { | 4574 AbstractScanner.prototype.tokenizeExponent = function(next) { |
| 4743 if (next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/) { | 4575 if (next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/) { |
| 4744 next = this.advance(); | 4576 next = this.advance(); |
| 4745 } | 4577 } |
| 4746 var hasDigits = false; | 4578 var hasDigits = false; |
| 4747 while (true) { | 4579 while (true) { |
| 4748 switch (next) { | 4580 switch (next) { |
| 4749 case 48/*null.$0*/: | 4581 case 48/*null.$0*/: |
| 4750 case 49/*null.$1*/: | 4582 case 49/*null.$1*/: |
| 4751 case 50/*null.$2*/: | 4583 case 50/*null.$2*/: |
| 4752 case 51/*null.$3*/: | 4584 case 51/*null.$3*/: |
| 4753 case 52/*null.$4*/: | 4585 case 52/*null.$4*/: |
| 4754 case 53/*null.$5*/: | 4586 case 53/*null.$5*/: |
| 4755 case 54/*null.$6*/: | 4587 case 54/*null.$6*/: |
| 4756 case 55/*null.$7*/: | 4588 case 55/*null.$7*/: |
| 4757 case 56/*null.$8*/: | 4589 case 56/*null.$8*/: |
| 4758 case 57/*null.$9*/: | 4590 case 57/*null.$9*/: |
| 4759 | 4591 |
| 4760 hasDigits = true; | 4592 hasDigits = true; |
| 4761 break; | 4593 break; |
| 4762 | 4594 |
| 4763 default: | 4595 default: |
| 4764 | 4596 |
| 4765 if (!$notnull_bool(hasDigits)) { | 4597 if (!hasDigits) { |
| 4766 $throw(new MalformedInputException(this.get$charOffset())); | 4598 $throw(new MalformedInputException(this.get$charOffset())); |
| 4767 } | 4599 } |
| 4768 return next; | 4600 return next; |
| 4769 | 4601 |
| 4770 } | 4602 } |
| 4771 next = this.advance(); | 4603 next = this.advance(); |
| 4772 } | 4604 } |
| 4773 } | 4605 } |
| 4774 AbstractScanner.prototype.tokenizeSlashOrComment = function(next) { | 4606 AbstractScanner.prototype.tokenizeSlashOrComment = function(next) { |
| 4775 next = this.advance(); | 4607 next = this.advance(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4828 | 4660 |
| 4829 default: | 4661 default: |
| 4830 | 4662 |
| 4831 next = this.advance(); | 4663 next = this.advance(); |
| 4832 break; | 4664 break; |
| 4833 | 4665 |
| 4834 } | 4666 } |
| 4835 } | 4667 } |
| 4836 } | 4668 } |
| 4837 AbstractScanner.prototype.tokenizeIdentifier = function(next) { | 4669 AbstractScanner.prototype.tokenizeIdentifier = function(next) { |
| 4838 var $0; | |
| 4839 var start = this.get$byteOffset(); | 4670 var start = this.get$byteOffset(); |
| 4840 var state = null; | 4671 var state = null; |
| 4841 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { | 4672 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { |
| 4842 state = KeywordState.get$KEYWORD_STATE().next(next); | 4673 state = KeywordState.get$KEYWORD_STATE().next(next); |
| 4843 next = this.advance(); | 4674 next = this.advance(); |
| 4844 } | 4675 } |
| 4845 var isAscii = true; | 4676 var isAscii = true; |
| 4846 while (true) { | 4677 while (true) { |
| 4847 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { | 4678 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { |
| 4848 if (state != null) { | 4679 if (state != null) { |
| 4849 state = state.next(next); | 4680 state = state.next(next); |
| 4850 } | 4681 } |
| 4851 } | 4682 } |
| 4852 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*/) { | 4683 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*/) { |
| 4853 state = null; | 4684 state = null; |
| 4854 } | 4685 } |
| 4855 else if (next < 128) { | 4686 else if (next < 128) { |
| 4856 if (state != null && $notnull_bool(state.isLeaf())) { | 4687 if (state != null && state.isLeaf()) { |
| 4857 this.appendKeywordToken(state.get$keyword()); | 4688 this.appendKeywordToken(state.get$keyword()); |
| 4858 } | 4689 } |
| 4859 else if ($notnull_bool(isAscii)) { | 4690 else if (isAscii) { |
| 4860 this.appendByteStringToken$2(97/*null.IDENTIFIER_TOKEN*/, this.asciiStri
ng(start)); | 4691 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString
(start)); |
| 4861 } | 4692 } |
| 4862 else { | 4693 else { |
| 4863 this.appendByteStringToken$2(97/*null.IDENTIFIER_TOKEN*/, this.utf8Strin
g(start, -1)); | 4694 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String(
start, -1)); |
| 4864 } | 4695 } |
| 4865 return next; | 4696 return next; |
| 4866 } | 4697 } |
| 4867 else { | 4698 else { |
| 4868 var nonAsciiStart = this.get$byteOffset(); | 4699 var nonAsciiStart = this.get$byteOffset(); |
| 4869 do { | 4700 do { |
| 4870 next = this.nextByte(); | 4701 next = this.nextByte(); |
| 4871 } | 4702 } |
| 4872 while (next > 127) | 4703 while (next > 127) |
| 4873 var string = this.utf8String(nonAsciiStart, -1).toString$0(); | 4704 var string = this.utf8String(nonAsciiStart, -1).toString$0(); |
| 4874 isAscii = false; | 4705 isAscii = false; |
| 4875 this.addToCharOffset(string.length); | 4706 this.addToCharOffset(string.length); |
| 4876 return next; | 4707 return next; |
| 4877 } | 4708 } |
| 4878 next = this.advance(); | 4709 next = this.advance(); |
| 4879 } | 4710 } |
| 4880 } | 4711 } |
| 4881 AbstractScanner.prototype.tokenizeRawString = function(next) { | 4712 AbstractScanner.prototype.tokenizeRawString = function(next) { |
| 4882 var start = this.get$byteOffset(); | 4713 var start = this.get$byteOffset(); |
| 4883 next = this.advance(); | 4714 next = this.advance(); |
| 4884 if (next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/) { | 4715 if (next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/) { |
| 4885 return this.tokenizeString(next, start, true); | 4716 return this.tokenizeString(next, start, true); |
| 4886 } | 4717 } |
| 4887 else { | 4718 else { |
| 4888 $throw(new MalformedInputException(this.get$charOffset())); | 4719 $throw(new MalformedInputException(this.get$charOffset())); |
| 4889 } | 4720 } |
| 4890 } | 4721 } |
| 4891 AbstractScanner.prototype.tokenizeString = function(next, start, raw) { | 4722 AbstractScanner.prototype.tokenizeString = function(next, start, raw) { |
| 4892 var $0; | |
| 4893 var q = next; | 4723 var q = next; |
| 4894 next = this.advance(); | 4724 next = this.advance(); |
| 4895 if (q == next) { | 4725 if (q == next) { |
| 4896 next = this.advance(); | 4726 next = this.advance(); |
| 4897 if (q == next) { | 4727 if (q == next) { |
| 4898 return this.tokenizeMultiLineString(q, start, raw); | 4728 return this.tokenizeMultiLineString(q, start, raw); |
| 4899 } | 4729 } |
| 4900 else { | 4730 else { |
| 4901 this.appendByteStringToken$2(39/*null.STRING_TOKEN*/, this.utf8String(star
t, -1)); | 4731 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
-1)); |
| 4902 return next; | 4732 return next; |
| 4903 } | 4733 } |
| 4904 } | 4734 } |
| 4905 if ($notnull_bool(raw)) { | 4735 if (raw) { |
| 4906 return this.tokenizeSingleLineRawString(next, q, start); | 4736 return this.tokenizeSingleLineRawString(next, q, start); |
| 4907 } | 4737 } |
| 4908 else { | 4738 else { |
| 4909 return this.tokenizeSingleLineString(next, q, start); | 4739 return this.tokenizeSingleLineString(next, q, start); |
| 4910 } | 4740 } |
| 4911 } | 4741 } |
| 4912 AbstractScanner.prototype.tokenizeSingleLineString = function(next, q1, start) { | 4742 AbstractScanner.prototype.tokenizeSingleLineString = function(next, q1, start) { |
| 4913 var $0; | |
| 4914 while (next != -1) { | 4743 while (next != -1) { |
| 4915 if (next == q1) { | 4744 if (next == q1) { |
| 4916 this.appendByteStringToken$2(39/*null.STRING_TOKEN*/, this.utf8String(star
t, 0)); | 4745 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); |
| 4917 return this.advance(); | 4746 return this.advance(); |
| 4918 } | 4747 } |
| 4919 else if (next == 92/*null.$BACKSLASH*/) { | 4748 else if (next == 92/*null.$BACKSLASH*/) { |
| 4920 next = this.advance(); | 4749 next = this.advance(); |
| 4921 if (next == -1) { | 4750 if (next == -1) { |
| 4922 $throw(new MalformedInputException(this.get$charOffset())); | 4751 $throw(new MalformedInputException(this.get$charOffset())); |
| 4923 } | 4752 } |
| 4924 } | 4753 } |
| 4925 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { | 4754 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { |
| 4926 $throw(new MalformedInputException(this.get$charOffset())); | 4755 $throw(new MalformedInputException(this.get$charOffset())); |
| 4927 } | 4756 } |
| 4928 next = this.advance(); | 4757 next = this.advance(); |
| 4929 } | 4758 } |
| 4930 $throw(new MalformedInputException(this.get$charOffset())); | 4759 $throw(new MalformedInputException(this.get$charOffset())); |
| 4931 } | 4760 } |
| 4932 AbstractScanner.prototype.tokenizeSingleLineRawString = function(next, q1, start
) { | 4761 AbstractScanner.prototype.tokenizeSingleLineRawString = function(next, q1, start
) { |
| 4933 var $0; | |
| 4934 next = this.advance(); | 4762 next = this.advance(); |
| 4935 while (next != -1) { | 4763 while (next != -1) { |
| 4936 if (next == q1) { | 4764 if (next == q1) { |
| 4937 this.appendByteStringToken$2(39/*null.STRING_TOKEN*/, this.utf8String(star
t, 0)); | 4765 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); |
| 4938 return this.advance(); | 4766 return this.advance(); |
| 4939 } | 4767 } |
| 4940 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { | 4768 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { |
| 4941 $throw(new MalformedInputException(this.get$charOffset())); | 4769 $throw(new MalformedInputException(this.get$charOffset())); |
| 4942 } | 4770 } |
| 4943 next = this.advance(); | 4771 next = this.advance(); |
| 4944 } | 4772 } |
| 4945 $throw(new MalformedInputException(this.get$charOffset())); | 4773 $throw(new MalformedInputException(this.get$charOffset())); |
| 4946 } | 4774 } |
| 4947 AbstractScanner.prototype.tokenizeMultiLineString = function(q, start, raw) { | 4775 AbstractScanner.prototype.tokenizeMultiLineString = function(q, start, raw) { |
| 4948 var $0; | |
| 4949 var next = this.advance(); | 4776 var next = this.advance(); |
| 4950 while (next != -1) { | 4777 while (next != -1) { |
| 4951 if (next == q) { | 4778 if (next == q) { |
| 4952 next = this.advance(); | 4779 next = this.advance(); |
| 4953 if (next == q) { | 4780 if (next == q) { |
| 4954 next = this.advance(); | 4781 next = this.advance(); |
| 4955 if (next == q) { | 4782 if (next == q) { |
| 4956 this.appendByteStringToken$2(39/*null.STRING_TOKEN*/, this.utf8String(
start, 0)); | 4783 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st
art, 0)); |
| 4957 return this.advance(); | 4784 return this.advance(); |
| 4958 } | 4785 } |
| 4959 } | 4786 } |
| 4960 } | 4787 } |
| 4961 next = this.advance(); | 4788 next = this.advance(); |
| 4962 } | 4789 } |
| 4963 return next; | 4790 return next; |
| 4964 } | 4791 } |
| 4965 AbstractScanner.prototype.appendByteStringToken$2 = AbstractScanner.prototype.ap
pendByteStringToken; | |
| 4966 // ********** Code for AbstractScanner$S ************** | 4792 // ********** Code for AbstractScanner$S ************** |
| 4967 function AbstractScanner$S() {} | 4793 function AbstractScanner$S() {} |
| 4968 $inherits(AbstractScanner$S, AbstractScanner); | 4794 $inherits(AbstractScanner$S, AbstractScanner); |
| 4969 AbstractScanner$S.prototype.tokenize = function() { | 4795 AbstractScanner$S.prototype.tokenize = function() { |
| 4970 var next = this.advance(); | 4796 var next = this.advance(); |
| 4971 while (next != -1) { | 4797 while (next != -1) { |
| 4972 next = this.bigSwitch(next); | 4798 next = this.bigSwitch(next); |
| 4973 } | 4799 } |
| 4974 this.appendEofToken(); | 4800 this.appendEofToken(); |
| 4975 return this.firstToken(); | 4801 return this.firstToken(); |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5395 return this.select(61/*null.$EQ*/, "<<=", "<<"); | 5221 return this.select(61/*null.$EQ*/, "<<=", "<<"); |
| 5396 | 5222 |
| 5397 default: | 5223 default: |
| 5398 | 5224 |
| 5399 this.appendBeginGroup(60/*null.LT_TOKEN*/, "<"); | 5225 this.appendBeginGroup(60/*null.LT_TOKEN*/, "<"); |
| 5400 return next; | 5226 return next; |
| 5401 | 5227 |
| 5402 } | 5228 } |
| 5403 } | 5229 } |
| 5404 AbstractScanner$S.prototype.tokenizeNumber = function(next) { | 5230 AbstractScanner$S.prototype.tokenizeNumber = function(next) { |
| 5405 var $0; | |
| 5406 var start = this.get$byteOffset(); | 5231 var start = this.get$byteOffset(); |
| 5407 while (true) { | 5232 while (true) { |
| 5408 next = this.advance(); | 5233 next = this.advance(); |
| 5409 switch (next) { | 5234 switch (next) { |
| 5410 case 48/*null.$0*/: | 5235 case 48/*null.$0*/: |
| 5411 case 49/*null.$1*/: | 5236 case 49/*null.$1*/: |
| 5412 case 50/*null.$2*/: | 5237 case 50/*null.$2*/: |
| 5413 case 51/*null.$3*/: | 5238 case 51/*null.$3*/: |
| 5414 case 52/*null.$4*/: | 5239 case 52/*null.$4*/: |
| 5415 case 53/*null.$5*/: | 5240 case 53/*null.$5*/: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5426 | 5251 |
| 5427 case 101/*null.$e*/: | 5252 case 101/*null.$e*/: |
| 5428 case 69/*null.$E*/: | 5253 case 69/*null.$E*/: |
| 5429 case 100/*null.$d*/: | 5254 case 100/*null.$d*/: |
| 5430 case 68/*null.$D*/: | 5255 case 68/*null.$D*/: |
| 5431 | 5256 |
| 5432 return this.tokenizeFractionPart(next, start); | 5257 return this.tokenizeFractionPart(next, start); |
| 5433 | 5258 |
| 5434 default: | 5259 default: |
| 5435 | 5260 |
| 5436 this.appendByteStringToken$2(105/*null.INT_TOKEN*/, this.asciiString(sta
rt)); | 5261 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start
)); |
| 5437 return next; | 5262 return next; |
| 5438 | 5263 |
| 5439 } | 5264 } |
| 5440 } | 5265 } |
| 5441 } | 5266 } |
| 5442 AbstractScanner$S.prototype.tokenizeHexOrNumber = function(next) { | 5267 AbstractScanner$S.prototype.tokenizeHexOrNumber = function(next) { |
| 5443 var x = this.peek(); | 5268 var x = this.peek(); |
| 5444 if (x == 120/*null.$x*/ || x == 88/*null.$X*/) { | 5269 if (x == 120/*null.$x*/ || x == 88/*null.$X*/) { |
| 5445 this.advance(); | 5270 this.advance(); |
| 5446 return this.tokenizeHex(x); | 5271 return this.tokenizeHex(x); |
| 5447 } | 5272 } |
| 5448 return this.tokenizeNumber(next); | 5273 return this.tokenizeNumber(next); |
| 5449 } | 5274 } |
| 5450 AbstractScanner$S.prototype.tokenizeHex = function(next) { | 5275 AbstractScanner$S.prototype.tokenizeHex = function(next) { |
| 5451 var $0; | |
| 5452 var start = this.get$byteOffset(); | 5276 var start = this.get$byteOffset(); |
| 5453 var hasDigits = false; | 5277 var hasDigits = false; |
| 5454 while (true) { | 5278 while (true) { |
| 5455 next = this.advance(); | 5279 next = this.advance(); |
| 5456 switch (next) { | 5280 switch (next) { |
| 5457 case 48/*null.$0*/: | 5281 case 48/*null.$0*/: |
| 5458 case 49/*null.$1*/: | 5282 case 49/*null.$1*/: |
| 5459 case 50/*null.$2*/: | 5283 case 50/*null.$2*/: |
| 5460 case 51/*null.$3*/: | 5284 case 51/*null.$3*/: |
| 5461 case 52/*null.$4*/: | 5285 case 52/*null.$4*/: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5475 case 99/*null.$c*/: | 5299 case 99/*null.$c*/: |
| 5476 case 100/*null.$d*/: | 5300 case 100/*null.$d*/: |
| 5477 case 101/*null.$e*/: | 5301 case 101/*null.$e*/: |
| 5478 case 102/*null.$f*/: | 5302 case 102/*null.$f*/: |
| 5479 | 5303 |
| 5480 hasDigits = true; | 5304 hasDigits = true; |
| 5481 break; | 5305 break; |
| 5482 | 5306 |
| 5483 default: | 5307 default: |
| 5484 | 5308 |
| 5485 if (!$notnull_bool(hasDigits)) { | 5309 if (!hasDigits) { |
| 5486 $throw(new MalformedInputException(this.get$charOffset())); | 5310 $throw(new MalformedInputException(this.get$charOffset())); |
| 5487 } | 5311 } |
| 5488 this.appendByteStringToken$2(120/*null.HEXADECIMAL_TOKEN*/, this.asciiSt
ring(start)); | 5312 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); |
| 5489 return next; | 5313 return next; |
| 5490 | 5314 |
| 5491 } | 5315 } |
| 5492 } | 5316 } |
| 5493 } | 5317 } |
| 5494 AbstractScanner$S.prototype.tokenizeDotOrNumber = function(next) { | 5318 AbstractScanner$S.prototype.tokenizeDotOrNumber = function(next) { |
| 5495 var start = this.get$byteOffset(); | 5319 var start = this.get$byteOffset(); |
| 5496 next = this.advance(); | 5320 next = this.advance(); |
| 5497 switch (next) { | 5321 switch (next) { |
| 5498 case 48/*null.$0*/: | 5322 case 48/*null.$0*/: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 5515 return this.select(46/*null.$PERIOD*/, "...", ".."); | 5339 return this.select(46/*null.$PERIOD*/, "...", ".."); |
| 5516 | 5340 |
| 5517 default: | 5341 default: |
| 5518 | 5342 |
| 5519 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 5343 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 5520 return next; | 5344 return next; |
| 5521 | 5345 |
| 5522 } | 5346 } |
| 5523 } | 5347 } |
| 5524 AbstractScanner$S.prototype.tokenizeFractionPart = function(next, start) { | 5348 AbstractScanner$S.prototype.tokenizeFractionPart = function(next, start) { |
| 5525 var $0; | |
| 5526 var done = false; | 5349 var done = false; |
| 5527 LOOP: | 5350 LOOP: |
| 5528 while (!$notnull_bool(done)) { | 5351 while (!done) { |
| 5529 switch (next) { | 5352 switch (next) { |
| 5530 case 48/*null.$0*/: | 5353 case 48/*null.$0*/: |
| 5531 case 49/*null.$1*/: | 5354 case 49/*null.$1*/: |
| 5532 case 50/*null.$2*/: | 5355 case 50/*null.$2*/: |
| 5533 case 51/*null.$3*/: | 5356 case 51/*null.$3*/: |
| 5534 case 52/*null.$4*/: | 5357 case 52/*null.$4*/: |
| 5535 case 53/*null.$5*/: | 5358 case 53/*null.$5*/: |
| 5536 case 54/*null.$6*/: | 5359 case 54/*null.$6*/: |
| 5537 case 55/*null.$7*/: | 5360 case 55/*null.$7*/: |
| 5538 case 56/*null.$8*/: | 5361 case 56/*null.$8*/: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5551 | 5374 |
| 5552 done = true; | 5375 done = true; |
| 5553 continue LOOP; | 5376 continue LOOP; |
| 5554 | 5377 |
| 5555 } | 5378 } |
| 5556 next = this.advance(); | 5379 next = this.advance(); |
| 5557 } | 5380 } |
| 5558 if (next == 100/*null.$d*/ || next == 68/*null.$D*/) { | 5381 if (next == 100/*null.$d*/ || next == 68/*null.$D*/) { |
| 5559 next = this.advance(); | 5382 next = this.advance(); |
| 5560 } | 5383 } |
| 5561 this.appendByteStringToken$2(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)
); | 5384 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); |
| 5562 return next; | 5385 return next; |
| 5563 } | 5386 } |
| 5564 AbstractScanner$S.prototype.tokenizeExponent = function(next) { | 5387 AbstractScanner$S.prototype.tokenizeExponent = function(next) { |
| 5565 if (next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/) { | 5388 if (next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/) { |
| 5566 next = this.advance(); | 5389 next = this.advance(); |
| 5567 } | 5390 } |
| 5568 var hasDigits = false; | 5391 var hasDigits = false; |
| 5569 while (true) { | 5392 while (true) { |
| 5570 switch (next) { | 5393 switch (next) { |
| 5571 case 48/*null.$0*/: | 5394 case 48/*null.$0*/: |
| 5572 case 49/*null.$1*/: | 5395 case 49/*null.$1*/: |
| 5573 case 50/*null.$2*/: | 5396 case 50/*null.$2*/: |
| 5574 case 51/*null.$3*/: | 5397 case 51/*null.$3*/: |
| 5575 case 52/*null.$4*/: | 5398 case 52/*null.$4*/: |
| 5576 case 53/*null.$5*/: | 5399 case 53/*null.$5*/: |
| 5577 case 54/*null.$6*/: | 5400 case 54/*null.$6*/: |
| 5578 case 55/*null.$7*/: | 5401 case 55/*null.$7*/: |
| 5579 case 56/*null.$8*/: | 5402 case 56/*null.$8*/: |
| 5580 case 57/*null.$9*/: | 5403 case 57/*null.$9*/: |
| 5581 | 5404 |
| 5582 hasDigits = true; | 5405 hasDigits = true; |
| 5583 break; | 5406 break; |
| 5584 | 5407 |
| 5585 default: | 5408 default: |
| 5586 | 5409 |
| 5587 if (!$notnull_bool(hasDigits)) { | 5410 if (!hasDigits) { |
| 5588 $throw(new MalformedInputException(this.get$charOffset())); | 5411 $throw(new MalformedInputException(this.get$charOffset())); |
| 5589 } | 5412 } |
| 5590 return next; | 5413 return next; |
| 5591 | 5414 |
| 5592 } | 5415 } |
| 5593 next = this.advance(); | 5416 next = this.advance(); |
| 5594 } | 5417 } |
| 5595 } | 5418 } |
| 5596 AbstractScanner$S.prototype.tokenizeSlashOrComment = function(next) { | 5419 AbstractScanner$S.prototype.tokenizeSlashOrComment = function(next) { |
| 5597 next = this.advance(); | 5420 next = this.advance(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5650 | 5473 |
| 5651 default: | 5474 default: |
| 5652 | 5475 |
| 5653 next = this.advance(); | 5476 next = this.advance(); |
| 5654 break; | 5477 break; |
| 5655 | 5478 |
| 5656 } | 5479 } |
| 5657 } | 5480 } |
| 5658 } | 5481 } |
| 5659 AbstractScanner$S.prototype.tokenizeIdentifier = function(next) { | 5482 AbstractScanner$S.prototype.tokenizeIdentifier = function(next) { |
| 5660 var $0; | |
| 5661 var start = this.get$byteOffset(); | 5483 var start = this.get$byteOffset(); |
| 5662 var state = null; | 5484 var state = null; |
| 5663 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { | 5485 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { |
| 5664 state = KeywordState.get$KEYWORD_STATE().next(next); | 5486 state = KeywordState.get$KEYWORD_STATE().next(next); |
| 5665 next = this.advance(); | 5487 next = this.advance(); |
| 5666 } | 5488 } |
| 5667 var isAscii = true; | 5489 var isAscii = true; |
| 5668 while (true) { | 5490 while (true) { |
| 5669 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { | 5491 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { |
| 5670 if (state != null) { | 5492 if (state != null) { |
| 5671 state = state.next(next); | 5493 state = state.next(next); |
| 5672 } | 5494 } |
| 5673 } | 5495 } |
| 5674 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*/) { | 5496 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*/) { |
| 5675 state = null; | 5497 state = null; |
| 5676 } | 5498 } |
| 5677 else if (next < 128) { | 5499 else if (next < 128) { |
| 5678 if (state != null && $notnull_bool(state.isLeaf())) { | 5500 if (state != null && state.isLeaf()) { |
| 5679 this.appendKeywordToken(state.get$keyword()); | 5501 this.appendKeywordToken(state.get$keyword()); |
| 5680 } | 5502 } |
| 5681 else if ($notnull_bool(isAscii)) { | 5503 else if (isAscii) { |
| 5682 this.appendByteStringToken$2(97/*null.IDENTIFIER_TOKEN*/, this.asciiStri
ng(start)); | 5504 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString
(start)); |
| 5683 } | 5505 } |
| 5684 else { | 5506 else { |
| 5685 this.appendByteStringToken$2(97/*null.IDENTIFIER_TOKEN*/, this.utf8Strin
g(start, -1)); | 5507 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String(
start, -1)); |
| 5686 } | 5508 } |
| 5687 return next; | 5509 return next; |
| 5688 } | 5510 } |
| 5689 else { | 5511 else { |
| 5690 var nonAsciiStart = this.get$byteOffset(); | 5512 var nonAsciiStart = this.get$byteOffset(); |
| 5691 do { | 5513 do { |
| 5692 next = this.nextByte(); | 5514 next = this.nextByte(); |
| 5693 } | 5515 } |
| 5694 while (next > 127) | 5516 while (next > 127) |
| 5695 var string = this.utf8String(nonAsciiStart, -1).toString$0(); | 5517 var string = this.utf8String(nonAsciiStart, -1).toString$0(); |
| 5696 isAscii = false; | 5518 isAscii = false; |
| 5697 this.addToCharOffset(string.length); | 5519 this.addToCharOffset(string.length); |
| 5698 return next; | 5520 return next; |
| 5699 } | 5521 } |
| 5700 next = this.advance(); | 5522 next = this.advance(); |
| 5701 } | 5523 } |
| 5702 } | 5524 } |
| 5703 AbstractScanner$S.prototype.tokenizeRawString = function(next) { | 5525 AbstractScanner$S.prototype.tokenizeRawString = function(next) { |
| 5704 var start = this.get$byteOffset(); | 5526 var start = this.get$byteOffset(); |
| 5705 next = this.advance(); | 5527 next = this.advance(); |
| 5706 if (next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/) { | 5528 if (next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/) { |
| 5707 return this.tokenizeString(next, start, true); | 5529 return this.tokenizeString(next, start, true); |
| 5708 } | 5530 } |
| 5709 else { | 5531 else { |
| 5710 $throw(new MalformedInputException(this.get$charOffset())); | 5532 $throw(new MalformedInputException(this.get$charOffset())); |
| 5711 } | 5533 } |
| 5712 } | 5534 } |
| 5713 AbstractScanner$S.prototype.tokenizeString = function(next, start, raw) { | 5535 AbstractScanner$S.prototype.tokenizeString = function(next, start, raw) { |
| 5714 var $0; | |
| 5715 var q = next; | 5536 var q = next; |
| 5716 next = this.advance(); | 5537 next = this.advance(); |
| 5717 if (q == next) { | 5538 if (q == next) { |
| 5718 next = this.advance(); | 5539 next = this.advance(); |
| 5719 if (q == next) { | 5540 if (q == next) { |
| 5720 return this.tokenizeMultiLineString(q, start, raw); | 5541 return this.tokenizeMultiLineString(q, start, raw); |
| 5721 } | 5542 } |
| 5722 else { | 5543 else { |
| 5723 this.appendByteStringToken$2(39/*null.STRING_TOKEN*/, this.utf8String(star
t, -1)); | 5544 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
-1)); |
| 5724 return next; | 5545 return next; |
| 5725 } | 5546 } |
| 5726 } | 5547 } |
| 5727 if ($notnull_bool(raw)) { | 5548 if (raw) { |
| 5728 return this.tokenizeSingleLineRawString(next, q, start); | 5549 return this.tokenizeSingleLineRawString(next, q, start); |
| 5729 } | 5550 } |
| 5730 else { | 5551 else { |
| 5731 return this.tokenizeSingleLineString(next, q, start); | 5552 return this.tokenizeSingleLineString(next, q, start); |
| 5732 } | 5553 } |
| 5733 } | 5554 } |
| 5734 AbstractScanner$S.prototype.tokenizeSingleLineString = function(next, q1, start)
{ | 5555 AbstractScanner$S.prototype.tokenizeSingleLineString = function(next, q1, start)
{ |
| 5735 var $0; | |
| 5736 while (next != -1) { | 5556 while (next != -1) { |
| 5737 if (next == q1) { | 5557 if (next == q1) { |
| 5738 this.appendByteStringToken$2(39/*null.STRING_TOKEN*/, this.utf8String(star
t, 0)); | 5558 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); |
| 5739 return this.advance(); | 5559 return this.advance(); |
| 5740 } | 5560 } |
| 5741 else if (next == 92/*null.$BACKSLASH*/) { | 5561 else if (next == 92/*null.$BACKSLASH*/) { |
| 5742 next = this.advance(); | 5562 next = this.advance(); |
| 5743 if (next == -1) { | 5563 if (next == -1) { |
| 5744 $throw(new MalformedInputException(this.get$charOffset())); | 5564 $throw(new MalformedInputException(this.get$charOffset())); |
| 5745 } | 5565 } |
| 5746 } | 5566 } |
| 5747 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { | 5567 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { |
| 5748 $throw(new MalformedInputException(this.get$charOffset())); | 5568 $throw(new MalformedInputException(this.get$charOffset())); |
| 5749 } | 5569 } |
| 5750 next = this.advance(); | 5570 next = this.advance(); |
| 5751 } | 5571 } |
| 5752 $throw(new MalformedInputException(this.get$charOffset())); | 5572 $throw(new MalformedInputException(this.get$charOffset())); |
| 5753 } | 5573 } |
| 5754 AbstractScanner$S.prototype.tokenizeSingleLineRawString = function(next, q1, sta
rt) { | 5574 AbstractScanner$S.prototype.tokenizeSingleLineRawString = function(next, q1, sta
rt) { |
| 5755 var $0; | |
| 5756 next = this.advance(); | 5575 next = this.advance(); |
| 5757 while (next != -1) { | 5576 while (next != -1) { |
| 5758 if (next == q1) { | 5577 if (next == q1) { |
| 5759 this.appendByteStringToken$2(39/*null.STRING_TOKEN*/, this.utf8String(star
t, 0)); | 5578 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); |
| 5760 return this.advance(); | 5579 return this.advance(); |
| 5761 } | 5580 } |
| 5762 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { | 5581 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { |
| 5763 $throw(new MalformedInputException(this.get$charOffset())); | 5582 $throw(new MalformedInputException(this.get$charOffset())); |
| 5764 } | 5583 } |
| 5765 next = this.advance(); | 5584 next = this.advance(); |
| 5766 } | 5585 } |
| 5767 $throw(new MalformedInputException(this.get$charOffset())); | 5586 $throw(new MalformedInputException(this.get$charOffset())); |
| 5768 } | 5587 } |
| 5769 AbstractScanner$S.prototype.tokenizeMultiLineString = function(q, start, raw) { | 5588 AbstractScanner$S.prototype.tokenizeMultiLineString = function(q, start, raw) { |
| 5770 var $0; | |
| 5771 var next = this.advance(); | 5589 var next = this.advance(); |
| 5772 while (next != -1) { | 5590 while (next != -1) { |
| 5773 if (next == q) { | 5591 if (next == q) { |
| 5774 next = this.advance(); | 5592 next = this.advance(); |
| 5775 if (next == q) { | 5593 if (next == q) { |
| 5776 next = this.advance(); | 5594 next = this.advance(); |
| 5777 if (next == q) { | 5595 if (next == q) { |
| 5778 this.appendByteStringToken$2(39/*null.STRING_TOKEN*/, this.utf8String(
start, 0)); | 5596 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st
art, 0)); |
| 5779 return this.advance(); | 5597 return this.advance(); |
| 5780 } | 5598 } |
| 5781 } | 5599 } |
| 5782 } | 5600 } |
| 5783 next = this.advance(); | 5601 next = this.advance(); |
| 5784 } | 5602 } |
| 5785 return next; | 5603 return next; |
| 5786 } | 5604 } |
| 5787 // ********** Code for MalformedInputException ************** | 5605 // ********** Code for MalformedInputException ************** |
| 5788 function MalformedInputException(message) { | 5606 function MalformedInputException(message) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 5800 CompilerTask.call(this, compiler); | 5618 CompilerTask.call(this, compiler); |
| 5801 // Initializers done | 5619 // Initializers done |
| 5802 } | 5620 } |
| 5803 $inherits(ScannerTask, CompilerTask); | 5621 $inherits(ScannerTask, CompilerTask); |
| 5804 ScannerTask.prototype.get$name = function() { | 5622 ScannerTask.prototype.get$name = function() { |
| 5805 return 'Scanner'; | 5623 return 'Scanner'; |
| 5806 } | 5624 } |
| 5807 ScannerTask.prototype.scan = function(script) { | 5625 ScannerTask.prototype.scan = function(script) { |
| 5808 var $this = this; // closure support | 5626 var $this = this; // closure support |
| 5809 this.measure((function () { | 5627 this.measure((function () { |
| 5810 var $0; | |
| 5811 var elements = $this.scanElements(script.get$text()); | 5628 var elements = $this.scanElements(script.get$text()); |
| 5812 for (var link = elements; | 5629 for (var link = elements; |
| 5813 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Lin
k$Element())) { | 5630 !link.isEmpty(); link = link.get$tail()) { |
| 5814 $this.compiler.universe.define((($0 = link.get$head()) && $0.is$Element())
); | 5631 $this.compiler.universe.define(link.get$head()); |
| 5815 } | 5632 } |
| 5816 }) | 5633 }) |
| 5817 ); | 5634 ); |
| 5818 } | 5635 } |
| 5819 ScannerTask.prototype.scanElements = function(text) { | 5636 ScannerTask.prototype.scanElements = function(text) { |
| 5820 var tokens = new StringScanner(text).tokenize(); | 5637 var tokens = new StringScanner(text).tokenize(); |
| 5821 var listener = new ElementListener(this.compiler); | 5638 var listener = new ElementListener(this.compiler); |
| 5822 var parser = new PartialParser(listener); | 5639 var parser = new PartialParser(listener); |
| 5823 parser.parseUnit(tokens); | 5640 parser.parseUnit(tokens); |
| 5824 return listener.topLevelElements; | 5641 return listener.topLevelElements; |
| 5825 } | 5642 } |
| 5826 // ********** Code for PartialParser ************** | 5643 // ********** Code for PartialParser ************** |
| 5827 function PartialParser(listener) { | 5644 function PartialParser(listener) { |
| 5828 var $this = this; // closure support | 5645 var $this = this; // closure support |
| 5829 this.listener = listener; | 5646 this.listener = listener; |
| 5830 // Initializers done | 5647 // Initializers done |
| 5831 this.beginTypeArguments = (function (t) { | 5648 this.beginTypeArguments = (function (t) { |
| 5832 return $this.listener.beginTypeArguments$1(t); | 5649 return $this.listener.beginTypeArguments$1(t); |
| 5833 }) | 5650 }) |
| 5834 ; | 5651 ; |
| 5835 this.parseTypeFunction = (function (t) { | 5652 this.parseTypeFunction = (function (t) { |
| 5836 return $this.parseType((t && t.is$Token())); | 5653 return $this.parseType(t); |
| 5837 }) | 5654 }) |
| 5838 ; | 5655 ; |
| 5839 this.endTypeArguments = (function (c, bt, et) { | 5656 this.endTypeArguments = (function (c, bt, et) { |
| 5840 return $this.listener.endTypeArguments$3(c, bt, et); | 5657 return $this.listener.endTypeArguments$3(c, bt, et); |
| 5841 }) | 5658 }) |
| 5842 ; | 5659 ; |
| 5843 this.handleNoTypeArguments = (function (t) { | 5660 this.handleNoTypeArguments = (function (t) { |
| 5844 return $this.listener.handleNoTypeArguments$1(t); | 5661 return $this.listener.handleNoTypeArguments$1(t); |
| 5845 }) | 5662 }) |
| 5846 ; | 5663 ; |
| 5847 this.beginTypeVariables = (function (t) { | 5664 this.beginTypeVariables = (function (t) { |
| 5848 return $this.listener.beginTypeVariables$1(t); | 5665 return $this.listener.beginTypeVariables$1(t); |
| 5849 }) | 5666 }) |
| 5850 ; | 5667 ; |
| 5851 this.parseTypeVariableFunction = (function (t) { | 5668 this.parseTypeVariableFunction = (function (t) { |
| 5852 return $this.parseTypeVariable((t && t.is$Token())); | 5669 return $this.parseTypeVariable(t); |
| 5853 }) | 5670 }) |
| 5854 ; | 5671 ; |
| 5855 this.endTypeVariables = (function (c, bt, et) { | 5672 this.endTypeVariables = (function (c, bt, et) { |
| 5856 return $this.listener.endTypeVariables$3(c, bt, et); | 5673 return $this.listener.endTypeVariables$3(c, bt, et); |
| 5857 }) | 5674 }) |
| 5858 ; | 5675 ; |
| 5859 this.handleNoTypeVariables = (function (t) { | 5676 this.handleNoTypeVariables = (function (t) { |
| 5860 return $this.listener.handleNoTypeVariables$1(t); | 5677 return $this.listener.handleNoTypeVariables$1(t); |
| 5861 }) | 5678 }) |
| 5862 ; | 5679 ; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5932 } | 5749 } |
| 5933 else { | 5750 else { |
| 5934 return this.parseTypeOpt(token); | 5751 return this.parseTypeOpt(token); |
| 5935 } | 5752 } |
| 5936 } | 5753 } |
| 5937 PartialParser.prototype.parseFormalParameters = function(token) { | 5754 PartialParser.prototype.parseFormalParameters = function(token) { |
| 5938 var begin = token; | 5755 var begin = token; |
| 5939 this.listener.beginFormalParameters$1(begin); | 5756 this.listener.beginFormalParameters$1(begin); |
| 5940 this.expect('(', token); | 5757 this.expect('(', token); |
| 5941 var parameterCount = 0; | 5758 var parameterCount = 0; |
| 5942 if ($notnull_bool(this.optional(')', token.next))) { | 5759 if (this.optional(')', token.next)) { |
| 5943 this.listener.endFormalParameters$3(parameterCount, begin, token.next); | 5760 this.listener.endFormalParameters$3(parameterCount, begin, token.next); |
| 5944 return token.next.next; | 5761 return token.next.next; |
| 5945 } | 5762 } |
| 5946 do { | 5763 do { |
| 5947 this.listener.beginFormalParameter$1(token); | 5764 this.listener.beginFormalParameter$1(token); |
| 5948 token = this.parseTypeOpt(this.next(token)); | 5765 token = this.parseTypeOpt(this.next(token)); |
| 5949 token = this.parseIdentifier(token); | 5766 token = this.parseIdentifier(token); |
| 5950 this.listener.endFormalParameter$1(token); | 5767 this.listener.endFormalParameter$1(token); |
| 5951 ++parameterCount; | 5768 ++parameterCount; |
| 5952 } | 5769 } |
| 5953 while ($notnull_bool(this.optional(',', token))) | 5770 while (this.optional(',', token)) |
| 5954 this.listener.endFormalParameters$3(parameterCount, begin, token); | 5771 this.listener.endFormalParameters$3(parameterCount, begin, token); |
| 5955 return this.expect(')', token); | 5772 return this.expect(')', token); |
| 5956 } | 5773 } |
| 5957 PartialParser.prototype.parseTypeOpt = function(token) { | 5774 PartialParser.prototype.parseTypeOpt = function(token) { |
| 5958 var nextValue = token.next.get$stringValue(); | 5775 var nextValue = token.next.get$stringValue(); |
| 5959 switch (true) { | 5776 switch (true) { |
| 5960 case nextValue === '<': | 5777 case nextValue === '<': |
| 5961 case nextValue === '.': | 5778 case nextValue === '.': |
| 5962 case this.isIdentifier(token.next): | 5779 case this.isIdentifier(token.next): |
| 5963 | 5780 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 5981 | 5798 |
| 5982 return token.get$value().isPseudo; | 5799 return token.get$value().isPseudo; |
| 5983 | 5800 |
| 5984 default: | 5801 default: |
| 5985 | 5802 |
| 5986 return false; | 5803 return false; |
| 5987 | 5804 |
| 5988 } | 5805 } |
| 5989 } | 5806 } |
| 5990 PartialParser.prototype.parseSupertypesClauseOpt = function(token) { | 5807 PartialParser.prototype.parseSupertypesClauseOpt = function(token) { |
| 5991 if ($notnull_bool(this.optional('extends', token))) { | 5808 if (this.optional('extends', token)) { |
| 5992 do { | 5809 do { |
| 5993 token = this.parseType(this.next(token)); | 5810 token = this.parseType(this.next(token)); |
| 5994 } | 5811 } |
| 5995 while ($notnull_bool(this.optional(',', token))) | 5812 while (this.optional(',', token)) |
| 5996 } | 5813 } |
| 5997 return token; | 5814 return token; |
| 5998 } | 5815 } |
| 5999 PartialParser.prototype.parseFactoryClauseOpt = function(token) { | 5816 PartialParser.prototype.parseFactoryClauseOpt = function(token) { |
| 6000 if ($notnull_bool(this.optional('factory', token))) { | 5817 if (this.optional('factory', token)) { |
| 6001 return this.parseType(this.next(token)); | 5818 return this.parseType(this.next(token)); |
| 6002 } | 5819 } |
| 6003 return token; | 5820 return token; |
| 6004 } | 5821 } |
| 6005 PartialParser.prototype.skipBlock = function(token) { | 5822 PartialParser.prototype.skipBlock = function(token) { |
| 6006 if (!$notnull_bool(this.optional('{', token))) { | 5823 if (!this.optional('{', token)) { |
| 6007 return this.listener.expectedBlock$1(token); | 5824 return this.listener.expectedBlock$1(token); |
| 6008 } | 5825 } |
| 6009 var beginGroupToken = (token && token.is$BeginGroupToken()); | 5826 var beginGroupToken = token; |
| 6010 $assert(beginGroupToken.endGroup == null || beginGroupToken.endGroup.kind ===
125/*null.$RBRACE*/, "beginGroupToken.endGroup === null ||\n beginGrou
pToken.endGroup.kind === $RBRACE", "parser.dart", 171, 12); | |
| 6011 return beginGroupToken.endGroup; | 5827 return beginGroupToken.endGroup; |
| 6012 } | 5828 } |
| 6013 PartialParser.prototype.skipArguments = function(token) { | 5829 PartialParser.prototype.skipArguments = function(token) { |
| 6014 return token.endGroup; | 5830 return token.endGroup; |
| 6015 } | 5831 } |
| 6016 PartialParser.prototype.parseClass = function(token) { | 5832 PartialParser.prototype.parseClass = function(token) { |
| 6017 var begin = token; | 5833 var begin = token; |
| 6018 this.listener.beginClass$1(token); | 5834 this.listener.beginClass$1(token); |
| 6019 token = this.parseIdentifier(this.next(token)); | 5835 token = this.parseIdentifier(this.next(token)); |
| 6020 token = this.parseTypeVariablesOpt(token); | 5836 token = this.parseTypeVariablesOpt(token); |
| 6021 var extendsKeyword; | 5837 var extendsKeyword; |
| 6022 if ($notnull_bool(this.optional('extends', token))) { | 5838 if (this.optional('extends', token)) { |
| 6023 extendsKeyword = token; | 5839 extendsKeyword = token; |
| 6024 token = this.parseType(this.next(token)); | 5840 token = this.parseType(this.next(token)); |
| 6025 } | 5841 } |
| 6026 else { | 5842 else { |
| 6027 extendsKeyword = null; | 5843 extendsKeyword = null; |
| 6028 this.listener.handleNoType$1(token); | 5844 this.listener.handleNoType$1(token); |
| 6029 } | 5845 } |
| 6030 var implementsKeyword; | 5846 var implementsKeyword; |
| 6031 var interfacesCount = 0; | 5847 var interfacesCount = 0; |
| 6032 if ($notnull_bool(this.optional('implements', token))) { | 5848 if (this.optional('implements', token)) { |
| 6033 do { | 5849 do { |
| 6034 token = this.parseType(this.next(token)); | 5850 token = this.parseType(this.next(token)); |
| 6035 ++interfacesCount; | 5851 ++interfacesCount; |
| 6036 } | 5852 } |
| 6037 while ($notnull_bool(this.optional(',', token))) | 5853 while (this.optional(',', token)) |
| 6038 } | 5854 } |
| 6039 token = this.parseNativeClassClauseOpt(token); | 5855 token = this.parseNativeClassClauseOpt(token); |
| 6040 token = this.parseClassBody(token); | 5856 token = this.parseClassBody(token); |
| 6041 this.listener.endClass$5(interfacesCount, begin, extendsKeyword, implementsKey
word, token); | 5857 this.listener.endClass$5(interfacesCount, begin, extendsKeyword, implementsKey
word, token); |
| 6042 return token.next; | 5858 return token.next; |
| 6043 } | 5859 } |
| 6044 PartialParser.prototype.parseNativeClassClauseOpt = function(token) { | 5860 PartialParser.prototype.parseNativeClassClauseOpt = function(token) { |
| 6045 if ($notnull_bool(this.optional('native', token))) { | 5861 if (this.optional('native', token)) { |
| 6046 return this.parseString(this.next(token)); | 5862 return this.parseString(this.next(token)); |
| 6047 } | 5863 } |
| 6048 return token; | 5864 return token; |
| 6049 } | 5865 } |
| 6050 PartialParser.prototype.parseString = function(token) { | 5866 PartialParser.prototype.parseString = function(token) { |
| 6051 var $0; | |
| 6052 if (token.kind === 39/*null.STRING_TOKEN*/) { | 5867 if (token.kind === 39/*null.STRING_TOKEN*/) { |
| 6053 return this.next(token); | 5868 return this.next(token); |
| 6054 } | 5869 } |
| 6055 else { | 5870 else { |
| 6056 return (($0 = this.listener.expected$2('string', token)) && $0.is$Token()); | 5871 return this.listener.expected$2('string', token); |
| 6057 } | 5872 } |
| 6058 } | 5873 } |
| 6059 PartialParser.prototype.parseIdentifier = function(token) { | 5874 PartialParser.prototype.parseIdentifier = function(token) { |
| 6060 if ($notnull_bool(this.isIdentifier(token))) { | 5875 if (this.isIdentifier(token)) { |
| 6061 this.listener.handleIdentifier$1(token); | 5876 this.listener.handleIdentifier$1(token); |
| 6062 } | 5877 } |
| 6063 else { | 5878 else { |
| 6064 this.listener.expectedIdentifier$1(token); | 5879 this.listener.expectedIdentifier$1(token); |
| 6065 } | 5880 } |
| 6066 return this.next(token); | 5881 return this.next(token); |
| 6067 } | 5882 } |
| 6068 PartialParser.prototype.expect = function(string, token) { | 5883 PartialParser.prototype.expect = function(string, token) { |
| 6069 if (string !== token.get$stringValue()) { | 5884 if (string !== token.get$stringValue()) { |
| 6070 if (string === '>') { | 5885 if (string === '>') { |
| 6071 if (token.get$stringValue() === '>>') { | 5886 if (token.get$stringValue() === '>>') { |
| 6072 var gt = new StringToken(62/*null.GT_TOKEN*/, '>', token.charOffset + 1)
; | 5887 var gt = new StringToken(62/*null.GT_TOKEN*/, '>', token.charOffset + 1)
; |
| 6073 gt.next = token.next; | 5888 gt.next = token.next; |
| 6074 return gt; | 5889 return gt; |
| 6075 } | 5890 } |
| 6076 else if (token.get$stringValue() === '>>>') { | 5891 else if (token.get$stringValue() === '>>>') { |
| 6077 var gtgt = new StringToken(1024/*null.UNKNOWN_TOKEN*/, '>>', token.charO
ffset + 1); | 5892 var gtgt = new StringToken(1024/*null.UNKNOWN_TOKEN*/, '>>', token.charO
ffset + 1); |
| 6078 gtgt.next = token.next; | 5893 gtgt.next = token.next; |
| 6079 return gtgt; | 5894 return gtgt; |
| 6080 } | 5895 } |
| 6081 } | 5896 } |
| 6082 return this.listener.expected$2(string, token); | 5897 return this.listener.expected$2(string, token); |
| 6083 } | 5898 } |
| 6084 return token.next; | 5899 return token.next; |
| 6085 } | 5900 } |
| 6086 PartialParser.prototype.parseTypeVariable = function(token) { | 5901 PartialParser.prototype.parseTypeVariable = function(token) { |
| 6087 this.listener.beginTypeVariable$1(token); | 5902 this.listener.beginTypeVariable$1(token); |
| 6088 token = this.parseIdentifier(token); | 5903 token = this.parseIdentifier(token); |
| 6089 if ($notnull_bool(this.optional('extends', token))) { | 5904 if (this.optional('extends', token)) { |
| 6090 token = this.parseType(this.next(token)); | 5905 token = this.parseType(this.next(token)); |
| 6091 } | 5906 } |
| 6092 else { | 5907 else { |
| 6093 this.listener.handleNoType$1(token); | 5908 this.listener.handleNoType$1(token); |
| 6094 } | 5909 } |
| 6095 this.listener.endTypeVariable$1(token); | 5910 this.listener.endTypeVariable$1(token); |
| 6096 return token; | 5911 return token; |
| 6097 } | 5912 } |
| 6098 PartialParser.prototype.optional = function(value, token) { | 5913 PartialParser.prototype.optional = function(value, token) { |
| 6099 return value === token.get$stringValue(); | 5914 return value === token.get$stringValue(); |
| 6100 } | 5915 } |
| 6101 PartialParser.prototype.parseType = function(token) { | 5916 PartialParser.prototype.parseType = function(token) { |
| 6102 var begin = token; | 5917 var begin = token; |
| 6103 var identifierCount = 1; | 5918 var identifierCount = 1; |
| 6104 if ($notnull_bool(this.isIdentifier(token))) { | 5919 if (this.isIdentifier(token)) { |
| 6105 token = this.parseIdentifier(token); | 5920 token = this.parseIdentifier(token); |
| 6106 while ($notnull_bool(this.optional('.', token))) { | 5921 while (this.optional('.', token)) { |
| 6107 token = this.parseIdentifier(this.next(token)); | 5922 token = this.parseIdentifier(this.next(token)); |
| 6108 ++identifierCount; | 5923 ++identifierCount; |
| 6109 } | 5924 } |
| 6110 } | 5925 } |
| 6111 else if ($notnull_bool(this.optional('var', token))) { | 5926 else if (this.optional('var', token)) { |
| 6112 this.listener.handleVarKeyword$1(token); | 5927 this.listener.handleVarKeyword$1(token); |
| 6113 this.listener.endType$3(identifierCount, begin, token); | 5928 this.listener.endType$3(identifierCount, begin, token); |
| 6114 return this.next(token); | 5929 return this.next(token); |
| 6115 } | 5930 } |
| 6116 else { | 5931 else { |
| 6117 token = this.listener.expectedType$1(token); | 5932 token = this.listener.expectedType$1(token); |
| 6118 } | 5933 } |
| 6119 token = this.parseTypeArgumentsOpt(token); | 5934 token = this.parseTypeArgumentsOpt(token); |
| 6120 this.listener.endType$3(identifierCount, begin, token); | 5935 this.listener.endType$3(identifierCount, begin, token); |
| 6121 return token; | 5936 return token; |
| 6122 } | 5937 } |
| 6123 PartialParser.prototype.parseTypeArgumentsOpt = function(token) { | 5938 PartialParser.prototype.parseTypeArgumentsOpt = function(token) { |
| 6124 return this.parseStuff(token, this.beginTypeArguments, this.parseTypeFunction,
this.endTypeArguments, this.handleNoTypeArguments); | 5939 return this.parseStuff(token, this.beginTypeArguments, this.parseTypeFunction,
this.endTypeArguments, this.handleNoTypeArguments); |
| 6125 } | 5940 } |
| 6126 PartialParser.prototype.parseTypeVariablesOpt = function(token) { | 5941 PartialParser.prototype.parseTypeVariablesOpt = function(token) { |
| 6127 if ($notnull_bool(this.optional('<', token))) { | 5942 if (this.optional('<', token)) { |
| 6128 var beginGroupToken = (token && token.is$BeginGroupToken()); | 5943 var beginGroupToken = token; |
| 6129 token = this.next(beginGroupToken.endGroup); | 5944 token = this.next(beginGroupToken.endGroup); |
| 6130 } | 5945 } |
| 6131 this.listener.handleNoTypeVariables$1(token); | 5946 this.listener.handleNoTypeVariables$1(token); |
| 6132 return token; | 5947 return token; |
| 6133 } | 5948 } |
| 6134 PartialParser.prototype.parseStuff = function(token, beginStuff, stuffParser, en
dStuff, handleNoStuff) { | 5949 PartialParser.prototype.parseStuff = function(token, beginStuff, stuffParser, en
dStuff, handleNoStuff) { |
| 6135 var $0; | 5950 if (this.optional('<', token)) { |
| 6136 if ($notnull_bool(this.optional('<', token))) { | |
| 6137 var begin = token; | 5951 var begin = token; |
| 6138 beginStuff.call$1(begin); | 5952 beginStuff.call$1(begin); |
| 6139 var count = 0; | 5953 var count = 0; |
| 6140 do { | 5954 do { |
| 6141 token = (($0 = stuffParser.call$1(this.next(token))) && $0.is$Token()); | 5955 token = stuffParser.call$1(this.next(token)); |
| 6142 ++count; | 5956 ++count; |
| 6143 } | 5957 } |
| 6144 while ($notnull_bool(this.optional(',', token))) | 5958 while (this.optional(',', token)) |
| 6145 endStuff.call$3(count, begin, token); | 5959 endStuff.call$3(count, begin, token); |
| 6146 return this.expect('>', token); | 5960 return this.expect('>', token); |
| 6147 } | 5961 } |
| 6148 handleNoStuff.call$1(token); | 5962 handleNoStuff.call$1(token); |
| 6149 return token; | 5963 return token; |
| 6150 } | 5964 } |
| 6151 PartialParser.prototype.parseClassBody = function(token) { | 5965 PartialParser.prototype.parseClassBody = function(token) { |
| 6152 return this.skipBlock(token); | 5966 return this.skipBlock(token); |
| 6153 } | 5967 } |
| 6154 PartialParser.prototype.parseTopLevelMember = function(token) { | 5968 PartialParser.prototype.parseTopLevelMember = function(token) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6170 | 5984 |
| 6171 previous = token; | 5985 previous = token; |
| 6172 token = this.next(token); | 5986 token = this.next(token); |
| 6173 break; | 5987 break; |
| 6174 | 5988 |
| 6175 } | 5989 } |
| 6176 } | 5990 } |
| 6177 token = this.parseIdentifier(previous); | 5991 token = this.parseIdentifier(previous); |
| 6178 var isField; | 5992 var isField; |
| 6179 while (true) { | 5993 while (true) { |
| 6180 if ($notnull_bool(this.optional('(', token))) { | 5994 if (this.optional('(', token)) { |
| 6181 isField = false; | 5995 isField = false; |
| 6182 break; | 5996 break; |
| 6183 } | 5997 } |
| 6184 else if ($notnull_bool(this.optional('=', token)) || $notnull_bool(this.opti
onal(';', token))) { | 5998 else if (this.optional('=', token) || this.optional(';', token)) { |
| 6185 isField = true; | 5999 isField = true; |
| 6186 break; | 6000 break; |
| 6187 } | 6001 } |
| 6188 else { | 6002 else { |
| 6189 token = this.listener.unexpected$1(token); | 6003 token = this.listener.unexpected$1(token); |
| 6190 } | 6004 } |
| 6191 } | 6005 } |
| 6192 if (!$notnull_bool(isField)) { | 6006 if (!isField) { |
| 6193 token = this.next(this.skipArguments((token && token.is$BeginGroupToken())))
; | 6007 token = this.next(this.skipArguments(token)); |
| 6194 } | 6008 } |
| 6195 while (token != null && token.kind !== 123/*null.LBRACE_TOKEN*/ && token.kind
!== 59/*null.SEMICOLON_TOKEN*/) { | 6009 while (token != null && token.kind !== 123/*null.LBRACE_TOKEN*/ && token.kind
!== 59/*null.SEMICOLON_TOKEN*/) { |
| 6196 token = this.next(token); | 6010 token = this.next(token); |
| 6197 } | 6011 } |
| 6198 if (!$notnull_bool(this.optional(';', token))) { | 6012 if (!this.optional(';', token)) { |
| 6199 token = this.skipBlock(token); | 6013 token = this.skipBlock(token); |
| 6200 } | 6014 } |
| 6201 if ($notnull_bool(isField)) { | 6015 if (isField) { |
| 6202 this.listener.endTopLevelField$2(start, token); | 6016 this.listener.endTopLevelField$2(start, token); |
| 6203 } | 6017 } |
| 6204 else { | 6018 else { |
| 6205 this.listener.endTopLevelMethod$2(start, token); | 6019 this.listener.endTopLevelMethod$2(start, token); |
| 6206 } | 6020 } |
| 6207 return token.next; | 6021 return token.next; |
| 6208 } | 6022 } |
| 6209 PartialParser.prototype.parseLibraryTags = function(token) { | 6023 PartialParser.prototype.parseLibraryTags = function(token) { |
| 6210 this.listener.beginLibraryTag$1(token); | 6024 this.listener.beginLibraryTag$1(token); |
| 6211 token = this.parseIdentifier(this.next(token)); | 6025 token = this.parseIdentifier(this.next(token)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 6228 PartialParser.prototype.endTypeVariables$3 = function($0, $1, $2) { | 6042 PartialParser.prototype.endTypeVariables$3 = function($0, $1, $2) { |
| 6229 return this.endTypeVariables.call$3($0, $1, $2); | 6043 return this.endTypeVariables.call$3($0, $1, $2); |
| 6230 }; | 6044 }; |
| 6231 PartialParser.prototype.handleNoTypeArguments$1 = function($0) { | 6045 PartialParser.prototype.handleNoTypeArguments$1 = function($0) { |
| 6232 return this.handleNoTypeArguments.call$1($0); | 6046 return this.handleNoTypeArguments.call$1($0); |
| 6233 }; | 6047 }; |
| 6234 PartialParser.prototype.handleNoTypeVariables$1 = function($0) { | 6048 PartialParser.prototype.handleNoTypeVariables$1 = function($0) { |
| 6235 return this.handleNoTypeVariables.call$1($0); | 6049 return this.handleNoTypeVariables.call$1($0); |
| 6236 }; | 6050 }; |
| 6237 PartialParser.prototype.parseClass$1 = function($0) { | 6051 PartialParser.prototype.parseClass$1 = function($0) { |
| 6238 return this.parseClass(($0 && $0.is$Token())); | 6052 return this.parseClass($0); |
| 6239 }; | 6053 }; |
| 6240 // ********** Code for Parser ************** | 6054 // ********** Code for Parser ************** |
| 6241 function Parser(listener) { | 6055 function Parser(listener) { |
| 6242 PartialParser.call(this, listener); | 6056 PartialParser.call(this, listener); |
| 6243 // Initializers done | 6057 // Initializers done |
| 6244 } | 6058 } |
| 6245 $inherits(Parser, PartialParser); | 6059 $inherits(Parser, PartialParser); |
| 6246 Parser.prototype.parseFunction = function(token) { | 6060 Parser.prototype.parseFunction = function(token) { |
| 6247 this.listener.beginFunction$1(token); | 6061 this.listener.beginFunction$1(token); |
| 6248 token = this.parseReturnTypeOpt(token); | 6062 token = this.parseReturnTypeOpt(token); |
| 6249 this.listener.beginFunctionName$1(token); | 6063 this.listener.beginFunctionName$1(token); |
| 6250 token = this.parseIdentifier(token); | 6064 token = this.parseIdentifier(token); |
| 6251 this.listener.endFunctionName$1(token); | 6065 this.listener.endFunctionName$1(token); |
| 6252 token = this.parseFormalParameters(token); | 6066 token = this.parseFormalParameters(token); |
| 6253 return this.parseFunctionBody(token); | 6067 return this.parseFunctionBody(token); |
| 6254 } | 6068 } |
| 6255 Parser.prototype.parseFunctionBody = function(token) { | 6069 Parser.prototype.parseFunctionBody = function(token) { |
| 6256 if ($notnull_bool(this.optional(';', token))) { | 6070 if (this.optional(';', token)) { |
| 6257 this.listener.endFunctionBody$3(0, null, token); | 6071 this.listener.endFunctionBody$3(0, null, token); |
| 6258 return token.next; | 6072 return token.next; |
| 6259 } | 6073 } |
| 6260 var begin = token; | 6074 var begin = token; |
| 6261 var statementCount = 0; | 6075 var statementCount = 0; |
| 6262 this.listener.beginFunctionBody$1(begin); | 6076 this.listener.beginFunctionBody$1(begin); |
| 6263 token = this.checkEof(this.expect('{', token)); | 6077 token = this.checkEof(this.expect('{', token)); |
| 6264 while (!$notnull_bool(this.optional('}', token))) { | 6078 while (!this.optional('}', token)) { |
| 6265 token = this.parseStatement(token); | 6079 token = this.parseStatement(token); |
| 6266 ++statementCount; | 6080 ++statementCount; |
| 6267 } | 6081 } |
| 6268 this.listener.endFunctionBody$3(statementCount, begin, token); | 6082 this.listener.endFunctionBody$3(statementCount, begin, token); |
| 6269 return this.expect('}', token); | 6083 return this.expect('}', token); |
| 6270 } | 6084 } |
| 6271 Parser.prototype.parseStatement = function(token) { | 6085 Parser.prototype.parseStatement = function(token) { |
| 6272 this.checkEof(token); | 6086 this.checkEof(token); |
| 6273 var value = token.get$stringValue(); | 6087 var value = token.get$stringValue(); |
| 6274 switch (true) { | 6088 switch (true) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 6305 return this.parseExpressionStatement(token); | 6119 return this.parseExpressionStatement(token); |
| 6306 | 6120 |
| 6307 } | 6121 } |
| 6308 } | 6122 } |
| 6309 Parser.prototype.expectSemicolon = function(token) { | 6123 Parser.prototype.expectSemicolon = function(token) { |
| 6310 return this.expect(';', token); | 6124 return this.expect(';', token); |
| 6311 } | 6125 } |
| 6312 Parser.prototype.parseReturnStatement = function(token) { | 6126 Parser.prototype.parseReturnStatement = function(token) { |
| 6313 var begin = token; | 6127 var begin = token; |
| 6314 this.listener.beginReturnStatement$1(begin); | 6128 this.listener.beginReturnStatement$1(begin); |
| 6315 $assert('return' === token.get$stringValue(), "'return' === token.stringValue"
, "parser.dart", 455, 12); | |
| 6316 token = this.next(token); | 6129 token = this.next(token); |
| 6317 if ($notnull_bool(this.optional(';', token))) { | 6130 if (this.optional(';', token)) { |
| 6318 this.listener.endReturnStatement$3(false, begin, token); | 6131 this.listener.endReturnStatement$3(false, begin, token); |
| 6319 } | 6132 } |
| 6320 else { | 6133 else { |
| 6321 token = this.parseExpression(token); | 6134 token = this.parseExpression(token); |
| 6322 this.listener.endReturnStatement$3(true, begin, token); | 6135 this.listener.endReturnStatement$3(true, begin, token); |
| 6323 } | 6136 } |
| 6324 return this.expectSemicolon(token); | 6137 return this.expectSemicolon(token); |
| 6325 } | 6138 } |
| 6326 Parser.prototype.parseExpressionStatementOrDeclaration = function(token) { | 6139 Parser.prototype.parseExpressionStatementOrDeclaration = function(token) { |
| 6327 $assert(token.kind === 97/*null.IDENTIFIER_TOKEN*/, "token.kind === IDENTIFIER
_TOKEN", "parser.dart", 467, 12); | |
| 6328 var peek = token.next; | 6140 var peek = token.next; |
| 6329 if (peek.kind === 46/*null.PERIOD_TOKEN*/) { | 6141 if (peek.kind === 46/*null.PERIOD_TOKEN*/) { |
| 6330 if (peek.next.kind === 97/*null.IDENTIFIER_TOKEN*/) { | 6142 if (peek.next.kind === 97/*null.IDENTIFIER_TOKEN*/) { |
| 6331 peek = peek.next.next; | 6143 peek = peek.next.next; |
| 6332 } | 6144 } |
| 6333 } | 6145 } |
| 6334 if (peek.kind === 97/*null.IDENTIFIER_TOKEN*/) { | 6146 if (peek.kind === 97/*null.IDENTIFIER_TOKEN*/) { |
| 6335 return this.parseLocalDeclaration(token, peek); | 6147 return this.parseLocalDeclaration(token, peek); |
| 6336 } | 6148 } |
| 6337 else if (peek.kind === 60/*null.LT_TOKEN*/) { | 6149 else if (peek.kind === 60/*null.LT_TOKEN*/) { |
| 6338 var beginGroupToken = (peek && peek.is$BeginGroupToken()); | 6150 var beginGroupToken = peek; |
| 6339 var gtToken = beginGroupToken.endGroup; | 6151 var gtToken = beginGroupToken.endGroup; |
| 6340 if (gtToken != null && gtToken.next.kind === 97/*null.IDENTIFIER_TOKEN*/) { | 6152 if (gtToken != null && gtToken.next.kind === 97/*null.IDENTIFIER_TOKEN*/) { |
| 6341 var identifier = gtToken.next; | 6153 var identifier = gtToken.next; |
| 6342 var afterId = identifier.next; | 6154 var afterId = identifier.next; |
| 6343 var afterIdKind = afterId.kind; | 6155 var afterIdKind = afterId.kind; |
| 6344 if (afterIdKind === 61/*null.EQ_TOKEN*/ || afterIdKind === 59/*null.SEMICO
LON_TOKEN*/) { | 6156 if (afterIdKind === 61/*null.EQ_TOKEN*/ || afterIdKind === 59/*null.SEMICO
LON_TOKEN*/) { |
| 6345 return this.parseLocalDeclaration(token, identifier); | 6157 return this.parseLocalDeclaration(token, identifier); |
| 6346 } | 6158 } |
| 6347 else if (afterIdKind === 41/*null.RPAREN_TOKEN*/) { | 6159 else if (afterIdKind === 41/*null.RPAREN_TOKEN*/) { |
| 6348 var beginParen = (afterId && afterId.is$BeginGroupToken()); | 6160 var beginParen = afterId; |
| 6349 var endParen = beginParen.endGroup; | 6161 var endParen = beginParen.endGroup; |
| 6350 var afterParens = endParen.next; | 6162 var afterParens = endParen.next; |
| 6351 if ($notnull_bool(this.optional('{', afterParens)) || $notnull_bool(this
.optional('=>', afterParens))) { | 6163 if (this.optional('{', afterParens) || this.optional('=>', afterParens))
{ |
| 6352 return this.parseLocalDeclaration(token, identifier); | 6164 return this.parseLocalDeclaration(token, identifier); |
| 6353 } | 6165 } |
| 6354 } | 6166 } |
| 6355 } | 6167 } |
| 6356 } | 6168 } |
| 6357 return this.parseExpressionStatement(token); | 6169 return this.parseExpressionStatement(token); |
| 6358 } | 6170 } |
| 6359 Parser.prototype.parseLocalDeclaration = function(token, peek1) { | 6171 Parser.prototype.parseLocalDeclaration = function(token, peek1) { |
| 6360 var peek2 = this.next(peek1); | 6172 var peek2 = this.next(peek1); |
| 6361 if (peek2.get$stringValue() === '(') { | 6173 if (peek2.get$stringValue() === '(') { |
| 6362 return this.parseFunction(token); | 6174 return this.parseFunction(token); |
| 6363 } | 6175 } |
| 6364 else { | 6176 else { |
| 6365 return this.parseVariablesDeclaration(token); | 6177 return this.parseVariablesDeclaration(token); |
| 6366 } | 6178 } |
| 6367 } | 6179 } |
| 6368 Parser.prototype.parseExpressionStatement = function(token) { | 6180 Parser.prototype.parseExpressionStatement = function(token) { |
| 6369 this.listener.beginExpressionStatement$1(token); | 6181 this.listener.beginExpressionStatement$1(token); |
| 6370 token = this.parseExpression(token); | 6182 token = this.parseExpression(token); |
| 6371 this.listener.endExpressionStatement$1(token); | 6183 this.listener.endExpressionStatement$1(token); |
| 6372 return this.expectSemicolon(token); | 6184 return this.expectSemicolon(token); |
| 6373 } | 6185 } |
| 6374 Parser.prototype.parseExpression = function(token) { | 6186 Parser.prototype.parseExpression = function(token) { |
| 6375 token = this.parseConditionalExpression(token); | 6187 token = this.parseConditionalExpression(token); |
| 6376 if ($notnull_bool(this.isAssignmentOperator(token))) { | 6188 if (this.isAssignmentOperator(token)) { |
| 6377 var operator = token; | 6189 var operator = token; |
| 6378 token = this.parseExpression(this.next(token)); | 6190 token = this.parseExpression(this.next(token)); |
| 6379 this.listener.handleAssignmentExpression$1(operator); | 6191 this.listener.handleAssignmentExpression$1(operator); |
| 6380 } | 6192 } |
| 6381 return token; | 6193 return token; |
| 6382 } | 6194 } |
| 6383 Parser.prototype.isAssignmentOperator = function(token) { | 6195 Parser.prototype.isAssignmentOperator = function(token) { |
| 6384 return 2 === this.getPrecedence(token); | 6196 return 2 === this.getPrecedence(token); |
| 6385 } | 6197 } |
| 6386 Parser.prototype.parseConditionalExpression = function(token) { | 6198 Parser.prototype.parseConditionalExpression = function(token) { |
| 6387 token = this.parseBinaryExpression(token, 4); | 6199 token = this.parseBinaryExpression(token, 4); |
| 6388 if ($notnull_bool(this.optional('?', token))) { | 6200 if (this.optional('?', token)) { |
| 6389 var question = token; | 6201 var question = token; |
| 6390 token = this.parseExpression(this.next(token)); | 6202 token = this.parseExpression(this.next(token)); |
| 6391 var colon = token; | 6203 var colon = token; |
| 6392 token = this.expect(':', token); | 6204 token = this.expect(':', token); |
| 6393 token = this.parseExpression(token); | 6205 token = this.parseExpression(token); |
| 6394 this.listener.handleConditionalExpression$2(question, colon); | 6206 this.listener.handleConditionalExpression$2(question, colon); |
| 6395 } | 6207 } |
| 6396 return token; | 6208 return token; |
| 6397 } | 6209 } |
| 6398 Parser.prototype.parseBinaryExpression = function(token, precedence) { | 6210 Parser.prototype.parseBinaryExpression = function(token, precedence) { |
| 6399 $assert(precedence >= 4, "precedence >= 4", "parser.dart", 553, 12); | |
| 6400 token = this.parsePrimary(token); | 6211 token = this.parsePrimary(token); |
| 6401 var tokenLevel = this.getPrecedence(token); | 6212 var tokenLevel = this.getPrecedence(token); |
| 6402 for (var level = $assert_num(tokenLevel); | 6213 for (var level = tokenLevel; |
| 6403 level >= precedence; --level) { | 6214 level >= precedence; --level) { |
| 6404 while (tokenLevel === level) { | 6215 while (tokenLevel === level) { |
| 6405 var operator = token; | 6216 var operator = token; |
| 6406 token = this.parseBinaryExpression(this.next(token), level + 1); | 6217 token = this.parseBinaryExpression(this.next(token), level + 1); |
| 6407 this.listener.handleBinaryExpression$1(operator); | 6218 this.listener.handleBinaryExpression$1(operator); |
| 6408 tokenLevel = this.getPrecedence(token); | 6219 tokenLevel = this.getPrecedence(token); |
| 6409 } | 6220 } |
| 6410 } | 6221 } |
| 6411 return token; | 6222 return token; |
| 6412 } | 6223 } |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6643 return token.next; | 6454 return token.next; |
| 6644 } | 6455 } |
| 6645 Parser.prototype.parseSend = function(token) { | 6456 Parser.prototype.parseSend = function(token) { |
| 6646 this.listener.beginSend$1(token); | 6457 this.listener.beginSend$1(token); |
| 6647 token = this.parseIdentifier(token); | 6458 token = this.parseIdentifier(token); |
| 6648 token = this.parseArgumentsOpt(token); | 6459 token = this.parseArgumentsOpt(token); |
| 6649 this.listener.endSend$1(token); | 6460 this.listener.endSend$1(token); |
| 6650 return token; | 6461 return token; |
| 6651 } | 6462 } |
| 6652 Parser.prototype.parseArgumentsOpt = function(token) { | 6463 Parser.prototype.parseArgumentsOpt = function(token) { |
| 6653 if (!$notnull_bool(this.optional('(', token))) { | 6464 if (!this.optional('(', token)) { |
| 6654 this.listener.handleNoArguments$1(token); | 6465 this.listener.handleNoArguments$1(token); |
| 6655 return token; | 6466 return token; |
| 6656 } | 6467 } |
| 6657 else { | 6468 else { |
| 6658 return this.parseArguments(token); | 6469 return this.parseArguments(token); |
| 6659 } | 6470 } |
| 6660 } | 6471 } |
| 6661 Parser.prototype.parseArguments = function(token) { | 6472 Parser.prototype.parseArguments = function(token) { |
| 6662 var begin = token; | 6473 var begin = token; |
| 6663 this.listener.beginArguments$1(begin); | 6474 this.listener.beginArguments$1(begin); |
| 6664 $assert('(' === token.get$stringValue(), "'(' === token.stringValue", "parser.
dart", 686, 12); | |
| 6665 var argumentCount = 0; | 6475 var argumentCount = 0; |
| 6666 if ($notnull_bool(this.optional(')', token.next))) { | 6476 if (this.optional(')', token.next)) { |
| 6667 this.listener.endArguments$3(argumentCount, begin, token.next); | 6477 this.listener.endArguments$3(argumentCount, begin, token.next); |
| 6668 return token.next.next; | 6478 return token.next.next; |
| 6669 } | 6479 } |
| 6670 do { | 6480 do { |
| 6671 token = this.parseExpression(this.next(token)); | 6481 token = this.parseExpression(this.next(token)); |
| 6672 ++argumentCount; | 6482 ++argumentCount; |
| 6673 } | 6483 } |
| 6674 while ($notnull_bool(this.optional(',', token))) | 6484 while (this.optional(',', token)) |
| 6675 this.listener.endArguments$3(argumentCount, begin, token); | 6485 this.listener.endArguments$3(argumentCount, begin, token); |
| 6676 return this.expect(')', token); | 6486 return this.expect(')', token); |
| 6677 } | 6487 } |
| 6678 Parser.prototype.parseVariablesDeclaration = function(token) { | 6488 Parser.prototype.parseVariablesDeclaration = function(token) { |
| 6679 var count = 1; | 6489 var count = 1; |
| 6680 this.listener.beginVariablesDeclaration$1(token); | 6490 this.listener.beginVariablesDeclaration$1(token); |
| 6681 token = this.parseFinalVarOrType(token); | 6491 token = this.parseFinalVarOrType(token); |
| 6682 token = this.parseOptionallyInitializedIdentifier(token); | 6492 token = this.parseOptionallyInitializedIdentifier(token); |
| 6683 while ($notnull_bool(this.optional(',', token))) { | 6493 while (this.optional(',', token)) { |
| 6684 token = this.parseOptionallyInitializedIdentifier(this.next(token)); | 6494 token = this.parseOptionallyInitializedIdentifier(this.next(token)); |
| 6685 ++count; | 6495 ++count; |
| 6686 } | 6496 } |
| 6687 this.listener.endVariablesDeclaration$2(count, token); | 6497 this.listener.endVariablesDeclaration$2(count, token); |
| 6688 return this.expectSemicolon(token); | 6498 return this.expectSemicolon(token); |
| 6689 } | 6499 } |
| 6690 Parser.prototype.parseOptionallyInitializedIdentifier = function(token) { | 6500 Parser.prototype.parseOptionallyInitializedIdentifier = function(token) { |
| 6691 this.listener.beginInitializedIdentifier$1(token); | 6501 this.listener.beginInitializedIdentifier$1(token); |
| 6692 token = this.parseIdentifier(token); | 6502 token = this.parseIdentifier(token); |
| 6693 if ($notnull_bool(this.optional('=', token))) { | 6503 if (this.optional('=', token)) { |
| 6694 var assignment = token; | 6504 var assignment = token; |
| 6695 this.listener.beginInitializer$1(token); | 6505 this.listener.beginInitializer$1(token); |
| 6696 token = this.parseExpression(this.next(token)); | 6506 token = this.parseExpression(this.next(token)); |
| 6697 this.listener.endInitializer$1(assignment); | 6507 this.listener.endInitializer$1(assignment); |
| 6698 } | 6508 } |
| 6699 this.listener.endInitializedIdentifier$0(); | 6509 this.listener.endInitializedIdentifier$0(); |
| 6700 return token; | 6510 return token; |
| 6701 } | 6511 } |
| 6702 Parser.prototype.parseFinalVarOrType = function(token) { | 6512 Parser.prototype.parseFinalVarOrType = function(token) { |
| 6703 var value = token.get$stringValue(); | 6513 var value = token.get$stringValue(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 6714 } | 6524 } |
| 6715 } | 6525 } |
| 6716 Parser.prototype.parseIfStatement = function(token) { | 6526 Parser.prototype.parseIfStatement = function(token) { |
| 6717 var ifToken = token; | 6527 var ifToken = token; |
| 6718 this.listener.beginIfStatement$1(ifToken); | 6528 this.listener.beginIfStatement$1(ifToken); |
| 6719 token = this.expect('if', token); | 6529 token = this.expect('if', token); |
| 6720 this.expect('(', token); | 6530 this.expect('(', token); |
| 6721 token = this.parseArguments(token); | 6531 token = this.parseArguments(token); |
| 6722 token = this.parseStatement(token); | 6532 token = this.parseStatement(token); |
| 6723 var elseToken = null; | 6533 var elseToken = null; |
| 6724 if ($notnull_bool(this.optional('else', token))) { | 6534 if (this.optional('else', token)) { |
| 6725 elseToken = token; | 6535 elseToken = token; |
| 6726 token = this.parseStatement(token.next); | 6536 token = this.parseStatement(token.next); |
| 6727 } | 6537 } |
| 6728 this.listener.endIfStatement$2(ifToken, elseToken); | 6538 this.listener.endIfStatement$2(ifToken, elseToken); |
| 6729 return token; | 6539 return token; |
| 6730 } | 6540 } |
| 6731 Parser.prototype.parseForStatement = function(token) { | 6541 Parser.prototype.parseForStatement = function(token) { |
| 6732 var forToken = token; | 6542 var forToken = token; |
| 6733 this.listener.beginForStatement$1(forToken); | 6543 this.listener.beginForStatement$1(forToken); |
| 6734 token = this.expect('for', token); | 6544 token = this.expect('for', token); |
| 6735 token = this.expect('(', token); | 6545 token = this.expect('(', token); |
| 6736 token = this.parseVariablesDeclaration(token); | 6546 token = this.parseVariablesDeclaration(token); |
| 6737 token = this.parseExpressionStatement(token); | 6547 token = this.parseExpressionStatement(token); |
| 6738 token = this.parseExpression(token); | 6548 token = this.parseExpression(token); |
| 6739 token = this.expect(')', token); | 6549 token = this.expect(')', token); |
| 6740 token = this.parseStatement(token); | 6550 token = this.parseStatement(token); |
| 6741 this.listener.endForStatement$2(forToken, token); | 6551 this.listener.endForStatement$2(forToken, token); |
| 6742 return token; | 6552 return token; |
| 6743 } | 6553 } |
| 6744 Parser.prototype.parseBlock = function(token) { | 6554 Parser.prototype.parseBlock = function(token) { |
| 6745 var begin = token; | 6555 var begin = token; |
| 6746 this.listener.beginBlock$1(begin); | 6556 this.listener.beginBlock$1(begin); |
| 6747 var statementCount = 0; | 6557 var statementCount = 0; |
| 6748 token = this.expect('{', token); | 6558 token = this.expect('{', token); |
| 6749 while (!$notnull_bool(this.optional('}', token))) { | 6559 while (!this.optional('}', token)) { |
| 6750 token = this.parseStatement(token); | 6560 token = this.parseStatement(token); |
| 6751 ++statementCount; | 6561 ++statementCount; |
| 6752 } | 6562 } |
| 6753 this.listener.endBlock$3(statementCount, begin, token); | 6563 this.listener.endBlock$3(statementCount, begin, token); |
| 6754 return this.expect('}', token); | 6564 return this.expect('}', token); |
| 6755 } | 6565 } |
| 6756 Parser.prototype.parseThrowStatement = function(token) { | 6566 Parser.prototype.parseThrowStatement = function(token) { |
| 6757 var throwToken = token; | 6567 var throwToken = token; |
| 6758 this.listener.beginThrowStatement$1(throwToken); | 6568 this.listener.beginThrowStatement$1(throwToken); |
| 6759 token = this.expect('throw', token); | 6569 token = this.expect('throw', token); |
| 6760 if ($notnull_bool(this.optional(';', token))) { | 6570 if (this.optional(';', token)) { |
| 6761 this.listener.endRethrowStatement$2(throwToken, token); | 6571 this.listener.endRethrowStatement$2(throwToken, token); |
| 6762 return token.next; | 6572 return token.next; |
| 6763 } | 6573 } |
| 6764 else { | 6574 else { |
| 6765 token = this.parseExpression(token); | 6575 token = this.parseExpression(token); |
| 6766 this.listener.endThrowStatement$2(throwToken, token); | 6576 this.listener.endThrowStatement$2(throwToken, token); |
| 6767 return this.expectSemicolon(token); | 6577 return this.expectSemicolon(token); |
| 6768 } | 6578 } |
| 6769 } | 6579 } |
| 6770 Parser.prototype.parseFunction$1 = function($0) { | 6580 Parser.prototype.parseFunction$1 = function($0) { |
| 6771 return this.parseFunction(($0 && $0.is$Token())); | 6581 return this.parseFunction($0); |
| 6772 }; | 6582 }; |
| 6773 // ********** Code for ParserTask ************** | 6583 // ********** Code for ParserTask ************** |
| 6774 function ParserTask(compiler) { | 6584 function ParserTask(compiler) { |
| 6775 CompilerTask.call(this, compiler); | 6585 CompilerTask.call(this, compiler); |
| 6776 // Initializers done | 6586 // Initializers done |
| 6777 } | 6587 } |
| 6778 $inherits(ParserTask, CompilerTask); | 6588 $inherits(ParserTask, CompilerTask); |
| 6779 ParserTask.prototype.get$name = function() { | 6589 ParserTask.prototype.get$name = function() { |
| 6780 return 'Parser'; | 6590 return 'Parser'; |
| 6781 } | 6591 } |
| 6782 ParserTask.prototype.parse = function(element) { | 6592 ParserTask.prototype.parse = function(element) { |
| 6783 var $this = this; // closure support | 6593 var $this = this; // closure support |
| 6784 var $0; | 6594 return this.measure((function () { |
| 6785 return (($0 = this.measure((function () { | |
| 6786 return element.parseNode($this.compiler, $this.compiler); | 6595 return element.parseNode($this.compiler, $this.compiler); |
| 6787 }) | 6596 }) |
| 6788 )) && $0.is$Node()); | 6597 ); |
| 6789 } | 6598 } |
| 6790 // ********** Code for Listener ************** | 6599 // ********** Code for Listener ************** |
| 6791 function Listener() {} | 6600 function Listener() {} |
| 6792 Listener.prototype.beginArguments = function(token) { | 6601 Listener.prototype.beginArguments = function(token) { |
| 6793 | 6602 |
| 6794 } | 6603 } |
| 6795 Listener.prototype.endArguments = function(count, beginToken, endToken) { | 6604 Listener.prototype.endArguments = function(count, beginToken, endToken) { |
| 6796 | 6605 |
| 6797 } | 6606 } |
| 6798 Listener.prototype.beginBlock = function(token) { | 6607 Listener.prototype.beginBlock = function(token) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6990 Listener.prototype.expectedType = function(token) { | 6799 Listener.prototype.expectedType = function(token) { |
| 6991 $throw(new ParserError(("Expected a type, but got '" + token + "' @ ") + ("" +
token.charOffset + ""))); | 6800 $throw(new ParserError(("Expected a type, but got '" + token + "' @ ") + ("" +
token.charOffset + ""))); |
| 6992 } | 6801 } |
| 6993 Listener.prototype.expectedBlock = function(token) { | 6802 Listener.prototype.expectedBlock = function(token) { |
| 6994 $throw(new ParserError(("Expected a block, but got '" + token + "' @ ") + (""
+ token.charOffset + ""))); | 6803 $throw(new ParserError(("Expected a block, but got '" + token + "' @ ") + (""
+ token.charOffset + ""))); |
| 6995 } | 6804 } |
| 6996 Listener.prototype.unexpected = function(token) { | 6805 Listener.prototype.unexpected = function(token) { |
| 6997 $throw(new ParserError(("Unexpected token '" + token + "' @ " + token.charOffs
et + ""))); | 6806 $throw(new ParserError(("Unexpected token '" + token + "' @ " + token.charOffs
et + ""))); |
| 6998 } | 6807 } |
| 6999 Listener.prototype.beginArguments$1 = function($0) { | 6808 Listener.prototype.beginArguments$1 = function($0) { |
| 7000 return this.beginArguments(($0 && $0.is$Token())); | 6809 return this.beginArguments($0); |
| 7001 }; | 6810 }; |
| 7002 Listener.prototype.beginBlock$1 = function($0) { | 6811 Listener.prototype.beginBlock$1 = function($0) { |
| 7003 return this.beginBlock(($0 && $0.is$Token())); | 6812 return this.beginBlock($0); |
| 7004 }; | 6813 }; |
| 7005 Listener.prototype.beginClass$1 = function($0) { | 6814 Listener.prototype.beginClass$1 = function($0) { |
| 7006 return this.beginClass(($0 && $0.is$Token())); | 6815 return this.beginClass($0); |
| 7007 }; | 6816 }; |
| 7008 Listener.prototype.beginExpressionStatement$1 = function($0) { | 6817 Listener.prototype.beginExpressionStatement$1 = function($0) { |
| 7009 return this.beginExpressionStatement(($0 && $0.is$Token())); | 6818 return this.beginExpressionStatement($0); |
| 7010 }; | 6819 }; |
| 7011 Listener.prototype.beginForStatement$1 = function($0) { | 6820 Listener.prototype.beginForStatement$1 = function($0) { |
| 7012 return this.beginForStatement(($0 && $0.is$Token())); | 6821 return this.beginForStatement($0); |
| 7013 }; | 6822 }; |
| 7014 Listener.prototype.beginFormalParameter$1 = function($0) { | 6823 Listener.prototype.beginFormalParameter$1 = function($0) { |
| 7015 return this.beginFormalParameter(($0 && $0.is$Token())); | 6824 return this.beginFormalParameter($0); |
| 7016 }; | 6825 }; |
| 7017 Listener.prototype.beginFormalParameters$1 = function($0) { | 6826 Listener.prototype.beginFormalParameters$1 = function($0) { |
| 7018 return this.beginFormalParameters(($0 && $0.is$Token())); | 6827 return this.beginFormalParameters($0); |
| 7019 }; | 6828 }; |
| 7020 Listener.prototype.beginFunction$1 = function($0) { | 6829 Listener.prototype.beginFunction$1 = function($0) { |
| 7021 return this.beginFunction(($0 && $0.is$Token())); | 6830 return this.beginFunction($0); |
| 7022 }; | 6831 }; |
| 7023 Listener.prototype.beginFunctionBody$1 = function($0) { | 6832 Listener.prototype.beginFunctionBody$1 = function($0) { |
| 7024 return this.beginFunctionBody(($0 && $0.is$Token())); | 6833 return this.beginFunctionBody($0); |
| 7025 }; | 6834 }; |
| 7026 Listener.prototype.beginFunctionName$1 = function($0) { | 6835 Listener.prototype.beginFunctionName$1 = function($0) { |
| 7027 return this.beginFunctionName(($0 && $0.is$Token())); | 6836 return this.beginFunctionName($0); |
| 7028 }; | 6837 }; |
| 7029 Listener.prototype.beginFunctionTypeAlias$1 = function($0) { | 6838 Listener.prototype.beginFunctionTypeAlias$1 = function($0) { |
| 7030 return this.beginFunctionTypeAlias(($0 && $0.is$Token())); | 6839 return this.beginFunctionTypeAlias($0); |
| 7031 }; | 6840 }; |
| 7032 Listener.prototype.beginIfStatement$1 = function($0) { | 6841 Listener.prototype.beginIfStatement$1 = function($0) { |
| 7033 return this.beginIfStatement(($0 && $0.is$Token())); | 6842 return this.beginIfStatement($0); |
| 7034 }; | 6843 }; |
| 7035 Listener.prototype.beginInitializedIdentifier$1 = function($0) { | 6844 Listener.prototype.beginInitializedIdentifier$1 = function($0) { |
| 7036 return this.beginInitializedIdentifier(($0 && $0.is$Token())); | 6845 return this.beginInitializedIdentifier($0); |
| 7037 }; | 6846 }; |
| 7038 Listener.prototype.beginInitializer$1 = function($0) { | 6847 Listener.prototype.beginInitializer$1 = function($0) { |
| 7039 return this.beginInitializer(($0 && $0.is$Token())); | 6848 return this.beginInitializer($0); |
| 7040 }; | 6849 }; |
| 7041 Listener.prototype.beginInterface$1 = function($0) { | 6850 Listener.prototype.beginInterface$1 = function($0) { |
| 7042 return this.beginInterface(($0 && $0.is$Token())); | 6851 return this.beginInterface($0); |
| 7043 }; | 6852 }; |
| 7044 Listener.prototype.beginLibraryTag$1 = function($0) { | 6853 Listener.prototype.beginLibraryTag$1 = function($0) { |
| 7045 return this.beginLibraryTag(($0 && $0.is$Token())); | 6854 return this.beginLibraryTag($0); |
| 7046 }; | 6855 }; |
| 7047 Listener.prototype.beginReturnStatement$1 = function($0) { | 6856 Listener.prototype.beginReturnStatement$1 = function($0) { |
| 7048 return this.beginReturnStatement(($0 && $0.is$Token())); | 6857 return this.beginReturnStatement($0); |
| 7049 }; | 6858 }; |
| 7050 Listener.prototype.beginSend$1 = function($0) { | 6859 Listener.prototype.beginSend$1 = function($0) { |
| 7051 return this.beginSend(($0 && $0.is$Token())); | 6860 return this.beginSend($0); |
| 7052 }; | 6861 }; |
| 7053 Listener.prototype.beginThrowStatement$1 = function($0) { | 6862 Listener.prototype.beginThrowStatement$1 = function($0) { |
| 7054 return this.beginThrowStatement(($0 && $0.is$Token())); | 6863 return this.beginThrowStatement($0); |
| 7055 }; | 6864 }; |
| 7056 Listener.prototype.beginTopLevelMember$1 = function($0) { | 6865 Listener.prototype.beginTopLevelMember$1 = function($0) { |
| 7057 return this.beginTopLevelMember(($0 && $0.is$Token())); | 6866 return this.beginTopLevelMember($0); |
| 7058 }; | 6867 }; |
| 7059 Listener.prototype.beginTypeArguments$1 = function($0) { | 6868 Listener.prototype.beginTypeArguments$1 = function($0) { |
| 7060 return this.beginTypeArguments(($0 && $0.is$Token())); | 6869 return this.beginTypeArguments($0); |
| 7061 }; | 6870 }; |
| 7062 Listener.prototype.beginTypeVariable$1 = function($0) { | 6871 Listener.prototype.beginTypeVariable$1 = function($0) { |
| 7063 return this.beginTypeVariable(($0 && $0.is$Token())); | 6872 return this.beginTypeVariable($0); |
| 7064 }; | 6873 }; |
| 7065 Listener.prototype.beginTypeVariables$1 = function($0) { | 6874 Listener.prototype.beginTypeVariables$1 = function($0) { |
| 7066 return this.beginTypeVariables(($0 && $0.is$Token())); | 6875 return this.beginTypeVariables($0); |
| 7067 }; | 6876 }; |
| 7068 Listener.prototype.beginVariablesDeclaration$1 = function($0) { | 6877 Listener.prototype.beginVariablesDeclaration$1 = function($0) { |
| 7069 return this.beginVariablesDeclaration(($0 && $0.is$Token())); | 6878 return this.beginVariablesDeclaration($0); |
| 7070 }; | 6879 }; |
| 7071 Listener.prototype.endArguments$3 = function($0, $1, $2) { | 6880 Listener.prototype.endArguments$3 = function($0, $1, $2) { |
| 7072 return this.endArguments($assert_num($0), ($1 && $1.is$Token()), ($2 && $2.is$
Token())); | 6881 return this.endArguments($0, $1, $2); |
| 7073 }; | 6882 }; |
| 7074 Listener.prototype.endBlock$3 = function($0, $1, $2) { | 6883 Listener.prototype.endBlock$3 = function($0, $1, $2) { |
| 7075 return this.endBlock($assert_num($0), ($1 && $1.is$Token()), ($2 && $2.is$Toke
n())); | 6884 return this.endBlock($0, $1, $2); |
| 7076 }; | 6885 }; |
| 7077 Listener.prototype.endClass$5 = function($0, $1, $2, $3, $4) { | 6886 Listener.prototype.endClass$5 = function($0, $1, $2, $3, $4) { |
| 7078 return this.endClass($assert_num($0), ($1 && $1.is$Token()), ($2 && $2.is$Toke
n()), ($3 && $3.is$Token()), ($4 && $4.is$Token())); | 6887 return this.endClass($0, $1, $2, $3, $4); |
| 7079 }; | 6888 }; |
| 7080 Listener.prototype.endExpressionStatement$1 = function($0) { | 6889 Listener.prototype.endExpressionStatement$1 = function($0) { |
| 7081 return this.endExpressionStatement(($0 && $0.is$Token())); | 6890 return this.endExpressionStatement($0); |
| 7082 }; | 6891 }; |
| 7083 Listener.prototype.endForStatement$2 = function($0, $1) { | 6892 Listener.prototype.endForStatement$2 = function($0, $1) { |
| 7084 return this.endForStatement(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 6893 return this.endForStatement($0, $1); |
| 7085 }; | 6894 }; |
| 7086 Listener.prototype.endFormalParameter$1 = function($0) { | 6895 Listener.prototype.endFormalParameter$1 = function($0) { |
| 7087 return this.endFormalParameter(($0 && $0.is$Token())); | 6896 return this.endFormalParameter($0); |
| 7088 }; | 6897 }; |
| 7089 Listener.prototype.endFormalParameters$3 = function($0, $1, $2) { | 6898 Listener.prototype.endFormalParameters$3 = function($0, $1, $2) { |
| 7090 return this.endFormalParameters($assert_num($0), ($1 && $1.is$Token()), ($2 &&
$2.is$Token())); | 6899 return this.endFormalParameters($0, $1, $2); |
| 7091 }; | 6900 }; |
| 7092 Listener.prototype.endFunctionBody$3 = function($0, $1, $2) { | 6901 Listener.prototype.endFunctionBody$3 = function($0, $1, $2) { |
| 7093 return this.endFunctionBody($assert_num($0), ($1 && $1.is$Token()), ($2 && $2.
is$Token())); | 6902 return this.endFunctionBody($0, $1, $2); |
| 7094 }; | 6903 }; |
| 7095 Listener.prototype.endFunctionName$1 = function($0) { | 6904 Listener.prototype.endFunctionName$1 = function($0) { |
| 7096 return this.endFunctionName(($0 && $0.is$Token())); | 6905 return this.endFunctionName($0); |
| 7097 }; | 6906 }; |
| 7098 Listener.prototype.endFunctionTypeAlias$1 = function($0) { | 6907 Listener.prototype.endFunctionTypeAlias$1 = function($0) { |
| 7099 return this.endFunctionTypeAlias(($0 && $0.is$Token())); | 6908 return this.endFunctionTypeAlias($0); |
| 7100 }; | 6909 }; |
| 7101 Listener.prototype.endIfStatement$2 = function($0, $1) { | 6910 Listener.prototype.endIfStatement$2 = function($0, $1) { |
| 7102 return this.endIfStatement(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 6911 return this.endIfStatement($0, $1); |
| 7103 }; | 6912 }; |
| 7104 Listener.prototype.endInitializedIdentifier$0 = function() { | 6913 Listener.prototype.endInitializedIdentifier$0 = function() { |
| 7105 return this.endInitializedIdentifier(); | 6914 return this.endInitializedIdentifier(); |
| 7106 }; | 6915 }; |
| 7107 Listener.prototype.endInitializer$1 = function($0) { | 6916 Listener.prototype.endInitializer$1 = function($0) { |
| 7108 return this.endInitializer(($0 && $0.is$Token())); | 6917 return this.endInitializer($0); |
| 7109 }; | 6918 }; |
| 7110 Listener.prototype.endInterface$1 = function($0) { | 6919 Listener.prototype.endInterface$1 = function($0) { |
| 7111 return this.endInterface(($0 && $0.is$Token())); | 6920 return this.endInterface($0); |
| 7112 }; | 6921 }; |
| 7113 Listener.prototype.endRethrowStatement$2 = function($0, $1) { | 6922 Listener.prototype.endRethrowStatement$2 = function($0, $1) { |
| 7114 return this.endRethrowStatement(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 6923 return this.endRethrowStatement($0, $1); |
| 7115 }; | 6924 }; |
| 7116 Listener.prototype.endReturnStatement$3 = function($0, $1, $2) { | 6925 Listener.prototype.endReturnStatement$3 = function($0, $1, $2) { |
| 7117 return this.endReturnStatement($assert_bool($0), ($1 && $1.is$Token()), ($2 &&
$2.is$Token())); | 6926 return this.endReturnStatement($0, $1, $2); |
| 7118 }; | 6927 }; |
| 7119 Listener.prototype.endSend$1 = function($0) { | 6928 Listener.prototype.endSend$1 = function($0) { |
| 7120 return this.endSend(($0 && $0.is$Token())); | 6929 return this.endSend($0); |
| 7121 }; | 6930 }; |
| 7122 Listener.prototype.endThrowStatement$2 = function($0, $1) { | 6931 Listener.prototype.endThrowStatement$2 = function($0, $1) { |
| 7123 return this.endThrowStatement(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 6932 return this.endThrowStatement($0, $1); |
| 7124 }; | 6933 }; |
| 7125 Listener.prototype.endTopLevelField$2 = function($0, $1) { | 6934 Listener.prototype.endTopLevelField$2 = function($0, $1) { |
| 7126 return this.endTopLevelField(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 6935 return this.endTopLevelField($0, $1); |
| 7127 }; | 6936 }; |
| 7128 Listener.prototype.endTopLevelMethod$2 = function($0, $1) { | 6937 Listener.prototype.endTopLevelMethod$2 = function($0, $1) { |
| 7129 return this.endTopLevelMethod(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 6938 return this.endTopLevelMethod($0, $1); |
| 7130 }; | 6939 }; |
| 7131 Listener.prototype.endType$3 = function($0, $1, $2) { | 6940 Listener.prototype.endType$3 = function($0, $1, $2) { |
| 7132 return this.endType($assert_num($0), ($1 && $1.is$Token()), ($2 && $2.is$Token
())); | 6941 return this.endType($0, $1, $2); |
| 7133 }; | 6942 }; |
| 7134 Listener.prototype.endTypeArguments$3 = function($0, $1, $2) { | 6943 Listener.prototype.endTypeArguments$3 = function($0, $1, $2) { |
| 7135 return this.endTypeArguments($assert_num($0), ($1 && $1.is$Token()), ($2 && $2
.is$Token())); | 6944 return this.endTypeArguments($0, $1, $2); |
| 7136 }; | 6945 }; |
| 7137 Listener.prototype.endTypeVariable$1 = function($0) { | 6946 Listener.prototype.endTypeVariable$1 = function($0) { |
| 7138 return this.endTypeVariable(($0 && $0.is$Token())); | 6947 return this.endTypeVariable($0); |
| 7139 }; | 6948 }; |
| 7140 Listener.prototype.endTypeVariables$3 = function($0, $1, $2) { | 6949 Listener.prototype.endTypeVariables$3 = function($0, $1, $2) { |
| 7141 return this.endTypeVariables($assert_num($0), ($1 && $1.is$Token()), ($2 && $2
.is$Token())); | 6950 return this.endTypeVariables($0, $1, $2); |
| 7142 }; | 6951 }; |
| 7143 Listener.prototype.endVariablesDeclaration$2 = function($0, $1) { | 6952 Listener.prototype.endVariablesDeclaration$2 = function($0, $1) { |
| 7144 return this.endVariablesDeclaration($assert_num($0), ($1 && $1.is$Token())); | 6953 return this.endVariablesDeclaration($0, $1); |
| 7145 }; | 6954 }; |
| 7146 Listener.prototype.expected$2 = function($0, $1) { | 6955 Listener.prototype.expected$2 = function($0, $1) { |
| 7147 return this.expected($assert_String($0), ($1 && $1.is$Token())); | 6956 return this.expected($0, $1); |
| 7148 }; | 6957 }; |
| 7149 Listener.prototype.expectedBlock$1 = function($0) { | 6958 Listener.prototype.expectedBlock$1 = function($0) { |
| 7150 return this.expectedBlock(($0 && $0.is$Token())); | 6959 return this.expectedBlock($0); |
| 7151 }; | 6960 }; |
| 7152 Listener.prototype.expectedIdentifier$1 = function($0) { | 6961 Listener.prototype.expectedIdentifier$1 = function($0) { |
| 7153 return this.expectedIdentifier(($0 && $0.is$Token())); | 6962 return this.expectedIdentifier($0); |
| 7154 }; | 6963 }; |
| 7155 Listener.prototype.expectedType$1 = function($0) { | 6964 Listener.prototype.expectedType$1 = function($0) { |
| 7156 return this.expectedType(($0 && $0.is$Token())); | 6965 return this.expectedType($0); |
| 7157 }; | 6966 }; |
| 7158 Listener.prototype.handleAssignmentExpression$1 = function($0) { | 6967 Listener.prototype.handleAssignmentExpression$1 = function($0) { |
| 7159 return this.handleAssignmentExpression(($0 && $0.is$Token())); | 6968 return this.handleAssignmentExpression($0); |
| 7160 }; | 6969 }; |
| 7161 Listener.prototype.handleBinaryExpression$1 = function($0) { | 6970 Listener.prototype.handleBinaryExpression$1 = function($0) { |
| 7162 return this.handleBinaryExpression(($0 && $0.is$Token())); | 6971 return this.handleBinaryExpression($0); |
| 7163 }; | 6972 }; |
| 7164 Listener.prototype.handleConditionalExpression$2 = function($0, $1) { | 6973 Listener.prototype.handleConditionalExpression$2 = function($0, $1) { |
| 7165 return this.handleConditionalExpression(($0 && $0.is$Token()), ($1 && $1.is$To
ken())); | 6974 return this.handleConditionalExpression($0, $1); |
| 7166 }; | 6975 }; |
| 7167 Listener.prototype.handleIdentifier$1 = function($0) { | 6976 Listener.prototype.handleIdentifier$1 = function($0) { |
| 7168 return this.handleIdentifier(($0 && $0.is$Token())); | 6977 return this.handleIdentifier($0); |
| 7169 }; | 6978 }; |
| 7170 Listener.prototype.handleLiteralBool$1 = function($0) { | 6979 Listener.prototype.handleLiteralBool$1 = function($0) { |
| 7171 return this.handleLiteralBool(($0 && $0.is$Token())); | 6980 return this.handleLiteralBool($0); |
| 7172 }; | 6981 }; |
| 7173 Listener.prototype.handleLiteralDouble$1 = function($0) { | 6982 Listener.prototype.handleLiteralDouble$1 = function($0) { |
| 7174 return this.handleLiteralDouble(($0 && $0.is$Token())); | 6983 return this.handleLiteralDouble($0); |
| 7175 }; | 6984 }; |
| 7176 Listener.prototype.handleLiteralInt$1 = function($0) { | 6985 Listener.prototype.handleLiteralInt$1 = function($0) { |
| 7177 return this.handleLiteralInt(($0 && $0.is$Token())); | 6986 return this.handleLiteralInt($0); |
| 7178 }; | 6987 }; |
| 7179 Listener.prototype.handleLiteralString$1 = function($0) { | 6988 Listener.prototype.handleLiteralString$1 = function($0) { |
| 7180 return this.handleLiteralString(($0 && $0.is$Token())); | 6989 return this.handleLiteralString($0); |
| 7181 }; | 6990 }; |
| 7182 Listener.prototype.handleNoArguments$1 = function($0) { | 6991 Listener.prototype.handleNoArguments$1 = function($0) { |
| 7183 return this.handleNoArguments(($0 && $0.is$Token())); | 6992 return this.handleNoArguments($0); |
| 7184 }; | 6993 }; |
| 7185 Listener.prototype.handleNoType$1 = function($0) { | 6994 Listener.prototype.handleNoType$1 = function($0) { |
| 7186 return this.handleNoType(($0 && $0.is$Token())); | 6995 return this.handleNoType($0); |
| 7187 }; | 6996 }; |
| 7188 Listener.prototype.handleNoTypeArguments$1 = function($0) { | 6997 Listener.prototype.handleNoTypeArguments$1 = function($0) { |
| 7189 return this.handleNoTypeArguments(($0 && $0.is$Token())); | 6998 return this.handleNoTypeArguments($0); |
| 7190 }; | 6999 }; |
| 7191 Listener.prototype.handleNoTypeVariables$1 = function($0) { | 7000 Listener.prototype.handleNoTypeVariables$1 = function($0) { |
| 7192 return this.handleNoTypeVariables(($0 && $0.is$Token())); | 7001 return this.handleNoTypeVariables($0); |
| 7193 }; | 7002 }; |
| 7194 Listener.prototype.handleVarKeyword$1 = function($0) { | 7003 Listener.prototype.handleVarKeyword$1 = function($0) { |
| 7195 return this.handleVarKeyword(($0 && $0.is$Token())); | 7004 return this.handleVarKeyword($0); |
| 7196 }; | 7005 }; |
| 7197 Listener.prototype.handleVoidKeyword$1 = function($0) { | 7006 Listener.prototype.handleVoidKeyword$1 = function($0) { |
| 7198 return this.handleVoidKeyword(($0 && $0.is$Token())); | 7007 return this.handleVoidKeyword($0); |
| 7199 }; | 7008 }; |
| 7200 Listener.prototype.unexpected$1 = function($0) { | 7009 Listener.prototype.unexpected$1 = function($0) { |
| 7201 return this.unexpected(($0 && $0.is$Token())); | 7010 return this.unexpected($0); |
| 7202 }; | 7011 }; |
| 7203 Listener.prototype.unexpectedEof$0 = function() { | 7012 Listener.prototype.unexpectedEof$0 = function() { |
| 7204 return this.unexpectedEof(); | 7013 return this.unexpectedEof(); |
| 7205 }; | 7014 }; |
| 7206 // ********** Code for ParserError ************** | 7015 // ********** Code for ParserError ************** |
| 7207 function ParserError(reason) { | 7016 function ParserError(reason) { |
| 7208 this.reason = reason; | 7017 this.reason = reason; |
| 7209 // Initializers done | 7018 // Initializers done |
| 7210 } | 7019 } |
| 7211 ParserError.prototype.toString = function() { | 7020 ParserError.prototype.toString = function() { |
| 7212 return this.reason; | 7021 return this.reason; |
| 7213 } | 7022 } |
| 7214 ParserError.prototype.toString$0 = function() { | 7023 ParserError.prototype.toString$0 = function() { |
| 7215 return this.toString(); | 7024 return this.toString(); |
| 7216 }; | 7025 }; |
| 7217 // ********** Code for ElementListener ************** | 7026 // ********** Code for ElementListener ************** |
| 7218 function ElementListener(canceler) { | 7027 function ElementListener(canceler) { |
| 7219 this.previousIdentifier = null | 7028 this.previousIdentifier = null |
| 7220 this.nodes = const$14/*const EmptyLink()*/ | 7029 this.nodes = const$14/*const EmptyLink()*/ |
| 7221 this.topLevelElements = const$14/*const EmptyLink()*/ | 7030 this.topLevelElements = const$14/*const EmptyLink()*/ |
| 7222 this.canceler = canceler; | 7031 this.canceler = canceler; |
| 7223 // Initializers done | 7032 // Initializers done |
| 7224 } | 7033 } |
| 7225 $inherits(ElementListener, Listener); | 7034 $inherits(ElementListener, Listener); |
| 7226 ElementListener.prototype.beginLibraryTag = function(token) { | 7035 ElementListener.prototype.beginLibraryTag = function(token) { |
| 7227 this.canceler.cancel("Cannot handle library tags"); | 7036 this.canceler.cancel("Cannot handle library tags"); |
| 7228 } | 7037 } |
| 7229 ElementListener.prototype.endClass = function(interfacesCount, beginToken, exten
dsKeyword, implementsKeyword, endToken) { | 7038 ElementListener.prototype.endClass = function(interfacesCount, beginToken, exten
dsKeyword, implementsKeyword, endToken) { |
| 7230 var $0; | |
| 7231 for (; interfacesCount > 0; --interfacesCount) { | 7039 for (; interfacesCount > 0; --interfacesCount) { |
| 7232 this.popNode(); | 7040 this.popNode(); |
| 7233 } | 7041 } |
| 7234 var supertype = (($0 = this.popNode()) && $0.is$Identifier()); | 7042 var supertype = this.popNode(); |
| 7235 var name = (($0 = this.popNode()) && $0.is$Identifier()); | 7043 var name = this.popNode(); |
| 7236 this.pushElement(new PartialClassElement(name.get$source(), beginToken, endTok
en)); | 7044 this.pushElement(new PartialClassElement(name.get$source(), beginToken, endTok
en)); |
| 7237 } | 7045 } |
| 7238 ElementListener.prototype.endInterface = function(token) { | 7046 ElementListener.prototype.endInterface = function(token) { |
| 7239 this.canceler.cancel("Cannot handle interfaces"); | 7047 this.canceler.cancel("Cannot handle interfaces"); |
| 7240 } | 7048 } |
| 7241 ElementListener.prototype.endFunctionTypeAlias = function(token) { | 7049 ElementListener.prototype.endFunctionTypeAlias = function(token) { |
| 7242 this.canceler.cancel("Cannot handle typedefs"); | 7050 this.canceler.cancel("Cannot handle typedefs"); |
| 7243 } | 7051 } |
| 7244 ElementListener.prototype.endTopLevelMethod = function(beginToken, endToken) { | 7052 ElementListener.prototype.endTopLevelMethod = function(beginToken, endToken) { |
| 7245 var $0; | 7053 var name = this.popNode(); |
| 7246 var name = (($0 = this.popNode()) && $0.is$Identifier()); | |
| 7247 this.pushElement(new PartialFunctionElement(name.get$source(), beginToken, end
Token)); | 7054 this.pushElement(new PartialFunctionElement(name.get$source(), beginToken, end
Token)); |
| 7248 } | 7055 } |
| 7249 ElementListener.prototype.endTopLevelField = function(beginToken, endToken) { | 7056 ElementListener.prototype.endTopLevelField = function(beginToken, endToken) { |
| 7250 this.canceler.cancel("Cannot handle fields"); | 7057 this.canceler.cancel("Cannot handle fields"); |
| 7251 } | 7058 } |
| 7252 ElementListener.prototype.handleIdentifier = function(token) { | 7059 ElementListener.prototype.handleIdentifier = function(token) { |
| 7253 this.pushNode(new Identifier(token)); | 7060 this.pushNode(new Identifier(token)); |
| 7254 } | 7061 } |
| 7255 ElementListener.prototype.handleNoType = function(token) { | 7062 ElementListener.prototype.handleNoType = function(token) { |
| 7256 this.pushNode(null); | 7063 this.pushNode(null); |
| 7257 } | 7064 } |
| 7258 ElementListener.prototype.endTypeVariable = function(token) { | 7065 ElementListener.prototype.endTypeVariable = function(token) { |
| 7259 var $0; | 7066 var bound = this.popNode(); |
| 7260 var bound = (($0 = this.popNode()) && $0.is$TypeAnnotation()); | 7067 var name = this.popNode(); |
| 7261 var name = (($0 = this.popNode()) && $0.is$Identifier()); | |
| 7262 } | 7068 } |
| 7263 ElementListener.prototype.endTypeArguments = function(count, beginToken, endToke
n) { | 7069 ElementListener.prototype.endTypeArguments = function(count, beginToken, endToke
n) { |
| 7264 for (; count > 0; --count) { | 7070 for (; count > 0; --count) { |
| 7265 this.popNode(); | 7071 this.popNode(); |
| 7266 } | 7072 } |
| 7267 } | 7073 } |
| 7268 ElementListener.prototype.expected = function(string, token) { | 7074 ElementListener.prototype.expected = function(string, token) { |
| 7269 this.canceler.cancel(("Expected '" + string + "', but got '" + token + "' ") +
("@ " + token.charOffset + "")); | 7075 this.canceler.cancel(("Expected '" + string + "', but got '" + token + "' ") +
("@ " + token.charOffset + "")); |
| 7270 } | 7076 } |
| 7271 ElementListener.prototype.unexpectedEof = function() { | 7077 ElementListener.prototype.unexpectedEof = function() { |
| 7272 this.canceler.cancel("Unexpected end of file"); | 7078 this.canceler.cancel("Unexpected end of file"); |
| 7273 } | 7079 } |
| 7274 ElementListener.prototype.expectedIdentifier = function(token) { | 7080 ElementListener.prototype.expectedIdentifier = function(token) { |
| 7275 this.canceler.cancel(("Expected identifier, but got '" + token + "' ") + ("@ "
+ token.charOffset + "")); | 7081 this.canceler.cancel(("Expected identifier, but got '" + token + "' ") + ("@ "
+ token.charOffset + "")); |
| 7276 } | 7082 } |
| 7277 ElementListener.prototype.expectedType = function(token) { | 7083 ElementListener.prototype.expectedType = function(token) { |
| 7278 this.canceler.cancel(("Expected a type, but got '" + token + "' @ " + token.ch
arOffset + "")); | 7084 this.canceler.cancel(("Expected a type, but got '" + token + "' @ " + token.ch
arOffset + "")); |
| 7279 } | 7085 } |
| 7280 ElementListener.prototype.expectedBlock = function(token) { | 7086 ElementListener.prototype.expectedBlock = function(token) { |
| 7281 this.canceler.cancel(("Expected a block, but got '" + token + "' @ " + token.c
harOffset + "")); | 7087 this.canceler.cancel(("Expected a block, but got '" + token + "' @ " + token.c
harOffset + "")); |
| 7282 } | 7088 } |
| 7283 ElementListener.prototype.unexpected = function(token) { | 7089 ElementListener.prototype.unexpected = function(token) { |
| 7284 this.canceler.cancel(("Unexpected token '" + token + "' @ " + token.charOffset
+ "")); | 7090 this.canceler.cancel(("Unexpected token '" + token + "' @ " + token.charOffset
+ "")); |
| 7285 } | 7091 } |
| 7286 ElementListener.prototype.pushElement = function(element) { | 7092 ElementListener.prototype.pushElement = function(element) { |
| 7287 var $0; | 7093 this.topLevelElements = this.topLevelElements.prepend(element); |
| 7288 this.topLevelElements = (($0 = this.topLevelElements.prepend(element)) && $0.i
s$Link$Element()); | |
| 7289 } | 7094 } |
| 7290 ElementListener.prototype.pushNode = function(node) { | 7095 ElementListener.prototype.pushNode = function(node) { |
| 7291 var $0; | 7096 this.nodes = this.nodes.prepend(node); |
| 7292 this.nodes = (($0 = this.nodes.prepend(node)) && $0.is$Link$Node()); | |
| 7293 this.log(("push " + this.nodes + "")); | 7097 this.log(("push " + this.nodes + "")); |
| 7294 } | 7098 } |
| 7295 ElementListener.prototype.popNode = function() { | 7099 ElementListener.prototype.popNode = function() { |
| 7296 var $0; | 7100 var node = this.nodes.get$head(); |
| 7297 $assert(!$notnull_bool(this.nodes.isEmpty()), "!nodes.isEmpty()", "listener.da
rt", 337, 12); | 7101 this.nodes = this.nodes.get$tail(); |
| 7298 var node = (($0 = this.nodes.get$head()) && $0.is$Node()); | |
| 7299 this.nodes = (($0 = this.nodes.get$tail()) && $0.is$Link$Node()); | |
| 7300 this.log(("pop " + this.nodes + "")); | 7102 this.log(("pop " + this.nodes + "")); |
| 7301 return node; | 7103 return node; |
| 7302 } | 7104 } |
| 7303 ElementListener.prototype.log = function(message) { | 7105 ElementListener.prototype.log = function(message) { |
| 7304 | 7106 |
| 7305 } | 7107 } |
| 7306 ElementListener.prototype.beginLibraryTag$1 = function($0) { | 7108 ElementListener.prototype.beginLibraryTag$1 = function($0) { |
| 7307 return this.beginLibraryTag(($0 && $0.is$Token())); | 7109 return this.beginLibraryTag($0); |
| 7308 }; | 7110 }; |
| 7309 ElementListener.prototype.endClass$5 = function($0, $1, $2, $3, $4) { | 7111 ElementListener.prototype.endClass$5 = function($0, $1, $2, $3, $4) { |
| 7310 return this.endClass($assert_num($0), ($1 && $1.is$Token()), ($2 && $2.is$Toke
n()), ($3 && $3.is$Token()), ($4 && $4.is$Token())); | 7112 return this.endClass($0, $1, $2, $3, $4); |
| 7311 }; | 7113 }; |
| 7312 ElementListener.prototype.endFunctionTypeAlias$1 = function($0) { | 7114 ElementListener.prototype.endFunctionTypeAlias$1 = function($0) { |
| 7313 return this.endFunctionTypeAlias(($0 && $0.is$Token())); | 7115 return this.endFunctionTypeAlias($0); |
| 7314 }; | 7116 }; |
| 7315 ElementListener.prototype.endInterface$1 = function($0) { | 7117 ElementListener.prototype.endInterface$1 = function($0) { |
| 7316 return this.endInterface(($0 && $0.is$Token())); | 7118 return this.endInterface($0); |
| 7317 }; | 7119 }; |
| 7318 ElementListener.prototype.endTopLevelField$2 = function($0, $1) { | 7120 ElementListener.prototype.endTopLevelField$2 = function($0, $1) { |
| 7319 return this.endTopLevelField(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 7121 return this.endTopLevelField($0, $1); |
| 7320 }; | 7122 }; |
| 7321 ElementListener.prototype.endTopLevelMethod$2 = function($0, $1) { | 7123 ElementListener.prototype.endTopLevelMethod$2 = function($0, $1) { |
| 7322 return this.endTopLevelMethod(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 7124 return this.endTopLevelMethod($0, $1); |
| 7323 }; | 7125 }; |
| 7324 ElementListener.prototype.endTypeArguments$3 = function($0, $1, $2) { | 7126 ElementListener.prototype.endTypeArguments$3 = function($0, $1, $2) { |
| 7325 return this.endTypeArguments($assert_num($0), ($1 && $1.is$Token()), ($2 && $2
.is$Token())); | 7127 return this.endTypeArguments($0, $1, $2); |
| 7326 }; | 7128 }; |
| 7327 ElementListener.prototype.endTypeVariable$1 = function($0) { | 7129 ElementListener.prototype.endTypeVariable$1 = function($0) { |
| 7328 return this.endTypeVariable(($0 && $0.is$Token())); | 7130 return this.endTypeVariable($0); |
| 7329 }; | 7131 }; |
| 7330 ElementListener.prototype.expected$2 = function($0, $1) { | 7132 ElementListener.prototype.expected$2 = function($0, $1) { |
| 7331 return this.expected($assert_String($0), ($1 && $1.is$Token())); | 7133 return this.expected($0, $1); |
| 7332 }; | 7134 }; |
| 7333 ElementListener.prototype.expectedBlock$1 = function($0) { | 7135 ElementListener.prototype.expectedBlock$1 = function($0) { |
| 7334 return this.expectedBlock(($0 && $0.is$Token())); | 7136 return this.expectedBlock($0); |
| 7335 }; | 7137 }; |
| 7336 ElementListener.prototype.expectedIdentifier$1 = function($0) { | 7138 ElementListener.prototype.expectedIdentifier$1 = function($0) { |
| 7337 return this.expectedIdentifier(($0 && $0.is$Token())); | 7139 return this.expectedIdentifier($0); |
| 7338 }; | 7140 }; |
| 7339 ElementListener.prototype.expectedType$1 = function($0) { | 7141 ElementListener.prototype.expectedType$1 = function($0) { |
| 7340 return this.expectedType(($0 && $0.is$Token())); | 7142 return this.expectedType($0); |
| 7341 }; | 7143 }; |
| 7342 ElementListener.prototype.handleIdentifier$1 = function($0) { | 7144 ElementListener.prototype.handleIdentifier$1 = function($0) { |
| 7343 return this.handleIdentifier(($0 && $0.is$Token())); | 7145 return this.handleIdentifier($0); |
| 7344 }; | 7146 }; |
| 7345 ElementListener.prototype.handleNoType$1 = function($0) { | 7147 ElementListener.prototype.handleNoType$1 = function($0) { |
| 7346 return this.handleNoType(($0 && $0.is$Token())); | 7148 return this.handleNoType($0); |
| 7347 }; | 7149 }; |
| 7348 ElementListener.prototype.unexpected$1 = function($0) { | 7150 ElementListener.prototype.unexpected$1 = function($0) { |
| 7349 return this.unexpected(($0 && $0.is$Token())); | 7151 return this.unexpected($0); |
| 7350 }; | 7152 }; |
| 7351 ElementListener.prototype.unexpectedEof$0 = function() { | 7153 ElementListener.prototype.unexpectedEof$0 = function() { |
| 7352 return this.unexpectedEof(); | 7154 return this.unexpectedEof(); |
| 7353 }; | 7155 }; |
| 7354 // ********** Code for NodeListener ************** | 7156 // ********** Code for NodeListener ************** |
| 7355 function NodeListener(canceler, logger) { | 7157 function NodeListener(canceler, logger) { |
| 7356 this.logger = logger; | 7158 this.logger = logger; |
| 7357 ElementListener.call(this, canceler); | 7159 ElementListener.call(this, canceler); |
| 7358 // Initializers done | 7160 // Initializers done |
| 7359 this.onError = this.get$handleOnError(); | 7161 this.onError = this.get$handleOnError(); |
| 7360 } | 7162 } |
| 7361 $inherits(NodeListener, ElementListener); | 7163 $inherits(NodeListener, ElementListener); |
| 7362 NodeListener.prototype.endClass = function(interfacesCount, beginToken, extendsK
eyword, implementsKeyword, endToken) { | 7164 NodeListener.prototype.endClass = function(interfacesCount, beginToken, extendsK
eyword, implementsKeyword, endToken) { |
| 7363 var $0; | |
| 7364 var interfaces = this.makeNodeList(interfacesCount, implementsKeyword, null, "
,"); | 7165 var interfaces = this.makeNodeList(interfacesCount, implementsKeyword, null, "
,"); |
| 7365 var supertype = (($0 = this.popNode()) && $0.is$TypeAnnotation()); | 7166 var supertype = this.popNode(); |
| 7366 var name = (($0 = this.popNode()) && $0.is$Identifier()); | 7167 var name = this.popNode(); |
| 7367 this.pushNode(new ClassNode(name, supertype, interfaces, beginToken, extendsKe
yword, endToken)); | 7168 this.pushNode(new ClassNode(name, supertype, interfaces, beginToken, extendsKe
yword, endToken)); |
| 7368 } | 7169 } |
| 7369 NodeListener.prototype.endFormalParameter = function(token) { | 7170 NodeListener.prototype.endFormalParameter = function(token) { |
| 7370 var $0; | |
| 7371 var name = new NodeList.singleton$ctor(this.popNode()); | 7171 var name = new NodeList.singleton$ctor(this.popNode()); |
| 7372 var type = (($0 = this.popNode()) && $0.is$TypeAnnotation()); | 7172 var type = this.popNode(); |
| 7373 this.pushNode(new VariableDefinitions(type, null, name, token)); | 7173 this.pushNode(new VariableDefinitions(type, null, name, token)); |
| 7374 } | 7174 } |
| 7375 NodeListener.prototype.endFormalParameters = function(count, beginToken, endToke
n) { | 7175 NodeListener.prototype.endFormalParameters = function(count, beginToken, endToke
n) { |
| 7376 this.pushNode(this.makeNodeList(count, beginToken, endToken, ",")); | 7176 this.pushNode(this.makeNodeList(count, beginToken, endToken, ",")); |
| 7377 } | 7177 } |
| 7378 NodeListener.prototype.endArguments = function(count, beginToken, endToken) { | 7178 NodeListener.prototype.endArguments = function(count, beginToken, endToken) { |
| 7379 this.pushNode(this.makeNodeList(count, beginToken, endToken, ",")); | 7179 this.pushNode(this.makeNodeList(count, beginToken, endToken, ",")); |
| 7380 } | 7180 } |
| 7381 NodeListener.prototype.handleNoArguments = function(token) { | 7181 NodeListener.prototype.handleNoArguments = function(token) { |
| 7382 this.pushNode(null); | 7182 this.pushNode(null); |
| 7383 } | 7183 } |
| 7384 NodeListener.prototype.endReturnStatement = function(hasExpression, beginToken,
endToken) { | 7184 NodeListener.prototype.endReturnStatement = function(hasExpression, beginToken,
endToken) { |
| 7385 var $0; | 7185 var expression = hasExpression ? this.popNode() : null; |
| 7386 var expression = (($0 = $notnull_bool(hasExpression) ? this.popNode() : null)
&& $0.is$Expression()); | |
| 7387 this.pushNode(new Return(beginToken, endToken, expression)); | 7186 this.pushNode(new Return(beginToken, endToken, expression)); |
| 7388 } | 7187 } |
| 7389 NodeListener.prototype.endExpressionStatement = function(token) { | 7188 NodeListener.prototype.endExpressionStatement = function(token) { |
| 7390 this.pushNode(new ExpressionStatement(this.popNode(), token)); | 7189 this.pushNode(new ExpressionStatement(this.popNode(), token)); |
| 7391 } | 7190 } |
| 7392 NodeListener.prototype.handleOnError = function(token, error) { | 7191 NodeListener.prototype.handleOnError = function(token, error) { |
| 7393 this.canceler.cancel(("internal error @ " + token.charOffset + ": '" + token.g
et$value() + "'") + (": " + error + "")); | 7192 this.canceler.cancel(("internal error @ " + token.charOffset + ": '" + token.g
et$value() + "'") + (": " + error + "")); |
| 7394 } | 7193 } |
| 7395 NodeListener.prototype.get$handleOnError = function() { | 7194 NodeListener.prototype.get$handleOnError = function() { |
| 7396 return NodeListener.prototype.handleOnError.bind(this); | 7195 return NodeListener.prototype.handleOnError.bind(this); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 7408 this.pushNode(new LiteralString(token)); | 7207 this.pushNode(new LiteralString(token)); |
| 7409 } | 7208 } |
| 7410 NodeListener.prototype.handleBinaryExpression = function(token) { | 7209 NodeListener.prototype.handleBinaryExpression = function(token) { |
| 7411 var arguments = new NodeList(null, LinkFactory.Link$factory(this.popNode()), n
ull, null); | 7210 var arguments = new NodeList(null, LinkFactory.Link$factory(this.popNode()), n
ull, null); |
| 7412 this.pushNode(new Send(this.popNode(), new Operator(token), arguments)); | 7211 this.pushNode(new Send(this.popNode(), new Operator(token), arguments)); |
| 7413 } | 7212 } |
| 7414 NodeListener.prototype.handleAssignmentExpression = function(token) { | 7213 NodeListener.prototype.handleAssignmentExpression = function(token) { |
| 7415 var arguments = new NodeList.singleton$ctor(this.popNode()); | 7214 var arguments = new NodeList.singleton$ctor(this.popNode()); |
| 7416 var node = this.popNode(); | 7215 var node = this.popNode(); |
| 7417 if (!(node instanceof Send)) this.canceler.cancel(('not assignable: ' + node +
'')); | 7216 if (!(node instanceof Send)) this.canceler.cancel(('not assignable: ' + node +
'')); |
| 7418 var send = (node && node.is$Send()); | 7217 var send = node; |
| 7419 if (!$notnull_bool(send.get$isPropertyAccess())) this.canceler.cancel(('not as
signable: ' + node + '')); | 7218 if (!send.get$isPropertyAccess()) this.canceler.cancel(('not assignable: ' + n
ode + '')); |
| 7420 if ((send instanceof SendSet)) this.canceler.cancel('chained assignment'); | 7219 if ((send instanceof SendSet)) this.canceler.cancel('chained assignment'); |
| 7421 this.pushNode(new SendSet(send.receiver, send.selector, token, arguments)); | 7220 this.pushNode(new SendSet(send.receiver, send.selector, token, arguments)); |
| 7422 } | 7221 } |
| 7423 NodeListener.prototype.handleConditionalExpression = function(question, colon) { | 7222 NodeListener.prototype.handleConditionalExpression = function(question, colon) { |
| 7424 var elseExpression = this.popNode(); | 7223 var elseExpression = this.popNode(); |
| 7425 var thenExpression = this.popNode(); | 7224 var thenExpression = this.popNode(); |
| 7426 var condition = this.popNode(); | 7225 var condition = this.popNode(); |
| 7427 this.canceler.cancel('conditional expression not implemented yet'); | 7226 this.canceler.cancel('conditional expression not implemented yet'); |
| 7428 } | 7227 } |
| 7429 NodeListener.prototype.endSend = function(token) { | 7228 NodeListener.prototype.endSend = function(token) { |
| 7430 var $0; | 7229 var arguments = this.popNode(); |
| 7431 var arguments = (($0 = this.popNode()) && $0.is$NodeList()); | |
| 7432 var selector = this.popNode(); | 7230 var selector = this.popNode(); |
| 7433 this.pushNode(new Send(null, selector, arguments)); | 7231 this.pushNode(new Send(null, selector, arguments)); |
| 7434 } | 7232 } |
| 7435 NodeListener.prototype.handleVoidKeyword = function(token) { | 7233 NodeListener.prototype.handleVoidKeyword = function(token) { |
| 7436 this.pushNode(new TypeAnnotation(new Identifier(token))); | 7234 this.pushNode(new TypeAnnotation(new Identifier(token))); |
| 7437 } | 7235 } |
| 7438 NodeListener.prototype.endFunctionBody = function(count, beginToken, endToken) { | 7236 NodeListener.prototype.endFunctionBody = function(count, beginToken, endToken) { |
| 7439 var $0; | |
| 7440 var block = new Block(this.makeNodeList(count, beginToken, endToken, null)); | 7237 var block = new Block(this.makeNodeList(count, beginToken, endToken, null)); |
| 7441 var formals = this.popNode(); | 7238 var formals = this.popNode(); |
| 7442 var name = this.popNode(); | 7239 var name = this.popNode(); |
| 7443 var type = (($0 = this.popNode()) && $0.is$TypeAnnotation()); | 7240 var type = this.popNode(); |
| 7444 this.pushNode(new FunctionExpression(name, formals, block, type)); | 7241 this.pushNode(new FunctionExpression(name, formals, block, type)); |
| 7445 } | 7242 } |
| 7446 NodeListener.prototype.handleVarKeyword = function(token) { | 7243 NodeListener.prototype.handleVarKeyword = function(token) { |
| 7447 this.pushNode(new Identifier(token)); | 7244 this.pushNode(new Identifier(token)); |
| 7448 } | 7245 } |
| 7449 NodeListener.prototype.handleFinalKeyword = function(token) { | 7246 NodeListener.prototype.handleFinalKeyword = function(token) { |
| 7450 this.pushNode(new Identifier(token)); | 7247 this.pushNode(new Identifier(token)); |
| 7451 } | 7248 } |
| 7452 NodeListener.prototype.endVariablesDeclaration = function(count, endToken) { | 7249 NodeListener.prototype.endVariablesDeclaration = function(count, endToken) { |
| 7453 var $0; | |
| 7454 var variables = this.makeNodeList(count, null, null, ","); | 7250 var variables = this.makeNodeList(count, null, null, ","); |
| 7455 var type = (($0 = this.popNode()) && $0.is$TypeAnnotation()); | 7251 var type = this.popNode(); |
| 7456 this.pushNode(new VariableDefinitions(type, null, variables, endToken)); | 7252 this.pushNode(new VariableDefinitions(type, null, variables, endToken)); |
| 7457 } | 7253 } |
| 7458 NodeListener.prototype.endInitializer = function(assignmentOperator) { | 7254 NodeListener.prototype.endInitializer = function(assignmentOperator) { |
| 7459 var $0; | 7255 var initializer = this.popNode(); |
| 7460 var initializer = (($0 = this.popNode()) && $0.is$Expression()); | |
| 7461 var arguments = new NodeList.singleton$ctor(initializer); | 7256 var arguments = new NodeList.singleton$ctor(initializer); |
| 7462 var name = (($0 = this.popNode()) && $0.is$Expression()); | 7257 var name = this.popNode(); |
| 7463 this.pushNode(new SendSet(null, name, assignmentOperator, arguments)); | 7258 this.pushNode(new SendSet(null, name, assignmentOperator, arguments)); |
| 7464 } | 7259 } |
| 7465 NodeListener.prototype.endIfStatement = function(ifToken, elseToken) { | 7260 NodeListener.prototype.endIfStatement = function(ifToken, elseToken) { |
| 7466 var $0; | 7261 var elsePart = (elseToken == null) ? null : this.popNode(); |
| 7467 var elsePart = (($0 = (elseToken == null) ? null : this.popNode()) && $0.is$St
atement()); | 7262 var thenPart = this.popNode(); |
| 7468 var thenPart = (($0 = this.popNode()) && $0.is$Statement()); | 7263 var condition = this.popNode(); |
| 7469 var condition = (($0 = this.popNode()) && $0.is$NodeList()); | |
| 7470 this.pushNode(new If(condition, thenPart, elsePart, ifToken, elseToken)); | 7264 this.pushNode(new If(condition, thenPart, elsePart, ifToken, elseToken)); |
| 7471 } | 7265 } |
| 7472 NodeListener.prototype.endForStatement = function(beginToken, endToken) { | 7266 NodeListener.prototype.endForStatement = function(beginToken, endToken) { |
| 7473 var $0; | 7267 var body = this.popNode(); |
| 7474 var body = (($0 = this.popNode()) && $0.is$Statement()); | 7268 var update = this.popNode(); |
| 7475 var update = (($0 = this.popNode()) && $0.is$Expression()); | 7269 var condition = this.popNode(); |
| 7476 var condition = (($0 = this.popNode()) && $0.is$ExpressionStatement()); | 7270 var initializer = this.popNode(); |
| 7477 var initializer = (($0 = this.popNode()) && $0.is$VariableDefinitions()); | |
| 7478 this.pushNode(new For(initializer, condition, update, body, beginToken)); | 7271 this.pushNode(new For(initializer, condition, update, body, beginToken)); |
| 7479 } | 7272 } |
| 7480 NodeListener.prototype.endBlock = function(count, beginToken, endToken) { | 7273 NodeListener.prototype.endBlock = function(count, beginToken, endToken) { |
| 7481 this.pushNode(new Block(this.makeNodeList(count, beginToken, endToken, null)))
; | 7274 this.pushNode(new Block(this.makeNodeList(count, beginToken, endToken, null)))
; |
| 7482 } | 7275 } |
| 7483 NodeListener.prototype.endType = function(count, beginToken, endToken) { | 7276 NodeListener.prototype.endType = function(count, beginToken, endToken) { |
| 7484 var $0; | 7277 var type = new TypeAnnotation(this.popNode()); |
| 7485 var type = new TypeAnnotation((($0 = this.popNode()) && $0.is$Identifier())); | |
| 7486 for (; count > 1; --count) { | 7278 for (; count > 1; --count) { |
| 7487 this.popNode(); | 7279 this.popNode(); |
| 7488 } | 7280 } |
| 7489 this.pushNode(type); | 7281 this.pushNode(type); |
| 7490 } | 7282 } |
| 7491 NodeListener.prototype.endThrowStatement = function(throwToken, endToken) { | 7283 NodeListener.prototype.endThrowStatement = function(throwToken, endToken) { |
| 7492 var $0; | 7284 var expression = this.popNode(); |
| 7493 var expression = (($0 = this.popNode()) && $0.is$Expression()); | |
| 7494 this.pushNode(new Throw(expression, throwToken, endToken)); | 7285 this.pushNode(new Throw(expression, throwToken, endToken)); |
| 7495 } | 7286 } |
| 7496 NodeListener.prototype.endRethrowStatement = function(throwToken, endToken) { | 7287 NodeListener.prototype.endRethrowStatement = function(throwToken, endToken) { |
| 7497 this.pushNode(new Throw(null, throwToken, endToken)); | 7288 this.pushNode(new Throw(null, throwToken, endToken)); |
| 7498 } | 7289 } |
| 7499 NodeListener.prototype.makeNodeList = function(count, beginToken, endToken, deli
miter) { | 7290 NodeListener.prototype.makeNodeList = function(count, beginToken, endToken, deli
miter) { |
| 7500 var $0; | |
| 7501 var nodes = const$14/*const EmptyLink()*/; | 7291 var nodes = const$14/*const EmptyLink()*/; |
| 7502 for (; count > 0; --count) { | 7292 for (; count > 0; --count) { |
| 7503 nodes = (($0 = nodes.prepend(this.popNode())) && $0.is$Link$Node()); | 7293 nodes = nodes.prepend(this.popNode()); |
| 7504 } | 7294 } |
| 7505 var sourceDelimiter = (($0 = (delimiter == null) ? null : new StringWrapper(de
limiter)) && $0.is$SourceString()); | 7295 var sourceDelimiter = (delimiter == null) ? null : new StringWrapper(delimiter
); |
| 7506 return new NodeList(beginToken, nodes, endToken, sourceDelimiter); | 7296 return new NodeList(beginToken, nodes, endToken, sourceDelimiter); |
| 7507 } | 7297 } |
| 7508 NodeListener.prototype.log = function(message) { | 7298 NodeListener.prototype.log = function(message) { |
| 7509 this.logger.log(message); | 7299 this.logger.log(message); |
| 7510 } | 7300 } |
| 7511 NodeListener.prototype.endArguments$3 = function($0, $1, $2) { | 7301 NodeListener.prototype.endArguments$3 = function($0, $1, $2) { |
| 7512 return this.endArguments($assert_num($0), ($1 && $1.is$Token()), ($2 && $2.is$
Token())); | 7302 return this.endArguments($0, $1, $2); |
| 7513 }; | 7303 }; |
| 7514 NodeListener.prototype.endBlock$3 = function($0, $1, $2) { | 7304 NodeListener.prototype.endBlock$3 = function($0, $1, $2) { |
| 7515 return this.endBlock($assert_num($0), ($1 && $1.is$Token()), ($2 && $2.is$Toke
n())); | 7305 return this.endBlock($0, $1, $2); |
| 7516 }; | 7306 }; |
| 7517 NodeListener.prototype.endClass$5 = function($0, $1, $2, $3, $4) { | 7307 NodeListener.prototype.endClass$5 = function($0, $1, $2, $3, $4) { |
| 7518 return this.endClass($assert_num($0), ($1 && $1.is$Token()), ($2 && $2.is$Toke
n()), ($3 && $3.is$Token()), ($4 && $4.is$Token())); | 7308 return this.endClass($0, $1, $2, $3, $4); |
| 7519 }; | 7309 }; |
| 7520 NodeListener.prototype.endExpressionStatement$1 = function($0) { | 7310 NodeListener.prototype.endExpressionStatement$1 = function($0) { |
| 7521 return this.endExpressionStatement(($0 && $0.is$Token())); | 7311 return this.endExpressionStatement($0); |
| 7522 }; | 7312 }; |
| 7523 NodeListener.prototype.endForStatement$2 = function($0, $1) { | 7313 NodeListener.prototype.endForStatement$2 = function($0, $1) { |
| 7524 return this.endForStatement(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 7314 return this.endForStatement($0, $1); |
| 7525 }; | 7315 }; |
| 7526 NodeListener.prototype.endFormalParameter$1 = function($0) { | 7316 NodeListener.prototype.endFormalParameter$1 = function($0) { |
| 7527 return this.endFormalParameter(($0 && $0.is$Token())); | 7317 return this.endFormalParameter($0); |
| 7528 }; | 7318 }; |
| 7529 NodeListener.prototype.endFormalParameters$3 = function($0, $1, $2) { | 7319 NodeListener.prototype.endFormalParameters$3 = function($0, $1, $2) { |
| 7530 return this.endFormalParameters($assert_num($0), ($1 && $1.is$Token()), ($2 &&
$2.is$Token())); | 7320 return this.endFormalParameters($0, $1, $2); |
| 7531 }; | 7321 }; |
| 7532 NodeListener.prototype.endFunctionBody$3 = function($0, $1, $2) { | 7322 NodeListener.prototype.endFunctionBody$3 = function($0, $1, $2) { |
| 7533 return this.endFunctionBody($assert_num($0), ($1 && $1.is$Token()), ($2 && $2.
is$Token())); | 7323 return this.endFunctionBody($0, $1, $2); |
| 7534 }; | 7324 }; |
| 7535 NodeListener.prototype.endIfStatement$2 = function($0, $1) { | 7325 NodeListener.prototype.endIfStatement$2 = function($0, $1) { |
| 7536 return this.endIfStatement(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 7326 return this.endIfStatement($0, $1); |
| 7537 }; | 7327 }; |
| 7538 NodeListener.prototype.endInitializer$1 = function($0) { | 7328 NodeListener.prototype.endInitializer$1 = function($0) { |
| 7539 return this.endInitializer(($0 && $0.is$Token())); | 7329 return this.endInitializer($0); |
| 7540 }; | 7330 }; |
| 7541 NodeListener.prototype.endRethrowStatement$2 = function($0, $1) { | 7331 NodeListener.prototype.endRethrowStatement$2 = function($0, $1) { |
| 7542 return this.endRethrowStatement(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 7332 return this.endRethrowStatement($0, $1); |
| 7543 }; | 7333 }; |
| 7544 NodeListener.prototype.endReturnStatement$3 = function($0, $1, $2) { | 7334 NodeListener.prototype.endReturnStatement$3 = function($0, $1, $2) { |
| 7545 return this.endReturnStatement($assert_bool($0), ($1 && $1.is$Token()), ($2 &&
$2.is$Token())); | 7335 return this.endReturnStatement($0, $1, $2); |
| 7546 }; | 7336 }; |
| 7547 NodeListener.prototype.endSend$1 = function($0) { | 7337 NodeListener.prototype.endSend$1 = function($0) { |
| 7548 return this.endSend(($0 && $0.is$Token())); | 7338 return this.endSend($0); |
| 7549 }; | 7339 }; |
| 7550 NodeListener.prototype.endThrowStatement$2 = function($0, $1) { | 7340 NodeListener.prototype.endThrowStatement$2 = function($0, $1) { |
| 7551 return this.endThrowStatement(($0 && $0.is$Token()), ($1 && $1.is$Token())); | 7341 return this.endThrowStatement($0, $1); |
| 7552 }; | 7342 }; |
| 7553 NodeListener.prototype.endType$3 = function($0, $1, $2) { | 7343 NodeListener.prototype.endType$3 = function($0, $1, $2) { |
| 7554 return this.endType($assert_num($0), ($1 && $1.is$Token()), ($2 && $2.is$Token
())); | 7344 return this.endType($0, $1, $2); |
| 7555 }; | 7345 }; |
| 7556 NodeListener.prototype.endVariablesDeclaration$2 = function($0, $1) { | 7346 NodeListener.prototype.endVariablesDeclaration$2 = function($0, $1) { |
| 7557 return this.endVariablesDeclaration($assert_num($0), ($1 && $1.is$Token())); | 7347 return this.endVariablesDeclaration($0, $1); |
| 7558 }; | 7348 }; |
| 7559 NodeListener.prototype.handleAssignmentExpression$1 = function($0) { | 7349 NodeListener.prototype.handleAssignmentExpression$1 = function($0) { |
| 7560 return this.handleAssignmentExpression(($0 && $0.is$Token())); | 7350 return this.handleAssignmentExpression($0); |
| 7561 }; | 7351 }; |
| 7562 NodeListener.prototype.handleBinaryExpression$1 = function($0) { | 7352 NodeListener.prototype.handleBinaryExpression$1 = function($0) { |
| 7563 return this.handleBinaryExpression(($0 && $0.is$Token())); | 7353 return this.handleBinaryExpression($0); |
| 7564 }; | 7354 }; |
| 7565 NodeListener.prototype.handleConditionalExpression$2 = function($0, $1) { | 7355 NodeListener.prototype.handleConditionalExpression$2 = function($0, $1) { |
| 7566 return this.handleConditionalExpression(($0 && $0.is$Token()), ($1 && $1.is$To
ken())); | 7356 return this.handleConditionalExpression($0, $1); |
| 7567 }; | 7357 }; |
| 7568 NodeListener.prototype.handleFinalKeyword$1 = function($0) { | 7358 NodeListener.prototype.handleFinalKeyword$1 = function($0) { |
| 7569 return this.handleFinalKeyword(($0 && $0.is$Token())); | 7359 return this.handleFinalKeyword($0); |
| 7570 }; | 7360 }; |
| 7571 NodeListener.prototype.handleLiteralBool$1 = function($0) { | 7361 NodeListener.prototype.handleLiteralBool$1 = function($0) { |
| 7572 return this.handleLiteralBool(($0 && $0.is$Token())); | 7362 return this.handleLiteralBool($0); |
| 7573 }; | 7363 }; |
| 7574 NodeListener.prototype.handleLiteralDouble$1 = function($0) { | 7364 NodeListener.prototype.handleLiteralDouble$1 = function($0) { |
| 7575 return this.handleLiteralDouble(($0 && $0.is$Token())); | 7365 return this.handleLiteralDouble($0); |
| 7576 }; | 7366 }; |
| 7577 NodeListener.prototype.handleLiteralInt$1 = function($0) { | 7367 NodeListener.prototype.handleLiteralInt$1 = function($0) { |
| 7578 return this.handleLiteralInt(($0 && $0.is$Token())); | 7368 return this.handleLiteralInt($0); |
| 7579 }; | 7369 }; |
| 7580 NodeListener.prototype.handleLiteralString$1 = function($0) { | 7370 NodeListener.prototype.handleLiteralString$1 = function($0) { |
| 7581 return this.handleLiteralString(($0 && $0.is$Token())); | 7371 return this.handleLiteralString($0); |
| 7582 }; | 7372 }; |
| 7583 NodeListener.prototype.handleNoArguments$1 = function($0) { | 7373 NodeListener.prototype.handleNoArguments$1 = function($0) { |
| 7584 return this.handleNoArguments(($0 && $0.is$Token())); | 7374 return this.handleNoArguments($0); |
| 7585 }; | 7375 }; |
| 7586 NodeListener.prototype.handleVarKeyword$1 = function($0) { | 7376 NodeListener.prototype.handleVarKeyword$1 = function($0) { |
| 7587 return this.handleVarKeyword(($0 && $0.is$Token())); | 7377 return this.handleVarKeyword($0); |
| 7588 }; | 7378 }; |
| 7589 NodeListener.prototype.handleVoidKeyword$1 = function($0) { | 7379 NodeListener.prototype.handleVoidKeyword$1 = function($0) { |
| 7590 return this.handleVoidKeyword(($0 && $0.is$Token())); | 7380 return this.handleVoidKeyword($0); |
| 7591 }; | 7381 }; |
| 7592 // ********** Code for PartialFunctionElement ************** | 7382 // ********** Code for PartialFunctionElement ************** |
| 7593 function PartialFunctionElement(name, beginToken, endToken) { | 7383 function PartialFunctionElement(name, beginToken, endToken) { |
| 7594 this.beginToken = beginToken; | 7384 this.beginToken = beginToken; |
| 7595 this.endToken = endToken; | 7385 this.endToken = endToken; |
| 7596 FunctionElement.call(this, name); | 7386 FunctionElement.call(this, name); |
| 7597 // Initializers done | 7387 // Initializers done |
| 7598 } | 7388 } |
| 7599 $inherits(PartialFunctionElement, FunctionElement); | 7389 $inherits(PartialFunctionElement, FunctionElement); |
| 7600 PartialFunctionElement.prototype.parseNode = function(canceler, logger) { | 7390 PartialFunctionElement.prototype.parseNode = function(canceler, logger) { |
| 7601 var $this = this; // closure support | 7391 var $this = this; // closure support |
| 7602 var $0; | |
| 7603 if (this.node != null) return this.node; | 7392 if (this.node != null) return this.node; |
| 7604 this.node = (($0 = parse(canceler, logger, (function (p) { | 7393 this.node = parse(canceler, logger, (function (p) { |
| 7605 return p.parseFunction$1($this.beginToken); | 7394 return p.parseFunction$1($this.beginToken); |
| 7606 }) | 7395 }) |
| 7607 )) && $0.is$FunctionExpression()); | 7396 ); |
| 7608 return this.node; | 7397 return this.node; |
| 7609 } | 7398 } |
| 7610 // ********** Code for PartialClassElement ************** | 7399 // ********** Code for PartialClassElement ************** |
| 7611 function PartialClassElement(name, beginToken, endToken) { | 7400 function PartialClassElement(name, beginToken, endToken) { |
| 7612 this.beginToken = beginToken; | 7401 this.beginToken = beginToken; |
| 7613 this.endToken = endToken; | 7402 this.endToken = endToken; |
| 7614 ClassElement.call(this, name); | 7403 ClassElement.call(this, name); |
| 7615 // Initializers done | 7404 // Initializers done |
| 7616 } | 7405 } |
| 7617 $inherits(PartialClassElement, ClassElement); | 7406 $inherits(PartialClassElement, ClassElement); |
| 7618 PartialClassElement.prototype.parseNode = function(canceler, logger) { | 7407 PartialClassElement.prototype.parseNode = function(canceler, logger) { |
| 7619 var $this = this; // closure support | 7408 var $this = this; // closure support |
| 7620 var $0; | |
| 7621 if (this.node != null) return this.node; | 7409 if (this.node != null) return this.node; |
| 7622 this.node = (($0 = parse(canceler, logger, (function (p) { | 7410 this.node = parse(canceler, logger, (function (p) { |
| 7623 return p.parseClass$1($this.beginToken); | 7411 return p.parseClass$1($this.beginToken); |
| 7624 }) | 7412 }) |
| 7625 )) && $0.is$ClassNode()); | 7413 ); |
| 7626 return this.node; | 7414 return this.node; |
| 7627 } | 7415 } |
| 7628 // ********** Code for StringScanner ************** | 7416 // ********** Code for StringScanner ************** |
| 7629 function StringScanner(string) { | 7417 function StringScanner(string) { |
| 7630 this.string = string; | 7418 this.string = string; |
| 7631 ArrayBasedScanner$SourceString.call(this); | 7419 ArrayBasedScanner$SourceString.call(this); |
| 7632 // Initializers done | 7420 // Initializers done |
| 7633 } | 7421 } |
| 7634 $inherits(StringScanner, ArrayBasedScanner$SourceString); | 7422 $inherits(StringScanner, ArrayBasedScanner$SourceString); |
| 7635 StringScanner.prototype.nextByte = function() { | 7423 StringScanner.prototype.nextByte = function() { |
| 7636 return this.charAt(++this.byteOffset); | 7424 return this.charAt(++this.byteOffset); |
| 7637 } | 7425 } |
| 7638 StringScanner.prototype.peek = function() { | 7426 StringScanner.prototype.peek = function() { |
| 7639 return this.charAt(this.byteOffset + 1); | 7427 return this.charAt(this.byteOffset + 1); |
| 7640 } | 7428 } |
| 7641 StringScanner.prototype.charAt = function(index) { | 7429 StringScanner.prototype.charAt = function(index) { |
| 7642 return (this.string.length > $assert_num(index)) ? this.string.charCodeAt($ass
ert_num(index)) : -1; | 7430 return (this.string.length > index) ? this.string.charCodeAt(index) : -1; |
| 7643 } | 7431 } |
| 7644 StringScanner.prototype.asciiString = function(start) { | 7432 StringScanner.prototype.asciiString = function(start) { |
| 7645 return new SubstringWrapper(this.string, start, this.byteOffset); | 7433 return new SubstringWrapper(this.string, start, this.byteOffset); |
| 7646 } | 7434 } |
| 7647 StringScanner.prototype.utf8String = function(start, offset) { | 7435 StringScanner.prototype.utf8String = function(start, offset) { |
| 7648 return new SubstringWrapper(this.string, start, this.byteOffset + offset + 1); | 7436 return new SubstringWrapper(this.string, start, this.byteOffset + offset + 1); |
| 7649 } | 7437 } |
| 7650 StringScanner.prototype.appendByteStringToken = function(kind, value) { | 7438 StringScanner.prototype.appendByteStringToken = function(kind, value) { |
| 7651 this.tail.next = new StringToken.fromSource$ctor(kind, value, this.tokenStart)
; | 7439 this.tail.next = new StringToken.fromSource$ctor(kind, value, this.tokenStart)
; |
| 7652 this.tail = this.tail.next; | 7440 this.tail = this.tail.next; |
| 7653 } | 7441 } |
| 7654 StringScanner.prototype.appendByteStringToken$2 = function($0, $1) { | |
| 7655 return this.appendByteStringToken($assert_num($0), ($1 && $1.is$SourceString()
)); | |
| 7656 }; | |
| 7657 // ********** Code for SubstringWrapper ************** | 7442 // ********** Code for SubstringWrapper ************** |
| 7658 function SubstringWrapper(internalString, begin, end) { | 7443 function SubstringWrapper(internalString, begin, end) { |
| 7659 this.internalString = internalString; | 7444 this.internalString = internalString; |
| 7660 this.begin = begin; | 7445 this.begin = begin; |
| 7661 this.end = end; | 7446 this.end = end; |
| 7662 // Initializers done | 7447 // Initializers done |
| 7663 } | 7448 } |
| 7664 SubstringWrapper.prototype.is$SourceString = function(){return this;}; | 7449 SubstringWrapper.prototype.is$SourceString = function(){return this;}; |
| 7665 SubstringWrapper.prototype.hashCode = function() { | 7450 SubstringWrapper.prototype.hashCode = function() { |
| 7666 return this.toString().hashCode(); | 7451 return this.toString().hashCode(); |
| 7667 } | 7452 } |
| 7668 SubstringWrapper.prototype.$eq = function(other) { | 7453 SubstringWrapper.prototype.$eq = function(other) { |
| 7669 return !!(other && other.is$SourceString) && this.toString() == other.toString
$0(); | 7454 return !!(other && other.is$SourceString) && this.toString() == other.toString
$0(); |
| 7670 } | 7455 } |
| 7671 SubstringWrapper.prototype.printOn = function(sb) { | 7456 SubstringWrapper.prototype.printOn = function(sb) { |
| 7672 sb.add(this); | 7457 sb.add(this); |
| 7673 } | 7458 } |
| 7674 SubstringWrapper.prototype.toString = function() { | 7459 SubstringWrapper.prototype.toString = function() { |
| 7675 return this.internalString.substring(this.begin, this.end); | 7460 return this.internalString.substring(this.begin, this.end); |
| 7676 } | 7461 } |
| 7677 SubstringWrapper.prototype.get$stringValue = function() { | 7462 SubstringWrapper.prototype.get$stringValue = function() { |
| 7678 return null; | 7463 return null; |
| 7679 } | 7464 } |
| 7680 SubstringWrapper.prototype.hashCode$0 = function() { | 7465 SubstringWrapper.prototype.hashCode$0 = function() { |
| 7681 return this.hashCode(); | 7466 return this.hashCode(); |
| 7682 }; | 7467 }; |
| 7683 SubstringWrapper.prototype.printOn$1 = function($0) { | 7468 SubstringWrapper.prototype.printOn$1 = function($0) { |
| 7684 return this.printOn(($0 && $0.is$StringBuffer())); | 7469 return this.printOn($0); |
| 7685 }; | 7470 }; |
| 7686 SubstringWrapper.prototype.toString$0 = function() { | 7471 SubstringWrapper.prototype.toString$0 = function() { |
| 7687 return this.toString(); | 7472 return this.toString(); |
| 7688 }; | 7473 }; |
| 7689 // ********** Code for Token ************** | 7474 // ********** Code for Token ************** |
| 7690 function Token(kind, charOffset) { | 7475 function Token(kind, charOffset) { |
| 7691 this.kind = kind; | 7476 this.kind = kind; |
| 7692 this.charOffset = charOffset; | 7477 this.charOffset = charOffset; |
| 7693 // Initializers done | 7478 // Initializers done |
| 7694 } | 7479 } |
| 7695 Token.prototype.is$Token = function(){return this;}; | |
| 7696 Token.prototype.get$charOffset = function() { return this.charOffset; }; | 7480 Token.prototype.get$charOffset = function() { return this.charOffset; }; |
| 7697 Token.prototype.get$value = function() { | 7481 Token.prototype.get$value = function() { |
| 7698 return const$234/*const SourceString('EOF')*/; | 7482 return const$234/*const SourceString('EOF')*/; |
| 7699 } | 7483 } |
| 7700 Token.prototype.get$stringValue = function() { | 7484 Token.prototype.get$stringValue = function() { |
| 7701 return 'EOF'; | 7485 return 'EOF'; |
| 7702 } | 7486 } |
| 7703 Token.prototype.toString = function() { | 7487 Token.prototype.toString = function() { |
| 7704 return Strings.String$fromCharCodes$factory([this.kind]); | 7488 return Strings.String$fromCharCodes$factory([this.kind]); |
| 7705 } | 7489 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7766 StringWrapper.prototype.toString = function() { | 7550 StringWrapper.prototype.toString = function() { |
| 7767 return this.internalString; | 7551 return this.internalString; |
| 7768 } | 7552 } |
| 7769 StringWrapper.prototype.get$stringValue = function() { | 7553 StringWrapper.prototype.get$stringValue = function() { |
| 7770 return this.internalString; | 7554 return this.internalString; |
| 7771 } | 7555 } |
| 7772 StringWrapper.prototype.hashCode$0 = function() { | 7556 StringWrapper.prototype.hashCode$0 = function() { |
| 7773 return this.hashCode(); | 7557 return this.hashCode(); |
| 7774 }; | 7558 }; |
| 7775 StringWrapper.prototype.printOn$1 = function($0) { | 7559 StringWrapper.prototype.printOn$1 = function($0) { |
| 7776 return this.printOn(($0 && $0.is$StringBuffer())); | 7560 return this.printOn($0); |
| 7777 }; | 7561 }; |
| 7778 StringWrapper.prototype.toString$0 = function() { | 7562 StringWrapper.prototype.toString$0 = function() { |
| 7779 return this.toString(); | 7563 return this.toString(); |
| 7780 }; | 7564 }; |
| 7781 // ********** Code for BeginGroupToken ************** | 7565 // ********** Code for BeginGroupToken ************** |
| 7782 function BeginGroupToken(kind, value, charOffset) { | 7566 function BeginGroupToken(kind, value, charOffset) { |
| 7783 StringToken.call(this, kind, value, charOffset); | 7567 StringToken.call(this, kind, value, charOffset); |
| 7784 // Initializers done | 7568 // Initializers done |
| 7785 } | 7569 } |
| 7786 $inherits(BeginGroupToken, StringToken); | 7570 $inherits(BeginGroupToken, StringToken); |
| 7787 BeginGroupToken.prototype.is$BeginGroupToken = function(){return this;}; | |
| 7788 // ********** Code for Keyword ************** | 7571 // ********** Code for Keyword ************** |
| 7789 function Keyword(syntax, isPseudo) { | 7572 function Keyword(syntax, isPseudo) { |
| 7790 this.syntax = syntax; | 7573 this.syntax = syntax; |
| 7791 this.isPseudo = isPseudo; | 7574 this.isPseudo = isPseudo; |
| 7792 // Initializers done | 7575 // Initializers done |
| 7793 } | 7576 } |
| 7794 Keyword.prototype.is$SourceString = function(){return this;}; | 7577 Keyword.prototype.is$SourceString = function(){return this;}; |
| 7795 Keyword.get$keywords = function() { | 7578 Keyword.get$keywords = function() { |
| 7796 if (Keyword._keywords == null) { | 7579 if (Keyword._keywords == null) { |
| 7797 Keyword._keywords = Keyword.computeKeywordMap(); | 7580 Keyword._keywords = Keyword.computeKeywordMap(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 7818 Keyword.prototype.toString = function() { | 7601 Keyword.prototype.toString = function() { |
| 7819 return this.syntax; | 7602 return this.syntax; |
| 7820 } | 7603 } |
| 7821 Keyword.prototype.get$stringValue = function() { | 7604 Keyword.prototype.get$stringValue = function() { |
| 7822 return this.syntax; | 7605 return this.syntax; |
| 7823 } | 7606 } |
| 7824 Keyword.prototype.hashCode$0 = function() { | 7607 Keyword.prototype.hashCode$0 = function() { |
| 7825 return this.hashCode(); | 7608 return this.hashCode(); |
| 7826 }; | 7609 }; |
| 7827 Keyword.prototype.printOn$1 = function($0) { | 7610 Keyword.prototype.printOn$1 = function($0) { |
| 7828 return this.printOn(($0 && $0.is$StringBuffer())); | 7611 return this.printOn($0); |
| 7829 }; | 7612 }; |
| 7830 Keyword.prototype.toString$0 = function() { | 7613 Keyword.prototype.toString$0 = function() { |
| 7831 return this.toString(); | 7614 return this.toString(); |
| 7832 }; | 7615 }; |
| 7833 // ********** Code for KeywordState ************** | 7616 // ********** Code for KeywordState ************** |
| 7834 function KeywordState() {} | 7617 function KeywordState() {} |
| 7835 KeywordState.prototype.is$KeywordState = function(){return this;}; | |
| 7836 KeywordState.get$KEYWORD_STATE = function() { | 7618 KeywordState.get$KEYWORD_STATE = function() { |
| 7837 if (KeywordState._KEYWORD_STATE == null) { | 7619 if (KeywordState._KEYWORD_STATE == null) { |
| 7838 var strings = new ListFactory(const$232/*Keyword.values*/.get$length()); | 7620 var strings = new ListFactory(const$232/*Keyword.values*/.get$length()); |
| 7839 for (var i = 0; | 7621 for (var i = 0; |
| 7840 i < const$232/*Keyword.values*/.get$length(); i++) { | 7622 i < const$232/*Keyword.values*/.get$length(); i++) { |
| 7841 strings.$setindex(i, const$232/*Keyword.values*/[i].syntax); | 7623 strings.$setindex(i, const$232/*Keyword.values*/[i].syntax); |
| 7842 } | 7624 } |
| 7843 strings.sort((function (a, b) { | 7625 strings.sort((function (a, b) { |
| 7844 return a.compareTo$1(b); | 7626 return a.compareTo$1(b); |
| 7845 }) | 7627 }) |
| 7846 ); | 7628 ); |
| 7847 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin
gs, 0, strings.length); | 7629 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin
gs, 0, strings.length); |
| 7848 } | 7630 } |
| 7849 return KeywordState._KEYWORD_STATE; | 7631 return KeywordState._KEYWORD_STATE; |
| 7850 } | 7632 } |
| 7851 KeywordState.computeKeywordStateTable = function(start, strings, offset, length)
{ | 7633 KeywordState.computeKeywordStateTable = function(start, strings, offset, length)
{ |
| 7852 var result = new ListFactory(26); | 7634 var result = new ListFactory(26); |
| 7853 $assert(length != 0, "length != 0", "keyword.dart", 161, 12); | |
| 7854 var chunk = 0; | 7635 var chunk = 0; |
| 7855 var chunkStart = -1; | 7636 var chunkStart = -1; |
| 7856 for (var i = offset; | 7637 for (var i = offset; |
| 7857 i < offset + length; i++) { | 7638 i < offset + length; i++) { |
| 7858 if (strings.$index(i).length > start) { | 7639 if (strings.$index(i).length > start) { |
| 7859 var c = strings.$index(i).charCodeAt$1(start); | 7640 var c = strings.$index(i).charCodeAt$1(start); |
| 7860 if (chunk != c) { | 7641 if (chunk != c) { |
| 7861 if (chunkStart != -1) { | 7642 if (chunkStart != -1) { |
| 7862 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordSta
teTable(start + 1, strings, chunkStart, i - chunkStart)); | 7643 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordSta
teTable(start + 1, strings, chunkStart, i - chunkStart)); |
| 7863 } | 7644 } |
| 7864 chunkStart = i; | 7645 chunkStart = i; |
| 7865 chunk = c; | 7646 chunk = c; |
| 7866 } | 7647 } |
| 7867 } | 7648 } |
| 7868 } | 7649 } |
| 7869 if (chunkStart != -1) { | 7650 if (chunkStart != -1) { |
| 7870 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordStateTabl
e(start + 1, strings, chunkStart, offset + length - chunkStart)); | 7651 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordStateTabl
e(start + 1, strings, chunkStart, offset + length - chunkStart)); |
| 7871 } | 7652 } |
| 7872 else { | 7653 else { |
| 7873 $assert(length == 1, "length == 1", "keyword.dart", 183, 14); | 7654 return new LeafKeywordState(strings.$index(offset)); |
| 7874 return new LeafKeywordState($assert_String(strings.$index(offset))); | |
| 7875 } | 7655 } |
| 7876 return new ArrayKeywordState(result); | 7656 return new ArrayKeywordState(result); |
| 7877 } | 7657 } |
| 7878 // ********** Code for ArrayKeywordState ************** | 7658 // ********** Code for ArrayKeywordState ************** |
| 7879 function ArrayKeywordState(table) { | 7659 function ArrayKeywordState(table) { |
| 7880 this.table = table; | 7660 this.table = table; |
| 7881 // Initializers done | 7661 // Initializers done |
| 7882 } | 7662 } |
| 7883 $inherits(ArrayKeywordState, KeywordState); | 7663 $inherits(ArrayKeywordState, KeywordState); |
| 7884 ArrayKeywordState.prototype.isLeaf = function() { | 7664 ArrayKeywordState.prototype.isLeaf = function() { |
| 7885 return false; | 7665 return false; |
| 7886 } | 7666 } |
| 7887 ArrayKeywordState.prototype.next = function(c) { | 7667 ArrayKeywordState.prototype.next = function(c) { |
| 7888 var $0; | 7668 return this.table.$index(c - 97/*null.$a*/); |
| 7889 return (($0 = this.table.$index(c - 97/*null.$a*/)) && $0.is$KeywordState()); | |
| 7890 } | 7669 } |
| 7891 ArrayKeywordState.prototype.get$keyword = function() { | 7670 ArrayKeywordState.prototype.get$keyword = function() { |
| 7892 $throw("should not be called"); | 7671 $throw("should not be called"); |
| 7893 } | 7672 } |
| 7894 ArrayKeywordState.prototype.toString = function() { | 7673 ArrayKeywordState.prototype.toString = function() { |
| 7895 var sb = new StringBufferImpl(""); | 7674 var sb = new StringBufferImpl(""); |
| 7896 sb.add("["); | 7675 sb.add("["); |
| 7897 var foo = this.table; | 7676 var foo = this.table; |
| 7898 for (var i = 0; | 7677 for (var i = 0; |
| 7899 i < foo.length; i++) { | 7678 i < foo.length; i++) { |
| 7900 if ($notnull_bool($ne(foo.$index(i), null))) { | 7679 if ($ne(foo.$index(i), null)) { |
| 7901 sb.add(("" + (i + 97/*null.$a*/) + ": " + foo.$index(i) + "; ")); | 7680 sb.add(("" + (i + 97/*null.$a*/) + ": " + foo.$index(i) + "; ")); |
| 7902 } | 7681 } |
| 7903 } | 7682 } |
| 7904 sb.add("]"); | 7683 sb.add("]"); |
| 7905 return sb.toString(); | 7684 return sb.toString(); |
| 7906 } | 7685 } |
| 7907 ArrayKeywordState.prototype.toString$0 = function() { | 7686 ArrayKeywordState.prototype.toString$0 = function() { |
| 7908 return this.toString(); | 7687 return this.toString(); |
| 7909 }; | 7688 }; |
| 7910 // ********** Code for LeafKeywordState ************** | 7689 // ********** Code for LeafKeywordState ************** |
| (...skipping 20 matching lines...) Expand all Loading... |
| 7931 function parse(canceler, logger, doParse) { | 7710 function parse(canceler, logger, doParse) { |
| 7932 var listener = new NodeListener(canceler, logger); | 7711 var listener = new NodeListener(canceler, logger); |
| 7933 doParse(new Parser(listener)); | 7712 doParse(new Parser(listener)); |
| 7934 var node = listener.popNode(); | 7713 var node = listener.popNode(); |
| 7935 logger.log(("parsed: " + node + "")); | 7714 logger.log(("parsed: " + node + "")); |
| 7936 return node; | 7715 return node; |
| 7937 } | 7716 } |
| 7938 // ********** Library tree ************** | 7717 // ********** Library tree ************** |
| 7939 // ********** Code for Node ************** | 7718 // ********** Code for Node ************** |
| 7940 function Node() {} | 7719 function Node() {} |
| 7941 Node.prototype.is$Node = function(){return this;}; | |
| 7942 Node.prototype.hashCode = function() { | 7720 Node.prototype.hashCode = function() { |
| 7943 return this._hashCode; | 7721 return this._hashCode; |
| 7944 } | 7722 } |
| 7945 Node.prototype.toString = function() { | 7723 Node.prototype.toString = function() { |
| 7946 return this.unparse(); | 7724 return this.unparse(); |
| 7947 } | 7725 } |
| 7948 Node.prototype.getObjectDescription = function() { | 7726 Node.prototype.getObjectDescription = function() { |
| 7949 return Object.prototype.toString.call(this); | 7727 return Object.prototype.toString.call(this); |
| 7950 } | 7728 } |
| 7951 Node.prototype.unparse = function() { | 7729 Node.prototype.unparse = function() { |
| 7952 var unparser = new Unparser(false); | 7730 var unparser = new Unparser(false); |
| 7953 try { | 7731 try { |
| 7954 return unparser.unparse(this); | 7732 return unparser.unparse(this); |
| 7955 } catch (e) { | 7733 } catch (e) { |
| 7956 e = $toDartException(e); | 7734 e = $toDartException(e); |
| 7957 return ('<<unparse error: ' + this.getObjectDescription() + ': ' + unparser.
sb + '>>'); | 7735 return ('<<unparse error: ' + this.getObjectDescription() + ': ' + unparser.
sb + '>>'); |
| 7958 } | 7736 } |
| 7959 } | 7737 } |
| 7960 Node.prototype.accept$1 = function($0) { | 7738 Node.prototype.accept$1 = function($0) { |
| 7961 return this.accept(($0 && $0.is$Visitor())); | 7739 return this.accept($0); |
| 7962 }; | 7740 }; |
| 7963 Node.prototype.getBeginToken$0 = function() { | 7741 Node.prototype.getBeginToken$0 = function() { |
| 7964 return this.getBeginToken(); | 7742 return this.getBeginToken(); |
| 7965 }; | 7743 }; |
| 7966 Node.prototype.getEndToken$0 = function() { | 7744 Node.prototype.getEndToken$0 = function() { |
| 7967 return this.getEndToken(); | 7745 return this.getEndToken(); |
| 7968 }; | 7746 }; |
| 7969 Node.prototype.hashCode$0 = function() { | 7747 Node.prototype.hashCode$0 = function() { |
| 7970 return this.hashCode(); | 7748 return this.hashCode(); |
| 7971 }; | 7749 }; |
| 7972 Node.prototype.toString$0 = function() { | 7750 Node.prototype.toString$0 = function() { |
| 7973 return this.toString(); | 7751 return this.toString(); |
| 7974 }; | 7752 }; |
| 7975 // ********** Code for ClassNode ************** | 7753 // ********** Code for ClassNode ************** |
| 7976 function ClassNode(name, superclass, interfaces, beginToken, extendsKeyword, end
Token) { | 7754 function ClassNode(name, superclass, interfaces, beginToken, extendsKeyword, end
Token) { |
| 7977 this.name = name; | 7755 this.name = name; |
| 7978 this.superclass = superclass; | 7756 this.superclass = superclass; |
| 7979 this.interfaces = interfaces; | 7757 this.interfaces = interfaces; |
| 7980 this.beginToken = beginToken; | 7758 this.beginToken = beginToken; |
| 7981 this.extendsKeyword = extendsKeyword; | 7759 this.extendsKeyword = extendsKeyword; |
| 7982 this.endToken = endToken; | 7760 this.endToken = endToken; |
| 7983 // Initializers done | 7761 // Initializers done |
| 7984 } | 7762 } |
| 7985 $inherits(ClassNode, Node); | 7763 $inherits(ClassNode, Node); |
| 7986 ClassNode.prototype.is$ClassNode = function(){return this;}; | |
| 7987 ClassNode.prototype.get$name = function() { return this.name; }; | 7764 ClassNode.prototype.get$name = function() { return this.name; }; |
| 7988 ClassNode.prototype.get$interfaces = function() { return this.interfaces; }; | 7765 ClassNode.prototype.get$interfaces = function() { return this.interfaces; }; |
| 7989 ClassNode.prototype.accept = function(visitor) { | 7766 ClassNode.prototype.accept = function(visitor) { |
| 7990 return visitor.visitClassNode(this); | 7767 return visitor.visitClassNode(this); |
| 7991 } | 7768 } |
| 7992 ClassNode.prototype.get$isInterface = function() { | 7769 ClassNode.prototype.get$isInterface = function() { |
| 7993 return this.beginToken.get$stringValue() === 'interface'; | 7770 return this.beginToken.get$stringValue() === 'interface'; |
| 7994 } | 7771 } |
| 7995 ClassNode.prototype.get$isClass = function() { | 7772 ClassNode.prototype.get$isClass = function() { |
| 7996 return !$notnull_bool(this.get$isInterface()); | 7773 return !this.get$isInterface(); |
| 7997 } | 7774 } |
| 7998 ClassNode.prototype.getBeginToken = function() { | 7775 ClassNode.prototype.getBeginToken = function() { |
| 7999 return this.beginToken; | 7776 return this.beginToken; |
| 8000 } | 7777 } |
| 8001 ClassNode.prototype.getEndToken = function() { | 7778 ClassNode.prototype.getEndToken = function() { |
| 8002 return this.endToken; | 7779 return this.endToken; |
| 8003 } | 7780 } |
| 8004 ClassNode.prototype.accept$1 = function($0) { | 7781 ClassNode.prototype.accept$1 = function($0) { |
| 8005 return this.accept(($0 && $0.is$Visitor())); | 7782 return this.accept($0); |
| 8006 }; | 7783 }; |
| 8007 ClassNode.prototype.getBeginToken$0 = function() { | 7784 ClassNode.prototype.getBeginToken$0 = function() { |
| 8008 return this.getBeginToken(); | 7785 return this.getBeginToken(); |
| 8009 }; | 7786 }; |
| 8010 ClassNode.prototype.getEndToken$0 = function() { | 7787 ClassNode.prototype.getEndToken$0 = function() { |
| 8011 return this.getEndToken(); | 7788 return this.getEndToken(); |
| 8012 }; | 7789 }; |
| 8013 // ********** Code for Expression ************** | 7790 // ********** Code for Expression ************** |
| 8014 function Expression() {} | 7791 function Expression() {} |
| 8015 $inherits(Expression, Node); | 7792 $inherits(Expression, Node); |
| 8016 Expression.prototype.is$Expression = function(){return this;}; | |
| 8017 // ********** Code for Statement ************** | 7793 // ********** Code for Statement ************** |
| 8018 function Statement() {} | 7794 function Statement() {} |
| 8019 $inherits(Statement, Node); | 7795 $inherits(Statement, Node); |
| 8020 Statement.prototype.is$Statement = function(){return this;}; | |
| 8021 // ********** Code for Send ************** | 7796 // ********** Code for Send ************** |
| 8022 function Send(receiver, selector, argumentsNode) { | 7797 function Send(receiver, selector, argumentsNode) { |
| 8023 this.receiver = receiver; | 7798 this.receiver = receiver; |
| 8024 this.selector = selector; | 7799 this.selector = selector; |
| 8025 this.argumentsNode = argumentsNode; | 7800 this.argumentsNode = argumentsNode; |
| 8026 // Initializers done | 7801 // Initializers done |
| 8027 } | 7802 } |
| 8028 $inherits(Send, Expression); | 7803 $inherits(Send, Expression); |
| 8029 Send.prototype.is$Send = function(){return this;}; | |
| 8030 Send.prototype.get$arguments = function() { | 7804 Send.prototype.get$arguments = function() { |
| 8031 return this.argumentsNode.nodes; | 7805 return this.argumentsNode.nodes; |
| 8032 } | 7806 } |
| 8033 Send.prototype.accept = function(visitor) { | 7807 Send.prototype.accept = function(visitor) { |
| 8034 return visitor.visitSend(this); | 7808 return visitor.visitSend(this); |
| 8035 } | 7809 } |
| 8036 Send.prototype.get$isOperator = function() { | 7810 Send.prototype.get$isOperator = function() { |
| 8037 return (this.selector instanceof Operator); | 7811 return (this.selector instanceof Operator); |
| 8038 } | 7812 } |
| 8039 Send.prototype.get$isPropertyAccess = function() { | 7813 Send.prototype.get$isPropertyAccess = function() { |
| 8040 return this.argumentsNode == null; | 7814 return this.argumentsNode == null; |
| 8041 } | 7815 } |
| 8042 Send.prototype.get$isFunctionObjectInvocation = function() { | 7816 Send.prototype.get$isFunctionObjectInvocation = function() { |
| 8043 return this.selector == null; | 7817 return this.selector == null; |
| 8044 } | 7818 } |
| 8045 Send.prototype.getBeginToken = function() { | 7819 Send.prototype.getBeginToken = function() { |
| 8046 return firstBeginToken(this.receiver, this.selector); | 7820 return firstBeginToken(this.receiver, this.selector); |
| 8047 } | 7821 } |
| 8048 Send.prototype.getEndToken = function() { | 7822 Send.prototype.getEndToken = function() { |
| 8049 var $0; | |
| 8050 var token; | 7823 var token; |
| 8051 if (this.argumentsNode != null) token = this.argumentsNode.getEndToken(); | 7824 if (this.argumentsNode != null) token = this.argumentsNode.getEndToken(); |
| 8052 if (token != null) return token; | 7825 if (token != null) return token; |
| 8053 if (this.selector != null) { | 7826 if (this.selector != null) { |
| 8054 return (($0 = this.selector.getEndToken()) && $0.is$Token()); | 7827 return this.selector.getEndToken(); |
| 8055 } | 7828 } |
| 8056 return (($0 = this.receiver.getBeginToken()) && $0.is$Token()); | 7829 return this.receiver.getBeginToken(); |
| 8057 } | 7830 } |
| 8058 Send.prototype.accept$1 = function($0) { | 7831 Send.prototype.accept$1 = function($0) { |
| 8059 return this.accept(($0 && $0.is$Visitor())); | 7832 return this.accept($0); |
| 8060 }; | 7833 }; |
| 8061 Send.prototype.getBeginToken$0 = function() { | 7834 Send.prototype.getBeginToken$0 = function() { |
| 8062 return this.getBeginToken(); | 7835 return this.getBeginToken(); |
| 8063 }; | 7836 }; |
| 8064 Send.prototype.getEndToken$0 = function() { | 7837 Send.prototype.getEndToken$0 = function() { |
| 8065 return this.getEndToken(); | 7838 return this.getEndToken(); |
| 8066 }; | 7839 }; |
| 8067 // ********** Code for SendSet ************** | 7840 // ********** Code for SendSet ************** |
| 8068 function SendSet(receiver, selector, assignmentOperator, argumentsNode) { | 7841 function SendSet(receiver, selector, assignmentOperator, argumentsNode) { |
| 8069 this.assignmentOperator = assignmentOperator; | 7842 this.assignmentOperator = assignmentOperator; |
| 8070 Send.call(this, receiver, selector, argumentsNode); | 7843 Send.call(this, receiver, selector, argumentsNode); |
| 8071 // Initializers done | 7844 // Initializers done |
| 8072 } | 7845 } |
| 8073 $inherits(SendSet, Send); | 7846 $inherits(SendSet, Send); |
| 8074 SendSet.prototype.is$SendSet = function(){return this;}; | |
| 8075 SendSet.prototype.accept = function(visitor) { | 7847 SendSet.prototype.accept = function(visitor) { |
| 8076 return visitor.visitSendSet(this); | 7848 return visitor.visitSendSet(this); |
| 8077 } | 7849 } |
| 8078 SendSet.prototype.accept$1 = function($0) { | 7850 SendSet.prototype.accept$1 = function($0) { |
| 8079 return this.accept(($0 && $0.is$Visitor())); | 7851 return this.accept($0); |
| 8080 }; | 7852 }; |
| 8081 // ********** Code for NodeList ************** | 7853 // ********** Code for NodeList ************** |
| 8082 function NodeList(beginToken, nodes, endToken, delimiter) { | 7854 function NodeList(beginToken, nodes, endToken, delimiter) { |
| 8083 this.beginToken = beginToken; | 7855 this.beginToken = beginToken; |
| 8084 this.nodes = nodes; | 7856 this.nodes = nodes; |
| 8085 this.endToken = endToken; | 7857 this.endToken = endToken; |
| 8086 this.delimiter = delimiter; | 7858 this.delimiter = delimiter; |
| 8087 // Initializers done | 7859 // Initializers done |
| 8088 } | 7860 } |
| 8089 NodeList.singleton$ctor = function(node) { | 7861 NodeList.singleton$ctor = function(node) { |
| 8090 NodeList.call(this, null, LinkFactory.Link$factory(node)); | 7862 NodeList.call(this, null, LinkFactory.Link$factory(node)); |
| 8091 // Initializers done | 7863 // Initializers done |
| 8092 } | 7864 } |
| 8093 NodeList.singleton$ctor.prototype = NodeList.prototype; | 7865 NodeList.singleton$ctor.prototype = NodeList.prototype; |
| 8094 $inherits(NodeList, Node); | 7866 $inherits(NodeList, Node); |
| 8095 NodeList.prototype.is$NodeList = function(){return this;}; | |
| 8096 NodeList.prototype.accept = function(visitor) { | 7867 NodeList.prototype.accept = function(visitor) { |
| 8097 return visitor.visitNodeList(this); | 7868 return visitor.visitNodeList(this); |
| 8098 } | 7869 } |
| 8099 NodeList.prototype.getBeginToken = function() { | 7870 NodeList.prototype.getBeginToken = function() { |
| 8100 var $0; | |
| 8101 if (this.beginToken != null) return this.beginToken; | 7871 if (this.beginToken != null) return this.beginToken; |
| 8102 if (this.nodes != null) { | 7872 if (this.nodes != null) { |
| 8103 for (var link = this.nodes; | 7873 for (var link = this.nodes; |
| 8104 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Lin
k$Node())) { | 7874 !link.isEmpty(); link = link.get$tail()) { |
| 8105 if (link.get$head().getBeginToken$0() != null) { | 7875 if (link.get$head().getBeginToken$0() != null) { |
| 8106 return (($0 = link.get$head().getBeginToken$0()) && $0.is$Token()); | 7876 return link.get$head().getBeginToken$0(); |
| 8107 } | 7877 } |
| 8108 if (link.get$head().getEndToken$0() != null) { | 7878 if (link.get$head().getEndToken$0() != null) { |
| 8109 return (($0 = link.get$head().getEndToken$0()) && $0.is$Token()); | 7879 return link.get$head().getEndToken$0(); |
| 8110 } | 7880 } |
| 8111 } | 7881 } |
| 8112 } | 7882 } |
| 8113 return this.endToken; | 7883 return this.endToken; |
| 8114 } | 7884 } |
| 8115 NodeList.prototype.getEndToken = function() { | 7885 NodeList.prototype.getEndToken = function() { |
| 8116 var $0; | |
| 8117 if (this.endToken != null) return this.endToken; | 7886 if (this.endToken != null) return this.endToken; |
| 8118 if (this.nodes != null) { | 7887 if (this.nodes != null) { |
| 8119 var link = this.nodes; | 7888 var link = this.nodes; |
| 8120 while (!$notnull_bool(link.get$tail().isEmpty$0())) link = (($0 = link.get$t
ail()) && $0.is$Link$Node()); | 7889 while (!link.get$tail().isEmpty$0()) link = link.get$tail(); |
| 8121 if (link.get$head().getEndToken$0() != null) return (($0 = link.get$head().g
etEndToken$0()) && $0.is$Token()); | 7890 if (link.get$head().getEndToken$0() != null) return link.get$head().getEndTo
ken$0(); |
| 8122 if (link.get$head().getBeginToken$0() != null) return (($0 = link.get$head()
.getBeginToken$0()) && $0.is$Token()); | 7891 if (link.get$head().getBeginToken$0() != null) return link.get$head().getBeg
inToken$0(); |
| 8123 } | 7892 } |
| 8124 return this.beginToken; | 7893 return this.beginToken; |
| 8125 } | 7894 } |
| 8126 NodeList.prototype.accept$1 = function($0) { | 7895 NodeList.prototype.accept$1 = function($0) { |
| 8127 return this.accept(($0 && $0.is$Visitor())); | 7896 return this.accept($0); |
| 8128 }; | 7897 }; |
| 8129 NodeList.prototype.getBeginToken$0 = function() { | 7898 NodeList.prototype.getBeginToken$0 = function() { |
| 8130 return this.getBeginToken(); | 7899 return this.getBeginToken(); |
| 8131 }; | 7900 }; |
| 8132 NodeList.prototype.getEndToken$0 = function() { | 7901 NodeList.prototype.getEndToken$0 = function() { |
| 8133 return this.getEndToken(); | 7902 return this.getEndToken(); |
| 8134 }; | 7903 }; |
| 8135 // ********** Code for Block ************** | 7904 // ********** Code for Block ************** |
| 8136 function Block(statements) { | 7905 function Block(statements) { |
| 8137 this.statements = statements; | 7906 this.statements = statements; |
| 8138 // Initializers done | 7907 // Initializers done |
| 8139 } | 7908 } |
| 8140 $inherits(Block, Statement); | 7909 $inherits(Block, Statement); |
| 8141 Block.prototype.accept = function(visitor) { | 7910 Block.prototype.accept = function(visitor) { |
| 8142 return visitor.visitBlock(this); | 7911 return visitor.visitBlock(this); |
| 8143 } | 7912 } |
| 8144 Block.prototype.getBeginToken = function() { | 7913 Block.prototype.getBeginToken = function() { |
| 8145 return this.statements.getBeginToken(); | 7914 return this.statements.getBeginToken(); |
| 8146 } | 7915 } |
| 8147 Block.prototype.getEndToken = function() { | 7916 Block.prototype.getEndToken = function() { |
| 8148 return this.statements.getEndToken(); | 7917 return this.statements.getEndToken(); |
| 8149 } | 7918 } |
| 8150 Block.prototype.accept$1 = function($0) { | 7919 Block.prototype.accept$1 = function($0) { |
| 8151 return this.accept(($0 && $0.is$Visitor())); | 7920 return this.accept($0); |
| 8152 }; | 7921 }; |
| 8153 Block.prototype.getBeginToken$0 = function() { | 7922 Block.prototype.getBeginToken$0 = function() { |
| 8154 return this.getBeginToken(); | 7923 return this.getBeginToken(); |
| 8155 }; | 7924 }; |
| 8156 Block.prototype.getEndToken$0 = function() { | 7925 Block.prototype.getEndToken$0 = function() { |
| 8157 return this.getEndToken(); | 7926 return this.getEndToken(); |
| 8158 }; | 7927 }; |
| 8159 // ********** Code for If ************** | 7928 // ********** Code for If ************** |
| 8160 function If(condition, thenPart, elsePart, ifToken, elseToken) { | 7929 function If(condition, thenPart, elsePart, ifToken, elseToken) { |
| 8161 this.condition = condition; | 7930 this.condition = condition; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 8173 return visitor.visitIf(this); | 7942 return visitor.visitIf(this); |
| 8174 } | 7943 } |
| 8175 If.prototype.getBeginToken = function() { | 7944 If.prototype.getBeginToken = function() { |
| 8176 return this.ifToken; | 7945 return this.ifToken; |
| 8177 } | 7946 } |
| 8178 If.prototype.getEndToken = function() { | 7947 If.prototype.getEndToken = function() { |
| 8179 if (this.elsePart == null) return this.thenPart.getEndToken(); | 7948 if (this.elsePart == null) return this.thenPart.getEndToken(); |
| 8180 return this.elsePart.getEndToken(); | 7949 return this.elsePart.getEndToken(); |
| 8181 } | 7950 } |
| 8182 If.prototype.accept$1 = function($0) { | 7951 If.prototype.accept$1 = function($0) { |
| 8183 return this.accept(($0 && $0.is$Visitor())); | 7952 return this.accept($0); |
| 8184 }; | 7953 }; |
| 8185 If.prototype.getBeginToken$0 = function() { | 7954 If.prototype.getBeginToken$0 = function() { |
| 8186 return this.getBeginToken(); | 7955 return this.getBeginToken(); |
| 8187 }; | 7956 }; |
| 8188 If.prototype.getEndToken$0 = function() { | 7957 If.prototype.getEndToken$0 = function() { |
| 8189 return this.getEndToken(); | 7958 return this.getEndToken(); |
| 8190 }; | 7959 }; |
| 8191 // ********** Code for For ************** | 7960 // ********** Code for For ************** |
| 8192 function For(initializer, condition, update, body, forToken) { | 7961 function For(initializer, condition, update, body, forToken) { |
| 8193 this.initializer = initializer; | 7962 this.initializer = initializer; |
| 8194 this.condition = condition; | 7963 this.condition = condition; |
| 8195 this.update = update; | 7964 this.update = update; |
| 8196 this.body = body; | 7965 this.body = body; |
| 8197 this.forToken = forToken; | 7966 this.forToken = forToken; |
| 8198 // Initializers done | 7967 // Initializers done |
| 8199 } | 7968 } |
| 8200 $inherits(For, Statement); | 7969 $inherits(For, Statement); |
| 8201 For.prototype.accept = function(visitor) { | 7970 For.prototype.accept = function(visitor) { |
| 8202 return visitor.visitFor(this); | 7971 return visitor.visitFor(this); |
| 8203 } | 7972 } |
| 8204 For.prototype.getBeginToken = function() { | 7973 For.prototype.getBeginToken = function() { |
| 8205 return this.forToken; | 7974 return this.forToken; |
| 8206 } | 7975 } |
| 8207 For.prototype.getEndToken = function() { | 7976 For.prototype.getEndToken = function() { |
| 8208 return this.body.getEndToken(); | 7977 return this.body.getEndToken(); |
| 8209 } | 7978 } |
| 8210 For.prototype.accept$1 = function($0) { | 7979 For.prototype.accept$1 = function($0) { |
| 8211 return this.accept(($0 && $0.is$Visitor())); | 7980 return this.accept($0); |
| 8212 }; | 7981 }; |
| 8213 For.prototype.getBeginToken$0 = function() { | 7982 For.prototype.getBeginToken$0 = function() { |
| 8214 return this.getBeginToken(); | 7983 return this.getBeginToken(); |
| 8215 }; | 7984 }; |
| 8216 For.prototype.getEndToken$0 = function() { | 7985 For.prototype.getEndToken$0 = function() { |
| 8217 return this.getEndToken(); | 7986 return this.getEndToken(); |
| 8218 }; | 7987 }; |
| 8219 // ********** Code for FunctionExpression ************** | 7988 // ********** Code for FunctionExpression ************** |
| 8220 function FunctionExpression(name, parameters, body, returnType) { | 7989 function FunctionExpression(name, parameters, body, returnType) { |
| 8221 this.name = name; | 7990 this.name = name; |
| 8222 this.parameters = parameters; | 7991 this.parameters = parameters; |
| 8223 this.body = body; | 7992 this.body = body; |
| 8224 this.returnType = returnType; | 7993 this.returnType = returnType; |
| 8225 // Initializers done | 7994 // Initializers done |
| 8226 } | 7995 } |
| 8227 $inherits(FunctionExpression, Expression); | 7996 $inherits(FunctionExpression, Expression); |
| 8228 FunctionExpression.prototype.is$FunctionExpression = function(){return this;}; | |
| 8229 FunctionExpression.prototype.get$name = function() { return this.name; }; | 7997 FunctionExpression.prototype.get$name = function() { return this.name; }; |
| 8230 FunctionExpression.prototype.get$parameters = function() { return this.parameter
s; }; | 7998 FunctionExpression.prototype.get$parameters = function() { return this.parameter
s; }; |
| 8231 FunctionExpression.prototype.get$returnType = function() { return this.returnTyp
e; }; | 7999 FunctionExpression.prototype.get$returnType = function() { return this.returnTyp
e; }; |
| 8232 FunctionExpression.prototype.accept = function(visitor) { | 8000 FunctionExpression.prototype.accept = function(visitor) { |
| 8233 return visitor.visitFunctionExpression(this); | 8001 return visitor.visitFunctionExpression(this); |
| 8234 } | 8002 } |
| 8235 FunctionExpression.prototype.getBeginToken = function() { | 8003 FunctionExpression.prototype.getBeginToken = function() { |
| 8236 return firstBeginToken(this.returnType, this.name); | 8004 return firstBeginToken(this.returnType, this.name); |
| 8237 } | 8005 } |
| 8238 FunctionExpression.prototype.getEndToken = function() { | 8006 FunctionExpression.prototype.getEndToken = function() { |
| 8239 return this.body.getEndToken(); | 8007 return this.body.getEndToken(); |
| 8240 } | 8008 } |
| 8241 FunctionExpression.prototype.accept$1 = function($0) { | 8009 FunctionExpression.prototype.accept$1 = function($0) { |
| 8242 return this.accept(($0 && $0.is$Visitor())); | 8010 return this.accept($0); |
| 8243 }; | 8011 }; |
| 8244 FunctionExpression.prototype.getBeginToken$0 = function() { | 8012 FunctionExpression.prototype.getBeginToken$0 = function() { |
| 8245 return this.getBeginToken(); | 8013 return this.getBeginToken(); |
| 8246 }; | 8014 }; |
| 8247 FunctionExpression.prototype.getEndToken$0 = function() { | 8015 FunctionExpression.prototype.getEndToken$0 = function() { |
| 8248 return this.getEndToken(); | 8016 return this.getEndToken(); |
| 8249 }; | 8017 }; |
| 8250 // ********** Code for Literal ************** | 8018 // ********** Code for Literal ************** |
| 8251 function Literal(token, handler) { | 8019 function Literal(token, handler) { |
| 8252 this.token = token; | 8020 this.token = token; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8306 } catch (ex) { | 8074 } catch (ex) { |
| 8307 ex = $toDartException(ex); | 8075 ex = $toDartException(ex); |
| 8308 if (!(ex instanceof BadNumberFormatException)) throw ex; | 8076 if (!(ex instanceof BadNumberFormatException)) throw ex; |
| 8309 (this.handler)(this.token, ex); | 8077 (this.handler)(this.token, ex); |
| 8310 } | 8078 } |
| 8311 } | 8079 } |
| 8312 LiteralInt.prototype.accept = function(visitor) { | 8080 LiteralInt.prototype.accept = function(visitor) { |
| 8313 return visitor.visitLiteralInt(this); | 8081 return visitor.visitLiteralInt(this); |
| 8314 } | 8082 } |
| 8315 LiteralInt.prototype.accept$1 = function($0) { | 8083 LiteralInt.prototype.accept$1 = function($0) { |
| 8316 return this.accept(($0 && $0.is$Visitor())); | 8084 return this.accept($0); |
| 8317 }; | 8085 }; |
| 8318 // ********** Code for LiteralDouble ************** | 8086 // ********** Code for LiteralDouble ************** |
| 8319 function LiteralDouble(token, handler) { | 8087 function LiteralDouble(token, handler) { |
| 8320 Literal$double.call(this, token, handler); | 8088 Literal$double.call(this, token, handler); |
| 8321 // Initializers done | 8089 // Initializers done |
| 8322 } | 8090 } |
| 8323 $inherits(LiteralDouble, Literal$double); | 8091 $inherits(LiteralDouble, Literal$double); |
| 8324 LiteralDouble.prototype.get$value = function() { | 8092 LiteralDouble.prototype.get$value = function() { |
| 8325 try { | 8093 try { |
| 8326 return Math.parseDouble(this.token.get$value().toString$0()); | 8094 return Math.parseDouble(this.token.get$value().toString$0()); |
| 8327 } catch (ex) { | 8095 } catch (ex) { |
| 8328 ex = $toDartException(ex); | 8096 ex = $toDartException(ex); |
| 8329 if (!(ex instanceof BadNumberFormatException)) throw ex; | 8097 if (!(ex instanceof BadNumberFormatException)) throw ex; |
| 8330 (this.handler)(this.token, ex); | 8098 (this.handler)(this.token, ex); |
| 8331 } | 8099 } |
| 8332 } | 8100 } |
| 8333 LiteralDouble.prototype.accept = function(visitor) { | 8101 LiteralDouble.prototype.accept = function(visitor) { |
| 8334 return visitor.visitLiteralDouble(this); | 8102 return visitor.visitLiteralDouble(this); |
| 8335 } | 8103 } |
| 8336 LiteralDouble.prototype.accept$1 = function($0) { | 8104 LiteralDouble.prototype.accept$1 = function($0) { |
| 8337 return this.accept(($0 && $0.is$Visitor())); | 8105 return this.accept($0); |
| 8338 }; | 8106 }; |
| 8339 // ********** Code for LiteralBool ************** | 8107 // ********** Code for LiteralBool ************** |
| 8340 function LiteralBool(token, handler) { | 8108 function LiteralBool(token, handler) { |
| 8341 Literal$bool.call(this, token, handler); | 8109 Literal$bool.call(this, token, handler); |
| 8342 // Initializers done | 8110 // Initializers done |
| 8343 } | 8111 } |
| 8344 $inherits(LiteralBool, Literal$bool); | 8112 $inherits(LiteralBool, Literal$bool); |
| 8345 LiteralBool.prototype.get$value = function() { | 8113 LiteralBool.prototype.get$value = function() { |
| 8346 switch (this.token.get$value()) { | 8114 switch (this.token.get$value()) { |
| 8347 case const$188/*Keyword.TRUE*/: | 8115 case const$188/*Keyword.TRUE*/: |
| 8348 | 8116 |
| 8349 return true; | 8117 return true; |
| 8350 | 8118 |
| 8351 case const$160/*Keyword.FALSE*/: | 8119 case const$160/*Keyword.FALSE*/: |
| 8352 | 8120 |
| 8353 return false; | 8121 return false; |
| 8354 | 8122 |
| 8355 default: | 8123 default: |
| 8356 | 8124 |
| 8357 (this.handler)(this.token, ("not a bool " + this.token.get$value() + "")); | 8125 (this.handler)(this.token, ("not a bool " + this.token.get$value() + "")); |
| 8358 | 8126 |
| 8359 } | 8127 } |
| 8360 } | 8128 } |
| 8361 LiteralBool.prototype.accept = function(visitor) { | 8129 LiteralBool.prototype.accept = function(visitor) { |
| 8362 return visitor.visitLiteralBool(this); | 8130 return visitor.visitLiteralBool(this); |
| 8363 } | 8131 } |
| 8364 LiteralBool.prototype.accept$1 = function($0) { | 8132 LiteralBool.prototype.accept$1 = function($0) { |
| 8365 return this.accept(($0 && $0.is$Visitor())); | 8133 return this.accept($0); |
| 8366 }; | 8134 }; |
| 8367 // ********** Code for LiteralString ************** | 8135 // ********** Code for LiteralString ************** |
| 8368 function LiteralString(token) { | 8136 function LiteralString(token) { |
| 8369 Literal$SourceString.call(this, token, to$call$2(null)); | 8137 Literal$SourceString.call(this, token, to$call$2(null)); |
| 8370 // Initializers done | 8138 // Initializers done |
| 8371 } | 8139 } |
| 8372 $inherits(LiteralString, Literal$SourceString); | 8140 $inherits(LiteralString, Literal$SourceString); |
| 8373 LiteralString.prototype.is$LiteralString = function(){return this;}; | |
| 8374 LiteralString.prototype.get$value = function() { | 8141 LiteralString.prototype.get$value = function() { |
| 8375 var $0; | 8142 return this.token.get$value(); |
| 8376 return (($0 = this.token.get$value()) && $0.is$SourceString()); | |
| 8377 } | 8143 } |
| 8378 LiteralString.prototype.accept = function(visitor) { | 8144 LiteralString.prototype.accept = function(visitor) { |
| 8379 return visitor.visitLiteralString(this); | 8145 return visitor.visitLiteralString(this); |
| 8380 } | 8146 } |
| 8381 LiteralString.prototype.accept$1 = function($0) { | 8147 LiteralString.prototype.accept$1 = function($0) { |
| 8382 return this.accept(($0 && $0.is$Visitor())); | 8148 return this.accept($0); |
| 8383 }; | 8149 }; |
| 8384 // ********** Code for Identifier ************** | 8150 // ********** Code for Identifier ************** |
| 8385 function Identifier(token) { | 8151 function Identifier(token) { |
| 8386 this.token = token; | 8152 this.token = token; |
| 8387 // Initializers done | 8153 // Initializers done |
| 8388 } | 8154 } |
| 8389 $inherits(Identifier, Expression); | 8155 $inherits(Identifier, Expression); |
| 8390 Identifier.prototype.is$Identifier = function(){return this;}; | |
| 8391 Identifier.prototype.get$source = function() { | 8156 Identifier.prototype.get$source = function() { |
| 8392 var $0; | 8157 return this.token.get$value(); |
| 8393 return (($0 = this.token.get$value()) && $0.is$SourceString()); | |
| 8394 } | 8158 } |
| 8395 Identifier.prototype.accept = function(visitor) { | 8159 Identifier.prototype.accept = function(visitor) { |
| 8396 return visitor.visitIdentifier(this); | 8160 return visitor.visitIdentifier(this); |
| 8397 } | 8161 } |
| 8398 Identifier.prototype.getBeginToken = function() { | 8162 Identifier.prototype.getBeginToken = function() { |
| 8399 return this.token; | 8163 return this.token; |
| 8400 } | 8164 } |
| 8401 Identifier.prototype.getEndToken = function() { | 8165 Identifier.prototype.getEndToken = function() { |
| 8402 return this.token; | 8166 return this.token; |
| 8403 } | 8167 } |
| 8404 Identifier.prototype.accept$1 = function($0) { | 8168 Identifier.prototype.accept$1 = function($0) { |
| 8405 return this.accept(($0 && $0.is$Visitor())); | 8169 return this.accept($0); |
| 8406 }; | 8170 }; |
| 8407 Identifier.prototype.getBeginToken$0 = function() { | 8171 Identifier.prototype.getBeginToken$0 = function() { |
| 8408 return this.getBeginToken(); | 8172 return this.getBeginToken(); |
| 8409 }; | 8173 }; |
| 8410 Identifier.prototype.getEndToken$0 = function() { | 8174 Identifier.prototype.getEndToken$0 = function() { |
| 8411 return this.getEndToken(); | 8175 return this.getEndToken(); |
| 8412 }; | 8176 }; |
| 8413 // ********** Code for Operator ************** | 8177 // ********** Code for Operator ************** |
| 8414 function Operator(token) { | 8178 function Operator(token) { |
| 8415 Identifier.call(this, token); | 8179 Identifier.call(this, token); |
| 8416 // Initializers done | 8180 // Initializers done |
| 8417 } | 8181 } |
| 8418 $inherits(Operator, Identifier); | 8182 $inherits(Operator, Identifier); |
| 8419 Operator.prototype.is$Operator = function(){return this;}; | |
| 8420 Operator.prototype.accept = function(visitor) { | 8183 Operator.prototype.accept = function(visitor) { |
| 8421 return visitor.visitOperator(this); | 8184 return visitor.visitOperator(this); |
| 8422 } | 8185 } |
| 8423 Operator.prototype.accept$1 = function($0) { | 8186 Operator.prototype.accept$1 = function($0) { |
| 8424 return this.accept(($0 && $0.is$Visitor())); | 8187 return this.accept($0); |
| 8425 }; | 8188 }; |
| 8426 // ********** Code for Return ************** | 8189 // ********** Code for Return ************** |
| 8427 function Return(beginToken, endToken, expression) { | 8190 function Return(beginToken, endToken, expression) { |
| 8428 this.beginToken = beginToken; | 8191 this.beginToken = beginToken; |
| 8429 this.endToken = endToken; | 8192 this.endToken = endToken; |
| 8430 this.expression = expression; | 8193 this.expression = expression; |
| 8431 // Initializers done | 8194 // Initializers done |
| 8432 } | 8195 } |
| 8433 $inherits(Return, Statement); | 8196 $inherits(Return, Statement); |
| 8434 Return.prototype.get$hasExpression = function() { | 8197 Return.prototype.get$hasExpression = function() { |
| 8435 return this.expression != null; | 8198 return this.expression != null; |
| 8436 } | 8199 } |
| 8437 Return.prototype.accept = function(visitor) { | 8200 Return.prototype.accept = function(visitor) { |
| 8438 return visitor.visitReturn(this); | 8201 return visitor.visitReturn(this); |
| 8439 } | 8202 } |
| 8440 Return.prototype.getBeginToken = function() { | 8203 Return.prototype.getBeginToken = function() { |
| 8441 return this.beginToken; | 8204 return this.beginToken; |
| 8442 } | 8205 } |
| 8443 Return.prototype.getEndToken = function() { | 8206 Return.prototype.getEndToken = function() { |
| 8444 return this.endToken; | 8207 return this.endToken; |
| 8445 } | 8208 } |
| 8446 Return.prototype.accept$1 = function($0) { | 8209 Return.prototype.accept$1 = function($0) { |
| 8447 return this.accept(($0 && $0.is$Visitor())); | 8210 return this.accept($0); |
| 8448 }; | 8211 }; |
| 8449 Return.prototype.getBeginToken$0 = function() { | 8212 Return.prototype.getBeginToken$0 = function() { |
| 8450 return this.getBeginToken(); | 8213 return this.getBeginToken(); |
| 8451 }; | 8214 }; |
| 8452 Return.prototype.getEndToken$0 = function() { | 8215 Return.prototype.getEndToken$0 = function() { |
| 8453 return this.getEndToken(); | 8216 return this.getEndToken(); |
| 8454 }; | 8217 }; |
| 8455 // ********** Code for ExpressionStatement ************** | 8218 // ********** Code for ExpressionStatement ************** |
| 8456 function ExpressionStatement(expression, endToken) { | 8219 function ExpressionStatement(expression, endToken) { |
| 8457 this.expression = expression; | 8220 this.expression = expression; |
| 8458 this.endToken = endToken; | 8221 this.endToken = endToken; |
| 8459 // Initializers done | 8222 // Initializers done |
| 8460 } | 8223 } |
| 8461 $inherits(ExpressionStatement, Statement); | 8224 $inherits(ExpressionStatement, Statement); |
| 8462 ExpressionStatement.prototype.is$ExpressionStatement = function(){return this;}; | |
| 8463 ExpressionStatement.prototype.accept = function(visitor) { | 8225 ExpressionStatement.prototype.accept = function(visitor) { |
| 8464 return visitor.visitExpressionStatement(this); | 8226 return visitor.visitExpressionStatement(this); |
| 8465 } | 8227 } |
| 8466 ExpressionStatement.prototype.getBeginToken = function() { | 8228 ExpressionStatement.prototype.getBeginToken = function() { |
| 8467 var $0; | 8229 return this.expression.getBeginToken(); |
| 8468 return (($0 = this.expression.getBeginToken()) && $0.is$Token()); | |
| 8469 } | 8230 } |
| 8470 ExpressionStatement.prototype.getEndToken = function() { | 8231 ExpressionStatement.prototype.getEndToken = function() { |
| 8471 return this.endToken; | 8232 return this.endToken; |
| 8472 } | 8233 } |
| 8473 ExpressionStatement.prototype.accept$1 = function($0) { | 8234 ExpressionStatement.prototype.accept$1 = function($0) { |
| 8474 return this.accept(($0 && $0.is$Visitor())); | 8235 return this.accept($0); |
| 8475 }; | 8236 }; |
| 8476 ExpressionStatement.prototype.getBeginToken$0 = function() { | 8237 ExpressionStatement.prototype.getBeginToken$0 = function() { |
| 8477 return this.getBeginToken(); | 8238 return this.getBeginToken(); |
| 8478 }; | 8239 }; |
| 8479 ExpressionStatement.prototype.getEndToken$0 = function() { | 8240 ExpressionStatement.prototype.getEndToken$0 = function() { |
| 8480 return this.getEndToken(); | 8241 return this.getEndToken(); |
| 8481 }; | 8242 }; |
| 8482 // ********** Code for Throw ************** | 8243 // ********** Code for Throw ************** |
| 8483 function Throw(expression, throwToken, endToken) { | 8244 function Throw(expression, throwToken, endToken) { |
| 8484 this.expression = expression; | 8245 this.expression = expression; |
| 8485 this.throwToken = throwToken; | 8246 this.throwToken = throwToken; |
| 8486 this.endToken = endToken; | 8247 this.endToken = endToken; |
| 8487 // Initializers done | 8248 // Initializers done |
| 8488 } | 8249 } |
| 8489 $inherits(Throw, Statement); | 8250 $inherits(Throw, Statement); |
| 8490 Throw.prototype.accept = function(visitor) { | 8251 Throw.prototype.accept = function(visitor) { |
| 8491 return visitor.visitThrow(this); | 8252 return visitor.visitThrow(this); |
| 8492 } | 8253 } |
| 8493 Throw.prototype.getBeginToken = function() { | 8254 Throw.prototype.getBeginToken = function() { |
| 8494 return this.throwToken; | 8255 return this.throwToken; |
| 8495 } | 8256 } |
| 8496 Throw.prototype.getEndToken = function() { | 8257 Throw.prototype.getEndToken = function() { |
| 8497 return this.endToken; | 8258 return this.endToken; |
| 8498 } | 8259 } |
| 8499 Throw.prototype.accept$1 = function($0) { | 8260 Throw.prototype.accept$1 = function($0) { |
| 8500 return this.accept(($0 && $0.is$Visitor())); | 8261 return this.accept($0); |
| 8501 }; | 8262 }; |
| 8502 Throw.prototype.getBeginToken$0 = function() { | 8263 Throw.prototype.getBeginToken$0 = function() { |
| 8503 return this.getBeginToken(); | 8264 return this.getBeginToken(); |
| 8504 }; | 8265 }; |
| 8505 Throw.prototype.getEndToken$0 = function() { | 8266 Throw.prototype.getEndToken$0 = function() { |
| 8506 return this.getEndToken(); | 8267 return this.getEndToken(); |
| 8507 }; | 8268 }; |
| 8508 // ********** Code for TypeAnnotation ************** | 8269 // ********** Code for TypeAnnotation ************** |
| 8509 function TypeAnnotation(typeName) { | 8270 function TypeAnnotation(typeName) { |
| 8510 this.typeName = typeName; | 8271 this.typeName = typeName; |
| 8511 // Initializers done | 8272 // Initializers done |
| 8512 } | 8273 } |
| 8513 $inherits(TypeAnnotation, Node); | 8274 $inherits(TypeAnnotation, Node); |
| 8514 TypeAnnotation.prototype.is$TypeAnnotation = function(){return this;}; | |
| 8515 TypeAnnotation.prototype.get$typeName = function() { return this.typeName; }; | 8275 TypeAnnotation.prototype.get$typeName = function() { return this.typeName; }; |
| 8516 TypeAnnotation.prototype.accept = function(visitor) { | 8276 TypeAnnotation.prototype.accept = function(visitor) { |
| 8517 return visitor.visitTypeAnnotation(this); | 8277 return visitor.visitTypeAnnotation(this); |
| 8518 } | 8278 } |
| 8519 TypeAnnotation.prototype.getBeginToken = function() { | 8279 TypeAnnotation.prototype.getBeginToken = function() { |
| 8520 var $0; | 8280 return this.typeName.getBeginToken(); |
| 8521 return (($0 = this.typeName.getBeginToken()) && $0.is$Token()); | |
| 8522 } | 8281 } |
| 8523 TypeAnnotation.prototype.getEndToken = function() { | 8282 TypeAnnotation.prototype.getEndToken = function() { |
| 8524 var $0; | 8283 return this.typeName.getEndToken(); |
| 8525 return (($0 = this.typeName.getEndToken()) && $0.is$Token()); | |
| 8526 } | 8284 } |
| 8527 TypeAnnotation.prototype.accept$1 = function($0) { | 8285 TypeAnnotation.prototype.accept$1 = function($0) { |
| 8528 return this.accept(($0 && $0.is$Visitor())); | 8286 return this.accept($0); |
| 8529 }; | 8287 }; |
| 8530 TypeAnnotation.prototype.getBeginToken$0 = function() { | 8288 TypeAnnotation.prototype.getBeginToken$0 = function() { |
| 8531 return this.getBeginToken(); | 8289 return this.getBeginToken(); |
| 8532 }; | 8290 }; |
| 8533 TypeAnnotation.prototype.getEndToken$0 = function() { | 8291 TypeAnnotation.prototype.getEndToken$0 = function() { |
| 8534 return this.getEndToken(); | 8292 return this.getEndToken(); |
| 8535 }; | 8293 }; |
| 8536 // ********** Code for VariableDefinitions ************** | 8294 // ********** Code for VariableDefinitions ************** |
| 8537 function VariableDefinitions(type, modifiers, definitions, endToken) { | 8295 function VariableDefinitions(type, modifiers, definitions, endToken) { |
| 8538 this.type = type; | 8296 this.type = type; |
| 8539 this.modifiers = modifiers; | 8297 this.modifiers = modifiers; |
| 8540 this.definitions = definitions; | 8298 this.definitions = definitions; |
| 8541 this.endToken = endToken; | 8299 this.endToken = endToken; |
| 8542 // Initializers done | 8300 // Initializers done |
| 8543 } | 8301 } |
| 8544 $inherits(VariableDefinitions, Statement); | 8302 $inherits(VariableDefinitions, Statement); |
| 8545 VariableDefinitions.prototype.is$VariableDefinitions = function(){return this;}; | |
| 8546 VariableDefinitions.prototype.get$type = function() { return this.type; }; | |
| 8547 VariableDefinitions.prototype.accept = function(visitor) { | 8303 VariableDefinitions.prototype.accept = function(visitor) { |
| 8548 return visitor.visitVariableDefinitions(this); | 8304 return visitor.visitVariableDefinitions(this); |
| 8549 } | 8305 } |
| 8550 VariableDefinitions.prototype.getBeginToken = function() { | 8306 VariableDefinitions.prototype.getBeginToken = function() { |
| 8551 return firstBeginToken(this.type, this.definitions); | 8307 return firstBeginToken(this.type, this.definitions); |
| 8552 } | 8308 } |
| 8553 VariableDefinitions.prototype.getEndToken = function() { | 8309 VariableDefinitions.prototype.getEndToken = function() { |
| 8554 return this.endToken; | 8310 return this.endToken; |
| 8555 } | 8311 } |
| 8556 VariableDefinitions.prototype.accept$1 = function($0) { | 8312 VariableDefinitions.prototype.accept$1 = function($0) { |
| 8557 return this.accept(($0 && $0.is$Visitor())); | 8313 return this.accept($0); |
| 8558 }; | 8314 }; |
| 8559 VariableDefinitions.prototype.getBeginToken$0 = function() { | 8315 VariableDefinitions.prototype.getBeginToken$0 = function() { |
| 8560 return this.getBeginToken(); | 8316 return this.getBeginToken(); |
| 8561 }; | 8317 }; |
| 8562 VariableDefinitions.prototype.getEndToken$0 = function() { | 8318 VariableDefinitions.prototype.getEndToken$0 = function() { |
| 8563 return this.getEndToken(); | 8319 return this.getEndToken(); |
| 8564 }; | 8320 }; |
| 8565 // ********** Code for Unparser ************** | 8321 // ********** Code for Unparser ************** |
| 8566 function Unparser(printDebugInfo) { | 8322 function Unparser(printDebugInfo) { |
| 8567 this.printDebugInfo = printDebugInfo; | 8323 this.printDebugInfo = printDebugInfo; |
| 8568 // Initializers done | 8324 // Initializers done |
| 8569 } | 8325 } |
| 8570 Unparser.prototype.is$Visitor = function(){return this;}; | |
| 8571 Unparser.prototype.unparse = function(node) { | 8326 Unparser.prototype.unparse = function(node) { |
| 8572 this.sb = new StringBufferImpl(""); | 8327 this.sb = new StringBufferImpl(""); |
| 8573 this.visit(node); | 8328 this.visit(node); |
| 8574 return this.sb.toString(); | 8329 return this.sb.toString(); |
| 8575 } | 8330 } |
| 8576 Unparser.prototype.add = function(string) { | 8331 Unparser.prototype.add = function(string) { |
| 8577 string.printOn(this.sb); | 8332 string.printOn(this.sb); |
| 8578 } | 8333 } |
| 8579 Unparser.prototype.visit = function(node) { | 8334 Unparser.prototype.visit = function(node) { |
| 8580 if (node != null) { | 8335 if (node != null) { |
| 8581 if ($notnull_bool(this.printDebugInfo)) this.sb.add(('[' + node.getObjectDes
cription() + ': ')); | 8336 if (this.printDebugInfo) this.sb.add(('[' + node.getObjectDescription() + ':
')); |
| 8582 node.accept(this); | 8337 node.accept(this); |
| 8583 if ($notnull_bool(this.printDebugInfo)) this.sb.add(']'); | 8338 if (this.printDebugInfo) this.sb.add(']'); |
| 8584 } | 8339 } |
| 8585 else if ($notnull_bool(this.printDebugInfo)) { | 8340 else if (this.printDebugInfo) { |
| 8586 this.sb.add('[null]'); | 8341 this.sb.add('[null]'); |
| 8587 } | 8342 } |
| 8588 } | 8343 } |
| 8589 Unparser.prototype.visitBlock = function(node) { | 8344 Unparser.prototype.visitBlock = function(node) { |
| 8590 this.visit(node.statements); | 8345 this.visit(node.statements); |
| 8591 } | 8346 } |
| 8592 Unparser.prototype.visitExpressionStatement = function(node) { | 8347 Unparser.prototype.visitExpressionStatement = function(node) { |
| 8593 var $0; | |
| 8594 this.visit(node.expression); | 8348 this.visit(node.expression); |
| 8595 this.add((($0 = node.endToken.get$value()) && $0.is$SourceString())); | 8349 this.add(node.endToken.get$value()); |
| 8596 } | 8350 } |
| 8597 Unparser.prototype.visitFor = function(node) { | 8351 Unparser.prototype.visitFor = function(node) { |
| 8598 node.forToken.get$value().printOn$1(this.sb); | 8352 node.forToken.get$value().printOn$1(this.sb); |
| 8599 this.sb.add('('); | 8353 this.sb.add('('); |
| 8600 this.visit(node.initializer); | 8354 this.visit(node.initializer); |
| 8601 this.visit(node.condition); | 8355 this.visit(node.condition); |
| 8602 this.visit(node.update); | 8356 this.visit(node.update); |
| 8603 this.sb.add(')'); | 8357 this.sb.add(')'); |
| 8604 this.visit(node.body); | 8358 this.visit(node.body); |
| 8605 } | 8359 } |
| 8606 Unparser.prototype.visitFunctionExpression = function(node) { | 8360 Unparser.prototype.visitFunctionExpression = function(node) { |
| 8607 if (node.returnType != null) { | 8361 if (node.returnType != null) { |
| 8608 this.visit(node.returnType); | 8362 this.visit(node.returnType); |
| 8609 this.sb.add(' '); | 8363 this.sb.add(' '); |
| 8610 } | 8364 } |
| 8611 this.visit(node.name); | 8365 this.visit(node.name); |
| 8612 this.visit(node.parameters); | 8366 this.visit(node.parameters); |
| 8613 this.visit(node.body); | 8367 this.visit(node.body); |
| 8614 } | 8368 } |
| 8615 Unparser.prototype.visitIdentifier = function(node) { | 8369 Unparser.prototype.visitIdentifier = function(node) { |
| 8616 var $0; | 8370 this.add(node.token.get$value()); |
| 8617 this.add((($0 = node.token.get$value()) && $0.is$SourceString())); | |
| 8618 } | 8371 } |
| 8619 Unparser.prototype.visitIf = function(node) { | 8372 Unparser.prototype.visitIf = function(node) { |
| 8620 var $0; | 8373 this.add(node.ifToken.get$value()); |
| 8621 this.add((($0 = node.ifToken.get$value()) && $0.is$SourceString())); | |
| 8622 this.visit(node.condition); | 8374 this.visit(node.condition); |
| 8623 this.visit(node.thenPart); | 8375 this.visit(node.thenPart); |
| 8624 if ($notnull_bool(node.get$hasElsePart())) { | 8376 if (node.get$hasElsePart()) { |
| 8625 this.add((($0 = node.elseToken.get$value()) && $0.is$SourceString())); | 8377 this.add(node.elseToken.get$value()); |
| 8626 this.visit(node.elsePart); | 8378 this.visit(node.elsePart); |
| 8627 } | 8379 } |
| 8628 } | 8380 } |
| 8629 Unparser.prototype.visitLiteralBool = function(node) { | 8381 Unparser.prototype.visitLiteralBool = function(node) { |
| 8630 var $0; | 8382 this.add(node.token.get$value()); |
| 8631 this.add((($0 = node.token.get$value()) && $0.is$SourceString())); | |
| 8632 } | 8383 } |
| 8633 Unparser.prototype.visitLiteralDouble = function(node) { | 8384 Unparser.prototype.visitLiteralDouble = function(node) { |
| 8634 var $0; | 8385 this.add(node.token.get$value()); |
| 8635 this.add((($0 = node.token.get$value()) && $0.is$SourceString())); | |
| 8636 } | 8386 } |
| 8637 Unparser.prototype.visitLiteralInt = function(node) { | 8387 Unparser.prototype.visitLiteralInt = function(node) { |
| 8638 var $0; | 8388 this.add(node.token.get$value()); |
| 8639 this.add((($0 = node.token.get$value()) && $0.is$SourceString())); | |
| 8640 } | 8389 } |
| 8641 Unparser.prototype.visitLiteralString = function(node) { | 8390 Unparser.prototype.visitLiteralString = function(node) { |
| 8642 var $0; | 8391 this.add(node.token.get$value()); |
| 8643 this.add((($0 = node.token.get$value()) && $0.is$SourceString())); | |
| 8644 } | 8392 } |
| 8645 Unparser.prototype.visitNodeList = function(node) { | 8393 Unparser.prototype.visitNodeList = function(node) { |
| 8646 var $0; | 8394 if (node.beginToken != null) this.add(node.beginToken.get$value()); |
| 8647 if (node.beginToken != null) this.add((($0 = node.beginToken.get$value()) && $
0.is$SourceString())); | |
| 8648 if (node.nodes != null) { | 8395 if (node.nodes != null) { |
| 8649 node.nodes.printOn(this.sb, node.delimiter); | 8396 node.nodes.printOn(this.sb, node.delimiter); |
| 8650 } | 8397 } |
| 8651 if (node.endToken != null) this.add((($0 = node.endToken.get$value()) && $0.is
$SourceString())); | 8398 if (node.endToken != null) this.add(node.endToken.get$value()); |
| 8652 } | 8399 } |
| 8653 Unparser.prototype.visitOperator = function(node) { | 8400 Unparser.prototype.visitOperator = function(node) { |
| 8654 this.visitIdentifier(node); | 8401 this.visitIdentifier(node); |
| 8655 } | 8402 } |
| 8656 Unparser.prototype.visitReturn = function(node) { | 8403 Unparser.prototype.visitReturn = function(node) { |
| 8657 var $0; | 8404 this.add(node.beginToken.get$value()); |
| 8658 this.add((($0 = node.beginToken.get$value()) && $0.is$SourceString())); | 8405 if (node.get$hasExpression()) { |
| 8659 if ($notnull_bool(node.get$hasExpression())) { | |
| 8660 this.sb.add(' '); | 8406 this.sb.add(' '); |
| 8661 this.visit(node.expression); | 8407 this.visit(node.expression); |
| 8662 } | 8408 } |
| 8663 this.add((($0 = node.endToken.get$value()) && $0.is$SourceString())); | 8409 this.add(node.endToken.get$value()); |
| 8664 } | 8410 } |
| 8665 Unparser.prototype.visitSend = function(node) { | 8411 Unparser.prototype.visitSend = function(node) { |
| 8666 if (node.receiver != null) { | 8412 if (node.receiver != null) { |
| 8667 this.visit(node.receiver); | 8413 this.visit(node.receiver); |
| 8668 if (!(node.selector instanceof Operator)) this.sb.add('.'); | 8414 if (!(node.selector instanceof Operator)) this.sb.add('.'); |
| 8669 } | 8415 } |
| 8670 this.visit(node.selector); | 8416 this.visit(node.selector); |
| 8671 this.visit(node.argumentsNode); | 8417 this.visit(node.argumentsNode); |
| 8672 } | 8418 } |
| 8673 Unparser.prototype.visitSendSet = function(node) { | 8419 Unparser.prototype.visitSendSet = function(node) { |
| 8674 var $0; | |
| 8675 if (node.receiver != null) { | 8420 if (node.receiver != null) { |
| 8676 this.visit(node.receiver); | 8421 this.visit(node.receiver); |
| 8677 this.sb.add('.'); | 8422 this.sb.add('.'); |
| 8678 } | 8423 } |
| 8679 this.visit(node.selector); | 8424 this.visit(node.selector); |
| 8680 this.add((($0 = node.assignmentOperator.get$value()) && $0.is$SourceString()))
; | 8425 this.add(node.assignmentOperator.get$value()); |
| 8681 this.visit(node.argumentsNode); | 8426 this.visit(node.argumentsNode); |
| 8682 } | 8427 } |
| 8683 Unparser.prototype.visitThrow = function(node) { | 8428 Unparser.prototype.visitThrow = function(node) { |
| 8684 node.throwToken.get$value().printOn$1(this.sb); | 8429 node.throwToken.get$value().printOn$1(this.sb); |
| 8685 if (node.expression != null) { | 8430 if (node.expression != null) { |
| 8686 this.visit(node.expression); | 8431 this.visit(node.expression); |
| 8687 } | 8432 } |
| 8688 node.endToken.get$value().printOn$1(this.sb); | 8433 node.endToken.get$value().printOn$1(this.sb); |
| 8689 } | 8434 } |
| 8690 Unparser.prototype.visitTypeAnnotation = function(node) { | 8435 Unparser.prototype.visitTypeAnnotation = function(node) { |
| 8691 this.visit(node.typeName); | 8436 this.visit(node.typeName); |
| 8692 } | 8437 } |
| 8693 Unparser.prototype.visitVariableDefinitions = function(node) { | 8438 Unparser.prototype.visitVariableDefinitions = function(node) { |
| 8694 var $0; | |
| 8695 if (node.type != null) { | 8439 if (node.type != null) { |
| 8696 this.visit(node.type); | 8440 this.visit(node.type); |
| 8697 } | 8441 } |
| 8698 else { | 8442 else { |
| 8699 this.sb.add('var'); | 8443 this.sb.add('var'); |
| 8700 } | 8444 } |
| 8701 this.sb.add(' '); | 8445 this.sb.add(' '); |
| 8702 this.visit(node.definitions); | 8446 this.visit(node.definitions); |
| 8703 if (node.endToken != null) this.add((($0 = node.endToken.get$value()) && $0.is
$SourceString())); | 8447 if (node.endToken != null) this.add(node.endToken.get$value()); |
| 8704 } | 8448 } |
| 8705 Unparser.prototype.add$1 = function($0) { | 8449 Unparser.prototype.add$1 = function($0) { |
| 8706 return this.add(($0 && $0.is$SourceString())); | 8450 return this.add($0); |
| 8707 }; | 8451 }; |
| 8708 Unparser.prototype.visit$1 = function($0) { | 8452 Unparser.prototype.visit$1 = function($0) { |
| 8709 return this.visit(($0 && $0.is$Node())); | 8453 return this.visit($0); |
| 8710 }; | 8454 }; |
| 8711 // ********** Code for top level ************** | 8455 // ********** Code for top level ************** |
| 8712 function firstBeginToken(first, second) { | 8456 function firstBeginToken(first, second) { |
| 8713 var $0; | 8457 return (first != null) ? first.getBeginToken() : second.getBeginToken(); |
| 8714 return (($0 = (first != null) ? first.getBeginToken() : second.getBeginToken()
) && $0.is$Token()); | |
| 8715 } | 8458 } |
| 8716 // ********** Library elements ************** | 8459 // ********** Library elements ************** |
| 8717 // ********** Code for ElementKind ************** | 8460 // ********** Code for ElementKind ************** |
| 8718 function ElementKind(id) { | 8461 function ElementKind(id) { |
| 8719 this.id = id; | 8462 this.id = id; |
| 8720 // Initializers done | 8463 // Initializers done |
| 8721 } | 8464 } |
| 8722 // ********** Code for Element ************** | 8465 // ********** Code for Element ************** |
| 8723 function Element(name, kind, enclosingElement) { | 8466 function Element(name, kind, enclosingElement) { |
| 8724 this.name = name; | 8467 this.name = name; |
| 8725 this.kind = kind; | 8468 this.kind = kind; |
| 8726 this.enclosingElement = enclosingElement; | 8469 this.enclosingElement = enclosingElement; |
| 8727 // Initializers done | 8470 // Initializers done |
| 8728 } | 8471 } |
| 8729 Element.prototype.is$Element = function(){return this;}; | |
| 8730 Element.prototype.get$name = function() { return this.name; }; | 8472 Element.prototype.get$name = function() { return this.name; }; |
| 8731 Element.prototype.hashCode = function() { | 8473 Element.prototype.hashCode = function() { |
| 8732 return this.name.hashCode(); | 8474 return this.name.hashCode(); |
| 8733 } | 8475 } |
| 8734 Element.prototype.computeType$2 = function($0, $1) { | 8476 Element.prototype.computeType$2 = function($0, $1) { |
| 8735 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); | 8477 return this.computeType($0, $1); |
| 8736 }; | 8478 }; |
| 8737 Element.prototype.hashCode$0 = function() { | 8479 Element.prototype.hashCode$0 = function() { |
| 8738 return this.hashCode(); | 8480 return this.hashCode(); |
| 8739 }; | 8481 }; |
| 8740 // ********** Code for VariableElement ************** | 8482 // ********** Code for VariableElement ************** |
| 8741 function VariableElement(node, typeAnnotation, name, enclosingElement) { | 8483 function VariableElement(node, typeAnnotation, name, enclosingElement) { |
| 8742 this.node = node; | 8484 this.node = node; |
| 8743 this.typeAnnotation = typeAnnotation; | 8485 this.typeAnnotation = typeAnnotation; |
| 8744 Element.call(this, name, const$262, enclosingElement); | 8486 Element.call(this, name, const$262, enclosingElement); |
| 8745 // Initializers done | 8487 // Initializers done |
| 8746 } | 8488 } |
| 8747 $inherits(VariableElement, Element); | 8489 $inherits(VariableElement, Element); |
| 8748 VariableElement.prototype.get$type = function() { return this.type; }; | |
| 8749 VariableElement.prototype.set$type = function(value) { return this.type = value;
}; | |
| 8750 VariableElement.prototype.parseNode = function(canceler, logger) { | 8490 VariableElement.prototype.parseNode = function(canceler, logger) { |
| 8751 return this.node; | 8491 return this.node; |
| 8752 } | 8492 } |
| 8753 VariableElement.prototype.computeType = function(compiler, types) { | 8493 VariableElement.prototype.computeType = function(compiler, types) { |
| 8754 return getType(this.typeAnnotation, types); | 8494 return getType(this.typeAnnotation, types); |
| 8755 } | 8495 } |
| 8756 VariableElement.prototype.computeType$2 = function($0, $1) { | 8496 VariableElement.prototype.computeType$2 = function($0, $1) { |
| 8757 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); | 8497 return this.computeType($0, $1); |
| 8758 }; | 8498 }; |
| 8759 // ********** Code for ForeignElement ************** | 8499 // ********** Code for ForeignElement ************** |
| 8760 function ForeignElement(name) { | 8500 function ForeignElement(name) { |
| 8761 Element.call(this, name, const$242, null); | 8501 Element.call(this, name, const$242, null); |
| 8762 // Initializers done | 8502 // Initializers done |
| 8763 } | 8503 } |
| 8764 $inherits(ForeignElement, Element); | 8504 $inherits(ForeignElement, Element); |
| 8765 ForeignElement.prototype.computeType = function(compiler, types) { | 8505 ForeignElement.prototype.computeType = function(compiler, types) { |
| 8766 return types.dynamicType; | 8506 return types.dynamicType; |
| 8767 } | 8507 } |
| 8768 ForeignElement.prototype.computeType$2 = function($0, $1) { | 8508 ForeignElement.prototype.computeType$2 = function($0, $1) { |
| 8769 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); | 8509 return this.computeType($0, $1); |
| 8770 }; | 8510 }; |
| 8771 // ********** Code for FunctionElement ************** | 8511 // ********** Code for FunctionElement ************** |
| 8772 function FunctionElement(name) { | 8512 function FunctionElement(name) { |
| 8773 Element.call(this, name, const$239, null); | 8513 Element.call(this, name, const$239, null); |
| 8774 // Initializers done | 8514 // Initializers done |
| 8775 } | 8515 } |
| 8776 $inherits(FunctionElement, Element); | 8516 $inherits(FunctionElement, Element); |
| 8777 FunctionElement.prototype.get$type = function() { return this.type; }; | |
| 8778 FunctionElement.prototype.set$type = function(value) { return this.type = value;
}; | |
| 8779 FunctionElement.prototype.computeType = function(compiler, types) { | 8517 FunctionElement.prototype.computeType = function(compiler, types) { |
| 8780 var $0; | 8518 if (this.type != null) return this.type; |
| 8781 if (this.type != null) return (($0 = this.type) && $0.is$FunctionType()); | 8519 var node = this.parseNode(compiler, compiler); |
| 8782 var node = (($0 = this.parseNode(compiler, compiler)) && $0.is$FunctionExpress
ion()); | |
| 8783 var returnType = getType(node.returnType, types); | 8520 var returnType = getType(node.returnType, types); |
| 8784 if (returnType == null) compiler.cancel(('unknown type ' + returnType + '')); | 8521 if (returnType == null) compiler.cancel(('unknown type ' + returnType + '')); |
| 8785 var parameterTypes = new LinkBuilderImplementation(); | 8522 var parameterTypes = new LinkBuilderImplementation(); |
| 8786 for (var link = node.parameters.nodes; | 8523 for (var link = node.parameters.nodes; |
| 8787 !$notnull_bool(link.isEmpty$0()); link = link.get$tail()) { | 8524 !link.isEmpty$0(); link = link.get$tail()) { |
| 8788 var parameter = (($0 = link.get$head()) && $0.is$VariableDefinitions()); | 8525 var parameter = link.get$head(); |
| 8789 parameterTypes.addLast(getType(parameter.type, types)); | 8526 parameterTypes.addLast(getType(parameter.type, types)); |
| 8790 } | 8527 } |
| 8791 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0
.is$Link$Type())); | 8528 this.type = new FunctionType(returnType, parameterTypes.toLink()); |
| 8792 return (($0 = this.type) && $0.is$FunctionType()); | 8529 return this.type; |
| 8793 } | 8530 } |
| 8794 FunctionElement.prototype.computeType$2 = FunctionElement.prototype.computeType; | 8531 FunctionElement.prototype.computeType$2 = function($0, $1) { |
| 8532 return this.computeType($0, $1); |
| 8533 }; |
| 8795 // ********** Code for ClassElement ************** | 8534 // ********** Code for ClassElement ************** |
| 8796 function ClassElement(name) { | 8535 function ClassElement(name) { |
| 8797 this.interfaces = const$14/*const EmptyLink()*/ | 8536 this.interfaces = const$14/*const EmptyLink()*/ |
| 8798 this.isResolved = false | 8537 this.isResolved = false |
| 8799 Element.call(this, name, const$237, null); | 8538 Element.call(this, name, const$237, null); |
| 8800 // Initializers done | 8539 // Initializers done |
| 8801 } | 8540 } |
| 8802 $inherits(ClassElement, Element); | 8541 $inherits(ClassElement, Element); |
| 8803 ClassElement.prototype.is$ClassElement = function(){return this;}; | |
| 8804 ClassElement.prototype.get$type = function() { return this.type; }; | |
| 8805 ClassElement.prototype.set$type = function(value) { return this.type = value; }; | |
| 8806 ClassElement.prototype.get$interfaces = function() { return this.interfaces; }; | 8542 ClassElement.prototype.get$interfaces = function() { return this.interfaces; }; |
| 8807 ClassElement.prototype.set$interfaces = function(value) { return this.interfaces
= value; }; | 8543 ClassElement.prototype.set$interfaces = function(value) { return this.interfaces
= value; }; |
| 8808 ClassElement.prototype.computeType = function(compiler, types) { | 8544 ClassElement.prototype.computeType = function(compiler, types) { |
| 8809 if (this.type == null) { | 8545 if (this.type == null) { |
| 8810 this.type = new SimpleType(this.name, this); | 8546 this.type = new SimpleType(this.name, this); |
| 8811 } | 8547 } |
| 8812 return this.type; | 8548 return this.type; |
| 8813 } | 8549 } |
| 8814 ClassElement.prototype.resolve = function(compiler) { | 8550 ClassElement.prototype.resolve = function(compiler) { |
| 8815 if ($notnull_bool(this.isResolved)) return; | 8551 if (this.isResolved) return; |
| 8816 compiler.resolveType(this); | 8552 compiler.resolveType(this); |
| 8817 this.isResolved = true; | 8553 this.isResolved = true; |
| 8818 } | 8554 } |
| 8819 ClassElement.prototype.computeType$2 = ClassElement.prototype.computeType; | 8555 ClassElement.prototype.computeType$2 = function($0, $1) { |
| 8556 return this.computeType($0, $1); |
| 8557 }; |
| 8820 ClassElement.prototype.resolve$1 = function($0) { | 8558 ClassElement.prototype.resolve$1 = function($0) { |
| 8821 return this.resolve(($0 && $0.is$Compiler())); | 8559 return this.resolve($0); |
| 8822 }; | 8560 }; |
| 8823 // ********** Code for top level ************** | 8561 // ********** Code for top level ************** |
| 8824 function getType(annotation, types) { | 8562 function getType(annotation, types) { |
| 8825 var $0; | |
| 8826 if (annotation == null || annotation.typeName == null) { | 8563 if (annotation == null || annotation.typeName == null) { |
| 8827 return (($0 = types.dynamicType) && $0.is$Type()); | 8564 return types.dynamicType; |
| 8828 } | 8565 } |
| 8829 return (($0 = types.lookup$1(annotation.typeName.get$source())) && $0.is$Type(
)); | 8566 return types.lookup$1(annotation.typeName.get$source()); |
| 8830 } | 8567 } |
| 8831 // ********** Library ssa ************** | 8568 // ********** Library ssa ************** |
| 8832 // ********** Code for SsaBuilderTask ************** | 8569 // ********** Code for SsaBuilderTask ************** |
| 8833 function SsaBuilderTask(compiler) { | 8570 function SsaBuilderTask(compiler) { |
| 8834 CompilerTask.call(this, compiler); | 8571 CompilerTask.call(this, compiler); |
| 8835 // Initializers done | 8572 // Initializers done |
| 8836 } | 8573 } |
| 8837 $inherits(SsaBuilderTask, CompilerTask); | 8574 $inherits(SsaBuilderTask, CompilerTask); |
| 8838 SsaBuilderTask.prototype.get$name = function() { | 8575 SsaBuilderTask.prototype.get$name = function() { |
| 8839 return 'SSA builder'; | 8576 return 'SSA builder'; |
| 8840 } | 8577 } |
| 8841 SsaBuilderTask.prototype.build = function(tree, elements) { | 8578 SsaBuilderTask.prototype.build = function(tree, elements) { |
| 8842 var $this = this; // closure support | 8579 var $this = this; // closure support |
| 8843 var $0; | 8580 return this.measure((function () { |
| 8844 return (($0 = this.measure((function () { | 8581 var function_ = tree; |
| 8845 var $0; | |
| 8846 var function_ = (tree && tree.is$FunctionExpression()); | |
| 8847 var graph = $this.compileMethod(function_.parameters, function_.body, elemen
ts); | 8582 var graph = $this.compileMethod(function_.parameters, function_.body, elemen
ts); |
| 8848 $assert(graph.isValid(), "graph.isValid()", "builder.dart", 14, 14); | |
| 8849 if (false/*null.GENERATE_SSA_TRACE*/) { | 8583 if (false/*null.GENERATE_SSA_TRACE*/) { |
| 8850 var name = (($0 = function_.name) && $0.is$Identifier()); | 8584 var name = function_.name; |
| 8851 HTracer.HTracer$singleton$factory().traceCompilation(name.get$source().toS
tring()); | 8585 HTracer.HTracer$singleton$factory().traceCompilation(name.get$source().toS
tring()); |
| 8852 HTracer.HTracer$singleton$factory().traceGraph('builder', graph); | 8586 HTracer.HTracer$singleton$factory().traceGraph('builder', graph); |
| 8853 } | 8587 } |
| 8854 return graph; | 8588 return graph; |
| 8855 }) | 8589 }) |
| 8856 )) && $0.is$HGraph()); | 8590 ); |
| 8857 } | 8591 } |
| 8858 SsaBuilderTask.prototype.compileMethod = function(parameters, body, elements) { | 8592 SsaBuilderTask.prototype.compileMethod = function(parameters, body, elements) { |
| 8859 var builder = new SsaBuilder(this.compiler, elements); | 8593 var builder = new SsaBuilder(this.compiler, elements); |
| 8860 var graph = builder.build(parameters, body); | 8594 var graph = builder.build(parameters, body); |
| 8861 return graph; | 8595 return graph; |
| 8862 } | 8596 } |
| 8863 // ********** Code for SsaBuilder ************** | 8597 // ********** Code for SsaBuilder ************** |
| 8864 function SsaBuilder(compiler, elements) { | 8598 function SsaBuilder(compiler, elements) { |
| 8865 this.compiler = compiler; | 8599 this.compiler = compiler; |
| 8866 this.elements = elements; | 8600 this.elements = elements; |
| 8867 // Initializers done | 8601 // Initializers done |
| 8868 } | 8602 } |
| 8869 SsaBuilder.prototype.is$Visitor = function(){return this;}; | |
| 8870 SsaBuilder.prototype.build = function(parameters, body) { | 8603 SsaBuilder.prototype.build = function(parameters, body) { |
| 8871 this.stack = new ListFactory(); | 8604 this.stack = new ListFactory(); |
| 8872 this.definitions = new HashMapImplementation(); | 8605 this.definitions = new HashMapImplementation(); |
| 8873 this.graph = new HGraph(); | 8606 this.graph = new HGraph(); |
| 8874 var block = this.graph.addNewBlock(); | 8607 var block = this.graph.addNewBlock(); |
| 8875 this.open(this.graph.entry); | 8608 this.open(this.graph.entry); |
| 8876 this.visitParameters(parameters); | 8609 this.visitParameters(parameters); |
| 8877 this.close(new HGoto()).addSuccessor(block); | 8610 this.close(new HGoto()).addSuccessor(block); |
| 8878 this.open(block); | 8611 this.open(block); |
| 8879 body.accept(this); | 8612 body.accept(this); |
| 8880 if (!$notnull_bool(this.isAborted())) this.close(new HGoto()).addSuccessor(thi
s.graph.exit); | 8613 if (!this.isAborted()) this.close(new HGoto()).addSuccessor(this.graph.exit); |
| 8881 this.graph.finalize(); | 8614 this.graph.finalize(); |
| 8882 return this.graph; | 8615 return this.graph; |
| 8883 } | 8616 } |
| 8884 SsaBuilder.prototype.open = function(block) { | 8617 SsaBuilder.prototype.open = function(block) { |
| 8885 block.open(); | 8618 block.open(); |
| 8886 this.current = block; | 8619 this.current = block; |
| 8887 } | 8620 } |
| 8888 SsaBuilder.prototype.close = function(end) { | 8621 SsaBuilder.prototype.close = function(end) { |
| 8889 var result = this.current; | 8622 var result = this.current; |
| 8890 this.current.close(end); | 8623 this.current.close(end); |
| 8891 this.current = null; | 8624 this.current = null; |
| 8892 return result; | 8625 return result; |
| 8893 } | 8626 } |
| 8894 SsaBuilder.prototype.goto = function(from, to) { | 8627 SsaBuilder.prototype.goto = function(from, to) { |
| 8895 from.close(new HGoto()); | 8628 from.close(new HGoto()); |
| 8896 from.addSuccessor(to); | 8629 from.addSuccessor(to); |
| 8897 } | 8630 } |
| 8898 SsaBuilder.prototype.isAborted = function() { | 8631 SsaBuilder.prototype.isAborted = function() { |
| 8899 return this.current == null; | 8632 return this.current == null; |
| 8900 } | 8633 } |
| 8901 SsaBuilder.prototype.add = function(instruction) { | 8634 SsaBuilder.prototype.add = function(instruction) { |
| 8902 this.current.add(instruction); | 8635 this.current.add(instruction); |
| 8903 } | 8636 } |
| 8904 SsaBuilder.prototype.push = function(instruction) { | 8637 SsaBuilder.prototype.push = function(instruction) { |
| 8905 this.add(instruction); | 8638 this.add(instruction); |
| 8906 this.stack.add(instruction); | 8639 this.stack.add(instruction); |
| 8907 } | 8640 } |
| 8908 SsaBuilder.prototype.pop = function() { | 8641 SsaBuilder.prototype.pop = function() { |
| 8909 var $0; | 8642 return this.stack.removeLast(); |
| 8910 return (($0 = this.stack.removeLast()) && $0.is$HInstruction()); | |
| 8911 } | 8643 } |
| 8912 SsaBuilder.prototype.visit = function(node) { | 8644 SsaBuilder.prototype.visit = function(node) { |
| 8913 if (node != null) node.accept(this); | 8645 if (node != null) node.accept(this); |
| 8914 } | 8646 } |
| 8915 SsaBuilder.prototype.visitParameters = function(parameters) { | 8647 SsaBuilder.prototype.visitParameters = function(parameters) { |
| 8916 var $0; | |
| 8917 var parameterIndex = 0; | 8648 var parameterIndex = 0; |
| 8918 for (var link = parameters.nodes; | 8649 for (var link = parameters.nodes; |
| 8919 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 8650 !link.isEmpty(); link = link.get$tail()) { |
| 8920 var container = (($0 = link.get$head()) && $0.is$VariableDefinitions()); | 8651 var container = link.get$head(); |
| 8921 var identifierLink = container.definitions.nodes; | 8652 var identifierLink = container.definitions.nodes; |
| 8922 $assert(!$notnull_bool(identifierLink.isEmpty()) && $notnull_bool(identifier
Link.get$tail().isEmpty$0()), "!identifierLink.isEmpty() && identifierLink.tail.
isEmpty()", "builder.dart", 115, 14); | |
| 8923 if (!(identifierLink.get$head() instanceof Identifier)) { | 8653 if (!(identifierLink.get$head() instanceof Identifier)) { |
| 8924 this.compiler.unimplemented("SsaBuilder.visitParameters non-identifier"); | 8654 this.compiler.unimplemented("SsaBuilder.visitParameters non-identifier"); |
| 8925 } | 8655 } |
| 8926 var parameterId = (($0 = identifierLink.get$head()) && $0.is$Identifier()); | 8656 var parameterId = identifierLink.get$head(); |
| 8927 var element = (($0 = this.elements.$index(parameterId)) && $0.is$Element()); | 8657 var element = this.elements.$index(parameterId); |
| 8928 var parameterInstruction = new HParameter(parameterIndex++); | 8658 var parameterInstruction = new HParameter(parameterIndex++); |
| 8929 this.definitions.$setindex(element, parameterInstruction); | 8659 this.definitions.$setindex(element, parameterInstruction); |
| 8930 this.add(parameterInstruction); | 8660 this.add(parameterInstruction); |
| 8931 } | 8661 } |
| 8932 } | 8662 } |
| 8933 SsaBuilder.prototype.visitBlock = function(node) { | 8663 SsaBuilder.prototype.visitBlock = function(node) { |
| 8934 var $0; | |
| 8935 for (var link = node.statements.nodes; | 8664 for (var link = node.statements.nodes; |
| 8936 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 8665 !link.isEmpty(); link = link.get$tail()) { |
| 8937 this.visit((($0 = link.get$head()) && $0.is$Node())); | 8666 this.visit(link.get$head()); |
| 8938 if ($notnull_bool(this.isAborted())) { | 8667 if (this.isAborted()) { |
| 8939 if (!this.stack.isEmpty()) this.compiler.cancel('non-empty instruction sta
ck'); | 8668 if (!this.stack.isEmpty()) this.compiler.cancel('non-empty instruction sta
ck'); |
| 8940 return; | 8669 return; |
| 8941 } | 8670 } |
| 8942 } | 8671 } |
| 8943 $assert(!$notnull_bool(this.current.isClosed()), "!current.isClosed()", "build
er.dart", 138, 12); | |
| 8944 if (!this.stack.isEmpty()) this.compiler.cancel('non-empty instruction stack')
; | 8672 if (!this.stack.isEmpty()) this.compiler.cancel('non-empty instruction stack')
; |
| 8945 } | 8673 } |
| 8946 SsaBuilder.prototype.visitClassNode = function(node) { | 8674 SsaBuilder.prototype.visitClassNode = function(node) { |
| 8947 this.compiler.unimplemented("SsaBuilder.visitClassNode"); | 8675 this.compiler.unimplemented("SsaBuilder.visitClassNode"); |
| 8948 } | 8676 } |
| 8949 SsaBuilder.prototype.visitExpressionStatement = function(node) { | 8677 SsaBuilder.prototype.visitExpressionStatement = function(node) { |
| 8950 this.visit(node.expression); | 8678 this.visit(node.expression); |
| 8951 this.pop(); | 8679 this.pop(); |
| 8952 } | 8680 } |
| 8953 SsaBuilder.prototype.visitFor = function(node) { | 8681 SsaBuilder.prototype.visitFor = function(node) { |
| 8954 var $this = this; // closure support | 8682 var $this = this; // closure support |
| 8955 $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); | |
| 8956 this.visit(node.initializer); | 8683 this.visit(node.initializer); |
| 8957 $assert(!$notnull_bool(this.isAborted()), "!isAborted()", "builder.dart", 156,
12); | |
| 8958 var initializerBlock = this.close(new HGoto()); | 8684 var initializerBlock = this.close(new HGoto()); |
| 8959 var initializerDefinitions = HashMapImplementation.HashMapImplementation$from$
factory(this.definitions); | 8685 var initializerDefinitions = HashMapImplementation.HashMapImplementation$from$
factory(this.definitions); |
| 8960 var conditionBlock = this.graph.addNewBlock(); | 8686 var conditionBlock = this.graph.addNewBlock(); |
| 8961 conditionBlock.isLoopHeader = true; | 8687 conditionBlock.isLoopHeader = true; |
| 8962 initializerBlock.addSuccessor(conditionBlock); | 8688 initializerBlock.addSuccessor(conditionBlock); |
| 8963 this.open(conditionBlock); | 8689 this.open(conditionBlock); |
| 8964 initializerDefinitions.forEach((function (element, instruction) { | 8690 initializerDefinitions.forEach((function (element, instruction) { |
| 8965 var phi = new HPhi.singleInput$ctor(element, instruction); | 8691 var phi = new HPhi.singleInput$ctor(element, instruction); |
| 8966 conditionBlock.add(phi); | 8692 conditionBlock.add(phi); |
| 8967 $this.definitions.$setindex(element, phi); | 8693 $this.definitions.$setindex(element, phi); |
| 8968 }) | 8694 }) |
| 8969 ); | 8695 ); |
| 8970 this.visit(node.condition.expression); | 8696 this.visit(node.condition.expression); |
| 8971 var conditionExitBlock = this.close(new HLoopBranch(this.pop())); | 8697 var conditionExitBlock = this.close(new HLoopBranch(this.pop())); |
| 8972 var conditionDefinitions = HashMapImplementation.HashMapImplementation$from$fa
ctory(this.definitions); | 8698 var conditionDefinitions = HashMapImplementation.HashMapImplementation$from$fa
ctory(this.definitions); |
| 8973 var bodyBlock = this.graph.addNewBlock(); | 8699 var bodyBlock = this.graph.addNewBlock(); |
| 8974 conditionExitBlock.addSuccessor(bodyBlock); | 8700 conditionExitBlock.addSuccessor(bodyBlock); |
| 8975 this.open(bodyBlock); | 8701 this.open(bodyBlock); |
| 8976 this.visit(node.body); | 8702 this.visit(node.body); |
| 8977 if ($notnull_bool(this.isAborted())) { | 8703 if (this.isAborted()) { |
| 8978 this.compiler.unimplemented("SsaBuilder for loop with aborting body"); | 8704 this.compiler.unimplemented("SsaBuilder for loop with aborting body"); |
| 8979 } | 8705 } |
| 8980 bodyBlock = this.close(new HGoto()); | 8706 bodyBlock = this.close(new HGoto()); |
| 8981 var updateBlock = this.graph.addNewBlock(); | 8707 var updateBlock = this.graph.addNewBlock(); |
| 8982 bodyBlock.addSuccessor(updateBlock); | 8708 bodyBlock.addSuccessor(updateBlock); |
| 8983 this.open(updateBlock); | 8709 this.open(updateBlock); |
| 8984 this.visit(node.update); | 8710 this.visit(node.update); |
| 8985 $assert(!$notnull_bool(this.isAborted()), "!isAborted()", "builder.dart", 195,
12); | |
| 8986 var updateInstruction = this.pop(); | 8711 var updateInstruction = this.pop(); |
| 8987 updateBlock = this.close(new HGoto()); | 8712 updateBlock = this.close(new HGoto()); |
| 8988 updateBlock.addSuccessor(conditionBlock); | 8713 updateBlock.addSuccessor(conditionBlock); |
| 8989 conditionBlock.forEachPhi((function (phi) { | 8714 conditionBlock.forEachPhi((function (phi) { |
| 8990 var $0; | |
| 8991 var element = phi.element; | 8715 var element = phi.element; |
| 8992 var postBodyDefinition = (($0 = $this.definitions.$index(element)) && $0.is$
HInstruction()); | 8716 var postBodyDefinition = $this.definitions.$index(element); |
| 8993 if (postBodyDefinition !== phi) { | 8717 if (postBodyDefinition !== phi) { |
| 8994 phi.addInput(postBodyDefinition); | 8718 phi.addInput(postBodyDefinition); |
| 8995 } | 8719 } |
| 8996 else { | 8720 else { |
| 8997 $assert(phi.inputs.length == 1, "phi.inputs.length == 1", "builder.dart",
212, 16); | 8721 var input = phi.inputs.$index(0); |
| 8998 var input = (($0 = phi.inputs.$index(0)) && $0.is$HInstruction()); | |
| 8999 conditionBlock.rewrite(phi, input); | 8722 conditionBlock.rewrite(phi, input); |
| 9000 conditionBlock.remove(phi); | 8723 conditionBlock.remove(phi); |
| 9001 if (conditionDefinitions.$index(element) === phi) { | 8724 if (conditionDefinitions.$index(element) === phi) { |
| 9002 conditionDefinitions.$setindex(element, input); | 8725 conditionDefinitions.$setindex(element, input); |
| 9003 } | 8726 } |
| 9004 } | 8727 } |
| 9005 }) | 8728 }) |
| 9006 ); | 8729 ); |
| 9007 var loopExitBlock = this.graph.addNewBlock(); | 8730 var loopExitBlock = this.graph.addNewBlock(); |
| 9008 conditionExitBlock.addSuccessor(loopExitBlock); | 8731 conditionExitBlock.addSuccessor(loopExitBlock); |
| 9009 this.open(loopExitBlock); | 8732 this.open(loopExitBlock); |
| 9010 this.definitions = conditionDefinitions; | 8733 this.definitions = conditionDefinitions; |
| 9011 } | 8734 } |
| 9012 SsaBuilder.prototype.visitFunctionExpression = function(node) { | 8735 SsaBuilder.prototype.visitFunctionExpression = function(node) { |
| 9013 this.compiler.unimplemented('SsaBuilder.visitFunctionExpression'); | 8736 this.compiler.unimplemented('SsaBuilder.visitFunctionExpression'); |
| 9014 } | 8737 } |
| 9015 SsaBuilder.prototype.visitIdentifier = function(node) { | 8738 SsaBuilder.prototype.visitIdentifier = function(node) { |
| 9016 var $0; | 8739 var element = this.elements.$index(node); |
| 9017 var element = (($0 = this.elements.$index(node)) && $0.is$Element()); | |
| 9018 this.compiler.ensure(element != null); | 8740 this.compiler.ensure(element != null); |
| 9019 var def = (($0 = this.definitions.$index(element)) && $0.is$HInstruction()); | 8741 var def = this.definitions.$index(element); |
| 9020 $assert(def != null, "def !== null", "builder.dart", 240, 12); | |
| 9021 this.stack.add(def); | 8742 this.stack.add(def); |
| 9022 } | 8743 } |
| 9023 SsaBuilder.prototype.joinDefinitions = function(joinBlock, incoming1, incoming2)
{ | 8744 SsaBuilder.prototype.joinDefinitions = function(joinBlock, incoming1, incoming2)
{ |
| 9024 if (incoming1.get$length() > incoming2.get$length()) { | 8745 if (incoming1.get$length() > incoming2.get$length()) { |
| 9025 return this.joinDefinitions(joinBlock, incoming2, incoming1); | 8746 return this.joinDefinitions(joinBlock, incoming2, incoming1); |
| 9026 } | 8747 } |
| 9027 var joinedDefinitions = new HashMapImplementation(); | 8748 var joinedDefinitions = new HashMapImplementation(); |
| 9028 $assert(incoming1.get$length() <= incoming2.get$length(), "incoming1.length <=
incoming2.length", "builder.dart", 259, 12); | |
| 9029 incoming1.forEach((function (element, instruction) { | 8749 incoming1.forEach((function (element, instruction) { |
| 9030 var $0; | 8750 var other = incoming2.$index(element); |
| 9031 var other = (($0 = incoming2.$index(element)) && $0.is$HInstruction()); | |
| 9032 if (other == null) return; | 8751 if (other == null) return; |
| 9033 if (instruction === other) { | 8752 if (instruction === other) { |
| 9034 joinedDefinitions.$setindex(element, instruction); | 8753 joinedDefinitions.$setindex(element, instruction); |
| 9035 } | 8754 } |
| 9036 else { | 8755 else { |
| 9037 var phi = new HPhi.manyInputs$ctor(element, [instruction, other]); | 8756 var phi = new HPhi.manyInputs$ctor(element, [instruction, other]); |
| 9038 joinBlock.add(phi); | 8757 joinBlock.add(phi); |
| 9039 joinedDefinitions.$setindex(element, phi); | 8758 joinedDefinitions.$setindex(element, phi); |
| 9040 } | 8759 } |
| 9041 }) | 8760 }) |
| 9042 ); | 8761 ); |
| 9043 return joinedDefinitions; | 8762 return joinedDefinitions; |
| 9044 } | 8763 } |
| 9045 SsaBuilder.prototype.visitIf = function(node) { | 8764 SsaBuilder.prototype.visitIf = function(node) { |
| 9046 var hasElse = node.get$hasElsePart(); | 8765 var hasElse = node.get$hasElsePart(); |
| 9047 this.visit(node.condition); | 8766 this.visit(node.condition); |
| 9048 var conditionBlock = this.close(new HIf(this.pop(), hasElse)); | 8767 var conditionBlock = this.close(new HIf(this.pop(), hasElse)); |
| 9049 var conditionDefinitions = HashMapImplementation.HashMapImplementation$from$fa
ctory(this.definitions); | 8768 var conditionDefinitions = HashMapImplementation.HashMapImplementation$from$fa
ctory(this.definitions); |
| 9050 var thenBlock = this.graph.addNewBlock(); | 8769 var thenBlock = this.graph.addNewBlock(); |
| 9051 conditionBlock.addSuccessor(thenBlock); | 8770 conditionBlock.addSuccessor(thenBlock); |
| 9052 this.open(thenBlock); | 8771 this.open(thenBlock); |
| 9053 this.visit(node.thenPart); | 8772 this.visit(node.thenPart); |
| 9054 thenBlock = this.current; | 8773 thenBlock = this.current; |
| 9055 var thenDefinitions = this.definitions; | 8774 var thenDefinitions = this.definitions; |
| 9056 this.definitions = conditionDefinitions; | 8775 this.definitions = conditionDefinitions; |
| 9057 var elseBlock = null; | 8776 var elseBlock = null; |
| 9058 if ($notnull_bool(hasElse)) { | 8777 if (hasElse) { |
| 9059 elseBlock = this.graph.addNewBlock(); | 8778 elseBlock = this.graph.addNewBlock(); |
| 9060 conditionBlock.addSuccessor(elseBlock); | 8779 conditionBlock.addSuccessor(elseBlock); |
| 9061 this.open(elseBlock); | 8780 this.open(elseBlock); |
| 9062 this.visit(node.elsePart); | 8781 this.visit(node.elsePart); |
| 9063 elseBlock = this.current; | 8782 elseBlock = this.current; |
| 9064 } | 8783 } |
| 9065 if (thenBlock == null && elseBlock == null && $notnull_bool(hasElse)) { | 8784 if (thenBlock == null && elseBlock == null && hasElse) { |
| 9066 this.current = null; | 8785 this.current = null; |
| 9067 } | 8786 } |
| 9068 else { | 8787 else { |
| 9069 var joinBlock = this.graph.addNewBlock(); | 8788 var joinBlock = this.graph.addNewBlock(); |
| 9070 if (thenBlock != null) this.goto(thenBlock, joinBlock); | 8789 if (thenBlock != null) this.goto(thenBlock, joinBlock); |
| 9071 if (elseBlock != null) this.goto(elseBlock, joinBlock); | 8790 if (elseBlock != null) this.goto(elseBlock, joinBlock); |
| 9072 else if (!$notnull_bool(hasElse)) conditionBlock.addSuccessor(joinBlock); | 8791 else if (!hasElse) conditionBlock.addSuccessor(joinBlock); |
| 9073 this.open(joinBlock); | 8792 this.open(joinBlock); |
| 9074 if (joinBlock.predecessors.length == 2) { | 8793 if (joinBlock.predecessors.length == 2) { |
| 9075 this.definitions = this.joinDefinitions(joinBlock, this.definitions, thenD
efinitions); | 8794 this.definitions = this.joinDefinitions(joinBlock, this.definitions, thenD
efinitions); |
| 9076 } | 8795 } |
| 9077 } | 8796 } |
| 9078 } | 8797 } |
| 9079 SsaBuilder.prototype.unquote = function(literal) { | 8798 SsaBuilder.prototype.unquote = function(literal) { |
| 9080 var str = ('' + literal.get$value() + ''); | 8799 var str = ('' + literal.get$value() + ''); |
| 9081 this.compiler.ensure(str[0] == '@'); | 8800 this.compiler.ensure(str[0] == '@'); |
| 9082 var quotes = 1; | 8801 var quotes = 1; |
| 9083 var quote = str[1]; | 8802 var quote = str[1]; |
| 9084 while (str[quotes + 1] === quote) quotes++; | 8803 while (str[quotes + 1] === quote) quotes++; |
| 9085 return new StringWrapper(str.substring(quotes + 1, str.length - quotes)); | 8804 return new StringWrapper(str.substring(quotes + 1, str.length - quotes)); |
| 9086 } | 8805 } |
| 9087 SsaBuilder.prototype.visitSend = function(node) { | 8806 SsaBuilder.prototype.visitSend = function(node) { |
| 9088 var $0; | 8807 var element = this.elements.$index(node); |
| 9089 var element = (($0 = this.elements.$index(node)) && $0.is$Element()); | |
| 9090 if ((node.selector instanceof Operator)) { | 8808 if ((node.selector instanceof Operator)) { |
| 9091 this.visit(node.receiver); | 8809 this.visit(node.receiver); |
| 9092 this.visit(node.argumentsNode); | 8810 this.visit(node.argumentsNode); |
| 9093 var right = this.pop(); | 8811 var right = this.pop(); |
| 9094 var left = this.pop(); | 8812 var left = this.pop(); |
| 9095 var op = (($0 = node.selector) && $0.is$Operator()); | 8813 var op = node.selector; |
| 9096 if ($notnull_bool($eq(const$287/*const SourceString("+")*/, op.get$source())
)) { | 8814 if ($eq(const$287/*const SourceString("+")*/, op.get$source())) { |
| 9097 this.push(new HAdd(element, [left, right])); | 8815 this.push(new HAdd(element, [left, right])); |
| 9098 } | 8816 } |
| 9099 else if ($notnull_bool($eq(const$288/*const SourceString("-")*/, op.get$sour
ce()))) { | 8817 else if ($eq(const$288/*const SourceString("-")*/, op.get$source())) { |
| 9100 this.push(new HSubtract(element, [left, right])); | 8818 this.push(new HSubtract(element, [left, right])); |
| 9101 } | 8819 } |
| 9102 else if ($notnull_bool($eq(const$289/*const SourceString("*")*/, op.get$sour
ce()))) { | 8820 else if ($eq(const$289/*const SourceString("*")*/, op.get$source())) { |
| 9103 this.push(new HMultiply(element, [left, right])); | 8821 this.push(new HMultiply(element, [left, right])); |
| 9104 } | 8822 } |
| 9105 else if ($notnull_bool($eq(const$290/*const SourceString("/")*/, op.get$sour
ce()))) { | 8823 else if ($eq(const$290/*const SourceString("/")*/, op.get$source())) { |
| 9106 this.push(new HDivide(element, [left, right])); | 8824 this.push(new HDivide(element, [left, right])); |
| 9107 } | 8825 } |
| 9108 else if ($notnull_bool($eq(const$291/*const SourceString("~/")*/, op.get$sou
rce()))) { | 8826 else if ($eq(const$291/*const SourceString("~/")*/, op.get$source())) { |
| 9109 this.push(new HTruncatingDivide(element, [left, right])); | 8827 this.push(new HTruncatingDivide(element, [left, right])); |
| 9110 } | 8828 } |
| 9111 else if ($notnull_bool($eq(const$292/*const SourceString("==")*/, op.get$sou
rce()))) { | 8829 else if ($eq(const$292/*const SourceString("==")*/, op.get$source())) { |
| 9112 this.push(new HEquals(element, [left, right])); | 8830 this.push(new HEquals(element, [left, right])); |
| 9113 } | 8831 } |
| 9114 } | 8832 } |
| 9115 else if ($notnull_bool(node.get$isPropertyAccess())) { | 8833 else if (node.get$isPropertyAccess()) { |
| 9116 if (node.receiver != null) { | 8834 if (node.receiver != null) { |
| 9117 this.compiler.unimplemented("SsaBuilder.visitSend with receiver"); | 8835 this.compiler.unimplemented("SsaBuilder.visitSend with receiver"); |
| 9118 } | 8836 } |
| 9119 this.stack.add(this.definitions.$index(element)); | 8837 this.stack.add(this.definitions.$index(element)); |
| 9120 } | 8838 } |
| 9121 else { | 8839 else { |
| 9122 var link = node.get$arguments(); | 8840 var link = node.get$arguments(); |
| 9123 if (element.kind === const$242/*ElementKind.FOREIGN*/) { | 8841 if (element.kind === const$242/*ElementKind.FOREIGN*/) { |
| 9124 link = (($0 = link.get$tail()) && $0.is$Link$Node()); | 8842 link = link.get$tail(); |
| 9125 } | 8843 } |
| 9126 var arguments = []; | 8844 var arguments = []; |
| 9127 for (; !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.
is$Link$Node())) { | 8845 for (; !link.isEmpty(); link = link.get$tail()) { |
| 9128 this.visit((($0 = link.get$head()) && $0.is$Node())); | 8846 this.visit(link.get$head()); |
| 9129 arguments.add$1(this.pop()); | 8847 arguments.add$1(this.pop()); |
| 9130 } | 8848 } |
| 9131 if (element.kind === const$242/*ElementKind.FOREIGN*/) { | 8849 if (element.kind === const$242/*ElementKind.FOREIGN*/) { |
| 9132 var literal = (($0 = node.get$arguments().get$head()) && $0.is$LiteralStri
ng()); | 8850 var literal = node.get$arguments().get$head(); |
| 9133 this.compiler.ensure((literal instanceof LiteralString)); | 8851 this.compiler.ensure((literal instanceof LiteralString)); |
| 9134 this.push(new HInvokeForeign(element, arguments, this.unquote(literal))); | 8852 this.push(new HInvokeForeign(element, arguments, this.unquote(literal))); |
| 9135 } | 8853 } |
| 9136 else { | 8854 else { |
| 9137 var selector = (($0 = node.selector) && $0.is$Identifier()); | 8855 var selector = node.selector; |
| 9138 this.push(new HInvoke(element, arguments)); | 8856 this.push(new HInvoke(element, arguments)); |
| 9139 } | 8857 } |
| 9140 } | 8858 } |
| 9141 } | 8859 } |
| 9142 SsaBuilder.prototype.visitSendSet = function(node) { | 8860 SsaBuilder.prototype.visitSendSet = function(node) { |
| 9143 this.stack.add(this.updateDefinition(node)); | 8861 this.stack.add(this.updateDefinition(node)); |
| 9144 } | 8862 } |
| 9145 SsaBuilder.prototype.visitLiteralInt = function(node) { | 8863 SsaBuilder.prototype.visitLiteralInt = function(node) { |
| 9146 this.push(new HLiteral(node.get$value())); | 8864 this.push(new HLiteral(node.get$value())); |
| 9147 } | 8865 } |
| 9148 SsaBuilder.prototype.visitLiteralDouble = function(node) { | 8866 SsaBuilder.prototype.visitLiteralDouble = function(node) { |
| 9149 this.push(new HLiteral(node.get$value())); | 8867 this.push(new HLiteral(node.get$value())); |
| 9150 } | 8868 } |
| 9151 SsaBuilder.prototype.visitLiteralBool = function(node) { | 8869 SsaBuilder.prototype.visitLiteralBool = function(node) { |
| 9152 this.push(new HLiteral(node.get$value())); | 8870 this.push(new HLiteral(node.get$value())); |
| 9153 } | 8871 } |
| 9154 SsaBuilder.prototype.visitLiteralString = function(node) { | 8872 SsaBuilder.prototype.visitLiteralString = function(node) { |
| 9155 this.push(new HLiteral(node.get$value())); | 8873 this.push(new HLiteral(node.get$value())); |
| 9156 } | 8874 } |
| 9157 SsaBuilder.prototype.visitNodeList = function(node) { | 8875 SsaBuilder.prototype.visitNodeList = function(node) { |
| 9158 var $0; | |
| 9159 for (var link = node.nodes; | 8876 for (var link = node.nodes; |
| 9160 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 8877 !link.isEmpty(); link = link.get$tail()) { |
| 9161 this.visit((($0 = link.get$head()) && $0.is$Node())); | 8878 this.visit(link.get$head()); |
| 9162 } | 8879 } |
| 9163 } | 8880 } |
| 9164 SsaBuilder.prototype.visitOperator = function(node) { | 8881 SsaBuilder.prototype.visitOperator = function(node) { |
| 9165 this.compiler.unimplemented("SsaBuilder.visitOperator"); | 8882 this.compiler.unimplemented("SsaBuilder.visitOperator"); |
| 9166 } | 8883 } |
| 9167 SsaBuilder.prototype.visitReturn = function(node) { | 8884 SsaBuilder.prototype.visitReturn = function(node) { |
| 9168 if (node.expression == null) { | 8885 if (node.expression == null) { |
| 9169 this.compiler.unimplemented("SsaBuilder: return without expression"); | 8886 this.compiler.unimplemented("SsaBuilder: return without expression"); |
| 9170 } | 8887 } |
| 9171 this.visit(node.expression); | 8888 this.visit(node.expression); |
| 9172 var value = this.pop(); | 8889 var value = this.pop(); |
| 9173 this.close(new HReturn(value)).addSuccessor(this.graph.exit); | 8890 this.close(new HReturn(value)).addSuccessor(this.graph.exit); |
| 9174 } | 8891 } |
| 9175 SsaBuilder.prototype.visitThrow = function(node) { | 8892 SsaBuilder.prototype.visitThrow = function(node) { |
| 9176 if (node.expression == null) { | 8893 if (node.expression == null) { |
| 9177 this.compiler.unimplemented("SsaBuilder: throw without expression"); | 8894 this.compiler.unimplemented("SsaBuilder: throw without expression"); |
| 9178 } | 8895 } |
| 9179 this.visit(node.expression); | 8896 this.visit(node.expression); |
| 9180 this.close(new HThrow(this.pop())); | 8897 this.close(new HThrow(this.pop())); |
| 9181 } | 8898 } |
| 9182 SsaBuilder.prototype.visitTypeAnnotation = function(node) { | 8899 SsaBuilder.prototype.visitTypeAnnotation = function(node) { |
| 9183 | 8900 |
| 9184 } | 8901 } |
| 9185 SsaBuilder.prototype.updateDefinition = function(node) { | 8902 SsaBuilder.prototype.updateDefinition = function(node) { |
| 9186 var $0; | |
| 9187 if (node.receiver != null) { | 8903 if (node.receiver != null) { |
| 9188 this.compiler.unimplemented("SsaBuilder: property access"); | 8904 this.compiler.unimplemented("SsaBuilder: property access"); |
| 9189 } | 8905 } |
| 9190 var link = node.get$arguments(); | 8906 var link = node.get$arguments(); |
| 9191 $assert(!$notnull_bool(link.isEmpty()) && $notnull_bool(link.get$tail().isEmpt
y$0()), "!link.isEmpty() && link.tail.isEmpty()", "builder.dart", 443, 12); | 8907 this.visit(link.get$head()); |
| 9192 this.visit((($0 = link.get$head()) && $0.is$Node())); | |
| 9193 var value = this.pop(); | 8908 var value = this.pop(); |
| 9194 this.definitions.$setindex(this.elements.$index(node), value); | 8909 this.definitions.$setindex(this.elements.$index(node), value); |
| 9195 return value; | 8910 return value; |
| 9196 } | 8911 } |
| 9197 SsaBuilder.prototype.visitVariableDefinitions = function(node) { | 8912 SsaBuilder.prototype.visitVariableDefinitions = function(node) { |
| 9198 var $0; | |
| 9199 for (var link = node.definitions.nodes; | 8913 for (var link = node.definitions.nodes; |
| 9200 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 8914 !link.isEmpty(); link = link.get$tail()) { |
| 9201 var definition = (($0 = link.get$head()) && $0.is$Node()); | 8915 var definition = link.get$head(); |
| 9202 if ((definition instanceof Identifier)) { | 8916 if ((definition instanceof Identifier)) { |
| 9203 this.compiler.unimplemented("SsaBuilder.visitVariableDefinitions without i
nitial value"); | 8917 this.compiler.unimplemented("SsaBuilder.visitVariableDefinitions without i
nitial value"); |
| 9204 } | 8918 } |
| 9205 else { | 8919 else { |
| 9206 $assert((definition instanceof SendSet), "definition is SendSet", "builder
.dart", 459, 16); | 8920 this.updateDefinition(definition); |
| 9207 this.updateDefinition((definition && definition.is$SendSet())); | |
| 9208 } | 8921 } |
| 9209 } | 8922 } |
| 9210 } | 8923 } |
| 9211 SsaBuilder.prototype.add$1 = function($0) { | 8924 SsaBuilder.prototype.add$1 = function($0) { |
| 9212 return this.add(($0 && $0.is$HInstruction())); | 8925 return this.add($0); |
| 9213 }; | 8926 }; |
| 9214 SsaBuilder.prototype.visit$1 = function($0) { | 8927 SsaBuilder.prototype.visit$1 = function($0) { |
| 9215 return this.visit(($0 && $0.is$Node())); | 8928 return this.visit($0); |
| 9216 }; | 8929 }; |
| 9217 // ********** Code for SsaCodeGeneratorTask ************** | 8930 // ********** Code for SsaCodeGeneratorTask ************** |
| 9218 function SsaCodeGeneratorTask(compiler) { | 8931 function SsaCodeGeneratorTask(compiler) { |
| 9219 CompilerTask.call(this, compiler); | 8932 CompilerTask.call(this, compiler); |
| 9220 // Initializers done | 8933 // Initializers done |
| 9221 } | 8934 } |
| 9222 $inherits(SsaCodeGeneratorTask, CompilerTask); | 8935 $inherits(SsaCodeGeneratorTask, CompilerTask); |
| 9223 SsaCodeGeneratorTask.prototype.get$name = function() { | 8936 SsaCodeGeneratorTask.prototype.get$name = function() { |
| 9224 return 'SSA code generator'; | 8937 return 'SSA code generator'; |
| 9225 } | 8938 } |
| 9226 SsaCodeGeneratorTask.prototype.generate = function(tree, graph) { | 8939 SsaCodeGeneratorTask.prototype.generate = function(tree, graph) { |
| 9227 var $this = this; // closure support | 8940 var $this = this; // closure support |
| 9228 return $assert_String(this.measure((function () { | 8941 return this.measure((function () { |
| 9229 var $0; | 8942 var function_ = tree; |
| 9230 var function_ = (tree && tree.is$FunctionExpression()); | 8943 var name = function_.name; |
| 9231 var name = (($0 = function_.name) && $0.is$Identifier()); | |
| 9232 if (false/*null.GENERATE_SSA_TRACE*/) { | 8944 if (false/*null.GENERATE_SSA_TRACE*/) { |
| 9233 HTracer.HTracer$singleton$factory().traceGraph("codegen", graph); | 8945 HTracer.HTracer$singleton$factory().traceGraph("codegen", graph); |
| 9234 } | 8946 } |
| 9235 var code = $this.generateMethod(name.get$source(), SsaCodeGeneratorTask.coun
tParameters(function_), graph); | 8947 var code = $this.generateMethod(name.get$source(), SsaCodeGeneratorTask.coun
tParameters(function_), graph); |
| 9236 return code; | 8948 return code; |
| 9237 }) | 8949 }) |
| 9238 )); | 8950 ); |
| 9239 } | 8951 } |
| 9240 SsaCodeGeneratorTask.prototype.generateMethod = function(methodName, parameterCo
unt, graph) { | 8952 SsaCodeGeneratorTask.prototype.generateMethod = function(methodName, parameterCo
unt, graph) { |
| 9241 var buffer = new StringBufferImpl(""); | 8953 var buffer = new StringBufferImpl(""); |
| 9242 var codegen = new SsaCodeGenerator(this.compiler, buffer); | 8954 var codegen = new SsaCodeGenerator(this.compiler, buffer); |
| 9243 graph.assignInstructionIds(); | 8955 graph.assignInstructionIds(); |
| 9244 codegen.visitGraph(graph); | 8956 codegen.visitGraph(graph); |
| 9245 var parameters = new StringBufferImpl(""); | 8957 var parameters = new StringBufferImpl(""); |
| 9246 for (var i = 0; | 8958 for (var i = 0; |
| 9247 i < parameterCount; i++) { | 8959 i < parameterCount; i++) { |
| 9248 if (i != 0) parameters.add(', '); | 8960 if (i != 0) parameters.add(', '); |
| 9249 parameters.add(SsaCodeGenerator.parameter(i)); | 8961 parameters.add(SsaCodeGenerator.parameter(i)); |
| 9250 } | 8962 } |
| 9251 return ('function ' + methodName + '(' + parameters + ') {\n' + buffer + '}\n'
); | 8963 return ('function ' + methodName + '(' + parameters + ') {\n' + buffer + '}\n'
); |
| 9252 } | 8964 } |
| 9253 SsaCodeGeneratorTask.countParameters = function(function_) { | 8965 SsaCodeGeneratorTask.countParameters = function(function_) { |
| 9254 var $0; | |
| 9255 var result = 0; | 8966 var result = 0; |
| 9256 for (var link = function_.parameters.nodes; | 8967 for (var link = function_.parameters.nodes; |
| 9257 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 8968 !link.isEmpty(); link = link.get$tail()) { |
| 9258 result++; | 8969 result++; |
| 9259 } | 8970 } |
| 9260 return result; | 8971 return result; |
| 9261 } | 8972 } |
| 9262 // ********** Code for SsaCodeGenerator ************** | 8973 // ********** Code for SsaCodeGenerator ************** |
| 9263 function SsaCodeGenerator(compiler, buffer) { | 8974 function SsaCodeGenerator(compiler, buffer) { |
| 9264 this.indent = 0 | 8975 this.indent = 0 |
| 9265 this.compiler = compiler; | 8976 this.compiler = compiler; |
| 9266 this.buffer = buffer; | 8977 this.buffer = buffer; |
| 9267 // Initializers done | 8978 // Initializers done |
| 9268 } | 8979 } |
| 9269 SsaCodeGenerator.prototype.is$HVisitor = function(){return this;}; | |
| 9270 SsaCodeGenerator.prototype.visitGraph = function(graph) { | 8980 SsaCodeGenerator.prototype.visitGraph = function(graph) { |
| 9271 this.currentGraph = graph; | 8981 this.currentGraph = graph; |
| 9272 this.indent++; | 8982 this.indent++; |
| 9273 this.visitBasicBlock(graph.entry); | 8983 this.visitBasicBlock(graph.entry); |
| 9274 } | 8984 } |
| 9275 SsaCodeGenerator.temporary = function(instruction) { | 8985 SsaCodeGenerator.temporary = function(instruction) { |
| 9276 return ('t' + instruction.id + ''); | 8986 return ('t' + instruction.id + ''); |
| 9277 } | 8987 } |
| 9278 SsaCodeGenerator.parameter = function(index) { | 8988 SsaCodeGenerator.parameter = function(index) { |
| 9279 return ('p' + index + ''); | 8989 return ('p' + index + ''); |
| 9280 } | 8990 } |
| 9281 SsaCodeGenerator.prototype.invoke = function(element, arguments) { | 8991 SsaCodeGenerator.prototype.invoke = function(element, arguments) { |
| 9282 var $0; | |
| 9283 this.buffer.add(('' + element.name + '(')); | 8992 this.buffer.add(('' + element.name + '(')); |
| 9284 for (var i = 0; | 8993 for (var i = 0; |
| 9285 i < arguments.length; i++) { | 8994 i < arguments.length; i++) { |
| 9286 if (i != 0) this.buffer.add(', '); | 8995 if (i != 0) this.buffer.add(', '); |
| 9287 this.use((($0 = arguments.$index(i)) && $0.is$HInstruction())); | 8996 this.use(arguments.$index(i)); |
| 9288 } | 8997 } |
| 9289 this.buffer.add(")"); | 8998 this.buffer.add(")"); |
| 9290 } | 8999 } |
| 9291 SsaCodeGenerator.prototype.define = function(instruction) { | 9000 SsaCodeGenerator.prototype.define = function(instruction) { |
| 9292 var $0; | |
| 9293 var usedBy = instruction.get$usedBy(); | 9001 var usedBy = instruction.get$usedBy(); |
| 9294 if (usedBy.length == 1 && (usedBy.$index(0) instanceof HPhi)) { | 9002 if (usedBy.length == 1 && (usedBy.$index(0) instanceof HPhi)) { |
| 9295 this.buffer.add(('var ' + SsaCodeGenerator.temporary((($0 = usedBy.$index(0)
) && $0.is$HInstruction())) + ' = ')); | 9003 this.buffer.add(('var ' + SsaCodeGenerator.temporary(usedBy.$index(0)) + ' =
')); |
| 9296 this.visit(instruction); | 9004 this.visit(instruction); |
| 9297 } | 9005 } |
| 9298 else { | 9006 else { |
| 9299 var instructionId = SsaCodeGenerator.temporary(instruction); | 9007 var instructionId = SsaCodeGenerator.temporary(instruction); |
| 9300 this.buffer.add(('var ' + instructionId + ' = ')); | 9008 this.buffer.add(('var ' + instructionId + ' = ')); |
| 9301 this.visit(instruction); | 9009 this.visit(instruction); |
| 9302 for (var i = 0; | 9010 for (var i = 0; |
| 9303 i < usedBy.length; i++) { | 9011 i < usedBy.length; i++) { |
| 9304 if ((usedBy.$index(i) instanceof HPhi)) { | 9012 if ((usedBy.$index(i) instanceof HPhi)) { |
| 9305 this.buffer.add(';\n'); | 9013 this.buffer.add(';\n'); |
| 9306 this.addIndentation(); | 9014 this.addIndentation(); |
| 9307 this.buffer.add(('var ' + SsaCodeGenerator.temporary((($0 = usedBy.$inde
x(i)) && $0.is$HInstruction())) + ' = ' + instructionId + '')); | 9015 this.buffer.add(('var ' + SsaCodeGenerator.temporary(usedBy.$index(i)) +
' = ' + instructionId + '')); |
| 9308 } | 9016 } |
| 9309 } | 9017 } |
| 9310 } | 9018 } |
| 9311 } | 9019 } |
| 9312 SsaCodeGenerator.prototype.use = function(argument) { | 9020 SsaCodeGenerator.prototype.use = function(argument) { |
| 9313 if ($notnull_bool(argument.generateAtUseSite())) { | 9021 if (argument.generateAtUseSite()) { |
| 9314 this.visit(argument); | 9022 this.visit(argument); |
| 9315 } | 9023 } |
| 9316 else { | 9024 else { |
| 9317 this.buffer.add(SsaCodeGenerator.temporary(argument)); | 9025 this.buffer.add(SsaCodeGenerator.temporary(argument)); |
| 9318 } | 9026 } |
| 9319 } | 9027 } |
| 9320 SsaCodeGenerator.prototype.visit = function(node) { | 9028 SsaCodeGenerator.prototype.visit = function(node) { |
| 9321 return node.accept$1(this); | 9029 return node.accept$1(this); |
| 9322 } | 9030 } |
| 9323 SsaCodeGenerator.prototype.visitBasicBlock = function(node) { | 9031 SsaCodeGenerator.prototype.visitBasicBlock = function(node) { |
| 9324 if ($notnull_bool(node.isLoopHeader)) { | 9032 if (node.isLoopHeader) { |
| 9325 this.buffer.add('while(true) {\n'); | 9033 this.buffer.add('while(true) {\n'); |
| 9326 this.indent++; | 9034 this.indent++; |
| 9327 } | 9035 } |
| 9328 this.currentBlock = node; | 9036 this.currentBlock = node; |
| 9329 var instruction = node.first; | 9037 var instruction = node.first; |
| 9330 while (instruction != null) { | 9038 while (instruction != null) { |
| 9331 if (!$notnull_bool(instruction.generateAtUseSite())) { | 9039 if (!instruction.generateAtUseSite()) { |
| 9332 this.addIndentation(); | 9040 this.addIndentation(); |
| 9333 if (instruction.get$usedBy().isEmpty() || (instruction instanceof HPhi)) { | 9041 if (instruction.get$usedBy().isEmpty() || (instruction instanceof HPhi)) { |
| 9334 this.visit(instruction); | 9042 this.visit(instruction); |
| 9335 } | 9043 } |
| 9336 else { | 9044 else { |
| 9337 this.define(instruction); | 9045 this.define(instruction); |
| 9338 } | 9046 } |
| 9339 this.buffer.add(';\n'); | 9047 this.buffer.add(';\n'); |
| 9340 } | 9048 } |
| 9341 instruction = instruction.next; | 9049 instruction = instruction.next; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 9356 SsaCodeGenerator.prototype.visitSubtract = function(node) { | 9064 SsaCodeGenerator.prototype.visitSubtract = function(node) { |
| 9357 return this.visitInvoke(node); | 9065 return this.visitInvoke(node); |
| 9358 } | 9066 } |
| 9359 SsaCodeGenerator.prototype.visitTruncatingDivide = function(node) { | 9067 SsaCodeGenerator.prototype.visitTruncatingDivide = function(node) { |
| 9360 return this.visitInvoke(node); | 9068 return this.visitInvoke(node); |
| 9361 } | 9069 } |
| 9362 SsaCodeGenerator.prototype.visitExit = function(node) { | 9070 SsaCodeGenerator.prototype.visitExit = function(node) { |
| 9363 | 9071 |
| 9364 } | 9072 } |
| 9365 SsaCodeGenerator.prototype.visitGoto = function(node) { | 9073 SsaCodeGenerator.prototype.visitGoto = function(node) { |
| 9366 var $0; | |
| 9367 $assert(this.currentBlock.successors.length == 1, "currentBlock.successors.len
gth == 1", "codegen.dart", 150, 12); | |
| 9368 var dominated = this.currentBlock.dominatedBlocks; | 9074 var dominated = this.currentBlock.dominatedBlocks; |
| 9369 if (dominated.isEmpty()) return; | 9075 if (dominated.isEmpty()) return; |
| 9370 if (dominated.length > 2) unreachable(); | 9076 if (dominated.length > 2) unreachable(); |
| 9371 if (dominated.length == 2 && this.currentBlock !== this.currentGraph.entry) { | 9077 if (dominated.length == 2 && this.currentBlock !== this.currentGraph.entry) { |
| 9372 unreachable(); | 9078 unreachable(); |
| 9373 } | 9079 } |
| 9374 $assert($eq(dominated.$index(0), this.currentBlock.successors.$index(0)), "dom
inated[0] == currentBlock.successors[0]", "codegen.dart", 162, 12); | 9080 this.visitBasicBlock(dominated.$index(0)); |
| 9375 this.visitBasicBlock((($0 = dominated.$index(0)) && $0.is$HBasicBlock())); | |
| 9376 } | 9081 } |
| 9377 SsaCodeGenerator.prototype.visitIf = function(node) { | 9082 SsaCodeGenerator.prototype.visitIf = function(node) { |
| 9378 var $0; | |
| 9379 var ifBlock = this.currentBlock; | 9083 var ifBlock = this.currentBlock; |
| 9380 this.buffer.add('if ('); | 9084 this.buffer.add('if ('); |
| 9381 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); | 9085 this.use(node.inputs.$index(0)); |
| 9382 this.buffer.add(') {\n'); | 9086 this.buffer.add(') {\n'); |
| 9383 this.indent++; | 9087 this.indent++; |
| 9384 var dominated = this.currentBlock.dominatedBlocks; | 9088 var dominated = this.currentBlock.dominatedBlocks; |
| 9385 $assert(dominated.$index(0) === ifBlock.successors.$index(0), "dominated[0] ==
= ifBlock.successors[0]", "codegen.dart", 175, 12); | 9089 this.visitBasicBlock(ifBlock.successors.$index(0)); |
| 9386 this.visitBasicBlock((($0 = ifBlock.successors.$index(0)) && $0.is$HBasicBlock
())); | |
| 9387 this.indent--; | 9090 this.indent--; |
| 9388 this.addIndentation(); | 9091 this.addIndentation(); |
| 9389 var nextDominatedIndex; | 9092 var nextDominatedIndex; |
| 9390 if ($notnull_bool(node.hasElse)) { | 9093 if (node.hasElse) { |
| 9391 $assert(dominated.$index(1) === ifBlock.successors.$index(1), "dominated[1]
=== ifBlock.successors[1]", "codegen.dart", 181, 14); | |
| 9392 this.buffer.add('} else {\n'); | 9094 this.buffer.add('} else {\n'); |
| 9393 this.indent++; | 9095 this.indent++; |
| 9394 this.visitBasicBlock((($0 = ifBlock.successors.$index(1)) && $0.is$HBasicBlo
ck())); | 9096 this.visitBasicBlock(ifBlock.successors.$index(1)); |
| 9395 this.indent--; | 9097 this.indent--; |
| 9396 nextDominatedIndex = 2; | 9098 nextDominatedIndex = 2; |
| 9397 this.addIndentation(); | 9099 this.addIndentation(); |
| 9398 this.buffer.add("}\n"); | 9100 this.buffer.add("}\n"); |
| 9399 } | 9101 } |
| 9400 else { | 9102 else { |
| 9401 this.buffer.add("}\n"); | 9103 this.buffer.add("}\n"); |
| 9402 nextDominatedIndex = 1; | 9104 nextDominatedIndex = 1; |
| 9403 } | 9105 } |
| 9404 $assert(dominated.length <= nextDominatedIndex + 1, "dominated.length <= nextD
ominatedIndex + 1", "codegen.dart", 193, 12); | |
| 9405 if (dominated.length == nextDominatedIndex + 1) { | 9106 if (dominated.length == nextDominatedIndex + 1) { |
| 9406 this.visitBasicBlock((($0 = dominated.$index(nextDominatedIndex)) && $0.is$H
BasicBlock())); | 9107 this.visitBasicBlock(dominated.$index(nextDominatedIndex)); |
| 9407 } | 9108 } |
| 9408 } | 9109 } |
| 9409 SsaCodeGenerator.prototype.visitInvoke = function(node) { | 9110 SsaCodeGenerator.prototype.visitInvoke = function(node) { |
| 9410 this.compiler.worklist.add(node.element); | 9111 this.compiler.worklist.add(node.element); |
| 9411 this.invoke(node.element, node.inputs); | 9112 this.invoke(node.element, node.inputs); |
| 9412 } | 9113 } |
| 9413 SsaCodeGenerator.prototype.visitInvokeForeign = function(node) { | 9114 SsaCodeGenerator.prototype.visitInvokeForeign = function(node) { |
| 9414 var $0; | |
| 9415 if (!node.inputs.isEmpty()) { | 9115 if (!node.inputs.isEmpty()) { |
| 9416 this.buffer.add("(function foreign(\$0"); | 9116 this.buffer.add("(function foreign(\$0"); |
| 9417 for (var i = 1; | 9117 for (var i = 1; |
| 9418 i < node.inputs.length; i++) { | 9118 i < node.inputs.length; i++) { |
| 9419 this.buffer.add((', \$' + i + '')); | 9119 this.buffer.add((', \$' + i + '')); |
| 9420 } | 9120 } |
| 9421 this.buffer.add(') { return '); | 9121 this.buffer.add(') { return '); |
| 9422 } | 9122 } |
| 9423 this.buffer.add(node.code); | 9123 this.buffer.add(node.code); |
| 9424 if (!node.inputs.isEmpty()) { | 9124 if (!node.inputs.isEmpty()) { |
| 9425 this.buffer.add('; }) ('); | 9125 this.buffer.add('; }) ('); |
| 9426 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); | 9126 this.use(node.inputs.$index(0)); |
| 9427 for (var i = 1; | 9127 for (var i = 1; |
| 9428 i < node.inputs.length; i++) { | 9128 i < node.inputs.length; i++) { |
| 9429 this.buffer.add(', '); | 9129 this.buffer.add(', '); |
| 9430 this.use((($0 = node.inputs.$index(1)) && $0.is$HInstruction())); | 9130 this.use(node.inputs.$index(1)); |
| 9431 } | 9131 } |
| 9432 this.buffer.add(')'); | 9132 this.buffer.add(')'); |
| 9433 } | 9133 } |
| 9434 } | 9134 } |
| 9435 SsaCodeGenerator.prototype.visitLiteral = function(node) { | 9135 SsaCodeGenerator.prototype.visitLiteral = function(node) { |
| 9436 this.buffer.add(node.value); | 9136 this.buffer.add(node.value); |
| 9437 } | 9137 } |
| 9438 SsaCodeGenerator.prototype.visitLoopBranch = function(node) { | 9138 SsaCodeGenerator.prototype.visitLoopBranch = function(node) { |
| 9439 var $0; | |
| 9440 var branchBlock = this.currentBlock; | 9139 var branchBlock = this.currentBlock; |
| 9441 this.buffer.add('if (!('); | 9140 this.buffer.add('if (!('); |
| 9442 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); | 9141 this.use(node.inputs.$index(0)); |
| 9443 this.buffer.add(')) break;\n'); | 9142 this.buffer.add(')) break;\n'); |
| 9444 var dominated = this.currentBlock.dominatedBlocks; | 9143 var dominated = this.currentBlock.dominatedBlocks; |
| 9445 $assert(dominated.length == 2, "dominated.length == 2", "codegen.dart", 238, 1
2); | |
| 9446 $assert(dominated.$index(0) === branchBlock.successors.$index(0), "dominated[0
] === branchBlock.successors[0]", "codegen.dart", 239, 12); | |
| 9447 this.visit(dominated.$index(0)); | 9144 this.visit(dominated.$index(0)); |
| 9448 this.indent--; | 9145 this.indent--; |
| 9449 this.addIndentation(); | 9146 this.addIndentation(); |
| 9450 this.buffer.add('}\n'); | 9147 this.buffer.add('}\n'); |
| 9451 $assert(dominated.$index(1) === branchBlock.successors.$index(1), "dominated[1
] === branchBlock.successors[1]", "codegen.dart", 244, 12); | |
| 9452 this.visit(dominated.$index(1)); | 9148 this.visit(dominated.$index(1)); |
| 9453 } | 9149 } |
| 9454 SsaCodeGenerator.prototype.visitParameter = function(node) { | 9150 SsaCodeGenerator.prototype.visitParameter = function(node) { |
| 9455 this.buffer.add(SsaCodeGenerator.parameter(node.parameterIndex)); | 9151 this.buffer.add(SsaCodeGenerator.parameter(node.parameterIndex)); |
| 9456 } | 9152 } |
| 9457 SsaCodeGenerator.prototype.visitPhi = function(node) { | 9153 SsaCodeGenerator.prototype.visitPhi = function(node) { |
| 9458 var $0; | |
| 9459 var usedBy = node.get$usedBy(); | 9154 var usedBy = node.get$usedBy(); |
| 9460 var firstPhi = true; | 9155 var firstPhi = true; |
| 9461 for (var i = 0; | 9156 for (var i = 0; |
| 9462 i < usedBy.length; i++) { | 9157 i < usedBy.length; i++) { |
| 9463 if ((usedBy.$index(i) instanceof HPhi)) { | 9158 if ((usedBy.$index(i) instanceof HPhi)) { |
| 9464 if (!$notnull_bool(firstPhi)) { | 9159 if (!firstPhi) { |
| 9465 this.buffer.add(";\n"); | 9160 this.buffer.add(";\n"); |
| 9466 this.addIndentation(); | 9161 this.addIndentation(); |
| 9467 } | 9162 } |
| 9468 this.buffer.add(("var " + SsaCodeGenerator.temporary((($0 = usedBy.$index(
i)) && $0.is$HInstruction())) + " = " + SsaCodeGenerator.temporary(node) + "")); | 9163 this.buffer.add(("var " + SsaCodeGenerator.temporary(usedBy.$index(i)) + "
= " + SsaCodeGenerator.temporary(node) + "")); |
| 9469 firstPhi = false; | 9164 firstPhi = false; |
| 9470 } | 9165 } |
| 9471 } | 9166 } |
| 9472 } | 9167 } |
| 9473 SsaCodeGenerator.prototype.visitReturn = function(node) { | 9168 SsaCodeGenerator.prototype.visitReturn = function(node) { |
| 9474 var $0; | |
| 9475 this.buffer.add('return '); | 9169 this.buffer.add('return '); |
| 9476 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); | 9170 this.use(node.inputs.$index(0)); |
| 9477 } | 9171 } |
| 9478 SsaCodeGenerator.prototype.visitThrow = function(node) { | 9172 SsaCodeGenerator.prototype.visitThrow = function(node) { |
| 9479 var $0; | |
| 9480 this.buffer.add('throw '); | 9173 this.buffer.add('throw '); |
| 9481 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); | 9174 this.use(node.inputs.$index(0)); |
| 9482 } | 9175 } |
| 9483 SsaCodeGenerator.prototype.addIndentation = function() { | 9176 SsaCodeGenerator.prototype.addIndentation = function() { |
| 9484 for (var i = 0; | 9177 for (var i = 0; |
| 9485 i < this.indent; i++) { | 9178 i < this.indent; i++) { |
| 9486 this.buffer.add(' '); | 9179 this.buffer.add(' '); |
| 9487 } | 9180 } |
| 9488 } | 9181 } |
| 9489 SsaCodeGenerator.prototype.visit$1 = SsaCodeGenerator.prototype.visit; | 9182 SsaCodeGenerator.prototype.visit$1 = function($0) { |
| 9183 return this.visit($0); |
| 9184 }; |
| 9490 // ********** Code for HGraphVisitor ************** | 9185 // ********** Code for HGraphVisitor ************** |
| 9491 function HGraphVisitor() { | 9186 function HGraphVisitor() { |
| 9492 // Initializers done | 9187 // Initializers done |
| 9493 } | 9188 } |
| 9494 HGraphVisitor.prototype.visitDominatorTree = function(graph) { | 9189 HGraphVisitor.prototype.visitDominatorTree = function(graph) { |
| 9495 var $this = this; // closure support | 9190 var $this = this; // closure support |
| 9496 function visitBasicBlockAndSuccessors(block) { | 9191 function visitBasicBlockAndSuccessors(block) { |
| 9497 var $0; | |
| 9498 $this.visitBasicBlock(block); | 9192 $this.visitBasicBlock(block); |
| 9499 var dominated = block.dominatedBlocks; | 9193 var dominated = block.dominatedBlocks; |
| 9500 for (var i = 0; | 9194 for (var i = 0; |
| 9501 i < dominated.length; i++) { | 9195 i < dominated.length; i++) { |
| 9502 visitBasicBlockAndSuccessors((($0 = dominated.$index(i)) && $0.is$HBasicBl
ock())); | 9196 visitBasicBlockAndSuccessors(dominated.$index(i)); |
| 9503 } | 9197 } |
| 9504 } | 9198 } |
| 9505 visitBasicBlockAndSuccessors(graph.entry); | 9199 visitBasicBlockAndSuccessors(graph.entry); |
| 9506 } | 9200 } |
| 9507 HGraphVisitor.prototype.visitPostDominatorTree = function(graph) { | 9201 HGraphVisitor.prototype.visitPostDominatorTree = function(graph) { |
| 9508 var $this = this; // closure support | 9202 var $this = this; // closure support |
| 9509 function visitBasicBlockAndSuccessors(block) { | 9203 function visitBasicBlockAndSuccessors(block) { |
| 9510 var $0; | |
| 9511 var dominated = block.dominatedBlocks; | 9204 var dominated = block.dominatedBlocks; |
| 9512 for (var i = dominated.length - 1; | 9205 for (var i = dominated.length - 1; |
| 9513 i >= 0; i--) { | 9206 i >= 0; i--) { |
| 9514 visitBasicBlockAndSuccessors((($0 = dominated.$index(i)) && $0.is$HBasicBl
ock())); | 9207 visitBasicBlockAndSuccessors(dominated.$index(i)); |
| 9515 } | 9208 } |
| 9516 $this.visitBasicBlock(block); | 9209 $this.visitBasicBlock(block); |
| 9517 } | 9210 } |
| 9518 visitBasicBlockAndSuccessors(graph.entry); | 9211 visitBasicBlockAndSuccessors(graph.entry); |
| 9519 } | 9212 } |
| 9520 // ********** Code for HInstructionVisitor ************** | 9213 // ********** Code for HInstructionVisitor ************** |
| 9521 function HInstructionVisitor() { | 9214 function HInstructionVisitor() { |
| 9522 HGraphVisitor.call(this); | 9215 HGraphVisitor.call(this); |
| 9523 // Initializers done | 9216 // Initializers done |
| 9524 } | 9217 } |
| 9525 $inherits(HInstructionVisitor, HGraphVisitor); | 9218 $inherits(HInstructionVisitor, HGraphVisitor); |
| 9526 HInstructionVisitor.prototype.visitBasicBlock = function(node) { | 9219 HInstructionVisitor.prototype.visitBasicBlock = function(node) { |
| 9527 this.currentBlock = node; | 9220 this.currentBlock = node; |
| 9528 var instruction = node.first; | 9221 var instruction = node.first; |
| 9529 while (instruction != null) { | 9222 while (instruction != null) { |
| 9530 this.visitInstruction(instruction); | 9223 this.visitInstruction(instruction); |
| 9531 instruction = instruction.next; | 9224 instruction = instruction.next; |
| 9532 } | 9225 } |
| 9533 } | 9226 } |
| 9534 // ********** Code for HGraph ************** | 9227 // ********** Code for HGraph ************** |
| 9535 function HGraph() { | 9228 function HGraph() { |
| 9536 this.blocks = new ListFactory(); | 9229 this.blocks = new ListFactory(); |
| 9537 // Initializers done | 9230 // Initializers done |
| 9538 this.entry = this.addNewBlock(); | 9231 this.entry = this.addNewBlock(); |
| 9539 this.exit = new HBasicBlock(); | 9232 this.exit = new HBasicBlock(); |
| 9540 } | 9233 } |
| 9541 HGraph.prototype.is$HGraph = function(){return this;}; | |
| 9542 HGraph.prototype.addBlock = function(block) { | 9234 HGraph.prototype.addBlock = function(block) { |
| 9543 var id = this.blocks.length; | 9235 var id = this.blocks.length; |
| 9544 block.id = id; | 9236 block.id = id; |
| 9545 this.blocks.add(block); | 9237 this.blocks.add(block); |
| 9546 $assert(this.blocks.$index(id) === block, "blocks[id] === block", "nodes.dart"
, 85, 12); | |
| 9547 } | 9238 } |
| 9548 HGraph.prototype.addNewBlock = function() { | 9239 HGraph.prototype.addNewBlock = function() { |
| 9549 var result = new HBasicBlock(); | 9240 var result = new HBasicBlock(); |
| 9550 this.addBlock(result); | 9241 this.addBlock(result); |
| 9551 return result; | 9242 return result; |
| 9552 } | 9243 } |
| 9553 HGraph.prototype.finalize = function() { | 9244 HGraph.prototype.finalize = function() { |
| 9554 this.addBlock(this.exit); | 9245 this.addBlock(this.exit); |
| 9555 this.exit.open(); | 9246 this.exit.open(); |
| 9556 this.exit.close(new HExit()); | 9247 this.exit.close(new HExit()); |
| 9557 this.assignDominators(); | 9248 this.assignDominators(); |
| 9558 } | 9249 } |
| 9559 HGraph.prototype.assignDominators = function() { | 9250 HGraph.prototype.assignDominators = function() { |
| 9560 var $0; | |
| 9561 for (var i = 0, length = this.blocks.length; | 9251 for (var i = 0, length = this.blocks.length; |
| 9562 i < length; i++) { | 9252 i < length; i++) { |
| 9563 var block = (($0 = this.blocks.$index(i)) && $0.is$HBasicBlock()); | 9253 var block = this.blocks.$index(i); |
| 9564 var predecessors = block.predecessors; | 9254 var predecessors = block.predecessors; |
| 9565 if ($notnull_bool(block.isLoopHeader)) { | 9255 if (block.isLoopHeader) { |
| 9566 $assert(predecessors.length >= 2, "predecessors.length >= 2", "nodes.dart"
, 109, 16); | 9256 block.assignCommonDominator(predecessors.$index(0)); |
| 9567 block.assignCommonDominator((($0 = predecessors.$index(0)) && $0.is$HBasic
Block())); | |
| 9568 } | 9257 } |
| 9569 else { | 9258 else { |
| 9570 for (var j = predecessors.length - 1; | 9259 for (var j = predecessors.length - 1; |
| 9571 j >= 0; j--) { | 9260 j >= 0; j--) { |
| 9572 block.assignCommonDominator((($0 = predecessors.$index(j)) && $0.is$HBas
icBlock())); | 9261 block.assignCommonDominator(predecessors.$index(j)); |
| 9573 } | 9262 } |
| 9574 } | 9263 } |
| 9575 } | 9264 } |
| 9576 } | 9265 } |
| 9577 HGraph.prototype.assignInstructionIds = function() { | 9266 HGraph.prototype.assignInstructionIds = function() { |
| 9578 function handleDominatorTree(root, id) { | 9267 function handleDominatorTree(root, id) { |
| 9579 var $0; | |
| 9580 id = root.assignInstructionIds(id); | 9268 id = root.assignInstructionIds(id); |
| 9581 var dominatedBlocks = root.dominatedBlocks; | 9269 var dominatedBlocks = root.dominatedBlocks; |
| 9582 for (var i = 0, length = dominatedBlocks.length; | 9270 for (var i = 0, length = dominatedBlocks.length; |
| 9583 i < length; i++) { | 9271 i < length; i++) { |
| 9584 id = handleDominatorTree((($0 = dominatedBlocks.$index(i)) && $0.is$HBasic
Block()), id); | 9272 id = handleDominatorTree(dominatedBlocks.$index(i), id); |
| 9585 } | 9273 } |
| 9586 return id; | 9274 return id; |
| 9587 } | 9275 } |
| 9588 handleDominatorTree(this.entry, 0); | 9276 handleDominatorTree(this.entry, 0); |
| 9589 } | 9277 } |
| 9590 HGraph.prototype.isValid = function() { | 9278 HGraph.prototype.isValid = function() { |
| 9591 var validator = new HValidator(); | 9279 var validator = new HValidator(); |
| 9592 validator.visitGraph(this); | 9280 validator.visitGraph(this); |
| 9593 return validator.isValid; | 9281 return validator.isValid; |
| 9594 } | 9282 } |
| 9595 // ********** Code for HBaseVisitor ************** | 9283 // ********** Code for HBaseVisitor ************** |
| 9596 function HBaseVisitor() { | 9284 function HBaseVisitor() { |
| 9597 HGraphVisitor.call(this); | 9285 HGraphVisitor.call(this); |
| 9598 // Initializers done | 9286 // Initializers done |
| 9599 } | 9287 } |
| 9600 $inherits(HBaseVisitor, HGraphVisitor); | 9288 $inherits(HBaseVisitor, HGraphVisitor); |
| 9601 HBaseVisitor.prototype.is$HVisitor = function(){return this;}; | |
| 9602 HBaseVisitor.prototype.visitBasicBlock = function(node) { | 9289 HBaseVisitor.prototype.visitBasicBlock = function(node) { |
| 9603 this.currentBlock = node; | 9290 this.currentBlock = node; |
| 9604 var instruction = node.first; | 9291 var instruction = node.first; |
| 9605 while (instruction != null) { | 9292 while (instruction != null) { |
| 9606 instruction.accept(this); | 9293 instruction.accept(this); |
| 9607 instruction = instruction.next; | 9294 instruction = instruction.next; |
| 9608 } | 9295 } |
| 9609 } | 9296 } |
| 9610 HBaseVisitor.prototype.visitInstruction = function(HInstruction) { | 9297 HBaseVisitor.prototype.visitInstruction = function(HInstruction) { |
| 9611 | 9298 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9670 HBaseVisitor.prototype.visitTruncatingDivide = function(node) { | 9357 HBaseVisitor.prototype.visitTruncatingDivide = function(node) { |
| 9671 return this.visitArithmetic(node); | 9358 return this.visitArithmetic(node); |
| 9672 } | 9359 } |
| 9673 // ********** Code for HInstructionList ************** | 9360 // ********** Code for HInstructionList ************** |
| 9674 function HInstructionList() {} | 9361 function HInstructionList() {} |
| 9675 HInstructionList.prototype.isEmpty = function() { | 9362 HInstructionList.prototype.isEmpty = function() { |
| 9676 return this.first == null; | 9363 return this.first == null; |
| 9677 } | 9364 } |
| 9678 HInstructionList.prototype.addAfter = function(cursor, instruction) { | 9365 HInstructionList.prototype.addAfter = function(cursor, instruction) { |
| 9679 if (cursor == null) { | 9366 if (cursor == null) { |
| 9680 $assert(this.isEmpty(), "isEmpty()", "nodes.dart", 185, 14); | |
| 9681 this.first = this.last = instruction; | 9367 this.first = this.last = instruction; |
| 9682 } | 9368 } |
| 9683 else if (cursor === this.last) { | 9369 else if (cursor === this.last) { |
| 9684 this.last.next = instruction; | 9370 this.last.next = instruction; |
| 9685 instruction.previous = this.last; | 9371 instruction.previous = this.last; |
| 9686 this.last = instruction; | 9372 this.last = instruction; |
| 9687 } | 9373 } |
| 9688 else { | 9374 else { |
| 9689 instruction.previous = cursor; | 9375 instruction.previous = cursor; |
| 9690 instruction.next = cursor.next; | 9376 instruction.next = cursor.next; |
| 9691 cursor.next.previous = instruction; | 9377 cursor.next.previous = instruction; |
| 9692 cursor.next = instruction; | 9378 cursor.next = instruction; |
| 9693 } | 9379 } |
| 9694 instruction.notifyAddedToBlock(); | 9380 instruction.notifyAddedToBlock(); |
| 9695 } | 9381 } |
| 9696 HInstructionList.prototype.remove = function(instruction) { | 9382 HInstructionList.prototype.remove = function(instruction) { |
| 9697 $assert(this.contains(instruction), "contains(instruction)", "nodes.dart", 201
, 12); | |
| 9698 $assert(instruction.isInBasicBlock(), "instruction.isInBasicBlock()", "nodes.d
art", 202, 12); | |
| 9699 $assert(instruction.get$usedBy().isEmpty(), "instruction.usedBy.isEmpty()", "n
odes.dart", 203, 12); | |
| 9700 if (instruction.previous == null) { | 9383 if (instruction.previous == null) { |
| 9701 this.first = instruction.next; | 9384 this.first = instruction.next; |
| 9702 } | 9385 } |
| 9703 else { | 9386 else { |
| 9704 instruction.previous.next = instruction.next; | 9387 instruction.previous.next = instruction.next; |
| 9705 } | 9388 } |
| 9706 if (instruction.next == null) { | 9389 if (instruction.next == null) { |
| 9707 this.last = instruction.previous; | 9390 this.last = instruction.previous; |
| 9708 } | 9391 } |
| 9709 else { | 9392 else { |
| 9710 instruction.next.previous = instruction.previous; | 9393 instruction.next.previous = instruction.previous; |
| 9711 } | 9394 } |
| 9712 instruction.notifyRemovedFromBlock(); | 9395 instruction.notifyRemovedFromBlock(); |
| 9713 } | 9396 } |
| 9714 HInstructionList.prototype.contains = function(instruction) { | 9397 HInstructionList.prototype.contains = function(instruction) { |
| 9715 var cursor = this.first; | 9398 var cursor = this.first; |
| 9716 while (cursor != null) { | 9399 while (cursor != null) { |
| 9717 if (cursor === instruction) return true; | 9400 if (cursor === instruction) return true; |
| 9718 cursor = cursor.next; | 9401 cursor = cursor.next; |
| 9719 } | 9402 } |
| 9720 return false; | 9403 return false; |
| 9721 } | 9404 } |
| 9722 HInstructionList.prototype.contains$1 = function($0) { | 9405 HInstructionList.prototype.contains$1 = function($0) { |
| 9723 return this.contains(($0 && $0.is$HInstruction())); | 9406 return this.contains($0); |
| 9724 }; | 9407 }; |
| 9725 HInstructionList.prototype.isEmpty$0 = function() { | 9408 HInstructionList.prototype.isEmpty$0 = function() { |
| 9726 return this.isEmpty(); | 9409 return this.isEmpty(); |
| 9727 }; | 9410 }; |
| 9728 HInstructionList.prototype.last$0 = function() { | 9411 HInstructionList.prototype.last$0 = function() { |
| 9729 return this.last(); | 9412 return this.last(); |
| 9730 }; | 9413 }; |
| 9731 // ********** Code for HBasicBlock ************** | 9414 // ********** Code for HBasicBlock ************** |
| 9732 function HBasicBlock() { | 9415 function HBasicBlock() { |
| 9733 this.status = 0/*HBasicBlock.STATUS_NEW*/ | 9416 this.status = 0/*HBasicBlock.STATUS_NEW*/ |
| 9734 this.isLoopHeader = false | 9417 this.isLoopHeader = false |
| 9735 this.dominator = null | 9418 this.dominator = null |
| 9736 HBasicBlock.withId$ctor.call(this, null); | 9419 HBasicBlock.withId$ctor.call(this, null); |
| 9737 // Initializers done | 9420 // Initializers done |
| 9738 } | 9421 } |
| 9739 HBasicBlock.withId$ctor = function(id) { | 9422 HBasicBlock.withId$ctor = function(id) { |
| 9740 this.status = 0/*HBasicBlock.STATUS_NEW*/ | 9423 this.status = 0/*HBasicBlock.STATUS_NEW*/ |
| 9741 this.isLoopHeader = false | 9424 this.isLoopHeader = false |
| 9742 this.dominator = null | 9425 this.dominator = null |
| 9743 this.id = id; | 9426 this.id = id; |
| 9744 this.predecessors = []; | 9427 this.predecessors = []; |
| 9745 this.successors = const$13/*const []*/; | 9428 this.successors = const$13/*const []*/; |
| 9746 this.dominatedBlocks = []; | 9429 this.dominatedBlocks = []; |
| 9747 // Initializers done | 9430 // Initializers done |
| 9748 } | 9431 } |
| 9749 HBasicBlock.withId$ctor.prototype = HBasicBlock.prototype; | 9432 HBasicBlock.withId$ctor.prototype = HBasicBlock.prototype; |
| 9750 $inherits(HBasicBlock, HInstructionList); | 9433 $inherits(HBasicBlock, HInstructionList); |
| 9751 HBasicBlock.prototype.is$HBasicBlock = function(){return this;}; | |
| 9752 HBasicBlock.prototype.isNew = function() { | 9434 HBasicBlock.prototype.isNew = function() { |
| 9753 return this.status == 0/*HBasicBlock.STATUS_NEW*/; | 9435 return this.status == 0/*HBasicBlock.STATUS_NEW*/; |
| 9754 } | 9436 } |
| 9755 HBasicBlock.prototype.isOpen = function() { | 9437 HBasicBlock.prototype.isOpen = function() { |
| 9756 return this.status == 1/*HBasicBlock.STATUS_OPEN*/; | 9438 return this.status == 1/*HBasicBlock.STATUS_OPEN*/; |
| 9757 } | 9439 } |
| 9758 HBasicBlock.prototype.isClosed = function() { | 9440 HBasicBlock.prototype.isClosed = function() { |
| 9759 return this.status == 2/*HBasicBlock.STATUS_CLOSED*/; | 9441 return this.status == 2/*HBasicBlock.STATUS_CLOSED*/; |
| 9760 } | 9442 } |
| 9761 HBasicBlock.prototype.open = function() { | 9443 HBasicBlock.prototype.open = function() { |
| 9762 $assert(this.isNew(), "isNew()", "nodes.dart", 256, 12); | |
| 9763 this.status = 1/*HBasicBlock.STATUS_OPEN*/; | 9444 this.status = 1/*HBasicBlock.STATUS_OPEN*/; |
| 9764 } | 9445 } |
| 9765 HBasicBlock.prototype.close = function(end) { | 9446 HBasicBlock.prototype.close = function(end) { |
| 9766 $assert(this.isOpen(), "isOpen()", "nodes.dart", 261, 12); | |
| 9767 this.addAfter(this.last, end); | 9447 this.addAfter(this.last, end); |
| 9768 this.status = 2/*HBasicBlock.STATUS_CLOSED*/; | 9448 this.status = 2/*HBasicBlock.STATUS_CLOSED*/; |
| 9769 } | 9449 } |
| 9770 HBasicBlock.prototype.assignInstructionIds = function(id) { | 9450 HBasicBlock.prototype.assignInstructionIds = function(id) { |
| 9771 var instruction = this.first; | 9451 var instruction = this.first; |
| 9772 while (instruction != null) { | 9452 while (instruction != null) { |
| 9773 instruction.id = id++; | 9453 instruction.id = id++; |
| 9774 instruction = instruction.next; | 9454 instruction = instruction.next; |
| 9775 } | 9455 } |
| 9776 return id; | 9456 return id; |
| 9777 } | 9457 } |
| 9778 HBasicBlock.prototype.accept = function(visitor) { | 9458 HBasicBlock.prototype.accept = function(visitor) { |
| 9779 return visitor.visitBasicBlock(this); | 9459 return visitor.visitBasicBlock(this); |
| 9780 } | 9460 } |
| 9781 HBasicBlock.prototype.add = function(instruction) { | 9461 HBasicBlock.prototype.add = function(instruction) { |
| 9782 $assert(!(instruction instanceof HControlFlow), "instruction is !HControlFlow"
, "nodes.dart", 289, 12); | |
| 9783 HInstructionList.prototype.addAfter.call(this, this.last, instruction); | 9462 HInstructionList.prototype.addAfter.call(this, this.last, instruction); |
| 9784 } | 9463 } |
| 9785 HBasicBlock.prototype.addSuccessor = function(block) { | 9464 HBasicBlock.prototype.addSuccessor = function(block) { |
| 9786 $assert($notnull_bool(this.isClosed()) && ($notnull_bool(block.isNew()) || blo
ck.id < this.id), "isClosed() && (block.isNew() || block.id < id)", "nodes.dart"
, 295, 12); | |
| 9787 if (this.successors.isEmpty()) { | 9465 if (this.successors.isEmpty()) { |
| 9788 this.successors = [block]; | 9466 this.successors = [block]; |
| 9789 } | 9467 } |
| 9790 else { | 9468 else { |
| 9791 this.successors.add(block); | 9469 this.successors.add(block); |
| 9792 } | 9470 } |
| 9793 block.predecessors.add(this); | 9471 block.predecessors.add(this); |
| 9794 } | 9472 } |
| 9795 HBasicBlock.prototype.addAfter = function(cursor, instruction) { | 9473 HBasicBlock.prototype.addAfter = function(cursor, instruction) { |
| 9796 $assert($notnull_bool(this.isOpen()) || $notnull_bool(this.isClosed()), "isOpe
n() || isClosed()", "nodes.dart", 305, 12); | |
| 9797 HInstructionList.prototype.addAfter.call(this, cursor, instruction); | 9474 HInstructionList.prototype.addAfter.call(this, cursor, instruction); |
| 9798 } | 9475 } |
| 9799 HBasicBlock.prototype.remove = function(instruction) { | 9476 HBasicBlock.prototype.remove = function(instruction) { |
| 9800 $assert($notnull_bool(this.isOpen()) || $notnull_bool(this.isClosed()), "isOpe
n() || isClosed()", "nodes.dart", 310, 12); | |
| 9801 HInstructionList.prototype.remove.call(this, instruction); | 9477 HInstructionList.prototype.remove.call(this, instruction); |
| 9802 } | 9478 } |
| 9803 HBasicBlock.prototype.rewrite = function(from, to) { | 9479 HBasicBlock.prototype.rewrite = function(from, to) { |
| 9804 var $list = from.get$usedBy(); | 9480 var $list = from.get$usedBy(); |
| 9805 for (var $i = 0;$i < $list.length; $i++) { | 9481 for (var $i = 0;$i < $list.length; $i++) { |
| 9806 var use = $list.$index($i); | 9482 var use = $list.$index($i); |
| 9807 HBasicBlock.rewriteInput(use, from, to); | 9483 HBasicBlock.rewriteInput(use, from, to); |
| 9808 } | 9484 } |
| 9809 to.get$usedBy().addAll(from.get$usedBy()); | 9485 to.get$usedBy().addAll(from.get$usedBy()); |
| 9810 from._usedBy = []; | 9486 from._usedBy = []; |
| 9811 } | 9487 } |
| 9812 HBasicBlock.rewriteInput = function(instruction, from, to) { | 9488 HBasicBlock.rewriteInput = function(instruction, from, to) { |
| 9813 var inputs = instruction.inputs; | 9489 var inputs = instruction.inputs; |
| 9814 for (var i = 0; | 9490 for (var i = 0; |
| 9815 i < inputs.length; i++) { | 9491 i < inputs.length; i++) { |
| 9816 if (inputs.$index(i) === from) inputs.$setindex(i, to); | 9492 if (inputs.$index(i) === from) inputs.$setindex(i, to); |
| 9817 } | 9493 } |
| 9818 } | 9494 } |
| 9819 HBasicBlock.prototype.isExitBlock = function() { | 9495 HBasicBlock.prototype.isExitBlock = function() { |
| 9820 return this.first === this.last && (this.first instanceof HExit); | 9496 return this.first === this.last && (this.first instanceof HExit); |
| 9821 } | 9497 } |
| 9822 HBasicBlock.prototype.addDominatedBlock = function(block) { | 9498 HBasicBlock.prototype.addDominatedBlock = function(block) { |
| 9823 $assert(this.isClosed(), "isClosed()", "nodes.dart", 340, 12); | |
| 9824 $assert(this.id != null && block.id != null, "id !== null && block.id !== null
", "nodes.dart", 341, 12); | |
| 9825 $assert(this.dominatedBlocks.indexOf(block) < 0, "dominatedBlocks.indexOf(bloc
k) < 0", "nodes.dart", 342, 12); | |
| 9826 var index = this.dominatedBlocks.length; | 9499 var index = this.dominatedBlocks.length; |
| 9827 while (index > 0 && this.dominatedBlocks.$index(index - 1).id > block.id) { | 9500 while (index > 0 && this.dominatedBlocks.$index(index - 1).id > block.id) { |
| 9828 index--; | 9501 index--; |
| 9829 } | 9502 } |
| 9830 if (index == this.dominatedBlocks.length) { | 9503 if (index == this.dominatedBlocks.length) { |
| 9831 this.dominatedBlocks.add(block); | 9504 this.dominatedBlocks.add(block); |
| 9832 } | 9505 } |
| 9833 else { | 9506 else { |
| 9834 this.dominatedBlocks.insertRange(index, 1, block); | 9507 this.dominatedBlocks.insertRange(index, 1, block); |
| 9835 } | 9508 } |
| 9836 $assert(block.dominator == null, "block.dominator === null", "nodes.dart", 355
, 12); | |
| 9837 block.dominator = this; | 9509 block.dominator = this; |
| 9838 } | 9510 } |
| 9839 HBasicBlock.prototype.removeDominatedBlock = function(block) { | 9511 HBasicBlock.prototype.removeDominatedBlock = function(block) { |
| 9840 $assert(this.isClosed(), "isClosed()", "nodes.dart", 360, 12); | |
| 9841 $assert(this.id != null && block.id != null, "id !== null && block.id !== null
", "nodes.dart", 361, 12); | |
| 9842 var index = this.dominatedBlocks.indexOf(block); | 9512 var index = this.dominatedBlocks.indexOf(block); |
| 9843 $assert(index >= 0, "index >= 0", "nodes.dart", 363, 12); | |
| 9844 if (index == this.dominatedBlocks.length - 1) { | 9513 if (index == this.dominatedBlocks.length - 1) { |
| 9845 this.dominatedBlocks.removeLast(); | 9514 this.dominatedBlocks.removeLast(); |
| 9846 } | 9515 } |
| 9847 else { | 9516 else { |
| 9848 this.dominatedBlocks.removeRange(index, 1); | 9517 this.dominatedBlocks.removeRange(index, 1); |
| 9849 } | 9518 } |
| 9850 $assert(block.dominator === this, "block.dominator === this", "nodes.dart", 36
9, 12); | |
| 9851 block.dominator = null; | 9519 block.dominator = null; |
| 9852 } | 9520 } |
| 9853 HBasicBlock.prototype.assignCommonDominator = function(predecessor) { | 9521 HBasicBlock.prototype.assignCommonDominator = function(predecessor) { |
| 9854 $assert(this.isClosed(), "isClosed()", "nodes.dart", 374, 12); | |
| 9855 if (this.dominator == null) { | 9522 if (this.dominator == null) { |
| 9856 predecessor.addDominatedBlock(this); | 9523 predecessor.addDominatedBlock(this); |
| 9857 } | 9524 } |
| 9858 else if (predecessor.dominator != null) { | 9525 else if (predecessor.dominator != null) { |
| 9859 var first = this.dominator; | 9526 var first = this.dominator; |
| 9860 var second = predecessor; | 9527 var second = predecessor; |
| 9861 while (first !== second) { | 9528 while (first !== second) { |
| 9862 if (first.id > second.id) { | 9529 if (first.id > second.id) { |
| 9863 first = first.dominator; | 9530 first = first.dominator; |
| 9864 } | 9531 } |
| 9865 else { | 9532 else { |
| 9866 second = second.dominator; | 9533 second = second.dominator; |
| 9867 } | 9534 } |
| 9868 $assert(first != null && second != null, "first !== null && second !== nul
l", "nodes.dart", 391, 16); | |
| 9869 } | 9535 } |
| 9870 if (this.dominator !== first) { | 9536 if (this.dominator !== first) { |
| 9871 this.dominator.removeDominatedBlock(this); | 9537 this.dominator.removeDominatedBlock(this); |
| 9872 first.addDominatedBlock(this); | 9538 first.addDominatedBlock(this); |
| 9873 } | 9539 } |
| 9874 } | 9540 } |
| 9875 } | 9541 } |
| 9876 HBasicBlock.prototype.forEachPhi = function(f) { | 9542 HBasicBlock.prototype.forEachPhi = function(f) { |
| 9877 var current = this.first; | 9543 var current = this.first; |
| 9878 while (current != null && (current instanceof HPhi)) { | 9544 while (current != null && (current instanceof HPhi)) { |
| 9879 f((current && current.is$HPhi())); | 9545 f(current); |
| 9880 current = current.next; | 9546 current = current.next; |
| 9881 } | 9547 } |
| 9882 } | 9548 } |
| 9883 HBasicBlock.prototype.accept$1 = function($0) { | 9549 HBasicBlock.prototype.accept$1 = function($0) { |
| 9884 return this.accept(($0 && $0.is$HVisitor())); | 9550 return this.accept($0); |
| 9885 }; | 9551 }; |
| 9886 HBasicBlock.prototype.add$1 = function($0) { | 9552 HBasicBlock.prototype.add$1 = function($0) { |
| 9887 return this.add(($0 && $0.is$HInstruction())); | 9553 return this.add($0); |
| 9888 }; | 9554 }; |
| 9889 HBasicBlock.prototype.isExitBlock$0 = function() { | 9555 HBasicBlock.prototype.isExitBlock$0 = function() { |
| 9890 return this.isExitBlock(); | 9556 return this.isExitBlock(); |
| 9891 }; | 9557 }; |
| 9892 // ********** Code for HInstruction ************** | 9558 // ********** Code for HInstruction ************** |
| 9893 function HInstruction(inputs) { | 9559 function HInstruction(inputs) { |
| 9894 this._usedBy = null | 9560 this._usedBy = null |
| 9895 this.previous = null | 9561 this.previous = null |
| 9896 this.next = null | 9562 this.next = null |
| 9897 this.flags = 0 | 9563 this.flags = 0 |
| 9898 this.inputs = inputs; | 9564 this.inputs = inputs; |
| 9899 // Initializers done | 9565 // Initializers done |
| 9900 this.prepareGvn(); | 9566 this.prepareGvn(); |
| 9901 } | 9567 } |
| 9902 HInstruction.prototype.is$HInstruction = function(){return this;}; | |
| 9903 HInstruction.prototype.getFlag = function(position) { | 9568 HInstruction.prototype.getFlag = function(position) { |
| 9904 return (this.flags & (1 << position)) != 0; | 9569 return (this.flags & (1 << position)) != 0; |
| 9905 } | 9570 } |
| 9906 HInstruction.prototype.setFlag = function(position) { | 9571 HInstruction.prototype.setFlag = function(position) { |
| 9907 this.flags |= (1 << position); | 9572 this.flags |= (1 << position); |
| 9908 } | 9573 } |
| 9909 HInstruction.prototype.getChangesFlags = function() { | 9574 HInstruction.prototype.getChangesFlags = function() { |
| 9910 return this.flags & (1)/*((1 << FLAG_CHANGES_COUNT) - 1)*/; | 9575 return this.flags & (1)/*((1 << FLAG_CHANGES_COUNT) - 1)*/; |
| 9911 } | 9576 } |
| 9912 HInstruction.prototype.hasSideEffects = function() { | 9577 HInstruction.prototype.hasSideEffects = function() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 9931 this.setFlag(3/*HInstruction.FLAG_USE_GVN*/); | 9596 this.setFlag(3/*HInstruction.FLAG_USE_GVN*/); |
| 9932 } | 9597 } |
| 9933 HInstruction.prototype.get$usedBy = function() { | 9598 HInstruction.prototype.get$usedBy = function() { |
| 9934 if (this._usedBy == null) return const$13/*const []*/; | 9599 if (this._usedBy == null) return const$13/*const []*/; |
| 9935 return this._usedBy; | 9600 return this._usedBy; |
| 9936 } | 9601 } |
| 9937 HInstruction.prototype.isInBasicBlock = function() { | 9602 HInstruction.prototype.isInBasicBlock = function() { |
| 9938 return this._usedBy != null; | 9603 return this._usedBy != null; |
| 9939 } | 9604 } |
| 9940 HInstruction.prototype.notifyAddedToBlock = function() { | 9605 HInstruction.prototype.notifyAddedToBlock = function() { |
| 9941 $assert(!$notnull_bool(this.isInBasicBlock()), "!isInBasicBlock()", "nodes.dar
t", 507, 12); | |
| 9942 this._usedBy = []; | 9606 this._usedBy = []; |
| 9943 for (var i = 0; | 9607 for (var i = 0; |
| 9944 i < this.inputs.length; i++) { | 9608 i < this.inputs.length; i++) { |
| 9945 $assert(this.inputs.$index(i).isInBasicBlock$0(), "inputs[i].isInBasicBlock(
)", "nodes.dart", 511, 14); | |
| 9946 this.inputs.$index(i).get$usedBy().add(this); | 9609 this.inputs.$index(i).get$usedBy().add(this); |
| 9947 } | 9610 } |
| 9948 $assert(this.isValid(), "isValid()", "nodes.dart", 514, 12); | |
| 9949 } | 9611 } |
| 9950 HInstruction.prototype.notifyRemovedFromBlock = function() { | 9612 HInstruction.prototype.notifyRemovedFromBlock = function() { |
| 9951 $assert(this.isInBasicBlock(), "isInBasicBlock()", "nodes.dart", 518, 12); | |
| 9952 $assert(this.get$usedBy().isEmpty(), "usedBy.isEmpty()", "nodes.dart", 519, 12
); | |
| 9953 for (var i = 0; | 9613 for (var i = 0; |
| 9954 i < this.inputs.length; i++) { | 9614 i < this.inputs.length; i++) { |
| 9955 var inputUsedBy = this.inputs.$index(i).get$usedBy(); | 9615 var inputUsedBy = this.inputs.$index(i).get$usedBy(); |
| 9956 for (var j = 0; | 9616 for (var j = 0; |
| 9957 j < inputUsedBy.length; j++) { | 9617 j < inputUsedBy.length; j++) { |
| 9958 if (inputUsedBy.$index(j) === this) { | 9618 if (inputUsedBy.$index(j) === this) { |
| 9959 inputUsedBy.$setindex(j, inputUsedBy.$index(inputUsedBy.length - 1)); | 9619 inputUsedBy.$setindex(j, inputUsedBy.$index(inputUsedBy.length - 1)); |
| 9960 inputUsedBy.removeLast(); | 9620 inputUsedBy.removeLast(); |
| 9961 break; | 9621 break; |
| 9962 } | 9622 } |
| 9963 } | 9623 } |
| 9964 } | 9624 } |
| 9965 this._usedBy = null; | 9625 this._usedBy = null; |
| 9966 $assert(this.isValid(), "isValid()", "nodes.dart", 533, 12); | |
| 9967 } | 9626 } |
| 9968 HInstruction.prototype.isLiteralNumber = function() { | 9627 HInstruction.prototype.isLiteralNumber = function() { |
| 9969 return false; | 9628 return false; |
| 9970 } | 9629 } |
| 9971 HInstruction.prototype.isLiteralString = function() { | 9630 HInstruction.prototype.isLiteralString = function() { |
| 9972 return false; | 9631 return false; |
| 9973 } | 9632 } |
| 9974 HInstruction.prototype.isValid = function() { | 9633 HInstruction.prototype.isValid = function() { |
| 9975 var validator = new HValidator(); | 9634 var validator = new HValidator(); |
| 9976 validator.visitInstruction(this); | 9635 validator.visitInstruction(this); |
| 9977 return validator.isValid; | 9636 return validator.isValid; |
| 9978 } | 9637 } |
| 9979 HInstruction.prototype.accept$1 = function($0) { | 9638 HInstruction.prototype.accept$1 = function($0) { |
| 9980 return this.accept(($0 && $0.is$HVisitor())); | 9639 return this.accept($0); |
| 9981 }; | 9640 }; |
| 9982 HInstruction.prototype.isInBasicBlock$0 = function() { | 9641 HInstruction.prototype.isInBasicBlock$0 = function() { |
| 9983 return this.isInBasicBlock(); | 9642 return this.isInBasicBlock(); |
| 9984 }; | 9643 }; |
| 9985 HInstruction.prototype.isLiteralNumber$0 = function() { | 9644 HInstruction.prototype.isLiteralNumber$0 = function() { |
| 9986 return this.isLiteralNumber(); | 9645 return this.isLiteralNumber(); |
| 9987 }; | 9646 }; |
| 9988 HInstruction.prototype.isLiteralString$0 = function() { | 9647 HInstruction.prototype.isLiteralString$0 = function() { |
| 9989 return this.isLiteralString(); | 9648 return this.isLiteralString(); |
| 9990 }; | 9649 }; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 10020 } | 9679 } |
| 10021 $inherits(HInvoke, HInstruction); | 9680 $inherits(HInvoke, HInstruction); |
| 10022 HInvoke.prototype.get$element = function() { return this.element; }; | 9681 HInvoke.prototype.get$element = function() { return this.element; }; |
| 10023 HInvoke.prototype.toString = function() { | 9682 HInvoke.prototype.toString = function() { |
| 10024 return ('invoke: ' + this.element.name + ''); | 9683 return ('invoke: ' + this.element.name + ''); |
| 10025 } | 9684 } |
| 10026 HInvoke.prototype.accept = function(visitor) { | 9685 HInvoke.prototype.accept = function(visitor) { |
| 10027 return visitor.visitInvoke(this); | 9686 return visitor.visitInvoke(this); |
| 10028 } | 9687 } |
| 10029 HInvoke.prototype.accept$1 = function($0) { | 9688 HInvoke.prototype.accept$1 = function($0) { |
| 10030 return this.accept(($0 && $0.is$HVisitor())); | 9689 return this.accept($0); |
| 10031 }; | 9690 }; |
| 10032 HInvoke.prototype.toString$0 = function() { | 9691 HInvoke.prototype.toString$0 = function() { |
| 10033 return this.toString(); | 9692 return this.toString(); |
| 10034 }; | 9693 }; |
| 10035 // ********** Code for HInvokeForeign ************** | 9694 // ********** Code for HInvokeForeign ************** |
| 10036 function HInvokeForeign(element, inputs, code) { | 9695 function HInvokeForeign(element, inputs, code) { |
| 10037 this.code = code; | 9696 this.code = code; |
| 10038 HInvoke.call(this, element, inputs); | 9697 HInvoke.call(this, element, inputs); |
| 10039 // Initializers done | 9698 // Initializers done |
| 10040 } | 9699 } |
| 10041 $inherits(HInvokeForeign, HInvoke); | 9700 $inherits(HInvokeForeign, HInvoke); |
| 10042 HInvokeForeign.prototype.accept = function(visitor) { | 9701 HInvokeForeign.prototype.accept = function(visitor) { |
| 10043 return visitor.visitInvokeForeign(this); | 9702 return visitor.visitInvokeForeign(this); |
| 10044 } | 9703 } |
| 10045 HInvokeForeign.prototype.accept$1 = function($0) { | 9704 HInvokeForeign.prototype.accept$1 = function($0) { |
| 10046 return this.accept(($0 && $0.is$HVisitor())); | 9705 return this.accept($0); |
| 10047 }; | 9706 }; |
| 10048 // ********** Code for HArithmetic ************** | 9707 // ********** Code for HArithmetic ************** |
| 10049 function HArithmetic(element, inputs) { | 9708 function HArithmetic(element, inputs) { |
| 10050 HInvoke.call(this, element, inputs); | 9709 HInvoke.call(this, element, inputs); |
| 10051 // Initializers done | 9710 // Initializers done |
| 10052 } | 9711 } |
| 10053 $inherits(HArithmetic, HInvoke); | 9712 $inherits(HArithmetic, HInvoke); |
| 10054 HArithmetic.prototype.prepareGvn = function() { | 9713 HArithmetic.prototype.prepareGvn = function() { |
| 10055 if (!(this.inputs.$index(0) instanceof HLiteral)) return; | 9714 if (!(this.inputs.$index(0) instanceof HLiteral)) return; |
| 10056 this.clearAllSideEffects(); | 9715 this.clearAllSideEffects(); |
| 10057 this.setUseGvn(); | 9716 this.setUseGvn(); |
| 10058 } | 9717 } |
| 10059 // ********** Code for HAdd ************** | 9718 // ********** Code for HAdd ************** |
| 10060 function HAdd(element, inputs) { | 9719 function HAdd(element, inputs) { |
| 10061 HArithmetic.call(this, element, inputs); | 9720 HArithmetic.call(this, element, inputs); |
| 10062 // Initializers done | 9721 // Initializers done |
| 10063 } | 9722 } |
| 10064 $inherits(HAdd, HArithmetic); | 9723 $inherits(HAdd, HArithmetic); |
| 10065 HAdd.prototype.prepareGvn = function() { | 9724 HAdd.prototype.prepareGvn = function() { |
| 10066 if (!$notnull_bool(this.inputs.$index(0).isLiteralNumber$0())) return; | 9725 if (!this.inputs.$index(0).isLiteralNumber$0()) return; |
| 10067 this.clearAllSideEffects(); | 9726 this.clearAllSideEffects(); |
| 10068 this.setUseGvn(); | 9727 this.setUseGvn(); |
| 10069 } | 9728 } |
| 10070 HAdd.prototype.accept = function(visitor) { | 9729 HAdd.prototype.accept = function(visitor) { |
| 10071 return visitor.visitAdd(this); | 9730 return visitor.visitAdd(this); |
| 10072 } | 9731 } |
| 10073 HAdd.prototype.evaluate = function(a, b) { | 9732 HAdd.prototype.evaluate = function(a, b) { |
| 10074 return a + b; | 9733 return a + b; |
| 10075 } | 9734 } |
| 10076 HAdd.prototype.accept$1 = function($0) { | 9735 HAdd.prototype.accept$1 = function($0) { |
| 10077 return this.accept(($0 && $0.is$HVisitor())); | 9736 return this.accept($0); |
| 10078 }; | 9737 }; |
| 10079 // ********** Code for HDivide ************** | 9738 // ********** Code for HDivide ************** |
| 10080 function HDivide(element, inputs) { | 9739 function HDivide(element, inputs) { |
| 10081 HArithmetic.call(this, element, inputs); | 9740 HArithmetic.call(this, element, inputs); |
| 10082 // Initializers done | 9741 // Initializers done |
| 10083 } | 9742 } |
| 10084 $inherits(HDivide, HArithmetic); | 9743 $inherits(HDivide, HArithmetic); |
| 10085 HDivide.prototype.accept = function(visitor) { | 9744 HDivide.prototype.accept = function(visitor) { |
| 10086 return visitor.visitDivide(this); | 9745 return visitor.visitDivide(this); |
| 10087 } | 9746 } |
| 10088 HDivide.prototype.evaluate = function(a, b) { | 9747 HDivide.prototype.evaluate = function(a, b) { |
| 10089 return a / b; | 9748 return a / b; |
| 10090 } | 9749 } |
| 10091 HDivide.prototype.accept$1 = function($0) { | 9750 HDivide.prototype.accept$1 = function($0) { |
| 10092 return this.accept(($0 && $0.is$HVisitor())); | 9751 return this.accept($0); |
| 10093 }; | 9752 }; |
| 10094 // ********** Code for HMultiply ************** | 9753 // ********** Code for HMultiply ************** |
| 10095 function HMultiply(element, inputs) { | 9754 function HMultiply(element, inputs) { |
| 10096 HArithmetic.call(this, element, inputs); | 9755 HArithmetic.call(this, element, inputs); |
| 10097 // Initializers done | 9756 // Initializers done |
| 10098 } | 9757 } |
| 10099 $inherits(HMultiply, HArithmetic); | 9758 $inherits(HMultiply, HArithmetic); |
| 10100 HMultiply.prototype.accept = function(visitor) { | 9759 HMultiply.prototype.accept = function(visitor) { |
| 10101 return visitor.visitMultiply(this); | 9760 return visitor.visitMultiply(this); |
| 10102 } | 9761 } |
| 10103 HMultiply.prototype.evaluate = function(a, b) { | 9762 HMultiply.prototype.evaluate = function(a, b) { |
| 10104 return a * b; | 9763 return a * b; |
| 10105 } | 9764 } |
| 10106 HMultiply.prototype.accept$1 = function($0) { | 9765 HMultiply.prototype.accept$1 = function($0) { |
| 10107 return this.accept(($0 && $0.is$HVisitor())); | 9766 return this.accept($0); |
| 10108 }; | 9767 }; |
| 10109 // ********** Code for HSubtract ************** | 9768 // ********** Code for HSubtract ************** |
| 10110 function HSubtract(element, inputs) { | 9769 function HSubtract(element, inputs) { |
| 10111 HArithmetic.call(this, element, inputs); | 9770 HArithmetic.call(this, element, inputs); |
| 10112 // Initializers done | 9771 // Initializers done |
| 10113 } | 9772 } |
| 10114 $inherits(HSubtract, HArithmetic); | 9773 $inherits(HSubtract, HArithmetic); |
| 10115 HSubtract.prototype.accept = function(visitor) { | 9774 HSubtract.prototype.accept = function(visitor) { |
| 10116 return visitor.visitSubtract(this); | 9775 return visitor.visitSubtract(this); |
| 10117 } | 9776 } |
| 10118 HSubtract.prototype.evaluate = function(a, b) { | 9777 HSubtract.prototype.evaluate = function(a, b) { |
| 10119 return a - b; | 9778 return a - b; |
| 10120 } | 9779 } |
| 10121 HSubtract.prototype.accept$1 = function($0) { | 9780 HSubtract.prototype.accept$1 = function($0) { |
| 10122 return this.accept(($0 && $0.is$HVisitor())); | 9781 return this.accept($0); |
| 10123 }; | 9782 }; |
| 10124 // ********** Code for HTruncatingDivide ************** | 9783 // ********** Code for HTruncatingDivide ************** |
| 10125 function HTruncatingDivide(element, inputs) { | 9784 function HTruncatingDivide(element, inputs) { |
| 10126 HArithmetic.call(this, element, inputs); | 9785 HArithmetic.call(this, element, inputs); |
| 10127 // Initializers done | 9786 // Initializers done |
| 10128 } | 9787 } |
| 10129 $inherits(HTruncatingDivide, HArithmetic); | 9788 $inherits(HTruncatingDivide, HArithmetic); |
| 10130 HTruncatingDivide.prototype.accept = function(visitor) { | 9789 HTruncatingDivide.prototype.accept = function(visitor) { |
| 10131 return visitor.visitTruncatingDivide(this); | 9790 return visitor.visitTruncatingDivide(this); |
| 10132 } | 9791 } |
| 10133 HTruncatingDivide.prototype.evaluate = function(a, b) { | 9792 HTruncatingDivide.prototype.evaluate = function(a, b) { |
| 10134 return $truncdiv(a, b); | 9793 return $truncdiv(a, b); |
| 10135 } | 9794 } |
| 10136 HTruncatingDivide.prototype.accept$1 = function($0) { | 9795 HTruncatingDivide.prototype.accept$1 = function($0) { |
| 10137 return this.accept(($0 && $0.is$HVisitor())); | 9796 return this.accept($0); |
| 10138 }; | 9797 }; |
| 10139 // ********** Code for HEquals ************** | 9798 // ********** Code for HEquals ************** |
| 10140 function HEquals(element, inputs) { | 9799 function HEquals(element, inputs) { |
| 10141 HInvoke.call(this, element, inputs); | 9800 HInvoke.call(this, element, inputs); |
| 10142 // Initializers done | 9801 // Initializers done |
| 10143 } | 9802 } |
| 10144 $inherits(HEquals, HInvoke); | 9803 $inherits(HEquals, HInvoke); |
| 10145 HEquals.prototype.prepareGvn = function() { | 9804 HEquals.prototype.prepareGvn = function() { |
| 10146 if (!(this.inputs.$index(0) instanceof HLiteral)) return; | 9805 if (!(this.inputs.$index(0) instanceof HLiteral)) return; |
| 10147 this.clearAllSideEffects(); | 9806 this.clearAllSideEffects(); |
| 10148 this.setUseGvn(); | 9807 this.setUseGvn(); |
| 10149 } | 9808 } |
| 10150 HEquals.prototype.accept = function(visitor) { | 9809 HEquals.prototype.accept = function(visitor) { |
| 10151 return visitor.visitEquals(this); | 9810 return visitor.visitEquals(this); |
| 10152 } | 9811 } |
| 10153 HEquals.prototype.accept$1 = function($0) { | 9812 HEquals.prototype.accept$1 = function($0) { |
| 10154 return this.accept(($0 && $0.is$HVisitor())); | 9813 return this.accept($0); |
| 10155 }; | 9814 }; |
| 10156 // ********** Code for HExit ************** | 9815 // ********** Code for HExit ************** |
| 10157 function HExit() { | 9816 function HExit() { |
| 10158 HControlFlow.call(this, const$13/*const []*/); | 9817 HControlFlow.call(this, const$13/*const []*/); |
| 10159 // Initializers done | 9818 // Initializers done |
| 10160 } | 9819 } |
| 10161 $inherits(HExit, HControlFlow); | 9820 $inherits(HExit, HControlFlow); |
| 10162 HExit.prototype.toString = function() { | 9821 HExit.prototype.toString = function() { |
| 10163 return 'exit'; | 9822 return 'exit'; |
| 10164 } | 9823 } |
| 10165 HExit.prototype.accept = function(visitor) { | 9824 HExit.prototype.accept = function(visitor) { |
| 10166 return visitor.visitExit(this); | 9825 return visitor.visitExit(this); |
| 10167 } | 9826 } |
| 10168 HExit.prototype.accept$1 = function($0) { | 9827 HExit.prototype.accept$1 = function($0) { |
| 10169 return this.accept(($0 && $0.is$HVisitor())); | 9828 return this.accept($0); |
| 10170 }; | 9829 }; |
| 10171 HExit.prototype.toString$0 = function() { | 9830 HExit.prototype.toString$0 = function() { |
| 10172 return this.toString(); | 9831 return this.toString(); |
| 10173 }; | 9832 }; |
| 10174 // ********** Code for HGoto ************** | 9833 // ********** Code for HGoto ************** |
| 10175 function HGoto() { | 9834 function HGoto() { |
| 10176 HControlFlow.call(this, const$13/*const []*/); | 9835 HControlFlow.call(this, const$13/*const []*/); |
| 10177 // Initializers done | 9836 // Initializers done |
| 10178 } | 9837 } |
| 10179 $inherits(HGoto, HControlFlow); | 9838 $inherits(HGoto, HControlFlow); |
| 10180 HGoto.prototype.toString = function() { | 9839 HGoto.prototype.toString = function() { |
| 10181 return 'goto'; | 9840 return 'goto'; |
| 10182 } | 9841 } |
| 10183 HGoto.prototype.accept = function(visitor) { | 9842 HGoto.prototype.accept = function(visitor) { |
| 10184 return visitor.visitGoto(this); | 9843 return visitor.visitGoto(this); |
| 10185 } | 9844 } |
| 10186 HGoto.prototype.accept$1 = function($0) { | 9845 HGoto.prototype.accept$1 = function($0) { |
| 10187 return this.accept(($0 && $0.is$HVisitor())); | 9846 return this.accept($0); |
| 10188 }; | 9847 }; |
| 10189 HGoto.prototype.toString$0 = function() { | 9848 HGoto.prototype.toString$0 = function() { |
| 10190 return this.toString(); | 9849 return this.toString(); |
| 10191 }; | 9850 }; |
| 10192 // ********** Code for HIf ************** | 9851 // ********** Code for HIf ************** |
| 10193 function HIf(condition, hasElse) { | 9852 function HIf(condition, hasElse) { |
| 10194 this.hasElse = hasElse; | 9853 this.hasElse = hasElse; |
| 10195 HConditionalBranch.call(this, [condition]); | 9854 HConditionalBranch.call(this, [condition]); |
| 10196 // Initializers done | 9855 // Initializers done |
| 10197 } | 9856 } |
| 10198 $inherits(HIf, HConditionalBranch); | 9857 $inherits(HIf, HConditionalBranch); |
| 10199 HIf.prototype.toString = function() { | 9858 HIf.prototype.toString = function() { |
| 10200 return 'if'; | 9859 return 'if'; |
| 10201 } | 9860 } |
| 10202 HIf.prototype.accept = function(visitor) { | 9861 HIf.prototype.accept = function(visitor) { |
| 10203 return visitor.visitIf(this); | 9862 return visitor.visitIf(this); |
| 10204 } | 9863 } |
| 10205 HIf.prototype.accept$1 = function($0) { | 9864 HIf.prototype.accept$1 = function($0) { |
| 10206 return this.accept(($0 && $0.is$HVisitor())); | 9865 return this.accept($0); |
| 10207 }; | 9866 }; |
| 10208 HIf.prototype.toString$0 = function() { | 9867 HIf.prototype.toString$0 = function() { |
| 10209 return this.toString(); | 9868 return this.toString(); |
| 10210 }; | 9869 }; |
| 10211 // ********** Code for HLoopBranch ************** | 9870 // ********** Code for HLoopBranch ************** |
| 10212 function HLoopBranch(condition) { | 9871 function HLoopBranch(condition) { |
| 10213 HConditionalBranch.call(this, [condition]); | 9872 HConditionalBranch.call(this, [condition]); |
| 10214 // Initializers done | 9873 // Initializers done |
| 10215 } | 9874 } |
| 10216 $inherits(HLoopBranch, HConditionalBranch); | 9875 $inherits(HLoopBranch, HConditionalBranch); |
| 10217 HLoopBranch.prototype.toString = function() { | 9876 HLoopBranch.prototype.toString = function() { |
| 10218 return 'loop-branch'; | 9877 return 'loop-branch'; |
| 10219 } | 9878 } |
| 10220 HLoopBranch.prototype.accept = function(visitor) { | 9879 HLoopBranch.prototype.accept = function(visitor) { |
| 10221 return visitor.visitLoopBranch(this); | 9880 return visitor.visitLoopBranch(this); |
| 10222 } | 9881 } |
| 10223 HLoopBranch.prototype.accept$1 = function($0) { | 9882 HLoopBranch.prototype.accept$1 = function($0) { |
| 10224 return this.accept(($0 && $0.is$HVisitor())); | 9883 return this.accept($0); |
| 10225 }; | 9884 }; |
| 10226 HLoopBranch.prototype.toString$0 = function() { | 9885 HLoopBranch.prototype.toString$0 = function() { |
| 10227 return this.toString(); | 9886 return this.toString(); |
| 10228 }; | 9887 }; |
| 10229 // ********** Code for HLiteral ************** | 9888 // ********** Code for HLiteral ************** |
| 10230 function HLiteral(value) { | 9889 function HLiteral(value) { |
| 10231 this.value = value; | 9890 this.value = value; |
| 10232 HInstruction.call(this, []); | 9891 HInstruction.call(this, []); |
| 10233 // Initializers done | 9892 // Initializers done |
| 10234 } | 9893 } |
| 10235 $inherits(HLiteral, HInstruction); | 9894 $inherits(HLiteral, HInstruction); |
| 10236 HLiteral.prototype.is$HLiteral = function(){return this;}; | |
| 10237 HLiteral.prototype.get$value = function() { return this.value; }; | 9895 HLiteral.prototype.get$value = function() { return this.value; }; |
| 10238 HLiteral.prototype.prepareGvn = function() { | 9896 HLiteral.prototype.prepareGvn = function() { |
| 10239 this.clearAllSideEffects(); | 9897 this.clearAllSideEffects(); |
| 10240 this.setUseGvn(); | 9898 this.setUseGvn(); |
| 10241 } | 9899 } |
| 10242 HLiteral.prototype.toString = function() { | 9900 HLiteral.prototype.toString = function() { |
| 10243 return ('literal: ' + this.value + ''); | 9901 return ('literal: ' + this.value + ''); |
| 10244 } | 9902 } |
| 10245 HLiteral.prototype.accept = function(visitor) { | 9903 HLiteral.prototype.accept = function(visitor) { |
| 10246 return visitor.visitLiteral(this); | 9904 return visitor.visitLiteral(this); |
| 10247 } | 9905 } |
| 10248 HLiteral.prototype.isLiteralNumber = function() { | 9906 HLiteral.prototype.isLiteralNumber = function() { |
| 10249 return (typeof(this.value) == 'number'); | 9907 return (typeof(this.value) == 'number'); |
| 10250 } | 9908 } |
| 10251 HLiteral.prototype.isLiteralString = function() { | 9909 HLiteral.prototype.isLiteralString = function() { |
| 10252 var $0; | 9910 var $0; |
| 10253 return !!(($0 = this.value) && $0.is$SourceString); | 9911 return !!(($0 = this.value) && $0.is$SourceString); |
| 10254 } | 9912 } |
| 10255 HLiteral.prototype.accept$1 = function($0) { | 9913 HLiteral.prototype.accept$1 = function($0) { |
| 10256 return this.accept(($0 && $0.is$HVisitor())); | 9914 return this.accept($0); |
| 10257 }; | 9915 }; |
| 10258 HLiteral.prototype.isLiteralNumber$0 = function() { | 9916 HLiteral.prototype.isLiteralNumber$0 = function() { |
| 10259 return this.isLiteralNumber(); | 9917 return this.isLiteralNumber(); |
| 10260 }; | 9918 }; |
| 10261 HLiteral.prototype.isLiteralString$0 = function() { | 9919 HLiteral.prototype.isLiteralString$0 = function() { |
| 10262 return this.isLiteralString(); | 9920 return this.isLiteralString(); |
| 10263 }; | 9921 }; |
| 10264 HLiteral.prototype.toString$0 = function() { | 9922 HLiteral.prototype.toString$0 = function() { |
| 10265 return this.toString(); | 9923 return this.toString(); |
| 10266 }; | 9924 }; |
| 10267 // ********** Code for HParameter ************** | 9925 // ********** Code for HParameter ************** |
| 10268 function HParameter(parameterIndex) { | 9926 function HParameter(parameterIndex) { |
| 10269 this.parameterIndex = parameterIndex; | 9927 this.parameterIndex = parameterIndex; |
| 10270 HInstruction.call(this, []); | 9928 HInstruction.call(this, []); |
| 10271 // Initializers done | 9929 // Initializers done |
| 10272 } | 9930 } |
| 10273 $inherits(HParameter, HInstruction); | 9931 $inherits(HParameter, HInstruction); |
| 10274 HParameter.prototype.prepareGvn = function() { | 9932 HParameter.prototype.prepareGvn = function() { |
| 10275 this.clearAllSideEffects(); | 9933 this.clearAllSideEffects(); |
| 10276 } | 9934 } |
| 10277 HParameter.prototype.toString = function() { | 9935 HParameter.prototype.toString = function() { |
| 10278 return ('parameter ' + this.parameterIndex + ''); | 9936 return ('parameter ' + this.parameterIndex + ''); |
| 10279 } | 9937 } |
| 10280 HParameter.prototype.accept = function(visitor) { | 9938 HParameter.prototype.accept = function(visitor) { |
| 10281 return visitor.visitParameter(this); | 9939 return visitor.visitParameter(this); |
| 10282 } | 9940 } |
| 10283 HParameter.prototype.accept$1 = function($0) { | 9941 HParameter.prototype.accept$1 = function($0) { |
| 10284 return this.accept(($0 && $0.is$HVisitor())); | 9942 return this.accept($0); |
| 10285 }; | 9943 }; |
| 10286 HParameter.prototype.toString$0 = function() { | 9944 HParameter.prototype.toString$0 = function() { |
| 10287 return this.toString(); | 9945 return this.toString(); |
| 10288 }; | 9946 }; |
| 10289 // ********** Code for HPhi ************** | 9947 // ********** Code for HPhi ************** |
| 10290 function HPhi() {} | 9948 function HPhi() {} |
| 10291 HPhi.singleInput$ctor = function(element, input) { | 9949 HPhi.singleInput$ctor = function(element, input) { |
| 10292 this.element = element; | 9950 this.element = element; |
| 10293 HInstruction.call(this, [input]); | 9951 HInstruction.call(this, [input]); |
| 10294 // Initializers done | 9952 // Initializers done |
| 10295 } | 9953 } |
| 10296 HPhi.singleInput$ctor.prototype = HPhi.prototype; | 9954 HPhi.singleInput$ctor.prototype = HPhi.prototype; |
| 10297 HPhi.manyInputs$ctor = function(element, inputs) { | 9955 HPhi.manyInputs$ctor = function(element, inputs) { |
| 10298 this.element = element; | 9956 this.element = element; |
| 10299 HInstruction.call(this, inputs); | 9957 HInstruction.call(this, inputs); |
| 10300 // Initializers done | 9958 // Initializers done |
| 10301 } | 9959 } |
| 10302 HPhi.manyInputs$ctor.prototype = HPhi.prototype; | 9960 HPhi.manyInputs$ctor.prototype = HPhi.prototype; |
| 10303 $inherits(HPhi, HInstruction); | 9961 $inherits(HPhi, HInstruction); |
| 10304 HPhi.prototype.is$HPhi = function(){return this;}; | |
| 10305 HPhi.prototype.get$element = function() { return this.element; }; | 9962 HPhi.prototype.get$element = function() { return this.element; }; |
| 10306 HPhi.prototype.addInput = function(input) { | 9963 HPhi.prototype.addInput = function(input) { |
| 10307 $assert(this.isInBasicBlock(), "isInBasicBlock()", "nodes.dart", 701, 12); | |
| 10308 this.inputs.add(input); | 9964 this.inputs.add(input); |
| 10309 input.get$usedBy().add(this); | 9965 input.get$usedBy().add(this); |
| 10310 } | 9966 } |
| 10311 HPhi.prototype.toString = function() { | 9967 HPhi.prototype.toString = function() { |
| 10312 return 'phi'; | 9968 return 'phi'; |
| 10313 } | 9969 } |
| 10314 HPhi.prototype.accept = function(visitor) { | 9970 HPhi.prototype.accept = function(visitor) { |
| 10315 return visitor.visitPhi(this); | 9971 return visitor.visitPhi(this); |
| 10316 } | 9972 } |
| 10317 HPhi.prototype.accept$1 = function($0) { | 9973 HPhi.prototype.accept$1 = function($0) { |
| 10318 return this.accept(($0 && $0.is$HVisitor())); | 9974 return this.accept($0); |
| 10319 }; | 9975 }; |
| 10320 HPhi.prototype.toString$0 = function() { | 9976 HPhi.prototype.toString$0 = function() { |
| 10321 return this.toString(); | 9977 return this.toString(); |
| 10322 }; | 9978 }; |
| 10323 // ********** Code for HReturn ************** | 9979 // ********** Code for HReturn ************** |
| 10324 function HReturn(value) { | 9980 function HReturn(value) { |
| 10325 HControlFlow.call(this, [value]); | 9981 HControlFlow.call(this, [value]); |
| 10326 // Initializers done | 9982 // Initializers done |
| 10327 } | 9983 } |
| 10328 $inherits(HReturn, HControlFlow); | 9984 $inherits(HReturn, HControlFlow); |
| 10329 HReturn.prototype.toString = function() { | 9985 HReturn.prototype.toString = function() { |
| 10330 return 'return'; | 9986 return 'return'; |
| 10331 } | 9987 } |
| 10332 HReturn.prototype.accept = function(visitor) { | 9988 HReturn.prototype.accept = function(visitor) { |
| 10333 return visitor.visitReturn(this); | 9989 return visitor.visitReturn(this); |
| 10334 } | 9990 } |
| 10335 HReturn.prototype.accept$1 = function($0) { | 9991 HReturn.prototype.accept$1 = function($0) { |
| 10336 return this.accept(($0 && $0.is$HVisitor())); | 9992 return this.accept($0); |
| 10337 }; | 9993 }; |
| 10338 HReturn.prototype.toString$0 = function() { | 9994 HReturn.prototype.toString$0 = function() { |
| 10339 return this.toString(); | 9995 return this.toString(); |
| 10340 }; | 9996 }; |
| 10341 // ********** Code for HThrow ************** | 9997 // ********** Code for HThrow ************** |
| 10342 function HThrow(value) { | 9998 function HThrow(value) { |
| 10343 HControlFlow.call(this, [value]); | 9999 HControlFlow.call(this, [value]); |
| 10344 // Initializers done | 10000 // Initializers done |
| 10345 } | 10001 } |
| 10346 $inherits(HThrow, HControlFlow); | 10002 $inherits(HThrow, HControlFlow); |
| 10347 HThrow.prototype.toString = function() { | 10003 HThrow.prototype.toString = function() { |
| 10348 return 'throw'; | 10004 return 'throw'; |
| 10349 } | 10005 } |
| 10350 HThrow.prototype.accept = function(visitor) { | 10006 HThrow.prototype.accept = function(visitor) { |
| 10351 return visitor.visitThrow(this); | 10007 return visitor.visitThrow(this); |
| 10352 } | 10008 } |
| 10353 HThrow.prototype.accept$1 = function($0) { | 10009 HThrow.prototype.accept$1 = function($0) { |
| 10354 return this.accept(($0 && $0.is$HVisitor())); | 10010 return this.accept($0); |
| 10355 }; | 10011 }; |
| 10356 HThrow.prototype.toString$0 = function() { | 10012 HThrow.prototype.toString$0 = function() { |
| 10357 return this.toString(); | 10013 return this.toString(); |
| 10358 }; | 10014 }; |
| 10359 // ********** Code for SsaOptimizerTask ************** | 10015 // ********** Code for SsaOptimizerTask ************** |
| 10360 function SsaOptimizerTask(compiler) { | 10016 function SsaOptimizerTask(compiler) { |
| 10361 CompilerTask.call(this, compiler); | 10017 CompilerTask.call(this, compiler); |
| 10362 // Initializers done | 10018 // Initializers done |
| 10363 } | 10019 } |
| 10364 $inherits(SsaOptimizerTask, CompilerTask); | 10020 $inherits(SsaOptimizerTask, CompilerTask); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 10380 } | 10036 } |
| 10381 $inherits(SsaConstantFolder, HBaseVisitor); | 10037 $inherits(SsaConstantFolder, HBaseVisitor); |
| 10382 SsaConstantFolder.prototype.visitGraph = function(graph) { | 10038 SsaConstantFolder.prototype.visitGraph = function(graph) { |
| 10383 this.visitDominatorTree(graph); | 10039 this.visitDominatorTree(graph); |
| 10384 } | 10040 } |
| 10385 SsaConstantFolder.prototype.visitBasicBlock = function(block) { | 10041 SsaConstantFolder.prototype.visitBasicBlock = function(block) { |
| 10386 var instruction = block.first; | 10042 var instruction = block.first; |
| 10387 while (instruction != null) { | 10043 while (instruction != null) { |
| 10388 var replacement = instruction.accept(this); | 10044 var replacement = instruction.accept(this); |
| 10389 if (replacement !== instruction) { | 10045 if (replacement !== instruction) { |
| 10390 block.addAfter(instruction, (replacement && replacement.is$HInstruction())
); | 10046 block.addAfter(instruction, replacement); |
| 10391 block.rewrite(instruction, (replacement && replacement.is$HInstruction()))
; | 10047 block.rewrite(instruction, replacement); |
| 10392 block.remove(instruction); | 10048 block.remove(instruction); |
| 10393 } | 10049 } |
| 10394 instruction = instruction.next; | 10050 instruction = instruction.next; |
| 10395 } | 10051 } |
| 10396 } | 10052 } |
| 10397 SsaConstantFolder.prototype.visitInstruction = function(node) { | 10053 SsaConstantFolder.prototype.visitInstruction = function(node) { |
| 10398 return node; | 10054 return node; |
| 10399 } | 10055 } |
| 10400 SsaConstantFolder.prototype.visitEquals = function(node) { | 10056 SsaConstantFolder.prototype.visitEquals = function(node) { |
| 10401 var $0; | |
| 10402 var inputs = node.inputs; | 10057 var inputs = node.inputs; |
| 10403 if ((inputs.$index(0) instanceof HLiteral) && (inputs.$index(1) instanceof HLi
teral)) { | 10058 if ((inputs.$index(0) instanceof HLiteral) && (inputs.$index(1) instanceof HLi
teral)) { |
| 10404 var op1 = (($0 = inputs.$index(0)) && $0.is$HLiteral()); | 10059 var op1 = inputs.$index(0); |
| 10405 var op2 = (($0 = inputs.$index(1)) && $0.is$HLiteral()); | 10060 var op2 = inputs.$index(1); |
| 10406 return new HLiteral($eq(op1.value, op2.value)); | 10061 return new HLiteral($eq(op1.value, op2.value)); |
| 10407 } | 10062 } |
| 10408 return node; | 10063 return node; |
| 10409 } | 10064 } |
| 10410 SsaConstantFolder.prototype.visitArithmetic = function(node) { | 10065 SsaConstantFolder.prototype.visitArithmetic = function(node) { |
| 10411 var $0; | |
| 10412 var inputs = node.inputs; | 10066 var inputs = node.inputs; |
| 10413 $assert(inputs.length == 2, "inputs.length == 2", "optimize.dart", 57, 12); | 10067 if (inputs.$index(0).isLiteralNumber$0() && inputs.$index(1).isLiteralNumber$0
()) { |
| 10414 if ($notnull_bool(inputs.$index(0).isLiteralNumber$0()) && $notnull_bool(input
s.$index(1).isLiteralNumber$0())) { | 10068 var op1 = inputs.$index(0); |
| 10415 var op1 = (($0 = inputs.$index(0)) && $0.is$HLiteral()); | 10069 var op2 = inputs.$index(1); |
| 10416 var op2 = (($0 = inputs.$index(1)) && $0.is$HLiteral()); | |
| 10417 try { | 10070 try { |
| 10418 var folded = node.evaluate($assert_num(op1.value), $assert_num(op2.value))
; | 10071 var folded = node.evaluate(op1.value, op2.value); |
| 10419 return new HLiteral(folded); | 10072 return new HLiteral(folded); |
| 10420 } catch (e) { | 10073 } catch (e) { |
| 10421 e = $toDartException(e); | 10074 e = $toDartException(e); |
| 10422 if (!(e instanceof IntegerDivisionByZeroException)) throw e; | 10075 if (!(e instanceof IntegerDivisionByZeroException)) throw e; |
| 10423 return node; | 10076 return node; |
| 10424 } | 10077 } |
| 10425 } | 10078 } |
| 10426 return node; | 10079 return node; |
| 10427 } | 10080 } |
| 10428 SsaConstantFolder.prototype.visitAdd = function(node) { | 10081 SsaConstantFolder.prototype.visitAdd = function(node) { |
| 10429 var $0; | 10082 if (node.inputs.$index(0).isLiteralString$0()) { |
| 10430 if ($notnull_bool(node.inputs.$index(0).isLiteralString$0())) { | 10083 var op1 = node.inputs.$index(0); |
| 10431 var op1 = (($0 = node.inputs.$index(0)) && $0.is$HLiteral()); | 10084 var op2 = node.inputs.$index(1); |
| 10432 var op2 = (($0 = node.inputs.$index(1)) && $0.is$HLiteral()); | |
| 10433 return new HLiteral(new StringWrapper(("" + op1.value + " + " + op2.value +
""))); | 10085 return new HLiteral(new StringWrapper(("" + op1.value + " + " + op2.value +
""))); |
| 10434 } | 10086 } |
| 10435 return this.visitArithmetic(node); | 10087 return this.visitArithmetic(node); |
| 10436 } | 10088 } |
| 10437 // ********** Code for SsaDeadCodeEliminator ************** | 10089 // ********** Code for SsaDeadCodeEliminator ************** |
| 10438 function SsaDeadCodeEliminator() { | 10090 function SsaDeadCodeEliminator() { |
| 10439 HGraphVisitor.call(this); | 10091 HGraphVisitor.call(this); |
| 10440 // Initializers done | 10092 // Initializers done |
| 10441 } | 10093 } |
| 10442 $inherits(SsaDeadCodeEliminator, HGraphVisitor); | 10094 $inherits(SsaDeadCodeEliminator, HGraphVisitor); |
| 10443 SsaDeadCodeEliminator.isDeadCode = function(instruction) { | 10095 SsaDeadCodeEliminator.isDeadCode = function(instruction) { |
| 10444 return !$notnull_bool(instruction.hasSideEffects()) && instruction.get$usedBy(
).isEmpty(); | 10096 return !instruction.hasSideEffects() && instruction.get$usedBy().isEmpty(); |
| 10445 } | 10097 } |
| 10446 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) { | 10098 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) { |
| 10447 this.visitPostDominatorTree(graph); | 10099 this.visitPostDominatorTree(graph); |
| 10448 } | 10100 } |
| 10449 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) { | 10101 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) { |
| 10450 var instruction = block.last; | 10102 var instruction = block.last; |
| 10451 while (instruction != null) { | 10103 while (instruction != null) { |
| 10452 var previous = instruction.previous; | 10104 var previous = instruction.previous; |
| 10453 if ($notnull_bool(SsaDeadCodeEliminator.isDeadCode(instruction))) block.remo
ve(instruction); | 10105 if (SsaDeadCodeEliminator.isDeadCode(instruction)) block.remove(instruction)
; |
| 10454 instruction = (previous && previous.is$HInstruction()); | 10106 instruction = previous; |
| 10455 } | 10107 } |
| 10456 } | 10108 } |
| 10457 // ********** Code for SsaInstructionMerger ************** | 10109 // ********** Code for SsaInstructionMerger ************** |
| 10458 function SsaInstructionMerger() { | 10110 function SsaInstructionMerger() { |
| 10459 HInstructionVisitor.call(this); | 10111 HInstructionVisitor.call(this); |
| 10460 // Initializers done | 10112 // Initializers done |
| 10461 } | 10113 } |
| 10462 $inherits(SsaInstructionMerger, HInstructionVisitor); | 10114 $inherits(SsaInstructionMerger, HInstructionVisitor); |
| 10463 SsaInstructionMerger.prototype.visitGraph = function(graph) { | 10115 SsaInstructionMerger.prototype.visitGraph = function(graph) { |
| 10464 this.visitDominatorTree(graph); | 10116 this.visitDominatorTree(graph); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10538 } | 10190 } |
| 10539 } | 10191 } |
| 10540 HTracer.prototype.addInstructions = function(block) { | 10192 HTracer.prototype.addInstructions = function(block) { |
| 10541 var stringifier = new HInstructionStringifier(block); | 10193 var stringifier = new HInstructionStringifier(block); |
| 10542 for (var instruction = block.first; | 10194 for (var instruction = block.first; |
| 10543 instruction != null; instruction = instruction.next) { | 10195 instruction != null; instruction = instruction.next) { |
| 10544 var bci = 0; | 10196 var bci = 0; |
| 10545 var uses = instruction.get$usedBy().length; | 10197 var uses = instruction.get$usedBy().length; |
| 10546 this.addIndent(); | 10198 this.addIndent(); |
| 10547 var temporaryId = stringifier.temporaryId(instruction); | 10199 var temporaryId = stringifier.temporaryId(instruction); |
| 10548 var instructionString = $assert_String(stringifier.visit(instruction)); | 10200 var instructionString = stringifier.visit(instruction); |
| 10549 this.add(("" + bci + " " + uses + " " + temporaryId + " " + instructionStrin
g + " <|@\n")); | 10201 this.add(("" + bci + " " + uses + " " + temporaryId + " " + instructionStrin
g + " <|@\n")); |
| 10550 } | 10202 } |
| 10551 } | 10203 } |
| 10552 HTracer.prototype.visitBasicBlock = function(block) { | 10204 HTracer.prototype.visitBasicBlock = function(block) { |
| 10553 var $this = this; // closure support | 10205 var $this = this; // closure support |
| 10554 $assert(block.id != null, "block.id !== null", "tracer.dart", 75, 12); | |
| 10555 this.tag("block", (function () { | 10206 this.tag("block", (function () { |
| 10556 $this.printProperty("name", ("B" + block.id + "")); | 10207 $this.printProperty("name", ("B" + block.id + "")); |
| 10557 $this.printProperty("from_bci", -1); | 10208 $this.printProperty("from_bci", -1); |
| 10558 $this.printProperty("to_bci", -1); | 10209 $this.printProperty("to_bci", -1); |
| 10559 $this.addPredecessors(block); | 10210 $this.addPredecessors(block); |
| 10560 $this.addSuccessors(block); | 10211 $this.addSuccessors(block); |
| 10561 $this.printEmptyProperty("xhandlers"); | 10212 $this.printEmptyProperty("xhandlers"); |
| 10562 $this.printEmptyProperty("flags"); | 10213 $this.printEmptyProperty("flags"); |
| 10563 if (block.dominator != null) { | 10214 if (block.dominator != null) { |
| 10564 $this.printProperty("dominator", ("B" + block.dominator.id + "")); | 10215 $this.printProperty("dominator", ("B" + block.dominator.id + "")); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10607 HTracer.prototype.addIndent = function() { | 10258 HTracer.prototype.addIndent = function() { |
| 10608 for (var i = 0; | 10259 for (var i = 0; |
| 10609 i < this.indent; i++) { | 10260 i < this.indent; i++) { |
| 10610 this.add(" "); | 10261 this.add(" "); |
| 10611 } | 10262 } |
| 10612 } | 10263 } |
| 10613 HTracer.prototype.toString = function() { | 10264 HTracer.prototype.toString = function() { |
| 10614 return this.output.toString(); | 10265 return this.output.toString(); |
| 10615 } | 10266 } |
| 10616 HTracer.prototype.add$1 = function($0) { | 10267 HTracer.prototype.add$1 = function($0) { |
| 10617 return this.add($assert_String($0)); | 10268 return this.add($0); |
| 10618 }; | 10269 }; |
| 10619 HTracer.prototype.toString$0 = function() { | 10270 HTracer.prototype.toString$0 = function() { |
| 10620 return this.toString(); | 10271 return this.toString(); |
| 10621 }; | 10272 }; |
| 10622 // ********** Code for HInstructionStringifier ************** | 10273 // ********** Code for HInstructionStringifier ************** |
| 10623 function HInstructionStringifier(currentBlock) { | 10274 function HInstructionStringifier(currentBlock) { |
| 10624 this.currentBlock = currentBlock; | 10275 this.currentBlock = currentBlock; |
| 10625 // Initializers done | 10276 // Initializers done |
| 10626 } | 10277 } |
| 10627 HInstructionStringifier.prototype.is$HVisitor = function(){return this;}; | |
| 10628 HInstructionStringifier.prototype.visit = function(node) { | 10278 HInstructionStringifier.prototype.visit = function(node) { |
| 10629 return node.accept(this); | 10279 return node.accept(this); |
| 10630 } | 10280 } |
| 10631 HInstructionStringifier.prototype.visitBasicBlock = function(node) { | 10281 HInstructionStringifier.prototype.visitBasicBlock = function(node) { |
| 10632 unreachable(); | 10282 unreachable(); |
| 10633 } | 10283 } |
| 10634 HInstructionStringifier.prototype.temporaryId = function(instruction) { | 10284 HInstructionStringifier.prototype.temporaryId = function(instruction) { |
| 10635 return ("v" + instruction.id + ""); | 10285 return ("v" + instruction.id + ""); |
| 10636 } | 10286 } |
| 10637 HInstructionStringifier.prototype.visitAdd = function(node) { | 10287 HInstructionStringifier.prototype.visitAdd = function(node) { |
| 10638 return this.visitInvoke(node); | 10288 return this.visitInvoke(node); |
| 10639 } | 10289 } |
| 10640 HInstructionStringifier.prototype.visitDivide = function(node) { | 10290 HInstructionStringifier.prototype.visitDivide = function(node) { |
| 10641 return this.visitInvoke(node); | 10291 return this.visitInvoke(node); |
| 10642 } | 10292 } |
| 10643 HInstructionStringifier.prototype.visitEquals = function(node) { | 10293 HInstructionStringifier.prototype.visitEquals = function(node) { |
| 10644 return this.visitInvoke(node); | 10294 return this.visitInvoke(node); |
| 10645 } | 10295 } |
| 10646 HInstructionStringifier.prototype.visitExit = function(node) { | 10296 HInstructionStringifier.prototype.visitExit = function(node) { |
| 10647 return "exit"; | 10297 return "exit"; |
| 10648 } | 10298 } |
| 10649 HInstructionStringifier.prototype.visitGoto = function(node) { | 10299 HInstructionStringifier.prototype.visitGoto = function(node) { |
| 10650 var $0; | 10300 var target = this.currentBlock.successors.$index(0); |
| 10651 var target = (($0 = this.currentBlock.successors.$index(0)) && $0.is$HBasicBlo
ck()); | |
| 10652 return ("Goto: (B" + target.id + ")"); | 10301 return ("Goto: (B" + target.id + ")"); |
| 10653 } | 10302 } |
| 10654 HInstructionStringifier.prototype.visitIf = function(node) { | 10303 HInstructionStringifier.prototype.visitIf = function(node) { |
| 10655 var $0; | 10304 var thenBlock = this.currentBlock.successors.$index(0); |
| 10656 var thenBlock = (($0 = this.currentBlock.successors.$index(0)) && $0.is$HBasic
Block()); | 10305 var elseBlock = this.currentBlock.successors.$index(1); |
| 10657 var elseBlock = (($0 = this.currentBlock.successors.$index(1)) && $0.is$HBasic
Block()); | 10306 var conditionId = this.temporaryId(node.inputs.$index(0)); |
| 10658 var conditionId = this.temporaryId((($0 = node.inputs.$index(0)) && $0.is$HIns
truction())); | |
| 10659 return ("If (" + conditionId + "): (B" + thenBlock.id + ") else (B" + elseBloc
k.id + ")"); | 10307 return ("If (" + conditionId + "): (B" + thenBlock.id + ") else (B" + elseBloc
k.id + ")"); |
| 10660 } | 10308 } |
| 10661 HInstructionStringifier.prototype.visitGenericInvoke = function(invokeType, invo
ke) { | 10309 HInstructionStringifier.prototype.visitGenericInvoke = function(invokeType, invo
ke) { |
| 10662 var $0; | |
| 10663 var arguments = new StringBufferImpl(""); | 10310 var arguments = new StringBufferImpl(""); |
| 10664 for (var i = 0; | 10311 for (var i = 0; |
| 10665 i < invoke.inputs.length; i++) { | 10312 i < invoke.inputs.length; i++) { |
| 10666 if (i != 0) arguments.add(", "); | 10313 if (i != 0) arguments.add(", "); |
| 10667 arguments.add(this.temporaryId((($0 = invoke.inputs.$index(i)) && $0.is$HIns
truction()))); | 10314 arguments.add(this.temporaryId(invoke.inputs.$index(i))); |
| 10668 } | 10315 } |
| 10669 return ("" + invokeType + ": " + invoke.element.name + "(" + arguments + ")"); | 10316 return ("" + invokeType + ": " + invoke.element.name + "(" + arguments + ")"); |
| 10670 } | 10317 } |
| 10671 HInstructionStringifier.prototype.visitInvoke = function(invoke) { | 10318 HInstructionStringifier.prototype.visitInvoke = function(invoke) { |
| 10672 return this.visitGenericInvoke("Invoke", invoke); | 10319 return this.visitGenericInvoke("Invoke", invoke); |
| 10673 } | 10320 } |
| 10674 HInstructionStringifier.prototype.visitInvokeForeign = function(invoke) { | 10321 HInstructionStringifier.prototype.visitInvokeForeign = function(invoke) { |
| 10675 return this.visitGenericInvoke("InvokeForeign", invoke); | 10322 return this.visitGenericInvoke("InvokeForeign", invoke); |
| 10676 } | 10323 } |
| 10677 HInstructionStringifier.prototype.visitLiteral = function(literal) { | 10324 HInstructionStringifier.prototype.visitLiteral = function(literal) { |
| 10678 return ("Literal " + literal.value + ""); | 10325 return ("Literal " + literal.value + ""); |
| 10679 } | 10326 } |
| 10680 HInstructionStringifier.prototype.visitLoopBranch = function(branch) { | 10327 HInstructionStringifier.prototype.visitLoopBranch = function(branch) { |
| 10681 var $0; | 10328 var bodyBlock = this.currentBlock.successors.$index(0); |
| 10682 var bodyBlock = (($0 = this.currentBlock.successors.$index(0)) && $0.is$HBasic
Block()); | 10329 var exitBlock = this.currentBlock.successors.$index(1); |
| 10683 var exitBlock = (($0 = this.currentBlock.successors.$index(1)) && $0.is$HBasic
Block()); | 10330 var conditionId = this.temporaryId(branch.inputs.$index(0)); |
| 10684 var conditionId = this.temporaryId((($0 = branch.inputs.$index(0)) && $0.is$HI
nstruction())); | |
| 10685 return ("While (" + conditionId + "): (B" + bodyBlock.id + ") then (B" + exitB
lock.id + ")"); | 10331 return ("While (" + conditionId + "): (B" + bodyBlock.id + ") then (B" + exitB
lock.id + ")"); |
| 10686 } | 10332 } |
| 10687 HInstructionStringifier.prototype.visitMultiply = function(node) { | 10333 HInstructionStringifier.prototype.visitMultiply = function(node) { |
| 10688 return this.visitInvoke(node); | 10334 return this.visitInvoke(node); |
| 10689 } | 10335 } |
| 10690 HInstructionStringifier.prototype.visitParameter = function(node) { | 10336 HInstructionStringifier.prototype.visitParameter = function(node) { |
| 10691 return ("p" + node.parameterIndex + ""); | 10337 return ("p" + node.parameterIndex + ""); |
| 10692 } | 10338 } |
| 10693 HInstructionStringifier.prototype.visitPhi = function(phi) { | 10339 HInstructionStringifier.prototype.visitPhi = function(phi) { |
| 10694 var $0; | 10340 return ("Phi(" + this.temporaryId(phi.inputs.$index(0)) + ", " + this.temporar
yId(phi.inputs.$index(1)) + ")"); |
| 10695 return ("Phi(" + this.temporaryId((($0 = phi.inputs.$index(0)) && $0.is$HInstr
uction())) + ", " + this.temporaryId((($0 = phi.inputs.$index(1)) && $0.is$HInst
ruction())) + ")"); | |
| 10696 } | 10341 } |
| 10697 HInstructionStringifier.prototype.visitReturn = function(node) { | 10342 HInstructionStringifier.prototype.visitReturn = function(node) { |
| 10698 var $0; | 10343 return ("Return " + this.temporaryId(node.inputs.$index(0)) + ""); |
| 10699 return ("Return " + this.temporaryId((($0 = node.inputs.$index(0)) && $0.is$HI
nstruction())) + ""); | |
| 10700 } | 10344 } |
| 10701 HInstructionStringifier.prototype.visitSubtract = function(node) { | 10345 HInstructionStringifier.prototype.visitSubtract = function(node) { |
| 10702 return this.visitInvoke(node); | 10346 return this.visitInvoke(node); |
| 10703 } | 10347 } |
| 10704 HInstructionStringifier.prototype.visitThrow = function(node) { | 10348 HInstructionStringifier.prototype.visitThrow = function(node) { |
| 10705 var $0; | 10349 return ("Throw " + this.temporaryId(node.inputs.$index(0)) + ""); |
| 10706 return ("Throw " + this.temporaryId((($0 = node.inputs.$index(0)) && $0.is$HIn
struction())) + ""); | |
| 10707 } | 10350 } |
| 10708 HInstructionStringifier.prototype.visitTruncatingDivide = function(node) { | 10351 HInstructionStringifier.prototype.visitTruncatingDivide = function(node) { |
| 10709 return this.visitInvoke(node); | 10352 return this.visitInvoke(node); |
| 10710 } | 10353 } |
| 10711 HInstructionStringifier.prototype.visit$1 = function($0) { | 10354 HInstructionStringifier.prototype.visit$1 = function($0) { |
| 10712 return this.visit(($0 && $0.is$HInstruction())); | 10355 return this.visit($0); |
| 10713 }; | 10356 }; |
| 10714 // ********** Code for HValidator ************** | 10357 // ********** Code for HValidator ************** |
| 10715 function HValidator() { | 10358 function HValidator() { |
| 10716 this.isValid = true | 10359 this.isValid = true |
| 10717 HInstructionVisitor.call(this); | 10360 HInstructionVisitor.call(this); |
| 10718 // Initializers done | 10361 // Initializers done |
| 10719 } | 10362 } |
| 10720 $inherits(HValidator, HInstructionVisitor); | 10363 $inherits(HValidator, HInstructionVisitor); |
| 10721 HValidator.prototype.visitGraph = function(graph) { | 10364 HValidator.prototype.visitGraph = function(graph) { |
| 10722 this.graph = graph; | 10365 this.graph = graph; |
| 10723 this.visitDominatorTree(graph); | 10366 this.visitDominatorTree(graph); |
| 10724 } | 10367 } |
| 10725 HValidator.prototype.markInvalid = function(reason) { | 10368 HValidator.prototype.markInvalid = function(reason) { |
| 10726 print(reason); | 10369 print(reason); |
| 10727 this.isValid = false; | 10370 this.isValid = false; |
| 10728 } | 10371 } |
| 10729 HValidator.prototype.visitBasicBlock = function(block) { | 10372 HValidator.prototype.visitBasicBlock = function(block) { |
| 10730 if (!$notnull_bool(this.isValid)) return; | 10373 if (!this.isValid) return; |
| 10731 if (block.first == null || block.last == null) { | 10374 if (block.first == null || block.last == null) { |
| 10732 this.markInvalid("empty block"); | 10375 this.markInvalid("empty block"); |
| 10733 } | 10376 } |
| 10734 if (!(block.last instanceof HControlFlow)) { | 10377 if (!(block.last instanceof HControlFlow)) { |
| 10735 this.markInvalid("block ends with non-tail node."); | 10378 this.markInvalid("block ends with non-tail node."); |
| 10736 } | 10379 } |
| 10737 if ((block.last instanceof HIf) && block.successors.length != 2) { | 10380 if ((block.last instanceof HIf) && block.successors.length != 2) { |
| 10738 this.markInvalid("If node without two successors"); | 10381 this.markInvalid("If node without two successors"); |
| 10739 } | 10382 } |
| 10740 if ((block.last instanceof HConditionalBranch) && block.successors.length != 2
) { | 10383 if ((block.last instanceof HConditionalBranch) && block.successors.length != 2
) { |
| 10741 this.markInvalid("Conditional node without two successors"); | 10384 this.markInvalid("Conditional node without two successors"); |
| 10742 } | 10385 } |
| 10743 if ((block.last instanceof HGoto) && block.successors.length != 1) { | 10386 if ((block.last instanceof HGoto) && block.successors.length != 1) { |
| 10744 this.markInvalid("Goto node without one successor"); | 10387 this.markInvalid("Goto node without one successor"); |
| 10745 } | 10388 } |
| 10746 if ((block.last instanceof HReturn) && (block.successors.length != 1 || !$notn
ull_bool(block.successors.$index(0).isExitBlock$0()))) { | 10389 if ((block.last instanceof HReturn) && (block.successors.length != 1 || !block
.successors.$index(0).isExitBlock$0())) { |
| 10747 this.markInvalid("Return node with > 1 succesor or not going to exit-block")
; | 10390 this.markInvalid("Return node with > 1 succesor or not going to exit-block")
; |
| 10748 } | 10391 } |
| 10749 if ((block.last instanceof HExit) && !block.successors.isEmpty()) { | 10392 if ((block.last instanceof HExit) && !block.successors.isEmpty()) { |
| 10750 this.markInvalid("Exit block with successor"); | 10393 this.markInvalid("Exit block with successor"); |
| 10751 } | 10394 } |
| 10752 if ((block.last instanceof HThrow) && !block.successors.isEmpty()) { | 10395 if ((block.last instanceof HThrow) && !block.successors.isEmpty()) { |
| 10753 this.markInvalid("Throw block with successor"); | 10396 this.markInvalid("Throw block with successor"); |
| 10754 } | 10397 } |
| 10755 if (block.successors.isEmpty() && !(block.last instanceof HThrow) && !$notnull
_bool(block.isExitBlock())) { | 10398 if (block.successors.isEmpty() && !(block.last instanceof HThrow) && !block.is
ExitBlock()) { |
| 10756 this.markInvalid("Non-exit or throw block without successor"); | 10399 this.markInvalid("Non-exit or throw block without successor"); |
| 10757 } | 10400 } |
| 10758 if (block.id == null) this.markInvalid("block without id"); | 10401 if (block.id == null) this.markInvalid("block without id"); |
| 10759 var $list = block.successors; | 10402 var $list = block.successors; |
| 10760 for (var $i = 0;$i < $list.length; $i++) { | 10403 for (var $i = 0;$i < $list.length; $i++) { |
| 10761 var successor = $list.$index($i); | 10404 var successor = $list.$index($i); |
| 10762 if (!$notnull_bool(this.isValid)) break; | 10405 if (!this.isValid) break; |
| 10763 if (successor.id == null) this.markInvalid("successor without id"); | 10406 if (successor.id == null) this.markInvalid("successor without id"); |
| 10764 if (successor.id <= block.id && !$notnull_bool(successor.isLoopHeader)) { | 10407 if (successor.id <= block.id && !successor.isLoopHeader) { |
| 10765 this.markInvalid("successor with lower id, but not a loop-header"); | 10408 this.markInvalid("successor with lower id, but not a loop-header"); |
| 10766 } | 10409 } |
| 10767 } | 10410 } |
| 10768 var lastId = 0; | 10411 var lastId = 0; |
| 10769 var $list = block.dominatedBlocks; | 10412 var $list = block.dominatedBlocks; |
| 10770 for (var $i = 0;$i < $list.length; $i++) { | 10413 for (var $i = 0;$i < $list.length; $i++) { |
| 10771 var dominated = $list.$index($i); | 10414 var dominated = $list.$index($i); |
| 10772 if (!$notnull_bool(this.isValid)) break; | 10415 if (!this.isValid) break; |
| 10773 if (dominated.dominator !== block) { | 10416 if (dominated.dominator !== block) { |
| 10774 this.markInvalid("dominated block not pointing back"); | 10417 this.markInvalid("dominated block not pointing back"); |
| 10775 } | 10418 } |
| 10776 if (dominated.id == null || dominated.id <= lastId) { | 10419 if (dominated.id == null || dominated.id <= lastId) { |
| 10777 this.markInvalid("dominated.id === null or dominated has <= id"); | 10420 this.markInvalid("dominated.id === null or dominated has <= id"); |
| 10778 } | 10421 } |
| 10779 lastId = dominated.id; | 10422 lastId = dominated.id; |
| 10780 } | 10423 } |
| 10781 if (!$notnull_bool(this.isValid)) return; | 10424 if (!this.isValid) return; |
| 10782 HInstructionVisitor.prototype.visitBasicBlock.call(this, block); | 10425 HInstructionVisitor.prototype.visitBasicBlock.call(this, block); |
| 10783 } | 10426 } |
| 10784 HValidator.countInstruction = function(instructions, instruction) { | 10427 HValidator.countInstruction = function(instructions, instruction) { |
| 10785 var result = 0; | 10428 var result = 0; |
| 10786 for (var i = 0; | 10429 for (var i = 0; |
| 10787 i < instructions.length; i++) { | 10430 i < instructions.length; i++) { |
| 10788 if (instructions.$index(i) === instruction) result++; | 10431 if (instructions.$index(i) === instruction) result++; |
| 10789 } | 10432 } |
| 10790 return result; | 10433 return result; |
| 10791 } | 10434 } |
| 10792 HValidator.everyInstruction = function(instructions, f) { | 10435 HValidator.everyInstruction = function(instructions, f) { |
| 10793 var copy = ListFactory.ListFactory$from$factory(instructions); | 10436 var copy = ListFactory.ListFactory$from$factory(instructions); |
| 10794 for (var i = 0; | 10437 for (var i = 0; |
| 10795 i < copy.length; i++) { | 10438 i < copy.length; i++) { |
| 10796 var current = copy.$index(i); | 10439 var current = copy.$index(i); |
| 10797 if (current == null) continue; | 10440 if (current == null) continue; |
| 10798 var count = 1; | 10441 var count = 1; |
| 10799 for (var j = i + 1; | 10442 for (var j = i + 1; |
| 10800 j < copy.length; j++) { | 10443 j < copy.length; j++) { |
| 10801 if (copy.$index(j) === current) { | 10444 if (copy.$index(j) === current) { |
| 10802 copy.$setindex(j); | 10445 copy.$setindex(j); |
| 10803 count++; | 10446 count++; |
| 10804 } | 10447 } |
| 10805 } | 10448 } |
| 10806 if (!$notnull_bool(f.call$2(current, count))) return false; | 10449 if (!f.call$2(current, count)) return false; |
| 10807 } | 10450 } |
| 10808 return true; | 10451 return true; |
| 10809 } | 10452 } |
| 10810 HValidator.prototype.visitInstruction = function(instruction) { | 10453 HValidator.prototype.visitInstruction = function(instruction) { |
| 10811 var $this = this; // closure support | 10454 var $this = this; // closure support |
| 10812 function hasCorrectInputs(instruction) { | 10455 function hasCorrectInputs(instruction) { |
| 10813 var inBasicBlock = $assert_bool(instruction.isInBasicBlock$0()); | 10456 var inBasicBlock = instruction.isInBasicBlock$0(); |
| 10814 return HValidator.everyInstruction(instruction.inputs, (function (input, cou
nt) { | 10457 return HValidator.everyInstruction(instruction.inputs, (function (input, cou
nt) { |
| 10815 if ($notnull_bool(inBasicBlock)) { | 10458 if (inBasicBlock) { |
| 10816 return HValidator.countInstruction(input.get$usedBy(), (instruction && i
nstruction.is$HInstruction())) == count; | 10459 return HValidator.countInstruction(input.get$usedBy(), instruction) == c
ount; |
| 10817 } | 10460 } |
| 10818 else { | 10461 else { |
| 10819 return HValidator.countInstruction(input.get$usedBy(), (instruction && i
nstruction.is$HInstruction())) == 0; | 10462 return HValidator.countInstruction(input.get$usedBy(), instruction) == 0
; |
| 10820 } | 10463 } |
| 10821 }) | 10464 }) |
| 10822 ); | 10465 ); |
| 10823 } | 10466 } |
| 10824 function hasCorrectUses(instruction) { | 10467 function hasCorrectUses(instruction) { |
| 10825 if (!$notnull_bool(instruction.isInBasicBlock$0())) return true; | 10468 if (!instruction.isInBasicBlock$0()) return true; |
| 10826 return HValidator.everyInstruction(instruction.get$usedBy(), (function (use,
count) { | 10469 return HValidator.everyInstruction(instruction.get$usedBy(), (function (use,
count) { |
| 10827 return HValidator.countInstruction(use.inputs, (instruction && instruction
.is$HInstruction())) == count; | 10470 return HValidator.countInstruction(use.inputs, instruction) == count; |
| 10828 }) | 10471 }) |
| 10829 ); | 10472 ); |
| 10830 } | 10473 } |
| 10831 this.isValid = $notnull_bool(this.isValid) && $notnull_bool(hasCorrectInputs(i
nstruction)) && $notnull_bool(hasCorrectUses(instruction)); | 10474 this.isValid = this.isValid && hasCorrectInputs(instruction) && hasCorrectUses
(instruction); |
| 10832 } | 10475 } |
| 10833 // ********** Code for top level ************** | 10476 // ********** Code for top level ************** |
| 10834 // ********** Library leg ************** | 10477 // ********** Library leg ************** |
| 10835 // ********** Code for WorldCompiler ************** | 10478 // ********** Code for WorldCompiler ************** |
| 10836 function WorldCompiler(world, script) { | 10479 function WorldCompiler(world, script) { |
| 10837 this.world = world; | 10480 this.world = world; |
| 10838 Compiler.call(this, script); | 10481 Compiler.call(this, script); |
| 10839 // Initializers done | 10482 // Initializers done |
| 10840 } | 10483 } |
| 10841 $inherits(WorldCompiler, Compiler); | 10484 $inherits(WorldCompiler, Compiler); |
| 10842 WorldCompiler.prototype.log = function(message) { | 10485 WorldCompiler.prototype.log = function(message) { |
| 10843 if ($notnull_bool(options.showInfo)) { | 10486 if (options.showInfo) { |
| 10844 this.world.info(('[leg] ' + message + '')); | 10487 this.world.info(('[leg] ' + message + '')); |
| 10845 } | 10488 } |
| 10846 } | 10489 } |
| 10847 WorldCompiler.prototype.run = function() { | 10490 WorldCompiler.prototype.run = function() { |
| 10848 var success = Compiler.prototype.run.call(this); | 10491 var success = Compiler.prototype.run.call(this); |
| 10849 if ($notnull_bool(success)) { | 10492 if (success) { |
| 10850 var code = this.getGeneratedCode(); | 10493 var code = this.getGeneratedCode(); |
| 10851 this.world.legCode = $assert_String(code); | 10494 this.world.legCode = code; |
| 10852 this.world.jsBytesWritten = code.length; | 10495 this.world.jsBytesWritten = code.length; |
| 10853 var $list = this.tasks; | 10496 var $list = this.tasks; |
| 10854 for (var $i0 = 0;$i0 < $list.length; $i0++) { | 10497 for (var $i0 = 0;$i0 < $list.length; $i0++) { |
| 10855 var task = $list.$index($i0); | 10498 var task = $list.$index($i0); |
| 10856 this.log(('' + task.get$name() + ' took ' + task.get$timing() + 'msec')); | 10499 this.log(('' + task.get$name() + ' took ' + task.get$timing() + 'msec')); |
| 10857 } | 10500 } |
| 10858 } | 10501 } |
| 10859 return success; | 10502 return success; |
| 10860 } | 10503 } |
| 10861 WorldCompiler.prototype.spanFromNode = function(node) { | 10504 WorldCompiler.prototype.spanFromNode = function(node) { |
| 10862 var begin = node.getBeginToken(); | 10505 var begin = node.getBeginToken(); |
| 10863 var end = node.getEndToken(); | 10506 var end = node.getEndToken(); |
| 10864 if (begin == null || end == null) { | 10507 if (begin == null || end == null) { |
| 10865 this.cancel(('cannot find tokens to produce error message for ' + node + '.'
)); | 10508 this.cancel(('cannot find tokens to produce error message for ' + node + '.'
)); |
| 10866 } | 10509 } |
| 10867 var startOffset = begin.get$charOffset(); | 10510 var startOffset = begin.get$charOffset(); |
| 10868 var endOffset = end.get$charOffset() + end.toString$0().length; | 10511 var endOffset = end.get$charOffset() + end.toString$0().length; |
| 10869 return new SourceSpan(this.script.file, startOffset, endOffset); | 10512 return new SourceSpan(this.script.file, startOffset, endOffset); |
| 10870 } | 10513 } |
| 10871 WorldCompiler.prototype.reportWarning = function(node, message) { | 10514 WorldCompiler.prototype.reportWarning = function(node, message) { |
| 10872 var $0; | 10515 this.world.warning(('' + message + '.'), this.spanFromNode(node)); |
| 10873 this.world.warning(('' + message + '.'), (($0 = this.spanFromNode(node)) && $0
.is$SourceSpan())); | |
| 10874 } | 10516 } |
| 10875 // ********** Code for Compiler ************** | 10517 // ********** Code for Compiler ************** |
| 10876 function Compiler(script) { | 10518 function Compiler(script) { |
| 10877 this.script = script; | 10519 this.script = script; |
| 10878 // Initializers done | 10520 // Initializers done |
| 10879 this.universe = new Universe(); | 10521 this.universe = new Universe(); |
| 10880 this.worklist = new DoubleLinkedQueue(); | 10522 this.worklist = new DoubleLinkedQueue(); |
| 10881 this.scanner = new ScannerTask(this); | 10523 this.scanner = new ScannerTask(this); |
| 10882 this.parser = new ParserTask(this); | 10524 this.parser = new ParserTask(this); |
| 10883 this.resolver = new ResolverTask(this); | 10525 this.resolver = new ResolverTask(this); |
| 10884 this.checker = new TypeCheckerTask(this); | 10526 this.checker = new TypeCheckerTask(this); |
| 10885 this.builder = new SsaBuilderTask(this); | 10527 this.builder = new SsaBuilderTask(this); |
| 10886 this.optimizer = new SsaOptimizerTask(this); | 10528 this.optimizer = new SsaOptimizerTask(this); |
| 10887 this.generator = new SsaCodeGeneratorTask(this); | 10529 this.generator = new SsaCodeGeneratorTask(this); |
| 10888 this.tasks = [this.scanner, this.parser, this.resolver, this.checker, this.bui
lder, this.optimizer, this.generator]; | 10530 this.tasks = [this.scanner, this.parser, this.resolver, this.checker, this.bui
lder, this.optimizer, this.generator]; |
| 10889 } | 10531 } |
| 10890 Compiler.prototype.is$Compiler = function(){return this;}; | |
| 10891 Compiler.prototype.ensure = function(condition) { | 10532 Compiler.prototype.ensure = function(condition) { |
| 10892 if (!$notnull_bool(condition)) this.cancel('failed assertion in leg'); | 10533 if (!condition) this.cancel('failed assertion in leg'); |
| 10893 } | 10534 } |
| 10894 Compiler.prototype.unimplemented = function(methodName) { | 10535 Compiler.prototype.unimplemented = function(methodName) { |
| 10895 this.cancel(("" + methodName + " not implemented")); | 10536 this.cancel(("" + methodName + " not implemented")); |
| 10896 } | 10537 } |
| 10897 Compiler.prototype.cancel = function(reason) { | 10538 Compiler.prototype.cancel = function(reason) { |
| 10898 $throw(new CompilerCancelledException(reason)); | 10539 $throw(new CompilerCancelledException(reason)); |
| 10899 } | 10540 } |
| 10900 Compiler.prototype.log = function(message) { | 10541 Compiler.prototype.log = function(message) { |
| 10901 | 10542 |
| 10902 } | 10543 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 10919 return true; | 10560 return true; |
| 10920 } | 10561 } |
| 10921 Compiler.prototype.scanCoreLibrary = function() { | 10562 Compiler.prototype.scanCoreLibrary = function() { |
| 10922 var fileName = join([options.libDir, '..', 'leg', 'lib', 'core.dart']); | 10563 var fileName = join([options.libDir, '..', 'leg', 'lib', 'core.dart']); |
| 10923 var file = readSync(fileName); | 10564 var file = readSync(fileName); |
| 10924 this.scanner.scan(new leg_Script(file)); | 10565 this.scanner.scan(new leg_Script(file)); |
| 10925 var element = new ForeignElement(const$241/*const SourceString('JS')*/); | 10566 var element = new ForeignElement(const$241/*const SourceString('JS')*/); |
| 10926 this.universe.define(element); | 10567 this.universe.define(element); |
| 10927 } | 10568 } |
| 10928 Compiler.prototype.runCompiler = function() { | 10569 Compiler.prototype.runCompiler = function() { |
| 10929 var $0; | |
| 10930 this.scanCoreLibrary(); | 10570 this.scanCoreLibrary(); |
| 10931 this.scanner.scan(this.script); | 10571 this.scanner.scan(this.script); |
| 10932 var element = this.universe.find(const$244/*Compiler.MAIN*/); | 10572 var element = this.universe.find(const$244/*Compiler.MAIN*/); |
| 10933 if (element == null) this.cancel(('Could not find ' + const$244/*Compiler.MAIN
*/ + '')); | 10573 if (element == null) this.cancel(('Could not find ' + const$244/*Compiler.MAIN
*/ + '')); |
| 10934 this.compileMethod(element); | 10574 this.compileMethod(element); |
| 10935 while (!this.worklist.isEmpty()) { | 10575 while (!this.worklist.isEmpty()) { |
| 10936 this.compileMethod((($0 = this.worklist.removeLast()) && $0.is$Element())); | 10576 this.compileMethod(this.worklist.removeLast()); |
| 10937 } | 10577 } |
| 10938 } | 10578 } |
| 10939 Compiler.prototype.compileMethod = function(element) { | 10579 Compiler.prototype.compileMethod = function(element) { |
| 10940 var tree = this.parser.parse(element); | 10580 var tree = this.parser.parse(element); |
| 10941 var elements = this.resolver.resolve(tree); | 10581 var elements = this.resolver.resolve(tree); |
| 10942 this.checker.check(tree, elements); | 10582 this.checker.check(tree, elements); |
| 10943 var graph = this.builder.build(tree, elements); | 10583 var graph = this.builder.build(tree, elements); |
| 10944 this.optimizer.optimize(graph); | 10584 this.optimizer.optimize(graph); |
| 10945 var code = this.generator.generate(tree, graph); | 10585 var code = this.generator.generate(tree, graph); |
| 10946 this.universe.addGeneratedCode(element, code); | 10586 this.universe.addGeneratedCode(element, code); |
| 10947 return code; | 10587 return code; |
| 10948 } | 10588 } |
| 10949 Compiler.prototype.resolveType = function(element) { | 10589 Compiler.prototype.resolveType = function(element) { |
| 10950 this.resolver.resolveType(this.parser.parse(element)); | 10590 this.resolver.resolveType(this.parser.parse(element)); |
| 10951 } | 10591 } |
| 10952 Compiler.prototype.getGeneratedCode = function() { | 10592 Compiler.prototype.getGeneratedCode = function() { |
| 10953 var $0; | |
| 10954 var buffer = new StringBufferImpl(""); | 10593 var buffer = new StringBufferImpl(""); |
| 10955 var codeBlocks = (($0 = this.universe.generatedCode.getValues()) && $0.is$List
$String()); | 10594 var codeBlocks = this.universe.generatedCode.getValues(); |
| 10956 for (var i = codeBlocks.length - 1; | 10595 for (var i = codeBlocks.length - 1; |
| 10957 i >= 0; i--) { | 10596 i >= 0; i--) { |
| 10958 buffer.add(codeBlocks.$index(i)); | 10597 buffer.add(codeBlocks.$index(i)); |
| 10959 } | 10598 } |
| 10960 buffer.add('main();\n'); | 10599 buffer.add('main();\n'); |
| 10961 return buffer.toString(); | 10600 return buffer.toString(); |
| 10962 } | 10601 } |
| 10963 Compiler.prototype.reportWarning = function(node, message) { | 10602 Compiler.prototype.reportWarning = function(node, message) { |
| 10964 | 10603 |
| 10965 } | 10604 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10998 this.toResolve = new DoubleLinkedQueue(); | 10637 this.toResolve = new DoubleLinkedQueue(); |
| 10999 CompilerTask.call(this, compiler); | 10638 CompilerTask.call(this, compiler); |
| 11000 // Initializers done | 10639 // Initializers done |
| 11001 } | 10640 } |
| 11002 $inherits(ResolverTask, CompilerTask); | 10641 $inherits(ResolverTask, CompilerTask); |
| 11003 ResolverTask.prototype.get$name = function() { | 10642 ResolverTask.prototype.get$name = function() { |
| 11004 return 'Resolver'; | 10643 return 'Resolver'; |
| 11005 } | 10644 } |
| 11006 ResolverTask.prototype.resolve = function(tree) { | 10645 ResolverTask.prototype.resolve = function(tree) { |
| 11007 var $this = this; // closure support | 10646 var $this = this; // closure support |
| 11008 var $0; | 10647 return this.measure((function () { |
| 11009 return (($0 = this.measure((function () { | |
| 11010 var visitor = new ResolverVisitor($this.compiler); | 10648 var visitor = new ResolverVisitor($this.compiler); |
| 11011 visitor.visit(tree); | 10649 visitor.visit(tree); |
| 11012 while (!$this.toResolve.isEmpty()) { | 10650 while (!$this.toResolve.isEmpty()) { |
| 11013 $this.toResolve.removeFirst().resolve$1($this.compiler); | 10651 $this.toResolve.removeFirst().resolve$1($this.compiler); |
| 11014 } | 10652 } |
| 11015 return visitor.mapping; | 10653 return visitor.mapping; |
| 11016 }) | 10654 }) |
| 11017 )) && $0.is$Map$Node$Element()); | 10655 ); |
| 11018 } | 10656 } |
| 11019 ResolverTask.prototype.resolveType = function(tree) { | 10657 ResolverTask.prototype.resolveType = function(tree) { |
| 11020 var $this = this; // closure support | 10658 var $this = this; // closure support |
| 11021 this.measure((function () { | 10659 this.measure((function () { |
| 11022 var visitor = new ClassResolverVisitor($this.compiler); | 10660 var visitor = new ClassResolverVisitor($this.compiler); |
| 11023 visitor.visit(tree); | 10661 visitor.visit(tree); |
| 11024 }) | 10662 }) |
| 11025 ); | 10663 ); |
| 11026 } | 10664 } |
| 11027 ResolverTask.prototype.resolve$1 = function($0) { | 10665 ResolverTask.prototype.resolve$1 = function($0) { |
| 11028 return this.resolve(($0 && $0.is$Node())); | 10666 return this.resolve($0); |
| 11029 }; | 10667 }; |
| 11030 // ********** Code for ErrorMessages ************** | 10668 // ********** Code for ErrorMessages ************** |
| 11031 function ErrorMessages() {} | 10669 function ErrorMessages() {} |
| 11032 ErrorMessages.cannotResolve = function(id) { | 10670 ErrorMessages.cannotResolve = function(id) { |
| 11033 return ("cannot resolve " + id + ""); | 10671 return ("cannot resolve " + id + ""); |
| 11034 } | 10672 } |
| 11035 ErrorMessages.cannotResolveType = function(id) { | 10673 ErrorMessages.cannotResolveType = function(id) { |
| 11036 return ("cannot resolve type " + id + ""); | 10674 return ("cannot resolve type " + id + ""); |
| 11037 } | 10675 } |
| 11038 ErrorMessages.duplicateDefinition = function(id) { | 10676 ErrorMessages.duplicateDefinition = function(id) { |
| 11039 return ("duplicate definition of " + id + ""); | 10677 return ("duplicate definition of " + id + ""); |
| 11040 } | 10678 } |
| 11041 ErrorMessages.notAType = function(id) { | 10679 ErrorMessages.notAType = function(id) { |
| 11042 return ("" + id + " is not a type"); | 10680 return ("" + id + " is not a type"); |
| 11043 } | 10681 } |
| 11044 // ********** Code for ResolverVisitor ************** | 10682 // ********** Code for ResolverVisitor ************** |
| 11045 function ResolverVisitor(compiler) { | 10683 function ResolverVisitor(compiler) { |
| 11046 this.compiler = compiler; | 10684 this.compiler = compiler; |
| 11047 this.mapping = new LinkedHashMapImplementation(); | 10685 this.mapping = new LinkedHashMapImplementation(); |
| 11048 this.context = new Scope(new TopScope(compiler.universe)); | 10686 this.context = new Scope(new TopScope(compiler.universe)); |
| 11049 // Initializers done | 10687 // Initializers done |
| 11050 } | 10688 } |
| 11051 ResolverVisitor.prototype.is$Visitor = function(){return this;}; | |
| 11052 ResolverVisitor.prototype.fail = function(node, message) { | 10689 ResolverVisitor.prototype.fail = function(node, message) { |
| 11053 this.compiler.cancel(message); | 10690 this.compiler.cancel(message); |
| 11054 } | 10691 } |
| 11055 ResolverVisitor.prototype.warning = function(node, message) { | 10692 ResolverVisitor.prototype.warning = function(node, message) { |
| 11056 this.compiler.reportWarning(node, message); | 10693 this.compiler.reportWarning(node, message); |
| 11057 } | 10694 } |
| 11058 ResolverVisitor.prototype.visit = function(node) { | 10695 ResolverVisitor.prototype.visit = function(node) { |
| 11059 if (node == null) return null; | 10696 if (node == null) return null; |
| 11060 return node.accept(this); | 10697 return node.accept(this); |
| 11061 } | 10698 } |
| 11062 ResolverVisitor.prototype.visitIn = function(node, scope) { | 10699 ResolverVisitor.prototype.visitIn = function(node, scope) { |
| 11063 var $0; | |
| 11064 this.context = scope; | 10700 this.context = scope; |
| 11065 var element = (($0 = this.visit(node)) && $0.is$Element()); | 10701 var element = this.visit(node); |
| 11066 this.context = this.context.parent; | 10702 this.context = this.context.parent; |
| 11067 return element; | 10703 return element; |
| 11068 } | 10704 } |
| 11069 ResolverVisitor.prototype.visitBlock = function(node) { | 10705 ResolverVisitor.prototype.visitBlock = function(node) { |
| 11070 this.visitIn(node.statements, new Scope(this.context)); | 10706 this.visitIn(node.statements, new Scope(this.context)); |
| 11071 } | 10707 } |
| 11072 ResolverVisitor.prototype.visitExpressionStatement = function(node) { | 10708 ResolverVisitor.prototype.visitExpressionStatement = function(node) { |
| 11073 this.visit(node.expression); | 10709 this.visit(node.expression); |
| 11074 } | 10710 } |
| 11075 ResolverVisitor.prototype.visitFor = function(node) { | 10711 ResolverVisitor.prototype.visitFor = function(node) { |
| 11076 var scope = new Scope(this.context); | 10712 var scope = new Scope(this.context); |
| 11077 this.visitIn(node.initializer, scope); | 10713 this.visitIn(node.initializer, scope); |
| 11078 this.visitIn(node.condition, scope); | 10714 this.visitIn(node.condition, scope); |
| 11079 this.visitIn(node.update, scope); | 10715 this.visitIn(node.update, scope); |
| 11080 this.visitIn(node.body, scope); | 10716 this.visitIn(node.body, scope); |
| 11081 } | 10717 } |
| 11082 ResolverVisitor.prototype.visitFunctionExpression = function(node) { | 10718 ResolverVisitor.prototype.visitFunctionExpression = function(node) { |
| 11083 var $0; | |
| 11084 this.visit(node.returnType); | 10719 this.visit(node.returnType); |
| 11085 var enclosingElement = (($0 = this.visit(node.name)) && $0.is$Element()); | 10720 var enclosingElement = this.visit(node.name); |
| 11086 var newScope = new Scope.enclosing$ctor(this.context, enclosingElement); | 10721 var newScope = new Scope.enclosing$ctor(this.context, enclosingElement); |
| 11087 this.visitIn(node.parameters, newScope); | 10722 this.visitIn(node.parameters, newScope); |
| 11088 this.visitIn(node.body, newScope); | 10723 this.visitIn(node.body, newScope); |
| 11089 return enclosingElement; | 10724 return enclosingElement; |
| 11090 } | 10725 } |
| 11091 ResolverVisitor.prototype.visitIdentifier = function(node) { | 10726 ResolverVisitor.prototype.visitIdentifier = function(node) { |
| 11092 var element = this.context.lookup(node.get$source()); | 10727 var element = this.context.lookup(node.get$source()); |
| 11093 if (element == null) this.fail(node, ErrorMessages.cannotResolve(node)); | 10728 if (element == null) this.fail(node, ErrorMessages.cannotResolve(node)); |
| 11094 return this.useElement(node, element); | 10729 return this.useElement(node, element); |
| 11095 } | 10730 } |
| 11096 ResolverVisitor.prototype.visitIf = function(node) { | 10731 ResolverVisitor.prototype.visitIf = function(node) { |
| 11097 this.visit(node.condition); | 10732 this.visit(node.condition); |
| 11098 this.visit(node.thenPart); | 10733 this.visit(node.thenPart); |
| 11099 this.visit(node.elsePart); | 10734 this.visit(node.elsePart); |
| 11100 } | 10735 } |
| 11101 ResolverVisitor.prototype.potentiallyMapOperatorToMethodName = function(name) { | 10736 ResolverVisitor.prototype.potentiallyMapOperatorToMethodName = function(name) { |
| 11102 if ($notnull_bool($eq(name, const$247/*const SourceString('+')*/))) return con
st$248/*const SourceString('add')*/; | 10737 if ($eq(name, const$247/*const SourceString('+')*/)) return const$248/*const S
ourceString('add')*/; |
| 11103 if ($notnull_bool($eq(name, const$249/*const SourceString('-')*/))) return con
st$250/*const SourceString('sub')*/; | 10738 if ($eq(name, const$249/*const SourceString('-')*/)) return const$250/*const S
ourceString('sub')*/; |
| 11104 if ($notnull_bool($eq(name, const$251/*const SourceString('*')*/))) return con
st$252/*const SourceString('mul')*/; | 10739 if ($eq(name, const$251/*const SourceString('*')*/)) return const$252/*const S
ourceString('mul')*/; |
| 11105 if ($notnull_bool($eq(name, const$253/*const SourceString('/')*/))) return con
st$254/*const SourceString('div')*/; | 10740 if ($eq(name, const$253/*const SourceString('/')*/)) return const$254/*const S
ourceString('div')*/; |
| 11106 if ($notnull_bool($eq(name, const$255/*const SourceString('~/')*/))) return co
nst$256/*const SourceString('tdiv')*/; | 10741 if ($eq(name, const$255/*const SourceString('~/')*/)) return const$256/*const
SourceString('tdiv')*/; |
| 11107 if ($notnull_bool($eq(name, const$257/*const SourceString('==')*/))) return co
nst$258/*const SourceString('eq')*/; | 10742 if ($eq(name, const$257/*const SourceString('==')*/)) return const$258/*const
SourceString('eq')*/; |
| 11108 if ($notnull_bool($eq(name, const$259/*const SourceString('<')*/))) return con
st$260/*const SourceString('lt')*/; | 10743 if ($eq(name, const$259/*const SourceString('<')*/)) return const$260/*const S
ourceString('lt')*/; |
| 11109 return name; | 10744 return name; |
| 11110 } | 10745 } |
| 11111 ResolverVisitor.prototype.visitSend = function(node) { | 10746 ResolverVisitor.prototype.visitSend = function(node) { |
| 11112 var $0; | |
| 11113 this.visit(node.receiver); | 10747 this.visit(node.receiver); |
| 11114 var identifier = (($0 = node.selector) && $0.is$Identifier()); | 10748 var identifier = node.selector; |
| 11115 var name = this.potentiallyMapOperatorToMethodName(identifier.get$source()); | 10749 var name = this.potentiallyMapOperatorToMethodName(identifier.get$source()); |
| 11116 var target = this.context.lookup(name); | 10750 var target = this.context.lookup(name); |
| 11117 if (target == null) this.fail(node, ErrorMessages.cannotResolve(name)); | 10751 if (target == null) this.fail(node, ErrorMessages.cannotResolve(name)); |
| 11118 this.visit(node.argumentsNode); | 10752 this.visit(node.argumentsNode); |
| 11119 return this.useElement(node, target); | 10753 return this.useElement(node, target); |
| 11120 } | 10754 } |
| 11121 ResolverVisitor.prototype.visitSendSet = function(node) { | 10755 ResolverVisitor.prototype.visitSendSet = function(node) { |
| 11122 var $0; | 10756 var receiver = this.visit(node.receiver); |
| 11123 var receiver = (($0 = this.visit(node.receiver)) && $0.is$Element()); | 10757 var selector = node.selector; |
| 11124 var selector = (($0 = node.selector) && $0.is$Identifier()); | |
| 11125 if (receiver != null) { | 10758 if (receiver != null) { |
| 11126 this.compiler.unimplemented('Resolver: property access'); | 10759 this.compiler.unimplemented('Resolver: property access'); |
| 11127 } | 10760 } |
| 11128 var target = this.context.lookup(selector.get$source()); | 10761 var target = this.context.lookup(selector.get$source()); |
| 11129 if (target == null) this.fail(node, ErrorMessages.cannotResolve(node)); | 10762 if (target == null) this.fail(node, ErrorMessages.cannotResolve(node)); |
| 11130 this.visit(node.argumentsNode); | 10763 this.visit(node.argumentsNode); |
| 11131 return this.useElement(node, target); | 10764 return this.useElement(node, target); |
| 11132 } | 10765 } |
| 11133 ResolverVisitor.prototype.visitLiteralInt = function(node) { | 10766 ResolverVisitor.prototype.visitLiteralInt = function(node) { |
| 11134 | 10767 |
| 11135 } | 10768 } |
| 11136 ResolverVisitor.prototype.visitLiteralDouble = function(node) { | 10769 ResolverVisitor.prototype.visitLiteralDouble = function(node) { |
| 11137 | 10770 |
| 11138 } | 10771 } |
| 11139 ResolverVisitor.prototype.visitLiteralBool = function(node) { | 10772 ResolverVisitor.prototype.visitLiteralBool = function(node) { |
| 11140 | 10773 |
| 11141 } | 10774 } |
| 11142 ResolverVisitor.prototype.visitLiteralString = function(node) { | 10775 ResolverVisitor.prototype.visitLiteralString = function(node) { |
| 11143 | 10776 |
| 11144 } | 10777 } |
| 11145 ResolverVisitor.prototype.visitNodeList = function(node) { | 10778 ResolverVisitor.prototype.visitNodeList = function(node) { |
| 11146 var $0; | |
| 11147 for (var link = node.nodes; | 10779 for (var link = node.nodes; |
| 11148 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 10780 !link.isEmpty(); link = link.get$tail()) { |
| 11149 this.visit((($0 = link.get$head()) && $0.is$Node())); | 10781 this.visit(link.get$head()); |
| 11150 } | 10782 } |
| 11151 } | 10783 } |
| 11152 ResolverVisitor.prototype.visitOperator = function(node) { | 10784 ResolverVisitor.prototype.visitOperator = function(node) { |
| 11153 this.fail(node, "Unimplemented in the resolver"); | 10785 this.fail(node, "Unimplemented in the resolver"); |
| 11154 } | 10786 } |
| 11155 ResolverVisitor.prototype.visitReturn = function(node) { | 10787 ResolverVisitor.prototype.visitReturn = function(node) { |
| 11156 this.visit(node.expression); | 10788 this.visit(node.expression); |
| 11157 } | 10789 } |
| 11158 ResolverVisitor.prototype.visitThrow = function(node) { | 10790 ResolverVisitor.prototype.visitThrow = function(node) { |
| 11159 this.visit(node.expression); | 10791 this.visit(node.expression); |
| 11160 } | 10792 } |
| 11161 ResolverVisitor.prototype.visitTypeAnnotation = function(node) { | 10793 ResolverVisitor.prototype.visitTypeAnnotation = function(node) { |
| 11162 var name = node.typeName; | 10794 var name = node.typeName; |
| 11163 if ($notnull_bool($eq(name.get$source(), const$261/*const SourceString('var')*
/))) return null; | 10795 if ($eq(name.get$source(), const$261/*const SourceString('var')*/)) return nul
l; |
| 11164 if ($notnull_bool($eq(name.get$source(), const$4/*const SourceString('void')*/
))) return null; | 10796 if ($eq(name.get$source(), const$4/*const SourceString('void')*/)) return null
; |
| 11165 var element = this.context.lookup(name.get$source()); | 10797 var element = this.context.lookup(name.get$source()); |
| 11166 if (element == null) { | 10798 if (element == null) { |
| 11167 this.warning(node, ErrorMessages.cannotResolveType(name)); | 10799 this.warning(node, ErrorMessages.cannotResolveType(name)); |
| 11168 } | 10800 } |
| 11169 else if (element.kind !== const$237/*ElementKind.CLASS*/) { | 10801 else if (element.kind !== const$237/*ElementKind.CLASS*/) { |
| 11170 this.warning(node, ErrorMessages.notAType(name)); | 10802 this.warning(node, ErrorMessages.notAType(name)); |
| 11171 } | 10803 } |
| 11172 else { | 10804 else { |
| 11173 var cls = (element && element.is$ClassElement()); | 10805 var cls = element; |
| 11174 this.compiler.resolver.toResolve.add(element); | 10806 this.compiler.resolver.toResolve.add(element); |
| 11175 } | 10807 } |
| 11176 return this.useElement(node, element); | 10808 return this.useElement(node, element); |
| 11177 } | 10809 } |
| 11178 ResolverVisitor.prototype.visitVariableDefinitions = function(node) { | 10810 ResolverVisitor.prototype.visitVariableDefinitions = function(node) { |
| 11179 this.visit(node.type); | 10811 this.visit(node.type); |
| 11180 var visitor = new VariableDefinitionsVisitor(node, this); | 10812 var visitor = new VariableDefinitionsVisitor(node, this); |
| 11181 visitor.visit(node.definitions); | 10813 visitor.visit(node.definitions); |
| 11182 } | 10814 } |
| 11183 ResolverVisitor.prototype.defineElement = function(node, element) { | 10815 ResolverVisitor.prototype.defineElement = function(node, element) { |
| 11184 var $0; | |
| 11185 this.compiler.ensure(element != null); | 10816 this.compiler.ensure(element != null); |
| 11186 this.mapping.$setindex(node, element); | 10817 this.mapping.$setindex(node, element); |
| 11187 return (($0 = this.context.add(element)) && $0.is$Element()); | 10818 return this.context.add(element); |
| 11188 } | 10819 } |
| 11189 ResolverVisitor.prototype.useElement = function(node, element) { | 10820 ResolverVisitor.prototype.useElement = function(node, element) { |
| 11190 if (element == null) return null; | 10821 if (element == null) return null; |
| 11191 this.mapping.$setindex(node, element); | 10822 this.mapping.$setindex(node, element); |
| 11192 return element; | 10823 return element; |
| 11193 } | 10824 } |
| 11194 ResolverVisitor.prototype.visit$1 = function($0) { | 10825 ResolverVisitor.prototype.visit$1 = function($0) { |
| 11195 return this.visit(($0 && $0.is$Node())); | 10826 return this.visit($0); |
| 11196 }; | 10827 }; |
| 11197 // ********** Code for ClassResolverVisitor ************** | 10828 // ********** Code for ClassResolverVisitor ************** |
| 11198 function ClassResolverVisitor(compiler) { | 10829 function ClassResolverVisitor(compiler) { |
| 11199 this.compiler = compiler; | 10830 this.compiler = compiler; |
| 11200 this.context = new TopScope(compiler.universe); | 10831 this.context = new TopScope(compiler.universe); |
| 11201 // Initializers done | 10832 // Initializers done |
| 11202 } | 10833 } |
| 11203 ClassResolverVisitor.prototype.is$Visitor = function(){return this;}; | |
| 11204 ClassResolverVisitor.prototype.visitClassNode = function(node) { | 10834 ClassResolverVisitor.prototype.visitClassNode = function(node) { |
| 11205 var $0; | 10835 var element = this.context.lookup(node.name.get$source()); |
| 11206 var element = (($0 = this.context.lookup(node.name.get$source())) && $0.is$Cla
ssElement()); | |
| 11207 this.compiler.ensure(element != null); | 10836 this.compiler.ensure(element != null); |
| 11208 this.compiler.ensure(!$notnull_bool(element.isResolved)); | 10837 this.compiler.ensure(!element.isResolved); |
| 11209 element.supertype = this.visit(node.superclass); | 10838 element.supertype = this.visit(node.superclass); |
| 11210 for (var link = node.interfaces.nodes; | 10839 for (var link = node.interfaces.nodes; |
| 11211 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 10840 !link.isEmpty(); link = link.get$tail()) { |
| 11212 element.interfaces = (($0 = element.interfaces.prepend(this.visit((($0 = lin
k.get$head()) && $0.is$Node())))) && $0.is$Link$Type()); | 10841 element.interfaces = element.interfaces.prepend(this.visit(link.get$head()))
; |
| 11213 } | 10842 } |
| 11214 return element.computeType(this.compiler, null); | 10843 return element.computeType(this.compiler, null); |
| 11215 } | 10844 } |
| 11216 ClassResolverVisitor.prototype.visitTypeAnnotation = function(node) { | 10845 ClassResolverVisitor.prototype.visitTypeAnnotation = function(node) { |
| 11217 var $0; | |
| 11218 var name = node.typeName; | 10846 var name = node.typeName; |
| 11219 var element = this.context.lookup(name.get$source()); | 10847 var element = this.context.lookup(name.get$source()); |
| 11220 if (element == null) { | 10848 if (element == null) { |
| 11221 this.compiler.cancel(ErrorMessages.cannotResolveType(name)); | 10849 this.compiler.cancel(ErrorMessages.cannotResolveType(name)); |
| 11222 } | 10850 } |
| 11223 else if (element.kind !== const$237/*ElementKind.CLASS*/) { | 10851 else if (element.kind !== const$237/*ElementKind.CLASS*/) { |
| 11224 this.compiler.cancel(ErrorMessages.notAType(name)); | 10852 this.compiler.cancel(ErrorMessages.notAType(name)); |
| 11225 } | 10853 } |
| 11226 else { | 10854 else { |
| 11227 this.compiler.resolver.toResolve.add(element); | 10855 this.compiler.resolver.toResolve.add(element); |
| 11228 return (($0 = element.computeType(this.compiler, null)) && $0.is$Type()); | 10856 return element.computeType(this.compiler, null); |
| 11229 } | 10857 } |
| 11230 return null; | 10858 return null; |
| 11231 } | 10859 } |
| 11232 ClassResolverVisitor.prototype.visit = function(node) { | 10860 ClassResolverVisitor.prototype.visit = function(node) { |
| 11233 var $0; | |
| 11234 if (node == null) return null; | 10861 if (node == null) return null; |
| 11235 return (($0 = node.accept(this)) && $0.is$Type()); | 10862 return node.accept(this); |
| 11236 } | 10863 } |
| 11237 ClassResolverVisitor.prototype.visit$1 = function($0) { | 10864 ClassResolverVisitor.prototype.visit$1 = function($0) { |
| 11238 return this.visit(($0 && $0.is$Node())); | 10865 return this.visit($0); |
| 11239 }; | 10866 }; |
| 11240 // ********** Code for VariableDefinitionsVisitor ************** | 10867 // ********** Code for VariableDefinitionsVisitor ************** |
| 11241 function VariableDefinitionsVisitor(definitions, resolver) { | 10868 function VariableDefinitionsVisitor(definitions, resolver) { |
| 11242 this.definitions = definitions; | 10869 this.definitions = definitions; |
| 11243 this.resolver = resolver; | 10870 this.resolver = resolver; |
| 11244 // Initializers done | 10871 // Initializers done |
| 11245 } | 10872 } |
| 11246 VariableDefinitionsVisitor.prototype.is$Visitor = function(){return this;}; | |
| 11247 VariableDefinitionsVisitor.prototype.visitSendSet = function(node) { | 10873 VariableDefinitionsVisitor.prototype.visitSendSet = function(node) { |
| 11248 var $0; | |
| 11249 $assert(node.get$arguments().get$tail().isEmpty$0(), "node.arguments.tail.isEm
pty()", "resolver.dart", 269, 12); | |
| 11250 if (node.receiver != null) { | 10874 if (node.receiver != null) { |
| 11251 this.resolver.compiler.unimplemented("receiver on a variable definition"); | 10875 this.resolver.compiler.unimplemented("receiver on a variable definition"); |
| 11252 } | 10876 } |
| 11253 var selector = (($0 = node.selector) && $0.is$Identifier()); | 10877 var selector = node.selector; |
| 11254 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node())); | 10878 this.resolver.visit(node.get$arguments().get$head()); |
| 11255 return (($0 = this.visit(node.selector)) && $0.is$SourceString()); | 10879 return this.visit(node.selector); |
| 11256 } | 10880 } |
| 11257 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { | 10881 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { |
| 11258 return node.get$source(); | 10882 return node.get$source(); |
| 11259 } | 10883 } |
| 11260 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { | 10884 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { |
| 11261 var $0; | |
| 11262 for (var link = node.nodes; | 10885 for (var link = node.nodes; |
| 11263 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 10886 !link.isEmpty(); link = link.get$tail()) { |
| 11264 var name = (($0 = this.visit((($0 = link.get$head()) && $0.is$Node()))) && $
0.is$SourceString()); | 10887 var name = this.visit(link.get$head()); |
| 11265 var element = new VariableElement((($0 = link.get$head()) && $0.is$Node()),
this.definitions.type, name, this.resolver.context.enclosingElement); | 10888 var element = new VariableElement(link.get$head(), this.definitions.type, na
me, this.resolver.context.enclosingElement); |
| 11266 var existing = this.resolver.defineElement((($0 = link.get$head()) && $0.is$
Node()), element); | 10889 var existing = this.resolver.defineElement(link.get$head(), element); |
| 11267 if ($ne(existing, element)) { | 10890 if ($ne(existing, element)) { |
| 11268 this.resolver.fail(node, ErrorMessages.duplicateDefinition(link.get$head()
)); | 10891 this.resolver.fail(node, ErrorMessages.duplicateDefinition(link.get$head()
)); |
| 11269 } | 10892 } |
| 11270 } | 10893 } |
| 11271 } | 10894 } |
| 11272 VariableDefinitionsVisitor.prototype.visit = function(node) { | 10895 VariableDefinitionsVisitor.prototype.visit = function(node) { |
| 11273 return node.accept(this); | 10896 return node.accept(this); |
| 11274 } | 10897 } |
| 11275 VariableDefinitionsVisitor.prototype.visit$1 = function($0) { | 10898 VariableDefinitionsVisitor.prototype.visit$1 = function($0) { |
| 11276 return this.visit(($0 && $0.is$Node())); | 10899 return this.visit($0); |
| 11277 }; | 10900 }; |
| 11278 // ********** Code for Scope ************** | 10901 // ********** Code for Scope ************** |
| 11279 function Scope(parent) { | 10902 function Scope(parent) { |
| 11280 Scope.enclosing$ctor.call(this, parent, parent.enclosingElement); | 10903 Scope.enclosing$ctor.call(this, parent, parent.enclosingElement); |
| 11281 // Initializers done | 10904 // Initializers done |
| 11282 } | 10905 } |
| 11283 Scope.top$ctor = function() { | 10906 Scope.top$ctor = function() { |
| 11284 this.parent = null; | 10907 this.parent = null; |
| 11285 this.elements = const$246/*const {}*/; | 10908 this.elements = const$246/*const {}*/; |
| 11286 this.enclosingElement = null; | 10909 this.enclosingElement = null; |
| 11287 // Initializers done | 10910 // Initializers done |
| 11288 } | 10911 } |
| 11289 Scope.top$ctor.prototype = Scope.prototype; | 10912 Scope.top$ctor.prototype = Scope.prototype; |
| 11290 Scope.enclosing$ctor = function(parent, enclosingElement) { | 10913 Scope.enclosing$ctor = function(parent, enclosingElement) { |
| 11291 this.parent = parent; | 10914 this.parent = parent; |
| 11292 this.enclosingElement = enclosingElement; | 10915 this.enclosingElement = enclosingElement; |
| 11293 this.elements = $map([]); | 10916 this.elements = $map([]); |
| 11294 // Initializers done | 10917 // Initializers done |
| 11295 } | 10918 } |
| 11296 Scope.enclosing$ctor.prototype = Scope.prototype; | 10919 Scope.enclosing$ctor.prototype = Scope.prototype; |
| 11297 Scope.prototype.get$parent = function() { return this.parent; }; | 10920 Scope.prototype.get$parent = function() { return this.parent; }; |
| 11298 Scope.prototype.lookup = function(name) { | 10921 Scope.prototype.lookup = function(name) { |
| 11299 var $0; | 10922 var element = this.elements.$index(name); |
| 11300 var element = (($0 = this.elements.$index(name)) && $0.is$Element()); | |
| 11301 if (element != null) return element; | 10923 if (element != null) return element; |
| 11302 return this.parent.lookup(name); | 10924 return this.parent.lookup(name); |
| 11303 } | 10925 } |
| 11304 Scope.prototype.add = function(element) { | 10926 Scope.prototype.add = function(element) { |
| 11305 var $0; | 10927 if (this.elements.containsKey(element.name)) return this.elements.$index(eleme
nt.name); |
| 11306 if (this.elements.containsKey(element.name)) return (($0 = this.elements.$inde
x(element.name)) && $0.is$Element()); | |
| 11307 this.elements.$setindex(element.name, element); | 10928 this.elements.$setindex(element.name, element); |
| 11308 return element; | 10929 return element; |
| 11309 } | 10930 } |
| 11310 Scope.prototype.add$1 = function($0) { | 10931 Scope.prototype.add$1 = function($0) { |
| 11311 return this.add(($0 && $0.is$Element())); | 10932 return this.add($0); |
| 11312 }; | 10933 }; |
| 11313 Scope.prototype.lookup$1 = function($0) { | 10934 Scope.prototype.lookup$1 = function($0) { |
| 11314 return this.lookup(($0 && $0.is$SourceString())); | 10935 return this.lookup($0); |
| 11315 }; | 10936 }; |
| 11316 // ********** Code for TopScope ************** | 10937 // ********** Code for TopScope ************** |
| 11317 function TopScope(universe) { | 10938 function TopScope(universe) { |
| 11318 this.universe = universe; | 10939 this.universe = universe; |
| 11319 Scope.top$ctor.call(this); | 10940 Scope.top$ctor.call(this); |
| 11320 // Initializers done | 10941 // Initializers done |
| 11321 } | 10942 } |
| 11322 $inherits(TopScope, Scope); | 10943 $inherits(TopScope, Scope); |
| 11323 TopScope.prototype.lookup = function(name) { | 10944 TopScope.prototype.lookup = function(name) { |
| 11324 return this.universe.find(name); | 10945 return this.universe.find(name); |
| 11325 } | 10946 } |
| 11326 TopScope.prototype.add = function(element) { | 10947 TopScope.prototype.add = function(element) { |
| 11327 $throw("Cannot add an element in the top scope"); | 10948 $throw("Cannot add an element in the top scope"); |
| 11328 } | 10949 } |
| 11329 TopScope.prototype.add$1 = function($0) { | 10950 TopScope.prototype.add$1 = function($0) { |
| 11330 return this.add(($0 && $0.is$Element())); | 10951 return this.add($0); |
| 11331 }; | 10952 }; |
| 11332 TopScope.prototype.lookup$1 = function($0) { | 10953 TopScope.prototype.lookup$1 = function($0) { |
| 11333 return this.lookup(($0 && $0.is$SourceString())); | 10954 return this.lookup($0); |
| 11334 }; | 10955 }; |
| 11335 // ********** Code for leg_Script ************** | 10956 // ********** Code for leg_Script ************** |
| 11336 function leg_Script(file) { | 10957 function leg_Script(file) { |
| 11337 this.file = file; | 10958 this.file = file; |
| 11338 // Initializers done | 10959 // Initializers done |
| 11339 } | 10960 } |
| 11340 leg_Script.prototype.get$text = function() { | 10961 leg_Script.prototype.get$text = function() { |
| 11341 return this.file.get$text(); | 10962 return this.file.get$text(); |
| 11342 } | 10963 } |
| 11343 // ********** Code for TypeCheckerTask ************** | 10964 // ********** Code for TypeCheckerTask ************** |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11393 this.name = name; | 11014 this.name = name; |
| 11394 this.element = element; | 11015 this.element = element; |
| 11395 // Initializers done | 11016 // Initializers done |
| 11396 } | 11017 } |
| 11397 SimpleType.named$ctor = function(name) { | 11018 SimpleType.named$ctor = function(name) { |
| 11398 this.name = name; | 11019 this.name = name; |
| 11399 this.element = new Element(name, null, null); | 11020 this.element = new Element(name, null, null); |
| 11400 // Initializers done | 11021 // Initializers done |
| 11401 } | 11022 } |
| 11402 SimpleType.named$ctor.prototype = SimpleType.prototype; | 11023 SimpleType.named$ctor.prototype = SimpleType.prototype; |
| 11403 SimpleType.prototype.is$Type = function(){return this;}; | |
| 11404 SimpleType.prototype.get$name = function() { return this.name; }; | 11024 SimpleType.prototype.get$name = function() { return this.name; }; |
| 11405 SimpleType.prototype.get$element = function() { return this.element; }; | 11025 SimpleType.prototype.get$element = function() { return this.element; }; |
| 11406 SimpleType.prototype.toString = function() { | 11026 SimpleType.prototype.toString = function() { |
| 11407 return this.name.toString(); | 11027 return this.name.toString(); |
| 11408 } | 11028 } |
| 11409 SimpleType.prototype.toString$0 = function() { | 11029 SimpleType.prototype.toString$0 = function() { |
| 11410 return this.toString(); | 11030 return this.toString(); |
| 11411 }; | 11031 }; |
| 11412 // ********** Code for FunctionType ************** | 11032 // ********** Code for FunctionType ************** |
| 11413 function FunctionType(returnType, parameterTypes) { | 11033 function FunctionType(returnType, parameterTypes) { |
| 11414 this.returnType = returnType; | 11034 this.returnType = returnType; |
| 11415 this.parameterTypes = parameterTypes; | 11035 this.parameterTypes = parameterTypes; |
| 11416 // Initializers done | 11036 // Initializers done |
| 11417 } | 11037 } |
| 11418 FunctionType.prototype.is$FunctionType = function(){return this;}; | |
| 11419 FunctionType.prototype.is$Type = function(){return this;}; | |
| 11420 FunctionType.prototype.get$returnType = function() { return this.returnType; }; | 11038 FunctionType.prototype.get$returnType = function() { return this.returnType; }; |
| 11421 FunctionType.prototype.toString = function() { | 11039 FunctionType.prototype.toString = function() { |
| 11422 var sb = new StringBufferImpl(""); | 11040 var sb = new StringBufferImpl(""); |
| 11423 var first = true; | 11041 var first = true; |
| 11424 sb.add('('); | 11042 sb.add('('); |
| 11425 this.parameterTypes.printOn(sb, ', '); | 11043 this.parameterTypes.printOn(sb, ', '); |
| 11426 sb.add((') -> ' + this.returnType + '')); | 11044 sb.add((') -> ' + this.returnType + '')); |
| 11427 return sb.toString(); | 11045 return sb.toString(); |
| 11428 } | 11046 } |
| 11429 FunctionType.prototype.toString$0 = function() { | 11047 FunctionType.prototype.toString$0 = function() { |
| 11430 return this.toString(); | 11048 return this.toString(); |
| 11431 }; | 11049 }; |
| 11432 // ********** Code for Types ************** | 11050 // ********** Code for Types ************** |
| 11433 function Types() { | 11051 function Types() { |
| 11434 this.voidType = new SimpleType.named$ctor(const$4/*Types.VOID*/); | 11052 this.voidType = new SimpleType.named$ctor(const$4/*Types.VOID*/); |
| 11435 this.intType = new SimpleType.named$ctor(const$6/*Types.INT*/); | 11053 this.intType = new SimpleType.named$ctor(const$6/*Types.INT*/); |
| 11436 this.dynamicType = new SimpleType.named$ctor(const$8/*Types.DYNAMIC*/); | 11054 this.dynamicType = new SimpleType.named$ctor(const$8/*Types.DYNAMIC*/); |
| 11437 this.stringType = new SimpleType.named$ctor(const$10/*Types.STRING*/); | 11055 this.stringType = new SimpleType.named$ctor(const$10/*Types.STRING*/); |
| 11438 // Initializers done | 11056 // Initializers done |
| 11439 } | 11057 } |
| 11440 Types.prototype.is$Types = function(){return this;}; | |
| 11441 Types.prototype.lookup = function(s) { | 11058 Types.prototype.lookup = function(s) { |
| 11442 if ($notnull_bool($eq(const$4/*Types.VOID*/, s))) { | 11059 if ($eq(const$4/*Types.VOID*/, s)) { |
| 11443 return this.voidType; | 11060 return this.voidType; |
| 11444 } | 11061 } |
| 11445 else if ($notnull_bool($eq(const$6/*Types.INT*/, s))) { | 11062 else if ($eq(const$6/*Types.INT*/, s)) { |
| 11446 return this.intType; | 11063 return this.intType; |
| 11447 } | 11064 } |
| 11448 else if ($notnull_bool($eq(const$8/*Types.DYNAMIC*/, s)) || s.get$stringValue(
) === 'var') { | 11065 else if ($eq(const$8/*Types.DYNAMIC*/, s) || s.get$stringValue() === 'var') { |
| 11449 return this.dynamicType; | 11066 return this.dynamicType; |
| 11450 } | 11067 } |
| 11451 else if ($notnull_bool($eq(const$10/*Types.STRING*/, s))) { | 11068 else if ($eq(const$10/*Types.STRING*/, s)) { |
| 11452 return this.stringType; | 11069 return this.stringType; |
| 11453 } | 11070 } |
| 11454 return null; | 11071 return null; |
| 11455 } | 11072 } |
| 11456 Types.prototype.isSubtype = function(r, s) { | 11073 Types.prototype.isSubtype = function(r, s) { |
| 11457 return r === s || r === this.dynamicType || s === this.dynamicType; | 11074 return r === s || r === this.dynamicType || s === this.dynamicType; |
| 11458 } | 11075 } |
| 11459 Types.prototype.isAssignable = function(r, s) { | 11076 Types.prototype.isAssignable = function(r, s) { |
| 11460 return $notnull_bool(this.isSubtype(r, s)) || $notnull_bool(this.isSubtype(s,
r)); | 11077 return this.isSubtype(r, s) || this.isSubtype(s, r); |
| 11461 } | 11078 } |
| 11462 Types.prototype.lookup$1 = function($0) { | 11079 Types.prototype.lookup$1 = function($0) { |
| 11463 return this.lookup(($0 && $0.is$SourceString())); | 11080 return this.lookup($0); |
| 11464 }; | 11081 }; |
| 11465 // ********** Code for CancelTypeCheckException ************** | 11082 // ********** Code for CancelTypeCheckException ************** |
| 11466 function CancelTypeCheckException(node, reason) { | 11083 function CancelTypeCheckException(node, reason) { |
| 11467 this.node = node; | 11084 this.node = node; |
| 11468 this.reason = reason; | 11085 this.reason = reason; |
| 11469 // Initializers done | 11086 // Initializers done |
| 11470 } | 11087 } |
| 11471 // ********** Code for TypeCheckerVisitor ************** | 11088 // ********** Code for TypeCheckerVisitor ************** |
| 11472 function TypeCheckerVisitor(compiler, elements, types) { | 11089 function TypeCheckerVisitor(compiler, elements, types) { |
| 11473 this.compiler = compiler; | 11090 this.compiler = compiler; |
| 11474 this.elements = elements; | 11091 this.elements = elements; |
| 11475 this.types = types; | 11092 this.types = types; |
| 11476 // Initializers done | 11093 // Initializers done |
| 11477 } | 11094 } |
| 11478 TypeCheckerVisitor.prototype.is$Visitor = function(){return this;}; | |
| 11479 TypeCheckerVisitor.prototype.fail = function(node, reason) { | 11095 TypeCheckerVisitor.prototype.fail = function(node, reason) { |
| 11480 var message = 'cannot type-check'; | 11096 var message = 'cannot type-check'; |
| 11481 if (reason != null) { | 11097 if (reason != null) { |
| 11482 message = ('' + message + ': ' + reason + ''); | 11098 message = ('' + message + ': ' + reason + ''); |
| 11483 } | 11099 } |
| 11484 $throw(new CancelTypeCheckException(node, message)); | 11100 $throw(new CancelTypeCheckException(node, message)); |
| 11485 } | 11101 } |
| 11486 TypeCheckerVisitor.prototype.reportTypeWarning = function(node, kind, arguments)
{ | 11102 TypeCheckerVisitor.prototype.reportTypeWarning = function(node, kind, arguments)
{ |
| 11487 this.compiler.reportWarning(node, new TypeWarning(kind, arguments).getMessage(
)); | 11103 this.compiler.reportWarning(node, new TypeWarning(kind, arguments).getMessage(
)); |
| 11488 } | 11104 } |
| 11489 TypeCheckerVisitor.prototype.nonVoidType = function(node) { | 11105 TypeCheckerVisitor.prototype.nonVoidType = function(node) { |
| 11490 var type = this.type(node); | 11106 var type = this.type(node); |
| 11491 if ($eq(type, this.types.voidType)) { | 11107 if ($eq(type, this.types.voidType)) { |
| 11492 this.reportTypeWarning(node, const$277/*WarningKind.VOID_EXPRESSION*/, const
$13/*const []*/); | 11108 this.reportTypeWarning(node, const$277/*WarningKind.VOID_EXPRESSION*/, const
$13/*const []*/); |
| 11493 } | 11109 } |
| 11494 return type; | 11110 return type; |
| 11495 } | 11111 } |
| 11496 TypeCheckerVisitor.prototype.typeWithDefault = function(node, defaultValue) { | 11112 TypeCheckerVisitor.prototype.typeWithDefault = function(node, defaultValue) { |
| 11497 return node != null ? this.type(node) : defaultValue; | 11113 return node != null ? this.type(node) : defaultValue; |
| 11498 } | 11114 } |
| 11499 TypeCheckerVisitor.prototype.type = function(node) { | 11115 TypeCheckerVisitor.prototype.type = function(node) { |
| 11500 var $0; | |
| 11501 if (node == null) this.fail(null, 'unexpected node: null'); | 11116 if (node == null) this.fail(null, 'unexpected node: null'); |
| 11502 var result = (($0 = node.accept(this)) && $0.is$Type()); | 11117 var result = node.accept(this); |
| 11503 return result; | 11118 return result; |
| 11504 } | 11119 } |
| 11505 TypeCheckerVisitor.prototype.get$type = function() { | |
| 11506 return TypeCheckerVisitor.prototype.type.bind(this); | |
| 11507 } | |
| 11508 TypeCheckerVisitor.prototype.checkAssignable = function(node, s, t) { | 11120 TypeCheckerVisitor.prototype.checkAssignable = function(node, s, t) { |
| 11509 if (!$notnull_bool(this.types.isAssignable(s, t))) { | 11121 if (!this.types.isAssignable(s, t)) { |
| 11510 this.reportTypeWarning(node, const$270/*WarningKind.NOT_ASSIGNABLE*/, [s, t]
); | 11122 this.reportTypeWarning(node, const$270/*WarningKind.NOT_ASSIGNABLE*/, [s, t]
); |
| 11511 } | 11123 } |
| 11512 } | 11124 } |
| 11513 TypeCheckerVisitor.prototype.visitBlock = function(node) { | 11125 TypeCheckerVisitor.prototype.visitBlock = function(node) { |
| 11514 this.type(node.statements); | 11126 this.type(node.statements); |
| 11515 return this.types.voidType; | 11127 return this.types.voidType; |
| 11516 } | 11128 } |
| 11517 TypeCheckerVisitor.prototype.visitClassNode = function(node) { | 11129 TypeCheckerVisitor.prototype.visitClassNode = function(node) { |
| 11518 this.fail(node); | 11130 this.fail(node); |
| 11519 } | 11131 } |
| 11520 TypeCheckerVisitor.prototype.visitExpressionStatement = function(node) { | 11132 TypeCheckerVisitor.prototype.visitExpressionStatement = function(node) { |
| 11521 return this.type(node.expression); | 11133 return this.type(node.expression); |
| 11522 } | 11134 } |
| 11523 TypeCheckerVisitor.prototype.visitFor = function(node) { | 11135 TypeCheckerVisitor.prototype.visitFor = function(node) { |
| 11524 this.fail(node); | 11136 this.fail(node); |
| 11525 } | 11137 } |
| 11526 TypeCheckerVisitor.prototype.visitFunctionExpression = function(node) { | 11138 TypeCheckerVisitor.prototype.visitFunctionExpression = function(node) { |
| 11527 var $0; | 11139 var functionType = this.elements.$index(node.name).computeType$2(this.compiler
, this.types); |
| 11528 var functionType = (($0 = this.elements.$index(node.name).computeType$2(this.c
ompiler, this.types)) && $0.is$FunctionType()); | |
| 11529 var returnType = functionType.returnType; | 11140 var returnType = functionType.returnType; |
| 11530 var previous = this.expectedReturnType; | 11141 var previous = this.expectedReturnType; |
| 11531 this.expectedReturnType = returnType; | 11142 this.expectedReturnType = returnType; |
| 11532 this.type(node.body); | 11143 this.type(node.body); |
| 11533 this.expectedReturnType = previous; | 11144 this.expectedReturnType = previous; |
| 11534 return functionType; | 11145 return functionType; |
| 11535 } | 11146 } |
| 11536 TypeCheckerVisitor.prototype.visitIdentifier = function(node) { | 11147 TypeCheckerVisitor.prototype.visitIdentifier = function(node) { |
| 11537 this.fail(node); | 11148 this.fail(node); |
| 11538 } | 11149 } |
| 11539 TypeCheckerVisitor.prototype.visitIf = function(node) { | 11150 TypeCheckerVisitor.prototype.visitIf = function(node) { |
| 11540 this.type(node.condition); | 11151 this.type(node.condition); |
| 11541 this.type(node.thenPart); | 11152 this.type(node.thenPart); |
| 11542 if ($notnull_bool(node.get$hasElsePart())) this.type(node.elsePart); | 11153 if (node.get$hasElsePart()) this.type(node.elsePart); |
| 11543 return this.types.voidType; | 11154 return this.types.voidType; |
| 11544 } | 11155 } |
| 11545 TypeCheckerVisitor.prototype.visitSend = function(node) { | 11156 TypeCheckerVisitor.prototype.visitSend = function(node) { |
| 11546 var $0; | |
| 11547 var target = this.elements.$index(node); | 11157 var target = this.elements.$index(node); |
| 11548 var selector = (($0 = node.selector) && $0.is$Identifier()); | 11158 var selector = node.selector; |
| 11549 if (target != null) { | 11159 if (target != null) { |
| 11550 var name = selector.get$source(); | 11160 var name = selector.get$source(); |
| 11551 if ($notnull_bool($eq(name, const$247/*const SourceString('+')*/)) || $notnu
ll_bool($eq(name, const$274/*const SourceString('=')*/)) || $notnull_bool($eq(na
me, const$249/*const SourceString('-')*/)) || $notnull_bool($eq(name, const$251/
*const SourceString('*')*/)) || $notnull_bool($eq(name, const$253/*const SourceS
tring('/')*/)) || $notnull_bool($eq(name, const$259/*const SourceString('<')*/))
|| $notnull_bool($eq(name, const$255/*const SourceString('~/')*/))) { | 11161 if ($eq(name, const$247/*const SourceString('+')*/) || $eq(name, const$274/*
const SourceString('=')*/) || $eq(name, const$249/*const SourceString('-')*/) ||
$eq(name, const$251/*const SourceString('*')*/) || $eq(name, const$253/*const S
ourceString('/')*/) || $eq(name, const$259/*const SourceString('<')*/) || $eq(na
me, const$255/*const SourceString('~/')*/)) { |
| 11552 return this.types.dynamicType; | 11162 return this.types.dynamicType; |
| 11553 } | 11163 } |
| 11554 var targetType = target.computeType$2(this.compiler, this.types); | 11164 var targetType = target.computeType$2(this.compiler, this.types); |
| 11555 if ($notnull_bool(node.get$isPropertyAccess())) { | 11165 if (node.get$isPropertyAccess()) { |
| 11556 return (targetType && targetType.is$Type()); | 11166 return targetType; |
| 11557 } | 11167 } |
| 11558 else if ($notnull_bool(node.get$isFunctionObjectInvocation())) { | 11168 else if (node.get$isFunctionObjectInvocation()) { |
| 11559 this.fail(node); | 11169 this.fail(node); |
| 11560 } | 11170 } |
| 11561 else { | 11171 else { |
| 11562 if (!(targetType instanceof FunctionType)) { | 11172 if (!(targetType instanceof FunctionType)) { |
| 11563 if ((target instanceof ForeignElement)) { | 11173 if ((target instanceof ForeignElement)) { |
| 11564 return this.types.dynamicType; | 11174 return this.types.dynamicType; |
| 11565 } | 11175 } |
| 11566 this.fail(node, 'can only handle function types'); | 11176 this.fail(node, 'can only handle function types'); |
| 11567 } | 11177 } |
| 11568 var funType = (targetType && targetType.is$FunctionType()); | 11178 var funType = targetType; |
| 11569 var formals = funType.parameterTypes; | 11179 var formals = funType.parameterTypes; |
| 11570 var arguments = node.get$arguments(); | 11180 var arguments = node.get$arguments(); |
| 11571 while ((!$notnull_bool(formals.isEmpty())) && (!$notnull_bool(arguments.is
Empty()))) { | 11181 while ((!formals.isEmpty()) && (!arguments.isEmpty())) { |
| 11572 var argument = (($0 = arguments.get$head()) && $0.is$Node()); | 11182 var argument = arguments.get$head(); |
| 11573 var argumentType = this.type(argument); | 11183 var argumentType = this.type(argument); |
| 11574 this.checkAssignable(argument, argumentType, (($0 = formals.get$head())
&& $0.is$Type())); | 11184 this.checkAssignable(argument, argumentType, formals.get$head()); |
| 11575 formals = (($0 = formals.get$tail()) && $0.is$Link$Type()); | 11185 formals = formals.get$tail(); |
| 11576 arguments = (($0 = arguments.get$tail()) && $0.is$Link$Node()); | 11186 arguments = arguments.get$tail(); |
| 11577 } | 11187 } |
| 11578 if (!$notnull_bool(formals.isEmpty())) { | 11188 if (!formals.isEmpty()) { |
| 11579 this.compiler.reportWarning(node, 'missing argument'); | 11189 this.compiler.reportWarning(node, 'missing argument'); |
| 11580 } | 11190 } |
| 11581 if (!$notnull_bool(arguments.isEmpty())) { | 11191 if (!arguments.isEmpty()) { |
| 11582 this.compiler.reportWarning((($0 = arguments.get$head()) && $0.is$Node()
), 'additional arguments'); | 11192 this.compiler.reportWarning(arguments.get$head(), 'additional arguments'
); |
| 11583 } | 11193 } |
| 11584 return funType.returnType; | 11194 return funType.returnType; |
| 11585 } | 11195 } |
| 11586 } | 11196 } |
| 11587 else { | 11197 else { |
| 11588 this.fail(node, ('unresolved send ' + selector.get$source() + '')); | 11198 this.fail(node, ('unresolved send ' + selector.get$source() + '')); |
| 11589 } | 11199 } |
| 11590 } | 11200 } |
| 11591 TypeCheckerVisitor.prototype.visitSendSet = function(node) { | 11201 TypeCheckerVisitor.prototype.visitSendSet = function(node) { |
| 11592 var $0; | 11202 this.compiler.ensure(node.get$arguments() != null && !node.get$arguments().isE
mpty()); |
| 11593 this.compiler.ensure(node.get$arguments() != null && !$notnull_bool(node.get$a
rguments().isEmpty())); | 11203 var targetType = this.elements.$index(node).computeType$2(this.compiler, this.
types); |
| 11594 var targetType = (($0 = this.elements.$index(node).computeType$2(this.compiler
, this.types)) && $0.is$Type()); | 11204 var value = node.get$arguments().get$head(); |
| 11595 var value = (($0 = node.get$arguments().get$head()) && $0.is$Node()); | |
| 11596 this.checkAssignable(value, this.type(value), targetType); | 11205 this.checkAssignable(value, this.type(value), targetType); |
| 11597 return targetType; | 11206 return targetType; |
| 11598 } | 11207 } |
| 11599 TypeCheckerVisitor.prototype.visitLiteralInt = function(node) { | 11208 TypeCheckerVisitor.prototype.visitLiteralInt = function(node) { |
| 11600 return this.types.intType; | 11209 return this.types.intType; |
| 11601 } | 11210 } |
| 11602 TypeCheckerVisitor.prototype.visitLiteralDouble = function(node) { | 11211 TypeCheckerVisitor.prototype.visitLiteralDouble = function(node) { |
| 11603 return this.types.dynamicType; | 11212 return this.types.dynamicType; |
| 11604 } | 11213 } |
| 11605 TypeCheckerVisitor.prototype.visitLiteralBool = function(node) { | 11214 TypeCheckerVisitor.prototype.visitLiteralBool = function(node) { |
| 11606 return this.types.dynamicType; | 11215 return this.types.dynamicType; |
| 11607 } | 11216 } |
| 11608 TypeCheckerVisitor.prototype.visitLiteralString = function(node) { | 11217 TypeCheckerVisitor.prototype.visitLiteralString = function(node) { |
| 11609 return this.types.stringType; | 11218 return this.types.stringType; |
| 11610 } | 11219 } |
| 11611 TypeCheckerVisitor.prototype.visitNodeList = function(node) { | 11220 TypeCheckerVisitor.prototype.visitNodeList = function(node) { |
| 11612 var $0; | |
| 11613 for (var link = node.nodes; | 11221 for (var link = node.nodes; |
| 11614 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 11222 !link.isEmpty(); link = link.get$tail()) { |
| 11615 this.type((($0 = link.get$head()) && $0.is$Node())); | 11223 this.type(link.get$head()); |
| 11616 } | 11224 } |
| 11617 return null; | 11225 return null; |
| 11618 } | 11226 } |
| 11619 TypeCheckerVisitor.prototype.visitOperator = function(node) { | 11227 TypeCheckerVisitor.prototype.visitOperator = function(node) { |
| 11620 return this.types.dynamicType; | 11228 return this.types.dynamicType; |
| 11621 } | 11229 } |
| 11622 TypeCheckerVisitor.prototype.visitReturn = function(node) { | 11230 TypeCheckerVisitor.prototype.visitReturn = function(node) { |
| 11623 var expression = node.expression; | 11231 var expression = node.expression; |
| 11624 var isVoidFunction = (this.expectedReturnType === this.types.voidType); | 11232 var isVoidFunction = (this.expectedReturnType === this.types.voidType); |
| 11625 if (expression != null) { | 11233 if (expression != null) { |
| 11626 var expressionType = this.type(expression); | 11234 var expressionType = this.type(expression); |
| 11627 if (isVoidFunction && !$notnull_bool(this.types.isAssignable(expressionType,
this.types.voidType))) { | 11235 if (isVoidFunction && !this.types.isAssignable(expressionType, this.types.vo
idType)) { |
| 11628 this.reportTypeWarning(expression, const$268/*WarningKind.RETURN_VALUE_IN_
VOID*/, const$13/*const []*/); | 11236 this.reportTypeWarning(expression, const$268/*WarningKind.RETURN_VALUE_IN_
VOID*/, const$13/*const []*/); |
| 11629 } | 11237 } |
| 11630 else { | 11238 else { |
| 11631 this.checkAssignable(expression, expressionType, this.expectedReturnType); | 11239 this.checkAssignable(expression, expressionType, this.expectedReturnType); |
| 11632 } | 11240 } |
| 11633 } | 11241 } |
| 11634 else if (!$notnull_bool(this.types.isAssignable(this.expectedReturnType, this.
types.voidType))) { | 11242 else if (!this.types.isAssignable(this.expectedReturnType, this.types.voidType
)) { |
| 11635 this.reportTypeWarning(node, const$272/*WarningKind.RETURN_NOTHING*/, [this.
expectedReturnType]); | 11243 this.reportTypeWarning(node, const$272/*WarningKind.RETURN_NOTHING*/, [this.
expectedReturnType]); |
| 11636 } | 11244 } |
| 11637 return null; | 11245 return null; |
| 11638 } | 11246 } |
| 11639 TypeCheckerVisitor.prototype.visitThrow = function(node) { | 11247 TypeCheckerVisitor.prototype.visitThrow = function(node) { |
| 11640 if (node.expression != null) this.type(node.expression); | 11248 if (node.expression != null) this.type(node.expression); |
| 11641 return this.types.voidType; | 11249 return this.types.voidType; |
| 11642 } | 11250 } |
| 11643 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) { | 11251 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) { |
| 11644 if (node.typeName == null) return this.types.dynamicType; | 11252 if (node.typeName == null) return this.types.dynamicType; |
| 11645 var name = node.typeName.get$source(); | 11253 var name = node.typeName.get$source(); |
| 11646 var type = this.types.lookup(name); | 11254 var type = this.types.lookup(name); |
| 11647 if (type == null) this.fail(node, ('unsupported type ' + name + '')); | 11255 if (type == null) this.fail(node, ('unsupported type ' + name + '')); |
| 11648 return type; | 11256 return type; |
| 11649 } | 11257 } |
| 11650 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) { | 11258 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) { |
| 11651 var $0; | |
| 11652 var type = this.typeWithDefault(node.type, this.types.dynamicType); | 11259 var type = this.typeWithDefault(node.type, this.types.dynamicType); |
| 11653 if ($eq(type, this.types.voidType)) { | 11260 if ($eq(type, this.types.voidType)) { |
| 11654 this.reportTypeWarning(node.type, const$275/*WarningKind.VOID_VARIABLE*/, co
nst$13/*const []*/); | 11261 this.reportTypeWarning(node.type, const$275/*WarningKind.VOID_VARIABLE*/, co
nst$13/*const []*/); |
| 11655 type = this.types.dynamicType; | 11262 type = this.types.dynamicType; |
| 11656 } | 11263 } |
| 11657 for (var link = node.definitions.nodes; | 11264 for (var link = node.definitions.nodes; |
| 11658 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 11265 !link.isEmpty(); link = link.get$tail()) { |
| 11659 var initialization = (($0 = link.get$head()) && $0.is$Node()); | 11266 var initialization = link.get$head(); |
| 11660 this.compiler.ensure((initialization instanceof Identifier) || (initializati
on instanceof Send)); | 11267 this.compiler.ensure((initialization instanceof Identifier) || (initializati
on instanceof Send)); |
| 11661 if ((initialization instanceof Send)) { | 11268 if ((initialization instanceof Send)) { |
| 11662 var initializer = this.nonVoidType((($0 = link.get$head()) && $0.is$Node()
)); | 11269 var initializer = this.nonVoidType(link.get$head()); |
| 11663 this.checkAssignable(node, type, initializer); | 11270 this.checkAssignable(node, type, initializer); |
| 11664 } | 11271 } |
| 11665 } | 11272 } |
| 11666 return null; | 11273 return null; |
| 11667 } | 11274 } |
| 11668 // ********** Code for Universe ************** | 11275 // ********** Code for Universe ************** |
| 11669 function Universe() { | 11276 function Universe() { |
| 11670 this.elements = $map([]); | 11277 this.elements = $map([]); |
| 11671 this.generatedCode = $map([]); | 11278 this.generatedCode = $map([]); |
| 11672 this.scope = new Element(const$2, null, null); | 11279 this.scope = new Element(const$2, null, null); |
| 11673 // Initializers done | 11280 // Initializers done |
| 11674 } | 11281 } |
| 11675 Universe.prototype.find = function(name) { | 11282 Universe.prototype.find = function(name) { |
| 11676 var $0; | 11283 return this.elements.$index(name); |
| 11677 return (($0 = this.elements.$index(name)) && $0.is$Element()); | |
| 11678 } | 11284 } |
| 11679 Universe.prototype.define = function(element) { | 11285 Universe.prototype.define = function(element) { |
| 11680 $assert(this.elements.$index(element.name) == null, "elements[element.name] ==
null", "universe.dart", 20, 12); | |
| 11681 this.elements.$setindex(element.name, element); | 11286 this.elements.$setindex(element.name, element); |
| 11682 } | 11287 } |
| 11683 Universe.prototype.addGeneratedCode = function(element, code) { | 11288 Universe.prototype.addGeneratedCode = function(element, code) { |
| 11684 this.generatedCode.$setindex(element, code); | 11289 this.generatedCode.$setindex(element, code); |
| 11685 } | 11290 } |
| 11686 // ********** Code for top level ************** | 11291 // ********** Code for top level ************** |
| 11687 function unreachable() { | 11292 function unreachable() { |
| 11688 $throw(const$295/*const Exception("Internal Error (Leg): UNREACHABLE")*/); | 11293 $throw(const$295/*const Exception("Internal Error (Leg): UNREACHABLE")*/); |
| 11689 } | 11294 } |
| 11690 function compile(world) { | 11295 function compile(world) { |
| 11691 var file = world.readFile(options.dartScript); | 11296 var file = world.readFile(options.dartScript); |
| 11692 var script = new leg_Script(file); | 11297 var script = new leg_Script(file); |
| 11693 var compiler = new WorldCompiler(world, script); | 11298 var compiler = new WorldCompiler(world, script); |
| 11694 return compiler.run(); | 11299 return compiler.run(); |
| 11695 } | 11300 } |
| 11696 // ********** Library lang ************** | 11301 // ********** Library lang ************** |
| 11697 // ********** Code for CodeWriter ************** | 11302 // ********** Code for CodeWriter ************** |
| 11698 function CodeWriter() { | 11303 function CodeWriter() { |
| 11699 this._indentation = 0 | 11304 this._indentation = 0 |
| 11700 this._pendingIndent = false | 11305 this._pendingIndent = false |
| 11701 this.writeComments = true | 11306 this.writeComments = true |
| 11702 this._buf = new StringBufferImpl(""); | 11307 this._buf = new StringBufferImpl(""); |
| 11703 // Initializers done | 11308 // Initializers done |
| 11704 } | 11309 } |
| 11705 CodeWriter.prototype.is$CodeWriter = function(){return this;}; | |
| 11706 CodeWriter.prototype.get$text = function() { | 11310 CodeWriter.prototype.get$text = function() { |
| 11707 return this._buf.toString(); | 11311 return this._buf.toString(); |
| 11708 } | 11312 } |
| 11709 CodeWriter.prototype._indent = function() { | 11313 CodeWriter.prototype._indent = function() { |
| 11710 this._pendingIndent = false; | 11314 this._pendingIndent = false; |
| 11711 for (var i = 0; | 11315 for (var i = 0; |
| 11712 i < this._indentation; i++) { | 11316 i < this._indentation; i++) { |
| 11713 this._buf.add(' '/*CodeWriter.INDENTATION*/); | 11317 this._buf.add(' '/*CodeWriter.INDENTATION*/); |
| 11714 } | 11318 } |
| 11715 } | 11319 } |
| 11716 CodeWriter.prototype.comment = function(text) { | 11320 CodeWriter.prototype.comment = function(text) { |
| 11717 if ($notnull_bool(this.writeComments)) { | 11321 if (this.writeComments) { |
| 11718 this.writeln(text); | 11322 this.writeln(text); |
| 11719 } | 11323 } |
| 11720 } | 11324 } |
| 11721 CodeWriter.prototype.write = function(text) { | 11325 CodeWriter.prototype.write = function(text) { |
| 11722 if (text.length == 0) return; | 11326 if (text.length == 0) return; |
| 11723 if ($notnull_bool(this._pendingIndent)) this._indent(); | 11327 if (this._pendingIndent) this._indent(); |
| 11724 if (text.indexOf('\n', 0) != -1) { | 11328 if (text.indexOf('\n', 0) != -1) { |
| 11725 var lines = text.split('\n'); | 11329 var lines = text.split('\n'); |
| 11726 for (var i = 0; | 11330 for (var i = 0; |
| 11727 i < lines.length - 1; i++) { | 11331 i < lines.length - 1; i++) { |
| 11728 this.writeln($assert_String(lines.$index(i))); | 11332 this.writeln(lines.$index(i)); |
| 11729 } | 11333 } |
| 11730 this.write($assert_String(lines.$index(lines.length - 1))); | 11334 this.write(lines.$index(lines.length - 1)); |
| 11731 } | 11335 } |
| 11732 else { | 11336 else { |
| 11733 this._buf.add(text); | 11337 this._buf.add(text); |
| 11734 } | 11338 } |
| 11735 } | 11339 } |
| 11736 CodeWriter.prototype.writeln = function(text) { | 11340 CodeWriter.prototype.writeln = function(text) { |
| 11737 if (text != null) { | 11341 if (text != null) { |
| 11738 this.write(text); | 11342 this.write(text); |
| 11739 } | 11343 } |
| 11740 if (!text.endsWith('\n')) this._buf.add('\n'/*CodeWriter.NEWLINE*/); | 11344 if (!text.endsWith('\n')) this._buf.add('\n'/*CodeWriter.NEWLINE*/); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 11764 this.useMap = false | 11368 this.useMap = false |
| 11765 this.useAssert = false | 11369 this.useAssert = false |
| 11766 this.useNotNullBool = false | 11370 this.useNotNullBool = false |
| 11767 this.useIndex = false | 11371 this.useIndex = false |
| 11768 this.useSetIndex = false | 11372 this.useSetIndex = false |
| 11769 this.useToString = false | 11373 this.useToString = false |
| 11770 this._usedOperators = $map([]); | 11374 this._usedOperators = $map([]); |
| 11771 // Initializers done | 11375 // Initializers done |
| 11772 } | 11376 } |
| 11773 CoreJs.prototype.useOperator = function(name) { | 11377 CoreJs.prototype.useOperator = function(name) { |
| 11774 if ($notnull_bool($ne(this._usedOperators.$index(name), null))) return; | 11378 if ($ne(this._usedOperators.$index(name), null)) return; |
| 11775 var code; | 11379 var code; |
| 11776 switch (name) { | 11380 switch (name) { |
| 11777 case '\$ne': | 11381 case '\$ne': |
| 11778 | 11382 |
| 11779 code = "function $ne(x, y) {\n if (x == null) return y != null;\n return
(typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'bo
olean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(
y) == 'string')\n ? x != y : !x.$eq(y);\n}"; | 11383 code = "function $ne(x, y) {\n if (x == null) return y != null;\n return
(typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'bo
olean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(
y) == 'string')\n ? x != y : !x.$eq(y);\n}"; |
| 11780 break; | 11384 break; |
| 11781 | 11385 |
| 11782 case '\$eq': | 11386 case '\$eq': |
| 11783 | 11387 |
| 11784 code = "function $eq(x, y) {\n if (x == null) return y == null;\n return
(typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'bo
olean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(
y) == 'string')\n ? x == y : x.$eq(y);\n}\n// TODO(jimhug): Should this or sh
ould it not match equals?\nObject.prototype.$eq = function(other) { return this
=== other; }"; | 11388 code = "function $eq(x, y) {\n if (x == null) return y == null;\n return
(typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'bo
olean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(
y) == 'string')\n ? x == y : x.$eq(y);\n}\n// TODO(jimhug): Should this or sh
ould it not match equals?\nObject.prototype.$eq = function(other) { return this
=== other; }"; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 11813 default: | 11417 default: |
| 11814 | 11418 |
| 11815 var op = TokenKind.rawOperatorFromMethod(name); | 11419 var op = TokenKind.rawOperatorFromMethod(name); |
| 11816 code = ("function " + name + "(x, y) {\n return (typeof(x) == 'number' &&
typeof(y) == 'number')\n ? x " + op + " y : x." + name + "(y);\n}"); | 11420 code = ("function " + name + "(x, y) {\n return (typeof(x) == 'number' &&
typeof(y) == 'number')\n ? x " + op + " y : x." + name + "(y);\n}"); |
| 11817 break; | 11421 break; |
| 11818 | 11422 |
| 11819 } | 11423 } |
| 11820 this._usedOperators.$setindex(name, code); | 11424 this._usedOperators.$setindex(name, code); |
| 11821 } | 11425 } |
| 11822 CoreJs.prototype.generate = function(w) { | 11426 CoreJs.prototype.generate = function(w) { |
| 11823 if ($notnull_bool(this.useVarMethod)) { | 11427 if (this.useVarMethod) { |
| 11824 this.useTypeNameOf = true; | 11428 this.useTypeNameOf = true; |
| 11825 w.writeln("function $varMethod(name, methods) {\n Object.prototype[name] =
function() {\n $patchMethod(this, name, methods);\n return this[name].appl
y(this, Array.prototype.slice.call(arguments));\n };\n}\nfunction $patchMethod(
obj, name, methods) {\n // Get the prototype to patch.\n // Don't overwrite an
existing stub, like the one on Object.prototype\n var proto = Object.getProtot
ypeOf(obj);\n if (!proto || proto.hasOwnProperty(name)) proto = obj;\n var met
hod;\n while (obj && !(method = methods[obj.$typeNameOf()])) {\n obj = Objec
t.getPrototypeOf(obj);\n }\n obj[name] = method || methods['Object'];\n}"); | 11429 w.writeln("function $varMethod(name, methods) {\n Object.prototype[name] =
function() {\n $patchMethod(this, name, methods);\n return this[name].appl
y(this, Array.prototype.slice.call(arguments));\n };\n}\nfunction $patchMethod(
obj, name, methods) {\n // Get the prototype to patch.\n // Don't overwrite an
existing stub, like the one on Object.prototype\n var proto = Object.getProtot
ypeOf(obj);\n if (!proto || proto.hasOwnProperty(name)) proto = obj;\n var met
hod;\n while (obj && !(method = methods[obj.$typeNameOf()])) {\n obj = Objec
t.getPrototypeOf(obj);\n }\n obj[name] = method || methods['Object'];\n}"); |
| 11826 } | 11430 } |
| 11827 if ($notnull_bool(this.useGenStub)) { | 11431 if (this.useGenStub) { |
| 11828 this.useThrow = true; | 11432 this.useThrow = true; |
| 11829 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}"); | 11433 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}"); |
| 11830 } | 11434 } |
| 11831 if ($notnull_bool(this.useStackTraceOf)) { | 11435 if (this.useStackTraceOf) { |
| 11832 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}"); | 11436 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}"); |
| 11833 } | 11437 } |
| 11834 if ($notnull_bool(this.useToDartException)) { | 11438 if (this.useToDartException) { |
| 11835 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}"); | 11439 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}"); |
| 11836 } | 11440 } |
| 11837 if ($notnull_bool(this.useNotNullBool)) { | 11441 if (this.useNotNullBool) { |
| 11838 this.useThrow = true; | 11442 this.useThrow = true; |
| 11839 w.writeln("function $notnull_bool(test) {\n return (test === true || test =
== false) ? test : test.is$bool(); // TypeError\n}"); | 11443 w.writeln("function $notnull_bool(test) {\n return (test === true || test =
== false) ? test : test.is$bool(); // TypeError\n}"); |
| 11840 } | 11444 } |
| 11841 if ($notnull_bool(this.useAssert)) { | 11445 if (this.useAssert) { |
| 11842 this.useThrow = true; | 11446 this.useThrow = true; |
| 11843 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}"); | 11447 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}"); |
| 11844 } | 11448 } |
| 11845 if ($notnull_bool(this.useThrow)) { | 11449 if (this.useThrow) { |
| 11846 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}"); | 11450 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}"); |
| 11847 } | 11451 } |
| 11848 if ($notnull_bool(this.useMap)) { | 11452 if (this.useMap) { |
| 11849 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}"); | 11453 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}"); |
| 11850 } | 11454 } |
| 11851 if ($notnull_bool(this.useToString)) { | 11455 if (this.useToString) { |
| 11852 w.writeln("function $toString(o) {\n if (o == null) return 'null';\n var t
= typeof(o);\n if (t == 'object') { return o.toString(); }\n else if (t == 's
tring') { return o; }\n else if (t == 'bool') { return ''+o; }\n else if (t ==
'number') { return ''+o; }\n else return o.toString();\n}"); | 11456 w.writeln("function $toString(o) {\n if (o == null) return 'null';\n var t
= typeof(o);\n if (t == 'object') { return o.toString(); }\n else if (t == 's
tring') { return o; }\n else if (t == 'bool') { return ''+o; }\n else if (t ==
'number') { return ''+o; }\n else return o.toString();\n}"); |
| 11853 } | 11457 } |
| 11854 if ($notnull_bool(this.useTypeNameOf)) { | 11458 if (this.useTypeNameOf) { |
| 11855 w.writeln("Object.prototype.$typeNameOf = function() {\n if ((typeof(window
) != 'undefined' && window.constructor.name == 'DOMWindow')\n || typeof(pro
cess) != 'undefined') { // fast-path for Chrome and Node\n return this.constr
uctor.name;\n }\n var str = Object.prototype.toString.call(this);\n return st
r.substring(8, str.length - 1);\n}"); | 11459 w.writeln("Object.prototype.$typeNameOf = function() {\n if ((typeof(window
) != 'undefined' && window.constructor.name == 'DOMWindow')\n || typeof(pro
cess) != 'undefined') { // fast-path for Chrome and Node\n return this.constr
uctor.name;\n }\n var str = Object.prototype.toString.call(this);\n return st
r.substring(8, str.length - 1);\n}"); |
| 11856 } | 11460 } |
| 11857 if ($notnull_bool(this.useIndex)) { | 11461 if (this.useIndex) { |
| 11858 w.writeln("Object.prototype.$index = function(i) { return this[i]; }\nArray.
prototype.$index = function(i) { return this[i]; }\nString.prototype.$index = fu
nction(i) { return this[i]; }"); | 11462 w.writeln("Object.prototype.$index = function(i) { return this[i]; }\nArray.
prototype.$index = function(i) { return this[i]; }\nString.prototype.$index = fu
nction(i) { return this[i]; }"); |
| 11859 } | 11463 } |
| 11860 if ($notnull_bool(this.useSetIndex)) { | 11464 if (this.useSetIndex) { |
| 11861 w.writeln("Object.prototype.$setindex = function(i, value) { return this[i]
= value; }\nArray.prototype.$setindex = function(i, value) { return this[i] = va
lue; }"); | 11465 w.writeln("Object.prototype.$setindex = function(i, value) { return this[i]
= value; }\nArray.prototype.$setindex = function(i, value) { return this[i] = va
lue; }"); |
| 11862 } | 11466 } |
| 11863 var $list = orderValuesByKeys(this._usedOperators); | 11467 var $list = orderValuesByKeys(this._usedOperators); |
| 11864 for (var $i = 0;$i < $list.length; $i++) { | 11468 for (var $i = 0;$i < $list.length; $i++) { |
| 11865 var opImpl = $list.$index($i); | 11469 var opImpl = $list.$index($i); |
| 11866 w.writeln($assert_String(opImpl)); | 11470 w.writeln(opImpl); |
| 11867 } | 11471 } |
| 11868 } | 11472 } |
| 11869 CoreJs.prototype.generate$1 = function($0) { | 11473 CoreJs.prototype.generate$1 = function($0) { |
| 11870 return this.generate(($0 && $0.is$CodeWriter())); | 11474 return this.generate($0); |
| 11871 }; | 11475 }; |
| 11872 // ********** Code for WorldGenerator ************** | 11476 // ********** Code for WorldGenerator ************** |
| 11873 function WorldGenerator(main, writer) { | 11477 function WorldGenerator(main, writer) { |
| 11874 this._inheritsGenerated = false | 11478 this._inheritsGenerated = false |
| 11875 this.main = main; | 11479 this.main = main; |
| 11876 this.writer = writer; | 11480 this.writer = writer; |
| 11877 this.globals = $map([]); | 11481 this.globals = $map([]); |
| 11878 this.corejs = new CoreJs(); | 11482 this.corejs = new CoreJs(); |
| 11879 // Initializers done | 11483 // Initializers done |
| 11880 } | 11484 } |
| 11881 WorldGenerator.prototype.run = function() { | 11485 WorldGenerator.prototype.run = function() { |
| 11882 var $0; | |
| 11883 var metaGen = new MethodGenerator(this.main, null); | 11486 var metaGen = new MethodGenerator(this.main, null); |
| 11884 var mainCall = this.main.invoke((metaGen && metaGen.is$MethodGenerator()), nul
l, null, Arguments.get$EMPTY(), false); | 11487 var mainCall = this.main.invoke(metaGen, null, null, Arguments.get$EMPTY(), fa
lse); |
| 11885 this.main.declaringType.markUsed(); | 11488 this.main.declaringType.markUsed(); |
| 11886 world.corelib.types.$index('BadNumberFormatException').markUsed$0(); | 11489 world.corelib.types.$index('BadNumberFormatException').markUsed$0(); |
| 11887 world.get$coreimpl().types.$index('NumImplementation').markUsed$0(); | 11490 world.get$coreimpl().types.$index('NumImplementation').markUsed$0(); |
| 11888 world.get$coreimpl().types.$index('StringImplementation').markUsed$0(); | 11491 world.get$coreimpl().types.$index('StringImplementation').markUsed$0(); |
| 11889 world.get$coreimpl().types.$index('MatchImplementation').markUsed$0(); | 11492 world.get$coreimpl().types.$index('MatchImplementation').markUsed$0(); |
| 11890 this.genMethod((($0 = world.get$coreimpl().types.$index('MatchImplementation')
.getConstructor$1('')) && $0.is$Member())); | 11493 this.genMethod(world.get$coreimpl().types.$index('MatchImplementation').getCon
structor$1('')); |
| 11891 this.writeTypes(world.get$coreimpl()); | 11494 this.writeTypes(world.get$coreimpl()); |
| 11892 this.writeTypes(world.corelib); | 11495 this.writeTypes(world.corelib); |
| 11893 this.writeTypes(this.main.declaringType.get$library()); | 11496 this.writeTypes(this.main.declaringType.get$library()); |
| 11894 this._writeGlobals(); | 11497 this._writeGlobals(); |
| 11895 this.writer.writeln(('RunEntry(function() {' + mainCall.code + ';}, []);')); | 11498 this.writer.writeln(('RunEntry(function() {' + mainCall.code + ';}, []);')); |
| 11896 } | 11499 } |
| 11897 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe
ndencies) { | 11500 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe
ndencies) { |
| 11898 var $0; | |
| 11899 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); | 11501 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); |
| 11900 if (!this.globals.containsKey(fullname)) { | 11502 if (!this.globals.containsKey(fullname)) { |
| 11901 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory(
field, fieldValue, dependencies)); | 11503 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory(
field, fieldValue, dependencies)); |
| 11902 } | 11504 } |
| 11903 return (($0 = this.globals.$index(fullname)) && $0.is$GlobalValue()); | 11505 return this.globals.$index(fullname); |
| 11904 } | 11506 } |
| 11905 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { | 11507 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { |
| 11906 var $0; | |
| 11907 var code = exp.canonicalCode; | 11508 var code = exp.canonicalCode; |
| 11908 if (!this.globals.containsKey(code)) { | 11509 if (!this.globals.containsKey(code)) { |
| 11909 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this.
globals.get$length(), exp, dependencies)); | 11510 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this.
globals.get$length(), exp, dependencies)); |
| 11910 } | 11511 } |
| 11911 return (($0 = this.globals.$index(code)) && $0.is$GlobalValue()); | 11512 return this.globals.$index(code); |
| 11912 } | 11513 } |
| 11913 WorldGenerator.prototype.writeTypes = function(lib) { | 11514 WorldGenerator.prototype.writeTypes = function(lib) { |
| 11914 if ($notnull_bool(lib.isWritten)) return; | 11515 if (lib.isWritten) return; |
| 11915 lib.isWritten = true; | 11516 lib.isWritten = true; |
| 11916 var $list = lib.imports; | 11517 var $list = lib.imports; |
| 11917 for (var $i = 0;$i < $list.length; $i++) { | 11518 for (var $i = 0;$i < $list.length; $i++) { |
| 11918 var import_ = $list.$index($i); | 11519 var import_ = $list.$index($i); |
| 11919 this.writeTypes(import_.get$library()); | 11520 this.writeTypes(import_.get$library()); |
| 11920 } | 11521 } |
| 11921 for (var i = 0; | 11522 for (var i = 0; |
| 11922 i < lib.sources.length; i++) { | 11523 i < lib.sources.length; i++) { |
| 11923 lib.sources.$index(i).orderInLibrary = i; | 11524 lib.sources.$index(i).orderInLibrary = i; |
| 11924 } | 11525 } |
| 11925 this.writer.comment(('// ********** Library ' + lib.name + ' **************')
); | 11526 this.writer.comment(('// ********** Library ' + lib.name + ' **************')
); |
| 11926 if ($notnull_bool(lib.get$isCore())) { | 11527 if (lib.get$isCore()) { |
| 11927 this.writer.comment('// ********** Natives dart:core **************'); | 11528 this.writer.comment('// ********** Natives dart:core **************'); |
| 11928 this.corejs.generate(this.writer); | 11529 this.corejs.generate(this.writer); |
| 11929 } | 11530 } |
| 11930 var $list = lib.natives; | 11531 var $list = lib.natives; |
| 11931 for (var $i = 0;$i < $list.length; $i++) { | 11532 for (var $i = 0;$i < $list.length; $i++) { |
| 11932 var file = $list.$index($i); | 11533 var file = $list.$index($i); |
| 11933 var filename = basename(file.filename); | 11534 var filename = basename(file.filename); |
| 11934 this.writer.comment(('// ********** Natives ' + filename + ' **************
')); | 11535 this.writer.comment(('// ********** Natives ' + filename + ' **************
')); |
| 11935 this.writer.writeln(file.get$text()); | 11536 this.writer.writeln(file.get$text()); |
| 11936 } | 11537 } |
| 11937 lib.topType.markUsed(); | 11538 lib.topType.markUsed(); |
| 11938 var $list = this._orderValues(lib.types); | 11539 var $list = this._orderValues(lib.types); |
| 11939 for (var $i = 0;$i < $list.length; $i++) { | 11540 for (var $i = 0;$i < $list.length; $i++) { |
| 11940 var type = $list.$index($i); | 11541 var type = $list.$index($i); |
| 11941 if ($notnull_bool(type.get$isUsed()) && $notnull_bool(type.get$isClass())) { | 11542 if (type.get$isUsed() && type.get$isClass()) { |
| 11942 this.writeType((type && type.is$lang_Type())); | 11543 this.writeType(type); |
| 11943 if ($notnull_bool(type.get$isGeneric())) { | 11544 if (type.get$isGeneric()) { |
| 11944 var $list0 = this._orderValues(type._concreteTypes); | 11545 var $list0 = this._orderValues(type._concreteTypes); |
| 11945 for (var $i0 = 0;$i0 < $list0.length; $i0++) { | 11546 for (var $i0 = 0;$i0 < $list0.length; $i0++) { |
| 11946 var ct = $list0.$index($i0); | 11547 var ct = $list0.$index($i0); |
| 11947 this.writeType((ct && ct.is$lang_Type())); | 11548 this.writeType(ct); |
| 11948 } | 11549 } |
| 11949 } | 11550 } |
| 11950 } | 11551 } |
| 11951 if ($notnull_bool(type.get$isFunction()) && type.varStubs != null) { | 11552 if (type.get$isFunction() && type.varStubs != null) { |
| 11952 this.writer.comment(('// ********** Code for ' + type.get$jsname() + ' ***
***********')); | 11553 this.writer.comment(('// ********** Code for ' + type.get$jsname() + ' ***
***********')); |
| 11953 this._writeDynamicStubs((type && type.is$lang_Type())); | 11554 this._writeDynamicStubs(type); |
| 11954 } | 11555 } |
| 11955 if (type.typeCheckCode != null) { | 11556 if (type.typeCheckCode != null) { |
| 11956 this.writer.writeln(type.typeCheckCode); | 11557 this.writer.writeln(type.typeCheckCode); |
| 11957 } | 11558 } |
| 11958 } | 11559 } |
| 11959 } | 11560 } |
| 11960 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { | 11561 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { |
| 11961 if (!$notnull_bool(meth.isGenerated) && !$notnull_bool(meth.get$isAbstract())
&& $notnull_bool($ne(meth.get$definition(), null))) { | 11562 if (!meth.isGenerated && !meth.get$isAbstract() && $ne(meth.get$definition(),
null)) { |
| 11962 new MethodGenerator(meth, enclosingMethod).run(); | 11563 new MethodGenerator(meth, enclosingMethod).run(); |
| 11963 } | 11564 } |
| 11964 } | 11565 } |
| 11965 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { | 11566 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { |
| 11966 if (!$notnull_bool(checkType.isTested)) return; | 11567 if (!checkType.isTested) return; |
| 11967 var value = 'false'; | 11568 var value = 'false'; |
| 11968 if ($notnull_bool(onType.isSubtypeOf(checkType))) { | 11569 if (onType.isSubtypeOf(checkType)) { |
| 11969 value = 'function(){return this;}'; | 11570 value = 'function(){return this;}'; |
| 11970 } | 11571 } |
| 11971 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType.
get$jsname() + ' = ') + ('' + value + ';')); | 11572 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType.
get$jsname() + ' = ') + ('' + value + ';')); |
| 11972 } | 11573 } |
| 11973 WorldGenerator.prototype.writeType = function(type) { | 11574 WorldGenerator.prototype.writeType = function(type) { |
| 11974 var $0; | |
| 11975 if (type.name != null && (type instanceof ConcreteType) && $eq(type.get$librar
y(), world.get$coreimpl()) && type.name.startsWith('ListFactory')) { | 11575 if (type.name != null && (type instanceof ConcreteType) && $eq(type.get$librar
y(), world.get$coreimpl()) && type.name.startsWith('ListFactory')) { |
| 11976 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType()
.get$jsname() + ';')); | 11576 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType()
.get$jsname() + ';')); |
| 11977 return; | 11577 return; |
| 11978 } | 11578 } |
| 11979 var typeName = type.get$jsname() != null ? type.get$jsname() : 'top level'; | 11579 var typeName = type.get$jsname() != null ? type.get$jsname() : 'top level'; |
| 11980 this.writer.comment(('// ********** Code for ' + typeName + ' **************')
); | 11580 this.writer.comment(('// ********** Code for ' + typeName + ' **************')
); |
| 11981 if ($notnull_bool(type.get$isNativeType()) && !$notnull_bool(type.get$isTop())
) { | 11581 if (type.get$isNativeType() && !type.get$isTop()) { |
| 11982 var nativeName = type.get$definition().get$nativeType(); | 11582 var nativeName = type.get$definition().get$nativeType(); |
| 11983 if ($notnull_bool($eq(nativeName, ''))) { | 11583 if ($eq(nativeName, '')) { |
| 11984 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 11584 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 11985 } | 11585 } |
| 11986 else if (type.get$jsname() != nativeName) { | 11586 else if (type.get$jsname() != nativeName) { |
| 11987 this.writer.writeln(('' + type.get$jsname() + ' = ' + nativeName + ';')); | 11587 this.writer.writeln(('' + type.get$jsname() + ' = ' + nativeName + ';')); |
| 11988 } | 11588 } |
| 11989 } | 11589 } |
| 11990 if ($notnull_bool(type.get$isTop())) { | 11590 if (type.get$isTop()) { |
| 11991 } | 11591 } |
| 11992 else if (type.get$constructors().get$length() == 0) { | 11592 else if (type.get$constructors().get$length() == 0) { |
| 11993 if (!$notnull_bool(type.get$isNativeType())) { | 11593 if (!type.get$isNativeType()) { |
| 11994 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 11594 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 11995 } | 11595 } |
| 11996 } | 11596 } |
| 11997 else { | 11597 else { |
| 11998 var standardConstructor = (($0 = type.get$constructors().$index('')) && $0.i
s$Member()); | 11598 var standardConstructor = type.get$constructors().$index(''); |
| 11999 if (standardConstructor == null || standardConstructor.generator == null) { | 11599 if (standardConstructor == null || standardConstructor.generator == null) { |
| 12000 if (!$notnull_bool(type.get$isNativeType())) { | 11600 if (!type.get$isNativeType()) { |
| 12001 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 11601 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 12002 } | 11602 } |
| 12003 } | 11603 } |
| 12004 else { | 11604 else { |
| 12005 standardConstructor.generator.writeDefinition(this.writer, null); | 11605 standardConstructor.generator.writeDefinition(this.writer, null); |
| 12006 } | 11606 } |
| 12007 var $list = type.get$constructors().getValues(); | 11607 var $list = type.get$constructors().getValues(); |
| 12008 for (var $i = type.get$constructors().getValues().iterator$0(); $i.hasNext$0
(); ) { | 11608 for (var $i = type.get$constructors().getValues().iterator$0(); $i.hasNext$0
(); ) { |
| 12009 var c = $i.next$0(); | 11609 var c = $i.next$0(); |
| 12010 if ($notnull_bool($ne(c.generator, null)) && $notnull_bool($ne(c, standard
Constructor))) { | 11610 if ($ne(c.generator, null) && $ne(c, standardConstructor)) { |
| 12011 c.generator.writeDefinition$2(this.writer); | 11611 c.generator.writeDefinition$2(this.writer); |
| 12012 } | 11612 } |
| 12013 } | 11613 } |
| 12014 } | 11614 } |
| 12015 if (!$notnull_bool(type.get$isTop())) { | 11615 if (!type.get$isTop()) { |
| 12016 if ((type instanceof ConcreteType)) { | 11616 if ((type instanceof ConcreteType)) { |
| 12017 this._ensureInheritsHelper(); | 11617 this._ensureInheritsHelper(); |
| 12018 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g
enericType().get$jsname() + ');')); | 11618 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g
enericType().get$jsname() + ');')); |
| 12019 } | 11619 } |
| 12020 else if (!$notnull_bool(type.get$isNativeType())) { | 11620 else if (!type.get$isNativeType()) { |
| 12021 if (type.get$parent() != null && !$notnull_bool(type.get$parent().get$isOb
ject())) { | 11621 if (type.get$parent() != null && !type.get$parent().get$isObject()) { |
| 12022 this._ensureInheritsHelper(); | 11622 this._ensureInheritsHelper(); |
| 12023 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get
$parent().get$jsname() + ');')); | 11623 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get
$parent().get$jsname() + ');')); |
| 12024 } | 11624 } |
| 12025 } | 11625 } |
| 12026 } | 11626 } |
| 12027 if (!(type instanceof ConcreteType)) { | 11627 if (!(type instanceof ConcreteType)) { |
| 12028 this._maybeIsTest(type, type); | 11628 this._maybeIsTest(type, type); |
| 12029 } | 11629 } |
| 12030 if (type.get$genericType()._concreteTypes != null) { | 11630 if (type.get$genericType()._concreteTypes != null) { |
| 12031 var $list = this._orderValues(type.get$genericType()._concreteTypes); | 11631 var $list = this._orderValues(type.get$genericType()._concreteTypes); |
| 12032 for (var $i = 0;$i < $list.length; $i++) { | 11632 for (var $i = 0;$i < $list.length; $i++) { |
| 12033 var ct = $list.$index($i); | 11633 var ct = $list.$index($i); |
| 12034 this._maybeIsTest(type, (ct && ct.is$lang_Type())); | 11634 this._maybeIsTest(type, ct); |
| 12035 } | 11635 } |
| 12036 } | 11636 } |
| 12037 if (type.get$interfaces() != null) { | 11637 if (type.get$interfaces() != null) { |
| 12038 var seen = new HashSetImplementation(); | 11638 var seen = new HashSetImplementation(); |
| 12039 var worklist = []; | 11639 var worklist = []; |
| 12040 worklist.addAll(type.get$interfaces()); | 11640 worklist.addAll(type.get$interfaces()); |
| 12041 seen.addAll(type.get$interfaces()); | 11641 seen.addAll(type.get$interfaces()); |
| 12042 while (!worklist.isEmpty()) { | 11642 while (!worklist.isEmpty()) { |
| 12043 var interface_ = worklist.removeLast(); | 11643 var interface_ = worklist.removeLast(); |
| 12044 this._maybeIsTest(type, interface_.get$genericType()); | 11644 this._maybeIsTest(type, interface_.get$genericType()); |
| 12045 if (interface_.get$genericType()._concreteTypes != null) { | 11645 if (interface_.get$genericType()._concreteTypes != null) { |
| 12046 var $list = this._orderValues(interface_.get$genericType()._concreteType
s); | 11646 var $list = this._orderValues(interface_.get$genericType()._concreteType
s); |
| 12047 for (var $i = 0;$i < $list.length; $i++) { | 11647 for (var $i = 0;$i < $list.length; $i++) { |
| 12048 var ct = $list.$index($i); | 11648 var ct = $list.$index($i); |
| 12049 this._maybeIsTest(type, (ct && ct.is$lang_Type())); | 11649 this._maybeIsTest(type, ct); |
| 12050 } | 11650 } |
| 12051 } | 11651 } |
| 12052 var $list = interface_.get$interfaces(); | 11652 var $list = interface_.get$interfaces(); |
| 12053 for (var $i = interface_.get$interfaces().iterator$0(); $i.hasNext$0(); )
{ | 11653 for (var $i = interface_.get$interfaces().iterator$0(); $i.hasNext$0(); )
{ |
| 12054 var other = $i.next$0(); | 11654 var other = $i.next$0(); |
| 12055 if (!seen.contains(other)) { | 11655 if (!seen.contains(other)) { |
| 12056 worklist.addLast(other); | 11656 worklist.addLast(other); |
| 12057 seen.add(other); | 11657 seen.add(other); |
| 12058 } | 11658 } |
| 12059 } | 11659 } |
| 12060 } | 11660 } |
| 12061 } | 11661 } |
| 12062 type.get$factories().forEach(this.get$_writeMethod()); | 11662 type.get$factories().forEach(this.get$_writeMethod()); |
| 12063 var $list = this._orderValues(type.get$members()); | 11663 var $list = this._orderValues(type.get$members()); |
| 12064 for (var $i = 0;$i < $list.length; $i++) { | 11664 for (var $i = 0;$i < $list.length; $i++) { |
| 12065 var member = $list.$index($i); | 11665 var member = $list.$index($i); |
| 12066 if ((member instanceof FieldMember)) { | 11666 if ((member instanceof FieldMember)) { |
| 12067 this._writeField((member && member.is$FieldMember())); | 11667 this._writeField(member); |
| 12068 } | 11668 } |
| 12069 if ((member instanceof PropertyMember)) { | 11669 if ((member instanceof PropertyMember)) { |
| 12070 this._writeProperty((member && member.is$PropertyMember())); | 11670 this._writeProperty(member); |
| 12071 } | 11671 } |
| 12072 if ($notnull_bool(member.get$isMethod())) { | 11672 if (member.get$isMethod()) { |
| 12073 this._writeMethod((member && member.is$Member())); | 11673 this._writeMethod(member); |
| 12074 } | 11674 } |
| 12075 } | 11675 } |
| 12076 this._writeDynamicStubs(type); | 11676 this._writeDynamicStubs(type); |
| 12077 } | 11677 } |
| 12078 WorldGenerator.prototype._ensureInheritsHelper = function() { | 11678 WorldGenerator.prototype._ensureInheritsHelper = function() { |
| 12079 if ($notnull_bool(this._inheritsGenerated)) return; | 11679 if (this._inheritsGenerated) return; |
| 12080 this._inheritsGenerated = true; | 11680 this._inheritsGenerated = true; |
| 12081 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}"); | 11681 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}"); |
| 12082 } | 11682 } |
| 12083 WorldGenerator.prototype._writeDynamicStubs = function(type) { | 11683 WorldGenerator.prototype._writeDynamicStubs = function(type) { |
| 12084 if (type.varStubs != null) { | 11684 if (type.varStubs != null) { |
| 12085 var $list = orderValuesByKeys(type.varStubs); | 11685 var $list = orderValuesByKeys(type.varStubs); |
| 12086 for (var $i = 0;$i < $list.length; $i++) { | 11686 for (var $i = 0;$i < $list.length; $i++) { |
| 12087 var stub = $list.$index($i); | 11687 var stub = $list.$index($i); |
| 12088 stub.generate$1(this.writer); | 11688 stub.generate$1(this.writer); |
| 12089 } | 11689 } |
| 12090 } | 11690 } |
| 12091 } | 11691 } |
| 12092 WorldGenerator.prototype._writeStaticField = function(field) { | 11692 WorldGenerator.prototype._writeStaticField = function(field) { |
| 12093 if ($notnull_bool(field.isFinal)) return; | 11693 if (field.isFinal) return; |
| 12094 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); | 11694 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); |
| 12095 if (this.globals.containsKey(fullname)) { | 11695 if (this.globals.containsKey(fullname)) { |
| 12096 var value = this.globals.$index(fullname); | 11696 var value = this.globals.$index(fullname); |
| 12097 if ($notnull_bool(field.declaringType.get$isTop()) && !$notnull_bool(field.i
sNative)) { | 11697 if (field.declaringType.get$isTop() && !field.isNative) { |
| 12098 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code
+ ';')); | 11698 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code
+ ';')); |
| 12099 } | 11699 } |
| 12100 else { | 11700 else { |
| 12101 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g
et$jsname() + ' = ' + value.exp.code + ';')); | 11701 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g
et$jsname() + ' = ' + value.exp.code + ';')); |
| 12102 } | 11702 } |
| 12103 } | 11703 } |
| 12104 } | 11704 } |
| 12105 WorldGenerator.prototype._writeField = function(field) { | 11705 WorldGenerator.prototype._writeField = function(field) { |
| 12106 if ($notnull_bool(field.declaringType.get$isTop()) && !$notnull_bool(field.isN
ative) && field.value == null) { | 11706 if (field.declaringType.get$isTop() && !field.isNative && field.value == null)
{ |
| 12107 this.writer.writeln(('var ' + field.get$jsname() + ';')); | 11707 this.writer.writeln(('var ' + field.get$jsname() + ';')); |
| 12108 } | 11708 } |
| 12109 if ($notnull_bool(field._providePropertySyntax)) { | 11709 if (field._providePropertySyntax) { |
| 12110 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get
\$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn
ame() + '; };')); | 11710 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get
\$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn
ame() + '; };')); |
| 12111 if (!$notnull_bool(field.isFinal)) { | 11711 if (!field.isFinal) { |
| 12112 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.s
et\$' + field.get$jsname() + ' = ') + ('function(value) { return this.' + field.
get$jsname() + ' = value; };')); | 11712 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.s
et\$' + field.get$jsname() + ' = ') + ('function(value) { return this.' + field.
get$jsname() + ' = value; };')); |
| 12113 } | 11713 } |
| 12114 } | 11714 } |
| 12115 } | 11715 } |
| 12116 WorldGenerator.prototype._writeProperty = function(property) { | 11716 WorldGenerator.prototype._writeProperty = function(property) { |
| 12117 if (property.getter != null) this._writeMethod(property.getter); | 11717 if (property.getter != null) this._writeMethod(property.getter); |
| 12118 if (property.setter != null) this._writeMethod(property.setter); | 11718 if (property.setter != null) this._writeMethod(property.setter); |
| 12119 if ($notnull_bool(property._provideFieldSyntax)) { | 11719 if (property._provideFieldSyntax) { |
| 12120 this.writer.enterBlock('Object.defineProperty(' + ('' + property.declaringTy
pe.get$jsname() + '.prototype, "' + property.get$jsname() + '", {')); | 11720 this.writer.enterBlock('Object.defineProperty(' + ('' + property.declaringTy
pe.get$jsname() + '.prototype, "' + property.get$jsname() + '", {')); |
| 12121 if (property.getter != null) { | 11721 if (property.getter != null) { |
| 12122 this.writer.write(('get: ' + property.declaringType.get$jsname() + '.proto
type.' + property.getter.get$jsname() + '')); | 11722 this.writer.write(('get: ' + property.declaringType.get$jsname() + '.proto
type.' + property.getter.get$jsname() + '')); |
| 12123 this.writer.writeln(property.setter == null ? '' : ','); | 11723 this.writer.writeln(property.setter == null ? '' : ','); |
| 12124 } | 11724 } |
| 12125 if (property.setter != null) { | 11725 if (property.setter != null) { |
| 12126 this.writer.writeln(('set: ' + property.declaringType.get$jsname() + '.pro
totype.' + property.setter.get$jsname() + '')); | 11726 this.writer.writeln(('set: ' + property.declaringType.get$jsname() + '.pro
totype.' + property.setter.get$jsname() + '')); |
| 12127 } | 11727 } |
| 12128 this.writer.exitBlock('});'); | 11728 this.writer.exitBlock('});'); |
| 12129 } | 11729 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 12149 var global = $i.next$0(); | 11749 var global = $i.next$0(); |
| 12150 if (global.field != null) { | 11750 if (global.field != null) { |
| 12151 this._writeStaticField(global.field); | 11751 this._writeStaticField(global.field); |
| 12152 } | 11752 } |
| 12153 else { | 11753 else { |
| 12154 this.writer.writeln(('var ' + global.get$name() + ' = ' + global.exp.code
+ ';')); | 11754 this.writer.writeln(('var ' + global.get$name() + ' = ' + global.exp.code
+ ';')); |
| 12155 } | 11755 } |
| 12156 } | 11756 } |
| 12157 } | 11757 } |
| 12158 WorldGenerator.prototype._orderValues = function(map) { | 11758 WorldGenerator.prototype._orderValues = function(map) { |
| 12159 var $0; | 11759 var values = map.getValues(); |
| 12160 var values = (($0 = map.getValues()) && $0.is$List()); | |
| 12161 values.sort(this.get$_compareMembers()); | 11760 values.sort(this.get$_compareMembers()); |
| 12162 return values; | 11761 return values; |
| 12163 } | 11762 } |
| 12164 WorldGenerator.prototype._compareMembers = function(x, y) { | 11763 WorldGenerator.prototype._compareMembers = function(x, y) { |
| 12165 if (x.get$span() != null && y.get$span() != null) { | 11764 if (x.get$span() != null && y.get$span() != null) { |
| 12166 var spans = x.get$span().compareTo(y.get$span()); | 11765 var spans = x.get$span().compareTo(y.get$span()); |
| 12167 if (spans != 0) return spans; | 11766 if (spans != 0) return spans; |
| 12168 } | 11767 } |
| 12169 if (x.get$span() == null) return 1; | 11768 if (x.get$span() == null) return 1; |
| 12170 if (y.get$span() == null) return -1; | 11769 if (y.get$span() == null) return -1; |
| 12171 return $assert_num(x.get$name().compareTo$1(y.get$name())); | 11770 return x.get$name().compareTo$1(y.get$name()); |
| 12172 } | 11771 } |
| 12173 WorldGenerator.prototype.get$_compareMembers = function() { | 11772 WorldGenerator.prototype.get$_compareMembers = function() { |
| 12174 return WorldGenerator.prototype._compareMembers.bind(this); | 11773 return WorldGenerator.prototype._compareMembers.bind(this); |
| 12175 } | 11774 } |
| 12176 WorldGenerator.prototype.useMapFactory = function() { | 11775 WorldGenerator.prototype.useMapFactory = function() { |
| 12177 var $0; | |
| 12178 this.corejs.useMap = true; | 11776 this.corejs.useMap = true; |
| 12179 var factType = world.get$coreimpl().types.$index('HashMapImplementation'); | 11777 var factType = world.get$coreimpl().types.$index('HashMapImplementation'); |
| 12180 var m = factType.resolveMember$1('\$setindex'); | 11778 var m = factType.resolveMember$1('\$setindex'); |
| 12181 this.genMethod((($0 = m.get$members().$index(0)) && $0.is$Member())); | 11779 this.genMethod(m.get$members().$index(0)); |
| 12182 var c = factType.getConstructor$1(''); | 11780 var c = factType.getConstructor$1(''); |
| 12183 this.genMethod((c && c.is$Member())); | 11781 this.genMethod(c); |
| 12184 return (factType && factType.is$lang_Type()); | 11782 return factType; |
| 12185 } | 11783 } |
| 12186 // ********** Code for BlockScope ************** | 11784 // ********** Code for BlockScope ************** |
| 12187 function BlockScope(enclosingMethod, parent, reentrant) { | 11785 function BlockScope(enclosingMethod, parent, reentrant) { |
| 12188 this.enclosingMethod = enclosingMethod; | 11786 this.enclosingMethod = enclosingMethod; |
| 12189 this.parent = parent; | 11787 this.parent = parent; |
| 12190 this.reentrant = reentrant; | 11788 this.reentrant = reentrant; |
| 12191 this._vars = $map([]); | 11789 this._vars = $map([]); |
| 12192 // Initializers done | 11790 // Initializers done |
| 12193 if ($notnull_bool(this.get$isMethodScope())) { | 11791 if (this.get$isMethodScope()) { |
| 12194 this._closedOver = new HashSetImplementation(); | 11792 this._closedOver = new HashSetImplementation(); |
| 12195 } | 11793 } |
| 12196 else { | 11794 else { |
| 12197 this.reentrant = $notnull_bool(this.reentrant) || $notnull_bool(this.parent.
reentrant); | 11795 this.reentrant = this.reentrant || this.parent.reentrant; |
| 12198 } | 11796 } |
| 12199 } | 11797 } |
| 12200 BlockScope.prototype.is$BlockScope = function(){return this;}; | |
| 12201 BlockScope.prototype.get$parent = function() { return this.parent; }; | 11798 BlockScope.prototype.get$parent = function() { return this.parent; }; |
| 12202 BlockScope.prototype.set$parent = function(value) { return this.parent = value;
}; | 11799 BlockScope.prototype.set$parent = function(value) { return this.parent = value;
}; |
| 12203 BlockScope.prototype.get$isMethodScope = function() { | 11800 BlockScope.prototype.get$isMethodScope = function() { |
| 12204 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM
ethod); | 11801 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM
ethod); |
| 12205 } | 11802 } |
| 12206 BlockScope.prototype.get$methodScope = function() { | 11803 BlockScope.prototype.get$methodScope = function() { |
| 12207 var s = this; | 11804 var s = this; |
| 12208 while (!$notnull_bool(s.get$isMethodScope())) s = s.get$parent(); | 11805 while (!s.get$isMethodScope()) s = s.get$parent(); |
| 12209 return (s && s.is$BlockScope()); | 11806 return s; |
| 12210 } | 11807 } |
| 12211 BlockScope.prototype.lookup = function(name) { | 11808 BlockScope.prototype.lookup = function(name) { |
| 12212 var ret = this._vars.$index(name); | 11809 var ret = this._vars.$index(name); |
| 12213 if ($notnull_bool($ne(ret, null))) return ret; | 11810 if ($ne(ret, null)) return ret; |
| 12214 for (var s = this.parent; | 11811 for (var s = this.parent; |
| 12215 $notnull_bool($ne(s, null)); s = s.get$parent()) { | 11812 $ne(s, null); s = s.get$parent()) { |
| 12216 ret = s._vars.$index(name); | 11813 ret = s._vars.$index(name); |
| 12217 if ($notnull_bool($ne(ret, null))) { | 11814 if ($ne(ret, null)) { |
| 12218 if ($ne(s.enclosingMethod, this.enclosingMethod)) { | 11815 if ($ne(s.enclosingMethod, this.enclosingMethod)) { |
| 12219 s.get$methodScope()._closedOver.add(ret.code); | 11816 s.get$methodScope()._closedOver.add(ret.code); |
| 12220 if (this.enclosingMethod.captures != null && $notnull_bool(s.reentrant))
{ | 11817 if (this.enclosingMethod.captures != null && s.reentrant) { |
| 12221 this.enclosingMethod.captures.add(ret.code); | 11818 this.enclosingMethod.captures.add(ret.code); |
| 12222 } | 11819 } |
| 12223 } | 11820 } |
| 12224 return ret; | 11821 return ret; |
| 12225 } | 11822 } |
| 12226 } | 11823 } |
| 12227 } | 11824 } |
| 12228 BlockScope.prototype._isDefinedInParent = function(name) { | 11825 BlockScope.prototype._isDefinedInParent = function(name) { |
| 12229 if ($notnull_bool(this.get$isMethodScope()) && this._closedOver.contains(name)
) return true; | 11826 if (this.get$isMethodScope() && this._closedOver.contains(name)) return true; |
| 12230 for (var s = this.parent; | 11827 for (var s = this.parent; |
| 12231 $notnull_bool($ne(s, null)); s = s.get$parent()) { | 11828 $ne(s, null); s = s.get$parent()) { |
| 12232 if (s._vars.containsKey(name)) return true; | 11829 if (s._vars.containsKey(name)) return true; |
| 12233 if ($notnull_bool(s.get$isMethodScope()) && s._closedOver.contains(name)) re
turn true; | 11830 if (s.get$isMethodScope() && s._closedOver.contains(name)) return true; |
| 12234 } | 11831 } |
| 12235 var type = this.enclosingMethod.method.declaringType; | 11832 var type = this.enclosingMethod.method.declaringType; |
| 12236 if (type.get$library().lookup(name, null) != null) return true; | 11833 if (type.get$library().lookup(name, null) != null) return true; |
| 12237 return false; | 11834 return false; |
| 12238 } | 11835 } |
| 12239 BlockScope.prototype.create = function(name, type, span, isParameter) { | 11836 BlockScope.prototype.create = function(name, type, span, isParameter) { |
| 12240 var jsName = world.toJsIdentifier(name); | 11837 var jsName = world.toJsIdentifier(name); |
| 12241 if (this._vars.containsKey(name)) { | 11838 if (this._vars.containsKey(name)) { |
| 12242 world.error(('duplicate name "' + name + '"'), span); | 11839 world.error(('duplicate name "' + name + '"'), span); |
| 12243 } | 11840 } |
| 12244 if (!$notnull_bool(isParameter)) { | 11841 if (!isParameter) { |
| 12245 var index = 0; | 11842 var index = 0; |
| 12246 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) { | 11843 while (this._isDefinedInParent(jsName)) { |
| 12247 jsName = ('' + name + '' + index++ + ''); | 11844 jsName = ('' + name + '' + index++ + ''); |
| 12248 } | 11845 } |
| 12249 } | 11846 } |
| 12250 var ret = new Value(type, jsName, span, false); | 11847 var ret = new Value(type, jsName, span, false); |
| 12251 this._vars.$setindex(name, ret); | 11848 this._vars.$setindex(name, ret); |
| 12252 return (ret && ret.is$Value()); | 11849 return ret; |
| 12253 } | 11850 } |
| 12254 BlockScope.prototype.declareParameter = function(p) { | 11851 BlockScope.prototype.declareParameter = function(p) { |
| 12255 return this.create(p.name, p.type, p.definition.span, true); | 11852 return this.create(p.name, p.type, p.definition.span, true); |
| 12256 } | 11853 } |
| 12257 BlockScope.prototype.declare = function(id) { | 11854 BlockScope.prototype.declare = function(id) { |
| 12258 var type = this.enclosingMethod.method.resolveType(id.type, false); | 11855 var type = this.enclosingMethod.method.resolveType(id.type, false); |
| 12259 return this.create(id.name.name, (type && type.is$lang_Type()), id.span, false
); | 11856 return this.create(id.name.name, type, id.span, false); |
| 12260 } | 11857 } |
| 12261 BlockScope.prototype.getRethrow = function() { | 11858 BlockScope.prototype.getRethrow = function() { |
| 12262 var scope = this; | 11859 var scope = this; |
| 12263 while (scope.rethrow == null && $notnull_bool($ne(scope.get$parent(), null)))
{ | 11860 while (scope.rethrow == null && $ne(scope.get$parent(), null)) { |
| 12264 scope = scope.get$parent(); | 11861 scope = scope.get$parent(); |
| 12265 } | 11862 } |
| 12266 return scope.rethrow; | 11863 return scope.rethrow; |
| 12267 } | 11864 } |
| 12268 BlockScope.prototype.lookup$1 = function($0) { | 11865 BlockScope.prototype.lookup$1 = function($0) { |
| 12269 return this.lookup($assert_String($0)); | 11866 return this.lookup($0); |
| 12270 }; | 11867 }; |
| 12271 // ********** Code for MethodGenerator ************** | 11868 // ********** Code for MethodGenerator ************** |
| 12272 function MethodGenerator(method, enclosingMethod) { | 11869 function MethodGenerator(method, enclosingMethod) { |
| 12273 var $0; | |
| 12274 this.method = method; | 11870 this.method = method; |
| 12275 this.enclosingMethod = enclosingMethod; | 11871 this.enclosingMethod = enclosingMethod; |
| 12276 this.writer = new CodeWriter(); | 11872 this.writer = new CodeWriter(); |
| 12277 this.needsThis = false; | 11873 this.needsThis = false; |
| 12278 // Initializers done | 11874 // Initializers done |
| 12279 if (this.enclosingMethod != null) { | 11875 if (this.enclosingMethod != null) { |
| 12280 this._scope = new BlockScope(this, this.enclosingMethod._scope, false); | 11876 this._scope = new BlockScope(this, this.enclosingMethod._scope, false); |
| 12281 this.captures = new HashSetImplementation(); | 11877 this.captures = new HashSetImplementation(); |
| 12282 } | 11878 } |
| 12283 else { | 11879 else { |
| 12284 this._scope = new BlockScope(this, null, false); | 11880 this._scope = new BlockScope(this, null, false); |
| 12285 } | 11881 } |
| 12286 if (this.enclosingMethod != null && this.method.name != '') { | 11882 if (this.enclosingMethod != null && this.method.name != '') { |
| 12287 var m = (($0 = this.method) && $0.is$MethodMember()); | 11883 var m = this.method; |
| 12288 this._scope.create(m.name, m.get$functionType(), m.definition.span, false); | 11884 this._scope.create(m.name, m.get$functionType(), m.definition.span, false); |
| 12289 } | 11885 } |
| 12290 this._usedTemps = new HashSetImplementation(); | 11886 this._usedTemps = new HashSetImplementation(); |
| 12291 this._freeTemps = []; | 11887 this._freeTemps = []; |
| 12292 } | 11888 } |
| 12293 MethodGenerator.prototype.is$MethodGenerator = function(){return this;}; | |
| 12294 MethodGenerator.prototype.is$TreeVisitor = function(){return this;}; | |
| 12295 MethodGenerator.prototype.get$library = function() { | 11889 MethodGenerator.prototype.get$library = function() { |
| 12296 return this.method.get$library(); | 11890 return this.method.get$library(); |
| 12297 } | 11891 } |
| 12298 MethodGenerator.prototype.findMembers = function(name) { | 11892 MethodGenerator.prototype.findMembers = function(name) { |
| 12299 return this.get$library()._findMembers(name); | 11893 return this.get$library()._findMembers(name); |
| 12300 } | 11894 } |
| 12301 MethodGenerator.prototype.get$isClosure = function() { | 11895 MethodGenerator.prototype.get$isClosure = function() { |
| 12302 return (this.enclosingMethod != null); | 11896 return (this.enclosingMethod != null); |
| 12303 } | 11897 } |
| 12304 MethodGenerator.prototype.get$isStatic = function() { | 11898 MethodGenerator.prototype.get$isStatic = function() { |
| 12305 return this.method.get$isStatic(); | 11899 return this.method.get$isStatic(); |
| 12306 } | 11900 } |
| 12307 MethodGenerator.prototype.getTemp = function(value) { | 11901 MethodGenerator.prototype.getTemp = function(value) { |
| 12308 return $notnull_bool(value.needsTemp) ? this.forceTemp(value) : value; | 11902 return value.needsTemp ? this.forceTemp(value) : value; |
| 12309 } | 11903 } |
| 12310 MethodGenerator.prototype.forceTemp = function(value) { | 11904 MethodGenerator.prototype.forceTemp = function(value) { |
| 12311 var name; | 11905 var name; |
| 12312 if (this._freeTemps.length > 0) { | 11906 if (this._freeTemps.length > 0) { |
| 12313 name = $assert_String(this._freeTemps.removeLast()); | 11907 name = this._freeTemps.removeLast(); |
| 12314 } | 11908 } |
| 12315 else { | 11909 else { |
| 12316 name = '\$' + this._usedTemps.get$length(); | 11910 name = '\$' + this._usedTemps.get$length(); |
| 12317 } | 11911 } |
| 12318 this._usedTemps.add(name); | 11912 this._usedTemps.add(name); |
| 12319 return new Value(value.type, name, value.span, false); | 11913 return new Value(value.type, name, value.span, false); |
| 12320 } | 11914 } |
| 12321 MethodGenerator.prototype.assignTemp = function(tmp, v) { | 11915 MethodGenerator.prototype.assignTemp = function(tmp, v) { |
| 12322 if ($eq(tmp, v)) { | 11916 if ($eq(tmp, v)) { |
| 12323 return v; | 11917 return v; |
| 12324 } | 11918 } |
| 12325 else { | 11919 else { |
| 12326 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), v.span, tr
ue); | 11920 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), v.span, tr
ue); |
| 12327 } | 11921 } |
| 12328 } | 11922 } |
| 12329 MethodGenerator.prototype.freeTemp = function(value) { | 11923 MethodGenerator.prototype.freeTemp = function(value) { |
| 12330 if (this._usedTemps.remove(value.code)) { | 11924 if (this._usedTemps.remove(value.code)) { |
| 12331 this._freeTemps.add(value.code); | 11925 this._freeTemps.add(value.code); |
| 12332 } | 11926 } |
| 12333 else { | 11927 else { |
| 12334 world.internalError(('tried to free unused value or non-temp "' + value.code
+ '"')); | 11928 world.internalError(('tried to free unused value or non-temp "' + value.code
+ '"')); |
| 12335 } | 11929 } |
| 12336 } | 11930 } |
| 12337 MethodGenerator.prototype.run = function() { | 11931 MethodGenerator.prototype.run = function() { |
| 12338 if ($notnull_bool(this.method.isGenerated)) return; | 11932 if (this.method.isGenerated) return; |
| 12339 this.method.isGenerated = true; | 11933 this.method.isGenerated = true; |
| 12340 this.method.generator = this; | 11934 this.method.generator = this; |
| 12341 if ((this.method.get$definition().body instanceof NativeStatement)) { | 11935 if ((this.method.get$definition().body instanceof NativeStatement)) { |
| 12342 if ($notnull_bool(this.method.get$definition().body.body == null)) { | 11936 if (this.method.get$definition().body.body == null) { |
| 12343 this.method.generator = null; | 11937 this.method.generator = null; |
| 12344 } | 11938 } |
| 12345 else { | 11939 else { |
| 12346 this._paramCode = map(this.method.get$parameters(), (function (p) { | 11940 this._paramCode = map(this.method.get$parameters(), (function (p) { |
| 12347 return p.get$name(); | 11941 return p.get$name(); |
| 12348 }) | 11942 }) |
| 12349 ); | 11943 ); |
| 12350 this.writer.write($assert_String(this.method.get$definition().body.body)); | 11944 this.writer.write(this.method.get$definition().body.body); |
| 12351 } | 11945 } |
| 12352 } | 11946 } |
| 12353 else { | 11947 else { |
| 12354 this.writeBody(); | 11948 this.writeBody(); |
| 12355 } | 11949 } |
| 12356 } | 11950 } |
| 12357 MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { | 11951 MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { |
| 12358 var $0; | |
| 12359 var paramCode = this._paramCode; | 11952 var paramCode = this._paramCode; |
| 12360 var names = null; | 11953 var names = null; |
| 12361 if (this.captures != null && this.captures.get$length() > 0) { | 11954 if (this.captures != null && this.captures.get$length() > 0) { |
| 12362 names = ListFactory.ListFactory$from$factory(this.captures); | 11955 names = ListFactory.ListFactory$from$factory(this.captures); |
| 12363 names.sort$1((function (x, y) { | 11956 names.sort$1((function (x, y) { |
| 12364 return x.compareTo$1(y); | 11957 return x.compareTo$1(y); |
| 12365 }) | 11958 }) |
| 12366 ); | 11959 ); |
| 12367 paramCode = ListFactory.ListFactory$from$factory((names && names.is$Iterable
())); | 11960 paramCode = ListFactory.ListFactory$from$factory(names); |
| 12368 paramCode.addAll$1(this._paramCode); | 11961 paramCode.addAll$1(this._paramCode); |
| 12369 } | 11962 } |
| 12370 var _params = ('(' + Strings.join(this._paramCode, ", ") + ')'); | 11963 var _params = ('(' + Strings.join(this._paramCode, ", ") + ')'); |
| 12371 var params = ('(' + Strings.join((paramCode && paramCode.is$List$String()), ",
") + ')'); | 11964 var params = ('(' + Strings.join(paramCode, ", ") + ')'); |
| 12372 if ($notnull_bool(this.method.declaringType.get$isTop()) && !$notnull_bool(thi
s.get$isClosure())) { | 11965 if (this.method.declaringType.get$isTop() && !this.get$isClosure()) { |
| 12373 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params +
' {')); | 11966 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params +
' {')); |
| 12374 } | 11967 } |
| 12375 else if ($notnull_bool(this.get$isClosure())) { | 11968 else if (this.get$isClosure()) { |
| 12376 if (this.method.name == '') { | 11969 if (this.method.name == '') { |
| 12377 defWriter.enterBlock(('(function ' + params + ' {')); | 11970 defWriter.enterBlock(('(function ' + params + ' {')); |
| 12378 } | 11971 } |
| 12379 else if ($notnull_bool($ne(names, null))) { | 11972 else if ($ne(names, null)) { |
| 12380 if (lambda == null) { | 11973 if (lambda == null) { |
| 12381 defWriter.enterBlock(('var ' + this.method.get$jsname() + ' = (function'
+ params + ' {')); | 11974 defWriter.enterBlock(('var ' + this.method.get$jsname() + ' = (function'
+ params + ' {')); |
| 12382 } | 11975 } |
| 12383 else { | 11976 else { |
| 12384 defWriter.enterBlock(('(function ' + this.method.get$jsname() + '' + par
ams + ' {')); | 11977 defWriter.enterBlock(('(function ' + this.method.get$jsname() + '' + par
ams + ' {')); |
| 12385 } | 11978 } |
| 12386 } | 11979 } |
| 12387 else { | 11980 else { |
| 12388 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params
+ ' {')); | 11981 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params
+ ' {')); |
| 12389 } | 11982 } |
| 12390 } | 11983 } |
| 12391 else if ($notnull_bool(this.method.get$isConstructor())) { | 11984 else if (this.method.get$isConstructor()) { |
| 12392 if (this.method.get$constructorName() == '') { | 11985 if (this.method.get$constructorName() == '') { |
| 12393 defWriter.enterBlock(('function ' + this.method.declaringType.get$jsname()
+ '' + params + ' {')); | 11986 defWriter.enterBlock(('function ' + this.method.declaringType.get$jsname()
+ '' + params + ' {')); |
| 12394 } | 11987 } |
| 12395 else { | 11988 else { |
| 12396 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' +
this.method.get$constructorName() + '\$ctor = function' + params + ' {')); | 11989 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' +
this.method.get$constructorName() + '\$ctor = function' + params + ' {')); |
| 12397 } | 11990 } |
| 12398 } | 11991 } |
| 12399 else if ($notnull_bool(this.method.get$isFactory())) { | 11992 else if (this.method.get$isFactory()) { |
| 12400 defWriter.enterBlock(('' + this.method.get$generatedFactoryName() + ' = func
tion' + _params + ' {')); | 11993 defWriter.enterBlock(('' + this.method.get$generatedFactoryName() + ' = func
tion' + _params + ' {')); |
| 12401 } | 11994 } |
| 12402 else if ($notnull_bool(this.method.get$isStatic())) { | 11995 else if (this.method.get$isStatic()) { |
| 12403 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th
is.method.get$jsname() + ' = function' + _params + ' {')); | 11996 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th
is.method.get$jsname() + ' = function' + _params + ' {')); |
| 12404 } | 11997 } |
| 12405 else { | 11998 else { |
| 12406 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot
ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {')); | 11999 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot
ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {')); |
| 12407 } | 12000 } |
| 12408 if ($notnull_bool(this.needsThis)) { | 12001 if (this.needsThis) { |
| 12409 defWriter.writeln('var \$this = this; // closure support'); | 12002 defWriter.writeln('var \$this = this; // closure support'); |
| 12410 } | 12003 } |
| 12411 if (this._usedTemps.get$length() > 0 || this._freeTemps.length > 0) { | 12004 if (this._usedTemps.get$length() > 0 || this._freeTemps.length > 0) { |
| 12412 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da
rt", 695, 14); | |
| 12413 this._freeTemps.addAll(this._usedTemps); | 12005 this._freeTemps.addAll(this._usedTemps); |
| 12414 this._freeTemps.sort((function (x, y) { | 12006 this._freeTemps.sort((function (x, y) { |
| 12415 return x.compareTo$1(y); | 12007 return x.compareTo$1(y); |
| 12416 }) | 12008 }) |
| 12417 ); | 12009 ); |
| 12418 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); | 12010 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); |
| 12419 } | 12011 } |
| 12420 defWriter.writeln(this.writer.get$text()); | 12012 defWriter.writeln(this.writer.get$text()); |
| 12421 if ($notnull_bool($ne(names, null))) { | 12013 if ($ne(names, null)) { |
| 12422 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List
$String()), ", ") + ')')); | 12014 defWriter.exitBlock(('}).bind(null, ' + Strings.join(names, ", ") + ')')); |
| 12423 } | 12015 } |
| 12424 else if ($notnull_bool(this.get$isClosure()) && this.method.name == '') { | 12016 else if (this.get$isClosure() && this.method.name == '') { |
| 12425 defWriter.exitBlock('})'); | 12017 defWriter.exitBlock('})'); |
| 12426 } | 12018 } |
| 12427 else { | 12019 else { |
| 12428 defWriter.exitBlock('}'); | 12020 defWriter.exitBlock('}'); |
| 12429 } | 12021 } |
| 12430 if ($notnull_bool(this.method.get$isConstructor()) && this.method.get$construc
torName() != '') { | 12022 if (this.method.get$isConstructor() && this.method.get$constructorName() != ''
) { |
| 12431 defWriter.writeln(('' + this.method.declaringType.get$jsname() + '.' + this.
method.get$constructorName() + '\$ctor.prototype = ') + ('' + this.method.declar
ingType.get$jsname() + '.prototype;')); | 12023 defWriter.writeln(('' + this.method.declaringType.get$jsname() + '.' + this.
method.get$constructorName() + '\$ctor.prototype = ') + ('' + this.method.declar
ingType.get$jsname() + '.prototype;')); |
| 12432 } | 12024 } |
| 12433 this._provideOptionalParamInfo(defWriter); | 12025 this._provideOptionalParamInfo(defWriter); |
| 12434 if ((this.method instanceof MethodMember)) { | 12026 if ((this.method instanceof MethodMember)) { |
| 12435 var m = (($0 = this.method) && $0.is$MethodMember()); | 12027 var m = this.method; |
| 12436 if ($notnull_bool(m._providePropertySyntax)) { | 12028 if (m._providePropertySyntax) { |
| 12437 defWriter.enterBlock(('' + m.declaringType.get$jsname() + '.prototype') +
('.get\$' + m.get$jsname() + ' = function() {')); | 12029 defWriter.enterBlock(('' + m.declaringType.get$jsname() + '.prototype') +
('.get\$' + m.get$jsname() + ' = function() {')); |
| 12438 defWriter.writeln(('return ' + m.declaringType.get$jsname() + '.prototype.
') + ('' + m.get$jsname() + '.bind(this);')); | 12030 defWriter.writeln(('return ' + m.declaringType.get$jsname() + '.prototype.
') + ('' + m.get$jsname() + '.bind(this);')); |
| 12439 defWriter.exitBlock('}'); | 12031 defWriter.exitBlock('}'); |
| 12440 if ($notnull_bool(m._provideFieldSyntax)) { | 12032 if (m._provideFieldSyntax) { |
| 12441 world.internalError('bound m accessed with field syntax'); | 12033 world.internalError('bound m accessed with field syntax'); |
| 12442 } | 12034 } |
| 12443 } | 12035 } |
| 12444 } | 12036 } |
| 12445 } | 12037 } |
| 12446 MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) { | 12038 MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) { |
| 12447 var $0; | |
| 12448 if ((this.method instanceof MethodMember)) { | 12039 if ((this.method instanceof MethodMember)) { |
| 12449 var meth = (($0 = this.method) && $0.is$MethodMember()); | 12040 var meth = this.method; |
| 12450 if ($notnull_bool(meth._provideOptionalParamInfo)) { | 12041 if (meth._provideOptionalParamInfo) { |
| 12451 var optNames = []; | 12042 var optNames = []; |
| 12452 var optValues = []; | 12043 var optValues = []; |
| 12453 meth.genParameterValues(); | 12044 meth.genParameterValues(); |
| 12454 var $list = meth.parameters; | 12045 var $list = meth.parameters; |
| 12455 for (var $i = 0;$i < $list.length; $i++) { | 12046 for (var $i = 0;$i < $list.length; $i++) { |
| 12456 var param = $list.$index($i); | 12047 var param = $list.$index($i); |
| 12457 if ($notnull_bool(param.get$isOptional())) { | 12048 if (param.get$isOptional()) { |
| 12458 optNames.add$1(param.get$name()); | 12049 optNames.add$1(param.get$name()); |
| 12459 optValues.add$1(MethodGenerator._escapeString($assert_String(param.get
$value().code))); | 12050 optValues.add$1(MethodGenerator._escapeString(param.get$value().code))
; |
| 12460 } | 12051 } |
| 12461 } | 12052 } |
| 12462 if (optNames.length > 0) { | 12053 if (optNames.length > 0) { |
| 12463 var start = ''; | 12054 var start = ''; |
| 12464 if ($notnull_bool(meth.isStatic)) { | 12055 if (meth.isStatic) { |
| 12465 if (!$notnull_bool(meth.declaringType.get$isTop())) { | 12056 if (!meth.declaringType.get$isTop()) { |
| 12466 start = meth.declaringType.get$jsname() + '.'; | 12057 start = meth.declaringType.get$jsname() + '.'; |
| 12467 } | 12058 } |
| 12468 } | 12059 } |
| 12469 else { | 12060 else { |
| 12470 start = meth.declaringType.get$jsname() + '.prototype.'; | 12061 start = meth.declaringType.get$jsname() + '.prototype.'; |
| 12471 } | 12062 } |
| 12472 optNames.addAll$1(optValues); | 12063 optNames.addAll$1(optValues); |
| 12473 var optional = "['" + Strings.join((optNames && optNames.is$List$String(
)), "', '") + "']"; | 12064 var optional = "['" + Strings.join(optNames, "', '") + "']"; |
| 12474 defWriter.writeln(('' + start + '' + meth.get$jsname() + '.\$optional =
' + optional + '')); | 12065 defWriter.writeln(('' + start + '' + meth.get$jsname() + '.\$optional =
' + optional + '')); |
| 12475 } | 12066 } |
| 12476 } | 12067 } |
| 12477 } | 12068 } |
| 12478 } | 12069 } |
| 12479 MethodGenerator.prototype.writeBody = function() { | 12070 MethodGenerator.prototype.writeBody = function() { |
| 12480 var initializers = null; | 12071 var initializers = null; |
| 12481 var initializedFields = null; | 12072 var initializedFields = null; |
| 12482 if ($notnull_bool(this.method.get$isConstructor())) { | 12073 if (this.method.get$isConstructor()) { |
| 12483 initializers = []; | 12074 initializers = []; |
| 12484 initializedFields = new HashSetImplementation(); | 12075 initializedFields = new HashSetImplementation(); |
| 12485 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers()
); | 12076 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers()
); |
| 12486 for (var $i = 0;$i < $list.length; $i++) { | 12077 for (var $i = 0;$i < $list.length; $i++) { |
| 12487 var f = $list.$index($i); | 12078 var f = $list.$index($i); |
| 12488 if ((f instanceof FieldMember) && !$notnull_bool(f.get$isStatic())) { | 12079 if ((f instanceof FieldMember) && !f.get$isStatic()) { |
| 12489 var cv = f.computeValue$0(); | 12080 var cv = f.computeValue$0(); |
| 12490 if ($notnull_bool($ne(cv, null))) { | 12081 if ($ne(cv, null)) { |
| 12491 initializers.add$1(('this.' + f.get$jsname() + ' = ' + cv.code + '')); | 12082 initializers.add$1(('this.' + f.get$jsname() + ' = ' + cv.code + '')); |
| 12492 initializedFields.add$1(f.get$name()); | 12083 initializedFields.add$1(f.get$name()); |
| 12493 } | 12084 } |
| 12494 } | 12085 } |
| 12495 } | 12086 } |
| 12496 } | 12087 } |
| 12497 this._paramCode = []; | 12088 this._paramCode = []; |
| 12498 var $list = this.method.get$parameters(); | 12089 var $list = this.method.get$parameters(); |
| 12499 for (var $i = 0;$i < $list.length; $i++) { | 12090 for (var $i = 0;$i < $list.length; $i++) { |
| 12500 var p = $list.$index($i); | 12091 var p = $list.$index($i); |
| 12501 if ($notnull_bool($ne(initializers, null)) && $notnull_bool(p.isInitializer)
) { | 12092 if ($ne(initializers, null) && p.isInitializer) { |
| 12502 var field = this.method.declaringType.getMember($assert_String(p.get$name(
))); | 12093 var field = this.method.declaringType.getMember(p.get$name()); |
| 12503 if ($notnull_bool(field == null)) { | 12094 if (field == null) { |
| 12504 world.error('bad this parameter - no matching field', p.get$definition()
.get$span()); | 12095 world.error('bad this parameter - no matching field', p.get$definition()
.get$span()); |
| 12505 } | 12096 } |
| 12506 if (!$notnull_bool(field.get$isField())) { | 12097 if (!field.get$isField()) { |
| 12507 world.error(('"this.' + p.get$name() + '" does not refer to a field'), p
.get$definition().get$span()); | 12098 world.error(('"this.' + p.get$name() + '" does not refer to a field'), p
.get$definition().get$span()); |
| 12508 } | 12099 } |
| 12509 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def
inition().get$span(), false); | 12100 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def
inition().get$span(), false); |
| 12510 this._paramCode.add(paramValue.code); | 12101 this._paramCode.add(paramValue.code); |
| 12511 initializers.add$1(('this.' + field.get$jsname() + ' = ' + paramValue.code
+ ';')); | 12102 initializers.add$1(('this.' + field.get$jsname() + ' = ' + paramValue.code
+ ';')); |
| 12512 initializedFields.add$1(p.get$name()); | 12103 initializedFields.add$1(p.get$name()); |
| 12513 } | 12104 } |
| 12514 else { | 12105 else { |
| 12515 var paramValue = this._scope.declareParameter((p && p.is$Parameter())); | 12106 var paramValue = this._scope.declareParameter(p); |
| 12516 this._paramCode.add(paramValue.code); | 12107 this._paramCode.add(paramValue.code); |
| 12517 } | 12108 } |
| 12518 } | 12109 } |
| 12519 var body = this.method.get$definition().body; | 12110 var body = this.method.get$definition().body; |
| 12520 if ($notnull_bool(body == null) && !$notnull_bool(this.method.get$isConstructo
r())) { | 12111 if (body == null && !this.method.get$isConstructor()) { |
| 12521 world.error(('unexpected empty body for ' + this.method.name + ''), this.met
hod.get$definition().get$span()); | 12112 world.error(('unexpected empty body for ' + this.method.name + ''), this.met
hod.get$definition().get$span()); |
| 12522 } | 12113 } |
| 12523 if ($notnull_bool($ne(initializers, null))) { | 12114 if ($ne(initializers, null)) { |
| 12524 for (var $i = initializers.iterator$0(); $i.hasNext$0(); ) { | 12115 for (var $i = initializers.iterator$0(); $i.hasNext$0(); ) { |
| 12525 var i = $i.next$0(); | 12116 var i = $i.next$0(); |
| 12526 this.writer.writeln($assert_String(i)); | 12117 this.writer.writeln(i); |
| 12527 } | 12118 } |
| 12528 var declaredInitializers = this.method.get$definition().initializers; | 12119 var declaredInitializers = this.method.get$definition().initializers; |
| 12529 if (declaredInitializers != null) { | 12120 if (declaredInitializers != null) { |
| 12530 var initializerCall = null; | 12121 var initializerCall = null; |
| 12531 for (var $i = 0;$i < declaredInitializers.length; $i++) { | 12122 for (var $i = 0;$i < declaredInitializers.length; $i++) { |
| 12532 var init = declaredInitializers.$index($i); | 12123 var init = declaredInitializers.$index($i); |
| 12533 if ((init instanceof CallExpression)) { | 12124 if ((init instanceof CallExpression)) { |
| 12534 if ($notnull_bool($ne(initializerCall, null))) { | 12125 if ($ne(initializerCall, null)) { |
| 12535 world.error('only one initializer redirecting call is allowed', init
.get$span()); | 12126 world.error('only one initializer redirecting call is allowed', init
.get$span()); |
| 12536 } | 12127 } |
| 12537 initializerCall = init; | 12128 initializerCall = init; |
| 12538 } | 12129 } |
| 12539 else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign(
init.op.kind) == 0) { | 12130 else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign(
init.op.kind) == 0) { |
| 12540 var left = init.x; | 12131 var left = init.x; |
| 12541 if (!((left instanceof DotExpression) && (left.self instanceof ThisExp
ression) || (left instanceof VarExpression))) { | 12132 if (!((left instanceof DotExpression) && (left.self instanceof ThisExp
ression) || (left instanceof VarExpression))) { |
| 12542 world.error('invalid left side of initializer', left.get$span()); | 12133 world.error('invalid left side of initializer', left.get$span()); |
| 12543 continue; | 12134 continue; |
| 12544 } | 12135 } |
| 12545 var f = this.method.declaringType.getMember($assert_String(left.get$na
me().get$name())); | 12136 var f = this.method.declaringType.getMember(left.get$name().get$name()
); |
| 12546 if ($notnull_bool(f == null)) { | 12137 if (f == null) { |
| 12547 world.error('bad initializer - no matching field', left.get$span()); | 12138 world.error('bad initializer - no matching field', left.get$span()); |
| 12548 continue; | 12139 continue; |
| 12549 } | 12140 } |
| 12550 else if (!$notnull_bool(f.get$isField())) { | 12141 else if (!f.get$isField()) { |
| 12551 world.error(('"' + left.get$name().get$name() + '" does not refer to
a field'), left.get$span()); | 12142 world.error(('"' + left.get$name().get$name() + '" does not refer to
a field'), left.get$span()); |
| 12552 continue; | 12143 continue; |
| 12553 } | 12144 } |
| 12554 initializedFields.add$1(f.get$name()); | 12145 initializedFields.add$1(f.get$name()); |
| 12555 this.writer.writeln(('this.' + f.get$jsname() + ' = ' + this.visitValu
e(init.y).code + ';')); | 12146 this.writer.writeln(('this.' + f.get$jsname() + ' = ' + this.visitValu
e(init.y).code + ';')); |
| 12556 } | 12147 } |
| 12557 else { | 12148 else { |
| 12558 world.error('invalid initializer', init.get$span()); | 12149 world.error('invalid initializer', init.get$span()); |
| 12559 } | 12150 } |
| 12560 } | 12151 } |
| 12561 if ($notnull_bool($ne(initializerCall, null))) { | 12152 if ($ne(initializerCall, null)) { |
| 12562 var target = this._writeInitializerCall((initializerCall && initializerC
all.is$CallExpression())); | 12153 var target = this._writeInitializerCall(initializerCall); |
| 12563 if (!$notnull_bool(target.isSuper)) { | 12154 if (!target.isSuper) { |
| 12564 if (initializers.length > 0) { | 12155 if (initializers.length > 0) { |
| 12565 var $list = this.method.get$parameters(); | 12156 var $list = this.method.get$parameters(); |
| 12566 for (var $i = 0;$i < $list.length; $i++) { | 12157 for (var $i = 0;$i < $list.length; $i++) { |
| 12567 var p = $list.$index($i); | 12158 var p = $list.$index($i); |
| 12568 if ($notnull_bool(p.isInitializer)) { | 12159 if (p.isInitializer) { |
| 12569 world.error('no initialization allowed on redirecting constructo
rs', p.get$definition().get$span()); | 12160 world.error('no initialization allowed on redirecting constructo
rs', p.get$definition().get$span()); |
| 12570 break; | 12161 break; |
| 12571 } | 12162 } |
| 12572 } | 12163 } |
| 12573 } | 12164 } |
| 12574 if (declaredInitializers.length > 1) { | 12165 if (declaredInitializers.length > 1) { |
| 12575 var init = $notnull_bool($eq(declaredInitializers.$index(0), initial
izerCall)) ? declaredInitializers.$index(1) : declaredInitializers.$index(0); | 12166 var init = $eq(declaredInitializers.$index(0), initializerCall) ? de
claredInitializers.$index(1) : declaredInitializers.$index(0); |
| 12576 world.error('no initialization allowed on redirecting constructors',
init.get$span()); | 12167 world.error('no initialization allowed on redirecting constructors',
init.get$span()); |
| 12577 } | 12168 } |
| 12578 initializedFields = null; | 12169 initializedFields = null; |
| 12579 } | 12170 } |
| 12580 } | 12171 } |
| 12581 else { | 12172 else { |
| 12582 } | 12173 } |
| 12583 } | 12174 } |
| 12584 this.writer.comment('// Initializers done'); | 12175 this.writer.comment('// Initializers done'); |
| 12585 } | 12176 } |
| 12586 if ($notnull_bool($ne(initializedFields, null))) { | 12177 if ($ne(initializedFields, null)) { |
| 12587 var $list = this.method.declaringType.get$members().getKeys(); | 12178 var $list = this.method.declaringType.get$members().getKeys(); |
| 12588 for (var $i = this.method.declaringType.get$members().getKeys().iterator$0()
; $i.hasNext$0(); ) { | 12179 for (var $i = this.method.declaringType.get$members().getKeys().iterator$0()
; $i.hasNext$0(); ) { |
| 12589 var name = $i.next$0(); | 12180 var name = $i.next$0(); |
| 12590 var member = this.method.declaringType.get$members().$index(name); | 12181 var member = this.method.declaringType.get$members().$index(name); |
| 12591 if ((member instanceof FieldMember) && $notnull_bool(member.isFinal) && !$
notnull_bool(member.get$isStatic()) && !$notnull_bool(initializedFields.contains
$1(name))) { | 12182 if ((member instanceof FieldMember) && member.isFinal && !member.get$isSta
tic() && !initializedFields.contains$1(name)) { |
| 12592 world.error(('Field "' + name + '" is final and was not initialized'), t
his.method.get$definition().get$span()); | 12183 world.error(('Field "' + name + '" is final and was not initialized'), t
his.method.get$definition().get$span()); |
| 12593 } | 12184 } |
| 12594 } | 12185 } |
| 12595 } | 12186 } |
| 12596 this.visitStatementsInBlock((body && body.is$lang_Statement())); | 12187 this.visitStatementsInBlock(body); |
| 12597 } | 12188 } |
| 12598 MethodGenerator.prototype._writeInitializerCall = function(node) { | 12189 MethodGenerator.prototype._writeInitializerCall = function(node) { |
| 12599 var contructorName = ''; | 12190 var contructorName = ''; |
| 12600 var targetExp = node.target; | 12191 var targetExp = node.target; |
| 12601 if ((targetExp instanceof DotExpression)) { | 12192 if ((targetExp instanceof DotExpression)) { |
| 12602 var dot = (targetExp && targetExp.is$DotExpression()); | 12193 var dot = targetExp; |
| 12603 targetExp = dot.self; | 12194 targetExp = dot.self; |
| 12604 contructorName = dot.name.name; | 12195 contructorName = dot.name.name; |
| 12605 } | 12196 } |
| 12606 var target = null; | 12197 var target = null; |
| 12607 if ((targetExp instanceof SuperExpression)) { | 12198 if ((targetExp instanceof SuperExpression)) { |
| 12608 target = this._makeSuperValue((targetExp && targetExp.is$lang_Node())); | 12199 target = this._makeSuperValue(targetExp); |
| 12609 } | 12200 } |
| 12610 else if ((targetExp instanceof ThisExpression)) { | 12201 else if ((targetExp instanceof ThisExpression)) { |
| 12611 target = this._makeThisValue((targetExp && targetExp.is$lang_Node())); | 12202 target = this._makeThisValue(targetExp); |
| 12612 } | 12203 } |
| 12613 else { | 12204 else { |
| 12614 world.error('bad call in initializers', node.span); | 12205 world.error('bad call in initializers', node.span); |
| 12615 } | 12206 } |
| 12616 var m = target.type.getConstructor$1(contructorName); | 12207 var m = target.type.getConstructor$1(contructorName); |
| 12617 this.method.set$initDelegate(m); | 12208 this.method.set$initDelegate(m); |
| 12618 var other = m; | 12209 var other = m; |
| 12619 while ($notnull_bool($ne(other, null))) { | 12210 while ($ne(other, null)) { |
| 12620 if ($notnull_bool($eq(other, this.method))) { | 12211 if ($eq(other, this.method)) { |
| 12621 world.error('initialization cycle', node.span); | 12212 world.error('initialization cycle', node.span); |
| 12622 break; | 12213 break; |
| 12623 } | 12214 } |
| 12624 other = other.get$initDelegate(); | 12215 other = other.get$initDelegate(); |
| 12625 } | 12216 } |
| 12626 world.gen.genMethod((m && m.is$Member())); | 12217 world.gen.genMethod(m); |
| 12627 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments)); | 12218 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments)); |
| 12628 if ($notnull_bool($ne(target.type, world.objectType))) { | 12219 if ($ne(target.type, world.objectType)) { |
| 12629 this.writer.writeln(('' + value.code + ';')); | 12220 this.writer.writeln(('' + value.code + ';')); |
| 12630 } | 12221 } |
| 12631 return (target && target.is$Value()); | 12222 return target; |
| 12632 } | 12223 } |
| 12633 MethodGenerator.prototype._makeArgs = function(arguments) { | 12224 MethodGenerator.prototype._makeArgs = function(arguments) { |
| 12634 var $0; | |
| 12635 var args = []; | 12225 var args = []; |
| 12636 var seenLabel = false; | 12226 var seenLabel = false; |
| 12637 for (var $i = 0;$i < arguments.length; $i++) { | 12227 for (var $i = 0;$i < arguments.length; $i++) { |
| 12638 var arg = arguments.$index($i); | 12228 var arg = arguments.$index($i); |
| 12639 if (arg.label != null) { | 12229 if (arg.label != null) { |
| 12640 seenLabel = true; | 12230 seenLabel = true; |
| 12641 } | 12231 } |
| 12642 else if ($notnull_bool(seenLabel)) { | 12232 else if (seenLabel) { |
| 12643 world.error('bare argument can not follow named arguments', arg.get$span()
); | 12233 world.error('bare argument can not follow named arguments', arg.get$span()
); |
| 12644 } | 12234 } |
| 12645 args.add$1(this.visitValue((($0 = arg.get$value()) && $0.is$lang_Expression(
)))); | 12235 args.add$1(this.visitValue(arg.get$value())); |
| 12646 } | 12236 } |
| 12647 return new Arguments(arguments, args); | 12237 return new Arguments(arguments, args); |
| 12648 } | 12238 } |
| 12649 MethodGenerator._escapeString = function(text) { | 12239 MethodGenerator._escapeString = function(text) { |
| 12650 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', '
\\n').replaceAll('\r', '\\r'); | 12240 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', '
\\n').replaceAll('\r', '\\r'); |
| 12651 } | 12241 } |
| 12652 MethodGenerator.prototype.visitStatementsInBlock = function(body) { | 12242 MethodGenerator.prototype.visitStatementsInBlock = function(body) { |
| 12653 if ((body instanceof BlockStatement)) { | 12243 if ((body instanceof BlockStatement)) { |
| 12654 var block = (body && body.is$BlockStatement()); | 12244 var block = body; |
| 12655 var $list = block.body; | 12245 var $list = block.body; |
| 12656 for (var $i = 0;$i < $list.length; $i++) { | 12246 for (var $i = 0;$i < $list.length; $i++) { |
| 12657 var stmt = $list.$index($i); | 12247 var stmt = $list.$index($i); |
| 12658 stmt.visit$1(this); | 12248 stmt.visit$1(this); |
| 12659 } | 12249 } |
| 12660 } | 12250 } |
| 12661 else { | 12251 else { |
| 12662 if (body != null) body.visit(this); | 12252 if (body != null) body.visit(this); |
| 12663 } | 12253 } |
| 12664 return false; | 12254 return false; |
| 12665 } | 12255 } |
| 12666 MethodGenerator.prototype._pushBlock = function(reentrant) { | 12256 MethodGenerator.prototype._pushBlock = function(reentrant) { |
| 12667 this._scope = new BlockScope(this, this._scope, reentrant); | 12257 this._scope = new BlockScope(this, this._scope, reentrant); |
| 12668 } | 12258 } |
| 12669 MethodGenerator.prototype._popBlock = function() { | 12259 MethodGenerator.prototype._popBlock = function() { |
| 12670 this._scope = this._scope.parent; | 12260 this._scope = this._scope.parent; |
| 12671 } | 12261 } |
| 12672 MethodGenerator.prototype._makeLambdaMethod = function(name, func) { | 12262 MethodGenerator.prototype._makeLambdaMethod = function(name, func) { |
| 12673 var meth = new MethodMember(name, this.method.declaringType, func); | 12263 var meth = new MethodMember(name, this.method.declaringType, func); |
| 12674 meth.isLambda = true; | 12264 meth.isLambda = true; |
| 12675 meth.resolve$1(this.method.declaringType); | 12265 meth.resolve$1(this.method.declaringType); |
| 12676 world.gen.genMethod((meth && meth.is$Member()), this); | 12266 world.gen.genMethod(meth, this); |
| 12677 return (meth && meth.is$MethodMember()); | 12267 return meth; |
| 12678 } | 12268 } |
| 12679 MethodGenerator.prototype.visitBool = function(node) { | 12269 MethodGenerator.prototype.visitBool = function(node) { |
| 12680 return this.visitValue(node).convertTo$3(this, world.nonNullBool, node); | 12270 return this.visitValue(node).convertTo$3(this, world.nonNullBool, node); |
| 12681 } | 12271 } |
| 12682 MethodGenerator.prototype.visitValue = function(node) { | 12272 MethodGenerator.prototype.visitValue = function(node) { |
| 12683 if (node == null) return null; | 12273 if (node == null) return null; |
| 12684 var value = node.visit(this); | 12274 var value = node.visit(this); |
| 12685 value.checkFirstClass$1(node.span); | 12275 value.checkFirstClass$1(node.span); |
| 12686 return value; | 12276 return value; |
| 12687 } | 12277 } |
| 12688 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) { | 12278 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) { |
| 12689 return this.visitValue(node).convertTo$3(this, expectedType, node); | 12279 return this.visitValue(node).convertTo$3(this, expectedType, node); |
| 12690 } | 12280 } |
| 12691 MethodGenerator.prototype.visitVoid = function(node) { | 12281 MethodGenerator.prototype.visitVoid = function(node) { |
| 12692 if ((node instanceof PostfixExpression)) { | 12282 if ((node instanceof PostfixExpression)) { |
| 12693 var value = this.visitPostfixExpression((node && node.is$PostfixExpression()
), true); | 12283 var value = this.visitPostfixExpression(node, true); |
| 12694 value.checkFirstClass$1(node.span); | 12284 value.checkFirstClass$1(node.span); |
| 12695 return value; | 12285 return value; |
| 12696 } | 12286 } |
| 12697 return this.visitValue(node); | 12287 return this.visitValue(node); |
| 12698 } | 12288 } |
| 12699 MethodGenerator.prototype.visitDietStatement = function(node) { | 12289 MethodGenerator.prototype.visitDietStatement = function(node) { |
| 12700 var parser = new lang_Parser(node.span.file, false, false, false, node.span.st
art); | 12290 var parser = new lang_Parser(node.span.file, false, false, false, node.span.st
art); |
| 12701 this.visitStatementsInBlock(parser.block$0()); | 12291 this.visitStatementsInBlock(parser.block$0()); |
| 12702 return false; | 12292 return false; |
| 12703 } | 12293 } |
| 12704 MethodGenerator.prototype.visitVariableDefinition = function(node) { | 12294 MethodGenerator.prototype.visitVariableDefinition = function(node) { |
| 12705 var $0; | |
| 12706 var isFinal = false; | 12295 var isFinal = false; |
| 12707 if (node.modifiers != null && $notnull_bool($eq(node.modifiers.$index(0).kind,
97/*TokenKind.FINAL*/))) { | 12296 if (node.modifiers != null && $eq(node.modifiers.$index(0).kind, 97/*TokenKind
.FINAL*/)) { |
| 12708 isFinal = true; | 12297 isFinal = true; |
| 12709 } | 12298 } |
| 12710 this.writer.write('var '); | 12299 this.writer.write('var '); |
| 12711 var type = this.method.resolveType(node.type, false); | 12300 var type = this.method.resolveType(node.type, false); |
| 12712 for (var i = 0; | 12301 for (var i = 0; |
| 12713 i < node.names.length; i++) { | 12302 i < node.names.length; i++) { |
| 12714 var thisType = type; | 12303 var thisType = type; |
| 12715 if (i > 0) { | 12304 if (i > 0) { |
| 12716 this.writer.write(', '); | 12305 this.writer.write(', '); |
| 12717 } | 12306 } |
| 12718 var name = node.names.$index(i).get$name(); | 12307 var name = node.names.$index(i).get$name(); |
| 12719 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr
ession())); | 12308 var value = this.visitValue(node.values.$index(i)); |
| 12720 if ($notnull_bool(isFinal)) { | 12309 if (isFinal) { |
| 12721 if ($notnull_bool(value == null)) { | 12310 if (value == null) { |
| 12722 world.error('no value specified for final variable', node.span); | 12311 world.error('no value specified for final variable', node.span); |
| 12723 } | 12312 } |
| 12724 else { | 12313 else { |
| 12725 if ($notnull_bool(thisType.get$isVar())) thisType = value.type; | 12314 if (thisType.get$isVar()) thisType = value.type; |
| 12726 } | 12315 } |
| 12727 } | 12316 } |
| 12728 var val = this._scope.create($assert_String(name), (thisType && thisType.is$
lang_Type()), node.names.$index(i).get$span(), false); | 12317 var val = this._scope.create(name, thisType, node.names.$index(i).get$span()
, false); |
| 12729 if ($notnull_bool(value == null)) { | 12318 if (value == null) { |
| 12730 this.writer.write(('' + val.code + '')); | 12319 this.writer.write(('' + val.code + '')); |
| 12731 } | 12320 } |
| 12732 else { | 12321 else { |
| 12733 value = value.convertTo$3(this, type, node.values.$index(i)); | 12322 value = value.convertTo$3(this, type, node.values.$index(i)); |
| 12734 this.writer.write(('' + val.code + ' = ' + value.code + '')); | 12323 this.writer.write(('' + val.code + ' = ' + value.code + '')); |
| 12735 } | 12324 } |
| 12736 } | 12325 } |
| 12737 this.writer.writeln(';'); | 12326 this.writer.writeln(';'); |
| 12738 return false; | 12327 return false; |
| 12739 } | 12328 } |
| 12740 MethodGenerator.prototype.visitFunctionDefinition = function(node) { | 12329 MethodGenerator.prototype.visitFunctionDefinition = function(node) { |
| 12741 var $0; | |
| 12742 var name = world.toJsIdentifier(node.name.name); | 12330 var name = world.toJsIdentifier(node.name.name); |
| 12743 var meth = this._makeLambdaMethod($assert_String(name), node); | 12331 var meth = this._makeLambdaMethod(name, node); |
| 12744 var funcValue = this._scope.create($assert_String(name), (($0 = meth.get$funct
ionType()) && $0.is$lang_Type()), this.method.get$definition().get$span(), false
); | 12332 var funcValue = this._scope.create(name, meth.get$functionType(), this.method.
get$definition().get$span(), false); |
| 12745 meth.generator.writeDefinition$2(this.writer); | 12333 meth.generator.writeDefinition$2(this.writer); |
| 12746 return false; | 12334 return false; |
| 12747 } | 12335 } |
| 12748 MethodGenerator.prototype.visitReturnStatement = function(node) { | 12336 MethodGenerator.prototype.visitReturnStatement = function(node) { |
| 12749 if (node.value == null) { | 12337 if (node.value == null) { |
| 12750 this.writer.writeln('return;'); | 12338 this.writer.writeln('return;'); |
| 12751 } | 12339 } |
| 12752 else { | 12340 else { |
| 12753 if ($notnull_bool(this.method.get$isConstructor())) { | 12341 if (this.method.get$isConstructor()) { |
| 12754 world.error('return of value not allowed from constructor', node.span); | 12342 world.error('return of value not allowed from constructor', node.span); |
| 12755 } | 12343 } |
| 12756 var value = this.visitTypedValue(node.value, this.method.get$returnType()); | 12344 var value = this.visitTypedValue(node.value, this.method.get$returnType()); |
| 12757 this.writer.writeln(('return ' + value.code + ';')); | 12345 this.writer.writeln(('return ' + value.code + ';')); |
| 12758 } | 12346 } |
| 12759 return true; | 12347 return true; |
| 12760 } | 12348 } |
| 12761 MethodGenerator.prototype.visitThrowStatement = function(node) { | 12349 MethodGenerator.prototype.visitThrowStatement = function(node) { |
| 12762 if (node.value != null) { | 12350 if (node.value != null) { |
| 12763 var value = this.visitValue(node.value); | 12351 var value = this.visitValue(node.value); |
| 12764 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY()); | 12352 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY()); |
| 12765 this.writer.writeln(('\$throw(' + value.code + ');')); | 12353 this.writer.writeln(('\$throw(' + value.code + ');')); |
| 12766 world.gen.corejs.useThrow = true; | 12354 world.gen.corejs.useThrow = true; |
| 12767 } | 12355 } |
| 12768 else { | 12356 else { |
| 12769 var rethrow = this._scope.getRethrow(); | 12357 var rethrow = this._scope.getRethrow(); |
| 12770 if ($notnull_bool(rethrow == null)) { | 12358 if (rethrow == null) { |
| 12771 world.error('rethrow outside of catch', node.span); | 12359 world.error('rethrow outside of catch', node.span); |
| 12772 } | 12360 } |
| 12773 else { | 12361 else { |
| 12774 this.writer.writeln(('throw ' + rethrow.code + ';')); | 12362 this.writer.writeln(('throw ' + rethrow.code + ';')); |
| 12775 } | 12363 } |
| 12776 } | 12364 } |
| 12777 return true; | 12365 return true; |
| 12778 } | 12366 } |
| 12779 MethodGenerator.prototype.visitAssertStatement = function(node) { | 12367 MethodGenerator.prototype.visitAssertStatement = function(node) { |
| 12780 var $0; | |
| 12781 var test = this.visitValue(node.test); | 12368 var test = this.visitValue(node.test); |
| 12782 if ($notnull_bool(options.enableAsserts)) { | 12369 if (options.enableAsserts) { |
| 12783 var err = world.corelib.types.$index('AssertError'); | 12370 var err = world.corelib.types.$index('AssertError'); |
| 12784 world.gen.genMethod((($0 = err.getConstructor$1('')) && $0.is$Member())); | 12371 world.gen.genMethod(err.getConstructor$1('')); |
| 12785 world.gen.genMethod((($0 = err.get$members().$index('toString')) && $0.is$Me
mber())); | 12372 world.gen.genMethod(err.get$members().$index('toString')); |
| 12786 var span = node.test.span; | 12373 var span = node.test.span; |
| 12787 var line = span.file.getLine(span.start); | 12374 var line = span.file.getLine(span.start); |
| 12788 var column = span.file.getColumn($assert_num(line), span.start); | 12375 var column = span.file.getColumn(line, span.start); |
| 12789 this.writer.writeln(('\$assert(' + test.code + ', "' + MethodGenerator._esca
peString(span.get$text()) + '",') + (' "' + basename(span.file.filename) + '", '
+ (line + 1) + ', ' + (column + 1) + ');')); | 12376 this.writer.writeln(('\$assert(' + test.code + ', "' + MethodGenerator._esca
peString(span.get$text()) + '",') + (' "' + basename(span.file.filename) + '", '
+ (line + 1) + ', ' + (column + 1) + ');')); |
| 12790 world.gen.corejs.useAssert = true; | 12377 world.gen.corejs.useAssert = true; |
| 12791 } | 12378 } |
| 12792 return false; | 12379 return false; |
| 12793 } | 12380 } |
| 12794 MethodGenerator.prototype.visitBreakStatement = function(node) { | 12381 MethodGenerator.prototype.visitBreakStatement = function(node) { |
| 12795 if (node.label == null) { | 12382 if (node.label == null) { |
| 12796 this.writer.writeln('break;'); | 12383 this.writer.writeln('break;'); |
| 12797 } | 12384 } |
| 12798 else { | 12385 else { |
| 12799 this.writer.writeln(('break ' + node.label.name + ';')); | 12386 this.writer.writeln(('break ' + node.label.name + ';')); |
| 12800 } | 12387 } |
| 12801 return true; | 12388 return true; |
| 12802 } | 12389 } |
| 12803 MethodGenerator.prototype.visitContinueStatement = function(node) { | 12390 MethodGenerator.prototype.visitContinueStatement = function(node) { |
| 12804 if (node.label == null) { | 12391 if (node.label == null) { |
| 12805 this.writer.writeln('continue;'); | 12392 this.writer.writeln('continue;'); |
| 12806 } | 12393 } |
| 12807 else { | 12394 else { |
| 12808 this.writer.writeln(('continue ' + node.label.name + ';')); | 12395 this.writer.writeln(('continue ' + node.label.name + ';')); |
| 12809 } | 12396 } |
| 12810 return true; | 12397 return true; |
| 12811 } | 12398 } |
| 12812 MethodGenerator.prototype.visitIfStatement = function(node) { | 12399 MethodGenerator.prototype.visitIfStatement = function(node) { |
| 12813 var test = this.visitBool(node.test); | 12400 var test = this.visitBool(node.test); |
| 12814 this.writer.write(('if (' + test.code + ') ')); | 12401 this.writer.write(('if (' + test.code + ') ')); |
| 12815 var exit1 = node.trueBranch.visit(this); | 12402 var exit1 = node.trueBranch.visit(this); |
| 12816 if (node.falseBranch != null) { | 12403 if (node.falseBranch != null) { |
| 12817 this.writer.write('else '); | 12404 this.writer.write('else '); |
| 12818 if ($notnull_bool(node.falseBranch.visit(this)) && $notnull_bool(exit1)) { | 12405 if (node.falseBranch.visit(this) && exit1) { |
| 12819 return true; | 12406 return true; |
| 12820 } | 12407 } |
| 12821 } | 12408 } |
| 12822 return false; | 12409 return false; |
| 12823 } | 12410 } |
| 12824 MethodGenerator.prototype.visitWhileStatement = function(node) { | 12411 MethodGenerator.prototype.visitWhileStatement = function(node) { |
| 12825 var test = this.visitBool(node.test); | 12412 var test = this.visitBool(node.test); |
| 12826 this.writer.write(('while (' + test.code + ') ')); | 12413 this.writer.write(('while (' + test.code + ') ')); |
| 12827 this._pushBlock(true); | 12414 this._pushBlock(true); |
| 12828 node.body.visit(this); | 12415 node.body.visit(this); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 12847 var test = this.visitBool(node.test); | 12434 var test = this.visitBool(node.test); |
| 12848 this.writer.write((' ' + test.code + '; ')); | 12435 this.writer.write((' ' + test.code + '; ')); |
| 12849 } | 12436 } |
| 12850 else { | 12437 else { |
| 12851 this.writer.write('; '); | 12438 this.writer.write('; '); |
| 12852 } | 12439 } |
| 12853 var needsComma = false; | 12440 var needsComma = false; |
| 12854 var $list = node.step; | 12441 var $list = node.step; |
| 12855 for (var $i = 0;$i < $list.length; $i++) { | 12442 for (var $i = 0;$i < $list.length; $i++) { |
| 12856 var s = $list.$index($i); | 12443 var s = $list.$index($i); |
| 12857 if ($notnull_bool(needsComma)) this.writer.write(', '); | 12444 if (needsComma) this.writer.write(', '); |
| 12858 var sv = this.visitVoid((s && s.is$lang_Expression())); | 12445 var sv = this.visitVoid(s); |
| 12859 this.writer.write($assert_String(sv.code)); | 12446 this.writer.write(sv.code); |
| 12860 needsComma = true; | 12447 needsComma = true; |
| 12861 } | 12448 } |
| 12862 this.writer.write(') '); | 12449 this.writer.write(') '); |
| 12863 this._pushBlock(true); | 12450 this._pushBlock(true); |
| 12864 node.body.visit(this); | 12451 node.body.visit(this); |
| 12865 this._popBlock(); | 12452 this._popBlock(); |
| 12866 this._popBlock(); | 12453 this._popBlock(); |
| 12867 return false; | 12454 return false; |
| 12868 } | 12455 } |
| 12869 MethodGenerator.prototype.visitForInStatement = function(node) { | 12456 MethodGenerator.prototype.visitForInStatement = function(node) { |
| 12870 var $0; | |
| 12871 var itemType = this.method.resolveType(node.item.type, false); | 12457 var itemType = this.method.resolveType(node.item.type, false); |
| 12872 var itemName = node.item.name.name; | 12458 var itemName = node.item.name.name; |
| 12873 var list = node.list.visit(this); | 12459 var list = node.list.visit(this); |
| 12874 this._pushBlock(true); | 12460 this._pushBlock(true); |
| 12875 var item = this._scope.create($assert_String(itemName), (itemType && itemType.
is$lang_Type()), node.item.name.span, false); | 12461 var item = this._scope.create(itemName, itemType, node.item.name.span, false); |
| 12876 var listVar = (list && list.is$Value()); | 12462 var listVar = list; |
| 12877 if ($notnull_bool(list.needsTemp)) { | 12463 if (list.needsTemp) { |
| 12878 listVar = this._scope.create('\$list', (($0 = list.type) && $0.is$lang_Type(
)), null, false); | 12464 listVar = this._scope.create('\$list', list.type, null, false); |
| 12879 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';')); | 12465 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';')); |
| 12880 } | 12466 } |
| 12881 if ($notnull_bool(list.type.get$isList())) { | 12467 if (list.type.get$isList()) { |
| 12882 var tmpi = this._scope.create('\$i', world.numType, null, false); | 12468 var tmpi = this._scope.create('\$i', world.numType, null, false); |
| 12883 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code
+ ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {')); | 12469 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code
+ ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {')); |
| 12884 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [
tmpi]), false); | 12470 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [
tmpi]), false); |
| 12885 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';')); | 12471 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';')); |
| 12886 } | 12472 } |
| 12887 else { | 12473 else { |
| 12888 this._pushBlock(false); | 12474 this._pushBlock(false); |
| 12889 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT
Y()); | 12475 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT
Y()); |
| 12890 var tmpi = this._scope.create('\$i', (($0 = iterator.type) && $0.is$lang_Typ
e()), null, false); | 12476 var tmpi = this._scope.create('\$i', iterator.type, null, false); |
| 12891 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY(
)); | 12477 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY(
)); |
| 12892 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY()); | 12478 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY()); |
| 12893 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + ';
' + hasNext.code + '; ) {')); | 12479 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + ';
' + hasNext.code + '; ) {')); |
| 12894 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';')); | 12480 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';')); |
| 12895 } | 12481 } |
| 12896 this.visitStatementsInBlock(node.body); | 12482 this.visitStatementsInBlock(node.body); |
| 12897 this.writer.exitBlock('}'); | 12483 this.writer.exitBlock('}'); |
| 12898 this._popBlock(); | 12484 this._popBlock(); |
| 12899 return false; | 12485 return false; |
| 12900 } | 12486 } |
| 12901 MethodGenerator.prototype._genToDartException = function(ex, node) { | 12487 MethodGenerator.prototype._genToDartException = function(ex, node) { |
| 12902 var types = const$408/*const [ | 12488 var types = const$408/*const [ |
| 12903 'NullPointerException', 'ObjectNotClosureException', | 12489 'NullPointerException', 'ObjectNotClosureException', |
| 12904 'NoSuchMethodException', 'StackOverflowException']*/; | 12490 'NoSuchMethodException', 'StackOverflowException']*/; |
| 12905 var target = new Value(world.varType, 'this', node.span, true); | 12491 var target = new Value(world.varType, 'this', node.span, true); |
| 12906 for (var $i = types.iterator$0(); $i.hasNext$0(); ) { | 12492 for (var $i = types.iterator$0(); $i.hasNext$0(); ) { |
| 12907 var name = $i.next$0(); | 12493 var name = $i.next$0(); |
| 12908 world.corelib.types.$index(name).markUsed$0(); | 12494 world.corelib.types.$index(name).markUsed$0(); |
| 12909 world.corelib.types.$index(name).get$members().$index('toString').invoke$4(t
his, node, target, Arguments.get$EMPTY()); | 12495 world.corelib.types.$index(name).get$members().$index('toString').invoke$4(t
his, node, target, Arguments.get$EMPTY()); |
| 12910 } | 12496 } |
| 12911 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');')); | 12497 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');')); |
| 12912 world.gen.corejs.useToDartException = true; | 12498 world.gen.corejs.useToDartException = true; |
| 12913 } | 12499 } |
| 12914 MethodGenerator.prototype.visitTryStatement = function(node) { | 12500 MethodGenerator.prototype.visitTryStatement = function(node) { |
| 12915 var $0; | |
| 12916 this.writer.enterBlock('try {'); | 12501 this.writer.enterBlock('try {'); |
| 12917 this._pushBlock(false); | 12502 this._pushBlock(false); |
| 12918 this.visitStatementsInBlock(node.body); | 12503 this.visitStatementsInBlock(node.body); |
| 12919 this._popBlock(); | 12504 this._popBlock(); |
| 12920 if (node.catches.length == 1) { | 12505 if (node.catches.length == 1) { |
| 12921 var catch_ = node.catches.$index(0); | 12506 var catch_ = node.catches.$index(0); |
| 12922 this._pushBlock(false); | 12507 this._pushBlock(false); |
| 12923 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare
dIdentifier())); | 12508 var ex = this._scope.declare(catch_.get$exception()); |
| 12924 this._scope.rethrow = (ex && ex.is$Value()); | 12509 this._scope.rethrow = ex; |
| 12925 this.writer.nextBlock(('} catch (' + ex.code + ') {')); | 12510 this.writer.nextBlock(('} catch (' + ex.code + ') {')); |
| 12926 if (catch_.trace != null) { | 12511 if (catch_.trace != null) { |
| 12927 var trace = this._scope.declare(catch_.trace); | 12512 var trace = this._scope.declare(catch_.trace); |
| 12928 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); | 12513 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); |
| 12929 world.gen.corejs.useStackTraceOf = true; | 12514 world.gen.corejs.useStackTraceOf = true; |
| 12930 } | 12515 } |
| 12931 this._genToDartException($assert_String(ex.code), node); | 12516 this._genToDartException(ex.code, node); |
| 12932 if (!$notnull_bool(ex.type.get$isVar())) { | 12517 if (!ex.type.get$isVar()) { |
| 12933 var test = ex.instanceOf$3$isTrue$forceCheck(this, ex.type, catch_.get$exc
eption().get$span(), false, true); | 12518 var test = ex.instanceOf$3$isTrue$forceCheck(this, ex.type, catch_.get$exc
eption().get$span(), false, true); |
| 12934 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';')); | 12519 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';')); |
| 12935 } | 12520 } |
| 12936 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan
g_Statement())); | 12521 this.visitStatementsInBlock(node.catches.$index(0).body); |
| 12937 this._popBlock(); | 12522 this._popBlock(); |
| 12938 } | 12523 } |
| 12939 else if (node.catches.length > 0) { | 12524 else if (node.catches.length > 0) { |
| 12940 this._pushBlock(false); | 12525 this._pushBlock(false); |
| 12941 var ex = this._scope.create('\$ex', world.varType, null, false); | 12526 var ex = this._scope.create('\$ex', world.varType, null, false); |
| 12942 this._scope.rethrow = (ex && ex.is$Value()); | 12527 this._scope.rethrow = ex; |
| 12943 this.writer.nextBlock(('} catch (' + ex.code + ') {')); | 12528 this.writer.nextBlock(('} catch (' + ex.code + ') {')); |
| 12944 var trace = null; | 12529 var trace = null; |
| 12945 if (node.catches.some((function (c) { | 12530 if (node.catches.some((function (c) { |
| 12946 return c.trace != null; | 12531 return c.trace != null; |
| 12947 }) | 12532 }) |
| 12948 )) { | 12533 )) { |
| 12949 trace = this._scope.create('\$trace', world.varType, null, false); | 12534 trace = this._scope.create('\$trace', world.varType, null, false); |
| 12950 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); | 12535 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); |
| 12951 world.gen.corejs.useStackTraceOf = true; | 12536 world.gen.corejs.useStackTraceOf = true; |
| 12952 } | 12537 } |
| 12953 this._genToDartException($assert_String(ex.code), node); | 12538 this._genToDartException(ex.code, node); |
| 12954 var needsRethrow = true; | 12539 var needsRethrow = true; |
| 12955 for (var i = 0; | 12540 for (var i = 0; |
| 12956 i < node.catches.length; i++) { | 12541 i < node.catches.length; i++) { |
| 12957 var catch_ = node.catches.$index(i); | 12542 var catch_ = node.catches.$index(i); |
| 12958 this._pushBlock(false); | 12543 this._pushBlock(false); |
| 12959 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl
aredIdentifier())); | 12544 var tmp = this._scope.declare(catch_.get$exception()); |
| 12960 if (!$notnull_bool(tmp.type.get$isVar())) { | 12545 if (!tmp.type.get$isVar()) { |
| 12961 var test = ex.instanceOf$3$isTrue$forceCheck(this, tmp.type, catch_.get$
exception().get$span(), true, true); | 12546 var test = ex.instanceOf$3$isTrue$forceCheck(this, tmp.type, catch_.get$
exception().get$span(), true, true); |
| 12962 if (i == 0) { | 12547 if (i == 0) { |
| 12963 this.writer.enterBlock(('if (' + test.code + ') {')); | 12548 this.writer.enterBlock(('if (' + test.code + ') {')); |
| 12964 } | 12549 } |
| 12965 else { | 12550 else { |
| 12966 this.writer.nextBlock(('} else if (' + test.code + ') {')); | 12551 this.writer.nextBlock(('} else if (' + test.code + ') {')); |
| 12967 } | 12552 } |
| 12968 } | 12553 } |
| 12969 else if (i > 0) { | 12554 else if (i > 0) { |
| 12970 this.writer.nextBlock('} else {'); | 12555 this.writer.nextBlock('} else {'); |
| 12971 } | 12556 } |
| 12972 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';')); | 12557 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';')); |
| 12973 if (catch_.trace != null) { | 12558 if (catch_.trace != null) { |
| 12974 var tmptrace = this._scope.declare(catch_.trace); | 12559 var tmptrace = this._scope.declare(catch_.trace); |
| 12975 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';'))
; | 12560 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';'))
; |
| 12976 } | 12561 } |
| 12977 this.visitStatementsInBlock((($0 = catch_.body) && $0.is$lang_Statement())
); | 12562 this.visitStatementsInBlock(catch_.body); |
| 12978 this._popBlock(); | 12563 this._popBlock(); |
| 12979 if ($notnull_bool(tmp.type.get$isVar())) { | 12564 if (tmp.type.get$isVar()) { |
| 12980 if (i + 1 < node.catches.length) { | 12565 if (i + 1 < node.catches.length) { |
| 12981 world.warning('Unreachable catch clause', (($0 = node.catches.$index(i
+ 1)) && $0.is$SourceSpan())); | 12566 world.warning('Unreachable catch clause', node.catches.$index(i + 1)); |
| 12982 } | 12567 } |
| 12983 if (i > 0) { | 12568 if (i > 0) { |
| 12984 this.writer.exitBlock('}'); | 12569 this.writer.exitBlock('}'); |
| 12985 } | 12570 } |
| 12986 needsRethrow = false; | 12571 needsRethrow = false; |
| 12987 break; | 12572 break; |
| 12988 } | 12573 } |
| 12989 } | 12574 } |
| 12990 if ($notnull_bool(needsRethrow)) { | 12575 if (needsRethrow) { |
| 12991 this.writer.nextBlock('} else {'); | 12576 this.writer.nextBlock('} else {'); |
| 12992 this.writer.writeln(('throw ' + ex.code + ';')); | 12577 this.writer.writeln(('throw ' + ex.code + ';')); |
| 12993 this.writer.exitBlock('}'); | 12578 this.writer.exitBlock('}'); |
| 12994 } | 12579 } |
| 12995 this._popBlock(); | 12580 this._popBlock(); |
| 12996 } | 12581 } |
| 12997 if (node.finallyBlock != null) { | 12582 if (node.finallyBlock != null) { |
| 12998 this.writer.nextBlock('} finally {'); | 12583 this.writer.nextBlock('} finally {'); |
| 12999 this._pushBlock(false); | 12584 this._pushBlock(false); |
| 13000 this.visitStatementsInBlock(node.finallyBlock); | 12585 this.visitStatementsInBlock(node.finallyBlock); |
| 13001 this._popBlock(); | 12586 this._popBlock(); |
| 13002 } | 12587 } |
| 13003 this.writer.exitBlock('}'); | 12588 this.writer.exitBlock('}'); |
| 13004 return false; | 12589 return false; |
| 13005 } | 12590 } |
| 13006 MethodGenerator.prototype.visitSwitchStatement = function(node) { | 12591 MethodGenerator.prototype.visitSwitchStatement = function(node) { |
| 13007 var test = this.visitValue(node.test); | 12592 var test = this.visitValue(node.test); |
| 13008 this.writer.enterBlock(('switch (' + test.code + ') {')); | 12593 this.writer.enterBlock(('switch (' + test.code + ') {')); |
| 13009 var $list = node.cases; | 12594 var $list = node.cases; |
| 13010 for (var $i = 0;$i < $list.length; $i++) { | 12595 for (var $i = 0;$i < $list.length; $i++) { |
| 13011 var case_ = $list.$index($i); | 12596 var case_ = $list.$index($i); |
| 13012 if (case_.label != null) { | 12597 if (case_.label != null) { |
| 13013 world.error('unimplemented: labeled case statement', case_.get$span()); | 12598 world.error('unimplemented: labeled case statement', case_.get$span()); |
| 13014 } | 12599 } |
| 13015 this._pushBlock(false); | 12600 this._pushBlock(false); |
| 13016 for (var i = 0; | 12601 for (var i = 0; |
| 13017 i < case_.cases.length; i++) { | 12602 i < case_.cases.length; i++) { |
| 13018 var expr = case_.cases.$index(i); | 12603 var expr = case_.cases.$index(i); |
| 13019 if ($notnull_bool(expr == null)) { | 12604 if (expr == null) { |
| 13020 if (i < case_.cases.length - 1) { | 12605 if (i < case_.cases.length - 1) { |
| 13021 world.error('default clause must be the last case', case_.get$span()); | 12606 world.error('default clause must be the last case', case_.get$span()); |
| 13022 } | 12607 } |
| 13023 this.writer.writeln('default:'); | 12608 this.writer.writeln('default:'); |
| 13024 } | 12609 } |
| 13025 else { | 12610 else { |
| 13026 var value = this.visitValue((expr && expr.is$lang_Expression())); | 12611 var value = this.visitValue(expr); |
| 13027 this.writer.writeln(('case ' + value.code + ':')); | 12612 this.writer.writeln(('case ' + value.code + ':')); |
| 13028 } | 12613 } |
| 13029 } | 12614 } |
| 13030 this.writer.enterBlock(''); | 12615 this.writer.enterBlock(''); |
| 13031 var caseExits = this._visitAllStatements(case_.statements, false); | 12616 var caseExits = this._visitAllStatements(case_.statements, false); |
| 13032 if ($notnull_bool($ne(case_, node.cases.$index(node.cases.length - 1))) && !
$notnull_bool(caseExits)) { | 12617 if ($ne(case_, node.cases.$index(node.cases.length - 1)) && !caseExits) { |
| 13033 var span = case_.statements.$index(case_.statements.length - 1).get$span()
; | 12618 var span = case_.statements.$index(case_.statements.length - 1).get$span()
; |
| 13034 this.writer.writeln('\$throw(new FallThroughError());'); | 12619 this.writer.writeln('\$throw(new FallThroughError());'); |
| 13035 world.gen.corejs.useThrow = true; | 12620 world.gen.corejs.useThrow = true; |
| 13036 } | 12621 } |
| 13037 this.writer.exitBlock(''); | 12622 this.writer.exitBlock(''); |
| 13038 this._popBlock(); | 12623 this._popBlock(); |
| 13039 } | 12624 } |
| 13040 this.writer.exitBlock('}'); | 12625 this.writer.exitBlock('}'); |
| 13041 return false; | 12626 return false; |
| 13042 } | 12627 } |
| 13043 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { | 12628 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { |
| 13044 for (var i = 0; | 12629 for (var i = 0; |
| 13045 i < statementList.length; i++) { | 12630 i < statementList.length; i++) { |
| 13046 var stmt = statementList.$index(i); | 12631 var stmt = statementList.$index(i); |
| 13047 exits = stmt.visit$1(this); | 12632 exits = stmt.visit$1(this); |
| 13048 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1)))
&& $notnull_bool(exits)) { | 12633 if ($ne(stmt, statementList.$index(statementList.length - 1)) && exits) { |
| 13049 world.warning('unreachable code', statementList.$index(i + 1).get$span()); | 12634 world.warning('unreachable code', statementList.$index(i + 1).get$span()); |
| 13050 } | 12635 } |
| 13051 } | 12636 } |
| 13052 return $assert_bool(exits); | 12637 return exits; |
| 13053 } | 12638 } |
| 13054 MethodGenerator.prototype.visitBlockStatement = function(node) { | 12639 MethodGenerator.prototype.visitBlockStatement = function(node) { |
| 13055 this._pushBlock(false); | 12640 this._pushBlock(false); |
| 13056 this.writer.enterBlock('{'); | 12641 this.writer.enterBlock('{'); |
| 13057 var exits = this._visitAllStatements(node.body, false); | 12642 var exits = this._visitAllStatements(node.body, false); |
| 13058 this.writer.exitBlock('}'); | 12643 this.writer.exitBlock('}'); |
| 13059 this._popBlock(); | 12644 this._popBlock(); |
| 13060 return $assert_bool(exits); | 12645 return exits; |
| 13061 } | 12646 } |
| 13062 MethodGenerator.prototype.visitLabeledStatement = function(node) { | 12647 MethodGenerator.prototype.visitLabeledStatement = function(node) { |
| 13063 this.writer.writeln(('' + node.name.name + ':')); | 12648 this.writer.writeln(('' + node.name.name + ':')); |
| 13064 node.body.visit(this); | 12649 node.body.visit(this); |
| 13065 return false; | 12650 return false; |
| 13066 } | 12651 } |
| 13067 MethodGenerator.prototype.visitExpressionStatement = function(node) { | 12652 MethodGenerator.prototype.visitExpressionStatement = function(node) { |
| 13068 if ((node.body instanceof VarExpression) || (node.body instanceof ThisExpressi
on)) { | 12653 if ((node.body instanceof VarExpression) || (node.body instanceof ThisExpressi
on)) { |
| 13069 world.warning('variable used as statement', node.span); | 12654 world.warning('variable used as statement', node.span); |
| 13070 } | 12655 } |
| 13071 var value = this.visitVoid(node.body); | 12656 var value = this.visitVoid(node.body); |
| 13072 this.writer.writeln(('' + value.code + ';')); | 12657 this.writer.writeln(('' + value.code + ';')); |
| 13073 return false; | 12658 return false; |
| 13074 } | 12659 } |
| 13075 MethodGenerator.prototype.visitEmptyStatement = function(node) { | 12660 MethodGenerator.prototype.visitEmptyStatement = function(node) { |
| 13076 this.writer.writeln(';'); | 12661 this.writer.writeln(';'); |
| 13077 return false; | 12662 return false; |
| 13078 } | 12663 } |
| 13079 MethodGenerator.prototype._checkNonStatic = function(node) { | 12664 MethodGenerator.prototype._checkNonStatic = function(node) { |
| 13080 if ($notnull_bool(this.get$isStatic())) { | 12665 if (this.get$isStatic()) { |
| 13081 world.warning('not allowed in static method', node.span); | 12666 world.warning('not allowed in static method', node.span); |
| 13082 } | 12667 } |
| 13083 } | 12668 } |
| 13084 MethodGenerator.prototype._makeSuperValue = function(node) { | 12669 MethodGenerator.prototype._makeSuperValue = function(node) { |
| 13085 var parentType = this.method.declaringType.get$parent(); | 12670 var parentType = this.method.declaringType.get$parent(); |
| 13086 this._checkNonStatic(node); | 12671 this._checkNonStatic(node); |
| 13087 if ($notnull_bool(parentType == null)) { | 12672 if (parentType == null) { |
| 13088 world.error('no super class', node.span); | 12673 world.error('no super class', node.span); |
| 13089 } | 12674 } |
| 13090 var ret = new Value(parentType, 'this', node.span, false); | 12675 var ret = new Value(parentType, 'this', node.span, false); |
| 13091 ret.isSuper = true; | 12676 ret.isSuper = true; |
| 13092 return ret; | 12677 return ret; |
| 13093 } | 12678 } |
| 13094 MethodGenerator.prototype._getOutermostMethod = function() { | 12679 MethodGenerator.prototype._getOutermostMethod = function() { |
| 13095 var result = this; | 12680 var result = this; |
| 13096 while (result.enclosingMethod != null) { | 12681 while (result.enclosingMethod != null) { |
| 13097 result = result.enclosingMethod; | 12682 result = result.enclosingMethod; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 13117 else { | 12702 else { |
| 13118 this._checkNonStatic(node); | 12703 this._checkNonStatic(node); |
| 13119 return new Value(this.method.declaringType, 'this', node != null ? node.span
: null, false); | 12704 return new Value(this.method.declaringType, 'this', node != null ? node.span
: null, false); |
| 13120 } | 12705 } |
| 13121 } | 12706 } |
| 13122 MethodGenerator.prototype.visitLambdaExpression = function(node) { | 12707 MethodGenerator.prototype.visitLambdaExpression = function(node) { |
| 13123 var name = ''; | 12708 var name = ''; |
| 13124 if (node.func.name != null) { | 12709 if (node.func.name != null) { |
| 13125 name = world.toJsIdentifier(node.func.name.name); | 12710 name = world.toJsIdentifier(node.func.name.name); |
| 13126 } | 12711 } |
| 13127 var meth = this._makeLambdaMethod($assert_String(name), node.func); | 12712 var meth = this._makeLambdaMethod(name, node.func); |
| 13128 var w = new CodeWriter(); | 12713 var w = new CodeWriter(); |
| 13129 meth.generator.writeDefinition$2(w, node); | 12714 meth.generator.writeDefinition$2(w, node); |
| 13130 return new Value(meth.get$functionType(), w.get$text(), node.span, true); | 12715 return new Value(meth.get$functionType(), w.get$text(), node.span, true); |
| 13131 } | 12716 } |
| 13132 MethodGenerator.prototype.visitCallExpression = function(node) { | 12717 MethodGenerator.prototype.visitCallExpression = function(node) { |
| 13133 var $0; | |
| 13134 var target; | 12718 var target; |
| 13135 var position = node.target; | 12719 var position = node.target; |
| 13136 var name = '\$call'; | 12720 var name = '\$call'; |
| 13137 if ((node.target instanceof DotExpression)) { | 12721 if ((node.target instanceof DotExpression)) { |
| 13138 var dot = (($0 = node.target) && $0.is$DotExpression()); | 12722 var dot = node.target; |
| 13139 target = dot.self.visit(this); | 12723 target = dot.self.visit(this); |
| 13140 name = dot.name.name; | 12724 name = dot.name.name; |
| 13141 position = dot.name; | 12725 position = dot.name; |
| 13142 } | 12726 } |
| 13143 else if ((node.target instanceof VarExpression)) { | 12727 else if ((node.target instanceof VarExpression)) { |
| 13144 var varExpr = (($0 = node.target) && $0.is$VarExpression()); | 12728 var varExpr = node.target; |
| 13145 name = varExpr.name.name; | 12729 name = varExpr.name.name; |
| 13146 target = this._scope.lookup($assert_String(name)); | 12730 target = this._scope.lookup(name); |
| 13147 if ($notnull_bool($ne(target, null))) { | 12731 if ($ne(target, null)) { |
| 13148 return target.invoke$4(this, '\$call', node, this._makeArgs(node.arguments
)); | 12732 return target.invoke$4(this, '\$call', node, this._makeArgs(node.arguments
)); |
| 13149 } | 12733 } |
| 13150 target = this._makeThisOrType(varExpr.span); | 12734 target = this._makeThisOrType(varExpr.span); |
| 13151 return target.invoke$4(this, name, node, this._makeArgs(node.arguments)); | 12735 return target.invoke$4(this, name, node, this._makeArgs(node.arguments)); |
| 13152 } | 12736 } |
| 13153 else { | 12737 else { |
| 13154 target = node.target.visit(this); | 12738 target = node.target.visit(this); |
| 13155 } | 12739 } |
| 13156 return target.invoke$4(this, name, position, this._makeArgs(node.arguments)); | 12740 return target.invoke$4(this, name, position, this._makeArgs(node.arguments)); |
| 13157 } | 12741 } |
| 13158 MethodGenerator.prototype.visitIndexExpression = function(node) { | 12742 MethodGenerator.prototype.visitIndexExpression = function(node) { |
| 13159 var target = this.visitValue(node.target); | 12743 var target = this.visitValue(node.target); |
| 13160 var index = this.visitValue(node.index); | 12744 var index = this.visitValue(node.index); |
| 13161 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); | 12745 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); |
| 13162 } | 12746 } |
| 13163 MethodGenerator.prototype.visitBinaryExpression = function(node) { | 12747 MethodGenerator.prototype.visitBinaryExpression = function(node) { |
| 13164 var kind = node.op.kind; | 12748 var kind = node.op.kind; |
| 13165 if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) { | 12749 if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) { |
| 13166 var x = this.visitTypedValue(node.x, world.nonNullBool); | 12750 var x = this.visitTypedValue(node.x, world.nonNullBool); |
| 13167 var y = this.visitTypedValue(node.y, world.nonNullBool); | 12751 var y = this.visitTypedValue(node.y, world.nonNullBool); |
| 13168 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); | 12752 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); |
| 13169 if ($notnull_bool(x.get$isConst()) && $notnull_bool(y.get$isConst())) { | 12753 if (x.get$isConst() && y.get$isConst()) { |
| 13170 var value = (kind == 35/*TokenKind.AND*/) ? $notnull_bool(x.get$actualValu
e()) && $notnull_bool(y.get$actualValue()) : $notnull_bool(x.get$actualValue())
|| $notnull_bool(y.get$actualValue()); | 12754 var value = (kind == 35/*TokenKind.AND*/) ? x.get$actualValue() && y.get$a
ctualValue() : x.get$actualValue() || y.get$actualValue(); |
| 13171 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, value, (''
+ value + ''), node.span); | 12755 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, value, (''
+ value + ''), node.span); |
| 13172 } | 12756 } |
| 13173 return new Value(world.nonNullBool, code, node.span, true); | 12757 return new Value(world.nonNullBool, code, node.span, true); |
| 13174 } | 12758 } |
| 13175 else if (kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenKind.NE_STRICT*
/) { | 12759 else if (kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenKind.NE_STRICT*
/) { |
| 13176 var x = this.visitValue(node.x); | 12760 var x = this.visitValue(node.x); |
| 13177 var y = this.visitValue(node.y); | 12761 var y = this.visitValue(node.y); |
| 13178 if ($notnull_bool(x.get$isConst()) && $notnull_bool(y.get$isConst())) { | 12762 if (x.get$isConst() && y.get$isConst()) { |
| 13179 var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(x.get$actualValue(), y
.get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue()); | 12763 var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(x.get$actualValue(), y
.get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue()); |
| 13180 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, value, (""
+ value + ""), node.span); | 12764 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, value, (""
+ value + ""), node.span); |
| 13181 } | 12765 } |
| 13182 if ($notnull_bool($eq(x.code, 'null')) || $notnull_bool($eq(y.code, 'null'))
) { | 12766 if ($eq(x.code, 'null') || $eq(y.code, 'null')) { |
| 13183 var op = node.op.toString().substring(0, 2); | 12767 var op = node.op.toString().substring(0, 2); |
| 13184 return new Value(world.nonNullBool, ('' + x.code + ' ' + op + ' ' + y.code
+ ''), node.span, true); | 12768 return new Value(world.nonNullBool, ('' + x.code + ' ' + op + ' ' + y.code
+ ''), node.span, true); |
| 13185 } | 12769 } |
| 13186 else { | 12770 else { |
| 13187 return new Value(world.nonNullBool, ('' + x.code + ' ' + node.op + ' ' + y
.code + ''), node.span, true); | 12771 return new Value(world.nonNullBool, ('' + x.code + ' ' + node.op + ' ' + y
.code + ''), node.span, true); |
| 13188 } | 12772 } |
| 13189 } | 12773 } |
| 13190 var assignKind = TokenKind.kindFromAssign(node.op.kind); | 12774 var assignKind = TokenKind.kindFromAssign(node.op.kind); |
| 13191 if (assignKind == -1) { | 12775 if (assignKind == -1) { |
| 13192 var x = this.visitValue(node.x); | 12776 var x = this.visitValue(node.x); |
| 13193 var y = this.visitValue(node.y); | 12777 var y = this.visitValue(node.y); |
| 13194 var name = TokenKind.binaryMethodName(node.op.kind); | 12778 var name = TokenKind.binaryMethodName(node.op.kind); |
| 13195 if (node.op.kind == 49/*TokenKind.NE*/) { | 12779 if (node.op.kind == 49/*TokenKind.NE*/) { |
| 13196 name = '\$ne'; | 12780 name = '\$ne'; |
| 13197 } | 12781 } |
| 13198 if ($notnull_bool(name == null)) { | 12782 if (name == null) { |
| 13199 world.internalError(('unimplemented binary op ' + node.op + ''), node.span
); | 12783 world.internalError(('unimplemented binary op ' + node.op + ''), node.span
); |
| 13200 return; | 12784 return; |
| 13201 } | 12785 } |
| 13202 return x.invoke$4(this, name, node, new Arguments(null, [y])); | 12786 return x.invoke$4(this, name, node, new Arguments(null, [y])); |
| 13203 } | 12787 } |
| 13204 else { | 12788 else { |
| 13205 return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null)); | 12789 return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null)); |
| 13206 } | 12790 } |
| 13207 } | 12791 } |
| 13208 MethodGenerator.prototype._visitAssign = function(kind, xn, yn, position, captur
eOriginal) { | 12792 MethodGenerator.prototype._visitAssign = function(kind, xn, yn, position, captur
eOriginal) { |
| 13209 if (captureOriginal == null) { | 12793 if (captureOriginal == null) { |
| 13210 captureOriginal = (function (x) { | 12794 captureOriginal = (function (x) { |
| 13211 return x; | 12795 return x; |
| 13212 }) | 12796 }) |
| 13213 ; | 12797 ; |
| 13214 } | 12798 } |
| 13215 if ((xn instanceof VarExpression)) { | 12799 if ((xn instanceof VarExpression)) { |
| 13216 return this._visitVarAssign(kind, (xn && xn.is$VarExpression()), yn, positio
n, captureOriginal); | 12800 return this._visitVarAssign(kind, xn, yn, position, captureOriginal); |
| 13217 } | 12801 } |
| 13218 else if ((xn instanceof IndexExpression)) { | 12802 else if ((xn instanceof IndexExpression)) { |
| 13219 return this._visitIndexAssign(kind, (xn && xn.is$IndexExpression()), yn, pos
ition, captureOriginal); | 12803 return this._visitIndexAssign(kind, xn, yn, position, captureOriginal); |
| 13220 } | 12804 } |
| 13221 else if ((xn instanceof DotExpression)) { | 12805 else if ((xn instanceof DotExpression)) { |
| 13222 return this._visitDotAssign(kind, (xn && xn.is$DotExpression()), yn, positio
n, captureOriginal); | 12806 return this._visitDotAssign(kind, xn, yn, position, captureOriginal); |
| 13223 } | 12807 } |
| 13224 else { | 12808 else { |
| 13225 world.error('illegal lhs', position.span); | 12809 world.error('illegal lhs', position.span); |
| 13226 } | 12810 } |
| 13227 } | 12811 } |
| 13228 MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap
tureOriginal) { | 12812 MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap
tureOriginal) { |
| 13229 var name = xn.name.name; | 12813 var name = xn.name.name; |
| 13230 var x = this._scope.lookup(name); | 12814 var x = this._scope.lookup(name); |
| 13231 var y = this.visitValue(yn); | 12815 var y = this.visitValue(yn); |
| 13232 if ($notnull_bool(x == null)) { | 12816 if (x == null) { |
| 13233 var members = this.method.declaringType.resolveMember(name); | 12817 var members = this.method.declaringType.resolveMember(name); |
| 13234 if ($notnull_bool($ne(members, null))) { | 12818 if ($ne(members, null)) { |
| 13235 x = this._makeThisOrType(position.span); | 12819 x = this._makeThisOrType(position.span); |
| 13236 if (kind == 0) { | 12820 if (kind == 0) { |
| 13237 return x.set_$4(this, name, position, y); | 12821 return x.set_$4(this, name, position, y); |
| 13238 } | 12822 } |
| 13239 else if (!$notnull_bool(members.get$treatAsField()) || $notnull_bool(membe
rs.get$containsMethods())) { | 12823 else if (!members.get$treatAsField() || members.get$containsMethods()) { |
| 13240 var right = x.get_$3(this, name, position); | 12824 var right = x.get_$3(this, name, position); |
| 13241 right = captureOriginal((right && right.is$Value())); | 12825 right = captureOriginal(right); |
| 13242 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new
Arguments(null, [y])); | 12826 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new
Arguments(null, [y])); |
| 13243 return x.set_$4(this, name, position, y); | 12827 return x.set_$4(this, name, position, y); |
| 13244 } | 12828 } |
| 13245 else { | 12829 else { |
| 13246 x = x.get_$3(this, name, position); | 12830 x = x.get_$3(this, name, position); |
| 13247 } | 12831 } |
| 13248 } | 12832 } |
| 13249 else { | 12833 else { |
| 13250 var member = this.get$library().lookup(name, xn.name.span); | 12834 var member = this.get$library().lookup(name, xn.name.span); |
| 13251 if (member == null) { | 12835 if (member == null) { |
| 13252 world.warning(('can not resolve ' + name + ''), xn.span); | 12836 world.warning(('can not resolve ' + name + ''), xn.span); |
| 13253 return this._makeMissingValue(name); | 12837 return this._makeMissingValue(name); |
| 13254 } | 12838 } |
| 13255 members = new MemberSet(member, false); | 12839 members = new MemberSet(member, false); |
| 13256 if (!$notnull_bool(members.get$treatAsField()) || $notnull_bool(members.ge
t$containsMethods())) { | 12840 if (!members.get$treatAsField() || members.get$containsMethods()) { |
| 13257 if (kind != 0) { | 12841 if (kind != 0) { |
| 13258 var right = members._get$3(this, position, x); | 12842 var right = members._get$3(this, position, x); |
| 13259 right = captureOriginal((right && right.is$Value())); | 12843 right = captureOriginal(right); |
| 13260 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, n
ew Arguments(null, [y])); | 12844 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, n
ew Arguments(null, [y])); |
| 13261 } | 12845 } |
| 13262 return members._set$4(this, position, x, y); | 12846 return members._set$4(this, position, x, y); |
| 13263 } | 12847 } |
| 13264 else { | 12848 else { |
| 13265 x = members._get$3(this, position, x); | 12849 x = members._get$3(this, position, x); |
| 13266 } | 12850 } |
| 13267 } | 12851 } |
| 13268 } | 12852 } |
| 13269 y = y.convertTo$3(this, x.type, yn); | 12853 y = y.convertTo$3(this, x.type, yn); |
| 13270 if (kind == 0) { | 12854 if (kind == 0) { |
| 13271 x = captureOriginal((x && x.is$Value())); | 12855 x = captureOriginal(x); |
| 13272 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span,
true); | 12856 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span,
true); |
| 13273 } | 12857 } |
| 13274 else if ($notnull_bool(x.type.get$isNum()) && $notnull_bool(y.type.get$isNum()
) && (kind != 46/*TokenKind.TRUNCDIV*/)) { | 12858 else if (x.type.get$isNum() && y.type.get$isNum() && (kind != 46/*TokenKind.TR
UNCDIV*/)) { |
| 13275 x = captureOriginal((x && x.is$Value())); | 12859 x = captureOriginal(x); |
| 13276 var op = TokenKind.kindToString(kind); | 12860 var op = TokenKind.kindToString(kind); |
| 13277 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), posi
tion.span, true); | 12861 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), posi
tion.span, true); |
| 13278 } | 12862 } |
| 13279 else { | 12863 else { |
| 13280 var right = x; | 12864 var right = x; |
| 13281 right = captureOriginal((right && right.is$Value())); | 12865 right = captureOriginal(right); |
| 13282 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); | 12866 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); |
| 13283 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span,
true); | 12867 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span,
true); |
| 13284 } | 12868 } |
| 13285 } | 12869 } |
| 13286 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c
aptureOriginal) { | 12870 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c
aptureOriginal) { |
| 13287 var target = this.visitValue(xn.target); | 12871 var target = this.visitValue(xn.target); |
| 13288 var index = this.visitValue(xn.index); | 12872 var index = this.visitValue(xn.index); |
| 13289 var y = this.visitValue(yn); | 12873 var y = this.visitValue(yn); |
| 13290 var tmptarget = target; | 12874 var tmptarget = target; |
| 13291 var tmpindex = index; | 12875 var tmpindex = index; |
| 13292 if (kind != 0) { | 12876 if (kind != 0) { |
| 13293 tmptarget = this.getTemp((target && target.is$Value())); | 12877 tmptarget = this.getTemp(target); |
| 13294 tmpindex = this.getTemp((index && index.is$Value())); | 12878 tmpindex = this.getTemp(index); |
| 13295 index = this.assignTemp((tmpindex && tmpindex.is$Value()), (index && index.i
s$Value())); | 12879 index = this.assignTemp(tmpindex, index); |
| 13296 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null
, [tmpindex])); | 12880 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null
, [tmpindex])); |
| 13297 right = captureOriginal((right && right.is$Value())); | 12881 right = captureOriginal(right); |
| 13298 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); | 12882 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); |
| 13299 } | 12883 } |
| 13300 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ
et.is$Value())).invoke(this, '\$setindex', position, new Arguments(null, [index,
y]), false); | 12884 var ret = this.assignTemp(tmptarget, target).invoke(this, '\$setindex', positi
on, new Arguments(null, [index, y]), false); |
| 13301 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg
et.is$Value())); | 12885 if ($ne(tmptarget, target)) this.freeTemp(tmptarget); |
| 13302 if ($notnull_bool($ne(tmpindex, index))) this.freeTemp((tmpindex && tmpindex.i
s$Value())); | 12886 if ($ne(tmpindex, index)) this.freeTemp(tmpindex); |
| 13303 return ret; | 12887 return ret; |
| 13304 } | 12888 } |
| 13305 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap
tureOriginal) { | 12889 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap
tureOriginal) { |
| 13306 var target = xn.self.visit(this); | 12890 var target = xn.self.visit(this); |
| 13307 var y = this.visitValue(yn); | 12891 var y = this.visitValue(yn); |
| 13308 var tmptarget = target; | 12892 var tmptarget = target; |
| 13309 if (kind != 0) { | 12893 if (kind != 0) { |
| 13310 tmptarget = this.getTemp((target && target.is$Value())); | 12894 tmptarget = this.getTemp(target); |
| 13311 var right = tmptarget.get_$3(this, xn.name.name, xn.name); | 12895 var right = tmptarget.get_$3(this, xn.name.name, xn.name); |
| 13312 right = captureOriginal((right && right.is$Value())); | 12896 right = captureOriginal(right); |
| 13313 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); | 12897 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); |
| 13314 } | 12898 } |
| 13315 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); | 12899 var ret = this.assignTemp(tmptarget, target).set_(this, xn.name.name, xn.name,
y, false); |
| 13316 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg
et.is$Value())); | 12900 if ($ne(tmptarget, target)) this.freeTemp(tmptarget); |
| 13317 return ret; | 12901 return ret; |
| 13318 } | 12902 } |
| 13319 MethodGenerator.prototype.visitUnaryExpression = function(node) { | 12903 MethodGenerator.prototype.visitUnaryExpression = function(node) { |
| 13320 var $0; | |
| 13321 var value = this.visitValue(node.self); | 12904 var value = this.visitValue(node.self); |
| 13322 switch (node.op.kind) { | 12905 switch (node.op.kind) { |
| 13323 case 16/*TokenKind.INCR*/: | 12906 case 16/*TokenKind.INCR*/: |
| 13324 case 17/*TokenKind.DECR*/: | 12907 case 17/*TokenKind.DECR*/: |
| 13325 | 12908 |
| 13326 if ($notnull_bool(value.type.get$isNum())) { | 12909 if (value.type.get$isNum()) { |
| 13327 return new Value(value.type, ('' + node.op + '' + value.code + ''), node
.span, true); | 12910 return new Value(value.type, ('' + node.op + '' + value.code + ''), node
.span, true); |
| 13328 } | 12911 } |
| 13329 else { | 12912 else { |
| 13330 var kind = (16/*TokenKind.INCR*/ == node.op.kind ? 42/*TokenKind.ADD*/ :
43/*TokenKind.SUB*/); | 12913 var kind = (16/*TokenKind.INCR*/ == node.op.kind ? 42/*TokenKind.ADD*/ :
43/*TokenKind.SUB*/); |
| 13331 var operand = new LiteralExpression(1, new TypeReference(node.span, worl
d.numType), '1', node.span); | 12914 var operand = new LiteralExpression(1, new TypeReference(node.span, worl
d.numType), '1', node.span); |
| 13332 return this._visitAssign($assert_num(kind), node.self, (operand && opera
nd.is$lang_Expression()), node, to$call$1(null)); | 12915 return this._visitAssign(kind, node.self, operand, node, to$call$1(null)
); |
| 13333 } | 12916 } |
| 13334 | 12917 |
| 13335 case 19/*TokenKind.NOT*/: | 12918 case 19/*TokenKind.NOT*/: |
| 13336 | 12919 |
| 13337 if ($notnull_bool(value.type.get$isBool()) && $notnull_bool(value.get$isCo
nst())) { | 12920 if (value.type.get$isBool() && value.get$isConst()) { |
| 13338 var newVal = !$notnull_bool(value.get$actualValue()); | 12921 var newVal = !value.get$actualValue(); |
| 13339 return EvaluatedValue.EvaluatedValue$factory((($0 = value.type) && $0.is
$lang_Type()), newVal, ('' + newVal + ''), node.span); | 12922 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, ('' + n
ewVal + ''), node.span); |
| 13340 } | 12923 } |
| 13341 else { | 12924 else { |
| 13342 var newVal = value.convertTo$3(this, world.nonNullBool, node); | 12925 var newVal = value.convertTo$3(this, world.nonNullBool, node); |
| 13343 return new Value(newVal.type, ('!' + newVal.code + ''), node.span, true)
; | 12926 return new Value(newVal.type, ('!' + newVal.code + ''), node.span, true)
; |
| 13344 } | 12927 } |
| 13345 | 12928 |
| 13346 case 42/*TokenKind.ADD*/: | 12929 case 42/*TokenKind.ADD*/: |
| 13347 | 12930 |
| 13348 return value.convertTo$3(this, world.numType, node); | 12931 return value.convertTo$3(this, world.numType, node); |
| 13349 | 12932 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 13363 | 12946 |
| 13364 default: | 12947 default: |
| 13365 | 12948 |
| 13366 world.internalError(('unimplemented: ' + node.op + ''), node.span); | 12949 world.internalError(('unimplemented: ' + node.op + ''), node.span); |
| 13367 | 12950 |
| 13368 } | 12951 } |
| 13369 } | 12952 } |
| 13370 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { | 12953 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { |
| 13371 var $this = this; // closure support | 12954 var $this = this; // closure support |
| 13372 var value = this.visitValue(node.body); | 12955 var value = this.visitValue(node.body); |
| 13373 if ($notnull_bool(value.type.get$isNum())) { | 12956 if (value.type.get$isNum()) { |
| 13374 return new Value(value.type, ('' + value.code + '' + node.op + ''), node.spa
n, true); | 12957 return new Value(value.type, ('' + value.code + '' + node.op + ''), node.spa
n, true); |
| 13375 } | 12958 } |
| 13376 var kind = (16/*TokenKind.INCR*/ == node.op.kind) ? 42/*TokenKind.ADD*/ : 43/*
TokenKind.SUB*/; | 12959 var kind = (16/*TokenKind.INCR*/ == node.op.kind) ? 42/*TokenKind.ADD*/ : 43/*
TokenKind.SUB*/; |
| 13377 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT
ype), '1', node.span); | 12960 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT
ype), '1', node.span); |
| 13378 var tmpleft = null, left = null; | 12961 var tmpleft = null, left = null; |
| 13379 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand.
is$lang_Expression()), node, (function (l) { | 12962 var ret = this._visitAssign(kind, node.body, operand, node, (function (l) { |
| 13380 if ($notnull_bool(isVoid)) { | 12963 if (isVoid) { |
| 13381 return l; | 12964 return l; |
| 13382 } | 12965 } |
| 13383 else { | 12966 else { |
| 13384 left = l; | 12967 left = l; |
| 13385 tmpleft = $this.forceTemp((l && l.is$Value())); | 12968 tmpleft = $this.forceTemp(l); |
| 13386 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$
Value())); | 12969 return $this.assignTemp(tmpleft, left); |
| 13387 } | 12970 } |
| 13388 }) | 12971 }) |
| 13389 ); | 12972 ); |
| 13390 if ($notnull_bool($ne(tmpleft, null))) { | 12973 if ($ne(tmpleft, null)) { |
| 13391 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), node
.span, true); | 12974 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), node
.span, true); |
| 13392 } | 12975 } |
| 13393 if ($notnull_bool($ne(tmpleft, left))) { | 12976 if ($ne(tmpleft, left)) { |
| 13394 this.freeTemp((tmpleft && tmpleft.is$Value())); | 12977 this.freeTemp(tmpleft); |
| 13395 } | 12978 } |
| 13396 return ret; | 12979 return ret; |
| 13397 } | 12980 } |
| 13398 MethodGenerator.prototype.visitNewExpression = function(node) { | 12981 MethodGenerator.prototype.visitNewExpression = function(node) { |
| 13399 var $0; | |
| 13400 var typeRef = node.type; | 12982 var typeRef = node.type; |
| 13401 var constructorName = ''; | 12983 var constructorName = ''; |
| 13402 if (node.name != null) { | 12984 if (node.name != null) { |
| 13403 constructorName = node.name.name; | 12985 constructorName = node.name.name; |
| 13404 } | 12986 } |
| 13405 if ($notnull_bool($eq(constructorName, '')) && !(typeRef instanceof GenericTyp
eReference) && typeRef.names != null) { | 12987 if ($eq(constructorName, '') && !(typeRef instanceof GenericTypeReference) &&
typeRef.names != null) { |
| 13406 var names = ListFactory.ListFactory$from$factory(typeRef.names); | 12988 var names = ListFactory.ListFactory$from$factory(typeRef.names); |
| 13407 constructorName = names.removeLast$0().get$name(); | 12989 constructorName = names.removeLast$0().get$name(); |
| 13408 if (names.length == 0) names = null; | 12990 if (names.length == 0) names = null; |
| 13409 typeRef = new NameTypeReference(typeRef.isFinal, typeRef.get$name(), names,
typeRef.get$span()); | 12991 typeRef = new NameTypeReference(typeRef.isFinal, typeRef.get$name(), names,
typeRef.get$span()); |
| 13410 } | 12992 } |
| 13411 var type = this.method.resolveType((typeRef && typeRef.is$TypeReference()), tr
ue); | 12993 var type = this.method.resolveType(typeRef, true); |
| 13412 if ($notnull_bool(type.get$isTop())) { | 12994 if (type.get$isTop()) { |
| 13413 type = type.get$library().findTypeByName($assert_String(constructorName)); | 12995 type = type.get$library().findTypeByName(constructorName); |
| 13414 constructorName = ''; | 12996 constructorName = ''; |
| 13415 } | 12997 } |
| 13416 var m = type.getConstructor$1(constructorName); | 12998 var m = type.getConstructor$1(constructorName); |
| 13417 if ($notnull_bool(m == null)) { | 12999 if (m == null) { |
| 13418 var name = type.get$jsname(); | 13000 var name = type.get$jsname(); |
| 13419 if ($notnull_bool(type.get$isVar())) { | 13001 if (type.get$isVar()) { |
| 13420 name = typeRef.get$name().get$name(); | 13002 name = typeRef.get$name().get$name(); |
| 13421 } | 13003 } |
| 13422 world.error(('no matching constructor for ' + name + ''), node.span); | 13004 world.error(('no matching constructor for ' + name + ''), node.span); |
| 13423 return this._makeMissingValue($assert_String(name)); | 13005 return this._makeMissingValue(name); |
| 13424 } | 13006 } |
| 13425 if ($notnull_bool(node.isConst)) { | 13007 if (node.isConst) { |
| 13426 if (!$notnull_bool(m.get$isConst())) { | 13008 if (!m.get$isConst()) { |
| 13427 world.error('can\'t use const on a non-const constructor', node.span); | 13009 world.error('can\'t use const on a non-const constructor', node.span); |
| 13428 } | 13010 } |
| 13429 var $list = node.arguments; | 13011 var $list = node.arguments; |
| 13430 for (var $i = 0;$i < $list.length; $i++) { | 13012 for (var $i = 0;$i < $list.length; $i++) { |
| 13431 var arg = $list.$index($i); | 13013 var arg = $list.$index($i); |
| 13432 if (!$notnull_bool(this.visitValue((($0 = arg.get$value()) && $0.is$lang_E
xpression())).get$isConst())) { | 13014 if (!this.visitValue(arg.get$value()).get$isConst()) { |
| 13433 world.error('const constructor expects const arguments', arg.get$span())
; | 13015 world.error('const constructor expects const arguments', arg.get$span())
; |
| 13434 } | 13016 } |
| 13435 } | 13017 } |
| 13436 } | 13018 } |
| 13437 return m.invoke$4(this, node, null, this._makeArgs(node.arguments)); | 13019 return m.invoke$4(this, node, null, this._makeArgs(node.arguments)); |
| 13438 } | 13020 } |
| 13439 MethodGenerator.prototype.visitListExpression = function(node) { | 13021 MethodGenerator.prototype.visitListExpression = function(node) { |
| 13440 var argsCode = []; | 13022 var argsCode = []; |
| 13441 var argValues = []; | 13023 var argValues = []; |
| 13442 var $list = node.values; | 13024 var $list = node.values; |
| 13443 for (var $i = 0;$i < $list.length; $i++) { | 13025 for (var $i = 0;$i < $list.length; $i++) { |
| 13444 var item = $list.$index($i); | 13026 var item = $list.$index($i); |
| 13445 var arg = this.visitValue((item && item.is$lang_Expression())); | 13027 var arg = this.visitValue(item); |
| 13446 argValues.add$1(arg); | 13028 argValues.add$1(arg); |
| 13447 if ($notnull_bool(node.isConst)) { | 13029 if (node.isConst) { |
| 13448 if (!$notnull_bool(arg.get$isConst())) { | 13030 if (!arg.get$isConst()) { |
| 13449 world.error('const list can only contain const values', item.get$span())
; | 13031 world.error('const list can only contain const values', item.get$span())
; |
| 13450 argsCode.add$1(arg.code); | 13032 argsCode.add$1(arg.code); |
| 13451 } | 13033 } |
| 13452 else { | 13034 else { |
| 13453 argsCode.add$1(arg.get$canonicalCode()); | 13035 argsCode.add$1(arg.get$canonicalCode()); |
| 13454 } | 13036 } |
| 13455 } | 13037 } |
| 13456 else { | 13038 else { |
| 13457 argsCode.add$1(arg.code); | 13039 argsCode.add$1(arg.code); |
| 13458 } | 13040 } |
| 13459 } | 13041 } |
| 13460 world.get$coreimpl().types.$index('ListFactory').markUsed$0(); | 13042 world.get$coreimpl().types.$index('ListFactory').markUsed$0(); |
| 13461 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ")
+ ']'); | 13043 var code = ('[' + Strings.join(argsCode, ", ") + ']'); |
| 13462 var value = new Value(world.listType, code, node.span, true); | 13044 var value = new Value(world.listType, code, node.span, true); |
| 13463 if ($notnull_bool(node.isConst)) { | 13045 if (node.isConst) { |
| 13464 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); | 13046 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); |
| 13465 var immutableListCtor = immutableList.getConstructor$1('from'); | 13047 var immutableListCtor = immutableList.getConstructor$1('from'); |
| 13466 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null
, [value])); | 13048 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null
, [value])); |
| 13467 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory((immu
tableList && immutableList.is$lang_Type()), (argValues && argValues.is$List$Eval
uatedValue()), ('const ' + code + ''), $assert_String(result.code), node.span),
(argValues && argValues.is$List$Value())); | 13049 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory(immut
ableList, argValues, ('const ' + code + ''), result.code, node.span), argValues)
; |
| 13468 } | 13050 } |
| 13469 return value; | 13051 return value; |
| 13470 } | 13052 } |
| 13471 MethodGenerator.prototype.visitMapExpression = function(node) { | 13053 MethodGenerator.prototype.visitMapExpression = function(node) { |
| 13472 var $0; | |
| 13473 var mapImplType = world.gen.useMapFactory(); | 13054 var mapImplType = world.gen.useMapFactory(); |
| 13474 var argValues = []; | 13055 var argValues = []; |
| 13475 var argsCode = []; | 13056 var argsCode = []; |
| 13476 for (var i = 0; | 13057 for (var i = 0; |
| 13477 i < node.items.length; i += 2) { | 13058 i < node.items.length; i += 2) { |
| 13478 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex
pression()), world.stringType); | 13059 var key = this.visitTypedValue(node.items.$index(i), world.stringType); |
| 13479 var valueItem = node.items.$index(i + 1); | 13060 var valueItem = node.items.$index(i + 1); |
| 13480 var value = this.visitValue((valueItem && valueItem.is$lang_Expression())); | 13061 var value = this.visitValue(valueItem); |
| 13481 argValues.add$1(key); | 13062 argValues.add$1(key); |
| 13482 argValues.add$1(value); | 13063 argValues.add$1(value); |
| 13483 if ($notnull_bool(node.isConst)) { | 13064 if (node.isConst) { |
| 13484 if (!$notnull_bool(key.get$isConst()) || !$notnull_bool(value.get$isConst(
))) { | 13065 if (!key.get$isConst() || !value.get$isConst()) { |
| 13485 world.error('const map can only contain const values', valueItem.get$spa
n()); | 13066 world.error('const map can only contain const values', valueItem.get$spa
n()); |
| 13486 argsCode.add$1(key.code); | 13067 argsCode.add$1(key.code); |
| 13487 argsCode.add$1(value.code); | 13068 argsCode.add$1(value.code); |
| 13488 } | 13069 } |
| 13489 else { | 13070 else { |
| 13490 argsCode.add$1(key.get$canonicalCode()); | 13071 argsCode.add$1(key.get$canonicalCode()); |
| 13491 argsCode.add$1(value.get$canonicalCode()); | 13072 argsCode.add$1(value.get$canonicalCode()); |
| 13492 } | 13073 } |
| 13493 } | 13074 } |
| 13494 else { | 13075 else { |
| 13495 argsCode.add$1(key.code); | 13076 argsCode.add$1(key.code); |
| 13496 argsCode.add$1(value.code); | 13077 argsCode.add$1(value.code); |
| 13497 } | 13078 } |
| 13498 } | 13079 } |
| 13499 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ",
") + ']'); | 13080 var argList = ('[' + Strings.join(argsCode, ", ") + ']'); |
| 13500 var code = ('\$map(' + argList + ')'); | 13081 var code = ('\$map(' + argList + ')'); |
| 13501 if ($notnull_bool(node.isConst)) { | 13082 if (node.isConst) { |
| 13502 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap'); | 13083 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap'); |
| 13503 var immutableMapCtor = immutableMap.getConstructor$1(''); | 13084 var immutableMapCtor = immutableMap.getConstructor$1(''); |
| 13504 var argsValue = new Value(world.listType, argList, node.span, true); | 13085 var argsValue = new Value(world.listType, argList, node.span, true); |
| 13505 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null,
[argsValue])); | 13086 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null,
[argsValue])); |
| 13506 var value = ConstMapValue.ConstMapValue$factory((immutableMap && immutableMa
p.is$lang_Type()), (argValues && argValues.is$List$EvaluatedValue()), code, $ass
ert_String(result.code), node.span); | 13087 var value = ConstMapValue.ConstMapValue$factory(immutableMap, argValues, cod
e, result.code, node.span); |
| 13507 return world.gen.globalForConst(value, (argValues && argValues.is$List$Value
())); | 13088 return world.gen.globalForConst(value, argValues); |
| 13508 } | 13089 } |
| 13509 return new Value(mapImplType, code, node.span, true); | 13090 return new Value(mapImplType, code, node.span, true); |
| 13510 } | 13091 } |
| 13511 MethodGenerator.prototype.visitConditionalExpression = function(node) { | 13092 MethodGenerator.prototype.visitConditionalExpression = function(node) { |
| 13512 var $0; | |
| 13513 var test = this.visitBool(node.test); | 13093 var test = this.visitBool(node.test); |
| 13514 var trueBranch = this.visitValue(node.trueBranch); | 13094 var trueBranch = this.visitValue(node.trueBranch); |
| 13515 var falseBranch = this.visitValue(node.falseBranch); | 13095 var falseBranch = this.visitValue(node.falseBranch); |
| 13516 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod
e + ''); | 13096 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod
e + ''); |
| 13517 return new Value(lang_Type.union((($0 = trueBranch.type) && $0.is$lang_Type())
, (($0 = falseBranch.type) && $0.is$lang_Type())), code, node.span, true); | 13097 return new Value(lang_Type.union(trueBranch.type, falseBranch.type), code, nod
e.span, true); |
| 13518 } | 13098 } |
| 13519 MethodGenerator.prototype.visitIsExpression = function(node) { | 13099 MethodGenerator.prototype.visitIsExpression = function(node) { |
| 13520 var value = this.visitValue(node.x); | 13100 var value = this.visitValue(node.x); |
| 13521 var type = this.method.resolveType(node.type, false); | 13101 var type = this.method.resolveType(node.type, false); |
| 13522 return value.instanceOf$4(this, type, node.span, node.isTrue); | 13102 return value.instanceOf$4(this, type, node.span, node.isTrue); |
| 13523 } | 13103 } |
| 13524 MethodGenerator.prototype.visitParenExpression = function(node) { | 13104 MethodGenerator.prototype.visitParenExpression = function(node) { |
| 13525 var $0; | |
| 13526 var body = this.visitValue(node.body); | 13105 var body = this.visitValue(node.body); |
| 13527 if ($notnull_bool(body.get$isConst())) { | 13106 if (body.get$isConst()) { |
| 13528 return EvaluatedValue.EvaluatedValue$factory((($0 = body.type) && $0.is$lang
_Type()), body.get$actualValue(), ('(' + body.get$canonicalCode() + ')'), node.s
pan); | 13107 return EvaluatedValue.EvaluatedValue$factory(body.type, body.get$actualValue
(), ('(' + body.get$canonicalCode() + ')'), node.span); |
| 13529 } | 13108 } |
| 13530 return new Value(body.type, ('(' + body.code + ')'), node.span, true); | 13109 return new Value(body.type, ('(' + body.code + ')'), node.span, true); |
| 13531 } | 13110 } |
| 13532 MethodGenerator.prototype.visitDotExpression = function(node) { | 13111 MethodGenerator.prototype.visitDotExpression = function(node) { |
| 13533 var target = node.self.visit(this); | 13112 var target = node.self.visit(this); |
| 13534 return target.get_$3(this, node.name.name, node.name); | 13113 return target.get_$3(this, node.name.name, node.name); |
| 13535 } | 13114 } |
| 13536 MethodGenerator.prototype.visitVarExpression = function(node) { | 13115 MethodGenerator.prototype.visitVarExpression = function(node) { |
| 13537 var name = node.name.name; | 13116 var name = node.name.name; |
| 13538 var ret = this._scope.lookup(name); | 13117 var ret = this._scope.lookup(name); |
| 13539 if ($notnull_bool($ne(ret, null))) return ret; | 13118 if ($ne(ret, null)) return ret; |
| 13540 return this._makeThisOrType(node.span).get_$3(this, name, node); | 13119 return this._makeThisOrType(node.span).get_$3(this, name, node); |
| 13541 } | 13120 } |
| 13542 MethodGenerator.prototype._makeMissingValue = function(name) { | 13121 MethodGenerator.prototype._makeMissingValue = function(name) { |
| 13543 return new Value(world.varType, ('' + name + '()/*NotFound*/'), null, true); | 13122 return new Value(world.varType, ('' + name + '()/*NotFound*/'), null, true); |
| 13544 } | 13123 } |
| 13545 MethodGenerator.prototype._makeThisOrType = function(span) { | 13124 MethodGenerator.prototype._makeThisOrType = function(span) { |
| 13546 var $0; | 13125 return new BareValue(this, this._getOutermostMethod(), span); |
| 13547 return new BareValue(this, (($0 = this._getOutermostMethod()) && $0.is$MethodG
enerator()), span); | |
| 13548 } | 13126 } |
| 13549 MethodGenerator.prototype.visitThisExpression = function(node) { | 13127 MethodGenerator.prototype.visitThisExpression = function(node) { |
| 13550 return this._makeThisValue(node); | 13128 return this._makeThisValue(node); |
| 13551 } | 13129 } |
| 13552 MethodGenerator.prototype.visitSuperExpression = function(node) { | 13130 MethodGenerator.prototype.visitSuperExpression = function(node) { |
| 13553 return this._makeSuperValue(node); | 13131 return this._makeSuperValue(node); |
| 13554 } | 13132 } |
| 13555 MethodGenerator.prototype.visitNullExpression = function(node) { | 13133 MethodGenerator.prototype.visitNullExpression = function(node) { |
| 13556 return EvaluatedValue.EvaluatedValue$factory(world.varType, null, 'null', null
); | 13134 return EvaluatedValue.EvaluatedValue$factory(world.varType, null, 'null', null
); |
| 13557 } | 13135 } |
| 13558 MethodGenerator.prototype.visitLiteralExpression = function(node) { | 13136 MethodGenerator.prototype.visitLiteralExpression = function(node) { |
| 13559 var $0; | 13137 var $0; |
| 13560 var type = node.type.type; | 13138 var type = node.type.type; |
| 13561 $assert($ne(type, null), "type != null", "gen.dart", 2083, 12); | |
| 13562 if (!!(($0 = node.value) && $0.is$List)) { | 13139 if (!!(($0 = node.value) && $0.is$List)) { |
| 13563 var items = []; | 13140 var items = []; |
| 13564 var $list = node.value; | 13141 var $list = node.value; |
| 13565 for (var $i = node.value.iterator$0(); $i.hasNext$0(); ) { | 13142 for (var $i = node.value.iterator$0(); $i.hasNext$0(); ) { |
| 13566 var item = $i.next$0(); | 13143 var item = $i.next$0(); |
| 13567 var val = this.visitValue((item && item.is$lang_Expression())); | 13144 var val = this.visitValue(item); |
| 13568 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); | 13145 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); |
| 13569 var code = val.code; | 13146 var code = val.code; |
| 13570 if ((item instanceof BinaryExpression) || (item instanceof ConditionalExpr
ession)) { | 13147 if ((item instanceof BinaryExpression) || (item instanceof ConditionalExpr
ession)) { |
| 13571 code = ('(' + code + ')'); | 13148 code = ('(' + code + ')'); |
| 13572 } | 13149 } |
| 13573 items.add$1(code); | 13150 items.add$1(code); |
| 13574 } | 13151 } |
| 13575 return new Value(type, ('(' + Strings.join((items && items.is$List$String())
, " + ") + ')'), node.span, true); | 13152 return new Value(type, ('(' + Strings.join(items, " + ") + ')'), node.span,
true); |
| 13576 } | 13153 } |
| 13577 var text = node.text; | 13154 var text = node.text; |
| 13578 if ($notnull_bool(type.get$isString())) { | 13155 if (type.get$isString()) { |
| 13579 if ($notnull_bool(text.startsWith$1('@'))) { | 13156 if (text.startsWith$1('@')) { |
| 13580 text = MethodGenerator._escapeString(parseStringLiteral($assert_String(tex
t))); | 13157 text = MethodGenerator._escapeString(parseStringLiteral(text)); |
| 13581 text = ('"' + text + '"'); | 13158 text = ('"' + text + '"'); |
| 13582 } | 13159 } |
| 13583 else if ($notnull_bool(isMultilineString($assert_String(text)))) { | 13160 else if (isMultilineString(text)) { |
| 13584 text = parseStringLiteral($assert_String(text)); | 13161 text = parseStringLiteral(text); |
| 13585 text = text.replaceAll$2('\n', '\\n'); | 13162 text = text.replaceAll$2('\n', '\\n'); |
| 13586 text = text.replaceAll$2('"', '\\"'); | 13163 text = text.replaceAll$2('"', '\\"'); |
| 13587 text = ('"' + text + '"'); | 13164 text = ('"' + text + '"'); |
| 13588 } | 13165 } |
| 13589 if (text !== node.text) { | 13166 if (text !== node.text) { |
| 13590 node.value = text; | 13167 node.value = text; |
| 13591 node.text = $assert_String(text); | 13168 node.text = text; |
| 13592 } | 13169 } |
| 13593 } | 13170 } |
| 13594 return EvaluatedValue.EvaluatedValue$factory((type && type.is$lang_Type()), no
de.value, node.text, null); | 13171 return EvaluatedValue.EvaluatedValue$factory(type, node.value, node.text, null
); |
| 13595 } | 13172 } |
| 13596 MethodGenerator.prototype.visitPostfixExpression$1 = function($0) { | 13173 MethodGenerator.prototype.visitPostfixExpression$1 = function($0) { |
| 13597 return this.visitPostfixExpression(($0 && $0.is$PostfixExpression()), false); | 13174 return this.visitPostfixExpression($0, false); |
| 13598 }; | 13175 }; |
| 13599 MethodGenerator.prototype.writeDefinition$2 = function($0, $1) { | 13176 MethodGenerator.prototype.writeDefinition$2 = function($0, $1) { |
| 13600 return this.writeDefinition(($0 && $0.is$CodeWriter()), ($1 && $1.is$LambdaExp
ression())); | 13177 return this.writeDefinition($0, $1); |
| 13601 }; | 13178 }; |
| 13602 // ********** Code for Arguments ************** | 13179 // ********** Code for Arguments ************** |
| 13603 function Arguments(nodes, values) { | 13180 function Arguments(nodes, values) { |
| 13604 this.nodes = nodes; | 13181 this.nodes = nodes; |
| 13605 this.values = values; | 13182 this.values = values; |
| 13606 // Initializers done | 13183 // Initializers done |
| 13607 } | 13184 } |
| 13608 Arguments.prototype.is$Arguments = function(){return this;}; | |
| 13609 Arguments.Arguments$bare$factory = function(arity) { | 13185 Arguments.Arguments$bare$factory = function(arity) { |
| 13610 var values = []; | 13186 var values = []; |
| 13611 for (var i = 0; | 13187 for (var i = 0; |
| 13612 i < arity; i++) { | 13188 i < arity; i++) { |
| 13613 values.add$1(new Value(world.varType, ('\$' + i + ''), null, false)); | 13189 values.add$1(new Value(world.varType, ('\$' + i + ''), null, false)); |
| 13614 } | 13190 } |
| 13615 return new Arguments(null, values); | 13191 return new Arguments(null, values); |
| 13616 } | 13192 } |
| 13617 Arguments.get$EMPTY = function() { | 13193 Arguments.get$EMPTY = function() { |
| 13618 if (Arguments._empty == null) { | 13194 if (Arguments._empty == null) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 13638 Arguments.prototype.getIndexOfName = function(name) { | 13214 Arguments.prototype.getIndexOfName = function(name) { |
| 13639 for (var i = this.get$bareCount(); | 13215 for (var i = this.get$bareCount(); |
| 13640 i < this.get$length(); i++) { | 13216 i < this.get$length(); i++) { |
| 13641 if (this.getName(i) == name) { | 13217 if (this.getName(i) == name) { |
| 13642 return i; | 13218 return i; |
| 13643 } | 13219 } |
| 13644 } | 13220 } |
| 13645 return -1; | 13221 return -1; |
| 13646 } | 13222 } |
| 13647 Arguments.prototype.getValue = function(name) { | 13223 Arguments.prototype.getValue = function(name) { |
| 13648 var $0; | |
| 13649 var i = this.getIndexOfName(name); | 13224 var i = this.getIndexOfName(name); |
| 13650 return (($0 = i >= 0 ? this.values.$index(i) : null) && $0.is$Value()); | 13225 return i >= 0 ? this.values.$index(i) : null; |
| 13651 } | 13226 } |
| 13652 Arguments.prototype.get$bareCount = function() { | 13227 Arguments.prototype.get$bareCount = function() { |
| 13653 if (this._bareCount == null) { | 13228 if (this._bareCount == null) { |
| 13654 this._bareCount = this.get$length(); | 13229 this._bareCount = this.get$length(); |
| 13655 if (this.nodes != null) { | 13230 if (this.nodes != null) { |
| 13656 for (var i = 0; | 13231 for (var i = 0; |
| 13657 i < this.nodes.length; i++) { | 13232 i < this.nodes.length; i++) { |
| 13658 if (this.nodes.$index(i).label != null) { | 13233 if (this.nodes.$index(i).label != null) { |
| 13659 this._bareCount = i; | 13234 this._bareCount = i; |
| 13660 break; | 13235 break; |
| 13661 } | 13236 } |
| 13662 } | 13237 } |
| 13663 } | 13238 } |
| 13664 } | 13239 } |
| 13665 return this._bareCount; | 13240 return this._bareCount; |
| 13666 } | 13241 } |
| 13667 Arguments.prototype.getCode = function() { | 13242 Arguments.prototype.getCode = function() { |
| 13668 var argsCode = []; | 13243 var argsCode = []; |
| 13669 for (var i = 0; | 13244 for (var i = 0; |
| 13670 i < this.get$length(); i++) { | 13245 i < this.get$length(); i++) { |
| 13671 argsCode.add$1(this.values.$index(i).code); | 13246 argsCode.add$1(this.values.$index(i).code); |
| 13672 } | 13247 } |
| 13673 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); | 13248 Arguments.removeTrailingNulls(argsCode); |
| 13674 return Strings.join((argsCode && argsCode.is$List$String()), ", "); | 13249 return Strings.join(argsCode, ", "); |
| 13675 } | 13250 } |
| 13676 Arguments.removeTrailingNulls = function(argsCode) { | 13251 Arguments.removeTrailingNulls = function(argsCode) { |
| 13677 while (argsCode.length > 0 && $notnull_bool($eq(argsCode.last(), 'null'))) { | 13252 while (argsCode.length > 0 && $eq(argsCode.last(), 'null')) { |
| 13678 argsCode.removeLast(); | 13253 argsCode.removeLast(); |
| 13679 } | 13254 } |
| 13680 } | 13255 } |
| 13681 Arguments.prototype.getNames = function() { | 13256 Arguments.prototype.getNames = function() { |
| 13682 var names = []; | 13257 var names = []; |
| 13683 for (var i = this.get$bareCount(); | 13258 for (var i = this.get$bareCount(); |
| 13684 i < this.get$length(); i++) { | 13259 i < this.get$length(); i++) { |
| 13685 names.add$1(this.getName(i)); | 13260 names.add$1(this.getName(i)); |
| 13686 } | 13261 } |
| 13687 return (names && names.is$List$String()); | 13262 return names; |
| 13688 } | 13263 } |
| 13689 Arguments.prototype.toCallStubArgs = function() { | 13264 Arguments.prototype.toCallStubArgs = function() { |
| 13690 var result = []; | 13265 var result = []; |
| 13691 for (var i = 0; | 13266 for (var i = 0; |
| 13692 i < this.get$bareCount(); i++) { | 13267 i < this.get$bareCount(); i++) { |
| 13693 result.add$1(new Value(world.varType, ('\$' + i + ''), null, false)); | 13268 result.add$1(new Value(world.varType, ('\$' + i + ''), null, false)); |
| 13694 } | 13269 } |
| 13695 for (var i = this.get$bareCount(); | 13270 for (var i = this.get$bareCount(); |
| 13696 i < this.get$length(); i++) { | 13271 i < this.get$length(); i++) { |
| 13697 var name = this.getName(i); | 13272 var name = this.getName(i); |
| 13698 if ($notnull_bool(name == null)) name = ('\$' + i + ''); | 13273 if (name == null) name = ('\$' + i + ''); |
| 13699 result.add$1(new Value(world.varType, name, null, false)); | 13274 result.add$1(new Value(world.varType, name, null, false)); |
| 13700 } | 13275 } |
| 13701 return new Arguments(this.nodes, result); | 13276 return new Arguments(this.nodes, result); |
| 13702 } | 13277 } |
| 13703 // ********** Code for LibraryImport ************** | 13278 // ********** Code for LibraryImport ************** |
| 13704 function LibraryImport(library, prefix) { | 13279 function LibraryImport(library, prefix) { |
| 13705 this.library = library; | 13280 this.library = library; |
| 13706 this.prefix = prefix; | 13281 this.prefix = prefix; |
| 13707 // Initializers done | 13282 // Initializers done |
| 13708 } | 13283 } |
| 13709 LibraryImport.prototype.get$library = function() { return this.library; }; | 13284 LibraryImport.prototype.get$library = function() { return this.library; }; |
| 13710 LibraryImport.prototype.set$library = function(value) { return this.library = va
lue; }; | 13285 LibraryImport.prototype.set$library = function(value) { return this.library = va
lue; }; |
| 13711 // ********** Code for Library ************** | 13286 // ********** Code for Library ************** |
| 13712 function Library(baseSource) { | 13287 function Library(baseSource) { |
| 13713 this.isWritten = false | 13288 this.isWritten = false |
| 13714 this.baseSource = baseSource; | 13289 this.baseSource = baseSource; |
| 13715 // Initializers done | 13290 // Initializers done |
| 13716 this.sourceDir = dirname(this.baseSource.filename); | 13291 this.sourceDir = dirname(this.baseSource.filename); |
| 13717 this.topType = new DefinedType(null, this, null, true); | 13292 this.topType = new DefinedType(null, this, null, true); |
| 13718 this.types = $map(['', this.topType]); | 13293 this.types = $map(['', this.topType]); |
| 13719 this.imports = []; | 13294 this.imports = []; |
| 13720 this.natives = []; | 13295 this.natives = []; |
| 13721 this.sources = []; | 13296 this.sources = []; |
| 13722 this._privateMembers = $map([]); | 13297 this._privateMembers = $map([]); |
| 13723 } | 13298 } |
| 13724 Library.prototype.is$Library = function(){return this;}; | |
| 13725 Library.prototype.get$name = function() { return this.name; }; | 13299 Library.prototype.get$name = function() { return this.name; }; |
| 13726 Library.prototype.set$name = function(value) { return this.name = value; }; | 13300 Library.prototype.set$name = function(value) { return this.name = value; }; |
| 13727 Library.prototype.get$isCore = function() { | 13301 Library.prototype.get$isCore = function() { |
| 13728 return $eq(this, world.corelib); | 13302 return $eq(this, world.corelib); |
| 13729 } | 13303 } |
| 13730 Library.prototype.get$isCoreImpl = function() { | 13304 Library.prototype.get$isCoreImpl = function() { |
| 13731 return $eq(this, world.get$coreimpl()); | 13305 return $eq(this, world.get$coreimpl()); |
| 13732 } | 13306 } |
| 13733 Library.prototype.get$jsname = function() { | 13307 Library.prototype.get$jsname = function() { |
| 13734 if (this._jsname == null) { | 13308 if (this._jsname == null) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 13748 } | 13322 } |
| 13749 Library.prototype.addImport = function(fullname, prefix) { | 13323 Library.prototype.addImport = function(fullname, prefix) { |
| 13750 var newLib = world.getOrAddLibrary(fullname); | 13324 var newLib = world.getOrAddLibrary(fullname); |
| 13751 this.imports.add(new LibraryImport(newLib, prefix)); | 13325 this.imports.add(new LibraryImport(newLib, prefix)); |
| 13752 return newLib; | 13326 return newLib; |
| 13753 } | 13327 } |
| 13754 Library.prototype.addNative = function(fullname) { | 13328 Library.prototype.addNative = function(fullname) { |
| 13755 this.natives.add(world.reader.readFile(fullname)); | 13329 this.natives.add(world.reader.readFile(fullname)); |
| 13756 } | 13330 } |
| 13757 Library.prototype._findMembers = function(name) { | 13331 Library.prototype._findMembers = function(name) { |
| 13758 var $0; | |
| 13759 if (name.startsWith('_')) { | 13332 if (name.startsWith('_')) { |
| 13760 return (($0 = this._privateMembers.$index(name)) && $0.is$MemberSet()); | 13333 return this._privateMembers.$index(name); |
| 13761 } | 13334 } |
| 13762 else { | 13335 else { |
| 13763 return (($0 = world._members.$index(name)) && $0.is$MemberSet()); | 13336 return world._members.$index(name); |
| 13764 } | 13337 } |
| 13765 } | 13338 } |
| 13766 Library.prototype._addMember = function(member) { | 13339 Library.prototype._addMember = function(member) { |
| 13767 if ($notnull_bool(member.get$isPrivate())) { | 13340 if (member.get$isPrivate()) { |
| 13768 if ($notnull_bool(member.get$isStatic())) { | 13341 if (member.get$isStatic()) { |
| 13769 if ($notnull_bool(member.declaringType.get$isTop())) { | 13342 if (member.declaringType.get$isTop()) { |
| 13770 world._addTopName(member); | 13343 world._addTopName(member); |
| 13771 } | 13344 } |
| 13772 return; | 13345 return; |
| 13773 } | 13346 } |
| 13774 var mset = this._privateMembers.$index(member.name); | 13347 var mset = this._privateMembers.$index(member.name); |
| 13775 if ($notnull_bool(mset == null)) { | 13348 if (mset == null) { |
| 13776 var $list = world.libraries.getValues(); | 13349 var $list = world.libraries.getValues(); |
| 13777 for (var $i = world.libraries.getValues().iterator$0(); $i.hasNext$0(); )
{ | 13350 for (var $i = world.libraries.getValues().iterator$0(); $i.hasNext$0(); )
{ |
| 13778 var lib = $i.next$0(); | 13351 var lib = $i.next$0(); |
| 13779 if (lib._privateMembers.containsKey(member.name)) { | 13352 if (lib._privateMembers.containsKey(member.name)) { |
| 13780 member.set$jsname(('_' + this.get$jsname() + '' + member.name + '')); | 13353 member.set$jsname(('_' + this.get$jsname() + '' + member.name + '')); |
| 13781 break; | 13354 break; |
| 13782 } | 13355 } |
| 13783 } | 13356 } |
| 13784 mset = new MemberSet(member, false); | 13357 mset = new MemberSet(member, false); |
| 13785 this._privateMembers.$setindex(member.name, mset); | 13358 this._privateMembers.$setindex(member.name, mset); |
| 13786 } | 13359 } |
| 13787 else { | 13360 else { |
| 13788 mset.get$members().add$1(member); | 13361 mset.get$members().add$1(member); |
| 13789 } | 13362 } |
| 13790 } | 13363 } |
| 13791 else { | 13364 else { |
| 13792 world._addMember(member); | 13365 world._addMember(member); |
| 13793 } | 13366 } |
| 13794 } | 13367 } |
| 13795 Library.prototype.getOrAddFunctionType = function(name, func, inType) { | 13368 Library.prototype.getOrAddFunctionType = function(name, func, inType) { |
| 13796 var def = new FunctionTypeDefinition(func, null, func.span); | 13369 var def = new FunctionTypeDefinition(func, null, func.span); |
| 13797 var type = new DefinedType(name, this, def, false); | 13370 var type = new DefinedType(name, this, def, false); |
| 13798 type.addMethod('\$call', func); | 13371 type.addMethod('\$call', func); |
| 13799 type.members.$index('\$call').resolve$1(inType); | 13372 type.members.$index('\$call').resolve$1(inType); |
| 13800 type.interfaces = [world.functionType]; | 13373 type.interfaces = [world.functionType]; |
| 13801 return type; | 13374 return type; |
| 13802 } | 13375 } |
| 13803 Library.prototype.addType = function(name, definition, isClass) { | 13376 Library.prototype.addType = function(name, definition, isClass) { |
| 13804 var $0; | |
| 13805 if (this.types.containsKey(name)) { | 13377 if (this.types.containsKey(name)) { |
| 13806 var existingType = this.types.$index(name); | 13378 var existingType = this.types.$index(name); |
| 13807 if ($notnull_bool(this.get$isCore()) && $notnull_bool(existingType.get$defin
ition() == null)) { | 13379 if (this.get$isCore() && existingType.get$definition() == null) { |
| 13808 existingType.setDefinition$1(definition); | 13380 existingType.setDefinition$1(definition); |
| 13809 } | 13381 } |
| 13810 else { | 13382 else { |
| 13811 world.warning(('duplicate definition of ' + name + ''), definition.span); | 13383 world.warning(('duplicate definition of ' + name + ''), definition.span); |
| 13812 } | 13384 } |
| 13813 } | 13385 } |
| 13814 else { | 13386 else { |
| 13815 this.types.$setindex(name, new DefinedType(name, this, (definition && defini
tion.is$Definition()), isClass)); | 13387 this.types.$setindex(name, new DefinedType(name, this, definition, isClass))
; |
| 13816 } | 13388 } |
| 13817 return (($0 = this.types.$index(name)) && $0.is$DefinedType()); | 13389 return this.types.$index(name); |
| 13818 } | 13390 } |
| 13819 Library.prototype.findType = function(type) { | 13391 Library.prototype.findType = function(type) { |
| 13820 var result = this.findTypeByName(type.name.name); | 13392 var result = this.findTypeByName(type.name.name); |
| 13821 if (result == null) return null; | 13393 if (result == null) return null; |
| 13822 if (type.names != null) { | 13394 if (type.names != null) { |
| 13823 if (type.names.length > 1) { | 13395 if (type.names.length > 1) { |
| 13824 return null; | 13396 return null; |
| 13825 } | 13397 } |
| 13826 if (!$notnull_bool(result.get$isTop())) { | 13398 if (!result.get$isTop()) { |
| 13827 return null; | 13399 return null; |
| 13828 } | 13400 } |
| 13829 return result.get$library().findTypeByName($assert_String(type.names.$index(
0).get$name())); | 13401 return result.get$library().findTypeByName(type.names.$index(0).get$name()); |
| 13830 } | 13402 } |
| 13831 return result; | 13403 return result; |
| 13832 } | 13404 } |
| 13833 Library.prototype.findTypeByName = function(name) { | 13405 Library.prototype.findTypeByName = function(name) { |
| 13834 var ret = this.types.$index(name); | 13406 var ret = this.types.$index(name); |
| 13835 var $list = this.imports; | 13407 var $list = this.imports; |
| 13836 for (var $i = 0;$i < $list.length; $i++) { | 13408 for (var $i = 0;$i < $list.length; $i++) { |
| 13837 var imported = $list.$index($i); | 13409 var imported = $list.$index($i); |
| 13838 var newRet = null; | 13410 var newRet = null; |
| 13839 if (imported.prefix == null) { | 13411 if (imported.prefix == null) { |
| 13840 newRet = imported.get$library().types.$index(name); | 13412 newRet = imported.get$library().types.$index(name); |
| 13841 } | 13413 } |
| 13842 else if (imported.prefix == name) { | 13414 else if (imported.prefix == name) { |
| 13843 newRet = imported.get$library().topType; | 13415 newRet = imported.get$library().topType; |
| 13844 } | 13416 } |
| 13845 if ($notnull_bool($ne(newRet, null))) { | 13417 if ($ne(newRet, null)) { |
| 13846 if ($notnull_bool($ne(ret, null)) && $notnull_bool($ne(ret, newRet))) { | 13418 if ($ne(ret, null) && $ne(ret, newRet)) { |
| 13847 world.error(('conflicting types for "' + name + '"'), ret.get$span(), ne
wRet.get$span()); | 13419 world.error(('conflicting types for "' + name + '"'), ret.get$span(), ne
wRet.get$span()); |
| 13848 } | 13420 } |
| 13849 else { | 13421 else { |
| 13850 ret = newRet; | 13422 ret = newRet; |
| 13851 } | 13423 } |
| 13852 } | 13424 } |
| 13853 } | 13425 } |
| 13854 return (ret && ret.is$lang_Type()); | 13426 return ret; |
| 13855 } | 13427 } |
| 13856 Library.prototype.lookup = function(name, span) { | 13428 Library.prototype.lookup = function(name, span) { |
| 13857 var retType = this.findTypeByName(name); | 13429 var retType = this.findTypeByName(name); |
| 13858 var ret = null; | 13430 var ret = null; |
| 13859 if ($notnull_bool($ne(retType, null))) { | 13431 if ($ne(retType, null)) { |
| 13860 ret = retType.get$typeMember(); | 13432 ret = retType.get$typeMember(); |
| 13861 } | 13433 } |
| 13862 var newRet = this.topType.getMember(name); | 13434 var newRet = this.topType.getMember(name); |
| 13863 if ($notnull_bool($ne(newRet, null))) { | 13435 if ($ne(newRet, null)) { |
| 13864 if ($notnull_bool($ne(ret, null)) && $notnull_bool($ne(ret, newRet))) { | 13436 if ($ne(ret, null) && $ne(ret, newRet)) { |
| 13865 world.error(('conflicting members for "' + name + '"'), span, ret.get$span
(), newRet.get$span()); | 13437 world.error(('conflicting members for "' + name + '"'), span, ret.get$span
(), newRet.get$span()); |
| 13866 } | 13438 } |
| 13867 else { | 13439 else { |
| 13868 ret = newRet; | 13440 ret = newRet; |
| 13869 } | 13441 } |
| 13870 } | 13442 } |
| 13871 var $list = this.imports; | 13443 var $list = this.imports; |
| 13872 for (var $i = 0;$i < $list.length; $i++) { | 13444 for (var $i = 0;$i < $list.length; $i++) { |
| 13873 var imported = $list.$index($i); | 13445 var imported = $list.$index($i); |
| 13874 if (imported.prefix == null) { | 13446 if (imported.prefix == null) { |
| 13875 newRet = imported.get$library().topType.getMember(name); | 13447 newRet = imported.get$library().topType.getMember(name); |
| 13876 if ($notnull_bool($ne(newRet, null))) { | 13448 if ($ne(newRet, null)) { |
| 13877 if ($notnull_bool($ne(ret, null)) && $notnull_bool($ne(ret, newRet))) { | 13449 if ($ne(ret, null) && $ne(ret, newRet)) { |
| 13878 world.error(('conflicting members for "' + name + '"'), span, ret.get$
span(), newRet.get$span()); | 13450 world.error(('conflicting members for "' + name + '"'), span, ret.get$
span(), newRet.get$span()); |
| 13879 } | 13451 } |
| 13880 else { | 13452 else { |
| 13881 ret = newRet; | 13453 ret = newRet; |
| 13882 } | 13454 } |
| 13883 } | 13455 } |
| 13884 } | 13456 } |
| 13885 } | 13457 } |
| 13886 return (ret && ret.is$Member()); | 13458 return ret; |
| 13887 } | 13459 } |
| 13888 Library.prototype.resolve = function() { | 13460 Library.prototype.resolve = function() { |
| 13889 if (this.name == null) { | 13461 if (this.name == null) { |
| 13890 this.name = this.baseSource.filename; | 13462 this.name = this.baseSource.filename; |
| 13891 var index = this.name.lastIndexOf('/', this.name.length); | 13463 var index = this.name.lastIndexOf('/', this.name.length); |
| 13892 if (index >= 0) { | 13464 if (index >= 0) { |
| 13893 this.name = this.name.substring($assert_num(index + 1)); | 13465 this.name = this.name.substring(index + 1); |
| 13894 } | 13466 } |
| 13895 index = this.name.indexOf('.', 0); | 13467 index = this.name.indexOf('.', 0); |
| 13896 if (index > 0) { | 13468 if (index > 0) { |
| 13897 this.name = this.name.substring(0, $assert_num(index)); | 13469 this.name = this.name.substring(0, index); |
| 13898 } | 13470 } |
| 13899 } | 13471 } |
| 13900 var $list = this.types.getValues(); | 13472 var $list = this.types.getValues(); |
| 13901 for (var $i = this.types.getValues().iterator$0(); $i.hasNext$0(); ) { | 13473 for (var $i = this.types.getValues().iterator$0(); $i.hasNext$0(); ) { |
| 13902 var type = $i.next$0(); | 13474 var type = $i.next$0(); |
| 13903 type.resolve$0(); | 13475 type.resolve$0(); |
| 13904 } | 13476 } |
| 13905 } | 13477 } |
| 13906 Library.prototype.visitSources = function() { | 13478 Library.prototype.visitSources = function() { |
| 13907 var visitor = new _LibraryVisitor(this); | 13479 var visitor = new _LibraryVisitor(this); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 13923 function _LibraryVisitor(library) { | 13495 function _LibraryVisitor(library) { |
| 13924 this.seenImport = false | 13496 this.seenImport = false |
| 13925 this.seenSource = false | 13497 this.seenSource = false |
| 13926 this.seenResource = false | 13498 this.seenResource = false |
| 13927 this.isTop = true | 13499 this.isTop = true |
| 13928 this.library = library; | 13500 this.library = library; |
| 13929 // Initializers done | 13501 // Initializers done |
| 13930 this.currentType = this.library.topType; | 13502 this.currentType = this.library.topType; |
| 13931 this.sources = []; | 13503 this.sources = []; |
| 13932 } | 13504 } |
| 13933 _LibraryVisitor.prototype.is$TreeVisitor = function(){return this;}; | |
| 13934 _LibraryVisitor.prototype.get$library = function() { return this.library; }; | 13505 _LibraryVisitor.prototype.get$library = function() { return this.library; }; |
| 13935 _LibraryVisitor.prototype.get$isTop = function() { return this.isTop; }; | 13506 _LibraryVisitor.prototype.get$isTop = function() { return this.isTop; }; |
| 13936 _LibraryVisitor.prototype.set$isTop = function(value) { return this.isTop = valu
e; }; | 13507 _LibraryVisitor.prototype.set$isTop = function(value) { return this.isTop = valu
e; }; |
| 13937 _LibraryVisitor.prototype.addSourceFromName = function(name, span) { | 13508 _LibraryVisitor.prototype.addSourceFromName = function(name, span) { |
| 13938 var filename = this.library.makeFullPath(name); | 13509 var filename = this.library.makeFullPath(name); |
| 13939 if ($notnull_bool($eq(filename, this.library.baseSource.filename))) { | 13510 if ($eq(filename, this.library.baseSource.filename)) { |
| 13940 world.error('library can not source itself', span); | 13511 world.error('library can not source itself', span); |
| 13941 return; | 13512 return; |
| 13942 } | 13513 } |
| 13943 else if (this.sources.some((function (s) { | 13514 else if (this.sources.some((function (s) { |
| 13944 return $eq(s.filename, filename); | 13515 return s.filename == filename; |
| 13945 }) | 13516 }) |
| 13946 )) { | 13517 )) { |
| 13947 world.error(('file "' + filename + '" has already been sourced'), span); | 13518 world.error(('file "' + filename + '" has already been sourced'), span); |
| 13948 return; | 13519 return; |
| 13949 } | 13520 } |
| 13950 var source = world.readFile(this.library.makeFullPath(name)); | 13521 var source = world.readFile(this.library.makeFullPath(name)); |
| 13951 this.sources.add(source); | 13522 this.sources.add(source); |
| 13952 } | 13523 } |
| 13953 _LibraryVisitor.prototype.addSource = function(source) { | 13524 _LibraryVisitor.prototype.addSource = function(source) { |
| 13954 var $this = this; // closure support | 13525 var $this = this; // closure support |
| 13955 if (this.library.sources.some((function (s) { | 13526 if (this.library.sources.some((function (s) { |
| 13956 return s.filename == source.filename; | 13527 return s.filename == source.filename; |
| 13957 }) | 13528 }) |
| 13958 )) { | 13529 )) { |
| 13959 world.error(('duplicate source file "' + source.filename + '"')); | 13530 world.error(('duplicate source file "' + source.filename + '"')); |
| 13960 return; | 13531 return; |
| 13961 } | 13532 } |
| 13962 this.library.sources.add(source); | 13533 this.library.sources.add(source); |
| 13963 var parser = new lang_Parser(source, options.dietParse, false, false, 0); | 13534 var parser = new lang_Parser(source, options.dietParse, false, false, 0); |
| 13964 var unit = parser.compilationUnit(); | 13535 var unit = parser.compilationUnit(); |
| 13965 unit.forEach((function (def) { | 13536 unit.forEach((function (def) { |
| 13966 return def.visit$1($this); | 13537 return def.visit$1($this); |
| 13967 }) | 13538 }) |
| 13968 ); | 13539 ); |
| 13969 $assert(this.sources.length == 0 || $notnull_bool(this.isTop), "sources.length
== 0 || isTop", "library.dart", 293, 12); | |
| 13970 this.isTop = false; | 13540 this.isTop = false; |
| 13971 var newSources = this.sources; | 13541 var newSources = this.sources; |
| 13972 this.sources = []; | 13542 this.sources = []; |
| 13973 for (var $i = newSources.iterator$0(); $i.hasNext$0(); ) { | 13543 for (var $i = newSources.iterator$0(); $i.hasNext$0(); ) { |
| 13974 var source0 = $i.next$0(); | 13544 var source0 = $i.next$0(); |
| 13975 this.addSource((source0 && source0.is$SourceFile())); | 13545 this.addSource(source0); |
| 13976 } | 13546 } |
| 13977 } | 13547 } |
| 13978 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { | 13548 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { |
| 13979 if (!$notnull_bool(this.isTop)) { | 13549 if (!this.isTop) { |
| 13980 world.error('directives not allowed in sourced file', node.span); | 13550 world.error('directives not allowed in sourced file', node.span); |
| 13981 return; | 13551 return; |
| 13982 } | 13552 } |
| 13983 var name; | 13553 var name; |
| 13984 switch (node.name.name) { | 13554 switch (node.name.name) { |
| 13985 case "library": | 13555 case "library": |
| 13986 | 13556 |
| 13987 name = this.getSingleStringArg(node); | 13557 name = this.getSingleStringArg(node); |
| 13988 if (this.library.name == null) { | 13558 if (this.library.name == null) { |
| 13989 this.library.name = $assert_String(name); | 13559 this.library.name = name; |
| 13990 if ($notnull_bool($eq(name, 'node')) || $notnull_bool($eq(name, 'dom')))
{ | 13560 if ($eq(name, 'node') || $eq(name, 'dom')) { |
| 13991 this.library.topType.isNativeType = true; | 13561 this.library.topType.isNativeType = true; |
| 13992 } | 13562 } |
| 13993 if ($notnull_bool(this.seenImport) || $notnull_bool(this.seenSource) ||
$notnull_bool(this.seenResource)) { | 13563 if (this.seenImport || this.seenSource || this.seenResource) { |
| 13994 world.error('#library must be first directive in file', node.span); | 13564 world.error('#library must be first directive in file', node.span); |
| 13995 } | 13565 } |
| 13996 } | 13566 } |
| 13997 else { | 13567 else { |
| 13998 world.error('already specified library name', node.span); | 13568 world.error('already specified library name', node.span); |
| 13999 } | 13569 } |
| 14000 break; | 13570 break; |
| 14001 | 13571 |
| 14002 case "import": | 13572 case "import": |
| 14003 | 13573 |
| 14004 this.seenImport = true; | 13574 this.seenImport = true; |
| 14005 name = this.getFirstStringArg(node); | 13575 name = this.getFirstStringArg(node); |
| 14006 var prefix = this.tryGetNamedStringArg(node, 'prefix'); | 13576 var prefix = this.tryGetNamedStringArg(node, 'prefix'); |
| 14007 if (node.arguments.length > 2 || node.arguments.length == 2 && $notnull_bo
ol(prefix == null)) { | 13577 if (node.arguments.length > 2 || node.arguments.length == 2 && prefix == n
ull) { |
| 14008 world.error('expected at most one "name" argument and one optional "pref
ix"' + (' but found ' + node.arguments.length + ''), node.span); | 13578 world.error('expected at most one "name" argument and one optional "pref
ix"' + (' but found ' + node.arguments.length + ''), node.span); |
| 14009 } | 13579 } |
| 14010 else if ($notnull_bool($ne(prefix, null)) && prefix.indexOf$2('.', 0) >= 0
) { | 13580 else if ($ne(prefix, null) && prefix.indexOf$2('.', 0) >= 0) { |
| 14011 world.error('library prefix canot contain "."', node.span); | 13581 world.error('library prefix canot contain "."', node.span); |
| 14012 } | 13582 } |
| 14013 else if ($notnull_bool(this.seenSource) || $notnull_bool(this.seenResource
)) { | 13583 else if (this.seenSource || this.seenResource) { |
| 14014 world.error('#imports must come before any #source or #resource', node.s
pan); | 13584 world.error('#imports must come before any #source or #resource', node.s
pan); |
| 14015 } | 13585 } |
| 14016 if ($notnull_bool($eq(prefix, ''))) prefix = null; | 13586 if ($eq(prefix, '')) prefix = null; |
| 14017 var filename = this.library.makeFullPath($assert_String(name)); | 13587 var filename = this.library.makeFullPath(name); |
| 14018 if (this.library.imports.some((function (li) { | 13588 if (this.library.imports.some((function (li) { |
| 14019 return $eq(li.get$library().baseSource, filename); | 13589 return $eq(li.get$library().baseSource, filename); |
| 14020 }) | 13590 }) |
| 14021 )) { | 13591 )) { |
| 14022 world.error(('duplicate import of "' + name + '"'), node.span); | 13592 world.error(('duplicate import of "' + name + '"'), node.span); |
| 14023 return; | 13593 return; |
| 14024 } | 13594 } |
| 14025 var newLib = this.library.addImport($assert_String(filename), $assert_Stri
ng(prefix)); | 13595 var newLib = this.library.addImport(filename, prefix); |
| 14026 break; | 13596 break; |
| 14027 | 13597 |
| 14028 case "source": | 13598 case "source": |
| 14029 | 13599 |
| 14030 this.seenSource = true; | 13600 this.seenSource = true; |
| 14031 name = this.getSingleStringArg(node); | 13601 name = this.getSingleStringArg(node); |
| 14032 this.addSourceFromName($assert_String(name), node.span); | 13602 this.addSourceFromName(name, node.span); |
| 14033 if ($notnull_bool(this.seenResource)) { | 13603 if (this.seenResource) { |
| 14034 world.error('#sources must come before any #resource', node.span); | 13604 world.error('#sources must come before any #resource', node.span); |
| 14035 } | 13605 } |
| 14036 break; | 13606 break; |
| 14037 | 13607 |
| 14038 case "native": | 13608 case "native": |
| 14039 | 13609 |
| 14040 name = this.getSingleStringArg(node); | 13610 name = this.getSingleStringArg(node); |
| 14041 this.library.addNative(this.library.makeFullPath($assert_String(name))); | 13611 this.library.addNative(this.library.makeFullPath(name)); |
| 14042 break; | 13612 break; |
| 14043 | 13613 |
| 14044 case "resource": | 13614 case "resource": |
| 14045 | 13615 |
| 14046 this.seenResource = true; | 13616 this.seenResource = true; |
| 14047 this.getFirstStringArg(node); | 13617 this.getFirstStringArg(node); |
| 14048 break; | 13618 break; |
| 14049 | 13619 |
| 14050 default: | 13620 default: |
| 14051 | 13621 |
| 14052 world.error(('unknown directive: ' + node.name.name + ''), node.span); | 13622 world.error(('unknown directive: ' + node.name.name + ''), node.span); |
| 14053 | 13623 |
| 14054 } | 13624 } |
| 14055 } | 13625 } |
| 14056 _LibraryVisitor.prototype.getSingleStringArg = function(node) { | 13626 _LibraryVisitor.prototype.getSingleStringArg = function(node) { |
| 14057 if (node.arguments.length != 1) { | 13627 if (node.arguments.length != 1) { |
| 14058 world.error(('expected exactly one argument but found ' + node.arguments.len
gth + ''), node.span); | 13628 world.error(('expected exactly one argument but found ' + node.arguments.len
gth + ''), node.span); |
| 14059 } | 13629 } |
| 14060 return this.getFirstStringArg(node); | 13630 return this.getFirstStringArg(node); |
| 14061 } | 13631 } |
| 14062 _LibraryVisitor.prototype.getFirstStringArg = function(node) { | 13632 _LibraryVisitor.prototype.getFirstStringArg = function(node) { |
| 14063 if (node.arguments.length < 1) { | 13633 if (node.arguments.length < 1) { |
| 14064 world.error(('expected at least one argument but found ' + node.arguments.le
ngth + ''), node.span); | 13634 world.error(('expected at least one argument but found ' + node.arguments.le
ngth + ''), node.span); |
| 14065 } | 13635 } |
| 14066 var arg = node.arguments.$index(0); | 13636 var arg = node.arguments.$index(0); |
| 14067 if (arg.label != null) { | 13637 if (arg.label != null) { |
| 14068 world.error('label not allowed for directive', node.span); | 13638 world.error('label not allowed for directive', node.span); |
| 14069 } | 13639 } |
| 14070 return this._parseStringArgument((arg && arg.is$ArgumentNode())); | 13640 return this._parseStringArgument(arg); |
| 14071 } | 13641 } |
| 14072 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { | 13642 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { |
| 14073 var args = node.arguments.filter((function (a) { | 13643 var args = node.arguments.filter((function (a) { |
| 14074 return a.label != null && a.label.name == argName; | 13644 return a.label != null && a.label.name == argName; |
| 14075 }) | 13645 }) |
| 14076 ); | 13646 ); |
| 14077 if (args.length == 0) { | 13647 if (args.length == 0) { |
| 14078 return null; | 13648 return null; |
| 14079 } | 13649 } |
| 14080 if (args.length > 1) { | 13650 if (args.length > 1) { |
| 14081 world.error(('expected at most one "' + argName + '" argument but found ') +
node.arguments.length, node.span); | 13651 world.error(('expected at most one "' + argName + '" argument but found ') +
node.arguments.length, node.span); |
| 14082 } | 13652 } |
| 14083 for (var $i = args.iterator$0(); $i.hasNext$0(); ) { | 13653 for (var $i = args.iterator$0(); $i.hasNext$0(); ) { |
| 14084 var arg = $i.next$0(); | 13654 var arg = $i.next$0(); |
| 14085 return this._parseStringArgument((arg && arg.is$ArgumentNode())); | 13655 return this._parseStringArgument(arg); |
| 14086 } | 13656 } |
| 14087 } | 13657 } |
| 14088 _LibraryVisitor.prototype._parseStringArgument = function(arg) { | 13658 _LibraryVisitor.prototype._parseStringArgument = function(arg) { |
| 14089 var expr = arg.value; | 13659 var expr = arg.value; |
| 14090 if (!(expr instanceof LiteralExpression) || !$notnull_bool(expr.type.type.get$
isString())) { | 13660 if (!(expr instanceof LiteralExpression) || !expr.type.type.get$isString()) { |
| 14091 world.error('expected string', expr.get$span()); | 13661 world.error('expected string', expr.get$span()); |
| 14092 } | 13662 } |
| 14093 return parseStringLiteral($assert_String(expr.get$value())); | 13663 return parseStringLiteral(expr.get$value()); |
| 14094 } | 13664 } |
| 14095 _LibraryVisitor.prototype.visitTypeDefinition = function(node) { | 13665 _LibraryVisitor.prototype.visitTypeDefinition = function(node) { |
| 14096 var oldType = this.currentType; | 13666 var oldType = this.currentType; |
| 14097 this.currentType = this.library.addType(node.name.name, node, node.isClass); | 13667 this.currentType = this.library.addType(node.name.name, node, node.isClass); |
| 14098 var $list = node.body; | 13668 var $list = node.body; |
| 14099 for (var $i = 0;$i < $list.length; $i++) { | 13669 for (var $i = 0;$i < $list.length; $i++) { |
| 14100 var member = $list.$index($i); | 13670 var member = $list.$index($i); |
| 14101 member.visit$1(this); | 13671 member.visit$1(this); |
| 14102 } | 13672 } |
| 14103 this.currentType = (oldType && oldType.is$DefinedType()); | 13673 this.currentType = oldType; |
| 14104 } | 13674 } |
| 14105 _LibraryVisitor.prototype.visitVariableDefinition = function(node) { | 13675 _LibraryVisitor.prototype.visitVariableDefinition = function(node) { |
| 14106 this.currentType.addField(node); | 13676 this.currentType.addField(node); |
| 14107 } | 13677 } |
| 14108 _LibraryVisitor.prototype.visitFunctionDefinition = function(node) { | 13678 _LibraryVisitor.prototype.visitFunctionDefinition = function(node) { |
| 14109 this.currentType.addMethod(node.name.name, node); | 13679 this.currentType.addMethod(node.name.name, node); |
| 14110 } | 13680 } |
| 14111 _LibraryVisitor.prototype.visitFunctionTypeDefinition = function(node) { | 13681 _LibraryVisitor.prototype.visitFunctionTypeDefinition = function(node) { |
| 14112 var type = this.library.addType(node.func.name.name, node, false); | 13682 var type = this.library.addType(node.func.name.name, node, false); |
| 14113 type.addMethod$2('\$call', node.func); | 13683 type.addMethod$2('\$call', node.func); |
| 14114 } | 13684 } |
| 14115 _LibraryVisitor.prototype.addSource$1 = function($0) { | 13685 _LibraryVisitor.prototype.addSource$1 = function($0) { |
| 14116 return this.addSource(($0 && $0.is$SourceFile())); | 13686 return this.addSource($0); |
| 14117 }; | 13687 }; |
| 14118 // ********** Code for Parameter ************** | 13688 // ********** Code for Parameter ************** |
| 14119 function Parameter(definition) { | 13689 function Parameter(definition) { |
| 14120 this.isInitializer = false | 13690 this.isInitializer = false |
| 14121 this.definition = definition; | 13691 this.definition = definition; |
| 14122 // Initializers done | 13692 // Initializers done |
| 14123 } | 13693 } |
| 14124 Parameter.prototype.is$Parameter = function(){return this;}; | |
| 14125 Parameter.prototype.get$definition = function() { return this.definition; }; | 13694 Parameter.prototype.get$definition = function() { return this.definition; }; |
| 14126 Parameter.prototype.set$definition = function(value) { return this.definition =
value; }; | 13695 Parameter.prototype.set$definition = function(value) { return this.definition =
value; }; |
| 14127 Parameter.prototype.get$name = function() { return this.name; }; | 13696 Parameter.prototype.get$name = function() { return this.name; }; |
| 14128 Parameter.prototype.set$name = function(value) { return this.name = value; }; | 13697 Parameter.prototype.set$name = function(value) { return this.name = value; }; |
| 14129 Parameter.prototype.get$type = function() { return this.type; }; | |
| 14130 Parameter.prototype.set$type = function(value) { return this.type = value; }; | |
| 14131 Parameter.prototype.get$value = function() { return this.value; }; | 13698 Parameter.prototype.get$value = function() { return this.value; }; |
| 14132 Parameter.prototype.set$value = function(value) { return this.value = value; }; | 13699 Parameter.prototype.set$value = function(value) { return this.value = value; }; |
| 14133 Parameter.prototype.resolve = function(method, inType) { | 13700 Parameter.prototype.resolve = function(method, inType) { |
| 14134 this.name = this.definition.name.name; | 13701 this.name = this.definition.name.name; |
| 14135 if (this.name.startsWith('this.')) { | 13702 if (this.name.startsWith('this.')) { |
| 14136 this.name = this.name.substring(5); | 13703 this.name = this.name.substring(5); |
| 14137 this.isInitializer = true; | 13704 this.isInitializer = true; |
| 14138 } | 13705 } |
| 14139 this.type = inType.resolveType(this.definition.type, false); | 13706 this.type = inType.resolveType(this.definition.type, false); |
| 14140 if ($notnull_bool(method.get$isStatic()) && $notnull_bool(this.type.get$hasTyp
eParams())) { | 13707 if (method.get$isStatic() && this.type.get$hasTypeParams()) { |
| 14141 world.error('using type parameter in static context', this.definition.span); | 13708 world.error('using type parameter in static context', this.definition.span); |
| 14142 } | 13709 } |
| 14143 if (this.definition.value != null) { | 13710 if (this.definition.value != null) { |
| 14144 if ((this.definition.value instanceof NullExpression) && this.definition.val
ue.span.start == this.definition.span.start) { | 13711 if ((this.definition.value instanceof NullExpression) && this.definition.val
ue.span.start == this.definition.span.start) { |
| 14145 return; | 13712 return; |
| 14146 } | 13713 } |
| 14147 if ($notnull_bool(method.get$isAbstract())) { | 13714 if (method.get$isAbstract()) { |
| 14148 world.error('default value not allowed on abstract methods', this.definiti
on.span); | 13715 world.error('default value not allowed on abstract methods', this.definiti
on.span); |
| 14149 } | 13716 } |
| 14150 else if (method.name == '\$call' && $notnull_bool(method.get$definition().bo
dy == null)) { | 13717 else if (method.name == '\$call' && method.get$definition().body == null) { |
| 14151 world.error('default value not allowed on function type', this.definition.
span); | 13718 world.error('default value not allowed on function type', this.definition.
span); |
| 14152 } | 13719 } |
| 14153 } | 13720 } |
| 14154 else if ($notnull_bool(this.isInitializer) && !$notnull_bool(method.get$isCons
tructor())) { | 13721 else if (this.isInitializer && !method.get$isConstructor()) { |
| 14155 world.error('initializer parameters only allowed on constructors', this.defi
nition.span); | 13722 world.error('initializer parameters only allowed on constructors', this.defi
nition.span); |
| 14156 } | 13723 } |
| 14157 } | 13724 } |
| 14158 Parameter.prototype.genValue = function(method, context) { | 13725 Parameter.prototype.genValue = function(method, context) { |
| 14159 var $0; | |
| 14160 if (this.definition.value == null || this.value != null) return; | 13726 if (this.definition.value == null || this.value != null) return; |
| 14161 if (context == null) { | 13727 if (context == null) { |
| 14162 context = new MethodGenerator(method, null); | 13728 context = new MethodGenerator(method, null); |
| 14163 } | 13729 } |
| 14164 this.value = (($0 = this.definition.value.visit(context)) && $0.is$Value()); | 13730 this.value = this.definition.value.visit(context); |
| 14165 this.value = this.value.convertTo(context, this.type, this.definition.value, f
alse); | 13731 this.value = this.value.convertTo(context, this.type, this.definition.value, f
alse); |
| 14166 } | 13732 } |
| 14167 Parameter.prototype.copyWithNewType = function(newType) { | 13733 Parameter.prototype.copyWithNewType = function(newType) { |
| 14168 var $0; | |
| 14169 var ret = new Parameter(this.definition); | 13734 var ret = new Parameter(this.definition); |
| 14170 ret.set$type(newType); | 13735 ret.type = newType; |
| 14171 ret.set$name(this.name); | 13736 ret.name = this.name; |
| 14172 ret.isInitializer = this.isInitializer; | 13737 ret.isInitializer = this.isInitializer; |
| 14173 return (ret && ret.is$Parameter()); | 13738 return ret; |
| 14174 } | 13739 } |
| 14175 Parameter.prototype.get$isOptional = function() { | 13740 Parameter.prototype.get$isOptional = function() { |
| 14176 return this.definition != null && this.definition.value != null; | 13741 return this.definition != null && this.definition.value != null; |
| 14177 } | 13742 } |
| 14178 Parameter.prototype.copyWithNewType$1 = function($0) { | 13743 Parameter.prototype.copyWithNewType$1 = function($0) { |
| 14179 return this.copyWithNewType(($0 && $0.is$lang_Type())); | 13744 return this.copyWithNewType($0); |
| 14180 }; | 13745 }; |
| 14181 Parameter.prototype.genValue$2 = function($0, $1) { | 13746 Parameter.prototype.genValue$2 = function($0, $1) { |
| 14182 return this.genValue(($0 && $0.is$MethodMember()), ($1 && $1.is$MethodGenerato
r())); | 13747 return this.genValue($0, $1); |
| 14183 }; | 13748 }; |
| 14184 Parameter.prototype.resolve$2 = function($0, $1) { | 13749 Parameter.prototype.resolve$2 = function($0, $1) { |
| 14185 return this.resolve(($0 && $0.is$Member()), ($1 && $1.is$lang_Type())); | 13750 return this.resolve($0, $1); |
| 14186 }; | 13751 }; |
| 14187 // ********** Code for Member ************** | 13752 // ********** Code for Member ************** |
| 14188 function Member(name, declaringType) { | 13753 function Member(name, declaringType) { |
| 14189 this.name = name; | 13754 this.name = name; |
| 14190 this.declaringType = declaringType; | 13755 this.declaringType = declaringType; |
| 14191 this.isGenerated = false; | 13756 this.isGenerated = false; |
| 14192 // Initializers done | 13757 // Initializers done |
| 14193 } | 13758 } |
| 14194 Member.prototype.is$Member = function(){return this;}; | |
| 14195 Member.prototype.is$Named = function(){return this;}; | |
| 14196 Member.prototype.get$name = function() { return this.name; }; | 13759 Member.prototype.get$name = function() { return this.name; }; |
| 14197 Member.prototype.get$jsname = function() { | 13760 Member.prototype.get$jsname = function() { |
| 14198 return this._jsname == null ? this.name : this._jsname; | 13761 return this._jsname == null ? this.name : this._jsname; |
| 14199 } | 13762 } |
| 14200 Member.prototype.set$jsname = function(name) { | 13763 Member.prototype.set$jsname = function(name) { |
| 14201 return this._jsname = name; | 13764 return this._jsname = name; |
| 14202 } | 13765 } |
| 14203 Member.prototype.get$library = function() { | 13766 Member.prototype.get$library = function() { |
| 14204 return this.declaringType.get$library(); | 13767 return this.declaringType.get$library(); |
| 14205 } | 13768 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14252 return world.internalError('can not be property', this.get$span()); | 13815 return world.internalError('can not be property', this.get$span()); |
| 14253 } | 13816 } |
| 14254 Member.prototype.get$initDelegate = function() { | 13817 Member.prototype.get$initDelegate = function() { |
| 14255 world.internalError('cannot have initializers', this.get$span()); | 13818 world.internalError('cannot have initializers', this.get$span()); |
| 14256 } | 13819 } |
| 14257 Member.prototype.set$initDelegate = function(ctor) { | 13820 Member.prototype.set$initDelegate = function(ctor) { |
| 14258 world.internalError('cannot have initializers', this.get$span()); | 13821 world.internalError('cannot have initializers', this.get$span()); |
| 14259 } | 13822 } |
| 14260 Member.prototype.get$inferredResult = function() { | 13823 Member.prototype.get$inferredResult = function() { |
| 14261 var t = this.get$returnType(); | 13824 var t = this.get$returnType(); |
| 14262 if ($notnull_bool(t.get$isBool()) && ($notnull_bool(this.get$library().get$isC
ore()) || $notnull_bool(this.get$library().get$isCoreImpl()))) { | 13825 if (t.get$isBool() && (this.get$library().get$isCore() || this.get$library().g
et$isCoreImpl())) { |
| 14263 return world.nonNullBool; | 13826 return world.nonNullBool; |
| 14264 } | 13827 } |
| 14265 return (t && t.is$lang_Type()); | 13828 return t; |
| 14266 } | 13829 } |
| 14267 Member.prototype.get$definition = function() { | 13830 Member.prototype.get$definition = function() { |
| 14268 return null; | 13831 return null; |
| 14269 } | 13832 } |
| 14270 Member.prototype.get$parameters = function() { | 13833 Member.prototype.get$parameters = function() { |
| 14271 return []; | 13834 return []; |
| 14272 } | 13835 } |
| 14273 Member.prototype.canInvoke = function(context, args) { | 13836 Member.prototype.canInvoke = function(context, args) { |
| 14274 return $notnull_bool(this.get$canGet()) && $notnull_bool(new Value(this.get$re
turnType(), null, null, true).canInvoke(context, '\$call', args)); | 13837 return this.get$canGet() && new Value(this.get$returnType(), null, null, true)
.canInvoke(context, '\$call', args); |
| 14275 } | 13838 } |
| 14276 Member.prototype.invoke = function(context, node, target, args, isDynamic) { | 13839 Member.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 14277 var $0; | |
| 14278 var newTarget = this._get(context, node, target, isDynamic); | 13840 var newTarget = this._get(context, node, target, isDynamic); |
| 14279 return (($0 = newTarget.invoke$5(context, '\$call', node, args, isDynamic)) &&
$0.is$Value()); | 13841 return newTarget.invoke$5(context, '\$call', node, args, isDynamic); |
| 14280 } | 13842 } |
| 14281 Member.prototype.override = function(other) { | 13843 Member.prototype.override = function(other) { |
| 14282 if ($notnull_bool(this.get$isStatic())) { | 13844 if (this.get$isStatic()) { |
| 14283 world.error('static members can not hide parent members', this.get$span(), o
ther.get$span()); | 13845 world.error('static members can not hide parent members', this.get$span(), o
ther.get$span()); |
| 14284 return false; | 13846 return false; |
| 14285 } | 13847 } |
| 14286 else if ($notnull_bool(other.get$isStatic())) { | 13848 else if (other.get$isStatic()) { |
| 14287 world.error('can not override static member', this.get$span(), other.get$spa
n()); | 13849 world.error('can not override static member', this.get$span(), other.get$spa
n()); |
| 14288 return false; | 13850 return false; |
| 14289 } | 13851 } |
| 14290 return true; | 13852 return true; |
| 14291 } | 13853 } |
| 14292 Member.prototype.get$generatedFactoryName = function() { | 13854 Member.prototype.get$generatedFactoryName = function() { |
| 14293 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 195, 12); | |
| 14294 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo
rName() + '\$'); | 13855 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo
rName() + '\$'); |
| 14295 if (this.name == '') { | 13856 if (this.name == '') { |
| 14296 return ('' + prefix + 'factory'); | 13857 return ('' + prefix + 'factory'); |
| 14297 } | 13858 } |
| 14298 else { | 13859 else { |
| 14299 return ('' + prefix + '' + this.name + '\$factory'); | 13860 return ('' + prefix + '' + this.name + '\$factory'); |
| 14300 } | 13861 } |
| 14301 } | 13862 } |
| 14302 Member.prototype.resolveType = function(node, isRequired) { | 13863 Member.prototype.resolveType = function(node, isRequired) { |
| 14303 var type = this.declaringType.resolveType(node, isRequired); | 13864 var type = this.declaringType.resolveType(node, isRequired); |
| 14304 if ($notnull_bool(this.get$isStatic()) && $notnull_bool(type.get$hasTypeParams
())) { | 13865 if (this.get$isStatic() && type.get$hasTypeParams()) { |
| 14305 world.error('using type parameter in static context', node.span); | 13866 world.error('using type parameter in static context', node.span); |
| 14306 } | 13867 } |
| 14307 return (type && type.is$lang_Type()); | 13868 return type; |
| 14308 } | 13869 } |
| 14309 Member.prototype._get$3 = function($0, $1, $2) { | 13870 Member.prototype._get$3 = function($0, $1, $2) { |
| 14310 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value())); | 13871 return this._get($0, $1, $2); |
| 14311 }; | 13872 }; |
| 14312 Member.prototype._set$4 = function($0, $1, $2, $3) { | 13873 Member.prototype._set$4 = function($0, $1, $2, $3) { |
| 14313 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value())); | 13874 return this._set($0, $1, $2, $3); |
| 14314 }; | 13875 }; |
| 14315 Member.prototype.canInvoke$2 = function($0, $1) { | 13876 Member.prototype.canInvoke$2 = function($0, $1) { |
| 14316 return this.canInvoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$Arguments(
))); | 13877 return this.canInvoke($0, $1); |
| 14317 }; | 13878 }; |
| 14318 Member.prototype.invoke$4 = function($0, $1, $2, $3) { | 13879 Member.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 14319 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); | 13880 return this.invoke($0, $1, $2, $3, false); |
| 14320 }; | 13881 }; |
| 14321 Member.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic) { | 13882 Member.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic) { |
| 14322 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), $assert_bool(isDynamic)); | 13883 return this.invoke($0, $1, $2, $3, isDynamic); |
| 14323 }; | 13884 }; |
| 14324 Member.prototype.invoke$5 = function($0, $1, $2, $3, $4) { | 13885 Member.prototype.invoke$5 = function($0, $1, $2, $3, $4) { |
| 14325 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), $assert_bool($4)); | 13886 return this.invoke($0, $1, $2, $3, $4); |
| 14326 }; | 13887 }; |
| 14327 Member.prototype.provideFieldSyntax$0 = function() { | 13888 Member.prototype.provideFieldSyntax$0 = function() { |
| 14328 return this.provideFieldSyntax(); | 13889 return this.provideFieldSyntax(); |
| 14329 }; | 13890 }; |
| 14330 Member.prototype.providePropertySyntax$0 = function() { | 13891 Member.prototype.providePropertySyntax$0 = function() { |
| 14331 return this.providePropertySyntax(); | 13892 return this.providePropertySyntax(); |
| 14332 }; | 13893 }; |
| 14333 Member.prototype.resolve$1 = function($0) { | 13894 Member.prototype.resolve$1 = function($0) { |
| 14334 return this.resolve(($0 && $0.is$lang_Type())); | 13895 return this.resolve($0); |
| 14335 }; | 13896 }; |
| 14336 // ********** Code for TypeMember ************** | 13897 // ********** Code for TypeMember ************** |
| 14337 function TypeMember(type) { | 13898 function TypeMember(type) { |
| 14338 this.type = type; | 13899 this.type = type; |
| 14339 Member.call(this, type.name, type.library.topType); | 13900 Member.call(this, type.name, type.library.topType); |
| 14340 // Initializers done | 13901 // Initializers done |
| 14341 } | 13902 } |
| 14342 $inherits(TypeMember, Member); | 13903 $inherits(TypeMember, Member); |
| 14343 TypeMember.prototype.is$TypeMember = function(){return this;}; | |
| 14344 TypeMember.prototype.get$type = function() { return this.type; }; | |
| 14345 TypeMember.prototype.get$span = function() { | 13904 TypeMember.prototype.get$span = function() { |
| 14346 return this.type.definition.span; | 13905 return this.type.definition.span; |
| 14347 } | 13906 } |
| 14348 TypeMember.prototype.get$isStatic = function() { | 13907 TypeMember.prototype.get$isStatic = function() { |
| 14349 return true; | 13908 return true; |
| 14350 } | 13909 } |
| 14351 TypeMember.prototype.get$returnType = function() { | 13910 TypeMember.prototype.get$returnType = function() { |
| 14352 return world.varType; | 13911 return world.varType; |
| 14353 } | 13912 } |
| 14354 TypeMember.prototype.canInvoke = function(context, args) { | 13913 TypeMember.prototype.canInvoke = function(context, args) { |
| 14355 return false; | 13914 return false; |
| 14356 } | 13915 } |
| 14357 TypeMember.prototype.get$canGet = function() { | 13916 TypeMember.prototype.get$canGet = function() { |
| 14358 return true; | 13917 return true; |
| 14359 } | 13918 } |
| 14360 TypeMember.prototype.get$canSet = function() { | 13919 TypeMember.prototype.get$canSet = function() { |
| 14361 return false; | 13920 return false; |
| 14362 } | 13921 } |
| 14363 TypeMember.prototype.resolve = function(inType) { | 13922 TypeMember.prototype.resolve = function(inType) { |
| 14364 | 13923 |
| 14365 } | 13924 } |
| 14366 TypeMember.prototype._get = function(context, node, target, isDynamic) { | 13925 TypeMember.prototype._get = function(context, node, target, isDynamic) { |
| 14367 var ret = new Value(this.type, this.type.get$jsname(), node.span, false); | 13926 var ret = new Value(this.type, this.type.get$jsname(), node.span, false); |
| 14368 ret.isType = true; | 13927 ret.isType = true; |
| 14369 return (ret && ret.is$Value()); | 13928 return ret; |
| 14370 } | 13929 } |
| 14371 TypeMember.prototype._set = function(context, node, target, value, isDynamic) { | 13930 TypeMember.prototype._set = function(context, node, target, value, isDynamic) { |
| 14372 world.error('can not set type', this.type.definition.span); | 13931 world.error('can not set type', this.type.definition.span); |
| 14373 } | 13932 } |
| 14374 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { | 13933 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 14375 world.error('can not invoke type', this.type.definition.span); | 13934 world.error('can not invoke type', this.type.definition.span); |
| 14376 } | 13935 } |
| 14377 TypeMember.prototype._get$3 = function($0, $1, $2) { | 13936 TypeMember.prototype._get$3 = function($0, $1, $2) { |
| 14378 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 13937 return this._get($0, $1, $2, false); |
| 14379 }; | 13938 }; |
| 14380 TypeMember.prototype._set$4 = function($0, $1, $2, $3) { | 13939 TypeMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 14381 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); | 13940 return this._set($0, $1, $2, $3, false); |
| 14382 }; | 13941 }; |
| 14383 TypeMember.prototype.canInvoke$2 = function($0, $1) { | 13942 TypeMember.prototype.canInvoke$2 = function($0, $1) { |
| 14384 return this.canInvoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$Arguments(
))); | 13943 return this.canInvoke($0, $1); |
| 14385 }; | 13944 }; |
| 14386 TypeMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 13945 TypeMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 14387 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); | 13946 return this.invoke($0, $1, $2, $3, false); |
| 14388 }; | 13947 }; |
| 14389 TypeMember.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic) { | 13948 TypeMember.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic) { |
| 14390 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), $assert_bool(isDynamic)); | 13949 return this.invoke($0, $1, $2, $3, isDynamic); |
| 14391 }; | 13950 }; |
| 14392 TypeMember.prototype.invoke$5 = function($0, $1, $2, $3, $4) { | 13951 TypeMember.prototype.invoke$5 = function($0, $1, $2, $3, $4) { |
| 14393 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), $assert_bool($4)); | 13952 return this.invoke($0, $1, $2, $3, $4); |
| 14394 }; | 13953 }; |
| 14395 TypeMember.prototype.resolve$1 = function($0) { | 13954 TypeMember.prototype.resolve$1 = function($0) { |
| 14396 return this.resolve(($0 && $0.is$lang_Type())); | 13955 return this.resolve($0); |
| 14397 }; | 13956 }; |
| 14398 // ********** Code for FieldMember ************** | 13957 // ********** Code for FieldMember ************** |
| 14399 function FieldMember(name, declaringType, definition, value) { | 13958 function FieldMember(name, declaringType, definition, value) { |
| 14400 this._providePropertySyntax = false | 13959 this._providePropertySyntax = false |
| 14401 this._computing = false | 13960 this._computing = false |
| 14402 this.definition = definition; | 13961 this.definition = definition; |
| 14403 this.value = value; | 13962 this.value = value; |
| 14404 this.isNative = false; | 13963 this.isNative = false; |
| 14405 Member.call(this, name, declaringType); | 13964 Member.call(this, name, declaringType); |
| 14406 // Initializers done | 13965 // Initializers done |
| 14407 } | 13966 } |
| 14408 $inherits(FieldMember, Member); | 13967 $inherits(FieldMember, Member); |
| 14409 FieldMember.prototype.is$FieldMember = function(){return this;}; | |
| 14410 FieldMember.prototype.get$definition = function() { return this.definition; }; | 13968 FieldMember.prototype.get$definition = function() { return this.definition; }; |
| 14411 FieldMember.prototype.get$value = function() { return this.value; }; | 13969 FieldMember.prototype.get$value = function() { return this.value; }; |
| 14412 FieldMember.prototype.get$type = function() { return this.type; }; | |
| 14413 FieldMember.prototype.set$type = function(value) { return this.type = value; }; | |
| 14414 FieldMember.prototype.get$isStatic = function() { return this.isStatic; }; | 13970 FieldMember.prototype.get$isStatic = function() { return this.isStatic; }; |
| 14415 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va
lue; }; | 13971 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va
lue; }; |
| 14416 FieldMember.prototype.get$isNative = function() { return this.isNative; }; | 13972 FieldMember.prototype.get$isNative = function() { return this.isNative; }; |
| 14417 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va
lue; }; | 13973 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va
lue; }; |
| 14418 FieldMember.prototype.override = function(other) { | 13974 FieldMember.prototype.override = function(other) { |
| 14419 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false; | 13975 if (!Member.prototype.override.call(this, other)) return false; |
| 14420 if ($notnull_bool(other.get$isProperty())) { | 13976 if (other.get$isProperty()) { |
| 14421 return true; | 13977 return true; |
| 14422 } | 13978 } |
| 14423 else { | 13979 else { |
| 14424 world.error('field can not override anything but property', this.get$span(),
other.get$span()); | 13980 world.error('field can not override anything but property', this.get$span(),
other.get$span()); |
| 14425 return false; | 13981 return false; |
| 14426 } | 13982 } |
| 14427 } | 13983 } |
| 14428 FieldMember.prototype.get$prefersPropertySyntax = function() { | 13984 FieldMember.prototype.get$prefersPropertySyntax = function() { |
| 14429 return false; | 13985 return false; |
| 14430 } | 13986 } |
| 14431 FieldMember.prototype.get$requiresFieldSyntax = function() { | 13987 FieldMember.prototype.get$requiresFieldSyntax = function() { |
| 14432 return this.isNative; | 13988 return this.isNative; |
| 14433 } | 13989 } |
| 14434 FieldMember.prototype.provideFieldSyntax = function() { | 13990 FieldMember.prototype.provideFieldSyntax = function() { |
| 14435 | 13991 |
| 14436 } | 13992 } |
| 14437 FieldMember.prototype.providePropertySyntax = function() { | 13993 FieldMember.prototype.providePropertySyntax = function() { |
| 14438 this._providePropertySyntax = true; | 13994 this._providePropertySyntax = true; |
| 14439 } | 13995 } |
| 14440 FieldMember.prototype.get$span = function() { | 13996 FieldMember.prototype.get$span = function() { |
| 14441 var $0; | 13997 return this.definition == null ? null : this.definition.span; |
| 14442 return (($0 = this.definition == null ? null : this.definition.span) && $0.is$
SourceSpan()); | |
| 14443 } | 13998 } |
| 14444 FieldMember.prototype.get$returnType = function() { | 13999 FieldMember.prototype.get$returnType = function() { |
| 14445 return this.type; | 14000 return this.type; |
| 14446 } | 14001 } |
| 14447 FieldMember.prototype.get$canGet = function() { | 14002 FieldMember.prototype.get$canGet = function() { |
| 14448 return true; | 14003 return true; |
| 14449 } | 14004 } |
| 14450 FieldMember.prototype.get$canSet = function() { | 14005 FieldMember.prototype.get$canSet = function() { |
| 14451 return !$notnull_bool(this.isFinal); | 14006 return !this.isFinal; |
| 14452 } | 14007 } |
| 14453 FieldMember.prototype.get$isField = function() { | 14008 FieldMember.prototype.get$isField = function() { |
| 14454 return true; | 14009 return true; |
| 14455 } | 14010 } |
| 14456 FieldMember.prototype.resolve = function(inType) { | 14011 FieldMember.prototype.resolve = function(inType) { |
| 14457 this.isStatic = this.declaringType.get$isTop(); | 14012 this.isStatic = this.declaringType.get$isTop(); |
| 14458 this.isFinal = false; | 14013 this.isFinal = false; |
| 14459 if (this.definition.modifiers != null) { | 14014 if (this.definition.modifiers != null) { |
| 14460 var $list = this.definition.modifiers; | 14015 var $list = this.definition.modifiers; |
| 14461 for (var $i = 0;$i < $list.length; $i++) { | 14016 for (var $i = 0;$i < $list.length; $i++) { |
| 14462 var mod = $list.$index($i); | 14017 var mod = $list.$index($i); |
| 14463 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { | 14018 if ($eq(mod.kind, 86/*TokenKind.STATIC*/)) { |
| 14464 if ($notnull_bool(this.isStatic)) { | 14019 if (this.isStatic) { |
| 14465 world.error('duplicate static modifier', mod.get$span()); | 14020 world.error('duplicate static modifier', mod.get$span()); |
| 14466 } | 14021 } |
| 14467 this.isStatic = true; | 14022 this.isStatic = true; |
| 14468 } | 14023 } |
| 14469 else if ($notnull_bool($eq(mod.kind, 97/*TokenKind.FINAL*/))) { | 14024 else if ($eq(mod.kind, 97/*TokenKind.FINAL*/)) { |
| 14470 if ($notnull_bool(this.isFinal)) { | 14025 if (this.isFinal) { |
| 14471 world.error('duplicate final modifier', mod.get$span()); | 14026 world.error('duplicate final modifier', mod.get$span()); |
| 14472 } | 14027 } |
| 14473 this.isFinal = true; | 14028 this.isFinal = true; |
| 14474 } | 14029 } |
| 14475 else { | 14030 else { |
| 14476 world.error(('' + mod + ' modifier not allowed on field'), mod.get$span(
)); | 14031 world.error(('' + mod + ' modifier not allowed on field'), mod.get$span(
)); |
| 14477 } | 14032 } |
| 14478 } | 14033 } |
| 14479 } | 14034 } |
| 14480 this.type = inType.resolveType(this.definition.type, false); | 14035 this.type = inType.resolveType(this.definition.type, false); |
| 14481 if ($notnull_bool(this.isStatic) && $notnull_bool(this.type.get$hasTypeParams(
))) { | 14036 if (this.isStatic && this.type.get$hasTypeParams()) { |
| 14482 world.error('using type parameter in static context', this.definition.type.s
pan); | 14037 world.error('using type parameter in static context', this.definition.type.s
pan); |
| 14483 } | 14038 } |
| 14484 if ($notnull_bool(this.isStatic) && $notnull_bool(this.isFinal) && this.value
== null) { | 14039 if (this.isStatic && this.isFinal && this.value == null) { |
| 14485 world.error('static final field is missing initializer', this.get$span()); | 14040 world.error('static final field is missing initializer', this.get$span()); |
| 14486 } | 14041 } |
| 14487 this.get$library()._addMember(this); | 14042 this.get$library()._addMember(this); |
| 14488 } | 14043 } |
| 14489 FieldMember.prototype.computeValue = function() { | 14044 FieldMember.prototype.computeValue = function() { |
| 14490 var $0; | |
| 14491 if (this.value == null) return null; | 14045 if (this.value == null) return null; |
| 14492 if (this._computedValue == null) { | 14046 if (this._computedValue == null) { |
| 14493 if ($notnull_bool(this._computing)) { | 14047 if (this._computing) { |
| 14494 world.error('circular reference', this.value.span); | 14048 world.error('circular reference', this.value.span); |
| 14495 return null; | 14049 return null; |
| 14496 } | 14050 } |
| 14497 this._computing = true; | 14051 this._computing = true; |
| 14498 var finalMethod = new MethodMember('final_context', this.declaringType, null
); | 14052 var finalMethod = new MethodMember('final_context', this.declaringType, null
); |
| 14499 finalMethod.isStatic = true; | 14053 finalMethod.isStatic = true; |
| 14500 var finalGen = new MethodGenerator(finalMethod, null); | 14054 var finalGen = new MethodGenerator(finalMethod, null); |
| 14501 this._computedValue = (($0 = this.value.visit((finalGen && finalGen.is$TreeV
isitor()))) && $0.is$Value()); | 14055 this._computedValue = this.value.visit(finalGen); |
| 14502 if (!$notnull_bool(this._computedValue.get$isConst())) { | 14056 if (!this._computedValue.get$isConst()) { |
| 14503 if ($notnull_bool(this.isStatic)) { | 14057 if (this.isStatic) { |
| 14504 world.error('non constant static field must be initialized in functions'
, this.value.span); | 14058 world.error('non constant static field must be initialized in functions'
, this.value.span); |
| 14505 } | 14059 } |
| 14506 else { | 14060 else { |
| 14507 world.error('non constant field must be initialized in constructor', thi
s.value.span); | 14061 world.error('non constant field must be initialized in constructor', thi
s.value.span); |
| 14508 } | 14062 } |
| 14509 } | 14063 } |
| 14510 if ($notnull_bool(this.isStatic)) { | 14064 if (this.isStatic) { |
| 14511 this._computedValue = world.gen.globalForStaticField(this, this._computedV
alue, [this._computedValue]); | 14065 this._computedValue = world.gen.globalForStaticField(this, this._computedV
alue, [this._computedValue]); |
| 14512 } | 14066 } |
| 14513 this._computing = false; | 14067 this._computing = false; |
| 14514 } | 14068 } |
| 14515 return this._computedValue; | 14069 return this._computedValue; |
| 14516 } | 14070 } |
| 14517 FieldMember.prototype._get = function(context, node, target, isDynamic) { | 14071 FieldMember.prototype._get = function(context, node, target, isDynamic) { |
| 14518 var $0; | 14072 if (!isDynamic) { |
| 14519 if (!$notnull_bool(isDynamic)) { | |
| 14520 this.declaringType.markUsed(); | 14073 this.declaringType.markUsed(); |
| 14521 } | 14074 } |
| 14522 if ($notnull_bool(this.isStatic)) { | 14075 if (this.isStatic) { |
| 14523 var cv = this.computeValue(); | 14076 var cv = this.computeValue(); |
| 14524 if ($notnull_bool(this.isFinal)) { | 14077 if (this.isFinal) { |
| 14525 return (cv && cv.is$Value()); | 14078 return cv; |
| 14526 } | 14079 } |
| 14527 if ($notnull_bool(this.declaringType.get$isTop())) { | 14080 if (this.declaringType.get$isTop()) { |
| 14528 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, true
); | 14081 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, true
); |
| 14529 } | 14082 } |
| 14530 else { | 14083 else { |
| 14531 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' +
this.get$jsname() + ''), node.span, true); | 14084 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' +
this.get$jsname() + ''), node.span, true); |
| 14532 } | 14085 } |
| 14533 } | 14086 } |
| 14534 else if ($notnull_bool(target.get$isConst()) && $notnull_bool(this.isFinal)) { | 14087 else if (target.get$isConst() && this.isFinal) { |
| 14535 var constTarget = (target instanceof GlobalValue) ? target.get$dynamic().exp
: target; | 14088 var constTarget = (target instanceof GlobalValue) ? target.get$dynamic().exp
: target; |
| 14536 if ((constTarget instanceof ConstObjectValue)) { | 14089 if ((constTarget instanceof ConstObjectValue)) { |
| 14537 return (($0 = constTarget.fields.$index(this.name)) && $0.is$Value()); | 14090 return constTarget.fields.$index(this.name); |
| 14538 } | 14091 } |
| 14539 else if ($notnull_bool($eq(constTarget.type, world.stringType)) && this.name
== 'length') { | 14092 else if ($eq(constTarget.type, world.stringType) && this.name == 'length') { |
| 14540 return new Value(this.type, ('' + constTarget.get$actualValue().length + '
'), node.span, true); | 14093 return new Value(this.type, ('' + constTarget.get$actualValue().length + '
'), node.span, true); |
| 14541 } | 14094 } |
| 14542 } | 14095 } |
| 14543 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''),
node.span, true); | 14096 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''),
node.span, true); |
| 14544 } | 14097 } |
| 14545 FieldMember.prototype._set = function(context, node, target, value, isDynamic) { | 14098 FieldMember.prototype._set = function(context, node, target, value, isDynamic) { |
| 14546 var lhs = this._get(context, node, target, isDynamic); | 14099 var lhs = this._get(context, node, target, isDynamic); |
| 14547 value = value.convertTo(context, this.type, node, isDynamic); | 14100 value = value.convertTo(context, this.type, node, isDynamic); |
| 14548 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), node.sp
an, true); | 14101 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), node.sp
an, true); |
| 14549 } | 14102 } |
| 14550 FieldMember.prototype._get$3 = function($0, $1, $2) { | 14103 FieldMember.prototype._get$3 = function($0, $1, $2) { |
| 14551 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 14104 return this._get($0, $1, $2, false); |
| 14552 }; | 14105 }; |
| 14553 FieldMember.prototype._set$4 = function($0, $1, $2, $3) { | 14106 FieldMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 14554 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); | 14107 return this._set($0, $1, $2, $3, false); |
| 14555 }; | 14108 }; |
| 14556 FieldMember.prototype.computeValue$0 = function() { | 14109 FieldMember.prototype.computeValue$0 = function() { |
| 14557 return this.computeValue(); | 14110 return this.computeValue(); |
| 14558 }; | 14111 }; |
| 14559 FieldMember.prototype.provideFieldSyntax$0 = function() { | 14112 FieldMember.prototype.provideFieldSyntax$0 = function() { |
| 14560 return this.provideFieldSyntax(); | 14113 return this.provideFieldSyntax(); |
| 14561 }; | 14114 }; |
| 14562 FieldMember.prototype.providePropertySyntax$0 = function() { | 14115 FieldMember.prototype.providePropertySyntax$0 = function() { |
| 14563 return this.providePropertySyntax(); | 14116 return this.providePropertySyntax(); |
| 14564 }; | 14117 }; |
| 14565 FieldMember.prototype.resolve$1 = function($0) { | 14118 FieldMember.prototype.resolve$1 = function($0) { |
| 14566 return this.resolve(($0 && $0.is$lang_Type())); | 14119 return this.resolve($0); |
| 14567 }; | 14120 }; |
| 14568 // ********** Code for PropertyMember ************** | 14121 // ********** Code for PropertyMember ************** |
| 14569 function PropertyMember(name, declaringType) { | 14122 function PropertyMember(name, declaringType) { |
| 14570 this._provideFieldSyntax = false | 14123 this._provideFieldSyntax = false |
| 14571 Member.call(this, name, declaringType); | 14124 Member.call(this, name, declaringType); |
| 14572 // Initializers done | 14125 // Initializers done |
| 14573 } | 14126 } |
| 14574 $inherits(PropertyMember, Member); | 14127 $inherits(PropertyMember, Member); |
| 14575 PropertyMember.prototype.is$PropertyMember = function(){return this;}; | |
| 14576 PropertyMember.prototype.get$span = function() { | 14128 PropertyMember.prototype.get$span = function() { |
| 14577 var $0; | 14129 return this.getter != null ? this.getter.get$span() : null; |
| 14578 return (($0 = this.getter != null ? this.getter.get$span() : null) && $0.is$So
urceSpan()); | |
| 14579 } | 14130 } |
| 14580 PropertyMember.prototype.get$canGet = function() { | 14131 PropertyMember.prototype.get$canGet = function() { |
| 14581 return this.getter != null; | 14132 return this.getter != null; |
| 14582 } | 14133 } |
| 14583 PropertyMember.prototype.get$canSet = function() { | 14134 PropertyMember.prototype.get$canSet = function() { |
| 14584 return this.setter != null; | 14135 return this.setter != null; |
| 14585 } | 14136 } |
| 14586 PropertyMember.prototype.get$prefersPropertySyntax = function() { | 14137 PropertyMember.prototype.get$prefersPropertySyntax = function() { |
| 14587 return true; | 14138 return true; |
| 14588 } | 14139 } |
| 14589 PropertyMember.prototype.get$requiresFieldSyntax = function() { | 14140 PropertyMember.prototype.get$requiresFieldSyntax = function() { |
| 14590 return false; | 14141 return false; |
| 14591 } | 14142 } |
| 14592 PropertyMember.prototype.provideFieldSyntax = function() { | 14143 PropertyMember.prototype.provideFieldSyntax = function() { |
| 14593 this._provideFieldSyntax = true; | 14144 this._provideFieldSyntax = true; |
| 14594 } | 14145 } |
| 14595 PropertyMember.prototype.providePropertySyntax = function() { | 14146 PropertyMember.prototype.providePropertySyntax = function() { |
| 14596 | 14147 |
| 14597 } | 14148 } |
| 14598 PropertyMember.prototype.get$isStatic = function() { | 14149 PropertyMember.prototype.get$isStatic = function() { |
| 14599 return this.getter == null ? this.setter.isStatic : this.getter.isStatic; | 14150 return this.getter == null ? this.setter.isStatic : this.getter.isStatic; |
| 14600 } | 14151 } |
| 14601 PropertyMember.prototype.get$isProperty = function() { | 14152 PropertyMember.prototype.get$isProperty = function() { |
| 14602 return true; | 14153 return true; |
| 14603 } | 14154 } |
| 14604 PropertyMember.prototype.get$returnType = function() { | 14155 PropertyMember.prototype.get$returnType = function() { |
| 14605 return this.getter == null ? this.setter.returnType : this.getter.returnType; | 14156 return this.getter == null ? this.setter.returnType : this.getter.returnType; |
| 14606 } | 14157 } |
| 14607 PropertyMember.prototype.override = function(other) { | 14158 PropertyMember.prototype.override = function(other) { |
| 14608 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false; | 14159 if (!Member.prototype.override.call(this, other)) return false; |
| 14609 if ($notnull_bool(other.get$isProperty()) || $notnull_bool(other.get$isField()
)) { | 14160 if (other.get$isProperty() || other.get$isField()) { |
| 14610 if ($notnull_bool(other.get$isProperty())) this.addFromParent(other); | 14161 if (other.get$isProperty()) this.addFromParent(other); |
| 14611 else this._overriddenField = other; | 14162 else this._overriddenField = other; |
| 14612 return true; | 14163 return true; |
| 14613 } | 14164 } |
| 14614 else { | 14165 else { |
| 14615 world.error('property can only override field or property', this.get$span(),
other.get$span()); | 14166 world.error('property can only override field or property', this.get$span(),
other.get$span()); |
| 14616 return false; | 14167 return false; |
| 14617 } | 14168 } |
| 14618 } | 14169 } |
| 14619 PropertyMember.prototype._get = function(context, node, target, isDynamic) { | 14170 PropertyMember.prototype._get = function(context, node, target, isDynamic) { |
| 14620 if (this.getter == null) { | 14171 if (this.getter == null) { |
| 14621 if (this._overriddenField != null) { | 14172 if (this._overriddenField != null) { |
| 14622 return this._overriddenField._get(context, node, target, isDynamic); | 14173 return this._overriddenField._get(context, node, target, isDynamic); |
| 14623 } | 14174 } |
| 14624 return target.invokeNoSuchMethod(context, ('get:' + this.name + ''), node); | 14175 return target.invokeNoSuchMethod(context, ('get:' + this.name + ''), node); |
| 14625 } | 14176 } |
| 14626 return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), false)
; | 14177 return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), false)
; |
| 14627 } | 14178 } |
| 14628 PropertyMember.prototype._set = function(context, node, target, value, isDynamic
) { | 14179 PropertyMember.prototype._set = function(context, node, target, value, isDynamic
) { |
| 14629 if (this.setter == null) { | 14180 if (this.setter == null) { |
| 14630 if (this._overriddenField != null) { | 14181 if (this._overriddenField != null) { |
| 14631 return this._overriddenField._set(context, node, target, value, isDynamic)
; | 14182 return this._overriddenField._set(context, node, target, value, isDynamic)
; |
| 14632 } | 14183 } |
| 14633 return target.invokeNoSuchMethod(context, ('set:' + this.name + ''), node, n
ew Arguments(null, [value])); | 14184 return target.invokeNoSuchMethod(context, ('set:' + this.name + ''), node, n
ew Arguments(null, [value])); |
| 14634 } | 14185 } |
| 14635 return this.setter.invoke(context, node, target, new Arguments(null, [value]),
isDynamic); | 14186 return this.setter.invoke(context, node, target, new Arguments(null, [value]),
isDynamic); |
| 14636 } | 14187 } |
| 14637 PropertyMember.prototype.addFromParent = function(parentMember) { | 14188 PropertyMember.prototype.addFromParent = function(parentMember) { |
| 14638 var $0; | |
| 14639 var parent; | 14189 var parent; |
| 14640 if ((parentMember instanceof ConcreteMember)) { | 14190 if ((parentMember instanceof ConcreteMember)) { |
| 14641 var c = (parentMember && parentMember.is$ConcreteMember()); | 14191 var c = parentMember; |
| 14642 parent = (($0 = c.baseMember) && $0.is$PropertyMember()); | 14192 parent = c.baseMember; |
| 14643 } | 14193 } |
| 14644 else { | 14194 else { |
| 14645 parent = (parentMember && parentMember.is$PropertyMember()); | 14195 parent = parentMember; |
| 14646 } | 14196 } |
| 14647 if (this.getter == null) this.getter = parent.getter; | 14197 if (this.getter == null) this.getter = parent.getter; |
| 14648 if (this.setter == null) this.setter = parent.setter; | 14198 if (this.setter == null) this.setter = parent.setter; |
| 14649 } | 14199 } |
| 14650 PropertyMember.prototype.resolve = function(inType) { | 14200 PropertyMember.prototype.resolve = function(inType) { |
| 14651 if (this.getter != null) this.getter.resolve(inType); | 14201 if (this.getter != null) this.getter.resolve(inType); |
| 14652 if (this.setter != null) this.setter.resolve(inType); | 14202 if (this.setter != null) this.setter.resolve(inType); |
| 14653 this.get$library()._addMember(this); | 14203 this.get$library()._addMember(this); |
| 14654 } | 14204 } |
| 14655 PropertyMember.prototype._get$3 = function($0, $1, $2) { | 14205 PropertyMember.prototype._get$3 = function($0, $1, $2) { |
| 14656 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 14206 return this._get($0, $1, $2, false); |
| 14657 }; | 14207 }; |
| 14658 PropertyMember.prototype._set$4 = function($0, $1, $2, $3) { | 14208 PropertyMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 14659 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); | 14209 return this._set($0, $1, $2, $3, false); |
| 14660 }; | 14210 }; |
| 14661 PropertyMember.prototype.provideFieldSyntax$0 = function() { | 14211 PropertyMember.prototype.provideFieldSyntax$0 = function() { |
| 14662 return this.provideFieldSyntax(); | 14212 return this.provideFieldSyntax(); |
| 14663 }; | 14213 }; |
| 14664 PropertyMember.prototype.providePropertySyntax$0 = function() { | 14214 PropertyMember.prototype.providePropertySyntax$0 = function() { |
| 14665 return this.providePropertySyntax(); | 14215 return this.providePropertySyntax(); |
| 14666 }; | 14216 }; |
| 14667 PropertyMember.prototype.resolve$1 = function($0) { | 14217 PropertyMember.prototype.resolve$1 = function($0) { |
| 14668 return this.resolve(($0 && $0.is$lang_Type())); | 14218 return this.resolve($0); |
| 14669 }; | 14219 }; |
| 14670 // ********** Code for ConcreteMember ************** | 14220 // ********** Code for ConcreteMember ************** |
| 14671 function ConcreteMember(name, declaringType, baseMember) { | 14221 function ConcreteMember(name, declaringType, baseMember) { |
| 14672 this.baseMember = baseMember; | 14222 this.baseMember = baseMember; |
| 14673 Member.call(this, name, declaringType); | 14223 Member.call(this, name, declaringType); |
| 14674 // Initializers done | 14224 // Initializers done |
| 14675 this.parameters = []; | 14225 this.parameters = []; |
| 14676 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring
Type); | 14226 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring
Type); |
| 14677 var $list = this.baseMember.get$parameters(); | 14227 var $list = this.baseMember.get$parameters(); |
| 14678 for (var $i = 0;$i < $list.length; $i++) { | 14228 for (var $i = 0;$i < $list.length; $i++) { |
| 14679 var p = $list.$index($i); | 14229 var p = $list.$index($i); |
| 14680 var newType = p.type.resolveTypeParams$1(declaringType); | 14230 var newType = p.type.resolveTypeParams$1(declaringType); |
| 14681 if ($notnull_bool($ne(newType, p.type))) { | 14231 if ($ne(newType, p.type)) { |
| 14682 this.parameters.add(p.copyWithNewType$1(newType)); | 14232 this.parameters.add(p.copyWithNewType$1(newType)); |
| 14683 } | 14233 } |
| 14684 else { | 14234 else { |
| 14685 this.parameters.add(p); | 14235 this.parameters.add(p); |
| 14686 } | 14236 } |
| 14687 } | 14237 } |
| 14688 } | 14238 } |
| 14689 $inherits(ConcreteMember, Member); | 14239 $inherits(ConcreteMember, Member); |
| 14690 ConcreteMember.prototype.is$ConcreteMember = function(){return this;}; | |
| 14691 ConcreteMember.prototype.get$returnType = function() { return this.returnType; }
; | 14240 ConcreteMember.prototype.get$returnType = function() { return this.returnType; }
; |
| 14692 ConcreteMember.prototype.set$returnType = function(value) { return this.returnTy
pe = value; }; | 14241 ConcreteMember.prototype.set$returnType = function(value) { return this.returnTy
pe = value; }; |
| 14693 ConcreteMember.prototype.get$parameters = function() { return this.parameters; }
; | 14242 ConcreteMember.prototype.get$parameters = function() { return this.parameters; }
; |
| 14694 ConcreteMember.prototype.set$parameters = function(value) { return this.paramete
rs = value; }; | 14243 ConcreteMember.prototype.set$parameters = function(value) { return this.paramete
rs = value; }; |
| 14695 ConcreteMember.prototype.get$span = function() { | 14244 ConcreteMember.prototype.get$span = function() { |
| 14696 return this.baseMember.get$span(); | 14245 return this.baseMember.get$span(); |
| 14697 } | 14246 } |
| 14698 ConcreteMember.prototype.get$isStatic = function() { | 14247 ConcreteMember.prototype.get$isStatic = function() { |
| 14699 return this.baseMember.get$isStatic(); | 14248 return this.baseMember.get$isStatic(); |
| 14700 } | 14249 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14743 ConcreteMember.prototype.providePropertySyntax = function() { | 14292 ConcreteMember.prototype.providePropertySyntax = function() { |
| 14744 return this.baseMember.providePropertySyntax(); | 14293 return this.baseMember.providePropertySyntax(); |
| 14745 } | 14294 } |
| 14746 ConcreteMember.prototype.get$isConstructor = function() { | 14295 ConcreteMember.prototype.get$isConstructor = function() { |
| 14747 return this.name == this.declaringType.name; | 14296 return this.name == this.declaringType.name; |
| 14748 } | 14297 } |
| 14749 ConcreteMember.prototype.get$constructorName = function() { | 14298 ConcreteMember.prototype.get$constructorName = function() { |
| 14750 return this.baseMember.get$constructorName(); | 14299 return this.baseMember.get$constructorName(); |
| 14751 } | 14300 } |
| 14752 ConcreteMember.prototype.get$definition = function() { | 14301 ConcreteMember.prototype.get$definition = function() { |
| 14753 var $0; | 14302 return this.baseMember.get$definition(); |
| 14754 return (($0 = this.baseMember.get$definition()) && $0.is$Definition()); | |
| 14755 } | 14303 } |
| 14756 ConcreteMember.prototype.get$initDelegate = function() { | 14304 ConcreteMember.prototype.get$initDelegate = function() { |
| 14757 var $0; | 14305 return this.baseMember.get$initDelegate(); |
| 14758 return (($0 = this.baseMember.get$initDelegate()) && $0.is$Definition()); | |
| 14759 } | 14306 } |
| 14760 ConcreteMember.prototype.set$initDelegate = function(ctor) { | 14307 ConcreteMember.prototype.set$initDelegate = function(ctor) { |
| 14761 this.baseMember.set$initDelegate(ctor); | 14308 this.baseMember.set$initDelegate(ctor); |
| 14762 } | 14309 } |
| 14763 ConcreteMember.prototype.resolveType = function(node, isRequired) { | 14310 ConcreteMember.prototype.resolveType = function(node, isRequired) { |
| 14764 var $0; | |
| 14765 var type = this.baseMember.resolveType(node, isRequired); | 14311 var type = this.baseMember.resolveType(node, isRequired); |
| 14766 return (($0 = type.resolveTypeParams$1(this.declaringType)) && $0.is$lang_Type
()); | 14312 return type.resolveTypeParams$1(this.declaringType); |
| 14767 } | 14313 } |
| 14768 ConcreteMember.prototype.override = function(other) { | 14314 ConcreteMember.prototype.override = function(other) { |
| 14769 return this.baseMember.override(other); | 14315 return this.baseMember.override(other); |
| 14770 } | 14316 } |
| 14771 ConcreteMember.prototype._get = function(context, node, target, isDynamic) { | 14317 ConcreteMember.prototype._get = function(context, node, target, isDynamic) { |
| 14772 var ret = this.baseMember._get(context, node, target, isDynamic); | 14318 var ret = this.baseMember._get(context, node, target, isDynamic); |
| 14773 return new Value(this.get$inferredResult(), ret.code, node.span, true); | 14319 return new Value(this.get$inferredResult(), ret.code, node.span, true); |
| 14774 } | 14320 } |
| 14775 ConcreteMember.prototype._set = function(context, node, target, value, isDynamic
) { | 14321 ConcreteMember.prototype._set = function(context, node, target, value, isDynamic
) { |
| 14776 var ret = this.baseMember._set(context, node, target, value, isDynamic); | 14322 var ret = this.baseMember._set(context, node, target, value, isDynamic); |
| 14777 return new Value(this.returnType, ret.code, node.span, true); | 14323 return new Value(this.returnType, ret.code, node.span, true); |
| 14778 } | 14324 } |
| 14779 ConcreteMember.prototype.invoke = function(context, node, target, args, isDynami
c) { | 14325 ConcreteMember.prototype.invoke = function(context, node, target, args, isDynami
c) { |
| 14780 var ret = this.baseMember.invoke(context, node, target, args, isDynamic); | 14326 var ret = this.baseMember.invoke(context, node, target, args, isDynamic); |
| 14781 var code = ret.code; | 14327 var code = ret.code; |
| 14782 if ($notnull_bool(this.get$isConstructor())) { | 14328 if (this.get$isConstructor()) { |
| 14783 code = code.replaceFirst$2(this.declaringType.get$genericType().get$jsname()
, this.declaringType.get$jsname()); | 14329 code = code.replaceFirst$2(this.declaringType.get$genericType().get$jsname()
, this.declaringType.get$jsname()); |
| 14784 } | 14330 } |
| 14785 this.declaringType.genMethod(this); | 14331 this.declaringType.genMethod(this); |
| 14786 return new Value(this.get$inferredResult(), code, node.span, true); | 14332 return new Value(this.get$inferredResult(), code, node.span, true); |
| 14787 } | 14333 } |
| 14788 ConcreteMember.prototype._get$3 = function($0, $1, $2) { | 14334 ConcreteMember.prototype._get$3 = function($0, $1, $2) { |
| 14789 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 14335 return this._get($0, $1, $2, false); |
| 14790 }; | 14336 }; |
| 14791 ConcreteMember.prototype._set$4 = function($0, $1, $2, $3) { | 14337 ConcreteMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 14792 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); | 14338 return this._set($0, $1, $2, $3, false); |
| 14793 }; | 14339 }; |
| 14794 ConcreteMember.prototype.canInvoke$2 = function($0, $1) { | 14340 ConcreteMember.prototype.canInvoke$2 = function($0, $1) { |
| 14795 return this.canInvoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$Arguments(
))); | 14341 return this.canInvoke($0, $1); |
| 14796 }; | 14342 }; |
| 14797 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 14343 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 14798 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); | 14344 return this.invoke($0, $1, $2, $3, false); |
| 14799 }; | 14345 }; |
| 14800 ConcreteMember.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic
) { | 14346 ConcreteMember.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic
) { |
| 14801 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), $assert_bool(isDynamic)); | 14347 return this.invoke($0, $1, $2, $3, isDynamic); |
| 14802 }; | 14348 }; |
| 14803 ConcreteMember.prototype.invoke$5 = function($0, $1, $2, $3, $4) { | 14349 ConcreteMember.prototype.invoke$5 = function($0, $1, $2, $3, $4) { |
| 14804 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), $assert_bool($4)); | 14350 return this.invoke($0, $1, $2, $3, $4); |
| 14805 }; | 14351 }; |
| 14806 ConcreteMember.prototype.provideFieldSyntax$0 = function() { | 14352 ConcreteMember.prototype.provideFieldSyntax$0 = function() { |
| 14807 return this.provideFieldSyntax(); | 14353 return this.provideFieldSyntax(); |
| 14808 }; | 14354 }; |
| 14809 ConcreteMember.prototype.providePropertySyntax$0 = function() { | 14355 ConcreteMember.prototype.providePropertySyntax$0 = function() { |
| 14810 return this.providePropertySyntax(); | 14356 return this.providePropertySyntax(); |
| 14811 }; | 14357 }; |
| 14812 // ********** Code for MethodMember ************** | 14358 // ********** Code for MethodMember ************** |
| 14813 function MethodMember(name, declaringType, definition) { | 14359 function MethodMember(name, declaringType, definition) { |
| 14814 this.isStatic = false | 14360 this.isStatic = false |
| 14815 this.isAbstract = false | 14361 this.isAbstract = false |
| 14816 this.isConst = false | 14362 this.isConst = false |
| 14817 this.isFactory = false | 14363 this.isFactory = false |
| 14818 this.isLambda = false | 14364 this.isLambda = false |
| 14819 this._providePropertySyntax = false | 14365 this._providePropertySyntax = false |
| 14820 this._provideFieldSyntax = false | 14366 this._provideFieldSyntax = false |
| 14821 this._provideOptionalParamInfo = false | 14367 this._provideOptionalParamInfo = false |
| 14822 this.definition = definition; | 14368 this.definition = definition; |
| 14823 Member.call(this, name, declaringType); | 14369 Member.call(this, name, declaringType); |
| 14824 // Initializers done | 14370 // Initializers done |
| 14825 } | 14371 } |
| 14826 $inherits(MethodMember, Member); | 14372 $inherits(MethodMember, Member); |
| 14827 MethodMember.prototype.is$MethodMember = function(){return this;}; | |
| 14828 MethodMember.prototype.get$definition = function() { return this.definition; }; | 14373 MethodMember.prototype.get$definition = function() { return this.definition; }; |
| 14829 MethodMember.prototype.set$definition = function(value) { return this.definition
= value; }; | 14374 MethodMember.prototype.set$definition = function(value) { return this.definition
= value; }; |
| 14830 MethodMember.prototype.get$returnType = function() { return this.returnType; }; | 14375 MethodMember.prototype.get$returnType = function() { return this.returnType; }; |
| 14831 MethodMember.prototype.set$returnType = function(value) { return this.returnType
= value; }; | 14376 MethodMember.prototype.set$returnType = function(value) { return this.returnType
= value; }; |
| 14832 MethodMember.prototype.get$parameters = function() { return this.parameters; }; | 14377 MethodMember.prototype.get$parameters = function() { return this.parameters; }; |
| 14833 MethodMember.prototype.set$parameters = function(value) { return this.parameters
= value; }; | 14378 MethodMember.prototype.set$parameters = function(value) { return this.parameters
= value; }; |
| 14834 MethodMember.prototype.get$isStatic = function() { return this.isStatic; }; | 14379 MethodMember.prototype.get$isStatic = function() { return this.isStatic; }; |
| 14835 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v
alue; }; | 14380 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v
alue; }; |
| 14836 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; }; | 14381 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; }; |
| 14837 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract
= value; }; | 14382 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract
= value; }; |
| 14838 MethodMember.prototype.get$isConst = function() { return this.isConst; }; | 14383 MethodMember.prototype.get$isConst = function() { return this.isConst; }; |
| 14839 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val
ue; }; | 14384 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val
ue; }; |
| 14840 MethodMember.prototype.get$isFactory = function() { return this.isFactory; }; | 14385 MethodMember.prototype.get$isFactory = function() { return this.isFactory; }; |
| 14841 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory =
value; }; | 14386 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory =
value; }; |
| 14842 MethodMember.prototype.get$initDelegate = function() { return this.initDelegate;
}; | 14387 MethodMember.prototype.get$initDelegate = function() { return this.initDelegate;
}; |
| 14843 MethodMember.prototype.set$initDelegate = function(value) { return this.initDele
gate = value; }; | 14388 MethodMember.prototype.set$initDelegate = function(value) { return this.initDele
gate = value; }; |
| 14844 MethodMember.prototype.get$isConstructor = function() { | 14389 MethodMember.prototype.get$isConstructor = function() { |
| 14845 return this.name == this.declaringType.name; | 14390 return this.name == this.declaringType.name; |
| 14846 } | 14391 } |
| 14847 MethodMember.prototype.get$isMethod = function() { | 14392 MethodMember.prototype.get$isMethod = function() { |
| 14848 return !$notnull_bool(this.get$isConstructor()); | 14393 return !this.get$isConstructor(); |
| 14849 } | 14394 } |
| 14850 MethodMember.prototype.get$isNative = function() { | 14395 MethodMember.prototype.get$isNative = function() { |
| 14851 return (this.definition.body instanceof NativeStatement); | 14396 return (this.definition.body instanceof NativeStatement); |
| 14852 } | 14397 } |
| 14853 MethodMember.prototype.get$canGet = function() { | 14398 MethodMember.prototype.get$canGet = function() { |
| 14854 return false; | 14399 return false; |
| 14855 } | 14400 } |
| 14856 MethodMember.prototype.get$canSet = function() { | 14401 MethodMember.prototype.get$canSet = function() { |
| 14857 return false; | 14402 return false; |
| 14858 } | 14403 } |
| 14859 MethodMember.prototype.get$span = function() { | 14404 MethodMember.prototype.get$span = function() { |
| 14860 var $0; | 14405 return this.definition == null ? null : this.definition.span; |
| 14861 return (($0 = this.definition == null ? null : this.definition.span) && $0.is$
SourceSpan()); | |
| 14862 } | 14406 } |
| 14863 MethodMember.prototype.get$constructorName = function() { | 14407 MethodMember.prototype.get$constructorName = function() { |
| 14864 var $0; | 14408 var returnType = this.definition.returnType; |
| 14865 var returnType = (($0 = this.definition.returnType) && $0.is$NameTypeReference
()); | |
| 14866 if (returnType == null) return ''; | 14409 if (returnType == null) return ''; |
| 14867 if (returnType.names != null) { | 14410 if (returnType.names != null) { |
| 14868 return $assert_String(returnType.names.$index(0).get$name()); | 14411 return returnType.names.$index(0).get$name(); |
| 14869 } | 14412 } |
| 14870 else if (returnType.name != null) { | 14413 else if (returnType.name != null) { |
| 14871 return returnType.name.name; | 14414 return returnType.name.name; |
| 14872 } | 14415 } |
| 14873 world.internalError('no valid constructor name', this.definition.span); | 14416 world.internalError('no valid constructor name', this.definition.span); |
| 14874 } | 14417 } |
| 14875 MethodMember.prototype.get$functionType = function() { | 14418 MethodMember.prototype.get$functionType = function() { |
| 14876 if (this._functionType == null) { | 14419 if (this._functionType == null) { |
| 14877 this._functionType = this.get$library().getOrAddFunctionType(this.name, this
.definition, this.declaringType); | 14420 this._functionType = this.get$library().getOrAddFunctionType(this.name, this
.definition, this.declaringType); |
| 14878 if (this.parameters == null) { | 14421 if (this.parameters == null) { |
| 14879 this.resolve(this.declaringType); | 14422 this.resolve(this.declaringType); |
| 14880 } | 14423 } |
| 14881 } | 14424 } |
| 14882 return this._functionType; | 14425 return this._functionType; |
| 14883 } | 14426 } |
| 14884 MethodMember.prototype.override = function(other) { | 14427 MethodMember.prototype.override = function(other) { |
| 14885 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false; | 14428 if (!Member.prototype.override.call(this, other)) return false; |
| 14886 if ($notnull_bool(other.get$isMethod())) { | 14429 if (other.get$isMethod()) { |
| 14887 return true; | 14430 return true; |
| 14888 } | 14431 } |
| 14889 else { | 14432 else { |
| 14890 world.error('method can only override methods', this.get$span(), other.get$s
pan()); | 14433 world.error('method can only override methods', this.get$span(), other.get$s
pan()); |
| 14891 return false; | 14434 return false; |
| 14892 } | 14435 } |
| 14893 } | 14436 } |
| 14894 MethodMember.prototype.canInvoke = function(context, args) { | 14437 MethodMember.prototype.canInvoke = function(context, args) { |
| 14895 var bareCount = args.get$bareCount(); | 14438 var bareCount = args.get$bareCount(); |
| 14896 if (bareCount > this.parameters.length) return false; | 14439 if (bareCount > this.parameters.length) return false; |
| 14897 if (bareCount == this.parameters.length) { | 14440 if (bareCount == this.parameters.length) { |
| 14898 if (bareCount != args.get$length()) return false; | 14441 if (bareCount != args.get$length()) return false; |
| 14899 } | 14442 } |
| 14900 else { | 14443 else { |
| 14901 if (!$notnull_bool(this.parameters.$index(bareCount).get$isOptional())) retu
rn false; | 14444 if (!this.parameters.$index(bareCount).get$isOptional()) return false; |
| 14902 for (var i = bareCount; | 14445 for (var i = bareCount; |
| 14903 i < args.get$length(); i++) { | 14446 i < args.get$length(); i++) { |
| 14904 if (this.indexOfParameter(args.getName(i)) < 0) { | 14447 if (this.indexOfParameter(args.getName(i)) < 0) { |
| 14905 return false; | 14448 return false; |
| 14906 } | 14449 } |
| 14907 } | 14450 } |
| 14908 } | 14451 } |
| 14909 return true; | 14452 return true; |
| 14910 } | 14453 } |
| 14911 MethodMember.prototype.indexOfParameter = function(name) { | 14454 MethodMember.prototype.indexOfParameter = function(name) { |
| 14912 for (var i = 0; | 14455 for (var i = 0; |
| 14913 i < this.parameters.length; i++) { | 14456 i < this.parameters.length; i++) { |
| 14914 var p = this.parameters.$index(i); | 14457 var p = this.parameters.$index(i); |
| 14915 if ($notnull_bool(p.get$isOptional()) && $notnull_bool($eq(p.get$name(), nam
e))) { | 14458 if (p.get$isOptional() && $eq(p.get$name(), name)) { |
| 14916 return i; | 14459 return i; |
| 14917 } | 14460 } |
| 14918 } | 14461 } |
| 14919 return -1; | 14462 return -1; |
| 14920 } | 14463 } |
| 14921 MethodMember.prototype.get$prefersPropertySyntax = function() { | 14464 MethodMember.prototype.get$prefersPropertySyntax = function() { |
| 14922 return true; | 14465 return true; |
| 14923 } | 14466 } |
| 14924 MethodMember.prototype.get$requiresFieldSyntax = function() { | 14467 MethodMember.prototype.get$requiresFieldSyntax = function() { |
| 14925 return false; | 14468 return false; |
| 14926 } | 14469 } |
| 14927 MethodMember.prototype.provideFieldSyntax = function() { | 14470 MethodMember.prototype.provideFieldSyntax = function() { |
| 14928 this._provideFieldSyntax = true; | 14471 this._provideFieldSyntax = true; |
| 14929 } | 14472 } |
| 14930 MethodMember.prototype.providePropertySyntax = function() { | 14473 MethodMember.prototype.providePropertySyntax = function() { |
| 14931 this._providePropertySyntax = true; | 14474 this._providePropertySyntax = true; |
| 14932 } | 14475 } |
| 14933 MethodMember.prototype._set = function(context, Node, target, value, isDynamic)
{ | 14476 MethodMember.prototype._set = function(context, Node, target, value, isDynamic)
{ |
| 14934 world.error('can not set method', this.definition.span); | 14477 world.error('can not set method', this.definition.span); |
| 14935 } | 14478 } |
| 14936 MethodMember.prototype._get = function(context, node, target, isDynamic) { | 14479 MethodMember.prototype._get = function(context, node, target, isDynamic) { |
| 14937 this.declaringType.genMethod(this); | 14480 this.declaringType.genMethod(this); |
| 14938 this._provideOptionalParamInfo = true; | 14481 this._provideOptionalParamInfo = true; |
| 14939 if ($notnull_bool(this.isStatic)) { | 14482 if (this.isStatic) { |
| 14940 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d
eclaringType.get$jsname() + '.'); | 14483 var type = this.declaringType.get$isTop() ? '' : ('' + this.declaringType.ge
t$jsname() + '.'); |
| 14941 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname(
) + ''), node.span, true); | 14484 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname(
) + ''), node.span, true); |
| 14942 } | 14485 } |
| 14943 this._providePropertySyntax = true; | 14486 this._providePropertySyntax = true; |
| 14944 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this.
get$jsname() + '()'), node.span, true); | 14487 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this.
get$jsname() + '()'), node.span, true); |
| 14945 } | 14488 } |
| 14946 MethodMember.prototype.namesInOrder = function(args) { | 14489 MethodMember.prototype.namesInOrder = function(args) { |
| 14947 if (!$notnull_bool(args.get$hasNames())) return true; | 14490 if (!args.get$hasNames()) return true; |
| 14948 var lastParameter = null; | 14491 var lastParameter = null; |
| 14949 for (var i = args.get$bareCount(); | 14492 for (var i = args.get$bareCount(); |
| 14950 i < this.parameters.length; i++) { | 14493 i < this.parameters.length; i++) { |
| 14951 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam
e())); | 14494 var p = args.getIndexOfName(this.parameters.$index(i).get$name()); |
| 14952 if (p >= 0 && $notnull_bool(args.values.$index(p).needsTemp)) { | 14495 if (p >= 0 && args.values.$index(p).needsTemp) { |
| 14953 if (lastParameter != null && lastParameter > $assert_num(p)) { | 14496 if (lastParameter != null && lastParameter > p) { |
| 14954 return false; | 14497 return false; |
| 14955 } | 14498 } |
| 14956 lastParameter = $assert_num(p); | 14499 lastParameter = p; |
| 14957 } | 14500 } |
| 14958 } | 14501 } |
| 14959 return true; | 14502 return true; |
| 14960 } | 14503 } |
| 14961 MethodMember.prototype.needsArgumentConversion = function(args) { | 14504 MethodMember.prototype.needsArgumentConversion = function(args) { |
| 14962 var bareCount = args.get$bareCount(); | 14505 var bareCount = args.get$bareCount(); |
| 14963 for (var i = 0; | 14506 for (var i = 0; |
| 14964 i < bareCount; i++) { | 14507 i < bareCount; i++) { |
| 14965 var arg = args.values.$index(i); | 14508 var arg = args.values.$index(i); |
| 14966 if ($notnull_bool(arg.needsConversion$1(this.parameters.$index(i).type))) { | 14509 if (arg.needsConversion$1(this.parameters.$index(i).type)) { |
| 14967 return false; | 14510 return false; |
| 14968 } | 14511 } |
| 14969 } | 14512 } |
| 14970 if (bareCount < this.parameters.length) { | 14513 if (bareCount < this.parameters.length) { |
| 14971 this.genParameterValues(); | 14514 this.genParameterValues(); |
| 14972 for (var i = bareCount; | 14515 for (var i = bareCount; |
| 14973 i < this.parameters.length; i++) { | 14516 i < this.parameters.length; i++) { |
| 14974 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name(
))); | 14517 var arg = args.getValue(this.parameters.$index(i).get$name()); |
| 14975 if ($notnull_bool($ne(arg, null)) && $notnull_bool(arg.needsConversion$1(t
his.parameters.$index(i).type))) { | 14518 if ($ne(arg, null) && arg.needsConversion$1(this.parameters.$index(i).type
)) { |
| 14976 return false; | 14519 return false; |
| 14977 } | 14520 } |
| 14978 } | 14521 } |
| 14979 } | 14522 } |
| 14980 return true; | 14523 return true; |
| 14981 } | 14524 } |
| 14982 MethodMember._argCountMsg = function(actual, expected, atLeast) { | 14525 MethodMember._argCountMsg = function(actual, expected, atLeast) { |
| 14983 return 'wrong number of arguments, expected ' + ('' + ($notnull_bool(atLeast)
? "at least " : "") + '' + expected + ' but found ' + actual + ''); | 14526 return 'wrong number of arguments, expected ' + ('' + (atLeast ? "at least " :
"") + '' + expected + ' but found ' + actual + ''); |
| 14984 } | 14527 } |
| 14985 MethodMember.prototype._argError = function(context, node, target, args, msg) { | 14528 MethodMember.prototype._argError = function(context, node, target, args, msg) { |
| 14986 if ($notnull_bool(this.isStatic) || $notnull_bool(this.get$isConstructor())) { | 14529 if (this.isStatic || this.get$isConstructor()) { |
| 14987 world.error(msg, node.span); | 14530 world.error(msg, node.span); |
| 14988 } | 14531 } |
| 14989 else { | 14532 else { |
| 14990 world.warning(msg, node.span); | 14533 world.warning(msg, node.span); |
| 14991 } | 14534 } |
| 14992 return target.invokeNoSuchMethod(context, this.name, node, args); | 14535 return target.invokeNoSuchMethod(context, this.name, node, args); |
| 14993 } | 14536 } |
| 14994 MethodMember.prototype.genParameterValues = function() { | 14537 MethodMember.prototype.genParameterValues = function() { |
| 14995 var $list = this.parameters; | 14538 var $list = this.parameters; |
| 14996 for (var $i = 0;$i < $list.length; $i++) { | 14539 for (var $i = 0;$i < $list.length; $i++) { |
| 14997 var p = $list.$index($i); | 14540 var p = $list.$index($i); |
| 14998 p.genValue$2(this, this.generator); | 14541 p.genValue$2(this, this.generator); |
| 14999 } | 14542 } |
| 15000 } | 14543 } |
| 15001 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
{ | 14544 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
{ |
| 15002 if (this.parameters == null) { | 14545 if (this.parameters == null) { |
| 15003 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.'
+ this.name + '')); | 14546 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.'
+ this.name + '')); |
| 15004 this.resolve(this.declaringType); | 14547 this.resolve(this.declaringType); |
| 15005 } | 14548 } |
| 15006 this.declaringType.genMethod(this); | 14549 this.declaringType.genMethod(this); |
| 15007 if ($notnull_bool(this.isStatic) || $notnull_bool(this.isFactory)) { | 14550 if (this.isStatic || this.isFactory) { |
| 15008 this.declaringType.markUsed(); | 14551 this.declaringType.markUsed(); |
| 15009 } | 14552 } |
| 15010 if ($notnull_bool(this.get$isNative()) && this.returnType != null) this.return
Type.markUsed(); | 14553 if (this.get$isNative() && this.returnType != null) this.returnType.markUsed()
; |
| 15011 if (!$notnull_bool(this.namesInOrder(args))) { | 14554 if (!this.namesInOrder(args)) { |
| 15012 return context.findMembers(this.name).invokeOnVar(context, node, target, arg
s); | 14555 return context.findMembers(this.name).invokeOnVar(context, node, target, arg
s); |
| 15013 } | 14556 } |
| 15014 var argsCode = []; | 14557 var argsCode = []; |
| 15015 if (target != null && ($notnull_bool(this.get$isConstructor()) || $notnull_boo
l(target.isSuper))) { | 14558 if (target != null && (this.get$isConstructor() || target.isSuper)) { |
| 15016 argsCode.add$1('this'); | 14559 argsCode.add$1('this'); |
| 15017 } | 14560 } |
| 15018 var bareCount = args.get$bareCount(); | 14561 var bareCount = args.get$bareCount(); |
| 15019 for (var i = 0; | 14562 for (var i = 0; |
| 15020 i < bareCount; i++) { | 14563 i < bareCount; i++) { |
| 15021 var arg = args.values.$index(i); | 14564 var arg = args.values.$index(i); |
| 15022 if (i >= this.parameters.length) { | 14565 if (i >= this.parameters.length) { |
| 15023 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len
gth, false); | 14566 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len
gth, false); |
| 15024 return this._argError(context, node, target, args, $assert_String(msg)); | 14567 return this._argError(context, node, target, args, msg); |
| 15025 } | 14568 } |
| 15026 arg = arg.convertTo$4(context, this.parameters.$index(i).type, node, isDynam
ic); | 14569 arg = arg.convertTo$4(context, this.parameters.$index(i).type, node, isDynam
ic); |
| 15027 if ($notnull_bool(this.isConst) && $notnull_bool(arg.get$isConst())) { | 14570 if (this.isConst && arg.get$isConst()) { |
| 15028 argsCode.add$1(arg.get$canonicalCode()); | 14571 argsCode.add$1(arg.get$canonicalCode()); |
| 15029 } | 14572 } |
| 15030 else { | 14573 else { |
| 15031 argsCode.add$1(arg.code); | 14574 argsCode.add$1(arg.code); |
| 15032 } | 14575 } |
| 15033 } | 14576 } |
| 15034 if (bareCount < this.parameters.length) { | 14577 if (bareCount < this.parameters.length) { |
| 15035 this.genParameterValues(); | 14578 this.genParameterValues(); |
| 15036 var namedArgsUsed = 0; | 14579 var namedArgsUsed = 0; |
| 15037 for (var i = bareCount; | 14580 for (var i = bareCount; |
| 15038 i < this.parameters.length; i++) { | 14581 i < this.parameters.length; i++) { |
| 15039 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name(
))); | 14582 var arg = args.getValue(this.parameters.$index(i).get$name()); |
| 15040 if ($notnull_bool(arg == null)) { | 14583 if (arg == null) { |
| 15041 arg = this.parameters.$index(i).get$value(); | 14584 arg = this.parameters.$index(i).get$value(); |
| 15042 } | 14585 } |
| 15043 else { | 14586 else { |
| 15044 arg = arg.convertTo$4(context, this.parameters.$index(i).type, node, isD
ynamic); | 14587 arg = arg.convertTo$4(context, this.parameters.$index(i).type, node, isD
ynamic); |
| 15045 namedArgsUsed++; | 14588 namedArgsUsed++; |
| 15046 } | 14589 } |
| 15047 if ($notnull_bool(arg == null) || !$notnull_bool(this.parameters.$index(i)
.get$isOptional())) { | 14590 if (arg == null || !this.parameters.$index(i).get$isOptional()) { |
| 15048 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i +
1, true); | 14591 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i +
1, true); |
| 15049 return this._argError(context, node, target, args, $assert_String(msg)); | 14592 return this._argError(context, node, target, args, msg); |
| 15050 } | 14593 } |
| 15051 else { | 14594 else { |
| 15052 argsCode.add$1($notnull_bool(this.isConst) && $notnull_bool(arg.get$isCo
nst()) ? arg.get$canonicalCode() : arg.code); | 14595 argsCode.add$1(this.isConst && arg.get$isConst() ? arg.get$canonicalCode
() : arg.code); |
| 15053 } | 14596 } |
| 15054 } | 14597 } |
| 15055 if (namedArgsUsed < args.get$nameCount()) { | 14598 if (namedArgsUsed < args.get$nameCount()) { |
| 15056 var seen = new HashSetImplementation(); | 14599 var seen = new HashSetImplementation(); |
| 15057 for (var i = bareCount; | 14600 for (var i = bareCount; |
| 15058 i < args.get$length(); i++) { | 14601 i < args.get$length(); i++) { |
| 15059 var name = args.getName(i); | 14602 var name = args.getName(i); |
| 15060 if ($notnull_bool(seen.contains$1(name))) { | 14603 if (seen.contains$1(name)) { |
| 15061 return this._argError(context, node, target, args, ('duplicate argumen
t "' + name + '"')); | 14604 return this._argError(context, node, target, args, ('duplicate argumen
t "' + name + '"')); |
| 15062 } | 14605 } |
| 15063 seen.add$1(name); | 14606 seen.add$1(name); |
| 15064 var p = this.indexOfParameter($assert_String(name)); | 14607 var p = this.indexOfParameter(name); |
| 15065 if (p < 0) { | 14608 if (p < 0) { |
| 15066 return this._argError(context, node, target, args, ('method does not h
ave optional parameter "' + name + '"')); | 14609 return this._argError(context, node, target, args, ('method does not h
ave optional parameter "' + name + '"')); |
| 15067 } | 14610 } |
| 15068 else if (p < bareCount) { | 14611 else if (p < bareCount) { |
| 15069 return this._argError(context, node, target, args, ('argument "' + nam
e + '" passed as positional and named')); | 14612 return this._argError(context, node, target, args, ('argument "' + nam
e + '" passed as positional and named')); |
| 15070 } | 14613 } |
| 15071 } | 14614 } |
| 15072 world.internalError(('wrong named arguments calling ' + this.name + ''), n
ode.span); | 14615 world.internalError(('wrong named arguments calling ' + this.name + ''), n
ode.span); |
| 15073 } | 14616 } |
| 15074 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); | 14617 Arguments.removeTrailingNulls(argsCode); |
| 15075 } | 14618 } |
| 15076 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); | 14619 var argsString = Strings.join(argsCode, ', '); |
| 15077 if ($notnull_bool(this.get$isConstructor())) { | 14620 if (this.get$isConstructor()) { |
| 15078 return this._invokeConstructor(context, node, target, args, argsString); | 14621 return this._invokeConstructor(context, node, target, args, argsString); |
| 15079 } | 14622 } |
| 15080 if (target != null && $notnull_bool(target.isSuper)) { | 14623 if (target != null && target.isSuper) { |
| 15081 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn
ame() + '.prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.s
pan, true); | 14624 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn
ame() + '.prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.s
pan, true); |
| 15082 } | 14625 } |
| 15083 if ($notnull_bool(this.get$isOperator())) { | 14626 if (this.get$isOperator()) { |
| 15084 return this._invokeBuiltin(context, node, target, args, argsCode, isDynamic)
; | 14627 return this._invokeBuiltin(context, node, target, args, argsCode, isDynamic)
; |
| 15085 } | 14628 } |
| 15086 if ($notnull_bool(this.isFactory)) { | 14629 if (this.isFactory) { |
| 15087 return new Value(this.get$inferredResult(), ('' + this.get$generatedFactoryN
ame() + '(' + argsString + ')'), node.span, true); | 14630 return new Value(this.get$inferredResult(), ('' + this.get$generatedFactoryN
ame() + '(' + argsString + ')'), node.span, true); |
| 15088 } | 14631 } |
| 15089 if ($notnull_bool(this.isStatic)) { | 14632 if (this.isStatic) { |
| 15090 if ($notnull_bool(this.declaringType.get$isTop())) { | 14633 if (this.declaringType.get$isTop()) { |
| 15091 return new Value(this.get$inferredResult(), ('' + this.get$jsname() + '('
+ argsString + ')'), node != null ? node.span : node, true); | 14634 return new Value(this.get$inferredResult(), ('' + this.get$jsname() + '('
+ argsString + ')'), node != null ? node.span : node, true); |
| 15092 } | 14635 } |
| 15093 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn
ame() + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true); | 14636 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn
ame() + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true); |
| 15094 } | 14637 } |
| 15095 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')
'); | 14638 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')
'); |
| 15096 if ($notnull_bool(target.get$isConst())) { | 14639 if (target.get$isConst()) { |
| 15097 if ((target instanceof GlobalValue)) { | 14640 if ((target instanceof GlobalValue)) { |
| 15098 target = target.get$dynamic().exp; | 14641 target = target.get$dynamic().exp; |
| 15099 } | 14642 } |
| 15100 if (this.name == 'get\$length') { | 14643 if (this.name == 'get\$length') { |
| 15101 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue
)) { | 14644 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue
)) { |
| 15102 code = ('' + target.get$dynamic().values.length + ''); | 14645 code = ('' + target.get$dynamic().values.length + ''); |
| 15103 } | 14646 } |
| 15104 } | 14647 } |
| 15105 else if (this.name == 'isEmpty') { | 14648 else if (this.name == 'isEmpty') { |
| 15106 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue
)) { | 14649 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue
)) { |
| 15107 code = ('' + target.get$dynamic().values.isEmpty$0() + ''); | 14650 code = ('' + target.get$dynamic().values.isEmpty$0() + ''); |
| 15108 } | 14651 } |
| 15109 } | 14652 } |
| 15110 } | 14653 } |
| 15111 if (this.name == 'get\$typeName' && $eq(this.declaringType.get$library(), worl
d.get$dom())) { | 14654 if (this.name == 'get\$typeName' && $eq(this.declaringType.get$library(), worl
d.get$dom())) { |
| 15112 world.gen.corejs.useTypeNameOf = true; | 14655 world.gen.corejs.useTypeNameOf = true; |
| 15113 } | 14656 } |
| 15114 return new Value(this.get$inferredResult(), code, node.span, true); | 14657 return new Value(this.get$inferredResult(), code, node.span, true); |
| 15115 } | 14658 } |
| 15116 MethodMember.prototype._invokeConstructor = function(context, node, target, args
, argsString) { | 14659 MethodMember.prototype._invokeConstructor = function(context, node, target, args
, argsString) { |
| 15117 this.declaringType.markUsed(); | 14660 this.declaringType.markUsed(); |
| 15118 if (target != null) { | 14661 if (target != null) { |
| 15119 var code = (this.get$constructorName() != '') ? ('' + this.declaringType.get
$jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + argsString + ')'
) : ('' + this.declaringType.get$jsname() + '.call(' + argsString + ')'); | 14662 var code = (this.get$constructorName() != '') ? ('' + this.declaringType.get
$jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + argsString + ')'
) : ('' + this.declaringType.get$jsname() + '.call(' + argsString + ')'); |
| 15120 return new Value(this.declaringType, code, node.span, true); | 14663 return new Value(this.declaringType, code, node.span, true); |
| 15121 } | 14664 } |
| 15122 else { | 14665 else { |
| 15123 var code = (this.get$constructorName() != '') ? ('new ' + this.declaringType
.get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + argsString + ')')
: ('new ' + this.declaringType.get$jsname() + '(' + argsString + ')'); | 14666 var code = (this.get$constructorName() != '') ? ('new ' + this.declaringType
.get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + argsString + ')')
: ('new ' + this.declaringType.get$jsname() + '(' + argsString + ')'); |
| 15124 if ($notnull_bool(this.isConst) && (node instanceof lang_NewExpression) && $
notnull_bool(node.get$dynamic().get$isConst())) { | 14667 if (this.isConst && (node instanceof lang_NewExpression) && node.get$dynamic
().get$isConst()) { |
| 15125 return this._invokeConstConstructor(node, $assert_String(code), target, ar
gs); | 14668 return this._invokeConstConstructor(node, code, target, args); |
| 15126 } | 14669 } |
| 15127 else { | 14670 else { |
| 15128 return new Value(this.declaringType, code, node.span, true); | 14671 return new Value(this.declaringType, code, node.span, true); |
| 15129 } | 14672 } |
| 15130 } | 14673 } |
| 15131 } | 14674 } |
| 15132 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
gs) { | 14675 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
gs) { |
| 15133 var $0; | |
| 15134 var fields = new HashMapImplementation(); | 14676 var fields = new HashMapImplementation(); |
| 15135 for (var i = 0; | 14677 for (var i = 0; |
| 15136 i < this.parameters.length; i++) { | 14678 i < this.parameters.length; i++) { |
| 15137 var param = this.parameters.$index(i); | 14679 var param = this.parameters.$index(i); |
| 15138 if ($notnull_bool(param.isInitializer)) { | 14680 if (param.isInitializer) { |
| 15139 var value = null; | 14681 var value = null; |
| 15140 if (i < args.get$length()) { | 14682 if (i < args.get$length()) { |
| 15141 value = args.values.$index(i); | 14683 value = args.values.$index(i); |
| 15142 } | 14684 } |
| 15143 else { | 14685 else { |
| 15144 value = args.getValue($assert_String(param.get$name())); | 14686 value = args.getValue(param.get$name()); |
| 15145 if ($notnull_bool(value == null)) { | 14687 if (value == null) { |
| 15146 value = param.get$value(); | 14688 value = param.get$value(); |
| 15147 } | 14689 } |
| 15148 } | 14690 } |
| 15149 fields.$setindex(param.get$name(), value); | 14691 fields.$setindex(param.get$name(), value); |
| 15150 } | 14692 } |
| 15151 } | 14693 } |
| 15152 if (this.definition.initializers != null) { | 14694 if (this.definition.initializers != null) { |
| 15153 this.generator._pushBlock(false); | 14695 this.generator._pushBlock(false); |
| 15154 for (var j = 0; | 14696 for (var j = 0; |
| 15155 j < this.definition.formals.length; j++) { | 14697 j < this.definition.formals.length; j++) { |
| 15156 var name = this.definition.formals.$index(j).get$name().get$name(); | 14698 var name = this.definition.formals.$index(j).get$name().get$name(); |
| 15157 var value = null; | 14699 var value = null; |
| 15158 if (j < args.get$length()) { | 14700 if (j < args.get$length()) { |
| 15159 value = args.values.$index(j); | 14701 value = args.values.$index(j); |
| 15160 } | 14702 } |
| 15161 else { | 14703 else { |
| 15162 value = args.getValue($assert_String(this.parameters.$index(j).get$name(
))); | 14704 value = args.getValue(this.parameters.$index(j).get$name()); |
| 15163 if ($notnull_bool(value == null)) { | 14705 if (value == null) { |
| 15164 value = this.parameters.$index(j).get$value(); | 14706 value = this.parameters.$index(j).get$value(); |
| 15165 } | 14707 } |
| 15166 } | 14708 } |
| 15167 this.generator._scope._vars.$setindex(name, value); | 14709 this.generator._scope._vars.$setindex(name, value); |
| 15168 } | 14710 } |
| 15169 var $list = this.definition.initializers; | 14711 var $list = this.definition.initializers; |
| 15170 for (var $i = 0;$i < $list.length; $i++) { | 14712 for (var $i = 0;$i < $list.length; $i++) { |
| 15171 var init = $list.$index($i); | 14713 var init = $list.$index($i); |
| 15172 if ((init instanceof CallExpression)) { | 14714 if ((init instanceof CallExpression)) { |
| 15173 var delegateArgs = this.generator._makeArgs((($0 = init.get$arguments())
&& $0.is$List$ArgumentNode())); | 14715 var delegateArgs = this.generator._makeArgs(init.get$arguments()); |
| 15174 var value = this.initDelegate.invoke(this.generator, node, target, (dele
gateArgs && delegateArgs.is$Arguments()), false); | 14716 var value = this.initDelegate.invoke(this.generator, node, target, deleg
ateArgs, false); |
| 15175 if ((init.target instanceof ThisExpression)) { | 14717 if ((init.target instanceof ThisExpression)) { |
| 15176 return (value && value.is$Value()); | 14718 return value; |
| 15177 } | 14719 } |
| 15178 else { | 14720 else { |
| 15179 if ((value instanceof GlobalValue)) { | 14721 if ((value instanceof GlobalValue)) { |
| 15180 value = value.exp; | 14722 value = value.exp; |
| 15181 } | 14723 } |
| 15182 var $list0 = value.fields.getKeys(); | 14724 var $list0 = value.fields.getKeys(); |
| 15183 for (var $i0 = value.fields.getKeys().iterator$0(); $i0.hasNext$0(); )
{ | 14725 for (var $i0 = value.fields.getKeys().iterator$0(); $i0.hasNext$0(); )
{ |
| 15184 var fname = $i0.next$0(); | 14726 var fname = $i0.next$0(); |
| 15185 fields.$setindex(fname, value.fields.$index(fname)); | 14727 fields.$setindex(fname, value.fields.$index(fname)); |
| 15186 } | 14728 } |
| 15187 } | 14729 } |
| 15188 } | 14730 } |
| 15189 else { | 14731 else { |
| 15190 var assign = (init && init.is$BinaryExpression()); | 14732 var assign = init; |
| 15191 var x = (($0 = assign.x) && $0.is$VarExpression()); | 14733 var x = assign.x; |
| 15192 var fname = x.name.name; | 14734 var fname = x.name.name; |
| 15193 var val = this.generator.visitValue(assign.y); | 14735 var val = this.generator.visitValue(assign.y); |
| 15194 fields.$setindex(fname, val); | 14736 fields.$setindex(fname, val); |
| 15195 } | 14737 } |
| 15196 } | 14738 } |
| 15197 this.generator._popBlock(); | 14739 this.generator._popBlock(); |
| 15198 } | 14740 } |
| 15199 var $list = this.declaringType.get$members().getValues(); | 14741 var $list = this.declaringType.get$members().getValues(); |
| 15200 for (var $i = this.declaringType.get$members().getValues().iterator$0(); $i.ha
sNext$0(); ) { | 14742 for (var $i = this.declaringType.get$members().getValues().iterator$0(); $i.ha
sNext$0(); ) { |
| 15201 var f = $i.next$0(); | 14743 var f = $i.next$0(); |
| 15202 if ((f instanceof FieldMember) && !$notnull_bool(f.get$isStatic()) && $notnu
ll_bool($ne(f.get$value(), null)) && !fields.containsKey(f.get$name())) { | 14744 if ((f instanceof FieldMember) && !f.get$isStatic() && $ne(f.get$value(), nu
ll) && !fields.containsKey(f.get$name())) { |
| 15203 fields.$setindex(f.get$name(), f.computeValue$0()); | 14745 fields.$setindex(f.get$name(), f.computeValue$0()); |
| 15204 } | 14746 } |
| 15205 } | 14747 } |
| 15206 return world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(this
.declaringType, fields, code, node.span), args.values); | 14748 return world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(this
.declaringType, fields, code, node.span), args.values); |
| 15207 } | 14749 } |
| 15208 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
gsCode, isDynamic) { | 14750 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
gsCode, isDynamic) { |
| 15209 var allConst = $notnull_bool(target.get$isConst()) && args.values.every((funct
ion (arg) { | 14751 var allConst = target.get$isConst() && args.values.every((function (arg) { |
| 15210 return arg.get$isConst(); | 14752 return arg.get$isConst(); |
| 15211 }) | 14753 }) |
| 15212 ); | 14754 ); |
| 15213 if ($notnull_bool(this.declaringType.get$isNum())) { | 14755 if (this.declaringType.get$isNum()) { |
| 15214 if (!$notnull_bool(allConst)) { | 14756 if (!allConst) { |
| 15215 var code; | 14757 var code; |
| 15216 if (this.name == '\$negate') { | 14758 if (this.name == '\$negate') { |
| 15217 code = ('-' + target.code + ''); | 14759 code = ('-' + target.code + ''); |
| 15218 } | 14760 } |
| 15219 else if (this.name == '\$bit_not') { | 14761 else if (this.name == '\$bit_not') { |
| 15220 code = ('~' + target.code + ''); | 14762 code = ('~' + target.code + ''); |
| 15221 } | 14763 } |
| 15222 else if (this.name == '\$truncdiv' || this.name == '\$mod') { | 14764 else if (this.name == '\$truncdiv' || this.name == '\$mod') { |
| 15223 world.gen.corejs.useOperator(this.name); | 14765 world.gen.corejs.useOperator(this.name); |
| 15224 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) +
')'); | 14766 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) +
')'); |
| 15225 } | 14767 } |
| 15226 else { | 14768 else { |
| 15227 var op = TokenKind.rawOperatorFromMethod(this.name); | 14769 var op = TokenKind.rawOperatorFromMethod(this.name); |
| 15228 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''); | 14770 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''); |
| 15229 } | 14771 } |
| 15230 return new Value(this.get$inferredResult(), code, node.span, true); | 14772 return new Value(this.get$inferredResult(), code, node.span, true); |
| 15231 } | 14773 } |
| 15232 else { | 14774 else { |
| 15233 var value; | 14775 var value; |
| 15234 var val0, val1, ival0, ival1; | 14776 var val0, val1, ival0, ival1; |
| 15235 val0 = $assert_num(target.get$dynamic().get$actualValue()); | 14777 val0 = target.get$dynamic().get$actualValue(); |
| 15236 ival0 = val0.toInt(); | 14778 ival0 = val0.toInt(); |
| 15237 if (args.values.length > 0) { | 14779 if (args.values.length > 0) { |
| 15238 val1 = $assert_num(args.values.$index(0).get$dynamic().get$actualValue()
); | 14780 val1 = args.values.$index(0).get$dynamic().get$actualValue(); |
| 15239 ival1 = val1.toInt(); | 14781 ival1 = val1.toInt(); |
| 15240 } | 14782 } |
| 15241 switch (this.name) { | 14783 switch (this.name) { |
| 15242 case '\$negate': | 14784 case '\$negate': |
| 15243 | 14785 |
| 15244 value = -val0; | 14786 value = -val0; |
| 15245 break; | 14787 break; |
| 15246 | 14788 |
| 15247 case '\$add': | 14789 case '\$add': |
| 15248 | 14790 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15336 | 14878 |
| 15337 case '\$shr': | 14879 case '\$shr': |
| 15338 | 14880 |
| 15339 value = (ival0 >>> ival1).toDouble(); | 14881 value = (ival0 >>> ival1).toDouble(); |
| 15340 break; | 14882 break; |
| 15341 | 14883 |
| 15342 } | 14884 } |
| 15343 return EvaluatedValue.EvaluatedValue$factory(this.get$inferredResult(), va
lue, ("" + value + ""), node.span); | 14885 return EvaluatedValue.EvaluatedValue$factory(this.get$inferredResult(), va
lue, ("" + value + ""), node.span); |
| 15344 } | 14886 } |
| 15345 } | 14887 } |
| 15346 else if ($notnull_bool(this.declaringType.get$isString())) { | 14888 else if (this.declaringType.get$isString()) { |
| 15347 if (this.name == '\$index') { | 14889 if (this.name == '\$index') { |
| 15348 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i
ndex(0) + ']'), node.span, true); | 14890 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i
ndex(0) + ']'), node.span, true); |
| 15349 } | 14891 } |
| 15350 else if (this.name == '\$add') { | 14892 else if (this.name == '\$add') { |
| 15351 if ($notnull_bool(allConst)) { | 14893 if (allConst) { |
| 15352 var val0 = target.get$dynamic().get$actualValue(); | 14894 var val0 = target.get$dynamic().get$actualValue(); |
| 15353 val0 = val0.substring$2(1, val0.length - 1); | 14895 val0 = val0.substring$2(1, val0.length - 1); |
| 15354 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); | 14896 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); |
| 15355 if ($notnull_bool(args.values.$index(0).type.get$isString())) { | 14897 if (args.values.$index(0).type.get$isString()) { |
| 15356 val1 = val1.substring$2(1, val1.length - 1); | 14898 val1 = val1.substring$2(1, val1.length - 1); |
| 15357 } | 14899 } |
| 15358 var value = ('' + val0 + '' + val1 + ''); | 14900 var value = ('' + val0 + '' + val1 + ''); |
| 15359 value = '"' + value.replaceAll$2('"', '\\"') + '"'; | 14901 value = '"' + value.replaceAll$2('"', '\\"') + '"'; |
| 15360 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, $a
ssert_String(value), node.span); | 14902 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, va
lue, node.span); |
| 15361 } | 14903 } |
| 15362 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM
PTY()); | 14904 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM
PTY()); |
| 15363 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode.
$index(0) + ''), node.span, true); | 14905 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode.
$index(0) + ''), node.span, true); |
| 15364 } | 14906 } |
| 15365 } | 14907 } |
| 15366 else if ($notnull_bool(this.declaringType.get$isNativeType())) { | 14908 else if (this.declaringType.get$isNativeType()) { |
| 15367 if (this.name == '\$index') { | 14909 if (this.name == '\$index') { |
| 15368 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde
x(0) + ']'), node.span, true); | 14910 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde
x(0) + ']'), node.span, true); |
| 15369 } | 14911 } |
| 15370 else if (this.name == '\$setindex') { | 14912 else if (this.name == '\$setindex') { |
| 15371 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde
x(0) + '] = ' + argsCode.$index(1) + ''), node.span, true); | 14913 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde
x(0) + '] = ' + argsCode.$index(1) + ''), node.span, true); |
| 15372 } | 14914 } |
| 15373 } | 14915 } |
| 15374 if (this.name == '\$eq' || this.name == '\$ne') { | 14916 if (this.name == '\$eq' || this.name == '\$ne') { |
| 15375 var op = this.name == '\$eq' ? '==' : '!='; | 14917 var op = this.name == '\$eq' ? '==' : '!='; |
| 15376 if (this.name == '\$ne') { | 14918 if (this.name == '\$ne') { |
| 15377 target.invoke(context, '\$eq', node, args, isDynamic); | 14919 target.invoke(context, '\$eq', node, args, isDynamic); |
| 15378 } | 14920 } |
| 15379 if ($notnull_bool(allConst)) { | 14921 if (allConst) { |
| 15380 var val0 = target.get$dynamic().get$actualValue(); | 14922 var val0 = target.get$dynamic().get$actualValue(); |
| 15381 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); | 14923 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); |
| 15382 var newVal = this.name == '\$eq' ? $eq(val0, val1) : $ne(val0, val1); | 14924 var newVal = this.name == '\$eq' ? $eq(val0, val1) : $ne(val0, val1); |
| 15383 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, newVal, ("
" + newVal + ""), node.span); | 14925 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, newVal, ("
" + newVal + ""), node.span); |
| 15384 } | 14926 } |
| 15385 if ($notnull_bool($eq(argsCode.$index(0), 'null'))) { | 14927 if ($eq(argsCode.$index(0), 'null')) { |
| 15386 return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op +
' null'), node.span, true); | 14928 return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op +
' null'), node.span, true); |
| 15387 } | 14929 } |
| 15388 else if ($notnull_bool(target.type.get$isNum()) || $notnull_bool(target.type
.get$isString())) { | 14930 else if (target.type.get$isNum() || target.type.get$isString()) { |
| 15389 return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op +
' ' + argsCode.$index(0) + ''), node.span, true); | 14931 return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op +
' ' + argsCode.$index(0) + ''), node.span, true); |
| 15390 } | 14932 } |
| 15391 world.gen.corejs.useOperator(this.name); | 14933 world.gen.corejs.useOperator(this.name); |
| 15392 return new Value(this.get$inferredResult(), ('' + this.name + '(' + target.c
ode + ', ' + argsCode.$index(0) + ')'), node.span, true); | 14934 return new Value(this.get$inferredResult(), ('' + this.name + '(' + target.c
ode + ', ' + argsCode.$index(0) + ')'), node.span, true); |
| 15393 } | 14935 } |
| 15394 if ($notnull_bool(this.get$isCallMethod())) { | 14936 if (this.get$isCallMethod()) { |
| 15395 this.declaringType.markUsed(); | 14937 this.declaringType.markUsed(); |
| 15396 return new Value(this.get$inferredResult(), ('' + target.code + '(' + String
s.join((argsCode && argsCode.is$List$String()), ", ") + ')'), node.span, true); | 14938 return new Value(this.get$inferredResult(), ('' + target.code + '(' + String
s.join(argsCode, ", ") + ')'), node.span, true); |
| 15397 } | 14939 } |
| 15398 if (this.name == '\$index') { | 14940 if (this.name == '\$index') { |
| 15399 world.gen.corejs.useIndex = true; | 14941 world.gen.corejs.useIndex = true; |
| 15400 } | 14942 } |
| 15401 else if (this.name == '\$setindex') { | 14943 else if (this.name == '\$setindex') { |
| 15402 world.gen.corejs.useSetIndex = true; | 14944 world.gen.corejs.useSetIndex = true; |
| 15403 } | 14945 } |
| 15404 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); | 14946 var argsString = Strings.join(argsCode, ', '); |
| 15405 return new Value(this.get$inferredResult(), ('' + target.code + '.' + this.get
$jsname() + '(' + argsString + ')'), node.span, true); | 14947 return new Value(this.get$inferredResult(), ('' + target.code + '.' + this.get
$jsname() + '(' + argsString + ')'), node.span, true); |
| 15406 } | 14948 } |
| 15407 MethodMember.prototype.resolve = function(inType) { | 14949 MethodMember.prototype.resolve = function(inType) { |
| 15408 this.isStatic = inType.get$isTop(); | 14950 this.isStatic = inType.get$isTop(); |
| 15409 this.isConst = false; | 14951 this.isConst = false; |
| 15410 this.isFactory = false; | 14952 this.isFactory = false; |
| 15411 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass()); | 14953 this.isAbstract = !this.declaringType.get$isClass(); |
| 15412 if (this.definition.modifiers != null) { | 14954 if (this.definition.modifiers != null) { |
| 15413 var $list = this.definition.modifiers; | 14955 var $list = this.definition.modifiers; |
| 15414 for (var $i = 0;$i < $list.length; $i++) { | 14956 for (var $i = 0;$i < $list.length; $i++) { |
| 15415 var mod = $list.$index($i); | 14957 var mod = $list.$index($i); |
| 15416 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { | 14958 if ($eq(mod.kind, 86/*TokenKind.STATIC*/)) { |
| 15417 if ($notnull_bool(this.isStatic)) { | 14959 if (this.isStatic) { |
| 15418 world.error('duplicate static modifier', mod.get$span()); | 14960 world.error('duplicate static modifier', mod.get$span()); |
| 15419 } | 14961 } |
| 15420 this.isStatic = true; | 14962 this.isStatic = true; |
| 15421 } | 14963 } |
| 15422 else if ($notnull_bool(this.get$isConstructor()) && $notnull_bool($eq(mod.
kind, 91/*TokenKind.CONST*/))) { | 14964 else if (this.get$isConstructor() && $eq(mod.kind, 91/*TokenKind.CONST*/))
{ |
| 15423 if ($notnull_bool(this.isConst)) { | 14965 if (this.isConst) { |
| 15424 world.error('duplicate const modifier', mod.get$span()); | 14966 world.error('duplicate const modifier', mod.get$span()); |
| 15425 } | 14967 } |
| 15426 this.isConst = true; | 14968 this.isConst = true; |
| 15427 } | 14969 } |
| 15428 else if ($notnull_bool($eq(mod.kind, 75/*TokenKind.FACTORY*/))) { | 14970 else if ($eq(mod.kind, 75/*TokenKind.FACTORY*/)) { |
| 15429 if ($notnull_bool(this.isFactory)) { | 14971 if (this.isFactory) { |
| 15430 world.error('duplicate factory modifier', mod.get$span()); | 14972 world.error('duplicate factory modifier', mod.get$span()); |
| 15431 } | 14973 } |
| 15432 this.isFactory = true; | 14974 this.isFactory = true; |
| 15433 } | 14975 } |
| 15434 else if ($notnull_bool($eq(mod.kind, 71/*TokenKind.ABSTRACT*/))) { | 14976 else if ($eq(mod.kind, 71/*TokenKind.ABSTRACT*/)) { |
| 15435 if ($notnull_bool(this.isAbstract)) { | 14977 if (this.isAbstract) { |
| 15436 if ($notnull_bool(this.declaringType.get$isClass())) { | 14978 if (this.declaringType.get$isClass()) { |
| 15437 world.error('duplicate abstract modifier', mod.get$span()); | 14979 world.error('duplicate abstract modifier', mod.get$span()); |
| 15438 } | 14980 } |
| 15439 else { | 14981 else { |
| 15440 world.error('abstract modifier not allowed on interface members', mo
d.get$span()); | 14982 world.error('abstract modifier not allowed on interface members', mo
d.get$span()); |
| 15441 } | 14983 } |
| 15442 } | 14984 } |
| 15443 this.isAbstract = true; | 14985 this.isAbstract = true; |
| 15444 } | 14986 } |
| 15445 else { | 14987 else { |
| 15446 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span
()); | 14988 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span
()); |
| 15447 } | 14989 } |
| 15448 } | 14990 } |
| 15449 } | 14991 } |
| 15450 if ($notnull_bool(this.isFactory)) { | 14992 if (this.isFactory) { |
| 15451 this.isStatic = true; | 14993 this.isStatic = true; |
| 15452 } | 14994 } |
| 15453 if ($notnull_bool(this.get$isOperator()) && $notnull_bool(this.isStatic) && !$
notnull_bool(this.get$isCallMethod())) { | 14995 if (this.get$isOperator() && this.isStatic && !this.get$isCallMethod()) { |
| 15454 world.error(('operator method may not be static "' + this.name + '"'), this.
get$span()); | 14996 world.error(('operator method may not be static "' + this.name + '"'), this.
get$span()); |
| 15455 } | 14997 } |
| 15456 if ($notnull_bool(this.isAbstract)) { | 14998 if (this.isAbstract) { |
| 15457 if (this.definition.body != null && !(this.declaringType.get$definition() in
stanceof FunctionTypeDefinition)) { | 14999 if (this.definition.body != null && !(this.declaringType.get$definition() in
stanceof FunctionTypeDefinition)) { |
| 15458 world.error('abstract method can not have a body', this.get$span()); | 15000 world.error('abstract method can not have a body', this.get$span()); |
| 15459 } | 15001 } |
| 15460 if ($notnull_bool(this.isStatic) && !(this.declaringType.get$definition() in
stanceof FunctionTypeDefinition)) { | 15002 if (this.isStatic && !(this.declaringType.get$definition() instanceof Functi
onTypeDefinition)) { |
| 15461 world.error('static method can not be abstract', this.get$span()); | 15003 world.error('static method can not be abstract', this.get$span()); |
| 15462 } | 15004 } |
| 15463 } | 15005 } |
| 15464 else { | 15006 else { |
| 15465 if (this.definition.body == null && !$notnull_bool(this.get$isConstructor())
) { | 15007 if (this.definition.body == null && !this.get$isConstructor()) { |
| 15466 world.error('method needs a body', this.get$span()); | 15008 world.error('method needs a body', this.get$span()); |
| 15467 } | 15009 } |
| 15468 } | 15010 } |
| 15469 if ($notnull_bool(this.get$isConstructor())) { | 15011 if (this.get$isConstructor()) { |
| 15470 this.returnType = this.declaringType; | 15012 this.returnType = this.declaringType; |
| 15471 } | 15013 } |
| 15472 else { | 15014 else { |
| 15473 this.returnType = inType.resolveType(this.definition.returnType, false); | 15015 this.returnType = inType.resolveType(this.definition.returnType, false); |
| 15474 if ($notnull_bool(this.isStatic) && $notnull_bool(this.returnType.get$hasTyp
eParams())) { | 15016 if (this.isStatic && this.returnType.get$hasTypeParams()) { |
| 15475 world.error('using type parameter in static context', this.definition.retu
rnType.span); | 15017 world.error('using type parameter in static context', this.definition.retu
rnType.span); |
| 15476 } | 15018 } |
| 15477 } | 15019 } |
| 15478 this.parameters = []; | 15020 this.parameters = []; |
| 15479 var $list = this.definition.formals; | 15021 var $list = this.definition.formals; |
| 15480 for (var $i = 0;$i < $list.length; $i++) { | 15022 for (var $i = 0;$i < $list.length; $i++) { |
| 15481 var formal = $list.$index($i); | 15023 var formal = $list.$index($i); |
| 15482 var param = new Parameter(formal); | 15024 var param = new Parameter(formal); |
| 15483 param.resolve$2(this, inType); | 15025 param.resolve$2(this, inType); |
| 15484 this.parameters.add(param); | 15026 this.parameters.add(param); |
| 15485 } | 15027 } |
| 15486 if (!$notnull_bool(this.isLambda)) { | 15028 if (!this.isLambda) { |
| 15487 this.get$library()._addMember(this); | 15029 this.get$library()._addMember(this); |
| 15488 } | 15030 } |
| 15489 } | 15031 } |
| 15490 MethodMember.prototype._get$3 = function($0, $1, $2) { | 15032 MethodMember.prototype._get$3 = function($0, $1, $2) { |
| 15491 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 15033 return this._get($0, $1, $2, false); |
| 15492 }; | 15034 }; |
| 15493 MethodMember.prototype._set$4 = function($0, $1, $2, $3) { | 15035 MethodMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 15494 return this._set(($0 && $0.is$MethodGenerator()), $1, ($2 && $2.is$Value()), (
$3 && $3.is$Value()), false); | 15036 return this._set($0, $1, $2, $3, false); |
| 15495 }; | 15037 }; |
| 15496 MethodMember.prototype.canInvoke$2 = function($0, $1) { | 15038 MethodMember.prototype.canInvoke$2 = function($0, $1) { |
| 15497 return this.canInvoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$Arguments(
))); | 15039 return this.canInvoke($0, $1); |
| 15498 }; | 15040 }; |
| 15499 MethodMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 15041 MethodMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 15500 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); | 15042 return this.invoke($0, $1, $2, $3, false); |
| 15501 }; | 15043 }; |
| 15502 MethodMember.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic)
{ | 15044 MethodMember.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic)
{ |
| 15503 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), $assert_bool(isDynamic)); | 15045 return this.invoke($0, $1, $2, $3, isDynamic); |
| 15504 }; | 15046 }; |
| 15505 MethodMember.prototype.invoke$5 = function($0, $1, $2, $3, $4) { | 15047 MethodMember.prototype.invoke$5 = function($0, $1, $2, $3, $4) { |
| 15506 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), $assert_bool($4)); | 15048 return this.invoke($0, $1, $2, $3, $4); |
| 15507 }; | 15049 }; |
| 15508 MethodMember.prototype.namesInOrder$1 = function($0) { | 15050 MethodMember.prototype.namesInOrder$1 = function($0) { |
| 15509 return this.namesInOrder(($0 && $0.is$Arguments())); | 15051 return this.namesInOrder($0); |
| 15510 }; | 15052 }; |
| 15511 MethodMember.prototype.provideFieldSyntax$0 = function() { | 15053 MethodMember.prototype.provideFieldSyntax$0 = function() { |
| 15512 return this.provideFieldSyntax(); | 15054 return this.provideFieldSyntax(); |
| 15513 }; | 15055 }; |
| 15514 MethodMember.prototype.providePropertySyntax$0 = function() { | 15056 MethodMember.prototype.providePropertySyntax$0 = function() { |
| 15515 return this.providePropertySyntax(); | 15057 return this.providePropertySyntax(); |
| 15516 }; | 15058 }; |
| 15517 MethodMember.prototype.resolve$1 = function($0) { | 15059 MethodMember.prototype.resolve$1 = function($0) { |
| 15518 return this.resolve(($0 && $0.is$lang_Type())); | 15060 return this.resolve($0); |
| 15519 }; | 15061 }; |
| 15520 // ********** Code for MemberSet ************** | 15062 // ********** Code for MemberSet ************** |
| 15521 function MemberSet(member, isVar) { | 15063 function MemberSet(member, isVar) { |
| 15522 this.name = member.name; | 15064 this.name = member.name; |
| 15523 this.members = [member]; | 15065 this.members = [member]; |
| 15524 this.jsname = member.get$jsname(); | 15066 this.jsname = member.get$jsname(); |
| 15525 this.isVar = isVar; | 15067 this.isVar = isVar; |
| 15526 // Initializers done | 15068 // Initializers done |
| 15527 } | 15069 } |
| 15528 MemberSet.prototype.is$MemberSet = function(){return this;}; | |
| 15529 MemberSet.prototype.get$name = function() { return this.name; }; | 15070 MemberSet.prototype.get$name = function() { return this.name; }; |
| 15530 MemberSet.prototype.get$members = function() { return this.members; }; | 15071 MemberSet.prototype.get$members = function() { return this.members; }; |
| 15531 MemberSet.prototype.get$jsname = function() { return this.jsname; }; | 15072 MemberSet.prototype.get$jsname = function() { return this.jsname; }; |
| 15532 MemberSet.prototype.get$isVar = function() { return this.isVar; }; | 15073 MemberSet.prototype.get$isVar = function() { return this.isVar; }; |
| 15533 MemberSet.prototype.toString = function() { | 15074 MemberSet.prototype.toString = function() { |
| 15534 return ('' + this.name + ':' + this.members.length + ''); | 15075 return ('' + this.name + ':' + this.members.length + ''); |
| 15535 } | 15076 } |
| 15536 MemberSet.prototype.get$containsMethods = function() { | 15077 MemberSet.prototype.get$containsMethods = function() { |
| 15537 return this.members.some((function (m) { | 15078 return this.members.some((function (m) { |
| 15538 return (m instanceof MethodMember); | 15079 return (m instanceof MethodMember); |
| 15539 }) | 15080 }) |
| 15540 ); | 15081 ); |
| 15541 } | 15082 } |
| 15542 MemberSet.prototype.add = function(member) { | 15083 MemberSet.prototype.add = function(member) { |
| 15543 return this.members.add(member); | 15084 return this.members.add(member); |
| 15544 } | 15085 } |
| 15545 MemberSet.prototype.get$isStatic = function() { | 15086 MemberSet.prototype.get$isStatic = function() { |
| 15546 return this.members.length == 1 && $notnull_bool(this.members.$index(0).get$is
Static()); | 15087 return this.members.length == 1 && this.members.$index(0).get$isStatic(); |
| 15547 } | 15088 } |
| 15548 MemberSet.prototype.get$isOperator = function() { | 15089 MemberSet.prototype.get$isOperator = function() { |
| 15549 return this.members.$index(0).get$isOperator(); | 15090 return this.members.$index(0).get$isOperator(); |
| 15550 } | 15091 } |
| 15551 MemberSet.prototype.canInvoke = function(context, args) { | 15092 MemberSet.prototype.canInvoke = function(context, args) { |
| 15552 return this.members.some((function (m) { | 15093 return this.members.some((function (m) { |
| 15553 return m.canInvoke$2(context, args); | 15094 return m.canInvoke$2(context, args); |
| 15554 }) | 15095 }) |
| 15555 ); | 15096 ); |
| 15556 } | 15097 } |
| 15557 MemberSet.prototype._makeError = function(node, target, action) { | 15098 MemberSet.prototype._makeError = function(node, target, action) { |
| 15558 if (!$notnull_bool(target.type.get$isVar())) { | 15099 if (!target.type.get$isVar()) { |
| 15559 world.warning(('could not find applicable ' + action + ' for "' + this.name
+ '"'), node.span); | 15100 world.warning(('could not find applicable ' + action + ' for "' + this.name
+ '"'), node.span); |
| 15560 } | 15101 } |
| 15561 return new Value(world.varType, ('' + target.code + '.' + this.jsname + '() /*
no applicable ' + action + '*/'), node.span, true); | 15102 return new Value(world.varType, ('' + target.code + '.' + this.jsname + '() /*
no applicable ' + action + '*/'), node.span, true); |
| 15562 } | 15103 } |
| 15563 MemberSet.prototype.get$treatAsField = function() { | 15104 MemberSet.prototype.get$treatAsField = function() { |
| 15564 if (this._treatAsField == null) { | 15105 if (this._treatAsField == null) { |
| 15565 this._treatAsField = true; | 15106 this._treatAsField = true; |
| 15566 var $list = this.members; | 15107 var $list = this.members; |
| 15567 for (var $i = 0;$i < $list.length; $i++) { | 15108 for (var $i = 0;$i < $list.length; $i++) { |
| 15568 var member = $list.$index($i); | 15109 var member = $list.$index($i); |
| 15569 if ($notnull_bool(member.get$requiresFieldSyntax())) { | 15110 if (member.get$requiresFieldSyntax()) { |
| 15570 this._treatAsField = true; | 15111 this._treatAsField = true; |
| 15571 break; | 15112 break; |
| 15572 } | 15113 } |
| 15573 if ($notnull_bool(member.get$prefersPropertySyntax())) { | 15114 if (member.get$prefersPropertySyntax()) { |
| 15574 this._treatAsField = false; | 15115 this._treatAsField = false; |
| 15575 } | 15116 } |
| 15576 } | 15117 } |
| 15577 var $list = this.members; | 15118 var $list = this.members; |
| 15578 for (var $i = 0;$i < $list.length; $i++) { | 15119 for (var $i = 0;$i < $list.length; $i++) { |
| 15579 var member = $list.$index($i); | 15120 var member = $list.$index($i); |
| 15580 if ($notnull_bool(this._treatAsField)) { | 15121 if (this._treatAsField) { |
| 15581 member.provideFieldSyntax$0(); | 15122 member.provideFieldSyntax$0(); |
| 15582 } | 15123 } |
| 15583 else { | 15124 else { |
| 15584 member.providePropertySyntax$0(); | 15125 member.providePropertySyntax$0(); |
| 15585 } | 15126 } |
| 15586 } | 15127 } |
| 15587 } | 15128 } |
| 15588 return this._treatAsField; | 15129 return this._treatAsField; |
| 15589 } | 15130 } |
| 15590 MemberSet.prototype._get = function(context, node, target, isDynamic) { | 15131 MemberSet.prototype._get = function(context, node, target, isDynamic) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 15601 var returnValue = null; | 15142 var returnValue = null; |
| 15602 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { | 15143 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { |
| 15603 var member = $i.next$0(); | 15144 var member = $i.next$0(); |
| 15604 var value = member._get(context, node, target, true); | 15145 var value = member._get(context, node, target, true); |
| 15605 returnValue = this._tryUnion(returnValue, value, node); | 15146 returnValue = this._tryUnion(returnValue, value, node); |
| 15606 } | 15147 } |
| 15607 if (returnValue == null) { | 15148 if (returnValue == null) { |
| 15608 return this._makeError(node, target, 'getter'); | 15149 return this._makeError(node, target, 'getter'); |
| 15609 } | 15150 } |
| 15610 if (returnValue.code == null) { | 15151 if (returnValue.code == null) { |
| 15611 if ($notnull_bool(this.get$treatAsField())) { | 15152 if (this.get$treatAsField()) { |
| 15612 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
''), node.span, true); | 15153 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
''), node.span, true); |
| 15613 } | 15154 } |
| 15614 else { | 15155 else { |
| 15615 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn
ame + '()'), node.span, true); | 15156 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn
ame + '()'), node.span, true); |
| 15616 } | 15157 } |
| 15617 } | 15158 } |
| 15618 return returnValue; | 15159 return returnValue; |
| 15619 } | 15160 } |
| 15620 MemberSet.prototype._set = function(context, node, target, value, isDynamic) { | 15161 MemberSet.prototype._set = function(context, node, target, value, isDynamic) { |
| 15621 if (this.members.length == 1) { | 15162 if (this.members.length == 1) { |
| 15622 return this.members.$index(0)._set(context, node, target, value, isDynamic); | 15163 return this.members.$index(0)._set(context, node, target, value, isDynamic); |
| 15623 } | 15164 } |
| 15624 var targets = this.members.filter((function (m) { | 15165 var targets = this.members.filter((function (m) { |
| 15625 return m.get$canSet(); | 15166 return m.get$canSet(); |
| 15626 }) | 15167 }) |
| 15627 ); | 15168 ); |
| 15628 if (targets.length == 1) { | 15169 if (targets.length == 1) { |
| 15629 return targets.$index(0)._set(context, node, target, value, isDynamic); | 15170 return targets.$index(0)._set(context, node, target, value, isDynamic); |
| 15630 } | 15171 } |
| 15631 var returnValue = null; | 15172 var returnValue = null; |
| 15632 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { | 15173 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { |
| 15633 var member = $i.next$0(); | 15174 var member = $i.next$0(); |
| 15634 var res = member._set(context, node, target, value, true); | 15175 var res = member._set(context, node, target, value, true); |
| 15635 returnValue = this._tryUnion(returnValue, res, node); | 15176 returnValue = this._tryUnion(returnValue, res, node); |
| 15636 } | 15177 } |
| 15637 if (returnValue == null) { | 15178 if (returnValue == null) { |
| 15638 return this._makeError(node, target, 'setter'); | 15179 return this._makeError(node, target, 'setter'); |
| 15639 } | 15180 } |
| 15640 if (returnValue.code == null) { | 15181 if (returnValue.code == null) { |
| 15641 if ($notnull_bool(this.get$treatAsField())) { | 15182 if (this.get$treatAsField()) { |
| 15642 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
' = ' + value.code + ''), node.span, true); | 15183 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
' = ' + value.code + ''), node.span, true); |
| 15643 } | 15184 } |
| 15644 else { | 15185 else { |
| 15645 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn
ame + '(' + value.code + ')'), node.span, true); | 15186 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn
ame + '(' + value.code + ')'), node.span, true); |
| 15646 } | 15187 } |
| 15647 } | 15188 } |
| 15648 return returnValue; | 15189 return returnValue; |
| 15649 } | 15190 } |
| 15650 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { | 15191 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 15651 var $0; | 15192 if (this.isVar && !this.get$isOperator()) { |
| 15652 if ($notnull_bool(this.isVar) && !$notnull_bool(this.get$isOperator())) { | |
| 15653 return this.invokeOnVar(context, node, target, args); | 15193 return this.invokeOnVar(context, node, target, args); |
| 15654 } | 15194 } |
| 15655 if (this.members.length == 1) { | 15195 if (this.members.length == 1) { |
| 15656 return (($0 = this.members.$index(0).invoke$5(context, node, target, args, i
sDynamic)) && $0.is$Value()); | 15196 return this.members.$index(0).invoke$5(context, node, target, args, isDynami
c); |
| 15657 } | 15197 } |
| 15658 var targets = this.members.filter((function (m) { | 15198 var targets = this.members.filter((function (m) { |
| 15659 return m.canInvoke$2(context, args); | 15199 return m.canInvoke$2(context, args); |
| 15660 }) | 15200 }) |
| 15661 ); | 15201 ); |
| 15662 if (targets.length == 1) { | 15202 if (targets.length == 1) { |
| 15663 return (($0 = targets.$index(0).invoke$5(context, node, target, args, isDyna
mic)) && $0.is$Value()); | 15203 return targets.$index(0).invoke$5(context, node, target, args, isDynamic); |
| 15664 } | 15204 } |
| 15665 var returnValue = null; | 15205 var returnValue = null; |
| 15666 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { | 15206 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { |
| 15667 var member = $i.next$0(); | 15207 var member = $i.next$0(); |
| 15668 var res = member.invoke$4$isDynamic(context, node, target, args, true); | 15208 var res = member.invoke$4$isDynamic(context, node, target, args, true); |
| 15669 returnValue = this._tryUnion(returnValue, (res && res.is$Value()), node); | 15209 returnValue = this._tryUnion(returnValue, res, node); |
| 15670 } | 15210 } |
| 15671 if (returnValue == null) { | 15211 if (returnValue == null) { |
| 15672 return this._makeError(node, target, 'method'); | 15212 return this._makeError(node, target, 'method'); |
| 15673 } | 15213 } |
| 15674 if (returnValue.code == null) { | 15214 if (returnValue.code == null) { |
| 15675 if (this.name == '\$call') { | 15215 if (this.name == '\$call') { |
| 15676 return target._varCall(context, args); | 15216 return target._varCall(context, args); |
| 15677 } | 15217 } |
| 15678 else if ($notnull_bool(this.get$isOperator())) { | 15218 else if (this.get$isOperator()) { |
| 15679 return target.invokeSpecial(this.name, args, returnValue.type); | 15219 return target.invokeSpecial(this.name, args, returnValue.type); |
| 15680 } | 15220 } |
| 15681 else { | 15221 else { |
| 15682 return this.invokeOnVar(context, node, target, args); | 15222 return this.invokeOnVar(context, node, target, args); |
| 15683 } | 15223 } |
| 15684 } | 15224 } |
| 15685 return returnValue; | 15225 return returnValue; |
| 15686 } | 15226 } |
| 15687 MemberSet.prototype.invokeOnVar = function(context, node, target, args) { | 15227 MemberSet.prototype.invokeOnVar = function(context, node, target, args) { |
| 15688 var member = this.getVarMember(context, node, args); | 15228 var member = this.getVarMember(context, node, args); |
| 15689 return member.invoke$4(context, node, target, args); | 15229 return member.invoke$4(context, node, target, args); |
| 15690 } | 15230 } |
| 15691 MemberSet.prototype._tryUnion = function(x, y, node) { | 15231 MemberSet.prototype._tryUnion = function(x, y, node) { |
| 15692 if (x == null) return y; | 15232 if (x == null) return y; |
| 15693 var type = lang_Type.union(x.type, y.type); | 15233 var type = lang_Type.union(x.type, y.type); |
| 15694 if (x.code == y.code) { | 15234 if (x.code == y.code) { |
| 15695 if ($notnull_bool($eq(type, x.type))) { | 15235 if ($eq(type, x.type)) { |
| 15696 return x; | 15236 return x; |
| 15697 } | 15237 } |
| 15698 else if ($notnull_bool(x.get$isConst()) || $notnull_bool(y.get$isConst())) { | 15238 else if (x.get$isConst() || y.get$isConst()) { |
| 15699 world.internalError("unexpected: union of const values "); | 15239 world.internalError("unexpected: union of const values "); |
| 15700 } | 15240 } |
| 15701 else { | 15241 else { |
| 15702 var ret = new Value(type, x.code, node.span, true); | 15242 var ret = new Value(type, x.code, node.span, true); |
| 15703 ret.isSuper = $notnull_bool(x.isSuper) && $notnull_bool(y.isSuper); | 15243 ret.isSuper = x.isSuper && y.isSuper; |
| 15704 ret.needsTemp = $notnull_bool(x.needsTemp) || $notnull_bool(y.needsTemp); | 15244 ret.needsTemp = x.needsTemp || y.needsTemp; |
| 15705 ret.isType = $notnull_bool(x.isType) && $notnull_bool(y.isType); | 15245 ret.isType = x.isType && y.isType; |
| 15706 return (ret && ret.is$Value()); | 15246 return ret; |
| 15707 } | 15247 } |
| 15708 } | 15248 } |
| 15709 else { | 15249 else { |
| 15710 return new Value(type, null, node.span, true); | 15250 return new Value(type, null, node.span, true); |
| 15711 } | 15251 } |
| 15712 } | 15252 } |
| 15713 MemberSet.prototype.getVarMember = function(context, node, args) { | 15253 MemberSet.prototype.getVarMember = function(context, node, args) { |
| 15714 if (world.objectType.varStubs == null) { | 15254 if (world.objectType.varStubs == null) { |
| 15715 world.objectType.varStubs = $map([]); | 15255 world.objectType.varStubs = $map([]); |
| 15716 } | 15256 } |
| 15717 var stubName = _getCallStubName(this.name, args); | 15257 var stubName = _getCallStubName(this.name, args); |
| 15718 var stub = world.objectType.varStubs.$index(stubName); | 15258 var stub = world.objectType.varStubs.$index(stubName); |
| 15719 if ($notnull_bool(stub == null)) { | 15259 if (stub == null) { |
| 15720 var mset = context.findMembers(this.name).members; | 15260 var mset = context.findMembers(this.name).members; |
| 15721 var targets = mset.filter((function (m) { | 15261 var targets = mset.filter((function (m) { |
| 15722 return m.canInvoke$2(context, args); | 15262 return m.canInvoke$2(context, args); |
| 15723 }) | 15263 }) |
| 15724 ); | 15264 ); |
| 15725 var returnType = reduce(map((targets && targets.is$Iterable()), (function (t
) { | 15265 var returnType = reduce(map(targets, (function (t) { |
| 15726 return t.get$returnType(); | 15266 return t.get$returnType(); |
| 15727 }) | 15267 }) |
| 15728 ), lang_Type.union); | 15268 ), lang_Type.union); |
| 15729 stub = new VarMethodSet($assert_String(stubName), targets, args, returnType)
; | 15269 stub = new VarMethodSet(stubName, targets, args, returnType); |
| 15730 world.objectType.varStubs.$setindex(stubName, stub); | 15270 world.objectType.varStubs.$setindex(stubName, stub); |
| 15731 } | 15271 } |
| 15732 return (stub && stub.is$VarMember()); | 15272 return stub; |
| 15733 } | 15273 } |
| 15734 MemberSet.prototype._get$3 = function($0, $1, $2) { | 15274 MemberSet.prototype._get$3 = function($0, $1, $2) { |
| 15735 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 15275 return this._get($0, $1, $2, false); |
| 15736 }; | 15276 }; |
| 15737 MemberSet.prototype._set$4 = function($0, $1, $2, $3) { | 15277 MemberSet.prototype._set$4 = function($0, $1, $2, $3) { |
| 15738 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); | 15278 return this._set($0, $1, $2, $3, false); |
| 15739 }; | 15279 }; |
| 15740 MemberSet.prototype.add$1 = function($0) { | 15280 MemberSet.prototype.add$1 = function($0) { |
| 15741 return this.add(($0 && $0.is$Member())); | 15281 return this.add($0); |
| 15742 }; | 15282 }; |
| 15743 MemberSet.prototype.canInvoke$2 = function($0, $1) { | 15283 MemberSet.prototype.canInvoke$2 = function($0, $1) { |
| 15744 return this.canInvoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$Arguments(
))); | 15284 return this.canInvoke($0, $1); |
| 15745 }; | 15285 }; |
| 15746 MemberSet.prototype.invoke$4 = function($0, $1, $2, $3) { | 15286 MemberSet.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 15747 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); | 15287 return this.invoke($0, $1, $2, $3, false); |
| 15748 }; | 15288 }; |
| 15749 MemberSet.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic) { | 15289 MemberSet.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic) { |
| 15750 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), $assert_bool(isDynamic)); | 15290 return this.invoke($0, $1, $2, $3, isDynamic); |
| 15751 }; | 15291 }; |
| 15752 MemberSet.prototype.invoke$5 = function($0, $1, $2, $3, $4) { | 15292 MemberSet.prototype.invoke$5 = function($0, $1, $2, $3, $4) { |
| 15753 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), $assert_bool($4)); | 15293 return this.invoke($0, $1, $2, $3, $4); |
| 15754 }; | 15294 }; |
| 15755 MemberSet.prototype.toString$0 = function() { | 15295 MemberSet.prototype.toString$0 = function() { |
| 15756 return this.toString(); | 15296 return this.toString(); |
| 15757 }; | 15297 }; |
| 15758 // ********** Code for FactoryMap ************** | 15298 // ********** Code for FactoryMap ************** |
| 15759 function FactoryMap() { | 15299 function FactoryMap() { |
| 15760 this.factories = $map([]); | 15300 this.factories = $map([]); |
| 15761 // Initializers done | 15301 // Initializers done |
| 15762 } | 15302 } |
| 15763 FactoryMap.prototype.getFactoriesFor = function(typeName) { | 15303 FactoryMap.prototype.getFactoriesFor = function(typeName) { |
| 15764 var ret = this.factories.$index(typeName); | 15304 var ret = this.factories.$index(typeName); |
| 15765 if ($notnull_bool(ret == null)) { | 15305 if (ret == null) { |
| 15766 ret = $map([]); | 15306 ret = $map([]); |
| 15767 this.factories.$setindex(typeName, ret); | 15307 this.factories.$setindex(typeName, ret); |
| 15768 } | 15308 } |
| 15769 return (ret && ret.is$Map$String$Member()); | 15309 return ret; |
| 15770 } | 15310 } |
| 15771 FactoryMap.prototype.addFactory = function(typeName, name, member) { | 15311 FactoryMap.prototype.addFactory = function(typeName, name, member) { |
| 15772 this.getFactoriesFor(typeName).$setindex(name, member); | 15312 this.getFactoriesFor(typeName).$setindex(name, member); |
| 15773 } | 15313 } |
| 15774 FactoryMap.prototype.getFactory = function(typeName, name) { | 15314 FactoryMap.prototype.getFactory = function(typeName, name) { |
| 15775 var $0; | 15315 return this.getFactoriesFor(typeName).$index(name); |
| 15776 return (($0 = this.getFactoriesFor(typeName).$index(name)) && $0.is$Member()); | |
| 15777 } | 15316 } |
| 15778 FactoryMap.prototype.forEach = function(f) { | 15317 FactoryMap.prototype.forEach = function(f) { |
| 15779 this.factories.forEach((function (_, constructors) { | 15318 this.factories.forEach((function (_, constructors) { |
| 15780 constructors.forEach((function (_, member) { | 15319 constructors.forEach((function (_, member) { |
| 15781 f(member); | 15320 f(member); |
| 15782 }) | 15321 }) |
| 15783 ); | 15322 ); |
| 15784 }) | 15323 }) |
| 15785 ); | 15324 ); |
| 15786 } | 15325 } |
| 15787 FactoryMap.prototype.getFactory$2 = function($0, $1) { | 15326 FactoryMap.prototype.getFactory$2 = function($0, $1) { |
| 15788 return this.getFactory($assert_String($0), $assert_String($1)); | 15327 return this.getFactory($0, $1); |
| 15789 }; | 15328 }; |
| 15790 // ********** Code for lang_Token ************** | 15329 // ********** Code for lang_Token ************** |
| 15791 function lang_Token(kind, source, start, end) { | 15330 function lang_Token(kind, source, start, end) { |
| 15792 this.kind = kind; | 15331 this.kind = kind; |
| 15793 this.source = source; | 15332 this.source = source; |
| 15794 this.start = start; | 15333 this.start = start; |
| 15795 this.end = end; | 15334 this.end = end; |
| 15796 // Initializers done | 15335 // Initializers done |
| 15797 } | 15336 } |
| 15798 lang_Token.prototype.get$text = function() { | 15337 lang_Token.prototype.get$text = function() { |
| 15799 return this.source.get$text().substring(this.start, this.end); | 15338 return this.source.get$text().substring(this.start, this.end); |
| 15800 } | 15339 } |
| 15801 lang_Token.prototype.toString = function() { | 15340 lang_Token.prototype.toString = function() { |
| 15802 var kindText = TokenKind.kindToString(this.kind); | 15341 var kindText = TokenKind.kindToString(this.kind); |
| 15803 var actualText = this.get$text(); | 15342 var actualText = this.get$text(); |
| 15804 if ($notnull_bool($ne(kindText, actualText))) { | 15343 if ($ne(kindText, actualText)) { |
| 15805 if (actualText.length > 10) { | 15344 if (actualText.length > 10) { |
| 15806 actualText = actualText.substring$2(0, 8) + '...'; | 15345 actualText = actualText.substring$2(0, 8) + '...'; |
| 15807 } | 15346 } |
| 15808 return ('' + kindText + '(' + actualText + ')'); | 15347 return ('' + kindText + '(' + actualText + ')'); |
| 15809 } | 15348 } |
| 15810 else { | 15349 else { |
| 15811 return $assert_String(kindText); | 15350 return kindText; |
| 15812 } | 15351 } |
| 15813 } | 15352 } |
| 15814 lang_Token.prototype.get$span = function() { | 15353 lang_Token.prototype.get$span = function() { |
| 15815 return new SourceSpan(this.source, this.start, this.end); | 15354 return new SourceSpan(this.source, this.start, this.end); |
| 15816 } | 15355 } |
| 15817 lang_Token.prototype.toString$0 = function() { | 15356 lang_Token.prototype.toString$0 = function() { |
| 15818 return this.toString(); | 15357 return this.toString(); |
| 15819 }; | 15358 }; |
| 15820 // ********** Code for SourceFile ************** | 15359 // ********** Code for SourceFile ************** |
| 15821 function SourceFile(filename, _text) { | 15360 function SourceFile(filename, _text) { |
| 15822 this.filename = filename; | 15361 this.filename = filename; |
| 15823 this._text = _text; | 15362 this._text = _text; |
| 15824 // Initializers done | 15363 // Initializers done |
| 15825 } | 15364 } |
| 15826 SourceFile.prototype.is$SourceFile = function(){return this;}; | |
| 15827 SourceFile.prototype.is$Comparable = function(){return this;}; | |
| 15828 SourceFile.prototype.get$text = function() { | 15365 SourceFile.prototype.get$text = function() { |
| 15829 return this._text; | 15366 return this._text; |
| 15830 } | 15367 } |
| 15831 SourceFile.prototype.get$lineStarts = function() { | 15368 SourceFile.prototype.get$lineStarts = function() { |
| 15832 if (this._lineStarts == null) { | 15369 if (this._lineStarts == null) { |
| 15833 var starts = [0]; | 15370 var starts = [0]; |
| 15834 var index = 0; | 15371 var index = 0; |
| 15835 while (index < this.get$text().length) { | 15372 while (index < this.get$text().length) { |
| 15836 index = this.get$text().indexOf('\n', $assert_num(index)) + 1; | 15373 index = this.get$text().indexOf('\n', index) + 1; |
| 15837 if (index <= 0) break; | 15374 if (index <= 0) break; |
| 15838 starts.add$1(index); | 15375 starts.add$1(index); |
| 15839 } | 15376 } |
| 15840 starts.add$1(this.get$text().length + 1); | 15377 starts.add$1(this.get$text().length + 1); |
| 15841 this._lineStarts = (starts && starts.is$List$int()); | 15378 this._lineStarts = starts; |
| 15842 } | 15379 } |
| 15843 return this._lineStarts; | 15380 return this._lineStarts; |
| 15844 } | 15381 } |
| 15845 SourceFile.prototype.getLine = function(position) { | 15382 SourceFile.prototype.getLine = function(position) { |
| 15846 var starts = this.get$lineStarts(); | 15383 var starts = this.get$lineStarts(); |
| 15847 for (var i = 0; | 15384 for (var i = 0; |
| 15848 i < starts.length; i++) { | 15385 i < starts.length; i++) { |
| 15849 if (starts.$index(i) > position) return i - 1; | 15386 if (starts.$index(i) > position) return i - 1; |
| 15850 } | 15387 } |
| 15851 world.internalError('bad position'); | 15388 world.internalError('bad position'); |
| 15852 } | 15389 } |
| 15853 SourceFile.prototype.getColumn = function(line, position) { | 15390 SourceFile.prototype.getColumn = function(line, position) { |
| 15854 return position - $assert_num(this.get$lineStarts().$index(line)); | 15391 return position - this.get$lineStarts().$index(line); |
| 15855 } | 15392 } |
| 15856 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT
ext) { | 15393 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT
ext) { |
| 15857 var line = this.getLine(start); | 15394 var line = this.getLine(start); |
| 15858 var column = this.getColumn($assert_num(line), start); | 15395 var column = this.getColumn(line, start); |
| 15859 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' +
(column + 1) + ': ' + message + '')); | 15396 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' +
(column + 1) + ': ' + message + '')); |
| 15860 if ($notnull_bool(includeText)) { | 15397 if (includeText) { |
| 15861 buf.add$1('\n'); | 15398 buf.add$1('\n'); |
| 15862 var textLine; | 15399 var textLine; |
| 15863 if ((line + 2) < this._lineStarts.length) { | 15400 if ((line + 2) < this._lineStarts.length) { |
| 15864 textLine = this.get$text().substring($assert_num(this._lineStarts.$index(l
ine)), $assert_num(this._lineStarts.$index(line + 1))); | 15401 textLine = this.get$text().substring(this._lineStarts.$index(line), this._
lineStarts.$index(line + 1)); |
| 15865 } | 15402 } |
| 15866 else { | 15403 else { |
| 15867 textLine = this.get$text().substring($assert_num(this._lineStarts.$index(l
ine))) + '\n'; | 15404 textLine = this.get$text().substring(this._lineStarts.$index(line)) + '\n'
; |
| 15868 } | 15405 } |
| 15869 buf.add$1(textLine); | 15406 buf.add$1(textLine); |
| 15870 var i = 0; | 15407 var i = 0; |
| 15871 for (; i < $assert_num(column); i++) { | 15408 for (; i < column; i++) { |
| 15872 buf.add$1(' '); | 15409 buf.add$1(' '); |
| 15873 } | 15410 } |
| 15874 var toColumn = Math.min($assert_num(column + (end - start)), textLine.length
); | 15411 var toColumn = Math.min(column + (end - start), textLine.length); |
| 15875 for (; i < toColumn; i++) { | 15412 for (; i < toColumn; i++) { |
| 15876 buf.add$1('^'); | 15413 buf.add$1('^'); |
| 15877 } | 15414 } |
| 15878 } | 15415 } |
| 15879 return buf.toString$0(); | 15416 return buf.toString$0(); |
| 15880 } | 15417 } |
| 15881 SourceFile.prototype.compareTo = function(other) { | 15418 SourceFile.prototype.compareTo = function(other) { |
| 15882 if (this.orderInLibrary != null && other.orderInLibrary != null) { | 15419 if (this.orderInLibrary != null && other.orderInLibrary != null) { |
| 15883 return this.orderInLibrary - other.orderInLibrary; | 15420 return this.orderInLibrary - other.orderInLibrary; |
| 15884 } | 15421 } |
| 15885 else { | 15422 else { |
| 15886 return this.filename.compareTo(other.filename); | 15423 return this.filename.compareTo(other.filename); |
| 15887 } | 15424 } |
| 15888 } | 15425 } |
| 15889 SourceFile.prototype.compareTo$1 = function($0) { | 15426 SourceFile.prototype.compareTo$1 = function($0) { |
| 15890 return this.compareTo(($0 && $0.is$SourceFile())); | 15427 return this.compareTo($0); |
| 15891 }; | 15428 }; |
| 15892 // ********** Code for SourceSpan ************** | 15429 // ********** Code for SourceSpan ************** |
| 15893 function SourceSpan(file, start, end) { | 15430 function SourceSpan(file, start, end) { |
| 15894 this.file = file; | 15431 this.file = file; |
| 15895 this.start = start; | 15432 this.start = start; |
| 15896 this.end = end; | 15433 this.end = end; |
| 15897 // Initializers done | 15434 // Initializers done |
| 15898 } | 15435 } |
| 15899 SourceSpan.prototype.is$SourceSpan = function(){return this;}; | |
| 15900 SourceSpan.prototype.is$Comparable = function(){return this;}; | |
| 15901 SourceSpan.prototype.get$text = function() { | 15436 SourceSpan.prototype.get$text = function() { |
| 15902 return this.file.get$text().substring(this.start, this.end); | 15437 return this.file.get$text().substring(this.start, this.end); |
| 15903 } | 15438 } |
| 15904 SourceSpan.prototype.toMessageString = function(message) { | 15439 SourceSpan.prototype.toMessageString = function(message) { |
| 15905 return this.file.getLocationMessage(message, this.start, this.end, true); | 15440 return this.file.getLocationMessage(message, this.start, this.end, true); |
| 15906 } | 15441 } |
| 15907 SourceSpan.prototype.get$locationText = function() { | 15442 SourceSpan.prototype.get$locationText = function() { |
| 15908 var line = this.file.getLine(this.start); | 15443 var line = this.file.getLine(this.start); |
| 15909 var column = this.file.getColumn($assert_num(line), this.start); | 15444 var column = this.file.getColumn(line, this.start); |
| 15910 return ('' + this.file.filename + ':' + (line + 1) + ':' + (column + 1) + ''); | 15445 return ('' + this.file.filename + ':' + (line + 1) + ':' + (column + 1) + ''); |
| 15911 } | 15446 } |
| 15912 SourceSpan.prototype.compareTo = function(other) { | 15447 SourceSpan.prototype.compareTo = function(other) { |
| 15913 if ($eq(this.file, other.file)) { | 15448 if ($eq(this.file, other.file)) { |
| 15914 var d = this.start - other.start; | 15449 var d = this.start - other.start; |
| 15915 return d == 0 ? (this.end - other.end) : d; | 15450 return d == 0 ? (this.end - other.end) : d; |
| 15916 } | 15451 } |
| 15917 return this.file.compareTo(other.file); | 15452 return this.file.compareTo(other.file); |
| 15918 } | 15453 } |
| 15919 SourceSpan.prototype.compareTo$1 = function($0) { | 15454 SourceSpan.prototype.compareTo$1 = function($0) { |
| 15920 return this.compareTo(($0 && $0.is$SourceSpan())); | 15455 return this.compareTo($0); |
| 15921 }; | 15456 }; |
| 15922 // ********** Code for InterpStack ************** | 15457 // ********** Code for InterpStack ************** |
| 15923 function InterpStack(previous, quote, isMultiline) { | 15458 function InterpStack(previous, quote, isMultiline) { |
| 15924 this.previous = previous; | 15459 this.previous = previous; |
| 15925 this.quote = quote; | 15460 this.quote = quote; |
| 15926 this.isMultiline = isMultiline; | 15461 this.isMultiline = isMultiline; |
| 15927 this.depth = -1; | 15462 this.depth = -1; |
| 15928 // Initializers done | 15463 // Initializers done |
| 15929 } | 15464 } |
| 15930 InterpStack.prototype.is$InterpStack = function(){return this;}; | |
| 15931 InterpStack.prototype.pop = function() { | 15465 InterpStack.prototype.pop = function() { |
| 15932 return this.previous; | 15466 return this.previous; |
| 15933 } | 15467 } |
| 15934 InterpStack.push = function(stack, quote, isMultiline) { | 15468 InterpStack.push = function(stack, quote, isMultiline) { |
| 15935 var newStack = new InterpStack(stack, quote, isMultiline); | 15469 var newStack = new InterpStack(stack, quote, isMultiline); |
| 15936 if (stack != null) newStack.previous = stack; | 15470 if (stack != null) newStack.previous = stack; |
| 15937 return (newStack && newStack.is$InterpStack()); | 15471 return newStack; |
| 15938 } | 15472 } |
| 15939 InterpStack.prototype.next$0 = function() { | 15473 InterpStack.prototype.next$0 = function() { |
| 15940 return this.next(); | 15474 return this.next(); |
| 15941 }; | 15475 }; |
| 15942 // ********** Code for TokenizerBase ************** | 15476 // ********** Code for TokenizerBase ************** |
| 15943 function TokenizerBase(_source, _skipWhitespace, _index) { | 15477 function TokenizerBase(_source, _skipWhitespace, _index) { |
| 15944 this._source = _source; | 15478 this._source = _source; |
| 15945 this._skipWhitespace = _skipWhitespace; | 15479 this._skipWhitespace = _skipWhitespace; |
| 15946 this._lang_index = _index; | 15480 this._lang_index = _index; |
| 15947 // Initializers done | 15481 // Initializers done |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15979 } | 15513 } |
| 15980 } | 15514 } |
| 15981 TokenizerBase.prototype._finishToken = function(kind) { | 15515 TokenizerBase.prototype._finishToken = function(kind) { |
| 15982 return new lang_Token(kind, this._source, this._startIndex, this._lang_index); | 15516 return new lang_Token(kind, this._source, this._startIndex, this._lang_index); |
| 15983 } | 15517 } |
| 15984 TokenizerBase.prototype._errorToken = function() { | 15518 TokenizerBase.prototype._errorToken = function() { |
| 15985 return this._finishToken(65/*TokenKind.ERROR*/); | 15519 return this._finishToken(65/*TokenKind.ERROR*/); |
| 15986 } | 15520 } |
| 15987 TokenizerBase.prototype.finishWhitespace = function() { | 15521 TokenizerBase.prototype.finishWhitespace = function() { |
| 15988 while (this._lang_index < this._text.length) { | 15522 while (this._lang_index < this._text.length) { |
| 15989 if (!$notnull_bool(TokenizerHelpers.isWhitespace(this._text.charCodeAt(this.
_lang_index++)))) { | 15523 if (!TokenizerHelpers.isWhitespace(this._text.charCodeAt(this._lang_index++)
)) { |
| 15990 this._lang_index--; | 15524 this._lang_index--; |
| 15991 if ($notnull_bool(this._skipWhitespace)) { | 15525 if (this._skipWhitespace) { |
| 15992 return this.next(); | 15526 return this.next(); |
| 15993 } | 15527 } |
| 15994 else { | 15528 else { |
| 15995 return this._finishToken(63/*TokenKind.WHITESPACE*/); | 15529 return this._finishToken(63/*TokenKind.WHITESPACE*/); |
| 15996 } | 15530 } |
| 15997 } | 15531 } |
| 15998 } | 15532 } |
| 15999 return this._finishToken(1/*TokenKind.END_OF_FILE*/); | 15533 return this._finishToken(1/*TokenKind.END_OF_FILE*/); |
| 16000 } | 15534 } |
| 16001 TokenizerBase.prototype.finishHashBang = function() { | 15535 TokenizerBase.prototype.finishHashBang = function() { |
| 16002 while (true) { | 15536 while (true) { |
| 16003 var ch = this._nextChar(); | 15537 var ch = this._nextChar(); |
| 16004 if (ch == 0 || ch == 10 || ch == 13) { | 15538 if (ch == 0 || ch == 10 || ch == 13) { |
| 16005 return this._finishToken(13/*TokenKind.HASHBANG*/); | 15539 return this._finishToken(13/*TokenKind.HASHBANG*/); |
| 16006 } | 15540 } |
| 16007 } | 15541 } |
| 16008 } | 15542 } |
| 16009 TokenizerBase.prototype.finishSingleLineComment = function() { | 15543 TokenizerBase.prototype.finishSingleLineComment = function() { |
| 16010 while (true) { | 15544 while (true) { |
| 16011 var ch = this._nextChar(); | 15545 var ch = this._nextChar(); |
| 16012 if (ch == 0 || ch == 10 || ch == 13) { | 15546 if (ch == 0 || ch == 10 || ch == 13) { |
| 16013 if ($notnull_bool(this._skipWhitespace)) { | 15547 if (this._skipWhitespace) { |
| 16014 return this.next(); | 15548 return this.next(); |
| 16015 } | 15549 } |
| 16016 else { | 15550 else { |
| 16017 return this._finishToken(64/*TokenKind.COMMENT*/); | 15551 return this._finishToken(64/*TokenKind.COMMENT*/); |
| 16018 } | 15552 } |
| 16019 } | 15553 } |
| 16020 } | 15554 } |
| 16021 } | 15555 } |
| 16022 TokenizerBase.prototype.finishMultiLineComment = function() { | 15556 TokenizerBase.prototype.finishMultiLineComment = function() { |
| 16023 while (true) { | 15557 while (true) { |
| 16024 var ch = this._nextChar(); | 15558 var ch = this._nextChar(); |
| 16025 if (ch == 0) { | 15559 if (ch == 0) { |
| 16026 return this._finishToken(67/*TokenKind.INCOMPLETE_COMMENT*/); | 15560 return this._finishToken(67/*TokenKind.INCOMPLETE_COMMENT*/); |
| 16027 } | 15561 } |
| 16028 else if (ch == 42) { | 15562 else if (ch == 42) { |
| 16029 if ($notnull_bool(this._maybeEatChar(47))) { | 15563 if (this._maybeEatChar(47)) { |
| 16030 if ($notnull_bool(this._skipWhitespace)) { | 15564 if (this._skipWhitespace) { |
| 16031 return this.next(); | 15565 return this.next(); |
| 16032 } | 15566 } |
| 16033 else { | 15567 else { |
| 16034 return this._finishToken(64/*TokenKind.COMMENT*/); | 15568 return this._finishToken(64/*TokenKind.COMMENT*/); |
| 16035 } | 15569 } |
| 16036 } | 15570 } |
| 16037 } | 15571 } |
| 16038 } | 15572 } |
| 16039 return this._errorToken(); | 15573 return this._errorToken(); |
| 16040 } | 15574 } |
| 16041 TokenizerBase.prototype.eatDigits = function() { | 15575 TokenizerBase.prototype.eatDigits = function() { |
| 16042 while (this._lang_index < this._text.length) { | 15576 while (this._lang_index < this._text.length) { |
| 16043 if ($notnull_bool(TokenizerHelpers.isDigit(this._text.charCodeAt(this._lang_
index)))) { | 15577 if (TokenizerHelpers.isDigit(this._text.charCodeAt(this._lang_index))) { |
| 16044 this._lang_index++; | 15578 this._lang_index++; |
| 16045 } | 15579 } |
| 16046 else { | 15580 else { |
| 16047 return; | 15581 return; |
| 16048 } | 15582 } |
| 16049 } | 15583 } |
| 16050 } | 15584 } |
| 16051 TokenizerBase.prototype.eatHexDigits = function() { | 15585 TokenizerBase.prototype.eatHexDigits = function() { |
| 16052 while (this._lang_index < this._text.length) { | 15586 while (this._lang_index < this._text.length) { |
| 16053 if ($notnull_bool(TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._la
ng_index)))) { | 15587 if (TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._lang_index))) { |
| 16054 this._lang_index++; | 15588 this._lang_index++; |
| 16055 } | 15589 } |
| 16056 else { | 15590 else { |
| 16057 return; | 15591 return; |
| 16058 } | 15592 } |
| 16059 } | 15593 } |
| 16060 } | 15594 } |
| 16061 TokenizerBase.prototype.maybeEatHexDigit = function() { | 15595 TokenizerBase.prototype.maybeEatHexDigit = function() { |
| 16062 if (this._lang_index < this._text.length && $notnull_bool(TokenizerHelpers.isH
exDigit(this._text.charCodeAt(this._lang_index)))) { | 15596 if (this._lang_index < this._text.length && TokenizerHelpers.isHexDigit(this._
text.charCodeAt(this._lang_index))) { |
| 16063 this._lang_index++; | 15597 this._lang_index++; |
| 16064 return true; | 15598 return true; |
| 16065 } | 15599 } |
| 16066 return false; | 15600 return false; |
| 16067 } | 15601 } |
| 16068 TokenizerBase.prototype.finishHex = function() { | 15602 TokenizerBase.prototype.finishHex = function() { |
| 16069 this.eatHexDigits(); | 15603 this.eatHexDigits(); |
| 16070 return this._finishToken(61/*TokenKind.HEX_INTEGER*/); | 15604 return this._finishToken(61/*TokenKind.HEX_INTEGER*/); |
| 16071 } | 15605 } |
| 16072 TokenizerBase.prototype.finishNumber = function() { | 15606 TokenizerBase.prototype.finishNumber = function() { |
| 16073 this.eatDigits(); | 15607 this.eatDigits(); |
| 16074 if (this._peekChar() == 46) { | 15608 if (this._peekChar() == 46) { |
| 16075 this._nextChar(); | 15609 this._nextChar(); |
| 16076 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { | 15610 if (TokenizerHelpers.isDigit(this._peekChar())) { |
| 16077 this.eatDigits(); | 15611 this.eatDigits(); |
| 16078 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); | 15612 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); |
| 16079 } | 15613 } |
| 16080 else { | 15614 else { |
| 16081 this._lang_index--; | 15615 this._lang_index--; |
| 16082 } | 15616 } |
| 16083 } | 15617 } |
| 16084 return this.finishNumberExtra(60/*TokenKind.INTEGER*/); | 15618 return this.finishNumberExtra(60/*TokenKind.INTEGER*/); |
| 16085 } | 15619 } |
| 16086 TokenizerBase.prototype.finishNumberExtra = function(kind) { | 15620 TokenizerBase.prototype.finishNumberExtra = function(kind) { |
| 16087 if ($notnull_bool(this._maybeEatChar(101)) || $notnull_bool(this._maybeEatChar
(69))) { | 15621 if (this._maybeEatChar(101) || this._maybeEatChar(69)) { |
| 16088 kind = 62/*TokenKind.DOUBLE*/; | 15622 kind = 62/*TokenKind.DOUBLE*/; |
| 16089 this._maybeEatChar(45); | 15623 this._maybeEatChar(45); |
| 16090 this._maybeEatChar(43); | 15624 this._maybeEatChar(43); |
| 16091 this.eatDigits(); | 15625 this.eatDigits(); |
| 16092 } | 15626 } |
| 16093 if (this._peekChar() != 0 && $notnull_bool(TokenizerHelpers.isIdentifierStart(
this._peekChar()))) { | 15627 if (this._peekChar() != 0 && TokenizerHelpers.isIdentifierStart(this._peekChar
())) { |
| 16094 this._nextChar(); | 15628 this._nextChar(); |
| 16095 return this._errorToken(); | 15629 return this._errorToken(); |
| 16096 } | 15630 } |
| 16097 return this._finishToken(kind); | 15631 return this._finishToken(kind); |
| 16098 } | 15632 } |
| 16099 TokenizerBase.prototype.finishMultilineString = function(quote) { | 15633 TokenizerBase.prototype.finishMultilineString = function(quote) { |
| 16100 while (true) { | 15634 while (true) { |
| 16101 var ch = this._nextChar(); | 15635 var ch = this._nextChar(); |
| 16102 if (ch == 0) { | 15636 if (ch == 0) { |
| 16103 var kind = quote == 34 ? 68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/ :
69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; | 15637 var kind = quote == 34 ? 68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/ :
69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; |
| 16104 return this._finishToken(kind); | 15638 return this._finishToken(kind); |
| 16105 } | 15639 } |
| 16106 else if (ch == quote) { | 15640 else if (ch == quote) { |
| 16107 if ($notnull_bool(this._maybeEatChar(quote))) { | 15641 if (this._maybeEatChar(quote)) { |
| 16108 if ($notnull_bool(this._maybeEatChar(quote))) { | 15642 if (this._maybeEatChar(quote)) { |
| 16109 return this._finishToken(58/*TokenKind.STRING*/); | 15643 return this._finishToken(58/*TokenKind.STRING*/); |
| 16110 } | 15644 } |
| 16111 } | 15645 } |
| 16112 } | 15646 } |
| 16113 else if (ch == 36) { | 15647 else if (ch == 36) { |
| 16114 this._interpStack = InterpStack.push(this._interpStack, quote, true); | 15648 this._interpStack = InterpStack.push(this._interpStack, quote, true); |
| 16115 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); | 15649 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 16116 } | 15650 } |
| 16117 else if (ch == 92) { | 15651 else if (ch == 92) { |
| 16118 if (!$notnull_bool(this.eatEscapeSequence())) { | 15652 if (!this.eatEscapeSequence()) { |
| 16119 return this._errorToken(); | 15653 return this._errorToken(); |
| 16120 } | 15654 } |
| 16121 } | 15655 } |
| 16122 } | 15656 } |
| 16123 } | 15657 } |
| 16124 TokenizerBase.prototype._finishOpenBrace = function() { | 15658 TokenizerBase.prototype._finishOpenBrace = function() { |
| 16125 var $0; | 15659 var $0; |
| 16126 if (this._interpStack != null) { | 15660 if (this._interpStack != null) { |
| 16127 if (this._interpStack.depth == -1) { | 15661 if (this._interpStack.depth == -1) { |
| 16128 this._interpStack.depth = 1; | 15662 this._interpStack.depth = 1; |
| 16129 } | 15663 } |
| 16130 else { | 15664 else { |
| 16131 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenize
r.dart", 261, 16); | |
| 16132 ($0 = this._interpStack).depth = $0.depth + 1; | 15665 ($0 = this._interpStack).depth = $0.depth + 1; |
| 16133 } | 15666 } |
| 16134 } | 15667 } |
| 16135 return this._finishToken(6/*TokenKind.LBRACE*/); | 15668 return this._finishToken(6/*TokenKind.LBRACE*/); |
| 16136 } | 15669 } |
| 16137 TokenizerBase.prototype._finishCloseBrace = function() { | 15670 TokenizerBase.prototype._finishCloseBrace = function() { |
| 16138 var $0; | 15671 var $0; |
| 16139 if (this._interpStack != null) { | 15672 if (this._interpStack != null) { |
| 16140 ($0 = this._interpStack).depth = $0.depth - 1; | 15673 ($0 = this._interpStack).depth = $0.depth - 1; |
| 16141 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenizer.
dart", 271, 14); | |
| 16142 } | 15674 } |
| 16143 return this._finishToken(7/*TokenKind.RBRACE*/); | 15675 return this._finishToken(7/*TokenKind.RBRACE*/); |
| 16144 } | 15676 } |
| 16145 TokenizerBase.prototype.finishString = function(quote) { | 15677 TokenizerBase.prototype.finishString = function(quote) { |
| 16146 if ($notnull_bool(this._maybeEatChar(quote))) { | 15678 if (this._maybeEatChar(quote)) { |
| 16147 if ($notnull_bool(this._maybeEatChar(quote))) { | 15679 if (this._maybeEatChar(quote)) { |
| 16148 return this.finishMultilineString(quote); | 15680 return this.finishMultilineString(quote); |
| 16149 } | 15681 } |
| 16150 else { | 15682 else { |
| 16151 return this._finishToken(58/*TokenKind.STRING*/); | 15683 return this._finishToken(58/*TokenKind.STRING*/); |
| 16152 } | 15684 } |
| 16153 } | 15685 } |
| 16154 return this.finishStringBody(quote); | 15686 return this.finishStringBody(quote); |
| 16155 } | 15687 } |
| 16156 TokenizerBase.prototype.finishRawString = function(quote) { | 15688 TokenizerBase.prototype.finishRawString = function(quote) { |
| 16157 if ($notnull_bool(this._maybeEatChar(quote))) { | 15689 if (this._maybeEatChar(quote)) { |
| 16158 if ($notnull_bool(this._maybeEatChar(quote))) { | 15690 if (this._maybeEatChar(quote)) { |
| 16159 return this.finishMultilineRawString(quote); | 15691 return this.finishMultilineRawString(quote); |
| 16160 } | 15692 } |
| 16161 else { | 15693 else { |
| 16162 return this._finishToken(58/*TokenKind.STRING*/); | 15694 return this._finishToken(58/*TokenKind.STRING*/); |
| 16163 } | 15695 } |
| 16164 } | 15696 } |
| 16165 while (true) { | 15697 while (true) { |
| 16166 var ch = this._nextChar(); | 15698 var ch = this._nextChar(); |
| 16167 if (ch == quote) { | 15699 if (ch == quote) { |
| 16168 return this._finishToken(58/*TokenKind.STRING*/); | 15700 return this._finishToken(58/*TokenKind.STRING*/); |
| 16169 } | 15701 } |
| 16170 else if (ch == 0) { | 15702 else if (ch == 0) { |
| 16171 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); | 15703 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 16172 } | 15704 } |
| 16173 } | 15705 } |
| 16174 } | 15706 } |
| 16175 TokenizerBase.prototype.finishMultilineRawString = function(quote) { | 15707 TokenizerBase.prototype.finishMultilineRawString = function(quote) { |
| 16176 while (true) { | 15708 while (true) { |
| 16177 var ch = this._nextChar(); | 15709 var ch = this._nextChar(); |
| 16178 if (ch == 0) { | 15710 if (ch == 0) { |
| 16179 var kind = quote == 34 ? 68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/ :
69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; | 15711 var kind = quote == 34 ? 68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/ :
69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; |
| 16180 return this._finishToken(kind); | 15712 return this._finishToken(kind); |
| 16181 } | 15713 } |
| 16182 else if (ch == quote && $notnull_bool(this._maybeEatChar(quote)) && $notnull
_bool(this._maybeEatChar(quote))) { | 15714 else if (ch == quote && this._maybeEatChar(quote) && this._maybeEatChar(quot
e)) { |
| 16183 return this._finishToken(58/*TokenKind.STRING*/); | 15715 return this._finishToken(58/*TokenKind.STRING*/); |
| 16184 } | 15716 } |
| 16185 } | 15717 } |
| 16186 } | 15718 } |
| 16187 TokenizerBase.prototype.finishStringBody = function(quote) { | 15719 TokenizerBase.prototype.finishStringBody = function(quote) { |
| 16188 while (true) { | 15720 while (true) { |
| 16189 var ch = this._nextChar(); | 15721 var ch = this._nextChar(); |
| 16190 if (ch == quote) { | 15722 if (ch == quote) { |
| 16191 return this._finishToken(58/*TokenKind.STRING*/); | 15723 return this._finishToken(58/*TokenKind.STRING*/); |
| 16192 } | 15724 } |
| 16193 else if (ch == 36) { | 15725 else if (ch == 36) { |
| 16194 this._interpStack = InterpStack.push(this._interpStack, quote, false); | 15726 this._interpStack = InterpStack.push(this._interpStack, quote, false); |
| 16195 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); | 15727 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 16196 } | 15728 } |
| 16197 else if (ch == 0) { | 15729 else if (ch == 0) { |
| 16198 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); | 15730 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 16199 } | 15731 } |
| 16200 else if (ch == 92) { | 15732 else if (ch == 92) { |
| 16201 if (!$notnull_bool(this.eatEscapeSequence())) { | 15733 if (!this.eatEscapeSequence()) { |
| 16202 return this._errorToken(); | 15734 return this._errorToken(); |
| 16203 } | 15735 } |
| 16204 } | 15736 } |
| 16205 } | 15737 } |
| 16206 } | 15738 } |
| 16207 TokenizerBase.prototype.eatEscapeSequence = function() { | 15739 TokenizerBase.prototype.eatEscapeSequence = function() { |
| 16208 var hex; | 15740 var hex; |
| 16209 switch (this._nextChar()) { | 15741 switch (this._nextChar()) { |
| 16210 case 120: | 15742 case 120: |
| 16211 | 15743 |
| 16212 return $notnull_bool(this.maybeEatHexDigit()) && $notnull_bool(this.maybeE
atHexDigit()); | 15744 return this.maybeEatHexDigit() && this.maybeEatHexDigit(); |
| 16213 | 15745 |
| 16214 case 117: | 15746 case 117: |
| 16215 | 15747 |
| 16216 if ($notnull_bool(this._maybeEatChar(123))) { | 15748 if (this._maybeEatChar(123)) { |
| 16217 var start = this._lang_index; | 15749 var start = this._lang_index; |
| 16218 this.eatHexDigits(); | 15750 this.eatHexDigits(); |
| 16219 var chars = this._lang_index - start; | 15751 var chars = this._lang_index - start; |
| 16220 if (chars > 0 && chars <= 6 && $notnull_bool(this._maybeEatChar(125))) { | 15752 if (chars > 0 && chars <= 6 && this._maybeEatChar(125)) { |
| 16221 hex = this._text.substring(start, start + chars); | 15753 hex = this._text.substring(start, start + chars); |
| 16222 break; | 15754 break; |
| 16223 } | 15755 } |
| 16224 else { | 15756 else { |
| 16225 return false; | 15757 return false; |
| 16226 } | 15758 } |
| 16227 } | 15759 } |
| 16228 else { | 15760 else { |
| 16229 if ($notnull_bool(this.maybeEatHexDigit()) && $notnull_bool(this.maybeEa
tHexDigit()) && $notnull_bool(this.maybeEatHexDigit()) && $notnull_bool(this.may
beEatHexDigit())) { | 15761 if (this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatH
exDigit() && this.maybeEatHexDigit()) { |
| 16230 hex = this._text.substring(this._lang_index - 4, this._lang_index); | 15762 hex = this._text.substring(this._lang_index - 4, this._lang_index); |
| 16231 break; | 15763 break; |
| 16232 } | 15764 } |
| 16233 else { | 15765 else { |
| 16234 return false; | 15766 return false; |
| 16235 } | 15767 } |
| 16236 } | 15768 } |
| 16237 | 15769 |
| 16238 default: | 15770 default: |
| 16239 | 15771 |
| 16240 return true; | 15772 return true; |
| 16241 | 15773 |
| 16242 } | 15774 } |
| 16243 var n = lang_Parser.parseHex(hex); | 15775 var n = lang_Parser.parseHex(hex); |
| 16244 return n < 0xD800 || n > 0xDFFF && n <= 0x10FFFF; | 15776 return n < 0xD800 || n > 0xDFFF && n <= 0x10FFFF; |
| 16245 } | 15777 } |
| 16246 TokenizerBase.prototype.finishDot = function() { | 15778 TokenizerBase.prototype.finishDot = function() { |
| 16247 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { | 15779 if (TokenizerHelpers.isDigit(this._peekChar())) { |
| 16248 this.eatDigits(); | 15780 this.eatDigits(); |
| 16249 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); | 15781 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); |
| 16250 } | 15782 } |
| 16251 else { | 15783 else { |
| 16252 return this._finishToken(14/*TokenKind.DOT*/); | 15784 return this._finishToken(14/*TokenKind.DOT*/); |
| 16253 } | 15785 } |
| 16254 } | 15786 } |
| 16255 TokenizerBase.prototype.finishIdentifier = function() { | 15787 TokenizerBase.prototype.finishIdentifier = function() { |
| 16256 while (this._lang_index < this._text.length) { | 15788 while (this._lang_index < this._text.length) { |
| 16257 if (!$notnull_bool(TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(t
his._lang_index++)))) { | 15789 if (!TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(this._lang_inde
x++))) { |
| 16258 this._lang_index--; | 15790 this._lang_index--; |
| 16259 break; | 15791 break; |
| 16260 } | 15792 } |
| 16261 } | 15793 } |
| 16262 var kind = this.getIdentifierKind(); | 15794 var kind = this.getIdentifierKind(); |
| 16263 if (this._interpStack != null && this._interpStack.depth == -1) { | 15795 if (this._interpStack != null && this._interpStack.depth == -1) { |
| 16264 this._interpStack.depth = 0; | 15796 this._interpStack.depth = 0; |
| 16265 } | 15797 } |
| 16266 if (kind == 70/*TokenKind.IDENTIFIER*/) { | 15798 if (kind == 70/*TokenKind.IDENTIFIER*/) { |
| 16267 return this._finishToken(70/*TokenKind.IDENTIFIER*/); | 15799 return this._finishToken(70/*TokenKind.IDENTIFIER*/); |
| 16268 } | 15800 } |
| 16269 else { | 15801 else { |
| 16270 return this._finishToken(kind); | 15802 return this._finishToken(kind); |
| 16271 } | 15803 } |
| 16272 } | 15804 } |
| 16273 TokenizerBase.prototype.next$0 = function() { | 15805 TokenizerBase.prototype.next$0 = function() { |
| 16274 return this.next(); | 15806 return this.next(); |
| 16275 }; | 15807 }; |
| 16276 // ********** Code for Tokenizer ************** | 15808 // ********** Code for Tokenizer ************** |
| 16277 function Tokenizer(source, skipWhitespace, index) { | 15809 function Tokenizer(source, skipWhitespace, index) { |
| 16278 TokenizerBase.call(this, source, skipWhitespace, index); | 15810 TokenizerBase.call(this, source, skipWhitespace, index); |
| 16279 // Initializers done | 15811 // Initializers done |
| 16280 } | 15812 } |
| 16281 $inherits(Tokenizer, TokenizerBase); | 15813 $inherits(Tokenizer, TokenizerBase); |
| 16282 Tokenizer.prototype.next = function() { | 15814 Tokenizer.prototype.next = function() { |
| 16283 this._startIndex = this._lang_index; | 15815 this._startIndex = this._lang_index; |
| 16284 if (this._interpStack != null && this._interpStack.depth == 0) { | 15816 if (this._interpStack != null && this._interpStack.depth == 0) { |
| 16285 var istack = this._interpStack; | 15817 var istack = this._interpStack; |
| 16286 this._interpStack = this._interpStack.pop(); | 15818 this._interpStack = this._interpStack.pop(); |
| 16287 if ($notnull_bool(istack.isMultiline)) { | 15819 if (istack.isMultiline) { |
| 16288 return this.finishMultilineString(istack.quote); | 15820 return this.finishMultilineString(istack.quote); |
| 16289 } | 15821 } |
| 16290 else { | 15822 else { |
| 16291 return this.finishStringBody(istack.quote); | 15823 return this.finishStringBody(istack.quote); |
| 16292 } | 15824 } |
| 16293 } | 15825 } |
| 16294 var ch; | 15826 var ch; |
| 16295 ch = this._nextChar(); | 15827 ch = this._nextChar(); |
| 16296 switch (ch) { | 15828 switch (ch) { |
| 16297 case 0: | 15829 case 0: |
| 16298 | 15830 |
| 16299 return this._finishToken(1/*TokenKind.END_OF_FILE*/); | 15831 return this._finishToken(1/*TokenKind.END_OF_FILE*/); |
| 16300 | 15832 |
| 16301 case 32: | 15833 case 32: |
| 16302 case 9: | 15834 case 9: |
| 16303 case 10: | 15835 case 10: |
| 16304 case 13: | 15836 case 13: |
| 16305 | 15837 |
| 16306 return this.finishWhitespace(); | 15838 return this.finishWhitespace(); |
| 16307 | 15839 |
| 16308 case 33: | 15840 case 33: |
| 16309 | 15841 |
| 16310 if ($notnull_bool(this._maybeEatChar(61))) { | 15842 if (this._maybeEatChar(61)) { |
| 16311 if ($notnull_bool(this._maybeEatChar(61))) { | 15843 if (this._maybeEatChar(61)) { |
| 16312 return this._finishToken(51/*TokenKind.NE_STRICT*/); | 15844 return this._finishToken(51/*TokenKind.NE_STRICT*/); |
| 16313 } | 15845 } |
| 16314 else { | 15846 else { |
| 16315 return this._finishToken(49/*TokenKind.NE*/); | 15847 return this._finishToken(49/*TokenKind.NE*/); |
| 16316 } | 15848 } |
| 16317 } | 15849 } |
| 16318 else { | 15850 else { |
| 16319 return this._finishToken(19/*TokenKind.NOT*/); | 15851 return this._finishToken(19/*TokenKind.NOT*/); |
| 16320 } | 15852 } |
| 16321 | 15853 |
| 16322 case 34: | 15854 case 34: |
| 16323 | 15855 |
| 16324 return this.finishString(34); | 15856 return this.finishString(34); |
| 16325 | 15857 |
| 16326 case 35: | 15858 case 35: |
| 16327 | 15859 |
| 16328 if ($notnull_bool(this._maybeEatChar(33))) { | 15860 if (this._maybeEatChar(33)) { |
| 16329 return this.finishHashBang(); | 15861 return this.finishHashBang(); |
| 16330 } | 15862 } |
| 16331 else { | 15863 else { |
| 16332 return this._finishToken(12/*TokenKind.HASH*/); | 15864 return this._finishToken(12/*TokenKind.HASH*/); |
| 16333 } | 15865 } |
| 16334 | 15866 |
| 16335 case 36: | 15867 case 36: |
| 16336 | 15868 |
| 16337 if ($notnull_bool(this._maybeEatChar(34))) { | 15869 if (this._maybeEatChar(34)) { |
| 16338 return this.finishString(34); | 15870 return this.finishString(34); |
| 16339 } | 15871 } |
| 16340 else if ($notnull_bool(this._maybeEatChar(39))) { | 15872 else if (this._maybeEatChar(39)) { |
| 16341 return this.finishString(39); | 15873 return this.finishString(39); |
| 16342 } | 15874 } |
| 16343 else { | 15875 else { |
| 16344 return this.finishIdentifier(); | 15876 return this.finishIdentifier(); |
| 16345 } | 15877 } |
| 16346 | 15878 |
| 16347 case 37: | 15879 case 37: |
| 16348 | 15880 |
| 16349 if ($notnull_bool(this._maybeEatChar(61))) { | 15881 if (this._maybeEatChar(61)) { |
| 16350 return this._finishToken(32/*TokenKind.ASSIGN_MOD*/); | 15882 return this._finishToken(32/*TokenKind.ASSIGN_MOD*/); |
| 16351 } | 15883 } |
| 16352 else { | 15884 else { |
| 16353 return this._finishToken(47/*TokenKind.MOD*/); | 15885 return this._finishToken(47/*TokenKind.MOD*/); |
| 16354 } | 15886 } |
| 16355 | 15887 |
| 16356 case 38: | 15888 case 38: |
| 16357 | 15889 |
| 16358 if ($notnull_bool(this._maybeEatChar(38))) { | 15890 if (this._maybeEatChar(38)) { |
| 16359 return this._finishToken(35/*TokenKind.AND*/); | 15891 return this._finishToken(35/*TokenKind.AND*/); |
| 16360 } | 15892 } |
| 16361 else if ($notnull_bool(this._maybeEatChar(61))) { | 15893 else if (this._maybeEatChar(61)) { |
| 16362 return this._finishToken(23/*TokenKind.ASSIGN_AND*/); | 15894 return this._finishToken(23/*TokenKind.ASSIGN_AND*/); |
| 16363 } | 15895 } |
| 16364 else { | 15896 else { |
| 16365 return this._finishToken(38/*TokenKind.BIT_AND*/); | 15897 return this._finishToken(38/*TokenKind.BIT_AND*/); |
| 16366 } | 15898 } |
| 16367 | 15899 |
| 16368 case 39: | 15900 case 39: |
| 16369 | 15901 |
| 16370 return this.finishString(39); | 15902 return this.finishString(39); |
| 16371 | 15903 |
| 16372 case 40: | 15904 case 40: |
| 16373 | 15905 |
| 16374 return this._finishToken(2/*TokenKind.LPAREN*/); | 15906 return this._finishToken(2/*TokenKind.LPAREN*/); |
| 16375 | 15907 |
| 16376 case 41: | 15908 case 41: |
| 16377 | 15909 |
| 16378 return this._finishToken(3/*TokenKind.RPAREN*/); | 15910 return this._finishToken(3/*TokenKind.RPAREN*/); |
| 16379 | 15911 |
| 16380 case 42: | 15912 case 42: |
| 16381 | 15913 |
| 16382 if ($notnull_bool(this._maybeEatChar(61))) { | 15914 if (this._maybeEatChar(61)) { |
| 16383 return this._finishToken(29/*TokenKind.ASSIGN_MUL*/); | 15915 return this._finishToken(29/*TokenKind.ASSIGN_MUL*/); |
| 16384 } | 15916 } |
| 16385 else { | 15917 else { |
| 16386 return this._finishToken(44/*TokenKind.MUL*/); | 15918 return this._finishToken(44/*TokenKind.MUL*/); |
| 16387 } | 15919 } |
| 16388 | 15920 |
| 16389 case 43: | 15921 case 43: |
| 16390 | 15922 |
| 16391 if ($notnull_bool(this._maybeEatChar(43))) { | 15923 if (this._maybeEatChar(43)) { |
| 16392 return this._finishToken(16/*TokenKind.INCR*/); | 15924 return this._finishToken(16/*TokenKind.INCR*/); |
| 16393 } | 15925 } |
| 16394 else if ($notnull_bool(this._maybeEatChar(61))) { | 15926 else if (this._maybeEatChar(61)) { |
| 16395 return this._finishToken(27/*TokenKind.ASSIGN_ADD*/); | 15927 return this._finishToken(27/*TokenKind.ASSIGN_ADD*/); |
| 16396 } | 15928 } |
| 16397 else { | 15929 else { |
| 16398 return this._finishToken(42/*TokenKind.ADD*/); | 15930 return this._finishToken(42/*TokenKind.ADD*/); |
| 16399 } | 15931 } |
| 16400 | 15932 |
| 16401 case 44: | 15933 case 44: |
| 16402 | 15934 |
| 16403 return this._finishToken(11/*TokenKind.COMMA*/); | 15935 return this._finishToken(11/*TokenKind.COMMA*/); |
| 16404 | 15936 |
| 16405 case 45: | 15937 case 45: |
| 16406 | 15938 |
| 16407 if ($notnull_bool(this._maybeEatChar(45))) { | 15939 if (this._maybeEatChar(45)) { |
| 16408 return this._finishToken(17/*TokenKind.DECR*/); | 15940 return this._finishToken(17/*TokenKind.DECR*/); |
| 16409 } | 15941 } |
| 16410 else if ($notnull_bool(this._maybeEatChar(61))) { | 15942 else if (this._maybeEatChar(61)) { |
| 16411 return this._finishToken(28/*TokenKind.ASSIGN_SUB*/); | 15943 return this._finishToken(28/*TokenKind.ASSIGN_SUB*/); |
| 16412 } | 15944 } |
| 16413 else { | 15945 else { |
| 16414 return this._finishToken(43/*TokenKind.SUB*/); | 15946 return this._finishToken(43/*TokenKind.SUB*/); |
| 16415 } | 15947 } |
| 16416 | 15948 |
| 16417 case 46: | 15949 case 46: |
| 16418 | 15950 |
| 16419 if ($notnull_bool(this._maybeEatChar(46))) { | 15951 if (this._maybeEatChar(46)) { |
| 16420 if ($notnull_bool(this._maybeEatChar(46))) { | 15952 if (this._maybeEatChar(46)) { |
| 16421 return this._finishToken(15/*TokenKind.ELLIPSIS*/); | 15953 return this._finishToken(15/*TokenKind.ELLIPSIS*/); |
| 16422 } | 15954 } |
| 16423 else { | 15955 else { |
| 16424 return this._errorToken(); | 15956 return this._errorToken(); |
| 16425 } | 15957 } |
| 16426 } | 15958 } |
| 16427 else { | 15959 else { |
| 16428 return this.finishDot(); | 15960 return this.finishDot(); |
| 16429 } | 15961 } |
| 16430 | 15962 |
| 16431 case 47: | 15963 case 47: |
| 16432 | 15964 |
| 16433 if ($notnull_bool(this._maybeEatChar(42))) { | 15965 if (this._maybeEatChar(42)) { |
| 16434 return this.finishMultiLineComment(); | 15966 return this.finishMultiLineComment(); |
| 16435 } | 15967 } |
| 16436 else if ($notnull_bool(this._maybeEatChar(47))) { | 15968 else if (this._maybeEatChar(47)) { |
| 16437 return this.finishSingleLineComment(); | 15969 return this.finishSingleLineComment(); |
| 16438 } | 15970 } |
| 16439 else if ($notnull_bool(this._maybeEatChar(61))) { | 15971 else if (this._maybeEatChar(61)) { |
| 16440 return this._finishToken(30/*TokenKind.ASSIGN_DIV*/); | 15972 return this._finishToken(30/*TokenKind.ASSIGN_DIV*/); |
| 16441 } | 15973 } |
| 16442 else { | 15974 else { |
| 16443 return this._finishToken(45/*TokenKind.DIV*/); | 15975 return this._finishToken(45/*TokenKind.DIV*/); |
| 16444 } | 15976 } |
| 16445 | 15977 |
| 16446 case 48: | 15978 case 48: |
| 16447 | 15979 |
| 16448 if ($notnull_bool(this._maybeEatChar(88))) { | 15980 if (this._maybeEatChar(88)) { |
| 16449 return this.finishHex(); | 15981 return this.finishHex(); |
| 16450 } | 15982 } |
| 16451 else if ($notnull_bool(this._maybeEatChar(120))) { | 15983 else if (this._maybeEatChar(120)) { |
| 16452 return this.finishHex(); | 15984 return this.finishHex(); |
| 16453 } | 15985 } |
| 16454 else { | 15986 else { |
| 16455 return this.finishNumber(); | 15987 return this.finishNumber(); |
| 16456 } | 15988 } |
| 16457 | 15989 |
| 16458 case 58: | 15990 case 58: |
| 16459 | 15991 |
| 16460 return this._finishToken(8/*TokenKind.COLON*/); | 15992 return this._finishToken(8/*TokenKind.COLON*/); |
| 16461 | 15993 |
| 16462 case 59: | 15994 case 59: |
| 16463 | 15995 |
| 16464 return this._finishToken(10/*TokenKind.SEMICOLON*/); | 15996 return this._finishToken(10/*TokenKind.SEMICOLON*/); |
| 16465 | 15997 |
| 16466 case 60: | 15998 case 60: |
| 16467 | 15999 |
| 16468 if ($notnull_bool(this._maybeEatChar(60))) { | 16000 if (this._maybeEatChar(60)) { |
| 16469 if ($notnull_bool(this._maybeEatChar(61))) { | 16001 if (this._maybeEatChar(61)) { |
| 16470 return this._finishToken(24/*TokenKind.ASSIGN_SHL*/); | 16002 return this._finishToken(24/*TokenKind.ASSIGN_SHL*/); |
| 16471 } | 16003 } |
| 16472 else { | 16004 else { |
| 16473 return this._finishToken(39/*TokenKind.SHL*/); | 16005 return this._finishToken(39/*TokenKind.SHL*/); |
| 16474 } | 16006 } |
| 16475 } | 16007 } |
| 16476 else if ($notnull_bool(this._maybeEatChar(61))) { | 16008 else if (this._maybeEatChar(61)) { |
| 16477 return this._finishToken(54/*TokenKind.LTE*/); | 16009 return this._finishToken(54/*TokenKind.LTE*/); |
| 16478 } | 16010 } |
| 16479 else { | 16011 else { |
| 16480 return this._finishToken(52/*TokenKind.LT*/); | 16012 return this._finishToken(52/*TokenKind.LT*/); |
| 16481 } | 16013 } |
| 16482 | 16014 |
| 16483 case 61: | 16015 case 61: |
| 16484 | 16016 |
| 16485 if ($notnull_bool(this._maybeEatChar(61))) { | 16017 if (this._maybeEatChar(61)) { |
| 16486 if ($notnull_bool(this._maybeEatChar(61))) { | 16018 if (this._maybeEatChar(61)) { |
| 16487 return this._finishToken(50/*TokenKind.EQ_STRICT*/); | 16019 return this._finishToken(50/*TokenKind.EQ_STRICT*/); |
| 16488 } | 16020 } |
| 16489 else { | 16021 else { |
| 16490 return this._finishToken(48/*TokenKind.EQ*/); | 16022 return this._finishToken(48/*TokenKind.EQ*/); |
| 16491 } | 16023 } |
| 16492 } | 16024 } |
| 16493 else if ($notnull_bool(this._maybeEatChar(62))) { | 16025 else if (this._maybeEatChar(62)) { |
| 16494 return this._finishToken(9/*TokenKind.ARROW*/); | 16026 return this._finishToken(9/*TokenKind.ARROW*/); |
| 16495 } | 16027 } |
| 16496 else { | 16028 else { |
| 16497 return this._finishToken(20/*TokenKind.ASSIGN*/); | 16029 return this._finishToken(20/*TokenKind.ASSIGN*/); |
| 16498 } | 16030 } |
| 16499 | 16031 |
| 16500 case 62: | 16032 case 62: |
| 16501 | 16033 |
| 16502 if ($notnull_bool(this._maybeEatChar(61))) { | 16034 if (this._maybeEatChar(61)) { |
| 16503 return this._finishToken(55/*TokenKind.GTE*/); | 16035 return this._finishToken(55/*TokenKind.GTE*/); |
| 16504 } | 16036 } |
| 16505 else if ($notnull_bool(this._maybeEatChar(62))) { | 16037 else if (this._maybeEatChar(62)) { |
| 16506 if ($notnull_bool(this._maybeEatChar(61))) { | 16038 if (this._maybeEatChar(61)) { |
| 16507 return this._finishToken(25/*TokenKind.ASSIGN_SAR*/); | 16039 return this._finishToken(25/*TokenKind.ASSIGN_SAR*/); |
| 16508 } | 16040 } |
| 16509 else if ($notnull_bool(this._maybeEatChar(62))) { | 16041 else if (this._maybeEatChar(62)) { |
| 16510 if ($notnull_bool(this._maybeEatChar(61))) { | 16042 if (this._maybeEatChar(61)) { |
| 16511 return this._finishToken(26/*TokenKind.ASSIGN_SHR*/); | 16043 return this._finishToken(26/*TokenKind.ASSIGN_SHR*/); |
| 16512 } | 16044 } |
| 16513 else { | 16045 else { |
| 16514 return this._finishToken(41/*TokenKind.SHR*/); | 16046 return this._finishToken(41/*TokenKind.SHR*/); |
| 16515 } | 16047 } |
| 16516 } | 16048 } |
| 16517 else { | 16049 else { |
| 16518 return this._finishToken(40/*TokenKind.SAR*/); | 16050 return this._finishToken(40/*TokenKind.SAR*/); |
| 16519 } | 16051 } |
| 16520 } | 16052 } |
| 16521 else { | 16053 else { |
| 16522 return this._finishToken(53/*TokenKind.GT*/); | 16054 return this._finishToken(53/*TokenKind.GT*/); |
| 16523 } | 16055 } |
| 16524 | 16056 |
| 16525 case 63: | 16057 case 63: |
| 16526 | 16058 |
| 16527 return this._finishToken(33/*TokenKind.CONDITIONAL*/); | 16059 return this._finishToken(33/*TokenKind.CONDITIONAL*/); |
| 16528 | 16060 |
| 16529 case 64: | 16061 case 64: |
| 16530 | 16062 |
| 16531 if ($notnull_bool(this._maybeEatChar(34))) { | 16063 if (this._maybeEatChar(34)) { |
| 16532 return this.finishRawString(34); | 16064 return this.finishRawString(34); |
| 16533 } | 16065 } |
| 16534 else if ($notnull_bool(this._maybeEatChar(39))) { | 16066 else if (this._maybeEatChar(39)) { |
| 16535 return this.finishRawString(39); | 16067 return this.finishRawString(39); |
| 16536 } | 16068 } |
| 16537 else { | 16069 else { |
| 16538 return this._errorToken(); | 16070 return this._errorToken(); |
| 16539 } | 16071 } |
| 16540 | 16072 |
| 16541 case 91: | 16073 case 91: |
| 16542 | 16074 |
| 16543 if ($notnull_bool(this._maybeEatChar(93))) { | 16075 if (this._maybeEatChar(93)) { |
| 16544 if ($notnull_bool(this._maybeEatChar(61))) { | 16076 if (this._maybeEatChar(61)) { |
| 16545 return this._finishToken(57/*TokenKind.SETINDEX*/); | 16077 return this._finishToken(57/*TokenKind.SETINDEX*/); |
| 16546 } | 16078 } |
| 16547 else { | 16079 else { |
| 16548 return this._finishToken(56/*TokenKind.INDEX*/); | 16080 return this._finishToken(56/*TokenKind.INDEX*/); |
| 16549 } | 16081 } |
| 16550 } | 16082 } |
| 16551 else { | 16083 else { |
| 16552 return this._finishToken(4/*TokenKind.LBRACK*/); | 16084 return this._finishToken(4/*TokenKind.LBRACK*/); |
| 16553 } | 16085 } |
| 16554 | 16086 |
| 16555 case 93: | 16087 case 93: |
| 16556 | 16088 |
| 16557 return this._finishToken(5/*TokenKind.RBRACK*/); | 16089 return this._finishToken(5/*TokenKind.RBRACK*/); |
| 16558 | 16090 |
| 16559 case 94: | 16091 case 94: |
| 16560 | 16092 |
| 16561 if ($notnull_bool(this._maybeEatChar(61))) { | 16093 if (this._maybeEatChar(61)) { |
| 16562 return this._finishToken(22/*TokenKind.ASSIGN_XOR*/); | 16094 return this._finishToken(22/*TokenKind.ASSIGN_XOR*/); |
| 16563 } | 16095 } |
| 16564 else { | 16096 else { |
| 16565 return this._finishToken(37/*TokenKind.BIT_XOR*/); | 16097 return this._finishToken(37/*TokenKind.BIT_XOR*/); |
| 16566 } | 16098 } |
| 16567 | 16099 |
| 16568 case 123: | 16100 case 123: |
| 16569 | 16101 |
| 16570 return this._finishOpenBrace(); | 16102 return this._finishOpenBrace(); |
| 16571 | 16103 |
| 16572 case 124: | 16104 case 124: |
| 16573 | 16105 |
| 16574 if ($notnull_bool(this._maybeEatChar(61))) { | 16106 if (this._maybeEatChar(61)) { |
| 16575 return this._finishToken(21/*TokenKind.ASSIGN_OR*/); | 16107 return this._finishToken(21/*TokenKind.ASSIGN_OR*/); |
| 16576 } | 16108 } |
| 16577 else if ($notnull_bool(this._maybeEatChar(124))) { | 16109 else if (this._maybeEatChar(124)) { |
| 16578 return this._finishToken(34/*TokenKind.OR*/); | 16110 return this._finishToken(34/*TokenKind.OR*/); |
| 16579 } | 16111 } |
| 16580 else { | 16112 else { |
| 16581 return this._finishToken(36/*TokenKind.BIT_OR*/); | 16113 return this._finishToken(36/*TokenKind.BIT_OR*/); |
| 16582 } | 16114 } |
| 16583 | 16115 |
| 16584 case 125: | 16116 case 125: |
| 16585 | 16117 |
| 16586 return this._finishCloseBrace(); | 16118 return this._finishCloseBrace(); |
| 16587 | 16119 |
| 16588 case 126: | 16120 case 126: |
| 16589 | 16121 |
| 16590 if ($notnull_bool(this._maybeEatChar(47))) { | 16122 if (this._maybeEatChar(47)) { |
| 16591 if ($notnull_bool(this._maybeEatChar(61))) { | 16123 if (this._maybeEatChar(61)) { |
| 16592 return this._finishToken(31/*TokenKind.ASSIGN_TRUNCDIV*/); | 16124 return this._finishToken(31/*TokenKind.ASSIGN_TRUNCDIV*/); |
| 16593 } | 16125 } |
| 16594 else { | 16126 else { |
| 16595 return this._finishToken(46/*TokenKind.TRUNCDIV*/); | 16127 return this._finishToken(46/*TokenKind.TRUNCDIV*/); |
| 16596 } | 16128 } |
| 16597 } | 16129 } |
| 16598 else { | 16130 else { |
| 16599 return this._finishToken(18/*TokenKind.BIT_NOT*/); | 16131 return this._finishToken(18/*TokenKind.BIT_NOT*/); |
| 16600 } | 16132 } |
| 16601 | 16133 |
| 16602 default: | 16134 default: |
| 16603 | 16135 |
| 16604 if ($notnull_bool(TokenizerHelpers.isIdentifierStart(ch))) { | 16136 if (TokenizerHelpers.isIdentifierStart(ch)) { |
| 16605 return this.finishIdentifier(); | 16137 return this.finishIdentifier(); |
| 16606 } | 16138 } |
| 16607 else if ($notnull_bool(TokenizerHelpers.isDigit(ch))) { | 16139 else if (TokenizerHelpers.isDigit(ch)) { |
| 16608 return this.finishNumber(); | 16140 return this.finishNumber(); |
| 16609 } | 16141 } |
| 16610 else { | 16142 else { |
| 16611 return this._errorToken(); | 16143 return this._errorToken(); |
| 16612 } | 16144 } |
| 16613 | 16145 |
| 16614 } | 16146 } |
| 16615 } | 16147 } |
| 16616 Tokenizer.prototype.getIdentifierKind = function() { | 16148 Tokenizer.prototype.getIdentifierKind = function() { |
| 16617 var i0 = this._startIndex; | 16149 var i0 = this._startIndex; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16805 }; | 16337 }; |
| 16806 // ********** Code for TokenizerHelpers ************** | 16338 // ********** Code for TokenizerHelpers ************** |
| 16807 function TokenizerHelpers() {} | 16339 function TokenizerHelpers() {} |
| 16808 TokenizerHelpers.isIdentifierStart = function(c) { | 16340 TokenizerHelpers.isIdentifierStart = function(c) { |
| 16809 return ((c >= 97 && c <= 122) || (c >= 65 && c <= 90) || c == 95); | 16341 return ((c >= 97 && c <= 122) || (c >= 65 && c <= 90) || c == 95); |
| 16810 } | 16342 } |
| 16811 TokenizerHelpers.isDigit = function(c) { | 16343 TokenizerHelpers.isDigit = function(c) { |
| 16812 return (c >= 48 && c <= 57); | 16344 return (c >= 48 && c <= 57); |
| 16813 } | 16345 } |
| 16814 TokenizerHelpers.isHexDigit = function(c) { | 16346 TokenizerHelpers.isHexDigit = function(c) { |
| 16815 return ($notnull_bool(TokenizerHelpers.isDigit(c)) || (c >= 97 && c <= 102) ||
(c >= 65 && c <= 70)); | 16347 return (TokenizerHelpers.isDigit(c) || (c >= 97 && c <= 102) || (c >= 65 && c
<= 70)); |
| 16816 } | 16348 } |
| 16817 TokenizerHelpers.isWhitespace = function(c) { | 16349 TokenizerHelpers.isWhitespace = function(c) { |
| 16818 return (c == 32 || c == 9 || c == 10 || c == 13); | 16350 return (c == 32 || c == 9 || c == 10 || c == 13); |
| 16819 } | 16351 } |
| 16820 TokenizerHelpers.isIdentifierPart = function(c) { | 16352 TokenizerHelpers.isIdentifierPart = function(c) { |
| 16821 return ($notnull_bool(TokenizerHelpers.isIdentifierStart(c)) || $notnull_bool(
TokenizerHelpers.isDigit(c))); | 16353 return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c)); |
| 16822 } | 16354 } |
| 16823 // ********** Code for TokenKind ************** | 16355 // ********** Code for TokenKind ************** |
| 16824 function TokenKind() {} | 16356 function TokenKind() {} |
| 16825 TokenKind.kindToString = function(kind) { | 16357 TokenKind.kindToString = function(kind) { |
| 16826 switch (kind) { | 16358 switch (kind) { |
| 16827 case 1/*TokenKind.END_OF_FILE*/: | 16359 case 1/*TokenKind.END_OF_FILE*/: |
| 16828 | 16360 |
| 16829 return "end of file"; | 16361 return "end of file"; |
| 16830 | 16362 |
| 16831 case 2/*TokenKind.LPAREN*/: | 16363 case 2/*TokenKind.LPAREN*/: |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17630 this.diet = diet; | 17162 this.diet = diet; |
| 17631 this.throwOnIncomplete = throwOnIncomplete; | 17163 this.throwOnIncomplete = throwOnIncomplete; |
| 17632 this.optionalSemicolons = optionalSemicolons; | 17164 this.optionalSemicolons = optionalSemicolons; |
| 17633 // Initializers done | 17165 // Initializers done |
| 17634 this.tokenizer = new Tokenizer(this.source, true, startOffset); | 17166 this.tokenizer = new Tokenizer(this.source, true, startOffset); |
| 17635 this._peekToken = this.tokenizer.next(); | 17167 this._peekToken = this.tokenizer.next(); |
| 17636 this._previousToken = null; | 17168 this._previousToken = null; |
| 17637 this._inInitializers = false; | 17169 this._inInitializers = false; |
| 17638 } | 17170 } |
| 17639 lang_Parser.prototype.isPrematureEndOfFile = function() { | 17171 lang_Parser.prototype.isPrematureEndOfFile = function() { |
| 17640 if ($notnull_bool(this.throwOnIncomplete) && $notnull_bool(this._maybeEat(1/*T
okenKind.END_OF_FILE*/)) || $notnull_bool(this._maybeEat(68/*TokenKind.INCOMPLET
E_MULTILINE_STRING_DQ*/)) || $notnull_bool(this._maybeEat(69/*TokenKind.INCOMPLE
TE_MULTILINE_STRING_SQ*/))) { | 17172 if (this.throwOnIncomplete && this._maybeEat(1/*TokenKind.END_OF_FILE*/) || th
is._maybeEat(68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/) || this._maybeEat(6
9/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/)) { |
| 17641 $throw(new IncompleteSourceException(this._previousToken)); | 17173 $throw(new IncompleteSourceException(this._previousToken)); |
| 17642 } | 17174 } |
| 17643 else if ($notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/))) { | 17175 else if (this._maybeEat(1/*TokenKind.END_OF_FILE*/)) { |
| 17644 this._lang_error('unexpected end of file', this._peekToken.get$span()); | 17176 this._lang_error('unexpected end of file', this._peekToken.get$span()); |
| 17645 return true; | 17177 return true; |
| 17646 } | 17178 } |
| 17647 else { | 17179 else { |
| 17648 return false; | 17180 return false; |
| 17649 } | 17181 } |
| 17650 } | 17182 } |
| 17651 lang_Parser.prototype._peek = function() { | 17183 lang_Parser.prototype._peek = function() { |
| 17652 return this._peekToken.kind; | 17184 return this._peekToken.kind; |
| 17653 } | 17185 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 17666 if (this._peekToken.kind == kind) { | 17198 if (this._peekToken.kind == kind) { |
| 17667 this._previousToken = this._peekToken; | 17199 this._previousToken = this._peekToken; |
| 17668 this._peekToken = this.tokenizer.next(); | 17200 this._peekToken = this.tokenizer.next(); |
| 17669 return true; | 17201 return true; |
| 17670 } | 17202 } |
| 17671 else { | 17203 else { |
| 17672 return false; | 17204 return false; |
| 17673 } | 17205 } |
| 17674 } | 17206 } |
| 17675 lang_Parser.prototype._eat = function(kind) { | 17207 lang_Parser.prototype._eat = function(kind) { |
| 17676 if (!$notnull_bool(this._maybeEat(kind))) { | 17208 if (!this._maybeEat(kind)) { |
| 17677 this._errorExpected(TokenKind.kindToString(kind)); | 17209 this._errorExpected(TokenKind.kindToString(kind)); |
| 17678 } | 17210 } |
| 17679 } | 17211 } |
| 17680 lang_Parser.prototype._eatSemicolon = function() { | 17212 lang_Parser.prototype._eatSemicolon = function() { |
| 17681 if ($notnull_bool(this.optionalSemicolons) && $notnull_bool(this._peekKind(1/*
TokenKind.END_OF_FILE*/))) return; | 17213 if (this.optionalSemicolons && this._peekKind(1/*TokenKind.END_OF_FILE*/)) ret
urn; |
| 17682 this._eat(10/*TokenKind.SEMICOLON*/); | 17214 this._eat(10/*TokenKind.SEMICOLON*/); |
| 17683 } | 17215 } |
| 17684 lang_Parser.prototype._errorExpected = function(expected) { | 17216 lang_Parser.prototype._errorExpected = function(expected) { |
| 17685 if ($notnull_bool(this.throwOnIncomplete)) this.isPrematureEndOfFile(); | 17217 if (this.throwOnIncomplete) this.isPrematureEndOfFile(); |
| 17686 var tok = this._lang_next(); | 17218 var tok = this._lang_next(); |
| 17687 var message = ('expected ' + expected + ', but found ' + tok + ''); | 17219 var message = ('expected ' + expected + ', but found ' + tok + ''); |
| 17688 this._lang_error($assert_String(message), tok.get$span()); | 17220 this._lang_error(message, tok.get$span()); |
| 17689 } | 17221 } |
| 17690 lang_Parser.prototype._lang_error = function(message, location) { | 17222 lang_Parser.prototype._lang_error = function(message, location) { |
| 17691 if (location == null) { | 17223 if (location == null) { |
| 17692 location = this._peekToken.get$span(); | 17224 location = this._peekToken.get$span(); |
| 17693 } | 17225 } |
| 17694 world.fatal(message, location); | 17226 world.fatal(message, location); |
| 17695 } | 17227 } |
| 17696 lang_Parser.prototype._skipBlock = function() { | 17228 lang_Parser.prototype._skipBlock = function() { |
| 17697 var depth = 1; | 17229 var depth = 1; |
| 17698 this._eat(6/*TokenKind.LBRACE*/); | 17230 this._eat(6/*TokenKind.LBRACE*/); |
| 17699 while (true) { | 17231 while (true) { |
| 17700 var tok = this._lang_next(); | 17232 var tok = this._lang_next(); |
| 17701 if ($notnull_bool($eq(tok.kind, 6/*TokenKind.LBRACE*/))) { | 17233 if ($eq(tok.kind, 6/*TokenKind.LBRACE*/)) { |
| 17702 depth += 1; | 17234 depth += 1; |
| 17703 } | 17235 } |
| 17704 else if ($notnull_bool($eq(tok.kind, 7/*TokenKind.RBRACE*/))) { | 17236 else if ($eq(tok.kind, 7/*TokenKind.RBRACE*/)) { |
| 17705 depth -= 1; | 17237 depth -= 1; |
| 17706 if (depth == 0) return; | 17238 if (depth == 0) return; |
| 17707 } | 17239 } |
| 17708 else if ($notnull_bool($eq(tok.kind, 1/*TokenKind.END_OF_FILE*/))) { | 17240 else if ($eq(tok.kind, 1/*TokenKind.END_OF_FILE*/)) { |
| 17709 this._lang_error('unexpected end of file during diet parse', tok.get$span(
)); | 17241 this._lang_error('unexpected end of file during diet parse', tok.get$span(
)); |
| 17710 return; | 17242 return; |
| 17711 } | 17243 } |
| 17712 } | 17244 } |
| 17713 } | 17245 } |
| 17714 lang_Parser.prototype._makeSpan = function(start) { | 17246 lang_Parser.prototype._makeSpan = function(start) { |
| 17715 return new SourceSpan(this.source, start, this._previousToken.end); | 17247 return new SourceSpan(this.source, start, this._previousToken.end); |
| 17716 } | 17248 } |
| 17717 lang_Parser.prototype.compilationUnit = function() { | 17249 lang_Parser.prototype.compilationUnit = function() { |
| 17718 var ret = []; | 17250 var ret = []; |
| 17719 this._maybeEat(13/*TokenKind.HASHBANG*/); | 17251 this._maybeEat(13/*TokenKind.HASHBANG*/); |
| 17720 while ($notnull_bool(this._peekKind(12/*TokenKind.HASH*/))) { | 17252 while (this._peekKind(12/*TokenKind.HASH*/)) { |
| 17721 ret.add$1(this.directive()); | 17253 ret.add$1(this.directive()); |
| 17722 } | 17254 } |
| 17723 while (!$notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/))) { | 17255 while (!this._maybeEat(1/*TokenKind.END_OF_FILE*/)) { |
| 17724 ret.add$1(this.topLevelDefinition()); | 17256 ret.add$1(this.topLevelDefinition()); |
| 17725 } | 17257 } |
| 17726 return (ret && ret.is$List$Definition()); | 17258 return ret; |
| 17727 } | 17259 } |
| 17728 lang_Parser.prototype.directive = function() { | 17260 lang_Parser.prototype.directive = function() { |
| 17729 var start = this._peekToken.start; | 17261 var start = this._peekToken.start; |
| 17730 this._eat(12/*TokenKind.HASH*/); | 17262 this._eat(12/*TokenKind.HASH*/); |
| 17731 var name = this.identifier(); | 17263 var name = this.identifier(); |
| 17732 var args = this.arguments(); | 17264 var args = this.arguments(); |
| 17733 this._eatSemicolon(); | 17265 this._eatSemicolon(); |
| 17734 return new DirectiveDefinition(name, args, this._makeSpan(start)); | 17266 return new DirectiveDefinition(name, args, this._makeSpan(start)); |
| 17735 } | 17267 } |
| 17736 lang_Parser.prototype.topLevelDefinition = function() { | 17268 lang_Parser.prototype.topLevelDefinition = function() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 17751 | 17283 |
| 17752 return this.declaration(true); | 17284 return this.declaration(true); |
| 17753 | 17285 |
| 17754 } | 17286 } |
| 17755 } | 17287 } |
| 17756 lang_Parser.prototype.classDefinition = function(kind) { | 17288 lang_Parser.prototype.classDefinition = function(kind) { |
| 17757 var start = this._peekToken.start; | 17289 var start = this._peekToken.start; |
| 17758 this._eat(kind); | 17290 this._eat(kind); |
| 17759 var name = this.identifier(); | 17291 var name = this.identifier(); |
| 17760 var typeParams = null; | 17292 var typeParams = null; |
| 17761 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { | 17293 if (this._peekKind(52/*TokenKind.LT*/)) { |
| 17762 typeParams = this.typeParameters(); | 17294 typeParams = this.typeParameters(); |
| 17763 } | 17295 } |
| 17764 var _extends = null; | 17296 var _extends = null; |
| 17765 if ($notnull_bool(this._maybeEat(74/*TokenKind.EXTENDS*/))) { | 17297 if (this._maybeEat(74/*TokenKind.EXTENDS*/)) { |
| 17766 _extends = this.typeList(); | 17298 _extends = this.typeList(); |
| 17767 } | 17299 } |
| 17768 var _implements = null; | 17300 var _implements = null; |
| 17769 if ($notnull_bool(this._maybeEat(77/*TokenKind.IMPLEMENTS*/))) { | 17301 if (this._maybeEat(77/*TokenKind.IMPLEMENTS*/)) { |
| 17770 _implements = this.typeList(); | 17302 _implements = this.typeList(); |
| 17771 } | 17303 } |
| 17772 var _native = null; | 17304 var _native = null; |
| 17773 if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { | 17305 if (this._maybeEat(81/*TokenKind.NATIVE*/)) { |
| 17774 _native = this.maybeStringLiteral(); | 17306 _native = this.maybeStringLiteral(); |
| 17775 } | 17307 } |
| 17776 var _factory = null; | 17308 var _factory = null; |
| 17777 if ($notnull_bool(this._maybeEat(75/*TokenKind.FACTORY*/))) { | 17309 if (this._maybeEat(75/*TokenKind.FACTORY*/)) { |
| 17778 _factory = this.type(0); | 17310 _factory = this.type(0); |
| 17779 } | 17311 } |
| 17780 var body = []; | 17312 var body = []; |
| 17781 if ($notnull_bool(this._maybeEat(6/*TokenKind.LBRACE*/))) { | 17313 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { |
| 17782 while (!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/))) { | 17314 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { |
| 17783 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 17315 if (this.isPrematureEndOfFile()) break; |
| 17784 body.add$1(this.declaration(true)); | 17316 body.add$1(this.declaration(true)); |
| 17785 } | 17317 } |
| 17786 } | 17318 } |
| 17787 else { | 17319 else { |
| 17788 this._errorExpected('block starting with "{" or ";"'); | 17320 this._errorExpected('block starting with "{" or ";"'); |
| 17789 } | 17321 } |
| 17790 return new TypeDefinition(kind == 73/*TokenKind.CLASS*/, name, typeParams, _ex
tends, _implements, _native, _factory, body, this._makeSpan(start)); | 17322 return new TypeDefinition(kind == 73/*TokenKind.CLASS*/, name, typeParams, _ex
tends, _implements, _native, _factory, body, this._makeSpan(start)); |
| 17791 } | 17323 } |
| 17792 lang_Parser.prototype.functionTypeAlias = function() { | 17324 lang_Parser.prototype.functionTypeAlias = function() { |
| 17793 var start = this._peekToken.start; | 17325 var start = this._peekToken.start; |
| 17794 this._eat(87/*TokenKind.TYPEDEF*/); | 17326 this._eat(87/*TokenKind.TYPEDEF*/); |
| 17795 var di = this.declaredIdentifier(false); | 17327 var di = this.declaredIdentifier(false); |
| 17796 var typeParams = null; | 17328 var typeParams = null; |
| 17797 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { | 17329 if (this._peekKind(52/*TokenKind.LT*/)) { |
| 17798 typeParams = this.typeParameters(); | 17330 typeParams = this.typeParameters(); |
| 17799 } | 17331 } |
| 17800 var formals = this.formalParameterList(); | 17332 var formals = this.formalParameterList(); |
| 17801 this._eatSemicolon(); | 17333 this._eatSemicolon(); |
| 17802 var func = new FunctionDefinition(null, di.type, di.get$name(), formals, null,
null, this._makeSpan(start)); | 17334 var func = new FunctionDefinition(null, di.type, di.get$name(), formals, null,
null, this._makeSpan(start)); |
| 17803 return new FunctionTypeDefinition(func, typeParams, this._makeSpan(start)); | 17335 return new FunctionTypeDefinition(func, typeParams, this._makeSpan(start)); |
| 17804 } | 17336 } |
| 17805 lang_Parser.prototype.initializers = function() { | 17337 lang_Parser.prototype.initializers = function() { |
| 17806 this._inInitializers = true; | 17338 this._inInitializers = true; |
| 17807 var ret = []; | 17339 var ret = []; |
| 17808 do { | 17340 do { |
| 17809 ret.add$1(this.expression()); | 17341 ret.add$1(this.expression()); |
| 17810 } | 17342 } |
| 17811 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 17343 while (this._maybeEat(11/*TokenKind.COMMA*/)) |
| 17812 this._inInitializers = false; | 17344 this._inInitializers = false; |
| 17813 return ret; | 17345 return ret; |
| 17814 } | 17346 } |
| 17815 lang_Parser.prototype.functionBody = function(inExpression) { | 17347 lang_Parser.prototype.functionBody = function(inExpression) { |
| 17816 var start = this._peekToken.start; | 17348 var start = this._peekToken.start; |
| 17817 if ($notnull_bool(this._maybeEat(9/*TokenKind.ARROW*/))) { | 17349 if (this._maybeEat(9/*TokenKind.ARROW*/)) { |
| 17818 var expr = this.expression(); | 17350 var expr = this.expression(); |
| 17819 if (!$notnull_bool(inExpression)) { | 17351 if (!inExpression) { |
| 17820 this._eatSemicolon(); | 17352 this._eatSemicolon(); |
| 17821 } | 17353 } |
| 17822 return new ReturnStatement(expr, this._makeSpan(start)); | 17354 return new ReturnStatement(expr, this._makeSpan(start)); |
| 17823 } | 17355 } |
| 17824 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { | 17356 else if (this._peekKind(6/*TokenKind.LBRACE*/)) { |
| 17825 if ($notnull_bool(this.diet)) { | 17357 if (this.diet) { |
| 17826 this._skipBlock(); | 17358 this._skipBlock(); |
| 17827 return new DietStatement(this._makeSpan(start)); | 17359 return new DietStatement(this._makeSpan(start)); |
| 17828 } | 17360 } |
| 17829 else { | 17361 else { |
| 17830 return this.block(); | 17362 return this.block(); |
| 17831 } | 17363 } |
| 17832 } | 17364 } |
| 17833 else if (!$notnull_bool(inExpression)) { | 17365 else if (!inExpression) { |
| 17834 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { | 17366 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { |
| 17835 return null; | 17367 return null; |
| 17836 } | 17368 } |
| 17837 else if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { | 17369 else if (this._maybeEat(81/*TokenKind.NATIVE*/)) { |
| 17838 var nativeBody = this.maybeStringLiteral(); | 17370 var nativeBody = this.maybeStringLiteral(); |
| 17839 if ($notnull_bool(this._peekKind(10/*TokenKind.SEMICOLON*/))) { | 17371 if (this._peekKind(10/*TokenKind.SEMICOLON*/)) { |
| 17840 this._eatSemicolon(); | 17372 this._eatSemicolon(); |
| 17841 return new NativeStatement(nativeBody, this._makeSpan(start)); | 17373 return new NativeStatement(nativeBody, this._makeSpan(start)); |
| 17842 } | 17374 } |
| 17843 else { | 17375 else { |
| 17844 return this.functionBody(inExpression); | 17376 return this.functionBody(inExpression); |
| 17845 } | 17377 } |
| 17846 } | 17378 } |
| 17847 } | 17379 } |
| 17848 this._lang_error('Expected function body (neither { nor => found)'); | 17380 this._lang_error('Expected function body (neither { nor => found)'); |
| 17849 } | 17381 } |
| 17850 lang_Parser.prototype.finishField = function(start, modifiers, type, name, value
) { | 17382 lang_Parser.prototype.finishField = function(start, modifiers, type, name, value
) { |
| 17851 var names = [name]; | 17383 var names = [name]; |
| 17852 var values = [value]; | 17384 var values = [value]; |
| 17853 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 17385 while (this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 17854 names.add$1(this.identifier()); | 17386 names.add$1(this.identifier()); |
| 17855 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { | 17387 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| 17856 values.add$1(this.expression()); | 17388 values.add$1(this.expression()); |
| 17857 } | 17389 } |
| 17858 else { | 17390 else { |
| 17859 values.add$1(); | 17391 values.add$1(); |
| 17860 } | 17392 } |
| 17861 } | 17393 } |
| 17862 this._eatSemicolon(); | 17394 this._eatSemicolon(); |
| 17863 return new VariableDefinition(modifiers, type, names, values, this._makeSpan($
assert_num(start))); | 17395 return new VariableDefinition(modifiers, type, names, values, this._makeSpan(s
tart)); |
| 17864 } | 17396 } |
| 17865 lang_Parser.prototype.finishDefinition = function(start, modifiers, di) { | 17397 lang_Parser.prototype.finishDefinition = function(start, modifiers, di) { |
| 17866 var $0; | |
| 17867 switch (this._peek()) { | 17398 switch (this._peek()) { |
| 17868 case 2/*TokenKind.LPAREN*/: | 17399 case 2/*TokenKind.LPAREN*/: |
| 17869 | 17400 |
| 17870 var formals = this.formalParameterList(); | 17401 var formals = this.formalParameterList(); |
| 17871 var inits = null; | 17402 var inits = null; |
| 17872 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { | 17403 if (this._maybeEat(8/*TokenKind.COLON*/)) { |
| 17873 inits = this.initializers(); | 17404 inits = this.initializers(); |
| 17874 } | 17405 } |
| 17875 var body = this.functionBody(false); | 17406 var body = this.functionBody(false); |
| 17876 if ($notnull_bool(di.get$name() == null)) { | 17407 if (di.get$name() == null) { |
| 17877 di.set$name(di.type.get$name()); | 17408 di.name = di.type.get$name(); |
| 17878 } | 17409 } |
| 17879 return new FunctionDefinition(modifiers, di.type, di.get$name(), formals,
inits, body, this._makeSpan($assert_num(start))); | 17410 return new FunctionDefinition(modifiers, di.type, di.get$name(), formals,
inits, body, this._makeSpan(start)); |
| 17880 | 17411 |
| 17881 case 20/*TokenKind.ASSIGN*/: | 17412 case 20/*TokenKind.ASSIGN*/: |
| 17882 | 17413 |
| 17883 this._eat(20/*TokenKind.ASSIGN*/); | 17414 this._eat(20/*TokenKind.ASSIGN*/); |
| 17884 var value = this.expression(); | 17415 var value = this.expression(); |
| 17885 return this.finishField(start, modifiers, di.type, di.get$name(), value); | 17416 return this.finishField(start, modifiers, di.type, di.get$name(), value); |
| 17886 | 17417 |
| 17887 case 11/*TokenKind.COMMA*/: | 17418 case 11/*TokenKind.COMMA*/: |
| 17888 case 10/*TokenKind.SEMICOLON*/: | 17419 case 10/*TokenKind.SEMICOLON*/: |
| 17889 | 17420 |
| 17890 return this.finishField(start, modifiers, di.type, di.get$name(), null); | 17421 return this.finishField(start, modifiers, di.type, di.get$name(), null); |
| 17891 | 17422 |
| 17892 default: | 17423 default: |
| 17893 | 17424 |
| 17894 this._errorExpected('declaration'); | 17425 this._errorExpected('declaration'); |
| 17895 return null; | 17426 return null; |
| 17896 | 17427 |
| 17897 } | 17428 } |
| 17898 } | 17429 } |
| 17899 lang_Parser.prototype.declaration = function(includeOperators) { | 17430 lang_Parser.prototype.declaration = function(includeOperators) { |
| 17900 var start = this._peekToken.start; | 17431 var start = this._peekToken.start; |
| 17901 if ($notnull_bool(this._peekKind(75/*TokenKind.FACTORY*/))) { | 17432 if (this._peekKind(75/*TokenKind.FACTORY*/)) { |
| 17902 return this.factoryConstructorDeclaration(); | 17433 return this.factoryConstructorDeclaration(); |
| 17903 } | 17434 } |
| 17904 var modifiers = this._readModifiers(); | 17435 var modifiers = this._readModifiers(); |
| 17905 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators)); | 17436 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators)); |
| 17906 } | 17437 } |
| 17907 lang_Parser.prototype.factoryConstructorDeclaration = function() { | 17438 lang_Parser.prototype.factoryConstructorDeclaration = function() { |
| 17908 var start = this._peekToken.start; | 17439 var start = this._peekToken.start; |
| 17909 var factoryToken = this._lang_next(); | 17440 var factoryToken = this._lang_next(); |
| 17910 var names = [this.identifier()]; | 17441 var names = [this.identifier()]; |
| 17911 while ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { | 17442 while (this._maybeEat(14/*TokenKind.DOT*/)) { |
| 17912 names.add$1(this.identifier()); | 17443 names.add$1(this.identifier()); |
| 17913 } | 17444 } |
| 17914 var typeParams = null; | 17445 var typeParams = null; |
| 17915 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { | 17446 if (this._peekKind(52/*TokenKind.LT*/)) { |
| 17916 typeParams = this.typeParameters(); | 17447 typeParams = this.typeParameters(); |
| 17917 } | 17448 } |
| 17918 var name = null; | 17449 var name = null; |
| 17919 var type = null; | 17450 var type = null; |
| 17920 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { | 17451 if (this._maybeEat(14/*TokenKind.DOT*/)) { |
| 17921 name = this.identifier(); | 17452 name = this.identifier(); |
| 17922 } | 17453 } |
| 17923 else if ($notnull_bool(typeParams == null)) { | 17454 else if (typeParams == null) { |
| 17924 if (names.length > 1) { | 17455 if (names.length > 1) { |
| 17925 name = names.removeLast$0(); | 17456 name = names.removeLast$0(); |
| 17926 } | 17457 } |
| 17927 else { | 17458 else { |
| 17928 name = new lang_Identifier('', names.$index(0).get$span()); | 17459 name = new lang_Identifier('', names.$index(0).get$span()); |
| 17929 } | 17460 } |
| 17930 } | 17461 } |
| 17931 else { | 17462 else { |
| 17932 name = new lang_Identifier('', names.$index(0).get$span()); | 17463 name = new lang_Identifier('', names.$index(0).get$span()); |
| 17933 } | 17464 } |
| 17934 if (names.length > 1) { | 17465 if (names.length > 1) { |
| 17935 this._lang_error('unsupported qualified name for factory', names.$index(0).g
et$span()); | 17466 this._lang_error('unsupported qualified name for factory', names.$index(0).g
et$span()); |
| 17936 } | 17467 } |
| 17937 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get
$span()); | 17468 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get
$span()); |
| 17938 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); | 17469 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); |
| 17939 return this.finishDefinition(start, [factoryToken], di); | 17470 return this.finishDefinition(start, [factoryToken], di); |
| 17940 } | 17471 } |
| 17941 lang_Parser.prototype.statement = function() { | 17472 lang_Parser.prototype.statement = function() { |
| 17942 var $0; | |
| 17943 switch (this._peek()) { | 17473 switch (this._peek()) { |
| 17944 case 88/*TokenKind.BREAK*/: | 17474 case 88/*TokenKind.BREAK*/: |
| 17945 | 17475 |
| 17946 return (($0 = this.breakStatement()) && $0.is$lang_Statement()); | 17476 return this.breakStatement(); |
| 17947 | 17477 |
| 17948 case 92/*TokenKind.CONTINUE*/: | 17478 case 92/*TokenKind.CONTINUE*/: |
| 17949 | 17479 |
| 17950 return (($0 = this.continueStatement()) && $0.is$lang_Statement()); | 17480 return this.continueStatement(); |
| 17951 | 17481 |
| 17952 case 105/*TokenKind.RETURN*/: | 17482 case 105/*TokenKind.RETURN*/: |
| 17953 | 17483 |
| 17954 return (($0 = this.returnStatement()) && $0.is$lang_Statement()); | 17484 return this.returnStatement(); |
| 17955 | 17485 |
| 17956 case 109/*TokenKind.THROW*/: | 17486 case 109/*TokenKind.THROW*/: |
| 17957 | 17487 |
| 17958 return (($0 = this.throwStatement()) && $0.is$lang_Statement()); | 17488 return this.throwStatement(); |
| 17959 | 17489 |
| 17960 case 72/*TokenKind.ASSERT*/: | 17490 case 72/*TokenKind.ASSERT*/: |
| 17961 | 17491 |
| 17962 return (($0 = this.assertStatement()) && $0.is$lang_Statement()); | 17492 return this.assertStatement(); |
| 17963 | 17493 |
| 17964 case 114/*TokenKind.WHILE*/: | 17494 case 114/*TokenKind.WHILE*/: |
| 17965 | 17495 |
| 17966 return this.whileStatement(); | 17496 return this.whileStatement(); |
| 17967 | 17497 |
| 17968 case 94/*TokenKind.DO*/: | 17498 case 94/*TokenKind.DO*/: |
| 17969 | 17499 |
| 17970 return this.doStatement(); | 17500 return this.doStatement(); |
| 17971 | 17501 |
| 17972 case 99/*TokenKind.FOR*/: | 17502 case 99/*TokenKind.FOR*/: |
| 17973 | 17503 |
| 17974 return (($0 = this.forStatement()) && $0.is$lang_Statement()); | 17504 return this.forStatement(); |
| 17975 | 17505 |
| 17976 case 100/*TokenKind.IF*/: | 17506 case 100/*TokenKind.IF*/: |
| 17977 | 17507 |
| 17978 return this.ifStatement(); | 17508 return this.ifStatement(); |
| 17979 | 17509 |
| 17980 case 107/*TokenKind.SWITCH*/: | 17510 case 107/*TokenKind.SWITCH*/: |
| 17981 | 17511 |
| 17982 return (($0 = this.switchStatement()) && $0.is$lang_Statement()); | 17512 return this.switchStatement(); |
| 17983 | 17513 |
| 17984 case 111/*TokenKind.TRY*/: | 17514 case 111/*TokenKind.TRY*/: |
| 17985 | 17515 |
| 17986 return (($0 = this.tryStatement()) && $0.is$lang_Statement()); | 17516 return this.tryStatement(); |
| 17987 | 17517 |
| 17988 case 6/*TokenKind.LBRACE*/: | 17518 case 6/*TokenKind.LBRACE*/: |
| 17989 | 17519 |
| 17990 return this.block(); | 17520 return this.block(); |
| 17991 | 17521 |
| 17992 case 10/*TokenKind.SEMICOLON*/: | 17522 case 10/*TokenKind.SEMICOLON*/: |
| 17993 | 17523 |
| 17994 return this.emptyStatement(); | 17524 return this.emptyStatement(); |
| 17995 | 17525 |
| 17996 case 97/*TokenKind.FINAL*/: | 17526 case 97/*TokenKind.FINAL*/: |
| 17997 | 17527 |
| 17998 return (($0 = this.declaration(false)) && $0.is$lang_Statement()); | 17528 return this.declaration(false); |
| 17999 | 17529 |
| 18000 case 112/*TokenKind.VAR*/: | 17530 case 112/*TokenKind.VAR*/: |
| 18001 | 17531 |
| 18002 return (($0 = this.declaration(false)) && $0.is$lang_Statement()); | 17532 return this.declaration(false); |
| 18003 | 17533 |
| 18004 default: | 17534 default: |
| 18005 | 17535 |
| 18006 return (($0 = this.finishExpressionAsStatement(this.expression())) && $0.i
s$lang_Statement()); | 17536 return this.finishExpressionAsStatement(this.expression()); |
| 18007 | 17537 |
| 18008 } | 17538 } |
| 18009 } | 17539 } |
| 18010 lang_Parser.prototype.finishExpressionAsStatement = function(expr) { | 17540 lang_Parser.prototype.finishExpressionAsStatement = function(expr) { |
| 18011 var $0; | |
| 18012 var start = expr.get$span().start; | 17541 var start = expr.get$span().start; |
| 18013 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { | 17542 if (this._maybeEat(8/*TokenKind.COLON*/)) { |
| 18014 var label = this._makeLabel(expr); | 17543 var label = this._makeLabel(expr); |
| 18015 return new LabeledStatement(label, this.statement(), this._makeSpan(start)); | 17544 return new LabeledStatement(label, this.statement(), this._makeSpan(start)); |
| 18016 } | 17545 } |
| 18017 if ((expr instanceof LambdaExpression)) { | 17546 if ((expr instanceof LambdaExpression)) { |
| 18018 if (!(expr.func.body instanceof BlockStatement)) { | 17547 if (!(expr.func.body instanceof BlockStatement)) { |
| 18019 this._eatSemicolon(); | 17548 this._eatSemicolon(); |
| 18020 expr.func.span = this._makeSpan(start); | 17549 expr.func.span = this._makeSpan(start); |
| 18021 } | 17550 } |
| 18022 return expr.func; | 17551 return expr.func; |
| 18023 } | 17552 } |
| 18024 else if ((expr instanceof DeclaredIdentifier)) { | 17553 else if ((expr instanceof DeclaredIdentifier)) { |
| 18025 var value = null; | 17554 var value = null; |
| 18026 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { | 17555 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| 18027 value = this.expression(); | 17556 value = this.expression(); |
| 18028 } | 17557 } |
| 18029 return this.finishField(start, null, expr.type, expr.get$name(), value); | 17558 return this.finishField(start, null, expr.type, expr.get$name(), value); |
| 18030 } | 17559 } |
| 18031 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/)) && ((expr.x
instanceof DeclaredIdentifier))) { | 17560 else if (this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x instanceof Decl
aredIdentifier))) { |
| 18032 var di = (($0 = expr.x) && $0.is$DeclaredIdentifier()); | 17561 var di = expr.x; |
| 18033 return this.finishField(start, null, di.type, di.name, expr.y); | 17562 return this.finishField(start, null, di.type, di.name, expr.y); |
| 18034 } | 17563 } |
| 18035 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/)) && $notnull_bool
(this._maybeEat(11/*TokenKind.COMMA*/))) { | 17564 else if (this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat(11/*TokenKind
.COMMA*/)) { |
| 18036 var baseType = this._makeType(expr.x); | 17565 var baseType = this._makeType(expr.x); |
| 18037 var typeArgs = [this._makeType(expr.y)]; | 17566 var typeArgs = [this._makeType(expr.y)]; |
| 18038 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference())
, 0, typeArgs); | 17567 var gt = this._finishTypeArguments(baseType, 0, typeArgs); |
| 18039 var name = this.identifier(); | 17568 var name = this.identifier(); |
| 18040 var value = null; | 17569 var value = null; |
| 18041 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { | 17570 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| 18042 value = this.expression(); | 17571 value = this.expression(); |
| 18043 } | 17572 } |
| 18044 return this.finishField(expr.get$span().start, null, gt, name, value); | 17573 return this.finishField(expr.get$span().start, null, gt, name, value); |
| 18045 } | 17574 } |
| 18046 else { | 17575 else { |
| 18047 this._eatSemicolon(); | 17576 this._eatSemicolon(); |
| 18048 return new lang_ExpressionStatement(expr, this._makeSpan(expr.get$span().sta
rt)); | 17577 return new lang_ExpressionStatement(expr, this._makeSpan(expr.get$span().sta
rt)); |
| 18049 } | 17578 } |
| 18050 } | 17579 } |
| 18051 lang_Parser.prototype.testCondition = function() { | 17580 lang_Parser.prototype.testCondition = function() { |
| 18052 this._eat(2/*TokenKind.LPAREN*/); | 17581 this._eat(2/*TokenKind.LPAREN*/); |
| 18053 var ret = this.expression(); | 17582 var ret = this.expression(); |
| 18054 this._eat(3/*TokenKind.RPAREN*/); | 17583 this._eat(3/*TokenKind.RPAREN*/); |
| 18055 return (ret && ret.is$lang_Expression()); | 17584 return ret; |
| 18056 } | 17585 } |
| 18057 lang_Parser.prototype.block = function() { | 17586 lang_Parser.prototype.block = function() { |
| 18058 var start = this._peekToken.start; | 17587 var start = this._peekToken.start; |
| 18059 this._eat(6/*TokenKind.LBRACE*/); | 17588 this._eat(6/*TokenKind.LBRACE*/); |
| 18060 var stmts = []; | 17589 var stmts = []; |
| 18061 while (!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/))) { | 17590 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { |
| 18062 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 17591 if (this.isPrematureEndOfFile()) break; |
| 18063 stmts.add$1(this.statement()); | 17592 stmts.add$1(this.statement()); |
| 18064 } | 17593 } |
| 18065 return new BlockStatement(stmts, this._makeSpan(start)); | 17594 return new BlockStatement(stmts, this._makeSpan(start)); |
| 18066 } | 17595 } |
| 18067 lang_Parser.prototype.emptyStatement = function() { | 17596 lang_Parser.prototype.emptyStatement = function() { |
| 18068 var start = this._peekToken.start; | 17597 var start = this._peekToken.start; |
| 18069 this._eat(10/*TokenKind.SEMICOLON*/); | 17598 this._eat(10/*TokenKind.SEMICOLON*/); |
| 18070 return new EmptyStatement(this._makeSpan(start)); | 17599 return new EmptyStatement(this._makeSpan(start)); |
| 18071 } | 17600 } |
| 18072 lang_Parser.prototype.ifStatement = function() { | 17601 lang_Parser.prototype.ifStatement = function() { |
| 18073 var start = this._peekToken.start; | 17602 var start = this._peekToken.start; |
| 18074 this._eat(100/*TokenKind.IF*/); | 17603 this._eat(100/*TokenKind.IF*/); |
| 18075 var test = this.testCondition(); | 17604 var test = this.testCondition(); |
| 18076 var trueBranch = this.statement(); | 17605 var trueBranch = this.statement(); |
| 18077 var falseBranch = null; | 17606 var falseBranch = null; |
| 18078 if ($notnull_bool(this._maybeEat(95/*TokenKind.ELSE*/))) { | 17607 if (this._maybeEat(95/*TokenKind.ELSE*/)) { |
| 18079 falseBranch = this.statement(); | 17608 falseBranch = this.statement(); |
| 18080 } | 17609 } |
| 18081 return new IfStatement(test, trueBranch, falseBranch, this._makeSpan(start)); | 17610 return new IfStatement(test, trueBranch, falseBranch, this._makeSpan(start)); |
| 18082 } | 17611 } |
| 18083 lang_Parser.prototype.whileStatement = function() { | 17612 lang_Parser.prototype.whileStatement = function() { |
| 18084 var start = this._peekToken.start; | 17613 var start = this._peekToken.start; |
| 18085 this._eat(114/*TokenKind.WHILE*/); | 17614 this._eat(114/*TokenKind.WHILE*/); |
| 18086 var test = this.testCondition(); | 17615 var test = this.testCondition(); |
| 18087 var body = this.statement(); | 17616 var body = this.statement(); |
| 18088 return new WhileStatement(test, body, this._makeSpan(start)); | 17617 return new WhileStatement(test, body, this._makeSpan(start)); |
| 18089 } | 17618 } |
| 18090 lang_Parser.prototype.doStatement = function() { | 17619 lang_Parser.prototype.doStatement = function() { |
| 18091 var start = this._peekToken.start; | 17620 var start = this._peekToken.start; |
| 18092 this._eat(94/*TokenKind.DO*/); | 17621 this._eat(94/*TokenKind.DO*/); |
| 18093 var body = this.statement(); | 17622 var body = this.statement(); |
| 18094 this._eat(114/*TokenKind.WHILE*/); | 17623 this._eat(114/*TokenKind.WHILE*/); |
| 18095 var test = this.testCondition(); | 17624 var test = this.testCondition(); |
| 18096 this._eatSemicolon(); | 17625 this._eatSemicolon(); |
| 18097 return new DoStatement(body, test, this._makeSpan(start)); | 17626 return new DoStatement(body, test, this._makeSpan(start)); |
| 18098 } | 17627 } |
| 18099 lang_Parser.prototype.forStatement = function() { | 17628 lang_Parser.prototype.forStatement = function() { |
| 18100 var start = this._peekToken.start; | 17629 var start = this._peekToken.start; |
| 18101 this._eat(99/*TokenKind.FOR*/); | 17630 this._eat(99/*TokenKind.FOR*/); |
| 18102 this._eat(2/*TokenKind.LPAREN*/); | 17631 this._eat(2/*TokenKind.LPAREN*/); |
| 18103 var init = this.forInitializerStatement(start); | 17632 var init = this.forInitializerStatement(start); |
| 18104 if ((init instanceof ForInStatement)) { | 17633 if ((init instanceof ForInStatement)) { |
| 18105 return init; | 17634 return init; |
| 18106 } | 17635 } |
| 18107 var test = null; | 17636 var test = null; |
| 18108 if (!$notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { | 17637 if (!this._maybeEat(10/*TokenKind.SEMICOLON*/)) { |
| 18109 test = this.expression(); | 17638 test = this.expression(); |
| 18110 this._eatSemicolon(); | 17639 this._eatSemicolon(); |
| 18111 } | 17640 } |
| 18112 var step = []; | 17641 var step = []; |
| 18113 if (!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/))) { | 17642 if (!this._maybeEat(3/*TokenKind.RPAREN*/)) { |
| 18114 step.add$1(this.expression()); | 17643 step.add$1(this.expression()); |
| 18115 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 17644 while (this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 18116 step.add$1(this.expression()); | 17645 step.add$1(this.expression()); |
| 18117 } | 17646 } |
| 18118 this._eat(3/*TokenKind.RPAREN*/); | 17647 this._eat(3/*TokenKind.RPAREN*/); |
| 18119 } | 17648 } |
| 18120 var body = this.statement(); | 17649 var body = this.statement(); |
| 18121 return new ForStatement(init, test, step, body, this._makeSpan(start)); | 17650 return new ForStatement(init, test, step, body, this._makeSpan(start)); |
| 18122 } | 17651 } |
| 18123 lang_Parser.prototype.forInitializerStatement = function(start) { | 17652 lang_Parser.prototype.forInitializerStatement = function(start) { |
| 18124 var $0; | 17653 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { |
| 18125 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { | |
| 18126 return null; | 17654 return null; |
| 18127 } | 17655 } |
| 18128 else { | 17656 else { |
| 18129 var init = this.expression(); | 17657 var init = this.expression(); |
| 18130 if ($notnull_bool(this._peekKind(11/*TokenKind.COMMA*/)) && $notnull_bool(th
is._isBin(init, 52/*TokenKind.LT*/))) { | 17658 if (this._peekKind(11/*TokenKind.COMMA*/) && this._isBin(init, 52/*TokenKind
.LT*/)) { |
| 18131 this._eat(11/*TokenKind.COMMA*/); | 17659 this._eat(11/*TokenKind.COMMA*/); |
| 18132 var baseType = this._makeType(init.x); | 17660 var baseType = this._makeType(init.x); |
| 18133 var typeArgs = [this._makeType(init.y)]; | 17661 var typeArgs = [this._makeType(init.y)]; |
| 18134 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference(
)), 0, typeArgs); | 17662 var gt = this._finishTypeArguments(baseType, 0, typeArgs); |
| 18135 var name = this.identifier(); | 17663 var name = this.identifier(); |
| 18136 init = new DeclaredIdentifier(gt, name, this._makeSpan(init.get$span().sta
rt)); | 17664 init = new DeclaredIdentifier(gt, name, this._makeSpan(init.get$span().sta
rt)); |
| 18137 } | 17665 } |
| 18138 if ($notnull_bool(this._maybeEat(101/*TokenKind.IN*/))) { | 17666 if (this._maybeEat(101/*TokenKind.IN*/)) { |
| 18139 return this._finishForIn(start, (($0 = this._makeDeclaredIdentifier(init))
&& $0.is$DeclaredIdentifier())); | 17667 return this._finishForIn(start, this._makeDeclaredIdentifier(init)); |
| 18140 } | 17668 } |
| 18141 else { | 17669 else { |
| 18142 return this.finishExpressionAsStatement(init); | 17670 return this.finishExpressionAsStatement(init); |
| 18143 } | 17671 } |
| 18144 } | 17672 } |
| 18145 } | 17673 } |
| 18146 lang_Parser.prototype._finishForIn = function(start, di) { | 17674 lang_Parser.prototype._finishForIn = function(start, di) { |
| 18147 var expr = this.expression(); | 17675 var expr = this.expression(); |
| 18148 this._eat(3/*TokenKind.RPAREN*/); | 17676 this._eat(3/*TokenKind.RPAREN*/); |
| 18149 var body = this.statement(); | 17677 var body = this.statement(); |
| 18150 return new ForInStatement(di, expr, body, this._makeSpan(start)); | 17678 return new ForInStatement(di, expr, body, this._makeSpan(start)); |
| 18151 } | 17679 } |
| 18152 lang_Parser.prototype.tryStatement = function() { | 17680 lang_Parser.prototype.tryStatement = function() { |
| 18153 var start = this._peekToken.start; | 17681 var start = this._peekToken.start; |
| 18154 this._eat(111/*TokenKind.TRY*/); | 17682 this._eat(111/*TokenKind.TRY*/); |
| 18155 var body = this.block(); | 17683 var body = this.block(); |
| 18156 var catches = []; | 17684 var catches = []; |
| 18157 while ($notnull_bool(this._peekKind(90/*TokenKind.CATCH*/))) { | 17685 while (this._peekKind(90/*TokenKind.CATCH*/)) { |
| 18158 catches.add$1(this.catchNode()); | 17686 catches.add$1(this.catchNode()); |
| 18159 } | 17687 } |
| 18160 var finallyBlock = null; | 17688 var finallyBlock = null; |
| 18161 if ($notnull_bool(this._maybeEat(98/*TokenKind.FINALLY*/))) { | 17689 if (this._maybeEat(98/*TokenKind.FINALLY*/)) { |
| 18162 finallyBlock = this.block(); | 17690 finallyBlock = this.block(); |
| 18163 } | 17691 } |
| 18164 return new TryStatement(body, catches, finallyBlock, this._makeSpan(start)); | 17692 return new TryStatement(body, catches, finallyBlock, this._makeSpan(start)); |
| 18165 } | 17693 } |
| 18166 lang_Parser.prototype.catchNode = function() { | 17694 lang_Parser.prototype.catchNode = function() { |
| 18167 var start = this._peekToken.start; | 17695 var start = this._peekToken.start; |
| 18168 this._eat(90/*TokenKind.CATCH*/); | 17696 this._eat(90/*TokenKind.CATCH*/); |
| 18169 this._eat(2/*TokenKind.LPAREN*/); | 17697 this._eat(2/*TokenKind.LPAREN*/); |
| 18170 var exc = this.declaredIdentifier(false); | 17698 var exc = this.declaredIdentifier(false); |
| 18171 var trace = null; | 17699 var trace = null; |
| 18172 if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 17700 if (this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 18173 trace = this.declaredIdentifier(false); | 17701 trace = this.declaredIdentifier(false); |
| 18174 } | 17702 } |
| 18175 this._eat(3/*TokenKind.RPAREN*/); | 17703 this._eat(3/*TokenKind.RPAREN*/); |
| 18176 var body = this.block(); | 17704 var body = this.block(); |
| 18177 return new CatchNode(exc, trace, body, this._makeSpan(start)); | 17705 return new CatchNode(exc, trace, body, this._makeSpan(start)); |
| 18178 } | 17706 } |
| 18179 lang_Parser.prototype.switchStatement = function() { | 17707 lang_Parser.prototype.switchStatement = function() { |
| 18180 var start = this._peekToken.start; | 17708 var start = this._peekToken.start; |
| 18181 this._eat(107/*TokenKind.SWITCH*/); | 17709 this._eat(107/*TokenKind.SWITCH*/); |
| 18182 var test = this.testCondition(); | 17710 var test = this.testCondition(); |
| 18183 var cases = []; | 17711 var cases = []; |
| 18184 this._eat(6/*TokenKind.LBRACE*/); | 17712 this._eat(6/*TokenKind.LBRACE*/); |
| 18185 while (!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/))) { | 17713 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { |
| 18186 cases.add$1(this.caseNode()); | 17714 cases.add$1(this.caseNode()); |
| 18187 } | 17715 } |
| 18188 return new SwitchStatement(test, cases, this._makeSpan(start)); | 17716 return new SwitchStatement(test, cases, this._makeSpan(start)); |
| 18189 } | 17717 } |
| 18190 lang_Parser.prototype._peekCaseEnd = function() { | 17718 lang_Parser.prototype._peekCaseEnd = function() { |
| 18191 var kind = this._peek(); | 17719 var kind = this._peek(); |
| 18192 return $notnull_bool($eq(kind, 7/*TokenKind.RBRACE*/)) || $notnull_bool($eq(ki
nd, 89/*TokenKind.CASE*/)) || $notnull_bool($eq(kind, 93/*TokenKind.DEFAULT*/)); | 17720 return $eq(kind, 7/*TokenKind.RBRACE*/) || $eq(kind, 89/*TokenKind.CASE*/) ||
$eq(kind, 93/*TokenKind.DEFAULT*/); |
| 18193 } | 17721 } |
| 18194 lang_Parser.prototype.caseNode = function() { | 17722 lang_Parser.prototype.caseNode = function() { |
| 18195 var start = this._peekToken.start; | 17723 var start = this._peekToken.start; |
| 18196 var label = null; | 17724 var label = null; |
| 18197 if ($notnull_bool(this._peekIdentifier())) { | 17725 if (this._peekIdentifier()) { |
| 18198 label = this.identifier(); | 17726 label = this.identifier(); |
| 18199 this._eat(8/*TokenKind.COLON*/); | 17727 this._eat(8/*TokenKind.COLON*/); |
| 18200 } | 17728 } |
| 18201 var cases = []; | 17729 var cases = []; |
| 18202 while (true) { | 17730 while (true) { |
| 18203 if ($notnull_bool(this._maybeEat(89/*TokenKind.CASE*/))) { | 17731 if (this._maybeEat(89/*TokenKind.CASE*/)) { |
| 18204 cases.add$1(this.expression()); | 17732 cases.add$1(this.expression()); |
| 18205 this._eat(8/*TokenKind.COLON*/); | 17733 this._eat(8/*TokenKind.COLON*/); |
| 18206 } | 17734 } |
| 18207 else if ($notnull_bool(this._maybeEat(93/*TokenKind.DEFAULT*/))) { | 17735 else if (this._maybeEat(93/*TokenKind.DEFAULT*/)) { |
| 18208 cases.add$1(); | 17736 cases.add$1(); |
| 18209 this._eat(8/*TokenKind.COLON*/); | 17737 this._eat(8/*TokenKind.COLON*/); |
| 18210 } | 17738 } |
| 18211 else { | 17739 else { |
| 18212 break; | 17740 break; |
| 18213 } | 17741 } |
| 18214 } | 17742 } |
| 18215 if (cases.length == 0) { | 17743 if (cases.length == 0) { |
| 18216 this._lang_error('case or default'); | 17744 this._lang_error('case or default'); |
| 18217 } | 17745 } |
| 18218 var stmts = []; | 17746 var stmts = []; |
| 18219 while (!$notnull_bool(this._peekCaseEnd())) { | 17747 while (!this._peekCaseEnd()) { |
| 18220 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 17748 if (this.isPrematureEndOfFile()) break; |
| 18221 stmts.add$1(this.statement()); | 17749 stmts.add$1(this.statement()); |
| 18222 } | 17750 } |
| 18223 return new CaseNode(label, cases, stmts, this._makeSpan(start)); | 17751 return new CaseNode(label, cases, stmts, this._makeSpan(start)); |
| 18224 } | 17752 } |
| 18225 lang_Parser.prototype.returnStatement = function() { | 17753 lang_Parser.prototype.returnStatement = function() { |
| 18226 var start = this._peekToken.start; | 17754 var start = this._peekToken.start; |
| 18227 this._eat(105/*TokenKind.RETURN*/); | 17755 this._eat(105/*TokenKind.RETURN*/); |
| 18228 var expr; | 17756 var expr; |
| 18229 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { | 17757 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { |
| 18230 expr = null; | 17758 expr = null; |
| 18231 } | 17759 } |
| 18232 else { | 17760 else { |
| 18233 expr = this.expression(); | 17761 expr = this.expression(); |
| 18234 this._eatSemicolon(); | 17762 this._eatSemicolon(); |
| 18235 } | 17763 } |
| 18236 return new ReturnStatement(expr, this._makeSpan(start)); | 17764 return new ReturnStatement(expr, this._makeSpan(start)); |
| 18237 } | 17765 } |
| 18238 lang_Parser.prototype.throwStatement = function() { | 17766 lang_Parser.prototype.throwStatement = function() { |
| 18239 var start = this._peekToken.start; | 17767 var start = this._peekToken.start; |
| 18240 this._eat(109/*TokenKind.THROW*/); | 17768 this._eat(109/*TokenKind.THROW*/); |
| 18241 var expr; | 17769 var expr; |
| 18242 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { | 17770 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { |
| 18243 expr = null; | 17771 expr = null; |
| 18244 } | 17772 } |
| 18245 else { | 17773 else { |
| 18246 expr = this.expression(); | 17774 expr = this.expression(); |
| 18247 this._eatSemicolon(); | 17775 this._eatSemicolon(); |
| 18248 } | 17776 } |
| 18249 return new ThrowStatement(expr, this._makeSpan(start)); | 17777 return new ThrowStatement(expr, this._makeSpan(start)); |
| 18250 } | 17778 } |
| 18251 lang_Parser.prototype.assertStatement = function() { | 17779 lang_Parser.prototype.assertStatement = function() { |
| 18252 var start = this._peekToken.start; | 17780 var start = this._peekToken.start; |
| 18253 this._eat(72/*TokenKind.ASSERT*/); | 17781 this._eat(72/*TokenKind.ASSERT*/); |
| 18254 this._eat(2/*TokenKind.LPAREN*/); | 17782 this._eat(2/*TokenKind.LPAREN*/); |
| 18255 var expr = this.expression(); | 17783 var expr = this.expression(); |
| 18256 this._eat(3/*TokenKind.RPAREN*/); | 17784 this._eat(3/*TokenKind.RPAREN*/); |
| 18257 this._eatSemicolon(); | 17785 this._eatSemicolon(); |
| 18258 return new AssertStatement(expr, this._makeSpan(start)); | 17786 return new AssertStatement(expr, this._makeSpan(start)); |
| 18259 } | 17787 } |
| 18260 lang_Parser.prototype.breakStatement = function() { | 17788 lang_Parser.prototype.breakStatement = function() { |
| 18261 var start = this._peekToken.start; | 17789 var start = this._peekToken.start; |
| 18262 this._eat(88/*TokenKind.BREAK*/); | 17790 this._eat(88/*TokenKind.BREAK*/); |
| 18263 var name = null; | 17791 var name = null; |
| 18264 if ($notnull_bool(this._peekIdentifier())) { | 17792 if (this._peekIdentifier()) { |
| 18265 name = this.identifier(); | 17793 name = this.identifier(); |
| 18266 } | 17794 } |
| 18267 this._eatSemicolon(); | 17795 this._eatSemicolon(); |
| 18268 return new BreakStatement(name, this._makeSpan(start)); | 17796 return new BreakStatement(name, this._makeSpan(start)); |
| 18269 } | 17797 } |
| 18270 lang_Parser.prototype.continueStatement = function() { | 17798 lang_Parser.prototype.continueStatement = function() { |
| 18271 var start = this._peekToken.start; | 17799 var start = this._peekToken.start; |
| 18272 this._eat(92/*TokenKind.CONTINUE*/); | 17800 this._eat(92/*TokenKind.CONTINUE*/); |
| 18273 var name = null; | 17801 var name = null; |
| 18274 if ($notnull_bool(this._peekIdentifier())) { | 17802 if (this._peekIdentifier()) { |
| 18275 name = this.identifier(); | 17803 name = this.identifier(); |
| 18276 } | 17804 } |
| 18277 this._eatSemicolon(); | 17805 this._eatSemicolon(); |
| 18278 return new ContinueStatement(name, this._makeSpan(start)); | 17806 return new ContinueStatement(name, this._makeSpan(start)); |
| 18279 } | 17807 } |
| 18280 lang_Parser.prototype.expression = function() { | 17808 lang_Parser.prototype.expression = function() { |
| 18281 return this.infixExpression(0); | 17809 return this.infixExpression(0); |
| 18282 } | 17810 } |
| 18283 lang_Parser.prototype._makeType = function(expr) { | 17811 lang_Parser.prototype._makeType = function(expr) { |
| 18284 if ((expr instanceof VarExpression)) { | 17812 if ((expr instanceof VarExpression)) { |
| 18285 return new NameTypeReference(false, expr.get$name(), null, expr.get$span()); | 17813 return new NameTypeReference(false, expr.get$name(), null, expr.get$span()); |
| 18286 } | 17814 } |
| 18287 else if ((expr instanceof DotExpression)) { | 17815 else if ((expr instanceof DotExpression)) { |
| 18288 var type = this._makeType(expr.self); | 17816 var type = this._makeType(expr.self); |
| 18289 if (type.names == null) { | 17817 if (type.names == null) { |
| 18290 type.names = [expr.get$name()]; | 17818 type.names = [expr.get$name()]; |
| 18291 } | 17819 } |
| 18292 else { | 17820 else { |
| 18293 type.names.add(expr.get$name()); | 17821 type.names.add(expr.get$name()); |
| 18294 } | 17822 } |
| 18295 type.span = expr.get$span(); | 17823 type.span = expr.get$span(); |
| 18296 return type; | 17824 return type; |
| 18297 } | 17825 } |
| 18298 else { | 17826 else { |
| 18299 this._lang_error('expected type reference'); | 17827 this._lang_error('expected type reference'); |
| 18300 return null; | 17828 return null; |
| 18301 } | 17829 } |
| 18302 } | 17830 } |
| 18303 lang_Parser.prototype.infixExpression = function(precedence) { | 17831 lang_Parser.prototype.infixExpression = function(precedence) { |
| 18304 var $0; | 17832 return this.finishInfixExpression(this.unaryExpression(), precedence); |
| 18305 return this.finishInfixExpression((($0 = this.unaryExpression()) && $0.is$lang
_Expression()), precedence); | |
| 18306 } | 17833 } |
| 18307 lang_Parser.prototype._finishDeclaredId = function(type) { | 17834 lang_Parser.prototype._finishDeclaredId = function(type) { |
| 18308 var name = this.identifier(); | 17835 var name = this.identifier(); |
| 18309 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m
akeSpan(type.get$span().start))); | 17836 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m
akeSpan(type.get$span().start))); |
| 18310 } | 17837 } |
| 18311 lang_Parser.prototype._fixAsType = function(x) { | 17838 lang_Parser.prototype._fixAsType = function(x) { |
| 18312 $assert(this._isBin(x, 52/*TokenKind.LT*/), "_isBin(x, TokenKind.LT)", "parser
.dart", 790, 12); | 17839 if (this._maybeEat(53/*TokenKind.GT*/)) { |
| 18313 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { | |
| 18314 var base = this._makeType(x.x); | 17840 var base = this._makeType(x.x); |
| 18315 var typeParam = this._makeType(x.y); | 17841 var typeParam = this._makeType(x.y); |
| 18316 var type = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.s
pan.start)); | 17842 var type = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.s
pan.start)); |
| 18317 return this._finishDeclaredId(type); | 17843 return this._finishDeclaredId(type); |
| 18318 } | 17844 } |
| 18319 else { | 17845 else { |
| 18320 $assert(this._peekKind(52/*TokenKind.LT*/), "_peekKind(TokenKind.LT)", "pars
er.dart", 801, 14); | |
| 18321 var base = this._makeType(x.x); | 17846 var base = this._makeType(x.x); |
| 18322 var paramBase = this._makeType(x.y); | 17847 var paramBase = this._makeType(x.y); |
| 18323 var firstParam = this.addTypeArguments((paramBase && paramBase.is$TypeRefere
nce()), 1); | 17848 var firstParam = this.addTypeArguments(paramBase, 1); |
| 18324 var type; | 17849 var type; |
| 18325 if (firstParam.depth <= 0) { | 17850 if (firstParam.depth <= 0) { |
| 18326 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp
an.start)); | 17851 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp
an.start)); |
| 18327 } | 17852 } |
| 18328 else if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 17853 else if (this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 18329 type = this._finishTypeArguments((base && base.is$TypeReference()), 0, [fi
rstParam]); | 17854 type = this._finishTypeArguments(base, 0, [firstParam]); |
| 18330 } | 17855 } |
| 18331 else { | 17856 else { |
| 18332 this._eat(53/*TokenKind.GT*/); | 17857 this._eat(53/*TokenKind.GT*/); |
| 18333 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp
an.start)); | 17858 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp
an.start)); |
| 18334 } | 17859 } |
| 18335 return this._finishDeclaredId(type); | 17860 return this._finishDeclaredId(type); |
| 18336 } | 17861 } |
| 18337 } | 17862 } |
| 18338 lang_Parser.prototype.finishInfixExpression = function(x, precedence) { | 17863 lang_Parser.prototype.finishInfixExpression = function(x, precedence) { |
| 18339 while (true) { | 17864 while (true) { |
| 18340 var kind = this._peek(); | 17865 var kind = this._peek(); |
| 18341 var prec = TokenKind.infixPrecedence(this._peek()); | 17866 var prec = TokenKind.infixPrecedence(this._peek()); |
| 18342 if (prec >= precedence) { | 17867 if (prec >= precedence) { |
| 18343 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) { | 17868 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) { |
| 18344 if ($notnull_bool(this._isBin(x, 52/*TokenKind.LT*/))) { | 17869 if (this._isBin(x, 52/*TokenKind.LT*/)) { |
| 18345 return this._fixAsType((x && x.is$BinaryExpression())); | 17870 return this._fixAsType(x); |
| 18346 } | 17871 } |
| 18347 } | 17872 } |
| 18348 var op = this._lang_next(); | 17873 var op = this._lang_next(); |
| 18349 if ($notnull_bool($eq(op.kind, 102/*TokenKind.IS*/))) { | 17874 if ($eq(op.kind, 102/*TokenKind.IS*/)) { |
| 18350 var isTrue = !$notnull_bool(this._maybeEat(19/*TokenKind.NOT*/)); | 17875 var isTrue = !this._maybeEat(19/*TokenKind.NOT*/); |
| 18351 var typeRef = this.type(0); | 17876 var typeRef = this.type(0); |
| 18352 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); | 17877 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); |
| 18353 continue; | 17878 continue; |
| 18354 } | 17879 } |
| 18355 var y = this.infixExpression($assert_num($notnull_bool($eq(prec, 2)) ? pre
c : prec + 1)); | 17880 var y = this.infixExpression($eq(prec, 2) ? prec : prec + 1); |
| 18356 if ($notnull_bool($eq(op.kind, 33/*TokenKind.CONDITIONAL*/))) { | 17881 if ($eq(op.kind, 33/*TokenKind.CONDITIONAL*/)) { |
| 18357 this._eat(8/*TokenKind.COLON*/); | 17882 this._eat(8/*TokenKind.COLON*/); |
| 18358 var z = this.infixExpression($assert_num(prec)); | 17883 var z = this.infixExpression(prec); |
| 18359 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start)); | 17884 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start)); |
| 18360 } | 17885 } |
| 18361 else { | 17886 else { |
| 18362 x = new BinaryExpression(op, x, y, this._makeSpan(x.span.start)); | 17887 x = new BinaryExpression(op, x, y, this._makeSpan(x.span.start)); |
| 18363 } | 17888 } |
| 18364 } | 17889 } |
| 18365 else { | 17890 else { |
| 18366 break; | 17891 break; |
| 18367 } | 17892 } |
| 18368 } | 17893 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 18380 return true; | 17905 return true; |
| 18381 | 17906 |
| 18382 default: | 17907 default: |
| 18383 | 17908 |
| 18384 return false; | 17909 return false; |
| 18385 | 17910 |
| 18386 } | 17911 } |
| 18387 } | 17912 } |
| 18388 lang_Parser.prototype.unaryExpression = function() { | 17913 lang_Parser.prototype.unaryExpression = function() { |
| 18389 var start = this._peekToken.start; | 17914 var start = this._peekToken.start; |
| 18390 if ($notnull_bool(this._isPrefixUnaryOperator(this._peek()))) { | 17915 if (this._isPrefixUnaryOperator(this._peek())) { |
| 18391 var tok = this._lang_next(); | 17916 var tok = this._lang_next(); |
| 18392 var expr = this.unaryExpression(); | 17917 var expr = this.unaryExpression(); |
| 18393 return new UnaryExpression(tok, expr, this._makeSpan(start)); | 17918 return new UnaryExpression(tok, expr, this._makeSpan(start)); |
| 18394 } | 17919 } |
| 18395 return this.finishPostfixExpression(this.primary()); | 17920 return this.finishPostfixExpression(this.primary()); |
| 18396 } | 17921 } |
| 18397 lang_Parser.prototype.argument = function() { | 17922 lang_Parser.prototype.argument = function() { |
| 18398 var start = this._peekToken.start; | 17923 var start = this._peekToken.start; |
| 18399 var expr; | 17924 var expr; |
| 18400 var label = null; | 17925 var label = null; |
| 18401 if ($notnull_bool(this._maybeEat(15/*TokenKind.ELLIPSIS*/))) { | 17926 if (this._maybeEat(15/*TokenKind.ELLIPSIS*/)) { |
| 18402 label = new lang_Identifier('...', this._makeSpan(start)); | 17927 label = new lang_Identifier('...', this._makeSpan(start)); |
| 18403 } | 17928 } |
| 18404 expr = this.expression(); | 17929 expr = this.expression(); |
| 18405 if (label == null && $notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { | 17930 if (label == null && this._maybeEat(8/*TokenKind.COLON*/)) { |
| 18406 label = this._makeLabel(expr); | 17931 label = this._makeLabel(expr); |
| 18407 expr = this.expression(); | 17932 expr = this.expression(); |
| 18408 } | 17933 } |
| 18409 return new ArgumentNode(label, expr, this._makeSpan(start)); | 17934 return new ArgumentNode(label, expr, this._makeSpan(start)); |
| 18410 } | 17935 } |
| 18411 lang_Parser.prototype.arguments = function() { | 17936 lang_Parser.prototype.arguments = function() { |
| 18412 var args = []; | 17937 var args = []; |
| 18413 this._eat(2/*TokenKind.LPAREN*/); | 17938 this._eat(2/*TokenKind.LPAREN*/); |
| 18414 if (!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/))) { | 17939 if (!this._maybeEat(3/*TokenKind.RPAREN*/)) { |
| 18415 do { | 17940 do { |
| 18416 args.add$1(this.argument()); | 17941 args.add$1(this.argument()); |
| 18417 } | 17942 } |
| 18418 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 17943 while (this._maybeEat(11/*TokenKind.COMMA*/)) |
| 18419 this._eat(3/*TokenKind.RPAREN*/); | 17944 this._eat(3/*TokenKind.RPAREN*/); |
| 18420 } | 17945 } |
| 18421 return args; | 17946 return args; |
| 18422 } | 17947 } |
| 18423 lang_Parser.prototype.get$arguments = function() { | 17948 lang_Parser.prototype.get$arguments = function() { |
| 18424 return lang_Parser.prototype.arguments.bind(this); | 17949 return lang_Parser.prototype.arguments.bind(this); |
| 18425 } | 17950 } |
| 18426 lang_Parser.prototype.finishPostfixExpression = function(expr) { | 17951 lang_Parser.prototype.finishPostfixExpression = function(expr) { |
| 18427 switch (this._peek()) { | 17952 switch (this._peek()) { |
| 18428 case 2/*TokenKind.LPAREN*/: | 17953 case 2/*TokenKind.LPAREN*/: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 18445 | 17970 |
| 18446 case 16/*TokenKind.INCR*/: | 17971 case 16/*TokenKind.INCR*/: |
| 18447 case 17/*TokenKind.DECR*/: | 17972 case 17/*TokenKind.DECR*/: |
| 18448 | 17973 |
| 18449 var tok = this._lang_next(); | 17974 var tok = this._lang_next(); |
| 18450 return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().sta
rt)); | 17975 return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().sta
rt)); |
| 18451 | 17976 |
| 18452 case 9/*TokenKind.ARROW*/: | 17977 case 9/*TokenKind.ARROW*/: |
| 18453 case 6/*TokenKind.LBRACE*/: | 17978 case 6/*TokenKind.LBRACE*/: |
| 18454 | 17979 |
| 18455 if ($notnull_bool(this._inInitializers)) return expr; | 17980 if (this._inInitializers) return expr; |
| 18456 var body = this.functionBody(true); | 17981 var body = this.functionBody(true); |
| 18457 return this._makeFunction(expr, body); | 17982 return this._makeFunction(expr, body); |
| 18458 | 17983 |
| 18459 default: | 17984 default: |
| 18460 | 17985 |
| 18461 if ($notnull_bool(this._peekIdentifier())) { | 17986 if (this._peekIdentifier()) { |
| 18462 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp
e(expr), this.identifier(), this._makeSpan(expr.get$span().start))); | 17987 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp
e(expr), this.identifier(), this._makeSpan(expr.get$span().start))); |
| 18463 } | 17988 } |
| 18464 else { | 17989 else { |
| 18465 return expr; | 17990 return expr; |
| 18466 } | 17991 } |
| 18467 | 17992 |
| 18468 } | 17993 } |
| 18469 } | 17994 } |
| 18470 lang_Parser.prototype._isBin = function(expr, kind) { | 17995 lang_Parser.prototype._isBin = function(expr, kind) { |
| 18471 return (expr instanceof BinaryExpression) && expr.op.kind == kind; | 17996 return (expr instanceof BinaryExpression) && expr.op.kind == kind; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 18491 return new ThisExpression(this._makeSpan(start)); | 18016 return new ThisExpression(this._makeSpan(start)); |
| 18492 | 18017 |
| 18493 case 106/*TokenKind.SUPER*/: | 18018 case 106/*TokenKind.SUPER*/: |
| 18494 | 18019 |
| 18495 this._eat(106/*TokenKind.SUPER*/); | 18020 this._eat(106/*TokenKind.SUPER*/); |
| 18496 return new SuperExpression(this._makeSpan(start)); | 18021 return new SuperExpression(this._makeSpan(start)); |
| 18497 | 18022 |
| 18498 case 91/*TokenKind.CONST*/: | 18023 case 91/*TokenKind.CONST*/: |
| 18499 | 18024 |
| 18500 this._eat(91/*TokenKind.CONST*/); | 18025 this._eat(91/*TokenKind.CONST*/); |
| 18501 if ($notnull_bool(this._peekKind(4/*TokenKind.LBRACK*/)) || $notnull_bool(
this._peekKind(56/*TokenKind.INDEX*/))) { | 18026 if (this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/*TokenKind.
INDEX*/)) { |
| 18502 return this.finishListLiteral(start, true, null); | 18027 return this.finishListLiteral(start, true, null); |
| 18503 } | 18028 } |
| 18504 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { | 18029 else if (this._peekKind(6/*TokenKind.LBRACE*/)) { |
| 18505 return this.finishMapLiteral(start, true, null); | 18030 return this.finishMapLiteral(start, true, null); |
| 18506 } | 18031 } |
| 18507 else if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { | 18032 else if (this._peekKind(52/*TokenKind.LT*/)) { |
| 18508 return this.finishTypedLiteral(start, true); | 18033 return this.finishTypedLiteral(start, true); |
| 18509 } | 18034 } |
| 18510 else { | 18035 else { |
| 18511 return this.finishNewExpression(start, true); | 18036 return this.finishNewExpression(start, true); |
| 18512 } | 18037 } |
| 18513 | 18038 |
| 18514 case 103/*TokenKind.NEW*/: | 18039 case 103/*TokenKind.NEW*/: |
| 18515 | 18040 |
| 18516 this._eat(103/*TokenKind.NEW*/); | 18041 this._eat(103/*TokenKind.NEW*/); |
| 18517 return this.finishNewExpression(start, false); | 18042 return this.finishNewExpression(start, false); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18572 return this.finishTypedLiteral(start, false); | 18097 return this.finishTypedLiteral(start, false); |
| 18573 | 18098 |
| 18574 case 113/*TokenKind.VOID*/: | 18099 case 113/*TokenKind.VOID*/: |
| 18575 case 112/*TokenKind.VAR*/: | 18100 case 112/*TokenKind.VAR*/: |
| 18576 case 97/*TokenKind.FINAL*/: | 18101 case 97/*TokenKind.FINAL*/: |
| 18577 | 18102 |
| 18578 return this.declaredIdentifier(false); | 18103 return this.declaredIdentifier(false); |
| 18579 | 18104 |
| 18580 default: | 18105 default: |
| 18581 | 18106 |
| 18582 if (!$notnull_bool(this._peekIdentifier())) { | 18107 if (!this._peekIdentifier()) { |
| 18583 this._errorExpected('expression'); | 18108 this._errorExpected('expression'); |
| 18584 } | 18109 } |
| 18585 return new VarExpression(this.identifier(), this._makeSpan(start)); | 18110 return new VarExpression(this.identifier(), this._makeSpan(start)); |
| 18586 | 18111 |
| 18587 } | 18112 } |
| 18588 } | 18113 } |
| 18589 lang_Parser.prototype.stringInterpolation = function() { | 18114 lang_Parser.prototype.stringInterpolation = function() { |
| 18590 var start = this._peekToken.start; | 18115 var start = this._peekToken.start; |
| 18591 var lits = []; | 18116 var lits = []; |
| 18592 var startQuote = null, endQuote = null; | 18117 var startQuote = null, endQuote = null; |
| 18593 while ($notnull_bool(this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/))) { | 18118 while (this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/)) { |
| 18594 var token = this._lang_next(); | 18119 var token = this._lang_next(); |
| 18595 var text = token.get$text(); | 18120 var text = token.get$text(); |
| 18596 if ($notnull_bool(startQuote == null)) { | 18121 if (startQuote == null) { |
| 18597 if ($notnull_bool(isMultilineString($assert_String(text)))) { | 18122 if (isMultilineString(text)) { |
| 18598 endQuote = text.substring$2(0, 3); | 18123 endQuote = text.substring$2(0, 3); |
| 18599 startQuote = $add(endQuote, '\n'); | 18124 startQuote = endQuote + '\n'; |
| 18600 } | 18125 } |
| 18601 else { | 18126 else { |
| 18602 startQuote = endQuote = text.$index(0); | 18127 startQuote = endQuote = text.$index(0); |
| 18603 } | 18128 } |
| 18604 text = $add(text.substring$2(0, text.length - 1), endQuote); | 18129 text = text.substring$2(0, text.length - 1) + endQuote; |
| 18605 } | 18130 } |
| 18606 else { | 18131 else { |
| 18607 text = $add($add(startQuote, text.substring$2(0, text.length - 1)), endQuo
te); | 18132 text = startQuote + text.substring$2(0, text.length - 1) + endQuote; |
| 18608 } | 18133 } |
| 18609 lits.add$1(this.makeStringLiteral($assert_String(text), token.get$span())); | 18134 lits.add$1(this.makeStringLiteral(text, token.get$span())); |
| 18610 if ($notnull_bool(this._maybeEat(6/*TokenKind.LBRACE*/))) { | 18135 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { |
| 18611 lits.add$1(this.expression()); | 18136 lits.add$1(this.expression()); |
| 18612 this._eat(7/*TokenKind.RBRACE*/); | 18137 this._eat(7/*TokenKind.RBRACE*/); |
| 18613 } | 18138 } |
| 18614 else { | 18139 else { |
| 18615 var id = this.identifier(); | 18140 var id = this.identifier(); |
| 18616 lits.add$1(new VarExpression(id, id.get$span())); | 18141 lits.add$1(new VarExpression(id, id.get$span())); |
| 18617 } | 18142 } |
| 18618 } | 18143 } |
| 18619 var tok = this._lang_next(); | 18144 var tok = this._lang_next(); |
| 18620 if ($notnull_bool($ne(tok.kind, 58/*TokenKind.STRING*/))) { | 18145 if ($ne(tok.kind, 58/*TokenKind.STRING*/)) { |
| 18621 this._errorExpected('interpolated string'); | 18146 this._errorExpected('interpolated string'); |
| 18622 } | 18147 } |
| 18623 var text = $add(startQuote, tok.get$text()); | 18148 var text = startQuote + tok.get$text(); |
| 18624 lits.add$1(this.makeStringLiteral($assert_String(text), tok.get$span())); | 18149 lits.add$1(this.makeStringLiteral(text, tok.get$span())); |
| 18625 var span = this._makeSpan(start); | 18150 var span = this._makeSpan(start); |
| 18626 return new LiteralExpression(lits, this._stringTypeRef((span && span.is$Source
Span())), '\$\$\$', (span && span.is$SourceSpan())); | 18151 return new LiteralExpression(lits, this._stringTypeRef(span), '\$\$\$', span); |
| 18627 } | 18152 } |
| 18628 lang_Parser.prototype.makeStringLiteral = function(text, span) { | 18153 lang_Parser.prototype.makeStringLiteral = function(text, span) { |
| 18629 return new LiteralExpression(text, this._stringTypeRef(span), text, span); | 18154 return new LiteralExpression(text, this._stringTypeRef(span), text, span); |
| 18630 } | 18155 } |
| 18631 lang_Parser.prototype.stringLiteralExpr = function() { | 18156 lang_Parser.prototype.stringLiteralExpr = function() { |
| 18632 var token = this._lang_next(); | 18157 var token = this._lang_next(); |
| 18633 return this.makeStringLiteral(token.get$text(), token.get$span()); | 18158 return this.makeStringLiteral(token.get$text(), token.get$span()); |
| 18634 } | 18159 } |
| 18635 lang_Parser.prototype.maybeStringLiteral = function() { | 18160 lang_Parser.prototype.maybeStringLiteral = function() { |
| 18636 var kind = this._peek(); | 18161 var kind = this._peek(); |
| 18637 if ($notnull_bool($eq(kind, 58/*TokenKind.STRING*/))) { | 18162 if ($eq(kind, 58/*TokenKind.STRING*/)) { |
| 18638 return parseStringLiteral(this._lang_next().get$text()); | 18163 return parseStringLiteral(this._lang_next().get$text()); |
| 18639 } | 18164 } |
| 18640 else if ($notnull_bool($eq(kind, 59/*TokenKind.STRING_PART*/))) { | 18165 else if ($eq(kind, 59/*TokenKind.STRING_PART*/)) { |
| 18641 this._lang_next(); | 18166 this._lang_next(); |
| 18642 this._errorExpected('string literal, but found interpolated string start'); | 18167 this._errorExpected('string literal, but found interpolated string start'); |
| 18643 } | 18168 } |
| 18644 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) { | 18169 else if ($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/)) { |
| 18645 this._lang_next(); | 18170 this._lang_next(); |
| 18646 this._errorExpected('string literal, but found incomplete string'); | 18171 this._errorExpected('string literal, but found incomplete string'); |
| 18647 } | 18172 } |
| 18648 return null; | 18173 return null; |
| 18649 } | 18174 } |
| 18650 lang_Parser.prototype._parenOrLambda = function() { | 18175 lang_Parser.prototype._parenOrLambda = function() { |
| 18651 var start = this._peekToken.start; | 18176 var start = this._peekToken.start; |
| 18652 var args = this.arguments(); | 18177 var args = this.arguments(); |
| 18653 if (!$notnull_bool(this._inInitializers) && ($notnull_bool(this._peekKind(9/*T
okenKind.ARROW*/)) || $notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/)))) { | 18178 if (!this._inInitializers && (this._peekKind(9/*TokenKind.ARROW*/) || this._pe
ekKind(6/*TokenKind.LBRACE*/))) { |
| 18654 var body = this.functionBody(true); | 18179 var body = this.functionBody(true); |
| 18655 var formals = this._makeFormals(args); | 18180 var formals = this._makeFormals(args); |
| 18656 var func = new FunctionDefinition(null, null, null, formals, null, body, thi
s._makeSpan(start)); | 18181 var func = new FunctionDefinition(null, null, null, formals, null, body, thi
s._makeSpan(start)); |
| 18657 return new LambdaExpression(func, func.get$span()); | 18182 return new LambdaExpression(func, func.get$span()); |
| 18658 } | 18183 } |
| 18659 else { | 18184 else { |
| 18660 if (args.length == 1) { | 18185 if (args.length == 1) { |
| 18661 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star
t)); | 18186 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star
t)); |
| 18662 } | 18187 } |
| 18663 else { | 18188 else { |
| 18664 this._lang_error('unexpected comma expression'); | 18189 this._lang_error('unexpected comma expression'); |
| 18665 return args.$index(0).get$value(); | 18190 return args.$index(0).get$value(); |
| 18666 } | 18191 } |
| 18667 } | 18192 } |
| 18668 } | 18193 } |
| 18669 lang_Parser.prototype._typeAsIdentifier = function(type) { | 18194 lang_Parser.prototype._typeAsIdentifier = function(type) { |
| 18670 return type.get$name(); | 18195 return type.get$name(); |
| 18671 } | 18196 } |
| 18672 lang_Parser.prototype._specialIdentifier = function(includeOperators) { | 18197 lang_Parser.prototype._specialIdentifier = function(includeOperators) { |
| 18673 var start = this._peekToken.start; | 18198 var start = this._peekToken.start; |
| 18674 var name; | 18199 var name; |
| 18675 switch (this._peek()) { | 18200 switch (this._peek()) { |
| 18676 case 15/*TokenKind.ELLIPSIS*/: | 18201 case 15/*TokenKind.ELLIPSIS*/: |
| 18677 | 18202 |
| 18678 this._eat(15/*TokenKind.ELLIPSIS*/); | 18203 this._eat(15/*TokenKind.ELLIPSIS*/); |
| 18679 this._lang_error('rest no longer supported', this._previousToken.get$span(
)); | 18204 this._lang_error('rest no longer supported', this._previousToken.get$span(
)); |
| 18680 name = $assert_String(this.identifier().get$name()); | 18205 name = this.identifier().get$name(); |
| 18681 break; | 18206 break; |
| 18682 | 18207 |
| 18683 case 108/*TokenKind.THIS*/: | 18208 case 108/*TokenKind.THIS*/: |
| 18684 | 18209 |
| 18685 this._eat(108/*TokenKind.THIS*/); | 18210 this._eat(108/*TokenKind.THIS*/); |
| 18686 this._eat(14/*TokenKind.DOT*/); | 18211 this._eat(14/*TokenKind.DOT*/); |
| 18687 name = ('this.' + this.identifier().get$name() + ''); | 18212 name = ('this.' + this.identifier().get$name() + ''); |
| 18688 break; | 18213 break; |
| 18689 | 18214 |
| 18690 case 76/*TokenKind.GET*/: | 18215 case 76/*TokenKind.GET*/: |
| 18691 | 18216 |
| 18692 if (!$notnull_bool(includeOperators)) return null; | 18217 if (!includeOperators) return null; |
| 18693 this._eat(76/*TokenKind.GET*/); | 18218 this._eat(76/*TokenKind.GET*/); |
| 18694 if ($notnull_bool(this._peekIdentifier())) { | 18219 if (this._peekIdentifier()) { |
| 18695 name = ('get\$' + this.identifier().get$name() + ''); | 18220 name = ('get\$' + this.identifier().get$name() + ''); |
| 18696 } | 18221 } |
| 18697 else { | 18222 else { |
| 18698 name = 'get'; | 18223 name = 'get'; |
| 18699 } | 18224 } |
| 18700 break; | 18225 break; |
| 18701 | 18226 |
| 18702 case 84/*TokenKind.SET*/: | 18227 case 84/*TokenKind.SET*/: |
| 18703 | 18228 |
| 18704 if (!$notnull_bool(includeOperators)) return null; | 18229 if (!includeOperators) return null; |
| 18705 this._eat(84/*TokenKind.SET*/); | 18230 this._eat(84/*TokenKind.SET*/); |
| 18706 if ($notnull_bool(this._peekIdentifier())) { | 18231 if (this._peekIdentifier()) { |
| 18707 name = ('set\$' + this.identifier().get$name() + ''); | 18232 name = ('set\$' + this.identifier().get$name() + ''); |
| 18708 } | 18233 } |
| 18709 else { | 18234 else { |
| 18710 name = 'set'; | 18235 name = 'set'; |
| 18711 } | 18236 } |
| 18712 break; | 18237 break; |
| 18713 | 18238 |
| 18714 case 83/*TokenKind.OPERATOR*/: | 18239 case 83/*TokenKind.OPERATOR*/: |
| 18715 | 18240 |
| 18716 if (!$notnull_bool(includeOperators)) return null; | 18241 if (!includeOperators) return null; |
| 18717 this._eat(83/*TokenKind.OPERATOR*/); | 18242 this._eat(83/*TokenKind.OPERATOR*/); |
| 18718 var kind = this._peek(); | 18243 var kind = this._peek(); |
| 18719 if ($notnull_bool($eq(kind, 82/*TokenKind.NEGATE*/))) { | 18244 if ($eq(kind, 82/*TokenKind.NEGATE*/)) { |
| 18720 name = '\$negate'; | 18245 name = '\$negate'; |
| 18721 this._lang_next(); | 18246 this._lang_next(); |
| 18722 } | 18247 } |
| 18723 else { | 18248 else { |
| 18724 name = TokenKind.binaryMethodName($assert_num(kind)); | 18249 name = TokenKind.binaryMethodName(kind); |
| 18725 if (name == null) { | 18250 if (name == null) { |
| 18726 name = 'operator'; | 18251 name = 'operator'; |
| 18727 } | 18252 } |
| 18728 else { | 18253 else { |
| 18729 this._lang_next(); | 18254 this._lang_next(); |
| 18730 } | 18255 } |
| 18731 } | 18256 } |
| 18732 break; | 18257 break; |
| 18733 | 18258 |
| 18734 default: | 18259 default: |
| 18735 | 18260 |
| 18736 return null; | 18261 return null; |
| 18737 | 18262 |
| 18738 } | 18263 } |
| 18739 return new lang_Identifier(name, this._makeSpan(start)); | 18264 return new lang_Identifier(name, this._makeSpan(start)); |
| 18740 } | 18265 } |
| 18741 lang_Parser.prototype.declaredIdentifier = function(includeOperators) { | 18266 lang_Parser.prototype.declaredIdentifier = function(includeOperators) { |
| 18742 var start = this._peekToken.start; | 18267 var start = this._peekToken.start; |
| 18743 var myType = null; | 18268 var myType = null; |
| 18744 var name = this._specialIdentifier(includeOperators); | 18269 var name = this._specialIdentifier(includeOperators); |
| 18745 if (name == null) { | 18270 if (name == null) { |
| 18746 myType = this.type(0); | 18271 myType = this.type(0); |
| 18747 name = this._specialIdentifier(includeOperators); | 18272 name = this._specialIdentifier(includeOperators); |
| 18748 if (name == null) { | 18273 if (name == null) { |
| 18749 if ($notnull_bool(this._peekIdentifier())) { | 18274 if (this._peekIdentifier()) { |
| 18750 name = this.identifier(); | 18275 name = this.identifier(); |
| 18751 } | 18276 } |
| 18752 else if ((myType instanceof NameTypeReference) && myType.names == null) { | 18277 else if ((myType instanceof NameTypeReference) && myType.names == null) { |
| 18753 name = this._typeAsIdentifier(myType); | 18278 name = this._typeAsIdentifier(myType); |
| 18754 myType = null; | 18279 myType = null; |
| 18755 } | 18280 } |
| 18756 else { | 18281 else { |
| 18757 } | 18282 } |
| 18758 } | 18283 } |
| 18759 } | 18284 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 18771 } | 18296 } |
| 18772 else { | 18297 else { |
| 18773 return -1; | 18298 return -1; |
| 18774 } | 18299 } |
| 18775 } | 18300 } |
| 18776 lang_Parser.parseHex = function(hex) { | 18301 lang_Parser.parseHex = function(hex) { |
| 18777 var result = 0; | 18302 var result = 0; |
| 18778 for (var i = 0; | 18303 for (var i = 0; |
| 18779 i < hex.length; i++) { | 18304 i < hex.length; i++) { |
| 18780 var digit = lang_Parser._hexDigit(hex.charCodeAt(i)); | 18305 var digit = lang_Parser._hexDigit(hex.charCodeAt(i)); |
| 18781 $assert($ne(digit, -1), "digit != -1", "parser.dart", 1259, 14); | 18306 result = (result << 4) + digit; |
| 18782 result = (result << 4) + $assert_num(digit); | |
| 18783 } | 18307 } |
| 18784 return $assert_num(result); | 18308 return result; |
| 18785 } | 18309 } |
| 18786 lang_Parser.prototype.finishNewExpression = function(start, isConst) { | 18310 lang_Parser.prototype.finishNewExpression = function(start, isConst) { |
| 18787 var type = this.type(0); | 18311 var type = this.type(0); |
| 18788 var name = null; | 18312 var name = null; |
| 18789 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { | 18313 if (this._maybeEat(14/*TokenKind.DOT*/)) { |
| 18790 name = this.identifier(); | 18314 name = this.identifier(); |
| 18791 } | 18315 } |
| 18792 var args = this.arguments(); | 18316 var args = this.arguments(); |
| 18793 return new lang_NewExpression(isConst, type, name, args, this._makeSpan(start)
); | 18317 return new lang_NewExpression(isConst, type, name, args, this._makeSpan(start)
); |
| 18794 } | 18318 } |
| 18795 lang_Parser.prototype.finishListLiteral = function(start, isConst, type) { | 18319 lang_Parser.prototype.finishListLiteral = function(start, isConst, type) { |
| 18796 if ($notnull_bool(this._maybeEat(56/*TokenKind.INDEX*/))) { | 18320 if (this._maybeEat(56/*TokenKind.INDEX*/)) { |
| 18797 return new ListExpression(isConst, type, [], this._makeSpan(start)); | 18321 return new ListExpression(isConst, type, [], this._makeSpan(start)); |
| 18798 } | 18322 } |
| 18799 var values = []; | 18323 var values = []; |
| 18800 this._eat(4/*TokenKind.LBRACK*/); | 18324 this._eat(4/*TokenKind.LBRACK*/); |
| 18801 while (!$notnull_bool(this._maybeEat(5/*TokenKind.RBRACK*/))) { | 18325 while (!this._maybeEat(5/*TokenKind.RBRACK*/)) { |
| 18802 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 18326 if (this.isPrematureEndOfFile()) break; |
| 18803 values.add$1(this.expression()); | 18327 values.add$1(this.expression()); |
| 18804 if (!$notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 18328 if (!this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 18805 this._eat(5/*TokenKind.RBRACK*/); | 18329 this._eat(5/*TokenKind.RBRACK*/); |
| 18806 break; | 18330 break; |
| 18807 } | 18331 } |
| 18808 } | 18332 } |
| 18809 return new ListExpression(isConst, type, values, this._makeSpan(start)); | 18333 return new ListExpression(isConst, type, values, this._makeSpan(start)); |
| 18810 } | 18334 } |
| 18811 lang_Parser.prototype.finishMapLiteral = function(start, isConst, type) { | 18335 lang_Parser.prototype.finishMapLiteral = function(start, isConst, type) { |
| 18812 var items = []; | 18336 var items = []; |
| 18813 this._eat(6/*TokenKind.LBRACE*/); | 18337 this._eat(6/*TokenKind.LBRACE*/); |
| 18814 while (!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/))) { | 18338 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { |
| 18815 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 18339 if (this.isPrematureEndOfFile()) break; |
| 18816 items.add$1(this.expression()); | 18340 items.add$1(this.expression()); |
| 18817 this._eat(8/*TokenKind.COLON*/); | 18341 this._eat(8/*TokenKind.COLON*/); |
| 18818 items.add$1(this.expression()); | 18342 items.add$1(this.expression()); |
| 18819 if (!$notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 18343 if (!this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 18820 this._eat(7/*TokenKind.RBRACE*/); | 18344 this._eat(7/*TokenKind.RBRACE*/); |
| 18821 break; | 18345 break; |
| 18822 } | 18346 } |
| 18823 } | 18347 } |
| 18824 return new MapExpression(isConst, type, items, this._makeSpan(start)); | 18348 return new MapExpression(isConst, type, items, this._makeSpan(start)); |
| 18825 } | 18349 } |
| 18826 lang_Parser.prototype.finishTypedLiteral = function(start, isConst) { | 18350 lang_Parser.prototype.finishTypedLiteral = function(start, isConst) { |
| 18827 var span = this._makeSpan(start); | 18351 var span = this._makeSpan(start); |
| 18828 var typeToBeNamedLater = new NameTypeReference(false, null, null, (span && spa
n.is$SourceSpan())); | 18352 var typeToBeNamedLater = new NameTypeReference(false, null, null, span); |
| 18829 var genericType = this.addTypeArguments((typeToBeNamedLater && typeToBeNamedLa
ter.is$TypeReference()), 0); | 18353 var genericType = this.addTypeArguments(typeToBeNamedLater, 0); |
| 18830 if ($notnull_bool(this._peekKind(4/*TokenKind.LBRACK*/)) || $notnull_bool(this
._peekKind(56/*TokenKind.INDEX*/))) { | 18354 if (this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/*TokenKind.INDE
X*/)) { |
| 18831 return this.finishListLiteral(start, isConst, (genericType && genericType.is
$TypeReference())); | 18355 return this.finishListLiteral(start, isConst, genericType); |
| 18832 } | 18356 } |
| 18833 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { | 18357 else if (this._peekKind(6/*TokenKind.LBRACE*/)) { |
| 18834 return this.finishMapLiteral(start, isConst, (genericType && genericType.is$
TypeReference())); | 18358 return this.finishMapLiteral(start, isConst, genericType); |
| 18835 } | 18359 } |
| 18836 else { | 18360 else { |
| 18837 this._errorExpected('array or map literal'); | 18361 this._errorExpected('array or map literal'); |
| 18838 } | 18362 } |
| 18839 } | 18363 } |
| 18840 lang_Parser.prototype._readModifiers = function() { | 18364 lang_Parser.prototype._readModifiers = function() { |
| 18841 var modifiers = null; | 18365 var modifiers = null; |
| 18842 while (true) { | 18366 while (true) { |
| 18843 switch (this._peek()) { | 18367 switch (this._peek()) { |
| 18844 case 86/*TokenKind.STATIC*/: | 18368 case 86/*TokenKind.STATIC*/: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 18856 return modifiers; | 18380 return modifiers; |
| 18857 | 18381 |
| 18858 } | 18382 } |
| 18859 } | 18383 } |
| 18860 return null; | 18384 return null; |
| 18861 } | 18385 } |
| 18862 lang_Parser.prototype.typeParameter = function() { | 18386 lang_Parser.prototype.typeParameter = function() { |
| 18863 var start = this._peekToken.start; | 18387 var start = this._peekToken.start; |
| 18864 var name = this.identifier(); | 18388 var name = this.identifier(); |
| 18865 var myType = null; | 18389 var myType = null; |
| 18866 if ($notnull_bool(this._maybeEat(74/*TokenKind.EXTENDS*/))) { | 18390 if (this._maybeEat(74/*TokenKind.EXTENDS*/)) { |
| 18867 myType = this.type(1); | 18391 myType = this.type(1); |
| 18868 } | 18392 } |
| 18869 return new TypeParameter(name, myType, this._makeSpan(start)); | 18393 return new TypeParameter(name, myType, this._makeSpan(start)); |
| 18870 } | 18394 } |
| 18871 lang_Parser.prototype.typeParameters = function() { | 18395 lang_Parser.prototype.typeParameters = function() { |
| 18872 this._eat(52/*TokenKind.LT*/); | 18396 this._eat(52/*TokenKind.LT*/); |
| 18873 var closed = false; | 18397 var closed = false; |
| 18874 var ret = []; | 18398 var ret = []; |
| 18875 do { | 18399 do { |
| 18876 var tp = this.typeParameter(); | 18400 var tp = this.typeParameter(); |
| 18877 ret.add$1(tp); | 18401 ret.add$1(tp); |
| 18878 if ((tp.extendsType instanceof GenericTypeReference) && tp.extendsType.depth
== 0) { | 18402 if ((tp.extendsType instanceof GenericTypeReference) && tp.extendsType.depth
== 0) { |
| 18879 closed = true; | 18403 closed = true; |
| 18880 break; | 18404 break; |
| 18881 } | 18405 } |
| 18882 } | 18406 } |
| 18883 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 18407 while (this._maybeEat(11/*TokenKind.COMMA*/)) |
| 18884 if (!$notnull_bool(closed)) { | 18408 if (!closed) { |
| 18885 this._eat(53/*TokenKind.GT*/); | 18409 this._eat(53/*TokenKind.GT*/); |
| 18886 } | 18410 } |
| 18887 return ret; | 18411 return ret; |
| 18888 } | 18412 } |
| 18889 lang_Parser.prototype.get$typeParameters = function() { | 18413 lang_Parser.prototype.get$typeParameters = function() { |
| 18890 return lang_Parser.prototype.typeParameters.bind(this); | 18414 return lang_Parser.prototype.typeParameters.bind(this); |
| 18891 } | 18415 } |
| 18892 lang_Parser.prototype._eatClosingAngle = function(depth) { | 18416 lang_Parser.prototype._eatClosingAngle = function(depth) { |
| 18893 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { | 18417 if (this._maybeEat(53/*TokenKind.GT*/)) { |
| 18894 return depth; | 18418 return depth; |
| 18895 } | 18419 } |
| 18896 else if (depth > 0 && $notnull_bool(this._maybeEat(40/*TokenKind.SAR*/))) { | 18420 else if (depth > 0 && this._maybeEat(40/*TokenKind.SAR*/)) { |
| 18897 return depth - 1; | 18421 return depth - 1; |
| 18898 } | 18422 } |
| 18899 else if (depth > 1 && $notnull_bool(this._maybeEat(41/*TokenKind.SHR*/))) { | 18423 else if (depth > 1 && this._maybeEat(41/*TokenKind.SHR*/)) { |
| 18900 return depth - 2; | 18424 return depth - 2; |
| 18901 } | 18425 } |
| 18902 else { | 18426 else { |
| 18903 this._errorExpected('>'); | 18427 this._errorExpected('>'); |
| 18904 return depth; | 18428 return depth; |
| 18905 } | 18429 } |
| 18906 } | 18430 } |
| 18907 lang_Parser.prototype.addTypeArguments = function(baseType, depth) { | 18431 lang_Parser.prototype.addTypeArguments = function(baseType, depth) { |
| 18908 this._eat(52/*TokenKind.LT*/); | 18432 this._eat(52/*TokenKind.LT*/); |
| 18909 return this._finishTypeArguments(baseType, depth, []); | 18433 return this._finishTypeArguments(baseType, depth, []); |
| 18910 } | 18434 } |
| 18911 lang_Parser.prototype._finishTypeArguments = function(baseType, depth, types) { | 18435 lang_Parser.prototype._finishTypeArguments = function(baseType, depth, types) { |
| 18912 var delta = -1; | 18436 var delta = -1; |
| 18913 do { | 18437 do { |
| 18914 var myType = this.type(depth + 1); | 18438 var myType = this.type(depth + 1); |
| 18915 types.add$1(myType); | 18439 types.add$1(myType); |
| 18916 if ((myType instanceof GenericTypeReference) && myType.depth <= depth) { | 18440 if ((myType instanceof GenericTypeReference) && myType.depth <= depth) { |
| 18917 delta = depth - myType.depth; | 18441 delta = depth - myType.depth; |
| 18918 break; | 18442 break; |
| 18919 } | 18443 } |
| 18920 } | 18444 } |
| 18921 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 18445 while (this._maybeEat(11/*TokenKind.COMMA*/)) |
| 18922 if (delta >= 0) { | 18446 if (delta >= 0) { |
| 18923 depth -= $assert_num(delta); | 18447 depth = depth - delta; |
| 18924 } | 18448 } |
| 18925 else { | 18449 else { |
| 18926 depth = this._eatClosingAngle(depth); | 18450 depth = this._eatClosingAngle(depth); |
| 18927 } | 18451 } |
| 18928 var span = this._makeSpan(baseType.span.start); | 18452 var span = this._makeSpan(baseType.span.start); |
| 18929 return new GenericTypeReference(baseType, types, depth, (span && span.is$Sourc
eSpan())); | 18453 return new GenericTypeReference(baseType, types, depth, span); |
| 18930 } | 18454 } |
| 18931 lang_Parser.prototype.typeList = function() { | 18455 lang_Parser.prototype.typeList = function() { |
| 18932 var types = []; | 18456 var types = []; |
| 18933 do { | 18457 do { |
| 18934 types.add$1(this.type(0)); | 18458 types.add$1(this.type(0)); |
| 18935 } | 18459 } |
| 18936 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 18460 while (this._maybeEat(11/*TokenKind.COMMA*/)) |
| 18937 return types; | 18461 return types; |
| 18938 } | 18462 } |
| 18939 lang_Parser.prototype.type = function(depth) { | 18463 lang_Parser.prototype.type = function(depth) { |
| 18940 var start = this._peekToken.start; | 18464 var start = this._peekToken.start; |
| 18941 var name; | 18465 var name; |
| 18942 var names = null; | 18466 var names = null; |
| 18943 var typeArgs = null; | 18467 var typeArgs = null; |
| 18944 var isFinal = false; | 18468 var isFinal = false; |
| 18945 switch (this._peek()) { | 18469 switch (this._peek()) { |
| 18946 case 113/*TokenKind.VOID*/: | 18470 case 113/*TokenKind.VOID*/: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 18957 isFinal = true; | 18481 isFinal = true; |
| 18958 name = this.identifier(); | 18482 name = this.identifier(); |
| 18959 break; | 18483 break; |
| 18960 | 18484 |
| 18961 default: | 18485 default: |
| 18962 | 18486 |
| 18963 name = this.identifier(); | 18487 name = this.identifier(); |
| 18964 break; | 18488 break; |
| 18965 | 18489 |
| 18966 } | 18490 } |
| 18967 while ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { | 18491 while (this._maybeEat(14/*TokenKind.DOT*/)) { |
| 18968 if (names == null) names = []; | 18492 if (names == null) names = []; |
| 18969 names.add$1(this.identifier()); | 18493 names.add$1(this.identifier()); |
| 18970 } | 18494 } |
| 18971 var typeRef = new NameTypeReference(isFinal, name, names, this._makeSpan(start
)); | 18495 var typeRef = new NameTypeReference(isFinal, name, names, this._makeSpan(start
)); |
| 18972 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { | 18496 if (this._peekKind(52/*TokenKind.LT*/)) { |
| 18973 return this.addTypeArguments((typeRef && typeRef.is$TypeReference()), depth)
; | 18497 return this.addTypeArguments(typeRef, depth); |
| 18974 } | 18498 } |
| 18975 else { | 18499 else { |
| 18976 return typeRef; | 18500 return typeRef; |
| 18977 } | 18501 } |
| 18978 } | 18502 } |
| 18979 lang_Parser.prototype.get$type = function() { | |
| 18980 return lang_Parser.prototype.type.bind(this); | |
| 18981 } | |
| 18982 lang_Parser.prototype.formalParameter = function(inOptionalBlock) { | 18503 lang_Parser.prototype.formalParameter = function(inOptionalBlock) { |
| 18983 var start = this._peekToken.start; | 18504 var start = this._peekToken.start; |
| 18984 var isThis = false; | 18505 var isThis = false; |
| 18985 var isRest = false; | 18506 var isRest = false; |
| 18986 var di = this.declaredIdentifier(false); | 18507 var di = this.declaredIdentifier(false); |
| 18987 var type = di.type; | 18508 var type = di.type; |
| 18988 var name = di.get$name(); | 18509 var name = di.get$name(); |
| 18989 var value = null; | 18510 var value = null; |
| 18990 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { | 18511 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| 18991 if (!$notnull_bool(inOptionalBlock)) { | 18512 if (!inOptionalBlock) { |
| 18992 this._lang_error('default values only allowed inside [optional] section'); | 18513 this._lang_error('default values only allowed inside [optional] section'); |
| 18993 } | 18514 } |
| 18994 value = this.expression(); | 18515 value = this.expression(); |
| 18995 } | 18516 } |
| 18996 else if ($notnull_bool(this._peekKind(2/*TokenKind.LPAREN*/))) { | 18517 else if (this._peekKind(2/*TokenKind.LPAREN*/)) { |
| 18997 var formals = this.formalParameterList(); | 18518 var formals = this.formalParameterList(); |
| 18998 var func = new FunctionDefinition(null, type, name, formals, null, null, thi
s._makeSpan(start)); | 18519 var func = new FunctionDefinition(null, type, name, formals, null, null, thi
s._makeSpan(start)); |
| 18999 type = new FunctionTypeReference(false, func, func.get$span()); | 18520 type = new FunctionTypeReference(false, func, func.get$span()); |
| 19000 } | 18521 } |
| 19001 if ($notnull_bool(inOptionalBlock) && $notnull_bool(value == null)) { | 18522 if (inOptionalBlock && value == null) { |
| 19002 value = new NullExpression(this._makeSpan(start)); | 18523 value = new NullExpression(this._makeSpan(start)); |
| 19003 } | 18524 } |
| 19004 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); | 18525 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); |
| 19005 } | 18526 } |
| 19006 lang_Parser.prototype.formalParameterList = function() { | 18527 lang_Parser.prototype.formalParameterList = function() { |
| 19007 this._eat(2/*TokenKind.LPAREN*/); | 18528 this._eat(2/*TokenKind.LPAREN*/); |
| 19008 var formals = []; | 18529 var formals = []; |
| 19009 var inOptionalBlock = false; | 18530 var inOptionalBlock = false; |
| 19010 if (!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/))) { | 18531 if (!this._maybeEat(3/*TokenKind.RPAREN*/)) { |
| 19011 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { | 18532 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { |
| 19012 inOptionalBlock = true; | 18533 inOptionalBlock = true; |
| 19013 } | 18534 } |
| 19014 formals.add$1(this.formalParameter($assert_bool(inOptionalBlock))); | 18535 formals.add$1(this.formalParameter(inOptionalBlock)); |
| 19015 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 18536 while (this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 19016 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { | 18537 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { |
| 19017 if ($notnull_bool(inOptionalBlock)) { | 18538 if (inOptionalBlock) { |
| 19018 this._lang_error('already inside an optional block', this._previousTok
en.get$span()); | 18539 this._lang_error('already inside an optional block', this._previousTok
en.get$span()); |
| 19019 } | 18540 } |
| 19020 inOptionalBlock = true; | 18541 inOptionalBlock = true; |
| 19021 } | 18542 } |
| 19022 formals.add$1(this.formalParameter($assert_bool(inOptionalBlock))); | 18543 formals.add$1(this.formalParameter(inOptionalBlock)); |
| 19023 } | 18544 } |
| 19024 if ($notnull_bool(inOptionalBlock)) { | 18545 if (inOptionalBlock) { |
| 19025 this._eat(5/*TokenKind.RBRACK*/); | 18546 this._eat(5/*TokenKind.RBRACK*/); |
| 19026 } | 18547 } |
| 19027 this._eat(3/*TokenKind.RPAREN*/); | 18548 this._eat(3/*TokenKind.RPAREN*/); |
| 19028 } | 18549 } |
| 19029 return formals; | 18550 return formals; |
| 19030 } | 18551 } |
| 19031 lang_Parser.prototype.identifier = function() { | 18552 lang_Parser.prototype.identifier = function() { |
| 19032 var tok = this._lang_next(); | 18553 var tok = this._lang_next(); |
| 19033 if (!$notnull_bool(TokenKind.isIdentifier($assert_num(tok.kind)))) { | 18554 if (!TokenKind.isIdentifier(tok.kind)) { |
| 19034 this._lang_error(('expected identifier, but found ' + tok + ''), tok.get$spa
n()); | 18555 this._lang_error(('expected identifier, but found ' + tok + ''), tok.get$spa
n()); |
| 19035 } | 18556 } |
| 19036 return new lang_Identifier(tok.get$text(), this._makeSpan(tok.start)); | 18557 return new lang_Identifier(tok.get$text(), this._makeSpan(tok.start)); |
| 19037 } | 18558 } |
| 19038 lang_Parser.prototype._makeFunction = function(expr, body) { | 18559 lang_Parser.prototype._makeFunction = function(expr, body) { |
| 19039 var name, type; | 18560 var name, type; |
| 19040 if ((expr instanceof CallExpression)) { | 18561 if ((expr instanceof CallExpression)) { |
| 19041 if ((expr.target instanceof VarExpression)) { | 18562 if ((expr.target instanceof VarExpression)) { |
| 19042 name = expr.target.get$name(); | 18563 name = expr.target.get$name(); |
| 19043 type = null; | 18564 type = null; |
| 19044 } | 18565 } |
| 19045 else if ((expr.target instanceof DeclaredIdentifier)) { | 18566 else if ((expr.target instanceof DeclaredIdentifier)) { |
| 19046 name = expr.target.get$name(); | 18567 name = expr.target.get$name(); |
| 19047 type = expr.target.type; | 18568 type = expr.target.type; |
| 19048 } | 18569 } |
| 19049 else { | 18570 else { |
| 19050 this._lang_error('bad function'); | 18571 this._lang_error('bad function'); |
| 19051 } | 18572 } |
| 19052 var formals = this._makeFormals(expr.get$arguments()); | 18573 var formals = this._makeFormals(expr.get$arguments()); |
| 19053 var span = new SourceSpan(expr.get$span().file, expr.get$span().start, body.
get$span().end); | 18574 var span = new SourceSpan(expr.get$span().file, expr.get$span().start, body.
get$span().end); |
| 19054 var func = new FunctionDefinition(null, type, name, formals, null, body, (sp
an && span.is$SourceSpan())); | 18575 var func = new FunctionDefinition(null, type, name, formals, null, body, spa
n); |
| 19055 return new LambdaExpression(func, func.get$span()); | 18576 return new LambdaExpression(func, func.get$span()); |
| 19056 } | 18577 } |
| 19057 else { | 18578 else { |
| 19058 this._lang_error('expected function'); | 18579 this._lang_error('expected function'); |
| 19059 } | 18580 } |
| 19060 } | 18581 } |
| 19061 lang_Parser.prototype._makeFormal = function(expr) { | 18582 lang_Parser.prototype._makeFormal = function(expr) { |
| 19062 var $0; | |
| 19063 if ((expr instanceof VarExpression)) { | 18583 if ((expr instanceof VarExpression)) { |
| 19064 return new FormalNode(false, false, null, expr.get$name(), null, expr.get$sp
an()); | 18584 return new FormalNode(false, false, null, expr.get$name(), null, expr.get$sp
an()); |
| 19065 } | 18585 } |
| 19066 else if ((expr instanceof DeclaredIdentifier)) { | 18586 else if ((expr instanceof DeclaredIdentifier)) { |
| 19067 return new FormalNode(false, false, expr.type, expr.get$name(), null, expr.g
et$span()); | 18587 return new FormalNode(false, false, expr.type, expr.get$name(), null, expr.g
et$span()); |
| 19068 } | 18588 } |
| 19069 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/)) && ((expr.x
instanceof DeclaredIdentifier))) { | 18589 else if (this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x instanceof Decl
aredIdentifier))) { |
| 19070 var di = (($0 = expr.x) && $0.is$DeclaredIdentifier()); | 18590 var di = expr.x; |
| 19071 return new FormalNode(false, false, di.type, di.name, expr.y, expr.get$span(
)); | 18591 return new FormalNode(false, false, di.type, di.name, expr.y, expr.get$span(
)); |
| 19072 } | 18592 } |
| 19073 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/))) { | 18593 else if (this._isBin(expr, 52/*TokenKind.LT*/)) { |
| 19074 return null; | 18594 return null; |
| 19075 } | 18595 } |
| 19076 else if ((expr instanceof ListExpression)) { | 18596 else if ((expr instanceof ListExpression)) { |
| 19077 return this._makeFormalsFromList(expr); | 18597 return this._makeFormalsFromList(expr); |
| 19078 } | 18598 } |
| 19079 else { | 18599 else { |
| 19080 this._lang_error('expected formal', expr.get$span()); | 18600 this._lang_error('expected formal', expr.get$span()); |
| 19081 } | 18601 } |
| 19082 } | 18602 } |
| 19083 lang_Parser.prototype._makeFormalsFromList = function(expr) { | 18603 lang_Parser.prototype._makeFormalsFromList = function(expr) { |
| 19084 if ($notnull_bool(expr.get$isConst())) { | 18604 if (expr.get$isConst()) { |
| 19085 this._lang_error('expected formal, but found "const"', expr.get$span()); | 18605 this._lang_error('expected formal, but found "const"', expr.get$span()); |
| 19086 } | 18606 } |
| 19087 else if ($notnull_bool($ne(expr.type, null))) { | 18607 else if ($ne(expr.type, null)) { |
| 19088 this._lang_error('expected formal, but found generic type arguments', expr.t
ype.get$span()); | 18608 this._lang_error('expected formal, but found generic type arguments', expr.t
ype.get$span()); |
| 19089 } | 18609 } |
| 19090 return this._makeFormalsFromExpressions(expr.values, false); | 18610 return this._makeFormalsFromExpressions(expr.values, false); |
| 19091 } | 18611 } |
| 19092 lang_Parser.prototype._makeFormals = function(arguments) { | 18612 lang_Parser.prototype._makeFormals = function(arguments) { |
| 19093 var expressions = []; | 18613 var expressions = []; |
| 19094 for (var i = 0; | 18614 for (var i = 0; |
| 19095 i < arguments.length; i++) { | 18615 i < arguments.length; i++) { |
| 19096 var arg = arguments.$index(i); | 18616 var arg = arguments.$index(i); |
| 19097 if (arg.label != null) { | 18617 if (arg.label != null) { |
| 19098 this._lang_error('expected formal, but found ":"'); | 18618 this._lang_error('expected formal, but found ":"'); |
| 19099 } | 18619 } |
| 19100 expressions.add$1(arg.get$value()); | 18620 expressions.add$1(arg.get$value()); |
| 19101 } | 18621 } |
| 19102 return this._makeFormalsFromExpressions(expressions, true); | 18622 return this._makeFormalsFromExpressions(expressions, true); |
| 19103 } | 18623 } |
| 19104 lang_Parser.prototype._makeFormalsFromExpressions = function(expressions, allowO
ptional) { | 18624 lang_Parser.prototype._makeFormalsFromExpressions = function(expressions, allowO
ptional) { |
| 19105 var $0; | |
| 19106 var formals = []; | 18625 var formals = []; |
| 19107 for (var i = 0; | 18626 for (var i = 0; |
| 19108 i < expressions.length; i++) { | 18627 i < expressions.length; i++) { |
| 19109 var formal = this._makeFormal(expressions.$index(i)); | 18628 var formal = this._makeFormal(expressions.$index(i)); |
| 19110 if ($notnull_bool(formal == null)) { | 18629 if (formal == null) { |
| 19111 var baseType = this._makeType(expressions.$index(i).x); | 18630 var baseType = this._makeType(expressions.$index(i).x); |
| 19112 var typeParams = [this._makeType(expressions.$index(i).y)]; | 18631 var typeParams = [this._makeType(expressions.$index(i).y)]; |
| 19113 i++; | 18632 i++; |
| 19114 while (i < expressions.length) { | 18633 while (i < expressions.length) { |
| 19115 var expr = expressions.$index(i++); | 18634 var expr = expressions.$index(i++); |
| 19116 if ($notnull_bool(this._isBin(expr, 53/*TokenKind.GT*/))) { | 18635 if (this._isBin(expr, 53/*TokenKind.GT*/)) { |
| 19117 typeParams.add$1(this._makeType(expr.x)); | 18636 typeParams.add$1(this._makeType(expr.x)); |
| 19118 var type = new GenericTypeReference(baseType, typeParams, 0, this._mak
eSpan(baseType.get$span().start)); | 18637 var type = new GenericTypeReference(baseType, typeParams, 0, this._mak
eSpan(baseType.get$span().start)); |
| 19119 var name = null; | 18638 var name = null; |
| 19120 if ((expr.y instanceof VarExpression)) { | 18639 if ((expr.y instanceof VarExpression)) { |
| 19121 var ve = (($0 = expr.y) && $0.is$VarExpression()); | 18640 var ve = expr.y; |
| 19122 name = ve.name; | 18641 name = ve.name; |
| 19123 } | 18642 } |
| 19124 else { | 18643 else { |
| 19125 this._lang_error('expected formal', expr.get$span()); | 18644 this._lang_error('expected formal', expr.get$span()); |
| 19126 } | 18645 } |
| 19127 formal = new FormalNode(false, false, type, name, null, this._makeSpan
(expressions.$index(0).get$span().start)); | 18646 formal = new FormalNode(false, false, type, name, null, this._makeSpan
(expressions.$index(0).get$span().start)); |
| 19128 break; | 18647 break; |
| 19129 } | 18648 } |
| 19130 else { | 18649 else { |
| 19131 typeParams.add$1(this._makeType(expr)); | 18650 typeParams.add$1(this._makeType(expr)); |
| 19132 } | 18651 } |
| 19133 } | 18652 } |
| 19134 formals.add$1(formal); | 18653 formals.add$1(formal); |
| 19135 } | 18654 } |
| 19136 else if (!!(formal && formal.is$List)) { | 18655 else if (!!(formal && formal.is$List)) { |
| 19137 formals.addAll$1(formal); | 18656 formals.addAll$1(formal); |
| 19138 if (!$notnull_bool(allowOptional)) { | 18657 if (!allowOptional) { |
| 19139 this._lang_error('unexpected nested optional formal', expressions.$index
(i).get$span()); | 18658 this._lang_error('unexpected nested optional formal', expressions.$index
(i).get$span()); |
| 19140 } | 18659 } |
| 19141 } | 18660 } |
| 19142 else { | 18661 else { |
| 19143 formals.add$1(formal); | 18662 formals.add$1(formal); |
| 19144 } | 18663 } |
| 19145 } | 18664 } |
| 19146 return formals; | 18665 return formals; |
| 19147 } | 18666 } |
| 19148 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { | 18667 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 19169 lang_Parser.prototype.block$0 = function() { | 18688 lang_Parser.prototype.block$0 = function() { |
| 19170 return this.block(); | 18689 return this.block(); |
| 19171 }; | 18690 }; |
| 19172 // ********** Code for IncompleteSourceException ************** | 18691 // ********** Code for IncompleteSourceException ************** |
| 19173 function IncompleteSourceException(token) { | 18692 function IncompleteSourceException(token) { |
| 19174 this.token = token; | 18693 this.token = token; |
| 19175 // Initializers done | 18694 // Initializers done |
| 19176 } | 18695 } |
| 19177 IncompleteSourceException.prototype.toString = function() { | 18696 IncompleteSourceException.prototype.toString = function() { |
| 19178 if (this.token.get$span() == null) return ('Unexpected ' + this.token + ''); | 18697 if (this.token.get$span() == null) return ('Unexpected ' + this.token + ''); |
| 19179 return $assert_String(this.token.get$span().toMessageString(('Unexpected ' + t
his.token + ''))); | 18698 return this.token.get$span().toMessageString(('Unexpected ' + this.token + '')
); |
| 19180 } | 18699 } |
| 19181 IncompleteSourceException.prototype.toString$0 = function() { | 18700 IncompleteSourceException.prototype.toString$0 = function() { |
| 19182 return this.toString(); | 18701 return this.toString(); |
| 19183 }; | 18702 }; |
| 19184 // ********** Code for lang_Node ************** | 18703 // ********** Code for lang_Node ************** |
| 19185 function lang_Node(span) { | 18704 function lang_Node(span) { |
| 19186 this.span = span; | 18705 this.span = span; |
| 19187 // Initializers done | 18706 // Initializers done |
| 19188 } | 18707 } |
| 19189 lang_Node.prototype.is$lang_Node = function(){return this;}; | |
| 19190 lang_Node.prototype.get$span = function() { return this.span; }; | 18708 lang_Node.prototype.get$span = function() { return this.span; }; |
| 19191 lang_Node.prototype.set$span = function(value) { return this.span = value; }; | 18709 lang_Node.prototype.set$span = function(value) { return this.span = value; }; |
| 19192 lang_Node.prototype.visit$1 = function($0) { | 18710 lang_Node.prototype.visit$1 = function($0) { |
| 19193 return this.visit(($0 && $0.is$TreeVisitor())); | 18711 return this.visit($0); |
| 19194 }; | 18712 }; |
| 19195 // ********** Code for Definition ************** | 18713 // ********** Code for Definition ************** |
| 19196 function Definition(span) { | 18714 function Definition(span) { |
| 19197 lang_Statement.call(this, span); | 18715 lang_Statement.call(this, span); |
| 19198 // Initializers done | 18716 // Initializers done |
| 19199 } | 18717 } |
| 19200 $inherits(Definition, lang_Statement); | 18718 $inherits(Definition, lang_Statement); |
| 19201 Definition.prototype.is$Definition = function(){return this;}; | |
| 19202 Definition.prototype.get$typeParameters = function() { | 18719 Definition.prototype.get$typeParameters = function() { |
| 19203 return null; | 18720 return null; |
| 19204 } | 18721 } |
| 19205 Definition.prototype.get$nativeType = function() { | 18722 Definition.prototype.get$nativeType = function() { |
| 19206 return null; | 18723 return null; |
| 19207 } | 18724 } |
| 19208 // ********** Code for lang_Statement ************** | 18725 // ********** Code for lang_Statement ************** |
| 19209 function lang_Statement(span) { | 18726 function lang_Statement(span) { |
| 19210 lang_Node.call(this, span); | 18727 lang_Node.call(this, span); |
| 19211 // Initializers done | 18728 // Initializers done |
| 19212 } | 18729 } |
| 19213 $inherits(lang_Statement, lang_Node); | 18730 $inherits(lang_Statement, lang_Node); |
| 19214 lang_Statement.prototype.is$lang_Statement = function(){return this;}; | |
| 19215 // ********** Code for lang_Expression ************** | 18731 // ********** Code for lang_Expression ************** |
| 19216 function lang_Expression(span) { | 18732 function lang_Expression(span) { |
| 19217 lang_Node.call(this, span); | 18733 lang_Node.call(this, span); |
| 19218 // Initializers done | 18734 // Initializers done |
| 19219 } | 18735 } |
| 19220 $inherits(lang_Expression, lang_Node); | 18736 $inherits(lang_Expression, lang_Node); |
| 19221 lang_Expression.prototype.is$lang_Expression = function(){return this;}; | |
| 19222 // ********** Code for TypeReference ************** | 18737 // ********** Code for TypeReference ************** |
| 19223 function TypeReference(span, type) { | 18738 function TypeReference(span, type) { |
| 19224 this.type = type; | 18739 this.type = type; |
| 19225 lang_Node.call(this, span); | 18740 lang_Node.call(this, span); |
| 19226 // Initializers done | 18741 // Initializers done |
| 19227 } | 18742 } |
| 19228 $inherits(TypeReference, lang_Node); | 18743 $inherits(TypeReference, lang_Node); |
| 19229 TypeReference.prototype.is$TypeReference = function(){return this;}; | |
| 19230 TypeReference.prototype.get$type = function() { return this.type; }; | |
| 19231 TypeReference.prototype.set$type = function(value) { return this.type = value; }
; | |
| 19232 TypeReference.prototype.visit = function(visitor) { | 18744 TypeReference.prototype.visit = function(visitor) { |
| 19233 return visitor.visitTypeReference(this); | 18745 return visitor.visitTypeReference(this); |
| 19234 } | 18746 } |
| 19235 TypeReference.prototype.visit$1 = function($0) { | 18747 TypeReference.prototype.visit$1 = function($0) { |
| 19236 return this.visit(($0 && $0.is$TreeVisitor())); | 18748 return this.visit($0); |
| 19237 }; | 18749 }; |
| 19238 // ********** Code for DirectiveDefinition ************** | 18750 // ********** Code for DirectiveDefinition ************** |
| 19239 function DirectiveDefinition(name, arguments, span) { | 18751 function DirectiveDefinition(name, arguments, span) { |
| 19240 this.name = name; | 18752 this.name = name; |
| 19241 this.arguments = arguments; | 18753 this.arguments = arguments; |
| 19242 Definition.call(this, span); | 18754 Definition.call(this, span); |
| 19243 // Initializers done | 18755 // Initializers done |
| 19244 } | 18756 } |
| 19245 $inherits(DirectiveDefinition, Definition); | 18757 $inherits(DirectiveDefinition, Definition); |
| 19246 DirectiveDefinition.prototype.get$name = function() { return this.name; }; | 18758 DirectiveDefinition.prototype.get$name = function() { return this.name; }; |
| 19247 DirectiveDefinition.prototype.set$name = function(value) { return this.name = va
lue; }; | 18759 DirectiveDefinition.prototype.set$name = function(value) { return this.name = va
lue; }; |
| 19248 DirectiveDefinition.prototype.get$arguments = function() { return this.arguments
; }; | 18760 DirectiveDefinition.prototype.get$arguments = function() { return this.arguments
; }; |
| 19249 DirectiveDefinition.prototype.set$arguments = function(value) { return this.argu
ments = value; }; | 18761 DirectiveDefinition.prototype.set$arguments = function(value) { return this.argu
ments = value; }; |
| 19250 DirectiveDefinition.prototype.visit = function(visitor) { | 18762 DirectiveDefinition.prototype.visit = function(visitor) { |
| 19251 return visitor.visitDirectiveDefinition(this); | 18763 return visitor.visitDirectiveDefinition(this); |
| 19252 } | 18764 } |
| 19253 DirectiveDefinition.prototype.visit$1 = function($0) { | 18765 DirectiveDefinition.prototype.visit$1 = function($0) { |
| 19254 return this.visit(($0 && $0.is$TreeVisitor())); | 18766 return this.visit($0); |
| 19255 }; | 18767 }; |
| 19256 // ********** Code for TypeDefinition ************** | 18768 // ********** Code for TypeDefinition ************** |
| 19257 function TypeDefinition(isClass, name, typeParameters, extendsTypes, implementsT
ypes, nativeType, factoryType, body, span) { | 18769 function TypeDefinition(isClass, name, typeParameters, extendsTypes, implementsT
ypes, nativeType, factoryType, body, span) { |
| 19258 this.isClass = isClass; | 18770 this.isClass = isClass; |
| 19259 this.name = name; | 18771 this.name = name; |
| 19260 this.typeParameters = typeParameters; | 18772 this.typeParameters = typeParameters; |
| 19261 this.extendsTypes = extendsTypes; | 18773 this.extendsTypes = extendsTypes; |
| 19262 this.implementsTypes = implementsTypes; | 18774 this.implementsTypes = implementsTypes; |
| 19263 this.nativeType = nativeType; | 18775 this.nativeType = nativeType; |
| 19264 this.factoryType = factoryType; | 18776 this.factoryType = factoryType; |
| 19265 this.body = body; | 18777 this.body = body; |
| 19266 Definition.call(this, span); | 18778 Definition.call(this, span); |
| 19267 // Initializers done | 18779 // Initializers done |
| 19268 } | 18780 } |
| 19269 $inherits(TypeDefinition, Definition); | 18781 $inherits(TypeDefinition, Definition); |
| 19270 TypeDefinition.prototype.is$TypeDefinition = function(){return this;}; | |
| 19271 TypeDefinition.prototype.get$isClass = function() { return this.isClass; }; | 18782 TypeDefinition.prototype.get$isClass = function() { return this.isClass; }; |
| 19272 TypeDefinition.prototype.set$isClass = function(value) { return this.isClass = v
alue; }; | 18783 TypeDefinition.prototype.set$isClass = function(value) { return this.isClass = v
alue; }; |
| 19273 TypeDefinition.prototype.get$name = function() { return this.name; }; | 18784 TypeDefinition.prototype.get$name = function() { return this.name; }; |
| 19274 TypeDefinition.prototype.set$name = function(value) { return this.name = value;
}; | 18785 TypeDefinition.prototype.set$name = function(value) { return this.name = value;
}; |
| 19275 TypeDefinition.prototype.get$typeParameters = function() { return this.typeParam
eters; }; | 18786 TypeDefinition.prototype.get$typeParameters = function() { return this.typeParam
eters; }; |
| 19276 TypeDefinition.prototype.set$typeParameters = function(value) { return this.type
Parameters = value; }; | 18787 TypeDefinition.prototype.set$typeParameters = function(value) { return this.type
Parameters = value; }; |
| 19277 TypeDefinition.prototype.get$nativeType = function() { return this.nativeType; }
; | 18788 TypeDefinition.prototype.get$nativeType = function() { return this.nativeType; }
; |
| 19278 TypeDefinition.prototype.set$nativeType = function(value) { return this.nativeTy
pe = value; }; | 18789 TypeDefinition.prototype.set$nativeType = function(value) { return this.nativeTy
pe = value; }; |
| 19279 TypeDefinition.prototype.visit = function(visitor) { | 18790 TypeDefinition.prototype.visit = function(visitor) { |
| 19280 return visitor.visitTypeDefinition(this); | 18791 return visitor.visitTypeDefinition(this); |
| 19281 } | 18792 } |
| 19282 TypeDefinition.prototype.visit$1 = function($0) { | 18793 TypeDefinition.prototype.visit$1 = function($0) { |
| 19283 return this.visit(($0 && $0.is$TreeVisitor())); | 18794 return this.visit($0); |
| 19284 }; | 18795 }; |
| 19285 // ********** Code for FunctionTypeDefinition ************** | 18796 // ********** Code for FunctionTypeDefinition ************** |
| 19286 function FunctionTypeDefinition(func, typeParameters, span) { | 18797 function FunctionTypeDefinition(func, typeParameters, span) { |
| 19287 this.func = func; | 18798 this.func = func; |
| 19288 this.typeParameters = typeParameters; | 18799 this.typeParameters = typeParameters; |
| 19289 Definition.call(this, span); | 18800 Definition.call(this, span); |
| 19290 // Initializers done | 18801 // Initializers done |
| 19291 } | 18802 } |
| 19292 $inherits(FunctionTypeDefinition, Definition); | 18803 $inherits(FunctionTypeDefinition, Definition); |
| 19293 FunctionTypeDefinition.prototype.get$typeParameters = function() { return this.t
ypeParameters; }; | 18804 FunctionTypeDefinition.prototype.get$typeParameters = function() { return this.t
ypeParameters; }; |
| 19294 FunctionTypeDefinition.prototype.set$typeParameters = function(value) { return t
his.typeParameters = value; }; | 18805 FunctionTypeDefinition.prototype.set$typeParameters = function(value) { return t
his.typeParameters = value; }; |
| 19295 FunctionTypeDefinition.prototype.visit = function(visitor) { | 18806 FunctionTypeDefinition.prototype.visit = function(visitor) { |
| 19296 return visitor.visitFunctionTypeDefinition(this); | 18807 return visitor.visitFunctionTypeDefinition(this); |
| 19297 } | 18808 } |
| 19298 FunctionTypeDefinition.prototype.visit$1 = function($0) { | 18809 FunctionTypeDefinition.prototype.visit$1 = function($0) { |
| 19299 return this.visit(($0 && $0.is$TreeVisitor())); | 18810 return this.visit($0); |
| 19300 }; | 18811 }; |
| 19301 // ********** Code for VariableDefinition ************** | 18812 // ********** Code for VariableDefinition ************** |
| 19302 function VariableDefinition(modifiers, type, names, values, span) { | 18813 function VariableDefinition(modifiers, type, names, values, span) { |
| 19303 this.modifiers = modifiers; | 18814 this.modifiers = modifiers; |
| 19304 this.type = type; | 18815 this.type = type; |
| 19305 this.names = names; | 18816 this.names = names; |
| 19306 this.values = values; | 18817 this.values = values; |
| 19307 Definition.call(this, span); | 18818 Definition.call(this, span); |
| 19308 // Initializers done | 18819 // Initializers done |
| 19309 } | 18820 } |
| 19310 $inherits(VariableDefinition, Definition); | 18821 $inherits(VariableDefinition, Definition); |
| 19311 VariableDefinition.prototype.get$type = function() { return this.type; }; | |
| 19312 VariableDefinition.prototype.set$type = function(value) { return this.type = val
ue; }; | |
| 19313 VariableDefinition.prototype.visit = function(visitor) { | 18822 VariableDefinition.prototype.visit = function(visitor) { |
| 19314 return visitor.visitVariableDefinition(this); | 18823 return visitor.visitVariableDefinition(this); |
| 19315 } | 18824 } |
| 19316 VariableDefinition.prototype.visit$1 = function($0) { | 18825 VariableDefinition.prototype.visit$1 = function($0) { |
| 19317 return this.visit(($0 && $0.is$TreeVisitor())); | 18826 return this.visit($0); |
| 19318 }; | 18827 }; |
| 19319 // ********** Code for FunctionDefinition ************** | 18828 // ********** Code for FunctionDefinition ************** |
| 19320 function FunctionDefinition(modifiers, returnType, name, formals, initializers,
body, span) { | 18829 function FunctionDefinition(modifiers, returnType, name, formals, initializers,
body, span) { |
| 19321 this.modifiers = modifiers; | 18830 this.modifiers = modifiers; |
| 19322 this.returnType = returnType; | 18831 this.returnType = returnType; |
| 19323 this.name = name; | 18832 this.name = name; |
| 19324 this.formals = formals; | 18833 this.formals = formals; |
| 19325 this.initializers = initializers; | 18834 this.initializers = initializers; |
| 19326 this.body = body; | 18835 this.body = body; |
| 19327 Definition.call(this, span); | 18836 Definition.call(this, span); |
| 19328 // Initializers done | 18837 // Initializers done |
| 19329 } | 18838 } |
| 19330 $inherits(FunctionDefinition, Definition); | 18839 $inherits(FunctionDefinition, Definition); |
| 19331 FunctionDefinition.prototype.is$FunctionDefinition = function(){return this;}; | |
| 19332 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp
e; }; | 18840 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp
e; }; |
| 19333 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu
rnType = value; }; | 18841 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu
rnType = value; }; |
| 19334 FunctionDefinition.prototype.get$name = function() { return this.name; }; | 18842 FunctionDefinition.prototype.get$name = function() { return this.name; }; |
| 19335 FunctionDefinition.prototype.set$name = function(value) { return this.name = val
ue; }; | 18843 FunctionDefinition.prototype.set$name = function(value) { return this.name = val
ue; }; |
| 19336 FunctionDefinition.prototype.visit = function(visitor) { | 18844 FunctionDefinition.prototype.visit = function(visitor) { |
| 19337 return visitor.visitFunctionDefinition(this); | 18845 return visitor.visitFunctionDefinition(this); |
| 19338 } | 18846 } |
| 19339 FunctionDefinition.prototype.visit$1 = function($0) { | 18847 FunctionDefinition.prototype.visit$1 = function($0) { |
| 19340 return this.visit(($0 && $0.is$TreeVisitor())); | 18848 return this.visit($0); |
| 19341 }; | 18849 }; |
| 19342 // ********** Code for ReturnStatement ************** | 18850 // ********** Code for ReturnStatement ************** |
| 19343 function ReturnStatement(value, span) { | 18851 function ReturnStatement(value, span) { |
| 19344 this.value = value; | 18852 this.value = value; |
| 19345 lang_Statement.call(this, span); | 18853 lang_Statement.call(this, span); |
| 19346 // Initializers done | 18854 // Initializers done |
| 19347 } | 18855 } |
| 19348 $inherits(ReturnStatement, lang_Statement); | 18856 $inherits(ReturnStatement, lang_Statement); |
| 19349 ReturnStatement.prototype.get$value = function() { return this.value; }; | 18857 ReturnStatement.prototype.get$value = function() { return this.value; }; |
| 19350 ReturnStatement.prototype.set$value = function(value) { return this.value = valu
e; }; | 18858 ReturnStatement.prototype.set$value = function(value) { return this.value = valu
e; }; |
| 19351 ReturnStatement.prototype.visit = function(visitor) { | 18859 ReturnStatement.prototype.visit = function(visitor) { |
| 19352 return visitor.visitReturnStatement(this); | 18860 return visitor.visitReturnStatement(this); |
| 19353 } | 18861 } |
| 19354 ReturnStatement.prototype.visit$1 = function($0) { | 18862 ReturnStatement.prototype.visit$1 = function($0) { |
| 19355 return this.visit(($0 && $0.is$TreeVisitor())); | 18863 return this.visit($0); |
| 19356 }; | 18864 }; |
| 19357 // ********** Code for ThrowStatement ************** | 18865 // ********** Code for ThrowStatement ************** |
| 19358 function ThrowStatement(value, span) { | 18866 function ThrowStatement(value, span) { |
| 19359 this.value = value; | 18867 this.value = value; |
| 19360 lang_Statement.call(this, span); | 18868 lang_Statement.call(this, span); |
| 19361 // Initializers done | 18869 // Initializers done |
| 19362 } | 18870 } |
| 19363 $inherits(ThrowStatement, lang_Statement); | 18871 $inherits(ThrowStatement, lang_Statement); |
| 19364 ThrowStatement.prototype.get$value = function() { return this.value; }; | 18872 ThrowStatement.prototype.get$value = function() { return this.value; }; |
| 19365 ThrowStatement.prototype.set$value = function(value) { return this.value = value
; }; | 18873 ThrowStatement.prototype.set$value = function(value) { return this.value = value
; }; |
| 19366 ThrowStatement.prototype.visit = function(visitor) { | 18874 ThrowStatement.prototype.visit = function(visitor) { |
| 19367 return visitor.visitThrowStatement(this); | 18875 return visitor.visitThrowStatement(this); |
| 19368 } | 18876 } |
| 19369 ThrowStatement.prototype.visit$1 = function($0) { | 18877 ThrowStatement.prototype.visit$1 = function($0) { |
| 19370 return this.visit(($0 && $0.is$TreeVisitor())); | 18878 return this.visit($0); |
| 19371 }; | 18879 }; |
| 19372 // ********** Code for AssertStatement ************** | 18880 // ********** Code for AssertStatement ************** |
| 19373 function AssertStatement(test, span) { | 18881 function AssertStatement(test, span) { |
| 19374 this.test = test; | 18882 this.test = test; |
| 19375 lang_Statement.call(this, span); | 18883 lang_Statement.call(this, span); |
| 19376 // Initializers done | 18884 // Initializers done |
| 19377 } | 18885 } |
| 19378 $inherits(AssertStatement, lang_Statement); | 18886 $inherits(AssertStatement, lang_Statement); |
| 19379 AssertStatement.prototype.visit = function(visitor) { | 18887 AssertStatement.prototype.visit = function(visitor) { |
| 19380 return visitor.visitAssertStatement(this); | 18888 return visitor.visitAssertStatement(this); |
| 19381 } | 18889 } |
| 19382 AssertStatement.prototype.visit$1 = function($0) { | 18890 AssertStatement.prototype.visit$1 = function($0) { |
| 19383 return this.visit(($0 && $0.is$TreeVisitor())); | 18891 return this.visit($0); |
| 19384 }; | 18892 }; |
| 19385 // ********** Code for BreakStatement ************** | 18893 // ********** Code for BreakStatement ************** |
| 19386 function BreakStatement(label, span) { | 18894 function BreakStatement(label, span) { |
| 19387 this.label = label; | 18895 this.label = label; |
| 19388 lang_Statement.call(this, span); | 18896 lang_Statement.call(this, span); |
| 19389 // Initializers done | 18897 // Initializers done |
| 19390 } | 18898 } |
| 19391 $inherits(BreakStatement, lang_Statement); | 18899 $inherits(BreakStatement, lang_Statement); |
| 19392 BreakStatement.prototype.visit = function(visitor) { | 18900 BreakStatement.prototype.visit = function(visitor) { |
| 19393 return visitor.visitBreakStatement(this); | 18901 return visitor.visitBreakStatement(this); |
| 19394 } | 18902 } |
| 19395 BreakStatement.prototype.visit$1 = function($0) { | 18903 BreakStatement.prototype.visit$1 = function($0) { |
| 19396 return this.visit(($0 && $0.is$TreeVisitor())); | 18904 return this.visit($0); |
| 19397 }; | 18905 }; |
| 19398 // ********** Code for ContinueStatement ************** | 18906 // ********** Code for ContinueStatement ************** |
| 19399 function ContinueStatement(label, span) { | 18907 function ContinueStatement(label, span) { |
| 19400 this.label = label; | 18908 this.label = label; |
| 19401 lang_Statement.call(this, span); | 18909 lang_Statement.call(this, span); |
| 19402 // Initializers done | 18910 // Initializers done |
| 19403 } | 18911 } |
| 19404 $inherits(ContinueStatement, lang_Statement); | 18912 $inherits(ContinueStatement, lang_Statement); |
| 19405 ContinueStatement.prototype.visit = function(visitor) { | 18913 ContinueStatement.prototype.visit = function(visitor) { |
| 19406 return visitor.visitContinueStatement(this); | 18914 return visitor.visitContinueStatement(this); |
| 19407 } | 18915 } |
| 19408 ContinueStatement.prototype.visit$1 = function($0) { | 18916 ContinueStatement.prototype.visit$1 = function($0) { |
| 19409 return this.visit(($0 && $0.is$TreeVisitor())); | 18917 return this.visit($0); |
| 19410 }; | 18918 }; |
| 19411 // ********** Code for IfStatement ************** | 18919 // ********** Code for IfStatement ************** |
| 19412 function IfStatement(test, trueBranch, falseBranch, span) { | 18920 function IfStatement(test, trueBranch, falseBranch, span) { |
| 19413 this.test = test; | 18921 this.test = test; |
| 19414 this.trueBranch = trueBranch; | 18922 this.trueBranch = trueBranch; |
| 19415 this.falseBranch = falseBranch; | 18923 this.falseBranch = falseBranch; |
| 19416 lang_Statement.call(this, span); | 18924 lang_Statement.call(this, span); |
| 19417 // Initializers done | 18925 // Initializers done |
| 19418 } | 18926 } |
| 19419 $inherits(IfStatement, lang_Statement); | 18927 $inherits(IfStatement, lang_Statement); |
| 19420 IfStatement.prototype.visit = function(visitor) { | 18928 IfStatement.prototype.visit = function(visitor) { |
| 19421 return visitor.visitIfStatement(this); | 18929 return visitor.visitIfStatement(this); |
| 19422 } | 18930 } |
| 19423 IfStatement.prototype.visit$1 = function($0) { | 18931 IfStatement.prototype.visit$1 = function($0) { |
| 19424 return this.visit(($0 && $0.is$TreeVisitor())); | 18932 return this.visit($0); |
| 19425 }; | 18933 }; |
| 19426 // ********** Code for WhileStatement ************** | 18934 // ********** Code for WhileStatement ************** |
| 19427 function WhileStatement(test, body, span) { | 18935 function WhileStatement(test, body, span) { |
| 19428 this.test = test; | 18936 this.test = test; |
| 19429 this.body = body; | 18937 this.body = body; |
| 19430 lang_Statement.call(this, span); | 18938 lang_Statement.call(this, span); |
| 19431 // Initializers done | 18939 // Initializers done |
| 19432 } | 18940 } |
| 19433 $inherits(WhileStatement, lang_Statement); | 18941 $inherits(WhileStatement, lang_Statement); |
| 19434 WhileStatement.prototype.visit = function(visitor) { | 18942 WhileStatement.prototype.visit = function(visitor) { |
| 19435 return visitor.visitWhileStatement(this); | 18943 return visitor.visitWhileStatement(this); |
| 19436 } | 18944 } |
| 19437 WhileStatement.prototype.visit$1 = function($0) { | 18945 WhileStatement.prototype.visit$1 = function($0) { |
| 19438 return this.visit(($0 && $0.is$TreeVisitor())); | 18946 return this.visit($0); |
| 19439 }; | 18947 }; |
| 19440 // ********** Code for DoStatement ************** | 18948 // ********** Code for DoStatement ************** |
| 19441 function DoStatement(body, test, span) { | 18949 function DoStatement(body, test, span) { |
| 19442 this.body = body; | 18950 this.body = body; |
| 19443 this.test = test; | 18951 this.test = test; |
| 19444 lang_Statement.call(this, span); | 18952 lang_Statement.call(this, span); |
| 19445 // Initializers done | 18953 // Initializers done |
| 19446 } | 18954 } |
| 19447 $inherits(DoStatement, lang_Statement); | 18955 $inherits(DoStatement, lang_Statement); |
| 19448 DoStatement.prototype.visit = function(visitor) { | 18956 DoStatement.prototype.visit = function(visitor) { |
| 19449 return visitor.visitDoStatement(this); | 18957 return visitor.visitDoStatement(this); |
| 19450 } | 18958 } |
| 19451 DoStatement.prototype.visit$1 = function($0) { | 18959 DoStatement.prototype.visit$1 = function($0) { |
| 19452 return this.visit(($0 && $0.is$TreeVisitor())); | 18960 return this.visit($0); |
| 19453 }; | 18961 }; |
| 19454 // ********** Code for ForStatement ************** | 18962 // ********** Code for ForStatement ************** |
| 19455 function ForStatement(init, test, step, body, span) { | 18963 function ForStatement(init, test, step, body, span) { |
| 19456 this.init = init; | 18964 this.init = init; |
| 19457 this.test = test; | 18965 this.test = test; |
| 19458 this.step = step; | 18966 this.step = step; |
| 19459 this.body = body; | 18967 this.body = body; |
| 19460 lang_Statement.call(this, span); | 18968 lang_Statement.call(this, span); |
| 19461 // Initializers done | 18969 // Initializers done |
| 19462 } | 18970 } |
| 19463 $inherits(ForStatement, lang_Statement); | 18971 $inherits(ForStatement, lang_Statement); |
| 19464 ForStatement.prototype.visit = function(visitor) { | 18972 ForStatement.prototype.visit = function(visitor) { |
| 19465 return visitor.visitForStatement(this); | 18973 return visitor.visitForStatement(this); |
| 19466 } | 18974 } |
| 19467 ForStatement.prototype.visit$1 = function($0) { | 18975 ForStatement.prototype.visit$1 = function($0) { |
| 19468 return this.visit(($0 && $0.is$TreeVisitor())); | 18976 return this.visit($0); |
| 19469 }; | 18977 }; |
| 19470 // ********** Code for ForInStatement ************** | 18978 // ********** Code for ForInStatement ************** |
| 19471 function ForInStatement(item, list, body, span) { | 18979 function ForInStatement(item, list, body, span) { |
| 19472 this.item = item; | 18980 this.item = item; |
| 19473 this.list = list; | 18981 this.list = list; |
| 19474 this.body = body; | 18982 this.body = body; |
| 19475 lang_Statement.call(this, span); | 18983 lang_Statement.call(this, span); |
| 19476 // Initializers done | 18984 // Initializers done |
| 19477 } | 18985 } |
| 19478 $inherits(ForInStatement, lang_Statement); | 18986 $inherits(ForInStatement, lang_Statement); |
| 19479 ForInStatement.prototype.visit = function(visitor) { | 18987 ForInStatement.prototype.visit = function(visitor) { |
| 19480 return visitor.visitForInStatement(this); | 18988 return visitor.visitForInStatement(this); |
| 19481 } | 18989 } |
| 19482 ForInStatement.prototype.visit$1 = function($0) { | 18990 ForInStatement.prototype.visit$1 = function($0) { |
| 19483 return this.visit(($0 && $0.is$TreeVisitor())); | 18991 return this.visit($0); |
| 19484 }; | 18992 }; |
| 19485 // ********** Code for TryStatement ************** | 18993 // ********** Code for TryStatement ************** |
| 19486 function TryStatement(body, catches, finallyBlock, span) { | 18994 function TryStatement(body, catches, finallyBlock, span) { |
| 19487 this.body = body; | 18995 this.body = body; |
| 19488 this.catches = catches; | 18996 this.catches = catches; |
| 19489 this.finallyBlock = finallyBlock; | 18997 this.finallyBlock = finallyBlock; |
| 19490 lang_Statement.call(this, span); | 18998 lang_Statement.call(this, span); |
| 19491 // Initializers done | 18999 // Initializers done |
| 19492 } | 19000 } |
| 19493 $inherits(TryStatement, lang_Statement); | 19001 $inherits(TryStatement, lang_Statement); |
| 19494 TryStatement.prototype.visit = function(visitor) { | 19002 TryStatement.prototype.visit = function(visitor) { |
| 19495 return visitor.visitTryStatement(this); | 19003 return visitor.visitTryStatement(this); |
| 19496 } | 19004 } |
| 19497 TryStatement.prototype.visit$1 = function($0) { | 19005 TryStatement.prototype.visit$1 = function($0) { |
| 19498 return this.visit(($0 && $0.is$TreeVisitor())); | 19006 return this.visit($0); |
| 19499 }; | 19007 }; |
| 19500 // ********** Code for SwitchStatement ************** | 19008 // ********** Code for SwitchStatement ************** |
| 19501 function SwitchStatement(test, cases, span) { | 19009 function SwitchStatement(test, cases, span) { |
| 19502 this.test = test; | 19010 this.test = test; |
| 19503 this.cases = cases; | 19011 this.cases = cases; |
| 19504 lang_Statement.call(this, span); | 19012 lang_Statement.call(this, span); |
| 19505 // Initializers done | 19013 // Initializers done |
| 19506 } | 19014 } |
| 19507 $inherits(SwitchStatement, lang_Statement); | 19015 $inherits(SwitchStatement, lang_Statement); |
| 19508 SwitchStatement.prototype.visit = function(visitor) { | 19016 SwitchStatement.prototype.visit = function(visitor) { |
| 19509 return visitor.visitSwitchStatement(this); | 19017 return visitor.visitSwitchStatement(this); |
| 19510 } | 19018 } |
| 19511 SwitchStatement.prototype.visit$1 = function($0) { | 19019 SwitchStatement.prototype.visit$1 = function($0) { |
| 19512 return this.visit(($0 && $0.is$TreeVisitor())); | 19020 return this.visit($0); |
| 19513 }; | 19021 }; |
| 19514 // ********** Code for BlockStatement ************** | 19022 // ********** Code for BlockStatement ************** |
| 19515 function BlockStatement(body, span) { | 19023 function BlockStatement(body, span) { |
| 19516 this.body = body; | 19024 this.body = body; |
| 19517 lang_Statement.call(this, span); | 19025 lang_Statement.call(this, span); |
| 19518 // Initializers done | 19026 // Initializers done |
| 19519 } | 19027 } |
| 19520 $inherits(BlockStatement, lang_Statement); | 19028 $inherits(BlockStatement, lang_Statement); |
| 19521 BlockStatement.prototype.is$BlockStatement = function(){return this;}; | |
| 19522 BlockStatement.prototype.visit = function(visitor) { | 19029 BlockStatement.prototype.visit = function(visitor) { |
| 19523 return visitor.visitBlockStatement(this); | 19030 return visitor.visitBlockStatement(this); |
| 19524 } | 19031 } |
| 19525 BlockStatement.prototype.visit$1 = function($0) { | 19032 BlockStatement.prototype.visit$1 = function($0) { |
| 19526 return this.visit(($0 && $0.is$TreeVisitor())); | 19033 return this.visit($0); |
| 19527 }; | 19034 }; |
| 19528 // ********** Code for LabeledStatement ************** | 19035 // ********** Code for LabeledStatement ************** |
| 19529 function LabeledStatement(name, body, span) { | 19036 function LabeledStatement(name, body, span) { |
| 19530 this.name = name; | 19037 this.name = name; |
| 19531 this.body = body; | 19038 this.body = body; |
| 19532 lang_Statement.call(this, span); | 19039 lang_Statement.call(this, span); |
| 19533 // Initializers done | 19040 // Initializers done |
| 19534 } | 19041 } |
| 19535 $inherits(LabeledStatement, lang_Statement); | 19042 $inherits(LabeledStatement, lang_Statement); |
| 19536 LabeledStatement.prototype.get$name = function() { return this.name; }; | 19043 LabeledStatement.prototype.get$name = function() { return this.name; }; |
| 19537 LabeledStatement.prototype.set$name = function(value) { return this.name = value
; }; | 19044 LabeledStatement.prototype.set$name = function(value) { return this.name = value
; }; |
| 19538 LabeledStatement.prototype.visit = function(visitor) { | 19045 LabeledStatement.prototype.visit = function(visitor) { |
| 19539 return visitor.visitLabeledStatement(this); | 19046 return visitor.visitLabeledStatement(this); |
| 19540 } | 19047 } |
| 19541 LabeledStatement.prototype.visit$1 = function($0) { | 19048 LabeledStatement.prototype.visit$1 = function($0) { |
| 19542 return this.visit(($0 && $0.is$TreeVisitor())); | 19049 return this.visit($0); |
| 19543 }; | 19050 }; |
| 19544 // ********** Code for lang_ExpressionStatement ************** | 19051 // ********** Code for lang_ExpressionStatement ************** |
| 19545 function lang_ExpressionStatement(body, span) { | 19052 function lang_ExpressionStatement(body, span) { |
| 19546 this.body = body; | 19053 this.body = body; |
| 19547 lang_Statement.call(this, span); | 19054 lang_Statement.call(this, span); |
| 19548 // Initializers done | 19055 // Initializers done |
| 19549 } | 19056 } |
| 19550 $inherits(lang_ExpressionStatement, lang_Statement); | 19057 $inherits(lang_ExpressionStatement, lang_Statement); |
| 19551 lang_ExpressionStatement.prototype.visit = function(visitor) { | 19058 lang_ExpressionStatement.prototype.visit = function(visitor) { |
| 19552 return visitor.visitExpressionStatement(this); | 19059 return visitor.visitExpressionStatement(this); |
| 19553 } | 19060 } |
| 19554 lang_ExpressionStatement.prototype.visit$1 = function($0) { | 19061 lang_ExpressionStatement.prototype.visit$1 = function($0) { |
| 19555 return this.visit(($0 && $0.is$TreeVisitor())); | 19062 return this.visit($0); |
| 19556 }; | 19063 }; |
| 19557 // ********** Code for EmptyStatement ************** | 19064 // ********** Code for EmptyStatement ************** |
| 19558 function EmptyStatement(span) { | 19065 function EmptyStatement(span) { |
| 19559 lang_Statement.call(this, span); | 19066 lang_Statement.call(this, span); |
| 19560 // Initializers done | 19067 // Initializers done |
| 19561 } | 19068 } |
| 19562 $inherits(EmptyStatement, lang_Statement); | 19069 $inherits(EmptyStatement, lang_Statement); |
| 19563 EmptyStatement.prototype.visit = function(visitor) { | 19070 EmptyStatement.prototype.visit = function(visitor) { |
| 19564 return visitor.visitEmptyStatement(this); | 19071 return visitor.visitEmptyStatement(this); |
| 19565 } | 19072 } |
| 19566 EmptyStatement.prototype.visit$1 = function($0) { | 19073 EmptyStatement.prototype.visit$1 = function($0) { |
| 19567 return this.visit(($0 && $0.is$TreeVisitor())); | 19074 return this.visit($0); |
| 19568 }; | 19075 }; |
| 19569 // ********** Code for DietStatement ************** | 19076 // ********** Code for DietStatement ************** |
| 19570 function DietStatement(span) { | 19077 function DietStatement(span) { |
| 19571 lang_Statement.call(this, span); | 19078 lang_Statement.call(this, span); |
| 19572 // Initializers done | 19079 // Initializers done |
| 19573 } | 19080 } |
| 19574 $inherits(DietStatement, lang_Statement); | 19081 $inherits(DietStatement, lang_Statement); |
| 19575 DietStatement.prototype.visit = function(visitor) { | 19082 DietStatement.prototype.visit = function(visitor) { |
| 19576 return visitor.visitDietStatement(this); | 19083 return visitor.visitDietStatement(this); |
| 19577 } | 19084 } |
| 19578 DietStatement.prototype.visit$1 = function($0) { | 19085 DietStatement.prototype.visit$1 = function($0) { |
| 19579 return this.visit(($0 && $0.is$TreeVisitor())); | 19086 return this.visit($0); |
| 19580 }; | 19087 }; |
| 19581 // ********** Code for NativeStatement ************** | 19088 // ********** Code for NativeStatement ************** |
| 19582 function NativeStatement(body, span) { | 19089 function NativeStatement(body, span) { |
| 19583 this.body = body; | 19090 this.body = body; |
| 19584 lang_Statement.call(this, span); | 19091 lang_Statement.call(this, span); |
| 19585 // Initializers done | 19092 // Initializers done |
| 19586 } | 19093 } |
| 19587 $inherits(NativeStatement, lang_Statement); | 19094 $inherits(NativeStatement, lang_Statement); |
| 19588 NativeStatement.prototype.visit = function(visitor) { | 19095 NativeStatement.prototype.visit = function(visitor) { |
| 19589 return visitor.visitNativeStatement(this); | 19096 return visitor.visitNativeStatement(this); |
| 19590 } | 19097 } |
| 19591 NativeStatement.prototype.visit$1 = function($0) { | 19098 NativeStatement.prototype.visit$1 = function($0) { |
| 19592 return this.visit(($0 && $0.is$TreeVisitor())); | 19099 return this.visit($0); |
| 19593 }; | 19100 }; |
| 19594 // ********** Code for LambdaExpression ************** | 19101 // ********** Code for LambdaExpression ************** |
| 19595 function LambdaExpression(func, span) { | 19102 function LambdaExpression(func, span) { |
| 19596 this.func = func; | 19103 this.func = func; |
| 19597 lang_Expression.call(this, span); | 19104 lang_Expression.call(this, span); |
| 19598 // Initializers done | 19105 // Initializers done |
| 19599 } | 19106 } |
| 19600 $inherits(LambdaExpression, lang_Expression); | 19107 $inherits(LambdaExpression, lang_Expression); |
| 19601 LambdaExpression.prototype.is$LambdaExpression = function(){return this;}; | |
| 19602 LambdaExpression.prototype.visit = function(visitor) { | 19108 LambdaExpression.prototype.visit = function(visitor) { |
| 19603 return visitor.visitLambdaExpression(this); | 19109 return visitor.visitLambdaExpression(this); |
| 19604 } | 19110 } |
| 19605 LambdaExpression.prototype.visit$1 = function($0) { | 19111 LambdaExpression.prototype.visit$1 = function($0) { |
| 19606 return this.visit(($0 && $0.is$TreeVisitor())); | 19112 return this.visit($0); |
| 19607 }; | 19113 }; |
| 19608 // ********** Code for CallExpression ************** | 19114 // ********** Code for CallExpression ************** |
| 19609 function CallExpression(target, arguments, span) { | 19115 function CallExpression(target, arguments, span) { |
| 19610 this.target = target; | 19116 this.target = target; |
| 19611 this.arguments = arguments; | 19117 this.arguments = arguments; |
| 19612 lang_Expression.call(this, span); | 19118 lang_Expression.call(this, span); |
| 19613 // Initializers done | 19119 // Initializers done |
| 19614 } | 19120 } |
| 19615 $inherits(CallExpression, lang_Expression); | 19121 $inherits(CallExpression, lang_Expression); |
| 19616 CallExpression.prototype.is$CallExpression = function(){return this;}; | |
| 19617 CallExpression.prototype.get$arguments = function() { return this.arguments; }; | 19122 CallExpression.prototype.get$arguments = function() { return this.arguments; }; |
| 19618 CallExpression.prototype.set$arguments = function(value) { return this.arguments
= value; }; | 19123 CallExpression.prototype.set$arguments = function(value) { return this.arguments
= value; }; |
| 19619 CallExpression.prototype.visit = function(visitor) { | 19124 CallExpression.prototype.visit = function(visitor) { |
| 19620 return visitor.visitCallExpression(this); | 19125 return visitor.visitCallExpression(this); |
| 19621 } | 19126 } |
| 19622 CallExpression.prototype.visit$1 = function($0) { | 19127 CallExpression.prototype.visit$1 = function($0) { |
| 19623 return this.visit(($0 && $0.is$TreeVisitor())); | 19128 return this.visit($0); |
| 19624 }; | 19129 }; |
| 19625 // ********** Code for IndexExpression ************** | 19130 // ********** Code for IndexExpression ************** |
| 19626 function IndexExpression(target, index, span) { | 19131 function IndexExpression(target, index, span) { |
| 19627 this.target = target; | 19132 this.target = target; |
| 19628 this.index = index; | 19133 this.index = index; |
| 19629 lang_Expression.call(this, span); | 19134 lang_Expression.call(this, span); |
| 19630 // Initializers done | 19135 // Initializers done |
| 19631 } | 19136 } |
| 19632 $inherits(IndexExpression, lang_Expression); | 19137 $inherits(IndexExpression, lang_Expression); |
| 19633 IndexExpression.prototype.is$IndexExpression = function(){return this;}; | |
| 19634 IndexExpression.prototype.visit = function(visitor) { | 19138 IndexExpression.prototype.visit = function(visitor) { |
| 19635 return visitor.visitIndexExpression(this); | 19139 return visitor.visitIndexExpression(this); |
| 19636 } | 19140 } |
| 19637 IndexExpression.prototype.visit$1 = function($0) { | 19141 IndexExpression.prototype.visit$1 = function($0) { |
| 19638 return this.visit(($0 && $0.is$TreeVisitor())); | 19142 return this.visit($0); |
| 19639 }; | 19143 }; |
| 19640 // ********** Code for BinaryExpression ************** | 19144 // ********** Code for BinaryExpression ************** |
| 19641 function BinaryExpression(op, x, y, span) { | 19145 function BinaryExpression(op, x, y, span) { |
| 19642 this.op = op; | 19146 this.op = op; |
| 19643 this.x = x; | 19147 this.x = x; |
| 19644 this.y = y; | 19148 this.y = y; |
| 19645 lang_Expression.call(this, span); | 19149 lang_Expression.call(this, span); |
| 19646 // Initializers done | 19150 // Initializers done |
| 19647 } | 19151 } |
| 19648 $inherits(BinaryExpression, lang_Expression); | 19152 $inherits(BinaryExpression, lang_Expression); |
| 19649 BinaryExpression.prototype.is$BinaryExpression = function(){return this;}; | |
| 19650 BinaryExpression.prototype.visit = function(visitor) { | 19153 BinaryExpression.prototype.visit = function(visitor) { |
| 19651 return visitor.visitBinaryExpression(this); | 19154 return visitor.visitBinaryExpression(this); |
| 19652 } | 19155 } |
| 19653 BinaryExpression.prototype.visit$1 = function($0) { | 19156 BinaryExpression.prototype.visit$1 = function($0) { |
| 19654 return this.visit(($0 && $0.is$TreeVisitor())); | 19157 return this.visit($0); |
| 19655 }; | 19158 }; |
| 19656 // ********** Code for UnaryExpression ************** | 19159 // ********** Code for UnaryExpression ************** |
| 19657 function UnaryExpression(op, self, span) { | 19160 function UnaryExpression(op, self, span) { |
| 19658 this.op = op; | 19161 this.op = op; |
| 19659 this.self = self; | 19162 this.self = self; |
| 19660 lang_Expression.call(this, span); | 19163 lang_Expression.call(this, span); |
| 19661 // Initializers done | 19164 // Initializers done |
| 19662 } | 19165 } |
| 19663 $inherits(UnaryExpression, lang_Expression); | 19166 $inherits(UnaryExpression, lang_Expression); |
| 19664 UnaryExpression.prototype.visit = function(visitor) { | 19167 UnaryExpression.prototype.visit = function(visitor) { |
| 19665 return visitor.visitUnaryExpression(this); | 19168 return visitor.visitUnaryExpression(this); |
| 19666 } | 19169 } |
| 19667 UnaryExpression.prototype.visit$1 = function($0) { | 19170 UnaryExpression.prototype.visit$1 = function($0) { |
| 19668 return this.visit(($0 && $0.is$TreeVisitor())); | 19171 return this.visit($0); |
| 19669 }; | 19172 }; |
| 19670 // ********** Code for PostfixExpression ************** | 19173 // ********** Code for PostfixExpression ************** |
| 19671 function PostfixExpression(body, op, span) { | 19174 function PostfixExpression(body, op, span) { |
| 19672 this.body = body; | 19175 this.body = body; |
| 19673 this.op = op; | 19176 this.op = op; |
| 19674 lang_Expression.call(this, span); | 19177 lang_Expression.call(this, span); |
| 19675 // Initializers done | 19178 // Initializers done |
| 19676 } | 19179 } |
| 19677 $inherits(PostfixExpression, lang_Expression); | 19180 $inherits(PostfixExpression, lang_Expression); |
| 19678 PostfixExpression.prototype.is$PostfixExpression = function(){return this;}; | |
| 19679 PostfixExpression.prototype.visit = function(visitor) { | 19181 PostfixExpression.prototype.visit = function(visitor) { |
| 19680 return visitor.visitPostfixExpression$1(this); | 19182 return visitor.visitPostfixExpression$1(this); |
| 19681 } | 19183 } |
| 19682 PostfixExpression.prototype.visit$1 = function($0) { | 19184 PostfixExpression.prototype.visit$1 = function($0) { |
| 19683 return this.visit(($0 && $0.is$TreeVisitor())); | 19185 return this.visit($0); |
| 19684 }; | 19186 }; |
| 19685 // ********** Code for lang_NewExpression ************** | 19187 // ********** Code for lang_NewExpression ************** |
| 19686 function lang_NewExpression(isConst, type, name, arguments, span) { | 19188 function lang_NewExpression(isConst, type, name, arguments, span) { |
| 19687 this.isConst = isConst; | 19189 this.isConst = isConst; |
| 19688 this.type = type; | 19190 this.type = type; |
| 19689 this.name = name; | 19191 this.name = name; |
| 19690 this.arguments = arguments; | 19192 this.arguments = arguments; |
| 19691 lang_Expression.call(this, span); | 19193 lang_Expression.call(this, span); |
| 19692 // Initializers done | 19194 // Initializers done |
| 19693 } | 19195 } |
| 19694 $inherits(lang_NewExpression, lang_Expression); | 19196 $inherits(lang_NewExpression, lang_Expression); |
| 19695 lang_NewExpression.prototype.get$isConst = function() { return this.isConst; }; | 19197 lang_NewExpression.prototype.get$isConst = function() { return this.isConst; }; |
| 19696 lang_NewExpression.prototype.set$isConst = function(value) { return this.isConst
= value; }; | 19198 lang_NewExpression.prototype.set$isConst = function(value) { return this.isConst
= value; }; |
| 19697 lang_NewExpression.prototype.get$type = function() { return this.type; }; | |
| 19698 lang_NewExpression.prototype.set$type = function(value) { return this.type = val
ue; }; | |
| 19699 lang_NewExpression.prototype.get$name = function() { return this.name; }; | 19199 lang_NewExpression.prototype.get$name = function() { return this.name; }; |
| 19700 lang_NewExpression.prototype.set$name = function(value) { return this.name = val
ue; }; | 19200 lang_NewExpression.prototype.set$name = function(value) { return this.name = val
ue; }; |
| 19701 lang_NewExpression.prototype.get$arguments = function() { return this.arguments;
}; | 19201 lang_NewExpression.prototype.get$arguments = function() { return this.arguments;
}; |
| 19702 lang_NewExpression.prototype.set$arguments = function(value) { return this.argum
ents = value; }; | 19202 lang_NewExpression.prototype.set$arguments = function(value) { return this.argum
ents = value; }; |
| 19703 lang_NewExpression.prototype.visit = function(visitor) { | 19203 lang_NewExpression.prototype.visit = function(visitor) { |
| 19704 return visitor.visitNewExpression(this); | 19204 return visitor.visitNewExpression(this); |
| 19705 } | 19205 } |
| 19706 lang_NewExpression.prototype.visit$1 = function($0) { | 19206 lang_NewExpression.prototype.visit$1 = function($0) { |
| 19707 return this.visit(($0 && $0.is$TreeVisitor())); | 19207 return this.visit($0); |
| 19708 }; | 19208 }; |
| 19709 // ********** Code for ListExpression ************** | 19209 // ********** Code for ListExpression ************** |
| 19710 function ListExpression(isConst, type, values, span) { | 19210 function ListExpression(isConst, type, values, span) { |
| 19711 this.isConst = isConst; | 19211 this.isConst = isConst; |
| 19712 this.type = type; | 19212 this.type = type; |
| 19713 this.values = values; | 19213 this.values = values; |
| 19714 lang_Expression.call(this, span); | 19214 lang_Expression.call(this, span); |
| 19715 // Initializers done | 19215 // Initializers done |
| 19716 } | 19216 } |
| 19717 $inherits(ListExpression, lang_Expression); | 19217 $inherits(ListExpression, lang_Expression); |
| 19718 ListExpression.prototype.get$isConst = function() { return this.isConst; }; | 19218 ListExpression.prototype.get$isConst = function() { return this.isConst; }; |
| 19719 ListExpression.prototype.set$isConst = function(value) { return this.isConst = v
alue; }; | 19219 ListExpression.prototype.set$isConst = function(value) { return this.isConst = v
alue; }; |
| 19720 ListExpression.prototype.get$type = function() { return this.type; }; | |
| 19721 ListExpression.prototype.set$type = function(value) { return this.type = value;
}; | |
| 19722 ListExpression.prototype.visit = function(visitor) { | 19220 ListExpression.prototype.visit = function(visitor) { |
| 19723 return visitor.visitListExpression(this); | 19221 return visitor.visitListExpression(this); |
| 19724 } | 19222 } |
| 19725 ListExpression.prototype.visit$1 = function($0) { | 19223 ListExpression.prototype.visit$1 = function($0) { |
| 19726 return this.visit(($0 && $0.is$TreeVisitor())); | 19224 return this.visit($0); |
| 19727 }; | 19225 }; |
| 19728 // ********** Code for MapExpression ************** | 19226 // ********** Code for MapExpression ************** |
| 19729 function MapExpression(isConst, type, items, span) { | 19227 function MapExpression(isConst, type, items, span) { |
| 19730 this.isConst = isConst; | 19228 this.isConst = isConst; |
| 19731 this.type = type; | 19229 this.type = type; |
| 19732 this.items = items; | 19230 this.items = items; |
| 19733 lang_Expression.call(this, span); | 19231 lang_Expression.call(this, span); |
| 19734 // Initializers done | 19232 // Initializers done |
| 19735 } | 19233 } |
| 19736 $inherits(MapExpression, lang_Expression); | 19234 $inherits(MapExpression, lang_Expression); |
| 19737 MapExpression.prototype.get$isConst = function() { return this.isConst; }; | 19235 MapExpression.prototype.get$isConst = function() { return this.isConst; }; |
| 19738 MapExpression.prototype.set$isConst = function(value) { return this.isConst = va
lue; }; | 19236 MapExpression.prototype.set$isConst = function(value) { return this.isConst = va
lue; }; |
| 19739 MapExpression.prototype.get$type = function() { return this.type; }; | |
| 19740 MapExpression.prototype.set$type = function(value) { return this.type = value; }
; | |
| 19741 MapExpression.prototype.visit = function(visitor) { | 19237 MapExpression.prototype.visit = function(visitor) { |
| 19742 return visitor.visitMapExpression(this); | 19238 return visitor.visitMapExpression(this); |
| 19743 } | 19239 } |
| 19744 MapExpression.prototype.visit$1 = function($0) { | 19240 MapExpression.prototype.visit$1 = function($0) { |
| 19745 return this.visit(($0 && $0.is$TreeVisitor())); | 19241 return this.visit($0); |
| 19746 }; | 19242 }; |
| 19747 // ********** Code for ConditionalExpression ************** | 19243 // ********** Code for ConditionalExpression ************** |
| 19748 function ConditionalExpression(test, trueBranch, falseBranch, span) { | 19244 function ConditionalExpression(test, trueBranch, falseBranch, span) { |
| 19749 this.test = test; | 19245 this.test = test; |
| 19750 this.trueBranch = trueBranch; | 19246 this.trueBranch = trueBranch; |
| 19751 this.falseBranch = falseBranch; | 19247 this.falseBranch = falseBranch; |
| 19752 lang_Expression.call(this, span); | 19248 lang_Expression.call(this, span); |
| 19753 // Initializers done | 19249 // Initializers done |
| 19754 } | 19250 } |
| 19755 $inherits(ConditionalExpression, lang_Expression); | 19251 $inherits(ConditionalExpression, lang_Expression); |
| 19756 ConditionalExpression.prototype.visit = function(visitor) { | 19252 ConditionalExpression.prototype.visit = function(visitor) { |
| 19757 return visitor.visitConditionalExpression(this); | 19253 return visitor.visitConditionalExpression(this); |
| 19758 } | 19254 } |
| 19759 ConditionalExpression.prototype.visit$1 = function($0) { | 19255 ConditionalExpression.prototype.visit$1 = function($0) { |
| 19760 return this.visit(($0 && $0.is$TreeVisitor())); | 19256 return this.visit($0); |
| 19761 }; | 19257 }; |
| 19762 // ********** Code for IsExpression ************** | 19258 // ********** Code for IsExpression ************** |
| 19763 function IsExpression(isTrue, x, type, span) { | 19259 function IsExpression(isTrue, x, type, span) { |
| 19764 this.isTrue = isTrue; | 19260 this.isTrue = isTrue; |
| 19765 this.x = x; | 19261 this.x = x; |
| 19766 this.type = type; | 19262 this.type = type; |
| 19767 lang_Expression.call(this, span); | 19263 lang_Expression.call(this, span); |
| 19768 // Initializers done | 19264 // Initializers done |
| 19769 } | 19265 } |
| 19770 $inherits(IsExpression, lang_Expression); | 19266 $inherits(IsExpression, lang_Expression); |
| 19771 IsExpression.prototype.get$type = function() { return this.type; }; | |
| 19772 IsExpression.prototype.set$type = function(value) { return this.type = value; }; | |
| 19773 IsExpression.prototype.visit = function(visitor) { | 19267 IsExpression.prototype.visit = function(visitor) { |
| 19774 return visitor.visitIsExpression(this); | 19268 return visitor.visitIsExpression(this); |
| 19775 } | 19269 } |
| 19776 IsExpression.prototype.visit$1 = function($0) { | 19270 IsExpression.prototype.visit$1 = function($0) { |
| 19777 return this.visit(($0 && $0.is$TreeVisitor())); | 19271 return this.visit($0); |
| 19778 }; | 19272 }; |
| 19779 // ********** Code for ParenExpression ************** | 19273 // ********** Code for ParenExpression ************** |
| 19780 function ParenExpression(body, span) { | 19274 function ParenExpression(body, span) { |
| 19781 this.body = body; | 19275 this.body = body; |
| 19782 lang_Expression.call(this, span); | 19276 lang_Expression.call(this, span); |
| 19783 // Initializers done | 19277 // Initializers done |
| 19784 } | 19278 } |
| 19785 $inherits(ParenExpression, lang_Expression); | 19279 $inherits(ParenExpression, lang_Expression); |
| 19786 ParenExpression.prototype.visit = function(visitor) { | 19280 ParenExpression.prototype.visit = function(visitor) { |
| 19787 return visitor.visitParenExpression(this); | 19281 return visitor.visitParenExpression(this); |
| 19788 } | 19282 } |
| 19789 ParenExpression.prototype.visit$1 = function($0) { | 19283 ParenExpression.prototype.visit$1 = function($0) { |
| 19790 return this.visit(($0 && $0.is$TreeVisitor())); | 19284 return this.visit($0); |
| 19791 }; | 19285 }; |
| 19792 // ********** Code for DotExpression ************** | 19286 // ********** Code for DotExpression ************** |
| 19793 function DotExpression(self, name, span) { | 19287 function DotExpression(self, name, span) { |
| 19794 this.self = self; | 19288 this.self = self; |
| 19795 this.name = name; | 19289 this.name = name; |
| 19796 lang_Expression.call(this, span); | 19290 lang_Expression.call(this, span); |
| 19797 // Initializers done | 19291 // Initializers done |
| 19798 } | 19292 } |
| 19799 $inherits(DotExpression, lang_Expression); | 19293 $inherits(DotExpression, lang_Expression); |
| 19800 DotExpression.prototype.is$DotExpression = function(){return this;}; | |
| 19801 DotExpression.prototype.get$name = function() { return this.name; }; | 19294 DotExpression.prototype.get$name = function() { return this.name; }; |
| 19802 DotExpression.prototype.set$name = function(value) { return this.name = value; }
; | 19295 DotExpression.prototype.set$name = function(value) { return this.name = value; }
; |
| 19803 DotExpression.prototype.visit = function(visitor) { | 19296 DotExpression.prototype.visit = function(visitor) { |
| 19804 return visitor.visitDotExpression(this); | 19297 return visitor.visitDotExpression(this); |
| 19805 } | 19298 } |
| 19806 DotExpression.prototype.visit$1 = function($0) { | 19299 DotExpression.prototype.visit$1 = function($0) { |
| 19807 return this.visit(($0 && $0.is$TreeVisitor())); | 19300 return this.visit($0); |
| 19808 }; | 19301 }; |
| 19809 // ********** Code for VarExpression ************** | 19302 // ********** Code for VarExpression ************** |
| 19810 function VarExpression(name, span) { | 19303 function VarExpression(name, span) { |
| 19811 this.name = name; | 19304 this.name = name; |
| 19812 lang_Expression.call(this, span); | 19305 lang_Expression.call(this, span); |
| 19813 // Initializers done | 19306 // Initializers done |
| 19814 } | 19307 } |
| 19815 $inherits(VarExpression, lang_Expression); | 19308 $inherits(VarExpression, lang_Expression); |
| 19816 VarExpression.prototype.is$VarExpression = function(){return this;}; | |
| 19817 VarExpression.prototype.get$name = function() { return this.name; }; | 19309 VarExpression.prototype.get$name = function() { return this.name; }; |
| 19818 VarExpression.prototype.set$name = function(value) { return this.name = value; }
; | 19310 VarExpression.prototype.set$name = function(value) { return this.name = value; }
; |
| 19819 VarExpression.prototype.visit = function(visitor) { | 19311 VarExpression.prototype.visit = function(visitor) { |
| 19820 return visitor.visitVarExpression(this); | 19312 return visitor.visitVarExpression(this); |
| 19821 } | 19313 } |
| 19822 VarExpression.prototype.visit$1 = function($0) { | 19314 VarExpression.prototype.visit$1 = function($0) { |
| 19823 return this.visit(($0 && $0.is$TreeVisitor())); | 19315 return this.visit($0); |
| 19824 }; | 19316 }; |
| 19825 // ********** Code for ThisExpression ************** | 19317 // ********** Code for ThisExpression ************** |
| 19826 function ThisExpression(span) { | 19318 function ThisExpression(span) { |
| 19827 lang_Expression.call(this, span); | 19319 lang_Expression.call(this, span); |
| 19828 // Initializers done | 19320 // Initializers done |
| 19829 } | 19321 } |
| 19830 $inherits(ThisExpression, lang_Expression); | 19322 $inherits(ThisExpression, lang_Expression); |
| 19831 ThisExpression.prototype.visit = function(visitor) { | 19323 ThisExpression.prototype.visit = function(visitor) { |
| 19832 return visitor.visitThisExpression(this); | 19324 return visitor.visitThisExpression(this); |
| 19833 } | 19325 } |
| 19834 ThisExpression.prototype.visit$1 = function($0) { | 19326 ThisExpression.prototype.visit$1 = function($0) { |
| 19835 return this.visit(($0 && $0.is$TreeVisitor())); | 19327 return this.visit($0); |
| 19836 }; | 19328 }; |
| 19837 // ********** Code for SuperExpression ************** | 19329 // ********** Code for SuperExpression ************** |
| 19838 function SuperExpression(span) { | 19330 function SuperExpression(span) { |
| 19839 lang_Expression.call(this, span); | 19331 lang_Expression.call(this, span); |
| 19840 // Initializers done | 19332 // Initializers done |
| 19841 } | 19333 } |
| 19842 $inherits(SuperExpression, lang_Expression); | 19334 $inherits(SuperExpression, lang_Expression); |
| 19843 SuperExpression.prototype.visit = function(visitor) { | 19335 SuperExpression.prototype.visit = function(visitor) { |
| 19844 return visitor.visitSuperExpression(this); | 19336 return visitor.visitSuperExpression(this); |
| 19845 } | 19337 } |
| 19846 SuperExpression.prototype.visit$1 = function($0) { | 19338 SuperExpression.prototype.visit$1 = function($0) { |
| 19847 return this.visit(($0 && $0.is$TreeVisitor())); | 19339 return this.visit($0); |
| 19848 }; | 19340 }; |
| 19849 // ********** Code for NullExpression ************** | 19341 // ********** Code for NullExpression ************** |
| 19850 function NullExpression(span) { | 19342 function NullExpression(span) { |
| 19851 lang_Expression.call(this, span); | 19343 lang_Expression.call(this, span); |
| 19852 // Initializers done | 19344 // Initializers done |
| 19853 } | 19345 } |
| 19854 $inherits(NullExpression, lang_Expression); | 19346 $inherits(NullExpression, lang_Expression); |
| 19855 NullExpression.prototype.visit = function(visitor) { | 19347 NullExpression.prototype.visit = function(visitor) { |
| 19856 return visitor.visitNullExpression(this); | 19348 return visitor.visitNullExpression(this); |
| 19857 } | 19349 } |
| 19858 NullExpression.prototype.visit$1 = function($0) { | 19350 NullExpression.prototype.visit$1 = function($0) { |
| 19859 return this.visit(($0 && $0.is$TreeVisitor())); | 19351 return this.visit($0); |
| 19860 }; | 19352 }; |
| 19861 // ********** Code for LiteralExpression ************** | 19353 // ********** Code for LiteralExpression ************** |
| 19862 function LiteralExpression(value, type, text, span) { | 19354 function LiteralExpression(value, type, text, span) { |
| 19863 this.value = value; | 19355 this.value = value; |
| 19864 this.type = type; | 19356 this.type = type; |
| 19865 this.text = text; | 19357 this.text = text; |
| 19866 lang_Expression.call(this, span); | 19358 lang_Expression.call(this, span); |
| 19867 // Initializers done | 19359 // Initializers done |
| 19868 } | 19360 } |
| 19869 $inherits(LiteralExpression, lang_Expression); | 19361 $inherits(LiteralExpression, lang_Expression); |
| 19870 LiteralExpression.prototype.get$value = function() { return this.value; }; | 19362 LiteralExpression.prototype.get$value = function() { return this.value; }; |
| 19871 LiteralExpression.prototype.set$value = function(value) { return this.value = va
lue; }; | 19363 LiteralExpression.prototype.set$value = function(value) { return this.value = va
lue; }; |
| 19872 LiteralExpression.prototype.get$type = function() { return this.type; }; | |
| 19873 LiteralExpression.prototype.set$type = function(value) { return this.type = valu
e; }; | |
| 19874 LiteralExpression.prototype.get$text = function() { return this.text; }; | 19364 LiteralExpression.prototype.get$text = function() { return this.text; }; |
| 19875 LiteralExpression.prototype.set$text = function(value) { return this.text = valu
e; }; | 19365 LiteralExpression.prototype.set$text = function(value) { return this.text = valu
e; }; |
| 19876 LiteralExpression.prototype.visit = function(visitor) { | 19366 LiteralExpression.prototype.visit = function(visitor) { |
| 19877 return visitor.visitLiteralExpression(this); | 19367 return visitor.visitLiteralExpression(this); |
| 19878 } | 19368 } |
| 19879 LiteralExpression.prototype.visit$1 = function($0) { | 19369 LiteralExpression.prototype.visit$1 = function($0) { |
| 19880 return this.visit(($0 && $0.is$TreeVisitor())); | 19370 return this.visit($0); |
| 19881 }; | 19371 }; |
| 19882 // ********** Code for NameTypeReference ************** | 19372 // ********** Code for NameTypeReference ************** |
| 19883 function NameTypeReference(isFinal, name, names, span) { | 19373 function NameTypeReference(isFinal, name, names, span) { |
| 19884 this.isFinal = isFinal; | 19374 this.isFinal = isFinal; |
| 19885 this.name = name; | 19375 this.name = name; |
| 19886 this.names = names; | 19376 this.names = names; |
| 19887 TypeReference.call(this, span); | 19377 TypeReference.call(this, span); |
| 19888 // Initializers done | 19378 // Initializers done |
| 19889 } | 19379 } |
| 19890 $inherits(NameTypeReference, TypeReference); | 19380 $inherits(NameTypeReference, TypeReference); |
| 19891 NameTypeReference.prototype.is$NameTypeReference = function(){return this;}; | |
| 19892 NameTypeReference.prototype.get$name = function() { return this.name; }; | 19381 NameTypeReference.prototype.get$name = function() { return this.name; }; |
| 19893 NameTypeReference.prototype.set$name = function(value) { return this.name = valu
e; }; | 19382 NameTypeReference.prototype.set$name = function(value) { return this.name = valu
e; }; |
| 19894 NameTypeReference.prototype.visit = function(visitor) { | 19383 NameTypeReference.prototype.visit = function(visitor) { |
| 19895 return visitor.visitNameTypeReference(this); | 19384 return visitor.visitNameTypeReference(this); |
| 19896 } | 19385 } |
| 19897 NameTypeReference.prototype.visit$1 = function($0) { | 19386 NameTypeReference.prototype.visit$1 = function($0) { |
| 19898 return this.visit(($0 && $0.is$TreeVisitor())); | 19387 return this.visit($0); |
| 19899 }; | 19388 }; |
| 19900 // ********** Code for GenericTypeReference ************** | 19389 // ********** Code for GenericTypeReference ************** |
| 19901 function GenericTypeReference(baseType, typeArguments, depth, span) { | 19390 function GenericTypeReference(baseType, typeArguments, depth, span) { |
| 19902 this.baseType = baseType; | 19391 this.baseType = baseType; |
| 19903 this.typeArguments = typeArguments; | 19392 this.typeArguments = typeArguments; |
| 19904 this.depth = depth; | 19393 this.depth = depth; |
| 19905 TypeReference.call(this, span); | 19394 TypeReference.call(this, span); |
| 19906 // Initializers done | 19395 // Initializers done |
| 19907 } | 19396 } |
| 19908 $inherits(GenericTypeReference, TypeReference); | 19397 $inherits(GenericTypeReference, TypeReference); |
| 19909 GenericTypeReference.prototype.is$GenericTypeReference = function(){return this;
}; | |
| 19910 GenericTypeReference.prototype.visit = function(visitor) { | 19398 GenericTypeReference.prototype.visit = function(visitor) { |
| 19911 return visitor.visitGenericTypeReference(this); | 19399 return visitor.visitGenericTypeReference(this); |
| 19912 } | 19400 } |
| 19913 GenericTypeReference.prototype.visit$1 = function($0) { | 19401 GenericTypeReference.prototype.visit$1 = function($0) { |
| 19914 return this.visit(($0 && $0.is$TreeVisitor())); | 19402 return this.visit($0); |
| 19915 }; | 19403 }; |
| 19916 // ********** Code for FunctionTypeReference ************** | 19404 // ********** Code for FunctionTypeReference ************** |
| 19917 function FunctionTypeReference(isFinal, func, span) { | 19405 function FunctionTypeReference(isFinal, func, span) { |
| 19918 this.isFinal = isFinal; | 19406 this.isFinal = isFinal; |
| 19919 this.func = func; | 19407 this.func = func; |
| 19920 TypeReference.call(this, span); | 19408 TypeReference.call(this, span); |
| 19921 // Initializers done | 19409 // Initializers done |
| 19922 } | 19410 } |
| 19923 $inherits(FunctionTypeReference, TypeReference); | 19411 $inherits(FunctionTypeReference, TypeReference); |
| 19924 FunctionTypeReference.prototype.is$FunctionTypeReference = function(){return thi
s;}; | |
| 19925 FunctionTypeReference.prototype.visit = function(visitor) { | 19412 FunctionTypeReference.prototype.visit = function(visitor) { |
| 19926 return visitor.visitFunctionTypeReference(this); | 19413 return visitor.visitFunctionTypeReference(this); |
| 19927 } | 19414 } |
| 19928 FunctionTypeReference.prototype.visit$1 = function($0) { | 19415 FunctionTypeReference.prototype.visit$1 = function($0) { |
| 19929 return this.visit(($0 && $0.is$TreeVisitor())); | 19416 return this.visit($0); |
| 19930 }; | 19417 }; |
| 19931 // ********** Code for ArgumentNode ************** | 19418 // ********** Code for ArgumentNode ************** |
| 19932 function ArgumentNode(label, value, span) { | 19419 function ArgumentNode(label, value, span) { |
| 19933 this.label = label; | 19420 this.label = label; |
| 19934 this.value = value; | 19421 this.value = value; |
| 19935 lang_Node.call(this, span); | 19422 lang_Node.call(this, span); |
| 19936 // Initializers done | 19423 // Initializers done |
| 19937 } | 19424 } |
| 19938 $inherits(ArgumentNode, lang_Node); | 19425 $inherits(ArgumentNode, lang_Node); |
| 19939 ArgumentNode.prototype.is$ArgumentNode = function(){return this;}; | |
| 19940 ArgumentNode.prototype.get$value = function() { return this.value; }; | 19426 ArgumentNode.prototype.get$value = function() { return this.value; }; |
| 19941 ArgumentNode.prototype.set$value = function(value) { return this.value = value;
}; | 19427 ArgumentNode.prototype.set$value = function(value) { return this.value = value;
}; |
| 19942 ArgumentNode.prototype.visit = function(visitor) { | 19428 ArgumentNode.prototype.visit = function(visitor) { |
| 19943 return visitor.visitArgumentNode(this); | 19429 return visitor.visitArgumentNode(this); |
| 19944 } | 19430 } |
| 19945 ArgumentNode.prototype.visit$1 = function($0) { | 19431 ArgumentNode.prototype.visit$1 = function($0) { |
| 19946 return this.visit(($0 && $0.is$TreeVisitor())); | 19432 return this.visit($0); |
| 19947 }; | 19433 }; |
| 19948 // ********** Code for FormalNode ************** | 19434 // ********** Code for FormalNode ************** |
| 19949 function FormalNode(isThis, isRest, type, name, value, span) { | 19435 function FormalNode(isThis, isRest, type, name, value, span) { |
| 19950 this.isThis = isThis; | 19436 this.isThis = isThis; |
| 19951 this.isRest = isRest; | 19437 this.isRest = isRest; |
| 19952 this.type = type; | 19438 this.type = type; |
| 19953 this.name = name; | 19439 this.name = name; |
| 19954 this.value = value; | 19440 this.value = value; |
| 19955 lang_Node.call(this, span); | 19441 lang_Node.call(this, span); |
| 19956 // Initializers done | 19442 // Initializers done |
| 19957 } | 19443 } |
| 19958 $inherits(FormalNode, lang_Node); | 19444 $inherits(FormalNode, lang_Node); |
| 19959 FormalNode.prototype.get$type = function() { return this.type; }; | |
| 19960 FormalNode.prototype.set$type = function(value) { return this.type = value; }; | |
| 19961 FormalNode.prototype.get$name = function() { return this.name; }; | 19445 FormalNode.prototype.get$name = function() { return this.name; }; |
| 19962 FormalNode.prototype.set$name = function(value) { return this.name = value; }; | 19446 FormalNode.prototype.set$name = function(value) { return this.name = value; }; |
| 19963 FormalNode.prototype.get$value = function() { return this.value; }; | 19447 FormalNode.prototype.get$value = function() { return this.value; }; |
| 19964 FormalNode.prototype.set$value = function(value) { return this.value = value; }; | 19448 FormalNode.prototype.set$value = function(value) { return this.value = value; }; |
| 19965 FormalNode.prototype.visit = function(visitor) { | 19449 FormalNode.prototype.visit = function(visitor) { |
| 19966 return visitor.visitFormalNode(this); | 19450 return visitor.visitFormalNode(this); |
| 19967 } | 19451 } |
| 19968 FormalNode.prototype.visit$1 = function($0) { | 19452 FormalNode.prototype.visit$1 = function($0) { |
| 19969 return this.visit(($0 && $0.is$TreeVisitor())); | 19453 return this.visit($0); |
| 19970 }; | 19454 }; |
| 19971 // ********** Code for CatchNode ************** | 19455 // ********** Code for CatchNode ************** |
| 19972 function CatchNode(exception, trace, body, span) { | 19456 function CatchNode(exception, trace, body, span) { |
| 19973 this.exception = exception; | 19457 this.exception = exception; |
| 19974 this.trace = trace; | 19458 this.trace = trace; |
| 19975 this.body = body; | 19459 this.body = body; |
| 19976 lang_Node.call(this, span); | 19460 lang_Node.call(this, span); |
| 19977 // Initializers done | 19461 // Initializers done |
| 19978 } | 19462 } |
| 19979 $inherits(CatchNode, lang_Node); | 19463 $inherits(CatchNode, lang_Node); |
| 19980 CatchNode.prototype.get$exception = function() { return this.exception; }; | 19464 CatchNode.prototype.get$exception = function() { return this.exception; }; |
| 19981 CatchNode.prototype.set$exception = function(value) { return this.exception = va
lue; }; | 19465 CatchNode.prototype.set$exception = function(value) { return this.exception = va
lue; }; |
| 19982 CatchNode.prototype.visit = function(visitor) { | 19466 CatchNode.prototype.visit = function(visitor) { |
| 19983 return visitor.visitCatchNode(this); | 19467 return visitor.visitCatchNode(this); |
| 19984 } | 19468 } |
| 19985 CatchNode.prototype.visit$1 = function($0) { | 19469 CatchNode.prototype.visit$1 = function($0) { |
| 19986 return this.visit(($0 && $0.is$TreeVisitor())); | 19470 return this.visit($0); |
| 19987 }; | 19471 }; |
| 19988 // ********** Code for CaseNode ************** | 19472 // ********** Code for CaseNode ************** |
| 19989 function CaseNode(label, cases, statements, span) { | 19473 function CaseNode(label, cases, statements, span) { |
| 19990 this.label = label; | 19474 this.label = label; |
| 19991 this.cases = cases; | 19475 this.cases = cases; |
| 19992 this.statements = statements; | 19476 this.statements = statements; |
| 19993 lang_Node.call(this, span); | 19477 lang_Node.call(this, span); |
| 19994 // Initializers done | 19478 // Initializers done |
| 19995 } | 19479 } |
| 19996 $inherits(CaseNode, lang_Node); | 19480 $inherits(CaseNode, lang_Node); |
| 19997 CaseNode.prototype.visit = function(visitor) { | 19481 CaseNode.prototype.visit = function(visitor) { |
| 19998 return visitor.visitCaseNode(this); | 19482 return visitor.visitCaseNode(this); |
| 19999 } | 19483 } |
| 20000 CaseNode.prototype.visit$1 = function($0) { | 19484 CaseNode.prototype.visit$1 = function($0) { |
| 20001 return this.visit(($0 && $0.is$TreeVisitor())); | 19485 return this.visit($0); |
| 20002 }; | 19486 }; |
| 20003 // ********** Code for TypeParameter ************** | 19487 // ********** Code for TypeParameter ************** |
| 20004 function TypeParameter(name, extendsType, span) { | 19488 function TypeParameter(name, extendsType, span) { |
| 20005 this.name = name; | 19489 this.name = name; |
| 20006 this.extendsType = extendsType; | 19490 this.extendsType = extendsType; |
| 20007 lang_Node.call(this, span); | 19491 lang_Node.call(this, span); |
| 20008 // Initializers done | 19492 // Initializers done |
| 20009 } | 19493 } |
| 20010 $inherits(TypeParameter, lang_Node); | 19494 $inherits(TypeParameter, lang_Node); |
| 20011 TypeParameter.prototype.get$name = function() { return this.name; }; | 19495 TypeParameter.prototype.get$name = function() { return this.name; }; |
| 20012 TypeParameter.prototype.set$name = function(value) { return this.name = value; }
; | 19496 TypeParameter.prototype.set$name = function(value) { return this.name = value; }
; |
| 20013 TypeParameter.prototype.visit = function(visitor) { | 19497 TypeParameter.prototype.visit = function(visitor) { |
| 20014 return visitor.visitTypeParameter(this); | 19498 return visitor.visitTypeParameter(this); |
| 20015 } | 19499 } |
| 20016 TypeParameter.prototype.visit$1 = function($0) { | 19500 TypeParameter.prototype.visit$1 = function($0) { |
| 20017 return this.visit(($0 && $0.is$TreeVisitor())); | 19501 return this.visit($0); |
| 20018 }; | 19502 }; |
| 20019 // ********** Code for lang_Identifier ************** | 19503 // ********** Code for lang_Identifier ************** |
| 20020 function lang_Identifier(name, span) { | 19504 function lang_Identifier(name, span) { |
| 20021 this.name = name; | 19505 this.name = name; |
| 20022 lang_Node.call(this, span); | 19506 lang_Node.call(this, span); |
| 20023 // Initializers done | 19507 // Initializers done |
| 20024 } | 19508 } |
| 20025 $inherits(lang_Identifier, lang_Node); | 19509 $inherits(lang_Identifier, lang_Node); |
| 20026 lang_Identifier.prototype.is$lang_Identifier = function(){return this;}; | |
| 20027 lang_Identifier.prototype.get$name = function() { return this.name; }; | 19510 lang_Identifier.prototype.get$name = function() { return this.name; }; |
| 20028 lang_Identifier.prototype.set$name = function(value) { return this.name = value;
}; | 19511 lang_Identifier.prototype.set$name = function(value) { return this.name = value;
}; |
| 20029 lang_Identifier.prototype.visit = function(visitor) { | 19512 lang_Identifier.prototype.visit = function(visitor) { |
| 20030 return visitor.visitIdentifier(this); | 19513 return visitor.visitIdentifier(this); |
| 20031 } | 19514 } |
| 20032 lang_Identifier.prototype.visit$1 = function($0) { | 19515 lang_Identifier.prototype.visit$1 = function($0) { |
| 20033 return this.visit(($0 && $0.is$TreeVisitor())); | 19516 return this.visit($0); |
| 20034 }; | 19517 }; |
| 20035 // ********** Code for DeclaredIdentifier ************** | 19518 // ********** Code for DeclaredIdentifier ************** |
| 20036 function DeclaredIdentifier(type, name, span) { | 19519 function DeclaredIdentifier(type, name, span) { |
| 20037 this.type = type; | 19520 this.type = type; |
| 20038 this.name = name; | 19521 this.name = name; |
| 20039 lang_Expression.call(this, span); | 19522 lang_Expression.call(this, span); |
| 20040 // Initializers done | 19523 // Initializers done |
| 20041 } | 19524 } |
| 20042 $inherits(DeclaredIdentifier, lang_Expression); | 19525 $inherits(DeclaredIdentifier, lang_Expression); |
| 20043 DeclaredIdentifier.prototype.is$DeclaredIdentifier = function(){return this;}; | |
| 20044 DeclaredIdentifier.prototype.get$type = function() { return this.type; }; | |
| 20045 DeclaredIdentifier.prototype.set$type = function(value) { return this.type = val
ue; }; | |
| 20046 DeclaredIdentifier.prototype.get$name = function() { return this.name; }; | 19526 DeclaredIdentifier.prototype.get$name = function() { return this.name; }; |
| 20047 DeclaredIdentifier.prototype.set$name = function(value) { return this.name = val
ue; }; | 19527 DeclaredIdentifier.prototype.set$name = function(value) { return this.name = val
ue; }; |
| 20048 DeclaredIdentifier.prototype.visit = function(visitor) { | 19528 DeclaredIdentifier.prototype.visit = function(visitor) { |
| 20049 return visitor.visitDeclaredIdentifier(this); | 19529 return visitor.visitDeclaredIdentifier(this); |
| 20050 } | 19530 } |
| 20051 DeclaredIdentifier.prototype.visit$1 = function($0) { | 19531 DeclaredIdentifier.prototype.visit$1 = function($0) { |
| 20052 return this.visit(($0 && $0.is$TreeVisitor())); | 19532 return this.visit($0); |
| 20053 }; | 19533 }; |
| 20054 // ********** Code for lang_Type ************** | 19534 // ********** Code for lang_Type ************** |
| 20055 function lang_Type(name) { | 19535 function lang_Type(name) { |
| 20056 this.name = name; | 19536 this.name = name; |
| 20057 this.isTested = false; | 19537 this.isTested = false; |
| 20058 // Initializers done | 19538 // Initializers done |
| 20059 } | 19539 } |
| 20060 lang_Type.prototype.is$lang_Type = function(){return this;}; | |
| 20061 lang_Type.prototype.is$Named = function(){return this;}; | |
| 20062 lang_Type.prototype.get$name = function() { return this.name; }; | 19540 lang_Type.prototype.get$name = function() { return this.name; }; |
| 20063 lang_Type.prototype.markUsed = function() { | 19541 lang_Type.prototype.markUsed = function() { |
| 20064 | 19542 |
| 20065 } | 19543 } |
| 20066 lang_Type.prototype.get$typeMember = function() { | 19544 lang_Type.prototype.get$typeMember = function() { |
| 20067 var $0; | |
| 20068 if (this._typeMember == null) { | 19545 if (this._typeMember == null) { |
| 20069 this._typeMember = new TypeMember((this && this.is$DefinedType())); | 19546 this._typeMember = new TypeMember(this); |
| 20070 } | 19547 } |
| 20071 return (($0 = this._typeMember) && $0.is$TypeMember()); | 19548 return this._typeMember; |
| 20072 } | 19549 } |
| 20073 lang_Type.prototype.getMember = function(name) { | 19550 lang_Type.prototype.getMember = function(name) { |
| 20074 return null; | 19551 return null; |
| 20075 } | 19552 } |
| 20076 lang_Type.prototype.get$isVar = function() { | 19553 lang_Type.prototype.get$isVar = function() { |
| 20077 return false; | 19554 return false; |
| 20078 } | 19555 } |
| 20079 lang_Type.prototype.get$isTop = function() { | 19556 lang_Type.prototype.get$isTop = function() { |
| 20080 return false; | 19557 return false; |
| 20081 } | 19558 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 20097 lang_Type.prototype.get$isNum = function() { | 19574 lang_Type.prototype.get$isNum = function() { |
| 20098 return false; | 19575 return false; |
| 20099 } | 19576 } |
| 20100 lang_Type.prototype.get$isVoid = function() { | 19577 lang_Type.prototype.get$isVoid = function() { |
| 20101 return false; | 19578 return false; |
| 20102 } | 19579 } |
| 20103 lang_Type.prototype.get$isNullable = function() { | 19580 lang_Type.prototype.get$isNullable = function() { |
| 20104 return true; | 19581 return true; |
| 20105 } | 19582 } |
| 20106 lang_Type.prototype.get$isVarOrFunction = function() { | 19583 lang_Type.prototype.get$isVarOrFunction = function() { |
| 20107 return $notnull_bool(this.get$isVar()) || $notnull_bool(this.get$isFunction())
; | 19584 return this.get$isVar() || this.get$isFunction(); |
| 20108 } | 19585 } |
| 20109 lang_Type.prototype.getCallMethod = function() { | 19586 lang_Type.prototype.getCallMethod = function() { |
| 20110 return null; | 19587 return null; |
| 20111 } | 19588 } |
| 20112 lang_Type.prototype.get$isClosed = function() { | 19589 lang_Type.prototype.get$isClosed = function() { |
| 20113 return $notnull_bool(this.get$isString()) || $notnull_bool(this.get$isBool())
|| $notnull_bool(this.get$isNum()) || $notnull_bool(this.get$isFunction()) || $n
otnull_bool(this.get$isVar()); | 19590 return this.get$isString() || this.get$isBool() || this.get$isNum() || this.ge
t$isFunction() || this.get$isVar(); |
| 20114 } | 19591 } |
| 20115 lang_Type.prototype.get$isUsed = function() { | 19592 lang_Type.prototype.get$isUsed = function() { |
| 20116 return false; | 19593 return false; |
| 20117 } | 19594 } |
| 20118 lang_Type.prototype.get$isGeneric = function() { | 19595 lang_Type.prototype.get$isGeneric = function() { |
| 20119 return false; | 19596 return false; |
| 20120 } | 19597 } |
| 20121 lang_Type.prototype.get$isNativeType = function() { | 19598 lang_Type.prototype.get$isNativeType = function() { |
| 20122 return false; | 19599 return false; |
| 20123 } | 19600 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 20142 lang_Type.prototype.get$definition = function() { | 19619 lang_Type.prototype.get$definition = function() { |
| 20143 return null; | 19620 return null; |
| 20144 } | 19621 } |
| 20145 lang_Type.prototype.get$factories = function() { | 19622 lang_Type.prototype.get$factories = function() { |
| 20146 return null; | 19623 return null; |
| 20147 } | 19624 } |
| 20148 lang_Type.prototype.get$typeArgsInOrder = function() { | 19625 lang_Type.prototype.get$typeArgsInOrder = function() { |
| 20149 return null; | 19626 return null; |
| 20150 } | 19627 } |
| 20151 lang_Type.prototype.get$genericType = function() { | 19628 lang_Type.prototype.get$genericType = function() { |
| 20152 return (this && this.is$DefinedType()); | 19629 return this; |
| 20153 } | 19630 } |
| 20154 lang_Type.prototype.get$interfaces = function() { | 19631 lang_Type.prototype.get$interfaces = function() { |
| 20155 return null; | 19632 return null; |
| 20156 } | 19633 } |
| 20157 lang_Type.prototype.get$parent = function() { | 19634 lang_Type.prototype.get$parent = function() { |
| 20158 return null; | 19635 return null; |
| 20159 } | 19636 } |
| 20160 lang_Type.prototype.getAllMembers = function() { | 19637 lang_Type.prototype.getAllMembers = function() { |
| 20161 return $map([]); | 19638 return $map([]); |
| 20162 } | 19639 } |
| 20163 lang_Type.prototype.hashCode = function() { | 19640 lang_Type.prototype.hashCode = function() { |
| 20164 return this.name.hashCode(); | 19641 return this.name.hashCode(); |
| 20165 } | 19642 } |
| 20166 lang_Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) { | 19643 lang_Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) { |
| 20167 if (!$notnull_bool(this.isSubtypeOf(other))) { | 19644 if (!this.isSubtypeOf(other)) { |
| 20168 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name + ''); | 19645 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name + ''); |
| 20169 if ($notnull_bool(typeErrors)) { | 19646 if (typeErrors) { |
| 20170 world.error($assert_String(msg), span); | 19647 world.error(msg, span); |
| 20171 } | 19648 } |
| 20172 else { | 19649 else { |
| 20173 world.warning($assert_String(msg), span); | 19650 world.warning(msg, span); |
| 20174 } | 19651 } |
| 20175 } | 19652 } |
| 20176 } | 19653 } |
| 20177 lang_Type.prototype.needsVarCall = function(args) { | 19654 lang_Type.prototype.needsVarCall = function(args) { |
| 20178 if ($notnull_bool(this.get$isVarOrFunction())) { | 19655 if (this.get$isVarOrFunction()) { |
| 20179 return true; | 19656 return true; |
| 20180 } | 19657 } |
| 20181 var call = this.getCallMethod(); | 19658 var call = this.getCallMethod(); |
| 20182 if ($notnull_bool($ne(call, null))) { | 19659 if ($ne(call, null)) { |
| 20183 if (args.get$length() != call.get$parameters().length || !$notnull_bool(call
.namesInOrder$1(args))) { | 19660 if (args.get$length() != call.get$parameters().length || !call.namesInOrder$
1(args)) { |
| 20184 return true; | 19661 return true; |
| 20185 } | 19662 } |
| 20186 } | 19663 } |
| 20187 return false; | 19664 return false; |
| 20188 } | 19665 } |
| 20189 lang_Type.union = function(x, y) { | 19666 lang_Type.union = function(x, y) { |
| 20190 if ($eq(x, y)) return x; | 19667 if ($eq(x, y)) return x; |
| 20191 if ($notnull_bool(x.get$isNum()) && $notnull_bool(y.get$isNum())) return world
.numType; | 19668 if (x.get$isNum() && y.get$isNum()) return world.numType; |
| 20192 if ($notnull_bool(x.get$isString()) && $notnull_bool(y.get$isString())) return
world.stringType; | 19669 if (x.get$isString() && y.get$isString()) return world.stringType; |
| 20193 return world.varType; | 19670 return world.varType; |
| 20194 } | 19671 } |
| 20195 lang_Type.prototype.isAssignable = function(other) { | 19672 lang_Type.prototype.isAssignable = function(other) { |
| 20196 return $notnull_bool(this.isSubtypeOf(other)) || $notnull_bool(other.isSubtype
Of(this)); | 19673 return this.isSubtypeOf(other) || other.isSubtypeOf(this); |
| 20197 } | 19674 } |
| 20198 lang_Type.prototype._isDirectSupertypeOf = function(other) { | 19675 lang_Type.prototype._isDirectSupertypeOf = function(other) { |
| 20199 var $this = this; // closure support | 19676 var $this = this; // closure support |
| 20200 if ($notnull_bool(other.get$isClass())) { | 19677 if (other.get$isClass()) { |
| 20201 return $eq(other.get$parent(), this) || $notnull_bool(this.get$isObject()) &
& other.get$parent() == null; | 19678 return $eq(other.get$parent(), this) || this.get$isObject() && other.get$par
ent() == null; |
| 20202 } | 19679 } |
| 20203 else { | 19680 else { |
| 20204 if (other.get$interfaces() == null || other.get$interfaces().isEmpty()) { | 19681 if (other.get$interfaces() == null || other.get$interfaces().isEmpty()) { |
| 20205 return this.get$isObject(); | 19682 return this.get$isObject(); |
| 20206 } | 19683 } |
| 20207 else { | 19684 else { |
| 20208 return other.get$interfaces().some((function (i) { | 19685 return other.get$interfaces().some((function (i) { |
| 20209 return $eq(i, $this); | 19686 return $eq(i, $this); |
| 20210 }) | 19687 }) |
| 20211 ); | 19688 ); |
| 20212 } | 19689 } |
| 20213 } | 19690 } |
| 20214 } | 19691 } |
| 20215 lang_Type.prototype.isSubtypeOf = function(other) { | 19692 lang_Type.prototype.isSubtypeOf = function(other) { |
| 20216 if ((other instanceof ParameterType)) { | 19693 if ((other instanceof ParameterType)) { |
| 20217 return true; | 19694 return true; |
| 20218 } | 19695 } |
| 20219 if ($eq(this, other)) return true; | 19696 if ($eq(this, other)) return true; |
| 20220 if ($notnull_bool(this.get$isVar())) return true; | 19697 if (this.get$isVar()) return true; |
| 20221 if ($notnull_bool(other.get$isVar())) return true; | 19698 if (other.get$isVar()) return true; |
| 20222 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true; | 19699 if (other._isDirectSupertypeOf(this)) return true; |
| 20223 var call = this.getCallMethod(); | 19700 var call = this.getCallMethod(); |
| 20224 var otherCall = other.getCallMethod(); | 19701 var otherCall = other.getCallMethod(); |
| 20225 if ($notnull_bool($ne(call, null)) && $notnull_bool($ne(otherCall, null))) { | 19702 if ($ne(call, null) && $ne(otherCall, null)) { |
| 20226 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth
erCall && otherCall.is$MethodMember())); | 19703 return lang_Type._isFunctionSubtypeOf(call, otherCall); |
| 20227 } | 19704 } |
| 20228 if ($eq(this.get$genericType(), other.get$genericType()) && $notnull_bool($ne(
this.get$typeArgsInOrder(), null)) && $notnull_bool($ne(other.get$typeArgsInOrde
r(), null)) && this.get$typeArgsInOrder().length == other.get$typeArgsInOrder().
length) { | 19705 if ($eq(this.get$genericType(), other.get$genericType()) && $ne(this.get$typeA
rgsInOrder(), null) && $ne(other.get$typeArgsInOrder(), null) && this.get$typeAr
gsInOrder().length == other.get$typeArgsInOrder().length) { |
| 20229 var t = this.get$typeArgsInOrder().iterator$0(); | 19706 var t = this.get$typeArgsInOrder().iterator$0(); |
| 20230 var s = other.get$typeArgsInOrder().iterator$0(); | 19707 var s = other.get$typeArgsInOrder().iterator$0(); |
| 20231 while ($notnull_bool(t.hasNext$0())) { | 19708 while (t.hasNext$0()) { |
| 20232 if (!$notnull_bool(t.next$0().isSubtypeOf$1(s.next$0()))) return false; | 19709 if (!t.next$0().isSubtypeOf$1(s.next$0())) return false; |
| 20233 } | 19710 } |
| 20234 return true; | 19711 return true; |
| 20235 } | 19712 } |
| 20236 if (this.get$parent() != null && $notnull_bool(this.get$parent().isSubtypeOf(o
ther))) { | 19713 if (this.get$parent() != null && this.get$parent().isSubtypeOf(other)) { |
| 20237 return true; | 19714 return true; |
| 20238 } | 19715 } |
| 20239 if (this.get$interfaces() != null && this.get$interfaces().some((function (i)
{ | 19716 if (this.get$interfaces() != null && this.get$interfaces().some((function (i)
{ |
| 20240 return i.isSubtypeOf$1(other); | 19717 return i.isSubtypeOf$1(other); |
| 20241 }) | 19718 }) |
| 20242 )) { | 19719 )) { |
| 20243 return true; | 19720 return true; |
| 20244 } | 19721 } |
| 20245 return false; | 19722 return false; |
| 20246 } | 19723 } |
| 20247 lang_Type._isFunctionSubtypeOf = function(t, s) { | 19724 lang_Type._isFunctionSubtypeOf = function(t, s) { |
| 20248 if (!$notnull_bool(s.returnType.get$isVoid()) && !$notnull_bool(s.returnType.i
sAssignable(t.returnType))) { | 19725 if (!s.returnType.get$isVoid() && !s.returnType.isAssignable(t.returnType)) { |
| 20249 return false; | 19726 return false; |
| 20250 } | 19727 } |
| 20251 var tp = t.parameters; | 19728 var tp = t.parameters; |
| 20252 var sp = s.parameters; | 19729 var sp = s.parameters; |
| 20253 if (tp.length < sp.length) return false; | 19730 if (tp.length < sp.length) return false; |
| 20254 for (var i = 0; | 19731 for (var i = 0; |
| 20255 i < sp.length; i++) { | 19732 i < sp.length; i++) { |
| 20256 if ($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOptional())) retur
n false; | 19733 if ($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOptional())) retur
n false; |
| 20257 if ($notnull_bool(tp.$index(i).get$isOptional()) && $notnull_bool($ne(tp.$in
dex(i).get$name(), sp.$index(i).get$name()))) return false; | 19734 if (tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name(), sp.$index(
i).get$name())) return false; |
| 20258 if (!$notnull_bool(tp.$index(i).type.isAssignable$1(sp.$index(i).type))) ret
urn false; | 19735 if (!tp.$index(i).type.isAssignable$1(sp.$index(i).type)) return false; |
| 20259 } | 19736 } |
| 20260 if (tp.length > sp.length && !$notnull_bool(tp.$index(sp.length).get$isOptiona
l())) return false; | 19737 if (tp.length > sp.length && !tp.$index(sp.length).get$isOptional()) return fa
lse; |
| 20261 return true; | 19738 return true; |
| 20262 } | 19739 } |
| 20263 lang_Type.prototype.addDirectSubtype$1 = function($0) { | 19740 lang_Type.prototype.addDirectSubtype$1 = function($0) { |
| 20264 return this.addDirectSubtype(($0 && $0.is$lang_Type())); | 19741 return this.addDirectSubtype($0); |
| 20265 }; | 19742 }; |
| 20266 lang_Type.prototype.ensureSubtypeOf$3 = function($0, $1, $2) { | 19743 lang_Type.prototype.ensureSubtypeOf$3 = function($0, $1, $2) { |
| 20267 return this.ensureSubtypeOf(($0 && $0.is$lang_Type()), ($1 && $1.is$SourceSpan
()), $assert_bool($2)); | 19744 return this.ensureSubtypeOf($0, $1, $2); |
| 20268 }; | 19745 }; |
| 20269 lang_Type.prototype.getConstructor$1 = function($0) { | 19746 lang_Type.prototype.getConstructor$1 = function($0) { |
| 20270 return this.getConstructor($assert_String($0)); | 19747 return this.getConstructor($0); |
| 20271 }; | 19748 }; |
| 20272 lang_Type.prototype.getFactory$2 = function($0, $1) { | 19749 lang_Type.prototype.getFactory$2 = function($0, $1) { |
| 20273 return this.getFactory(($0 && $0.is$lang_Type()), $assert_String($1)); | 19750 return this.getFactory($0, $1); |
| 20274 }; | 19751 }; |
| 20275 lang_Type.prototype.getMember$1 = function($0) { | 19752 lang_Type.prototype.getMember$1 = function($0) { |
| 20276 return this.getMember($assert_String($0)); | 19753 return this.getMember($0); |
| 20277 }; | 19754 }; |
| 20278 lang_Type.prototype.getOrMakeConcreteType$1 = function($0) { | 19755 lang_Type.prototype.getOrMakeConcreteType$1 = function($0) { |
| 20279 return this.getOrMakeConcreteType(($0 && $0.is$List$Type())); | 19756 return this.getOrMakeConcreteType($0); |
| 20280 }; | 19757 }; |
| 20281 lang_Type.prototype.hashCode$0 = function() { | 19758 lang_Type.prototype.hashCode$0 = function() { |
| 20282 return this.hashCode(); | 19759 return this.hashCode(); |
| 20283 }; | 19760 }; |
| 20284 lang_Type.prototype.isAssignable$1 = function($0) { | 19761 lang_Type.prototype.isAssignable$1 = function($0) { |
| 20285 return this.isAssignable(($0 && $0.is$lang_Type())); | 19762 return this.isAssignable($0); |
| 20286 }; | 19763 }; |
| 20287 lang_Type.prototype.isSubtypeOf$1 = function($0) { | 19764 lang_Type.prototype.isSubtypeOf$1 = function($0) { |
| 20288 return this.isSubtypeOf(($0 && $0.is$lang_Type())); | 19765 return this.isSubtypeOf($0); |
| 20289 }; | 19766 }; |
| 20290 lang_Type.prototype.markUsed$0 = function() { | 19767 lang_Type.prototype.markUsed$0 = function() { |
| 20291 return this.markUsed(); | 19768 return this.markUsed(); |
| 20292 }; | 19769 }; |
| 20293 lang_Type.prototype.resolveMember$1 = function($0) { | 19770 lang_Type.prototype.resolveMember$1 = function($0) { |
| 20294 return this.resolveMember($assert_String($0)); | 19771 return this.resolveMember($0); |
| 20295 }; | 19772 }; |
| 20296 lang_Type.prototype.resolveTypeParams$1 = function($0) { | 19773 lang_Type.prototype.resolveTypeParams$1 = function($0) { |
| 20297 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); | 19774 return this.resolveTypeParams($0); |
| 20298 }; | 19775 }; |
| 20299 // ********** Code for ParameterType ************** | 19776 // ********** Code for ParameterType ************** |
| 20300 function ParameterType(name, typeParameter) { | 19777 function ParameterType(name, typeParameter) { |
| 20301 this.typeParameter = typeParameter; | 19778 this.typeParameter = typeParameter; |
| 20302 lang_Type.call(this, name); | 19779 lang_Type.call(this, name); |
| 20303 // Initializers done | 19780 // Initializers done |
| 20304 } | 19781 } |
| 20305 $inherits(ParameterType, lang_Type); | 19782 $inherits(ParameterType, lang_Type); |
| 20306 ParameterType.prototype.is$ParameterType = function(){return this;}; | |
| 20307 ParameterType.prototype.get$isClass = function() { | 19783 ParameterType.prototype.get$isClass = function() { |
| 20308 return false; | 19784 return false; |
| 20309 } | 19785 } |
| 20310 ParameterType.prototype.get$library = function() { | 19786 ParameterType.prototype.get$library = function() { |
| 20311 return null; | 19787 return null; |
| 20312 } | 19788 } |
| 20313 ParameterType.prototype.get$span = function() { | 19789 ParameterType.prototype.get$span = function() { |
| 20314 return this.typeParameter.span; | 19790 return this.typeParameter.span; |
| 20315 } | 19791 } |
| 20316 ParameterType.prototype.get$constructors = function() { | 19792 ParameterType.prototype.get$constructors = function() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 20328 ParameterType.prototype.resolveMember = function(memberName) { | 19804 ParameterType.prototype.resolveMember = function(memberName) { |
| 20329 return this.extendsType.resolveMember(memberName); | 19805 return this.extendsType.resolveMember(memberName); |
| 20330 } | 19806 } |
| 20331 ParameterType.prototype.getConstructor = function(constructorName) { | 19807 ParameterType.prototype.getConstructor = function(constructorName) { |
| 20332 world.internalError('no constructors on type parameters yet'); | 19808 world.internalError('no constructors on type parameters yet'); |
| 20333 } | 19809 } |
| 20334 ParameterType.prototype.getOrMakeConcreteType = function(typeArgs) { | 19810 ParameterType.prototype.getOrMakeConcreteType = function(typeArgs) { |
| 20335 world.internalError('no concrete types of type parameters yet', this.get$span(
)); | 19811 world.internalError('no concrete types of type parameters yet', this.get$span(
)); |
| 20336 } | 19812 } |
| 20337 ParameterType.prototype.resolveTypeParams = function(inType) { | 19813 ParameterType.prototype.resolveTypeParams = function(inType) { |
| 20338 var $0; | 19814 return inType.typeArguments.$index(this.name); |
| 20339 return (($0 = inType.typeArguments.$index(this.name)) && $0.is$lang_Type()); | |
| 20340 } | 19815 } |
| 20341 ParameterType.prototype.addDirectSubtype = function(type) { | 19816 ParameterType.prototype.addDirectSubtype = function(type) { |
| 20342 world.internalError('no subtypes of type parameters yet', this.get$span()); | 19817 world.internalError('no subtypes of type parameters yet', this.get$span()); |
| 20343 } | 19818 } |
| 20344 ParameterType.prototype.resolve = function(inType) { | 19819 ParameterType.prototype.resolve = function(inType) { |
| 20345 if (this.typeParameter.extendsType != null) { | 19820 if (this.typeParameter.extendsType != null) { |
| 20346 this.extendsType = inType.resolveType(this.typeParameter.extendsType, true); | 19821 this.extendsType = inType.resolveType(this.typeParameter.extendsType, true); |
| 20347 } | 19822 } |
| 20348 else { | 19823 else { |
| 20349 this.extendsType = world.objectType; | 19824 this.extendsType = world.objectType; |
| 20350 } | 19825 } |
| 20351 } | 19826 } |
| 20352 ParameterType.prototype.addDirectSubtype$1 = function($0) { | 19827 ParameterType.prototype.addDirectSubtype$1 = function($0) { |
| 20353 return this.addDirectSubtype(($0 && $0.is$lang_Type())); | 19828 return this.addDirectSubtype($0); |
| 20354 }; | 19829 }; |
| 20355 ParameterType.prototype.getConstructor$1 = function($0) { | 19830 ParameterType.prototype.getConstructor$1 = function($0) { |
| 20356 return this.getConstructor($assert_String($0)); | 19831 return this.getConstructor($0); |
| 20357 }; | 19832 }; |
| 20358 ParameterType.prototype.getOrMakeConcreteType$1 = function($0) { | 19833 ParameterType.prototype.getOrMakeConcreteType$1 = function($0) { |
| 20359 return this.getOrMakeConcreteType(($0 && $0.is$List$Type())); | 19834 return this.getOrMakeConcreteType($0); |
| 20360 }; | 19835 }; |
| 20361 ParameterType.prototype.isSubtypeOf$1 = function($0) { | 19836 ParameterType.prototype.isSubtypeOf$1 = function($0) { |
| 20362 return this.isSubtypeOf(($0 && $0.is$lang_Type())); | 19837 return this.isSubtypeOf($0); |
| 20363 }; | 19838 }; |
| 20364 ParameterType.prototype.resolve$1 = function($0) { | 19839 ParameterType.prototype.resolve$1 = function($0) { |
| 20365 return this.resolve(($0 && $0.is$lang_Type())); | 19840 return this.resolve($0); |
| 20366 }; | 19841 }; |
| 20367 ParameterType.prototype.resolveMember$1 = function($0) { | 19842 ParameterType.prototype.resolveMember$1 = function($0) { |
| 20368 return this.resolveMember($assert_String($0)); | 19843 return this.resolveMember($0); |
| 20369 }; | 19844 }; |
| 20370 ParameterType.prototype.resolveTypeParams$1 = function($0) { | 19845 ParameterType.prototype.resolveTypeParams$1 = function($0) { |
| 20371 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); | 19846 return this.resolveTypeParams($0); |
| 20372 }; | 19847 }; |
| 20373 // ********** Code for NonNullableType ************** | 19848 // ********** Code for NonNullableType ************** |
| 20374 function NonNullableType(type) { | 19849 function NonNullableType(type) { |
| 20375 this.type = type; | 19850 this.type = type; |
| 20376 lang_Type.call(this, type.name); | 19851 lang_Type.call(this, type.name); |
| 20377 // Initializers done | 19852 // Initializers done |
| 20378 } | 19853 } |
| 20379 $inherits(NonNullableType, lang_Type); | 19854 $inherits(NonNullableType, lang_Type); |
| 20380 NonNullableType.prototype.get$type = function() { return this.type; }; | |
| 20381 NonNullableType.prototype.get$isNullable = function() { | 19855 NonNullableType.prototype.get$isNullable = function() { |
| 20382 return false; | 19856 return false; |
| 20383 } | 19857 } |
| 20384 NonNullableType.prototype.get$isBool = function() { | 19858 NonNullableType.prototype.get$isBool = function() { |
| 20385 return this.type.get$isBool(); | 19859 return this.type.get$isBool(); |
| 20386 } | 19860 } |
| 20387 NonNullableType.prototype.get$isUsed = function() { | 19861 NonNullableType.prototype.get$isUsed = function() { |
| 20388 return false; | 19862 return false; |
| 20389 } | 19863 } |
| 20390 NonNullableType.prototype.isSubtypeOf = function(other) { | 19864 NonNullableType.prototype.isSubtypeOf = function(other) { |
| 20391 return $eq(this, other) || $eq(this.type, other) || $notnull_bool(this.type.is
SubtypeOf(other)); | 19865 return $eq(this, other) || $eq(this.type, other) || this.type.isSubtypeOf(othe
r); |
| 20392 } | 19866 } |
| 20393 NonNullableType.prototype.resolveType = function(node, isRequired) { | 19867 NonNullableType.prototype.resolveType = function(node, isRequired) { |
| 20394 return this.type.resolveType(node, isRequired); | 19868 return this.type.resolveType(node, isRequired); |
| 20395 } | 19869 } |
| 20396 NonNullableType.prototype.resolveTypeParams = function(inType) { | 19870 NonNullableType.prototype.resolveTypeParams = function(inType) { |
| 20397 return this.type.resolveTypeParams(inType); | 19871 return this.type.resolveTypeParams(inType); |
| 20398 } | 19872 } |
| 20399 NonNullableType.prototype.addDirectSubtype = function(subtype) { | 19873 NonNullableType.prototype.addDirectSubtype = function(subtype) { |
| 20400 this.type.addDirectSubtype(subtype); | 19874 this.type.addDirectSubtype(subtype); |
| 20401 } | 19875 } |
| 20402 NonNullableType.prototype.markUsed = function() { | 19876 NonNullableType.prototype.markUsed = function() { |
| 20403 this.type.markUsed(); | 19877 this.type.markUsed(); |
| 20404 } | 19878 } |
| 20405 NonNullableType.prototype.genMethod = function(method) { | 19879 NonNullableType.prototype.genMethod = function(method) { |
| 20406 this.type.genMethod(method); | 19880 this.type.genMethod(method); |
| 20407 } | 19881 } |
| 20408 NonNullableType.prototype.get$span = function() { | 19882 NonNullableType.prototype.get$span = function() { |
| 20409 return this.type.get$span(); | 19883 return this.type.get$span(); |
| 20410 } | 19884 } |
| 20411 NonNullableType.prototype.resolveMember = function(name) { | 19885 NonNullableType.prototype.resolveMember = function(name) { |
| 20412 return this.type.resolveMember(name); | 19886 return this.type.resolveMember(name); |
| 20413 } | 19887 } |
| 20414 NonNullableType.prototype.getMember = function(name) { | 19888 NonNullableType.prototype.getMember = function(name) { |
| 20415 return this.type.getMember(name); | 19889 return this.type.getMember(name); |
| 20416 } | 19890 } |
| 20417 NonNullableType.prototype.getConstructor = function(name) { | 19891 NonNullableType.prototype.getConstructor = function(name) { |
| 20418 var $0; | 19892 return this.type.getConstructor(name); |
| 20419 return (($0 = this.type.getConstructor(name)) && $0.is$MethodMember()); | |
| 20420 } | 19893 } |
| 20421 NonNullableType.prototype.getFactory = function(t, name) { | 19894 NonNullableType.prototype.getFactory = function(t, name) { |
| 20422 var $0; | 19895 return this.type.getFactory(t, name); |
| 20423 return (($0 = this.type.getFactory(t, name)) && $0.is$MethodMember()); | |
| 20424 } | 19896 } |
| 20425 NonNullableType.prototype.getOrMakeConcreteType = function(typeArgs) { | 19897 NonNullableType.prototype.getOrMakeConcreteType = function(typeArgs) { |
| 20426 return this.type.getOrMakeConcreteType(typeArgs); | 19898 return this.type.getOrMakeConcreteType(typeArgs); |
| 20427 } | 19899 } |
| 20428 NonNullableType.prototype.get$constructors = function() { | 19900 NonNullableType.prototype.get$constructors = function() { |
| 20429 return this.type.get$constructors(); | 19901 return this.type.get$constructors(); |
| 20430 } | 19902 } |
| 20431 NonNullableType.prototype.get$isClass = function() { | 19903 NonNullableType.prototype.get$isClass = function() { |
| 20432 return this.type.get$isClass(); | 19904 return this.type.get$isClass(); |
| 20433 } | 19905 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 20455 NonNullableType.prototype.get$members = function() { | 19927 NonNullableType.prototype.get$members = function() { |
| 20456 return this.type.get$members(); | 19928 return this.type.get$members(); |
| 20457 } | 19929 } |
| 20458 NonNullableType.prototype.get$definition = function() { | 19930 NonNullableType.prototype.get$definition = function() { |
| 20459 return this.type.get$definition(); | 19931 return this.type.get$definition(); |
| 20460 } | 19932 } |
| 20461 NonNullableType.prototype.get$factories = function() { | 19933 NonNullableType.prototype.get$factories = function() { |
| 20462 return this.type.get$factories(); | 19934 return this.type.get$factories(); |
| 20463 } | 19935 } |
| 20464 NonNullableType.prototype.get$typeArgsInOrder = function() { | 19936 NonNullableType.prototype.get$typeArgsInOrder = function() { |
| 20465 var $0; | 19937 return this.type.get$typeArgsInOrder(); |
| 20466 return (($0 = this.type.get$typeArgsInOrder()) && $0.is$Collection$Type()); | |
| 20467 } | 19938 } |
| 20468 NonNullableType.prototype.get$genericType = function() { | 19939 NonNullableType.prototype.get$genericType = function() { |
| 20469 return this.type.get$genericType(); | 19940 return this.type.get$genericType(); |
| 20470 } | 19941 } |
| 20471 NonNullableType.prototype.get$interfaces = function() { | 19942 NonNullableType.prototype.get$interfaces = function() { |
| 20472 return this.type.get$interfaces(); | 19943 return this.type.get$interfaces(); |
| 20473 } | 19944 } |
| 20474 NonNullableType.prototype.get$parent = function() { | 19945 NonNullableType.prototype.get$parent = function() { |
| 20475 return this.type.get$parent(); | 19946 return this.type.get$parent(); |
| 20476 } | 19947 } |
| 20477 NonNullableType.prototype.getAllMembers = function() { | 19948 NonNullableType.prototype.getAllMembers = function() { |
| 20478 return this.type.getAllMembers(); | 19949 return this.type.getAllMembers(); |
| 20479 } | 19950 } |
| 20480 NonNullableType.prototype.get$isNativeType = function() { | 19951 NonNullableType.prototype.get$isNativeType = function() { |
| 20481 return this.type.get$isNativeType(); | 19952 return this.type.get$isNativeType(); |
| 20482 } | 19953 } |
| 20483 NonNullableType.prototype.addDirectSubtype$1 = function($0) { | 19954 NonNullableType.prototype.addDirectSubtype$1 = function($0) { |
| 20484 return this.addDirectSubtype(($0 && $0.is$lang_Type())); | 19955 return this.addDirectSubtype($0); |
| 20485 }; | 19956 }; |
| 20486 NonNullableType.prototype.getConstructor$1 = function($0) { | 19957 NonNullableType.prototype.getConstructor$1 = function($0) { |
| 20487 return this.getConstructor($assert_String($0)); | 19958 return this.getConstructor($0); |
| 20488 }; | 19959 }; |
| 20489 NonNullableType.prototype.getFactory$2 = function($0, $1) { | 19960 NonNullableType.prototype.getFactory$2 = function($0, $1) { |
| 20490 return this.getFactory(($0 && $0.is$lang_Type()), $assert_String($1)); | 19961 return this.getFactory($0, $1); |
| 20491 }; | 19962 }; |
| 20492 NonNullableType.prototype.getMember$1 = function($0) { | 19963 NonNullableType.prototype.getMember$1 = function($0) { |
| 20493 return this.getMember($assert_String($0)); | 19964 return this.getMember($0); |
| 20494 }; | 19965 }; |
| 20495 NonNullableType.prototype.getOrMakeConcreteType$1 = function($0) { | 19966 NonNullableType.prototype.getOrMakeConcreteType$1 = function($0) { |
| 20496 return this.getOrMakeConcreteType(($0 && $0.is$List$Type())); | 19967 return this.getOrMakeConcreteType($0); |
| 20497 }; | 19968 }; |
| 20498 NonNullableType.prototype.isSubtypeOf$1 = function($0) { | 19969 NonNullableType.prototype.isSubtypeOf$1 = function($0) { |
| 20499 return this.isSubtypeOf(($0 && $0.is$lang_Type())); | 19970 return this.isSubtypeOf($0); |
| 20500 }; | 19971 }; |
| 20501 NonNullableType.prototype.markUsed$0 = function() { | 19972 NonNullableType.prototype.markUsed$0 = function() { |
| 20502 return this.markUsed(); | 19973 return this.markUsed(); |
| 20503 }; | 19974 }; |
| 20504 NonNullableType.prototype.resolveMember$1 = function($0) { | 19975 NonNullableType.prototype.resolveMember$1 = function($0) { |
| 20505 return this.resolveMember($assert_String($0)); | 19976 return this.resolveMember($0); |
| 20506 }; | 19977 }; |
| 20507 NonNullableType.prototype.resolveTypeParams$1 = function($0) { | 19978 NonNullableType.prototype.resolveTypeParams$1 = function($0) { |
| 20508 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); | 19979 return this.resolveTypeParams($0); |
| 20509 }; | 19980 }; |
| 20510 // ********** Code for ConcreteType ************** | 19981 // ********** Code for ConcreteType ************** |
| 20511 function ConcreteType(name, genericType, typeArguments, typeArgsInOrder) { | 19982 function ConcreteType(name, genericType, typeArguments, typeArgsInOrder) { |
| 20512 this.genericType = genericType; | 19983 this.genericType = genericType; |
| 20513 this.typeArguments = typeArguments; | 19984 this.typeArguments = typeArguments; |
| 20514 this.typeArgsInOrder = typeArgsInOrder; | 19985 this.typeArgsInOrder = typeArgsInOrder; |
| 20515 this.constructors = $map([]); | 19986 this.constructors = $map([]); |
| 20516 this.members = $map([]); | 19987 this.members = $map([]); |
| 20517 this.factories = new FactoryMap(); | 19988 this.factories = new FactoryMap(); |
| 20518 lang_Type.call(this, name); | 19989 lang_Type.call(this, name); |
| 20519 // Initializers done | 19990 // Initializers done |
| 20520 } | 19991 } |
| 20521 $inherits(ConcreteType, lang_Type); | 19992 $inherits(ConcreteType, lang_Type); |
| 20522 ConcreteType.prototype.is$ConcreteType = function(){return this;}; | |
| 20523 ConcreteType.prototype.get$genericType = function() { return this.genericType; }
; | 19993 ConcreteType.prototype.get$genericType = function() { return this.genericType; }
; |
| 20524 ConcreteType.prototype.get$typeArgsInOrder = function() { return this.typeArgsIn
Order; }; | 19994 ConcreteType.prototype.get$typeArgsInOrder = function() { return this.typeArgsIn
Order; }; |
| 20525 ConcreteType.prototype.set$typeArgsInOrder = function(value) { return this.typeA
rgsInOrder = value; }; | 19995 ConcreteType.prototype.set$typeArgsInOrder = function(value) { return this.typeA
rgsInOrder = value; }; |
| 20526 ConcreteType.prototype.get$isList = function() { | 19996 ConcreteType.prototype.get$isList = function() { |
| 20527 return this.genericType.get$isList(); | 19997 return this.genericType.get$isList(); |
| 20528 } | 19998 } |
| 20529 ConcreteType.prototype.get$isClass = function() { | 19999 ConcreteType.prototype.get$isClass = function() { |
| 20530 return this.genericType.isClass; | 20000 return this.genericType.isClass; |
| 20531 } | 20001 } |
| 20532 ConcreteType.prototype.get$library = function() { | 20002 ConcreteType.prototype.get$library = function() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 20547 ConcreteType.prototype.set$constructors = function(value) { return this.construc
tors = value; }; | 20017 ConcreteType.prototype.set$constructors = function(value) { return this.construc
tors = value; }; |
| 20548 ConcreteType.prototype.get$factories = function() { return this.factories; }; | 20018 ConcreteType.prototype.get$factories = function() { return this.factories; }; |
| 20549 ConcreteType.prototype.set$factories = function(value) { return this.factories =
value; }; | 20019 ConcreteType.prototype.set$factories = function(value) { return this.factories =
value; }; |
| 20550 ConcreteType.prototype.resolveTypeParams = function(inType) { | 20020 ConcreteType.prototype.resolveTypeParams = function(inType) { |
| 20551 var newTypeArgs = []; | 20021 var newTypeArgs = []; |
| 20552 var needsNewType = false; | 20022 var needsNewType = false; |
| 20553 var $list = this.typeArgsInOrder; | 20023 var $list = this.typeArgsInOrder; |
| 20554 for (var $i = 0;$i < $list.length; $i++) { | 20024 for (var $i = 0;$i < $list.length; $i++) { |
| 20555 var t = $list.$index($i); | 20025 var t = $list.$index($i); |
| 20556 var newType = t.resolveTypeParams$1(inType); | 20026 var newType = t.resolveTypeParams$1(inType); |
| 20557 if ($notnull_bool($ne(newType, t))) needsNewType = true; | 20027 if ($ne(newType, t)) needsNewType = true; |
| 20558 newTypeArgs.add$1(newType); | 20028 newTypeArgs.add$1(newType); |
| 20559 } | 20029 } |
| 20560 if (!$notnull_bool(needsNewType)) return this; | 20030 if (!needsNewType) return this; |
| 20561 return this.genericType.getOrMakeConcreteType((newTypeArgs && newTypeArgs.is$L
ist$Type())); | 20031 return this.genericType.getOrMakeConcreteType(newTypeArgs); |
| 20562 } | 20032 } |
| 20563 ConcreteType.prototype.getOrMakeConcreteType = function(typeArgs) { | 20033 ConcreteType.prototype.getOrMakeConcreteType = function(typeArgs) { |
| 20564 return this.genericType.getOrMakeConcreteType(typeArgs); | 20034 return this.genericType.getOrMakeConcreteType(typeArgs); |
| 20565 } | 20035 } |
| 20566 ConcreteType.prototype.get$parent = function() { | 20036 ConcreteType.prototype.get$parent = function() { |
| 20567 return this.genericType.get$parent(); | 20037 return this.genericType.get$parent(); |
| 20568 } | 20038 } |
| 20569 ConcreteType.prototype.get$interfaces = function() { | 20039 ConcreteType.prototype.get$interfaces = function() { |
| 20570 if (this._interfaces == null && this.genericType.interfaces != null) { | 20040 if (this._interfaces == null && this.genericType.interfaces != null) { |
| 20571 this._interfaces = []; | 20041 this._interfaces = []; |
| 20572 var $list = this.genericType.interfaces; | 20042 var $list = this.genericType.interfaces; |
| 20573 for (var $i = 0;$i < $list.length; $i++) { | 20043 for (var $i = 0;$i < $list.length; $i++) { |
| 20574 var i = $list.$index($i); | 20044 var i = $list.$index($i); |
| 20575 this._interfaces.add(i.resolveTypeParams$1(this)); | 20045 this._interfaces.add(i.resolveTypeParams$1(this)); |
| 20576 } | 20046 } |
| 20577 } | 20047 } |
| 20578 return this._interfaces; | 20048 return this._interfaces; |
| 20579 } | 20049 } |
| 20580 ConcreteType.prototype.getCallMethod = function() { | 20050 ConcreteType.prototype.getCallMethod = function() { |
| 20581 return this.genericType.getCallMethod(); | 20051 return this.genericType.getCallMethod(); |
| 20582 } | 20052 } |
| 20583 ConcreteType.prototype.getAllMembers = function() { | 20053 ConcreteType.prototype.getAllMembers = function() { |
| 20584 var result = this.genericType.getAllMembers(); | 20054 var result = this.genericType.getAllMembers(); |
| 20585 var $list = result.getKeys$0(); | 20055 var $list = result.getKeys$0(); |
| 20586 for (var $i = result.getKeys$0().iterator(); $i.hasNext$0(); ) { | 20056 for (var $i = result.getKeys$0().iterator(); $i.hasNext$0(); ) { |
| 20587 var memberName = $i.next$0(); | 20057 var memberName = $i.next$0(); |
| 20588 var myMember = this.members.$index(memberName); | 20058 var myMember = this.members.$index(memberName); |
| 20589 if ($notnull_bool($ne(myMember, null))) { | 20059 if ($ne(myMember, null)) { |
| 20590 result.$setindex(memberName, myMember); | 20060 result.$setindex(memberName, myMember); |
| 20591 } | 20061 } |
| 20592 } | 20062 } |
| 20593 return (result && result.is$Map$String$Member()); | 20063 return result; |
| 20594 } | 20064 } |
| 20595 ConcreteType.prototype.markUsed = function() { | 20065 ConcreteType.prototype.markUsed = function() { |
| 20596 this.genericType.markUsed(); | 20066 this.genericType.markUsed(); |
| 20597 } | 20067 } |
| 20598 ConcreteType.prototype.genMethod = function(method) { | 20068 ConcreteType.prototype.genMethod = function(method) { |
| 20599 this.genericType.genMethod(method); | 20069 this.genericType.genMethod(method); |
| 20600 } | 20070 } |
| 20601 ConcreteType.prototype.getFactory = function(type, constructorName) { | 20071 ConcreteType.prototype.getFactory = function(type, constructorName) { |
| 20602 return this.genericType.getFactory(type, constructorName); | 20072 return this.genericType.getFactory(type, constructorName); |
| 20603 } | 20073 } |
| 20604 ConcreteType.prototype.getConstructor = function(constructorName) { | 20074 ConcreteType.prototype.getConstructor = function(constructorName) { |
| 20605 var ret = this.constructors.$index(constructorName); | 20075 var ret = this.constructors.$index(constructorName); |
| 20606 if ($notnull_bool($ne(ret, null))) return ret; | 20076 if ($ne(ret, null)) return ret; |
| 20607 ret = this.factories.getFactory(this.name, constructorName); | 20077 ret = this.factories.getFactory(this.name, constructorName); |
| 20608 if ($notnull_bool($ne(ret, null))) return ret; | 20078 if ($ne(ret, null)) return ret; |
| 20609 var genericMember = this.genericType.getConstructor(constructorName); | 20079 var genericMember = this.genericType.getConstructor(constructorName); |
| 20610 if ($notnull_bool(genericMember == null)) return null; | 20080 if (genericMember == null) return null; |
| 20611 if ($ne(genericMember.declaringType, this.genericType)) { | 20081 if ($ne(genericMember.declaringType, this.genericType)) { |
| 20612 if (!$notnull_bool(genericMember.declaringType.get$isGeneric())) return gene
ricMember; | 20082 if (!genericMember.declaringType.get$isGeneric()) return genericMember; |
| 20613 var newDeclaringType = genericMember.declaringType.getOrMakeConcreteType(thi
s.typeArgsInOrder); | 20083 var newDeclaringType = genericMember.declaringType.getOrMakeConcreteType(thi
s.typeArgsInOrder); |
| 20614 var factory = newDeclaringType.getFactory$2(this.genericType, constructorNam
e); | 20084 var factory = newDeclaringType.getFactory$2(this.genericType, constructorNam
e); |
| 20615 if (factory != null) return factory; | 20085 if (factory != null) return factory; |
| 20616 return newDeclaringType.getConstructor$1(constructorName); | 20086 return newDeclaringType.getConstructor$1(constructorName); |
| 20617 } | 20087 } |
| 20618 if ($notnull_bool(genericMember.get$isFactory())) { | 20088 if (genericMember.get$isFactory()) { |
| 20619 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gen
ericMember); | 20089 ret = new ConcreteMember(genericMember.get$name(), this, genericMember); |
| 20620 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member(
))); | 20090 this.factories.addFactory(this.name, constructorName, ret); |
| 20621 } | 20091 } |
| 20622 else { | 20092 else { |
| 20623 ret = new ConcreteMember(this.name, this, genericMember); | 20093 ret = new ConcreteMember(this.name, this, genericMember); |
| 20624 this.constructors.$setindex(constructorName, ret); | 20094 this.constructors.$setindex(constructorName, ret); |
| 20625 } | 20095 } |
| 20626 return ret; | 20096 return ret; |
| 20627 } | 20097 } |
| 20628 ConcreteType.prototype.getMember = function(memberName) { | 20098 ConcreteType.prototype.getMember = function(memberName) { |
| 20629 var ret = this.members.$index(memberName); | 20099 var ret = this.members.$index(memberName); |
| 20630 if ($notnull_bool($ne(ret, null))) return (ret && ret.is$Member()); | 20100 if ($ne(ret, null)) return ret; |
| 20631 var genericMember = this.genericType.getMember(memberName); | 20101 var genericMember = this.genericType.getMember(memberName); |
| 20632 if ($notnull_bool(genericMember == null)) return null; | 20102 if (genericMember == null) return null; |
| 20633 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gener
icMember); | 20103 ret = new ConcreteMember(genericMember.get$name(), this, genericMember); |
| 20634 this.members.$setindex(memberName, ret); | 20104 this.members.$setindex(memberName, ret); |
| 20635 return (ret && ret.is$Member()); | 20105 return ret; |
| 20636 } | 20106 } |
| 20637 ConcreteType.prototype.resolveMember = function(memberName) { | 20107 ConcreteType.prototype.resolveMember = function(memberName) { |
| 20638 var mem = this.getMember(memberName); | 20108 var mem = this.getMember(memberName); |
| 20639 if ($notnull_bool(mem == null)) return null; | 20109 if (mem == null) return null; |
| 20640 var ret = new MemberSet((mem && mem.is$Member()), false); | 20110 var ret = new MemberSet(mem, false); |
| 20641 if ($notnull_bool(mem.get$isStatic())) return (ret && ret.is$MemberSet()); | 20111 if (mem.get$isStatic()) return ret; |
| 20642 var $list = this.genericType.get$subtypes(); | 20112 var $list = this.genericType.get$subtypes(); |
| 20643 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext$0(); ) { | 20113 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext$0(); ) { |
| 20644 var t = $i.next$0(); | 20114 var t = $i.next$0(); |
| 20645 var m = t.get$members().$index(memberName); | 20115 var m = t.get$members().$index(memberName); |
| 20646 if ($notnull_bool($ne(m, null))) ret.add$1(m); | 20116 if ($ne(m, null)) ret.add$1(m); |
| 20647 } | 20117 } |
| 20648 return (ret && ret.is$MemberSet()); | 20118 return ret; |
| 20649 } | 20119 } |
| 20650 ConcreteType.prototype.resolveType = function(node, isRequired) { | 20120 ConcreteType.prototype.resolveType = function(node, isRequired) { |
| 20651 var ret = this.genericType.resolveType(node, isRequired); | 20121 var ret = this.genericType.resolveType(node, isRequired); |
| 20652 return (ret && ret.is$lang_Type()); | 20122 return ret; |
| 20653 } | 20123 } |
| 20654 ConcreteType.prototype.addDirectSubtype = function(type) { | 20124 ConcreteType.prototype.addDirectSubtype = function(type) { |
| 20655 this.genericType.addDirectSubtype(type); | 20125 this.genericType.addDirectSubtype(type); |
| 20656 } | 20126 } |
| 20657 ConcreteType.prototype.addDirectSubtype$1 = function($0) { | 20127 ConcreteType.prototype.addDirectSubtype$1 = function($0) { |
| 20658 return this.addDirectSubtype(($0 && $0.is$lang_Type())); | 20128 return this.addDirectSubtype($0); |
| 20659 }; | 20129 }; |
| 20660 ConcreteType.prototype.getConstructor$1 = function($0) { | 20130 ConcreteType.prototype.getConstructor$1 = function($0) { |
| 20661 return this.getConstructor($assert_String($0)); | 20131 return this.getConstructor($0); |
| 20662 }; | 20132 }; |
| 20663 ConcreteType.prototype.getFactory$2 = function($0, $1) { | 20133 ConcreteType.prototype.getFactory$2 = function($0, $1) { |
| 20664 return this.getFactory(($0 && $0.is$lang_Type()), $assert_String($1)); | 20134 return this.getFactory($0, $1); |
| 20665 }; | 20135 }; |
| 20666 ConcreteType.prototype.getMember$1 = function($0) { | 20136 ConcreteType.prototype.getMember$1 = function($0) { |
| 20667 return this.getMember($assert_String($0)); | 20137 return this.getMember($0); |
| 20668 }; | 20138 }; |
| 20669 ConcreteType.prototype.getOrMakeConcreteType$1 = function($0) { | 20139 ConcreteType.prototype.getOrMakeConcreteType$1 = function($0) { |
| 20670 return this.getOrMakeConcreteType(($0 && $0.is$List$Type())); | 20140 return this.getOrMakeConcreteType($0); |
| 20671 }; | 20141 }; |
| 20672 ConcreteType.prototype.markUsed$0 = function() { | 20142 ConcreteType.prototype.markUsed$0 = function() { |
| 20673 return this.markUsed(); | 20143 return this.markUsed(); |
| 20674 }; | 20144 }; |
| 20675 ConcreteType.prototype.resolveMember$1 = function($0) { | 20145 ConcreteType.prototype.resolveMember$1 = function($0) { |
| 20676 return this.resolveMember($assert_String($0)); | 20146 return this.resolveMember($0); |
| 20677 }; | 20147 }; |
| 20678 ConcreteType.prototype.resolveTypeParams$1 = function($0) { | 20148 ConcreteType.prototype.resolveTypeParams$1 = function($0) { |
| 20679 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); | 20149 return this.resolveTypeParams($0); |
| 20680 }; | 20150 }; |
| 20681 // ********** Code for DefinedType ************** | 20151 // ********** Code for DefinedType ************** |
| 20682 function DefinedType(name, library, definition, isClass) { | 20152 function DefinedType(name, library, definition, isClass) { |
| 20683 this.isUsed = false | 20153 this.isUsed = false |
| 20684 this.isNativeType = false | 20154 this.isNativeType = false |
| 20685 this.library = library; | 20155 this.library = library; |
| 20686 this.isClass = isClass; | 20156 this.isClass = isClass; |
| 20687 this.directSubtypes = new HashSetImplementation(); | 20157 this.directSubtypes = new HashSetImplementation(); |
| 20688 this.constructors = $map([]); | 20158 this.constructors = $map([]); |
| 20689 this.members = $map([]); | 20159 this.members = $map([]); |
| 20690 this.factories = new FactoryMap(); | 20160 this.factories = new FactoryMap(); |
| 20691 this._resolvedMembers = $map([]); | 20161 this._resolvedMembers = $map([]); |
| 20692 lang_Type.call(this, name); | 20162 lang_Type.call(this, name); |
| 20693 // Initializers done | 20163 // Initializers done |
| 20694 this.setDefinition(definition); | 20164 this.setDefinition(definition); |
| 20695 } | 20165 } |
| 20696 $inherits(DefinedType, lang_Type); | 20166 $inherits(DefinedType, lang_Type); |
| 20697 DefinedType.prototype.is$DefinedType = function(){return this;}; | |
| 20698 DefinedType.prototype.get$definition = function() { return this.definition; }; | 20167 DefinedType.prototype.get$definition = function() { return this.definition; }; |
| 20699 DefinedType.prototype.set$definition = function(value) { return this.definition
= value; }; | 20168 DefinedType.prototype.set$definition = function(value) { return this.definition
= value; }; |
| 20700 DefinedType.prototype.get$library = function() { return this.library; }; | 20169 DefinedType.prototype.get$library = function() { return this.library; }; |
| 20701 DefinedType.prototype.get$isClass = function() { return this.isClass; }; | 20170 DefinedType.prototype.get$isClass = function() { return this.isClass; }; |
| 20702 DefinedType.prototype.get$parent = function() { | 20171 DefinedType.prototype.get$parent = function() { |
| 20703 return this._parent; | 20172 return this._parent; |
| 20704 } | 20173 } |
| 20705 DefinedType.prototype.set$parent = function(p) { | 20174 DefinedType.prototype.set$parent = function(p) { |
| 20706 this._parent = p; | 20175 this._parent = p; |
| 20707 } | 20176 } |
| 20708 DefinedType.prototype.get$interfaces = function() { return this.interfaces; }; | 20177 DefinedType.prototype.get$interfaces = function() { return this.interfaces; }; |
| 20709 DefinedType.prototype.set$interfaces = function(value) { return this.interfaces
= value; }; | 20178 DefinedType.prototype.set$interfaces = function(value) { return this.interfaces
= value; }; |
| 20710 DefinedType.prototype.get$typeParameters = function() { return this.typeParamete
rs; }; | 20179 DefinedType.prototype.get$typeParameters = function() { return this.typeParamete
rs; }; |
| 20711 DefinedType.prototype.set$typeParameters = function(value) { return this.typePar
ameters = value; }; | 20180 DefinedType.prototype.set$typeParameters = function(value) { return this.typePar
ameters = value; }; |
| 20712 DefinedType.prototype.get$constructors = function() { return this.constructors;
}; | 20181 DefinedType.prototype.get$constructors = function() { return this.constructors;
}; |
| 20713 DefinedType.prototype.set$constructors = function(value) { return this.construct
ors = value; }; | 20182 DefinedType.prototype.set$constructors = function(value) { return this.construct
ors = value; }; |
| 20714 DefinedType.prototype.get$members = function() { return this.members; }; | 20183 DefinedType.prototype.get$members = function() { return this.members; }; |
| 20715 DefinedType.prototype.set$members = function(value) { return this.members = valu
e; }; | 20184 DefinedType.prototype.set$members = function(value) { return this.members = valu
e; }; |
| 20716 DefinedType.prototype.get$factories = function() { return this.factories; }; | 20185 DefinedType.prototype.get$factories = function() { return this.factories; }; |
| 20717 DefinedType.prototype.set$factories = function(value) { return this.factories =
value; }; | 20186 DefinedType.prototype.set$factories = function(value) { return this.factories =
value; }; |
| 20718 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; | 20187 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; |
| 20719 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value;
}; | 20188 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value;
}; |
| 20720 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType;
}; | 20189 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType;
}; |
| 20721 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT
ype = value; }; | 20190 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT
ype = value; }; |
| 20722 DefinedType.prototype.setDefinition = function(def) { | 20191 DefinedType.prototype.setDefinition = function(def) { |
| 20723 $assert(this.definition == null, "definition == null", "type.dart", 630, 12); | |
| 20724 this.definition = def; | 20192 this.definition = def; |
| 20725 if ((this.definition instanceof TypeDefinition) && this.definition.get$nativeT
ype() != null) { | 20193 if ((this.definition instanceof TypeDefinition) && this.definition.get$nativeT
ype() != null) { |
| 20726 this.isNativeType = true; | 20194 this.isNativeType = true; |
| 20727 } | 20195 } |
| 20728 if (this.definition != null && this.definition.get$typeParameters() != null) { | 20196 if (this.definition != null && this.definition.get$typeParameters() != null) { |
| 20729 this._concreteTypes = $map([]); | 20197 this._concreteTypes = $map([]); |
| 20730 this.typeParameters = []; | 20198 this.typeParameters = []; |
| 20731 var $list = this.definition.get$typeParameters(); | 20199 var $list = this.definition.get$typeParameters(); |
| 20732 for (var $i = 0;$i < $list.length; $i++) { | 20200 for (var $i = 0;$i < $list.length; $i++) { |
| 20733 var tp = $list.$index($i); | 20201 var tp = $list.$index($i); |
| 20734 var paramName = tp.get$name().get$name(); | 20202 var paramName = tp.get$name().get$name(); |
| 20735 this.typeParameters.add(new ParameterType($assert_String(paramName), tp)); | 20203 this.typeParameters.add(new ParameterType(paramName, tp)); |
| 20736 } | 20204 } |
| 20737 } | 20205 } |
| 20738 } | 20206 } |
| 20739 DefinedType.prototype.get$typeArgsInOrder = function() { | 20207 DefinedType.prototype.get$typeArgsInOrder = function() { |
| 20740 if (this.typeParameters == null) return null; | 20208 if (this.typeParameters == null) return null; |
| 20741 if (this._typeArgsInOrder == null) { | 20209 if (this._typeArgsInOrder == null) { |
| 20742 this._typeArgsInOrder = new FixedCollection$Type(world.varType, this.typePar
ameters.length); | 20210 this._typeArgsInOrder = new FixedCollection$Type(world.varType, this.typePar
ameters.length); |
| 20743 } | 20211 } |
| 20744 return this._typeArgsInOrder; | 20212 return this._typeArgsInOrder; |
| 20745 } | 20213 } |
| 20746 DefinedType.prototype.get$isVar = function() { | 20214 DefinedType.prototype.get$isVar = function() { |
| 20747 return $eq(this, world.varType); | 20215 return $eq(this, world.varType); |
| 20748 } | 20216 } |
| 20749 DefinedType.prototype.get$isVoid = function() { | 20217 DefinedType.prototype.get$isVoid = function() { |
| 20750 return $eq(this, world.voidType); | 20218 return $eq(this, world.voidType); |
| 20751 } | 20219 } |
| 20752 DefinedType.prototype.get$isTop = function() { | 20220 DefinedType.prototype.get$isTop = function() { |
| 20753 return this.name == null; | 20221 return this.name == null; |
| 20754 } | 20222 } |
| 20755 DefinedType.prototype.get$isObject = function() { | 20223 DefinedType.prototype.get$isObject = function() { |
| 20756 return $notnull_bool(this.library.get$isCore()) && this.name == 'Object'; | 20224 return this.library.get$isCore() && this.name == 'Object'; |
| 20757 } | 20225 } |
| 20758 DefinedType.prototype.get$isString = function() { | 20226 DefinedType.prototype.get$isString = function() { |
| 20759 return $notnull_bool(this.library.get$isCore()) && this.name == 'String' || $n
otnull_bool(this.library.get$isCoreImpl()) && this.name == 'StringImplementation
'; | 20227 return this.library.get$isCore() && this.name == 'String' || this.library.get$
isCoreImpl() && this.name == 'StringImplementation'; |
| 20760 } | 20228 } |
| 20761 DefinedType.prototype.get$isBool = function() { | 20229 DefinedType.prototype.get$isBool = function() { |
| 20762 return $notnull_bool(this.library.get$isCore()) && this.name == 'bool'; | 20230 return this.library.get$isCore() && this.name == 'bool'; |
| 20763 } | 20231 } |
| 20764 DefinedType.prototype.get$isFunction = function() { | 20232 DefinedType.prototype.get$isFunction = function() { |
| 20765 return $notnull_bool(this.library.get$isCore()) && this.name == 'Function'; | 20233 return this.library.get$isCore() && this.name == 'Function'; |
| 20766 } | 20234 } |
| 20767 DefinedType.prototype.get$isList = function() { | 20235 DefinedType.prototype.get$isList = function() { |
| 20768 return $notnull_bool(this.library.get$isCore()) && this.name == 'List'; | 20236 return this.library.get$isCore() && this.name == 'List'; |
| 20769 } | 20237 } |
| 20770 DefinedType.prototype.get$isGeneric = function() { | 20238 DefinedType.prototype.get$isGeneric = function() { |
| 20771 return this.typeParameters != null; | 20239 return this.typeParameters != null; |
| 20772 } | 20240 } |
| 20773 DefinedType.prototype.get$span = function() { | 20241 DefinedType.prototype.get$span = function() { |
| 20774 var $0; | 20242 return this.definition == null ? null : this.definition.span; |
| 20775 return (($0 = this.definition == null ? null : this.definition.span) && $0.is$
SourceSpan()); | |
| 20776 } | 20243 } |
| 20777 DefinedType.prototype.get$typeofName = function() { | 20244 DefinedType.prototype.get$typeofName = function() { |
| 20778 if (!$notnull_bool(this.library.get$isCore())) return null; | 20245 if (!this.library.get$isCore()) return null; |
| 20779 if ($notnull_bool(this.get$isBool())) return 'boolean'; | 20246 if (this.get$isBool()) return 'boolean'; |
| 20780 else if ($notnull_bool(this.get$isNum())) return 'number'; | 20247 else if (this.get$isNum()) return 'number'; |
| 20781 else if ($notnull_bool(this.get$isString())) return 'string'; | 20248 else if (this.get$isString()) return 'string'; |
| 20782 else if ($notnull_bool(this.get$isFunction())) return 'function'; | 20249 else if (this.get$isFunction()) return 'function'; |
| 20783 else return null; | 20250 else return null; |
| 20784 } | 20251 } |
| 20785 DefinedType.prototype.get$isNum = function() { | 20252 DefinedType.prototype.get$isNum = function() { |
| 20786 return this.library != null && $notnull_bool(this.library.get$isCore()) && (th
is.name == 'num' || this.name == 'int' || this.name == 'double'); | 20253 return this.library != null && this.library.get$isCore() && (this.name == 'num
' || this.name == 'int' || this.name == 'double'); |
| 20787 } | 20254 } |
| 20788 DefinedType.prototype.getCallMethod = function() { | 20255 DefinedType.prototype.getCallMethod = function() { |
| 20789 var $0; | 20256 return this.members.$index('\$call'); |
| 20790 return (($0 = this.members.$index('\$call')) && $0.is$MethodMember()); | |
| 20791 } | 20257 } |
| 20792 DefinedType.prototype.getAllMembers = function() { | 20258 DefinedType.prototype.getAllMembers = function() { |
| 20793 return HashMapImplementation.HashMapImplementation$from$factory(this.members); | 20259 return HashMapImplementation.HashMapImplementation$from$factory(this.members); |
| 20794 } | 20260 } |
| 20795 DefinedType.prototype.markUsed = function() { | 20261 DefinedType.prototype.markUsed = function() { |
| 20796 if ($notnull_bool(this.isUsed)) return; | 20262 if (this.isUsed) return; |
| 20797 this.isUsed = true; | 20263 this.isUsed = true; |
| 20798 if (this._lazyGenMethods != null) { | 20264 if (this._lazyGenMethods != null) { |
| 20799 var $list = orderValuesByKeys(this._lazyGenMethods); | 20265 var $list = orderValuesByKeys(this._lazyGenMethods); |
| 20800 for (var $i = 0;$i < $list.length; $i++) { | 20266 for (var $i = 0;$i < $list.length; $i++) { |
| 20801 var method = $list.$index($i); | 20267 var method = $list.$index($i); |
| 20802 world.gen.genMethod((method && method.is$Member())); | 20268 world.gen.genMethod(method); |
| 20803 } | 20269 } |
| 20804 this._lazyGenMethods = null; | 20270 this._lazyGenMethods = null; |
| 20805 } | 20271 } |
| 20806 if (this.get$parent() != null) this.get$parent().markUsed(); | 20272 if (this.get$parent() != null) this.get$parent().markUsed(); |
| 20807 } | 20273 } |
| 20808 DefinedType.prototype.genMethod = function(method) { | 20274 DefinedType.prototype.genMethod = function(method) { |
| 20809 if ($notnull_bool(this.isUsed)) { | 20275 if (this.isUsed) { |
| 20810 world.gen.genMethod(method); | 20276 world.gen.genMethod(method); |
| 20811 } | 20277 } |
| 20812 else if ($notnull_bool(this.isClass)) { | 20278 else if (this.isClass) { |
| 20813 if (this._lazyGenMethods == null) this._lazyGenMethods = $map([]); | 20279 if (this._lazyGenMethods == null) this._lazyGenMethods = $map([]); |
| 20814 this._lazyGenMethods.$setindex(method.name, method); | 20280 this._lazyGenMethods.$setindex(method.name, method); |
| 20815 } | 20281 } |
| 20816 } | 20282 } |
| 20817 DefinedType.prototype._resolveInterfaces = function(types) { | 20283 DefinedType.prototype._resolveInterfaces = function(types) { |
| 20818 if (types == null) return []; | 20284 if (types == null) return []; |
| 20819 var interfaces = []; | 20285 var interfaces = []; |
| 20820 for (var $i = 0;$i < types.length; $i++) { | 20286 for (var $i = 0;$i < types.length; $i++) { |
| 20821 var type = types.$index($i); | 20287 var type = types.$index($i); |
| 20822 var resolvedInterface = this.resolveType((type && type.is$TypeReference()),
true); | 20288 var resolvedInterface = this.resolveType(type, true); |
| 20823 if ($notnull_bool(resolvedInterface.get$isClosed()) && !($notnull_bool(this.
library.get$isCore()) || $notnull_bool(this.library.get$isCoreImpl()))) { | 20289 if (resolvedInterface.get$isClosed() && !(this.library.get$isCore() || this.
library.get$isCoreImpl())) { |
| 20824 world.error(('can not implement "' + resolvedInterface.get$name() + '": ')
+ 'only native implementation allowed', type.get$span()); | 20290 world.error(('can not implement "' + resolvedInterface.get$name() + '": ')
+ 'only native implementation allowed', type.get$span()); |
| 20825 } | 20291 } |
| 20826 resolvedInterface.addDirectSubtype$1(this); | 20292 resolvedInterface.addDirectSubtype$1(this); |
| 20827 interfaces.add$1(resolvedInterface); | 20293 interfaces.add$1(resolvedInterface); |
| 20828 } | 20294 } |
| 20829 return (interfaces && interfaces.is$List$Type()); | 20295 return interfaces; |
| 20830 } | 20296 } |
| 20831 DefinedType.prototype.addDirectSubtype = function(type) { | 20297 DefinedType.prototype.addDirectSubtype = function(type) { |
| 20832 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 746, 12); | |
| 20833 this.directSubtypes.add(type); | 20298 this.directSubtypes.add(type); |
| 20834 } | 20299 } |
| 20835 DefinedType.prototype.get$subtypes = function() { | 20300 DefinedType.prototype.get$subtypes = function() { |
| 20836 if (this._subtypes == null) { | 20301 if (this._subtypes == null) { |
| 20837 this._subtypes = new HashSetImplementation(); | 20302 this._subtypes = new HashSetImplementation(); |
| 20838 var $list = this.directSubtypes; | 20303 var $list = this.directSubtypes; |
| 20839 for (var $i = this.directSubtypes.iterator(); $i.hasNext$0(); ) { | 20304 for (var $i = this.directSubtypes.iterator(); $i.hasNext$0(); ) { |
| 20840 var st = $i.next$0(); | 20305 var st = $i.next$0(); |
| 20841 this._subtypes.add(st); | 20306 this._subtypes.add(st); |
| 20842 this._subtypes.addAll(st.get$subtypes()); | 20307 this._subtypes.addAll(st.get$subtypes()); |
| 20843 } | 20308 } |
| 20844 } | 20309 } |
| 20845 return this._subtypes; | 20310 return this._subtypes; |
| 20846 } | 20311 } |
| 20847 DefinedType.prototype._cycleInClassExtends = function() { | 20312 DefinedType.prototype._cycleInClassExtends = function() { |
| 20848 var seen = new HashSetImplementation(); | 20313 var seen = new HashSetImplementation(); |
| 20849 seen.add(this); | 20314 seen.add(this); |
| 20850 var ancestor = this.get$parent(); | 20315 var ancestor = this.get$parent(); |
| 20851 while ($notnull_bool($ne(ancestor, null))) { | 20316 while ($ne(ancestor, null)) { |
| 20852 if (ancestor === this) { | 20317 if (ancestor === this) { |
| 20853 return true; | 20318 return true; |
| 20854 } | 20319 } |
| 20855 if (seen.contains(ancestor)) { | 20320 if (seen.contains(ancestor)) { |
| 20856 return false; | 20321 return false; |
| 20857 } | 20322 } |
| 20858 seen.add(ancestor); | 20323 seen.add(ancestor); |
| 20859 ancestor = ancestor.get$parent(); | 20324 ancestor = ancestor.get$parent(); |
| 20860 } | 20325 } |
| 20861 return false; | 20326 return false; |
| 20862 } | 20327 } |
| 20863 DefinedType.prototype._cycleInInterfaceExtends = function() { | 20328 DefinedType.prototype._cycleInInterfaceExtends = function() { |
| 20864 var $this = this; // closure support | 20329 var $this = this; // closure support |
| 20865 var seen = new HashSetImplementation(); | 20330 var seen = new HashSetImplementation(); |
| 20866 seen.add(this); | 20331 seen.add(this); |
| 20867 function _helper(ancestor) { | 20332 function _helper(ancestor) { |
| 20868 if ($notnull_bool(ancestor == null)) return false; | 20333 if (ancestor == null) return false; |
| 20869 if (ancestor === $this) return true; | 20334 if (ancestor === $this) return true; |
| 20870 if (seen.contains(ancestor)) { | 20335 if (seen.contains(ancestor)) { |
| 20871 return false; | 20336 return false; |
| 20872 } | 20337 } |
| 20873 seen.add(ancestor); | 20338 seen.add(ancestor); |
| 20874 if ($notnull_bool($ne(ancestor.get$interfaces(), null))) { | 20339 if ($ne(ancestor.get$interfaces(), null)) { |
| 20875 var $list = ancestor.get$interfaces(); | 20340 var $list = ancestor.get$interfaces(); |
| 20876 for (var $i = ancestor.get$interfaces().iterator$0(); $i.hasNext$0(); ) { | 20341 for (var $i = ancestor.get$interfaces().iterator$0(); $i.hasNext$0(); ) { |
| 20877 var parent = $i.next$0(); | 20342 var parent = $i.next$0(); |
| 20878 if ($notnull_bool(_helper(parent))) return true; | 20343 if (_helper(parent)) return true; |
| 20879 } | 20344 } |
| 20880 } | 20345 } |
| 20881 return false; | 20346 return false; |
| 20882 } | 20347 } |
| 20883 for (var i = 0; | 20348 for (var i = 0; |
| 20884 i < this.interfaces.length; i++) { | 20349 i < this.interfaces.length; i++) { |
| 20885 if ($notnull_bool(_helper(this.interfaces.$index(i)))) return i; | 20350 if (_helper(this.interfaces.$index(i))) return i; |
| 20886 } | 20351 } |
| 20887 return -1; | 20352 return -1; |
| 20888 } | 20353 } |
| 20889 DefinedType.prototype.resolve = function() { | 20354 DefinedType.prototype.resolve = function() { |
| 20890 var $this = this; // closure support | 20355 var $this = this; // closure support |
| 20891 var $0; | |
| 20892 if ((this.definition instanceof TypeDefinition)) { | 20356 if ((this.definition instanceof TypeDefinition)) { |
| 20893 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition()); | 20357 var typeDef = this.definition; |
| 20894 if ($notnull_bool(this.isClass)) { | 20358 if (this.isClass) { |
| 20895 if (typeDef.extendsTypes != null && typeDef.extendsTypes.length > 0) { | 20359 if (typeDef.extendsTypes != null && typeDef.extendsTypes.length > 0) { |
| 20896 if (typeDef.extendsTypes.length > 1) { | 20360 if (typeDef.extendsTypes.length > 1) { |
| 20897 world.error('more than one base class', typeDef.extendsTypes.$index(1)
.get$span()); | 20361 world.error('more than one base class', typeDef.extendsTypes.$index(1)
.get$span()); |
| 20898 } | 20362 } |
| 20899 var extendsTypeRef = typeDef.extendsTypes.$index(0); | 20363 var extendsTypeRef = typeDef.extendsTypes.$index(0); |
| 20900 if ((extendsTypeRef instanceof GenericTypeReference)) { | 20364 if ((extendsTypeRef instanceof GenericTypeReference)) { |
| 20901 var g = (extendsTypeRef && extendsTypeRef.is$GenericTypeReference()); | 20365 var g = extendsTypeRef; |
| 20902 this.set$parent(this.resolveType(g.baseType, true)); | 20366 this.set$parent(this.resolveType(g.baseType, true)); |
| 20903 } | 20367 } |
| 20904 this.set$parent(this.resolveType((extendsTypeRef && extendsTypeRef.is$Ty
peReference()), true)); | 20368 this.set$parent(this.resolveType(extendsTypeRef, true)); |
| 20905 if (!$notnull_bool(this.get$parent().get$isClass())) { | 20369 if (!this.get$parent().get$isClass()) { |
| 20906 world.error('class may not extend an interface - use implements', type
Def.extendsTypes.$index(0).get$span()); | 20370 world.error('class may not extend an interface - use implements', type
Def.extendsTypes.$index(0).get$span()); |
| 20907 } | 20371 } |
| 20908 this.get$parent().addDirectSubtype(this); | 20372 this.get$parent().addDirectSubtype(this); |
| 20909 if ($notnull_bool(this._cycleInClassExtends())) { | 20373 if (this._cycleInClassExtends()) { |
| 20910 world.error(('class "' + this.name + '" has a cycle in its inheritance
chain'), extendsTypeRef.get$span()); | 20374 world.error(('class "' + this.name + '" has a cycle in its inheritance
chain'), extendsTypeRef.get$span()); |
| 20911 } | 20375 } |
| 20912 } | 20376 } |
| 20913 else { | 20377 else { |
| 20914 if (!$notnull_bool(this.get$isObject())) { | 20378 if (!this.get$isObject()) { |
| 20915 this.set$parent(world.objectType); | 20379 this.set$parent(world.objectType); |
| 20916 this.get$parent().addDirectSubtype(this); | 20380 this.get$parent().addDirectSubtype(this); |
| 20917 } | 20381 } |
| 20918 } | 20382 } |
| 20919 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); | 20383 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); |
| 20920 if (typeDef.factoryType != null) { | 20384 if (typeDef.factoryType != null) { |
| 20921 world.error('factory not allowed on classes', typeDef.factoryType.span); | 20385 world.error('factory not allowed on classes', typeDef.factoryType.span); |
| 20922 } | 20386 } |
| 20923 } | 20387 } |
| 20924 else { | 20388 else { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20960 m.resolve$1(this); | 20424 m.resolve$1(this); |
| 20961 } | 20425 } |
| 20962 this.factories.forEach((function (f) { | 20426 this.factories.forEach((function (f) { |
| 20963 return f.resolve$1($this); | 20427 return f.resolve$1($this); |
| 20964 }) | 20428 }) |
| 20965 ); | 20429 ); |
| 20966 } | 20430 } |
| 20967 DefinedType.prototype.addMethod = function(methodName, definition) { | 20431 DefinedType.prototype.addMethod = function(methodName, definition) { |
| 20968 if (methodName == null) methodName = definition.name.name; | 20432 if (methodName == null) methodName = definition.name.name; |
| 20969 var method = new MethodMember(methodName, this, definition); | 20433 var method = new MethodMember(methodName, this, definition); |
| 20970 if ($notnull_bool(method.get$isConstructor())) { | 20434 if (method.get$isConstructor()) { |
| 20971 if (this.constructors.containsKey(method.get$constructorName())) { | 20435 if (this.constructors.containsKey(method.get$constructorName())) { |
| 20972 world.error(('duplicate constructor definition of ' + method.get$name() +
''), definition.span); | 20436 world.error(('duplicate constructor definition of ' + method.get$name() +
''), definition.span); |
| 20973 return; | 20437 return; |
| 20974 } | 20438 } |
| 20975 this.constructors.$setindex(method.get$constructorName(), method); | 20439 this.constructors.$setindex(method.get$constructorName(), method); |
| 20976 return; | 20440 return; |
| 20977 } | 20441 } |
| 20978 if (definition.modifiers != null && definition.modifiers.length == 1 && $notnu
ll_bool($eq(definition.modifiers.$index(0).kind, 75/*TokenKind.FACTORY*/))) { | 20442 if (definition.modifiers != null && definition.modifiers.length == 1 && $eq(de
finition.modifiers.$index(0).kind, 75/*TokenKind.FACTORY*/)) { |
| 20979 if (this.factories.getFactory(method.get$constructorName(), $assert_String(m
ethod.get$name())) != null) { | 20443 if (this.factories.getFactory(method.get$constructorName(), method.get$name(
)) != null) { |
| 20980 world.error(('duplicate factory definition of "' + method.get$name() + '"'
), definition.span); | 20444 world.error(('duplicate factory definition of "' + method.get$name() + '"'
), definition.span); |
| 20981 return; | 20445 return; |
| 20982 } | 20446 } |
| 20983 this.factories.addFactory(method.get$constructorName(), $assert_String(metho
d.get$name()), (method && method.is$Member())); | 20447 this.factories.addFactory(method.get$constructorName(), method.get$name(), m
ethod); |
| 20984 return; | 20448 return; |
| 20985 } | 20449 } |
| 20986 if (methodName.startsWith('get\$') || methodName.startsWith('set\$')) { | 20450 if (methodName.startsWith('get\$') || methodName.startsWith('set\$')) { |
| 20987 var propName = methodName.substring(4); | 20451 var propName = methodName.substring(4); |
| 20988 var prop = this.members.$index(propName); | 20452 var prop = this.members.$index(propName); |
| 20989 if ($notnull_bool(prop == null)) { | 20453 if (prop == null) { |
| 20990 prop = new PropertyMember($assert_String(propName), this); | 20454 prop = new PropertyMember(propName, this); |
| 20991 this.members.$setindex(propName, prop); | 20455 this.members.$setindex(propName, prop); |
| 20992 } | 20456 } |
| 20993 if (!(prop instanceof PropertyMember)) { | 20457 if (!(prop instanceof PropertyMember)) { |
| 20994 world.error(('property conflicts with field "' + propName + '"'), definiti
on.span); | 20458 world.error(('property conflicts with field "' + propName + '"'), definiti
on.span); |
| 20995 return; | 20459 return; |
| 20996 } | 20460 } |
| 20997 if (methodName[0] == 'g') { | 20461 if (methodName[0] == 'g') { |
| 20998 if (prop.getter != null) { | 20462 if (prop.getter != null) { |
| 20999 world.error(('duplicate getter definition for "' + propName + '"'), defi
nition.span); | 20463 world.error(('duplicate getter definition for "' + propName + '"'), defi
nition.span); |
| 21000 } | 20464 } |
| 21001 prop.getter = (method && method.is$MethodMember()); | 20465 prop.getter = method; |
| 21002 } | 20466 } |
| 21003 else { | 20467 else { |
| 21004 if (prop.setter != null) { | 20468 if (prop.setter != null) { |
| 21005 world.error(('duplicate setter definition for "' + propName + '"'), defi
nition.span); | 20469 world.error(('duplicate setter definition for "' + propName + '"'), defi
nition.span); |
| 21006 } | 20470 } |
| 21007 prop.setter = (method && method.is$MethodMember()); | 20471 prop.setter = method; |
| 21008 } | 20472 } |
| 21009 return; | 20473 return; |
| 21010 } | 20474 } |
| 21011 if (this.members.containsKey(methodName)) { | 20475 if (this.members.containsKey(methodName)) { |
| 21012 world.error(('duplicate method definition of "' + method.get$name() + '"'),
definition.span); | 20476 world.error(('duplicate method definition of "' + method.get$name() + '"'),
definition.span); |
| 21013 return; | 20477 return; |
| 21014 } | 20478 } |
| 21015 this.members.$setindex(methodName, method); | 20479 this.members.$setindex(methodName, method); |
| 21016 } | 20480 } |
| 21017 DefinedType.prototype.addField = function(definition) { | 20481 DefinedType.prototype.addField = function(definition) { |
| 21018 for (var i = 0; | 20482 for (var i = 0; |
| 21019 i < definition.names.length; i++) { | 20483 i < definition.names.length; i++) { |
| 21020 var name = definition.names.$index(i).get$name(); | 20484 var name = definition.names.$index(i).get$name(); |
| 21021 if (this.members.containsKey(name)) { | 20485 if (this.members.containsKey(name)) { |
| 21022 world.error(('duplicate field definition of "' + name + '"'), definition.s
pan); | 20486 world.error(('duplicate field definition of "' + name + '"'), definition.s
pan); |
| 21023 return; | 20487 return; |
| 21024 } | 20488 } |
| 21025 var value = null; | 20489 var value = null; |
| 21026 if (definition.values != null) { | 20490 if (definition.values != null) { |
| 21027 value = definition.values.$index(i); | 20491 value = definition.values.$index(i); |
| 21028 } | 20492 } |
| 21029 var field = new FieldMember($assert_String(name), this, definition, value); | 20493 var field = new FieldMember(name, this, definition, value); |
| 21030 this.members.$setindex(name, field); | 20494 this.members.$setindex(name, field); |
| 21031 if ($notnull_bool(this.isNativeType)) { | 20495 if (this.isNativeType) { |
| 21032 field.isNative = true; | 20496 field.isNative = true; |
| 21033 } | 20497 } |
| 21034 } | 20498 } |
| 21035 } | 20499 } |
| 21036 DefinedType.prototype.getFactory = function(type, constructorName) { | 20500 DefinedType.prototype.getFactory = function(type, constructorName) { |
| 21037 var ret = this.factories.getFactory(type.name, constructorName); | 20501 var ret = this.factories.getFactory(type.name, constructorName); |
| 21038 if ($notnull_bool($ne(ret, null))) return ret; | 20502 if ($ne(ret, null)) return ret; |
| 21039 ret = this.factories.getFactory(this.name, constructorName); | 20503 ret = this.factories.getFactory(this.name, constructorName); |
| 21040 if ($notnull_bool($ne(ret, null))) return ret; | 20504 if ($ne(ret, null)) return ret; |
| 21041 ret = this.constructors.$index(constructorName); | 20505 ret = this.constructors.$index(constructorName); |
| 21042 if ($notnull_bool($ne(ret, null))) return ret; | 20506 if ($ne(ret, null)) return ret; |
| 21043 return this._tryCreateDefaultConstructor(constructorName); | 20507 return this._tryCreateDefaultConstructor(constructorName); |
| 21044 } | 20508 } |
| 21045 DefinedType.prototype.getConstructor = function(constructorName) { | 20509 DefinedType.prototype.getConstructor = function(constructorName) { |
| 21046 var ret = this.constructors.$index(constructorName); | 20510 var ret = this.constructors.$index(constructorName); |
| 21047 if ($notnull_bool($ne(ret, null))) { | 20511 if ($ne(ret, null)) { |
| 21048 if (this.factory_ != null) { | 20512 if (this.factory_ != null) { |
| 21049 return this.factory_.getFactory(this, constructorName); | 20513 return this.factory_.getFactory(this, constructorName); |
| 21050 } | 20514 } |
| 21051 return ret; | 20515 return ret; |
| 21052 } | 20516 } |
| 21053 ret = this.factories.getFactory(this.name, constructorName); | 20517 ret = this.factories.getFactory(this.name, constructorName); |
| 21054 if ($notnull_bool($ne(ret, null))) return ret; | 20518 if ($ne(ret, null)) return ret; |
| 21055 return this._tryCreateDefaultConstructor(constructorName); | 20519 return this._tryCreateDefaultConstructor(constructorName); |
| 21056 } | 20520 } |
| 21057 DefinedType.prototype._tryCreateDefaultConstructor = function(name) { | 20521 DefinedType.prototype._tryCreateDefaultConstructor = function(name) { |
| 21058 var $0; | 20522 if (name == '' && this.definition != null && this.isClass && this.constructors
.get$length() == 0) { |
| 21059 if (name == '' && this.definition != null && $notnull_bool(this.isClass) && th
is.constructors.get$length() == 0) { | |
| 21060 var span = this.definition.span; | 20523 var span = this.definition.span; |
| 21061 var inits = null, body = null; | 20524 var inits = null, body = null; |
| 21062 if ($notnull_bool(this.isNativeType)) { | 20525 if (this.isNativeType) { |
| 21063 body = new NativeStatement(null, (span && span.is$SourceSpan())); | 20526 body = new NativeStatement(null, span); |
| 21064 inits = null; | 20527 inits = null; |
| 21065 } | 20528 } |
| 21066 else { | 20529 else { |
| 21067 body = null; | 20530 body = null; |
| 21068 inits = [new CallExpression(new SuperExpression((span && span.is$SourceSpa
n())), [], (span && span.is$SourceSpan()))]; | 20531 inits = [new CallExpression(new SuperExpression(span), [], span)]; |
| 21069 } | 20532 } |
| 21070 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition()); | 20533 var typeDef = this.definition; |
| 21071 var c = new FunctionDefinition(null, null, typeDef.name, [], inits, body, (s
pan && span.is$SourceSpan())); | 20534 var c = new FunctionDefinition(null, null, typeDef.name, [], inits, body, sp
an); |
| 21072 this.addMethod(null, (c && c.is$FunctionDefinition())); | 20535 this.addMethod(null, c); |
| 21073 this.constructors.$index('').resolve$1(this); | 20536 this.constructors.$index('').resolve$1(this); |
| 21074 return this.constructors.$index(''); | 20537 return this.constructors.$index(''); |
| 21075 } | 20538 } |
| 21076 return null; | 20539 return null; |
| 21077 } | 20540 } |
| 21078 DefinedType.prototype.getMember = function(memberName) { | 20541 DefinedType.prototype.getMember = function(memberName) { |
| 21079 var $0; | 20542 var member = this.members.$index(memberName); |
| 21080 var member = (($0 = this.members.$index(memberName)) && $0.is$Member()); | |
| 21081 if (member != null) { | 20543 if (member != null) { |
| 21082 var parentMember = this.getMemberInParents(memberName); | 20544 var parentMember = this.getMemberInParents(memberName); |
| 21083 if ($notnull_bool($ne(parentMember, null))) { | 20545 if ($ne(parentMember, null)) { |
| 21084 if (!$notnull_bool(member.get$isPrivate()) || $eq(member.get$library(), pa
rentMember.get$library())) { | 20546 if (!member.get$isPrivate() || $eq(member.get$library(), parentMember.get$
library())) { |
| 21085 member.override((parentMember && parentMember.is$Member())); | 20547 member.override(parentMember); |
| 21086 } | 20548 } |
| 21087 } | 20549 } |
| 21088 return member; | 20550 return member; |
| 21089 } | 20551 } |
| 21090 if ($notnull_bool(this.get$isTop())) { | 20552 if (this.get$isTop()) { |
| 21091 var libType = this.library.findTypeByName(memberName); | 20553 var libType = this.library.findTypeByName(memberName); |
| 21092 if ($notnull_bool($ne(libType, null))) { | 20554 if ($ne(libType, null)) { |
| 21093 return libType.get$typeMember(); | 20555 return libType.get$typeMember(); |
| 21094 } | 20556 } |
| 21095 } | 20557 } |
| 21096 return this.getMemberInParents(memberName); | 20558 return this.getMemberInParents(memberName); |
| 21097 } | 20559 } |
| 21098 DefinedType.prototype.getMemberInParents = function(memberName) { | 20560 DefinedType.prototype.getMemberInParents = function(memberName) { |
| 21099 if ($notnull_bool(this.isClass)) { | 20561 if (this.isClass) { |
| 21100 if (this.get$parent() != null) { | 20562 if (this.get$parent() != null) { |
| 21101 return this.get$parent().getMember(memberName); | 20563 return this.get$parent().getMember(memberName); |
| 21102 } | 20564 } |
| 21103 else if ($notnull_bool(this.get$isObject())) { | 20565 else if (this.get$isObject()) { |
| 21104 if (memberName == '\$ne') { | 20566 if (memberName == '\$ne') { |
| 21105 var ret = this._createNotEqualMember(); | 20567 var ret = this._createNotEqualMember(); |
| 21106 this.members.$setindex(memberName, ret); | 20568 this.members.$setindex(memberName, ret); |
| 21107 return (ret && ret.is$Member()); | 20569 return ret; |
| 21108 } | 20570 } |
| 21109 return null; | 20571 return null; |
| 21110 } | 20572 } |
| 21111 } | 20573 } |
| 21112 else { | 20574 else { |
| 21113 if (this.interfaces != null && this.interfaces.length > 0) { | 20575 if (this.interfaces != null && this.interfaces.length > 0) { |
| 21114 var $list = this.interfaces; | 20576 var $list = this.interfaces; |
| 21115 for (var $i = 0;$i < $list.length; $i++) { | 20577 for (var $i = 0;$i < $list.length; $i++) { |
| 21116 var i = $list.$index($i); | 20578 var i = $list.$index($i); |
| 21117 var ret = i.getMember$1(memberName); | 20579 var ret = i.getMember$1(memberName); |
| 21118 if ($notnull_bool($ne(ret, null))) { | 20580 if ($ne(ret, null)) { |
| 21119 return (ret && ret.is$Member()); | 20581 return ret; |
| 21120 } | 20582 } |
| 21121 } | 20583 } |
| 21122 return null; | 20584 return null; |
| 21123 } | 20585 } |
| 21124 else { | 20586 else { |
| 21125 return world.objectType.getMember(memberName); | 20587 return world.objectType.getMember(memberName); |
| 21126 } | 20588 } |
| 21127 } | 20589 } |
| 21128 } | 20590 } |
| 21129 DefinedType.prototype.resolveMember = function(memberName) { | 20591 DefinedType.prototype.resolveMember = function(memberName) { |
| 21130 var $0; | 20592 var ret = this._resolvedMembers.$index(memberName); |
| 21131 var ret = (($0 = this._resolvedMembers.$index(memberName)) && $0.is$MemberSet(
)); | |
| 21132 if (ret != null) return ret; | 20593 if (ret != null) return ret; |
| 21133 var member = this.getMember(memberName); | 20594 var member = this.getMember(memberName); |
| 21134 if (member == null) { | 20595 if (member == null) { |
| 21135 return null; | 20596 return null; |
| 21136 } | 20597 } |
| 21137 ret = new MemberSet(member, false); | 20598 ret = new MemberSet(member, false); |
| 21138 this._resolvedMembers.$setindex(memberName, ret); | 20599 this._resolvedMembers.$setindex(memberName, ret); |
| 21139 if ($notnull_bool(member.get$isStatic())) { | 20600 if (member.get$isStatic()) { |
| 21140 return ret; | 20601 return ret; |
| 21141 } | 20602 } |
| 21142 else { | 20603 else { |
| 21143 var $list = this.get$subtypes(); | 20604 var $list = this.get$subtypes(); |
| 21144 for (var $i = this.get$subtypes().iterator(); $i.hasNext$0(); ) { | 20605 for (var $i = this.get$subtypes().iterator(); $i.hasNext$0(); ) { |
| 21145 var t = $i.next$0(); | 20606 var t = $i.next$0(); |
| 21146 var m; | 20607 var m; |
| 21147 if (!$notnull_bool(this.isClass) && $notnull_bool(t.get$isClass())) { | 20608 if (!this.isClass && t.get$isClass()) { |
| 21148 m = t.getMember$1(memberName); | 20609 m = t.getMember$1(memberName); |
| 21149 } | 20610 } |
| 21150 else { | 20611 else { |
| 21151 m = t.get$members().$index(memberName); | 20612 m = t.get$members().$index(memberName); |
| 21152 } | 20613 } |
| 21153 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member())); | 20614 if ($ne(m, null)) ret.add(m); |
| 21154 } | 20615 } |
| 21155 return ret; | 20616 return ret; |
| 21156 } | 20617 } |
| 21157 } | 20618 } |
| 21158 DefinedType.prototype._createNotEqualMember = function() { | 20619 DefinedType.prototype._createNotEqualMember = function() { |
| 21159 var $0; | 20620 var eq = this.members.$index('\$eq'); |
| 21160 var eq = (($0 = this.members.$index('\$eq')) && $0.is$MethodMember()); | |
| 21161 if (eq == null) { | 20621 if (eq == null) { |
| 21162 world.internalError('INTERNAL: object does not define ==', this.definition.s
pan); | 20622 world.internalError('INTERNAL: object does not define ==', this.definition.s
pan); |
| 21163 } | 20623 } |
| 21164 var ne = new MethodMember('\$ne', this, eq.definition); | 20624 var ne = new MethodMember('\$ne', this, eq.definition); |
| 21165 ne.isGenerated = true; | 20625 ne.isGenerated = true; |
| 21166 ne.returnType = eq.returnType; | 20626 ne.returnType = eq.returnType; |
| 21167 ne.parameters = eq.parameters; | 20627 ne.parameters = eq.parameters; |
| 21168 ne.isStatic = eq.isStatic; | 20628 ne.isStatic = eq.isStatic; |
| 21169 ne.isAbstract = eq.isAbstract; | 20629 ne.isAbstract = eq.isAbstract; |
| 21170 return ne; | 20630 return ne; |
| 21171 } | 20631 } |
| 21172 DefinedType._getDottedName = function(type) { | 20632 DefinedType._getDottedName = function(type) { |
| 21173 if (type.names != null) { | 20633 if (type.names != null) { |
| 21174 var names = map(type.names, (function (n) { | 20634 var names = map(type.names, (function (n) { |
| 21175 return n.get$name(); | 20635 return n.get$name(); |
| 21176 }) | 20636 }) |
| 21177 ); | 20637 ); |
| 21178 return type.name.name + '.' + Strings.join((names && names.is$List$String())
, '.'); | 20638 return type.name.name + '.' + Strings.join(names, '.'); |
| 21179 } | 20639 } |
| 21180 else { | 20640 else { |
| 21181 return type.name.name; | 20641 return type.name.name; |
| 21182 } | 20642 } |
| 21183 } | 20643 } |
| 21184 DefinedType.prototype.resolveType = function(node, typeErrors) { | 20644 DefinedType.prototype.resolveType = function(node, typeErrors) { |
| 21185 var $0; | |
| 21186 if (node == null) return world.varType; | 20645 if (node == null) return world.varType; |
| 21187 if (node.type != null) return node.type; | 20646 if (node.type != null) return node.type; |
| 21188 if ((node instanceof NameTypeReference)) { | 20647 if ((node instanceof NameTypeReference)) { |
| 21189 var typeRef = (node && node.is$NameTypeReference()); | 20648 var typeRef = node; |
| 21190 var name; | 20649 var name; |
| 21191 if (typeRef.names != null) { | 20650 if (typeRef.names != null) { |
| 21192 name = $assert_String(typeRef.names.last().get$name()); | 20651 name = typeRef.names.last().get$name(); |
| 21193 } | 20652 } |
| 21194 else { | 20653 else { |
| 21195 name = typeRef.name.name; | 20654 name = typeRef.name.name; |
| 21196 } | 20655 } |
| 21197 if (this.typeParameters != null) { | 20656 if (this.typeParameters != null) { |
| 21198 var $list = this.typeParameters; | 20657 var $list = this.typeParameters; |
| 21199 for (var $i = 0;$i < $list.length; $i++) { | 20658 for (var $i = 0;$i < $list.length; $i++) { |
| 21200 var tp = $list.$index($i); | 20659 var tp = $list.$index($i); |
| 21201 if ($notnull_bool($eq(tp.get$name(), name))) { | 20660 if ($eq(tp.get$name(), name)) { |
| 21202 typeRef.type = (tp && tp.is$lang_Type()); | 20661 typeRef.type = tp; |
| 21203 } | 20662 } |
| 21204 } | 20663 } |
| 21205 } | 20664 } |
| 21206 if (typeRef.type == null) { | 20665 if (typeRef.type == null) { |
| 21207 typeRef.type = this.library.findType(typeRef); | 20666 typeRef.type = this.library.findType(typeRef); |
| 21208 } | 20667 } |
| 21209 if (typeRef.type == null) { | 20668 if (typeRef.type == null) { |
| 21210 var message = ('can not find type ' + DefinedType._getDottedName(typeRef)
+ ''); | 20669 var message = ('can not find type ' + DefinedType._getDottedName(typeRef)
+ ''); |
| 21211 if ($notnull_bool(typeErrors)) { | 20670 if (typeErrors) { |
| 21212 world.error($assert_String(message), typeRef.span); | 20671 world.error(message, typeRef.span); |
| 21213 typeRef.type = world.objectType; | 20672 typeRef.type = world.objectType; |
| 21214 } | 20673 } |
| 21215 else { | 20674 else { |
| 21216 world.warning($assert_String(message), typeRef.span); | 20675 world.warning(message, typeRef.span); |
| 21217 typeRef.type = world.varType; | 20676 typeRef.type = world.varType; |
| 21218 } | 20677 } |
| 21219 } | 20678 } |
| 21220 } | 20679 } |
| 21221 else if ((node instanceof GenericTypeReference)) { | 20680 else if ((node instanceof GenericTypeReference)) { |
| 21222 var typeRef = (node && node.is$GenericTypeReference()); | 20681 var typeRef = node; |
| 21223 var baseType = this.resolveType(typeRef.baseType, typeErrors); | 20682 var baseType = this.resolveType(typeRef.baseType, typeErrors); |
| 21224 if (!$notnull_bool(baseType.get$isGeneric())) { | 20683 if (!baseType.get$isGeneric()) { |
| 21225 world.error(('' + baseType.get$name() + ' is not generic'), typeRef.span); | 20684 world.error(('' + baseType.get$name() + ' is not generic'), typeRef.span); |
| 21226 return null; | 20685 return null; |
| 21227 } | 20686 } |
| 21228 if (typeRef.typeArguments.length != baseType.get$typeParameters().length) { | 20687 if (typeRef.typeArguments.length != baseType.get$typeParameters().length) { |
| 21229 world.error('wrong number of type arguments', typeRef.span); | 20688 world.error('wrong number of type arguments', typeRef.span); |
| 21230 return null; | 20689 return null; |
| 21231 } | 20690 } |
| 21232 var typeArgs = []; | 20691 var typeArgs = []; |
| 21233 for (var i = 0; | 20692 for (var i = 0; |
| 21234 i < typeRef.typeArguments.length; i++) { | 20693 i < typeRef.typeArguments.length; i++) { |
| 21235 var extendsType = baseType.get$typeParameters().$index(i).extendsType; | 20694 var extendsType = baseType.get$typeParameters().$index(i).extendsType; |
| 21236 var typeArg = this.resolveType((($0 = typeRef.typeArguments.$index(i)) &&
$0.is$TypeReference()), typeErrors); | 20695 var typeArg = this.resolveType(typeRef.typeArguments.$index(i), typeErrors
); |
| 21237 typeArgs.add$1(typeArg); | 20696 typeArgs.add$1(typeArg); |
| 21238 if ($notnull_bool($ne(extendsType, null)) && !(typeArg instanceof Paramete
rType)) { | 20697 if ($ne(extendsType, null) && !(typeArg instanceof ParameterType)) { |
| 21239 typeArg.ensureSubtypeOf$3(extendsType, typeRef.typeArguments.$index(i).g
et$span(), typeErrors); | 20698 typeArg.ensureSubtypeOf$3(extendsType, typeRef.typeArguments.$index(i).g
et$span(), typeErrors); |
| 21240 } | 20699 } |
| 21241 } | 20700 } |
| 21242 typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs); | 20701 typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs); |
| 21243 } | 20702 } |
| 21244 else if ((node instanceof FunctionTypeReference)) { | 20703 else if ((node instanceof FunctionTypeReference)) { |
| 21245 var typeRef = (node && node.is$FunctionTypeReference()); | 20704 var typeRef = node; |
| 21246 var name = ''; | 20705 var name = ''; |
| 21247 if (typeRef.func.name != null) name = typeRef.func.name.name; | 20706 if (typeRef.func.name != null) name = typeRef.func.name.name; |
| 21248 typeRef.type = this.library.getOrAddFunctionType($assert_String(name), typeR
ef.func, this); | 20707 typeRef.type = this.library.getOrAddFunctionType(name, typeRef.func, this); |
| 21249 } | 20708 } |
| 21250 else { | 20709 else { |
| 21251 world.internalError('unknown type reference', node.span); | 20710 world.internalError('unknown type reference', node.span); |
| 21252 } | 20711 } |
| 21253 return node.type; | 20712 return node.type; |
| 21254 } | 20713 } |
| 21255 DefinedType.prototype.resolveTypeParams = function(inType) { | 20714 DefinedType.prototype.resolveTypeParams = function(inType) { |
| 21256 return this; | 20715 return this; |
| 21257 } | 20716 } |
| 21258 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { | 20717 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { |
| 21259 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1229, 12); | |
| 21260 var names = [this.name]; | 20718 var names = [this.name]; |
| 21261 var typeMap = $map([]); | 20719 var typeMap = $map([]); |
| 21262 for (var i = 0; | 20720 for (var i = 0; |
| 21263 i < typeArgs.length; i++) { | 20721 i < typeArgs.length; i++) { |
| 21264 var paramName = this.typeParameters.$index(i).get$name(); | 20722 var paramName = this.typeParameters.$index(i).get$name(); |
| 21265 typeMap.$setindex(paramName, typeArgs.$index(i)); | 20723 typeMap.$setindex(paramName, typeArgs.$index(i)); |
| 21266 names.add$1(typeArgs.$index(i).get$name()); | 20724 names.add$1(typeArgs.$index(i).get$name()); |
| 21267 } | 20725 } |
| 21268 var concreteName = Strings.join((names && names.is$List$String()), '\$'); | 20726 var concreteName = Strings.join(names, '\$'); |
| 21269 var ret = this._concreteTypes.$index(concreteName); | 20727 var ret = this._concreteTypes.$index(concreteName); |
| 21270 if ($notnull_bool(ret == null)) { | 20728 if (ret == null) { |
| 21271 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs
); | 20729 ret = new ConcreteType(concreteName, this, typeMap, typeArgs); |
| 21272 this._concreteTypes.$setindex(concreteName, ret); | 20730 this._concreteTypes.$setindex(concreteName, ret); |
| 21273 } | 20731 } |
| 21274 return (ret && ret.is$lang_Type()); | 20732 return ret; |
| 21275 } | 20733 } |
| 21276 DefinedType.prototype.getCallStub = function(args) { | 20734 DefinedType.prototype.getCallStub = function(args) { |
| 21277 $assert(this.get$isFunction(), "isFunction", "type.dart", 1249, 12); | |
| 21278 var name = _getCallStubName('call', args); | 20735 var name = _getCallStubName('call', args); |
| 21279 if (this.varStubs == null) this.varStubs = $map([]); | 20736 if (this.varStubs == null) this.varStubs = $map([]); |
| 21280 var stub = this.varStubs.$index(name); | 20737 var stub = this.varStubs.$index(name); |
| 21281 if ($notnull_bool(stub == null)) { | 20738 if (stub == null) { |
| 21282 stub = new VarFunctionStub($assert_String(name), args); | 20739 stub = new VarFunctionStub(name, args); |
| 21283 this.varStubs.$setindex(name, stub); | 20740 this.varStubs.$setindex(name, stub); |
| 21284 } | 20741 } |
| 21285 return (stub && stub.is$VarFunctionStub()); | 20742 return stub; |
| 21286 } | 20743 } |
| 21287 DefinedType.prototype.addDirectSubtype$1 = function($0) { | 20744 DefinedType.prototype.addDirectSubtype$1 = function($0) { |
| 21288 return this.addDirectSubtype(($0 && $0.is$lang_Type())); | 20745 return this.addDirectSubtype($0); |
| 21289 }; | 20746 }; |
| 21290 DefinedType.prototype.addMethod$2 = function($0, $1) { | 20747 DefinedType.prototype.addMethod$2 = function($0, $1) { |
| 21291 return this.addMethod($assert_String($0), ($1 && $1.is$FunctionDefinition())); | 20748 return this.addMethod($0, $1); |
| 21292 }; | 20749 }; |
| 21293 DefinedType.prototype.getConstructor$1 = function($0) { | 20750 DefinedType.prototype.getConstructor$1 = function($0) { |
| 21294 return this.getConstructor($assert_String($0)); | 20751 return this.getConstructor($0); |
| 21295 }; | 20752 }; |
| 21296 DefinedType.prototype.getFactory$2 = function($0, $1) { | 20753 DefinedType.prototype.getFactory$2 = function($0, $1) { |
| 21297 return this.getFactory(($0 && $0.is$lang_Type()), $assert_String($1)); | 20754 return this.getFactory($0, $1); |
| 21298 }; | 20755 }; |
| 21299 DefinedType.prototype.getMember$1 = function($0) { | 20756 DefinedType.prototype.getMember$1 = function($0) { |
| 21300 return this.getMember($assert_String($0)); | 20757 return this.getMember($0); |
| 21301 }; | 20758 }; |
| 21302 DefinedType.prototype.getOrMakeConcreteType$1 = function($0) { | 20759 DefinedType.prototype.getOrMakeConcreteType$1 = function($0) { |
| 21303 return this.getOrMakeConcreteType(($0 && $0.is$List$Type())); | 20760 return this.getOrMakeConcreteType($0); |
| 21304 }; | 20761 }; |
| 21305 DefinedType.prototype.markUsed$0 = function() { | 20762 DefinedType.prototype.markUsed$0 = function() { |
| 21306 return this.markUsed(); | 20763 return this.markUsed(); |
| 21307 }; | 20764 }; |
| 21308 DefinedType.prototype.resolve$0 = function() { | 20765 DefinedType.prototype.resolve$0 = function() { |
| 21309 return this.resolve(); | 20766 return this.resolve(); |
| 21310 }; | 20767 }; |
| 21311 DefinedType.prototype.resolveMember$1 = function($0) { | 20768 DefinedType.prototype.resolveMember$1 = function($0) { |
| 21312 return this.resolveMember($assert_String($0)); | 20769 return this.resolveMember($0); |
| 21313 }; | 20770 }; |
| 21314 DefinedType.prototype.resolveTypeParams$1 = function($0) { | 20771 DefinedType.prototype.resolveTypeParams$1 = function($0) { |
| 21315 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); | 20772 return this.resolveTypeParams($0); |
| 21316 }; | 20773 }; |
| 21317 DefinedType.prototype.setDefinition$1 = function($0) { | 20774 DefinedType.prototype.setDefinition$1 = function($0) { |
| 21318 return this.setDefinition(($0 && $0.is$Definition())); | 20775 return this.setDefinition($0); |
| 21319 }; | 20776 }; |
| 21320 // ********** Code for FixedCollection ************** | 20777 // ********** Code for FixedCollection ************** |
| 21321 function FixedCollection(value, length) { | 20778 function FixedCollection(value, length) { |
| 21322 this.value = value; | 20779 this.value = value; |
| 21323 this.length = length; | 20780 this.length = length; |
| 21324 // Initializers done | 20781 // Initializers done |
| 21325 } | 20782 } |
| 21326 FixedCollection.prototype.is$Collection$E = function(){return this;}; | |
| 21327 FixedCollection.prototype.is$Collection$Object = function(){return this;}; | |
| 21328 FixedCollection.prototype.is$Collection$Type = function(){return this;}; | |
| 21329 FixedCollection.prototype.is$Iterable = function(){return this;}; | |
| 21330 FixedCollection.prototype.get$value = function() { return this.value; }; | 20783 FixedCollection.prototype.get$value = function() { return this.value; }; |
| 21331 FixedCollection.prototype.iterator = function() { | 20784 FixedCollection.prototype.iterator = function() { |
| 21332 return new FixedIterator$E(this.value, this.length); | 20785 return new FixedIterator$E(this.value, this.length); |
| 21333 } | 20786 } |
| 21334 FixedCollection.prototype.forEach = function(f) { | 20787 FixedCollection.prototype.forEach = function(f) { |
| 21335 Collections.forEach(this, f); | 20788 Collections.forEach(this, f); |
| 21336 } | 20789 } |
| 21337 FixedCollection.prototype.filter = function(f) { | 20790 FixedCollection.prototype.filter = function(f) { |
| 21338 return Collections.filter(this, new ListFactory(), f); | 20791 return Collections.filter(this, new ListFactory(), f); |
| 21339 } | 20792 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 21351 return this.iterator(); | 20804 return this.iterator(); |
| 21352 }; | 20805 }; |
| 21353 FixedCollection.prototype.some$1 = FixedCollection.prototype.some; | 20806 FixedCollection.prototype.some$1 = FixedCollection.prototype.some; |
| 21354 // ********** Code for FixedCollection$Type ************** | 20807 // ********** Code for FixedCollection$Type ************** |
| 21355 function FixedCollection$Type(value, length) { | 20808 function FixedCollection$Type(value, length) { |
| 21356 this.value = value; | 20809 this.value = value; |
| 21357 this.length = length; | 20810 this.length = length; |
| 21358 // Initializers done | 20811 // Initializers done |
| 21359 } | 20812 } |
| 21360 $inherits(FixedCollection$Type, FixedCollection); | 20813 $inherits(FixedCollection$Type, FixedCollection); |
| 21361 FixedCollection$Type.prototype.is$Collection$E = function(){return this;}; | |
| 21362 FixedCollection$Type.prototype.is$Collection$Object = function(){return this;}; | |
| 21363 FixedCollection$Type.prototype.is$Collection$Type = function(){return this;}; | |
| 21364 FixedCollection$Type.prototype.is$Iterable = function(){return this;}; | |
| 21365 // ********** Code for FixedIterator ************** | 20814 // ********** Code for FixedIterator ************** |
| 21366 function FixedIterator(value, length) { | 20815 function FixedIterator(value, length) { |
| 21367 this._index = 0 | 20816 this._index = 0 |
| 21368 this.value = value; | 20817 this.value = value; |
| 21369 this.length = length; | 20818 this.length = length; |
| 21370 // Initializers done | 20819 // Initializers done |
| 21371 } | 20820 } |
| 21372 FixedIterator.prototype.is$Iterator$T = function(){return this;}; | |
| 21373 FixedIterator.prototype.get$value = function() { return this.value; }; | 20821 FixedIterator.prototype.get$value = function() { return this.value; }; |
| 21374 FixedIterator.prototype.hasNext = function() { | 20822 FixedIterator.prototype.hasNext = function() { |
| 21375 return this._index < this.length; | 20823 return this._index < this.length; |
| 21376 } | 20824 } |
| 21377 FixedIterator.prototype.next = function() { | 20825 FixedIterator.prototype.next = function() { |
| 21378 this._index++; | 20826 this._index++; |
| 21379 return this.value; | 20827 return this.value; |
| 21380 } | 20828 } |
| 21381 FixedIterator.prototype.hasNext$0 = function() { | 20829 FixedIterator.prototype.hasNext$0 = function() { |
| 21382 return this.hasNext(); | 20830 return this.hasNext(); |
| 21383 }; | 20831 }; |
| 21384 FixedIterator.prototype.next$0 = function() { | 20832 FixedIterator.prototype.next$0 = function() { |
| 21385 return this.next(); | 20833 return this.next(); |
| 21386 }; | 20834 }; |
| 21387 // ********** Code for FixedIterator$E ************** | 20835 // ********** Code for FixedIterator$E ************** |
| 21388 function FixedIterator$E(value, length) { | 20836 function FixedIterator$E(value, length) { |
| 21389 this._index = 0 | 20837 this._index = 0 |
| 21390 this.value = value; | 20838 this.value = value; |
| 21391 this.length = length; | 20839 this.length = length; |
| 21392 // Initializers done | 20840 // Initializers done |
| 21393 } | 20841 } |
| 21394 $inherits(FixedIterator$E, FixedIterator); | 20842 $inherits(FixedIterator$E, FixedIterator); |
| 21395 FixedIterator$E.prototype.is$Iterator$T = function(){return this;}; | |
| 21396 // ********** Code for Value ************** | 20843 // ********** Code for Value ************** |
| 21397 function Value(type, code, span, needsTemp) { | 20844 function Value(type, code, span, needsTemp) { |
| 21398 this.isSuper = false | 20845 this.isSuper = false |
| 21399 this.isType = false | 20846 this.isType = false |
| 21400 this.type = type; | 20847 this.type = type; |
| 21401 this.code = code; | 20848 this.code = code; |
| 21402 this.span = span; | 20849 this.span = span; |
| 21403 this.needsTemp = needsTemp; | 20850 this.needsTemp = needsTemp; |
| 21404 // Initializers done | 20851 // Initializers done |
| 21405 if (this.type == null) world.internalError('type passed as null', this.span); | 20852 if (this.type == null) world.internalError('type passed as null', this.span); |
| 21406 } | 20853 } |
| 21407 Value.prototype.is$Value = function(){return this;}; | |
| 21408 Value.prototype.get$type = function() { return this.type; }; | |
| 21409 Value.prototype.set$type = function(value) { return this.type = value; }; | |
| 21410 Value.prototype.get$span = function() { return this.span; }; | 20854 Value.prototype.get$span = function() { return this.span; }; |
| 21411 Value.prototype.set$span = function(value) { return this.span = value; }; | 20855 Value.prototype.set$span = function(value) { return this.span = value; }; |
| 21412 Value.prototype.get$_typeIsVarOrParameterType = function() { | 20856 Value.prototype.get$_typeIsVarOrParameterType = function() { |
| 21413 return $notnull_bool(this.type.get$isVar()) || (this.type instanceof Parameter
Type); | 20857 return this.type.get$isVar() || (this.type instanceof ParameterType); |
| 21414 } | 20858 } |
| 21415 Value.prototype.get$isConst = function() { | 20859 Value.prototype.get$isConst = function() { |
| 21416 return false; | 20860 return false; |
| 21417 } | 20861 } |
| 21418 Value.prototype.get$canonicalCode = function() { | 20862 Value.prototype.get$canonicalCode = function() { |
| 21419 return null; | 20863 return null; |
| 21420 } | 20864 } |
| 21421 Value.prototype.get_ = function(context, name, node) { | 20865 Value.prototype.get_ = function(context, name, node) { |
| 21422 var member = this._resolveMember(context, name, node, false); | 20866 var member = this._resolveMember(context, name, node, false); |
| 21423 if ($notnull_bool($ne(member, null))) { | 20867 if ($ne(member, null)) { |
| 21424 return member._get$3(context, node, this); | 20868 return member._get$3(context, node, this); |
| 21425 } | 20869 } |
| 21426 else { | 20870 else { |
| 21427 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node); | 20871 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node); |
| 21428 } | 20872 } |
| 21429 } | 20873 } |
| 21430 Value.prototype.set_ = function(context, name, node, value, isDynamic) { | 20874 Value.prototype.set_ = function(context, name, node, value, isDynamic) { |
| 21431 var member = this._resolveMember(context, name, node, isDynamic); | 20875 var member = this._resolveMember(context, name, node, isDynamic); |
| 21432 if ($notnull_bool($ne(member, null))) { | 20876 if ($ne(member, null)) { |
| 21433 return member._set(context, node, this, value, isDynamic); | 20877 return member._set(context, node, this, value, isDynamic); |
| 21434 } | 20878 } |
| 21435 else { | 20879 else { |
| 21436 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu
ments(null, [value])); | 20880 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu
ments(null, [value])); |
| 21437 } | 20881 } |
| 21438 } | 20882 } |
| 21439 Value.prototype.invoke = function(context, name, node, args, isDynamic) { | 20883 Value.prototype.invoke = function(context, name, node, args, isDynamic) { |
| 21440 if ($notnull_bool(this.get$_typeIsVarOrParameterType()) && name == '\$ne') { | 20884 if (this.get$_typeIsVarOrParameterType() && name == '\$ne') { |
| 21441 if (args.values.length != 1) { | 20885 if (args.values.length != 1) { |
| 21442 world.warning('wrong number of arguments for !=', node.span); | 20886 world.warning('wrong number of arguments for !=', node.span); |
| 21443 } | 20887 } |
| 21444 var eq = this.invoke(context, '\$eq', node, args, isDynamic); | 20888 var eq = this.invoke(context, '\$eq', node, args, isDynamic); |
| 21445 world.gen.corejs.useOperator('\$ne'); | 20889 world.gen.corejs.useOperator('\$ne'); |
| 21446 return new Value(eq.type, ('\$ne(' + this.code + ', ' + args.values.$index(0
).code + ')'), node.span, true); | 20890 return new Value(eq.type, ('\$ne(' + this.code + ', ' + args.values.$index(0
).code + ')'), node.span, true); |
| 21447 } | 20891 } |
| 21448 if (name == '\$call') { | 20892 if (name == '\$call') { |
| 21449 if ($notnull_bool(this.isType)) { | 20893 if (this.isType) { |
| 21450 world.error('must use "new" or "const" to construct a new instance', node.
span); | 20894 world.error('must use "new" or "const" to construct a new instance', node.
span); |
| 21451 } | 20895 } |
| 21452 if ($notnull_bool(this.type.needsVarCall(args))) { | 20896 if (this.type.needsVarCall(args)) { |
| 21453 return this._varCall(context, args); | 20897 return this._varCall(context, args); |
| 21454 } | 20898 } |
| 21455 } | 20899 } |
| 21456 var member = this._resolveMember(context, name, node, isDynamic); | 20900 var member = this._resolveMember(context, name, node, isDynamic); |
| 21457 if ($notnull_bool(member == null)) { | 20901 if (member == null) { |
| 21458 return this.invokeNoSuchMethod(context, name, node, args); | 20902 return this.invokeNoSuchMethod(context, name, node, args); |
| 21459 } | 20903 } |
| 21460 else { | 20904 else { |
| 21461 return member.invoke$5(context, node, this, args, isDynamic); | 20905 return member.invoke$5(context, node, this, args, isDynamic); |
| 21462 } | 20906 } |
| 21463 } | 20907 } |
| 21464 Value.prototype.canInvoke = function(context, name, args) { | 20908 Value.prototype.canInvoke = function(context, name, args) { |
| 21465 if ($notnull_bool(this.get$_typeIsVarOrParameterType()) && name == '\$ne') { | 20909 if (this.get$_typeIsVarOrParameterType() && name == '\$ne') { |
| 21466 return true; | 20910 return true; |
| 21467 } | 20911 } |
| 21468 if ($notnull_bool(this.type.get$isVarOrFunction()) && name == '\$call') { | 20912 if (this.type.get$isVarOrFunction() && name == '\$call') { |
| 21469 return true; | 20913 return true; |
| 21470 } | 20914 } |
| 21471 var member = this._resolveMember(context, name, null, true); | 20915 var member = this._resolveMember(context, name, null, true); |
| 21472 return $notnull_bool($ne(member, null)) && $notnull_bool(member.canInvoke$2(co
ntext, args)); | 20916 return $ne(member, null) && member.canInvoke$2(context, args); |
| 21473 } | 20917 } |
| 21474 Value.prototype._hasOverriddenNoSuchMethod = function() { | 20918 Value.prototype._hasOverriddenNoSuchMethod = function() { |
| 21475 if ($notnull_bool(this.isSuper)) { | 20919 if (this.isSuper) { |
| 21476 var m = this.type.getMember('noSuchMethod'); | 20920 var m = this.type.getMember('noSuchMethod'); |
| 21477 return $notnull_bool($ne(m, null)) && !$notnull_bool(m.declaringType.get$isO
bject()); | 20921 return $ne(m, null) && !m.declaringType.get$isObject(); |
| 21478 } | 20922 } |
| 21479 else { | 20923 else { |
| 21480 return this.type.resolveMember('noSuchMethod').members.length > 1; | 20924 return this.type.resolveMember('noSuchMethod').members.length > 1; |
| 21481 } | 20925 } |
| 21482 } | 20926 } |
| 21483 Value.prototype._tryResolveMember = function(context, name) { | 20927 Value.prototype._tryResolveMember = function(context, name) { |
| 21484 if ($notnull_bool(this.isSuper)) { | 20928 if (this.isSuper) { |
| 21485 return this.type.getMember(name); | 20929 return this.type.getMember(name); |
| 21486 } | 20930 } |
| 21487 else { | 20931 else { |
| 21488 return this.type.resolveMember(name); | 20932 return this.type.resolveMember(name); |
| 21489 } | 20933 } |
| 21490 } | 20934 } |
| 21491 Value.prototype._resolveMember = function(context, name, node, isDynamic) { | 20935 Value.prototype._resolveMember = function(context, name, node, isDynamic) { |
| 21492 var member; | 20936 var member; |
| 21493 if (!$notnull_bool(this.get$_typeIsVarOrParameterType())) { | 20937 if (!this.get$_typeIsVarOrParameterType()) { |
| 21494 member = this._tryResolveMember(context, name); | 20938 member = this._tryResolveMember(context, name); |
| 21495 if ($notnull_bool($ne(member, null)) && $notnull_bool(this.isType) && !$notn
ull_bool(member.get$isStatic())) { | 20939 if ($ne(member, null) && this.isType && !member.get$isStatic()) { |
| 21496 if (!$notnull_bool(isDynamic)) { | 20940 if (!isDynamic) { |
| 21497 world.error('can not refer to instance member as static', node.span); | 20941 world.error('can not refer to instance member as static', node.span); |
| 21498 } | 20942 } |
| 21499 return null; | 20943 return null; |
| 21500 } | 20944 } |
| 21501 if ($notnull_bool(member == null) && !$notnull_bool(isDynamic) && !$notnull_
bool(this._hasOverriddenNoSuchMethod())) { | 20945 if (member == null && !isDynamic && !this._hasOverriddenNoSuchMethod()) { |
| 21502 var typeName = this.type.name == null ? this.type.get$library().name : thi
s.type.name; | 20946 var typeName = this.type.name == null ? this.type.get$library().name : thi
s.type.name; |
| 21503 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); | 20947 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); |
| 21504 if ($notnull_bool(this.isType)) { | 20948 if (this.isType) { |
| 21505 world.error($assert_String(message), node.span); | 20949 world.error(message, node.span); |
| 21506 } | 20950 } |
| 21507 else { | 20951 else { |
| 21508 world.warning($assert_String(message), node.span); | 20952 world.warning(message, node.span); |
| 21509 } | 20953 } |
| 21510 } | 20954 } |
| 21511 } | 20955 } |
| 21512 if ($notnull_bool(member == null) && !$notnull_bool(this.isSuper) && !$notnull
_bool(this.isType)) { | 20956 if (member == null && !this.isSuper && !this.isType) { |
| 21513 member = context.findMembers(name); | 20957 member = context.findMembers(name); |
| 21514 if ($notnull_bool(member == null) && !$notnull_bool(isDynamic)) { | 20958 if (member == null && !isDynamic) { |
| 21515 world.warning(('' + name + ' is not defined anywhere in the world.'), node
.span); | 20959 world.warning(('' + name + ' is not defined anywhere in the world.'), node
.span); |
| 21516 } | 20960 } |
| 21517 } | 20961 } |
| 21518 return member; | 20962 return member; |
| 21519 } | 20963 } |
| 21520 Value.prototype.checkFirstClass = function(span) { | 20964 Value.prototype.checkFirstClass = function(span) { |
| 21521 if ($notnull_bool(this.isType)) { | 20965 if (this.isType) { |
| 21522 world.error('Types are not first class', span); | 20966 world.error('Types are not first class', span); |
| 21523 } | 20967 } |
| 21524 } | 20968 } |
| 21525 Value.prototype._varCall = function(context, args) { | 20969 Value.prototype._varCall = function(context, args) { |
| 21526 var stub = world.functionType.getCallStub(args); | 20970 var stub = world.functionType.getCallStub(args); |
| 21527 return new Value(world.varType, ('' + this.code + '.' + stub.get$name() + '('
+ args.getCode() + ')'), this.span, true); | 20971 return new Value(world.varType, ('' + this.code + '.' + stub.get$name() + '('
+ args.getCode() + ')'), this.span, true); |
| 21528 } | 20972 } |
| 21529 Value.prototype.needsConversion = function(toType) { | 20973 Value.prototype.needsConversion = function(toType) { |
| 21530 var callMethod = toType.getCallMethod(); | 20974 var callMethod = toType.getCallMethod(); |
| 21531 if ($notnull_bool($ne(callMethod, null))) { | 20975 if ($ne(callMethod, null)) { |
| 21532 var arity = callMethod.get$parameters().length; | 20976 var arity = callMethod.get$parameters().length; |
| 21533 var myCall = this.type.getCallMethod(); | 20977 var myCall = this.type.getCallMethod(); |
| 21534 if ($notnull_bool(myCall == null) || myCall.get$parameters().length != arity
) { | 20978 if (myCall == null || myCall.get$parameters().length != arity) { |
| 21535 return true; | 20979 return true; |
| 21536 } | 20980 } |
| 21537 } | 20981 } |
| 21538 if ($notnull_bool(options.enableTypeChecks)) { | 20982 if (options.enableTypeChecks) { |
| 21539 var fromType = this.type; | 20983 var fromType = this.type; |
| 21540 if ($notnull_bool(this.type.get$isVar()) && (this.code != 'null' || !$notnul
l_bool(toType.get$isNullable()))) { | 20984 if (this.type.get$isVar() && (this.code != 'null' || !toType.get$isNullable(
))) { |
| 21541 fromType = world.objectType; | 20985 fromType = world.objectType; |
| 21542 } | 20986 } |
| 21543 var bothNum = $notnull_bool(this.type.get$isNum()) && $notnull_bool(toType.g
et$isNum()); | 20987 var bothNum = this.type.get$isNum() && toType.get$isNum(); |
| 21544 return $notnull_bool(fromType.isSubtypeOf(toType)) || $notnull_bool(bothNum)
; | 20988 return fromType.isSubtypeOf(toType) || bothNum; |
| 21545 } | 20989 } |
| 21546 return false; | 20990 return false; |
| 21547 } | 20991 } |
| 21548 Value.prototype.convertTo = function(context, toType, node, isDynamic) { | 20992 Value.prototype.convertTo = function(context, toType, node, isDynamic) { |
| 21549 var $0; | 20993 var checked = !isDynamic; |
| 21550 var checked = !$notnull_bool(isDynamic); | |
| 21551 var callMethod = toType.getCallMethod(); | 20994 var callMethod = toType.getCallMethod(); |
| 21552 if ($notnull_bool($ne(callMethod, null))) { | 20995 if ($ne(callMethod, null)) { |
| 21553 if ($notnull_bool(checked) && !$notnull_bool(toType.isAssignable(this.type))
) { | 20996 if (checked && !toType.isAssignable(this.type)) { |
| 21554 this.convertWarning(toType, node); | 20997 this.convertWarning(toType, node); |
| 21555 } | 20998 } |
| 21556 var arity = callMethod.get$parameters().length; | 20999 var arity = callMethod.get$parameters().length; |
| 21557 var myCall = this.type.getCallMethod(); | 21000 var myCall = this.type.getCallMethod(); |
| 21558 if ($notnull_bool(myCall == null) || myCall.get$parameters().length != arity
) { | 21001 if (myCall == null || myCall.get$parameters().length != arity) { |
| 21559 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory
(arity)); | 21002 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory
(arity)); |
| 21560 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'),
node.span, true); | 21003 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'),
node.span, true); |
| 21561 return (($0 = $notnull_bool(this._isDomCallback(toType)) && !$notnull_bool
(this._isDomCallback(this.type)) ? val._wrapDomCallback(toType, arity) : val) &&
$0.is$Value()); | 21004 return this._isDomCallback(toType) && !this._isDomCallback(this.type) ? va
l._wrapDomCallback(toType, arity) : val; |
| 21562 } | 21005 } |
| 21563 else if ($notnull_bool(this._isDomCallback(toType)) && !$notnull_bool(this._
isDomCallback(this.type))) { | 21006 else if (this._isDomCallback(toType) && !this._isDomCallback(this.type)) { |
| 21564 return this._wrapDomCallback(toType, arity); | 21007 return this._wrapDomCallback(toType, arity); |
| 21565 } | 21008 } |
| 21566 } | 21009 } |
| 21567 var fromType = this.type; | 21010 var fromType = this.type; |
| 21568 if ($notnull_bool(this.type.get$isVar()) && (this.code != 'null' || !$notnull_
bool(toType.get$isNullable()))) { | 21011 if (this.type.get$isVar() && (this.code != 'null' || !toType.get$isNullable())
) { |
| 21569 fromType = world.objectType; | 21012 fromType = world.objectType; |
| 21570 } | 21013 } |
| 21571 var bothNum = $notnull_bool(this.type.get$isNum()) && $notnull_bool(toType.get
$isNum()); | 21014 var bothNum = this.type.get$isNum() && toType.get$isNum(); |
| 21572 if ($notnull_bool(fromType.isSubtypeOf(toType)) || $notnull_bool(bothNum)) { | 21015 if (fromType.isSubtypeOf(toType) || bothNum) { |
| 21573 return this; | 21016 return this; |
| 21574 } | 21017 } |
| 21575 if ($notnull_bool(checked) && !$notnull_bool(toType.isSubtypeOf(this.type))) { | 21018 if (checked && !toType.isSubtypeOf(this.type)) { |
| 21576 this.convertWarning(toType, node); | 21019 this.convertWarning(toType, node); |
| 21577 } | 21020 } |
| 21578 if ($notnull_bool(options.enableTypeChecks)) { | 21021 if (options.enableTypeChecks) { |
| 21579 return this._typeAssert(context, toType, node); | 21022 return this._typeAssert(context, toType, node); |
| 21580 } | 21023 } |
| 21581 else { | 21024 else { |
| 21582 return this; | 21025 return this; |
| 21583 } | 21026 } |
| 21584 } | 21027 } |
| 21585 Value.prototype._isDomCallback = function(toType) { | 21028 Value.prototype._isDomCallback = function(toType) { |
| 21586 return ((toType.get$definition() instanceof FunctionTypeDefinition) && $eq(toT
ype.get$library(), world.get$dom())); | 21029 return ((toType.get$definition() instanceof FunctionTypeDefinition) && $eq(toT
ype.get$library(), world.get$dom())); |
| 21587 } | 21030 } |
| 21588 Value.prototype._wrapDomCallback = function(toType, arity) { | 21031 Value.prototype._wrapDomCallback = function(toType, arity) { |
| 21589 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th
is.span, true); | 21032 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th
is.span, true); |
| 21590 } | 21033 } |
| 21591 Value.prototype._typeAssert = function(context, toType, node) { | 21034 Value.prototype._typeAssert = function(context, toType, node) { |
| 21592 if ((toType instanceof ParameterType)) { | 21035 if ((toType instanceof ParameterType)) { |
| 21593 var p = (toType && toType.is$ParameterType()); | 21036 var p = toType; |
| 21594 toType = p.extendsType; | 21037 toType = p.extendsType; |
| 21595 } | 21038 } |
| 21596 if (toType.getCallMethod() != null) { | 21039 if (toType.getCallMethod() != null) { |
| 21597 return this; | 21040 return this; |
| 21598 } | 21041 } |
| 21599 if ($notnull_bool(toType.get$isObject()) || $notnull_bool(toType.get$isVar()))
{ | 21042 if (toType.get$isObject() || toType.get$isVar()) { |
| 21600 world.internalError(('We thought ' + this.type.name + ' is not a subtype of
' + toType.name + '?')); | 21043 world.internalError(('We thought ' + this.type.name + ' is not a subtype of
' + toType.name + '?')); |
| 21601 } | 21044 } |
| 21602 if ($notnull_bool(toType.get$isNum())) toType = world.numType; | 21045 if (toType.get$isNum()) toType = world.numType; |
| 21603 var check; | 21046 var check; |
| 21604 if ($notnull_bool(toType.get$isVoid())) { | 21047 if (toType.get$isVoid()) { |
| 21605 check = ('\$assert_void(' + this.code + ')'); | 21048 check = ('\$assert_void(' + this.code + ')'); |
| 21606 if (toType.typeCheckCode == null) { | 21049 if (toType.typeCheckCode == null) { |
| 21607 toType.typeCheckCode = "function $assert_void(x) {\n return x == null ? x
: x.is$void(); // throws TypeError\n}"; | 21050 toType.typeCheckCode = "function $assert_void(x) {\n return x == null ? x
: x.is$void(); // throws TypeError\n}"; |
| 21608 } | 21051 } |
| 21609 } | 21052 } |
| 21610 else if ($eq(toType, world.nonNullBool)) { | 21053 else if ($eq(toType, world.nonNullBool)) { |
| 21611 world.gen.corejs.useNotNullBool = true; | 21054 world.gen.corejs.useNotNullBool = true; |
| 21612 check = ('\$notnull_bool(' + this.code + ')'); | 21055 check = ('\$notnull_bool(' + this.code + ')'); |
| 21613 } | 21056 } |
| 21614 else if ($notnull_bool(toType.get$library().get$isCore()) && toType.get$typeof
Name() != null) { | 21057 else if (toType.get$library().get$isCore() && toType.get$typeofName() != null)
{ |
| 21615 check = ('\$assert_' + toType.name + '(' + this.code + ')'); | 21058 check = ('\$assert_' + toType.name + '(' + this.code + ')'); |
| 21616 if (toType.typeCheckCode == null) { | 21059 if (toType.typeCheckCode == null) { |
| 21617 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}"); | 21060 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}"); |
| 21618 } | 21061 } |
| 21619 } | 21062 } |
| 21620 else { | 21063 else { |
| 21621 toType.isTested = true; | 21064 toType.isTested = true; |
| 21622 var temp = context.getTemp(this); | 21065 var temp = context.getTemp(this); |
| 21623 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + '
&&'); | 21066 check = ('(' + context.assignTemp(temp, this).code + ' &&'); |
| 21624 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); | 21067 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); |
| 21625 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value())); | 21068 if ($ne(this, temp)) context.freeTemp(temp); |
| 21626 } | 21069 } |
| 21627 return new Value(toType, check, this.span, true); | 21070 return new Value(toType, check, this.span, true); |
| 21628 } | 21071 } |
| 21629 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck)
{ | 21072 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck)
{ |
| 21630 if ($notnull_bool(toType.get$isVar())) { | 21073 if (toType.get$isVar()) { |
| 21631 world.error('can not resolve type', span); | 21074 world.error('can not resolve type', span); |
| 21632 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true'
, null); | 21075 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true'
, null); |
| 21633 } | 21076 } |
| 21634 if ((toType instanceof ParameterType)) { | 21077 if ((toType instanceof ParameterType)) { |
| 21635 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true'
, null); | 21078 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true'
, null); |
| 21636 } | 21079 } |
| 21637 var testCode = null; | 21080 var testCode = null; |
| 21638 if ($notnull_bool(toType.get$library().get$isCore())) { | 21081 if (toType.get$library().get$isCore()) { |
| 21639 var typeofName = toType.get$typeofName(); | 21082 var typeofName = toType.get$typeofName(); |
| 21640 if ($notnull_bool($ne(typeofName, null))) { | 21083 if ($ne(typeofName, null)) { |
| 21641 testCode = ("(typeof(" + this.code + ") " + ($notnull_bool(isTrue) ? '=='
: '!=') + " '" + typeofName + "')"); | 21084 testCode = ("(typeof(" + this.code + ") " + (isTrue ? '==' : '!=') + " '"
+ typeofName + "')"); |
| 21642 } | 21085 } |
| 21643 } | 21086 } |
| 21644 if ($notnull_bool(toType.get$isClass()) && !(toType instanceof ConcreteType))
{ | 21087 if (toType.get$isClass() && !(toType instanceof ConcreteType)) { |
| 21645 toType.markUsed(); | 21088 toType.markUsed(); |
| 21646 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); | 21089 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); |
| 21647 if (!$notnull_bool(isTrue)) { | 21090 if (!isTrue) { |
| 21648 testCode = '!' + testCode; | 21091 testCode = '!' + testCode; |
| 21649 } | 21092 } |
| 21650 } | 21093 } |
| 21651 if (testCode == null) { | 21094 if (testCode == null) { |
| 21652 toType.isTested = true; | 21095 toType.isTested = true; |
| 21653 var temp = context.getTemp(this); | 21096 var temp = context.getTemp(this); |
| 21654 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code +
' &&'); | 21097 testCode = ('(' + context.assignTemp(temp, this).code + ' &&'); |
| 21655 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')'
); | 21098 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')'
); |
| 21656 if ($notnull_bool(isTrue)) { | 21099 if (isTrue) { |
| 21657 testCode = '!!' + testCode; | 21100 testCode = '!!' + testCode; |
| 21658 } | 21101 } |
| 21659 else { | 21102 else { |
| 21660 testCode = '!' + testCode; | 21103 testCode = '!' + testCode; |
| 21661 } | 21104 } |
| 21662 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value())); | 21105 if ($ne(this, temp)) context.freeTemp(temp); |
| 21663 } | 21106 } |
| 21664 return new Value(world.nonNullBool, testCode, span, true); | 21107 return new Value(world.nonNullBool, testCode, span, true); |
| 21665 } | 21108 } |
| 21666 Value.prototype.convertWarning = function(toType, node) { | 21109 Value.prototype.convertWarning = function(toType, node) { |
| 21667 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType
.name + '"'), node.span); | 21110 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType
.name + '"'), node.span); |
| 21668 } | 21111 } |
| 21669 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { | 21112 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { |
| 21670 var pos = ''; | 21113 var pos = ''; |
| 21671 if (args != null) { | 21114 if (args != null) { |
| 21672 var argsCode = []; | 21115 var argsCode = []; |
| 21673 for (var i = 0; | 21116 for (var i = 0; |
| 21674 i < args.get$length(); i++) { | 21117 i < args.get$length(); i++) { |
| 21675 argsCode.add$1(args.values.$index(i).code); | 21118 argsCode.add$1(args.values.$index(i).code); |
| 21676 } | 21119 } |
| 21677 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); | 21120 pos = Strings.join(argsCode, ", "); |
| 21678 } | 21121 } |
| 21679 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, t
rue), new Value(world.listType, ('[' + pos + ']'), node.span, true)]; | 21122 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, t
rue), new Value(world.listType, ('[' + pos + ']'), node.span, true)]; |
| 21680 return this._resolveMember(context, 'noSuchMethod', node, false).invoke$4(cont
ext, node, this, new Arguments(null, noSuchArgs)); | 21123 return this._resolveMember(context, 'noSuchMethod', node, false).invoke$4(cont
ext, node, this, new Arguments(null, noSuchArgs)); |
| 21681 } | 21124 } |
| 21682 Value.prototype.invokeSpecial = function(name, args, returnType) { | 21125 Value.prototype.invokeSpecial = function(name, args, returnType) { |
| 21683 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 455, 12
); | |
| 21684 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4
56, 12); | |
| 21685 var argsString = args.getCode(); | 21126 var argsString = args.getCode(); |
| 21686 if (name == '\$index' || name == '\$setindex') { | 21127 if (name == '\$index' || name == '\$setindex') { |
| 21687 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString
+ ')'), this.span, true); | 21128 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString
+ ')'), this.span, true); |
| 21688 } | 21129 } |
| 21689 else { | 21130 else { |
| 21690 if (argsString.length > 0) argsString = (', ' + argsString + ''); | 21131 if (argsString.length > 0) argsString = (', ' + argsString + ''); |
| 21691 world.gen.corejs.useOperator(name); | 21132 world.gen.corejs.useOperator(name); |
| 21692 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString
+ ')'), this.span, true); | 21133 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString
+ ')'), this.span, true); |
| 21693 } | 21134 } |
| 21694 } | 21135 } |
| 21695 Value.prototype.checkFirstClass$1 = function($0) { | 21136 Value.prototype.checkFirstClass$1 = function($0) { |
| 21696 return this.checkFirstClass(($0 && $0.is$SourceSpan())); | 21137 return this.checkFirstClass($0); |
| 21697 }; | 21138 }; |
| 21698 Value.prototype.convertTo$3 = function($0, $1, $2) { | 21139 Value.prototype.convertTo$3 = function($0, $1, $2) { |
| 21699 return this.convertTo(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Type(
)), ($2 && $2.is$lang_Node()), false); | 21140 return this.convertTo($0, $1, $2, false); |
| 21700 }; | 21141 }; |
| 21701 Value.prototype.convertTo$4 = function($0, $1, $2, $3) { | 21142 Value.prototype.convertTo$4 = function($0, $1, $2, $3) { |
| 21702 return this.convertTo(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Type(
)), ($2 && $2.is$lang_Node()), $assert_bool($3)); | 21143 return this.convertTo($0, $1, $2, $3); |
| 21703 }; | 21144 }; |
| 21704 Value.prototype.get_$3 = function($0, $1, $2) { | 21145 Value.prototype.get_$3 = function($0, $1, $2) { |
| 21705 return this.get_(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 && $
2.is$lang_Node())); | 21146 return this.get_($0, $1, $2); |
| 21706 }; | 21147 }; |
| 21707 Value.prototype.instanceOf$3$isTrue$forceCheck = function($0, $1, $2, isTrue, fo
rceCheck) { | 21148 Value.prototype.instanceOf$3$isTrue$forceCheck = function($0, $1, $2, isTrue, fo
rceCheck) { |
| 21708 return this.instanceOf(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Type
()), ($2 && $2.is$SourceSpan()), $assert_bool(isTrue), $assert_bool(forceCheck))
; | 21149 return this.instanceOf($0, $1, $2, isTrue, forceCheck); |
| 21709 }; | 21150 }; |
| 21710 Value.prototype.instanceOf$4 = function($0, $1, $2, $3) { | 21151 Value.prototype.instanceOf$4 = function($0, $1, $2, $3) { |
| 21711 return this.instanceOf(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Type
()), ($2 && $2.is$SourceSpan()), $assert_bool($3), false); | 21152 return this.instanceOf($0, $1, $2, $3, false); |
| 21712 }; | 21153 }; |
| 21713 Value.prototype.invoke$4 = function($0, $1, $2, $3) { | 21154 Value.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 21714 return this.invoke(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 &&
$2.is$lang_Node()), ($3 && $3.is$Arguments()), false); | 21155 return this.invoke($0, $1, $2, $3, false); |
| 21715 }; | 21156 }; |
| 21716 Value.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic) { | 21157 Value.prototype.invoke$4$isDynamic = function($0, $1, $2, $3, isDynamic) { |
| 21717 return this.invoke(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 &&
$2.is$lang_Node()), ($3 && $3.is$Arguments()), $assert_bool(isDynamic)); | 21158 return this.invoke($0, $1, $2, $3, isDynamic); |
| 21718 }; | 21159 }; |
| 21719 Value.prototype.invoke$5 = function($0, $1, $2, $3, $4) { | 21160 Value.prototype.invoke$5 = function($0, $1, $2, $3, $4) { |
| 21720 return this.invoke(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 &&
$2.is$lang_Node()), ($3 && $3.is$Arguments()), $assert_bool($4)); | 21161 return this.invoke($0, $1, $2, $3, $4); |
| 21721 }; | 21162 }; |
| 21722 Value.prototype.needsConversion$1 = function($0) { | 21163 Value.prototype.needsConversion$1 = function($0) { |
| 21723 return this.needsConversion(($0 && $0.is$lang_Type())); | 21164 return this.needsConversion($0); |
| 21724 }; | 21165 }; |
| 21725 Value.prototype.set_$4 = function($0, $1, $2, $3) { | 21166 Value.prototype.set_$4 = function($0, $1, $2, $3) { |
| 21726 return this.set_(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 && $
2.is$lang_Node()), ($3 && $3.is$Value()), false); | 21167 return this.set_($0, $1, $2, $3, false); |
| 21727 }; | 21168 }; |
| 21728 // ********** Code for EvaluatedValue ************** | 21169 // ********** Code for EvaluatedValue ************** |
| 21729 function EvaluatedValue() {} | 21170 function EvaluatedValue() {} |
| 21730 EvaluatedValue._internal$ctor = function(type, actualValue, canonicalCode, span,
code) { | 21171 EvaluatedValue._internal$ctor = function(type, actualValue, canonicalCode, span,
code) { |
| 21731 this.actualValue = actualValue; | 21172 this.actualValue = actualValue; |
| 21732 this.canonicalCode = canonicalCode; | 21173 this.canonicalCode = canonicalCode; |
| 21733 Value.call(this, type, code, span, false); | 21174 Value.call(this, type, code, span, false); |
| 21734 // Initializers done | 21175 // Initializers done |
| 21735 } | 21176 } |
| 21736 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype; | 21177 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype; |
| 21737 $inherits(EvaluatedValue, Value); | 21178 $inherits(EvaluatedValue, Value); |
| 21738 EvaluatedValue.EvaluatedValue$factory = function(type, actualValue, canonicalCod
e, span) { | 21179 EvaluatedValue.EvaluatedValue$factory = function(type, actualValue, canonicalCod
e, span) { |
| 21739 return new EvaluatedValue._internal$ctor(type, actualValue, canonicalCode, spa
n, EvaluatedValue.codeWithComments(canonicalCode, span)); | 21180 return new EvaluatedValue._internal$ctor(type, actualValue, canonicalCode, spa
n, EvaluatedValue.codeWithComments(canonicalCode, span)); |
| 21740 } | 21181 } |
| 21741 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue;
}; | 21182 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue;
}; |
| 21742 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV
alue = value; }; | 21183 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV
alue = value; }; |
| 21743 EvaluatedValue.prototype.get$isConst = function() { | 21184 EvaluatedValue.prototype.get$isConst = function() { |
| 21744 return true; | 21185 return true; |
| 21745 } | 21186 } |
| 21746 EvaluatedValue.prototype.get$canonicalCode = function() { return this.canonicalC
ode; }; | 21187 EvaluatedValue.prototype.get$canonicalCode = function() { return this.canonicalC
ode; }; |
| 21747 EvaluatedValue.prototype.set$canonicalCode = function(value) { return this.canon
icalCode = value; }; | 21188 EvaluatedValue.prototype.set$canonicalCode = function(value) { return this.canon
icalCode = value; }; |
| 21748 EvaluatedValue.codeWithComments = function(canonicalCode, span) { | 21189 EvaluatedValue.codeWithComments = function(canonicalCode, span) { |
| 21749 return (span != null && span.get$text() != canonicalCode) ? ('' + canonicalCod
e + '/*' + span.get$text() + '*/') : canonicalCode; | 21190 return (span != null && span.get$text() != canonicalCode) ? ('' + canonicalCod
e + '/*' + span.get$text() + '*/') : canonicalCode; |
| 21750 } | 21191 } |
| 21751 // ********** Code for ConstListValue ************** | 21192 // ********** Code for ConstListValue ************** |
| 21752 function ConstListValue() {} | 21193 function ConstListValue() {} |
| 21753 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod
e, span, code) { | 21194 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod
e, span, code) { |
| 21754 this.values = values; | 21195 this.values = values; |
| 21755 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual
Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); | 21196 EvaluatedValue._internal$ctor.call(this, type, actualValue, canonicalCode, spa
n, code); |
| 21756 // Initializers done | 21197 // Initializers done |
| 21757 } | 21198 } |
| 21758 ConstListValue._internal$ctor.prototype = ConstListValue.prototype; | 21199 ConstListValue._internal$ctor.prototype = ConstListValue.prototype; |
| 21759 $inherits(ConstListValue, EvaluatedValue); | 21200 $inherits(ConstListValue, EvaluatedValue); |
| 21760 ConstListValue.ConstListValue$factory = function(type, values, actualValue, cano
nicalCode, span) { | 21201 ConstListValue.ConstListValue$factory = function(type, values, actualValue, cano
nicalCode, span) { |
| 21761 return new ConstListValue._internal$ctor(type, values, actualValue, canonicalC
ode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); | 21202 return new ConstListValue._internal$ctor(type, values, actualValue, canonicalC
ode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); |
| 21762 } | 21203 } |
| 21763 // ********** Code for ConstMapValue ************** | 21204 // ********** Code for ConstMapValue ************** |
| 21764 function ConstMapValue() {} | 21205 function ConstMapValue() {} |
| 21765 ConstMapValue._internal$ctor = function(type, values, actualValue, canonicalCode
, span, code) { | 21206 ConstMapValue._internal$ctor = function(type, values, actualValue, canonicalCode
, span, code) { |
| 21766 this.values = values; | 21207 this.values = values; |
| 21767 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual
Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); | 21208 EvaluatedValue._internal$ctor.call(this, type, actualValue, canonicalCode, spa
n, code); |
| 21768 // Initializers done | 21209 // Initializers done |
| 21769 } | 21210 } |
| 21770 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype; | 21211 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype; |
| 21771 $inherits(ConstMapValue, EvaluatedValue); | 21212 $inherits(ConstMapValue, EvaluatedValue); |
| 21772 ConstMapValue.ConstMapValue$factory = function(type, keyValuePairs, actualValue,
canonicalCode, span) { | 21213 ConstMapValue.ConstMapValue$factory = function(type, keyValuePairs, actualValue,
canonicalCode, span) { |
| 21773 var values = new HashMapImplementation(); | 21214 var values = new HashMapImplementation(); |
| 21774 for (var i = 0; | 21215 for (var i = 0; |
| 21775 i < keyValuePairs.length; i += 2) { | 21216 i < keyValuePairs.length; i += 2) { |
| 21776 values.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$i
ndex(i + 1)); | 21217 values.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$i
ndex(i + 1)); |
| 21777 } | 21218 } |
| 21778 return new ConstMapValue._internal$ctor(type, values, actualValue, canonicalCo
de, span, EvaluatedValue.codeWithComments(canonicalCode, span)); | 21219 return new ConstMapValue._internal$ctor(type, values, actualValue, canonicalCo
de, span, EvaluatedValue.codeWithComments(canonicalCode, span)); |
| 21779 } | 21220 } |
| 21780 // ********** Code for ConstObjectValue ************** | 21221 // ********** Code for ConstObjectValue ************** |
| 21781 function ConstObjectValue() {} | 21222 function ConstObjectValue() {} |
| 21782 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC
ode, span, code) { | 21223 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC
ode, span, code) { |
| 21783 this.fields = fields; | 21224 this.fields = fields; |
| 21784 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual
Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); | 21225 EvaluatedValue._internal$ctor.call(this, type, actualValue, canonicalCode, spa
n, code); |
| 21785 // Initializers done | 21226 // Initializers done |
| 21786 } | 21227 } |
| 21787 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype; | 21228 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype; |
| 21788 $inherits(ConstObjectValue, EvaluatedValue); | 21229 $inherits(ConstObjectValue, EvaluatedValue); |
| 21789 ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode
, span) { | 21230 ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode
, span) { |
| 21790 var fieldValues = []; | 21231 var fieldValues = []; |
| 21791 var $list = fields.getKeys(); | 21232 var $list = fields.getKeys(); |
| 21792 for (var $i = fields.getKeys().iterator$0(); $i.hasNext$0(); ) { | 21233 for (var $i = fields.getKeys().iterator$0(); $i.hasNext$0(); ) { |
| 21793 var f = $i.next$0(); | 21234 var f = $i.next$0(); |
| 21794 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + '')); | 21235 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + '')); |
| 21795 } | 21236 } |
| 21796 fieldValues.sort((function (a, b) { | 21237 fieldValues.sort((function (a, b) { |
| 21797 return a.compareTo$1(b); | 21238 return a.compareTo$1(b); |
| 21798 }) | 21239 }) |
| 21799 ); | 21240 ); |
| 21800 var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldVa
lues, ',') + ']'; | 21241 var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldVa
lues, ',') + ']'; |
| 21801 return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonica
lCode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); | 21242 return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonica
lCode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); |
| 21802 } | 21243 } |
| 21803 // ********** Code for GlobalValue ************** | 21244 // ********** Code for GlobalValue ************** |
| 21804 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span,
dependencies) { | 21245 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span,
dependencies) { |
| 21805 this.field = field; | 21246 this.field = field; |
| 21806 this.name = name; | 21247 this.name = name; |
| 21807 this.exp = exp; | 21248 this.exp = exp; |
| 21808 this.canonicalCode = canonicalCode; | 21249 this.canonicalCode = canonicalCode; |
| 21809 this.dependencies = dependencies; | 21250 this.dependencies = dependencies; |
| 21810 Value.call(this, type, code, span, !$notnull_bool(isConst)); | 21251 Value.call(this, type, code, span, !isConst); |
| 21811 // Initializers done | 21252 // Initializers done |
| 21812 } | 21253 } |
| 21813 $inherits(GlobalValue, Value); | 21254 $inherits(GlobalValue, Value); |
| 21814 GlobalValue.prototype.is$GlobalValue = function(){return this;}; | |
| 21815 GlobalValue.prototype.is$Comparable = function(){return this;}; | |
| 21816 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies)
{ | 21255 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies)
{ |
| 21817 var code = ($notnull_bool(exp.get$isConst()) ? exp.get$canonicalCode() : exp.c
ode); | 21256 var code = (exp.get$isConst() ? exp.get$canonicalCode() : exp.code); |
| 21818 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie
ld.get$name() + '*/'); | 21257 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie
ld.get$name() + '*/'); |
| 21819 return new GlobalValue(exp.type, $assert_String(codeWithComment), field.isFina
l, field, null, exp, code, exp.span, dependencies.filter$1((function (d) { | 21258 return new GlobalValue(exp.type, codeWithComment, field.isFinal, field, null,
exp, code, exp.span, dependencies.filter$1((function (d) { |
| 21820 return (d instanceof GlobalValue); | 21259 return (d instanceof GlobalValue); |
| 21821 }) | 21260 }) |
| 21822 )); | 21261 )); |
| 21823 } | 21262 } |
| 21824 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies
) { | 21263 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies
) { |
| 21825 var name = ("const\$" + uniqueId + ""); | 21264 var name = ("const\$" + uniqueId + ""); |
| 21826 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/"); | 21265 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/"); |
| 21827 return new GlobalValue(exp.type, $assert_String(codeWithComment), true, null,
name, exp, name, exp.span, dependencies.filter$1((function (d) { | 21266 return new GlobalValue(exp.type, codeWithComment, true, null, name, exp, name,
exp.span, dependencies.filter$1((function (d) { |
| 21828 return (d instanceof GlobalValue); | 21267 return (d instanceof GlobalValue); |
| 21829 }) | 21268 }) |
| 21830 )); | 21269 )); |
| 21831 } | 21270 } |
| 21832 GlobalValue.prototype.get$name = function() { return this.name; }; | 21271 GlobalValue.prototype.get$name = function() { return this.name; }; |
| 21833 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; | 21272 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; |
| 21834 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode
; }; | 21273 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode
; }; |
| 21835 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica
lCode = value; }; | 21274 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica
lCode = value; }; |
| 21836 GlobalValue.prototype.get$isConst = function() { | 21275 GlobalValue.prototype.get$isConst = function() { |
| 21837 return $notnull_bool(this.exp.get$isConst()) && (this.field == null || $notnul
l_bool(this.field.isFinal)); | 21276 return this.exp.get$isConst() && (this.field == null || this.field.isFinal); |
| 21838 } | 21277 } |
| 21839 GlobalValue.prototype.get$actualValue = function() { | 21278 GlobalValue.prototype.get$actualValue = function() { |
| 21840 return this.exp.get$dynamic().get$actualValue(); | 21279 return this.exp.get$dynamic().get$actualValue(); |
| 21841 } | 21280 } |
| 21842 GlobalValue.prototype.compareTo = function(other) { | 21281 GlobalValue.prototype.compareTo = function(other) { |
| 21843 if ($eq(other, this)) { | 21282 if ($eq(other, this)) { |
| 21844 return 0; | 21283 return 0; |
| 21845 } | 21284 } |
| 21846 else if (this.dependencies.indexOf(other, 0) >= 0) { | 21285 else if (this.dependencies.indexOf(other, 0) >= 0) { |
| 21847 return 1; | 21286 return 1; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 21862 return -1; | 21301 return -1; |
| 21863 } | 21302 } |
| 21864 else if (this.name != null) { | 21303 else if (this.name != null) { |
| 21865 return this.name.compareTo(other.name); | 21304 return this.name.compareTo(other.name); |
| 21866 } | 21305 } |
| 21867 else { | 21306 else { |
| 21868 return this.field.name.compareTo(other.field.name); | 21307 return this.field.name.compareTo(other.field.name); |
| 21869 } | 21308 } |
| 21870 } | 21309 } |
| 21871 GlobalValue.prototype.compareTo$1 = function($0) { | 21310 GlobalValue.prototype.compareTo$1 = function($0) { |
| 21872 return this.compareTo(($0 && $0.is$GlobalValue())); | 21311 return this.compareTo($0); |
| 21873 }; | 21312 }; |
| 21874 // ********** Code for BareValue ************** | 21313 // ********** Code for BareValue ************** |
| 21875 function BareValue(home, outermost, span) { | 21314 function BareValue(home, outermost, span) { |
| 21876 this.home = home; | 21315 this.home = home; |
| 21877 Value.call(this, outermost.method.declaringType, null, span, false); | 21316 Value.call(this, outermost.method.declaringType, null, span, false); |
| 21878 // Initializers done | 21317 // Initializers done |
| 21879 this.isType = outermost.get$isStatic(); | 21318 this.isType = outermost.get$isStatic(); |
| 21880 } | 21319 } |
| 21881 $inherits(BareValue, Value); | 21320 $inherits(BareValue, Value); |
| 21882 BareValue.prototype._tryResolveMember = function(context, name) { | 21321 BareValue.prototype._tryResolveMember = function(context, name) { |
| 21883 $assert($eq(context, this.home), "context == home", "value.dart", 660, 12); | |
| 21884 var member = this.type.resolveMember(name); | 21322 var member = this.type.resolveMember(name); |
| 21885 if ($notnull_bool($ne(member, null))) { | 21323 if ($ne(member, null)) { |
| 21886 $assert(this.code == null, "code == null", "value.dart", 665, 14); | 21324 if (this.isType) { |
| 21887 if ($notnull_bool(this.isType)) { | |
| 21888 this.code = this.type.get$jsname(); | 21325 this.code = this.type.get$jsname(); |
| 21889 } | 21326 } |
| 21890 else { | 21327 else { |
| 21891 this.code = this.home._makeThisCode(); | 21328 this.code = this.home._makeThisCode(); |
| 21892 } | 21329 } |
| 21893 return member; | 21330 return member; |
| 21894 } | 21331 } |
| 21895 member = this.home.get$library().lookup(name, this.span); | 21332 member = this.home.get$library().lookup(name, this.span); |
| 21896 if ($notnull_bool($ne(member, null))) { | 21333 if ($ne(member, null)) { |
| 21897 return member; | 21334 return member; |
| 21898 } | 21335 } |
| 21899 return null; | 21336 return null; |
| 21900 } | 21337 } |
| 21901 // ********** Code for CompilerException ************** | 21338 // ********** Code for CompilerException ************** |
| 21902 function CompilerException(_message, _location) { | 21339 function CompilerException(_message, _location) { |
| 21903 this._lang_message = _message; | 21340 this._lang_message = _message; |
| 21904 this._location = _location; | 21341 this._location = _location; |
| 21905 // Initializers done | 21342 // Initializers done |
| 21906 } | 21343 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 21924 this.seenFatal = false | 21361 this.seenFatal = false |
| 21925 this.files = files; | 21362 this.files = files; |
| 21926 this.libraries = $map([]); | 21363 this.libraries = $map([]); |
| 21927 this._todo = []; | 21364 this._todo = []; |
| 21928 this._members = $map([]); | 21365 this._members = $map([]); |
| 21929 this._topNames = $map([]); | 21366 this._topNames = $map([]); |
| 21930 this.reader = new LibraryReader(); | 21367 this.reader = new LibraryReader(); |
| 21931 // Initializers done | 21368 // Initializers done |
| 21932 } | 21369 } |
| 21933 World.prototype.get$coreimpl = function() { | 21370 World.prototype.get$coreimpl = function() { |
| 21934 var $0; | 21371 return this.libraries.$index('dart:coreimpl'); |
| 21935 return (($0 = this.libraries.$index('dart:coreimpl')) && $0.is$Library()); | |
| 21936 } | 21372 } |
| 21937 World.prototype.get$dom = function() { | 21373 World.prototype.get$dom = function() { |
| 21938 var $0; | 21374 return this.libraries.$index('dart:dom'); |
| 21939 return (($0 = this.libraries.$index('dart:dom')) && $0.is$Library()); | |
| 21940 } | 21375 } |
| 21941 World.prototype.get$functionType = function() { return this.functionType; }; | 21376 World.prototype.get$functionType = function() { return this.functionType; }; |
| 21942 World.prototype.set$functionType = function(value) { return this.functionType =
value; }; | 21377 World.prototype.set$functionType = function(value) { return this.functionType =
value; }; |
| 21943 World.prototype.init = function() { | 21378 World.prototype.init = function() { |
| 21944 var $0; | |
| 21945 this.corelib = new Library(this.readFile('dart:core')); | 21379 this.corelib = new Library(this.readFile('dart:core')); |
| 21946 this.libraries.$setindex('dart:core', this.corelib); | 21380 this.libraries.$setindex('dart:core', this.corelib); |
| 21947 this._todo.add(this.corelib); | 21381 this._todo.add(this.corelib); |
| 21948 this.voidType = (($0 = this._addToCoreLib('void', false)) && $0.is$DefinedType
()); | 21382 this.voidType = this._addToCoreLib('void', false); |
| 21949 this.dynamicType = (($0 = this._addToCoreLib('Dynamic', false)) && $0.is$Defin
edType()); | 21383 this.dynamicType = this._addToCoreLib('Dynamic', false); |
| 21950 this.varType = this.dynamicType; | 21384 this.varType = this.dynamicType; |
| 21951 this.objectType = (($0 = this._addToCoreLib('Object', true)) && $0.is$DefinedT
ype()); | 21385 this.objectType = this._addToCoreLib('Object', true); |
| 21952 this.numType = (($0 = this._addToCoreLib('num', false)) && $0.is$DefinedType()
); | 21386 this.numType = this._addToCoreLib('num', false); |
| 21953 this.intType = (($0 = this._addToCoreLib('int', false)) && $0.is$DefinedType()
); | 21387 this.intType = this._addToCoreLib('int', false); |
| 21954 this.doubleType = (($0 = this._addToCoreLib('double', false)) && $0.is$Defined
Type()); | 21388 this.doubleType = this._addToCoreLib('double', false); |
| 21955 this.boolType = (($0 = this._addToCoreLib('bool', false)) && $0.is$DefinedType
()); | 21389 this.boolType = this._addToCoreLib('bool', false); |
| 21956 this.stringType = (($0 = this._addToCoreLib('String', false)) && $0.is$Defined
Type()); | 21390 this.stringType = this._addToCoreLib('String', false); |
| 21957 this.listType = (($0 = this._addToCoreLib('List', false)) && $0.is$DefinedType
()); | 21391 this.listType = this._addToCoreLib('List', false); |
| 21958 this.mapType = (($0 = this._addToCoreLib('Map', false)) && $0.is$DefinedType()
); | 21392 this.mapType = this._addToCoreLib('Map', false); |
| 21959 this.functionType = (($0 = this._addToCoreLib('Function', false)) && $0.is$Def
inedType()); | 21393 this.functionType = this._addToCoreLib('Function', false); |
| 21960 this.nonNullBool = new NonNullableType(this.boolType); | 21394 this.nonNullBool = new NonNullableType(this.boolType); |
| 21961 } | 21395 } |
| 21962 World.prototype._addMember = function(member) { | 21396 World.prototype._addMember = function(member) { |
| 21963 $assert(!$notnull_bool(member.get$isPrivate()), "!member.isPrivate", "world.da
rt", 145, 12); | 21397 if (member.get$isStatic()) { |
| 21964 if ($notnull_bool(member.get$isStatic())) { | 21398 if (member.declaringType.get$isTop()) { |
| 21965 if ($notnull_bool(member.declaringType.get$isTop())) { | |
| 21966 this._addTopName(member); | 21399 this._addTopName(member); |
| 21967 } | 21400 } |
| 21968 return; | 21401 return; |
| 21969 } | 21402 } |
| 21970 var mset = this._members.$index(member.name); | 21403 var mset = this._members.$index(member.name); |
| 21971 if ($notnull_bool(mset == null)) { | 21404 if (mset == null) { |
| 21972 mset = new MemberSet(member, true); | 21405 mset = new MemberSet(member, true); |
| 21973 this._members.$setindex(mset.get$name(), mset); | 21406 this._members.$setindex(mset.get$name(), mset); |
| 21974 } | 21407 } |
| 21975 else { | 21408 else { |
| 21976 mset.get$members().add$1(member); | 21409 mset.get$members().add$1(member); |
| 21977 } | 21410 } |
| 21978 } | 21411 } |
| 21979 World.prototype._addTopName = function(named) { | 21412 World.prototype._addTopName = function(named) { |
| 21980 var existing = this._topNames.$index(named.get$name()); | 21413 var existing = this._topNames.$index(named.get$name()); |
| 21981 if ($notnull_bool($ne(existing, null))) { | 21414 if ($ne(existing, null)) { |
| 21982 this.info(('mangling matching top level name "' + named.get$name() + '" in '
) + ('both "' + named.get$library().name + '" and "' + existing.get$library().na
me + '"')); | 21415 this.info(('mangling matching top level name "' + named.get$name() + '" in '
) + ('both "' + named.get$library().name + '" and "' + existing.get$library().na
me + '"')); |
| 21983 if ($notnull_bool(named.get$isNative())) { | 21416 if (named.get$isNative()) { |
| 21984 if ($notnull_bool(existing.get$isNative())) { | 21417 if (existing.get$isNative()) { |
| 21985 world.internalError(('conflicting native names "' + named.get$name() + '
" ') + ('(already defined in ' + existing.get$span().get$locationText() + ')'),
named.get$span()); | 21418 world.internalError(('conflicting native names "' + named.get$name() + '
" ') + ('(already defined in ' + existing.get$span().get$locationText() + ')'),
named.get$span()); |
| 21986 } | 21419 } |
| 21987 else { | 21420 else { |
| 21988 this._topNames.$setindex(named.get$name(), named); | 21421 this._topNames.$setindex(named.get$name(), named); |
| 21989 this._addJavascriptTopName((existing && existing.is$Named())); | 21422 this._addJavascriptTopName(existing); |
| 21990 } | 21423 } |
| 21991 } | 21424 } |
| 21992 else if ($notnull_bool(named.get$library().get$isCore())) { | 21425 else if (named.get$library().get$isCore()) { |
| 21993 if ($notnull_bool(existing.get$library().get$isCore())) { | 21426 if (existing.get$library().get$isCore()) { |
| 21994 world.internalError(('conflicting top-level names in core "' + named.get
$name() + '" ') + ('(previously defined in ' + existing.get$span().get$locationT
ext() + ')'), named.get$span()); | 21427 world.internalError(('conflicting top-level names in core "' + named.get
$name() + '" ') + ('(previously defined in ' + existing.get$span().get$locationT
ext() + ')'), named.get$span()); |
| 21995 } | 21428 } |
| 21996 else { | 21429 else { |
| 21997 this._topNames.$setindex(named.get$name(), named); | 21430 this._topNames.$setindex(named.get$name(), named); |
| 21998 this._addJavascriptTopName((existing && existing.is$Named())); | 21431 this._addJavascriptTopName(existing); |
| 21999 } | 21432 } |
| 22000 } | 21433 } |
| 22001 else { | 21434 else { |
| 22002 this._addJavascriptTopName(named); | 21435 this._addJavascriptTopName(named); |
| 22003 } | 21436 } |
| 22004 } | 21437 } |
| 22005 else { | 21438 else { |
| 22006 this._topNames.$setindex(named.get$name(), named); | 21439 this._topNames.$setindex(named.get$name(), named); |
| 22007 } | 21440 } |
| 22008 } | 21441 } |
| 22009 World.prototype._addJavascriptTopName = function(named) { | 21442 World.prototype._addJavascriptTopName = function(named) { |
| 22010 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name
() + '')); | 21443 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name
() + '')); |
| 22011 var existing = this._topNames.$index(named.get$jsname()); | 21444 var existing = this._topNames.$index(named.get$jsname()); |
| 22012 if ($notnull_bool($ne(existing, null)) && $notnull_bool($ne(existing, named)))
{ | 21445 if ($ne(existing, null) && $ne(existing, named)) { |
| 22013 world.internalError(('name mangling failed for "' + named.get$jsname() + '"
') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$span().get
$locationText() + ')'), named.get$span()); | 21446 world.internalError(('name mangling failed for "' + named.get$jsname() + '"
') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$span().get
$locationText() + ')'), named.get$span()); |
| 22014 } | 21447 } |
| 22015 this._topNames.$setindex(named.get$jsname(), named); | 21448 this._topNames.$setindex(named.get$jsname(), named); |
| 22016 } | 21449 } |
| 22017 World.prototype._addType = function(type) { | 21450 World.prototype._addType = function(type) { |
| 22018 if (!$notnull_bool(type.get$isTop())) this._addTopName(type); | 21451 if (!type.get$isTop()) this._addTopName(type); |
| 22019 } | 21452 } |
| 22020 World.prototype._addToCoreLib = function(name, isClass) { | 21453 World.prototype._addToCoreLib = function(name, isClass) { |
| 22021 var ret = new DefinedType(name, this.corelib, null, isClass); | 21454 var ret = new DefinedType(name, this.corelib, null, isClass); |
| 22022 this.corelib.types.$setindex(name, ret); | 21455 this.corelib.types.$setindex(name, ret); |
| 22023 return ret; | 21456 return ret; |
| 22024 } | 21457 } |
| 22025 World.prototype.toJsIdentifier = function(name) { | 21458 World.prototype.toJsIdentifier = function(name) { |
| 22026 if (this._jsKeywords == null) { | 21459 if (this._jsKeywords == null) { |
| 22027 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'])
; | 21460 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'])
; |
| 22028 } | 21461 } |
| 22029 if (this._jsKeywords.contains(name)) { | 21462 if (this._jsKeywords.contains(name)) { |
| 22030 return name + '_'; | 21463 return name + '_'; |
| 22031 } | 21464 } |
| 22032 else { | 21465 else { |
| 22033 return name; | 21466 return name; |
| 22034 } | 21467 } |
| 22035 } | 21468 } |
| 22036 World.prototype.compile = function() { | 21469 World.prototype.compile = function() { |
| 22037 if (options.dartScript == null) { | 21470 if (options.dartScript == null) { |
| 22038 this.fatal('no script provided to compile'); | 21471 this.fatal('no script provided to compile'); |
| 22039 return false; | 21472 return false; |
| 22040 } | 21473 } |
| 22041 try { | 21474 try { |
| 22042 this.info(('compiling ' + options.dartScript + ' with corelib ' + this.corel
ib + '')); | 21475 this.info(('compiling ' + options.dartScript + ' with corelib ' + this.corel
ib + '')); |
| 22043 if (!$notnull_bool(this.runLeg())) this.runCompilationPhases(); | 21476 if (!this.runLeg()) this.runCompilationPhases(); |
| 22044 } catch (exc) { | 21477 } catch (exc) { |
| 22045 exc = $toDartException(exc); | 21478 exc = $toDartException(exc); |
| 22046 if ($notnull_bool(this.get$hasErrors()) && !$notnull_bool(options.throwOnErr
ors)) { | 21479 if (this.get$hasErrors() && !options.throwOnErrors) { |
| 22047 } | 21480 } |
| 22048 else { | 21481 else { |
| 22049 throw exc; | 21482 throw exc; |
| 22050 } | 21483 } |
| 22051 } | 21484 } |
| 22052 this.printStatus(); | 21485 this.printStatus(); |
| 22053 return !$notnull_bool(this.get$hasErrors()); | 21486 return !this.get$hasErrors(); |
| 22054 } | 21487 } |
| 22055 World.prototype.runLeg = function() { | 21488 World.prototype.runLeg = function() { |
| 22056 var $this = this; // closure support | 21489 var $this = this; // closure support |
| 22057 if (!$notnull_bool(options.enableLeg)) return false; | 21490 if (!options.enableLeg) return false; |
| 22058 var res = $assert_bool(this.withTiming('try leg compile', (function () { | 21491 var res = this.withTiming('try leg compile', (function () { |
| 22059 return compile($this); | 21492 return compile($this); |
| 22060 }) | 21493 }) |
| 22061 )); | 21494 ); |
| 22062 if (!$notnull_bool(res) && $notnull_bool(options.legOnly)) { | 21495 if (!res && options.legOnly) { |
| 22063 this.fatal(("Leg could not compile " + options.dartScript + "")); | 21496 this.fatal(("Leg could not compile " + options.dartScript + "")); |
| 22064 return true; | 21497 return true; |
| 22065 } | 21498 } |
| 22066 return res; | 21499 return res; |
| 22067 } | 21500 } |
| 22068 World.prototype.runCompilationPhases = function() { | 21501 World.prototype.runCompilationPhases = function() { |
| 22069 var $this = this; // closure support | 21502 var $this = this; // closure support |
| 22070 var lib = this.withTiming('first pass', (function () { | 21503 var lib = this.withTiming('first pass', (function () { |
| 22071 return $this.processScript(options.dartScript); | 21504 return $this.processScript(options.dartScript); |
| 22072 }) | 21505 }) |
| 22073 ); | 21506 ); |
| 22074 this.withTiming('resolve top level', (function () { | 21507 this.withTiming('resolve top level', (function () { |
| 22075 $this.resolveAll(); | 21508 $this.resolveAll(); |
| 22076 }) | 21509 }) |
| 22077 ); | 21510 ); |
| 22078 this.withTiming('generate code', (function () { | 21511 this.withTiming('generate code', (function () { |
| 22079 var mainMembers = lib.topType.resolveMember('main'); | 21512 var mainMembers = lib.topType.resolveMember('main'); |
| 22080 var main = null; | 21513 var main = null; |
| 22081 if ($notnull_bool(mainMembers == null) || mainMembers.get$members().length =
= 0) { | 21514 if (mainMembers == null || mainMembers.get$members().length == 0) { |
| 22082 $this.fatal('no main method specified'); | 21515 $this.fatal('no main method specified'); |
| 22083 } | 21516 } |
| 22084 else if (mainMembers.get$members().length > 1) { | 21517 else if (mainMembers.get$members().length > 1) { |
| 22085 var $list = mainMembers.get$members(); | 21518 var $list = mainMembers.get$members(); |
| 22086 for (var $i = mainMembers.get$members().iterator$0(); $i.hasNext$0(); ) { | 21519 for (var $i = mainMembers.get$members().iterator$0(); $i.hasNext$0(); ) { |
| 22087 var m = $i.next$0(); | 21520 var m = $i.next$0(); |
| 22088 main = m; | 21521 main = m; |
| 22089 $this.error('more than one main member (using last?)', main.get$span()); | 21522 $this.error('more than one main member (using last?)', main.get$span()); |
| 22090 } | 21523 } |
| 22091 } | 21524 } |
| 22092 else { | 21525 else { |
| 22093 main = mainMembers.get$members().$index(0); | 21526 main = mainMembers.get$members().$index(0); |
| 22094 } | 21527 } |
| 22095 var codeWriter = new CodeWriter(); | 21528 var codeWriter = new CodeWriter(); |
| 22096 $this.gen = new WorldGenerator(main, codeWriter); | 21529 $this.gen = new WorldGenerator(main, codeWriter); |
| 22097 $this.gen.run(); | 21530 $this.gen.run(); |
| 22098 $this.jsBytesWritten = codeWriter.get$text().length; | 21531 $this.jsBytesWritten = codeWriter.get$text().length; |
| 22099 }) | 21532 }) |
| 22100 ); | 21533 ); |
| 22101 } | 21534 } |
| 22102 World.prototype.getGeneratedCode = function() { | 21535 World.prototype.getGeneratedCode = function() { |
| 22103 if (this.legCode != null) { | 21536 if (this.legCode != null) { |
| 22104 $assert(options.enableLeg, "options.enableLeg", "world.dart", 310, 14); | |
| 22105 return this.legCode; | 21537 return this.legCode; |
| 22106 } | 21538 } |
| 22107 else { | 21539 else { |
| 22108 return this.gen.writer.get$text(); | 21540 return this.gen.writer.get$text(); |
| 22109 } | 21541 } |
| 22110 } | 21542 } |
| 22111 World.prototype.readFile = function(filename) { | 21543 World.prototype.readFile = function(filename) { |
| 22112 try { | 21544 try { |
| 22113 var sourceFile = this.reader.readFile(filename); | 21545 var sourceFile = this.reader.readFile(filename); |
| 22114 this.dartBytesRead += sourceFile.get$text().length; | 21546 this.dartBytesRead += sourceFile.get$text().length; |
| 22115 return sourceFile; | 21547 return sourceFile; |
| 22116 } catch (e) { | 21548 } catch (e) { |
| 22117 e = $toDartException(e); | 21549 e = $toDartException(e); |
| 22118 this.warning(('Error reading file: ' + filename + '')); | 21550 this.warning(('Error reading file: ' + filename + '')); |
| 22119 return new SourceFile(filename, ''); | 21551 return new SourceFile(filename, ''); |
| 22120 } | 21552 } |
| 22121 } | 21553 } |
| 22122 World.prototype.getOrAddLibrary = function(filename) { | 21554 World.prototype.getOrAddLibrary = function(filename) { |
| 22123 var $0; | 21555 var library = this.libraries.$index(filename); |
| 22124 var library = (($0 = this.libraries.$index(filename)) && $0.is$Library()); | |
| 22125 if (library == null) { | 21556 if (library == null) { |
| 22126 library = new Library(this.readFile(filename)); | 21557 library = new Library(this.readFile(filename)); |
| 22127 this.info(('read library ' + filename + '')); | 21558 this.info(('read library ' + filename + '')); |
| 22128 if (!$notnull_bool(library.get$isCore()) && !library.imports.some((function
(li) { | 21559 if (!library.get$isCore() && !library.imports.some((function (li) { |
| 22129 return li.get$library().get$isCore(); | 21560 return li.get$library().get$isCore(); |
| 22130 }) | 21561 }) |
| 22131 )) { | 21562 )) { |
| 22132 library.imports.add(new LibraryImport(this.corelib)); | 21563 library.imports.add(new LibraryImport(this.corelib)); |
| 22133 } | 21564 } |
| 22134 this.libraries.$setindex(filename, library); | 21565 this.libraries.$setindex(filename, library); |
| 22135 this._todo.add(library); | 21566 this._todo.add(library); |
| 22136 } | 21567 } |
| 22137 return library; | 21568 return library; |
| 22138 } | 21569 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 22163 if (span != null) { | 21594 if (span != null) { |
| 22164 text = span.toMessageString(message); | 21595 text = span.toMessageString(message); |
| 22165 } | 21596 } |
| 22166 print(text); | 21597 print(text); |
| 22167 if (span1 != null) { | 21598 if (span1 != null) { |
| 22168 print(span1.toMessageString(message)); | 21599 print(span1.toMessageString(message)); |
| 22169 } | 21600 } |
| 22170 if (span2 != null) { | 21601 if (span2 != null) { |
| 22171 print(span2.toMessageString(message)); | 21602 print(span2.toMessageString(message)); |
| 22172 } | 21603 } |
| 22173 if ($notnull_bool(throwing)) { | 21604 if (throwing) { |
| 22174 $throw(new CompilerException(message, span)); | 21605 $throw(new CompilerException(message, span)); |
| 22175 } | 21606 } |
| 22176 } | 21607 } |
| 22177 World.prototype.error = function(message, span, span1, span2) { | 21608 World.prototype.error = function(message, span, span1, span2) { |
| 22178 this.errors++; | 21609 this.errors++; |
| 22179 this._message(('error: ' + message + ''), span, span1, span2, options.throwOnE
rrors); | 21610 this._message(('error: ' + message + ''), span, span1, span2, options.throwOnE
rrors); |
| 22180 } | 21611 } |
| 22181 World.prototype.warning = function(message, span, span1, span2) { | 21612 World.prototype.warning = function(message, span, span1, span2) { |
| 22182 this.warnings++; | 21613 this.warnings++; |
| 22183 if ($notnull_bool(options.showWarnings)) { | 21614 if (options.showWarnings) { |
| 22184 this._message(('warning: ' + message + ''), span, span1, span2, options.thro
wOnWarnings); | 21615 this._message(('warning: ' + message + ''), span, span1, span2, options.thro
wOnWarnings); |
| 22185 } | 21616 } |
| 22186 } | 21617 } |
| 22187 World.prototype.fatal = function(message, span, span1, span2) { | 21618 World.prototype.fatal = function(message, span, span1, span2) { |
| 22188 this.errors++; | 21619 this.errors++; |
| 22189 this.seenFatal = true; | 21620 this.seenFatal = true; |
| 22190 this._message(('fatal: ' + message + ''), span, span1, span2, $notnull_bool(op
tions.throwOnFatal) || $notnull_bool(options.throwOnErrors)); | 21621 this._message(('fatal: ' + message + ''), span, span1, span2, options.throwOnF
atal || options.throwOnErrors); |
| 22191 } | 21622 } |
| 22192 World.prototype.internalError = function(message, span, span1, span2) { | 21623 World.prototype.internalError = function(message, span, span1, span2) { |
| 22193 this._message(('We are sorry, but... ' + message + ''), span, span1, span2, tr
ue); | 21624 this._message(('We are sorry, but... ' + message + ''), span, span1, span2, tr
ue); |
| 22194 } | 21625 } |
| 22195 World.prototype.info = function(message, span, span1, span2) { | 21626 World.prototype.info = function(message, span, span1, span2) { |
| 22196 if ($notnull_bool(options.showInfo)) { | 21627 if (options.showInfo) { |
| 22197 this._message(('info: ' + message + ''), span, span1, span2, false); | 21628 this._message(('info: ' + message + ''), span, span1, span2, false); |
| 22198 } | 21629 } |
| 22199 } | 21630 } |
| 22200 World.prototype.get$hasErrors = function() { | 21631 World.prototype.get$hasErrors = function() { |
| 22201 return this.errors > 0; | 21632 return this.errors > 0; |
| 22202 } | 21633 } |
| 22203 World.prototype.printStatus = function() { | 21634 World.prototype.printStatus = function() { |
| 22204 this.info(('compiled ' + this.dartBytesRead + ' bytes Dart -> ' + this.jsBytes
Written + ' bytes JS')); | 21635 this.info(('compiled ' + this.dartBytesRead + ' bytes Dart -> ' + this.jsBytes
Written + ' bytes JS')); |
| 22205 if ($notnull_bool(this.get$hasErrors())) { | 21636 if (this.get$hasErrors()) { |
| 22206 print(('compilation failed with ' + this.errors + ' errors')); | 21637 print(('compilation failed with ' + this.errors + ' errors')); |
| 22207 } | 21638 } |
| 22208 else { | 21639 else { |
| 22209 if (this.warnings > 0) { | 21640 if (this.warnings > 0) { |
| 22210 this.info(('compilation completed successfully with ' + this.warnings + '
warnings')); | 21641 this.info(('compilation completed successfully with ' + this.warnings + '
warnings')); |
| 22211 } | 21642 } |
| 22212 else { | 21643 else { |
| 22213 this.info('compilation completed sucessfully'); | 21644 this.info('compilation completed sucessfully'); |
| 22214 } | 21645 } |
| 22215 } | 21646 } |
| 22216 } | 21647 } |
| 22217 World.prototype.withTiming = function(name, f) { | 21648 World.prototype.withTiming = function(name, f) { |
| 22218 var sw = new StopwatchImplementation(); | 21649 var sw = new StopwatchImplementation(); |
| 22219 sw.start(); | 21650 sw.start(); |
| 22220 var result = f(); | 21651 var result = f(); |
| 22221 sw.stop(); | 21652 sw.stop(); |
| 22222 this.info(('' + name + ' in ' + sw.elapsedInMs() + 'msec')); | 21653 this.info(('' + name + ' in ' + sw.elapsedInMs() + 'msec')); |
| 22223 return result; | 21654 return result; |
| 22224 } | 21655 } |
| 22225 // ********** Code for FrogOptions ************** | 21656 // ********** Code for FrogOptions ************** |
| 22226 function FrogOptions(homedir, args, files) { | 21657 function FrogOptions(homedir, args, files) { |
| 22227 var $0; | |
| 22228 this.enableLeg = false | 21658 this.enableLeg = false |
| 22229 this.legOnly = false | 21659 this.legOnly = false |
| 22230 this.enableAsserts = false | 21660 this.enableAsserts = false |
| 22231 this.enableTypeChecks = false | 21661 this.enableTypeChecks = false |
| 22232 this.verifyImplements = false | 21662 this.verifyImplements = false |
| 22233 this.compileAll = false | 21663 this.compileAll = false |
| 22234 this.dietParse = false | 21664 this.dietParse = false |
| 22235 this.compileOnly = false | 21665 this.compileOnly = false |
| 22236 this.throwOnErrors = false | 21666 this.throwOnErrors = false |
| 22237 this.throwOnWarnings = false | 21667 this.throwOnWarnings = false |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22310 this.throwOnWarnings = true; | 21740 this.throwOnWarnings = true; |
| 22311 continue loop; | 21741 continue loop; |
| 22312 | 21742 |
| 22313 case '--compile-only': | 21743 case '--compile-only': |
| 22314 | 21744 |
| 22315 this.compileOnly = true; | 21745 this.compileOnly = true; |
| 22316 continue loop; | 21746 continue loop; |
| 22317 | 21747 |
| 22318 default: | 21748 default: |
| 22319 | 21749 |
| 22320 if ($notnull_bool(arg.endsWith$1('.dart'))) { | 21750 if (arg.endsWith$1('.dart')) { |
| 22321 this.dartScript = $assert_String(arg); | 21751 this.dartScript = arg; |
| 22322 this.childArgs = (($0 = args.getRange(i + 1, args.length - i - 1)) &&
$0.is$List$String()); | 21752 this.childArgs = args.getRange(i + 1, args.length - i - 1); |
| 22323 break loop; | 21753 break loop; |
| 22324 } | 21754 } |
| 22325 else if ($notnull_bool(arg.startsWith$1('--out='))) { | 21755 else if (arg.startsWith$1('--out=')) { |
| 22326 this.outfile = arg.substring$1('--out='.length); | 21756 this.outfile = arg.substring$1('--out='.length); |
| 22327 } | 21757 } |
| 22328 else if ($notnull_bool(arg.startsWith$1('--libdir='))) { | 21758 else if (arg.startsWith$1('--libdir=')) { |
| 22329 this.libDir = $assert_String(arg.substring$1('--libdir='.length)); | 21759 this.libDir = arg.substring$1('--libdir='.length); |
| 22330 passedLibDir = true; | 21760 passedLibDir = true; |
| 22331 } | 21761 } |
| 22332 else { | 21762 else { |
| 22333 if (!$notnull_bool(ignoreUnrecognizedFlags)) { | 21763 if (!ignoreUnrecognizedFlags) { |
| 22334 print(('unrecognized flag: "' + arg + '"')); | 21764 print(('unrecognized flag: "' + arg + '"')); |
| 22335 } | 21765 } |
| 22336 } | 21766 } |
| 22337 | 21767 |
| 22338 } | 21768 } |
| 22339 } | 21769 } |
| 22340 if (!$notnull_bool(passedLibDir) && !$notnull_bool(files.fileExists(this.libDi
r))) { | 21770 if (!passedLibDir && !files.fileExists(this.libDir)) { |
| 22341 var temp = 'frog/lib'; | 21771 var temp = 'frog/lib'; |
| 22342 if ($notnull_bool(files.fileExists($assert_String(temp)))) { | 21772 if (files.fileExists(temp)) { |
| 22343 this.libDir = $assert_String(temp); | 21773 this.libDir = temp; |
| 22344 } | 21774 } |
| 22345 else { | 21775 else { |
| 22346 this.libDir = 'lib'; | 21776 this.libDir = 'lib'; |
| 22347 } | 21777 } |
| 22348 } | 21778 } |
| 22349 } | 21779 } |
| 22350 // ********** Code for LibraryReader ************** | 21780 // ********** Code for LibraryReader ************** |
| 22351 function LibraryReader() { | 21781 function LibraryReader() { |
| 22352 // Initializers done | 21782 // Initializers done |
| 22353 this._specialLibs = $map(['dart:core', joinPaths(options.libDir, 'corelib.dart
'), 'dart:coreimpl', joinPaths(options.libDir, 'corelib_impl.dart'), 'dart:html'
, joinPaths(options.libDir, '../../client/html/release/html.dart'), 'dart:dom',
joinPaths(options.libDir, 'dom/dom.dart'), 'dart:json', joinPaths(options.libDir
, 'json.dart')]); | 21783 this._specialLibs = $map(['dart:core', joinPaths(options.libDir, 'corelib.dart
'), 'dart:coreimpl', joinPaths(options.libDir, 'corelib_impl.dart'), 'dart:html'
, joinPaths(options.libDir, '../../client/html/release/html.dart'), 'dart:dom',
joinPaths(options.libDir, 'dom/dom.dart'), 'dart:json', joinPaths(options.libDir
, 'json.dart')]); |
| 22354 } | 21784 } |
| 22355 LibraryReader.prototype.readFile = function(fullname) { | 21785 LibraryReader.prototype.readFile = function(fullname) { |
| 22356 var filename = this._specialLibs.$index(fullname); | 21786 var filename = this._specialLibs.$index(fullname); |
| 22357 if ($notnull_bool(filename == null)) { | 21787 if (filename == null) { |
| 22358 filename = fullname; | 21788 filename = fullname; |
| 22359 } | 21789 } |
| 22360 if ($notnull_bool(world.files.fileExists($assert_String(filename)))) { | 21790 if (world.files.fileExists(filename)) { |
| 22361 return new SourceFile(filename, world.files.readAll($assert_String(filename)
)); | 21791 return new SourceFile(filename, world.files.readAll(filename)); |
| 22362 } | 21792 } |
| 22363 else { | 21793 else { |
| 22364 world.error(('File not found: ' + filename + '')); | 21794 world.error(('File not found: ' + filename + '')); |
| 22365 return new SourceFile(filename, ''); | 21795 return new SourceFile(filename, ''); |
| 22366 } | 21796 } |
| 22367 } | 21797 } |
| 22368 // ********** Code for VarMember ************** | 21798 // ********** Code for VarMember ************** |
| 22369 function VarMember(name) { | 21799 function VarMember(name) { |
| 22370 this.name = name; | 21800 this.name = name; |
| 22371 // Initializers done | 21801 // Initializers done |
| 22372 } | 21802 } |
| 22373 VarMember.prototype.is$VarMember = function(){return this;}; | |
| 22374 VarMember.prototype.get$name = function() { return this.name; }; | 21803 VarMember.prototype.get$name = function() { return this.name; }; |
| 22375 VarMember.prototype.get$returnType = function() { | 21804 VarMember.prototype.get$returnType = function() { |
| 22376 return world.varType; | 21805 return world.varType; |
| 22377 } | 21806 } |
| 22378 VarMember.prototype.invoke = function(context, node, target, args) { | 21807 VarMember.prototype.invoke = function(context, node, target, args) { |
| 22379 return new Value(this.get$returnType(), ('' + target.code + '.' + this.name +
'(' + args.getCode() + ')'), node.span, true); | 21808 return new Value(this.get$returnType(), ('' + target.code + '.' + this.name +
'(' + args.getCode() + ')'), node.span, true); |
| 22380 } | 21809 } |
| 22381 VarMember.prototype.generate$1 = function($0) { | 21810 VarMember.prototype.generate$1 = function($0) { |
| 22382 return this.generate(($0 && $0.is$CodeWriter())); | 21811 return this.generate($0); |
| 22383 }; | 21812 }; |
| 22384 VarMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 21813 VarMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 22385 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments())); | 21814 return this.invoke($0, $1, $2, $3); |
| 22386 }; | 21815 }; |
| 22387 // ********** Code for VarFunctionStub ************** | 21816 // ********** Code for VarFunctionStub ************** |
| 22388 function VarFunctionStub(name, callArgs) { | 21817 function VarFunctionStub(name, callArgs) { |
| 22389 this.args = callArgs.toCallStubArgs(); | 21818 this.args = callArgs.toCallStubArgs(); |
| 22390 VarMember.call(this, name); | 21819 VarMember.call(this, name); |
| 22391 // Initializers done | 21820 // Initializers done |
| 22392 world.gen.corejs.useGenStub = true; | 21821 world.gen.corejs.useGenStub = true; |
| 22393 } | 21822 } |
| 22394 $inherits(VarFunctionStub, VarMember); | 21823 $inherits(VarFunctionStub, VarMember); |
| 22395 VarFunctionStub.prototype.is$VarFunctionStub = function(){return this;}; | |
| 22396 VarFunctionStub.prototype.generate = function(code) { | 21824 VarFunctionStub.prototype.generate = function(code) { |
| 22397 if ($notnull_bool(this.args.get$hasNames())) { | 21825 if (this.args.get$hasNames()) { |
| 22398 this.generateNamed(code); | 21826 this.generateNamed(code); |
| 22399 } | 21827 } |
| 22400 else { | 21828 else { |
| 22401 this.generatePositional(code); | 21829 this.generatePositional(code); |
| 22402 } | 21830 } |
| 22403 } | 21831 } |
| 22404 VarFunctionStub.prototype.generatePositional = function(w) { | 21832 VarFunctionStub.prototype.generatePositional = function(w) { |
| 22405 var arity = this.args.get$length(); | 21833 var arity = this.args.get$length(); |
| 22406 w.enterBlock(('Function.prototype.to\$' + this.name + ' = function() {')); | 21834 w.enterBlock(('Function.prototype.to\$' + this.name + ' = function() {')); |
| 22407 w.writeln(('this.' + this.name + ' = this.\$genStub(' + arity + ');')); | 21835 w.writeln(('this.' + this.name + ' = this.\$genStub(' + arity + ');')); |
| 22408 w.writeln(('this.to\$' + this.name + ' = function() { return this.' + this.nam
e + '; };')); | 21836 w.writeln(('this.to\$' + this.name + ' = function() { return this.' + this.nam
e + '; };')); |
| 22409 w.writeln(('return this.' + this.name + ';')); | 21837 w.writeln(('return this.' + this.name + ';')); |
| 22410 w.exitBlock('};'); | 21838 w.exitBlock('};'); |
| 22411 var argsCode = this.args.getCode(); | 21839 var argsCode = this.args.getCode(); |
| 22412 w.enterBlock(('Function.prototype.' + this.name + ' = function(' + argsCode +
') {')); | 21840 w.enterBlock(('Function.prototype.' + this.name + ' = function(' + argsCode +
') {')); |
| 22413 w.writeln(('return this.to\$' + this.name + '()(' + argsCode + ');')); | 21841 w.writeln(('return this.to\$' + this.name + '()(' + argsCode + ');')); |
| 22414 w.exitBlock('};'); | 21842 w.exitBlock('};'); |
| 22415 w.writeln(('function to\$' + this.name + '(f) { return f && f.to\$' + this.nam
e + '(); }')); | 21843 w.writeln(('function to\$' + this.name + '(f) { return f && f.to\$' + this.nam
e + '(); }')); |
| 22416 } | 21844 } |
| 22417 VarFunctionStub.prototype.generateNamed = function(w) { | 21845 VarFunctionStub.prototype.generateNamed = function(w) { |
| 22418 var named = Strings.join(this.args.getNames(), '", "'); | 21846 var named = Strings.join(this.args.getNames(), '", "'); |
| 22419 var argsCode = this.args.getCode(); | 21847 var argsCode = this.args.getCode(); |
| 22420 w.enterBlock(('Function.prototype.' + this.name + ' = function(' + argsCode +
') {')); | 21848 w.enterBlock(('Function.prototype.' + this.name + ' = function(' + argsCode +
') {')); |
| 22421 w.writeln(('this.' + this.name + ' = this.\$genStub(' + this.args.get$length()
+ ', ["' + named + '"]);')); | 21849 w.writeln(('this.' + this.name + ' = this.\$genStub(' + this.args.get$length()
+ ', ["' + named + '"]);')); |
| 22422 w.writeln(('return this.' + this.name + '(' + argsCode + ');')); | 21850 w.writeln(('return this.' + this.name + '(' + argsCode + ');')); |
| 22423 w.exitBlock('}'); | 21851 w.exitBlock('}'); |
| 22424 } | 21852 } |
| 22425 VarFunctionStub.prototype.generate$1 = function($0) { | 21853 VarFunctionStub.prototype.generate$1 = function($0) { |
| 22426 return this.generate(($0 && $0.is$CodeWriter())); | 21854 return this.generate($0); |
| 22427 }; | 21855 }; |
| 22428 // ********** Code for VarMethodStub ************** | 21856 // ********** Code for VarMethodStub ************** |
| 22429 function VarMethodStub(name, member, args, body) { | 21857 function VarMethodStub(name, member, args, body) { |
| 22430 this.member = member; | 21858 this.member = member; |
| 22431 this.args = args; | 21859 this.args = args; |
| 22432 this.body = body; | 21860 this.body = body; |
| 22433 VarMember.call(this, name); | 21861 VarMember.call(this, name); |
| 22434 // Initializers done | 21862 // Initializers done |
| 22435 } | 21863 } |
| 22436 $inherits(VarMethodStub, VarMember); | 21864 $inherits(VarMethodStub, VarMember); |
| 22437 VarMethodStub.prototype.get$returnType = function() { | 21865 VarMethodStub.prototype.get$returnType = function() { |
| 22438 var $0; | 21866 return this.member != null ? this.member.get$returnType() : world.varType; |
| 22439 return (($0 = this.member != null ? this.member.get$returnType() : world.varTy
pe) && $0.is$lang_Type()); | |
| 22440 } | 21867 } |
| 22441 VarMethodStub.prototype.get$typeName = function() { | 21868 VarMethodStub.prototype.get$typeName = function() { |
| 22442 return this.member != null ? this.member.declaringType.get$jsname() : 'Object'
; | 21869 return this.member != null ? this.member.declaringType.get$jsname() : 'Object'
; |
| 22443 } | 21870 } |
| 22444 VarMethodStub.prototype.generate = function(code) { | 21871 VarMethodStub.prototype.generate = function(code) { |
| 22445 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = ')); | 21872 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = ')); |
| 22446 this.generateBody(code, ';'); | 21873 this.generateBody(code, ';'); |
| 22447 } | 21874 } |
| 22448 VarMethodStub.prototype.generateBody = function(code, end) { | 21875 VarMethodStub.prototype.generateBody = function(code, end) { |
| 22449 if ($notnull_bool(this._useDirectCall(this.member, this.args))) { | 21876 if (this._useDirectCall(this.member, this.args)) { |
| 22450 code.writeln(('' + this.get$typeName() + '.prototype.' + this.member.get$jsn
ame() + '' + end + '')); | 21877 code.writeln(('' + this.get$typeName() + '.prototype.' + this.member.get$jsn
ame() + '' + end + '')); |
| 22451 } | 21878 } |
| 22452 else { | 21879 else { |
| 22453 code.enterBlock(('function(' + this.args.getCode() + ') {')); | 21880 code.enterBlock(('function(' + this.args.getCode() + ') {')); |
| 22454 code.writeln(('return ' + this.body.code + ';')); | 21881 code.writeln(('return ' + this.body.code + ';')); |
| 22455 code.exitBlock(('}' + end + '')); | 21882 code.exitBlock(('}' + end + '')); |
| 22456 } | 21883 } |
| 22457 } | 21884 } |
| 22458 VarMethodStub.prototype._useDirectCall = function(member, args) { | 21885 VarMethodStub.prototype._useDirectCall = function(member, args) { |
| 22459 if ((member instanceof MethodMember) && $ne(member.declaringType.get$library()
, world.get$dom())) { | 21886 if ((member instanceof MethodMember) && $ne(member.declaringType.get$library()
, world.get$dom())) { |
| 22460 var method = (member && member.is$MethodMember()); | 21887 var method = member; |
| 22461 if ($notnull_bool(method.needsArgumentConversion(args))) { | 21888 if (method.needsArgumentConversion(args)) { |
| 22462 return false; | 21889 return false; |
| 22463 } | 21890 } |
| 22464 for (var i = args.get$length(); | 21891 for (var i = args.get$length(); |
| 22465 i < method.parameters.length; i++) { | 21892 i < method.parameters.length; i++) { |
| 22466 if ($notnull_bool($ne(method.parameters.$index(i).get$value().code, 'null'
))) { | 21893 if ($ne(method.parameters.$index(i).get$value().code, 'null')) { |
| 22467 return false; | 21894 return false; |
| 22468 } | 21895 } |
| 22469 } | 21896 } |
| 22470 return method.namesInOrder(args); | 21897 return method.namesInOrder(args); |
| 22471 } | 21898 } |
| 22472 else { | 21899 else { |
| 22473 return false; | 21900 return false; |
| 22474 } | 21901 } |
| 22475 } | 21902 } |
| 22476 VarMethodStub.prototype.generate$1 = function($0) { | 21903 VarMethodStub.prototype.generate$1 = function($0) { |
| 22477 return this.generate(($0 && $0.is$CodeWriter())); | 21904 return this.generate($0); |
| 22478 }; | 21905 }; |
| 22479 VarMethodStub.prototype.generateBody$2 = function($0, $1) { | 21906 VarMethodStub.prototype.generateBody$2 = function($0, $1) { |
| 22480 return this.generateBody(($0 && $0.is$CodeWriter()), $assert_String($1)); | 21907 return this.generateBody($0, $1); |
| 22481 }; | 21908 }; |
| 22482 // ********** Code for VarMethodSet ************** | 21909 // ********** Code for VarMethodSet ************** |
| 22483 function VarMethodSet(name, members, callArgs, returnType) { | 21910 function VarMethodSet(name, members, callArgs, returnType) { |
| 22484 this.members = members; | 21911 this.members = members; |
| 22485 this.returnType = returnType; | 21912 this.returnType = returnType; |
| 22486 this.args = callArgs.toCallStubArgs(); | 21913 this.args = callArgs.toCallStubArgs(); |
| 22487 VarMember.call(this, name); | 21914 VarMember.call(this, name); |
| 22488 // Initializers done | 21915 // Initializers done |
| 22489 } | 21916 } |
| 22490 $inherits(VarMethodSet, VarMember); | 21917 $inherits(VarMethodSet, VarMember); |
| 22491 VarMethodSet.prototype.get$members = function() { return this.members; }; | 21918 VarMethodSet.prototype.get$members = function() { return this.members; }; |
| 22492 VarMethodSet.prototype.get$returnType = function() { return this.returnType; }; | 21919 VarMethodSet.prototype.get$returnType = function() { return this.returnType; }; |
| 22493 VarMethodSet.prototype.get$baseName = function() { | 21920 VarMethodSet.prototype.get$baseName = function() { |
| 22494 return $assert_String(this.members.$index(0).get$name()); | 21921 return this.members.$index(0).get$name(); |
| 22495 } | 21922 } |
| 22496 VarMethodSet.prototype.invoke = function(context, node, target, args) { | 21923 VarMethodSet.prototype.invoke = function(context, node, target, args) { |
| 22497 this._invokeMembers(context, node); | 21924 this._invokeMembers(context, node); |
| 22498 return VarMember.prototype.invoke.call(this, context, node, target, args); | 21925 return VarMember.prototype.invoke.call(this, context, node, target, args); |
| 22499 } | 21926 } |
| 22500 VarMethodSet.prototype._invokeMembers = function(context, node) { | 21927 VarMethodSet.prototype._invokeMembers = function(context, node) { |
| 22501 if (this._fallbackStubs != null) return; | 21928 if (this._fallbackStubs != null) return; |
| 22502 var objectStub = null; | 21929 var objectStub = null; |
| 22503 this._fallbackStubs = []; | 21930 this._fallbackStubs = []; |
| 22504 var $list = this.members; | 21931 var $list = this.members; |
| 22505 for (var $i = 0;$i < $list.length; $i++) { | 21932 for (var $i = 0;$i < $list.length; $i++) { |
| 22506 var member = $list.$index($i); | 21933 var member = $list.$index($i); |
| 22507 var target = new Value(member.declaringType, 'this', node.span, true); | 21934 var target = new Value(member.declaringType, 'this', node.span, true); |
| 22508 var result = member.invoke$4$isDynamic(context, node, target, this.args, tru
e); | 21935 var result = member.invoke$4$isDynamic(context, node, target, this.args, tru
e); |
| 22509 var stub = new VarMethodStub(this.name, member, this.args, result); | 21936 var stub = new VarMethodStub(this.name, member, this.args, result); |
| 22510 var type = member.declaringType; | 21937 var type = member.declaringType; |
| 22511 if ($notnull_bool(type.get$isObject())) { | 21938 if (type.get$isObject()) { |
| 22512 objectStub = stub; | 21939 objectStub = stub; |
| 22513 } | 21940 } |
| 22514 else if ($ne(type.get$library(), world.get$dom())) { | 21941 else if ($ne(type.get$library(), world.get$dom())) { |
| 22515 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V
arMember())); | 21942 VarMethodSet._addVarStub(type, stub); |
| 22516 } | 21943 } |
| 22517 else { | 21944 else { |
| 22518 this._fallbackStubs.add(stub); | 21945 this._fallbackStubs.add(stub); |
| 22519 } | 21946 } |
| 22520 } | 21947 } |
| 22521 if ($notnull_bool(objectStub == null)) { | 21948 if (objectStub == null) { |
| 22522 var target = new Value(world.objectType, 'this', node.span, true); | 21949 var target = new Value(world.objectType, 'this', node.span, true); |
| 22523 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, t
his.args); | 21950 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, t
his.args); |
| 22524 objectStub = new VarMethodStub(this.name, null, this.args, result); | 21951 objectStub = new VarMethodStub(this.name, null, this.args, result); |
| 22525 } | 21952 } |
| 22526 if (this._fallbackStubs.length == 0) { | 21953 if (this._fallbackStubs.length == 0) { |
| 22527 VarMethodSet._addVarStub(world.objectType, (objectStub && objectStub.is$VarM
ember())); | 21954 VarMethodSet._addVarStub(world.objectType, objectStub); |
| 22528 } | 21955 } |
| 22529 else { | 21956 else { |
| 22530 this._fallbackStubs.add(objectStub); | 21957 this._fallbackStubs.add(objectStub); |
| 22531 world.gen.corejs.useVarMethod = true; | 21958 world.gen.corejs.useVarMethod = true; |
| 22532 } | 21959 } |
| 22533 } | 21960 } |
| 22534 VarMethodSet._addVarStub = function(type, stub) { | 21961 VarMethodSet._addVarStub = function(type, stub) { |
| 22535 if (type.varStubs == null) type.varStubs = $map([]); | 21962 if (type.varStubs == null) type.varStubs = $map([]); |
| 22536 type.varStubs.$setindex(stub.name, stub); | 21963 type.varStubs.$setindex(stub.name, stub); |
| 22537 } | 21964 } |
| 22538 VarMethodSet.prototype.generate = function(code) { | 21965 VarMethodSet.prototype.generate = function(code) { |
| 22539 if (this._fallbackStubs.length == 0) return; | 21966 if (this._fallbackStubs.length == 0) return; |
| 22540 code.enterBlock(('\$varMethod("' + this.name + '", {')); | 21967 code.enterBlock(('\$varMethod("' + this.name + '", {')); |
| 22541 var lastOne = this._fallbackStubs.last(); | 21968 var lastOne = this._fallbackStubs.last(); |
| 22542 var $list = this._fallbackStubs; | 21969 var $list = this._fallbackStubs; |
| 22543 for (var $i = 0;$i < $list.length; $i++) { | 21970 for (var $i = 0;$i < $list.length; $i++) { |
| 22544 var stub = $list.$index($i); | 21971 var stub = $list.$index($i); |
| 22545 code.write(('"' + stub.get$typeName() + '": ')); | 21972 code.write(('"' + stub.get$typeName() + '": ')); |
| 22546 stub.generateBody$2(code, $notnull_bool($eq(stub, lastOne)) ? '' : ','); | 21973 stub.generateBody$2(code, $eq(stub, lastOne) ? '' : ','); |
| 22547 } | 21974 } |
| 22548 code.exitBlock('});'); | 21975 code.exitBlock('});'); |
| 22549 } | 21976 } |
| 22550 VarMethodSet.prototype.generate$1 = function($0) { | 21977 VarMethodSet.prototype.generate$1 = function($0) { |
| 22551 return this.generate(($0 && $0.is$CodeWriter())); | 21978 return this.generate($0); |
| 22552 }; | 21979 }; |
| 22553 VarMethodSet.prototype.invoke$4 = function($0, $1, $2, $3) { | 21980 VarMethodSet.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 22554 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments())); | 21981 return this.invoke($0, $1, $2, $3); |
| 22555 }; | 21982 }; |
| 22556 // ********** Code for top level ************** | 21983 // ********** Code for top level ************** |
| 22557 function map(source, mapper) { | 21984 function map(source, mapper) { |
| 22558 var result = new ListFactory(); | 21985 var result = new ListFactory(); |
| 22559 if (!!(source && source.is$List)) { | 21986 if (!!(source && source.is$List)) { |
| 22560 var list = (source && source.is$List()); | 21987 var list = source; |
| 22561 result.length = list.length; | 21988 result.length = list.length; |
| 22562 for (var i = 0; | 21989 for (var i = 0; |
| 22563 i < list.length; i++) { | 21990 i < list.length; i++) { |
| 22564 result.$setindex(i, mapper(list.$index(i))); | 21991 result.$setindex(i, mapper(list.$index(i))); |
| 22565 } | 21992 } |
| 22566 } | 21993 } |
| 22567 else { | 21994 else { |
| 22568 for (var $i = source.iterator(); $i.hasNext$0(); ) { | 21995 for (var $i = source.iterator(); $i.hasNext$0(); ) { |
| 22569 var item = $i.next$0(); | 21996 var item = $i.next$0(); |
| 22570 result.add(mapper(item)); | 21997 result.add(mapper(item)); |
| 22571 } | 21998 } |
| 22572 } | 21999 } |
| 22573 return result; | 22000 return result; |
| 22574 } | 22001 } |
| 22575 function reduce(source, callback, initialValue) { | 22002 function reduce(source, callback, initialValue) { |
| 22576 var i = source.iterator(); | 22003 var i = source.iterator(); |
| 22577 var current = initialValue; | 22004 var current = initialValue; |
| 22578 if ($notnull_bool(current == null) && $notnull_bool(i.hasNext$0())) { | 22005 if (current == null && i.hasNext$0()) { |
| 22579 current = i.next$0(); | 22006 current = i.next$0(); |
| 22580 } | 22007 } |
| 22581 while ($notnull_bool(i.hasNext$0())) { | 22008 while (i.hasNext$0()) { |
| 22582 current = callback.call$2(current, i.next$0()); | 22009 current = callback.call$2(current, i.next$0()); |
| 22583 } | 22010 } |
| 22584 return current; | 22011 return current; |
| 22585 } | 22012 } |
| 22586 function orderValuesByKeys(map) { | 22013 function orderValuesByKeys(map) { |
| 22587 var $0; | 22014 var keys = map.getKeys(); |
| 22588 var keys = (($0 = map.getKeys()) && $0.is$List()); | |
| 22589 keys.sort((function (x, y) { | 22015 keys.sort((function (x, y) { |
| 22590 return x.compareTo$1(y); | 22016 return x.compareTo$1(y); |
| 22591 }) | 22017 }) |
| 22592 ); | 22018 ); |
| 22593 var values = []; | 22019 var values = []; |
| 22594 for (var $i = 0;$i < keys.length; $i++) { | 22020 for (var $i = 0;$i < keys.length; $i++) { |
| 22595 var k = keys.$index($i); | 22021 var k = keys.$index($i); |
| 22596 values.add(map.$index(k)); | 22022 values.add(map.$index(k)); |
| 22597 } | 22023 } |
| 22598 return values; | 22024 return values; |
| 22599 } | 22025 } |
| 22600 function isMultilineString(text) { | 22026 function isMultilineString(text) { |
| 22601 return text.startsWith('"""') || text.startsWith("'''"); | 22027 return text.startsWith('"""') || text.startsWith("'''"); |
| 22602 } | 22028 } |
| 22603 function isRawMultilineString(text) { | 22029 function isRawMultilineString(text) { |
| 22604 return text.startsWith('@"""') || text.startsWith("@'''"); | 22030 return text.startsWith('@"""') || text.startsWith("@'''"); |
| 22605 } | 22031 } |
| 22606 function parseStringLiteral(lit) { | 22032 function parseStringLiteral(lit) { |
| 22607 if (lit.startsWith('@')) { | 22033 if (lit.startsWith('@')) { |
| 22608 if ($notnull_bool(isRawMultilineString(lit))) { | 22034 if (isRawMultilineString(lit)) { |
| 22609 return stripLeadingNewline(lit.substring(4, lit.length - 3)); | 22035 return stripLeadingNewline(lit.substring(4, lit.length - 3)); |
| 22610 } | 22036 } |
| 22611 else { | 22037 else { |
| 22612 return lit.substring(2, lit.length - 1); | 22038 return lit.substring(2, lit.length - 1); |
| 22613 } | 22039 } |
| 22614 } | 22040 } |
| 22615 else if ($notnull_bool(isMultilineString(lit))) { | 22041 else if (isMultilineString(lit)) { |
| 22616 lit = lit.substring(3, lit.length - 3).replaceAll('\\\$', '\$'); | 22042 lit = lit.substring(3, lit.length - 3).replaceAll('\\\$', '\$'); |
| 22617 return stripLeadingNewline(lit); | 22043 return stripLeadingNewline(lit); |
| 22618 } | 22044 } |
| 22619 else { | 22045 else { |
| 22620 return lit.substring(1, lit.length - 1).replaceAll('\\\$', '\$'); | 22046 return lit.substring(1, lit.length - 1).replaceAll('\\\$', '\$'); |
| 22621 } | 22047 } |
| 22622 } | 22048 } |
| 22623 function stripLeadingNewline(text) { | 22049 function stripLeadingNewline(text) { |
| 22624 if (text.startsWith('\n')) { | 22050 if (text.startsWith('\n')) { |
| 22625 return text.substring(1); | 22051 return text.substring(1); |
| 22626 } | 22052 } |
| 22627 else if (text.startsWith('\r')) { | 22053 else if (text.startsWith('\r')) { |
| 22628 if (text.startsWith('\r\n')) { | 22054 if (text.startsWith('\r\n')) { |
| 22629 return text.substring(2); | 22055 return text.substring(2); |
| 22630 } | 22056 } |
| 22631 else { | 22057 else { |
| 22632 return text.substring(1); | 22058 return text.substring(1); |
| 22633 } | 22059 } |
| 22634 } | 22060 } |
| 22635 else { | 22061 else { |
| 22636 return text; | 22062 return text; |
| 22637 } | 22063 } |
| 22638 } | 22064 } |
| 22639 var world; | 22065 var world; |
| 22640 function initializeWorld(files) { | 22066 function initializeWorld(files) { |
| 22641 $assert(world == null, "world == null", "world.dart", 13, 10); | |
| 22642 world = new World(files); | 22067 world = new World(files); |
| 22643 world.init(); | 22068 world.init(); |
| 22644 } | 22069 } |
| 22645 function lang_compile(homedir, args, files) { | 22070 function lang_compile(homedir, args, files) { |
| 22646 parseOptions(homedir, args, files); | 22071 parseOptions(homedir, args, files); |
| 22647 initializeWorld(files); | 22072 initializeWorld(files); |
| 22648 var success = world.compile(); | 22073 var success = world.compile(); |
| 22649 if (options.outfile != null) { | 22074 if (options.outfile != null) { |
| 22650 if ($notnull_bool(success)) { | 22075 if (success) { |
| 22651 var code = world.getGeneratedCode(); | 22076 var code = world.getGeneratedCode(); |
| 22652 if (!options.outfile.endsWith('.js')) { | 22077 if (!options.outfile.endsWith('.js')) { |
| 22653 code = '#!/usr/bin/env node\n' + code; | 22078 code = '#!/usr/bin/env node\n' + code; |
| 22654 } | 22079 } |
| 22655 world.files.writeString(options.outfile, $assert_String(code)); | 22080 world.files.writeString(options.outfile, code); |
| 22656 } | 22081 } |
| 22657 else { | 22082 else { |
| 22658 world.files.writeString(options.outfile, "throw 'Sorry, but I could not ge
nerate reasonable code to run.\\n';"); | 22083 world.files.writeString(options.outfile, "throw 'Sorry, but I could not ge
nerate reasonable code to run.\\n';"); |
| 22659 } | 22084 } |
| 22660 } | 22085 } |
| 22661 return $assert_bool(success); | 22086 return success; |
| 22662 } | 22087 } |
| 22663 var options; | 22088 var options; |
| 22664 function parseOptions(homedir, args, files) { | 22089 function parseOptions(homedir, args, files) { |
| 22665 $assert(options == null, "options == null", "frog_options.dart", 10, 10); | |
| 22666 options = new FrogOptions(homedir, args, files); | 22090 options = new FrogOptions(homedir, args, files); |
| 22667 } | 22091 } |
| 22668 function _getCallStubName(name, args) { | 22092 function _getCallStubName(name, args) { |
| 22669 var nameBuilder = new StringBufferImpl(('' + name + '\$' + args.get$bareCount(
) + '')); | 22093 var nameBuilder = new StringBufferImpl(('' + name + '\$' + args.get$bareCount(
) + '')); |
| 22670 for (var i = args.get$bareCount(); | 22094 for (var i = args.get$bareCount(); |
| 22671 i < args.get$length(); i++) { | 22095 i < args.get$length(); i++) { |
| 22672 nameBuilder.add('\$').add(args.getName(i)); | 22096 nameBuilder.add('\$').add(args.getName(i)); |
| 22673 } | 22097 } |
| 22674 return nameBuilder.toString(); | 22098 return nameBuilder.toString(); |
| 22675 } | 22099 } |
| 22676 // ********** Library frog ************** | 22100 // ********** Library frog ************** |
| 22677 // ********** Code for top level ************** | 22101 // ********** Code for top level ************** |
| 22678 function main() { | 22102 function main() { |
| 22679 var homedir = path.dirname(fs.realpathSync($assert_String(process.argv.$index(
1)))); | 22103 var homedir = path.dirname(fs.realpathSync(process.argv.$index(1))); |
| 22680 var argv = ListFactory.ListFactory$from$factory(process.argv); | 22104 var argv = ListFactory.ListFactory$from$factory(process.argv); |
| 22681 if ($notnull_bool(lang_compile($assert_String(homedir), (argv && argv.is$List$
String()), new NodeFileSystem()))) { | 22105 if (lang_compile(homedir, argv, new NodeFileSystem())) { |
| 22682 var code = world.getGeneratedCode(); | 22106 var code = world.getGeneratedCode(); |
| 22683 if (!$notnull_bool(options.compileOnly)) { | 22107 if (!options.compileOnly) { |
| 22684 process.argv = [argv.$index(0), argv.$index(1)]; | 22108 process.argv = [argv.$index(0), argv.$index(1)]; |
| 22685 process.argv.addAll(options.childArgs); | 22109 process.argv.addAll(options.childArgs); |
| 22686 vm.runInNewContext($assert_String(code), createSandbox()); | 22110 vm.runInNewContext(code, createSandbox()); |
| 22687 } | 22111 } |
| 22688 } | 22112 } |
| 22689 else { | 22113 else { |
| 22690 process.exit(1); | 22114 process.exit(1); |
| 22691 } | 22115 } |
| 22692 } | 22116 } |
| 22693 // ********** Globals ************** | 22117 // ********** Globals ************** |
| 22694 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; | 22118 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; |
| 22695 var const$10 = new StringWrapper('String')/*const SourceString('String')*/; | 22119 var const$10 = new StringWrapper('String')/*const SourceString('String')*/; |
| 22696 var const$12 = new IllegalAccessException()/*const IllegalAccessException()*/; | 22120 var const$12 = new IllegalAccessException()/*const IllegalAccessException()*/; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22829 INTERFACE, | 22253 INTERFACE, |
| 22830 LIBRARY, | 22254 LIBRARY, |
| 22831 NATIVE, | 22255 NATIVE, |
| 22832 NEGATE, | 22256 NEGATE, |
| 22833 OPERATOR, | 22257 OPERATOR, |
| 22834 SET, | 22258 SET, |
| 22835 SOURCE, | 22259 SOURCE, |
| 22836 STATIC, | 22260 STATIC, |
| 22837 TYPEDEF ]*/; | 22261 TYPEDEF ]*/; |
| 22838 RunEntry(function() {main();}, []); | 22262 RunEntry(function() {main();}, []); |
| OLD | NEW |