| OLD | NEW |
| 1 #!/usr/bin/env node | 1 #!/usr/bin/env node |
| 2 // ********** Library dart:core ************** | 2 // ********** Library dart:core ************** |
| 3 // ********** Natives core.js ************** | 3 // ********** Natives core.js ************** |
| 4 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 4 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 5 // for details. All rights reserved. Use of this source code is governed by a | 5 // for details. All rights reserved. Use of this source code is governed by a |
| 6 // BSD-style license that can be found in the LICENSE file. | 6 // BSD-style license that can be found in the LICENSE file. |
| 7 | 7 |
| 8 // TODO(jimhug): Completeness - see tests/corelib | 8 // TODO(jimhug): Completeness - see tests/corelib |
| 9 | 9 |
| 10 /** Implements extends for dart classes on javascript prototypes. */ | 10 /** Implements extends for dart classes on javascript prototypes. */ |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 ret.$setindex(items[i++], items[i++]); | 170 ret.$setindex(items[i++], items[i++]); |
| 171 } | 171 } |
| 172 return ret; | 172 return ret; |
| 173 } | 173 } |
| 174 | 174 |
| 175 function $assert(test, text, url, line, column) { | 175 function $assert(test, text, url, line, column) { |
| 176 if (typeof test == 'function') test = test(); | 176 if (typeof test == 'function') test = test(); |
| 177 if (!test) $throw(new AssertError(text, url, line, column)); | 177 if (!test) $throw(new AssertError(text, url, line, column)); |
| 178 } | 178 } |
| 179 | 179 |
| 180 function $notnull_bool(test) { |
| 181 if (test == null || typeof(test) != 'boolean') { |
| 182 $throw(new TypeError('must be "true" or "false"')); |
| 183 } |
| 184 return test === true; |
| 185 } |
| 186 |
| 180 function $throw(e) { | 187 function $throw(e) { |
| 181 // If e is not a value, we can use V8's captureStackTrace utility method. | 188 // If e is not a value, we can use V8's captureStackTrace utility method. |
| 182 // TODO(jmesserly): capture the stack trace on other JS engines. | 189 // TODO(jmesserly): capture the stack trace on other JS engines. |
| 183 if (e && (typeof e == "object") && Error.captureStackTrace) { | 190 if (e && (typeof e == "object") && Error.captureStackTrace) { |
| 184 // TODO(jmesserly): this will clobber the e.stack property | 191 // TODO(jmesserly): this will clobber the e.stack property |
| 185 Error.captureStackTrace(e, $throw); | 192 Error.captureStackTrace(e, $throw); |
| 186 } | 193 } |
| 187 throw e; | 194 throw e; |
| 188 } | 195 } |
| 189 | 196 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 Object.defineProperty(proto, name, {value: method || methods['Object']}); | 340 Object.defineProperty(proto, name, {value: method || methods['Object']}); |
| 334 } | 341 } |
| 335 // ********** Code for Clock ************** | 342 // ********** Code for Clock ************** |
| 336 function Clock() {} | 343 function Clock() {} |
| 337 Clock.now = function() { | 344 Clock.now = function() { |
| 338 return new Date().getTime(); | 345 return new Date().getTime(); |
| 339 } | 346 } |
| 340 Clock.frequency = function() { | 347 Clock.frequency = function() { |
| 341 return 1000; | 348 return 1000; |
| 342 } | 349 } |
| 350 // ********** Code for AssertError ************** |
| 351 function AssertError(failedAssertion, url, line, column) { |
| 352 this.failedAssertion = failedAssertion; |
| 353 this.url = url; |
| 354 this.line = line; |
| 355 this.column = column; |
| 356 // Initializers done |
| 357 } |
| 358 AssertError.prototype.toString = function() { |
| 359 return ("Failed assertion: '" + this.failedAssertion + "' is not true ") + ("i
n " + this.url + " at line " + this.line + ", column " + this.column + "."); |
| 360 } |
| 343 // ********** Code for Object ************** | 361 // ********** Code for Object ************** |
| 344 Object.prototype.get$dynamic = function() { | 362 Object.prototype.get$dynamic = function() { |
| 345 return this; | 363 return this; |
| 346 } | 364 } |
| 347 Object.prototype.noSuchMethod = function(name, args) { | 365 Object.prototype.noSuchMethod = function(name, args) { |
| 348 $throw(new NoSuchMethodException(this, name, args)); | 366 $throw(new NoSuchMethodException(this, name, args)); |
| 349 } | 367 } |
| 350 Object.prototype.forEach$1 = function($0) { | 368 Object.prototype.forEach$1 = function($0) { |
| 351 return this.noSuchMethod("forEach", [$0]); | 369 return this.noSuchMethod("forEach", [$0]); |
| 352 } | 370 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 364 } | 382 } |
| 365 ; | 383 ; |
| 366 Object.prototype.set_$4 = function($0, $1, $2, $3) { | 384 Object.prototype.set_$4 = function($0, $1, $2, $3) { |
| 367 return this.noSuchMethod("set_", [$0, $1, $2, $3]); | 385 return this.noSuchMethod("set_", [$0, $1, $2, $3]); |
| 368 } | 386 } |
| 369 ; | 387 ; |
| 370 Object.prototype.visitPostfixExpression$1 = function($0) { | 388 Object.prototype.visitPostfixExpression$1 = function($0) { |
| 371 return this.noSuchMethod("visitPostfixExpression", [$0]); | 389 return this.noSuchMethod("visitPostfixExpression", [$0]); |
| 372 } | 390 } |
| 373 ; | 391 ; |
| 392 function $assert_bool(x) { |
| 393 if (x == null || typeof(x) == "boolean") return x; |
| 394 throw new TypeError("'" + x + "' is not a bool."); |
| 395 } |
| 374 // ********** Code for IllegalAccessException ************** | 396 // ********** Code for IllegalAccessException ************** |
| 375 function IllegalAccessException() { | 397 function IllegalAccessException() { |
| 376 // Initializers done | 398 // Initializers done |
| 377 } | 399 } |
| 378 IllegalAccessException.prototype.toString = function() { | 400 IllegalAccessException.prototype.toString = function() { |
| 379 return "Attempt to modify an immutable object"; | 401 return "Attempt to modify an immutable object"; |
| 380 } | 402 } |
| 381 // ********** Code for NoSuchMethodException ************** | 403 // ********** Code for NoSuchMethodException ************** |
| 382 function NoSuchMethodException(_receiver, _functionName, _arguments) { | 404 function NoSuchMethodException(_receiver, _functionName, _arguments) { |
| 383 this._receiver = _receiver; | 405 this._receiver = _receiver; |
| 384 this._functionName = _functionName; | 406 this._functionName = _functionName; |
| 385 this._arguments = _arguments; | 407 this._arguments = _arguments; |
| 386 // Initializers done | 408 // Initializers done |
| 387 } | 409 } |
| 388 NoSuchMethodException.prototype.toString = function() { | 410 NoSuchMethodException.prototype.toString = function() { |
| 389 var sb = new StringBufferImpl(""); | 411 var sb = new StringBufferImpl(""); |
| 390 for (var i = 0; | 412 for (var i = 0; |
| 391 i < this._arguments.length; i++) { | 413 $notnull_bool(i < this._arguments.length); i++) { |
| 392 if (i > 0) { | 414 if ($notnull_bool(i > 0)) { |
| 393 sb.add(", "); | 415 sb.add(", "); |
| 394 } | 416 } |
| 395 sb.add(this._arguments.$index(i)); | 417 sb.add(this._arguments.$index(i)); |
| 396 } | 418 } |
| 397 sb.add("]"); | 419 sb.add("]"); |
| 398 return ("NoSuchMethodException - receiver: '" + this._receiver + "' ") + ("fun
ction name: '" + this._functionName + "' arguments: [" + sb + "]"); | 420 return ("NoSuchMethodException - receiver: '" + this._receiver + "' ") + ("fun
ction name: '" + this._functionName + "' arguments: [" + sb + "]"); |
| 399 } | 421 } |
| 400 // ********** Code for ObjectNotClosureException ************** | 422 // ********** Code for ObjectNotClosureException ************** |
| 401 function ObjectNotClosureException() {} | 423 function ObjectNotClosureException() {} |
| 402 ObjectNotClosureException.prototype.toString = function() { | 424 ObjectNotClosureException.prototype.toString = function() { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 } | 466 } |
| 445 Math.min = function(a, b) { | 467 Math.min = function(a, b) { |
| 446 if (a == b) return a; | 468 if (a == b) return a; |
| 447 if (a < b) { | 469 if (a < b) { |
| 448 if (isNaN(b)) return b; | 470 if (isNaN(b)) return b; |
| 449 else return a; | 471 else return a; |
| 450 } | 472 } |
| 451 if (isNaN(a)) return a; | 473 if (isNaN(a)) return a; |
| 452 else return b; | 474 else return b; |
| 453 } | 475 } |
| 476 function $assert_num(x) { |
| 477 if (x == null || typeof(x) == "number") return x; |
| 478 throw new TypeError("'" + x + "' is not a num."); |
| 479 } |
| 480 function $assert_String(x) { |
| 481 if (x == null || typeof(x) == "string") return x; |
| 482 throw new TypeError("'" + x + "' is not a String."); |
| 483 } |
| 454 // ********** Code for Strings ************** | 484 // ********** Code for Strings ************** |
| 455 function Strings() {} | 485 function Strings() {} |
| 456 Strings.String$fromCharCodes$factory = function(charCodes) { | 486 Strings.String$fromCharCodes$factory = function(charCodes) { |
| 457 return StringBase.createFromCharCodes(charCodes); | 487 return StringBase.createFromCharCodes(charCodes); |
| 458 } | 488 } |
| 459 Strings.join = function(strings, separator) { | 489 Strings.join = function(strings, separator) { |
| 460 return StringBase.join(strings, separator); | 490 return StringBase.join(strings, separator); |
| 461 } | 491 } |
| 462 // ********** Code for top level ************** | 492 // ********** Code for top level ************** |
| 463 function print(obj) { | 493 function print(obj) { |
| 464 if (typeof console == 'object') { | 494 if (typeof console == 'object') { |
| 465 if (obj) obj = obj.toString(); | 495 if (obj) obj = obj.toString(); |
| 466 console.log(obj); | 496 console.log(obj); |
| 467 } else { | 497 } else { |
| 468 write(obj); | 498 write(obj); |
| 469 write('\n'); | 499 write('\n'); |
| 470 } | 500 } |
| 471 } | 501 } |
| 472 // ********** Library dart:coreimpl ************** | 502 // ********** Library dart:coreimpl ************** |
| 473 // ********** Code for ListFactory ************** | 503 // ********** Code for ListFactory ************** |
| 474 ListFactory = Array; | 504 ListFactory = Array; |
| 475 ListFactory.prototype.is$List = function(){return this;}; | 505 ListFactory.prototype.is$List = function(){return this;}; |
| 506 ListFactory.prototype.is$List$ArgumentNode = function(){return this;}; |
| 507 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;}; |
| 508 ListFactory.prototype.is$List$String = function(){return this;}; |
| 509 ListFactory.prototype.is$List$T = function(){return this;}; |
| 510 ListFactory.prototype.is$List$Value = function(){return this;}; |
| 511 ListFactory.prototype.is$List$int = function(){return this;}; |
| 512 ListFactory.prototype.is$Iterable = function(){return this;}; |
| 476 ListFactory.ListFactory$from$factory = function(other) { | 513 ListFactory.ListFactory$from$factory = function(other) { |
| 514 var $0; |
| 477 var list = []; | 515 var list = []; |
| 478 for (var $i = other.iterator(); $i.hasNext(); ) { | 516 for (var $i = other.iterator(); $i.hasNext(); ) { |
| 479 var e = $i.next(); | 517 var e = $i.next(); |
| 480 list.add(e); | 518 list.add(e); |
| 481 } | 519 } |
| 482 return list; | 520 return list; |
| 483 } | 521 } |
| 484 ListFactory.prototype.add = function(value) { | 522 ListFactory.prototype.add = function(value) { |
| 485 this.push(value); | 523 this.push(value); |
| 486 } | 524 } |
| 487 ListFactory.prototype.addLast = function(value) { | 525 ListFactory.prototype.addLast = function(value) { |
| 488 this.push(value); | 526 this.push(value); |
| 489 } | 527 } |
| 490 ListFactory.prototype.addAll = function(collection) { | 528 ListFactory.prototype.addAll = function(collection) { |
| 529 var $0; |
| 491 for (var $i = collection.iterator(); $i.hasNext(); ) { | 530 for (var $i = collection.iterator(); $i.hasNext(); ) { |
| 492 var item = $i.next(); | 531 var item = $i.next(); |
| 493 this.add(item); | 532 this.add(item); |
| 494 } | 533 } |
| 495 } | 534 } |
| 496 ListFactory.prototype.clear = function() { | 535 ListFactory.prototype.clear = function() { |
| 497 this.length = 0; | 536 this.length = 0; |
| 498 } | 537 } |
| 499 ListFactory.prototype.removeLast = function() { | 538 ListFactory.prototype.removeLast = function() { |
| 500 return this.pop(); | 539 return this.pop(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 527 // ********** Code for ListIterator ************** | 566 // ********** Code for ListIterator ************** |
| 528 function ListIterator(array) { | 567 function ListIterator(array) { |
| 529 this._array = array; | 568 this._array = array; |
| 530 this._pos = 0; | 569 this._pos = 0; |
| 531 // Initializers done | 570 // Initializers done |
| 532 } | 571 } |
| 533 ListIterator.prototype.hasNext = function() { | 572 ListIterator.prototype.hasNext = function() { |
| 534 return this._array.length > this._pos; | 573 return this._array.length > this._pos; |
| 535 } | 574 } |
| 536 ListIterator.prototype.next = function() { | 575 ListIterator.prototype.next = function() { |
| 537 if (!this.hasNext()) { | 576 if ($notnull_bool(!this.hasNext())) { |
| 538 $throw(const$4/*const NoMoreElementsException()*/); | 577 $throw(const$0/*const NoMoreElementsException()*/); |
| 539 } | 578 } |
| 540 return this._array.$index(this._pos++); | 579 return this._array.$index(this._pos++); |
| 541 } | 580 } |
| 542 // ********** Code for ImmutableList ************** | 581 // ********** Code for ImmutableList ************** |
| 543 function ImmutableList(length0) { | 582 function ImmutableList(length0) { |
| 544 this._length = length0; | 583 this._length = length0; |
| 545 ListFactory$E.call(this, length0); | 584 ListFactory$E.call(this, length0); |
| 546 // Initializers done | 585 // Initializers done |
| 547 } | 586 } |
| 548 $inherits(ImmutableList, ListFactory$E); | 587 $inherits(ImmutableList, ListFactory$E); |
| 549 ImmutableList.ImmutableList$from$factory = function(other) { | 588 ImmutableList.ImmutableList$from$factory = function(other) { |
| 550 var list = new ImmutableList(other.length); | 589 var list = new ImmutableList(other.length); |
| 551 for (var i = 0; | 590 for (var i = 0; |
| 552 i < other.length; i++) { | 591 $notnull_bool(i < other.length); i++) { |
| 553 list._setindex(i, other.$index(i)); | 592 list._setindex(i, other.$index(i)); |
| 554 } | 593 } |
| 555 return list; | 594 return list; |
| 556 } | 595 } |
| 557 ImmutableList.prototype.get$length = function() { | 596 ImmutableList.prototype.get$length = function() { |
| 558 return this._length; | 597 return this._length; |
| 559 } | 598 } |
| 560 ImmutableList.prototype.set$length = function(length0) { | 599 ImmutableList.prototype.set$length = function(length0) { |
| 561 $throw(const$221/*const IllegalAccessException()*/); | 600 $throw(const$221/*const IllegalAccessException()*/); |
| 562 } | 601 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 586 $throw(const$221/*const IllegalAccessException()*/); | 625 $throw(const$221/*const IllegalAccessException()*/); |
| 587 } | 626 } |
| 588 ImmutableList.prototype.removeLast = function() { | 627 ImmutableList.prototype.removeLast = function() { |
| 589 $throw(const$221/*const IllegalAccessException()*/); | 628 $throw(const$221/*const IllegalAccessException()*/); |
| 590 } | 629 } |
| 591 // ********** Code for ImmutableMap ************** | 630 // ********** Code for ImmutableMap ************** |
| 592 function ImmutableMap(keyValuePairs) { | 631 function ImmutableMap(keyValuePairs) { |
| 593 this._internal = $map([]); | 632 this._internal = $map([]); |
| 594 // Initializers done | 633 // Initializers done |
| 595 for (var i = 0; | 634 for (var i = 0; |
| 596 i < keyValuePairs.length; i += 2) { | 635 $notnull_bool(i < keyValuePairs.length); i += 2) { |
| 597 this._internal.$setindex(keyValuePairs.$index(i), keyValuePairs.$index(i + 1
)); | 636 this._internal.$setindex(keyValuePairs.$index(i), keyValuePairs.$index(i + 1
)); |
| 598 } | 637 } |
| 599 } | 638 } |
| 639 ImmutableMap.prototype.is$Map = function(){return this;}; |
| 600 ImmutableMap.prototype.$index = function(key) { | 640 ImmutableMap.prototype.$index = function(key) { |
| 601 return this._internal.$index(key); | 641 return this._internal.$index(key); |
| 602 } | 642 } |
| 603 ImmutableMap.prototype.isEmpty = function() { | 643 ImmutableMap.prototype.isEmpty = function() { |
| 604 return this._internal.isEmpty(); | 644 return this._internal.isEmpty(); |
| 605 } | 645 } |
| 606 ImmutableMap.prototype.get$length = function() { | 646 ImmutableMap.prototype.get$length = function() { |
| 607 return this._internal.get$length(); | 647 return this._internal.get$length(); |
| 608 } | 648 } |
| 609 Object.defineProperty(ImmutableMap.prototype, "length", { | 649 Object.defineProperty(ImmutableMap.prototype, "length", { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 var truncated = (this < 0) ? Math.ceil(this) : Math.floor(this); | 692 var truncated = (this < 0) ? Math.ceil(this) : Math.floor(this); |
| 653 | 693 |
| 654 if (truncated == -0.0) return 0; | 694 if (truncated == -0.0) return 0; |
| 655 return truncated; | 695 return truncated; |
| 656 } | 696 } |
| 657 NumImplementation.prototype.toDouble = function() { | 697 NumImplementation.prototype.toDouble = function() { |
| 658 return this + 0; | 698 return this + 0; |
| 659 } | 699 } |
| 660 NumImplementation.prototype.compareTo = function(other) { | 700 NumImplementation.prototype.compareTo = function(other) { |
| 661 var thisValue = this.toDouble(); | 701 var thisValue = this.toDouble(); |
| 662 if (thisValue < other) { | 702 if ($notnull_bool(thisValue < other)) { |
| 663 return -1; | 703 return -1; |
| 664 } | 704 } |
| 665 else if (thisValue > other) { | 705 else if ($notnull_bool(thisValue > other)) { |
| 666 return 1; | 706 return 1; |
| 667 } | 707 } |
| 668 else if (thisValue == other) { | 708 else if ($notnull_bool(thisValue == other)) { |
| 669 if (thisValue == 0) { | 709 if ($notnull_bool(thisValue == 0)) { |
| 670 var thisIsNegative = this.isNegative(); | 710 var thisIsNegative = this.isNegative(); |
| 671 var otherIsNegative = other.isNegative(); | 711 var otherIsNegative = other.isNegative(); |
| 672 if ($eq(thisIsNegative, otherIsNegative)) return 0; | 712 if ($notnull_bool($eq(thisIsNegative, otherIsNegative))) return 0; |
| 673 if (thisIsNegative) return -1; | 713 if ($notnull_bool(thisIsNegative)) return -1; |
| 674 return 1; | 714 return 1; |
| 675 } | 715 } |
| 676 return 0; | 716 return 0; |
| 677 } | 717 } |
| 678 else if (this.isNaN()) { | 718 else if ($notnull_bool(this.isNaN())) { |
| 679 if (other.isNaN()) { | 719 if ($notnull_bool(other.isNaN())) { |
| 680 return 0; | 720 return 0; |
| 681 } | 721 } |
| 682 return 1; | 722 return 1; |
| 683 } | 723 } |
| 684 else { | 724 else { |
| 685 return -1; | 725 return -1; |
| 686 } | 726 } |
| 687 } | 727 } |
| 688 // ********** Code for ExceptionImplementation ************** | 728 // ********** Code for ExceptionImplementation ************** |
| 689 function ExceptionImplementation(_msg) { | 729 function ExceptionImplementation(_msg) { |
| 690 this._msg = _msg; | 730 this._msg = _msg; |
| 691 // Initializers done | 731 // Initializers done |
| 692 } | 732 } |
| 693 ExceptionImplementation.prototype.toString = function() { | 733 ExceptionImplementation.prototype.toString = function() { |
| 694 return (this._msg == null) ? "Exception" : ("Exception: " + this._msg + ""); | 734 return $notnull_bool((this._msg == null)) ? "Exception" : ("Exception: " + thi
s._msg + ""); |
| 695 } | 735 } |
| 696 // ********** Code for HashMapImplementation ************** | 736 // ********** Code for HashMapImplementation ************** |
| 697 function HashMapImplementation() { | 737 function HashMapImplementation() { |
| 698 // Initializers done | 738 // Initializers done |
| 699 if (HashMapImplementation._deletedKey == null) { | 739 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { |
| 700 HashMapImplementation._deletedKey = new Object(); | 740 HashMapImplementation._deletedKey = new Object(); |
| 701 } | 741 } |
| 702 this._numberOfEntries = 0; | 742 this._numberOfEntries = 0; |
| 703 this._numberOfDeleted = 0; | 743 this._numberOfDeleted = 0; |
| 704 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 744 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 705 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 745 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 706 this._values = new ListFactory$V(8/*HashMapImplementation._INITIAL_CAPACITY*/)
; | 746 this._values = new ListFactory$V(8/*HashMapImplementation._INITIAL_CAPACITY*/)
; |
| 707 } | 747 } |
| 748 HashMapImplementation.prototype.is$Map = function(){return this;}; |
| 708 HashMapImplementation.HashMapImplementation$from$factory = function(other) { | 749 HashMapImplementation.HashMapImplementation$from$factory = function(other) { |
| 709 var result = new HashMapImplementation(); | 750 var result = new HashMapImplementation(); |
| 710 other.forEach((function (key, value) { | 751 other.forEach((function (key, value) { |
| 711 result.$setindex(key, value); | 752 result.$setindex(key, value); |
| 712 }) | 753 }) |
| 713 ); | 754 ); |
| 714 return result; | 755 return result; |
| 715 } | 756 } |
| 716 HashMapImplementation._computeLoadLimit = function(capacity) { | 757 HashMapImplementation._computeLoadLimit = function(capacity) { |
| 717 return $truncdiv((capacity * 3), 4); | 758 return $truncdiv((capacity * 3), 4); |
| 718 } | 759 } |
| 719 HashMapImplementation._firstProbe = function(hashCode, length0) { | 760 HashMapImplementation._firstProbe = function(hashCode, length0) { |
| 720 return hashCode & (length0 - 1); | 761 return hashCode & (length0 - 1); |
| 721 } | 762 } |
| 722 HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length
0) { | 763 HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length
0) { |
| 723 return (currentProbe + numberOfProbes) & (length0 - 1); | 764 return (currentProbe + numberOfProbes) & (length0 - 1); |
| 724 } | 765 } |
| 725 HashMapImplementation.prototype._probeForAdding = function(key) { | 766 HashMapImplementation.prototype._probeForAdding = function(key) { |
| 726 var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.length
); | 767 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this
._keys.length); |
| 727 var numberOfProbes = 1; | 768 var numberOfProbes = 1; |
| 728 var initialHash = hash; | 769 var initialHash = hash; |
| 729 var insertionIndex = -1; | 770 var insertionIndex = -1; |
| 730 while (true) { | 771 while ($notnull_bool(true)) { |
| 731 var existingKey = this._keys.$index(hash); | 772 var existingKey = this._keys.$index(hash); |
| 732 if (existingKey == null) { | 773 if ($notnull_bool(existingKey == null)) { |
| 733 if (insertionIndex < 0) return hash; | 774 if ($notnull_bool(insertionIndex < 0)) return hash; |
| 734 return insertionIndex; | 775 return insertionIndex; |
| 735 } | 776 } |
| 736 else if ($eq(existingKey, key)) { | 777 else if ($notnull_bool($eq(existingKey, key))) { |
| 737 return hash; | 778 return hash; |
| 738 } | 779 } |
| 739 else if ((insertionIndex < 0) && (HashMapImplementation._deletedKey === exis
tingKey)) { | 780 else if ($notnull_bool((insertionIndex < 0) && (HashMapImplementation._delet
edKey === existingKey))) { |
| 740 insertionIndex = hash; | 781 insertionIndex = hash; |
| 741 } | 782 } |
| 742 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); | 783 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); |
| 743 } | 784 } |
| 744 } | 785 } |
| 745 HashMapImplementation.prototype._probeForLookup = function(key) { | 786 HashMapImplementation.prototype._probeForLookup = function(key) { |
| 746 var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.length
); | 787 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this
._keys.length); |
| 747 var numberOfProbes = 1; | 788 var numberOfProbes = 1; |
| 748 var initialHash = hash; | 789 var initialHash = hash; |
| 749 while (true) { | 790 while ($notnull_bool(true)) { |
| 750 var existingKey = this._keys.$index(hash); | 791 var existingKey = this._keys.$index(hash); |
| 751 if (existingKey == null) return -1; | 792 if ($notnull_bool(existingKey == null)) return -1; |
| 752 if ($eq(existingKey, key)) return hash; | 793 if ($notnull_bool($eq(existingKey, key))) return hash; |
| 753 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); | 794 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); |
| 754 } | 795 } |
| 755 } | 796 } |
| 756 HashMapImplementation.prototype._ensureCapacity = function() { | 797 HashMapImplementation.prototype._ensureCapacity = function() { |
| 757 var newNumberOfEntries = this._numberOfEntries + 1; | 798 var newNumberOfEntries = this._numberOfEntries + 1; |
| 758 if (newNumberOfEntries >= this._loadLimit) { | 799 if ($notnull_bool(newNumberOfEntries >= this._loadLimit)) { |
| 759 this._grow(this._keys.length * 2); | 800 this._grow(this._keys.length * 2); |
| 760 return; | 801 return; |
| 761 } | 802 } |
| 762 var capacity = this._keys.length; | 803 var capacity = this._keys.length; |
| 763 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; | 804 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; |
| 764 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; | 805 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; |
| 765 if (this._numberOfDeleted > numberOfFree) { | 806 if ($notnull_bool(this._numberOfDeleted > numberOfFree)) { |
| 766 this._grow(this._keys.length); | 807 this._grow(this._keys.length); |
| 767 } | 808 } |
| 768 } | 809 } |
| 769 HashMapImplementation._isPowerOfTwo = function(x) { | 810 HashMapImplementation._isPowerOfTwo = function(x) { |
| 770 return ((x & (x - 1)) == 0); | 811 return ((x & (x - 1)) == 0); |
| 771 } | 812 } |
| 772 HashMapImplementation.prototype._grow = function(newCapacity) { | 813 HashMapImplementation.prototype._grow = function(newCapacity) { |
| 814 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa
pacity)", "/Volumes/Data/dart/dart/corelib/src/implementation/hash_map_set.dart"
, 153, 12); |
| 773 var capacity = this._keys.length; | 815 var capacity = this._keys.length; |
| 774 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); | 816 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); |
| 775 var oldKeys = this._keys; | 817 var oldKeys = this._keys; |
| 776 var oldValues = this._values; | 818 var oldValues = this._values; |
| 777 this._keys = new ListFactory(newCapacity); | 819 this._keys = new ListFactory(newCapacity); |
| 778 this._values = new ListFactory$V(newCapacity); | 820 this._values = new ListFactory$V(newCapacity); |
| 779 for (var i = 0; | 821 for (var i = 0; |
| 780 i < capacity; i++) { | 822 $notnull_bool(i < capacity); i++) { |
| 781 var key = oldKeys.$index(i); | 823 var key = oldKeys.$index(i); |
| 782 if (key == null || key === HashMapImplementation._deletedKey) { | 824 if ($notnull_bool(key == null || key === HashMapImplementation._deletedKey))
{ |
| 783 continue; | 825 continue; |
| 784 } | 826 } |
| 785 var value = oldValues.$index(i); | 827 var value = oldValues.$index(i); |
| 786 var newIndex = this._probeForAdding(key); | 828 var newIndex = this._probeForAdding(key); |
| 787 this._keys.$setindex(newIndex, key); | 829 this._keys.$setindex(newIndex, key); |
| 788 this._values.$setindex(newIndex, value); | 830 this._values.$setindex(newIndex, value); |
| 789 } | 831 } |
| 790 this._numberOfDeleted = 0; | 832 this._numberOfDeleted = 0; |
| 791 } | 833 } |
| 792 HashMapImplementation.prototype.clear = function() { | 834 HashMapImplementation.prototype.clear = function() { |
| 793 this._numberOfEntries = 0; | 835 this._numberOfEntries = 0; |
| 794 this._numberOfDeleted = 0; | 836 this._numberOfDeleted = 0; |
| 795 var length0 = this._keys.length; | 837 var length0 = this._keys.length; |
| 796 for (var i = 0; | 838 for (var i = 0; |
| 797 i < length0; i++) { | 839 $notnull_bool(i < length0); i++) { |
| 798 this._keys.$setindex(i); | 840 this._keys.$setindex(i); |
| 799 this._values.$setindex(i); | 841 this._values.$setindex(i); |
| 800 } | 842 } |
| 801 } | 843 } |
| 802 HashMapImplementation.prototype.$setindex = function(key, value) { | 844 HashMapImplementation.prototype.$setindex = function(key, value) { |
| 803 this._ensureCapacity(); | 845 this._ensureCapacity(); |
| 804 var index = this._probeForAdding(key); | 846 var index = this._probeForAdding(key); |
| 805 if ((this._keys.$index(index) == null) || (this._keys.$index(index) === HashMa
pImplementation._deletedKey)) { | 847 if ($notnull_bool((this._keys.$index(index) == null) || (this._keys.$index(ind
ex) === HashMapImplementation._deletedKey))) { |
| 806 this._numberOfEntries++; | 848 this._numberOfEntries++; |
| 807 } | 849 } |
| 808 this._keys.$setindex(index, key); | 850 this._keys.$setindex(index, key); |
| 809 this._values.$setindex(index, value); | 851 this._values.$setindex(index, value); |
| 810 } | 852 } |
| 811 HashMapImplementation.prototype.$index = function(key) { | 853 HashMapImplementation.prototype.$index = function(key) { |
| 812 var index = this._probeForLookup(key); | 854 var index = this._probeForLookup(key); |
| 813 if (index < 0) return null; | 855 if ($notnull_bool(index < 0)) return null; |
| 814 return this._values.$index(index); | 856 return this._values.$index(index); |
| 815 } | 857 } |
| 816 HashMapImplementation.prototype.remove = function(key) { | 858 HashMapImplementation.prototype.remove = function(key) { |
| 817 var index = this._probeForLookup(key); | 859 var index = this._probeForLookup(key); |
| 818 if (index >= 0) { | 860 if ($notnull_bool(index >= 0)) { |
| 819 this._numberOfEntries--; | 861 this._numberOfEntries--; |
| 820 var value = this._values.$index(index); | 862 var value = this._values.$index(index); |
| 821 this._values.$setindex(index); | 863 this._values.$setindex(index); |
| 822 this._keys.$setindex(index, HashMapImplementation._deletedKey); | 864 this._keys.$setindex(index, HashMapImplementation._deletedKey); |
| 823 this._numberOfDeleted++; | 865 this._numberOfDeleted++; |
| 824 return value; | 866 return value; |
| 825 } | 867 } |
| 826 return null; | 868 return null; |
| 827 } | 869 } |
| 828 HashMapImplementation.prototype.isEmpty = function() { | 870 HashMapImplementation.prototype.isEmpty = function() { |
| 829 return this._numberOfEntries == 0; | 871 return this._numberOfEntries == 0; |
| 830 } | 872 } |
| 831 HashMapImplementation.prototype.get$length = function() { | 873 HashMapImplementation.prototype.get$length = function() { |
| 832 return this._numberOfEntries; | 874 return this._numberOfEntries; |
| 833 } | 875 } |
| 834 Object.defineProperty(HashMapImplementation.prototype, "length", { | 876 Object.defineProperty(HashMapImplementation.prototype, "length", { |
| 835 get: HashMapImplementation.prototype.get$length, | 877 get: HashMapImplementation.prototype.get$length, |
| 836 }); | 878 }); |
| 837 HashMapImplementation.prototype.forEach = function(f) { | 879 HashMapImplementation.prototype.forEach = function(f) { |
| 838 var length0 = this._keys.length; | 880 var length0 = this._keys.length; |
| 839 for (var i = 0; | 881 for (var i = 0; |
| 840 i < length0; i++) { | 882 $notnull_bool(i < length0); i++) { |
| 841 if ((this._keys.$index(i) != null) && (this._keys.$index(i) !== HashMapImple
mentation._deletedKey)) { | 883 if ($notnull_bool((this._keys.$index(i) != null) && (this._keys.$index(i) !=
= HashMapImplementation._deletedKey))) { |
| 842 f(this._keys.$index(i), this._values.$index(i)); | 884 f(this._keys.$index(i), this._values.$index(i)); |
| 843 } | 885 } |
| 844 } | 886 } |
| 845 } | 887 } |
| 846 HashMapImplementation.prototype.getKeys = function() { | 888 HashMapImplementation.prototype.getKeys = function() { |
| 847 var list = new ListFactory$K(this.get$length()); | 889 var list = new ListFactory$K(this.get$length()); |
| 848 var i = 0; | 890 var i = 0; |
| 849 this.forEach(function _(key, value) { | 891 this.forEach(function _(key, value) { |
| 850 list.$setindex(i++, key); | 892 list.$setindex(i++, key); |
| 851 } | 893 } |
| 852 ); | 894 ); |
| 853 return list; | 895 return list; |
| 854 } | 896 } |
| 855 HashMapImplementation.prototype.getValues = function() { | 897 HashMapImplementation.prototype.getValues = function() { |
| 856 var list = new ListFactory$V(this.get$length()); | 898 var list = new ListFactory$V(this.get$length()); |
| 857 var i = 0; | 899 var i = 0; |
| 858 this.forEach(function _(key, value) { | 900 this.forEach(function _(key, value) { |
| 859 list.$setindex(i++, value); | 901 list.$setindex(i++, value); |
| 860 } | 902 } |
| 861 ); | 903 ); |
| 862 return list; | 904 return list; |
| 863 } | 905 } |
| 864 HashMapImplementation.prototype.containsKey = function(key) { | 906 HashMapImplementation.prototype.containsKey = function(key) { |
| 865 return (this._probeForLookup(key) != -1); | 907 return (this._probeForLookup(key) != -1); |
| 866 } | 908 } |
| 867 HashMapImplementation.prototype.forEach$1 = HashMapImplementation.prototype.forE
ach; | 909 HashMapImplementation.prototype.forEach$1 = HashMapImplementation.prototype.forE
ach; |
| 868 // ********** Code for HashMapImplementation$E$E ************** | 910 // ********** Code for HashMapImplementation$E$E ************** |
| 869 function HashMapImplementation$E$E() { | 911 function HashMapImplementation$E$E() { |
| 870 // Initializers done | 912 // Initializers done |
| 871 if (HashMapImplementation._deletedKey == null) { | 913 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { |
| 872 HashMapImplementation._deletedKey = new Object(); | 914 HashMapImplementation._deletedKey = new Object(); |
| 873 } | 915 } |
| 874 this._numberOfEntries = 0; | 916 this._numberOfEntries = 0; |
| 875 this._numberOfDeleted = 0; | 917 this._numberOfDeleted = 0; |
| 876 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 918 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 877 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 919 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 878 this._values = new ListFactory$E(8/*HashMapImplementation._INITIAL_CAPACITY*/)
; | 920 this._values = new ListFactory$E(8/*HashMapImplementation._INITIAL_CAPACITY*/)
; |
| 879 } | 921 } |
| 880 $inherits(HashMapImplementation$E$E, HashMapImplementation); | 922 $inherits(HashMapImplementation$E$E, HashMapImplementation); |
| 923 HashMapImplementation$E$E.prototype.is$Map = function(){return this;}; |
| 881 HashMapImplementation$E$E._computeLoadLimit = function(capacity) { | 924 HashMapImplementation$E$E._computeLoadLimit = function(capacity) { |
| 882 return $truncdiv((capacity * 3), 4); | 925 return $truncdiv((capacity * 3), 4); |
| 883 } | 926 } |
| 884 HashMapImplementation$E$E._firstProbe = function(hashCode, length0) { | 927 HashMapImplementation$E$E._firstProbe = function(hashCode, length0) { |
| 885 return hashCode & (length0 - 1); | 928 return hashCode & (length0 - 1); |
| 886 } | 929 } |
| 887 HashMapImplementation$E$E._nextProbe = function(currentProbe, numberOfProbes, le
ngth0) { | 930 HashMapImplementation$E$E._nextProbe = function(currentProbe, numberOfProbes, le
ngth0) { |
| 888 return (currentProbe + numberOfProbes) & (length0 - 1); | 931 return (currentProbe + numberOfProbes) & (length0 - 1); |
| 889 } | 932 } |
| 890 HashMapImplementation$E$E.prototype._probeForAdding = function(key) { | 933 HashMapImplementation$E$E.prototype._probeForAdding = function(key) { |
| 891 var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.length
); | 934 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this
._keys.length); |
| 892 var numberOfProbes = 1; | 935 var numberOfProbes = 1; |
| 893 var initialHash = hash; | 936 var initialHash = hash; |
| 894 var insertionIndex = -1; | 937 var insertionIndex = -1; |
| 895 while (true) { | 938 while ($notnull_bool(true)) { |
| 896 var existingKey = this._keys.$index(hash); | 939 var existingKey = this._keys.$index(hash); |
| 897 if (existingKey == null) { | 940 if ($notnull_bool(existingKey == null)) { |
| 898 if (insertionIndex < 0) return hash; | 941 if ($notnull_bool(insertionIndex < 0)) return hash; |
| 899 return insertionIndex; | 942 return insertionIndex; |
| 900 } | 943 } |
| 901 else if ($eq(existingKey, key)) { | 944 else if ($notnull_bool($eq(existingKey, key))) { |
| 902 return hash; | 945 return hash; |
| 903 } | 946 } |
| 904 else if ((insertionIndex < 0) && (HashMapImplementation._deletedKey === exis
tingKey)) { | 947 else if ($notnull_bool((insertionIndex < 0) && (HashMapImplementation._delet
edKey === existingKey))) { |
| 905 insertionIndex = hash; | 948 insertionIndex = hash; |
| 906 } | 949 } |
| 907 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); | 950 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); |
| 908 } | 951 } |
| 909 } | 952 } |
| 910 HashMapImplementation$E$E.prototype._probeForLookup = function(key) { | 953 HashMapImplementation$E$E.prototype._probeForLookup = function(key) { |
| 911 var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.length
); | 954 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode()), this
._keys.length); |
| 912 var numberOfProbes = 1; | 955 var numberOfProbes = 1; |
| 913 var initialHash = hash; | 956 var initialHash = hash; |
| 914 while (true) { | 957 while ($notnull_bool(true)) { |
| 915 var existingKey = this._keys.$index(hash); | 958 var existingKey = this._keys.$index(hash); |
| 916 if (existingKey == null) return -1; | 959 if ($notnull_bool(existingKey == null)) return -1; |
| 917 if ($eq(existingKey, key)) return hash; | 960 if ($notnull_bool($eq(existingKey, key))) return hash; |
| 918 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); | 961 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l
ength); |
| 919 } | 962 } |
| 920 } | 963 } |
| 921 HashMapImplementation$E$E.prototype._ensureCapacity = function() { | 964 HashMapImplementation$E$E.prototype._ensureCapacity = function() { |
| 922 var newNumberOfEntries = this._numberOfEntries + 1; | 965 var newNumberOfEntries = this._numberOfEntries + 1; |
| 923 if (newNumberOfEntries >= this._loadLimit) { | 966 if ($notnull_bool(newNumberOfEntries >= this._loadLimit)) { |
| 924 this._grow(this._keys.length * 2); | 967 this._grow(this._keys.length * 2); |
| 925 return; | 968 return; |
| 926 } | 969 } |
| 927 var capacity = this._keys.length; | 970 var capacity = this._keys.length; |
| 928 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; | 971 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; |
| 929 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; | 972 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; |
| 930 if (this._numberOfDeleted > numberOfFree) { | 973 if ($notnull_bool(this._numberOfDeleted > numberOfFree)) { |
| 931 this._grow(this._keys.length); | 974 this._grow(this._keys.length); |
| 932 } | 975 } |
| 933 } | 976 } |
| 934 HashMapImplementation$E$E._isPowerOfTwo = function(x) { | 977 HashMapImplementation$E$E._isPowerOfTwo = function(x) { |
| 935 return ((x & (x - 1)) == 0); | 978 return ((x & (x - 1)) == 0); |
| 936 } | 979 } |
| 937 HashMapImplementation$E$E.prototype._grow = function(newCapacity) { | 980 HashMapImplementation$E$E.prototype._grow = function(newCapacity) { |
| 981 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa
pacity)", "/Volumes/Data/dart/dart/corelib/src/implementation/hash_map_set.dart"
, 153, 12); |
| 938 var capacity = this._keys.length; | 982 var capacity = this._keys.length; |
| 939 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); | 983 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); |
| 940 var oldKeys = this._keys; | 984 var oldKeys = this._keys; |
| 941 var oldValues = this._values; | 985 var oldValues = this._values; |
| 942 this._keys = new ListFactory(newCapacity); | 986 this._keys = new ListFactory(newCapacity); |
| 943 this._values = new ListFactory$E(newCapacity); | 987 this._values = new ListFactory$E(newCapacity); |
| 944 for (var i = 0; | 988 for (var i = 0; |
| 945 i < capacity; i++) { | 989 $notnull_bool(i < capacity); i++) { |
| 946 var key = oldKeys.$index(i); | 990 var key = oldKeys.$index(i); |
| 947 if (key == null || key === HashMapImplementation._deletedKey) { | 991 if ($notnull_bool(key == null || key === HashMapImplementation._deletedKey))
{ |
| 948 continue; | 992 continue; |
| 949 } | 993 } |
| 950 var value = oldValues.$index(i); | 994 var value = oldValues.$index(i); |
| 951 var newIndex = this._probeForAdding(key); | 995 var newIndex = this._probeForAdding(key); |
| 952 this._keys.$setindex(newIndex, key); | 996 this._keys.$setindex(newIndex, key); |
| 953 this._values.$setindex(newIndex, value); | 997 this._values.$setindex(newIndex, value); |
| 954 } | 998 } |
| 955 this._numberOfDeleted = 0; | 999 this._numberOfDeleted = 0; |
| 956 } | 1000 } |
| 957 HashMapImplementation$E$E.prototype.$setindex = function(key, value) { | 1001 HashMapImplementation$E$E.prototype.$setindex = function(key, value) { |
| 958 this._ensureCapacity(); | 1002 this._ensureCapacity(); |
| 959 var index = this._probeForAdding(key); | 1003 var index = this._probeForAdding(key); |
| 960 if ((this._keys.$index(index) == null) || (this._keys.$index(index) === HashMa
pImplementation._deletedKey)) { | 1004 if ($notnull_bool((this._keys.$index(index) == null) || (this._keys.$index(ind
ex) === HashMapImplementation._deletedKey))) { |
| 961 this._numberOfEntries++; | 1005 this._numberOfEntries++; |
| 962 } | 1006 } |
| 963 this._keys.$setindex(index, key); | 1007 this._keys.$setindex(index, key); |
| 964 this._values.$setindex(index, value); | 1008 this._values.$setindex(index, value); |
| 965 } | 1009 } |
| 966 HashMapImplementation$E$E.prototype.remove = function(key) { | 1010 HashMapImplementation$E$E.prototype.remove = function(key) { |
| 967 var index = this._probeForLookup(key); | 1011 var index = this._probeForLookup(key); |
| 968 if (index >= 0) { | 1012 if ($notnull_bool(index >= 0)) { |
| 969 this._numberOfEntries--; | 1013 this._numberOfEntries--; |
| 970 var value = this._values.$index(index); | 1014 var value = this._values.$index(index); |
| 971 this._values.$setindex(index); | 1015 this._values.$setindex(index); |
| 972 this._keys.$setindex(index, HashMapImplementation._deletedKey); | 1016 this._keys.$setindex(index, HashMapImplementation._deletedKey); |
| 973 this._numberOfDeleted++; | 1017 this._numberOfDeleted++; |
| 974 return value; | 1018 return value; |
| 975 } | 1019 } |
| 976 return null; | 1020 return null; |
| 977 } | 1021 } |
| 978 HashMapImplementation$E$E.prototype.isEmpty = function() { | 1022 HashMapImplementation$E$E.prototype.isEmpty = function() { |
| 979 return this._numberOfEntries == 0; | 1023 return this._numberOfEntries == 0; |
| 980 } | 1024 } |
| 981 HashMapImplementation$E$E.prototype.forEach = function(f) { | 1025 HashMapImplementation$E$E.prototype.forEach = function(f) { |
| 982 var length0 = this._keys.length; | 1026 var length0 = this._keys.length; |
| 983 for (var i = 0; | 1027 for (var i = 0; |
| 984 i < length0; i++) { | 1028 $notnull_bool(i < length0); i++) { |
| 985 if ((this._keys.$index(i) != null) && (this._keys.$index(i) !== HashMapImple
mentation._deletedKey)) { | 1029 if ($notnull_bool((this._keys.$index(i) != null) && (this._keys.$index(i) !=
= HashMapImplementation._deletedKey))) { |
| 986 f(this._keys.$index(i), this._values.$index(i)); | 1030 f(this._keys.$index(i), this._values.$index(i)); |
| 987 } | 1031 } |
| 988 } | 1032 } |
| 989 } | 1033 } |
| 990 HashMapImplementation$E$E.prototype.getKeys = function() { | 1034 HashMapImplementation$E$E.prototype.getKeys = function() { |
| 991 var list = new ListFactory$E(this.get$length()); | 1035 var list = new ListFactory$E(this.get$length()); |
| 992 var i = 0; | 1036 var i = 0; |
| 993 this.forEach(function _(key, value) { | 1037 this.forEach(function _(key, value) { |
| 994 list.$setindex(i++, key); | 1038 list.$setindex(i++, key); |
| 995 } | 1039 } |
| 996 ); | 1040 ); |
| 997 return list; | 1041 return list; |
| 998 } | 1042 } |
| 999 HashMapImplementation$E$E.prototype.containsKey = function(key) { | 1043 HashMapImplementation$E$E.prototype.containsKey = function(key) { |
| 1000 return (this._probeForLookup(key) != -1); | 1044 return (this._probeForLookup(key) != -1); |
| 1001 } | 1045 } |
| 1002 // ********** Code for HashMapImplementation$HInstruction$HInstruction *********
***** | 1046 // ********** Code for HashMapImplementation$HInstruction$HInstruction *********
***** |
| 1003 function HashMapImplementation$HInstruction$HInstruction() { | 1047 function HashMapImplementation$HInstruction$HInstruction() { |
| 1004 // Initializers done | 1048 // Initializers done |
| 1005 if (HashMapImplementation._deletedKey == null) { | 1049 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { |
| 1006 HashMapImplementation._deletedKey = new Object(); | 1050 HashMapImplementation._deletedKey = new Object(); |
| 1007 } | 1051 } |
| 1008 this._numberOfEntries = 0; | 1052 this._numberOfEntries = 0; |
| 1009 this._numberOfDeleted = 0; | 1053 this._numberOfDeleted = 0; |
| 1010 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 1054 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 1011 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1055 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1012 this._values = new ListFactory$HInstruction(8/*HashMapImplementation._INITIAL_
CAPACITY*/); | 1056 this._values = new ListFactory$HInstruction(8/*HashMapImplementation._INITIAL_
CAPACITY*/); |
| 1013 } | 1057 } |
| 1014 $inherits(HashMapImplementation$HInstruction$HInstruction, HashMapImplementation
); | 1058 $inherits(HashMapImplementation$HInstruction$HInstruction, HashMapImplementation
); |
| 1059 HashMapImplementation$HInstruction$HInstruction.prototype.is$Map = function(){re
turn this;}; |
| 1015 HashMapImplementation$HInstruction$HInstruction._computeLoadLimit = function(cap
acity) { | 1060 HashMapImplementation$HInstruction$HInstruction._computeLoadLimit = function(cap
acity) { |
| 1016 return $truncdiv((capacity * 3), 4); | 1061 return $truncdiv((capacity * 3), 4); |
| 1017 } | 1062 } |
| 1018 // ********** Code for HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePa
ir$K$V ************** | 1063 // ********** Code for HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePa
ir$K$V ************** |
| 1019 function HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V() { | 1064 function HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V() { |
| 1020 // Initializers done | 1065 // Initializers done |
| 1021 if (HashMapImplementation._deletedKey == null) { | 1066 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { |
| 1022 HashMapImplementation._deletedKey = new Object(); | 1067 HashMapImplementation._deletedKey = new Object(); |
| 1023 } | 1068 } |
| 1024 this._numberOfEntries = 0; | 1069 this._numberOfEntries = 0; |
| 1025 this._numberOfDeleted = 0; | 1070 this._numberOfDeleted = 0; |
| 1026 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 1071 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 1027 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1072 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1028 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$K$V(8/*Hash
MapImplementation._INITIAL_CAPACITY*/); | 1073 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$K$V(8/*Hash
MapImplementation._INITIAL_CAPACITY*/); |
| 1029 } | 1074 } |
| 1030 $inherits(HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V, HashM
apImplementation); | 1075 $inherits(HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V, HashM
apImplementation); |
| 1076 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$Map
= function(){return this;}; |
| 1031 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V._computeLoadLimi
t = function(capacity) { | 1077 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V._computeLoadLimi
t = function(capacity) { |
| 1032 return $truncdiv((capacity * 3), 4); | 1078 return $truncdiv((capacity * 3), 4); |
| 1033 } | 1079 } |
| 1034 // ********** Code for HashMapImplementation$Node$Element ************** | 1080 // ********** Code for HashMapImplementation$Node$Element ************** |
| 1035 function HashMapImplementation$Node$Element() { | 1081 function HashMapImplementation$Node$Element() { |
| 1036 // Initializers done | 1082 // Initializers done |
| 1037 if (HashMapImplementation._deletedKey == null) { | 1083 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { |
| 1038 HashMapImplementation._deletedKey = new Object(); | 1084 HashMapImplementation._deletedKey = new Object(); |
| 1039 } | 1085 } |
| 1040 this._numberOfEntries = 0; | 1086 this._numberOfEntries = 0; |
| 1041 this._numberOfDeleted = 0; | 1087 this._numberOfDeleted = 0; |
| 1042 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 1088 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 1043 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1089 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1044 this._values = new ListFactory$Element(8/*HashMapImplementation._INITIAL_CAPAC
ITY*/); | 1090 this._values = new ListFactory$Element(8/*HashMapImplementation._INITIAL_CAPAC
ITY*/); |
| 1045 } | 1091 } |
| 1046 $inherits(HashMapImplementation$Node$Element, HashMapImplementation); | 1092 $inherits(HashMapImplementation$Node$Element, HashMapImplementation); |
| 1093 HashMapImplementation$Node$Element.prototype.is$Map = function(){return this;}; |
| 1047 HashMapImplementation$Node$Element._computeLoadLimit = function(capacity) { | 1094 HashMapImplementation$Node$Element._computeLoadLimit = function(capacity) { |
| 1048 return $truncdiv((capacity * 3), 4); | 1095 return $truncdiv((capacity * 3), 4); |
| 1049 } | 1096 } |
| 1050 // ********** Code for HashMapImplementation$String$DoubleLinkedQueueEntry$KeyVa
luePair$String$Keyword ************** | 1097 // ********** Code for HashMapImplementation$String$DoubleLinkedQueueEntry$KeyVa
luePair$String$Keyword ************** |
| 1051 function HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String
$Keyword() { | 1098 function HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String
$Keyword() { |
| 1052 // Initializers done | 1099 // Initializers done |
| 1053 if (HashMapImplementation._deletedKey == null) { | 1100 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { |
| 1054 HashMapImplementation._deletedKey = new Object(); | 1101 HashMapImplementation._deletedKey = new Object(); |
| 1055 } | 1102 } |
| 1056 this._numberOfEntries = 0; | 1103 this._numberOfEntries = 0; |
| 1057 this._numberOfDeleted = 0; | 1104 this._numberOfDeleted = 0; |
| 1058 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 1105 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 1059 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1106 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1060 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$String$Keyw
ord(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1107 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$String$Keyw
ord(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1061 } | 1108 } |
| 1062 $inherits(HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$Strin
g$Keyword, HashMapImplementation); | 1109 $inherits(HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$Strin
g$Keyword, HashMapImplementation); |
| 1110 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword.
prototype.is$Map = function(){return this;}; |
| 1063 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword.
_computeLoadLimit = function(capacity) { | 1111 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword.
_computeLoadLimit = function(capacity) { |
| 1064 return $truncdiv((capacity * 3), 4); | 1112 return $truncdiv((capacity * 3), 4); |
| 1065 } | 1113 } |
| 1066 // ********** Code for HashMapImplementation$String$EvaluatedValue *************
* | 1114 // ********** Code for HashMapImplementation$String$EvaluatedValue *************
* |
| 1067 function HashMapImplementation$String$EvaluatedValue() { | 1115 function HashMapImplementation$String$EvaluatedValue() { |
| 1068 // Initializers done | 1116 // Initializers done |
| 1069 if (HashMapImplementation._deletedKey == null) { | 1117 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { |
| 1070 HashMapImplementation._deletedKey = new Object(); | 1118 HashMapImplementation._deletedKey = new Object(); |
| 1071 } | 1119 } |
| 1072 this._numberOfEntries = 0; | 1120 this._numberOfEntries = 0; |
| 1073 this._numberOfDeleted = 0; | 1121 this._numberOfDeleted = 0; |
| 1074 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 1122 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 1075 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1123 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1076 this._values = new ListFactory$EvaluatedValue(8/*HashMapImplementation._INITIA
L_CAPACITY*/); | 1124 this._values = new ListFactory$EvaluatedValue(8/*HashMapImplementation._INITIA
L_CAPACITY*/); |
| 1077 } | 1125 } |
| 1078 $inherits(HashMapImplementation$String$EvaluatedValue, HashMapImplementation); | 1126 $inherits(HashMapImplementation$String$EvaluatedValue, HashMapImplementation); |
| 1127 HashMapImplementation$String$EvaluatedValue.prototype.is$Map = function(){return
this;}; |
| 1079 HashMapImplementation$String$EvaluatedValue._computeLoadLimit = function(capacit
y) { | 1128 HashMapImplementation$String$EvaluatedValue._computeLoadLimit = function(capacit
y) { |
| 1080 return $truncdiv((capacity * 3), 4); | 1129 return $truncdiv((capacity * 3), 4); |
| 1081 } | 1130 } |
| 1082 // ********** Code for HashMapImplementation$String$String ************** | 1131 // ********** Code for HashMapImplementation$String$String ************** |
| 1083 function HashMapImplementation$String$String() { | 1132 function HashMapImplementation$String$String() { |
| 1084 // Initializers done | 1133 // Initializers done |
| 1085 if (HashMapImplementation._deletedKey == null) { | 1134 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { |
| 1086 HashMapImplementation._deletedKey = new Object(); | 1135 HashMapImplementation._deletedKey = new Object(); |
| 1087 } | 1136 } |
| 1088 this._numberOfEntries = 0; | 1137 this._numberOfEntries = 0; |
| 1089 this._numberOfDeleted = 0; | 1138 this._numberOfDeleted = 0; |
| 1090 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 1139 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 1091 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1140 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1092 this._values = new ListFactory$String(8/*HashMapImplementation._INITIAL_CAPACI
TY*/); | 1141 this._values = new ListFactory$String(8/*HashMapImplementation._INITIAL_CAPACI
TY*/); |
| 1093 } | 1142 } |
| 1094 $inherits(HashMapImplementation$String$String, HashMapImplementation); | 1143 $inherits(HashMapImplementation$String$String, HashMapImplementation); |
| 1144 HashMapImplementation$String$String.prototype.is$Map = function(){return this;}; |
| 1095 HashMapImplementation$String$String._computeLoadLimit = function(capacity) { | 1145 HashMapImplementation$String$String._computeLoadLimit = function(capacity) { |
| 1096 return $truncdiv((capacity * 3), 4); | 1146 return $truncdiv((capacity * 3), 4); |
| 1097 } | 1147 } |
| 1098 // ********** Code for HashMapImplementation$Type$Type ************** | 1148 // ********** Code for HashMapImplementation$Type$Type ************** |
| 1099 function HashMapImplementation$Type$Type() { | 1149 function HashMapImplementation$Type$Type() { |
| 1100 // Initializers done | 1150 // Initializers done |
| 1101 if (HashMapImplementation._deletedKey == null) { | 1151 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { |
| 1102 HashMapImplementation._deletedKey = new Object(); | 1152 HashMapImplementation._deletedKey = new Object(); |
| 1103 } | 1153 } |
| 1104 this._numberOfEntries = 0; | 1154 this._numberOfEntries = 0; |
| 1105 this._numberOfDeleted = 0; | 1155 this._numberOfDeleted = 0; |
| 1106 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 1156 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 1107 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 1157 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 1108 this._values = new ListFactory$Type(8/*HashMapImplementation._INITIAL_CAPACITY
*/); | 1158 this._values = new ListFactory$Type(8/*HashMapImplementation._INITIAL_CAPACITY
*/); |
| 1109 } | 1159 } |
| 1110 $inherits(HashMapImplementation$Type$Type, HashMapImplementation); | 1160 $inherits(HashMapImplementation$Type$Type, HashMapImplementation); |
| 1161 HashMapImplementation$Type$Type.prototype.is$Map = function(){return this;}; |
| 1111 HashMapImplementation$Type$Type._computeLoadLimit = function(capacity) { | 1162 HashMapImplementation$Type$Type._computeLoadLimit = function(capacity) { |
| 1112 return $truncdiv((capacity * 3), 4); | 1163 return $truncdiv((capacity * 3), 4); |
| 1113 } | 1164 } |
| 1114 // ********** Code for HashSetImplementation ************** | 1165 // ********** Code for HashSetImplementation ************** |
| 1115 function HashSetImplementation() { | 1166 function HashSetImplementation() { |
| 1116 // Initializers done | 1167 // Initializers done |
| 1117 this._backingMap = new HashMapImplementation$E$E(); | 1168 this._backingMap = new HashMapImplementation$E$E(); |
| 1118 } | 1169 } |
| 1170 HashSetImplementation.prototype.is$Iterable = function(){return this;}; |
| 1119 HashSetImplementation.HashSetImplementation$from$factory = function(other) { | 1171 HashSetImplementation.HashSetImplementation$from$factory = function(other) { |
| 1172 var $0; |
| 1120 var set = new HashSetImplementation(); | 1173 var set = new HashSetImplementation(); |
| 1121 for (var $i = other.iterator(); $i.hasNext(); ) { | 1174 for (var $i = other.iterator(); $i.hasNext(); ) { |
| 1122 var e = $i.next(); | 1175 var e = $i.next(); |
| 1123 set.add(e); | 1176 set.add(e); |
| 1124 } | 1177 } |
| 1125 return set; | 1178 return set; |
| 1126 } | 1179 } |
| 1127 HashSetImplementation.prototype.add = function(value) { | 1180 HashSetImplementation.prototype.add = function(value) { |
| 1128 this._backingMap.$setindex(value, value); | 1181 this._backingMap.$setindex(value, value); |
| 1129 } | 1182 } |
| 1130 HashSetImplementation.prototype.contains = function(value) { | 1183 HashSetImplementation.prototype.contains = function(value) { |
| 1131 return this._backingMap.containsKey(value); | 1184 return this._backingMap.containsKey(value); |
| 1132 } | 1185 } |
| 1133 HashSetImplementation.prototype.remove = function(value) { | 1186 HashSetImplementation.prototype.remove = function(value) { |
| 1134 if (!this._backingMap.containsKey(value)) return false; | 1187 if ($notnull_bool(!this._backingMap.containsKey(value))) return false; |
| 1135 this._backingMap.remove(value); | 1188 this._backingMap.remove(value); |
| 1136 return true; | 1189 return true; |
| 1137 } | 1190 } |
| 1138 HashSetImplementation.prototype.addAll = function(collection) { | 1191 HashSetImplementation.prototype.addAll = function(collection) { |
| 1139 var $this = this; // closure support | 1192 var $this = this; // closure support |
| 1140 collection.forEach(function _(value) { | 1193 collection.forEach(function _(value) { |
| 1141 $this.add(value); | 1194 $this.add(value); |
| 1142 } | 1195 } |
| 1143 ); | 1196 ); |
| 1144 } | 1197 } |
| 1145 HashSetImplementation.prototype.forEach = function(f) { | 1198 HashSetImplementation.prototype.forEach = function(f) { |
| 1146 this._backingMap.forEach(function _(key, value) { | 1199 this._backingMap.forEach(function _(key, value) { |
| 1147 f(key); | 1200 f(key); |
| 1148 } | 1201 } |
| 1149 ); | 1202 ); |
| 1150 } | 1203 } |
| 1151 HashSetImplementation.prototype.filter = function(f) { | 1204 HashSetImplementation.prototype.filter = function(f) { |
| 1152 var result = new HashSetImplementation$E(); | 1205 var result = new HashSetImplementation$E(); |
| 1153 this._backingMap.forEach(function _(key, value) { | 1206 this._backingMap.forEach(function _(key, value) { |
| 1154 if (f(key)) result.add(key); | 1207 if ($notnull_bool(f(key))) result.add(key); |
| 1155 } | 1208 } |
| 1156 ); | 1209 ); |
| 1157 return result; | 1210 return result; |
| 1158 } | 1211 } |
| 1159 HashSetImplementation.prototype.some = function(f) { | 1212 HashSetImplementation.prototype.some = function(f) { |
| 1160 var keys = this._backingMap.getKeys(); | 1213 var keys = this._backingMap.getKeys(); |
| 1161 return keys.some(f); | 1214 return keys.some(f); |
| 1162 } | 1215 } |
| 1163 HashSetImplementation.prototype.isEmpty = function() { | 1216 HashSetImplementation.prototype.isEmpty = function() { |
| 1164 return this._backingMap.isEmpty(); | 1217 return this._backingMap.isEmpty(); |
| 1165 } | 1218 } |
| 1166 HashSetImplementation.prototype.get$length = function() { | 1219 HashSetImplementation.prototype.get$length = function() { |
| 1167 return this._backingMap.get$length(); | 1220 return this._backingMap.get$length(); |
| 1168 } | 1221 } |
| 1169 Object.defineProperty(HashSetImplementation.prototype, "length", { | 1222 Object.defineProperty(HashSetImplementation.prototype, "length", { |
| 1170 get: HashSetImplementation.prototype.get$length, | 1223 get: HashSetImplementation.prototype.get$length, |
| 1171 }); | 1224 }); |
| 1172 HashSetImplementation.prototype.iterator = function() { | 1225 HashSetImplementation.prototype.iterator = function() { |
| 1173 return new HashSetIterator$E(this); | 1226 return new HashSetIterator$E(this); |
| 1174 } | 1227 } |
| 1175 HashSetImplementation.prototype.forEach$1 = HashSetImplementation.prototype.forE
ach; | 1228 HashSetImplementation.prototype.forEach$1 = HashSetImplementation.prototype.forE
ach; |
| 1176 // ********** Code for HashSetImplementation$E ************** | 1229 // ********** Code for HashSetImplementation$E ************** |
| 1177 function HashSetImplementation$E() { | 1230 function HashSetImplementation$E() { |
| 1178 // Initializers done | 1231 // Initializers done |
| 1179 this._backingMap = new HashMapImplementation$E$E(); | 1232 this._backingMap = new HashMapImplementation$E$E(); |
| 1180 } | 1233 } |
| 1181 $inherits(HashSetImplementation$E, HashSetImplementation); | 1234 $inherits(HashSetImplementation$E, HashSetImplementation); |
| 1235 HashSetImplementation$E.prototype.is$Iterable = function(){return this;}; |
| 1182 // ********** Code for HashSetImplementation$String ************** | 1236 // ********** Code for HashSetImplementation$String ************** |
| 1183 function HashSetImplementation$String() { | 1237 function HashSetImplementation$String() { |
| 1184 // Initializers done | 1238 // Initializers done |
| 1185 this._backingMap = new HashMapImplementation$String$String(); | 1239 this._backingMap = new HashMapImplementation$String$String(); |
| 1186 } | 1240 } |
| 1187 $inherits(HashSetImplementation$String, HashSetImplementation); | 1241 $inherits(HashSetImplementation$String, HashSetImplementation); |
| 1242 HashSetImplementation$String.prototype.is$Iterable = function(){return this;}; |
| 1188 // ********** Code for HashSetImplementation$Type ************** | 1243 // ********** Code for HashSetImplementation$Type ************** |
| 1189 function HashSetImplementation$Type() { | 1244 function HashSetImplementation$Type() { |
| 1190 // Initializers done | 1245 // Initializers done |
| 1191 this._backingMap = new HashMapImplementation$Type$Type(); | 1246 this._backingMap = new HashMapImplementation$Type$Type(); |
| 1192 } | 1247 } |
| 1193 $inherits(HashSetImplementation$Type, HashSetImplementation); | 1248 $inherits(HashSetImplementation$Type, HashSetImplementation); |
| 1249 HashSetImplementation$Type.prototype.is$Iterable = function(){return this;}; |
| 1194 // ********** Code for HashSetIterator ************** | 1250 // ********** Code for HashSetIterator ************** |
| 1195 function HashSetIterator(set_) { | 1251 function HashSetIterator(set_) { |
| 1196 this._nextValidIndex = -1; | 1252 this._nextValidIndex = -1; |
| 1197 this._entries = set_._backingMap._keys; | 1253 this._entries = set_._backingMap._keys; |
| 1198 // Initializers done | 1254 // Initializers done |
| 1199 this._advance(); | 1255 this._advance(); |
| 1200 } | 1256 } |
| 1201 HashSetIterator.prototype.hasNext = function() { | 1257 HashSetIterator.prototype.hasNext = function() { |
| 1202 if (this._nextValidIndex >= this._entries.length) return false; | 1258 if ($notnull_bool(this._nextValidIndex >= this._entries.length)) return false; |
| 1203 if (this._entries.$index(this._nextValidIndex) === HashMapImplementation._dele
tedKey) { | 1259 if ($notnull_bool(this._entries.$index(this._nextValidIndex) === HashMapImplem
entation._deletedKey)) { |
| 1204 this._advance(); | 1260 this._advance(); |
| 1205 } | 1261 } |
| 1206 return this._nextValidIndex < this._entries.length; | 1262 return this._nextValidIndex < this._entries.length; |
| 1207 } | 1263 } |
| 1208 HashSetIterator.prototype.next = function() { | 1264 HashSetIterator.prototype.next = function() { |
| 1209 if (!this.hasNext()) { | 1265 if ($notnull_bool(!this.hasNext())) { |
| 1210 $throw(const$4/*const NoMoreElementsException()*/); | 1266 $throw(const$0/*const NoMoreElementsException()*/); |
| 1211 } | 1267 } |
| 1212 var res = this._entries.$index(this._nextValidIndex); | 1268 var res = this._entries.$index(this._nextValidIndex); |
| 1213 this._advance(); | 1269 this._advance(); |
| 1214 return res; | 1270 return res; |
| 1215 } | 1271 } |
| 1216 HashSetIterator.prototype._advance = function() { | 1272 HashSetIterator.prototype._advance = function() { |
| 1217 var length = this._entries.length; | 1273 var length = this._entries.length; |
| 1218 var entry; | 1274 var entry; |
| 1219 var deletedKey = HashMapImplementation._deletedKey; | 1275 var deletedKey = HashMapImplementation._deletedKey; |
| 1220 do { | 1276 do { |
| 1221 if (++this._nextValidIndex >= length) break; | 1277 if ($notnull_bool(++this._nextValidIndex >= length)) break; |
| 1222 entry = this._entries.$index(this._nextValidIndex); | 1278 entry = this._entries.$index(this._nextValidIndex); |
| 1223 } | 1279 } |
| 1224 while ((entry == null) || (entry === deletedKey)) | 1280 while ($notnull_bool((entry == null) || (entry === deletedKey))) |
| 1225 } | 1281 } |
| 1226 // ********** Code for HashSetIterator$E ************** | 1282 // ********** Code for HashSetIterator$E ************** |
| 1227 function HashSetIterator$E(set_) { | 1283 function HashSetIterator$E(set_) { |
| 1228 this._nextValidIndex = -1; | 1284 this._nextValidIndex = -1; |
| 1229 this._entries = set_._backingMap._keys; | 1285 this._entries = set_._backingMap._keys; |
| 1230 // Initializers done | 1286 // Initializers done |
| 1231 this._advance(); | 1287 this._advance(); |
| 1232 } | 1288 } |
| 1233 $inherits(HashSetIterator$E, HashSetIterator); | 1289 $inherits(HashSetIterator$E, HashSetIterator); |
| 1234 HashSetIterator$E.prototype._advance = function() { | 1290 HashSetIterator$E.prototype._advance = function() { |
| 1235 var length = this._entries.length; | 1291 var length = this._entries.length; |
| 1236 var entry; | 1292 var entry; |
| 1237 var deletedKey = HashMapImplementation._deletedKey; | 1293 var deletedKey = HashMapImplementation._deletedKey; |
| 1238 do { | 1294 do { |
| 1239 if (++this._nextValidIndex >= length) break; | 1295 if ($notnull_bool(++this._nextValidIndex >= length)) break; |
| 1240 entry = this._entries.$index(this._nextValidIndex); | 1296 entry = this._entries.$index(this._nextValidIndex); |
| 1241 } | 1297 } |
| 1242 while ((entry == null) || (entry === deletedKey)) | 1298 while ($notnull_bool((entry == null) || (entry === deletedKey))) |
| 1243 } | 1299 } |
| 1244 // ********** Code for KeyValuePair ************** | 1300 // ********** Code for KeyValuePair ************** |
| 1245 function KeyValuePair(key, value) { | 1301 function KeyValuePair(key, value) { |
| 1246 this.key = key; | 1302 this.key = key; |
| 1247 this.value = value; | 1303 this.value = value; |
| 1248 // Initializers done | 1304 // Initializers done |
| 1249 } | 1305 } |
| 1250 KeyValuePair.prototype.get$value = function() { return this.value; }; | 1306 KeyValuePair.prototype.get$value = function() { return this.value; }; |
| 1251 KeyValuePair.prototype.set$value = function(value) { return this.value = value;
}; | 1307 KeyValuePair.prototype.set$value = function(value) { return this.value = value;
}; |
| 1252 // ********** Code for KeyValuePair$K$V ************** | 1308 // ********** Code for KeyValuePair$K$V ************** |
| 1253 function KeyValuePair$K$V(key, value) { | 1309 function KeyValuePair$K$V(key, value) { |
| 1254 this.key = key; | 1310 this.key = key; |
| 1255 this.value = value; | 1311 this.value = value; |
| 1256 // Initializers done | 1312 // Initializers done |
| 1257 } | 1313 } |
| 1258 $inherits(KeyValuePair$K$V, KeyValuePair); | 1314 $inherits(KeyValuePair$K$V, KeyValuePair); |
| 1259 // ********** Code for KeyValuePair$String$Keyword ************** | 1315 // ********** Code for KeyValuePair$String$Keyword ************** |
| 1260 function KeyValuePair$String$Keyword() {} | 1316 function KeyValuePair$String$Keyword() {} |
| 1261 $inherits(KeyValuePair$String$Keyword, KeyValuePair); | 1317 $inherits(KeyValuePair$String$Keyword, KeyValuePair); |
| 1262 // ********** Code for LinkedHashMapImplementation ************** | 1318 // ********** Code for LinkedHashMapImplementation ************** |
| 1263 function LinkedHashMapImplementation() { | 1319 function LinkedHashMapImplementation() { |
| 1264 // Initializers done | 1320 // Initializers done |
| 1265 this._map = new HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$
V(); | 1321 this._map = new HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$
V(); |
| 1266 this._list = new DoubleLinkedQueue$KeyValuePair$K$V(); | 1322 this._list = new DoubleLinkedQueue$KeyValuePair$K$V(); |
| 1267 } | 1323 } |
| 1324 LinkedHashMapImplementation.prototype.is$Map = function(){return this;}; |
| 1268 LinkedHashMapImplementation.prototype.$setindex = function(key, value) { | 1325 LinkedHashMapImplementation.prototype.$setindex = function(key, value) { |
| 1269 if (this._map.containsKey(key)) { | 1326 if ($notnull_bool(this._map.containsKey(key))) { |
| 1270 this._map.$index(key).get$element().value = value; | 1327 this._map.$index(key).get$element().value = value; |
| 1271 } | 1328 } |
| 1272 else { | 1329 else { |
| 1273 this._list.addLast(new KeyValuePair$K$V(key, value)); | 1330 this._list.addLast(new KeyValuePair$K$V(key, value)); |
| 1274 this._map.$setindex(key, this._list.lastEntry()); | 1331 this._map.$setindex(key, this._list.lastEntry()); |
| 1275 } | 1332 } |
| 1276 } | 1333 } |
| 1277 LinkedHashMapImplementation.prototype.$index = function(key) { | 1334 LinkedHashMapImplementation.prototype.$index = function(key) { |
| 1278 var entry = this._map.$index(key); | 1335 var entry = this._map.$index(key); |
| 1279 if (entry == null) return null; | 1336 if ($notnull_bool(entry == null)) return null; |
| 1280 return entry.get$element().get$value(); | 1337 return entry.get$element().get$value(); |
| 1281 } | 1338 } |
| 1282 LinkedHashMapImplementation.prototype.getKeys = function() { | 1339 LinkedHashMapImplementation.prototype.getKeys = function() { |
| 1283 var list = new ListFactory$K(this.get$length()); | 1340 var list = new ListFactory$K(this.get$length()); |
| 1284 var index = 0; | 1341 var index = 0; |
| 1285 this._list.forEach(function _(entry) { | 1342 this._list.forEach(function _(entry) { |
| 1286 list.$setindex(index++, entry.key); | 1343 list.$setindex(index++, entry.key); |
| 1287 } | 1344 } |
| 1288 ); | 1345 ); |
| 1346 $assert(index == this.get$length(), "index == length", "/Volumes/Data/dart/dar
t/corelib/src/implementation/linked_hash_map.dart", 75, 12); |
| 1289 return list; | 1347 return list; |
| 1290 } | 1348 } |
| 1291 LinkedHashMapImplementation.prototype.getValues = function() { | 1349 LinkedHashMapImplementation.prototype.getValues = function() { |
| 1292 var list = new ListFactory$V(this.get$length()); | 1350 var list = new ListFactory$V(this.get$length()); |
| 1293 var index = 0; | 1351 var index = 0; |
| 1294 this._list.forEach(function _(entry) { | 1352 this._list.forEach(function _(entry) { |
| 1295 list.$setindex(index++, entry.value); | 1353 list.$setindex(index++, entry.value); |
| 1296 } | 1354 } |
| 1297 ); | 1355 ); |
| 1356 $assert(index == this.get$length(), "index == length", "/Volumes/Data/dart/dar
t/corelib/src/implementation/linked_hash_map.dart", 86, 12); |
| 1298 return list; | 1357 return list; |
| 1299 } | 1358 } |
| 1300 LinkedHashMapImplementation.prototype.forEach = function(f) { | 1359 LinkedHashMapImplementation.prototype.forEach = function(f) { |
| 1301 this._list.forEach(function _(entry) { | 1360 this._list.forEach(function _(entry) { |
| 1302 f(entry.key, entry.value); | 1361 f(entry.key, entry.value); |
| 1303 } | 1362 } |
| 1304 ); | 1363 ); |
| 1305 } | 1364 } |
| 1306 LinkedHashMapImplementation.prototype.containsKey = function(key) { | 1365 LinkedHashMapImplementation.prototype.containsKey = function(key) { |
| 1307 return this._map.containsKey(key); | 1366 return this._map.containsKey(key); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1320 this._list.clear(); | 1379 this._list.clear(); |
| 1321 } | 1380 } |
| 1322 LinkedHashMapImplementation.prototype.forEach$1 = LinkedHashMapImplementation.pr
ototype.forEach; | 1381 LinkedHashMapImplementation.prototype.forEach$1 = LinkedHashMapImplementation.pr
ototype.forEach; |
| 1323 // ********** Code for LinkedHashMapImplementation$String$Keyword ************** | 1382 // ********** Code for LinkedHashMapImplementation$String$Keyword ************** |
| 1324 function LinkedHashMapImplementation$String$Keyword() { | 1383 function LinkedHashMapImplementation$String$Keyword() { |
| 1325 // Initializers done | 1384 // Initializers done |
| 1326 this._map = new HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePa
ir$String$Keyword(); | 1385 this._map = new HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePa
ir$String$Keyword(); |
| 1327 this._list = new DoubleLinkedQueue$KeyValuePair$String$Keyword(); | 1386 this._list = new DoubleLinkedQueue$KeyValuePair$String$Keyword(); |
| 1328 } | 1387 } |
| 1329 $inherits(LinkedHashMapImplementation$String$Keyword, LinkedHashMapImplementatio
n); | 1388 $inherits(LinkedHashMapImplementation$String$Keyword, LinkedHashMapImplementatio
n); |
| 1389 LinkedHashMapImplementation$String$Keyword.prototype.is$Map = function(){return
this;}; |
| 1330 // ********** Code for DoubleLinkedQueueEntry ************** | 1390 // ********** Code for DoubleLinkedQueueEntry ************** |
| 1331 function DoubleLinkedQueueEntry(e) { | 1391 function DoubleLinkedQueueEntry(e) { |
| 1332 // Initializers done | 1392 // Initializers done |
| 1333 this._element = e; | 1393 this._element = e; |
| 1334 } | 1394 } |
| 1335 DoubleLinkedQueueEntry.prototype._link = function(p, n) { | 1395 DoubleLinkedQueueEntry.prototype._link = function(p, n) { |
| 1336 this._next = n; | 1396 this._next = n; |
| 1337 this._previous = p; | 1397 this._previous = p; |
| 1338 p._next = this; | 1398 p._next = this; |
| 1339 n._previous = this; | 1399 n._previous = this; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 this._next = n; | 1522 this._next = n; |
| 1463 this._previous = p; | 1523 this._previous = p; |
| 1464 p._next = this; | 1524 p._next = this; |
| 1465 n._previous = this; | 1525 n._previous = this; |
| 1466 } | 1526 } |
| 1467 // ********** Code for DoubleLinkedQueue ************** | 1527 // ********** Code for DoubleLinkedQueue ************** |
| 1468 function DoubleLinkedQueue() { | 1528 function DoubleLinkedQueue() { |
| 1469 // Initializers done | 1529 // Initializers done |
| 1470 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); | 1530 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); |
| 1471 } | 1531 } |
| 1532 DoubleLinkedQueue.prototype.is$Iterable = function(){return this;}; |
| 1472 DoubleLinkedQueue.DoubleLinkedQueue$from$factory = function(other) { | 1533 DoubleLinkedQueue.DoubleLinkedQueue$from$factory = function(other) { |
| 1534 var $0; |
| 1473 var list = new DoubleLinkedQueue(); | 1535 var list = new DoubleLinkedQueue(); |
| 1474 for (var $i = other.iterator(); $i.hasNext(); ) { | 1536 for (var $i = other.iterator(); $i.hasNext(); ) { |
| 1475 var e = $i.next(); | 1537 var e = $i.next(); |
| 1476 list.addLast(e); | 1538 list.addLast(e); |
| 1477 } | 1539 } |
| 1478 return list; | 1540 return list; |
| 1479 } | 1541 } |
| 1480 DoubleLinkedQueue.prototype.addLast = function(value) { | 1542 DoubleLinkedQueue.prototype.addLast = function(value) { |
| 1481 this._sentinel.prepend(value); | 1543 this._sentinel.prepend(value); |
| 1482 } | 1544 } |
| 1483 DoubleLinkedQueue.prototype.add = function(value) { | 1545 DoubleLinkedQueue.prototype.add = function(value) { |
| 1484 this.addLast(value); | 1546 this.addLast(value); |
| 1485 } | 1547 } |
| 1486 DoubleLinkedQueue.prototype.addAll = function(collection) { | 1548 DoubleLinkedQueue.prototype.addAll = function(collection) { |
| 1549 var $0; |
| 1487 for (var $i = collection.iterator(); $i.hasNext(); ) { | 1550 for (var $i = collection.iterator(); $i.hasNext(); ) { |
| 1488 var e = $i.next(); | 1551 var e = $i.next(); |
| 1489 this.add(e); | 1552 this.add(e); |
| 1490 } | 1553 } |
| 1491 } | 1554 } |
| 1492 DoubleLinkedQueue.prototype.removeLast = function() { | 1555 DoubleLinkedQueue.prototype.removeLast = function() { |
| 1493 return this._sentinel._previous.remove(); | 1556 return this._sentinel._previous.remove(); |
| 1494 } | 1557 } |
| 1495 DoubleLinkedQueue.prototype.last = function() { | 1558 DoubleLinkedQueue.prototype.last = function() { |
| 1496 return this._sentinel._previous.get$element(); | 1559 return this._sentinel._previous.get$element(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1511 }); | 1574 }); |
| 1512 DoubleLinkedQueue.prototype.isEmpty = function() { | 1575 DoubleLinkedQueue.prototype.isEmpty = function() { |
| 1513 return (this._sentinel._next === this._sentinel); | 1576 return (this._sentinel._next === this._sentinel); |
| 1514 } | 1577 } |
| 1515 DoubleLinkedQueue.prototype.clear = function() { | 1578 DoubleLinkedQueue.prototype.clear = function() { |
| 1516 this._sentinel._next = this._sentinel; | 1579 this._sentinel._next = this._sentinel; |
| 1517 this._sentinel._previous = this._sentinel; | 1580 this._sentinel._previous = this._sentinel; |
| 1518 } | 1581 } |
| 1519 DoubleLinkedQueue.prototype.forEach = function(f) { | 1582 DoubleLinkedQueue.prototype.forEach = function(f) { |
| 1520 var entry = this._sentinel._next; | 1583 var entry = this._sentinel._next; |
| 1521 while (entry !== this._sentinel) { | 1584 while ($notnull_bool(entry !== this._sentinel)) { |
| 1522 f(entry._element); | 1585 f(entry._element); |
| 1523 entry = entry._next; | 1586 entry = entry._next; |
| 1524 } | 1587 } |
| 1525 } | 1588 } |
| 1526 DoubleLinkedQueue.prototype.some = function(f) { | 1589 DoubleLinkedQueue.prototype.some = function(f) { |
| 1527 var entry = this._sentinel._next; | 1590 var entry = this._sentinel._next; |
| 1528 while (entry !== this._sentinel) { | 1591 while ($notnull_bool(entry !== this._sentinel)) { |
| 1529 if (f(entry._element)) return true; | 1592 if ($notnull_bool(f(entry._element))) return true; |
| 1530 entry = entry._next; | 1593 entry = entry._next; |
| 1531 } | 1594 } |
| 1532 return false; | 1595 return false; |
| 1533 } | 1596 } |
| 1534 DoubleLinkedQueue.prototype.filter = function(f) { | 1597 DoubleLinkedQueue.prototype.filter = function(f) { |
| 1535 var other = new DoubleLinkedQueue$E(); | 1598 var other = new DoubleLinkedQueue$E(); |
| 1536 var entry = this._sentinel._next; | 1599 var entry = this._sentinel._next; |
| 1537 while (entry !== this._sentinel) { | 1600 while ($notnull_bool(entry !== this._sentinel)) { |
| 1538 if (f(entry._element)) other.addLast(entry._element); | 1601 if ($notnull_bool(f(entry._element))) other.addLast(entry._element); |
| 1539 entry = entry._next; | 1602 entry = entry._next; |
| 1540 } | 1603 } |
| 1541 return other; | 1604 return other; |
| 1542 } | 1605 } |
| 1543 DoubleLinkedQueue.prototype.iterator = function() { | 1606 DoubleLinkedQueue.prototype.iterator = function() { |
| 1544 return new _DoubleLinkedQueueIterator$E(this._sentinel); | 1607 return new _DoubleLinkedQueueIterator$E(this._sentinel); |
| 1545 } | 1608 } |
| 1546 DoubleLinkedQueue.prototype.forEach$1 = DoubleLinkedQueue.prototype.forEach; | 1609 DoubleLinkedQueue.prototype.forEach$1 = DoubleLinkedQueue.prototype.forEach; |
| 1547 // ********** Code for DoubleLinkedQueue$E ************** | 1610 // ********** Code for DoubleLinkedQueue$E ************** |
| 1548 function DoubleLinkedQueue$E() { | 1611 function DoubleLinkedQueue$E() { |
| 1549 // Initializers done | 1612 // Initializers done |
| 1550 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); | 1613 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); |
| 1551 } | 1614 } |
| 1552 $inherits(DoubleLinkedQueue$E, DoubleLinkedQueue); | 1615 $inherits(DoubleLinkedQueue$E, DoubleLinkedQueue); |
| 1616 DoubleLinkedQueue$E.prototype.is$Iterable = function(){return this;}; |
| 1553 // ********** Code for DoubleLinkedQueue$KeyValuePair$K$V ************** | 1617 // ********** Code for DoubleLinkedQueue$KeyValuePair$K$V ************** |
| 1554 function DoubleLinkedQueue$KeyValuePair$K$V() { | 1618 function DoubleLinkedQueue$KeyValuePair$K$V() { |
| 1555 // Initializers done | 1619 // Initializers done |
| 1556 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V(); | 1620 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V(); |
| 1557 } | 1621 } |
| 1558 $inherits(DoubleLinkedQueue$KeyValuePair$K$V, DoubleLinkedQueue); | 1622 $inherits(DoubleLinkedQueue$KeyValuePair$K$V, DoubleLinkedQueue); |
| 1623 DoubleLinkedQueue$KeyValuePair$K$V.prototype.is$Iterable = function(){return thi
s;}; |
| 1559 DoubleLinkedQueue$KeyValuePair$K$V.prototype.addLast = function(value) { | 1624 DoubleLinkedQueue$KeyValuePair$K$V.prototype.addLast = function(value) { |
| 1560 this._sentinel.prepend(value); | 1625 this._sentinel.prepend(value); |
| 1561 } | 1626 } |
| 1562 DoubleLinkedQueue$KeyValuePair$K$V.prototype.lastEntry = function() { | 1627 DoubleLinkedQueue$KeyValuePair$K$V.prototype.lastEntry = function() { |
| 1563 return this._sentinel.previousEntry(); | 1628 return this._sentinel.previousEntry(); |
| 1564 } | 1629 } |
| 1565 DoubleLinkedQueue$KeyValuePair$K$V.prototype.clear = function() { | 1630 DoubleLinkedQueue$KeyValuePair$K$V.prototype.clear = function() { |
| 1566 this._sentinel._next = this._sentinel; | 1631 this._sentinel._next = this._sentinel; |
| 1567 this._sentinel._previous = this._sentinel; | 1632 this._sentinel._previous = this._sentinel; |
| 1568 } | 1633 } |
| 1569 DoubleLinkedQueue$KeyValuePair$K$V.prototype.forEach = function(f) { | 1634 DoubleLinkedQueue$KeyValuePair$K$V.prototype.forEach = function(f) { |
| 1570 var entry = this._sentinel._next; | 1635 var entry = this._sentinel._next; |
| 1571 while (entry !== this._sentinel) { | 1636 while ($notnull_bool(entry !== this._sentinel)) { |
| 1572 f(entry._element); | 1637 f(entry._element); |
| 1573 entry = entry._next; | 1638 entry = entry._next; |
| 1574 } | 1639 } |
| 1575 } | 1640 } |
| 1576 // ********** Code for DoubleLinkedQueue$KeyValuePair$String$Keyword ***********
*** | 1641 // ********** Code for DoubleLinkedQueue$KeyValuePair$String$Keyword ***********
*** |
| 1577 function DoubleLinkedQueue$KeyValuePair$String$Keyword() { | 1642 function DoubleLinkedQueue$KeyValuePair$String$Keyword() { |
| 1578 // Initializers done | 1643 // Initializers done |
| 1579 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$String$Keywo
rd(); | 1644 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$String$Keywo
rd(); |
| 1580 } | 1645 } |
| 1581 $inherits(DoubleLinkedQueue$KeyValuePair$String$Keyword, DoubleLinkedQueue); | 1646 $inherits(DoubleLinkedQueue$KeyValuePair$String$Keyword, DoubleLinkedQueue); |
| 1647 DoubleLinkedQueue$KeyValuePair$String$Keyword.prototype.is$Iterable = function()
{return this;}; |
| 1582 // ********** Code for DoubleLinkedQueue$SourceString ************** | 1648 // ********** Code for DoubleLinkedQueue$SourceString ************** |
| 1583 function DoubleLinkedQueue$SourceString() {} | 1649 function DoubleLinkedQueue$SourceString() {} |
| 1584 $inherits(DoubleLinkedQueue$SourceString, DoubleLinkedQueue); | 1650 $inherits(DoubleLinkedQueue$SourceString, DoubleLinkedQueue); |
| 1651 DoubleLinkedQueue$SourceString.prototype.is$Iterable = function(){return this;}; |
| 1585 DoubleLinkedQueue$SourceString.DoubleLinkedQueue$from$factory = function(other)
{ | 1652 DoubleLinkedQueue$SourceString.DoubleLinkedQueue$from$factory = function(other)
{ |
| 1653 var $0; |
| 1586 var list = new DoubleLinkedQueue(); | 1654 var list = new DoubleLinkedQueue(); |
| 1587 for (var $i = other.iterator(); $i.hasNext(); ) { | 1655 for (var $i = other.iterator(); $i.hasNext(); ) { |
| 1588 var e = $i.next(); | 1656 var e = $i.next(); |
| 1589 list.addLast(e); | 1657 list.addLast(e); |
| 1590 } | 1658 } |
| 1591 return list; | 1659 return list; |
| 1592 } | 1660 } |
| 1593 // ********** Code for _DoubleLinkedQueueIterator ************** | 1661 // ********** Code for _DoubleLinkedQueueIterator ************** |
| 1594 function _DoubleLinkedQueueIterator(_sentinel) { | 1662 function _DoubleLinkedQueueIterator(_sentinel) { |
| 1595 this._sentinel = _sentinel; | 1663 this._sentinel = _sentinel; |
| 1596 // Initializers done | 1664 // Initializers done |
| 1597 this._currentEntry = this._sentinel; | 1665 this._currentEntry = this._sentinel; |
| 1598 } | 1666 } |
| 1599 _DoubleLinkedQueueIterator.prototype.hasNext = function() { | 1667 _DoubleLinkedQueueIterator.prototype.hasNext = function() { |
| 1600 return this._currentEntry._next !== this._sentinel; | 1668 return this._currentEntry._next !== this._sentinel; |
| 1601 } | 1669 } |
| 1602 _DoubleLinkedQueueIterator.prototype.next = function() { | 1670 _DoubleLinkedQueueIterator.prototype.next = function() { |
| 1603 if (!this.hasNext()) { | 1671 if ($notnull_bool(!this.hasNext())) { |
| 1604 $throw(const$4/*const NoMoreElementsException()*/); | 1672 $throw(const$0/*const NoMoreElementsException()*/); |
| 1605 } | 1673 } |
| 1606 this._currentEntry = this._currentEntry._next; | 1674 this._currentEntry = this._currentEntry._next; |
| 1607 return this._currentEntry.get$element(); | 1675 return this._currentEntry.get$element(); |
| 1608 } | 1676 } |
| 1609 // ********** Code for _DoubleLinkedQueueIterator$E ************** | 1677 // ********** Code for _DoubleLinkedQueueIterator$E ************** |
| 1610 function _DoubleLinkedQueueIterator$E(_sentinel) { | 1678 function _DoubleLinkedQueueIterator$E(_sentinel) { |
| 1611 this._sentinel = _sentinel; | 1679 this._sentinel = _sentinel; |
| 1612 // Initializers done | 1680 // Initializers done |
| 1613 this._currentEntry = this._sentinel; | 1681 this._currentEntry = this._sentinel; |
| 1614 } | 1682 } |
| 1615 $inherits(_DoubleLinkedQueueIterator$E, _DoubleLinkedQueueIterator); | 1683 $inherits(_DoubleLinkedQueueIterator$E, _DoubleLinkedQueueIterator); |
| 1616 // ********** Code for StopWatchImplementation ************** | 1684 // ********** Code for StopWatchImplementation ************** |
| 1617 function StopWatchImplementation() { | 1685 function StopWatchImplementation() { |
| 1618 this._start = null; | 1686 this._start = null; |
| 1619 this._stop = null; | 1687 this._stop = null; |
| 1620 // Initializers done | 1688 // Initializers done |
| 1621 } | 1689 } |
| 1622 StopWatchImplementation.prototype.start = function() { | 1690 StopWatchImplementation.prototype.start = function() { |
| 1623 if (this._start == null) { | 1691 if ($notnull_bool(this._start == null)) { |
| 1624 this._start = Clock.now(); | 1692 this._start = Clock.now(); |
| 1625 } | 1693 } |
| 1626 else { | 1694 else { |
| 1627 if (this._stop == null) { | 1695 if ($notnull_bool(this._stop == null)) { |
| 1628 return; | 1696 return; |
| 1629 } | 1697 } |
| 1630 this._start = Clock.now() - (this._stop - this._start); | 1698 this._start = Clock.now() - (this._stop - this._start); |
| 1631 } | 1699 } |
| 1632 } | 1700 } |
| 1633 StopWatchImplementation.prototype.stop = function() { | 1701 StopWatchImplementation.prototype.stop = function() { |
| 1634 if (this._start == null) { | 1702 if ($notnull_bool(this._start == null)) { |
| 1635 return; | 1703 return; |
| 1636 } | 1704 } |
| 1637 this._stop = Clock.now(); | 1705 this._stop = Clock.now(); |
| 1638 } | 1706 } |
| 1639 StopWatchImplementation.prototype.elapsed = function() { | 1707 StopWatchImplementation.prototype.elapsed = function() { |
| 1640 if (this._start == null) { | 1708 if ($notnull_bool(this._start == null)) { |
| 1641 return 0; | 1709 return 0; |
| 1642 } | 1710 } |
| 1643 return (this._stop == null) ? (Clock.now() - this._start) : (this._stop - this
._start); | 1711 return $notnull_bool((this._stop == null)) ? (Clock.now() - this._start) : (th
is._stop - this._start); |
| 1644 } | 1712 } |
| 1645 StopWatchImplementation.prototype.elapsedInMs = function() { | 1713 StopWatchImplementation.prototype.elapsedInMs = function() { |
| 1646 return $truncdiv((this.elapsed() * 1000), this.frequency()); | 1714 return $truncdiv((this.elapsed() * 1000), this.frequency()); |
| 1647 } | 1715 } |
| 1648 StopWatchImplementation.prototype.frequency = function() { | 1716 StopWatchImplementation.prototype.frequency = function() { |
| 1649 return Clock.frequency(); | 1717 return Clock.frequency(); |
| 1650 } | 1718 } |
| 1651 // ********** Code for StringBufferImpl ************** | 1719 // ********** Code for StringBufferImpl ************** |
| 1652 function StringBufferImpl(content) { | 1720 function StringBufferImpl(content) { |
| 1653 // Initializers done | 1721 // Initializers done |
| 1654 this.clear(); | 1722 this.clear(); |
| 1655 this.add(content); | 1723 this.add(content); |
| 1656 } | 1724 } |
| 1725 StringBufferImpl.prototype.is$StringBuffer = function(){return this;}; |
| 1657 StringBufferImpl.prototype.get$length = function() { | 1726 StringBufferImpl.prototype.get$length = function() { |
| 1658 return this._length; | 1727 return this._length; |
| 1659 } | 1728 } |
| 1660 Object.defineProperty(StringBufferImpl.prototype, "length", { | 1729 Object.defineProperty(StringBufferImpl.prototype, "length", { |
| 1661 get: StringBufferImpl.prototype.get$length, | 1730 get: StringBufferImpl.prototype.get$length, |
| 1662 }); | 1731 }); |
| 1663 StringBufferImpl.prototype.isEmpty = function() { | 1732 StringBufferImpl.prototype.isEmpty = function() { |
| 1664 return this._length == 0; | 1733 return this._length == 0; |
| 1665 } | 1734 } |
| 1666 StringBufferImpl.prototype.add = function(obj) { | 1735 StringBufferImpl.prototype.add = function(obj) { |
| 1667 var str = obj.toString(); | 1736 var str = obj.toString(); |
| 1668 if (str == null || str.isEmpty()) return this; | 1737 if ($notnull_bool(str == null || str.isEmpty())) return this; |
| 1669 this._buffer.add(str); | 1738 this._buffer.add(str); |
| 1670 this._length += str.length; | 1739 this._length += str.length; |
| 1671 return this; | 1740 return this; |
| 1672 } | 1741 } |
| 1673 StringBufferImpl.prototype.addAll = function(objects) { | 1742 StringBufferImpl.prototype.addAll = function(objects) { |
| 1743 var $0; |
| 1674 for (var $i = objects.iterator(); $i.hasNext(); ) { | 1744 for (var $i = objects.iterator(); $i.hasNext(); ) { |
| 1675 var obj = $i.next(); | 1745 var obj = $i.next(); |
| 1676 this.add(obj); | 1746 this.add(obj); |
| 1677 } | 1747 } |
| 1678 return this; | 1748 return this; |
| 1679 } | 1749 } |
| 1680 StringBufferImpl.prototype.clear = function() { | 1750 StringBufferImpl.prototype.clear = function() { |
| 1681 this._buffer = new ListFactory$String(); | 1751 this._buffer = new ListFactory$String(); |
| 1682 this._length = 0; | 1752 this._length = 0; |
| 1683 return this; | 1753 return this; |
| 1684 } | 1754 } |
| 1685 StringBufferImpl.prototype.toString = function() { | 1755 StringBufferImpl.prototype.toString = function() { |
| 1686 if (this._buffer.length == 0) return ""; | 1756 if ($notnull_bool(this._buffer.length == 0)) return ""; |
| 1687 if (this._buffer.length == 1) return this._buffer.$index(0); | 1757 if ($notnull_bool(this._buffer.length == 1)) return this._buffer.$index(0); |
| 1688 var result = StringBase.concatAll(this._buffer); | 1758 var result = StringBase.concatAll(this._buffer); |
| 1689 this._buffer.clear(); | 1759 this._buffer.clear(); |
| 1690 this._buffer.add(result); | 1760 this._buffer.add(result); |
| 1691 return result; | 1761 return result; |
| 1692 } | 1762 } |
| 1693 // ********** Code for StringBase ************** | 1763 // ********** Code for StringBase ************** |
| 1694 function StringBase() {} | 1764 function StringBase() {} |
| 1695 StringBase.createFromCharCodes = function(charCodes) { | 1765 StringBase.createFromCharCodes = function(charCodes) { |
| 1696 if (Object.getPrototypeOf(charCodes) !== Array.prototype) { | 1766 if (Object.getPrototypeOf(charCodes) !== Array.prototype) { |
| 1697 var length = charCodes.length; | 1767 var length = charCodes.length; |
| 1698 var tmp = new Array(length); | 1768 var tmp = new Array(length); |
| 1699 for (var i = 0; i < length; i++) { | 1769 for (var i = 0; i < length; i++) { |
| 1700 tmp[i] = charCodes.$index(i); | 1770 tmp[i] = charCodes.$index(i); |
| 1701 } | 1771 } |
| 1702 charCodes = tmp; | 1772 charCodes = tmp; |
| 1703 } | 1773 } |
| 1704 return String.fromCharCode.apply(null, charCodes); | 1774 return String.fromCharCode.apply(null, charCodes); |
| 1705 } | 1775 } |
| 1706 StringBase.join = function(strings, separator) { | 1776 StringBase.join = function(strings, separator) { |
| 1707 if (strings.length == 0) return ''; | 1777 if ($notnull_bool(strings.length == 0)) return ''; |
| 1708 var s = strings.$index(0); | 1778 var s = strings.$index(0); |
| 1709 for (var i = 1; | 1779 for (var i = 1; |
| 1710 i < strings.length; i++) { | 1780 $notnull_bool(i < strings.length); i++) { |
| 1711 s = s + separator + strings.$index(i); | 1781 s = s + separator + strings.$index(i); |
| 1712 } | 1782 } |
| 1713 return s; | 1783 return s; |
| 1714 } | 1784 } |
| 1715 StringBase.concatAll = function(strings) { | 1785 StringBase.concatAll = function(strings) { |
| 1716 return StringBase.join(strings, ""); | 1786 return StringBase.join(strings, ""); |
| 1717 } | 1787 } |
| 1718 // ********** Code for StringImplementation ************** | 1788 // ********** Code for StringImplementation ************** |
| 1719 StringImplementation = String; | 1789 StringImplementation = String; |
| 1720 StringImplementation.prototype.endsWith = function(other) { | 1790 StringImplementation.prototype.endsWith = function(other) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 this.hash_ = this.hash_ & ((1 << 29) - 1); | 1823 this.hash_ = this.hash_ & ((1 << 29) - 1); |
| 1754 } | 1824 } |
| 1755 return this.hash_; | 1825 return this.hash_; |
| 1756 } | 1826 } |
| 1757 StringImplementation.prototype.compareTo = function(other) { | 1827 StringImplementation.prototype.compareTo = function(other) { |
| 1758 return this == other ? 0 : this < other ? -1 : 1; | 1828 return this == other ? 0 : this < other ? -1 : 1; |
| 1759 } | 1829 } |
| 1760 // ********** Code for Collections ************** | 1830 // ********** Code for Collections ************** |
| 1761 function Collections() {} | 1831 function Collections() {} |
| 1762 Collections.forEach = function(iterable, f) { | 1832 Collections.forEach = function(iterable, f) { |
| 1833 var $0; |
| 1763 for (var $i = iterable.iterator(); $i.hasNext(); ) { | 1834 for (var $i = iterable.iterator(); $i.hasNext(); ) { |
| 1764 var e = $i.next(); | 1835 var e = $i.next(); |
| 1765 f(e); | 1836 f(e); |
| 1766 } | 1837 } |
| 1767 } | 1838 } |
| 1768 Collections.some = function(iterable, f) { | 1839 Collections.some = function(iterable, f) { |
| 1840 var $0; |
| 1769 for (var $i = iterable.iterator(); $i.hasNext(); ) { | 1841 for (var $i = iterable.iterator(); $i.hasNext(); ) { |
| 1770 var e = $i.next(); | 1842 var e = $i.next(); |
| 1771 if (f(e)) return true; | 1843 if ($notnull_bool(f(e))) return true; |
| 1772 } | 1844 } |
| 1773 return false; | 1845 return false; |
| 1774 } | 1846 } |
| 1775 Collections.filter = function(source, destination, f) { | 1847 Collections.filter = function(source, destination, f) { |
| 1848 var $0; |
| 1776 for (var $i = source.iterator(); $i.hasNext(); ) { | 1849 for (var $i = source.iterator(); $i.hasNext(); ) { |
| 1777 var e = $i.next(); | 1850 var e = $i.next(); |
| 1778 if (f(e)) destination.add(e); | 1851 if ($notnull_bool(f(e))) destination.add(e); |
| 1779 } | 1852 } |
| 1780 return destination; | 1853 return destination; |
| 1781 } | 1854 } |
| 1782 // ********** Code for DateImplementation ************** | 1855 // ********** Code for DateImplementation ************** |
| 1783 function DateImplementation() {} | 1856 function DateImplementation() {} |
| 1784 DateImplementation.fromEpoch$ctor = function(value, timeZone) { | 1857 DateImplementation.fromEpoch$ctor = function(value, timeZone) { |
| 1785 this.value = value; | 1858 this.value = value; |
| 1786 this.timeZone = timeZone; | 1859 this.timeZone = timeZone; |
| 1787 // Initializers done | 1860 // Initializers done |
| 1788 } | 1861 } |
| 1789 DateImplementation.fromEpoch$ctor.prototype = DateImplementation.prototype; | 1862 DateImplementation.fromEpoch$ctor.prototype = DateImplementation.prototype; |
| 1790 DateImplementation.now$ctor = function() { | 1863 DateImplementation.now$ctor = function() { |
| 1791 this.timeZone = new TimeZoneImplementation.local$ctor(); | 1864 this.timeZone = new TimeZoneImplementation.local$ctor(); |
| 1792 this.value = DateImplementation._now(); | 1865 this.value = DateImplementation._now(); |
| 1793 // Initializers done | 1866 // Initializers done |
| 1794 this._asJs(); | 1867 this._asJs(); |
| 1795 } | 1868 } |
| 1796 DateImplementation.now$ctor.prototype = DateImplementation.prototype; | 1869 DateImplementation.now$ctor.prototype = DateImplementation.prototype; |
| 1797 DateImplementation.prototype.get$value = function() { return this.value; }; | 1870 DateImplementation.prototype.get$value = function() { return this.value; }; |
| 1798 DateImplementation.prototype.$eq = function(other) { | 1871 DateImplementation.prototype.$eq = function(other) { |
| 1799 if (!((other instanceof DateImplementation))) return false; | 1872 if ($notnull_bool(!((other instanceof DateImplementation)))) return false; |
| 1800 return (this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone
)); | 1873 return (this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone
)); |
| 1801 } | 1874 } |
| 1802 DateImplementation.prototype.compareTo = function(other) { | 1875 DateImplementation.prototype.compareTo = function(other) { |
| 1803 return this.value.compareTo(other.value); | 1876 return this.value.compareTo(other.value); |
| 1804 } | 1877 } |
| 1805 DateImplementation.prototype.get$year = function() { | 1878 DateImplementation.prototype.get$year = function() { |
| 1806 return this.isUtc ? this._asJs().getUTCFullYear() : | 1879 return this.isUtc ? this._asJs().getUTCFullYear() : |
| 1807 this._asJs().getFullYear(); | 1880 this._asJs().getFullYear(); |
| 1808 } | 1881 } |
| 1809 DateImplementation.prototype.get$month = function() { | 1882 DateImplementation.prototype.get$month = function() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1821 } | 1894 } |
| 1822 DateImplementation.prototype.get$seconds = function() { | 1895 DateImplementation.prototype.get$seconds = function() { |
| 1823 return this.isUtc ? this._asJs().getUTCSeconds() : this._asJs().getSeconds() | 1896 return this.isUtc ? this._asJs().getUTCSeconds() : this._asJs().getSeconds() |
| 1824 } | 1897 } |
| 1825 DateImplementation.prototype.get$milliseconds = function() { | 1898 DateImplementation.prototype.get$milliseconds = function() { |
| 1826 return this.isUtc ? this._asJs().getUTCMilliseconds() : | 1899 return this.isUtc ? this._asJs().getUTCMilliseconds() : |
| 1827 this._asJs().getMilliseconds(); | 1900 this._asJs().getMilliseconds(); |
| 1828 } | 1901 } |
| 1829 DateImplementation.prototype.toString = function() { | 1902 DateImplementation.prototype.toString = function() { |
| 1830 function threeDigits(n) { | 1903 function threeDigits(n) { |
| 1831 if (n >= 100) return ("" + n + ""); | 1904 if ($notnull_bool(n >= 100)) return ("" + n + ""); |
| 1832 if (n > 10) return ("0" + n + ""); | 1905 if ($notnull_bool(n > 10)) return ("0" + n + ""); |
| 1833 return ("00" + n + ""); | 1906 return ("00" + n + ""); |
| 1834 } | 1907 } |
| 1835 function twoDigits(n) { | 1908 function twoDigits(n) { |
| 1836 if (n >= 10) return ("" + n + ""); | 1909 if ($notnull_bool(n >= 10)) return ("" + n + ""); |
| 1837 return ("0" + n + ""); | 1910 return ("0" + n + ""); |
| 1838 } | 1911 } |
| 1839 var m = twoDigits(this.get$month()); | 1912 var m = twoDigits(this.get$month()); |
| 1840 var d = twoDigits(this.get$day()); | 1913 var d = twoDigits(this.get$day()); |
| 1841 var h = twoDigits(this.get$hours()); | 1914 var h = twoDigits(this.get$hours()); |
| 1842 var min = twoDigits(this.get$minutes()); | 1915 var min = twoDigits(this.get$minutes()); |
| 1843 var sec = twoDigits(this.get$seconds()); | 1916 var sec = twoDigits(this.get$seconds()); |
| 1844 var ms = threeDigits(this.get$milliseconds()); | 1917 var ms = threeDigits(this.get$milliseconds()); |
| 1845 if (this.timeZone.isUtc) { | 1918 if ($notnull_bool(this.timeZone.isUtc)) { |
| 1846 return ("" + this.get$year() + "-" + m + "-" + d + " " + h + ":" + min + ":"
+ sec + "." + ms + "Z"); | 1919 return ("" + this.get$year() + "-" + m + "-" + d + " " + h + ":" + min + ":"
+ sec + "." + ms + "Z"); |
| 1847 } | 1920 } |
| 1848 else { | 1921 else { |
| 1849 return ("" + this.get$year() + "-" + m + "-" + d + " " + h + ":" + min + ":"
+ sec + "." + ms + ""); | 1922 return ("" + this.get$year() + "-" + m + "-" + d + " " + h + ":" + min + ":"
+ sec + "." + ms + ""); |
| 1850 } | 1923 } |
| 1851 } | 1924 } |
| 1852 DateImplementation.prototype.add = function(duration) { | 1925 DateImplementation.prototype.add = function(duration) { |
| 1853 return new DateImplementation.fromEpoch$ctor(this.value + duration.inMilliseco
nds, this.timeZone); | 1926 return new DateImplementation.fromEpoch$ctor(this.value + duration.inMilliseco
nds, this.timeZone); |
| 1854 } | 1927 } |
| 1855 DateImplementation._now = function() { | 1928 DateImplementation._now = function() { |
| 1856 return new Date().valueOf(); | 1929 return new Date().valueOf(); |
| 1857 } | 1930 } |
| 1858 DateImplementation.prototype._asJs = function() { | 1931 DateImplementation.prototype._asJs = function() { |
| 1859 if (!this.date) { | 1932 if (!this.date) { |
| 1860 this.date = new Date(this.value); | 1933 this.date = new Date(this.value); |
| 1861 } | 1934 } |
| 1862 return this.date; | 1935 return this.date; |
| 1863 } | 1936 } |
| 1864 // ********** Code for TimeZoneImplementation ************** | 1937 // ********** Code for TimeZoneImplementation ************** |
| 1865 function TimeZoneImplementation() {} | 1938 function TimeZoneImplementation() {} |
| 1866 TimeZoneImplementation.local$ctor = function() { | 1939 TimeZoneImplementation.local$ctor = function() { |
| 1867 this.isUtc = false; | 1940 this.isUtc = false; |
| 1868 // Initializers done | 1941 // Initializers done |
| 1869 } | 1942 } |
| 1870 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype; | 1943 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype; |
| 1871 TimeZoneImplementation.prototype.$eq = function(other) { | 1944 TimeZoneImplementation.prototype.$eq = function(other) { |
| 1872 if (!((other instanceof TimeZoneImplementation))) return false; | 1945 if ($notnull_bool(!((other instanceof TimeZoneImplementation)))) return false; |
| 1873 return $eq(this.isUtc, other.isUtc); | 1946 return $eq(this.isUtc, other.isUtc); |
| 1874 } | 1947 } |
| 1875 TimeZoneImplementation.prototype.toString = function() { | 1948 TimeZoneImplementation.prototype.toString = function() { |
| 1876 if (this.isUtc) return "TimeZone (UTC)"; | 1949 if ($notnull_bool(this.isUtc)) return "TimeZone (UTC)"; |
| 1877 return "TimeZone (Local)"; | 1950 return "TimeZone (Local)"; |
| 1878 } | 1951 } |
| 1879 // ********** Code for top level ************** | 1952 // ********** Code for top level ************** |
| 1880 function MatchImplementation(pattern, str, _start, _end, _groups) { | 1953 function MatchImplementation(pattern, str, _start, _end, _groups) { |
| 1881 this.pattern = pattern; | 1954 this.pattern = pattern; |
| 1882 this.str = str; | 1955 this.str = str; |
| 1883 this._start = _start; | 1956 this._start = _start; |
| 1884 this._end = _end; | 1957 this._end = _end; |
| 1885 this._groups = _groups; | 1958 this._groups = _groups; |
| 1886 // Initializers done | 1959 // Initializers done |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1915 function createSandbox() { | 1988 function createSandbox() { |
| 1916 return {'require': require, 'process': process, 'console': console}; | 1989 return {'require': require, 'process': process, 'console': console}; |
| 1917 } | 1990 } |
| 1918 // ********** Library file_system ************** | 1991 // ********** Library file_system ************** |
| 1919 // ********** Code for top level ************** | 1992 // ********** Code for top level ************** |
| 1920 function joinPaths(path1, path2) { | 1993 function joinPaths(path1, path2) { |
| 1921 var pieces = path1.split('/'); | 1994 var pieces = path1.split('/'); |
| 1922 var $list = path2.split('/'); | 1995 var $list = path2.split('/'); |
| 1923 for (var $i = 0;$i < $list.length; $i++) { | 1996 for (var $i = 0;$i < $list.length; $i++) { |
| 1924 var piece = $list.$index($i); | 1997 var piece = $list.$index($i); |
| 1925 if ($eq(piece, '..') && pieces.length > 0 && $ne(pieces.last(), '.') && $ne(
pieces.last(), '..')) { | 1998 if ($notnull_bool($eq(piece, '..') && pieces.length > 0 && $ne(pieces.last()
, '.') && $ne(pieces.last(), '..'))) { |
| 1926 pieces.removeLast(); | 1999 pieces.removeLast(); |
| 1927 } | 2000 } |
| 1928 else if ($ne(piece, '')) { | 2001 else if ($notnull_bool($ne(piece, ''))) { |
| 1929 if (pieces.length > 0 && $eq(pieces.last(), '.')) { | 2002 if ($notnull_bool(pieces.length > 0 && $eq(pieces.last(), '.'))) { |
| 1930 pieces.removeLast(); | 2003 pieces.removeLast(); |
| 1931 } | 2004 } |
| 1932 pieces.add(piece); | 2005 pieces.add(piece); |
| 1933 } | 2006 } |
| 1934 } | 2007 } |
| 1935 return Strings.join(pieces, '/'); | 2008 return Strings.join((pieces && pieces.is$List$String()), '/'); |
| 1936 } | 2009 } |
| 1937 function dirname(path) { | 2010 function dirname(path) { |
| 1938 var lastSlash = path.lastIndexOf('/', path.length); | 2011 var lastSlash = path.lastIndexOf('/', path.length); |
| 1939 if (lastSlash == -1) { | 2012 if ($notnull_bool(lastSlash == -1)) { |
| 1940 return '.'; | 2013 return '.'; |
| 1941 } | 2014 } |
| 1942 else { | 2015 else { |
| 1943 return path.substring(0, lastSlash); | 2016 return path.substring(0, lastSlash); |
| 1944 } | 2017 } |
| 1945 } | 2018 } |
| 1946 function basename(path) { | 2019 function basename(path) { |
| 1947 var lastSlash = path.lastIndexOf('/', path.length); | 2020 var lastSlash = path.lastIndexOf('/', path.length); |
| 1948 if (lastSlash == -1) { | 2021 if ($notnull_bool(lastSlash == -1)) { |
| 1949 return path; | 2022 return path; |
| 1950 } | 2023 } |
| 1951 else { | 2024 else { |
| 1952 return path.substring(lastSlash + 1); | 2025 return path.substring(lastSlash + 1); |
| 1953 } | 2026 } |
| 1954 } | 2027 } |
| 1955 // ********** Library file_system_node ************** | 2028 // ********** Library file_system_node ************** |
| 1956 // ********** Code for NodeFileSystem ************** | 2029 // ********** Code for NodeFileSystem ************** |
| 1957 function NodeFileSystem() { | 2030 function NodeFileSystem() { |
| 1958 // Initializers done | 2031 // Initializers done |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1984 ArrayBasedScanner.prototype.set$tail = function(value) { return this.tail = valu
e; }; | 2057 ArrayBasedScanner.prototype.set$tail = function(value) { return this.tail = valu
e; }; |
| 1985 ArrayBasedScanner.prototype.get$byteOffset = function() { return this.byteOffset
; }; | 2058 ArrayBasedScanner.prototype.get$byteOffset = function() { return this.byteOffset
; }; |
| 1986 ArrayBasedScanner.prototype.set$byteOffset = function(value) { return this.byteO
ffset = value; }; | 2059 ArrayBasedScanner.prototype.set$byteOffset = function(value) { return this.byteO
ffset = value; }; |
| 1987 ArrayBasedScanner.prototype.advance = function() { | 2060 ArrayBasedScanner.prototype.advance = function() { |
| 1988 var next = this.nextByte(); | 2061 var next = this.nextByte(); |
| 1989 this.charOffset++; | 2062 this.charOffset++; |
| 1990 return next; | 2063 return next; |
| 1991 } | 2064 } |
| 1992 ArrayBasedScanner.prototype.select = function(choice, yes, no) { | 2065 ArrayBasedScanner.prototype.select = function(choice, yes, no) { |
| 1993 var next = this.advance(); | 2066 var next = this.advance(); |
| 1994 if (next == choice) { | 2067 if ($notnull_bool(next == choice)) { |
| 1995 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, yes); | 2068 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, yes); |
| 1996 return this.advance(); | 2069 return this.advance(); |
| 1997 } | 2070 } |
| 1998 else { | 2071 else { |
| 1999 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, no); | 2072 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, no); |
| 2000 return next; | 2073 return next; |
| 2001 } | 2074 } |
| 2002 } | 2075 } |
| 2003 ArrayBasedScanner.prototype.appendStringToken = function(kind, value) { | 2076 ArrayBasedScanner.prototype.appendStringToken = function(kind, value) { |
| 2004 this.tail.next = new StringToken(kind, value, this.tokenStart); | 2077 this.tail.next = new StringToken(kind, value, this.tokenStart); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2034 this.tail = this.tokens; | 2107 this.tail = this.tokens; |
| 2035 } | 2108 } |
| 2036 $inherits(ArrayBasedScanner$String, ArrayBasedScanner); | 2109 $inherits(ArrayBasedScanner$String, ArrayBasedScanner); |
| 2037 ArrayBasedScanner$String.prototype.advance = function() { | 2110 ArrayBasedScanner$String.prototype.advance = function() { |
| 2038 var next = this.nextByte(); | 2111 var next = this.nextByte(); |
| 2039 this.charOffset++; | 2112 this.charOffset++; |
| 2040 return next; | 2113 return next; |
| 2041 } | 2114 } |
| 2042 ArrayBasedScanner$String.prototype.select = function(choice, yes, no) { | 2115 ArrayBasedScanner$String.prototype.select = function(choice, yes, no) { |
| 2043 var next = this.advance(); | 2116 var next = this.advance(); |
| 2044 if (next == choice) { | 2117 if ($notnull_bool(next == choice)) { |
| 2045 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, yes); | 2118 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, yes); |
| 2046 return this.advance(); | 2119 return this.advance(); |
| 2047 } | 2120 } |
| 2048 else { | 2121 else { |
| 2049 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, no); | 2122 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, no); |
| 2050 return next; | 2123 return next; |
| 2051 } | 2124 } |
| 2052 } | 2125 } |
| 2053 ArrayBasedScanner$String.prototype.appendStringToken = function(kind, value) { | 2126 ArrayBasedScanner$String.prototype.appendStringToken = function(kind, value) { |
| 2054 this.tail.next = new StringToken(kind, value, this.tokenStart); | 2127 this.tail.next = new StringToken(kind, value, this.tokenStart); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2069 return this.tokens.next; | 2142 return this.tokens.next; |
| 2070 } | 2143 } |
| 2071 ArrayBasedScanner$String.prototype.addToCharOffset = function(offset) { | 2144 ArrayBasedScanner$String.prototype.addToCharOffset = function(offset) { |
| 2072 this.charOffset += offset; | 2145 this.charOffset += offset; |
| 2073 } | 2146 } |
| 2074 ArrayBasedScanner$String.prototype.appendWhiteSpace = function(next) { | 2147 ArrayBasedScanner$String.prototype.appendWhiteSpace = function(next) { |
| 2075 | 2148 |
| 2076 } | 2149 } |
| 2077 ArrayBasedScanner$String.prototype.tokenize = function() { | 2150 ArrayBasedScanner$String.prototype.tokenize = function() { |
| 2078 var next = this.advance(); | 2151 var next = this.advance(); |
| 2079 while (next != -1) { | 2152 while ($notnull_bool(next != -1)) { |
| 2080 next = this.bigSwitch(next); | 2153 next = this.bigSwitch(next); |
| 2081 } | 2154 } |
| 2082 this.appendEofToken(); | 2155 this.appendEofToken(); |
| 2083 return this.firstToken(); | 2156 return this.firstToken(); |
| 2084 } | 2157 } |
| 2085 ArrayBasedScanner$String.prototype.bigSwitch = function(next) { | 2158 ArrayBasedScanner$String.prototype.bigSwitch = function(next) { |
| 2086 this.beginToken(); | 2159 this.beginToken(); |
| 2087 switch (next) { | 2160 switch (next) { |
| 2088 case 9/*null.$TAB*/: | 2161 case 9/*null.$TAB*/: |
| 2089 case 10/*null.$LF*/: | 2162 case 10/*null.$LF*/: |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2289 case 118/*null.$v*/: | 2362 case 118/*null.$v*/: |
| 2290 case 119/*null.$w*/: | 2363 case 119/*null.$w*/: |
| 2291 case 120/*null.$x*/: | 2364 case 120/*null.$x*/: |
| 2292 case 121/*null.$y*/: | 2365 case 121/*null.$y*/: |
| 2293 case 122/*null.$z*/: | 2366 case 122/*null.$z*/: |
| 2294 | 2367 |
| 2295 return this.tokenizeIdentifier(next); | 2368 return this.tokenizeIdentifier(next); |
| 2296 | 2369 |
| 2297 default: | 2370 default: |
| 2298 | 2371 |
| 2299 if (next == -1) { | 2372 if ($notnull_bool(next == -1)) { |
| 2300 return -1; | 2373 return -1; |
| 2301 } | 2374 } |
| 2302 if (next < 0x1f) { | 2375 if ($notnull_bool(next < 0x1f)) { |
| 2303 $throw(new MalformedInputException(this.charOffset)); | 2376 $throw(new MalformedInputException(this.charOffset)); |
| 2304 } | 2377 } |
| 2305 return this.tokenizeIdentifier(next); | 2378 return this.tokenizeIdentifier(next); |
| 2306 | 2379 |
| 2307 } | 2380 } |
| 2308 } | 2381 } |
| 2309 ArrayBasedScanner$String.prototype.tokenizeTag = function(next) { | 2382 ArrayBasedScanner$String.prototype.tokenizeTag = function(next) { |
| 2310 if (this.byteOffset == 0) { | 2383 if ($notnull_bool(this.byteOffset == 0)) { |
| 2311 if (this.peek() == 33/*null.$BANG*/) { | 2384 if ($notnull_bool(this.peek() == 33/*null.$BANG*/)) { |
| 2312 do { | 2385 do { |
| 2313 next = this.advance(); | 2386 next = this.advance(); |
| 2314 } | 2387 } |
| 2315 while (next != 10/*null.$LF*/ && next != 13/*null.$CR*/) | 2388 while ($notnull_bool(next != 10/*null.$LF*/ && next != 13/*null.$CR*/)) |
| 2316 return next; | 2389 return next; |
| 2317 } | 2390 } |
| 2318 } | 2391 } |
| 2319 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); | 2392 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); |
| 2320 return this.advance(); | 2393 return this.advance(); |
| 2321 } | 2394 } |
| 2322 ArrayBasedScanner$String.prototype.tokenizeTilde = function(next) { | 2395 ArrayBasedScanner$String.prototype.tokenizeTilde = function(next) { |
| 2323 next = this.advance(); | 2396 next = this.advance(); |
| 2324 if (next == 47/*null.$SLASH*/) { | 2397 if ($notnull_bool(next == 47/*null.$SLASH*/)) { |
| 2325 return this.select(61/*null.$EQ*/, "~/=", "~/"); | 2398 return this.select(61/*null.$EQ*/, "~/=", "~/"); |
| 2326 } | 2399 } |
| 2327 else { | 2400 else { |
| 2328 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); | 2401 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); |
| 2329 return next; | 2402 return next; |
| 2330 } | 2403 } |
| 2331 } | 2404 } |
| 2332 ArrayBasedScanner$String.prototype.tokenizeOpenBracket = function(next) { | 2405 ArrayBasedScanner$String.prototype.tokenizeOpenBracket = function(next) { |
| 2333 next = this.advance(); | 2406 next = this.advance(); |
| 2334 if (next == 93/*null.$RBRACKET*/) { | 2407 if ($notnull_bool(next == 93/*null.$RBRACKET*/)) { |
| 2335 return this.select(61/*null.$EQ*/, "[]=", "[]"); | 2408 return this.select(61/*null.$EQ*/, "[]=", "[]"); |
| 2336 } | 2409 } |
| 2337 else { | 2410 else { |
| 2338 this.appendStringToken(93/*null.RBRACKET_TOKEN*/, "["); | 2411 this.appendStringToken(93/*null.RBRACKET_TOKEN*/, "["); |
| 2339 return next; | 2412 return next; |
| 2340 } | 2413 } |
| 2341 } | 2414 } |
| 2342 ArrayBasedScanner$String.prototype.tokenizeCaret = function(next) { | 2415 ArrayBasedScanner$String.prototype.tokenizeCaret = function(next) { |
| 2343 return this.select(61/*null.$EQ*/, "^=", "^"); | 2416 return this.select(61/*null.$EQ*/, "^=", "^"); |
| 2344 } | 2417 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2423 | 2496 |
| 2424 default: | 2497 default: |
| 2425 | 2498 |
| 2426 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); | 2499 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); |
| 2427 return next; | 2500 return next; |
| 2428 | 2501 |
| 2429 } | 2502 } |
| 2430 } | 2503 } |
| 2431 ArrayBasedScanner$String.prototype.tokenizeExclamation = function(next) { | 2504 ArrayBasedScanner$String.prototype.tokenizeExclamation = function(next) { |
| 2432 next = this.advance(); | 2505 next = this.advance(); |
| 2433 if (next == 61/*null.$EQ*/) { | 2506 if ($notnull_bool(next == 61/*null.$EQ*/)) { |
| 2434 return this.select(61/*null.$EQ*/, "!==", "!="); | 2507 return this.select(61/*null.$EQ*/, "!==", "!="); |
| 2435 } | 2508 } |
| 2436 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); | 2509 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); |
| 2437 return next; | 2510 return next; |
| 2438 } | 2511 } |
| 2439 ArrayBasedScanner$String.prototype.tokenizeEquals = function(next) { | 2512 ArrayBasedScanner$String.prototype.tokenizeEquals = function(next) { |
| 2440 next = this.advance(); | 2513 next = this.advance(); |
| 2441 if (next == 61/*null.$EQ*/) { | 2514 if ($notnull_bool(next == 61/*null.$EQ*/)) { |
| 2442 return this.select(61/*null.$EQ*/, "===", "=="); | 2515 return this.select(61/*null.$EQ*/, "===", "=="); |
| 2443 } | 2516 } |
| 2444 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); | 2517 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); |
| 2445 return next; | 2518 return next; |
| 2446 } | 2519 } |
| 2447 ArrayBasedScanner$String.prototype.tokenizeGreaterThan = function(next) { | 2520 ArrayBasedScanner$String.prototype.tokenizeGreaterThan = function(next) { |
| 2448 next = this.advance(); | 2521 next = this.advance(); |
| 2449 switch (next) { | 2522 switch (next) { |
| 2450 case 61/*null.$EQ*/: | 2523 case 61/*null.$EQ*/: |
| 2451 | 2524 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2494 | 2567 |
| 2495 default: | 2568 default: |
| 2496 | 2569 |
| 2497 this.appendStringToken(60/*null.LT_TOKEN*/, "<"); | 2570 this.appendStringToken(60/*null.LT_TOKEN*/, "<"); |
| 2498 return next; | 2571 return next; |
| 2499 | 2572 |
| 2500 } | 2573 } |
| 2501 } | 2574 } |
| 2502 ArrayBasedScanner$String.prototype.tokenizeNumber = function(next) { | 2575 ArrayBasedScanner$String.prototype.tokenizeNumber = function(next) { |
| 2503 var start = this.byteOffset; | 2576 var start = this.byteOffset; |
| 2504 while (true) { | 2577 while ($notnull_bool(true)) { |
| 2505 next = this.advance(); | 2578 next = this.advance(); |
| 2506 switch (next) { | 2579 switch (next) { |
| 2507 case 48/*null.$0*/: | 2580 case 48/*null.$0*/: |
| 2508 case 49/*null.$1*/: | 2581 case 49/*null.$1*/: |
| 2509 case 50/*null.$2*/: | 2582 case 50/*null.$2*/: |
| 2510 case 51/*null.$3*/: | 2583 case 51/*null.$3*/: |
| 2511 case 52/*null.$4*/: | 2584 case 52/*null.$4*/: |
| 2512 case 53/*null.$5*/: | 2585 case 53/*null.$5*/: |
| 2513 case 54/*null.$6*/: | 2586 case 54/*null.$6*/: |
| 2514 case 55/*null.$7*/: | 2587 case 55/*null.$7*/: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2531 default: | 2604 default: |
| 2532 | 2605 |
| 2533 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start
)); | 2606 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start
)); |
| 2534 return next; | 2607 return next; |
| 2535 | 2608 |
| 2536 } | 2609 } |
| 2537 } | 2610 } |
| 2538 } | 2611 } |
| 2539 ArrayBasedScanner$String.prototype.tokenizeHexOrNumber = function(next) { | 2612 ArrayBasedScanner$String.prototype.tokenizeHexOrNumber = function(next) { |
| 2540 var x = this.peek(); | 2613 var x = this.peek(); |
| 2541 if (x == 120/*null.$x*/ || x == 88/*null.$X*/) { | 2614 if ($notnull_bool(x == 120/*null.$x*/ || x == 88/*null.$X*/)) { |
| 2542 this.advance(); | 2615 this.advance(); |
| 2543 return this.tokenizeHex(x); | 2616 return this.tokenizeHex(x); |
| 2544 } | 2617 } |
| 2545 return this.tokenizeNumber(next); | 2618 return this.tokenizeNumber(next); |
| 2546 } | 2619 } |
| 2547 ArrayBasedScanner$String.prototype.tokenizeHex = function(next) { | 2620 ArrayBasedScanner$String.prototype.tokenizeHex = function(next) { |
| 2548 var start = this.byteOffset; | 2621 var start = this.byteOffset; |
| 2549 var hasDigits = false; | 2622 var hasDigits = false; |
| 2550 while (true) { | 2623 while ($notnull_bool(true)) { |
| 2551 next = this.advance(); | 2624 next = this.advance(); |
| 2552 switch (next) { | 2625 switch (next) { |
| 2553 case 48/*null.$0*/: | 2626 case 48/*null.$0*/: |
| 2554 case 49/*null.$1*/: | 2627 case 49/*null.$1*/: |
| 2555 case 50/*null.$2*/: | 2628 case 50/*null.$2*/: |
| 2556 case 51/*null.$3*/: | 2629 case 51/*null.$3*/: |
| 2557 case 52/*null.$4*/: | 2630 case 52/*null.$4*/: |
| 2558 case 53/*null.$5*/: | 2631 case 53/*null.$5*/: |
| 2559 case 54/*null.$6*/: | 2632 case 54/*null.$6*/: |
| 2560 case 55/*null.$7*/: | 2633 case 55/*null.$7*/: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2571 case 99/*null.$c*/: | 2644 case 99/*null.$c*/: |
| 2572 case 100/*null.$d*/: | 2645 case 100/*null.$d*/: |
| 2573 case 101/*null.$e*/: | 2646 case 101/*null.$e*/: |
| 2574 case 102/*null.$f*/: | 2647 case 102/*null.$f*/: |
| 2575 | 2648 |
| 2576 hasDigits = true; | 2649 hasDigits = true; |
| 2577 break; | 2650 break; |
| 2578 | 2651 |
| 2579 default: | 2652 default: |
| 2580 | 2653 |
| 2581 if (!hasDigits) { | 2654 if ($notnull_bool(!hasDigits)) { |
| 2582 $throw(new MalformedInputException(this.charOffset)); | 2655 $throw(new MalformedInputException(this.charOffset)); |
| 2583 } | 2656 } |
| 2584 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); | 2657 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); |
| 2585 return next; | 2658 return next; |
| 2586 | 2659 |
| 2587 } | 2660 } |
| 2588 } | 2661 } |
| 2589 } | 2662 } |
| 2590 ArrayBasedScanner$String.prototype.tokenizeDotOrNumber = function(next) { | 2663 ArrayBasedScanner$String.prototype.tokenizeDotOrNumber = function(next) { |
| 2591 var start = this.byteOffset; | 2664 var start = this.byteOffset; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2613 default: | 2686 default: |
| 2614 | 2687 |
| 2615 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 2688 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 2616 return next; | 2689 return next; |
| 2617 | 2690 |
| 2618 } | 2691 } |
| 2619 } | 2692 } |
| 2620 ArrayBasedScanner$String.prototype.tokenizeFractionPart = function(next, start)
{ | 2693 ArrayBasedScanner$String.prototype.tokenizeFractionPart = function(next, start)
{ |
| 2621 var done = false; | 2694 var done = false; |
| 2622 LOOP: | 2695 LOOP: |
| 2623 while (!done) { | 2696 while ($notnull_bool(!done)) { |
| 2624 switch (next) { | 2697 switch (next) { |
| 2625 case 48/*null.$0*/: | 2698 case 48/*null.$0*/: |
| 2626 case 49/*null.$1*/: | 2699 case 49/*null.$1*/: |
| 2627 case 50/*null.$2*/: | 2700 case 50/*null.$2*/: |
| 2628 case 51/*null.$3*/: | 2701 case 51/*null.$3*/: |
| 2629 case 52/*null.$4*/: | 2702 case 52/*null.$4*/: |
| 2630 case 53/*null.$5*/: | 2703 case 53/*null.$5*/: |
| 2631 case 54/*null.$6*/: | 2704 case 54/*null.$6*/: |
| 2632 case 55/*null.$7*/: | 2705 case 55/*null.$7*/: |
| 2633 case 56/*null.$8*/: | 2706 case 56/*null.$8*/: |
| 2634 case 57/*null.$9*/: | 2707 case 57/*null.$9*/: |
| 2635 | 2708 |
| 2636 break; | 2709 break; |
| 2637 | 2710 |
| 2638 case 101/*null.$e*/: | 2711 case 101/*null.$e*/: |
| 2639 case 69/*null.$E*/: | 2712 case 69/*null.$E*/: |
| 2640 | 2713 |
| 2641 next = this.tokenizeExponent(this.advance()); | 2714 next = this.tokenizeExponent(this.advance()); |
| 2642 done = true; | 2715 done = true; |
| 2643 continue LOOP; | 2716 continue LOOP; |
| 2644 | 2717 |
| 2645 default: | 2718 default: |
| 2646 | 2719 |
| 2647 done = true; | 2720 done = true; |
| 2648 continue LOOP; | 2721 continue LOOP; |
| 2649 | 2722 |
| 2650 } | 2723 } |
| 2651 next = this.advance(); | 2724 next = this.advance(); |
| 2652 } | 2725 } |
| 2653 if (next == 100/*null.$d*/ || next == 68/*null.$D*/) { | 2726 if ($notnull_bool(next == 100/*null.$d*/ || next == 68/*null.$D*/)) { |
| 2654 next = this.advance(); | 2727 next = this.advance(); |
| 2655 } | 2728 } |
| 2656 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); | 2729 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); |
| 2657 return next; | 2730 return next; |
| 2658 } | 2731 } |
| 2659 ArrayBasedScanner$String.prototype.tokenizeExponent = function(next) { | 2732 ArrayBasedScanner$String.prototype.tokenizeExponent = function(next) { |
| 2660 if (next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/) { | 2733 if ($notnull_bool(next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/)) { |
| 2661 next = this.advance(); | 2734 next = this.advance(); |
| 2662 } | 2735 } |
| 2663 var hasDigits = false; | 2736 var hasDigits = false; |
| 2664 while (true) { | 2737 while ($notnull_bool(true)) { |
| 2665 switch (next) { | 2738 switch (next) { |
| 2666 case 48/*null.$0*/: | 2739 case 48/*null.$0*/: |
| 2667 case 49/*null.$1*/: | 2740 case 49/*null.$1*/: |
| 2668 case 50/*null.$2*/: | 2741 case 50/*null.$2*/: |
| 2669 case 51/*null.$3*/: | 2742 case 51/*null.$3*/: |
| 2670 case 52/*null.$4*/: | 2743 case 52/*null.$4*/: |
| 2671 case 53/*null.$5*/: | 2744 case 53/*null.$5*/: |
| 2672 case 54/*null.$6*/: | 2745 case 54/*null.$6*/: |
| 2673 case 55/*null.$7*/: | 2746 case 55/*null.$7*/: |
| 2674 case 56/*null.$8*/: | 2747 case 56/*null.$8*/: |
| 2675 case 57/*null.$9*/: | 2748 case 57/*null.$9*/: |
| 2676 | 2749 |
| 2677 hasDigits = true; | 2750 hasDigits = true; |
| 2678 break; | 2751 break; |
| 2679 | 2752 |
| 2680 default: | 2753 default: |
| 2681 | 2754 |
| 2682 if (!hasDigits) { | 2755 if ($notnull_bool(!hasDigits)) { |
| 2683 $throw(new MalformedInputException(this.charOffset)); | 2756 $throw(new MalformedInputException(this.charOffset)); |
| 2684 } | 2757 } |
| 2685 return next; | 2758 return next; |
| 2686 | 2759 |
| 2687 } | 2760 } |
| 2688 next = this.advance(); | 2761 next = this.advance(); |
| 2689 } | 2762 } |
| 2690 } | 2763 } |
| 2691 ArrayBasedScanner$String.prototype.tokenizeSlashOrComment = function(next) { | 2764 ArrayBasedScanner$String.prototype.tokenizeSlashOrComment = function(next) { |
| 2692 next = this.advance(); | 2765 next = this.advance(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2705 return this.advance(); | 2778 return this.advance(); |
| 2706 | 2779 |
| 2707 default: | 2780 default: |
| 2708 | 2781 |
| 2709 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); | 2782 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); |
| 2710 return next; | 2783 return next; |
| 2711 | 2784 |
| 2712 } | 2785 } |
| 2713 } | 2786 } |
| 2714 ArrayBasedScanner$String.prototype.tokenizeSingleLineComment = function(next) { | 2787 ArrayBasedScanner$String.prototype.tokenizeSingleLineComment = function(next) { |
| 2715 while (true) { | 2788 while ($notnull_bool(true)) { |
| 2716 next = this.advance(); | 2789 next = this.advance(); |
| 2717 switch (next) { | 2790 switch (next) { |
| 2718 case -1: | 2791 case -1: |
| 2719 case 10/*null.$LF*/: | 2792 case 10/*null.$LF*/: |
| 2720 case 13/*null.$CR*/: | 2793 case 13/*null.$CR*/: |
| 2721 | 2794 |
| 2722 return next; | 2795 return next; |
| 2723 | 2796 |
| 2724 } | 2797 } |
| 2725 } | 2798 } |
| 2726 } | 2799 } |
| 2727 ArrayBasedScanner$String.prototype.tokenizeMultiLineComment = function(next) { | 2800 ArrayBasedScanner$String.prototype.tokenizeMultiLineComment = function(next) { |
| 2728 next = this.advance(); | 2801 next = this.advance(); |
| 2729 while (true) { | 2802 while ($notnull_bool(true)) { |
| 2730 switch (next) { | 2803 switch (next) { |
| 2731 case -1: | 2804 case -1: |
| 2732 | 2805 |
| 2733 return next; | 2806 return next; |
| 2734 | 2807 |
| 2735 case 42/*null.$STAR*/: | 2808 case 42/*null.$STAR*/: |
| 2736 | 2809 |
| 2737 next = this.advance(); | 2810 next = this.advance(); |
| 2738 if (next == 47/*null.$SLASH*/) { | 2811 if ($notnull_bool(next == 47/*null.$SLASH*/)) { |
| 2739 return this.advance(); | 2812 return this.advance(); |
| 2740 } | 2813 } |
| 2741 else if (next == -1) { | 2814 else if ($notnull_bool(next == -1)) { |
| 2742 return next; | 2815 return next; |
| 2743 } | 2816 } |
| 2744 break; | 2817 break; |
| 2745 | 2818 |
| 2746 default: | 2819 default: |
| 2747 | 2820 |
| 2748 next = this.advance(); | 2821 next = this.advance(); |
| 2749 break; | 2822 break; |
| 2750 | 2823 |
| 2751 } | 2824 } |
| 2752 } | 2825 } |
| 2753 } | 2826 } |
| 2754 ArrayBasedScanner$String.prototype.tokenizeIdentifier = function(next) { | 2827 ArrayBasedScanner$String.prototype.tokenizeIdentifier = function(next) { |
| 2755 var start = this.byteOffset; | 2828 var start = this.byteOffset; |
| 2756 var state = null; | 2829 var state = null; |
| 2757 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { | 2830 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { |
| 2758 state = KeywordState.get$KEYWORD_STATE().next(next); | 2831 state = KeywordState.get$KEYWORD_STATE().next(next); |
| 2759 next = this.advance(); | 2832 next = this.advance(); |
| 2760 } | 2833 } |
| 2761 var isAscii = true; | 2834 var isAscii = true; |
| 2762 while (true) { | 2835 while ($notnull_bool(true)) { |
| 2763 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { | 2836 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { |
| 2764 if (state != null) { | 2837 if ($notnull_bool(state != null)) { |
| 2765 state = state.next(next); | 2838 state = state.next(next); |
| 2766 } | 2839 } |
| 2767 } | 2840 } |
| 2768 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*/) { | 2841 else if ($notnull_bool((48/*null.$0*/ <= next && next <= 57/*null.$9*/) || (
65/*null.$A*/ <= next && next <= 90/*null.$Z*/) || next == 95/*null.$_*/ || next
== 36/*null.$DOLLAR*/)) { |
| 2769 state = null; | 2842 state = null; |
| 2770 } | 2843 } |
| 2771 else if (next < 128) { | 2844 else if ($notnull_bool(next < 128)) { |
| 2772 if (state != null && state.isLeaf()) { | 2845 if ($notnull_bool(state != null && state.isLeaf())) { |
| 2773 this.appendKeywordToken(state.get$keyword()); | 2846 this.appendKeywordToken(state.get$keyword()); |
| 2774 } | 2847 } |
| 2775 else if (isAscii) { | 2848 else if ($notnull_bool(isAscii)) { |
| 2776 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString
(start)); | 2849 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString
(start)); |
| 2777 } | 2850 } |
| 2778 else { | 2851 else { |
| 2779 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String(
start, -1)); | 2852 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String(
start, -1)); |
| 2780 } | 2853 } |
| 2781 return next; | 2854 return next; |
| 2782 } | 2855 } |
| 2783 else { | 2856 else { |
| 2784 var nonAsciiStart = this.byteOffset; | 2857 var nonAsciiStart = this.byteOffset; |
| 2785 do { | 2858 do { |
| 2786 next = this.nextByte(); | 2859 next = this.nextByte(); |
| 2787 } | 2860 } |
| 2788 while (next > 127) | 2861 while ($notnull_bool(next > 127)) |
| 2789 var string = this.utf8String(nonAsciiStart, -1).toString(); | 2862 var string = this.utf8String(nonAsciiStart, -1).toString(); |
| 2790 isAscii = false; | 2863 isAscii = false; |
| 2791 this.addToCharOffset(string.length); | 2864 this.addToCharOffset(string.length); |
| 2792 return next; | 2865 return next; |
| 2793 } | 2866 } |
| 2794 next = this.advance(); | 2867 next = this.advance(); |
| 2795 } | 2868 } |
| 2796 } | 2869 } |
| 2797 ArrayBasedScanner$String.prototype.tokenizeRawString = function(next) { | 2870 ArrayBasedScanner$String.prototype.tokenizeRawString = function(next) { |
| 2798 var start = this.byteOffset; | 2871 var start = this.byteOffset; |
| 2799 next = this.advance(); | 2872 next = this.advance(); |
| 2800 if (next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/) { | 2873 if ($notnull_bool(next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/)) { |
| 2801 return this.tokenizeString(next, start, true); | 2874 return this.tokenizeString(next, start, true); |
| 2802 } | 2875 } |
| 2803 else { | 2876 else { |
| 2804 $throw(new MalformedInputException(this.charOffset)); | 2877 $throw(new MalformedInputException(this.charOffset)); |
| 2805 } | 2878 } |
| 2806 } | 2879 } |
| 2807 ArrayBasedScanner$String.prototype.tokenizeString = function(next, start, raw) { | 2880 ArrayBasedScanner$String.prototype.tokenizeString = function(next, start, raw) { |
| 2808 var q = next; | 2881 var q = next; |
| 2809 next = this.advance(); | 2882 next = this.advance(); |
| 2810 if (q == next) { | 2883 if ($notnull_bool(q == next)) { |
| 2811 next = this.advance(); | 2884 next = this.advance(); |
| 2812 if (q == next) { | 2885 if ($notnull_bool(q == next)) { |
| 2813 return this.tokenizeMultiLineString(q, start, raw); | 2886 return this.tokenizeMultiLineString(q, start, raw); |
| 2814 } | 2887 } |
| 2815 else { | 2888 else { |
| 2816 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
-1)); | 2889 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
-1)); |
| 2817 return next; | 2890 return next; |
| 2818 } | 2891 } |
| 2819 } | 2892 } |
| 2820 if (raw) { | 2893 if ($notnull_bool(raw)) { |
| 2821 return this.tokenizeSingleLineRawString(next, q, start); | 2894 return this.tokenizeSingleLineRawString(next, q, start); |
| 2822 } | 2895 } |
| 2823 else { | 2896 else { |
| 2824 return this.tokenizeSingleLineString(next, q, start); | 2897 return this.tokenizeSingleLineString(next, q, start); |
| 2825 } | 2898 } |
| 2826 } | 2899 } |
| 2827 ArrayBasedScanner$String.prototype.tokenizeSingleLineString = function(next, q1,
start) { | 2900 ArrayBasedScanner$String.prototype.tokenizeSingleLineString = function(next, q1,
start) { |
| 2828 while (next != -1) { | 2901 while ($notnull_bool(next != -1)) { |
| 2829 if (next == q1) { | 2902 if ($notnull_bool(next == q1)) { |
| 2830 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); | 2903 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); |
| 2831 return this.advance(); | 2904 return this.advance(); |
| 2832 } | 2905 } |
| 2833 else if (next == 92/*null.$BACKSLASH*/) { | 2906 else if ($notnull_bool(next == 92/*null.$BACKSLASH*/)) { |
| 2834 next = this.advance(); | 2907 next = this.advance(); |
| 2835 if (next == -1) { | 2908 if ($notnull_bool(next == -1)) { |
| 2836 $throw(new MalformedInputException(this.charOffset)); | 2909 $throw(new MalformedInputException(this.charOffset)); |
| 2837 } | 2910 } |
| 2838 } | 2911 } |
| 2839 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { | 2912 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { |
| 2840 $throw(new MalformedInputException(this.charOffset)); | 2913 $throw(new MalformedInputException(this.charOffset)); |
| 2841 } | 2914 } |
| 2842 next = this.advance(); | 2915 next = this.advance(); |
| 2843 } | 2916 } |
| 2844 $throw(new MalformedInputException(this.charOffset)); | 2917 $throw(new MalformedInputException(this.charOffset)); |
| 2845 } | 2918 } |
| 2846 ArrayBasedScanner$String.prototype.tokenizeSingleLineRawString = function(next,
q1, start) { | 2919 ArrayBasedScanner$String.prototype.tokenizeSingleLineRawString = function(next,
q1, start) { |
| 2847 next = this.advance(); | 2920 next = this.advance(); |
| 2848 while (next != -1) { | 2921 while ($notnull_bool(next != -1)) { |
| 2849 if (next == q1) { | 2922 if ($notnull_bool(next == q1)) { |
| 2850 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); | 2923 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); |
| 2851 return this.advance(); | 2924 return this.advance(); |
| 2852 } | 2925 } |
| 2853 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { | 2926 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { |
| 2854 $throw(new MalformedInputException(this.charOffset)); | 2927 $throw(new MalformedInputException(this.charOffset)); |
| 2855 } | 2928 } |
| 2856 next = this.advance(); | 2929 next = this.advance(); |
| 2857 } | 2930 } |
| 2858 $throw(new MalformedInputException(this.charOffset)); | 2931 $throw(new MalformedInputException(this.charOffset)); |
| 2859 } | 2932 } |
| 2860 ArrayBasedScanner$String.prototype.tokenizeMultiLineString = function(q, start,
raw) { | 2933 ArrayBasedScanner$String.prototype.tokenizeMultiLineString = function(q, start,
raw) { |
| 2861 var next = this.advance(); | 2934 var next = this.advance(); |
| 2862 while (next != -1) { | 2935 while ($notnull_bool(next != -1)) { |
| 2863 if (next == q) { | 2936 if ($notnull_bool(next == q)) { |
| 2864 next = this.advance(); | 2937 next = this.advance(); |
| 2865 if (next == q) { | 2938 if ($notnull_bool(next == q)) { |
| 2866 next = this.advance(); | 2939 next = this.advance(); |
| 2867 if (next == q) { | 2940 if ($notnull_bool(next == q)) { |
| 2868 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st
art, 0)); | 2941 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st
art, 0)); |
| 2869 return this.advance(); | 2942 return this.advance(); |
| 2870 } | 2943 } |
| 2871 } | 2944 } |
| 2872 } | 2945 } |
| 2873 next = this.advance(); | 2946 next = this.advance(); |
| 2874 } | 2947 } |
| 2875 return next; | 2948 return next; |
| 2876 } | 2949 } |
| 2877 // ********** Code for top level ************** | 2950 // ********** Code for top level ************** |
| 2878 // ********** Library util_implementation ************** | 2951 // ********** Library util_implementation ************** |
| 2879 // ********** Code for LinkFactory ************** | 2952 // ********** Code for LinkFactory ************** |
| 2880 function LinkFactory() {} | 2953 function LinkFactory() {} |
| 2881 LinkFactory.Link$factory = function(head, tail) { | 2954 LinkFactory.Link$factory = function(head, tail) { |
| 2882 return new LinkEntry(head, (tail == null) ? const$227/*const EmptyLink<Declara
tionBuilder>()*/ : tail); | 2955 var $0; |
| 2956 return new LinkEntry(head, (($0 = $notnull_bool((tail == null)) ? const$227/*c
onst EmptyLink<DeclarationBuilder>()*/ : tail) && $0.is$Link$T())); |
| 2883 } | 2957 } |
| 2884 // ********** Code for AbstractLink ************** | 2958 // ********** Code for AbstractLink ************** |
| 2885 function AbstractLink() {} | 2959 function AbstractLink() {} |
| 2960 AbstractLink.prototype.is$Link = function(){return this;}; |
| 2961 AbstractLink.prototype.is$Link$DeclarationBuilder = function(){return this;}; |
| 2962 AbstractLink.prototype.is$Link$Element = function(){return this;}; |
| 2963 AbstractLink.prototype.is$Link$Node = function(){return this;}; |
| 2964 AbstractLink.prototype.is$Link$T = function(){return this;}; |
| 2965 AbstractLink.prototype.is$Link$Type = function(){return this;}; |
| 2966 AbstractLink.prototype.is$Iterable = function(){return this;}; |
| 2886 AbstractLink.prototype.get$head = function() { | 2967 AbstractLink.prototype.get$head = function() { |
| 2887 $throw("bug"); | 2968 $throw("bug"); |
| 2888 } | 2969 } |
| 2889 AbstractLink.prototype.get$tail = function() { | 2970 AbstractLink.prototype.get$tail = function() { |
| 2890 $throw("bug"); | 2971 $throw("bug"); |
| 2891 } | 2972 } |
| 2892 AbstractLink.prototype.prepend = function(element) { | 2973 AbstractLink.prototype.prepend = function(element) { |
| 2893 return LinkFactory.Link$factory(element, this); | 2974 return LinkFactory.Link$factory(element, this); |
| 2894 } | 2975 } |
| 2895 AbstractLink.prototype.iterator = function() { | 2976 AbstractLink.prototype.iterator = function() { |
| 2896 return this.toList().iterator(); | 2977 return this.toList().iterator(); |
| 2897 } | 2978 } |
| 2898 AbstractLink.prototype.printOn = function(buffer, separatedBy) { | 2979 AbstractLink.prototype.printOn = function(buffer, separatedBy) { |
| 2899 if (this.isEmpty()) return; | 2980 var $0; |
| 2981 if ($notnull_bool(this.isEmpty())) return; |
| 2900 buffer.add(this.get$head()); | 2982 buffer.add(this.get$head()); |
| 2901 for (var link = this.get$tail(); | 2983 for (var link = this.get$tail(); |
| 2902 !link.isEmpty(); link = link.get$tail()) { | 2984 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link(
))) { |
| 2903 buffer.add(separatedBy); | 2985 buffer.add(separatedBy); |
| 2904 buffer.add(link.get$head()); | 2986 buffer.add(link.get$head()); |
| 2905 } | 2987 } |
| 2906 } | 2988 } |
| 2907 AbstractLink.prototype.toString = function() { | 2989 AbstractLink.prototype.toString = function() { |
| 2908 var buffer = new StringBufferImpl(""); | 2990 var buffer = new StringBufferImpl(""); |
| 2909 buffer.add('[ '); | 2991 buffer.add('[ '); |
| 2910 this.printOn(buffer, ', '); | 2992 this.printOn(buffer, ', '); |
| 2911 buffer.add(' ]'); | 2993 buffer.add(' ]'); |
| 2912 return buffer.toString(); | 2994 return buffer.toString(); |
| 2913 } | 2995 } |
| 2914 AbstractLink.prototype.printOn$1 = function($0) { | 2996 AbstractLink.prototype.printOn$1 = function($0) { |
| 2915 return this.printOn($0, ''); | 2997 return this.printOn(($0 && $0.is$StringBuffer()), ''); |
| 2916 } | 2998 } |
| 2917 ; | 2999 ; |
| 2918 // ********** Code for AbstractLink$T ************** | 3000 // ********** Code for AbstractLink$T ************** |
| 2919 function AbstractLink$T() {} | 3001 function AbstractLink$T() {} |
| 2920 $inherits(AbstractLink$T, AbstractLink); | 3002 $inherits(AbstractLink$T, AbstractLink); |
| 3003 AbstractLink$T.prototype.is$Link = function(){return this;}; |
| 3004 AbstractLink$T.prototype.is$Link$DeclarationBuilder = function(){return this;}; |
| 3005 AbstractLink$T.prototype.is$Link$Element = function(){return this;}; |
| 3006 AbstractLink$T.prototype.is$Link$Node = function(){return this;}; |
| 3007 AbstractLink$T.prototype.is$Link$T = function(){return this;}; |
| 3008 AbstractLink$T.prototype.is$Link$Type = function(){return this;}; |
| 3009 AbstractLink$T.prototype.is$Iterable = function(){return this;}; |
| 2921 AbstractLink$T.prototype.iterator = function() { | 3010 AbstractLink$T.prototype.iterator = function() { |
| 2922 return this.toList().iterator(); | 3011 return this.toList().iterator(); |
| 2923 } | 3012 } |
| 2924 // ********** Code for LinkTail ************** | 3013 // ********** Code for LinkTail ************** |
| 2925 function LinkTail() { | 3014 function LinkTail() { |
| 2926 // Initializers done | 3015 // Initializers done |
| 2927 } | 3016 } |
| 2928 $inherits(LinkTail, AbstractLink$T); | 3017 $inherits(LinkTail, AbstractLink$T); |
| 3018 LinkTail.prototype.is$Link = function(){return this;}; |
| 3019 LinkTail.prototype.is$Link$DeclarationBuilder = function(){return this;}; |
| 3020 LinkTail.prototype.is$Link$Element = function(){return this;}; |
| 3021 LinkTail.prototype.is$Link$Node = function(){return this;}; |
| 3022 LinkTail.prototype.is$Link$T = function(){return this;}; |
| 3023 LinkTail.prototype.is$Link$Type = function(){return this;}; |
| 3024 LinkTail.prototype.is$Iterable = function(){return this;}; |
| 2929 LinkTail.prototype.get$head = function() { | 3025 LinkTail.prototype.get$head = function() { |
| 2930 return null; | 3026 return null; |
| 2931 } | 3027 } |
| 2932 LinkTail.prototype.get$tail = function() { | 3028 LinkTail.prototype.get$tail = function() { |
| 2933 return null; | 3029 return null; |
| 2934 } | 3030 } |
| 2935 LinkTail.prototype.toList = function() { | 3031 LinkTail.prototype.toList = function() { |
| 2936 return const$226/*const []*/; | 3032 return const$226/*const []*/; |
| 2937 } | 3033 } |
| 2938 LinkTail.prototype.isEmpty = function() { | 3034 LinkTail.prototype.isEmpty = function() { |
| 2939 return true; | 3035 return true; |
| 2940 } | 3036 } |
| 2941 // ********** Code for LinkTail$DeclarationBuilder ************** | 3037 // ********** Code for LinkTail$DeclarationBuilder ************** |
| 2942 function LinkTail$DeclarationBuilder() { | 3038 function LinkTail$DeclarationBuilder() { |
| 2943 // Initializers done | 3039 // Initializers done |
| 2944 } | 3040 } |
| 2945 $inherits(LinkTail$DeclarationBuilder, LinkTail); | 3041 $inherits(LinkTail$DeclarationBuilder, LinkTail); |
| 3042 LinkTail$DeclarationBuilder.prototype.is$Link = function(){return this;}; |
| 3043 LinkTail$DeclarationBuilder.prototype.is$Link$DeclarationBuilder = function(){re
turn this;}; |
| 3044 LinkTail$DeclarationBuilder.prototype.is$Link$Element = function(){return this;}
; |
| 3045 LinkTail$DeclarationBuilder.prototype.is$Link$Node = function(){return this;}; |
| 3046 LinkTail$DeclarationBuilder.prototype.is$Link$T = function(){return this;}; |
| 3047 LinkTail$DeclarationBuilder.prototype.is$Link$Type = function(){return this;}; |
| 3048 LinkTail$DeclarationBuilder.prototype.is$Iterable = function(){return this;}; |
| 2946 // ********** Code for LinkTail$Element ************** | 3049 // ********** Code for LinkTail$Element ************** |
| 2947 function LinkTail$Element() { | 3050 function LinkTail$Element() { |
| 2948 // Initializers done | 3051 // Initializers done |
| 2949 } | 3052 } |
| 2950 $inherits(LinkTail$Element, LinkTail); | 3053 $inherits(LinkTail$Element, LinkTail); |
| 3054 LinkTail$Element.prototype.is$Link = function(){return this;}; |
| 3055 LinkTail$Element.prototype.is$Link$DeclarationBuilder = function(){return this;}
; |
| 3056 LinkTail$Element.prototype.is$Link$Element = function(){return this;}; |
| 3057 LinkTail$Element.prototype.is$Link$Node = function(){return this;}; |
| 3058 LinkTail$Element.prototype.is$Link$T = function(){return this;}; |
| 3059 LinkTail$Element.prototype.is$Link$Type = function(){return this;}; |
| 3060 LinkTail$Element.prototype.is$Iterable = function(){return this;}; |
| 2951 // ********** Code for LinkTail$Node ************** | 3061 // ********** Code for LinkTail$Node ************** |
| 2952 function LinkTail$Node() { | 3062 function LinkTail$Node() { |
| 2953 // Initializers done | 3063 // Initializers done |
| 2954 } | 3064 } |
| 2955 $inherits(LinkTail$Node, LinkTail); | 3065 $inherits(LinkTail$Node, LinkTail); |
| 3066 LinkTail$Node.prototype.is$Link = function(){return this;}; |
| 3067 LinkTail$Node.prototype.is$Link$DeclarationBuilder = function(){return this;}; |
| 3068 LinkTail$Node.prototype.is$Link$Element = function(){return this;}; |
| 3069 LinkTail$Node.prototype.is$Link$Node = function(){return this;}; |
| 3070 LinkTail$Node.prototype.is$Link$T = function(){return this;}; |
| 3071 LinkTail$Node.prototype.is$Link$Type = function(){return this;}; |
| 3072 LinkTail$Node.prototype.is$Iterable = function(){return this;}; |
| 2956 // ********** Code for LinkEntry ************** | 3073 // ********** Code for LinkEntry ************** |
| 2957 function LinkEntry(head, realTail) { | 3074 function LinkEntry(head, realTail) { |
| 2958 this.head = head; | 3075 this.head = head; |
| 2959 this.realTail = realTail; | 3076 this.realTail = realTail; |
| 2960 // Initializers done | 3077 // Initializers done |
| 2961 } | 3078 } |
| 2962 $inherits(LinkEntry, AbstractLink$T); | 3079 $inherits(LinkEntry, AbstractLink$T); |
| 2963 LinkEntry.prototype.get$head = function() { return this.head; }; | 3080 LinkEntry.prototype.get$head = function() { return this.head; }; |
| 2964 LinkEntry.prototype.get$tail = function() { | 3081 LinkEntry.prototype.get$tail = function() { |
| 2965 return this.realTail; | 3082 return this.realTail; |
| 2966 } | 3083 } |
| 2967 LinkEntry.prototype.isEmpty = function() { | 3084 LinkEntry.prototype.isEmpty = function() { |
| 2968 return false; | 3085 return false; |
| 2969 } | 3086 } |
| 2970 LinkEntry.prototype.toList = function() { | 3087 LinkEntry.prototype.toList = function() { |
| 3088 var $0; |
| 2971 var list = new ListFactory$T(); | 3089 var list = new ListFactory$T(); |
| 2972 for (var link = this; | 3090 for (var link = this; |
| 2973 !link.isEmpty(); link = link.get$tail()) { | 3091 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
T())) { |
| 2974 list.addLast(link.get$head()); | 3092 list.addLast(link.get$head()); |
| 2975 } | 3093 } |
| 2976 return list; | 3094 return list; |
| 2977 } | 3095 } |
| 2978 // ********** Code for LinkEntry$T ************** | 3096 // ********** Code for LinkEntry$T ************** |
| 2979 function LinkEntry$T(head, realTail) { | 3097 function LinkEntry$T(head, realTail) { |
| 2980 this.head = head; | 3098 this.head = head; |
| 2981 this.realTail = realTail; | 3099 this.realTail = realTail; |
| 2982 // Initializers done | 3100 // Initializers done |
| 2983 } | 3101 } |
| 2984 $inherits(LinkEntry$T, LinkEntry); | 3102 $inherits(LinkEntry$T, LinkEntry); |
| 2985 // ********** Code for LinkBuilderImplementation ************** | 3103 // ********** Code for LinkBuilderImplementation ************** |
| 2986 function LinkBuilderImplementation() { | 3104 function LinkBuilderImplementation() { |
| 2987 this.head = null | 3105 this.head = null |
| 2988 this.lastLink = null | 3106 this.lastLink = null |
| 2989 // Initializers done | 3107 // Initializers done |
| 2990 } | 3108 } |
| 2991 LinkBuilderImplementation.prototype.get$head = function() { return this.head; }; | 3109 LinkBuilderImplementation.prototype.get$head = function() { return this.head; }; |
| 2992 LinkBuilderImplementation.prototype.set$head = function(value) { return this.hea
d = value; }; | 3110 LinkBuilderImplementation.prototype.set$head = function(value) { return this.hea
d = value; }; |
| 2993 LinkBuilderImplementation.prototype.toLink = function() { | 3111 LinkBuilderImplementation.prototype.toLink = function() { |
| 2994 if (this.head == null) return const$227/*const EmptyLink<DeclarationBuilder>()
*/; | 3112 if ($notnull_bool(this.head == null)) return const$227/*const EmptyLink<Declar
ationBuilder>()*/; |
| 2995 this.lastLink.realTail = const$227/*const EmptyLink<DeclarationBuilder>()*/; | 3113 this.lastLink.realTail = const$227/*const EmptyLink<DeclarationBuilder>()*/; |
| 2996 var link = this.head; | 3114 var link = this.head; |
| 2997 this.lastLink = null; | 3115 this.lastLink = null; |
| 2998 this.head = null; | 3116 this.head = null; |
| 2999 return link; | 3117 return link; |
| 3000 } | 3118 } |
| 3001 LinkBuilderImplementation.prototype.addLast = function(t) { | 3119 LinkBuilderImplementation.prototype.addLast = function(t) { |
| 3002 var entry = new LinkEntry$T(t, null); | 3120 var entry = new LinkEntry$T(t, null); |
| 3003 if (this.head == null) { | 3121 if ($notnull_bool(this.head == null)) { |
| 3004 this.head = entry; | 3122 this.head = entry; |
| 3005 } | 3123 } |
| 3006 else { | 3124 else { |
| 3007 this.lastLink.realTail = entry; | 3125 this.lastLink.realTail = entry; |
| 3008 } | 3126 } |
| 3009 this.lastLink = entry; | 3127 this.lastLink = entry; |
| 3010 } | 3128 } |
| 3011 // ********** Code for LinkBuilderImplementation$Type ************** | 3129 // ********** Code for LinkBuilderImplementation$Type ************** |
| 3012 function LinkBuilderImplementation$Type() { | 3130 function LinkBuilderImplementation$Type() { |
| 3013 this.head = null | 3131 this.head = null |
| 3014 this.lastLink = null | 3132 this.lastLink = null |
| 3015 // Initializers done | 3133 // Initializers done |
| 3016 } | 3134 } |
| 3017 $inherits(LinkBuilderImplementation$Type, LinkBuilderImplementation); | 3135 $inherits(LinkBuilderImplementation$Type, LinkBuilderImplementation); |
| 3018 // ********** Code for top level ************** | 3136 // ********** Code for top level ************** |
| 3019 // ********** Library util ************** | 3137 // ********** Library util ************** |
| 3020 // ********** Code for top level ************** | 3138 // ********** Code for top level ************** |
| 3021 // ********** Library scanner ************** | 3139 // ********** Library scanner ************** |
| 3022 // ********** Code for AbstractScanner ************** | 3140 // ********** Code for AbstractScanner ************** |
| 3023 function AbstractScanner() {} | 3141 function AbstractScanner() {} |
| 3024 AbstractScanner.prototype.tokenize = function() { | 3142 AbstractScanner.prototype.tokenize = function() { |
| 3025 var next = this.advance(); | 3143 var next = this.advance(); |
| 3026 while (next != -1) { | 3144 while ($notnull_bool(next != -1)) { |
| 3027 next = this.bigSwitch(next); | 3145 next = this.bigSwitch(next); |
| 3028 } | 3146 } |
| 3029 this.appendEofToken(); | 3147 this.appendEofToken(); |
| 3030 return this.firstToken(); | 3148 return this.firstToken(); |
| 3031 } | 3149 } |
| 3032 AbstractScanner.prototype.bigSwitch = function(next) { | 3150 AbstractScanner.prototype.bigSwitch = function(next) { |
| 3033 this.beginToken(); | 3151 this.beginToken(); |
| 3034 switch (next) { | 3152 switch (next) { |
| 3035 case 9/*null.$TAB*/: | 3153 case 9/*null.$TAB*/: |
| 3036 case 10/*null.$LF*/: | 3154 case 10/*null.$LF*/: |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3236 case 118/*null.$v*/: | 3354 case 118/*null.$v*/: |
| 3237 case 119/*null.$w*/: | 3355 case 119/*null.$w*/: |
| 3238 case 120/*null.$x*/: | 3356 case 120/*null.$x*/: |
| 3239 case 121/*null.$y*/: | 3357 case 121/*null.$y*/: |
| 3240 case 122/*null.$z*/: | 3358 case 122/*null.$z*/: |
| 3241 | 3359 |
| 3242 return this.tokenizeIdentifier(next); | 3360 return this.tokenizeIdentifier(next); |
| 3243 | 3361 |
| 3244 default: | 3362 default: |
| 3245 | 3363 |
| 3246 if (next == -1) { | 3364 if ($notnull_bool(next == -1)) { |
| 3247 return -1; | 3365 return -1; |
| 3248 } | 3366 } |
| 3249 if (next < 0x1f) { | 3367 if ($notnull_bool(next < 0x1f)) { |
| 3250 $throw(new MalformedInputException(this.get$charOffset())); | 3368 $throw(new MalformedInputException(this.get$charOffset())); |
| 3251 } | 3369 } |
| 3252 return this.tokenizeIdentifier(next); | 3370 return this.tokenizeIdentifier(next); |
| 3253 | 3371 |
| 3254 } | 3372 } |
| 3255 } | 3373 } |
| 3256 AbstractScanner.prototype.tokenizeTag = function(next) { | 3374 AbstractScanner.prototype.tokenizeTag = function(next) { |
| 3257 if (this.get$byteOffset() == 0) { | 3375 if ($notnull_bool(this.get$byteOffset() == 0)) { |
| 3258 if (this.peek() == 33/*null.$BANG*/) { | 3376 if ($notnull_bool(this.peek() == 33/*null.$BANG*/)) { |
| 3259 do { | 3377 do { |
| 3260 next = this.advance(); | 3378 next = this.advance(); |
| 3261 } | 3379 } |
| 3262 while (next != 10/*null.$LF*/ && next != 13/*null.$CR*/) | 3380 while ($notnull_bool(next != 10/*null.$LF*/ && next != 13/*null.$CR*/)) |
| 3263 return next; | 3381 return next; |
| 3264 } | 3382 } |
| 3265 } | 3383 } |
| 3266 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); | 3384 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); |
| 3267 return this.advance(); | 3385 return this.advance(); |
| 3268 } | 3386 } |
| 3269 AbstractScanner.prototype.tokenizeTilde = function(next) { | 3387 AbstractScanner.prototype.tokenizeTilde = function(next) { |
| 3270 next = this.advance(); | 3388 next = this.advance(); |
| 3271 if (next == 47/*null.$SLASH*/) { | 3389 if ($notnull_bool(next == 47/*null.$SLASH*/)) { |
| 3272 return this.select(61/*null.$EQ*/, "~/=", "~/"); | 3390 return this.select(61/*null.$EQ*/, "~/=", "~/"); |
| 3273 } | 3391 } |
| 3274 else { | 3392 else { |
| 3275 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); | 3393 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); |
| 3276 return next; | 3394 return next; |
| 3277 } | 3395 } |
| 3278 } | 3396 } |
| 3279 AbstractScanner.prototype.tokenizeOpenBracket = function(next) { | 3397 AbstractScanner.prototype.tokenizeOpenBracket = function(next) { |
| 3280 next = this.advance(); | 3398 next = this.advance(); |
| 3281 if (next == 93/*null.$RBRACKET*/) { | 3399 if ($notnull_bool(next == 93/*null.$RBRACKET*/)) { |
| 3282 return this.select(61/*null.$EQ*/, "[]=", "[]"); | 3400 return this.select(61/*null.$EQ*/, "[]=", "[]"); |
| 3283 } | 3401 } |
| 3284 else { | 3402 else { |
| 3285 this.appendStringToken(93/*null.RBRACKET_TOKEN*/, "["); | 3403 this.appendStringToken(93/*null.RBRACKET_TOKEN*/, "["); |
| 3286 return next; | 3404 return next; |
| 3287 } | 3405 } |
| 3288 } | 3406 } |
| 3289 AbstractScanner.prototype.tokenizeCaret = function(next) { | 3407 AbstractScanner.prototype.tokenizeCaret = function(next) { |
| 3290 return this.select(61/*null.$EQ*/, "^=", "^"); | 3408 return this.select(61/*null.$EQ*/, "^=", "^"); |
| 3291 } | 3409 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3370 | 3488 |
| 3371 default: | 3489 default: |
| 3372 | 3490 |
| 3373 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); | 3491 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); |
| 3374 return next; | 3492 return next; |
| 3375 | 3493 |
| 3376 } | 3494 } |
| 3377 } | 3495 } |
| 3378 AbstractScanner.prototype.tokenizeExclamation = function(next) { | 3496 AbstractScanner.prototype.tokenizeExclamation = function(next) { |
| 3379 next = this.advance(); | 3497 next = this.advance(); |
| 3380 if (next == 61/*null.$EQ*/) { | 3498 if ($notnull_bool(next == 61/*null.$EQ*/)) { |
| 3381 return this.select(61/*null.$EQ*/, "!==", "!="); | 3499 return this.select(61/*null.$EQ*/, "!==", "!="); |
| 3382 } | 3500 } |
| 3383 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); | 3501 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); |
| 3384 return next; | 3502 return next; |
| 3385 } | 3503 } |
| 3386 AbstractScanner.prototype.tokenizeEquals = function(next) { | 3504 AbstractScanner.prototype.tokenizeEquals = function(next) { |
| 3387 next = this.advance(); | 3505 next = this.advance(); |
| 3388 if (next == 61/*null.$EQ*/) { | 3506 if ($notnull_bool(next == 61/*null.$EQ*/)) { |
| 3389 return this.select(61/*null.$EQ*/, "===", "=="); | 3507 return this.select(61/*null.$EQ*/, "===", "=="); |
| 3390 } | 3508 } |
| 3391 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); | 3509 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); |
| 3392 return next; | 3510 return next; |
| 3393 } | 3511 } |
| 3394 AbstractScanner.prototype.tokenizeGreaterThan = function(next) { | 3512 AbstractScanner.prototype.tokenizeGreaterThan = function(next) { |
| 3395 next = this.advance(); | 3513 next = this.advance(); |
| 3396 switch (next) { | 3514 switch (next) { |
| 3397 case 61/*null.$EQ*/: | 3515 case 61/*null.$EQ*/: |
| 3398 | 3516 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3441 | 3559 |
| 3442 default: | 3560 default: |
| 3443 | 3561 |
| 3444 this.appendStringToken(60/*null.LT_TOKEN*/, "<"); | 3562 this.appendStringToken(60/*null.LT_TOKEN*/, "<"); |
| 3445 return next; | 3563 return next; |
| 3446 | 3564 |
| 3447 } | 3565 } |
| 3448 } | 3566 } |
| 3449 AbstractScanner.prototype.tokenizeNumber = function(next) { | 3567 AbstractScanner.prototype.tokenizeNumber = function(next) { |
| 3450 var start = this.get$byteOffset(); | 3568 var start = this.get$byteOffset(); |
| 3451 while (true) { | 3569 while ($notnull_bool(true)) { |
| 3452 next = this.advance(); | 3570 next = this.advance(); |
| 3453 switch (next) { | 3571 switch (next) { |
| 3454 case 48/*null.$0*/: | 3572 case 48/*null.$0*/: |
| 3455 case 49/*null.$1*/: | 3573 case 49/*null.$1*/: |
| 3456 case 50/*null.$2*/: | 3574 case 50/*null.$2*/: |
| 3457 case 51/*null.$3*/: | 3575 case 51/*null.$3*/: |
| 3458 case 52/*null.$4*/: | 3576 case 52/*null.$4*/: |
| 3459 case 53/*null.$5*/: | 3577 case 53/*null.$5*/: |
| 3460 case 54/*null.$6*/: | 3578 case 54/*null.$6*/: |
| 3461 case 55/*null.$7*/: | 3579 case 55/*null.$7*/: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3478 default: | 3596 default: |
| 3479 | 3597 |
| 3480 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start
)); | 3598 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start
)); |
| 3481 return next; | 3599 return next; |
| 3482 | 3600 |
| 3483 } | 3601 } |
| 3484 } | 3602 } |
| 3485 } | 3603 } |
| 3486 AbstractScanner.prototype.tokenizeHexOrNumber = function(next) { | 3604 AbstractScanner.prototype.tokenizeHexOrNumber = function(next) { |
| 3487 var x = this.peek(); | 3605 var x = this.peek(); |
| 3488 if (x == 120/*null.$x*/ || x == 88/*null.$X*/) { | 3606 if ($notnull_bool(x == 120/*null.$x*/ || x == 88/*null.$X*/)) { |
| 3489 this.advance(); | 3607 this.advance(); |
| 3490 return this.tokenizeHex(x); | 3608 return this.tokenizeHex(x); |
| 3491 } | 3609 } |
| 3492 return this.tokenizeNumber(next); | 3610 return this.tokenizeNumber(next); |
| 3493 } | 3611 } |
| 3494 AbstractScanner.prototype.tokenizeHex = function(next) { | 3612 AbstractScanner.prototype.tokenizeHex = function(next) { |
| 3495 var start = this.get$byteOffset(); | 3613 var start = this.get$byteOffset(); |
| 3496 var hasDigits = false; | 3614 var hasDigits = false; |
| 3497 while (true) { | 3615 while ($notnull_bool(true)) { |
| 3498 next = this.advance(); | 3616 next = this.advance(); |
| 3499 switch (next) { | 3617 switch (next) { |
| 3500 case 48/*null.$0*/: | 3618 case 48/*null.$0*/: |
| 3501 case 49/*null.$1*/: | 3619 case 49/*null.$1*/: |
| 3502 case 50/*null.$2*/: | 3620 case 50/*null.$2*/: |
| 3503 case 51/*null.$3*/: | 3621 case 51/*null.$3*/: |
| 3504 case 52/*null.$4*/: | 3622 case 52/*null.$4*/: |
| 3505 case 53/*null.$5*/: | 3623 case 53/*null.$5*/: |
| 3506 case 54/*null.$6*/: | 3624 case 54/*null.$6*/: |
| 3507 case 55/*null.$7*/: | 3625 case 55/*null.$7*/: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3518 case 99/*null.$c*/: | 3636 case 99/*null.$c*/: |
| 3519 case 100/*null.$d*/: | 3637 case 100/*null.$d*/: |
| 3520 case 101/*null.$e*/: | 3638 case 101/*null.$e*/: |
| 3521 case 102/*null.$f*/: | 3639 case 102/*null.$f*/: |
| 3522 | 3640 |
| 3523 hasDigits = true; | 3641 hasDigits = true; |
| 3524 break; | 3642 break; |
| 3525 | 3643 |
| 3526 default: | 3644 default: |
| 3527 | 3645 |
| 3528 if (!hasDigits) { | 3646 if ($notnull_bool(!hasDigits)) { |
| 3529 $throw(new MalformedInputException(this.get$charOffset())); | 3647 $throw(new MalformedInputException(this.get$charOffset())); |
| 3530 } | 3648 } |
| 3531 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); | 3649 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); |
| 3532 return next; | 3650 return next; |
| 3533 | 3651 |
| 3534 } | 3652 } |
| 3535 } | 3653 } |
| 3536 } | 3654 } |
| 3537 AbstractScanner.prototype.tokenizeDotOrNumber = function(next) { | 3655 AbstractScanner.prototype.tokenizeDotOrNumber = function(next) { |
| 3538 var start = this.get$byteOffset(); | 3656 var start = this.get$byteOffset(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3560 default: | 3678 default: |
| 3561 | 3679 |
| 3562 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 3680 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 3563 return next; | 3681 return next; |
| 3564 | 3682 |
| 3565 } | 3683 } |
| 3566 } | 3684 } |
| 3567 AbstractScanner.prototype.tokenizeFractionPart = function(next, start) { | 3685 AbstractScanner.prototype.tokenizeFractionPart = function(next, start) { |
| 3568 var done = false; | 3686 var done = false; |
| 3569 LOOP: | 3687 LOOP: |
| 3570 while (!done) { | 3688 while ($notnull_bool(!done)) { |
| 3571 switch (next) { | 3689 switch (next) { |
| 3572 case 48/*null.$0*/: | 3690 case 48/*null.$0*/: |
| 3573 case 49/*null.$1*/: | 3691 case 49/*null.$1*/: |
| 3574 case 50/*null.$2*/: | 3692 case 50/*null.$2*/: |
| 3575 case 51/*null.$3*/: | 3693 case 51/*null.$3*/: |
| 3576 case 52/*null.$4*/: | 3694 case 52/*null.$4*/: |
| 3577 case 53/*null.$5*/: | 3695 case 53/*null.$5*/: |
| 3578 case 54/*null.$6*/: | 3696 case 54/*null.$6*/: |
| 3579 case 55/*null.$7*/: | 3697 case 55/*null.$7*/: |
| 3580 case 56/*null.$8*/: | 3698 case 56/*null.$8*/: |
| 3581 case 57/*null.$9*/: | 3699 case 57/*null.$9*/: |
| 3582 | 3700 |
| 3583 break; | 3701 break; |
| 3584 | 3702 |
| 3585 case 101/*null.$e*/: | 3703 case 101/*null.$e*/: |
| 3586 case 69/*null.$E*/: | 3704 case 69/*null.$E*/: |
| 3587 | 3705 |
| 3588 next = this.tokenizeExponent(this.advance()); | 3706 next = this.tokenizeExponent(this.advance()); |
| 3589 done = true; | 3707 done = true; |
| 3590 continue LOOP; | 3708 continue LOOP; |
| 3591 | 3709 |
| 3592 default: | 3710 default: |
| 3593 | 3711 |
| 3594 done = true; | 3712 done = true; |
| 3595 continue LOOP; | 3713 continue LOOP; |
| 3596 | 3714 |
| 3597 } | 3715 } |
| 3598 next = this.advance(); | 3716 next = this.advance(); |
| 3599 } | 3717 } |
| 3600 if (next == 100/*null.$d*/ || next == 68/*null.$D*/) { | 3718 if ($notnull_bool(next == 100/*null.$d*/ || next == 68/*null.$D*/)) { |
| 3601 next = this.advance(); | 3719 next = this.advance(); |
| 3602 } | 3720 } |
| 3603 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); | 3721 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); |
| 3604 return next; | 3722 return next; |
| 3605 } | 3723 } |
| 3606 AbstractScanner.prototype.tokenizeExponent = function(next) { | 3724 AbstractScanner.prototype.tokenizeExponent = function(next) { |
| 3607 if (next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/) { | 3725 if ($notnull_bool(next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/)) { |
| 3608 next = this.advance(); | 3726 next = this.advance(); |
| 3609 } | 3727 } |
| 3610 var hasDigits = false; | 3728 var hasDigits = false; |
| 3611 while (true) { | 3729 while ($notnull_bool(true)) { |
| 3612 switch (next) { | 3730 switch (next) { |
| 3613 case 48/*null.$0*/: | 3731 case 48/*null.$0*/: |
| 3614 case 49/*null.$1*/: | 3732 case 49/*null.$1*/: |
| 3615 case 50/*null.$2*/: | 3733 case 50/*null.$2*/: |
| 3616 case 51/*null.$3*/: | 3734 case 51/*null.$3*/: |
| 3617 case 52/*null.$4*/: | 3735 case 52/*null.$4*/: |
| 3618 case 53/*null.$5*/: | 3736 case 53/*null.$5*/: |
| 3619 case 54/*null.$6*/: | 3737 case 54/*null.$6*/: |
| 3620 case 55/*null.$7*/: | 3738 case 55/*null.$7*/: |
| 3621 case 56/*null.$8*/: | 3739 case 56/*null.$8*/: |
| 3622 case 57/*null.$9*/: | 3740 case 57/*null.$9*/: |
| 3623 | 3741 |
| 3624 hasDigits = true; | 3742 hasDigits = true; |
| 3625 break; | 3743 break; |
| 3626 | 3744 |
| 3627 default: | 3745 default: |
| 3628 | 3746 |
| 3629 if (!hasDigits) { | 3747 if ($notnull_bool(!hasDigits)) { |
| 3630 $throw(new MalformedInputException(this.get$charOffset())); | 3748 $throw(new MalformedInputException(this.get$charOffset())); |
| 3631 } | 3749 } |
| 3632 return next; | 3750 return next; |
| 3633 | 3751 |
| 3634 } | 3752 } |
| 3635 next = this.advance(); | 3753 next = this.advance(); |
| 3636 } | 3754 } |
| 3637 } | 3755 } |
| 3638 AbstractScanner.prototype.tokenizeSlashOrComment = function(next) { | 3756 AbstractScanner.prototype.tokenizeSlashOrComment = function(next) { |
| 3639 next = this.advance(); | 3757 next = this.advance(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3652 return this.advance(); | 3770 return this.advance(); |
| 3653 | 3771 |
| 3654 default: | 3772 default: |
| 3655 | 3773 |
| 3656 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); | 3774 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); |
| 3657 return next; | 3775 return next; |
| 3658 | 3776 |
| 3659 } | 3777 } |
| 3660 } | 3778 } |
| 3661 AbstractScanner.prototype.tokenizeSingleLineComment = function(next) { | 3779 AbstractScanner.prototype.tokenizeSingleLineComment = function(next) { |
| 3662 while (true) { | 3780 while ($notnull_bool(true)) { |
| 3663 next = this.advance(); | 3781 next = this.advance(); |
| 3664 switch (next) { | 3782 switch (next) { |
| 3665 case -1: | 3783 case -1: |
| 3666 case 10/*null.$LF*/: | 3784 case 10/*null.$LF*/: |
| 3667 case 13/*null.$CR*/: | 3785 case 13/*null.$CR*/: |
| 3668 | 3786 |
| 3669 return next; | 3787 return next; |
| 3670 | 3788 |
| 3671 } | 3789 } |
| 3672 } | 3790 } |
| 3673 } | 3791 } |
| 3674 AbstractScanner.prototype.tokenizeMultiLineComment = function(next) { | 3792 AbstractScanner.prototype.tokenizeMultiLineComment = function(next) { |
| 3675 next = this.advance(); | 3793 next = this.advance(); |
| 3676 while (true) { | 3794 while ($notnull_bool(true)) { |
| 3677 switch (next) { | 3795 switch (next) { |
| 3678 case -1: | 3796 case -1: |
| 3679 | 3797 |
| 3680 return next; | 3798 return next; |
| 3681 | 3799 |
| 3682 case 42/*null.$STAR*/: | 3800 case 42/*null.$STAR*/: |
| 3683 | 3801 |
| 3684 next = this.advance(); | 3802 next = this.advance(); |
| 3685 if (next == 47/*null.$SLASH*/) { | 3803 if ($notnull_bool(next == 47/*null.$SLASH*/)) { |
| 3686 return this.advance(); | 3804 return this.advance(); |
| 3687 } | 3805 } |
| 3688 else if (next == -1) { | 3806 else if ($notnull_bool(next == -1)) { |
| 3689 return next; | 3807 return next; |
| 3690 } | 3808 } |
| 3691 break; | 3809 break; |
| 3692 | 3810 |
| 3693 default: | 3811 default: |
| 3694 | 3812 |
| 3695 next = this.advance(); | 3813 next = this.advance(); |
| 3696 break; | 3814 break; |
| 3697 | 3815 |
| 3698 } | 3816 } |
| 3699 } | 3817 } |
| 3700 } | 3818 } |
| 3701 AbstractScanner.prototype.tokenizeIdentifier = function(next) { | 3819 AbstractScanner.prototype.tokenizeIdentifier = function(next) { |
| 3702 var start = this.get$byteOffset(); | 3820 var start = this.get$byteOffset(); |
| 3703 var state = null; | 3821 var state = null; |
| 3704 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { | 3822 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { |
| 3705 state = KeywordState.get$KEYWORD_STATE().next(next); | 3823 state = KeywordState.get$KEYWORD_STATE().next(next); |
| 3706 next = this.advance(); | 3824 next = this.advance(); |
| 3707 } | 3825 } |
| 3708 var isAscii = true; | 3826 var isAscii = true; |
| 3709 while (true) { | 3827 while ($notnull_bool(true)) { |
| 3710 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { | 3828 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { |
| 3711 if (state != null) { | 3829 if ($notnull_bool(state != null)) { |
| 3712 state = state.next(next); | 3830 state = state.next(next); |
| 3713 } | 3831 } |
| 3714 } | 3832 } |
| 3715 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*/) { | 3833 else if ($notnull_bool((48/*null.$0*/ <= next && next <= 57/*null.$9*/) || (
65/*null.$A*/ <= next && next <= 90/*null.$Z*/) || next == 95/*null.$_*/ || next
== 36/*null.$DOLLAR*/)) { |
| 3716 state = null; | 3834 state = null; |
| 3717 } | 3835 } |
| 3718 else if (next < 128) { | 3836 else if ($notnull_bool(next < 128)) { |
| 3719 if (state != null && state.isLeaf()) { | 3837 if ($notnull_bool(state != null && state.isLeaf())) { |
| 3720 this.appendKeywordToken(state.get$keyword()); | 3838 this.appendKeywordToken(state.get$keyword()); |
| 3721 } | 3839 } |
| 3722 else if (isAscii) { | 3840 else if ($notnull_bool(isAscii)) { |
| 3723 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString
(start)); | 3841 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString
(start)); |
| 3724 } | 3842 } |
| 3725 else { | 3843 else { |
| 3726 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String(
start, -1)); | 3844 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String(
start, -1)); |
| 3727 } | 3845 } |
| 3728 return next; | 3846 return next; |
| 3729 } | 3847 } |
| 3730 else { | 3848 else { |
| 3731 var nonAsciiStart = this.get$byteOffset(); | 3849 var nonAsciiStart = this.get$byteOffset(); |
| 3732 do { | 3850 do { |
| 3733 next = this.nextByte(); | 3851 next = this.nextByte(); |
| 3734 } | 3852 } |
| 3735 while (next > 127) | 3853 while ($notnull_bool(next > 127)) |
| 3736 var string = this.utf8String(nonAsciiStart, -1).toString(); | 3854 var string = this.utf8String(nonAsciiStart, -1).toString(); |
| 3737 isAscii = false; | 3855 isAscii = false; |
| 3738 this.addToCharOffset(string.length); | 3856 this.addToCharOffset(string.length); |
| 3739 return next; | 3857 return next; |
| 3740 } | 3858 } |
| 3741 next = this.advance(); | 3859 next = this.advance(); |
| 3742 } | 3860 } |
| 3743 } | 3861 } |
| 3744 AbstractScanner.prototype.tokenizeRawString = function(next) { | 3862 AbstractScanner.prototype.tokenizeRawString = function(next) { |
| 3745 var start = this.get$byteOffset(); | 3863 var start = this.get$byteOffset(); |
| 3746 next = this.advance(); | 3864 next = this.advance(); |
| 3747 if (next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/) { | 3865 if ($notnull_bool(next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/)) { |
| 3748 return this.tokenizeString(next, start, true); | 3866 return this.tokenizeString(next, start, true); |
| 3749 } | 3867 } |
| 3750 else { | 3868 else { |
| 3751 $throw(new MalformedInputException(this.get$charOffset())); | 3869 $throw(new MalformedInputException(this.get$charOffset())); |
| 3752 } | 3870 } |
| 3753 } | 3871 } |
| 3754 AbstractScanner.prototype.tokenizeString = function(next, start, raw) { | 3872 AbstractScanner.prototype.tokenizeString = function(next, start, raw) { |
| 3755 var q = next; | 3873 var q = next; |
| 3756 next = this.advance(); | 3874 next = this.advance(); |
| 3757 if (q == next) { | 3875 if ($notnull_bool(q == next)) { |
| 3758 next = this.advance(); | 3876 next = this.advance(); |
| 3759 if (q == next) { | 3877 if ($notnull_bool(q == next)) { |
| 3760 return this.tokenizeMultiLineString(q, start, raw); | 3878 return this.tokenizeMultiLineString(q, start, raw); |
| 3761 } | 3879 } |
| 3762 else { | 3880 else { |
| 3763 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
-1)); | 3881 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
-1)); |
| 3764 return next; | 3882 return next; |
| 3765 } | 3883 } |
| 3766 } | 3884 } |
| 3767 if (raw) { | 3885 if ($notnull_bool(raw)) { |
| 3768 return this.tokenizeSingleLineRawString(next, q, start); | 3886 return this.tokenizeSingleLineRawString(next, q, start); |
| 3769 } | 3887 } |
| 3770 else { | 3888 else { |
| 3771 return this.tokenizeSingleLineString(next, q, start); | 3889 return this.tokenizeSingleLineString(next, q, start); |
| 3772 } | 3890 } |
| 3773 } | 3891 } |
| 3774 AbstractScanner.prototype.tokenizeSingleLineString = function(next, q1, start) { | 3892 AbstractScanner.prototype.tokenizeSingleLineString = function(next, q1, start) { |
| 3775 while (next != -1) { | 3893 while ($notnull_bool(next != -1)) { |
| 3776 if (next == q1) { | 3894 if ($notnull_bool(next == q1)) { |
| 3777 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); | 3895 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); |
| 3778 return this.advance(); | 3896 return this.advance(); |
| 3779 } | 3897 } |
| 3780 else if (next == 92/*null.$BACKSLASH*/) { | 3898 else if ($notnull_bool(next == 92/*null.$BACKSLASH*/)) { |
| 3781 next = this.advance(); | 3899 next = this.advance(); |
| 3782 if (next == -1) { | 3900 if ($notnull_bool(next == -1)) { |
| 3783 $throw(new MalformedInputException(this.get$charOffset())); | 3901 $throw(new MalformedInputException(this.get$charOffset())); |
| 3784 } | 3902 } |
| 3785 } | 3903 } |
| 3786 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { | 3904 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { |
| 3787 $throw(new MalformedInputException(this.get$charOffset())); | 3905 $throw(new MalformedInputException(this.get$charOffset())); |
| 3788 } | 3906 } |
| 3789 next = this.advance(); | 3907 next = this.advance(); |
| 3790 } | 3908 } |
| 3791 $throw(new MalformedInputException(this.get$charOffset())); | 3909 $throw(new MalformedInputException(this.get$charOffset())); |
| 3792 } | 3910 } |
| 3793 AbstractScanner.prototype.tokenizeSingleLineRawString = function(next, q1, start
) { | 3911 AbstractScanner.prototype.tokenizeSingleLineRawString = function(next, q1, start
) { |
| 3794 next = this.advance(); | 3912 next = this.advance(); |
| 3795 while (next != -1) { | 3913 while ($notnull_bool(next != -1)) { |
| 3796 if (next == q1) { | 3914 if ($notnull_bool(next == q1)) { |
| 3797 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); | 3915 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); |
| 3798 return this.advance(); | 3916 return this.advance(); |
| 3799 } | 3917 } |
| 3800 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { | 3918 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { |
| 3801 $throw(new MalformedInputException(this.get$charOffset())); | 3919 $throw(new MalformedInputException(this.get$charOffset())); |
| 3802 } | 3920 } |
| 3803 next = this.advance(); | 3921 next = this.advance(); |
| 3804 } | 3922 } |
| 3805 $throw(new MalformedInputException(this.get$charOffset())); | 3923 $throw(new MalformedInputException(this.get$charOffset())); |
| 3806 } | 3924 } |
| 3807 AbstractScanner.prototype.tokenizeMultiLineString = function(q, start, raw) { | 3925 AbstractScanner.prototype.tokenizeMultiLineString = function(q, start, raw) { |
| 3808 var next = this.advance(); | 3926 var next = this.advance(); |
| 3809 while (next != -1) { | 3927 while ($notnull_bool(next != -1)) { |
| 3810 if (next == q) { | 3928 if ($notnull_bool(next == q)) { |
| 3811 next = this.advance(); | 3929 next = this.advance(); |
| 3812 if (next == q) { | 3930 if ($notnull_bool(next == q)) { |
| 3813 next = this.advance(); | 3931 next = this.advance(); |
| 3814 if (next == q) { | 3932 if ($notnull_bool(next == q)) { |
| 3815 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st
art, 0)); | 3933 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st
art, 0)); |
| 3816 return this.advance(); | 3934 return this.advance(); |
| 3817 } | 3935 } |
| 3818 } | 3936 } |
| 3819 } | 3937 } |
| 3820 next = this.advance(); | 3938 next = this.advance(); |
| 3821 } | 3939 } |
| 3822 return next; | 3940 return next; |
| 3823 } | 3941 } |
| 3824 // ********** Code for AbstractScanner$S ************** | 3942 // ********** Code for AbstractScanner$S ************** |
| 3825 function AbstractScanner$S() {} | 3943 function AbstractScanner$S() {} |
| 3826 $inherits(AbstractScanner$S, AbstractScanner); | 3944 $inherits(AbstractScanner$S, AbstractScanner); |
| 3827 AbstractScanner$S.prototype.tokenize = function() { | 3945 AbstractScanner$S.prototype.tokenize = function() { |
| 3828 var next = this.advance(); | 3946 var next = this.advance(); |
| 3829 while (next != -1) { | 3947 while ($notnull_bool(next != -1)) { |
| 3830 next = this.bigSwitch(next); | 3948 next = this.bigSwitch(next); |
| 3831 } | 3949 } |
| 3832 this.appendEofToken(); | 3950 this.appendEofToken(); |
| 3833 return this.firstToken(); | 3951 return this.firstToken(); |
| 3834 } | 3952 } |
| 3835 AbstractScanner$S.prototype.bigSwitch = function(next) { | 3953 AbstractScanner$S.prototype.bigSwitch = function(next) { |
| 3836 this.beginToken(); | 3954 this.beginToken(); |
| 3837 switch (next) { | 3955 switch (next) { |
| 3838 case 9/*null.$TAB*/: | 3956 case 9/*null.$TAB*/: |
| 3839 case 10/*null.$LF*/: | 3957 case 10/*null.$LF*/: |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4039 case 118/*null.$v*/: | 4157 case 118/*null.$v*/: |
| 4040 case 119/*null.$w*/: | 4158 case 119/*null.$w*/: |
| 4041 case 120/*null.$x*/: | 4159 case 120/*null.$x*/: |
| 4042 case 121/*null.$y*/: | 4160 case 121/*null.$y*/: |
| 4043 case 122/*null.$z*/: | 4161 case 122/*null.$z*/: |
| 4044 | 4162 |
| 4045 return this.tokenizeIdentifier(next); | 4163 return this.tokenizeIdentifier(next); |
| 4046 | 4164 |
| 4047 default: | 4165 default: |
| 4048 | 4166 |
| 4049 if (next == -1) { | 4167 if ($notnull_bool(next == -1)) { |
| 4050 return -1; | 4168 return -1; |
| 4051 } | 4169 } |
| 4052 if (next < 0x1f) { | 4170 if ($notnull_bool(next < 0x1f)) { |
| 4053 $throw(new MalformedInputException(this.get$charOffset())); | 4171 $throw(new MalformedInputException(this.get$charOffset())); |
| 4054 } | 4172 } |
| 4055 return this.tokenizeIdentifier(next); | 4173 return this.tokenizeIdentifier(next); |
| 4056 | 4174 |
| 4057 } | 4175 } |
| 4058 } | 4176 } |
| 4059 AbstractScanner$S.prototype.tokenizeTag = function(next) { | 4177 AbstractScanner$S.prototype.tokenizeTag = function(next) { |
| 4060 if (this.get$byteOffset() == 0) { | 4178 if ($notnull_bool(this.get$byteOffset() == 0)) { |
| 4061 if (this.peek() == 33/*null.$BANG*/) { | 4179 if ($notnull_bool(this.peek() == 33/*null.$BANG*/)) { |
| 4062 do { | 4180 do { |
| 4063 next = this.advance(); | 4181 next = this.advance(); |
| 4064 } | 4182 } |
| 4065 while (next != 10/*null.$LF*/ && next != 13/*null.$CR*/) | 4183 while ($notnull_bool(next != 10/*null.$LF*/ && next != 13/*null.$CR*/)) |
| 4066 return next; | 4184 return next; |
| 4067 } | 4185 } |
| 4068 } | 4186 } |
| 4069 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); | 4187 this.appendStringToken(35/*null.HASH_TOKEN*/, "#"); |
| 4070 return this.advance(); | 4188 return this.advance(); |
| 4071 } | 4189 } |
| 4072 AbstractScanner$S.prototype.tokenizeTilde = function(next) { | 4190 AbstractScanner$S.prototype.tokenizeTilde = function(next) { |
| 4073 next = this.advance(); | 4191 next = this.advance(); |
| 4074 if (next == 47/*null.$SLASH*/) { | 4192 if ($notnull_bool(next == 47/*null.$SLASH*/)) { |
| 4075 return this.select(61/*null.$EQ*/, "~/=", "~/"); | 4193 return this.select(61/*null.$EQ*/, "~/=", "~/"); |
| 4076 } | 4194 } |
| 4077 else { | 4195 else { |
| 4078 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); | 4196 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~"); |
| 4079 return next; | 4197 return next; |
| 4080 } | 4198 } |
| 4081 } | 4199 } |
| 4082 AbstractScanner$S.prototype.tokenizeOpenBracket = function(next) { | 4200 AbstractScanner$S.prototype.tokenizeOpenBracket = function(next) { |
| 4083 next = this.advance(); | 4201 next = this.advance(); |
| 4084 if (next == 93/*null.$RBRACKET*/) { | 4202 if ($notnull_bool(next == 93/*null.$RBRACKET*/)) { |
| 4085 return this.select(61/*null.$EQ*/, "[]=", "[]"); | 4203 return this.select(61/*null.$EQ*/, "[]=", "[]"); |
| 4086 } | 4204 } |
| 4087 else { | 4205 else { |
| 4088 this.appendStringToken(93/*null.RBRACKET_TOKEN*/, "["); | 4206 this.appendStringToken(93/*null.RBRACKET_TOKEN*/, "["); |
| 4089 return next; | 4207 return next; |
| 4090 } | 4208 } |
| 4091 } | 4209 } |
| 4092 AbstractScanner$S.prototype.tokenizeCaret = function(next) { | 4210 AbstractScanner$S.prototype.tokenizeCaret = function(next) { |
| 4093 return this.select(61/*null.$EQ*/, "^=", "^"); | 4211 return this.select(61/*null.$EQ*/, "^=", "^"); |
| 4094 } | 4212 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4173 | 4291 |
| 4174 default: | 4292 default: |
| 4175 | 4293 |
| 4176 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); | 4294 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+"); |
| 4177 return next; | 4295 return next; |
| 4178 | 4296 |
| 4179 } | 4297 } |
| 4180 } | 4298 } |
| 4181 AbstractScanner$S.prototype.tokenizeExclamation = function(next) { | 4299 AbstractScanner$S.prototype.tokenizeExclamation = function(next) { |
| 4182 next = this.advance(); | 4300 next = this.advance(); |
| 4183 if (next == 61/*null.$EQ*/) { | 4301 if ($notnull_bool(next == 61/*null.$EQ*/)) { |
| 4184 return this.select(61/*null.$EQ*/, "!==", "!="); | 4302 return this.select(61/*null.$EQ*/, "!==", "!="); |
| 4185 } | 4303 } |
| 4186 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); | 4304 this.appendStringToken(33/*null.BANG_TOKEN*/, "!"); |
| 4187 return next; | 4305 return next; |
| 4188 } | 4306 } |
| 4189 AbstractScanner$S.prototype.tokenizeEquals = function(next) { | 4307 AbstractScanner$S.prototype.tokenizeEquals = function(next) { |
| 4190 next = this.advance(); | 4308 next = this.advance(); |
| 4191 if (next == 61/*null.$EQ*/) { | 4309 if ($notnull_bool(next == 61/*null.$EQ*/)) { |
| 4192 return this.select(61/*null.$EQ*/, "===", "=="); | 4310 return this.select(61/*null.$EQ*/, "===", "=="); |
| 4193 } | 4311 } |
| 4194 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); | 4312 this.appendStringToken(61/*null.EQ_TOKEN*/, "="); |
| 4195 return next; | 4313 return next; |
| 4196 } | 4314 } |
| 4197 AbstractScanner$S.prototype.tokenizeGreaterThan = function(next) { | 4315 AbstractScanner$S.prototype.tokenizeGreaterThan = function(next) { |
| 4198 next = this.advance(); | 4316 next = this.advance(); |
| 4199 switch (next) { | 4317 switch (next) { |
| 4200 case 61/*null.$EQ*/: | 4318 case 61/*null.$EQ*/: |
| 4201 | 4319 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4244 | 4362 |
| 4245 default: | 4363 default: |
| 4246 | 4364 |
| 4247 this.appendStringToken(60/*null.LT_TOKEN*/, "<"); | 4365 this.appendStringToken(60/*null.LT_TOKEN*/, "<"); |
| 4248 return next; | 4366 return next; |
| 4249 | 4367 |
| 4250 } | 4368 } |
| 4251 } | 4369 } |
| 4252 AbstractScanner$S.prototype.tokenizeNumber = function(next) { | 4370 AbstractScanner$S.prototype.tokenizeNumber = function(next) { |
| 4253 var start = this.get$byteOffset(); | 4371 var start = this.get$byteOffset(); |
| 4254 while (true) { | 4372 while ($notnull_bool(true)) { |
| 4255 next = this.advance(); | 4373 next = this.advance(); |
| 4256 switch (next) { | 4374 switch (next) { |
| 4257 case 48/*null.$0*/: | 4375 case 48/*null.$0*/: |
| 4258 case 49/*null.$1*/: | 4376 case 49/*null.$1*/: |
| 4259 case 50/*null.$2*/: | 4377 case 50/*null.$2*/: |
| 4260 case 51/*null.$3*/: | 4378 case 51/*null.$3*/: |
| 4261 case 52/*null.$4*/: | 4379 case 52/*null.$4*/: |
| 4262 case 53/*null.$5*/: | 4380 case 53/*null.$5*/: |
| 4263 case 54/*null.$6*/: | 4381 case 54/*null.$6*/: |
| 4264 case 55/*null.$7*/: | 4382 case 55/*null.$7*/: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4281 default: | 4399 default: |
| 4282 | 4400 |
| 4283 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start
)); | 4401 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start
)); |
| 4284 return next; | 4402 return next; |
| 4285 | 4403 |
| 4286 } | 4404 } |
| 4287 } | 4405 } |
| 4288 } | 4406 } |
| 4289 AbstractScanner$S.prototype.tokenizeHexOrNumber = function(next) { | 4407 AbstractScanner$S.prototype.tokenizeHexOrNumber = function(next) { |
| 4290 var x = this.peek(); | 4408 var x = this.peek(); |
| 4291 if (x == 120/*null.$x*/ || x == 88/*null.$X*/) { | 4409 if ($notnull_bool(x == 120/*null.$x*/ || x == 88/*null.$X*/)) { |
| 4292 this.advance(); | 4410 this.advance(); |
| 4293 return this.tokenizeHex(x); | 4411 return this.tokenizeHex(x); |
| 4294 } | 4412 } |
| 4295 return this.tokenizeNumber(next); | 4413 return this.tokenizeNumber(next); |
| 4296 } | 4414 } |
| 4297 AbstractScanner$S.prototype.tokenizeHex = function(next) { | 4415 AbstractScanner$S.prototype.tokenizeHex = function(next) { |
| 4298 var start = this.get$byteOffset(); | 4416 var start = this.get$byteOffset(); |
| 4299 var hasDigits = false; | 4417 var hasDigits = false; |
| 4300 while (true) { | 4418 while ($notnull_bool(true)) { |
| 4301 next = this.advance(); | 4419 next = this.advance(); |
| 4302 switch (next) { | 4420 switch (next) { |
| 4303 case 48/*null.$0*/: | 4421 case 48/*null.$0*/: |
| 4304 case 49/*null.$1*/: | 4422 case 49/*null.$1*/: |
| 4305 case 50/*null.$2*/: | 4423 case 50/*null.$2*/: |
| 4306 case 51/*null.$3*/: | 4424 case 51/*null.$3*/: |
| 4307 case 52/*null.$4*/: | 4425 case 52/*null.$4*/: |
| 4308 case 53/*null.$5*/: | 4426 case 53/*null.$5*/: |
| 4309 case 54/*null.$6*/: | 4427 case 54/*null.$6*/: |
| 4310 case 55/*null.$7*/: | 4428 case 55/*null.$7*/: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4321 case 99/*null.$c*/: | 4439 case 99/*null.$c*/: |
| 4322 case 100/*null.$d*/: | 4440 case 100/*null.$d*/: |
| 4323 case 101/*null.$e*/: | 4441 case 101/*null.$e*/: |
| 4324 case 102/*null.$f*/: | 4442 case 102/*null.$f*/: |
| 4325 | 4443 |
| 4326 hasDigits = true; | 4444 hasDigits = true; |
| 4327 break; | 4445 break; |
| 4328 | 4446 |
| 4329 default: | 4447 default: |
| 4330 | 4448 |
| 4331 if (!hasDigits) { | 4449 if ($notnull_bool(!hasDigits)) { |
| 4332 $throw(new MalformedInputException(this.get$charOffset())); | 4450 $throw(new MalformedInputException(this.get$charOffset())); |
| 4333 } | 4451 } |
| 4334 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); | 4452 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); |
| 4335 return next; | 4453 return next; |
| 4336 | 4454 |
| 4337 } | 4455 } |
| 4338 } | 4456 } |
| 4339 } | 4457 } |
| 4340 AbstractScanner$S.prototype.tokenizeDotOrNumber = function(next) { | 4458 AbstractScanner$S.prototype.tokenizeDotOrNumber = function(next) { |
| 4341 var start = this.get$byteOffset(); | 4459 var start = this.get$byteOffset(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4363 default: | 4481 default: |
| 4364 | 4482 |
| 4365 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 4483 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 4366 return next; | 4484 return next; |
| 4367 | 4485 |
| 4368 } | 4486 } |
| 4369 } | 4487 } |
| 4370 AbstractScanner$S.prototype.tokenizeFractionPart = function(next, start) { | 4488 AbstractScanner$S.prototype.tokenizeFractionPart = function(next, start) { |
| 4371 var done = false; | 4489 var done = false; |
| 4372 LOOP: | 4490 LOOP: |
| 4373 while (!done) { | 4491 while ($notnull_bool(!done)) { |
| 4374 switch (next) { | 4492 switch (next) { |
| 4375 case 48/*null.$0*/: | 4493 case 48/*null.$0*/: |
| 4376 case 49/*null.$1*/: | 4494 case 49/*null.$1*/: |
| 4377 case 50/*null.$2*/: | 4495 case 50/*null.$2*/: |
| 4378 case 51/*null.$3*/: | 4496 case 51/*null.$3*/: |
| 4379 case 52/*null.$4*/: | 4497 case 52/*null.$4*/: |
| 4380 case 53/*null.$5*/: | 4498 case 53/*null.$5*/: |
| 4381 case 54/*null.$6*/: | 4499 case 54/*null.$6*/: |
| 4382 case 55/*null.$7*/: | 4500 case 55/*null.$7*/: |
| 4383 case 56/*null.$8*/: | 4501 case 56/*null.$8*/: |
| 4384 case 57/*null.$9*/: | 4502 case 57/*null.$9*/: |
| 4385 | 4503 |
| 4386 break; | 4504 break; |
| 4387 | 4505 |
| 4388 case 101/*null.$e*/: | 4506 case 101/*null.$e*/: |
| 4389 case 69/*null.$E*/: | 4507 case 69/*null.$E*/: |
| 4390 | 4508 |
| 4391 next = this.tokenizeExponent(this.advance()); | 4509 next = this.tokenizeExponent(this.advance()); |
| 4392 done = true; | 4510 done = true; |
| 4393 continue LOOP; | 4511 continue LOOP; |
| 4394 | 4512 |
| 4395 default: | 4513 default: |
| 4396 | 4514 |
| 4397 done = true; | 4515 done = true; |
| 4398 continue LOOP; | 4516 continue LOOP; |
| 4399 | 4517 |
| 4400 } | 4518 } |
| 4401 next = this.advance(); | 4519 next = this.advance(); |
| 4402 } | 4520 } |
| 4403 if (next == 100/*null.$d*/ || next == 68/*null.$D*/) { | 4521 if ($notnull_bool(next == 100/*null.$d*/ || next == 68/*null.$D*/)) { |
| 4404 next = this.advance(); | 4522 next = this.advance(); |
| 4405 } | 4523 } |
| 4406 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); | 4524 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start)); |
| 4407 return next; | 4525 return next; |
| 4408 } | 4526 } |
| 4409 AbstractScanner$S.prototype.tokenizeExponent = function(next) { | 4527 AbstractScanner$S.prototype.tokenizeExponent = function(next) { |
| 4410 if (next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/) { | 4528 if ($notnull_bool(next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/)) { |
| 4411 next = this.advance(); | 4529 next = this.advance(); |
| 4412 } | 4530 } |
| 4413 var hasDigits = false; | 4531 var hasDigits = false; |
| 4414 while (true) { | 4532 while ($notnull_bool(true)) { |
| 4415 switch (next) { | 4533 switch (next) { |
| 4416 case 48/*null.$0*/: | 4534 case 48/*null.$0*/: |
| 4417 case 49/*null.$1*/: | 4535 case 49/*null.$1*/: |
| 4418 case 50/*null.$2*/: | 4536 case 50/*null.$2*/: |
| 4419 case 51/*null.$3*/: | 4537 case 51/*null.$3*/: |
| 4420 case 52/*null.$4*/: | 4538 case 52/*null.$4*/: |
| 4421 case 53/*null.$5*/: | 4539 case 53/*null.$5*/: |
| 4422 case 54/*null.$6*/: | 4540 case 54/*null.$6*/: |
| 4423 case 55/*null.$7*/: | 4541 case 55/*null.$7*/: |
| 4424 case 56/*null.$8*/: | 4542 case 56/*null.$8*/: |
| 4425 case 57/*null.$9*/: | 4543 case 57/*null.$9*/: |
| 4426 | 4544 |
| 4427 hasDigits = true; | 4545 hasDigits = true; |
| 4428 break; | 4546 break; |
| 4429 | 4547 |
| 4430 default: | 4548 default: |
| 4431 | 4549 |
| 4432 if (!hasDigits) { | 4550 if ($notnull_bool(!hasDigits)) { |
| 4433 $throw(new MalformedInputException(this.get$charOffset())); | 4551 $throw(new MalformedInputException(this.get$charOffset())); |
| 4434 } | 4552 } |
| 4435 return next; | 4553 return next; |
| 4436 | 4554 |
| 4437 } | 4555 } |
| 4438 next = this.advance(); | 4556 next = this.advance(); |
| 4439 } | 4557 } |
| 4440 } | 4558 } |
| 4441 AbstractScanner$S.prototype.tokenizeSlashOrComment = function(next) { | 4559 AbstractScanner$S.prototype.tokenizeSlashOrComment = function(next) { |
| 4442 next = this.advance(); | 4560 next = this.advance(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4455 return this.advance(); | 4573 return this.advance(); |
| 4456 | 4574 |
| 4457 default: | 4575 default: |
| 4458 | 4576 |
| 4459 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); | 4577 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/"); |
| 4460 return next; | 4578 return next; |
| 4461 | 4579 |
| 4462 } | 4580 } |
| 4463 } | 4581 } |
| 4464 AbstractScanner$S.prototype.tokenizeSingleLineComment = function(next) { | 4582 AbstractScanner$S.prototype.tokenizeSingleLineComment = function(next) { |
| 4465 while (true) { | 4583 while ($notnull_bool(true)) { |
| 4466 next = this.advance(); | 4584 next = this.advance(); |
| 4467 switch (next) { | 4585 switch (next) { |
| 4468 case -1: | 4586 case -1: |
| 4469 case 10/*null.$LF*/: | 4587 case 10/*null.$LF*/: |
| 4470 case 13/*null.$CR*/: | 4588 case 13/*null.$CR*/: |
| 4471 | 4589 |
| 4472 return next; | 4590 return next; |
| 4473 | 4591 |
| 4474 } | 4592 } |
| 4475 } | 4593 } |
| 4476 } | 4594 } |
| 4477 AbstractScanner$S.prototype.tokenizeMultiLineComment = function(next) { | 4595 AbstractScanner$S.prototype.tokenizeMultiLineComment = function(next) { |
| 4478 next = this.advance(); | 4596 next = this.advance(); |
| 4479 while (true) { | 4597 while ($notnull_bool(true)) { |
| 4480 switch (next) { | 4598 switch (next) { |
| 4481 case -1: | 4599 case -1: |
| 4482 | 4600 |
| 4483 return next; | 4601 return next; |
| 4484 | 4602 |
| 4485 case 42/*null.$STAR*/: | 4603 case 42/*null.$STAR*/: |
| 4486 | 4604 |
| 4487 next = this.advance(); | 4605 next = this.advance(); |
| 4488 if (next == 47/*null.$SLASH*/) { | 4606 if ($notnull_bool(next == 47/*null.$SLASH*/)) { |
| 4489 return this.advance(); | 4607 return this.advance(); |
| 4490 } | 4608 } |
| 4491 else if (next == -1) { | 4609 else if ($notnull_bool(next == -1)) { |
| 4492 return next; | 4610 return next; |
| 4493 } | 4611 } |
| 4494 break; | 4612 break; |
| 4495 | 4613 |
| 4496 default: | 4614 default: |
| 4497 | 4615 |
| 4498 next = this.advance(); | 4616 next = this.advance(); |
| 4499 break; | 4617 break; |
| 4500 | 4618 |
| 4501 } | 4619 } |
| 4502 } | 4620 } |
| 4503 } | 4621 } |
| 4504 AbstractScanner$S.prototype.tokenizeIdentifier = function(next) { | 4622 AbstractScanner$S.prototype.tokenizeIdentifier = function(next) { |
| 4505 var start = this.get$byteOffset(); | 4623 var start = this.get$byteOffset(); |
| 4506 var state = null; | 4624 var state = null; |
| 4507 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { | 4625 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { |
| 4508 state = KeywordState.get$KEYWORD_STATE().next(next); | 4626 state = KeywordState.get$KEYWORD_STATE().next(next); |
| 4509 next = this.advance(); | 4627 next = this.advance(); |
| 4510 } | 4628 } |
| 4511 var isAscii = true; | 4629 var isAscii = true; |
| 4512 while (true) { | 4630 while ($notnull_bool(true)) { |
| 4513 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) { | 4631 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { |
| 4514 if (state != null) { | 4632 if ($notnull_bool(state != null)) { |
| 4515 state = state.next(next); | 4633 state = state.next(next); |
| 4516 } | 4634 } |
| 4517 } | 4635 } |
| 4518 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*/) { | 4636 else if ($notnull_bool((48/*null.$0*/ <= next && next <= 57/*null.$9*/) || (
65/*null.$A*/ <= next && next <= 90/*null.$Z*/) || next == 95/*null.$_*/ || next
== 36/*null.$DOLLAR*/)) { |
| 4519 state = null; | 4637 state = null; |
| 4520 } | 4638 } |
| 4521 else if (next < 128) { | 4639 else if ($notnull_bool(next < 128)) { |
| 4522 if (state != null && state.isLeaf()) { | 4640 if ($notnull_bool(state != null && state.isLeaf())) { |
| 4523 this.appendKeywordToken(state.get$keyword()); | 4641 this.appendKeywordToken(state.get$keyword()); |
| 4524 } | 4642 } |
| 4525 else if (isAscii) { | 4643 else if ($notnull_bool(isAscii)) { |
| 4526 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString
(start)); | 4644 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString
(start)); |
| 4527 } | 4645 } |
| 4528 else { | 4646 else { |
| 4529 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String(
start, -1)); | 4647 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String(
start, -1)); |
| 4530 } | 4648 } |
| 4531 return next; | 4649 return next; |
| 4532 } | 4650 } |
| 4533 else { | 4651 else { |
| 4534 var nonAsciiStart = this.get$byteOffset(); | 4652 var nonAsciiStart = this.get$byteOffset(); |
| 4535 do { | 4653 do { |
| 4536 next = this.nextByte(); | 4654 next = this.nextByte(); |
| 4537 } | 4655 } |
| 4538 while (next > 127) | 4656 while ($notnull_bool(next > 127)) |
| 4539 var string = this.utf8String(nonAsciiStart, -1).toString(); | 4657 var string = this.utf8String(nonAsciiStart, -1).toString(); |
| 4540 isAscii = false; | 4658 isAscii = false; |
| 4541 this.addToCharOffset(string.length); | 4659 this.addToCharOffset(string.length); |
| 4542 return next; | 4660 return next; |
| 4543 } | 4661 } |
| 4544 next = this.advance(); | 4662 next = this.advance(); |
| 4545 } | 4663 } |
| 4546 } | 4664 } |
| 4547 AbstractScanner$S.prototype.tokenizeRawString = function(next) { | 4665 AbstractScanner$S.prototype.tokenizeRawString = function(next) { |
| 4548 var start = this.get$byteOffset(); | 4666 var start = this.get$byteOffset(); |
| 4549 next = this.advance(); | 4667 next = this.advance(); |
| 4550 if (next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/) { | 4668 if ($notnull_bool(next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/)) { |
| 4551 return this.tokenizeString(next, start, true); | 4669 return this.tokenizeString(next, start, true); |
| 4552 } | 4670 } |
| 4553 else { | 4671 else { |
| 4554 $throw(new MalformedInputException(this.get$charOffset())); | 4672 $throw(new MalformedInputException(this.get$charOffset())); |
| 4555 } | 4673 } |
| 4556 } | 4674 } |
| 4557 AbstractScanner$S.prototype.tokenizeString = function(next, start, raw) { | 4675 AbstractScanner$S.prototype.tokenizeString = function(next, start, raw) { |
| 4558 var q = next; | 4676 var q = next; |
| 4559 next = this.advance(); | 4677 next = this.advance(); |
| 4560 if (q == next) { | 4678 if ($notnull_bool(q == next)) { |
| 4561 next = this.advance(); | 4679 next = this.advance(); |
| 4562 if (q == next) { | 4680 if ($notnull_bool(q == next)) { |
| 4563 return this.tokenizeMultiLineString(q, start, raw); | 4681 return this.tokenizeMultiLineString(q, start, raw); |
| 4564 } | 4682 } |
| 4565 else { | 4683 else { |
| 4566 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
-1)); | 4684 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
-1)); |
| 4567 return next; | 4685 return next; |
| 4568 } | 4686 } |
| 4569 } | 4687 } |
| 4570 if (raw) { | 4688 if ($notnull_bool(raw)) { |
| 4571 return this.tokenizeSingleLineRawString(next, q, start); | 4689 return this.tokenizeSingleLineRawString(next, q, start); |
| 4572 } | 4690 } |
| 4573 else { | 4691 else { |
| 4574 return this.tokenizeSingleLineString(next, q, start); | 4692 return this.tokenizeSingleLineString(next, q, start); |
| 4575 } | 4693 } |
| 4576 } | 4694 } |
| 4577 AbstractScanner$S.prototype.tokenizeSingleLineString = function(next, q1, start)
{ | 4695 AbstractScanner$S.prototype.tokenizeSingleLineString = function(next, q1, start)
{ |
| 4578 while (next != -1) { | 4696 while ($notnull_bool(next != -1)) { |
| 4579 if (next == q1) { | 4697 if ($notnull_bool(next == q1)) { |
| 4580 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); | 4698 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); |
| 4581 return this.advance(); | 4699 return this.advance(); |
| 4582 } | 4700 } |
| 4583 else if (next == 92/*null.$BACKSLASH*/) { | 4701 else if ($notnull_bool(next == 92/*null.$BACKSLASH*/)) { |
| 4584 next = this.advance(); | 4702 next = this.advance(); |
| 4585 if (next == -1) { | 4703 if ($notnull_bool(next == -1)) { |
| 4586 $throw(new MalformedInputException(this.get$charOffset())); | 4704 $throw(new MalformedInputException(this.get$charOffset())); |
| 4587 } | 4705 } |
| 4588 } | 4706 } |
| 4589 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { | 4707 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { |
| 4590 $throw(new MalformedInputException(this.get$charOffset())); | 4708 $throw(new MalformedInputException(this.get$charOffset())); |
| 4591 } | 4709 } |
| 4592 next = this.advance(); | 4710 next = this.advance(); |
| 4593 } | 4711 } |
| 4594 $throw(new MalformedInputException(this.get$charOffset())); | 4712 $throw(new MalformedInputException(this.get$charOffset())); |
| 4595 } | 4713 } |
| 4596 AbstractScanner$S.prototype.tokenizeSingleLineRawString = function(next, q1, sta
rt) { | 4714 AbstractScanner$S.prototype.tokenizeSingleLineRawString = function(next, q1, sta
rt) { |
| 4597 next = this.advance(); | 4715 next = this.advance(); |
| 4598 while (next != -1) { | 4716 while ($notnull_bool(next != -1)) { |
| 4599 if (next == q1) { | 4717 if ($notnull_bool(next == q1)) { |
| 4600 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); | 4718 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start,
0)); |
| 4601 return this.advance(); | 4719 return this.advance(); |
| 4602 } | 4720 } |
| 4603 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) { | 4721 else if ($notnull_bool(next == 10/*null.$LF*/ || next == 13/*null.$CR*/)) { |
| 4604 $throw(new MalformedInputException(this.get$charOffset())); | 4722 $throw(new MalformedInputException(this.get$charOffset())); |
| 4605 } | 4723 } |
| 4606 next = this.advance(); | 4724 next = this.advance(); |
| 4607 } | 4725 } |
| 4608 $throw(new MalformedInputException(this.get$charOffset())); | 4726 $throw(new MalformedInputException(this.get$charOffset())); |
| 4609 } | 4727 } |
| 4610 AbstractScanner$S.prototype.tokenizeMultiLineString = function(q, start, raw) { | 4728 AbstractScanner$S.prototype.tokenizeMultiLineString = function(q, start, raw) { |
| 4611 var next = this.advance(); | 4729 var next = this.advance(); |
| 4612 while (next != -1) { | 4730 while ($notnull_bool(next != -1)) { |
| 4613 if (next == q) { | 4731 if ($notnull_bool(next == q)) { |
| 4614 next = this.advance(); | 4732 next = this.advance(); |
| 4615 if (next == q) { | 4733 if ($notnull_bool(next == q)) { |
| 4616 next = this.advance(); | 4734 next = this.advance(); |
| 4617 if (next == q) { | 4735 if ($notnull_bool(next == q)) { |
| 4618 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st
art, 0)); | 4736 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st
art, 0)); |
| 4619 return this.advance(); | 4737 return this.advance(); |
| 4620 } | 4738 } |
| 4621 } | 4739 } |
| 4622 } | 4740 } |
| 4623 next = this.advance(); | 4741 next = this.advance(); |
| 4624 } | 4742 } |
| 4625 return next; | 4743 return next; |
| 4626 } | 4744 } |
| 4627 // ********** Code for MalformedInputException ************** | 4745 // ********** Code for MalformedInputException ************** |
| 4628 function MalformedInputException(ignored) { | 4746 function MalformedInputException(ignored) { |
| 4629 // Initializers done | 4747 // Initializers done |
| 4630 } | 4748 } |
| 4631 // ********** Code for Parser ************** | 4749 // ********** Code for Parser ************** |
| 4632 function Parser(listener) { | 4750 function Parser(listener) { |
| 4633 this.listener = listener; | 4751 this.listener = listener; |
| 4634 // Initializers done | 4752 // Initializers done |
| 4635 } | 4753 } |
| 4636 Parser.prototype.next = function(token) { | 4754 Parser.prototype.next = function(token) { |
| 4637 return this.checkEof(token.next); | 4755 return this.checkEof(token.next); |
| 4638 } | 4756 } |
| 4639 Parser.prototype.checkEof = function(token) { | 4757 Parser.prototype.checkEof = function(token) { |
| 4640 if (token.kind == 0/*null.EOF_TOKEN*/) { | 4758 if ($notnull_bool(token.kind == 0/*null.EOF_TOKEN*/)) { |
| 4641 this.listener.unexpectedEof(); | 4759 this.listener.unexpectedEof(); |
| 4642 $throw("Unexpected EOF"); | 4760 $throw("Unexpected EOF"); |
| 4643 } | 4761 } |
| 4644 return token; | 4762 return token; |
| 4645 } | 4763 } |
| 4646 Parser.prototype.parseUnit = function(token) { | 4764 Parser.prototype.parseUnit = function(token) { |
| 4647 while (token.kind != 0/*null.EOF_TOKEN*/) { | 4765 while ($notnull_bool(token.kind != 0/*null.EOF_TOKEN*/)) { |
| 4648 switch (token.get$value()) { | 4766 switch (token.get$value()) { |
| 4649 case const$203/*Keyword.INTERFACE*/: | 4767 case const$203/*Keyword.INTERFACE*/: |
| 4650 | 4768 |
| 4651 token = this.parseInterface(token); | 4769 token = this.parseInterface(token); |
| 4652 break; | 4770 break; |
| 4653 | 4771 |
| 4654 case const$191/*Keyword.CLASS*/: | 4772 case const$191/*Keyword.CLASS*/: |
| 4655 | 4773 |
| 4656 token = this.parseClass(token); | 4774 token = this.parseClass(token); |
| 4657 break; | 4775 break; |
| 4658 | 4776 |
| 4659 case const$219/*Keyword.TYPEDEF*/: | 4777 case const$219/*Keyword.TYPEDEF*/: |
| 4660 | 4778 |
| 4661 token = this.parseNamedFunctionAlias(token); | 4779 token = this.parseNamedFunctionAlias(token); |
| 4662 break; | 4780 break; |
| 4663 | 4781 |
| 4664 default: | 4782 default: |
| 4665 | 4783 |
| 4666 if ($eq(token.get$value(), const$237/*const SourceString("#")*/)) { | 4784 if ($notnull_bool($eq(token.get$value(), const$237/*const SourceString("
#")*/))) { |
| 4667 token = this.parseLibraryTags(token); | 4785 token = this.parseLibraryTags(token); |
| 4668 } | 4786 } |
| 4669 else { | 4787 else { |
| 4670 token = this.parseTopLevelMember(token); | 4788 token = this.parseTopLevelMember(token); |
| 4671 } | 4789 } |
| 4672 break; | 4790 break; |
| 4673 | 4791 |
| 4674 } | 4792 } |
| 4675 } | 4793 } |
| 4676 } | 4794 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4690 Parser.prototype.parseNamedFunctionAlias = function(token) { | 4808 Parser.prototype.parseNamedFunctionAlias = function(token) { |
| 4691 this.listener.beginFunctionTypeAlias(token); | 4809 this.listener.beginFunctionTypeAlias(token); |
| 4692 token = this.parseReturnTypeOpt(this.next(token)); | 4810 token = this.parseReturnTypeOpt(this.next(token)); |
| 4693 token = this.parseIdentifier(token); | 4811 token = this.parseIdentifier(token); |
| 4694 token = this.parseTypeVariablesOpt(token); | 4812 token = this.parseTypeVariablesOpt(token); |
| 4695 token = this.parseParameters(token); | 4813 token = this.parseParameters(token); |
| 4696 this.listener.endFunctionTypeAlias(token); | 4814 this.listener.endFunctionTypeAlias(token); |
| 4697 return this.expect(const$236/*const SourceString(";")*/, token); | 4815 return this.expect(const$236/*const SourceString(";")*/, token); |
| 4698 } | 4816 } |
| 4699 Parser.prototype.parseReturnTypeOpt = function(token) { | 4817 Parser.prototype.parseReturnTypeOpt = function(token) { |
| 4700 if ($eq(token.get$value(), const$183/*Keyword.VOID*/)) { | 4818 if ($notnull_bool($eq(token.get$value(), const$183/*Keyword.VOID*/))) { |
| 4701 this.listener.voidType(token); | 4819 this.listener.voidType(token); |
| 4702 return this.next(token); | 4820 return this.next(token); |
| 4703 } | 4821 } |
| 4704 else { | 4822 else { |
| 4705 return this.parseTypeOpt(token); | 4823 return this.parseTypeOpt(token); |
| 4706 } | 4824 } |
| 4707 } | 4825 } |
| 4708 Parser.prototype.parseParameters = function(token) { | 4826 Parser.prototype.parseParameters = function(token) { |
| 4709 this.expect(const$234/*const SourceString("(")*/, token); | 4827 this.expect(const$234/*const SourceString("(")*/, token); |
| 4710 if (this.optional(const$235/*const SourceString(")")*/, this.next(token))) { | 4828 if ($notnull_bool(this.optional(const$235/*const SourceString(")")*/, this.nex
t(token)))) { |
| 4711 return this.next(this.next(token)); | 4829 return this.next(this.next(token)); |
| 4712 } | 4830 } |
| 4713 do { | 4831 do { |
| 4714 token = this.parseTypeOpt(this.next(token)); | 4832 token = this.parseTypeOpt(this.next(token)); |
| 4715 token = this.parseIdentifier(token); | 4833 token = this.parseIdentifier(token); |
| 4716 } | 4834 } |
| 4717 while (this.optional(const$230/*const SourceString(",")*/, token)) | 4835 while ($notnull_bool(this.optional(const$230/*const SourceString(",")*/, token
))) |
| 4718 return this.expect(const$235/*const SourceString(")")*/, token); | 4836 return this.expect(const$235/*const SourceString(")")*/, token); |
| 4719 } | 4837 } |
| 4720 Parser.prototype.parseTypeOpt = function(token) { | 4838 Parser.prototype.parseTypeOpt = function(token) { |
| 4721 switch (true) { | 4839 switch (true) { |
| 4722 case this.optional(const$228/*const SourceString("<")*/, this.next(token)): | 4840 case this.optional(const$228/*const SourceString("<")*/, this.next(token)): |
| 4723 case this.optional(const$229/*const SourceString(".")*/, this.next(token)): | 4841 case this.optional(const$229/*const SourceString(".")*/, this.next(token)): |
| 4724 case this.isIdentifier(this.next(token)): | 4842 case this.isIdentifier(this.next(token)): |
| 4725 | 4843 |
| 4726 return this.parseType(token); | 4844 return this.parseType(token); |
| 4727 | 4845 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4741 | 4859 |
| 4742 return token.get$value().isPseudo; | 4860 return token.get$value().isPseudo; |
| 4743 | 4861 |
| 4744 default: | 4862 default: |
| 4745 | 4863 |
| 4746 return false; | 4864 return false; |
| 4747 | 4865 |
| 4748 } | 4866 } |
| 4749 } | 4867 } |
| 4750 Parser.prototype.parseSupertypesClauseOpt = function(token) { | 4868 Parser.prototype.parseSupertypesClauseOpt = function(token) { |
| 4751 if (this.optional(const$193/*Keyword.EXTENDS*/, token)) { | 4869 if ($notnull_bool(this.optional(const$193/*Keyword.EXTENDS*/, token))) { |
| 4752 do { | 4870 do { |
| 4753 token = this.parseType(this.next(token)); | 4871 token = this.parseType(this.next(token)); |
| 4754 } | 4872 } |
| 4755 while (this.optional(const$230/*const SourceString(",")*/, token)) | 4873 while ($notnull_bool(this.optional(const$230/*const SourceString(",")*/, tok
en))) |
| 4756 } | 4874 } |
| 4757 return token; | 4875 return token; |
| 4758 } | 4876 } |
| 4759 Parser.prototype.parseFactoryClauseOpt = function(token) { | 4877 Parser.prototype.parseFactoryClauseOpt = function(token) { |
| 4760 if (this.optional(const$195/*Keyword.FACTORY*/, token)) { | 4878 if ($notnull_bool(this.optional(const$195/*Keyword.FACTORY*/, token))) { |
| 4761 return this.parseType(this.next(token)); | 4879 return this.parseType(this.next(token)); |
| 4762 } | 4880 } |
| 4763 return token; | 4881 return token; |
| 4764 } | 4882 } |
| 4765 Parser.prototype.skipBlock = function(token) { | 4883 Parser.prototype.skipBlock = function(token) { |
| 4766 if (!this.optional(const$232/*const SourceString("{")*/, token)) { | 4884 if ($notnull_bool(!this.optional(const$232/*const SourceString("{")*/, token))
) { |
| 4767 return this.listener.expectedBlock(token); | 4885 return this.listener.expectedBlock(token); |
| 4768 } | 4886 } |
| 4769 token = this.next(token); | 4887 token = this.next(token); |
| 4770 var nesting = 1; | 4888 var nesting = 1; |
| 4771 do { | 4889 do { |
| 4772 switch (token.kind) { | 4890 switch (token.kind) { |
| 4773 case 123/*null.LBRACE_TOKEN*/: | 4891 case 123/*null.LBRACE_TOKEN*/: |
| 4774 | 4892 |
| 4775 nesting++; | 4893 nesting++; |
| 4776 break; | 4894 break; |
| 4777 | 4895 |
| 4778 case 125/*null.RBRACE_TOKEN*/: | 4896 case 125/*null.RBRACE_TOKEN*/: |
| 4779 | 4897 |
| 4780 nesting--; | 4898 nesting--; |
| 4781 if (nesting == 0) { | 4899 if ($notnull_bool(nesting == 0)) { |
| 4782 return token; | 4900 return token; |
| 4783 } | 4901 } |
| 4784 break; | 4902 break; |
| 4785 | 4903 |
| 4786 } | 4904 } |
| 4787 token = this.next(token); | 4905 token = this.next(token); |
| 4788 } | 4906 } |
| 4789 while (token != null) | 4907 while ($notnull_bool(token != null)) |
| 4790 $throw("Internal error: unreachable code"); | 4908 $throw("Internal error: unreachable code"); |
| 4791 } | 4909 } |
| 4792 Parser.prototype.parseClass = function(token) { | 4910 Parser.prototype.parseClass = function(token) { |
| 4793 this.listener.beginClass(token); | 4911 this.listener.beginClass(token); |
| 4794 token = this.parseIdentifier(this.next(token)); | 4912 token = this.parseIdentifier(this.next(token)); |
| 4795 token = this.parseTypeVariablesOpt(token); | 4913 token = this.parseTypeVariablesOpt(token); |
| 4796 token = this.parseSuperclassClauseOpt(token); | 4914 token = this.parseSuperclassClauseOpt(token); |
| 4797 token = this.parseImplementsOpt(token); | 4915 token = this.parseImplementsOpt(token); |
| 4798 token = this.parseNativeClassClauseOpt(token); | 4916 token = this.parseNativeClassClauseOpt(token); |
| 4799 return this.parseClassBody(token); | 4917 return this.parseClassBody(token); |
| 4800 } | 4918 } |
| 4801 Parser.prototype.parseNativeClassClauseOpt = function(token) { | 4919 Parser.prototype.parseNativeClassClauseOpt = function(token) { |
| 4802 if (this.optional(const$207/*Keyword.NATIVE*/, token)) { | 4920 if ($notnull_bool(this.optional(const$207/*Keyword.NATIVE*/, token))) { |
| 4803 return this.parseString(this.next(token)); | 4921 return this.parseString(this.next(token)); |
| 4804 } | 4922 } |
| 4805 return token; | 4923 return token; |
| 4806 } | 4924 } |
| 4807 Parser.prototype.parseString = function(token) { | 4925 Parser.prototype.parseString = function(token) { |
| 4808 switch (token.kind) { | 4926 switch (token.kind) { |
| 4809 case 39/*null.STRING_TOKEN*/: | 4927 case 39/*null.STRING_TOKEN*/: |
| 4810 | 4928 |
| 4811 return this.next(token); | 4929 return this.next(token); |
| 4812 | 4930 |
| 4813 default: | 4931 default: |
| 4814 | 4932 |
| 4815 return this.listener.expected(const$233/*const SourceString("string")*/, t
oken); | 4933 return this.listener.expected(const$233/*const SourceString("string")*/, t
oken); |
| 4816 | 4934 |
| 4817 } | 4935 } |
| 4818 } | 4936 } |
| 4819 Parser.prototype.parseIdentifier = function(token) { | 4937 Parser.prototype.parseIdentifier = function(token) { |
| 4820 if (this.isIdentifier(token)) { | 4938 if ($notnull_bool(this.isIdentifier(token))) { |
| 4821 this.listener.identifier(token); | 4939 this.listener.identifier(token); |
| 4822 } | 4940 } |
| 4823 else { | 4941 else { |
| 4824 this.listener.notIdentifier(token); | 4942 this.listener.notIdentifier(token); |
| 4825 } | 4943 } |
| 4826 return this.next(token); | 4944 return this.next(token); |
| 4827 } | 4945 } |
| 4828 Parser.prototype.parseTypeVariablesOpt = function(token) { | 4946 Parser.prototype.parseTypeVariablesOpt = function(token) { |
| 4829 if (!this.optional(const$228/*const SourceString("<")*/, token)) { | 4947 if ($notnull_bool(!this.optional(const$228/*const SourceString("<")*/, token))
) { |
| 4830 return token; | 4948 return token; |
| 4831 } | 4949 } |
| 4832 this.listener.beginTypeVariables(token); | 4950 this.listener.beginTypeVariables(token); |
| 4833 do { | 4951 do { |
| 4834 token = this.parseTypeVariable(this.next(token)); | 4952 token = this.parseTypeVariable(this.next(token)); |
| 4835 } | 4953 } |
| 4836 while (this.optional(const$230/*const SourceString(",")*/, token)) | 4954 while ($notnull_bool(this.optional(const$230/*const SourceString(",")*/, token
))) |
| 4837 return this.expect(const$231/*const SourceString(">")*/, token); | 4955 return this.expect(const$231/*const SourceString(">")*/, token); |
| 4838 } | 4956 } |
| 4839 Parser.prototype.expect = function(string, token) { | 4957 Parser.prototype.expect = function(string, token) { |
| 4840 if ($ne(string, token.get$value())) { | 4958 if ($notnull_bool($ne(string, token.get$value()))) { |
| 4841 return this.listener.expected(string, token); | 4959 return this.listener.expected(string, token); |
| 4842 } | 4960 } |
| 4843 return token.next; | 4961 return token.next; |
| 4844 } | 4962 } |
| 4845 Parser.prototype.parseTypeVariable = function(token) { | 4963 Parser.prototype.parseTypeVariable = function(token) { |
| 4846 this.listener.beginTypeVariable(token); | 4964 this.listener.beginTypeVariable(token); |
| 4847 token = this.parseIdentifier(token); | 4965 token = this.parseIdentifier(token); |
| 4848 token = this.parseSuperclassClauseOpt(token); | 4966 token = this.parseSuperclassClauseOpt(token); |
| 4849 this.listener.endTypeVariable(token); | 4967 this.listener.endTypeVariable(token); |
| 4850 return token; | 4968 return token; |
| 4851 } | 4969 } |
| 4852 Parser.prototype.optional = function(value, token) { | 4970 Parser.prototype.optional = function(value, token) { |
| 4853 return $eq(value, token.get$value()); | 4971 return $eq(value, token.get$value()); |
| 4854 } | 4972 } |
| 4855 Parser.prototype.parseSuperclassClauseOpt = function(token) { | 4973 Parser.prototype.parseSuperclassClauseOpt = function(token) { |
| 4856 if (this.optional(const$193/*Keyword.EXTENDS*/, token)) { | 4974 if ($notnull_bool(this.optional(const$193/*Keyword.EXTENDS*/, token))) { |
| 4857 return this.parseType(this.next(token)); | 4975 return this.parseType(this.next(token)); |
| 4858 } | 4976 } |
| 4859 return token; | 4977 return token; |
| 4860 } | 4978 } |
| 4861 Parser.prototype.parseType = function(token) { | 4979 Parser.prototype.parseType = function(token) { |
| 4862 if (this.isIdentifier(token)) { | 4980 if ($notnull_bool(this.isIdentifier(token))) { |
| 4863 token = this.parseIdentifier(token); | 4981 token = this.parseIdentifier(token); |
| 4864 while (this.optional(const$229/*const SourceString(".")*/, token)) { | 4982 while ($notnull_bool(this.optional(const$229/*const SourceString(".")*/, tok
en))) { |
| 4865 token = this.parseIdentifier(this.next(token)); | 4983 token = this.parseIdentifier(this.next(token)); |
| 4866 } | 4984 } |
| 4867 } | 4985 } |
| 4868 else { | 4986 else { |
| 4869 token = this.listener.expectedType(token); | 4987 token = this.listener.expectedType(token); |
| 4870 } | 4988 } |
| 4871 return this.parseTypeArgumentsOpt(token); | 4989 return this.parseTypeArgumentsOpt(token); |
| 4872 } | 4990 } |
| 4873 Parser.prototype.parseTypeArgumentsOpt = function(token) { | 4991 Parser.prototype.parseTypeArgumentsOpt = function(token) { |
| 4874 if (this.optional(const$228/*const SourceString("<")*/, token)) { | 4992 if ($notnull_bool(this.optional(const$228/*const SourceString("<")*/, token)))
{ |
| 4875 this.listener.beginTypeArguments(this.next(token)); | 4993 this.listener.beginTypeArguments(this.next(token)); |
| 4876 do { | 4994 do { |
| 4877 token = this.parseType(this.next(token)); | 4995 token = this.parseType(this.next(token)); |
| 4878 } | 4996 } |
| 4879 while (this.optional(const$230/*const SourceString(",")*/, token)) | 4997 while ($notnull_bool(this.optional(const$230/*const SourceString(",")*/, tok
en))) |
| 4880 return this.expect(const$231/*const SourceString(">")*/, token); | 4998 return this.expect(const$231/*const SourceString(">")*/, token); |
| 4881 } | 4999 } |
| 4882 return token; | 5000 return token; |
| 4883 } | 5001 } |
| 4884 Parser.prototype.parseImplementsOpt = function(token) { | 5002 Parser.prototype.parseImplementsOpt = function(token) { |
| 4885 if (this.optional(const$199/*Keyword.IMPLEMENTS*/, token)) { | 5003 if ($notnull_bool(this.optional(const$199/*Keyword.IMPLEMENTS*/, token))) { |
| 4886 do { | 5004 do { |
| 4887 token = this.parseType(this.next(token)); | 5005 token = this.parseType(this.next(token)); |
| 4888 } | 5006 } |
| 4889 while (this.optional(const$230/*const SourceString(",")*/, token)) | 5007 while ($notnull_bool(this.optional(const$230/*const SourceString(",")*/, tok
en))) |
| 4890 } | 5008 } |
| 4891 return token; | 5009 return token; |
| 4892 } | 5010 } |
| 4893 Parser.prototype.parseClassBody = function(token) { | 5011 Parser.prototype.parseClassBody = function(token) { |
| 4894 token = this.skipBlock(token); | 5012 token = this.skipBlock(token); |
| 4895 this.listener.endClass(token); | 5013 this.listener.endClass(token); |
| 4896 return token.next; | 5014 return token.next; |
| 4897 } | 5015 } |
| 4898 Parser.prototype.parseTopLevelMember = function(token) { | 5016 Parser.prototype.parseTopLevelMember = function(token) { |
| 4899 var start = token; | 5017 var start = token; |
| 4900 this.listener.beginTopLevelMember(token); | 5018 this.listener.beginTopLevelMember(token); |
| 4901 var previous = token; | 5019 var previous = token; |
| 4902 LOOP: | 5020 LOOP: |
| 4903 while (token != null) { | 5021 while ($notnull_bool(token != null)) { |
| 4904 switch (token.kind) { | 5022 switch (token.kind) { |
| 4905 case 123/*null.LBRACE_TOKEN*/: | 5023 case 123/*null.LBRACE_TOKEN*/: |
| 4906 case 59/*null.SEMICOLON_TOKEN*/: | 5024 case 59/*null.SEMICOLON_TOKEN*/: |
| 4907 case 40/*null.LPAREN_TOKEN*/: | 5025 case 40/*null.LPAREN_TOKEN*/: |
| 4908 case 61/*null.EQ_TOKEN*/: | 5026 case 61/*null.EQ_TOKEN*/: |
| 4909 | 5027 |
| 4910 break LOOP; | 5028 break LOOP; |
| 4911 | 5029 |
| 4912 default: | 5030 default: |
| 4913 | 5031 |
| 4914 previous = token; | 5032 previous = token; |
| 4915 token = this.next(token); | 5033 token = this.next(token); |
| 4916 break; | 5034 break; |
| 4917 | 5035 |
| 4918 } | 5036 } |
| 4919 } | 5037 } |
| 4920 token = this.parseIdentifier(previous); | 5038 token = this.parseIdentifier(previous); |
| 4921 if (this.optional(const$234/*const SourceString("(")*/, token)) { | 5039 if ($notnull_bool(this.optional(const$234/*const SourceString("(")*/, token)))
{ |
| 4922 this.listener.topLevelMethod(start); | 5040 this.listener.topLevelMethod(start); |
| 4923 } | 5041 } |
| 4924 else if (this.optional(const$238/*const SourceString("=")*/, token) || this.op
tional(const$236/*const SourceString(";")*/, token)) { | 5042 else if ($notnull_bool(this.optional(const$238/*const SourceString("=")*/, tok
en) || this.optional(const$236/*const SourceString(";")*/, token))) { |
| 4925 this.listener.topLevelField(start); | 5043 this.listener.topLevelField(start); |
| 4926 } | 5044 } |
| 4927 else { | 5045 else { |
| 4928 token = this.listener.unexpected(token); | 5046 token = this.listener.unexpected(token); |
| 4929 } | 5047 } |
| 4930 while (token != null && token.kind != 123/*null.LBRACE_TOKEN*/ && token.kind !
= 59/*null.SEMICOLON_TOKEN*/) { | 5048 while ($notnull_bool(token != null && token.kind != 123/*null.LBRACE_TOKEN*/ &
& token.kind != 59/*null.SEMICOLON_TOKEN*/)) { |
| 4931 token = this.next(token); | 5049 token = this.next(token); |
| 4932 } | 5050 } |
| 4933 if (!this.optional(const$236/*const SourceString(";")*/, token)) { | 5051 if ($notnull_bool(!this.optional(const$236/*const SourceString(";")*/, token))
) { |
| 4934 token = this.skipBlock(token); | 5052 token = this.skipBlock(token); |
| 4935 } | 5053 } |
| 4936 this.listener.endTopLevelMember(token); | 5054 this.listener.endTopLevelMember(token); |
| 4937 return token.next; | 5055 return token.next; |
| 4938 } | 5056 } |
| 4939 Parser.prototype.parseLibraryTags = function(token) { | 5057 Parser.prototype.parseLibraryTags = function(token) { |
| 4940 this.listener.beginLibraryTag(token); | 5058 this.listener.beginLibraryTag(token); |
| 4941 token = this.parseIdentifier(this.next(token)); | 5059 token = this.parseIdentifier(this.next(token)); |
| 4942 token = this.expect(const$234/*const SourceString("(")*/, token); | 5060 token = this.expect(const$234/*const SourceString("(")*/, token); |
| 4943 while (token != null && token.kind != 40/*null.LPAREN_TOKEN*/ && token.kind !=
41/*null.RPAREN_TOKEN*/) { | 5061 while ($notnull_bool(token != null && token.kind != 40/*null.LPAREN_TOKEN*/ &&
token.kind != 41/*null.RPAREN_TOKEN*/)) { |
| 4944 token = this.next(token); | 5062 token = this.next(token); |
| 4945 } | 5063 } |
| 4946 token = this.expect(const$235/*const SourceString(")")*/, token); | 5064 token = this.expect(const$235/*const SourceString(")")*/, token); |
| 4947 return this.expect(const$236/*const SourceString(";")*/, token); | 5065 return this.expect(const$236/*const SourceString(";")*/, token); |
| 4948 } | 5066 } |
| 4949 // ********** Code for BodyParser ************** | 5067 // ********** Code for BodyParser ************** |
| 4950 function BodyParser(listener0) { | 5068 function BodyParser(listener0) { |
| 4951 Parser.call(this, listener0); | 5069 Parser.call(this, listener0); |
| 4952 // Initializers done | 5070 // Initializers done |
| 4953 } | 5071 } |
| 4954 $inherits(BodyParser, Parser); | 5072 $inherits(BodyParser, Parser); |
| 4955 BodyParser.prototype.parseFunction = function(token) { | 5073 BodyParser.prototype.parseFunction = function(token) { |
| 4956 this.listener.beginFunction(token); | 5074 this.listener.beginFunction(token); |
| 4957 token = this.parseReturnTypeOpt(token); | 5075 token = this.parseReturnTypeOpt(token); |
| 4958 this.listener.beginFunctionName(token); | 5076 this.listener.beginFunctionName(token); |
| 4959 token = this.parseIdentifier(token); | 5077 token = this.parseIdentifier(token); |
| 4960 this.listener.endFunctionName(token); | 5078 this.listener.endFunctionName(token); |
| 4961 token = this.parseFormalParameters(token); | 5079 token = this.parseFormalParameters(token); |
| 4962 return this.parseFunctionBody(token); | 5080 return this.parseFunctionBody(token); |
| 4963 } | 5081 } |
| 4964 BodyParser.prototype.parseFormalParameters = function(token) { | 5082 BodyParser.prototype.parseFormalParameters = function(token) { |
| 4965 var begin = token; | 5083 var begin = token; |
| 4966 this.listener.beginFormalParameters(begin); | 5084 this.listener.beginFormalParameters(begin); |
| 4967 this.expect(const$234/*const SourceString("(")*/, token); | 5085 this.expect(const$234/*const SourceString("(")*/, token); |
| 4968 var parameterCount = 0; | 5086 var parameterCount = 0; |
| 4969 if (this.optional(const$235/*const SourceString(")")*/, token.next)) { | 5087 if ($notnull_bool(this.optional(const$235/*const SourceString(")")*/, token.ne
xt))) { |
| 4970 this.listener.endFormalParameters(parameterCount, begin, token.next); | 5088 this.listener.endFormalParameters(parameterCount, begin, token.next); |
| 4971 return token.next.next; | 5089 return token.next.next; |
| 4972 } | 5090 } |
| 4973 do { | 5091 do { |
| 4974 token = this.parseType(this.next(token)); | 5092 token = this.parseType(this.next(token)); |
| 4975 token = this.parseIdentifier(token); | 5093 token = this.parseIdentifier(token); |
| 4976 ++parameterCount; | 5094 ++parameterCount; |
| 4977 } | 5095 } |
| 4978 while (this.optional(const$230/*const SourceString(",")*/, token)) | 5096 while ($notnull_bool(this.optional(const$230/*const SourceString(",")*/, token
))) |
| 4979 this.listener.endFormalParameters(parameterCount, begin, token); | 5097 this.listener.endFormalParameters(parameterCount, begin, token); |
| 4980 return this.expect(const$235/*const SourceString(")")*/, token); | 5098 return this.expect(const$235/*const SourceString(")")*/, token); |
| 4981 } | 5099 } |
| 4982 BodyParser.prototype.parseFunctionBody = function(token) { | 5100 BodyParser.prototype.parseFunctionBody = function(token) { |
| 4983 if (this.optional(const$236/*const SourceString(";")*/, token)) { | 5101 if ($notnull_bool(this.optional(const$236/*const SourceString(";")*/, token)))
{ |
| 4984 this.listener.endFunctionBody(0, null, token); | 5102 this.listener.endFunctionBody(0, null, token); |
| 4985 return token.next; | 5103 return token.next; |
| 4986 } | 5104 } |
| 4987 var begin = token; | 5105 var begin = token; |
| 4988 var statementCount = 0; | 5106 var statementCount = 0; |
| 4989 this.listener.beginFunctionBody(begin); | 5107 this.listener.beginFunctionBody(begin); |
| 4990 token = this.checkEof(this.expect(const$232/*const SourceString("{")*/, token)
); | 5108 token = this.checkEof(this.expect(const$232/*const SourceString("{")*/, token)
); |
| 4991 while (!this.optional(const$239/*const SourceString("}")*/, token)) { | 5109 while ($notnull_bool(!this.optional(const$239/*const SourceString("}")*/, toke
n))) { |
| 4992 token = this.parseStatement(token); | 5110 token = this.parseStatement(token); |
| 4993 ++statementCount; | 5111 ++statementCount; |
| 4994 } | 5112 } |
| 4995 this.listener.endFunctionBody(statementCount, begin, token); | 5113 this.listener.endFunctionBody(statementCount, begin, token); |
| 4996 return this.expect(const$239/*const SourceString("}")*/, token); | 5114 return this.expect(const$239/*const SourceString("}")*/, token); |
| 4997 } | 5115 } |
| 4998 BodyParser.prototype.parseStatement = function(token) { | 5116 BodyParser.prototype.parseStatement = function(token) { |
| 4999 this.checkEof(token); | 5117 this.checkEof(token); |
| 5000 if ($eq(token.get$value(), const$240/*const SourceString('{')*/)) { | 5118 if ($notnull_bool($eq(token.get$value(), const$240/*const SourceString('{')*/)
)) { |
| 5001 return this.parseBlock(token); | 5119 return this.parseBlock(token); |
| 5002 } | 5120 } |
| 5003 switch (token.get$value()) { | 5121 switch (token.get$value()) { |
| 5004 case const$167/*Keyword.RETURN*/: | 5122 case const$167/*Keyword.RETURN*/: |
| 5005 | 5123 |
| 5006 return this.parseReturnStatement(token); | 5124 return this.parseReturnStatement(token); |
| 5007 | 5125 |
| 5008 case const$181/*Keyword.VAR*/: | 5126 case const$181/*Keyword.VAR*/: |
| 5009 | 5127 |
| 5010 return this.parseVariablesDeclaration(token); | 5128 return this.parseVariablesDeclaration(token); |
| 5011 | 5129 |
| 5012 case const$157/*Keyword.IF*/: | 5130 case const$157/*Keyword.IF*/: |
| 5013 | 5131 |
| 5014 return this.parseIfStatement(token); | 5132 return this.parseIfStatement(token); |
| 5015 | 5133 |
| 5016 default: | 5134 default: |
| 5017 | 5135 |
| 5018 return this.parseExpressionStatement(token); | 5136 return this.parseExpressionStatement(token); |
| 5019 | 5137 |
| 5020 } | 5138 } |
| 5021 } | 5139 } |
| 5022 BodyParser.prototype.expectSemicolon = function(token) { | 5140 BodyParser.prototype.expectSemicolon = function(token) { |
| 5023 return this.expect(const$236/*const SourceString(";")*/, token); | 5141 return this.expect(const$236/*const SourceString(";")*/, token); |
| 5024 } | 5142 } |
| 5025 BodyParser.prototype.parseReturnStatement = function(token) { | 5143 BodyParser.prototype.parseReturnStatement = function(token) { |
| 5026 var begin = token; | 5144 var begin = token; |
| 5027 this.listener.beginReturnStatement(begin); | 5145 this.listener.beginReturnStatement(begin); |
| 5146 $assert($eq(const$241/*const SourceString("return")*/, token.get$value()), "co
nst SourceString(\"return\") == token.value", "leg/scanner/parser.dart", 393, 12
); |
| 5028 token = this.parseExpression(this.next(token)); | 5147 token = this.parseExpression(this.next(token)); |
| 5029 this.listener.endReturnStatement(true, begin, token); | 5148 this.listener.endReturnStatement(true, begin, token); |
| 5030 return this.expectSemicolon(token); | 5149 return this.expectSemicolon(token); |
| 5031 } | 5150 } |
| 5032 BodyParser.prototype.parseExpressionStatement = function(token) { | 5151 BodyParser.prototype.parseExpressionStatement = function(token) { |
| 5033 this.listener.beginExpressionStatement(token); | 5152 this.listener.beginExpressionStatement(token); |
| 5034 token = this.parseExpression(token); | 5153 token = this.parseExpression(token); |
| 5035 this.listener.endExpressionStatement(token); | 5154 this.listener.endExpressionStatement(token); |
| 5036 return this.expectSemicolon(token); | 5155 return this.expectSemicolon(token); |
| 5037 } | 5156 } |
| 5038 BodyParser.prototype.parseExpression = function(token) { | 5157 BodyParser.prototype.parseExpression = function(token) { |
| 5039 token = this.parseConditionalExpression(token); | 5158 token = this.parseConditionalExpression(token); |
| 5040 if (this.isAssignmentOperator(token)) { | 5159 if ($notnull_bool(this.isAssignmentOperator(token))) { |
| 5041 var operator = token; | 5160 var operator = token; |
| 5042 token = this.parseExpression(this.next(token)); | 5161 token = this.parseExpression(this.next(token)); |
| 5043 this.listener.handleAssignmentExpression(operator); | 5162 this.listener.handleAssignmentExpression(operator); |
| 5044 } | 5163 } |
| 5045 return token; | 5164 return token; |
| 5046 } | 5165 } |
| 5047 BodyParser.prototype.isAssignmentOperator = function(token) { | 5166 BodyParser.prototype.isAssignmentOperator = function(token) { |
| 5048 return 2 == this.getPrecedence(token); | 5167 return 2 == this.getPrecedence(token); |
| 5049 } | 5168 } |
| 5050 BodyParser.prototype.parseConditionalExpression = function(token) { | 5169 BodyParser.prototype.parseConditionalExpression = function(token) { |
| 5051 token = this.parseBinaryExpression(token, 4); | 5170 token = this.parseBinaryExpression(token, 4); |
| 5052 if (this.optional(const$242/*const SourceString("?")*/, token)) { | 5171 if ($notnull_bool(this.optional(const$242/*const SourceString("?")*/, token)))
{ |
| 5053 var question = token; | 5172 var question = token; |
| 5054 token = this.parseExpression(this.next(token)); | 5173 token = this.parseExpression(this.next(token)); |
| 5055 var colon = token; | 5174 var colon = token; |
| 5056 token = this.expect(const$243/*const SourceString(":")*/, token); | 5175 token = this.expect(const$243/*const SourceString(":")*/, token); |
| 5057 token = this.parseExpression(token); | 5176 token = this.parseExpression(token); |
| 5058 this.listener.handleConditionalExpression(question, colon); | 5177 this.listener.handleConditionalExpression(question, colon); |
| 5059 } | 5178 } |
| 5060 return token; | 5179 return token; |
| 5061 } | 5180 } |
| 5062 BodyParser.prototype.parseBinaryExpression = function(token, precedence) { | 5181 BodyParser.prototype.parseBinaryExpression = function(token, precedence) { |
| 5182 $assert(precedence >= 4, "precedence >= 4", "leg/scanner/parser.dart", 434, 12
); |
| 5063 token = this.parsePrimary(token); | 5183 token = this.parsePrimary(token); |
| 5064 for (var level = this.getPrecedence(token); | 5184 for (var level = this.getPrecedence(token); |
| 5065 level >= precedence; --level) { | 5185 $notnull_bool(level >= precedence); --level) { |
| 5066 while (this.getPrecedence(token) == level) { | 5186 while ($notnull_bool(this.getPrecedence(token) == level)) { |
| 5067 var operator = token; | 5187 var operator = token; |
| 5068 token = this.parseBinaryExpression(this.next(token), level + 1); | 5188 token = this.parseBinaryExpression(this.next(token), level + 1); |
| 5069 this.listener.handleBinaryExpression(operator); | 5189 this.listener.handleBinaryExpression(operator); |
| 5070 } | 5190 } |
| 5071 } | 5191 } |
| 5072 return token; | 5192 return token; |
| 5073 } | 5193 } |
| 5074 BodyParser.prototype.getPrecedence = function(token) { | 5194 BodyParser.prototype.getPrecedence = function(token) { |
| 5075 if (token == null) return 0; | 5195 if ($notnull_bool(token == null)) return 0; |
| 5076 var value = token.get$value(); | 5196 var value = token.get$value(); |
| 5077 if (!(value instanceof StringWrapper)) return 0; | 5197 if ($notnull_bool(!(value instanceof StringWrapper))) return 0; |
| 5078 switch (value.toString()) { | 5198 switch (value.toString()) { |
| 5079 case "%=": | 5199 case "%=": |
| 5080 | 5200 |
| 5081 return 2; | 5201 return 2; |
| 5082 | 5202 |
| 5083 case "&=": | 5203 case "&=": |
| 5084 | 5204 |
| 5085 return 2; | 5205 return 2; |
| 5086 | 5206 |
| 5087 case "*=": | 5207 case "*=": |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5290 return token.next; | 5410 return token.next; |
| 5291 } | 5411 } |
| 5292 BodyParser.prototype.parseSend = function(token) { | 5412 BodyParser.prototype.parseSend = function(token) { |
| 5293 this.listener.beginSend(token); | 5413 this.listener.beginSend(token); |
| 5294 token = this.parseIdentifier(token); | 5414 token = this.parseIdentifier(token); |
| 5295 token = this.parseArgumentsOpt(token); | 5415 token = this.parseArgumentsOpt(token); |
| 5296 this.listener.endSend(token); | 5416 this.listener.endSend(token); |
| 5297 return token; | 5417 return token; |
| 5298 } | 5418 } |
| 5299 BodyParser.prototype.parseArgumentsOpt = function(token) { | 5419 BodyParser.prototype.parseArgumentsOpt = function(token) { |
| 5300 if (!this.optional(const$234/*const SourceString("(")*/, token)) { | 5420 if ($notnull_bool(!this.optional(const$234/*const SourceString("(")*/, token))
) { |
| 5301 this.listener.handleNoArgumentsOpt(token); | 5421 this.listener.handleNoArgumentsOpt(token); |
| 5302 return token; | 5422 return token; |
| 5303 } | 5423 } |
| 5304 else return this.parseArguments(token); | 5424 else return this.parseArguments(token); |
| 5305 } | 5425 } |
| 5306 BodyParser.prototype.parseArguments = function(token) { | 5426 BodyParser.prototype.parseArguments = function(token) { |
| 5307 var begin = token; | 5427 var begin = token; |
| 5308 this.listener.beginArguments(begin); | 5428 this.listener.beginArguments(begin); |
| 5429 $assert($eq(const$234/*const SourceString("(")*/, token.get$value()), "const S
ourceString(\"(\") == token.value", "leg/scanner/parser.dart", 559, 12); |
| 5309 var argumentCount = 0; | 5430 var argumentCount = 0; |
| 5310 if (this.optional(const$235/*const SourceString(")")*/, token.next)) { | 5431 if ($notnull_bool(this.optional(const$235/*const SourceString(")")*/, token.ne
xt))) { |
| 5311 this.listener.endArguments(argumentCount, begin, token.next); | 5432 this.listener.endArguments(argumentCount, begin, token.next); |
| 5312 return token.next.next; | 5433 return token.next.next; |
| 5313 } | 5434 } |
| 5314 do { | 5435 do { |
| 5315 token = this.parseExpression(this.next(token)); | 5436 token = this.parseExpression(this.next(token)); |
| 5316 ++argumentCount; | 5437 ++argumentCount; |
| 5317 } | 5438 } |
| 5318 while (this.optional(const$230/*const SourceString(",")*/, token)) | 5439 while ($notnull_bool(this.optional(const$230/*const SourceString(",")*/, token
))) |
| 5319 this.listener.endArguments(argumentCount, begin, token); | 5440 this.listener.endArguments(argumentCount, begin, token); |
| 5320 return this.expect(const$235/*const SourceString(")")*/, token); | 5441 return this.expect(const$235/*const SourceString(")")*/, token); |
| 5321 } | 5442 } |
| 5322 BodyParser.prototype.parseVariablesDeclaration = function(token) { | 5443 BodyParser.prototype.parseVariablesDeclaration = function(token) { |
| 5323 var count = 1; | 5444 var count = 1; |
| 5324 this.listener.beginVariablesDeclaration(token); | 5445 this.listener.beginVariablesDeclaration(token); |
| 5325 token = this.parseFinalVarOrType(token); | 5446 token = this.parseFinalVarOrType(token); |
| 5326 token = this.parseOptionallyInitializedIdentifier(token); | 5447 token = this.parseOptionallyInitializedIdentifier(token); |
| 5327 while (this.optional(const$245/*const SourceString(',')*/, token)) { | 5448 while ($notnull_bool(this.optional(const$245/*const SourceString(',')*/, token
))) { |
| 5328 token = this.parseOptionallyInitializedIdentifier(this.next(token)); | 5449 token = this.parseOptionallyInitializedIdentifier(this.next(token)); |
| 5329 ++count; | 5450 ++count; |
| 5330 } | 5451 } |
| 5331 this.listener.endVariablesDeclaration(count, token); | 5452 this.listener.endVariablesDeclaration(count, token); |
| 5332 return this.expectSemicolon(token); | 5453 return this.expectSemicolon(token); |
| 5333 } | 5454 } |
| 5334 BodyParser.prototype.parseOptionallyInitializedIdentifier = function(token) { | 5455 BodyParser.prototype.parseOptionallyInitializedIdentifier = function(token) { |
| 5335 this.listener.beginInitializedIdentifier(token); | 5456 this.listener.beginInitializedIdentifier(token); |
| 5336 token = this.parseIdentifier(token); | 5457 token = this.parseIdentifier(token); |
| 5337 if (this.optional(const$244/*const SourceString('=')*/, token)) { | 5458 if ($notnull_bool(this.optional(const$244/*const SourceString('=')*/, token)))
{ |
| 5338 var assignment = token; | 5459 var assignment = token; |
| 5339 this.listener.beginInitializer(token); | 5460 this.listener.beginInitializer(token); |
| 5340 token = this.parseExpression(this.next(token)); | 5461 token = this.parseExpression(this.next(token)); |
| 5341 this.listener.endInitializer(assignment); | 5462 this.listener.endInitializer(assignment); |
| 5342 } | 5463 } |
| 5343 this.listener.endInitializedIdentifier(); | 5464 this.listener.endInitializedIdentifier(); |
| 5344 return token; | 5465 return token; |
| 5345 } | 5466 } |
| 5346 BodyParser.prototype.parseFinalVarOrType = function(token) { | 5467 BodyParser.prototype.parseFinalVarOrType = function(token) { |
| 5347 this.listener.handleVarKeyword(token); | 5468 this.listener.handleVarKeyword(token); |
| 5348 return this.expect(const$181/*Keyword.VAR*/, token); | 5469 return this.expect(const$181/*Keyword.VAR*/, token); |
| 5349 } | 5470 } |
| 5350 BodyParser.prototype.parseIfStatement = function(token) { | 5471 BodyParser.prototype.parseIfStatement = function(token) { |
| 5351 var ifToken = token; | 5472 var ifToken = token; |
| 5352 this.listener.beginIfStatement(ifToken); | 5473 this.listener.beginIfStatement(ifToken); |
| 5353 token = this.expect(const$157/*Keyword.IF*/, token); | 5474 token = this.expect(const$157/*Keyword.IF*/, token); |
| 5354 this.expect(const$246/*const SourceString('(')*/, token); | 5475 this.expect(const$246/*const SourceString('(')*/, token); |
| 5355 token = this.parseArguments(token); | 5476 token = this.parseArguments(token); |
| 5356 token = this.parseStatement(token); | 5477 token = this.parseStatement(token); |
| 5357 var elseToken = null; | 5478 var elseToken = null; |
| 5358 if (this.optional(const$147/*Keyword.ELSE*/, token)) { | 5479 if ($notnull_bool(this.optional(const$147/*Keyword.ELSE*/, token))) { |
| 5359 elseToken = token; | 5480 elseToken = token; |
| 5360 token = this.parseStatement(token.next); | 5481 token = this.parseStatement(token.next); |
| 5361 } | 5482 } |
| 5362 this.listener.endIfStatement(ifToken, elseToken); | 5483 this.listener.endIfStatement(ifToken, elseToken); |
| 5363 return token; | 5484 return token; |
| 5364 } | 5485 } |
| 5365 BodyParser.prototype.parseBlock = function(token) { | 5486 BodyParser.prototype.parseBlock = function(token) { |
| 5366 var begin = token; | 5487 var begin = token; |
| 5367 this.listener.beginBlock(begin); | 5488 this.listener.beginBlock(begin); |
| 5368 var statementCount = 0; | 5489 var statementCount = 0; |
| 5369 token = this.expect(const$240/*const SourceString('{')*/, token); | 5490 token = this.expect(const$240/*const SourceString('{')*/, token); |
| 5370 while (!this.optional(const$239/*const SourceString("}")*/, token)) { | 5491 while ($notnull_bool(!this.optional(const$239/*const SourceString("}")*/, toke
n))) { |
| 5371 token = this.parseStatement(token); | 5492 token = this.parseStatement(token); |
| 5372 ++statementCount; | 5493 ++statementCount; |
| 5373 } | 5494 } |
| 5374 this.listener.endBlock(statementCount, begin, token); | 5495 this.listener.endBlock(statementCount, begin, token); |
| 5375 return this.expect(const$239/*const SourceString("}")*/, token); | 5496 return this.expect(const$239/*const SourceString("}")*/, token); |
| 5376 } | 5497 } |
| 5377 // ********** Code for Listener ************** | 5498 // ********** Code for Listener ************** |
| 5378 function Listener(canceler) { | 5499 function Listener(canceler) { |
| 5379 this.classCount = 0 | 5500 this.classCount = 0 |
| 5380 this.aliasCount = 0 | 5501 this.aliasCount = 0 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5483 Listener.prototype.expectedType = function(token) { | 5604 Listener.prototype.expectedType = function(token) { |
| 5484 this.canceler.cancel(("Expected a type, but got '" + token + "' @ " + token.ch
arOffset + "")); | 5605 this.canceler.cancel(("Expected a type, but got '" + token + "' @ " + token.ch
arOffset + "")); |
| 5485 } | 5606 } |
| 5486 Listener.prototype.expectedBlock = function(token) { | 5607 Listener.prototype.expectedBlock = function(token) { |
| 5487 this.canceler.cancel(("Expected a block, but got '" + token + "' @ " + token.c
harOffset + "")); | 5608 this.canceler.cancel(("Expected a block, but got '" + token + "' @ " + token.c
harOffset + "")); |
| 5488 } | 5609 } |
| 5489 Listener.prototype.unexpected = function(token) { | 5610 Listener.prototype.unexpected = function(token) { |
| 5490 this.canceler.cancel(("Unexpected token '" + token + "' @ " + token.charOffset
+ "")); | 5611 this.canceler.cancel(("Unexpected token '" + token + "' @ " + token.charOffset
+ "")); |
| 5491 } | 5612 } |
| 5492 Listener.prototype.push = function(token, builder) { | 5613 Listener.prototype.push = function(token, builder) { |
| 5493 this.builders = this.builders.prepend(new DeclarationBuilder(token, builder)); | 5614 var $0; |
| 5615 this.builders = (($0 = this.builders.prepend(new DeclarationBuilder(token, bui
lder))) && $0.is$Link$DeclarationBuilder()); |
| 5494 } | 5616 } |
| 5495 Listener.prototype.addElement = function(element) { | 5617 Listener.prototype.addElement = function(element) { |
| 5496 this.topLevelElements = this.topLevelElements.prepend(element); | 5618 var $0; |
| 5619 this.topLevelElements = (($0 = this.topLevelElements.prepend(element)) && $0.i
s$Link$Element()); |
| 5497 } | 5620 } |
| 5498 Listener.prototype.pop = function() { | 5621 Listener.prototype.pop = function() { |
| 5622 var $0; |
| 5499 var declaration = this.builders.get$head(); | 5623 var declaration = this.builders.get$head(); |
| 5500 this.builders = this.builders.get$tail(); | 5624 this.builders = (($0 = this.builders.get$tail()) && $0.is$Link$DeclarationBuil
der()); |
| 5501 return declaration; | 5625 return declaration; |
| 5502 } | 5626 } |
| 5503 Listener.prototype.handleDeclaration = function(declaration, token) { | 5627 Listener.prototype.handleDeclaration = function(declaration, token) { |
| 5504 declaration.endToken = token; | 5628 declaration.endToken = token; |
| 5505 declaration.endToken = token; | 5629 declaration.endToken = token; |
| 5506 this.addElement(declaration.build()); | 5630 this.addElement(declaration.build()); |
| 5507 } | 5631 } |
| 5508 Listener.prototype.voidType = function(token) { | 5632 Listener.prototype.voidType = function(token) { |
| 5509 | 5633 |
| 5510 } | 5634 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 5539 BodyListener.prototype.endArguments = function(count, beginToken, endToken) { | 5663 BodyListener.prototype.endArguments = function(count, beginToken, endToken) { |
| 5540 this.pushNode(this.makeNodeList(count, beginToken, endToken, ",")); | 5664 this.pushNode(this.makeNodeList(count, beginToken, endToken, ",")); |
| 5541 } | 5665 } |
| 5542 BodyListener.prototype.handleNoArgumentsOpt = function(token) { | 5666 BodyListener.prototype.handleNoArgumentsOpt = function(token) { |
| 5543 this.pushNode(null); | 5667 this.pushNode(null); |
| 5544 } | 5668 } |
| 5545 BodyListener.prototype.beginReturnStatement = function(token) { | 5669 BodyListener.prototype.beginReturnStatement = function(token) { |
| 5546 | 5670 |
| 5547 } | 5671 } |
| 5548 BodyListener.prototype.endReturnStatement = function(hasExpression, beginToken,
endToken) { | 5672 BodyListener.prototype.endReturnStatement = function(hasExpression, beginToken,
endToken) { |
| 5549 var expression = hasExpression ? this.popNode() : null; | 5673 var expression = $notnull_bool(hasExpression) ? this.popNode() : null; |
| 5550 this.pushNode(new Return(beginToken, endToken, expression)); | 5674 this.pushNode(new Return(beginToken, endToken, expression)); |
| 5551 } | 5675 } |
| 5552 BodyListener.prototype.beginExpressionStatement = function(token) { | 5676 BodyListener.prototype.beginExpressionStatement = function(token) { |
| 5553 | 5677 |
| 5554 } | 5678 } |
| 5555 BodyListener.prototype.endExpressionStatement = function(token) { | 5679 BodyListener.prototype.endExpressionStatement = function(token) { |
| 5556 this.pushNode(new ExpressionStatement(this.popNode(), token)); | 5680 this.pushNode(new ExpressionStatement(this.popNode(), token)); |
| 5557 } | 5681 } |
| 5558 BodyListener.prototype.onError = function(token, error) { | 5682 BodyListener.prototype.onError = function(token, error) { |
| 5559 this.canceler.cancel(("internal error @ " + token.charOffset + ": '" + token.g
et$value() + "'") + (": " + error + "")); | 5683 this.canceler.cancel(("internal error @ " + token.charOffset + ": '" + token.g
et$value() + "'") + (": " + error + "")); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5573 BodyListener.prototype.handleLiteralString = function(token) { | 5697 BodyListener.prototype.handleLiteralString = function(token) { |
| 5574 this.pushNode(new LiteralString(token)); | 5698 this.pushNode(new LiteralString(token)); |
| 5575 } | 5699 } |
| 5576 BodyListener.prototype.handleBinaryExpression = function(token) { | 5700 BodyListener.prototype.handleBinaryExpression = function(token) { |
| 5577 var arguments = new NodeList(null, LinkFactory.Link$factory(this.popNode()), n
ull, null); | 5701 var arguments = new NodeList(null, LinkFactory.Link$factory(this.popNode()), n
ull, null); |
| 5578 this.pushNode(new Send(this.popNode(), new Operator(token), arguments)); | 5702 this.pushNode(new Send(this.popNode(), new Operator(token), arguments)); |
| 5579 } | 5703 } |
| 5580 BodyListener.prototype.handleAssignmentExpression = function(token) { | 5704 BodyListener.prototype.handleAssignmentExpression = function(token) { |
| 5581 var arguments = new NodeList.singleton$ctor(this.popNode()); | 5705 var arguments = new NodeList.singleton$ctor(this.popNode()); |
| 5582 var node = this.popNode(); | 5706 var node = this.popNode(); |
| 5583 if (!(node instanceof Send)) this.canceler.cancel(('not assignable: ' + node +
'')); | 5707 if ($notnull_bool(!(node instanceof Send))) this.canceler.cancel(('not assigna
ble: ' + node + '')); |
| 5584 var send = node; | 5708 var send = node; |
| 5585 if (!send.get$isPropertyAccess()) this.canceler.cancel(('not assignable: ' + n
ode + '')); | 5709 if ($notnull_bool(!send.get$isPropertyAccess())) this.canceler.cancel(('not as
signable: ' + node + '')); |
| 5586 if ((send instanceof SetterSend)) this.canceler.cancel('chained assignment'); | 5710 if ($notnull_bool((send instanceof SetterSend))) this.canceler.cancel('chained
assignment'); |
| 5587 this.pushNode(new SetterSend(send.receiver, send.selector, token, arguments)); | 5711 this.pushNode(new SetterSend(send.receiver, send.selector, token, arguments)); |
| 5588 } | 5712 } |
| 5589 BodyListener.prototype.handleConditionalExpression = function(question, colon) { | 5713 BodyListener.prototype.handleConditionalExpression = function(question, colon) { |
| 5590 var elseExpression = this.popNode(); | 5714 var elseExpression = this.popNode(); |
| 5591 var thenExpression = this.popNode(); | 5715 var thenExpression = this.popNode(); |
| 5592 var condition = this.popNode(); | 5716 var condition = this.popNode(); |
| 5593 this.canceler.cancel('conditional expression not implemented yet'); | 5717 this.canceler.cancel('conditional expression not implemented yet'); |
| 5594 } | 5718 } |
| 5595 BodyListener.prototype.beginSend = function(token) { | 5719 BodyListener.prototype.beginSend = function(token) { |
| 5596 | 5720 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5612 BodyListener.prototype.beginFunctionName = function(token) { | 5736 BodyListener.prototype.beginFunctionName = function(token) { |
| 5613 | 5737 |
| 5614 } | 5738 } |
| 5615 BodyListener.prototype.endFunctionName = function(token) { | 5739 BodyListener.prototype.endFunctionName = function(token) { |
| 5616 | 5740 |
| 5617 } | 5741 } |
| 5618 BodyListener.prototype.beginFunctionBody = function(token) { | 5742 BodyListener.prototype.beginFunctionBody = function(token) { |
| 5619 | 5743 |
| 5620 } | 5744 } |
| 5621 BodyListener.prototype.endFunctionBody = function(count, beginToken, endToken) { | 5745 BodyListener.prototype.endFunctionBody = function(count, beginToken, endToken) { |
| 5746 var $0; |
| 5622 var block = new Block(this.makeNodeList(count, beginToken, endToken, null)); | 5747 var block = new Block(this.makeNodeList(count, beginToken, endToken, null)); |
| 5623 var formals = this.popNode(); | 5748 var formals = this.popNode(); |
| 5624 var name = this.popNode(); | 5749 var name = this.popNode(); |
| 5625 var type = new TypeAnnotation(this.popNode()); | 5750 var type = new TypeAnnotation((($0 = this.popNode()) && $0.is$Identifier())); |
| 5626 this.pushNode(new FunctionExpression(name, formals, block, type)); | 5751 this.pushNode(new FunctionExpression(name, formals, block, type)); |
| 5627 } | 5752 } |
| 5628 BodyListener.prototype.beginVariablesDeclaration = function(token) { | 5753 BodyListener.prototype.beginVariablesDeclaration = function(token) { |
| 5629 | 5754 |
| 5630 } | 5755 } |
| 5631 BodyListener.prototype.endVariablesDeclaration = function(count, endToken) { | 5756 BodyListener.prototype.endVariablesDeclaration = function(count, endToken) { |
| 5632 var variables = this.makeNodeList(count, null, null, ","); | 5757 var variables = this.makeNodeList(count, null, null, ","); |
| 5633 this.pushNode(new VariableDefinitions(null, null, variables, endToken)); | 5758 this.pushNode(new VariableDefinitions(null, null, variables, endToken)); |
| 5634 } | 5759 } |
| 5635 BodyListener.prototype.beginInitializedIdentifier = function(token) { | 5760 BodyListener.prototype.beginInitializedIdentifier = function(token) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5648 var name = this.popNode(); | 5773 var name = this.popNode(); |
| 5649 this.pushNode(new Send(name, operator, arguments)); | 5774 this.pushNode(new Send(name, operator, arguments)); |
| 5650 } | 5775 } |
| 5651 BodyListener.prototype.handleVarKeyword = function(token) { | 5776 BodyListener.prototype.handleVarKeyword = function(token) { |
| 5652 | 5777 |
| 5653 } | 5778 } |
| 5654 BodyListener.prototype.beginIfStatement = function(token) { | 5779 BodyListener.prototype.beginIfStatement = function(token) { |
| 5655 | 5780 |
| 5656 } | 5781 } |
| 5657 BodyListener.prototype.endIfStatement = function(ifToken, elseToken) { | 5782 BodyListener.prototype.endIfStatement = function(ifToken, elseToken) { |
| 5658 var elsePart = (elseToken == null) ? null : this.popNode(); | 5783 var elsePart = $notnull_bool((elseToken == null)) ? null : this.popNode(); |
| 5659 var thenPart = this.popNode(); | 5784 var thenPart = this.popNode(); |
| 5660 var condition = this.popNode(); | 5785 var condition = this.popNode(); |
| 5661 this.pushNode(new If(condition, thenPart, elsePart, ifToken, elseToken)); | 5786 this.pushNode(new If(condition, thenPart, elsePart, ifToken, elseToken)); |
| 5662 } | 5787 } |
| 5663 BodyListener.prototype.beginBlock = function(token) { | 5788 BodyListener.prototype.beginBlock = function(token) { |
| 5664 | 5789 |
| 5665 } | 5790 } |
| 5666 BodyListener.prototype.endBlock = function(count, beginToken, endToken) { | 5791 BodyListener.prototype.endBlock = function(count, beginToken, endToken) { |
| 5667 this.pushNode(new Block(this.makeNodeList(count, beginToken, endToken, null)))
; | 5792 this.pushNode(new Block(this.makeNodeList(count, beginToken, endToken, null)))
; |
| 5668 } | 5793 } |
| 5669 BodyListener.prototype.pushNode = function(node) { | 5794 BodyListener.prototype.pushNode = function(node) { |
| 5670 this.nodes = this.nodes.prepend(node); | 5795 var $0; |
| 5796 this.nodes = (($0 = this.nodes.prepend(node)) && $0.is$Link$Node()); |
| 5671 this.logger.log(("push " + this.nodes + "")); | 5797 this.logger.log(("push " + this.nodes + "")); |
| 5672 } | 5798 } |
| 5673 BodyListener.prototype.popNode = function() { | 5799 BodyListener.prototype.popNode = function() { |
| 5800 var $0; |
| 5801 $assert(!this.nodes.isEmpty(), "!nodes.isEmpty()", "leg/scanner/listener.dart"
, 360, 12); |
| 5674 var node = this.nodes.get$head(); | 5802 var node = this.nodes.get$head(); |
| 5675 this.nodes = this.nodes.get$tail(); | 5803 this.nodes = (($0 = this.nodes.get$tail()) && $0.is$Link$Node()); |
| 5676 this.logger.log(("pop " + this.nodes + "")); | 5804 this.logger.log(("pop " + this.nodes + "")); |
| 5677 return node; | 5805 return node; |
| 5678 } | 5806 } |
| 5679 BodyListener.prototype.makeNodeList = function(count, beginToken, endToken, deli
miter) { | 5807 BodyListener.prototype.makeNodeList = function(count, beginToken, endToken, deli
miter) { |
| 5808 var $0; |
| 5680 var nodes0 = const$227/*const EmptyLink<DeclarationBuilder>()*/; | 5809 var nodes0 = const$227/*const EmptyLink<DeclarationBuilder>()*/; |
| 5681 for (; count > 0; --count) { | 5810 for (; $notnull_bool(count > 0); --count) { |
| 5682 nodes0 = nodes0.prepend(this.popNode()); | 5811 nodes0 = (($0 = nodes0.prepend(this.popNode())) && $0.is$Link$Node()); |
| 5683 } | 5812 } |
| 5684 var sourceDelimiter = (delimiter == null) ? null : new StringWrapper(delimiter
); | 5813 var sourceDelimiter = $notnull_bool((delimiter == null)) ? null : new StringWr
apper(delimiter); |
| 5685 return new NodeList(beginToken, nodes0, endToken, sourceDelimiter); | 5814 return new NodeList(beginToken, nodes0, endToken, sourceDelimiter); |
| 5686 } | 5815 } |
| 5687 // ********** Code for PartialFunctionElement ************** | 5816 // ********** Code for PartialFunctionElement ************** |
| 5688 function PartialFunctionElement(name0, beginToken, endToken) { | 5817 function PartialFunctionElement(name0, beginToken, endToken) { |
| 5689 this.beginToken = beginToken; | 5818 this.beginToken = beginToken; |
| 5690 this.endToken = endToken; | 5819 this.endToken = endToken; |
| 5691 FunctionElement.call(this, name0); | 5820 FunctionElement.call(this, name0); |
| 5692 // Initializers done | 5821 // Initializers done |
| 5693 } | 5822 } |
| 5694 $inherits(PartialFunctionElement, FunctionElement); | 5823 $inherits(PartialFunctionElement, FunctionElement); |
| 5695 PartialFunctionElement.prototype.parseNode = function(canceler, logger) { | 5824 PartialFunctionElement.prototype.parseNode = function(canceler, logger) { |
| 5696 if (this.node != null) return this.node; | 5825 var $0; |
| 5826 if ($notnull_bool(this.node != null)) return this.node; |
| 5697 var listener = new BodyListener(canceler, logger); | 5827 var listener = new BodyListener(canceler, logger); |
| 5698 new BodyParser(listener).parseFunction(this.beginToken); | 5828 new BodyParser(listener).parseFunction(this.beginToken); |
| 5699 this.node = listener.popNode(); | 5829 this.node = (($0 = listener.popNode()) && $0.is$FunctionExpression()); |
| 5700 logger.log(("parsed function: " + this.node + "")); | 5830 logger.log(("parsed function: " + this.node + "")); |
| 5701 return this.node; | 5831 return this.node; |
| 5702 } | 5832 } |
| 5703 // ********** Code for StringScanner ************** | 5833 // ********** Code for StringScanner ************** |
| 5704 function StringScanner(string) { | 5834 function StringScanner(string) { |
| 5705 this.string = string; | 5835 this.string = string; |
| 5706 ArrayBasedScanner$String.call(this); | 5836 ArrayBasedScanner$String.call(this); |
| 5707 // Initializers done | 5837 // Initializers done |
| 5708 } | 5838 } |
| 5709 $inherits(StringScanner, ArrayBasedScanner$String); | 5839 $inherits(StringScanner, ArrayBasedScanner$String); |
| 5710 StringScanner.prototype.nextByte = function() { | 5840 StringScanner.prototype.nextByte = function() { |
| 5711 return this.charAt(++this.byteOffset); | 5841 return this.charAt(++this.byteOffset); |
| 5712 } | 5842 } |
| 5713 StringScanner.prototype.peek = function() { | 5843 StringScanner.prototype.peek = function() { |
| 5714 return this.charAt(this.byteOffset + 1); | 5844 return this.charAt(this.byteOffset + 1); |
| 5715 } | 5845 } |
| 5716 StringScanner.prototype.charAt = function(index) { | 5846 StringScanner.prototype.charAt = function(index) { |
| 5717 return (this.string.length > index) ? this.string.charCodeAt(index) : -1; | 5847 return $notnull_bool((this.string.length > $assert_num(index))) ? this.string.
charCodeAt(index) : -1; |
| 5718 } | 5848 } |
| 5719 StringScanner.prototype.asciiString = function(start) { | 5849 StringScanner.prototype.asciiString = function(start) { |
| 5720 return this.string.substring(start, this.byteOffset); | 5850 return this.string.substring(start, this.byteOffset); |
| 5721 } | 5851 } |
| 5722 StringScanner.prototype.utf8String = function(start, offset) { | 5852 StringScanner.prototype.utf8String = function(start, offset) { |
| 5723 return this.string.substring(start, this.byteOffset + offset + 1); | 5853 return this.string.substring(start, this.byteOffset + offset + 1); |
| 5724 } | 5854 } |
| 5725 StringScanner.prototype.appendByteStringToken = function(kind, value) { | 5855 StringScanner.prototype.appendByteStringToken = function(kind, value) { |
| 5726 this.tail.next = new StringToken(kind, value, this.tokenStart); | 5856 this.tail.next = new StringToken(kind, value, this.tokenStart); |
| 5727 this.tail = this.tail.next; | 5857 this.tail = this.tail.next; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5772 } | 5902 } |
| 5773 StringWrapper.prototype.$eq = function(other) { | 5903 StringWrapper.prototype.$eq = function(other) { |
| 5774 return !!(other && other.is$SourceString) && this.toString() == other.toString
(); | 5904 return !!(other && other.is$SourceString) && this.toString() == other.toString
(); |
| 5775 } | 5905 } |
| 5776 StringWrapper.prototype.printOn = function(sb) { | 5906 StringWrapper.prototype.printOn = function(sb) { |
| 5777 sb.add(this.internalString); | 5907 sb.add(this.internalString); |
| 5778 } | 5908 } |
| 5779 StringWrapper.prototype.toString = function() { | 5909 StringWrapper.prototype.toString = function() { |
| 5780 return this.internalString; | 5910 return this.internalString; |
| 5781 } | 5911 } |
| 5782 StringWrapper.prototype.printOn$1 = StringWrapper.prototype.printOn; | 5912 StringWrapper.prototype.printOn$1 = function($0) { |
| 5913 return this.printOn(($0 && $0.is$StringBuffer())); |
| 5914 } |
| 5915 ; |
| 5783 // ********** Code for Keyword ************** | 5916 // ********** Code for Keyword ************** |
| 5784 function Keyword(syntax, isPseudo) { | 5917 function Keyword(syntax, isPseudo) { |
| 5785 this.syntax = syntax; | 5918 this.syntax = syntax; |
| 5786 this.isPseudo = isPseudo; | 5919 this.isPseudo = isPseudo; |
| 5787 // Initializers done | 5920 // Initializers done |
| 5788 } | 5921 } |
| 5922 Keyword.prototype.is$Keyword = function(){return this;}; |
| 5789 Keyword.prototype.is$SourceString = function(){return this;}; | 5923 Keyword.prototype.is$SourceString = function(){return this;}; |
| 5790 Keyword.get$keywords = function() { | 5924 Keyword.get$keywords = function() { |
| 5791 if (Keyword._keywords == null) { | 5925 if ($notnull_bool(Keyword._keywords == null)) { |
| 5792 Keyword._keywords = Keyword.computeKeywordMap(); | 5926 Keyword._keywords = Keyword.computeKeywordMap(); |
| 5793 } | 5927 } |
| 5794 return Keyword._keywords; | 5928 return Keyword._keywords; |
| 5795 } | 5929 } |
| 5796 Keyword.computeKeywordMap = function() { | 5930 Keyword.computeKeywordMap = function() { |
| 5931 var $0; |
| 5797 var result = new LinkedHashMapImplementation$String$Keyword(); | 5932 var result = new LinkedHashMapImplementation$String$Keyword(); |
| 5798 for (var $i0 = const$222/*Keyword.values*/.iterator(); $i0.hasNext(); ) { | 5933 for (var $i0 = const$222/*Keyword.values*/.iterator(); $i0.hasNext(); ) { |
| 5799 var keyword = $i0.next(); | 5934 var keyword = $i0.next(); |
| 5800 result.$setindex(keyword.syntax, keyword); | 5935 result.$setindex(keyword.syntax, keyword); |
| 5801 } | 5936 } |
| 5802 return result; | 5937 return result; |
| 5803 } | 5938 } |
| 5804 Keyword.prototype.hashCode = function() { | 5939 Keyword.prototype.hashCode = function() { |
| 5805 return this.syntax.hashCode(); | 5940 return this.syntax.hashCode(); |
| 5806 } | 5941 } |
| 5807 Keyword.prototype.$eq = function(other) { | 5942 Keyword.prototype.$eq = function(other) { |
| 5808 return !!(other && other.is$SourceString) && this.toString() == other.toString
(); | 5943 return !!(other && other.is$SourceString) && this.toString() == other.toString
(); |
| 5809 } | 5944 } |
| 5810 Keyword.prototype.printOn = function(sb) { | 5945 Keyword.prototype.printOn = function(sb) { |
| 5811 sb.add(this.syntax); | 5946 sb.add(this.syntax); |
| 5812 } | 5947 } |
| 5813 Keyword.prototype.toString = function() { | 5948 Keyword.prototype.toString = function() { |
| 5814 return this.syntax; | 5949 return this.syntax; |
| 5815 } | 5950 } |
| 5816 Keyword.prototype.printOn$1 = Keyword.prototype.printOn; | 5951 Keyword.prototype.printOn$1 = function($0) { |
| 5952 return this.printOn(($0 && $0.is$StringBuffer())); |
| 5953 } |
| 5954 ; |
| 5817 // ********** Code for KeywordState ************** | 5955 // ********** Code for KeywordState ************** |
| 5818 function KeywordState() {} | 5956 function KeywordState() {} |
| 5819 KeywordState.get$KEYWORD_STATE = function() { | 5957 KeywordState.get$KEYWORD_STATE = function() { |
| 5820 if (KeywordState._KEYWORD_STATE == null) { | 5958 if ($notnull_bool(KeywordState._KEYWORD_STATE == null)) { |
| 5821 var strings = new ListFactory$String(const$222/*Keyword.values*/.get$length(
)); | 5959 var strings = new ListFactory$String(const$222/*Keyword.values*/.get$length(
)); |
| 5822 for (var i = 0; | 5960 for (var i = 0; |
| 5823 i < const$222/*Keyword.values*/.get$length(); i++) { | 5961 $notnull_bool(i < const$222/*Keyword.values*/.get$length()); i++) { |
| 5824 strings.$setindex(i, const$222/*Keyword.values*/[i].syntax); | 5962 strings.$setindex(i, const$222/*Keyword.values*/[i].syntax); |
| 5825 } | 5963 } |
| 5826 strings.sort((function (a, b) { | 5964 strings.sort((function (a, b) { |
| 5827 return a.compareTo(b); | 5965 return a.compareTo(b); |
| 5828 }) | 5966 }) |
| 5829 ); | 5967 ); |
| 5830 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin
gs, 0, strings.length); | 5968 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin
gs, 0, strings.length); |
| 5831 } | 5969 } |
| 5832 return KeywordState._KEYWORD_STATE; | 5970 return KeywordState._KEYWORD_STATE; |
| 5833 } | 5971 } |
| 5834 KeywordState.computeKeywordStateTable = function(start, strings, offset, length)
{ | 5972 KeywordState.computeKeywordStateTable = function(start, strings, offset, length)
{ |
| 5835 var result = new ListFactory$KeywordState(26); | 5973 var result = new ListFactory$KeywordState(26); |
| 5974 $assert(length != 0, "length != 0", "leg/scanner/keyword.dart", 160, 12); |
| 5836 var chunk = 0; | 5975 var chunk = 0; |
| 5837 var chunkStart = -1; | 5976 var chunkStart = -1; |
| 5838 for (var i = offset; | 5977 for (var i = offset; |
| 5839 i < offset + length; i++) { | 5978 $notnull_bool(i < offset + length); i++) { |
| 5840 if (strings.$index(i).length > start) { | 5979 if ($notnull_bool(strings.$index(i).length > start)) { |
| 5841 var c = strings.$index(i).charCodeAt(start); | 5980 var c = strings.$index(i).charCodeAt(start); |
| 5842 if (chunk != c) { | 5981 if ($notnull_bool(chunk != c)) { |
| 5843 if (chunkStart != -1) { | 5982 if ($notnull_bool(chunkStart != -1)) { |
| 5844 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordSta
teTable(start + 1, strings, chunkStart, i - chunkStart)); | 5983 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordSta
teTable(start + 1, strings, chunkStart, i - chunkStart)); |
| 5845 } | 5984 } |
| 5846 chunkStart = i; | 5985 chunkStart = i; |
| 5847 chunk = c; | 5986 chunk = c; |
| 5848 } | 5987 } |
| 5849 } | 5988 } |
| 5850 } | 5989 } |
| 5851 if (chunkStart != -1) { | 5990 if ($notnull_bool(chunkStart != -1)) { |
| 5852 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordStateTabl
e(start + 1, strings, chunkStart, offset + length - chunkStart)); | 5991 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordStateTabl
e(start + 1, strings, chunkStart, offset + length - chunkStart)); |
| 5853 } | 5992 } |
| 5854 else { | 5993 else { |
| 5855 return new LeafKeywordState(strings.$index(offset)); | 5994 $assert(length == 1, "length == 1", "leg/scanner/keyword.dart", 182, 14); |
| 5995 return new LeafKeywordState($assert_String(strings.$index(offset))); |
| 5856 } | 5996 } |
| 5857 return new ArrayKeywordState(result); | 5997 return new ArrayKeywordState(result); |
| 5858 } | 5998 } |
| 5859 // ********** Code for ArrayKeywordState ************** | 5999 // ********** Code for ArrayKeywordState ************** |
| 5860 function ArrayKeywordState(table) { | 6000 function ArrayKeywordState(table) { |
| 5861 this.table = table; | 6001 this.table = table; |
| 5862 // Initializers done | 6002 // Initializers done |
| 5863 } | 6003 } |
| 5864 $inherits(ArrayKeywordState, KeywordState); | 6004 $inherits(ArrayKeywordState, KeywordState); |
| 5865 ArrayKeywordState.prototype.isLeaf = function() { | 6005 ArrayKeywordState.prototype.isLeaf = function() { |
| 5866 return false; | 6006 return false; |
| 5867 } | 6007 } |
| 5868 ArrayKeywordState.prototype.next = function(c) { | 6008 ArrayKeywordState.prototype.next = function(c) { |
| 5869 return this.table.$index(c - 97/*null.$a*/); | 6009 return this.table.$index(c - 97/*null.$a*/); |
| 5870 } | 6010 } |
| 5871 ArrayKeywordState.prototype.get$keyword = function() { | 6011 ArrayKeywordState.prototype.get$keyword = function() { |
| 5872 $throw("should not be called"); | 6012 $throw("should not be called"); |
| 5873 } | 6013 } |
| 5874 ArrayKeywordState.prototype.toString = function() { | 6014 ArrayKeywordState.prototype.toString = function() { |
| 5875 var sb = new StringBufferImpl(""); | 6015 var sb = new StringBufferImpl(""); |
| 5876 sb.add("["); | 6016 sb.add("["); |
| 5877 var foo = this.table; | 6017 var foo = this.table; |
| 5878 for (var i = 0; | 6018 for (var i = 0; |
| 5879 i < foo.length; i++) { | 6019 $notnull_bool(i < foo.length); i++) { |
| 5880 if ($ne(foo.$index(i), null)) { | 6020 if ($notnull_bool($ne(foo.$index(i), null))) { |
| 5881 sb.add(("" + (i + 97/*null.$a*/) + ": " + foo.$index(i) + "; ")); | 6021 sb.add(("" + (i + 97/*null.$a*/) + ": " + foo.$index(i) + "; ")); |
| 5882 } | 6022 } |
| 5883 } | 6023 } |
| 5884 sb.add("]"); | 6024 sb.add("]"); |
| 5885 return sb.toString(); | 6025 return sb.toString(); |
| 5886 } | 6026 } |
| 5887 // ********** Code for LeafKeywordState ************** | 6027 // ********** Code for LeafKeywordState ************** |
| 5888 function LeafKeywordState(syntax) { | 6028 function LeafKeywordState(syntax) { |
| 5889 this.keyword = Keyword.get$keywords().$index(syntax); | 6029 var $0; |
| 6030 this.keyword = (($0 = Keyword.get$keywords().$index(syntax)) && $0.is$Keyword(
)); |
| 5890 // Initializers done | 6031 // Initializers done |
| 5891 } | 6032 } |
| 5892 $inherits(LeafKeywordState, KeywordState); | 6033 $inherits(LeafKeywordState, KeywordState); |
| 5893 LeafKeywordState.prototype.get$keyword = function() { return this.keyword; }; | 6034 LeafKeywordState.prototype.get$keyword = function() { return this.keyword; }; |
| 5894 LeafKeywordState.prototype.set$keyword = function(value) { return this.keyword =
value; }; | 6035 LeafKeywordState.prototype.set$keyword = function(value) { return this.keyword =
value; }; |
| 5895 LeafKeywordState.prototype.isLeaf = function() { | 6036 LeafKeywordState.prototype.isLeaf = function() { |
| 5896 return true; | 6037 return true; |
| 5897 } | 6038 } |
| 5898 LeafKeywordState.prototype.next = function(c) { | 6039 LeafKeywordState.prototype.next = function(c) { |
| 5899 return null; | 6040 return null; |
| 5900 } | 6041 } |
| 5901 LeafKeywordState.prototype.toString = function() { | 6042 LeafKeywordState.prototype.toString = function() { |
| 5902 return this.keyword.syntax; | 6043 return this.keyword.syntax; |
| 5903 } | 6044 } |
| 5904 // ********** Code for top level ************** | 6045 // ********** Code for top level ************** |
| 5905 // ********** Library tree ************** | 6046 // ********** Library tree ************** |
| 5906 // ********** Code for Node ************** | 6047 // ********** Code for Node ************** |
| 5907 function Node() {} | 6048 function Node() {} |
| 6049 Node.prototype.is$Node = function(){return this;}; |
| 5908 Node.prototype.hashCode = function() { | 6050 Node.prototype.hashCode = function() { |
| 5909 return this._hashCode; | 6051 return this._hashCode; |
| 5910 } | 6052 } |
| 5911 Node.prototype.toString = function() { | 6053 Node.prototype.toString = function() { |
| 5912 return this.unparse(); | 6054 return this.unparse(); |
| 5913 } | 6055 } |
| 5914 Node.prototype.unparse = function() { | 6056 Node.prototype.unparse = function() { |
| 5915 var unparser = new DebugUnparser(); | 6057 var unparser = new DebugUnparser(); |
| 5916 try { | 6058 try { |
| 5917 return unparser.unparse(this); | 6059 return unparser.unparse(this); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 5941 return visitor.visitSend(this); | 6083 return visitor.visitSend(this); |
| 5942 } | 6084 } |
| 5943 Send.prototype.get$isPropertyAccess = function() { | 6085 Send.prototype.get$isPropertyAccess = function() { |
| 5944 return this.argumentsNode == null; | 6086 return this.argumentsNode == null; |
| 5945 } | 6087 } |
| 5946 Send.prototype.getBeginToken = function() { | 6088 Send.prototype.getBeginToken = function() { |
| 5947 return firstBeginToken(this.receiver, this.selector); | 6089 return firstBeginToken(this.receiver, this.selector); |
| 5948 } | 6090 } |
| 5949 Send.prototype.getEndToken = function() { | 6091 Send.prototype.getEndToken = function() { |
| 5950 var token = this.argumentsNode.getEndToken(); | 6092 var token = this.argumentsNode.getEndToken(); |
| 5951 if (token != null) return token; | 6093 if ($notnull_bool(token != null)) return token; |
| 5952 if (this.selector != null) { | 6094 if ($notnull_bool(this.selector != null)) { |
| 5953 return this.selector.getEndToken(); | 6095 return this.selector.getEndToken(); |
| 5954 } | 6096 } |
| 5955 return this.receiver.getBeginToken(); | 6097 return this.receiver.getBeginToken(); |
| 5956 } | 6098 } |
| 5957 // ********** Code for SetterSend ************** | 6099 // ********** Code for SetterSend ************** |
| 5958 function SetterSend(receiver0, selector0, assignmentOperator, argumentsNode0) { | 6100 function SetterSend(receiver0, selector0, assignmentOperator, argumentsNode0) { |
| 5959 this.assignmentOperator = assignmentOperator; | 6101 this.assignmentOperator = assignmentOperator; |
| 5960 Send.call(this, receiver0, selector0, argumentsNode0); | 6102 Send.call(this, receiver0, selector0, argumentsNode0); |
| 5961 // Initializers done | 6103 // Initializers done |
| 5962 } | 6104 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5975 NodeList.singleton$ctor = function(node) { | 6117 NodeList.singleton$ctor = function(node) { |
| 5976 NodeList.call(this, null, LinkFactory.Link$factory(node)); | 6118 NodeList.call(this, null, LinkFactory.Link$factory(node)); |
| 5977 // Initializers done | 6119 // Initializers done |
| 5978 } | 6120 } |
| 5979 NodeList.singleton$ctor.prototype = NodeList.prototype; | 6121 NodeList.singleton$ctor.prototype = NodeList.prototype; |
| 5980 $inherits(NodeList, Node); | 6122 $inherits(NodeList, Node); |
| 5981 NodeList.prototype.accept = function(visitor) { | 6123 NodeList.prototype.accept = function(visitor) { |
| 5982 return visitor.visitNodeList(this); | 6124 return visitor.visitNodeList(this); |
| 5983 } | 6125 } |
| 5984 NodeList.prototype.getBeginToken = function() { | 6126 NodeList.prototype.getBeginToken = function() { |
| 5985 if (this.beginToken != null) return this.beginToken; | 6127 var $0; |
| 5986 if (this.nodes != null) { | 6128 if ($notnull_bool(this.beginToken != null)) return this.beginToken; |
| 6129 if ($notnull_bool(this.nodes != null)) { |
| 5987 for (var link = this.nodes; | 6130 for (var link = this.nodes; |
| 5988 !link.isEmpty(); link = link.get$tail()) { | 6131 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Lin
k$Node())) { |
| 5989 if (link.get$head().getBeginToken() != null) { | 6132 if ($notnull_bool(link.get$head().getBeginToken() != null)) { |
| 5990 return link.get$head().getBeginToken(); | 6133 return link.get$head().getBeginToken(); |
| 5991 } | 6134 } |
| 5992 if (link.get$head().getEndToken() != null) { | 6135 if ($notnull_bool(link.get$head().getEndToken() != null)) { |
| 5993 return link.get$head().getEndToken(); | 6136 return link.get$head().getEndToken(); |
| 5994 } | 6137 } |
| 5995 } | 6138 } |
| 5996 } | 6139 } |
| 5997 return this.endToken; | 6140 return this.endToken; |
| 5998 } | 6141 } |
| 5999 NodeList.prototype.getEndToken = function() { | 6142 NodeList.prototype.getEndToken = function() { |
| 6000 if (this.endToken != null) return this.endToken; | 6143 var $0; |
| 6001 if (this.nodes != null) { | 6144 if ($notnull_bool(this.endToken != null)) return this.endToken; |
| 6145 if ($notnull_bool(this.nodes != null)) { |
| 6002 var link = this.nodes; | 6146 var link = this.nodes; |
| 6003 while (!link.get$tail().isEmpty()) link = link.get$tail(); | 6147 while ($notnull_bool(!link.get$tail().isEmpty())) link = (($0 = link.get$tai
l()) && $0.is$Link$Node()); |
| 6004 if (link.get$head().getEndToken() != null) return link.get$head().getEndToke
n(); | 6148 if ($notnull_bool(link.get$head().getEndToken() != null)) return link.get$he
ad().getEndToken(); |
| 6005 if (link.get$head().getBeginToken() != null) return link.get$head().getBegin
Token(); | 6149 if ($notnull_bool(link.get$head().getBeginToken() != null)) return link.get$
head().getBeginToken(); |
| 6006 } | 6150 } |
| 6007 return this.beginToken; | 6151 return this.beginToken; |
| 6008 } | 6152 } |
| 6009 // ********** Code for Block ************** | 6153 // ********** Code for Block ************** |
| 6010 function Block(statements) { | 6154 function Block(statements) { |
| 6011 this.statements = statements; | 6155 this.statements = statements; |
| 6012 // Initializers done | 6156 // Initializers done |
| 6013 } | 6157 } |
| 6014 $inherits(Block, Statement); | 6158 $inherits(Block, Statement); |
| 6015 Block.prototype.accept = function(visitor) { | 6159 Block.prototype.accept = function(visitor) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 6034 If.prototype.get$hasElsePart = function() { | 6178 If.prototype.get$hasElsePart = function() { |
| 6035 return this.elsePart != null; | 6179 return this.elsePart != null; |
| 6036 } | 6180 } |
| 6037 If.prototype.accept = function(visitor) { | 6181 If.prototype.accept = function(visitor) { |
| 6038 return visitor.visitIf(this); | 6182 return visitor.visitIf(this); |
| 6039 } | 6183 } |
| 6040 If.prototype.getBeginToken = function() { | 6184 If.prototype.getBeginToken = function() { |
| 6041 return this.ifToken; | 6185 return this.ifToken; |
| 6042 } | 6186 } |
| 6043 If.prototype.getEndToken = function() { | 6187 If.prototype.getEndToken = function() { |
| 6044 if (this.elsePart == null) return this.thenPart.getEndToken(); | 6188 if ($notnull_bool(this.elsePart == null)) return this.thenPart.getEndToken(); |
| 6045 return this.elsePart.getEndToken(); | 6189 return this.elsePart.getEndToken(); |
| 6046 } | 6190 } |
| 6047 // ********** Code for FunctionExpression ************** | 6191 // ********** Code for FunctionExpression ************** |
| 6048 function FunctionExpression(name, parameters, body, returnType) { | 6192 function FunctionExpression(name, parameters, body, returnType) { |
| 6049 this.name = name; | 6193 this.name = name; |
| 6050 this.parameters = parameters; | 6194 this.parameters = parameters; |
| 6051 this.body = body; | 6195 this.body = body; |
| 6052 this.returnType = returnType; | 6196 this.returnType = returnType; |
| 6053 // Initializers done | 6197 // Initializers done |
| 6054 } | 6198 } |
| 6055 $inherits(FunctionExpression, Expression); | 6199 $inherits(FunctionExpression, Expression); |
| 6200 FunctionExpression.prototype.is$FunctionExpression = function(){return this;}; |
| 6056 FunctionExpression.prototype.get$name = function() { return this.name; }; | 6201 FunctionExpression.prototype.get$name = function() { return this.name; }; |
| 6057 FunctionExpression.prototype.get$parameters = function() { return this.parameter
s; }; | 6202 FunctionExpression.prototype.get$parameters = function() { return this.parameter
s; }; |
| 6058 FunctionExpression.prototype.get$returnType = function() { return this.returnTyp
e; }; | 6203 FunctionExpression.prototype.get$returnType = function() { return this.returnTyp
e; }; |
| 6059 FunctionExpression.prototype.accept = function(visitor) { | 6204 FunctionExpression.prototype.accept = function(visitor) { |
| 6060 return visitor.visitFunctionExpression(this); | 6205 return visitor.visitFunctionExpression(this); |
| 6061 } | 6206 } |
| 6062 FunctionExpression.prototype.getBeginToken = function() { | 6207 FunctionExpression.prototype.getBeginToken = function() { |
| 6063 return firstBeginToken(this.returnType, this.name); | 6208 return firstBeginToken(this.returnType, this.name); |
| 6064 } | 6209 } |
| 6065 FunctionExpression.prototype.getEndToken = function() { | 6210 FunctionExpression.prototype.getEndToken = function() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6113 return this._hashCode; | 6258 return this._hashCode; |
| 6114 } | 6259 } |
| 6115 // ********** Code for LiteralInt ************** | 6260 // ********** Code for LiteralInt ************** |
| 6116 function LiteralInt(token0, handler0) { | 6261 function LiteralInt(token0, handler0) { |
| 6117 Literal$int.call(this, token0, handler0); | 6262 Literal$int.call(this, token0, handler0); |
| 6118 // Initializers done | 6263 // Initializers done |
| 6119 } | 6264 } |
| 6120 $inherits(LiteralInt, Literal$int); | 6265 $inherits(LiteralInt, Literal$int); |
| 6121 LiteralInt.prototype.get$value = function() { | 6266 LiteralInt.prototype.get$value = function() { |
| 6122 try { | 6267 try { |
| 6123 return Math.parseInt(this.token.get$value().toString()); | 6268 return Math.parseInt($assert_String(this.token.get$value().toString())); |
| 6124 } catch (ex) { | 6269 } catch (ex) { |
| 6125 ex = $toDartException(ex); | 6270 ex = $toDartException(ex); |
| 6126 if (!(ex instanceof BadNumberFormatException)) throw ex; | 6271 if (!(ex instanceof BadNumberFormatException)) throw ex; |
| 6127 (this.handler)(this.token, ex); | 6272 (this.handler)(this.token, ex); |
| 6128 } | 6273 } |
| 6129 } | 6274 } |
| 6130 LiteralInt.prototype.accept = function(visitor) { | 6275 LiteralInt.prototype.accept = function(visitor) { |
| 6131 return visitor.visitLiteralInt(this); | 6276 return visitor.visitLiteralInt(this); |
| 6132 } | 6277 } |
| 6133 LiteralInt.prototype.getBeginToken = function() { | 6278 LiteralInt.prototype.getBeginToken = function() { |
| 6134 return null; | 6279 return null; |
| 6135 } | 6280 } |
| 6136 LiteralInt.prototype.getEndToken = function() { | 6281 LiteralInt.prototype.getEndToken = function() { |
| 6137 return null; | 6282 return null; |
| 6138 } | 6283 } |
| 6139 // ********** Code for LiteralDouble ************** | 6284 // ********** Code for LiteralDouble ************** |
| 6140 function LiteralDouble(token0, handler0) { | 6285 function LiteralDouble(token0, handler0) { |
| 6141 Literal$double.call(this, token0, handler0); | 6286 Literal$double.call(this, token0, handler0); |
| 6142 // Initializers done | 6287 // Initializers done |
| 6143 } | 6288 } |
| 6144 $inherits(LiteralDouble, Literal$double); | 6289 $inherits(LiteralDouble, Literal$double); |
| 6145 LiteralDouble.prototype.get$value = function() { | 6290 LiteralDouble.prototype.get$value = function() { |
| 6146 try { | 6291 try { |
| 6147 return Math.parseDouble(this.token.get$value().toString()); | 6292 return Math.parseDouble($assert_String(this.token.get$value().toString())); |
| 6148 } catch (ex) { | 6293 } catch (ex) { |
| 6149 ex = $toDartException(ex); | 6294 ex = $toDartException(ex); |
| 6150 if (!(ex instanceof BadNumberFormatException)) throw ex; | 6295 if (!(ex instanceof BadNumberFormatException)) throw ex; |
| 6151 (this.handler)(this.token, ex); | 6296 (this.handler)(this.token, ex); |
| 6152 } | 6297 } |
| 6153 } | 6298 } |
| 6154 LiteralDouble.prototype.accept = function(visitor) { | 6299 LiteralDouble.prototype.accept = function(visitor) { |
| 6155 return visitor.visitLiteralDouble(this); | 6300 return visitor.visitLiteralDouble(this); |
| 6156 } | 6301 } |
| 6157 // ********** Code for LiteralBool ************** | 6302 // ********** Code for LiteralBool ************** |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6190 } | 6335 } |
| 6191 LiteralString.prototype.accept = function(visitor) { | 6336 LiteralString.prototype.accept = function(visitor) { |
| 6192 return visitor.visitLiteralString(this); | 6337 return visitor.visitLiteralString(this); |
| 6193 } | 6338 } |
| 6194 // ********** Code for Identifier ************** | 6339 // ********** Code for Identifier ************** |
| 6195 function Identifier(token) { | 6340 function Identifier(token) { |
| 6196 this.token = token; | 6341 this.token = token; |
| 6197 // Initializers done | 6342 // Initializers done |
| 6198 } | 6343 } |
| 6199 $inherits(Identifier, Expression); | 6344 $inherits(Identifier, Expression); |
| 6345 Identifier.prototype.is$Identifier = function(){return this;}; |
| 6200 Identifier.prototype.get$source = function() { | 6346 Identifier.prototype.get$source = function() { |
| 6201 return this.token.get$value(); | 6347 return this.token.get$value(); |
| 6202 } | 6348 } |
| 6203 Identifier.prototype.accept = function(visitor) { | 6349 Identifier.prototype.accept = function(visitor) { |
| 6204 return visitor.visitIdentifier(this); | 6350 return visitor.visitIdentifier(this); |
| 6205 } | 6351 } |
| 6206 Identifier.prototype.getBeginToken = function() { | 6352 Identifier.prototype.getBeginToken = function() { |
| 6207 return this.token; | 6353 return this.token; |
| 6208 } | 6354 } |
| 6209 Identifier.prototype.getEndToken = function() { | 6355 Identifier.prototype.getEndToken = function() { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6303 // Initializers done | 6449 // Initializers done |
| 6304 } | 6450 } |
| 6305 DebugUnparser.prototype.unparse = function(node) { | 6451 DebugUnparser.prototype.unparse = function(node) { |
| 6306 this.separator = ''; | 6452 this.separator = ''; |
| 6307 this.sb = new StringBufferImpl(""); | 6453 this.sb = new StringBufferImpl(""); |
| 6308 this.visit(node); | 6454 this.visit(node); |
| 6309 return this.sb.toString(); | 6455 return this.sb.toString(); |
| 6310 } | 6456 } |
| 6311 DebugUnparser.prototype.visit = function(node, withSeparator) { | 6457 DebugUnparser.prototype.visit = function(node, withSeparator) { |
| 6312 var previous = this.separator; | 6458 var previous = this.separator; |
| 6313 this.separator = (withSeparator != null) ? withSeparator : this.separator; | 6459 this.separator = $assert_String($notnull_bool((withSeparator != null)) ? withS
eparator : this.separator); |
| 6314 if (node != null) node.accept(this); | 6460 if ($notnull_bool(node != null)) node.accept(this); |
| 6315 this.separator = previous; | 6461 this.separator = previous; |
| 6316 } | 6462 } |
| 6317 DebugUnparser.prototype.visitBlock = function(node) { | 6463 DebugUnparser.prototype.visitBlock = function(node) { |
| 6318 this.visit(node.statements); | 6464 this.visit(node.statements); |
| 6319 } | 6465 } |
| 6320 DebugUnparser.prototype.visitExpressionStatement = function(node) { | 6466 DebugUnparser.prototype.visitExpressionStatement = function(node) { |
| 6321 this.visit(node.expression); | 6467 this.visit(node.expression); |
| 6322 this.sb.add(';'); | 6468 this.sb.add(';'); |
| 6323 } | 6469 } |
| 6324 DebugUnparser.prototype.visitFunctionExpression = function(node) { | 6470 DebugUnparser.prototype.visitFunctionExpression = function(node) { |
| 6325 if (node.returnType != null) { | 6471 if ($notnull_bool(node.returnType != null)) { |
| 6326 this.visit(node.returnType); | 6472 this.visit(node.returnType); |
| 6327 this.sb.add(' '); | 6473 this.sb.add(' '); |
| 6328 } | 6474 } |
| 6329 this.visit(node.name); | 6475 this.visit(node.name); |
| 6330 this.visit(node.parameters, ', '); | 6476 this.visit(node.parameters, ', '); |
| 6331 this.visit(node.body); | 6477 this.visit(node.body); |
| 6332 } | 6478 } |
| 6333 DebugUnparser.prototype.visitIdentifier = function(node) { | 6479 DebugUnparser.prototype.visitIdentifier = function(node) { |
| 6334 node.get$source().printOn(this.sb); | 6480 node.get$source().printOn(this.sb); |
| 6335 } | 6481 } |
| 6336 DebugUnparser.prototype.visitIf = function(node) { | 6482 DebugUnparser.prototype.visitIf = function(node) { |
| 6337 node.ifToken.get$value().printOn$1(this.sb); | 6483 node.ifToken.get$value().printOn$1(this.sb); |
| 6338 this.visit(node.condition); | 6484 this.visit(node.condition); |
| 6339 this.visit(node.thenPart); | 6485 this.visit(node.thenPart); |
| 6340 if (node.get$hasElsePart()) { | 6486 if ($notnull_bool(node.get$hasElsePart())) { |
| 6341 node.elseToken.get$value().printOn$1(this.sb); | 6487 node.elseToken.get$value().printOn$1(this.sb); |
| 6342 this.visit(node.elsePart); | 6488 this.visit(node.elsePart); |
| 6343 } | 6489 } |
| 6344 } | 6490 } |
| 6345 DebugUnparser.prototype.visitLiteralBool = function(node) { | 6491 DebugUnparser.prototype.visitLiteralBool = function(node) { |
| 6346 node.token.get$value().printOn$1(this.sb); | 6492 node.token.get$value().printOn$1(this.sb); |
| 6347 } | 6493 } |
| 6348 DebugUnparser.prototype.visitLiteralDouble = function(node) { | 6494 DebugUnparser.prototype.visitLiteralDouble = function(node) { |
| 6349 node.token.get$value().printOn$1(this.sb); | 6495 node.token.get$value().printOn$1(this.sb); |
| 6350 } | 6496 } |
| 6351 DebugUnparser.prototype.visitLiteralInt = function(node) { | 6497 DebugUnparser.prototype.visitLiteralInt = function(node) { |
| 6352 node.token.get$value().printOn$1(this.sb); | 6498 node.token.get$value().printOn$1(this.sb); |
| 6353 } | 6499 } |
| 6354 DebugUnparser.prototype.visitLiteralString = function(node) { | 6500 DebugUnparser.prototype.visitLiteralString = function(node) { |
| 6355 node.token.get$value().printOn$1(this.sb); | 6501 node.token.get$value().printOn$1(this.sb); |
| 6356 } | 6502 } |
| 6357 DebugUnparser.prototype.visitNodeList = function(node) { | 6503 DebugUnparser.prototype.visitNodeList = function(node) { |
| 6504 var $0; |
| 6358 var first = true; | 6505 var first = true; |
| 6359 if (node.beginToken != null) this.sb.add(node.beginToken); | 6506 if ($notnull_bool(node.beginToken != null)) this.sb.add(node.beginToken); |
| 6360 if (node.nodes != null) { | 6507 if ($notnull_bool(node.nodes != null)) { |
| 6361 var delimiter = node.delimiter; | 6508 var delimiter = node.delimiter; |
| 6362 if (delimiter == null) delimiter = new StringWrapper(this.separator); | 6509 if ($notnull_bool(delimiter == null)) delimiter = new StringWrapper(this.sep
arator); |
| 6363 var $list = node.nodes; | 6510 var $list = node.nodes; |
| 6364 for (var $i = node.nodes.iterator(); $i.hasNext(); ) { | 6511 for (var $i = node.nodes.iterator(); $i.hasNext(); ) { |
| 6365 var element = $i.next(); | 6512 var element = $i.next(); |
| 6366 if (!first) delimiter.printOn(this.sb); | 6513 if ($notnull_bool(!first)) delimiter.printOn(this.sb); |
| 6367 first = false; | 6514 first = false; |
| 6368 this.visit(element); | 6515 this.visit(element); |
| 6369 } | 6516 } |
| 6370 } | 6517 } |
| 6371 if (node.endToken != null) this.sb.add(node.endToken); | 6518 if ($notnull_bool(node.endToken != null)) this.sb.add(node.endToken); |
| 6372 } | 6519 } |
| 6373 DebugUnparser.prototype.visitOperator = function(node) { | 6520 DebugUnparser.prototype.visitOperator = function(node) { |
| 6374 this.visitIdentifier(node); | 6521 this.visitIdentifier(node); |
| 6375 } | 6522 } |
| 6376 DebugUnparser.prototype.visitParameter = function(node) { | 6523 DebugUnparser.prototype.visitParameter = function(node) { |
| 6377 if (node.typeAnnotation != null) { | 6524 if ($notnull_bool(node.typeAnnotation != null)) { |
| 6378 this.visit(node.typeAnnotation); | 6525 this.visit(node.typeAnnotation); |
| 6379 this.sb.add(' '); | 6526 this.sb.add(' '); |
| 6380 } | 6527 } |
| 6381 this.visit(node.name); | 6528 this.visit(node.name); |
| 6382 } | 6529 } |
| 6383 DebugUnparser.prototype.visitReturn = function(node) { | 6530 DebugUnparser.prototype.visitReturn = function(node) { |
| 6384 node.beginToken.get$value().printOn$1(this.sb); | 6531 node.beginToken.get$value().printOn$1(this.sb); |
| 6385 if (node.get$hasExpression()) { | 6532 if ($notnull_bool(node.get$hasExpression())) { |
| 6386 this.sb.add(' '); | 6533 this.sb.add(' '); |
| 6387 this.visit(node.expression); | 6534 this.visit(node.expression); |
| 6388 } | 6535 } |
| 6389 node.endToken.get$value().printOn$1(this.sb); | 6536 node.endToken.get$value().printOn$1(this.sb); |
| 6390 } | 6537 } |
| 6391 DebugUnparser.prototype.visitSend = function(node) { | 6538 DebugUnparser.prototype.visitSend = function(node) { |
| 6392 if (node.receiver != null) { | 6539 if ($notnull_bool(node.receiver != null)) { |
| 6393 this.visit(node.receiver); | 6540 this.visit(node.receiver); |
| 6394 if (!(node.selector instanceof Operator)) this.sb.add('.'); | 6541 if ($notnull_bool(!(node.selector instanceof Operator))) this.sb.add('.'); |
| 6395 } | 6542 } |
| 6396 this.visit(node.selector); | 6543 this.visit(node.selector); |
| 6397 this.visit(node.argumentsNode, ', '); | 6544 this.visit(node.argumentsNode, ', '); |
| 6398 } | 6545 } |
| 6399 DebugUnparser.prototype.visitSetterSend = function(node) { | 6546 DebugUnparser.prototype.visitSetterSend = function(node) { |
| 6400 if (node.receiver != null) { | 6547 if ($notnull_bool(node.receiver != null)) { |
| 6401 this.visit(node.receiver); | 6548 this.visit(node.receiver); |
| 6402 this.sb.add('.'); | 6549 this.sb.add('.'); |
| 6403 } | 6550 } |
| 6404 this.visit(node.selector); | 6551 this.visit(node.selector); |
| 6405 node.assignmentOperator.get$value().printOn$1(this.sb); | 6552 node.assignmentOperator.get$value().printOn$1(this.sb); |
| 6406 this.visit(node.argumentsNode, ', '); | 6553 this.visit(node.argumentsNode, ', '); |
| 6407 } | 6554 } |
| 6408 DebugUnparser.prototype.visitTypeAnnotation = function(node) { | 6555 DebugUnparser.prototype.visitTypeAnnotation = function(node) { |
| 6409 this.visit(node.typeName); | 6556 this.visit(node.typeName); |
| 6410 } | 6557 } |
| 6411 DebugUnparser.prototype.visitVariableDefinitions = function(node) { | 6558 DebugUnparser.prototype.visitVariableDefinitions = function(node) { |
| 6412 if (node.type != null) { | 6559 if ($notnull_bool(node.type != null)) { |
| 6413 this.visit(node.type); | 6560 this.visit(node.type); |
| 6414 this.sb.add(' '); | 6561 this.sb.add(' '); |
| 6415 } | 6562 } |
| 6416 this.visit(node.definitions, ', '); | 6563 this.visit(node.definitions, ', '); |
| 6417 this.sb.add('; '); | 6564 this.sb.add('; '); |
| 6418 } | 6565 } |
| 6419 // ********** Code for top level ************** | 6566 // ********** Code for top level ************** |
| 6420 function firstBeginToken(first, second) { | 6567 function firstBeginToken(first, second) { |
| 6421 return (first != null) ? first.getBeginToken() : second.getBeginToken(); | 6568 return $notnull_bool((first != null)) ? first.getBeginToken() : second.getBegi
nToken(); |
| 6422 } | 6569 } |
| 6423 // ********** Library elements ************** | 6570 // ********** Library elements ************** |
| 6424 // ********** Code for Element ************** | 6571 // ********** Code for Element ************** |
| 6425 function Element(name, enclosingElement) { | 6572 function Element(name, enclosingElement) { |
| 6426 this.name = name; | 6573 this.name = name; |
| 6427 this.enclosingElement = enclosingElement; | 6574 this.enclosingElement = enclosingElement; |
| 6428 // Initializers done | 6575 // Initializers done |
| 6429 } | 6576 } |
| 6577 Element.prototype.is$Element = function(){return this;}; |
| 6430 Element.prototype.get$name = function() { return this.name; }; | 6578 Element.prototype.get$name = function() { return this.name; }; |
| 6431 Element.prototype.hashCode = function() { | 6579 Element.prototype.hashCode = function() { |
| 6432 return this.name.hashCode(); | 6580 return this.name.hashCode(); |
| 6433 } | 6581 } |
| 6434 // ********** Code for FunctionElement ************** | 6582 // ********** Code for FunctionElement ************** |
| 6435 function FunctionElement(name0) { | 6583 function FunctionElement(name0) { |
| 6436 Element.call(this, name0); | 6584 Element.call(this, name0); |
| 6437 // Initializers done | 6585 // Initializers done |
| 6438 } | 6586 } |
| 6439 $inherits(FunctionElement, Element); | 6587 $inherits(FunctionElement, Element); |
| 6440 FunctionElement.prototype.computeType = function(compiler, types) { | 6588 FunctionElement.prototype.computeType = function(compiler, types) { |
| 6441 if (this.type != null) return this.type; | 6589 var $0; |
| 6590 if ($notnull_bool(this.type != null)) return this.type; |
| 6442 var node = this.parseNode(compiler, compiler); | 6591 var node = this.parseNode(compiler, compiler); |
| 6443 var returnType = getType(node.returnType, types); | 6592 var returnType = getType(node.returnType, types); |
| 6444 var parameterTypes = new LinkBuilderImplementation$Type(); | 6593 var parameterTypes = new LinkBuilderImplementation$Type(); |
| 6445 for (var link = node.parameters.nodes; | 6594 for (var link = node.parameters.nodes; |
| 6446 !link.isEmpty(); link = link.get$tail()) { | 6595 $notnull_bool(!link.isEmpty()); link = link.get$tail()) { |
| 6447 compiler.cancel('parameters not supported.'); | 6596 compiler.cancel('parameters not supported.'); |
| 6448 var parameter = link.get$head(); | 6597 var parameter = link.get$head(); |
| 6449 parameterTypes.addLast(getType(parameter.typeAnnotation, types)); | 6598 parameterTypes.addLast(getType(parameter.typeAnnotation, types)); |
| 6450 } | 6599 } |
| 6451 this.type = new FunctionType(returnType, parameterTypes.toLink()); | 6600 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0
.is$Link$Type())); |
| 6452 return this.type; | 6601 return this.type; |
| 6453 } | 6602 } |
| 6454 // ********** Code for top level ************** | 6603 // ********** Code for top level ************** |
| 6455 function getType(annotation, types) { | 6604 function getType(annotation, types) { |
| 6456 if (annotation == null || annotation.typeName == null) { | 6605 if ($notnull_bool(annotation == null || annotation.typeName == null)) { |
| 6457 return types.DYNAMIC; | 6606 return types.DYNAMIC; |
| 6458 } | 6607 } |
| 6459 var name = annotation.typeName.get$source(); | 6608 var name = annotation.typeName.get$source(); |
| 6460 if ($eq(name, types.VOID.get$name())) { | 6609 if ($notnull_bool($eq(name, types.VOID.get$name()))) { |
| 6461 return types.VOID; | 6610 return types.VOID; |
| 6462 } | 6611 } |
| 6463 else if ($eq(name, types.INT.get$name())) { | 6612 else if ($notnull_bool($eq(name, types.INT.get$name()))) { |
| 6464 return types.INT; | 6613 return types.INT; |
| 6465 } | 6614 } |
| 6466 else if ($eq(name, types.STRING.get$name())) { | 6615 else if ($notnull_bool($eq(name, types.STRING.get$name()))) { |
| 6467 return types.STRING; | 6616 return types.STRING; |
| 6468 } | 6617 } |
| 6469 else { | 6618 else { |
| 6470 $throw("Unreachable"); | 6619 $throw("Unreachable"); |
| 6471 } | 6620 } |
| 6472 } | 6621 } |
| 6473 // ********** Library ssa ************** | 6622 // ********** Library ssa ************** |
| 6474 // ********** Code for SsaBuilderTask ************** | 6623 // ********** Code for SsaBuilderTask ************** |
| 6475 function SsaBuilderTask(compiler0) { | 6624 function SsaBuilderTask(compiler0) { |
| 6476 CompilerTask.call(this, compiler0); | 6625 CompilerTask.call(this, compiler0); |
| 6477 // Initializers done | 6626 // Initializers done |
| 6478 } | 6627 } |
| 6479 $inherits(SsaBuilderTask, CompilerTask); | 6628 $inherits(SsaBuilderTask, CompilerTask); |
| 6480 SsaBuilderTask.prototype.get$name = function() { | 6629 SsaBuilderTask.prototype.get$name = function() { |
| 6481 return 'SSA builder'; | 6630 return 'SSA builder'; |
| 6482 } | 6631 } |
| 6483 SsaBuilderTask.prototype.build = function(tree) { | 6632 SsaBuilderTask.prototype.build = function(tree) { |
| 6484 var $this = this; // closure support | 6633 var $this = this; // closure support |
| 6485 return this.measure((function () { | 6634 return this.measure((function () { |
| 6486 var function_ = tree; | 6635 var function_ = tree; |
| 6487 var graph = $this.compileMethod(function_.body); | 6636 var graph = $this.compileMethod(function_.body); |
| 6488 if (false/*null.GENERATE_SSA_TRACE*/) { | 6637 $assert(graph.isValid(), "graph.isValid()", "leg/ssa/builder.dart", 13, 14); |
| 6638 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) { |
| 6489 var name0 = tree.get$name(); | 6639 var name0 = tree.get$name(); |
| 6490 HTracer.HTracer$singleton$factory().traceCompilation(name0.get$source().to
String()); | 6640 HTracer.HTracer$singleton$factory().traceCompilation(name0.get$source().to
String()); |
| 6491 HTracer.HTracer$singleton$factory().traceGraph('builder', graph); | 6641 HTracer.HTracer$singleton$factory().traceGraph('builder', graph); |
| 6492 } | 6642 } |
| 6493 return graph; | 6643 return graph; |
| 6494 }) | 6644 }) |
| 6495 ); | 6645 ); |
| 6496 } | 6646 } |
| 6497 SsaBuilderTask.prototype.compileMethod = function(body) { | 6647 SsaBuilderTask.prototype.compileMethod = function(body) { |
| 6498 var builder = new SsaBuilder(this.compiler); | 6648 var builder = new SsaBuilder(this.compiler); |
| 6499 var graph = builder.build(body); | 6649 var graph = builder.build(body); |
| 6500 return graph; | 6650 return graph; |
| 6501 } | 6651 } |
| 6502 // ********** Code for SsaBuilder ************** | 6652 // ********** Code for SsaBuilder ************** |
| 6503 function SsaBuilder(compiler) { | 6653 function SsaBuilder(compiler) { |
| 6504 this.compiler = compiler; | 6654 this.compiler = compiler; |
| 6505 // Initializers done | 6655 // Initializers done |
| 6506 } | 6656 } |
| 6507 SsaBuilder.prototype.build = function(body) { | 6657 SsaBuilder.prototype.build = function(body) { |
| 6508 this.graph = new HGraph(); | 6658 this.graph = new HGraph(); |
| 6509 this.block = new HBasicBlock(); | 6659 this.block = new HBasicBlock(); |
| 6510 this.stack = new ListFactory$HInstruction(); | 6660 this.stack = new ListFactory$HInstruction(); |
| 6511 body.accept(this); | 6661 body.accept(this); |
| 6512 if (this.block.last == null || !(this.block.last instanceof HReturn)) { | 6662 if ($notnull_bool(this.block.last == null || !(this.block.last instanceof HRet
urn))) { |
| 6513 this.block.add(new HGoto()); | 6663 this.block.add(new HGoto()); |
| 6514 this.graph.setSuccessors(this.block, [this.graph.exit]); | 6664 this.graph.setSuccessors(this.block, [this.graph.exit]); |
| 6515 } | 6665 } |
| 6516 this.graph.entry.add(new HGoto()); | 6666 this.graph.entry.add(new HGoto()); |
| 6517 this.graph.setSuccessors(this.graph.entry, [this.block]); | 6667 this.graph.setSuccessors(this.graph.entry, [this.block]); |
| 6518 return this.graph; | 6668 return this.graph; |
| 6519 } | 6669 } |
| 6520 SsaBuilder.prototype.add = function(instruction) { | 6670 SsaBuilder.prototype.add = function(instruction) { |
| 6521 this.block.add(instruction); | 6671 this.block.add(instruction); |
| 6522 } | 6672 } |
| 6523 SsaBuilder.prototype.push = function(instruction) { | 6673 SsaBuilder.prototype.push = function(instruction) { |
| 6524 this.add(instruction); | 6674 this.add(instruction); |
| 6525 this.stack.add(instruction); | 6675 this.stack.add(instruction); |
| 6526 } | 6676 } |
| 6527 SsaBuilder.prototype.pop = function() { | 6677 SsaBuilder.prototype.pop = function() { |
| 6528 return this.stack.removeLast(); | 6678 return this.stack.removeLast(); |
| 6529 } | 6679 } |
| 6530 SsaBuilder.prototype.visit = function(node) { | 6680 SsaBuilder.prototype.visit = function(node) { |
| 6531 if (node != null) node.accept(this); | 6681 if ($notnull_bool(node != null)) node.accept(this); |
| 6532 } | 6682 } |
| 6533 SsaBuilder.prototype.visitBlock = function(node) { | 6683 SsaBuilder.prototype.visitBlock = function(node) { |
| 6534 this.visit(node.statements); | 6684 this.visit(node.statements); |
| 6535 if (!this.stack.isEmpty()) this.compiler.cancel('non-empty instruction stack')
; | 6685 if ($notnull_bool(!this.stack.isEmpty())) this.compiler.cancel('non-empty inst
ruction stack'); |
| 6536 } | 6686 } |
| 6537 SsaBuilder.prototype.visitExpressionStatement = function(node) { | 6687 SsaBuilder.prototype.visitExpressionStatement = function(node) { |
| 6538 this.visit(node.expression); | 6688 this.visit(node.expression); |
| 6539 this.pop(); | 6689 this.pop(); |
| 6540 } | 6690 } |
| 6541 SsaBuilder.prototype.visitFunctionExpression = function(node) { | 6691 SsaBuilder.prototype.visitFunctionExpression = function(node) { |
| 6542 this.compiler.cancel(); | 6692 this.compiler.cancel(); |
| 6543 } | 6693 } |
| 6544 SsaBuilder.prototype.visitIdentifier = function(node) { | 6694 SsaBuilder.prototype.visitIdentifier = function(node) { |
| 6545 this.compiler.cancel(); | 6695 this.compiler.cancel(); |
| 6546 } | 6696 } |
| 6547 SsaBuilder.prototype.visitIf = function(node) { | 6697 SsaBuilder.prototype.visitIf = function(node) { |
| 6548 this.compiler.cancel("ssa/builder.dart: visitIf not implemented"); | 6698 this.compiler.cancel("ssa/builder.dart: visitIf not implemented"); |
| 6549 } | 6699 } |
| 6550 SsaBuilder.prototype.visitSend = function(node) { | 6700 SsaBuilder.prototype.visitSend = function(node) { |
| 6551 if ((node.selector instanceof Operator)) { | 6701 var $0; |
| 6702 if ($notnull_bool((node.selector instanceof Operator))) { |
| 6552 this.visit(node.receiver); | 6703 this.visit(node.receiver); |
| 6553 this.visit(node.argumentsNode); | 6704 this.visit(node.argumentsNode); |
| 6554 var right = this.pop(); | 6705 var right = this.pop(); |
| 6555 var left = this.pop(); | 6706 var left = this.pop(); |
| 6556 var op = node.selector; | 6707 var op = node.selector; |
| 6557 if ($eq(const$258/*const SourceString("+")*/, op.get$source())) { | 6708 if ($notnull_bool($eq(const$258/*const SourceString("+")*/, op.get$source())
)) { |
| 6558 this.push(new HAdd([left, right])); | 6709 this.push(new HAdd([left, right])); |
| 6559 } | 6710 } |
| 6560 else if ($eq(const$259/*const SourceString("-")*/, op.get$source())) { | 6711 else if ($notnull_bool($eq(const$259/*const SourceString("-")*/, op.get$sour
ce()))) { |
| 6561 this.push(new HSubtract([left, right])); | 6712 this.push(new HSubtract([left, right])); |
| 6562 } | 6713 } |
| 6563 else if ($eq(const$260/*const SourceString("*")*/, op.get$source())) { | 6714 else if ($notnull_bool($eq(const$260/*const SourceString("*")*/, op.get$sour
ce()))) { |
| 6564 this.push(new HMultiply([left, right])); | 6715 this.push(new HMultiply([left, right])); |
| 6565 } | 6716 } |
| 6566 else if ($eq(const$261/*const SourceString("/")*/, op.get$source())) { | 6717 else if ($notnull_bool($eq(const$261/*const SourceString("/")*/, op.get$sour
ce()))) { |
| 6567 this.push(new HDivide([left, right])); | 6718 this.push(new HDivide([left, right])); |
| 6568 } | 6719 } |
| 6569 else if ($eq(const$262/*const SourceString("~/")*/, op.get$source())) { | 6720 else if ($notnull_bool($eq(const$262/*const SourceString("~/")*/, op.get$sou
rce()))) { |
| 6570 this.push(new HTruncatingDivide([left, right])); | 6721 this.push(new HTruncatingDivide([left, right])); |
| 6571 } | 6722 } |
| 6572 } | 6723 } |
| 6573 else { | 6724 else { |
| 6574 this.visit(node.argumentsNode); | 6725 this.visit(node.argumentsNode); |
| 6575 var arguments = []; | 6726 var arguments = []; |
| 6576 for (var link = node.get$arguments(); | 6727 for (var link = node.get$arguments(); |
| 6577 !link.isEmpty(); link = link.get$tail()) { | 6728 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Lin
k$Node())) { |
| 6578 arguments.add(this.pop()); | 6729 arguments.add(this.pop()); |
| 6579 } | 6730 } |
| 6580 var selector = node.selector; | 6731 var selector = node.selector; |
| 6581 this.push(new HInvoke(selector.get$source(), arguments)); | 6732 this.push(new HInvoke(selector.get$source(), arguments)); |
| 6582 } | 6733 } |
| 6583 } | 6734 } |
| 6584 SsaBuilder.prototype.visitLiteralInt = function(node) { | 6735 SsaBuilder.prototype.visitLiteralInt = function(node) { |
| 6585 this.push(new HLiteral(node.get$value())); | 6736 this.push(new HLiteral(node.get$value())); |
| 6586 } | 6737 } |
| 6587 SsaBuilder.prototype.visitLiteralDouble = function(node) { | 6738 SsaBuilder.prototype.visitLiteralDouble = function(node) { |
| 6588 this.push(new HLiteral(node.get$value())); | 6739 this.push(new HLiteral(node.get$value())); |
| 6589 } | 6740 } |
| 6590 SsaBuilder.prototype.visitLiteralBool = function(node) { | 6741 SsaBuilder.prototype.visitLiteralBool = function(node) { |
| 6591 this.push(new HLiteral(node.get$value())); | 6742 this.push(new HLiteral(node.get$value())); |
| 6592 } | 6743 } |
| 6593 SsaBuilder.prototype.visitLiteralString = function(node) { | 6744 SsaBuilder.prototype.visitLiteralString = function(node) { |
| 6594 this.push(new HLiteral(node.get$value())); | 6745 this.push(new HLiteral(node.get$value())); |
| 6595 } | 6746 } |
| 6596 SsaBuilder.prototype.visitNodeList = function(node) { | 6747 SsaBuilder.prototype.visitNodeList = function(node) { |
| 6748 var $0; |
| 6597 for (var link = node.nodes; | 6749 for (var link = node.nodes; |
| 6598 !link.isEmpty(); link = link.get$tail()) { | 6750 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { |
| 6599 this.visit(link.get$head()); | 6751 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 6600 } | 6752 } |
| 6601 } | 6753 } |
| 6602 SsaBuilder.prototype.visitOperator = function(node) { | 6754 SsaBuilder.prototype.visitOperator = function(node) { |
| 6603 this.compiler.unimplemented("SsaBuilder::visitOperator"); | 6755 this.compiler.unimplemented("SsaBuilder::visitOperator"); |
| 6604 } | 6756 } |
| 6605 SsaBuilder.prototype.visitParameter = function(node) { | 6757 SsaBuilder.prototype.visitParameter = function(node) { |
| 6606 this.compiler.unimplemented("SsaBuilder::visitParameter"); | 6758 this.compiler.unimplemented("SsaBuilder::visitParameter"); |
| 6607 } | 6759 } |
| 6608 SsaBuilder.prototype.visitReturn = function(node) { | 6760 SsaBuilder.prototype.visitReturn = function(node) { |
| 6609 this.visit(node.expression); | 6761 this.visit(node.expression); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6624 } | 6776 } |
| 6625 $inherits(SsaCodeGeneratorTask, CompilerTask); | 6777 $inherits(SsaCodeGeneratorTask, CompilerTask); |
| 6626 SsaCodeGeneratorTask.prototype.get$name = function() { | 6778 SsaCodeGeneratorTask.prototype.get$name = function() { |
| 6627 return 'SSA code generator'; | 6779 return 'SSA code generator'; |
| 6628 } | 6780 } |
| 6629 SsaCodeGeneratorTask.prototype.generate = function(tree, graph) { | 6781 SsaCodeGeneratorTask.prototype.generate = function(tree, graph) { |
| 6630 var $this = this; // closure support | 6782 var $this = this; // closure support |
| 6631 return this.measure((function () { | 6783 return this.measure((function () { |
| 6632 var function_ = tree; | 6784 var function_ = tree; |
| 6633 var name0 = function_.name; | 6785 var name0 = function_.name; |
| 6634 if (false/*null.GENERATE_SSA_TRACE*/) { | 6786 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) { |
| 6635 HTracer.HTracer$singleton$factory().traceGraph("codegen", graph); | 6787 HTracer.HTracer$singleton$factory().traceGraph("codegen", graph); |
| 6636 } | 6788 } |
| 6637 var code = $this.generateMethod(name0.get$source(), graph); | 6789 var code = $this.generateMethod(name0.get$source(), graph); |
| 6638 return code; | 6790 return code; |
| 6639 }) | 6791 }) |
| 6640 ); | 6792 ); |
| 6641 } | 6793 } |
| 6642 SsaCodeGeneratorTask.prototype.generateMethod = function(methodName, graph) { | 6794 SsaCodeGeneratorTask.prototype.generateMethod = function(methodName, graph) { |
| 6643 var buffer = new StringBufferImpl(""); | 6795 var buffer = new StringBufferImpl(""); |
| 6644 var codegen = new SsaCodeGenerator(this.compiler, buffer); | 6796 var codegen = new SsaCodeGenerator(this.compiler, buffer); |
| 6645 graph.number(); | 6797 graph.number(); |
| 6646 codegen.visitGraph(graph); | 6798 codegen.visitGraph(graph); |
| 6647 return ('function ' + methodName + '() {\n' + buffer + '}\n'); | 6799 return ('function ' + methodName + '() {\n' + buffer + '}\n'); |
| 6648 } | 6800 } |
| 6649 // ********** Code for SsaCodeGenerator ************** | 6801 // ********** Code for SsaCodeGenerator ************** |
| 6650 function SsaCodeGenerator(compiler, buffer) { | 6802 function SsaCodeGenerator(compiler, buffer) { |
| 6651 this.compiler = compiler; | 6803 this.compiler = compiler; |
| 6652 this.buffer = buffer; | 6804 this.buffer = buffer; |
| 6653 // Initializers done | 6805 // Initializers done |
| 6654 } | 6806 } |
| 6655 SsaCodeGenerator.prototype.visitGraph = function(graph) { | 6807 SsaCodeGenerator.prototype.visitGraph = function(graph) { |
| 6656 var $this = this; // closure support | 6808 var $this = this; // closure support |
| 6657 function visitBasicBlockAndSuccessors(block) { | 6809 function visitBasicBlockAndSuccessors(block) { |
| 6810 var $0; |
| 6658 $this.visit(block); | 6811 $this.visit(block); |
| 6659 if (!block.successors.isEmpty()) { | 6812 if ($notnull_bool(!block.successors.isEmpty())) { |
| 6660 visitBasicBlockAndSuccessors(block.successors.$index(0)); | 6813 $assert(block.successors.length == 1, "block.successors.length == 1", "leg
/ssa/codegen.dart", 39, 16); |
| 6814 visitBasicBlockAndSuccessors((($0 = block.successors.$index(0)) && $0.is$H
BasicBlock())); |
| 6661 } | 6815 } |
| 6662 } | 6816 } |
| 6663 visitBasicBlockAndSuccessors(graph.entry); | 6817 visitBasicBlockAndSuccessors(graph.entry); |
| 6664 } | 6818 } |
| 6665 SsaCodeGenerator.prototype.temporary = function(instruction) { | 6819 SsaCodeGenerator.prototype.temporary = function(instruction) { |
| 6666 return ('t' + instruction.id + ''); | 6820 return ('t' + instruction.id + ''); |
| 6667 } | 6821 } |
| 6668 SsaCodeGenerator.prototype.invoke = function(selector, arguments) { | 6822 SsaCodeGenerator.prototype.invoke = function(selector, arguments) { |
| 6823 var $0; |
| 6669 this.buffer.add(("" + selector + "(")); | 6824 this.buffer.add(("" + selector + "(")); |
| 6670 for (var i = 0; | 6825 for (var i = 0; |
| 6671 i < arguments.length; i++) { | 6826 $notnull_bool(i < arguments.length); i++) { |
| 6672 if (i != 0) this.buffer.add(', '); | 6827 if ($notnull_bool(i != 0)) this.buffer.add(', '); |
| 6673 this.use(arguments.$index(i)); | 6828 this.use((($0 = arguments.$index(i)) && $0.is$HInstruction())); |
| 6674 } | 6829 } |
| 6675 this.buffer.add(")"); | 6830 this.buffer.add(")"); |
| 6676 } | 6831 } |
| 6677 SsaCodeGenerator.prototype.define = function(instruction) { | 6832 SsaCodeGenerator.prototype.define = function(instruction) { |
| 6678 this.buffer.add(('var ' + this.temporary(instruction) + ' = ')); | 6833 this.buffer.add(('var ' + this.temporary(instruction) + ' = ')); |
| 6679 this.visit(instruction); | 6834 this.visit(instruction); |
| 6680 } | 6835 } |
| 6681 SsaCodeGenerator.prototype.use = function(argument) { | 6836 SsaCodeGenerator.prototype.use = function(argument) { |
| 6682 if (argument.canBeGeneratedAtUseSite()) { | 6837 if ($notnull_bool(argument.canBeGeneratedAtUseSite())) { |
| 6683 this.visit(argument); | 6838 this.visit(argument); |
| 6684 } | 6839 } |
| 6685 else { | 6840 else { |
| 6686 this.buffer.add(this.temporary(argument)); | 6841 this.buffer.add(this.temporary(argument)); |
| 6687 } | 6842 } |
| 6688 } | 6843 } |
| 6689 SsaCodeGenerator.prototype.visit = function(node) { | 6844 SsaCodeGenerator.prototype.visit = function(node) { |
| 6690 return node.accept(this); | 6845 return node.accept(this); |
| 6691 } | 6846 } |
| 6692 SsaCodeGenerator.prototype.visitAdd = function(node) { | 6847 SsaCodeGenerator.prototype.visitAdd = function(node) { |
| 6693 this.invoke(const$266/*const SourceString('\$add')*/, node.inputs); | 6848 this.invoke(const$266/*const SourceString('\$add')*/, node.inputs); |
| 6694 } | 6849 } |
| 6695 SsaCodeGenerator.prototype.visitBasicBlock = function(node) { | 6850 SsaCodeGenerator.prototype.visitBasicBlock = function(node) { |
| 6696 var instruction = node.first; | 6851 var instruction = node.first; |
| 6697 while (instruction != null) { | 6852 while ($notnull_bool(instruction != null)) { |
| 6698 if (!instruction.canBeSkipped()) { | 6853 if ($notnull_bool(!instruction.canBeSkipped())) { |
| 6699 this.buffer.add(' '); | 6854 this.buffer.add(' '); |
| 6700 if (!instruction.get$usedBy().isEmpty()) { | 6855 if ($notnull_bool(!instruction.get$usedBy().isEmpty())) { |
| 6701 this.define(instruction); | 6856 this.define(instruction); |
| 6702 } | 6857 } |
| 6703 else { | 6858 else { |
| 6704 this.visit(instruction); | 6859 this.visit(instruction); |
| 6705 } | 6860 } |
| 6706 this.buffer.add(';\n'); | 6861 this.buffer.add(';\n'); |
| 6707 } | 6862 } |
| 6708 instruction = instruction.next; | 6863 instruction = instruction.next; |
| 6709 } | 6864 } |
| 6710 } | 6865 } |
| 6711 SsaCodeGenerator.prototype.visitDivide = function(node) { | 6866 SsaCodeGenerator.prototype.visitDivide = function(node) { |
| 6712 this.invoke(const$267/*const SourceString('\$div')*/, node.inputs); | 6867 this.invoke(const$267/*const SourceString('\$div')*/, node.inputs); |
| 6713 } | 6868 } |
| 6714 SsaCodeGenerator.prototype.visitExit = function(node) { | 6869 SsaCodeGenerator.prototype.visitExit = function(node) { |
| 6715 unreachable(); | 6870 unreachable(); |
| 6716 } | 6871 } |
| 6717 SsaCodeGenerator.prototype.visitGoto = function(node) { | 6872 SsaCodeGenerator.prototype.visitGoto = function(node) { |
| 6718 unreachable(); | 6873 unreachable(); |
| 6719 } | 6874 } |
| 6720 SsaCodeGenerator.prototype.visitInvoke = function(node) { | 6875 SsaCodeGenerator.prototype.visitInvoke = function(node) { |
| 6721 this.invoke(node.selector, node.inputs); | 6876 this.invoke(node.selector, node.inputs); |
| 6722 } | 6877 } |
| 6723 SsaCodeGenerator.prototype.visitLiteral = function(node) { | 6878 SsaCodeGenerator.prototype.visitLiteral = function(node) { |
| 6724 this.buffer.add(node.value); | 6879 this.buffer.add(node.value); |
| 6725 } | 6880 } |
| 6726 SsaCodeGenerator.prototype.visitMultiply = function(node) { | 6881 SsaCodeGenerator.prototype.visitMultiply = function(node) { |
| 6727 this.invoke(const$268/*const SourceString('\$mul')*/, node.inputs); | 6882 this.invoke(const$268/*const SourceString('\$mul')*/, node.inputs); |
| 6728 } | 6883 } |
| 6729 SsaCodeGenerator.prototype.visitReturn = function(node) { | 6884 SsaCodeGenerator.prototype.visitReturn = function(node) { |
| 6885 var $0; |
| 6730 this.buffer.add('return '); | 6886 this.buffer.add('return '); |
| 6731 this.use(node.inputs.$index(0)); | 6887 this.use((($0 = node.inputs.$index(0)) && $0.is$HInstruction())); |
| 6732 } | 6888 } |
| 6733 SsaCodeGenerator.prototype.visitSubtract = function(node) { | 6889 SsaCodeGenerator.prototype.visitSubtract = function(node) { |
| 6734 this.invoke(const$269/*const SourceString('\$sub')*/, node.inputs); | 6890 this.invoke(const$269/*const SourceString('\$sub')*/, node.inputs); |
| 6735 } | 6891 } |
| 6736 SsaCodeGenerator.prototype.visitTruncatingDivide = function(node) { | 6892 SsaCodeGenerator.prototype.visitTruncatingDivide = function(node) { |
| 6737 this.invoke(const$270/*const SourceString('\$tdiv')*/, node.inputs); | 6893 this.invoke(const$270/*const SourceString('\$tdiv')*/, node.inputs); |
| 6738 } | 6894 } |
| 6739 // ********** Code for HGraphVisitor ************** | 6895 // ********** Code for HGraphVisitor ************** |
| 6740 function HGraphVisitor() { | 6896 function HGraphVisitor() { |
| 6741 // Initializers done | 6897 // Initializers done |
| 6742 } | 6898 } |
| 6743 HGraphVisitor.prototype.visitDominatorTree = function(graph) { | 6899 HGraphVisitor.prototype.visitDominatorTree = function(graph) { |
| 6744 var $this = this; // closure support | 6900 var $this = this; // closure support |
| 6745 function visitBasicBlockAndSuccessors(block) { | 6901 function visitBasicBlockAndSuccessors(block) { |
| 6902 var $0; |
| 6746 $this.visitBasicBlock(block); | 6903 $this.visitBasicBlock(block); |
| 6747 for (var i = 0; | 6904 for (var i = 0; |
| 6748 i < block.successors.length; i++) { | 6905 $notnull_bool(i < block.successors.length); i++) { |
| 6749 visitBasicBlockAndSuccessors(block.successors.$index(i)); | 6906 visitBasicBlockAndSuccessors((($0 = block.successors.$index(i)) && $0.is$H
BasicBlock())); |
| 6750 } | 6907 } |
| 6751 } | 6908 } |
| 6752 visitBasicBlockAndSuccessors(graph.entry); | 6909 visitBasicBlockAndSuccessors(graph.entry); |
| 6753 } | 6910 } |
| 6754 HGraphVisitor.prototype.visitPostDominatorTree = function(graph) { | 6911 HGraphVisitor.prototype.visitPostDominatorTree = function(graph) { |
| 6755 var $this = this; // closure support | 6912 var $this = this; // closure support |
| 6756 function visitBasicBlockAndSuccessors(block) { | 6913 function visitBasicBlockAndSuccessors(block) { |
| 6914 var $0; |
| 6757 for (var i = 0; | 6915 for (var i = 0; |
| 6758 i < block.successors.length; i++) { | 6916 $notnull_bool(i < block.successors.length); i++) { |
| 6759 visitBasicBlockAndSuccessors(block.successors.$index(i)); | 6917 visitBasicBlockAndSuccessors((($0 = block.successors.$index(i)) && $0.is$H
BasicBlock())); |
| 6760 } | 6918 } |
| 6761 $this.visitBasicBlock(block); | 6919 $this.visitBasicBlock(block); |
| 6762 } | 6920 } |
| 6763 visitBasicBlockAndSuccessors(graph.entry); | 6921 visitBasicBlockAndSuccessors(graph.entry); |
| 6764 } | 6922 } |
| 6765 // ********** Code for HInstructionVisitor ************** | 6923 // ********** Code for HInstructionVisitor ************** |
| 6766 function HInstructionVisitor() { | 6924 function HInstructionVisitor() { |
| 6767 HGraphVisitor.call(this); | 6925 HGraphVisitor.call(this); |
| 6768 // Initializers done | 6926 // Initializers done |
| 6769 } | 6927 } |
| 6770 $inherits(HInstructionVisitor, HGraphVisitor); | 6928 $inherits(HInstructionVisitor, HGraphVisitor); |
| 6771 HInstructionVisitor.prototype.visitBasicBlock = function(node) { | 6929 HInstructionVisitor.prototype.visitBasicBlock = function(node) { |
| 6772 this.currentBlock = node; | 6930 this.currentBlock = node; |
| 6773 var instruction = node.first; | 6931 var instruction = node.first; |
| 6774 while (instruction != null) { | 6932 while ($notnull_bool(instruction != null)) { |
| 6775 this.visitInstruction(instruction); | 6933 this.visitInstruction(instruction); |
| 6776 instruction = instruction.next; | 6934 instruction = instruction.next; |
| 6777 } | 6935 } |
| 6778 } | 6936 } |
| 6779 // ********** Code for HGraph ************** | 6937 // ********** Code for HGraph ************** |
| 6780 function HGraph() { | 6938 function HGraph() { |
| 6781 this.entry = new HBasicBlock(); | 6939 this.entry = new HBasicBlock(); |
| 6782 this.exit = new HBasicBlock(); | 6940 this.exit = new HBasicBlock(); |
| 6783 // Initializers done | 6941 // Initializers done |
| 6784 this.exit.add(new HExit()); | 6942 this.exit.add(new HExit()); |
| 6785 } | 6943 } |
| 6786 HGraph.prototype.number = function() { | 6944 HGraph.prototype.number = function() { |
| 6787 var basicBlockId = 0; | 6945 var basicBlockId = 0; |
| 6788 function numberBasicBlockAndSuccessors(block, id) { | 6946 function numberBasicBlockAndSuccessors(block, id) { |
| 6947 var $0; |
| 6789 id = block.number(basicBlockId++, id); | 6948 id = block.number(basicBlockId++, id); |
| 6790 for (var i = 0; | 6949 for (var i = 0; |
| 6791 i < block.successors.length; i++) { | 6950 $notnull_bool(i < block.successors.length); i++) { |
| 6792 id = numberBasicBlockAndSuccessors(block.successors.$index(i), id); | 6951 id = numberBasicBlockAndSuccessors((($0 = block.successors.$index(i)) && $
0.is$HBasicBlock()), id); |
| 6793 } | 6952 } |
| 6794 return id; | 6953 return id; |
| 6795 } | 6954 } |
| 6796 numberBasicBlockAndSuccessors(this.entry, 0); | 6955 numberBasicBlockAndSuccessors(this.entry, 0); |
| 6797 } | 6956 } |
| 6798 HGraph.prototype.setSuccessors = function(source, targets) { | 6957 HGraph.prototype.setSuccessors = function(source, targets) { |
| 6958 $assert(((source.last instanceof HGoto) || (source.last instanceof HReturn)) &
& targets.length == 1, "(source.last is HGoto || source.last is HReturn) &&\n
targets.length == 1", "leg/ssa/nodes.dart", 83, 12); |
| 6959 $assert(source.successors.isEmpty(), "source.successors.isEmpty()", "leg/ssa/n
odes.dart", 85, 12); |
| 6799 source.successors = targets; | 6960 source.successors = targets; |
| 6800 for (var i = 0; | 6961 for (var i = 0; |
| 6801 i < targets.length; i++) { | 6962 $notnull_bool(i < targets.length); i++) { |
| 6802 targets.$index(i).predecessors.add(source); | 6963 targets.$index(i).predecessors.add(source); |
| 6803 } | 6964 } |
| 6804 } | 6965 } |
| 6805 HGraph.prototype.isValid = function() { | 6966 HGraph.prototype.isValid = function() { |
| 6806 var validator = new HValidator(); | 6967 var validator = new HValidator(); |
| 6807 validator.visitGraph(this); | 6968 validator.visitGraph(this); |
| 6808 return validator.isValid; | 6969 return validator.isValid; |
| 6809 } | 6970 } |
| 6810 // ********** Code for HBaseVisitor ************** | 6971 // ********** Code for HBaseVisitor ************** |
| 6811 function HBaseVisitor() { | 6972 function HBaseVisitor() { |
| 6812 HGraphVisitor.call(this); | 6973 HGraphVisitor.call(this); |
| 6813 // Initializers done | 6974 // Initializers done |
| 6814 } | 6975 } |
| 6815 $inherits(HBaseVisitor, HGraphVisitor); | 6976 $inherits(HBaseVisitor, HGraphVisitor); |
| 6816 HBaseVisitor.prototype.visitBasicBlock = function(node) { | 6977 HBaseVisitor.prototype.visitBasicBlock = function(node) { |
| 6817 this.currentBlock = node; | 6978 this.currentBlock = node; |
| 6818 var instruction = node.first; | 6979 var instruction = node.first; |
| 6819 while (instruction != null) { | 6980 while ($notnull_bool(instruction != null)) { |
| 6820 instruction.accept(this); | 6981 instruction.accept(this); |
| 6821 instruction = instruction.next; | 6982 instruction = instruction.next; |
| 6822 } | 6983 } |
| 6823 } | 6984 } |
| 6824 HBaseVisitor.prototype.visitInstruction = function(HInstruction0) { | 6985 HBaseVisitor.prototype.visitInstruction = function(HInstruction0) { |
| 6825 | 6986 |
| 6826 } | 6987 } |
| 6827 HBaseVisitor.prototype.visitArithmetic = function(node, operation) { | 6988 HBaseVisitor.prototype.visitArithmetic = function(node, operation) { |
| 6828 return this.visitInvoke(node); | 6989 return this.visitInvoke(node); |
| 6829 } | 6990 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 6858 return this.visitArithmetic(node, '~/'); | 7019 return this.visitArithmetic(node, '~/'); |
| 6859 } | 7020 } |
| 6860 // ********** Code for HBasicBlock ************** | 7021 // ********** Code for HBasicBlock ************** |
| 6861 function HBasicBlock() { | 7022 function HBasicBlock() { |
| 6862 this.first = null | 7023 this.first = null |
| 6863 this.last = null | 7024 this.last = null |
| 6864 this.predecessors = []; | 7025 this.predecessors = []; |
| 6865 this.successors = const$226/*const []*/; | 7026 this.successors = const$226/*const []*/; |
| 6866 // Initializers done | 7027 // Initializers done |
| 6867 } | 7028 } |
| 7029 HBasicBlock.prototype.is$HBasicBlock = function(){return this;}; |
| 6868 HBasicBlock.prototype.number = function(basicBlockId, id0) { | 7030 HBasicBlock.prototype.number = function(basicBlockId, id0) { |
| 6869 this.id = basicBlockId; | 7031 this.id = basicBlockId; |
| 6870 var instruction = this.first; | 7032 var instruction = this.first; |
| 6871 while (instruction != null) { | 7033 while ($notnull_bool(instruction != null)) { |
| 6872 instruction.id = id0++; | 7034 instruction.id = id0++; |
| 6873 instruction = instruction.next; | 7035 instruction = instruction.next; |
| 6874 } | 7036 } |
| 6875 return id0; | 7037 return id0; |
| 6876 } | 7038 } |
| 6877 HBasicBlock.prototype.accept = function(visitor) { | 7039 HBasicBlock.prototype.accept = function(visitor) { |
| 6878 return visitor.visitBasicBlock(this); | 7040 return visitor.visitBasicBlock(this); |
| 6879 } | 7041 } |
| 6880 HBasicBlock.prototype.add = function(instruction) { | 7042 HBasicBlock.prototype.add = function(instruction) { |
| 6881 this.addAfter(this.last, instruction); | 7043 this.addAfter(this.last, instruction); |
| 6882 } | 7044 } |
| 6883 HBasicBlock.prototype.addAfter = function(cursor, instruction) { | 7045 HBasicBlock.prototype.addAfter = function(cursor, instruction) { |
| 6884 if (cursor == null) { | 7046 if ($notnull_bool(cursor == null)) { |
| 6885 this.first = this.last = instruction; | 7047 this.first = this.last = instruction; |
| 6886 } | 7048 } |
| 6887 else if (cursor === this.last) { | 7049 else if ($notnull_bool(cursor === this.last)) { |
| 6888 this.last.next = instruction; | 7050 this.last.next = instruction; |
| 6889 instruction.previous = this.last; | 7051 instruction.previous = this.last; |
| 6890 this.last = instruction; | 7052 this.last = instruction; |
| 6891 } | 7053 } |
| 6892 else { | 7054 else { |
| 6893 instruction.previous = cursor; | 7055 instruction.previous = cursor; |
| 6894 instruction.next = cursor.next; | 7056 instruction.next = cursor.next; |
| 6895 cursor.next.previous = instruction; | 7057 cursor.next.previous = instruction; |
| 6896 cursor.next = instruction; | 7058 cursor.next = instruction; |
| 6897 } | 7059 } |
| 6898 instruction.notifyAddedToBlock(); | 7060 instruction.notifyAddedToBlock(); |
| 6899 } | 7061 } |
| 6900 HBasicBlock.prototype.remove = function(instruction) { | 7062 HBasicBlock.prototype.remove = function(instruction) { |
| 6901 if (instruction.previous == null) { | 7063 $assert(instruction.isInBasicBlock(), "instruction.isInBasicBlock()", "leg/ssa
/nodes.dart", 183, 12); |
| 7064 $assert(instruction.get$usedBy().isEmpty(), "instruction.usedBy.isEmpty()", "l
eg/ssa/nodes.dart", 184, 12); |
| 7065 if ($notnull_bool(instruction.previous == null)) { |
| 6902 this.first = instruction.next; | 7066 this.first = instruction.next; |
| 6903 } | 7067 } |
| 6904 else { | 7068 else { |
| 6905 instruction.previous.next = instruction.next; | 7069 instruction.previous.next = instruction.next; |
| 6906 } | 7070 } |
| 6907 if (instruction.next == null) { | 7071 if ($notnull_bool(instruction.next == null)) { |
| 6908 this.last = instruction.previous; | 7072 this.last = instruction.previous; |
| 6909 } | 7073 } |
| 6910 else { | 7074 else { |
| 6911 instruction.next.previous = instruction.previous; | 7075 instruction.next.previous = instruction.previous; |
| 6912 } | 7076 } |
| 6913 instruction.notifyRemovedFromBlock(); | 7077 instruction.notifyRemovedFromBlock(); |
| 6914 } | 7078 } |
| 6915 HBasicBlock.prototype.rewrite = function(from, to) { | 7079 HBasicBlock.prototype.rewrite = function(from, to) { |
| 6916 var $list = from.get$usedBy(); | 7080 var $list = from.get$usedBy(); |
| 6917 for (var $i = 0;$i < $list.length; $i++) { | 7081 for (var $i = 0;$i < $list.length; $i++) { |
| 6918 var use = $list.$index($i); | 7082 var use = $list.$index($i); |
| 6919 HBasicBlock.rewriteInput(use, from, to); | 7083 HBasicBlock.rewriteInput(use, from, to); |
| 6920 } | 7084 } |
| 6921 to.get$usedBy().addAll(from.get$usedBy()); | 7085 to.get$usedBy().addAll(from.get$usedBy()); |
| 6922 from._usedBy = []; | 7086 from._usedBy = []; |
| 7087 $assert(this.isValid(), "isValid()", "leg/ssa/nodes.dart", 208, 12); |
| 6923 } | 7088 } |
| 6924 HBasicBlock.rewriteInput = function(instruction, from, to) { | 7089 HBasicBlock.rewriteInput = function(instruction, from, to) { |
| 6925 var inputs = instruction.inputs; | 7090 var inputs = instruction.inputs; |
| 6926 for (var i = 0; | 7091 for (var i = 0; |
| 6927 i < inputs.length; i++) { | 7092 $notnull_bool(i < inputs.length); i++) { |
| 6928 if (inputs.$index(i) === from) inputs.$setindex(i, to); | 7093 if ($notnull_bool(inputs.$index(i) === from)) inputs.$setindex(i, to); |
| 6929 } | 7094 } |
| 6930 } | 7095 } |
| 6931 HBasicBlock.prototype.isExitBlock = function() { | 7096 HBasicBlock.prototype.isExitBlock = function() { |
| 6932 return this.first === this.last && (this.first instanceof HExit); | 7097 return this.first === this.last && (this.first instanceof HExit); |
| 6933 } | 7098 } |
| 6934 HBasicBlock.prototype.isValid = function() { | 7099 HBasicBlock.prototype.isValid = function() { |
| 6935 var validator = new HValidator(); | 7100 var validator = new HValidator(); |
| 6936 validator.visitBasicBlock(this); | 7101 validator.visitBasicBlock(this); |
| 6937 return validator.isValid; | 7102 return validator.isValid; |
| 6938 } | 7103 } |
| 6939 // ********** Code for HInstruction ************** | 7104 // ********** Code for HInstruction ************** |
| 6940 function HInstruction(inputs) { | 7105 function HInstruction(inputs) { |
| 6941 this._usedBy = null | 7106 this._usedBy = null |
| 6942 this.previous = null | 7107 this.previous = null |
| 6943 this.next = null | 7108 this.next = null |
| 6944 this._canBeGeneratedAtUseSite = false | 7109 this._canBeGeneratedAtUseSite = false |
| 6945 this.inputs = inputs; | 7110 this.inputs = inputs; |
| 6946 // Initializers done | 7111 // Initializers done |
| 6947 } | 7112 } |
| 7113 HInstruction.prototype.is$HInstruction = function(){return this;}; |
| 6948 HInstruction.prototype.canBeGeneratedAtUseSite = function() { | 7114 HInstruction.prototype.canBeGeneratedAtUseSite = function() { |
| 6949 return this._canBeGeneratedAtUseSite; | 7115 return this._canBeGeneratedAtUseSite; |
| 6950 } | 7116 } |
| 6951 HInstruction.prototype.setCanBeGeneratedAtUseSite = function() { | 7117 HInstruction.prototype.setCanBeGeneratedAtUseSite = function() { |
| 6952 this._canBeGeneratedAtUseSite = true; | 7118 this._canBeGeneratedAtUseSite = true; |
| 6953 } | 7119 } |
| 6954 HInstruction.prototype.canBeSkipped = function() { | 7120 HInstruction.prototype.canBeSkipped = function() { |
| 6955 return this.canBeGeneratedAtUseSite(); | 7121 return this.canBeGeneratedAtUseSite(); |
| 6956 } | 7122 } |
| 6957 HInstruction.prototype.get$usedBy = function() { | 7123 HInstruction.prototype.get$usedBy = function() { |
| 6958 if (this._usedBy == null) return const$226/*const []*/; | 7124 if ($notnull_bool(this._usedBy == null)) return const$226/*const []*/; |
| 6959 return this._usedBy; | 7125 return this._usedBy; |
| 6960 } | 7126 } |
| 6961 HInstruction.prototype.isInBasicBlock = function() { | 7127 HInstruction.prototype.isInBasicBlock = function() { |
| 6962 return this._usedBy != null; | 7128 return this._usedBy != null; |
| 6963 } | 7129 } |
| 6964 HInstruction.prototype.$eq = function(other) { | 7130 HInstruction.prototype.$eq = function(other) { |
| 6965 return false; | 7131 return false; |
| 6966 } | 7132 } |
| 6967 HInstruction.prototype.hashCode = function() { | 7133 HInstruction.prototype.hashCode = function() { |
| 6968 return 0; | 7134 return 0; |
| 6969 } | 7135 } |
| 6970 HInstruction.prototype.notifyAddedToBlock = function() { | 7136 HInstruction.prototype.notifyAddedToBlock = function() { |
| 7137 $assert(!this.isInBasicBlock(), "!isInBasicBlock()", "leg/ssa/nodes.dart", 283
, 12); |
| 6971 this._usedBy = []; | 7138 this._usedBy = []; |
| 6972 for (var i = 0; | 7139 for (var i = 0; |
| 6973 i < this.inputs.length; i++) { | 7140 $notnull_bool(i < this.inputs.length); i++) { |
| 6974 this.inputs.$index(i).get$usedBy().add(this); | 7141 this.inputs.$index(i).get$usedBy().add(this); |
| 6975 } | 7142 } |
| 7143 $assert(this.isValid(), "isValid()", "leg/ssa/nodes.dart", 289, 12); |
| 6976 } | 7144 } |
| 6977 HInstruction.prototype.notifyRemovedFromBlock = function() { | 7145 HInstruction.prototype.notifyRemovedFromBlock = function() { |
| 7146 $assert(this.isInBasicBlock(), "isInBasicBlock()", "leg/ssa/nodes.dart", 293,
12); |
| 7147 $assert(this.get$usedBy().isEmpty(), "usedBy.isEmpty()", "leg/ssa/nodes.dart",
294, 12); |
| 6978 for (var i = 0; | 7148 for (var i = 0; |
| 6979 i < this.inputs.length; i++) { | 7149 $notnull_bool(i < this.inputs.length); i++) { |
| 6980 var inputUsedBy = this.inputs.$index(i).get$usedBy(); | 7150 var inputUsedBy = this.inputs.$index(i).get$usedBy(); |
| 6981 for (var j = 0; | 7151 for (var j = 0; |
| 6982 j < inputUsedBy.length; j++) { | 7152 $notnull_bool(j < inputUsedBy.length); j++) { |
| 6983 if (inputUsedBy.$index(j) === this) { | 7153 if ($notnull_bool(inputUsedBy.$index(j) === this)) { |
| 6984 inputUsedBy.$setindex(j, inputUsedBy.$index(inputUsedBy.length - 1)); | 7154 inputUsedBy.$setindex(j, inputUsedBy.$index(inputUsedBy.length - 1)); |
| 6985 inputUsedBy.removeLast(); | 7155 inputUsedBy.removeLast(); |
| 6986 break; | 7156 break; |
| 6987 } | 7157 } |
| 6988 } | 7158 } |
| 6989 } | 7159 } |
| 6990 this._usedBy = null; | 7160 this._usedBy = null; |
| 7161 $assert(this.isValid(), "isValid()", "leg/ssa/nodes.dart", 308, 12); |
| 6991 } | 7162 } |
| 6992 HInstruction.prototype.isValid = function() { | 7163 HInstruction.prototype.isValid = function() { |
| 6993 var validator = new HValidator(); | 7164 var validator = new HValidator(); |
| 6994 validator.visitInstruction(this); | 7165 validator.visitInstruction(this); |
| 6995 return validator.isValid; | 7166 return validator.isValid; |
| 6996 } | 7167 } |
| 6997 // ********** Code for HInvoke ************** | 7168 // ********** Code for HInvoke ************** |
| 6998 function HInvoke(selector, inputs0) { | 7169 function HInvoke(selector, inputs0) { |
| 6999 this.selector = selector; | 7170 this.selector = selector; |
| 7000 HInstruction.call(this, inputs0); | 7171 HInstruction.call(this, inputs0); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7164 function SsaConstantFolder() { | 7335 function SsaConstantFolder() { |
| 7165 HBaseVisitor.call(this); | 7336 HBaseVisitor.call(this); |
| 7166 // Initializers done | 7337 // Initializers done |
| 7167 } | 7338 } |
| 7168 $inherits(SsaConstantFolder, HBaseVisitor); | 7339 $inherits(SsaConstantFolder, HBaseVisitor); |
| 7169 SsaConstantFolder.prototype.visitGraph = function(graph) { | 7340 SsaConstantFolder.prototype.visitGraph = function(graph) { |
| 7170 this.visitDominatorTree(graph); | 7341 this.visitDominatorTree(graph); |
| 7171 } | 7342 } |
| 7172 SsaConstantFolder.prototype.visitBasicBlock = function(block) { | 7343 SsaConstantFolder.prototype.visitBasicBlock = function(block) { |
| 7173 var instruction = block.first; | 7344 var instruction = block.first; |
| 7174 while (instruction != null) { | 7345 while ($notnull_bool(instruction != null)) { |
| 7175 var replacement = instruction.accept(this); | 7346 var replacement = instruction.accept(this); |
| 7176 if (replacement !== instruction) { | 7347 if ($notnull_bool(replacement !== instruction)) { |
| 7177 block.addAfter(instruction, replacement); | 7348 block.addAfter(instruction, (replacement && replacement.is$HInstruction())
); |
| 7178 block.rewrite(instruction, replacement); | 7349 block.rewrite(instruction, (replacement && replacement.is$HInstruction()))
; |
| 7179 block.remove(instruction); | 7350 block.remove(instruction); |
| 7180 } | 7351 } |
| 7181 instruction = instruction.next; | 7352 instruction = instruction.next; |
| 7182 } | 7353 } |
| 7183 } | 7354 } |
| 7184 SsaConstantFolder.prototype.visitInstruction = function(node) { | 7355 SsaConstantFolder.prototype.visitInstruction = function(node) { |
| 7185 return node; | 7356 return node; |
| 7186 } | 7357 } |
| 7187 SsaConstantFolder.prototype.visitArithmetic = function(node, operation) { | 7358 SsaConstantFolder.prototype.visitArithmetic = function(node, operation) { |
| 7188 function isNumber(input) { | 7359 function isNumber(input) { |
| 7189 return (input instanceof HLiteral) && (typeof(input.get$value()) == 'number'
); | 7360 return (input instanceof HLiteral) && (typeof(input.get$value()) == 'number'
); |
| 7190 } | 7361 } |
| 7191 var inputs = node.inputs; | 7362 var inputs = node.inputs; |
| 7192 if (isNumber(inputs.$index(0)) && isNumber(inputs.$index(1))) { | 7363 $assert(inputs.length == 2, "inputs.length == 2", "leg/ssa/optimize.dart", 50,
12); |
| 7364 if ($notnull_bool(isNumber(inputs.$index(0)) && isNumber(inputs.$index(1)))) { |
| 7193 switch (operation) { | 7365 switch (operation) { |
| 7194 case '+': | 7366 case '+': |
| 7195 | 7367 |
| 7196 return new HLiteral(inputs.$index(0).get$value() + inputs.$index(1).get$
value()); | 7368 return new HLiteral(inputs.$index(0).get$value() + inputs.$index(1).get$
value()); |
| 7197 | 7369 |
| 7198 case '-': | 7370 case '-': |
| 7199 | 7371 |
| 7200 return new HLiteral(inputs.$index(0).get$value() - inputs.$index(1).get$
value()); | 7372 return new HLiteral(inputs.$index(0).get$value() - inputs.$index(1).get$
value()); |
| 7201 | 7373 |
| 7202 case '*': | 7374 case '*': |
| 7203 | 7375 |
| 7204 return new HLiteral(inputs.$index(0).get$value() * inputs.$index(1).get$
value()); | 7376 return new HLiteral(inputs.$index(0).get$value() * inputs.$index(1).get$
value()); |
| 7205 | 7377 |
| 7206 case '/': | 7378 case '/': |
| 7207 | 7379 |
| 7208 { | 7380 { |
| 7209 if ($eq(inputs.$index(1).get$value(), 0)) return node; | 7381 if ($notnull_bool($eq(inputs.$index(1).get$value(), 0))) return node; |
| 7210 return new HLiteral(inputs.$index(0).get$value() / inputs.$index(1).ge
t$value()); | 7382 return new HLiteral(inputs.$index(0).get$value() / inputs.$index(1).ge
t$value()); |
| 7211 } | 7383 } |
| 7212 | 7384 |
| 7213 case '~/': | 7385 case '~/': |
| 7214 | 7386 |
| 7215 { | 7387 { |
| 7216 if ($eq(inputs.$index(1).get$value(), 0)) return node; | 7388 if ($notnull_bool($eq(inputs.$index(1).get$value(), 0))) return node; |
| 7217 return new HLiteral($truncdiv(inputs.$index(0).get$value(), inputs.$in
dex(1).get$value())); | 7389 return new HLiteral($truncdiv(inputs.$index(0).get$value(), inputs.$in
dex(1).get$value())); |
| 7218 } | 7390 } |
| 7219 | 7391 |
| 7220 default: | 7392 default: |
| 7221 | 7393 |
| 7222 unreachable(); | 7394 unreachable(); |
| 7223 | 7395 |
| 7224 } | 7396 } |
| 7225 } | 7397 } |
| 7226 return node; | 7398 return node; |
| 7227 } | 7399 } |
| 7228 // ********** Code for SsaDeadCodeEliminator ************** | 7400 // ********** Code for SsaDeadCodeEliminator ************** |
| 7229 function SsaDeadCodeEliminator() { | 7401 function SsaDeadCodeEliminator() { |
| 7230 HGraphVisitor.call(this); | 7402 HGraphVisitor.call(this); |
| 7231 // Initializers done | 7403 // Initializers done |
| 7232 } | 7404 } |
| 7233 $inherits(SsaDeadCodeEliminator, HGraphVisitor); | 7405 $inherits(SsaDeadCodeEliminator, HGraphVisitor); |
| 7234 SsaDeadCodeEliminator.isDeadCode = function(instruction) { | 7406 SsaDeadCodeEliminator.isDeadCode = function(instruction) { |
| 7235 return !instruction.hasSideEffects() && instruction.get$usedBy().isEmpty(); | 7407 return !instruction.hasSideEffects() && instruction.get$usedBy().isEmpty(); |
| 7236 } | 7408 } |
| 7237 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) { | 7409 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) { |
| 7238 this.visitPostDominatorTree(graph); | 7410 this.visitPostDominatorTree(graph); |
| 7239 } | 7411 } |
| 7240 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) { | 7412 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) { |
| 7241 var instruction = block.last; | 7413 var instruction = block.last; |
| 7242 while (instruction != null) { | 7414 while ($notnull_bool(instruction != null)) { |
| 7243 var previous = instruction.previous; | 7415 var previous = instruction.previous; |
| 7244 if (SsaDeadCodeEliminator.isDeadCode(instruction)) block.remove(instruction)
; | 7416 if ($notnull_bool(SsaDeadCodeEliminator.isDeadCode(instruction))) block.remo
ve(instruction); |
| 7245 instruction = previous; | 7417 instruction = (previous && previous.is$HInstruction()); |
| 7246 } | 7418 } |
| 7247 } | 7419 } |
| 7248 // ********** Code for SsaGlobalValueNumberer ************** | 7420 // ********** Code for SsaGlobalValueNumberer ************** |
| 7249 function SsaGlobalValueNumberer(compiler) { | 7421 function SsaGlobalValueNumberer(compiler) { |
| 7250 this.compiler = compiler; | 7422 this.compiler = compiler; |
| 7251 this.values = new HashMapImplementation$HInstruction$HInstruction(); | 7423 this.values = new HashMapImplementation$HInstruction$HInstruction(); |
| 7252 // Initializers done | 7424 // Initializers done |
| 7253 } | 7425 } |
| 7254 $inherits(SsaGlobalValueNumberer, HGraphVisitor); | 7426 $inherits(SsaGlobalValueNumberer, HGraphVisitor); |
| 7255 SsaGlobalValueNumberer.prototype.visitGraph = function(graph) { | 7427 SsaGlobalValueNumberer.prototype.visitGraph = function(graph) { |
| 7256 this.visitPostDominatorTree(graph); | 7428 this.visitPostDominatorTree(graph); |
| 7257 } | 7429 } |
| 7258 SsaGlobalValueNumberer.prototype.visitBasicBlock = function(block) { | 7430 SsaGlobalValueNumberer.prototype.visitBasicBlock = function(block) { |
| 7259 var instruction = block.first; | 7431 var instruction = block.first; |
| 7260 while (instruction != null) { | 7432 while ($notnull_bool(instruction != null)) { |
| 7261 if (instruction.hasSideEffects()) { | 7433 if ($notnull_bool(instruction.hasSideEffects())) { |
| 7262 this.values.clear(); | 7434 this.values.clear(); |
| 7263 } | 7435 } |
| 7264 else { | 7436 else { |
| 7265 var other = this.values.$index(instruction); | 7437 var other = this.values.$index(instruction); |
| 7266 if (other != null) { | 7438 if ($notnull_bool(other != null)) { |
| 7267 block.rewrite(instruction, other); | 7439 block.rewrite(instruction, other); |
| 7268 block.remove(instruction); | 7440 block.remove(instruction); |
| 7269 } | 7441 } |
| 7270 else { | 7442 else { |
| 7271 this.values.$setindex(instruction, instruction); | 7443 this.values.$setindex(instruction, instruction); |
| 7272 } | 7444 } |
| 7273 } | 7445 } |
| 7274 instruction = instruction.next; | 7446 instruction = instruction.next; |
| 7275 } | 7447 } |
| 7276 } | 7448 } |
| 7277 // ********** Code for SsaInstructionMerger ************** | 7449 // ********** Code for SsaInstructionMerger ************** |
| 7278 function SsaInstructionMerger() { | 7450 function SsaInstructionMerger() { |
| 7279 HInstructionVisitor.call(this); | 7451 HInstructionVisitor.call(this); |
| 7280 // Initializers done | 7452 // Initializers done |
| 7281 } | 7453 } |
| 7282 $inherits(SsaInstructionMerger, HInstructionVisitor); | 7454 $inherits(SsaInstructionMerger, HInstructionVisitor); |
| 7283 SsaInstructionMerger.prototype.visitGraph = function(graph) { | 7455 SsaInstructionMerger.prototype.visitGraph = function(graph) { |
| 7284 this.visitDominatorTree(graph); | 7456 this.visitDominatorTree(graph); |
| 7285 } | 7457 } |
| 7286 SsaInstructionMerger.prototype.visitInstruction = function(node) { | 7458 SsaInstructionMerger.prototype.visitInstruction = function(node) { |
| 7287 var inputs = node.inputs; | 7459 var inputs = node.inputs; |
| 7288 var previousUnused = node.previous; | 7460 var previousUnused = node.previous; |
| 7289 for (var i = inputs.length - 1; | 7461 for (var i = inputs.length - 1; |
| 7290 i >= 0; i--) { | 7462 $notnull_bool(i >= 0); i--) { |
| 7291 if (previousUnused == null) return; | 7463 if ($notnull_bool(previousUnused == null)) return; |
| 7292 if (inputs.$index(i).get$usedBy().length != 1) return; | 7464 if ($notnull_bool(inputs.$index(i).get$usedBy().length != 1)) return; |
| 7293 if (inputs.$index(i) !== previousUnused) return; | 7465 if ($notnull_bool(inputs.$index(i) !== previousUnused)) return; |
| 7294 inputs.$index(i).setCanBeGeneratedAtUseSite(); | 7466 inputs.$index(i).setCanBeGeneratedAtUseSite(); |
| 7295 previousUnused = previousUnused.previous; | 7467 previousUnused = previousUnused.previous; |
| 7296 } | 7468 } |
| 7297 } | 7469 } |
| 7298 // ********** Code for HTracer ************** | 7470 // ********** Code for HTracer ************** |
| 7299 function HTracer() {} | 7471 function HTracer() {} |
| 7300 HTracer._internal$ctor = function() { | 7472 HTracer._internal$ctor = function() { |
| 7301 this.indent = 0 | 7473 this.indent = 0 |
| 7302 this.output = new StringBufferImpl(""); | 7474 this.output = new StringBufferImpl(""); |
| 7303 // Initializers done | 7475 // Initializers done |
| 7304 } | 7476 } |
| 7305 HTracer._internal$ctor.prototype = HTracer.prototype; | 7477 HTracer._internal$ctor.prototype = HTracer.prototype; |
| 7306 $inherits(HTracer, HGraphVisitor); | 7478 $inherits(HTracer, HGraphVisitor); |
| 7307 HTracer.HTracer$singleton$factory = function() { | 7479 HTracer.HTracer$singleton$factory = function() { |
| 7308 if (HTracer._singleton == null) HTracer._singleton = new HTracer._internal$cto
r(); | 7480 if ($notnull_bool(HTracer._singleton == null)) HTracer._singleton = new HTrace
r._internal$ctor(); |
| 7309 return HTracer._singleton; | 7481 return HTracer._singleton; |
| 7310 } | 7482 } |
| 7311 HTracer.prototype.traceCompilation = function(methodName) { | 7483 HTracer.prototype.traceCompilation = function(methodName) { |
| 7312 var $this = this; // closure support | 7484 var $this = this; // closure support |
| 7313 this.tag("compilation", (function () { | 7485 this.tag("compilation", (function () { |
| 7314 $this.printProperty("name", methodName); | 7486 $this.printProperty("name", methodName); |
| 7315 $this.printProperty("method", methodName); | 7487 $this.printProperty("method", methodName); |
| 7316 $this.printProperty("date", new DateImplementation.now$ctor().value); | 7488 $this.printProperty("date", new DateImplementation.now$ctor().value); |
| 7317 }) | 7489 }) |
| 7318 ); | 7490 ); |
| 7319 } | 7491 } |
| 7320 HTracer.prototype.traceGraph = function(name, graph) { | 7492 HTracer.prototype.traceGraph = function(name, graph) { |
| 7321 var $this = this; // closure support | 7493 var $this = this; // closure support |
| 7322 graph.number(); | 7494 graph.number(); |
| 7323 this.tag("cfg", (function () { | 7495 this.tag("cfg", (function () { |
| 7324 $this.printProperty("name", name); | 7496 $this.printProperty("name", name); |
| 7325 $this.visitDominatorTree(graph); | 7497 $this.visitDominatorTree(graph); |
| 7326 }) | 7498 }) |
| 7327 ); | 7499 ); |
| 7328 } | 7500 } |
| 7329 HTracer.prototype.addPredecessors = function(block) { | 7501 HTracer.prototype.addPredecessors = function(block) { |
| 7330 if (block.predecessors.isEmpty()) { | 7502 if ($notnull_bool(block.predecessors.isEmpty())) { |
| 7331 this.printEmptyProperty("predecessors"); | 7503 this.printEmptyProperty("predecessors"); |
| 7332 } | 7504 } |
| 7333 else { | 7505 else { |
| 7334 this.addIndent(); | 7506 this.addIndent(); |
| 7335 this.add("predecessors"); | 7507 this.add("predecessors"); |
| 7336 var $list = block.predecessors; | 7508 var $list = block.predecessors; |
| 7337 for (var $i = 0;$i < $list.length; $i++) { | 7509 for (var $i = 0;$i < $list.length; $i++) { |
| 7338 var predecessor = $list.$index($i); | 7510 var predecessor = $list.$index($i); |
| 7339 this.add((' "B' + predecessor.id + '"')); | 7511 this.add((' "B' + predecessor.id + '"')); |
| 7340 } | 7512 } |
| 7341 this.add("\n"); | 7513 this.add("\n"); |
| 7342 } | 7514 } |
| 7343 } | 7515 } |
| 7344 HTracer.prototype.addSuccessors = function(block) { | 7516 HTracer.prototype.addSuccessors = function(block) { |
| 7345 if (block.successors.isEmpty()) { | 7517 if ($notnull_bool(block.successors.isEmpty())) { |
| 7346 this.printEmptyProperty("successors"); | 7518 this.printEmptyProperty("successors"); |
| 7347 } | 7519 } |
| 7348 else { | 7520 else { |
| 7349 this.addIndent(); | 7521 this.addIndent(); |
| 7350 this.add("successors"); | 7522 this.add("successors"); |
| 7351 var $list = block.successors; | 7523 var $list = block.successors; |
| 7352 for (var $i = 0;$i < $list.length; $i++) { | 7524 for (var $i = 0;$i < $list.length; $i++) { |
| 7353 var successor = $list.$index($i); | 7525 var successor = $list.$index($i); |
| 7354 this.add((' "B' + successor.id + '"')); | 7526 this.add((' "B' + successor.id + '"')); |
| 7355 } | 7527 } |
| 7356 this.add("\n"); | 7528 this.add("\n"); |
| 7357 } | 7529 } |
| 7358 } | 7530 } |
| 7359 HTracer.prototype.addInstructions = function(block) { | 7531 HTracer.prototype.addInstructions = function(block) { |
| 7360 var stringifier = new HInstructionStringifier(block); | 7532 var stringifier = new HInstructionStringifier(block); |
| 7361 for (var instruction = block.first; | 7533 for (var instruction = block.first; |
| 7362 instruction != null; instruction = instruction.next) { | 7534 $notnull_bool(instruction != null); instruction = instruction.next) { |
| 7363 var bci = 0; | 7535 var bci = 0; |
| 7364 var uses = instruction.get$usedBy().length; | 7536 var uses = instruction.get$usedBy().length; |
| 7365 this.addIndent(); | 7537 this.addIndent(); |
| 7366 var temporaryId = stringifier.temporaryId(instruction); | 7538 var temporaryId = stringifier.temporaryId(instruction); |
| 7367 var instructionString = stringifier.visit(instruction); | 7539 var instructionString = stringifier.visit(instruction); |
| 7368 this.add(("" + bci + " " + uses + " " + temporaryId + " " + instructionStrin
g + " <|@\n")); | 7540 this.add(("" + bci + " " + uses + " " + temporaryId + " " + instructionStrin
g + " <|@\n")); |
| 7369 } | 7541 } |
| 7370 } | 7542 } |
| 7371 HTracer.prototype.visitBasicBlock = function(block) { | 7543 HTracer.prototype.visitBasicBlock = function(block) { |
| 7372 var $this = this; // closure support | 7544 var $this = this; // closure support |
| 7545 $assert(block.id != null, "block.id !== null", "leg/ssa/tracer.dart", 75, 12); |
| 7373 this.tag("block", (function () { | 7546 this.tag("block", (function () { |
| 7374 $this.printProperty("name", ("B" + block.id + "")); | 7547 $this.printProperty("name", ("B" + block.id + "")); |
| 7375 $this.printProperty("from_bci", -1); | 7548 $this.printProperty("from_bci", -1); |
| 7376 $this.printProperty("to_bci", -1); | 7549 $this.printProperty("to_bci", -1); |
| 7377 $this.addPredecessors(block); | 7550 $this.addPredecessors(block); |
| 7378 $this.addSuccessors(block); | 7551 $this.addSuccessors(block); |
| 7379 $this.printEmptyProperty("xhandlers"); | 7552 $this.printEmptyProperty("xhandlers"); |
| 7380 $this.printEmptyProperty("flags"); | 7553 $this.printEmptyProperty("flags"); |
| 7381 $this.tag("states", (function () { | 7554 $this.tag("states", (function () { |
| 7382 $this.tag("locals", (function () { | 7555 $this.tag("locals", (function () { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 7402 } | 7575 } |
| 7403 HTracer.prototype.print = function(string) { | 7576 HTracer.prototype.print = function(string) { |
| 7404 this.addIndent(); | 7577 this.addIndent(); |
| 7405 this.add(string); | 7578 this.add(string); |
| 7406 this.add("\n"); | 7579 this.add("\n"); |
| 7407 } | 7580 } |
| 7408 HTracer.prototype.printEmptyProperty = function(propertyName) { | 7581 HTracer.prototype.printEmptyProperty = function(propertyName) { |
| 7409 this.print(propertyName); | 7582 this.print(propertyName); |
| 7410 } | 7583 } |
| 7411 HTracer.prototype.printProperty = function(propertyName, value) { | 7584 HTracer.prototype.printProperty = function(propertyName, value) { |
| 7412 if ((typeof(value) == 'number')) { | 7585 if ($notnull_bool((typeof(value) == 'number'))) { |
| 7413 this.print(("" + propertyName + " " + value + "")); | 7586 this.print(("" + propertyName + " " + value + "")); |
| 7414 } | 7587 } |
| 7415 else { | 7588 else { |
| 7416 this.print(('' + propertyName + ' "' + value + '"')); | 7589 this.print(('' + propertyName + ' "' + value + '"')); |
| 7417 } | 7590 } |
| 7418 } | 7591 } |
| 7419 HTracer.prototype.add = function(string) { | 7592 HTracer.prototype.add = function(string) { |
| 7420 this.output.add(string); | 7593 this.output.add(string); |
| 7421 } | 7594 } |
| 7422 HTracer.prototype.addIndent = function() { | 7595 HTracer.prototype.addIndent = function() { |
| 7423 for (var i = 0; | 7596 for (var i = 0; |
| 7424 i < this.indent; i++) { | 7597 $notnull_bool(i < this.indent); i++) { |
| 7425 this.add(" "); | 7598 this.add(" "); |
| 7426 } | 7599 } |
| 7427 } | 7600 } |
| 7428 HTracer.prototype.toString = function() { | 7601 HTracer.prototype.toString = function() { |
| 7429 return this.output.toString(); | 7602 return this.output.toString(); |
| 7430 } | 7603 } |
| 7431 // ********** Code for HInstructionStringifier ************** | 7604 // ********** Code for HInstructionStringifier ************** |
| 7432 function HInstructionStringifier(currentBlock) { | 7605 function HInstructionStringifier(currentBlock) { |
| 7433 this.currentBlock = currentBlock; | 7606 this.currentBlock = currentBlock; |
| 7434 // Initializers done | 7607 // Initializers done |
| (...skipping 14 matching lines...) Expand all Loading... |
| 7449 return this.visitInvoke(node); | 7622 return this.visitInvoke(node); |
| 7450 } | 7623 } |
| 7451 HInstructionStringifier.prototype.visitExit = function(node) { | 7624 HInstructionStringifier.prototype.visitExit = function(node) { |
| 7452 return "exit"; | 7625 return "exit"; |
| 7453 } | 7626 } |
| 7454 HInstructionStringifier.prototype.visitGoto = function(node) { | 7627 HInstructionStringifier.prototype.visitGoto = function(node) { |
| 7455 var target = this.currentBlock.successors.$index(0); | 7628 var target = this.currentBlock.successors.$index(0); |
| 7456 return ("Goto (B" + target.id + ")"); | 7629 return ("Goto (B" + target.id + ")"); |
| 7457 } | 7630 } |
| 7458 HInstructionStringifier.prototype.visitInvoke = function(invoke) { | 7631 HInstructionStringifier.prototype.visitInvoke = function(invoke) { |
| 7632 var $0; |
| 7459 var arguments = new StringBufferImpl(""); | 7633 var arguments = new StringBufferImpl(""); |
| 7460 for (var i = 0; | 7634 for (var i = 0; |
| 7461 i < invoke.inputs.length; i++) { | 7635 $notnull_bool(i < invoke.inputs.length); i++) { |
| 7462 if (i != 0) arguments.add(", "); | 7636 if ($notnull_bool(i != 0)) arguments.add(", "); |
| 7463 arguments.add(this.temporaryId(invoke.inputs.$index(i))); | 7637 arguments.add(this.temporaryId((($0 = invoke.inputs.$index(i)) && $0.is$HIns
truction()))); |
| 7464 } | 7638 } |
| 7465 return ("Invoke: " + invoke.selector + "(" + arguments + ")"); | 7639 return ("Invoke: " + invoke.selector + "(" + arguments + ")"); |
| 7466 } | 7640 } |
| 7467 HInstructionStringifier.prototype.visitLiteral = function(literal) { | 7641 HInstructionStringifier.prototype.visitLiteral = function(literal) { |
| 7468 return ("Literal " + literal.value + ""); | 7642 return ("Literal " + literal.value + ""); |
| 7469 } | 7643 } |
| 7470 HInstructionStringifier.prototype.visitMultiply = function(node) { | 7644 HInstructionStringifier.prototype.visitMultiply = function(node) { |
| 7471 return this.visitInvoke(node); | 7645 return this.visitInvoke(node); |
| 7472 } | 7646 } |
| 7473 HInstructionStringifier.prototype.visitReturn = function(node) { | 7647 HInstructionStringifier.prototype.visitReturn = function(node) { |
| 7474 return ("Return " + this.temporaryId(node.inputs.$index(0)) + ""); | 7648 var $0; |
| 7649 return ("Return " + this.temporaryId((($0 = node.inputs.$index(0)) && $0.is$HI
nstruction())) + ""); |
| 7475 } | 7650 } |
| 7476 HInstructionStringifier.prototype.visitSubtract = function(node) { | 7651 HInstructionStringifier.prototype.visitSubtract = function(node) { |
| 7477 return this.visitInvoke(node); | 7652 return this.visitInvoke(node); |
| 7478 } | 7653 } |
| 7479 HInstructionStringifier.prototype.visitTruncatingDivide = function(node) { | 7654 HInstructionStringifier.prototype.visitTruncatingDivide = function(node) { |
| 7480 return this.visitInvoke(node); | 7655 return this.visitInvoke(node); |
| 7481 } | 7656 } |
| 7482 // ********** Code for HValidator ************** | 7657 // ********** Code for HValidator ************** |
| 7483 function HValidator() { | 7658 function HValidator() { |
| 7484 this.isValid = true | 7659 this.isValid = true |
| 7485 HInstructionVisitor.call(this); | 7660 HInstructionVisitor.call(this); |
| 7486 // Initializers done | 7661 // Initializers done |
| 7487 } | 7662 } |
| 7488 $inherits(HValidator, HInstructionVisitor); | 7663 $inherits(HValidator, HInstructionVisitor); |
| 7489 HValidator.prototype.visitGraph = function(graph0) { | 7664 HValidator.prototype.visitGraph = function(graph0) { |
| 7490 this.graph = graph0; | 7665 this.graph = graph0; |
| 7491 this.visitDominatorTree(graph0); | 7666 this.visitDominatorTree(graph0); |
| 7492 } | 7667 } |
| 7493 HValidator.prototype.visitBasicBlock = function(block) { | 7668 HValidator.prototype.visitBasicBlock = function(block) { |
| 7494 if (!this.isValid) return; | 7669 if ($notnull_bool(!this.isValid)) return; |
| 7495 if (block.first == null || block.last == null) this.isValid = false; | 7670 if ($notnull_bool(block.first == null || block.last == null)) this.isValid = f
alse; |
| 7496 if (!(block.last instanceof HGoto) && !(block.last instanceof HReturn) && !(bl
ock.last instanceof HExit)) { | 7671 if ($notnull_bool(!(block.last instanceof HGoto) && !(block.last instanceof HR
eturn) && !(block.last instanceof HExit))) { |
| 7497 this.isValid = false; | 7672 this.isValid = false; |
| 7498 } | 7673 } |
| 7499 if ((block.last instanceof HGoto) && block.successors.length != 1) this.isVali
d = false; | 7674 if ($notnull_bool((block.last instanceof HGoto) && block.successors.length !=
1)) this.isValid = false; |
| 7500 if ((block.last instanceof HReturn) && (block.successors.length != 1 || !block
.successors.$index(0).isExitBlock())) { | 7675 if ($notnull_bool((block.last instanceof HReturn) && (block.successors.length
!= 1 || !block.successors.$index(0).isExitBlock()))) { |
| 7501 this.isValid = false; | 7676 this.isValid = false; |
| 7502 } | 7677 } |
| 7503 if ((block.last instanceof HExit) && !block.successors.isEmpty()) this.isValid
= false; | 7678 if ($notnull_bool((block.last instanceof HExit) && !block.successors.isEmpty()
)) this.isValid = false; |
| 7504 if (block.successors.isEmpty() && (block.first !== block.last || !(block.last
instanceof HExit))) { | 7679 if ($notnull_bool(block.successors.isEmpty() && (block.first !== block.last ||
!(block.last instanceof HExit)))) { |
| 7505 this.isValid = false; | 7680 this.isValid = false; |
| 7506 } | 7681 } |
| 7507 if (!this.isValid) return; | 7682 if ($notnull_bool(!this.isValid)) return; |
| 7508 HInstructionVisitor.prototype.visitBasicBlock.call(this, block); | 7683 HInstructionVisitor.prototype.visitBasicBlock.call(this, block); |
| 7509 } | 7684 } |
| 7510 HValidator.countInstruction = function(instructions, instruction) { | 7685 HValidator.countInstruction = function(instructions, instruction) { |
| 7511 var result = 0; | 7686 var result = 0; |
| 7512 for (var i = 0; | 7687 for (var i = 0; |
| 7513 i < instructions.length; i++) { | 7688 $notnull_bool(i < instructions.length); i++) { |
| 7514 if (instructions.$index(i) === instruction) result++; | 7689 if ($notnull_bool(instructions.$index(i) === instruction)) result++; |
| 7515 } | 7690 } |
| 7516 return result; | 7691 return result; |
| 7517 } | 7692 } |
| 7518 HValidator.everyInstruction = function(instructions, f) { | 7693 HValidator.everyInstruction = function(instructions, f) { |
| 7519 var copy = ListFactory.ListFactory$from$factory(instructions); | 7694 var copy = ListFactory.ListFactory$from$factory(instructions); |
| 7520 for (var i = 0; | 7695 for (var i = 0; |
| 7521 i < copy.length; i++) { | 7696 $notnull_bool(i < copy.length); i++) { |
| 7522 var current = copy.$index(i); | 7697 var current = copy.$index(i); |
| 7523 if (current == null) continue; | 7698 if ($notnull_bool(current == null)) continue; |
| 7524 var count = 1; | 7699 var count = 1; |
| 7525 for (var j = i + 1; | 7700 for (var j = i + 1; |
| 7526 j < copy.length; j++) { | 7701 $notnull_bool(j < copy.length); j++) { |
| 7527 if (copy.$index(j) === current) { | 7702 if ($notnull_bool(copy.$index(j) === current)) { |
| 7528 copy.$setindex(j); | 7703 copy.$setindex(j); |
| 7529 count++; | 7704 count++; |
| 7530 } | 7705 } |
| 7531 } | 7706 } |
| 7532 if (!f.call$2(current, count)) return false; | 7707 if ($notnull_bool(!f.call$2(current, count))) return false; |
| 7533 } | 7708 } |
| 7534 return true; | 7709 return true; |
| 7535 } | 7710 } |
| 7536 HValidator.prototype.visitInstruction = function(instruction) { | 7711 HValidator.prototype.visitInstruction = function(instruction) { |
| 7537 var $this = this; // closure support | 7712 var $this = this; // closure support |
| 7538 function hasCorrectInputs(instruction0) { | 7713 function hasCorrectInputs(instruction0) { |
| 7539 var inBasicBlock = instruction0.isInBasicBlock(); | 7714 var inBasicBlock = instruction0.isInBasicBlock(); |
| 7540 return HValidator.everyInstruction(instruction0.inputs, (function (input, co
unt) { | 7715 return HValidator.everyInstruction(instruction0.inputs, (function (input, co
unt) { |
| 7541 if (inBasicBlock) { | 7716 if ($notnull_bool(inBasicBlock)) { |
| 7542 return HValidator.countInstruction(input.get$usedBy(), instruction0) ==
count; | 7717 return HValidator.countInstruction(input.get$usedBy(), (instruction0 &&
instruction0.is$HInstruction())) == count; |
| 7543 } | 7718 } |
| 7544 else { | 7719 else { |
| 7545 return HValidator.countInstruction(input.get$usedBy(), instruction0) ==
0; | 7720 return HValidator.countInstruction(input.get$usedBy(), (instruction0 &&
instruction0.is$HInstruction())) == 0; |
| 7546 } | 7721 } |
| 7547 }) | 7722 }) |
| 7548 ); | 7723 ); |
| 7549 } | 7724 } |
| 7550 function hasCorrectUses(instruction0) { | 7725 function hasCorrectUses(instruction0) { |
| 7551 if (!instruction0.isInBasicBlock()) return true; | 7726 if ($notnull_bool(!instruction0.isInBasicBlock())) return true; |
| 7552 return HValidator.everyInstruction(instruction0.get$usedBy(), (function (use
, count) { | 7727 return HValidator.everyInstruction(instruction0.get$usedBy(), (function (use
, count) { |
| 7553 return HValidator.countInstruction(use.inputs, instruction0) == count; | 7728 return HValidator.countInstruction(use.inputs, (instruction0 && instructio
n0.is$HInstruction())) == count; |
| 7554 }) | 7729 }) |
| 7555 ); | 7730 ); |
| 7556 } | 7731 } |
| 7557 this.isValid = this.isValid && hasCorrectInputs(instruction) && hasCorrectUses
(instruction); | 7732 this.isValid = $assert_bool(this.isValid && hasCorrectInputs(instruction) && h
asCorrectUses(instruction)); |
| 7558 } | 7733 } |
| 7559 // ********** Code for top level ************** | 7734 // ********** Code for top level ************** |
| 7560 // ********** Library leg ************** | 7735 // ********** Library leg ************** |
| 7561 // ********** Code for WorldCompiler ************** | 7736 // ********** Code for WorldCompiler ************** |
| 7562 function WorldCompiler(world, script0) { | 7737 function WorldCompiler(world, script0) { |
| 7563 this.world = world; | 7738 this.world = world; |
| 7564 Compiler.call(this, script0); | 7739 Compiler.call(this, script0); |
| 7565 // Initializers done | 7740 // Initializers done |
| 7566 } | 7741 } |
| 7567 $inherits(WorldCompiler, Compiler); | 7742 $inherits(WorldCompiler, Compiler); |
| 7568 WorldCompiler.prototype.log = function(message) { | 7743 WorldCompiler.prototype.log = function(message) { |
| 7569 if (options.showInfo) { | 7744 if ($notnull_bool(options.showInfo)) { |
| 7570 this.world.info(('[leg] ' + message + '')); | 7745 this.world.info(('[leg] ' + message + '')); |
| 7571 } | 7746 } |
| 7572 } | 7747 } |
| 7573 WorldCompiler.prototype.run = function() { | 7748 WorldCompiler.prototype.run = function() { |
| 7574 var success = Compiler.prototype.run.call(this); | 7749 var success = Compiler.prototype.run.call(this); |
| 7575 if (success) { | 7750 if ($notnull_bool(success)) { |
| 7576 var code = this.getGeneratedCode(); | 7751 var code = this.getGeneratedCode(); |
| 7577 this.world.legCode = code; | 7752 this.world.legCode = $assert_String(code); |
| 7578 this.world.jsBytesWritten = code.length; | 7753 this.world.jsBytesWritten = code.length; |
| 7579 var $list = this.tasks; | 7754 var $list = this.tasks; |
| 7580 for (var $i0 = 0;$i0 < $list.length; $i0++) { | 7755 for (var $i0 = 0;$i0 < $list.length; $i0++) { |
| 7581 var task = $list.$index($i0); | 7756 var task = $list.$index($i0); |
| 7582 this.log(('' + task.get$name() + ' took ' + task.get$timing() + 'msec')); | 7757 this.log(('' + task.get$name() + ' took ' + task.get$timing() + 'msec')); |
| 7583 } | 7758 } |
| 7584 } | 7759 } |
| 7585 return success; | 7760 return success; |
| 7586 } | 7761 } |
| 7587 WorldCompiler.prototype.spanFromNode = function(node) { | 7762 WorldCompiler.prototype.spanFromNode = function(node) { |
| 7588 var begin = node.getBeginToken(); | 7763 var begin = node.getBeginToken(); |
| 7589 var end = node.getEndToken(); | 7764 var end = node.getEndToken(); |
| 7590 if (begin == null || end == null) { | 7765 if ($notnull_bool(begin == null || end == null)) { |
| 7591 this.cancel(('cannot find tokens to produce error message for ' + node + '.'
)); | 7766 this.cancel(('cannot find tokens to produce error message for ' + node + '.'
)); |
| 7592 } | 7767 } |
| 7593 var startOffset = begin.get$charOffset(); | 7768 var startOffset = begin.get$charOffset(); |
| 7594 var endOffset = end.get$charOffset() + end.toString().length; | 7769 var endOffset = end.get$charOffset() + end.toString().length; |
| 7595 return new SourceSpan(this.script.file, startOffset, endOffset); | 7770 return new SourceSpan(this.script.file, startOffset, endOffset); |
| 7596 } | 7771 } |
| 7597 WorldCompiler.prototype.reportWarning = function(node, message) { | 7772 WorldCompiler.prototype.reportWarning = function(node, message) { |
| 7598 this.world.warning(('' + message + '.'), this.spanFromNode(node)); | 7773 var $0; |
| 7774 this.world.warning(('' + message + '.'), (($0 = this.spanFromNode(node)) && $0
.is$SourceSpan())); |
| 7599 } | 7775 } |
| 7600 // ********** Code for Compiler ************** | 7776 // ********** Code for Compiler ************** |
| 7601 function Compiler(script) { | 7777 function Compiler(script) { |
| 7602 this.script = script; | 7778 this.script = script; |
| 7603 // Initializers done | 7779 // Initializers done |
| 7604 this.universe = new Universe(); | 7780 this.universe = new Universe(); |
| 7605 this.worklist = DoubleLinkedQueue.DoubleLinkedQueue$from$factory([const$2/*Com
piler.MAIN*/]); | 7781 this.worklist = DoubleLinkedQueue.DoubleLinkedQueue$from$factory([const$3/*Com
piler.MAIN*/]); |
| 7606 this.scanner = new ScannerTask(this); | 7782 this.scanner = new ScannerTask(this); |
| 7607 this.resolver = new ResolverTask(this); | 7783 this.resolver = new ResolverTask(this); |
| 7608 this.checker = new TypeCheckerTask(this); | 7784 this.checker = new TypeCheckerTask(this); |
| 7609 this.builder = new SsaBuilderTask(this); | 7785 this.builder = new SsaBuilderTask(this); |
| 7610 this.optimizer = new SsaOptimizerTask(this); | 7786 this.optimizer = new SsaOptimizerTask(this); |
| 7611 this.generator = new SsaCodeGeneratorTask(this); | 7787 this.generator = new SsaCodeGeneratorTask(this); |
| 7612 this.tasks = [this.scanner, this.resolver, this.checker, this.builder, this.op
timizer, this.generator]; | 7788 this.tasks = [this.scanner, this.resolver, this.checker, this.builder, this.op
timizer, this.generator]; |
| 7613 } | 7789 } |
| 7614 Compiler.prototype.unimplemented = function(methodName) { | 7790 Compiler.prototype.unimplemented = function(methodName) { |
| 7615 this.cancel(("" + methodName + " not implemented")); | 7791 this.cancel(("" + methodName + " not implemented")); |
| 7616 } | 7792 } |
| 7617 Compiler.prototype.cancel = function(reason) { | 7793 Compiler.prototype.cancel = function(reason) { |
| 7618 $throw(new CompilerCancelledException(reason)); | 7794 $throw(new CompilerCancelledException(reason)); |
| 7619 } | 7795 } |
| 7620 Compiler.prototype.log = function(message) { | 7796 Compiler.prototype.log = function(message) { |
| 7621 | 7797 |
| 7622 } | 7798 } |
| 7623 Compiler.prototype.run = function() { | 7799 Compiler.prototype.run = function() { |
| 7624 try { | 7800 try { |
| 7625 this.runCompiler(); | 7801 this.runCompiler(); |
| 7626 } catch (exception) { | 7802 } catch (exception) { |
| 7627 exception = $toDartException(exception); | 7803 exception = $toDartException(exception); |
| 7628 if (!(exception instanceof CompilerCancelledException)) throw exception; | 7804 if (!(exception instanceof CompilerCancelledException)) throw exception; |
| 7629 this.log(exception.toString()); | 7805 this.log(exception.toString()); |
| 7630 this.log('compilation failed'); | 7806 this.log('compilation failed'); |
| 7631 return false; | 7807 return false; |
| 7632 } | 7808 } |
| 7633 if (false/*null.GENERATE_SSA_TRACE*/) { | 7809 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) { |
| 7634 print("------------------"); | 7810 print("------------------"); |
| 7635 print(HTracer.HTracer$singleton$factory()); | 7811 print(HTracer.HTracer$singleton$factory()); |
| 7636 print("------------------"); | 7812 print("------------------"); |
| 7637 } | 7813 } |
| 7638 this.log('compilation succeeded'); | 7814 this.log('compilation succeeded'); |
| 7639 return true; | 7815 return true; |
| 7640 } | 7816 } |
| 7641 Compiler.prototype.runCompiler = function() { | 7817 Compiler.prototype.runCompiler = function() { |
| 7642 this.scanner.scan(this.script); | 7818 this.scanner.scan(this.script); |
| 7643 while (!this.worklist.isEmpty()) { | 7819 while ($notnull_bool(!this.worklist.isEmpty())) { |
| 7644 var name = this.worklist.removeLast(); | 7820 var name = this.worklist.removeLast(); |
| 7645 var element = this.universe.find(name); | 7821 var element = this.universe.find(name); |
| 7646 if (element == null) this.cancel(('Could not find ' + name + '')); | 7822 if ($notnull_bool(element == null)) this.cancel(('Could not find ' + name +
'')); |
| 7647 var tree = element.parseNode(this, this); | 7823 var tree = element.parseNode(this, this); |
| 7648 var elements = this.resolver.resolve(tree); | 7824 var elements = this.resolver.resolve(tree); |
| 7649 this.checker.check(tree, elements); | 7825 this.checker.check(tree, elements); |
| 7650 var graph = this.builder.build(tree); | 7826 var graph = this.builder.build(tree); |
| 7651 this.optimizer.optimize(graph); | 7827 this.optimizer.optimize(graph); |
| 7652 var code = this.generator.generate(tree, graph); | 7828 var code = this.generator.generate(tree, graph); |
| 7653 this.universe.addGeneratedCode(element, code); | 7829 this.universe.addGeneratedCode(element, code); |
| 7654 } | 7830 } |
| 7655 } | 7831 } |
| 7656 Compiler.prototype.getGeneratedCode = function() { | 7832 Compiler.prototype.getGeneratedCode = function() { |
| 7657 var buffer = new StringBufferImpl(""); | 7833 var buffer = new StringBufferImpl(""); |
| 7658 buffer.add("var print = (typeof console == 'object')\n ? function(obj) { co
nsole.log(obj); }\n : function(obj) { write(obj); write('\\n'); };\n"/*null.P
RINT_SUPPORT*/); | 7834 buffer.add("var print = (typeof console == 'object')\n ? function(obj) { co
nsole.log(obj); }\n : function(obj) { write(obj); write('\\n'); };\n"/*null.P
RINT_SUPPORT*/); |
| 7659 buffer.add("function $add(a, b) {\n return a + b;\n}\n"/*null.ADD_SUPPORT*/); | 7835 buffer.add("function $add(a, b) {\n return a + b;\n}\n"/*null.ADD_SUPPORT*/); |
| 7660 buffer.add("function $div(a, b) {\n return a / b;\n}\n"/*null.DIV_SUPPORT*/); | 7836 buffer.add("function $div(a, b) {\n return a / b;\n}\n"/*null.DIV_SUPPORT*/); |
| 7661 buffer.add("function $sub(a, b) {\n return a - b;\n}\n"/*null.SUB_SUPPORT*/); | 7837 buffer.add("function $sub(a, b) {\n return a - b;\n}\n"/*null.SUB_SUPPORT*/); |
| 7662 buffer.add("function $mul(a, b) {\n return a * b;\n}\n"/*null.MUL_SUPPORT*/); | 7838 buffer.add("function $mul(a, b) {\n return a * b;\n}\n"/*null.MUL_SUPPORT*/); |
| 7663 buffer.add("function $tdiv(a, b) {\n var tmp = this / other;\n if (tmp < 0)
{\n return Math.ceil(tmp);\n } else {\n return Math.floor(tmp);\n }\n}\n
"/*null.TDIV_SUPPORT*/); | 7839 buffer.add("function $tdiv(a, b) {\n var tmp = this / other;\n if (tmp < 0)
{\n return Math.ceil(tmp);\n } else {\n return Math.floor(tmp);\n }\n}\n
"/*null.TDIV_SUPPORT*/); |
| 7664 var codeBlocks = this.universe.generatedCode.getValues(); | 7840 var codeBlocks = this.universe.generatedCode.getValues(); |
| 7665 for (var i = codeBlocks.length - 1; | 7841 for (var i = codeBlocks.length - 1; |
| 7666 i >= 0; i--) { | 7842 $notnull_bool(i >= 0); i--) { |
| 7667 buffer.add(codeBlocks.$index(i)); | 7843 buffer.add(codeBlocks.$index(i)); |
| 7668 } | 7844 } |
| 7669 buffer.add('main();\n'); | 7845 buffer.add('main();\n'); |
| 7670 return buffer.toString(); | 7846 return buffer.toString(); |
| 7671 } | 7847 } |
| 7672 // ********** Code for CompilerTask ************** | 7848 // ********** Code for CompilerTask ************** |
| 7673 function CompilerTask(compiler) { | 7849 function CompilerTask(compiler) { |
| 7674 this.compiler = compiler; | 7850 this.compiler = compiler; |
| 7675 this.watch = new StopWatchImplementation(); | 7851 this.watch = new StopWatchImplementation(); |
| 7676 // Initializers done | 7852 // Initializers done |
| (...skipping 10 matching lines...) Expand all Loading... |
| 7687 this.watch.stop(); | 7863 this.watch.stop(); |
| 7688 return result; | 7864 return result; |
| 7689 } | 7865 } |
| 7690 // ********** Code for CompilerCancelledException ************** | 7866 // ********** Code for CompilerCancelledException ************** |
| 7691 function CompilerCancelledException(reason) { | 7867 function CompilerCancelledException(reason) { |
| 7692 this.reason = reason; | 7868 this.reason = reason; |
| 7693 // Initializers done | 7869 // Initializers done |
| 7694 } | 7870 } |
| 7695 CompilerCancelledException.prototype.toString = function() { | 7871 CompilerCancelledException.prototype.toString = function() { |
| 7696 var banner = 'compiler cancelled'; | 7872 var banner = 'compiler cancelled'; |
| 7697 return (this.reason != null) ? ('' + banner + ': ' + this.reason + '') : ('' +
banner + ''); | 7873 return $notnull_bool((this.reason != null)) ? ('' + banner + ': ' + this.reaso
n + '') : ('' + banner + ''); |
| 7698 } | 7874 } |
| 7699 // ********** Code for ResolverTask ************** | 7875 // ********** Code for ResolverTask ************** |
| 7700 function ResolverTask(compiler0) { | 7876 function ResolverTask(compiler0) { |
| 7701 CompilerTask.call(this, compiler0); | 7877 CompilerTask.call(this, compiler0); |
| 7702 // Initializers done | 7878 // Initializers done |
| 7703 } | 7879 } |
| 7704 $inherits(ResolverTask, CompilerTask); | 7880 $inherits(ResolverTask, CompilerTask); |
| 7705 ResolverTask.prototype.get$name = function() { | 7881 ResolverTask.prototype.get$name = function() { |
| 7706 return 'Resolver'; | 7882 return 'Resolver'; |
| 7707 } | 7883 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 7718 function ResolverVisitor(compiler0) { | 7894 function ResolverVisitor(compiler0) { |
| 7719 this.compiler = compiler0; | 7895 this.compiler = compiler0; |
| 7720 this.mapping = new HashMapImplementation$Node$Element(); | 7896 this.mapping = new HashMapImplementation$Node$Element(); |
| 7721 this.context = new Scope(new TopScope(compiler0.universe)); | 7897 this.context = new Scope(new TopScope(compiler0.universe)); |
| 7722 // Initializers done | 7898 // Initializers done |
| 7723 } | 7899 } |
| 7724 ResolverVisitor.prototype.fail = function(node) { | 7900 ResolverVisitor.prototype.fail = function(node) { |
| 7725 this.compiler.cancel(('cannot resolve ' + node + '')); | 7901 this.compiler.cancel(('cannot resolve ' + node + '')); |
| 7726 } | 7902 } |
| 7727 ResolverVisitor.prototype.visit = function(node) { | 7903 ResolverVisitor.prototype.visit = function(node) { |
| 7728 if (node == null) return null; | 7904 if ($notnull_bool(node == null)) return null; |
| 7729 var element = node.accept(this); | 7905 var element = node.accept(this); |
| 7730 if (element != null) { | 7906 if ($notnull_bool(element != null)) { |
| 7731 this.mapping.$setindex(node, element); | 7907 this.mapping.$setindex(node, element); |
| 7732 } | 7908 } |
| 7733 return element; | 7909 return element; |
| 7734 } | 7910 } |
| 7735 ResolverVisitor.prototype.visitIn = function(node, scope) { | 7911 ResolverVisitor.prototype.visitIn = function(node, scope) { |
| 7736 this.context = scope; | 7912 this.context = scope; |
| 7737 var element = this.visit(node); | 7913 var element = this.visit(node); |
| 7738 this.context = this.context.parent; | 7914 this.context = this.context.parent; |
| 7739 return element; | 7915 return element; |
| 7740 } | 7916 } |
| 7741 ResolverVisitor.prototype.visitBlock = function(node) { | 7917 ResolverVisitor.prototype.visitBlock = function(node) { |
| 7742 this.visitIn(node.statements, new Scope(this.context)); | 7918 this.visitIn(node.statements, new Scope(this.context)); |
| 7743 } | 7919 } |
| 7744 ResolverVisitor.prototype.visitExpressionStatement = function(node) { | 7920 ResolverVisitor.prototype.visitExpressionStatement = function(node) { |
| 7745 this.visit(node.expression); | 7921 this.visit(node.expression); |
| 7746 } | 7922 } |
| 7747 ResolverVisitor.prototype.visitFunctionExpression = function(node) { | 7923 ResolverVisitor.prototype.visitFunctionExpression = function(node) { |
| 7748 if (!node.parameters.nodes.isEmpty()) this.fail(node); | 7924 if ($notnull_bool(!node.parameters.nodes.isEmpty())) this.fail(node); |
| 7749 var enclosingElement = this.visit(node.name); | 7925 var enclosingElement = this.visit(node.name); |
| 7750 this.visitIn(node.body, new Scope.enclosing$ctor(this.context, enclosingElemen
t)); | 7926 this.visitIn(node.body, new Scope.enclosing$ctor(this.context, enclosingElemen
t)); |
| 7751 return enclosingElement; | 7927 return enclosingElement; |
| 7752 } | 7928 } |
| 7753 ResolverVisitor.prototype.visitIdentifier = function(node) { | 7929 ResolverVisitor.prototype.visitIdentifier = function(node) { |
| 7754 var element = this.context.lookup(node.get$source()); | 7930 var element = this.context.lookup(node.get$source()); |
| 7755 if (element == null) this.fail(node); | 7931 if ($notnull_bool(element == null)) this.fail(node); |
| 7756 return element; | 7932 return element; |
| 7757 } | 7933 } |
| 7758 ResolverVisitor.prototype.visitIf = function(node) { | 7934 ResolverVisitor.prototype.visitIf = function(node) { |
| 7759 this.visit(node.condition); | 7935 this.visit(node.condition); |
| 7760 this.visit(node.thenPart); | 7936 this.visit(node.thenPart); |
| 7761 this.visit(node.elsePart); | 7937 this.visit(node.elsePart); |
| 7762 } | 7938 } |
| 7763 ResolverVisitor.prototype.visitSend = function(node) { | 7939 ResolverVisitor.prototype.visitSend = function(node) { |
| 7940 var $0; |
| 7764 var target = null; | 7941 var target = null; |
| 7765 this.visit(node.receiver); | 7942 this.visit(node.receiver); |
| 7766 var name = node.selector.get$source(); | 7943 var name = node.selector.get$source(); |
| 7767 if ($eq(name, const$248/*const SourceString('print')*/) || $eq(name, const$249
/*const SourceString('+')*/) || $eq(name, const$250/*const SourceString('-')*/)
|| $eq(name, const$251/*const SourceString('*')*/) || $eq(name, const$252/*const
SourceString('/')*/) || $eq(name, const$253/*const SourceString('~/')*/)) { | 7944 if ($notnull_bool($eq(name, const$248/*const SourceString('print')*/) || $eq(n
ame, const$249/*const SourceString('+')*/) || $eq(name, const$250/*const SourceS
tring('-')*/) || $eq(name, const$251/*const SourceString('*')*/) || $eq(name, co
nst$252/*const SourceString('/')*/) || $eq(name, const$253/*const SourceString('
~/')*/))) { |
| 7768 } | 7945 } |
| 7769 else { | 7946 else { |
| 7770 target = this.visit(node.selector); | 7947 target = (($0 = this.visit(node.selector)) && $0.is$Element()); |
| 7771 if (target == null) { | 7948 if ($notnull_bool(target == null)) { |
| 7772 this.fail(node); | 7949 this.fail(node); |
| 7773 } | 7950 } |
| 7774 else { | 7951 else { |
| 7775 this.compiler.worklist.add(node.selector.get$source()); | 7952 this.compiler.worklist.add(node.selector.get$source()); |
| 7776 } | 7953 } |
| 7777 } | 7954 } |
| 7778 this.visit(node.argumentsNode); | 7955 this.visit(node.argumentsNode); |
| 7779 return target; | 7956 return target; |
| 7780 } | 7957 } |
| 7781 ResolverVisitor.prototype.visitSetterSend = function(node) { | 7958 ResolverVisitor.prototype.visitSetterSend = function(node) { |
| 7782 this.compiler.unimplemented('ResolverVisitor::visitSetterSend'); | 7959 this.compiler.unimplemented('ResolverVisitor::visitSetterSend'); |
| 7783 } | 7960 } |
| 7784 ResolverVisitor.prototype.visitLiteralInt = function(node) { | 7961 ResolverVisitor.prototype.visitLiteralInt = function(node) { |
| 7785 | 7962 |
| 7786 } | 7963 } |
| 7787 ResolverVisitor.prototype.visitLiteralDouble = function(node) { | 7964 ResolverVisitor.prototype.visitLiteralDouble = function(node) { |
| 7788 | 7965 |
| 7789 } | 7966 } |
| 7790 ResolverVisitor.prototype.visitLiteralBool = function(node) { | 7967 ResolverVisitor.prototype.visitLiteralBool = function(node) { |
| 7791 | 7968 |
| 7792 } | 7969 } |
| 7793 ResolverVisitor.prototype.visitLiteralString = function(node) { | 7970 ResolverVisitor.prototype.visitLiteralString = function(node) { |
| 7794 | 7971 |
| 7795 } | 7972 } |
| 7796 ResolverVisitor.prototype.visitNodeList = function(node) { | 7973 ResolverVisitor.prototype.visitNodeList = function(node) { |
| 7974 var $0; |
| 7797 for (var link = node.nodes; | 7975 for (var link = node.nodes; |
| 7798 !link.isEmpty(); link = link.get$tail()) { | 7976 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { |
| 7799 this.visit(link.get$head()); | 7977 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 7800 } | 7978 } |
| 7801 } | 7979 } |
| 7802 ResolverVisitor.prototype.visitOperator = function(node) { | 7980 ResolverVisitor.prototype.visitOperator = function(node) { |
| 7803 this.fail(node); | 7981 this.fail(node); |
| 7804 } | 7982 } |
| 7805 ResolverVisitor.prototype.visitReturn = function(node) { | 7983 ResolverVisitor.prototype.visitReturn = function(node) { |
| 7806 this.visit(node.expression); | 7984 this.visit(node.expression); |
| 7807 return null; | 7985 return null; |
| 7808 } | 7986 } |
| 7809 ResolverVisitor.prototype.visitTypeAnnotation = function(node) { | 7987 ResolverVisitor.prototype.visitTypeAnnotation = function(node) { |
| 7810 | 7988 |
| 7811 } | 7989 } |
| 7812 ResolverVisitor.prototype.visitVariableDefinitions = function(node) { | 7990 ResolverVisitor.prototype.visitVariableDefinitions = function(node) { |
| 7813 var visitor = new VariableDefinitionsVisitor(node, this); | 7991 var visitor = new VariableDefinitionsVisitor(node, this); |
| 7814 visitor.visit(node.definitions); | 7992 visitor.visit(node.definitions); |
| 7815 } | 7993 } |
| 7816 ResolverVisitor.prototype.setElement = function(node, element) { | 7994 ResolverVisitor.prototype.setElement = function(node, element) { |
| 7817 this.mapping.$setindex(node, element); | 7995 this.mapping.$setindex(node, element); |
| 7818 this.context.add(element); | 7996 this.context.add(element); |
| 7819 } | 7997 } |
| 7820 // ********** Code for VariableDefinitionsVisitor ************** | 7998 // ********** Code for VariableDefinitionsVisitor ************** |
| 7821 function VariableDefinitionsVisitor(definitions, resolver) { | 7999 function VariableDefinitionsVisitor(definitions, resolver) { |
| 7822 this.definitions = definitions; | 8000 this.definitions = definitions; |
| 7823 this.resolver = resolver; | 8001 this.resolver = resolver; |
| 7824 // Initializers done | 8002 // Initializers done |
| 7825 } | 8003 } |
| 7826 VariableDefinitionsVisitor.prototype.visitSend = function(node) { | 8004 VariableDefinitionsVisitor.prototype.visitSend = function(node) { |
| 8005 var $0; |
| 8006 $assert(node.get$arguments().get$tail().isEmpty(), "node.arguments.tail.isEmpt
y()", "leg/resolver.dart", 157, 12); |
| 7827 var selector = node.selector; | 8007 var selector = node.selector; |
| 7828 var name = selector.get$source(); | 8008 var name = selector.get$source(); |
| 7829 this.resolver.visit(node.get$arguments().get$head()); | 8009 $assert($eq(name, const$244/*const SourceString('=')*/), "name == const Source
String('=')", "leg/resolver.dart", 160, 12); |
| 8010 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node())); |
| 7830 this.visit(node.receiver); | 8011 this.visit(node.receiver); |
| 7831 } | 8012 } |
| 7832 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { | 8013 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { |
| 7833 var variableElement = new Element(node.get$source(), this.resolver.context.enc
losingElement); | 8014 var variableElement = new Element(node.get$source(), this.resolver.context.enc
losingElement); |
| 7834 this.resolver.setElement(node, variableElement); | 8015 this.resolver.setElement(node, variableElement); |
| 7835 } | 8016 } |
| 7836 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { | 8017 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { |
| 8018 var $0; |
| 7837 for (var link = node.nodes; | 8019 for (var link = node.nodes; |
| 7838 !link.isEmpty(); link = link.get$tail()) { | 8020 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { |
| 7839 this.visit(link.get$head()); | 8021 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 7840 } | 8022 } |
| 7841 } | 8023 } |
| 7842 VariableDefinitionsVisitor.prototype.visit = function(node) { | 8024 VariableDefinitionsVisitor.prototype.visit = function(node) { |
| 7843 return node.accept(this); | 8025 return node.accept(this); |
| 7844 } | 8026 } |
| 7845 // ********** Code for Scope ************** | 8027 // ********** Code for Scope ************** |
| 7846 function Scope(parent0) { | 8028 function Scope(parent0) { |
| 7847 Scope.enclosing$ctor.call(this, parent0, parent0.enclosingElement); | 8029 Scope.enclosing$ctor.call(this, parent0, parent0.enclosingElement); |
| 7848 // Initializers done | 8030 // Initializers done |
| 7849 } | 8031 } |
| 7850 Scope.top$ctor = function() { | 8032 Scope.top$ctor = function() { |
| 7851 this.parent = null; | 8033 this.parent = null; |
| 7852 this.elements = const$247/*const {}*/; | 8034 this.elements = const$247/*const {}*/; |
| 7853 this.enclosingElement = null; | 8035 this.enclosingElement = null; |
| 7854 // Initializers done | 8036 // Initializers done |
| 7855 } | 8037 } |
| 7856 Scope.top$ctor.prototype = Scope.prototype; | 8038 Scope.top$ctor.prototype = Scope.prototype; |
| 7857 Scope.enclosing$ctor = function(parent, enclosingElement) { | 8039 Scope.enclosing$ctor = function(parent, enclosingElement) { |
| 7858 this.parent = parent; | 8040 this.parent = parent; |
| 7859 this.enclosingElement = enclosingElement; | 8041 this.enclosingElement = enclosingElement; |
| 7860 this.elements = $map([]); | 8042 this.elements = $map([]); |
| 7861 // Initializers done | 8043 // Initializers done |
| 7862 } | 8044 } |
| 7863 Scope.enclosing$ctor.prototype = Scope.prototype; | 8045 Scope.enclosing$ctor.prototype = Scope.prototype; |
| 7864 Scope.prototype.get$parent = function() { return this.parent; }; | 8046 Scope.prototype.get$parent = function() { return this.parent; }; |
| 7865 Scope.prototype.lookup = function(name) { | 8047 Scope.prototype.lookup = function(name) { |
| 7866 var element = this.elements.$index(name); | 8048 var element = this.elements.$index(name); |
| 7867 if (element != null) return element; | 8049 if ($notnull_bool(element != null)) return element; |
| 7868 return this.parent.lookup(name); | 8050 return this.parent.lookup(name); |
| 7869 } | 8051 } |
| 7870 Scope.prototype.add = function(element) { | 8052 Scope.prototype.add = function(element) { |
| 7871 this.elements.$setindex(element.name, element); | 8053 this.elements.$setindex(element.name, element); |
| 7872 } | 8054 } |
| 7873 // ********** Code for TopScope ************** | 8055 // ********** Code for TopScope ************** |
| 7874 function TopScope(universe) { | 8056 function TopScope(universe) { |
| 7875 this.universe = universe; | 8057 this.universe = universe; |
| 7876 Scope.top$ctor.call(this); | 8058 Scope.top$ctor.call(this); |
| 7877 // Initializers done | 8059 // Initializers done |
| (...skipping 10 matching lines...) Expand all Loading... |
| 7888 CompilerTask.call(this, compiler0); | 8070 CompilerTask.call(this, compiler0); |
| 7889 // Initializers done | 8071 // Initializers done |
| 7890 } | 8072 } |
| 7891 $inherits(ScannerTask, CompilerTask); | 8073 $inherits(ScannerTask, CompilerTask); |
| 7892 ScannerTask.prototype.get$name = function() { | 8074 ScannerTask.prototype.get$name = function() { |
| 7893 return 'Scanner'; | 8075 return 'Scanner'; |
| 7894 } | 8076 } |
| 7895 ScannerTask.prototype.scan = function(script) { | 8077 ScannerTask.prototype.scan = function(script) { |
| 7896 var $this = this; // closure support | 8078 var $this = this; // closure support |
| 7897 this.measure((function () { | 8079 this.measure((function () { |
| 8080 var $0; |
| 7898 var elements = $this.scanElements(script.get$text()); | 8081 var elements = $this.scanElements(script.get$text()); |
| 7899 for (var link = elements; | 8082 for (var link = elements; |
| 7900 !link.isEmpty(); link = link.get$tail()) { | 8083 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Lin
k$Element())) { |
| 7901 $this.compiler.universe.define(link.get$head()); | 8084 $this.compiler.universe.define((($0 = link.get$head()) && $0.is$Element())
); |
| 7902 } | 8085 } |
| 7903 }) | 8086 }) |
| 7904 ); | 8087 ); |
| 7905 } | 8088 } |
| 7906 ScannerTask.prototype.scanElements = function(text) { | 8089 ScannerTask.prototype.scanElements = function(text) { |
| 7907 var tokens = new StringScanner(text).tokenize(); | 8090 var tokens = new StringScanner(text).tokenize(); |
| 7908 var listener = new Listener(this.compiler); | 8091 var listener = new Listener(this.compiler); |
| 7909 var parser = new Parser(listener); | 8092 var parser = new Parser(listener); |
| 7910 parser.parseUnit(tokens); | 8093 parser.parseUnit(tokens); |
| 7911 return listener.topLevelElements; | 8094 return listener.topLevelElements; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 7939 function CompilerError() {} | 8122 function CompilerError() {} |
| 7940 CompilerError.NOT_ASSIGNABLE = function(t, s) { | 8123 CompilerError.NOT_ASSIGNABLE = function(t, s) { |
| 7941 return ('' + t + ' is not assignable to ' + s + ''); | 8124 return ('' + t + ' is not assignable to ' + s + ''); |
| 7942 } | 8125 } |
| 7943 // ********** Code for SimpleType ************** | 8126 // ********** Code for SimpleType ************** |
| 7944 function SimpleType(name, element) { | 8127 function SimpleType(name, element) { |
| 7945 this.name = name; | 8128 this.name = name; |
| 7946 this.element = element; | 8129 this.element = element; |
| 7947 // Initializers done | 8130 // Initializers done |
| 7948 } | 8131 } |
| 8132 SimpleType.prototype.is$Type = function(){return this;}; |
| 7949 SimpleType.prototype.get$name = function() { return this.name; }; | 8133 SimpleType.prototype.get$name = function() { return this.name; }; |
| 7950 SimpleType.prototype.get$element = function() { return this.element; }; | 8134 SimpleType.prototype.get$element = function() { return this.element; }; |
| 7951 SimpleType.prototype.toString = function() { | 8135 SimpleType.prototype.toString = function() { |
| 7952 return this.name.toString(); | 8136 return this.name.toString(); |
| 7953 } | 8137 } |
| 7954 // ********** Code for FunctionType ************** | 8138 // ********** Code for FunctionType ************** |
| 7955 function FunctionType(returnType, parameterTypes) { | 8139 function FunctionType(returnType, parameterTypes) { |
| 7956 this.returnType = returnType; | 8140 this.returnType = returnType; |
| 7957 this.parameterTypes = parameterTypes; | 8141 this.parameterTypes = parameterTypes; |
| 7958 // Initializers done | 8142 // Initializers done |
| 7959 } | 8143 } |
| 8144 FunctionType.prototype.is$Type = function(){return this;}; |
| 7960 FunctionType.prototype.get$returnType = function() { return this.returnType; }; | 8145 FunctionType.prototype.get$returnType = function() { return this.returnType; }; |
| 7961 FunctionType.prototype.toString = function() { | 8146 FunctionType.prototype.toString = function() { |
| 8147 var $0; |
| 7962 var sb = new StringBufferImpl(""); | 8148 var sb = new StringBufferImpl(""); |
| 7963 var first = true; | 8149 var first = true; |
| 7964 sb.add('('); | 8150 sb.add('('); |
| 7965 for (var link = this.parameterTypes; | 8151 for (var link = this.parameterTypes; |
| 7966 !link.isEmpty(); link = link.get$tail()) { | 8152 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Type())) { |
| 7967 if (!first) sb.add(', '); | 8153 if ($notnull_bool(!first)) sb.add(', '); |
| 7968 first = false; | 8154 first = false; |
| 7969 sb.add(link.get$head()); | 8155 sb.add(link.get$head()); |
| 7970 } | 8156 } |
| 7971 sb.add((') -> ' + this.returnType + '')); | 8157 sb.add((') -> ' + this.returnType + '')); |
| 7972 return sb.toString(); | 8158 return sb.toString(); |
| 7973 } | 8159 } |
| 7974 // ********** Code for Types ************** | 8160 // ********** Code for Types ************** |
| 7975 function Types() { | 8161 function Types() { |
| 7976 this.VOID = new SimpleType(const$254, new Element(const$254/*const SourceStrin
g('void')*/)); | 8162 this.VOID = new SimpleType(const$254, new Element(const$254/*const SourceStrin
g('void')*/)); |
| 7977 this.INT = new SimpleType(const$255, new Element(const$255/*const SourceString
('int')*/)); | 8163 this.INT = new SimpleType(const$255, new Element(const$255/*const SourceString
('int')*/)); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8014 this.visit(node.body); | 8200 this.visit(node.body); |
| 8015 this.expectedReturnType = previous; | 8201 this.expectedReturnType = previous; |
| 8016 return functionType; | 8202 return functionType; |
| 8017 } | 8203 } |
| 8018 TypeCheckerVisitor.prototype.visitIdentifier = function(node) { | 8204 TypeCheckerVisitor.prototype.visitIdentifier = function(node) { |
| 8019 this.fail(node); | 8205 this.fail(node); |
| 8020 } | 8206 } |
| 8021 TypeCheckerVisitor.prototype.visitIf = function(node) { | 8207 TypeCheckerVisitor.prototype.visitIf = function(node) { |
| 8022 this.visit(node.condition); | 8208 this.visit(node.condition); |
| 8023 this.visit(node.thenPart); | 8209 this.visit(node.thenPart); |
| 8024 if (node.get$hasElsePart()) this.visit(node.elsePart); | 8210 if ($notnull_bool(node.get$hasElsePart())) this.visit(node.elsePart); |
| 8025 return this.types.VOID; | 8211 return this.types.VOID; |
| 8026 } | 8212 } |
| 8027 TypeCheckerVisitor.prototype.visitSend = function(node) { | 8213 TypeCheckerVisitor.prototype.visitSend = function(node) { |
| 8214 var $0; |
| 8028 var target = this.elements.$index(node); | 8215 var target = this.elements.$index(node); |
| 8029 if (target != null) { | 8216 if ($notnull_bool(target != null)) { |
| 8030 var funType = target.computeType(this.compiler, this.types); | 8217 var funType = target.computeType(this.compiler, this.types); |
| 8031 var formals = funType.parameterTypes; | 8218 var formals = funType.parameterTypes; |
| 8032 var arguments = node.get$arguments(); | 8219 var arguments = node.get$arguments(); |
| 8033 while ((!formals.isEmpty()) && (!arguments.isEmpty())) { | 8220 while ($notnull_bool((!formals.isEmpty()) && (!arguments.isEmpty()))) { |
| 8034 this.compiler.cancel('parameters not supported.'); | 8221 this.compiler.cancel('parameters not supported.'); |
| 8035 var argumentType = this.visit(arguments.get$head()); | 8222 var argumentType = this.visit((($0 = arguments.get$head()) && $0.is$Node()
)); |
| 8036 if (!this.types.isAssignable(formals.get$head(), argumentType)) { | 8223 if ($notnull_bool(!this.types.isAssignable((($0 = formals.get$head()) && $
0.is$Type()), (argumentType && argumentType.is$Type())))) { |
| 8037 var warning = CompilerError.NOT_ASSIGNABLE(argumentType, formals.get$hea
d()); | 8224 var warning = CompilerError.NOT_ASSIGNABLE((argumentType && argumentType
.is$Type()), (($0 = formals.get$head()) && $0.is$Type())); |
| 8038 this.compiler.reportWarning(node, warning); | 8225 this.compiler.reportWarning(node, warning); |
| 8039 } | 8226 } |
| 8040 formals = formals.get$tail(); | 8227 formals = (($0 = formals.get$tail()) && $0.is$Link$Type()); |
| 8041 arguments = arguments.get$tail(); | 8228 arguments = (($0 = arguments.get$tail()) && $0.is$Link$Node()); |
| 8042 } | 8229 } |
| 8043 if (!formals.isEmpty()) { | 8230 if ($notnull_bool(!formals.isEmpty())) { |
| 8044 this.compiler.reportWarning(node, 'missing argument'); | 8231 this.compiler.reportWarning(node, 'missing argument'); |
| 8045 } | 8232 } |
| 8046 if (!arguments.isEmpty()) { | 8233 if ($notnull_bool(!arguments.isEmpty())) { |
| 8047 this.compiler.reportWarning(node, 'additional arguments'); | 8234 this.compiler.reportWarning(node, 'additional arguments'); |
| 8048 } | 8235 } |
| 8049 return funType.returnType; | 8236 return funType.returnType; |
| 8050 } | 8237 } |
| 8051 else { | 8238 else { |
| 8052 var selector = node.selector; | 8239 var selector = node.selector; |
| 8053 var name = selector.get$source(); | 8240 var name = selector.get$source(); |
| 8054 if ($eq(name, const$248/*const SourceString('print')*/) || $eq(name, const$2
49/*const SourceString('+')*/)) { | 8241 if ($notnull_bool($eq(name, const$248/*const SourceString('print')*/) || $eq
(name, const$249/*const SourceString('+')*/))) { |
| 8055 return this.types.DYNAMIC; | 8242 return this.types.DYNAMIC; |
| 8056 } | 8243 } |
| 8057 this.compiler.cancel(('unresolved send ' + name + '.')); | 8244 this.compiler.cancel(('unresolved send ' + name + '.')); |
| 8058 } | 8245 } |
| 8059 } | 8246 } |
| 8060 TypeCheckerVisitor.prototype.visitSetterSend = function(node) { | 8247 TypeCheckerVisitor.prototype.visitSetterSend = function(node) { |
| 8061 return this.types.DYNAMIC; | 8248 return this.types.DYNAMIC; |
| 8062 } | 8249 } |
| 8063 TypeCheckerVisitor.prototype.visitLiteralInt = function(node) { | 8250 TypeCheckerVisitor.prototype.visitLiteralInt = function(node) { |
| 8064 return this.types.INT; | 8251 return this.types.INT; |
| 8065 } | 8252 } |
| 8066 TypeCheckerVisitor.prototype.visitLiteralDouble = function(node) { | 8253 TypeCheckerVisitor.prototype.visitLiteralDouble = function(node) { |
| 8067 return this.types.DYNAMIC; | 8254 return this.types.DYNAMIC; |
| 8068 } | 8255 } |
| 8069 TypeCheckerVisitor.prototype.visitLiteralBool = function(node) { | 8256 TypeCheckerVisitor.prototype.visitLiteralBool = function(node) { |
| 8070 return this.types.DYNAMIC; | 8257 return this.types.DYNAMIC; |
| 8071 } | 8258 } |
| 8072 TypeCheckerVisitor.prototype.visitLiteralString = function(node) { | 8259 TypeCheckerVisitor.prototype.visitLiteralString = function(node) { |
| 8073 return this.types.DYNAMIC; | 8260 return this.types.DYNAMIC; |
| 8074 } | 8261 } |
| 8075 TypeCheckerVisitor.prototype.visitNodeList = function(node) { | 8262 TypeCheckerVisitor.prototype.visitNodeList = function(node) { |
| 8263 var $0; |
| 8076 for (var link = node.nodes; | 8264 for (var link = node.nodes; |
| 8077 !link.isEmpty(); link = link.get$tail()) { | 8265 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { |
| 8078 this.visit(link.get$head()); | 8266 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 8079 } | 8267 } |
| 8080 } | 8268 } |
| 8081 TypeCheckerVisitor.prototype.visitOperator = function(node) { | 8269 TypeCheckerVisitor.prototype.visitOperator = function(node) { |
| 8082 return this.types.DYNAMIC; | 8270 return this.types.DYNAMIC; |
| 8083 } | 8271 } |
| 8084 TypeCheckerVisitor.prototype.visitParameter = function(node) { | 8272 TypeCheckerVisitor.prototype.visitParameter = function(node) { |
| 8085 return null; | 8273 return null; |
| 8086 } | 8274 } |
| 8087 TypeCheckerVisitor.prototype.visitReturn = function(node) { | 8275 TypeCheckerVisitor.prototype.visitReturn = function(node) { |
| 8088 var expressionType = this.visit(node.expression); | 8276 var expressionType = this.visit(node.expression); |
| 8089 if (!this.types.isAssignable(this.expectedReturnType, expressionType)) { | 8277 if ($notnull_bool(!this.types.isAssignable(this.expectedReturnType, expression
Type))) { |
| 8090 var error = CompilerError.NOT_ASSIGNABLE(this.expectedReturnType, expression
Type); | 8278 var error = CompilerError.NOT_ASSIGNABLE(this.expectedReturnType, expression
Type); |
| 8091 this.compiler.reportWarning(node, error); | 8279 this.compiler.reportWarning(node, error); |
| 8092 } | 8280 } |
| 8093 return this.types.VOID; | 8281 return this.types.VOID; |
| 8094 } | 8282 } |
| 8095 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) { | 8283 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) { |
| 8096 if (node.typeName != null && $ne(node.typeName.get$source(), const$254/*const
SourceString('void')*/)) { | 8284 if ($notnull_bool(node.typeName != null && $ne(node.typeName.get$source(), con
st$254/*const SourceString('void')*/))) { |
| 8097 this.compiler.cancel(('unsupported type ' + node.typeName + '')); | 8285 this.compiler.cancel(('unsupported type ' + node.typeName + '')); |
| 8098 } | 8286 } |
| 8099 return this.types.VOID; | 8287 return this.types.VOID; |
| 8100 } | 8288 } |
| 8101 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) { | 8289 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) { |
| 8102 return this.types.VOID; | 8290 return this.types.VOID; |
| 8103 } | 8291 } |
| 8104 // ********** Code for Universe ************** | 8292 // ********** Code for Universe ************** |
| 8105 function Universe() { | 8293 function Universe() { |
| 8106 this.elements = $map([]); | 8294 this.elements = $map([]); |
| 8107 this.generatedCode = $map([]); | 8295 this.generatedCode = $map([]); |
| 8108 this.scope = new Element(const$1/*const SourceString('global scope')*/); | 8296 this.scope = new Element(const$2/*const SourceString('global scope')*/); |
| 8109 // Initializers done | 8297 // Initializers done |
| 8110 } | 8298 } |
| 8111 Universe.prototype.find = function(name) { | 8299 Universe.prototype.find = function(name) { |
| 8112 return this.elements.$index(name); | 8300 return this.elements.$index(name); |
| 8113 } | 8301 } |
| 8114 Universe.prototype.define = function(element) { | 8302 Universe.prototype.define = function(element) { |
| 8303 $assert(this.elements.$index(element.name) == null, "elements[element.name] ==
null", "leg/universe.dart", 19, 12); |
| 8115 this.elements.$setindex(element.name, element); | 8304 this.elements.$setindex(element.name, element); |
| 8116 } | 8305 } |
| 8117 Universe.prototype.addGeneratedCode = function(element, code) { | 8306 Universe.prototype.addGeneratedCode = function(element, code) { |
| 8118 this.generatedCode.$setindex(element, code); | 8307 this.generatedCode.$setindex(element, code); |
| 8119 } | 8308 } |
| 8120 // ********** Code for top level ************** | 8309 // ********** Code for top level ************** |
| 8121 function unreachable() { | 8310 function unreachable() { |
| 8122 $throw(const$265/*const Exception("Internal Error (Leg): UNREACHABLE")*/); | 8311 $throw(const$265/*const Exception("Internal Error (Leg): UNREACHABLE")*/); |
| 8123 } | 8312 } |
| 8124 function compile(world) { | 8313 function compile(world) { |
| 8125 var file = world.readFile(options.dartScript); | 8314 var file = world.readFile(options.dartScript); |
| 8126 var script = new leg_Script(file); | 8315 var script = new leg_Script(file); |
| 8127 var compiler = new WorldCompiler(world, script); | 8316 var compiler = new WorldCompiler(world, script); |
| 8128 return compiler.run(); | 8317 return compiler.run(); |
| 8129 } | 8318 } |
| 8130 // ********** Library lang ************** | 8319 // ********** Library lang ************** |
| 8131 // ********** Code for CodeWriter ************** | 8320 // ********** Code for CodeWriter ************** |
| 8132 function CodeWriter() { | 8321 function CodeWriter() { |
| 8133 this._indentation = 0 | 8322 this._indentation = 0 |
| 8134 this._pendingIndent = false | 8323 this._pendingIndent = false |
| 8135 this.writeComments = true | 8324 this.writeComments = true |
| 8136 this._buf = new StringBufferImpl(""); | 8325 this._buf = new StringBufferImpl(""); |
| 8137 // Initializers done | 8326 // Initializers done |
| 8138 } | 8327 } |
| 8328 CodeWriter.prototype.is$CodeWriter = function(){return this;}; |
| 8139 CodeWriter.prototype.get$text = function() { | 8329 CodeWriter.prototype.get$text = function() { |
| 8140 return this._buf.toString(); | 8330 return this._buf.toString(); |
| 8141 } | 8331 } |
| 8142 CodeWriter.prototype._indent = function() { | 8332 CodeWriter.prototype._indent = function() { |
| 8143 this._pendingIndent = false; | 8333 this._pendingIndent = false; |
| 8144 for (var i = 0; | 8334 for (var i = 0; |
| 8145 i < this._indentation; i++) { | 8335 $notnull_bool(i < this._indentation); i++) { |
| 8146 this._buf.add(' '/*CodeWriter.INDENTATION*/); | 8336 this._buf.add(' '/*CodeWriter.INDENTATION*/); |
| 8147 } | 8337 } |
| 8148 } | 8338 } |
| 8149 CodeWriter.prototype.comment = function(text0) { | 8339 CodeWriter.prototype.comment = function(text0) { |
| 8150 if (this.writeComments) { | 8340 if ($notnull_bool(this.writeComments)) { |
| 8151 this.writeln(text0); | 8341 this.writeln(text0); |
| 8152 } | 8342 } |
| 8153 } | 8343 } |
| 8154 CodeWriter.prototype.write = function(text0) { | 8344 CodeWriter.prototype.write = function(text0) { |
| 8155 if (text0.length == 0) return; | 8345 if ($notnull_bool(text0.length == 0)) return; |
| 8156 if (this._pendingIndent) this._indent(); | 8346 if ($notnull_bool(this._pendingIndent)) this._indent(); |
| 8157 if (text0.indexOf('\n', 0) != -1) { | 8347 if ($notnull_bool(text0.indexOf('\n', 0) != -1)) { |
| 8158 var lines = text0.split('\n'); | 8348 var lines = text0.split('\n'); |
| 8159 for (var i = 0; | 8349 for (var i = 0; |
| 8160 i < lines.length - 1; i++) { | 8350 $notnull_bool(i < lines.length - 1); i++) { |
| 8161 this.writeln(lines.$index(i)); | 8351 this.writeln($assert_String(lines.$index(i))); |
| 8162 } | 8352 } |
| 8163 this.write(lines.$index(lines.length - 1)); | 8353 this.write($assert_String(lines.$index(lines.length - 1))); |
| 8164 } | 8354 } |
| 8165 else { | 8355 else { |
| 8166 this._buf.add(text0); | 8356 this._buf.add(text0); |
| 8167 } | 8357 } |
| 8168 } | 8358 } |
| 8169 CodeWriter.prototype.writeln = function(text0) { | 8359 CodeWriter.prototype.writeln = function(text0) { |
| 8170 if (text0 != null) { | 8360 if ($notnull_bool(text0 != null)) { |
| 8171 this.write(text0); | 8361 this.write(text0); |
| 8172 } | 8362 } |
| 8173 if (!text0.endsWith('\n')) this._buf.add('\n'/*CodeWriter.NEWLINE*/); | 8363 if ($notnull_bool(!text0.endsWith('\n'))) this._buf.add('\n'/*CodeWriter.NEWLI
NE*/); |
| 8174 this._pendingIndent = true; | 8364 this._pendingIndent = true; |
| 8175 } | 8365 } |
| 8176 CodeWriter.prototype.enterBlock = function(text0) { | 8366 CodeWriter.prototype.enterBlock = function(text0) { |
| 8177 this.writeln(text0); | 8367 this.writeln(text0); |
| 8178 this._indentation++; | 8368 this._indentation++; |
| 8179 } | 8369 } |
| 8180 CodeWriter.prototype.exitBlock = function(text0) { | 8370 CodeWriter.prototype.exitBlock = function(text0) { |
| 8181 this._indentation--; | 8371 this._indentation--; |
| 8182 this.writeln(text0); | 8372 this.writeln(text0); |
| 8183 } | 8373 } |
| 8184 CodeWriter.prototype.nextBlock = function(text0) { | 8374 CodeWriter.prototype.nextBlock = function(text0) { |
| 8185 this._indentation--; | 8375 this._indentation--; |
| 8186 this.writeln(text0); | 8376 this.writeln(text0); |
| 8187 this._indentation++; | 8377 this._indentation++; |
| 8188 } | 8378 } |
| 8189 // ********** Code for WorldGenerator ************** | 8379 // ********** Code for WorldGenerator ************** |
| 8190 function WorldGenerator(main, writer) { | 8380 function WorldGenerator(main, writer) { |
| 8191 this.main = main; | 8381 this.main = main; |
| 8192 this.writer = writer; | 8382 this.writer = writer; |
| 8193 this.globals = $map([]); | 8383 this.globals = $map([]); |
| 8194 // Initializers done | 8384 // Initializers done |
| 8195 } | 8385 } |
| 8196 WorldGenerator.prototype.run = function() { | 8386 WorldGenerator.prototype.run = function() { |
| 8197 var metaGen = new MethodGenerator(this.main, null); | 8387 var metaGen = new MethodGenerator(this.main, null); |
| 8198 var mainCall = this.main.invoke(metaGen, null, null, Arguments.get$EMPTY(), fa
lse); | 8388 var mainCall = this.main.invoke((metaGen && metaGen.is$MethodGenerator()), nul
l, null, Arguments.get$EMPTY(), false); |
| 8199 this.main.declaringType.markUsed(); | 8389 this.main.declaringType.markUsed(); |
| 8200 world.corelib.types.$index('BadNumberFormatException').markUsed(); | 8390 world.corelib.types.$index('BadNumberFormatException').markUsed(); |
| 8201 world.get$coreimpl().types.$index('MatchImplementation').markUsed(); | 8391 world.get$coreimpl().types.$index('MatchImplementation').markUsed(); |
| 8202 world.get$coreimpl().types.$index('NumImplementation').markUsed(); | 8392 world.get$coreimpl().types.$index('NumImplementation').markUsed(); |
| 8203 world.get$coreimpl().types.$index('StringImplementation').markUsed(); | 8393 world.get$coreimpl().types.$index('StringImplementation').markUsed(); |
| 8204 this.writeTypes(world.get$coreimpl()); | 8394 this.writeTypes(world.get$coreimpl()); |
| 8205 this.writeTypes(world.corelib); | 8395 this.writeTypes(world.corelib); |
| 8206 var matchConstructor = world.get$coreimpl().types.$index('MatchImplementation'
).getConstructor(''); | 8396 var matchConstructor = world.get$coreimpl().types.$index('MatchImplementation'
).getConstructor(''); |
| 8207 this.genMethod(matchConstructor); | 8397 this.genMethod((matchConstructor && matchConstructor.is$Member())); |
| 8208 matchConstructor.generator.writeDefinition(this.writer, null); | 8398 matchConstructor.generator.writeDefinition(this.writer, null); |
| 8209 this.writeTypes(this.main.declaringType.get$library()); | 8399 this.writeTypes(this.main.declaringType.get$library()); |
| 8210 this._writeDynamicStubs(world.functionType); | 8400 this._writeDynamicStubs(world.functionType); |
| 8211 this._writeGlobals(); | 8401 this._writeGlobals(); |
| 8212 this.writer.writeln(('' + mainCall.code + ';')); | 8402 this.writer.writeln(('' + mainCall.code + ';')); |
| 8213 } | 8403 } |
| 8214 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe
ndencies) { | 8404 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe
ndencies) { |
| 8215 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); | 8405 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); |
| 8216 if (!this.globals.containsKey(fullname)) { | 8406 if ($notnull_bool(!this.globals.containsKey(fullname))) { |
| 8217 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory(
field, fieldValue, dependencies)); | 8407 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory(
field, fieldValue, dependencies)); |
| 8218 } | 8408 } |
| 8219 return this.globals.$index(fullname); | 8409 return this.globals.$index(fullname); |
| 8220 } | 8410 } |
| 8221 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { | 8411 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { |
| 8222 var code = exp.canonicalCode; | 8412 var code = exp.canonicalCode; |
| 8223 if (!this.globals.containsKey(code)) { | 8413 if ($notnull_bool(!this.globals.containsKey(code))) { |
| 8224 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this.
globals.get$length(), exp, dependencies)); | 8414 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this.
globals.get$length(), exp, dependencies)); |
| 8225 } | 8415 } |
| 8226 return this.globals.$index(code); | 8416 return this.globals.$index(code); |
| 8227 } | 8417 } |
| 8228 WorldGenerator.prototype.writeTypes = function(lib) { | 8418 WorldGenerator.prototype.writeTypes = function(lib) { |
| 8229 if (lib.isWritten) return; | 8419 if ($notnull_bool(lib.isWritten)) return; |
| 8230 lib.isWritten = true; | 8420 lib.isWritten = true; |
| 8231 var $list = lib.imports; | 8421 var $list = lib.imports; |
| 8232 for (var $i = 0;$i < $list.length; $i++) { | 8422 for (var $i = 0;$i < $list.length; $i++) { |
| 8233 var import_ = $list.$index($i); | 8423 var import_ = $list.$index($i); |
| 8234 this.writeTypes(import_.get$library()); | 8424 this.writeTypes(import_.get$library()); |
| 8235 } | 8425 } |
| 8236 for (var i = 0; | 8426 for (var i = 0; |
| 8237 i < lib.sources.length; i++) { | 8427 $notnull_bool(i < lib.sources.length); i++) { |
| 8238 lib.sources.$index(i).orderInLibrary = i; | 8428 lib.sources.$index(i).orderInLibrary = i; |
| 8239 } | 8429 } |
| 8240 this.writer.comment(('// ********** Library ' + lib.name + ' **************')
); | 8430 this.writer.comment(('// ********** Library ' + lib.name + ' **************')
); |
| 8241 var $list = lib.natives; | 8431 var $list = lib.natives; |
| 8242 for (var $i = 0;$i < $list.length; $i++) { | 8432 for (var $i = 0;$i < $list.length; $i++) { |
| 8243 var file = $list.$index($i); | 8433 var file = $list.$index($i); |
| 8244 var filename = basename(file.filename); | 8434 var filename = basename(file.filename); |
| 8245 this.writer.comment(('// ********** Natives ' + filename + ' **************
')); | 8435 this.writer.comment(('// ********** Natives ' + filename + ' **************
')); |
| 8246 this.writer.writeln(file.get$text()); | 8436 this.writer.writeln(file.get$text()); |
| 8247 } | 8437 } |
| 8248 lib.topType.markUsed(); | 8438 lib.topType.markUsed(); |
| 8249 var $list = this._orderValues(lib.types); | 8439 var $list = this._orderValues(lib.types); |
| 8250 for (var $i = 0;$i < $list.length; $i++) { | 8440 for (var $i = 0;$i < $list.length; $i++) { |
| 8251 var type = $list.$index($i); | 8441 var type = $list.$index($i); |
| 8252 if (type.get$isUsed() && type.get$isClass()) { | 8442 if ($notnull_bool(type.get$isUsed() && type.get$isClass())) { |
| 8253 this.writeType(type); | 8443 this.writeType((type && type.is$lang_Type())); |
| 8254 if (type.get$isGeneric()) { | 8444 if ($notnull_bool(type.get$isGeneric())) { |
| 8255 var $list0 = this._orderValues(type._concreteTypes); | 8445 var $list0 = this._orderValues(type._concreteTypes); |
| 8256 for (var $i0 = 0;$i0 < $list0.length; $i0++) { | 8446 for (var $i0 = 0;$i0 < $list0.length; $i0++) { |
| 8257 var ct = $list0.$index($i0); | 8447 var ct = $list0.$index($i0); |
| 8258 this.writeType(ct); | 8448 this.writeType((ct && ct.is$lang_Type())); |
| 8259 } | 8449 } |
| 8260 } | 8450 } |
| 8261 } | 8451 } |
| 8452 if ($notnull_bool(type.typeCheckCode != null)) { |
| 8453 this.writer.writeln(type.typeCheckCode); |
| 8454 } |
| 8262 } | 8455 } |
| 8263 } | 8456 } |
| 8264 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { | 8457 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { |
| 8265 if (!meth.isGenerated && meth.declaringType.get$isClass() && $ne(meth.get$defi
nition(), null) && !meth.get$isAbstract()) { | 8458 if ($notnull_bool(!meth.isGenerated && meth.declaringType.get$isClass() && $ne
(meth.get$definition(), null) && !meth.get$isAbstract())) { |
| 8266 new MethodGenerator(meth, enclosingMethod).run(); | 8459 new MethodGenerator(meth, enclosingMethod).run(); |
| 8267 } | 8460 } |
| 8268 } | 8461 } |
| 8269 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { | 8462 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { |
| 8270 if (!checkType.isTested) return; | 8463 if ($notnull_bool(!checkType.isTested)) return; |
| 8271 var value = 'false'; | 8464 var value = 'false'; |
| 8272 if (onType.isSubtypeOf(checkType)) { | 8465 if ($notnull_bool(onType.isSubtypeOf(checkType))) { |
| 8273 value = 'function(){return this;}'; | 8466 value = 'function(){return this;}'; |
| 8274 } | 8467 } |
| 8275 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType.
get$jsname() + ' = ') + ('' + value + ';')); | 8468 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType.
get$jsname() + ' = ') + ('' + value + ';')); |
| 8276 } | 8469 } |
| 8277 WorldGenerator.prototype.writeType = function(type) { | 8470 WorldGenerator.prototype.writeType = function(type) { |
| 8278 if (type.name != null && (type instanceof ConcreteType) && $eq(type.get$librar
y(), world.get$coreimpl()) && type.name.startsWith('ListFactory')) { | 8471 var $0; |
| 8472 if ($notnull_bool(type.name != null && (type instanceof ConcreteType) && $eq(t
ype.get$library(), world.get$coreimpl()) && type.name.startsWith('ListFactory'))
) { |
| 8279 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType()
.get$jsname() + ';')); | 8473 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType()
.get$jsname() + ';')); |
| 8280 return; | 8474 return; |
| 8281 } | 8475 } |
| 8282 var typeName = type.get$jsname() != null ? type.get$jsname() : 'top level'; | 8476 var typeName = $notnull_bool(type.get$jsname() != null) ? type.get$jsname() :
'top level'; |
| 8283 this.writer.comment(('// ********** Code for ' + typeName + ' **************')
); | 8477 this.writer.comment(('// ********** Code for ' + typeName + ' **************')
); |
| 8284 if (type.get$isNativeType() && !type.get$isTop()) { | 8478 if ($notnull_bool(type.get$isNativeType() && !type.get$isTop())) { |
| 8285 var nativeName = type.get$definition().nativeType; | 8479 var nativeName = type.get$definition().nativeType; |
| 8286 if ($eq(nativeName, '')) { | 8480 if ($notnull_bool($eq(nativeName, ''))) { |
| 8287 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 8481 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 8288 } | 8482 } |
| 8289 else if (type.get$jsname() != nativeName) { | 8483 else if ($notnull_bool(type.get$jsname() != nativeName)) { |
| 8290 this.writer.writeln(('' + type.get$jsname() + ' = ' + nativeName + ';')); | 8484 this.writer.writeln(('' + type.get$jsname() + ' = ' + nativeName + ';')); |
| 8291 } | 8485 } |
| 8292 } | 8486 } |
| 8293 if (type.get$isTop()) { | 8487 if ($notnull_bool(type.get$isTop())) { |
| 8294 } | 8488 } |
| 8295 else if (type.constructors.get$length() == 0) { | 8489 else if ($notnull_bool(type.constructors.get$length() == 0)) { |
| 8296 if (!type.get$isNativeType()) { | 8490 if ($notnull_bool(!type.get$isNativeType())) { |
| 8297 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 8491 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 8298 } | 8492 } |
| 8299 } | 8493 } |
| 8300 else { | 8494 else { |
| 8301 var standardConstructor = type.constructors.$index(''); | 8495 var standardConstructor = type.constructors.$index(''); |
| 8302 if (standardConstructor == null || standardConstructor.generator == null) { | 8496 if ($notnull_bool(standardConstructor == null || standardConstructor.generat
or == null)) { |
| 8303 if (!type.get$isNativeType()) { | 8497 if ($notnull_bool(!type.get$isNativeType())) { |
| 8304 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 8498 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 8305 } | 8499 } |
| 8306 } | 8500 } |
| 8307 else { | 8501 else { |
| 8308 standardConstructor.generator.writeDefinition(this.writer, null); | 8502 standardConstructor.generator.writeDefinition(this.writer, null); |
| 8309 } | 8503 } |
| 8310 var $list = type.constructors.getValues(); | 8504 var $list = type.constructors.getValues(); |
| 8311 for (var $i = type.constructors.getValues().iterator(); $i.hasNext(); ) { | 8505 for (var $i = type.constructors.getValues().iterator(); $i.hasNext(); ) { |
| 8312 var c = $i.next(); | 8506 var c = $i.next(); |
| 8313 if ($ne(c.generator, null) && $ne(c, standardConstructor)) { | 8507 if ($notnull_bool($ne(c.generator, null) && $ne(c, standardConstructor)))
{ |
| 8314 c.generator.writeDefinition(this.writer, null); | 8508 c.generator.writeDefinition(this.writer, null); |
| 8315 } | 8509 } |
| 8316 } | 8510 } |
| 8317 } | 8511 } |
| 8318 if (!type.get$isTop()) { | 8512 if ($notnull_bool(!type.get$isTop())) { |
| 8319 if ((type instanceof ConcreteType)) { | 8513 if ($notnull_bool((type instanceof ConcreteType))) { |
| 8320 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g
enericType().get$jsname() + ');')); | 8514 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g
enericType().get$jsname() + ');')); |
| 8321 } | 8515 } |
| 8322 else if (!type.get$isNativeType()) { | 8516 else if ($notnull_bool(!type.get$isNativeType())) { |
| 8323 if (type.get$parent() != null && !type.get$parent().get$isObject()) { | 8517 if ($notnull_bool(type.get$parent() != null && !type.get$parent().get$isOb
ject())) { |
| 8324 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get
$parent().get$jsname() + ');')); | 8518 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get
$parent().get$jsname() + ');')); |
| 8325 } | 8519 } |
| 8326 } | 8520 } |
| 8327 } | 8521 } |
| 8328 if (!(type instanceof ConcreteType)) { | 8522 if ($notnull_bool(!(type instanceof ConcreteType))) { |
| 8329 this._maybeIsTest(type, type); | 8523 this._maybeIsTest(type, type); |
| 8330 } | 8524 } |
| 8331 if (type.get$genericType()._concreteTypes != null) { | 8525 if ($notnull_bool(type.get$genericType()._concreteTypes != null)) { |
| 8332 var $list = this._orderValues(type.get$genericType()._concreteTypes); | 8526 var $list = this._orderValues(type.get$genericType()._concreteTypes); |
| 8333 for (var $i = 0;$i < $list.length; $i++) { | 8527 for (var $i = 0;$i < $list.length; $i++) { |
| 8334 var ct = $list.$index($i); | 8528 var ct = $list.$index($i); |
| 8335 this._maybeIsTest(type, ct); | 8529 this._maybeIsTest(type, (ct && ct.is$lang_Type())); |
| 8336 } | 8530 } |
| 8337 } | 8531 } |
| 8338 if (type.get$interfaces() != null) { | 8532 if ($notnull_bool(type.get$interfaces() != null)) { |
| 8339 var seen = new HashSetImplementation(); | 8533 var seen = new HashSetImplementation(); |
| 8340 var worklist = []; | 8534 var worklist = []; |
| 8341 worklist.addAll(type.get$interfaces()); | 8535 worklist.addAll(type.get$interfaces()); |
| 8342 seen.addAll(type.get$interfaces()); | 8536 seen.addAll(type.get$interfaces()); |
| 8343 while (!worklist.isEmpty()) { | 8537 while ($notnull_bool(!worklist.isEmpty())) { |
| 8344 var interface_ = worklist.removeLast(); | 8538 var interface_ = worklist.removeLast(); |
| 8345 this._maybeIsTest(type, interface_.get$genericType()); | 8539 this._maybeIsTest(type, interface_.get$genericType()); |
| 8346 if (interface_.get$genericType()._concreteTypes != null) { | 8540 if ($notnull_bool(interface_.get$genericType()._concreteTypes != null)) { |
| 8347 var $list = this._orderValues(interface_.get$genericType()._concreteType
s); | 8541 var $list = this._orderValues(interface_.get$genericType()._concreteType
s); |
| 8348 for (var $i = 0;$i < $list.length; $i++) { | 8542 for (var $i = 0;$i < $list.length; $i++) { |
| 8349 var ct = $list.$index($i); | 8543 var ct = $list.$index($i); |
| 8350 this._maybeIsTest(type, ct); | 8544 this._maybeIsTest(type, (ct && ct.is$lang_Type())); |
| 8351 } | 8545 } |
| 8352 } | 8546 } |
| 8353 var $list = interface_.get$interfaces(); | 8547 var $list = interface_.get$interfaces(); |
| 8354 for (var $i = 0;$i < $list.length; $i++) { | 8548 for (var $i = 0;$i < $list.length; $i++) { |
| 8355 var other = $list.$index($i); | 8549 var other = $list.$index($i); |
| 8356 if (!seen.contains(other)) { | 8550 if ($notnull_bool(!seen.contains(other))) { |
| 8357 worklist.addLast(other); | 8551 worklist.addLast(other); |
| 8358 seen.add(other); | 8552 seen.add(other); |
| 8359 } | 8553 } |
| 8360 } | 8554 } |
| 8361 } | 8555 } |
| 8362 } | 8556 } |
| 8363 type.factories.forEach$1(this.get$_writeMethod()); | 8557 type.factories.forEach$1(this.get$_writeMethod()); |
| 8364 var $list = this._orderValues(type.members); | 8558 var $list = this._orderValues((($0 = type.members) && $0.is$Map())); |
| 8365 for (var $i = 0;$i < $list.length; $i++) { | 8559 for (var $i = 0;$i < $list.length; $i++) { |
| 8366 var member = $list.$index($i); | 8560 var member = $list.$index($i); |
| 8367 if ((member instanceof FieldMember)) { | 8561 if ($notnull_bool((member instanceof FieldMember))) { |
| 8368 this._writeField(member); | 8562 this._writeField((member && member.is$FieldMember())); |
| 8369 } | 8563 } |
| 8370 if ((member instanceof PropertyMember)) { | 8564 if ($notnull_bool((member instanceof PropertyMember))) { |
| 8371 this._writeProperty(member); | 8565 this._writeProperty((member && member.is$PropertyMember())); |
| 8372 } | 8566 } |
| 8373 if (member.get$isMethod()) { | 8567 if ($notnull_bool(member.get$isMethod())) { |
| 8374 this._writeMethod(member); | 8568 this._writeMethod((member && member.is$Member())); |
| 8375 } | 8569 } |
| 8376 } | 8570 } |
| 8377 this._writeDynamicStubs(type); | 8571 this._writeDynamicStubs(type); |
| 8378 } | 8572 } |
| 8379 WorldGenerator.prototype._writeDynamicStubs = function(type) { | 8573 WorldGenerator.prototype._writeDynamicStubs = function(type) { |
| 8380 if (type.varStubs != null) { | 8574 if ($notnull_bool(type.varStubs != null)) { |
| 8381 var $list = orderValuesByKeys(type.varStubs); | 8575 var $list = orderValuesByKeys(type.varStubs); |
| 8382 for (var $i = 0;$i < $list.length; $i++) { | 8576 for (var $i = 0;$i < $list.length; $i++) { |
| 8383 var stub = $list.$index($i); | 8577 var stub = $list.$index($i); |
| 8384 stub.generate(this.writer); | 8578 stub.generate(this.writer); |
| 8385 } | 8579 } |
| 8386 } | 8580 } |
| 8387 } | 8581 } |
| 8388 WorldGenerator.prototype._writeStaticField = function(field) { | 8582 WorldGenerator.prototype._writeStaticField = function(field) { |
| 8389 if (field.isFinal) return; | 8583 if ($notnull_bool(field.isFinal)) return; |
| 8390 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); | 8584 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); |
| 8391 if (this.globals.containsKey(fullname)) { | 8585 if ($notnull_bool(this.globals.containsKey(fullname))) { |
| 8392 var value = this.globals.$index(fullname); | 8586 var value = this.globals.$index(fullname); |
| 8393 if (field.declaringType.get$isTop() && !field.isNative) { | 8587 if ($notnull_bool(field.declaringType.get$isTop() && !field.isNative)) { |
| 8394 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code
+ ';')); | 8588 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code
+ ';')); |
| 8395 } | 8589 } |
| 8396 else { | 8590 else { |
| 8397 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g
et$jsname() + ' = ' + value.exp.code + ';')); | 8591 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g
et$jsname() + ' = ' + value.exp.code + ';')); |
| 8398 } | 8592 } |
| 8399 } | 8593 } |
| 8400 } | 8594 } |
| 8401 WorldGenerator.prototype._writeField = function(field) { | 8595 WorldGenerator.prototype._writeField = function(field) { |
| 8402 if (field.declaringType.get$isTop() && !field.isNative && field.value == null)
{ | 8596 if ($notnull_bool(field.declaringType.get$isTop() && !field.isNative && field.
value == null)) { |
| 8403 this.writer.writeln(('var ' + field.get$jsname() + ';')); | 8597 this.writer.writeln(('var ' + field.get$jsname() + ';')); |
| 8404 } | 8598 } |
| 8405 if (field._providePropertySyntax) { | 8599 if ($notnull_bool(field._providePropertySyntax)) { |
| 8406 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get
\$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn
ame() + '; };')); | 8600 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get
\$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn
ame() + '; };')); |
| 8407 if (!field.isFinal) { | 8601 if ($notnull_bool(!field.isFinal)) { |
| 8408 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.s
et\$' + field.get$jsname() + ' = ') + ('function(value) { return this.' + field.
get$jsname() + ' = value; };')); | 8602 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.s
et\$' + field.get$jsname() + ' = ') + ('function(value) { return this.' + field.
get$jsname() + ' = value; };')); |
| 8409 } | 8603 } |
| 8410 } | 8604 } |
| 8411 } | 8605 } |
| 8412 WorldGenerator.prototype._writeProperty = function(property) { | 8606 WorldGenerator.prototype._writeProperty = function(property) { |
| 8413 if (property.getter != null) this._writeMethod(property.getter); | 8607 if ($notnull_bool(property.getter != null)) this._writeMethod(property.getter)
; |
| 8414 if (property.setter != null) this._writeMethod(property.setter); | 8608 if ($notnull_bool(property.setter != null)) this._writeMethod(property.setter)
; |
| 8415 if (property._provideFieldSyntax) { | 8609 if ($notnull_bool(property._provideFieldSyntax)) { |
| 8416 this.writer.enterBlock('Object.defineProperty(' + ('' + property.declaringTy
pe.get$jsname() + '.prototype, "' + property.get$jsname() + '", {')); | 8610 this.writer.enterBlock('Object.defineProperty(' + ('' + property.declaringTy
pe.get$jsname() + '.prototype, "' + property.get$jsname() + '", {')); |
| 8417 if (property.getter != null) { | 8611 if ($notnull_bool(property.getter != null)) { |
| 8418 this.writer.writeln(('get: ' + property.declaringType.get$jsname() + '.pro
totype.' + property.getter.get$jsname() + ',')); | 8612 this.writer.writeln(('get: ' + property.declaringType.get$jsname() + '.pro
totype.' + property.getter.get$jsname() + ',')); |
| 8419 } | 8613 } |
| 8420 if (property.setter != null) { | 8614 if ($notnull_bool(property.setter != null)) { |
| 8421 this.writer.writeln(('set: ' + property.declaringType.get$jsname() + '.pro
totype.' + property.setter.get$jsname() + '')); | 8615 this.writer.writeln(('set: ' + property.declaringType.get$jsname() + '.pro
totype.' + property.setter.get$jsname() + '')); |
| 8422 } | 8616 } |
| 8423 this.writer.exitBlock('});'); | 8617 this.writer.exitBlock('});'); |
| 8424 } | 8618 } |
| 8425 } | 8619 } |
| 8426 WorldGenerator.prototype._writeMethod = function(method) { | 8620 WorldGenerator.prototype._writeMethod = function(method) { |
| 8427 if (method.generator != null) { | 8621 if ($notnull_bool(method.generator != null)) { |
| 8428 method.generator.writeDefinition(this.writer, null); | 8622 method.generator.writeDefinition(this.writer, null); |
| 8429 } | 8623 } |
| 8430 } | 8624 } |
| 8431 WorldGenerator.prototype.get$_writeMethod = function() { | 8625 WorldGenerator.prototype.get$_writeMethod = function() { |
| 8432 return WorldGenerator.prototype._writeMethod.bind(this); | 8626 return WorldGenerator.prototype._writeMethod.bind(this); |
| 8433 } | 8627 } |
| 8434 WorldGenerator.prototype._writeGlobals = function() { | 8628 WorldGenerator.prototype._writeGlobals = function() { |
| 8629 var $0; |
| 8435 var list = this.globals.getValues(); | 8630 var list = this.globals.getValues(); |
| 8436 list.sort((function (a, b) { | 8631 list.sort((function (a, b) { |
| 8437 return a.compareTo(b); | 8632 return a.compareTo(b); |
| 8438 }) | 8633 }) |
| 8439 ); | 8634 ); |
| 8440 for (var $i = list.iterator(); $i.hasNext(); ) { | 8635 for (var $i = list.iterator(); $i.hasNext(); ) { |
| 8441 var global = $i.next(); | 8636 var global = $i.next(); |
| 8442 if (global.field != null) { | 8637 if ($notnull_bool(global.field != null)) { |
| 8443 this._writeStaticField(global.field); | 8638 this._writeStaticField(global.field); |
| 8444 } | 8639 } |
| 8445 else { | 8640 else { |
| 8446 this.writer.writeln(('var ' + global.get$name() + ' = ' + global.exp.code
+ ';')); | 8641 this.writer.writeln(('var ' + global.get$name() + ' = ' + global.exp.code
+ ';')); |
| 8447 } | 8642 } |
| 8448 } | 8643 } |
| 8449 } | 8644 } |
| 8450 WorldGenerator.prototype._orderValues = function(map0) { | 8645 WorldGenerator.prototype._orderValues = function(map0) { |
| 8451 var values = map0.getValues(); | 8646 var values = map0.getValues(); |
| 8452 values.sort(this.get$_compareMembers()); | 8647 values.sort(this.get$_compareMembers()); |
| 8453 return values; | 8648 return values; |
| 8454 } | 8649 } |
| 8455 WorldGenerator.prototype._compareMembers = function(x, y) { | 8650 WorldGenerator.prototype._compareMembers = function(x, y) { |
| 8456 if (x.get$span() != null && y.get$span() != null) { | 8651 if ($notnull_bool(x.get$span() != null && y.get$span() != null)) { |
| 8457 var spans = x.get$span().compareTo(y.get$span()); | 8652 var spans = x.get$span().compareTo(y.get$span()); |
| 8458 if (spans != 0) return spans; | 8653 if ($notnull_bool(spans != 0)) return spans; |
| 8459 } | 8654 } |
| 8460 if (x.get$span() == null) return 1; | 8655 if ($notnull_bool(x.get$span() == null)) return 1; |
| 8461 if (y.get$span() == null) return -1; | 8656 if ($notnull_bool(y.get$span() == null)) return -1; |
| 8462 return x.get$name().compareTo(y.get$name()); | 8657 return x.get$name().compareTo(y.get$name()); |
| 8463 } | 8658 } |
| 8464 WorldGenerator.prototype.get$_compareMembers = function() { | 8659 WorldGenerator.prototype.get$_compareMembers = function() { |
| 8465 return WorldGenerator.prototype._compareMembers.bind(this); | 8660 return WorldGenerator.prototype._compareMembers.bind(this); |
| 8466 } | 8661 } |
| 8467 WorldGenerator.prototype.useMapFactory = function() { | 8662 WorldGenerator.prototype.useMapFactory = function() { |
| 8663 var $0; |
| 8468 var factType = world.get$coreimpl().types.$index('HashMapImplementation'); | 8664 var factType = world.get$coreimpl().types.$index('HashMapImplementation'); |
| 8469 var m = factType.resolveMember('\$setindex'); | 8665 var m = factType.resolveMember('\$setindex'); |
| 8470 this.genMethod(m.members.$index(0)); | 8666 this.genMethod((($0 = m.members.$index(0)) && $0.is$Member())); |
| 8471 var c = factType.getConstructor(''); | 8667 var c = factType.getConstructor(''); |
| 8472 this.genMethod(c); | 8668 this.genMethod((c && c.is$Member())); |
| 8473 return factType; | 8669 return factType; |
| 8474 } | 8670 } |
| 8475 // ********** Code for BlockScope ************** | 8671 // ********** Code for BlockScope ************** |
| 8476 function BlockScope(enclosingMethod, parent, reentrant) { | 8672 function BlockScope(enclosingMethod, parent, reentrant) { |
| 8477 this.enclosingMethod = enclosingMethod; | 8673 this.enclosingMethod = enclosingMethod; |
| 8478 this.parent = parent; | 8674 this.parent = parent; |
| 8479 this.reentrant = reentrant; | 8675 this.reentrant = reentrant; |
| 8480 this._vars = $map([]); | 8676 this._vars = $map([]); |
| 8481 // Initializers done | 8677 // Initializers done |
| 8482 if (this.get$isMethodScope()) { | 8678 if ($notnull_bool(this.get$isMethodScope())) { |
| 8483 this._closedOver = new HashSetImplementation$String(); | 8679 this._closedOver = new HashSetImplementation$String(); |
| 8484 } | 8680 } |
| 8485 else { | 8681 else { |
| 8486 this.reentrant = this.reentrant || this.parent.reentrant; | 8682 this.reentrant = $assert_bool(this.reentrant || this.parent.reentrant); |
| 8487 } | 8683 } |
| 8488 } | 8684 } |
| 8489 BlockScope.prototype.get$parent = function() { return this.parent; }; | 8685 BlockScope.prototype.get$parent = function() { return this.parent; }; |
| 8490 BlockScope.prototype.set$parent = function(value) { return this.parent = value;
}; | 8686 BlockScope.prototype.set$parent = function(value) { return this.parent = value;
}; |
| 8491 BlockScope.prototype.get$isMethodScope = function() { | 8687 BlockScope.prototype.get$isMethodScope = function() { |
| 8492 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM
ethod); | 8688 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM
ethod); |
| 8493 } | 8689 } |
| 8494 BlockScope.prototype.get$methodScope = function() { | 8690 BlockScope.prototype.get$methodScope = function() { |
| 8495 var s = this; | 8691 var s = this; |
| 8496 while (!s.get$isMethodScope()) s = s.get$parent(); | 8692 while ($notnull_bool(!s.get$isMethodScope())) s = s.get$parent(); |
| 8497 return s; | 8693 return s; |
| 8498 } | 8694 } |
| 8499 BlockScope.prototype.lookup = function(name) { | 8695 BlockScope.prototype.lookup = function(name) { |
| 8500 var ret = this._vars.$index(name); | 8696 var ret = this._vars.$index(name); |
| 8501 if ($ne(ret, null)) return ret; | 8697 if ($notnull_bool($ne(ret, null))) return ret; |
| 8502 for (var s = this.parent; | 8698 for (var s = this.parent; |
| 8503 $ne(s, null); s = s.get$parent()) { | 8699 $notnull_bool($ne(s, null)); s = s.get$parent()) { |
| 8504 ret = s._vars.$index(name); | 8700 ret = s._vars.$index(name); |
| 8505 if ($ne(ret, null)) { | 8701 if ($notnull_bool($ne(ret, null))) { |
| 8506 if ($ne(s.enclosingMethod, this.enclosingMethod)) { | 8702 if ($notnull_bool($ne(s.enclosingMethod, this.enclosingMethod))) { |
| 8507 s.get$methodScope()._closedOver.add(ret.code); | 8703 s.get$methodScope()._closedOver.add(ret.code); |
| 8508 if (this.enclosingMethod.captures != null && s.reentrant) { | 8704 if ($notnull_bool(this.enclosingMethod.captures != null && s.reentrant))
{ |
| 8509 this.enclosingMethod.captures.add(ret.code); | 8705 this.enclosingMethod.captures.add(ret.code); |
| 8510 } | 8706 } |
| 8511 } | 8707 } |
| 8512 return ret; | 8708 return ret; |
| 8513 } | 8709 } |
| 8514 } | 8710 } |
| 8515 } | 8711 } |
| 8516 BlockScope.prototype._isDefinedInParent = function(name) { | 8712 BlockScope.prototype._isDefinedInParent = function(name) { |
| 8517 if (this.get$isMethodScope() && this._closedOver.contains(name)) return true; | 8713 if ($notnull_bool(this.get$isMethodScope() && this._closedOver.contains(name))
) return true; |
| 8518 for (var s = this.parent; | 8714 for (var s = this.parent; |
| 8519 $ne(s, null); s = s.get$parent()) { | 8715 $notnull_bool($ne(s, null)); s = s.get$parent()) { |
| 8520 if (s._vars.containsKey(name)) return true; | 8716 if ($notnull_bool(s._vars.containsKey(name))) return true; |
| 8521 if (s.get$isMethodScope() && s._closedOver.contains(name)) return true; | 8717 if ($notnull_bool(s.get$isMethodScope() && s._closedOver.contains(name))) re
turn true; |
| 8522 } | 8718 } |
| 8523 var type = this.enclosingMethod.method.declaringType; | 8719 var type = this.enclosingMethod.method.declaringType; |
| 8524 if (type.resolveMember(name) != null) return true; | 8720 if ($notnull_bool(type.resolveMember(name) != null)) return true; |
| 8525 if (type.get$library().lookup(name, null) != null) return true; | 8721 if ($notnull_bool(type.get$library().lookup(name, null) != null)) return true; |
| 8526 return false; | 8722 return false; |
| 8527 } | 8723 } |
| 8528 BlockScope.prototype.create = function(name, type, location) { | 8724 BlockScope.prototype.create = function(name, type, location) { |
| 8529 var jsName = world.toJsIdentifier(name); | 8725 var jsName = world.toJsIdentifier(name); |
| 8530 if (this._vars.containsKey(name)) { | 8726 if ($notnull_bool(this._vars.containsKey(name))) { |
| 8531 if (location != null) { | 8727 if ($notnull_bool(location != null)) { |
| 8532 world.error(('duplicate name "' + name + '"'), location.span); | 8728 world.error(('duplicate name "' + name + '"'), location.span); |
| 8533 } | 8729 } |
| 8534 else { | 8730 else { |
| 8535 world.internalError(('conflict with temporary name "' + name + '"')); | 8731 world.internalError(('conflict with temporary name "' + name + '"')); |
| 8536 } | 8732 } |
| 8537 } | 8733 } |
| 8538 var index = 0; | 8734 var index = 0; |
| 8539 while (this._isDefinedInParent(jsName)) { | 8735 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) { |
| 8540 jsName = ('' + name + '' + index++ + ''); | 8736 jsName = ('' + name + '' + index++ + ''); |
| 8541 } | 8737 } |
| 8542 var ret = new Value(type, jsName, false, false, false); | 8738 var ret = new Value(type, jsName, false, false, false); |
| 8543 this._vars.$setindex(name, ret); | 8739 this._vars.$setindex(name, ret); |
| 8544 return ret; | 8740 return ret; |
| 8545 } | 8741 } |
| 8546 BlockScope.prototype.declare = function(id) { | 8742 BlockScope.prototype.declare = function(id) { |
| 8547 var type = this.enclosingMethod.method.resolveType(id.type, false); | 8743 var type = this.enclosingMethod.method.resolveType(id.type, false); |
| 8548 return this.create(id.name.name, type, id); | 8744 return this.create(id.name.name, (type && type.is$lang_Type()), id); |
| 8549 } | 8745 } |
| 8550 BlockScope.prototype.getRethrow = function() { | 8746 BlockScope.prototype.getRethrow = function() { |
| 8551 var scope = this; | 8747 var scope = this; |
| 8552 while (scope.rethrow == null && $ne(scope.get$parent(), null)) { | 8748 while ($notnull_bool(scope.rethrow == null && $ne(scope.get$parent(), null)))
{ |
| 8553 scope = scope.get$parent(); | 8749 scope = scope.get$parent(); |
| 8554 } | 8750 } |
| 8555 return scope.rethrow; | 8751 return scope.rethrow; |
| 8556 } | 8752 } |
| 8557 // ********** Code for MethodGenerator ************** | 8753 // ********** Code for MethodGenerator ************** |
| 8558 function MethodGenerator(method, enclosingMethod) { | 8754 function MethodGenerator(method, enclosingMethod) { |
| 8755 var $0; |
| 8559 this.method = method; | 8756 this.method = method; |
| 8560 this.enclosingMethod = enclosingMethod; | 8757 this.enclosingMethod = enclosingMethod; |
| 8561 this.writer = new CodeWriter(); | 8758 this.writer = new CodeWriter(); |
| 8562 this.needsThis = false; | 8759 this.needsThis = false; |
| 8563 // Initializers done | 8760 // Initializers done |
| 8564 if (this.enclosingMethod != null) { | 8761 if ($notnull_bool(this.enclosingMethod != null)) { |
| 8565 this._scope = new BlockScope(this, this.enclosingMethod._scope, false); | 8762 this._scope = new BlockScope(this, this.enclosingMethod._scope, false); |
| 8566 this.captures = new HashSetImplementation(); | 8763 this.captures = new HashSetImplementation(); |
| 8567 } | 8764 } |
| 8568 else { | 8765 else { |
| 8569 this._scope = new BlockScope(this, null, false); | 8766 this._scope = new BlockScope(this, null, false); |
| 8570 } | 8767 } |
| 8571 if (this.enclosingMethod != null && this.method.name != '') { | 8768 if ($notnull_bool(this.enclosingMethod != null && this.method.name != '')) { |
| 8572 this._scope.create(this.method.name, this.method.get$functionType(), this.me
thod.get$definition()); | 8769 this._scope.create(this.method.name, this.method.get$functionType(), (($0 =
this.method.get$definition()) && $0.is$lang_Node())); |
| 8573 } | 8770 } |
| 8574 this._usedTemps = new HashSetImplementation(); | 8771 this._usedTemps = new HashSetImplementation(); |
| 8575 this._freeTemps = []; | 8772 this._freeTemps = []; |
| 8576 } | 8773 } |
| 8774 MethodGenerator.prototype.is$MethodGenerator = function(){return this;}; |
| 8577 MethodGenerator.prototype.findMembers = function(name) { | 8775 MethodGenerator.prototype.findMembers = function(name) { |
| 8578 return this.method.get$library()._findMembers(name); | 8776 return this.method.get$library()._findMembers(name); |
| 8579 } | 8777 } |
| 8580 MethodGenerator.prototype.get$isClosure = function() { | 8778 MethodGenerator.prototype.get$isClosure = function() { |
| 8581 return (this.enclosingMethod != null); | 8779 return (this.enclosingMethod != null); |
| 8582 } | 8780 } |
| 8583 MethodGenerator.prototype.getTemp = function(value) { | 8781 MethodGenerator.prototype.getTemp = function(value) { |
| 8584 return value.needsTemp ? this.forceTemp(value) : value; | 8782 return $notnull_bool(value.needsTemp) ? this.forceTemp(value) : value; |
| 8585 } | 8783 } |
| 8586 MethodGenerator.prototype.forceTemp = function(value) { | 8784 MethodGenerator.prototype.forceTemp = function(value) { |
| 8587 var name; | 8785 var name; |
| 8588 if (this._freeTemps.length > 0) { | 8786 if ($notnull_bool(this._freeTemps.length > 0)) { |
| 8589 name = this._freeTemps.removeLast(); | 8787 name = $assert_String(this._freeTemps.removeLast()); |
| 8590 } | 8788 } |
| 8591 else { | 8789 else { |
| 8592 name = '\$' + this._usedTemps.get$length(); | 8790 name = '\$' + this._usedTemps.get$length(); |
| 8593 } | 8791 } |
| 8594 this._usedTemps.add(name); | 8792 this._usedTemps.add(name); |
| 8595 return new Value(value.type, name, false, false, false); | 8793 return new Value(value.type, name, false, false, false); |
| 8596 } | 8794 } |
| 8597 MethodGenerator.prototype.assignTemp = function(tmp, v) { | 8795 MethodGenerator.prototype.assignTemp = function(tmp, v) { |
| 8598 if ($eq(tmp, v)) { | 8796 if ($notnull_bool($eq(tmp, v))) { |
| 8599 return v; | 8797 return v; |
| 8600 } | 8798 } |
| 8601 else { | 8799 else { |
| 8602 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), false, tru
e, false); | 8800 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), false, tru
e, false); |
| 8603 } | 8801 } |
| 8604 } | 8802 } |
| 8605 MethodGenerator.prototype.freeTemp = function(value) { | 8803 MethodGenerator.prototype.freeTemp = function(value) { |
| 8606 if (this._usedTemps.remove(value.code)) { | 8804 if ($notnull_bool(this._usedTemps.remove(value.code))) { |
| 8607 this._freeTemps.add(value.code); | 8805 this._freeTemps.add(value.code); |
| 8608 } | 8806 } |
| 8609 else { | 8807 else { |
| 8610 world.internalError(('tried to free unused value or non-temp "' + value.code
+ '"')); | 8808 world.internalError(('tried to free unused value or non-temp "' + value.code
+ '"')); |
| 8611 } | 8809 } |
| 8612 } | 8810 } |
| 8613 MethodGenerator.prototype.run = function() { | 8811 MethodGenerator.prototype.run = function() { |
| 8614 if (this.method.isGenerated) return; | 8812 if ($notnull_bool(this.method.isGenerated)) return; |
| 8615 this.method.isGenerated = true; | 8813 this.method.isGenerated = true; |
| 8616 this.method.generator = this; | 8814 this.method.generator = this; |
| 8617 if ((this.method.get$definition().body instanceof NativeStatement)) { | 8815 if ($notnull_bool((this.method.get$definition().body instanceof NativeStatemen
t))) { |
| 8618 if (this.method.get$definition().body.body == null) { | 8816 if ($notnull_bool(this.method.get$definition().body.body == null)) { |
| 8619 this.method.generator = null; | 8817 this.method.generator = null; |
| 8620 } | 8818 } |
| 8621 else { | 8819 else { |
| 8622 this._paramCode = map(this.method.get$parameters(), (function (p) { | 8820 this._paramCode = map(this.method.get$parameters(), (function (p) { |
| 8623 return p.get$name(); | 8821 return p.get$name(); |
| 8624 }) | 8822 }) |
| 8625 ); | 8823 ); |
| 8626 this.writer.write(this.method.get$definition().body.body); | 8824 this.writer.write($assert_String(this.method.get$definition().body.body)); |
| 8627 } | 8825 } |
| 8628 } | 8826 } |
| 8629 else { | 8827 else { |
| 8630 this.writeBody(); | 8828 this.writeBody(); |
| 8631 } | 8829 } |
| 8632 } | 8830 } |
| 8633 MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { | 8831 MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { |
| 8634 var paramCode = this._paramCode; | 8832 var paramCode = this._paramCode; |
| 8635 var names = null; | 8833 var names = null; |
| 8636 if (this.captures != null && this.captures.get$length() > 0) { | 8834 if ($notnull_bool(this.captures != null && this.captures.get$length() > 0)) { |
| 8637 names = ListFactory.ListFactory$from$factory(this.captures); | 8835 names = ListFactory.ListFactory$from$factory(this.captures); |
| 8638 names.sort((function (x, y) { | 8836 names.sort((function (x, y) { |
| 8639 return x.compareTo(y); | 8837 return x.compareTo(y); |
| 8640 }) | 8838 }) |
| 8641 ); | 8839 ); |
| 8642 paramCode = ListFactory.ListFactory$from$factory(names); | 8840 paramCode = ListFactory.ListFactory$from$factory((names && names.is$Iterable
())); |
| 8643 paramCode.addAll(this._paramCode); | 8841 paramCode.addAll(this._paramCode); |
| 8644 } | 8842 } |
| 8645 var _params = ('(' + Strings.join(this._paramCode, ", ") + ')'); | 8843 var _params = ('(' + Strings.join(this._paramCode, ", ") + ')'); |
| 8646 var params = ('(' + Strings.join(paramCode, ", ") + ')'); | 8844 var params = ('(' + Strings.join((paramCode && paramCode.is$List$String()), ",
") + ')'); |
| 8647 if (this.method.declaringType.get$isTop() && !this.get$isClosure()) { | 8845 if ($notnull_bool(this.method.declaringType.get$isTop() && !this.get$isClosure
())) { |
| 8648 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params +
' {')); | 8846 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params +
' {')); |
| 8649 } | 8847 } |
| 8650 else if (this.get$isClosure()) { | 8848 else if ($notnull_bool(this.get$isClosure())) { |
| 8651 if (this.method.name == '') { | 8849 if ($notnull_bool(this.method.name == '')) { |
| 8652 defWriter.enterBlock(('(function ' + params + ' {')); | 8850 defWriter.enterBlock(('(function ' + params + ' {')); |
| 8653 } | 8851 } |
| 8654 else if ($ne(names, null)) { | 8852 else if ($notnull_bool($ne(names, null))) { |
| 8655 if (lambda == null) { | 8853 if ($notnull_bool(lambda == null)) { |
| 8656 defWriter.enterBlock(('var ' + this.method.get$jsname() + ' = (function'
+ params + ' {')); | 8854 defWriter.enterBlock(('var ' + this.method.get$jsname() + ' = (function'
+ params + ' {')); |
| 8657 } | 8855 } |
| 8658 else { | 8856 else { |
| 8659 defWriter.enterBlock(('(function ' + this.method.get$jsname() + '' + par
ams + ' {')); | 8857 defWriter.enterBlock(('(function ' + this.method.get$jsname() + '' + par
ams + ' {')); |
| 8660 } | 8858 } |
| 8661 } | 8859 } |
| 8662 else { | 8860 else { |
| 8663 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params
+ ' {')); | 8861 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params
+ ' {')); |
| 8664 } | 8862 } |
| 8665 } | 8863 } |
| 8666 else if (this.method.get$isConstructor()) { | 8864 else if ($notnull_bool(this.method.get$isConstructor())) { |
| 8667 if (this.method.get$constructorName() == '') { | 8865 if ($notnull_bool(this.method.get$constructorName() == '')) { |
| 8668 defWriter.enterBlock(('function ' + this.method.declaringType.get$jsname()
+ '' + params + ' {')); | 8866 defWriter.enterBlock(('function ' + this.method.declaringType.get$jsname()
+ '' + params + ' {')); |
| 8669 } | 8867 } |
| 8670 else { | 8868 else { |
| 8671 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' +
this.method.get$constructorName() + '\$ctor = function' + params + ' {')); | 8869 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' +
this.method.get$constructorName() + '\$ctor = function' + params + ' {')); |
| 8672 } | 8870 } |
| 8673 } | 8871 } |
| 8674 else if (this.method.get$isFactory()) { | 8872 else if ($notnull_bool(this.method.get$isFactory())) { |
| 8675 defWriter.enterBlock(('' + this.method.get$generatedFactoryName() + ' = func
tion' + _params + ' {')); | 8873 defWriter.enterBlock(('' + this.method.get$generatedFactoryName() + ' = func
tion' + _params + ' {')); |
| 8676 } | 8874 } |
| 8677 else if (this.method.get$isStatic()) { | 8875 else if ($notnull_bool(this.method.get$isStatic())) { |
| 8678 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th
is.method.get$jsname() + ' = function' + _params + ' {')); | 8876 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th
is.method.get$jsname() + ' = function' + _params + ' {')); |
| 8679 } | 8877 } |
| 8680 else { | 8878 else { |
| 8681 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot
ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {')); | 8879 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot
ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {')); |
| 8682 } | 8880 } |
| 8683 if (this.needsThis) { | 8881 if ($notnull_bool(this.needsThis)) { |
| 8684 defWriter.writeln('var \$this = this; // closure support'); | 8882 defWriter.writeln('var \$this = this; // closure support'); |
| 8685 } | 8883 } |
| 8686 if (this._usedTemps.get$length() > 0 || this._freeTemps.length > 0) { | 8884 if ($notnull_bool(this._usedTemps.get$length() > 0 || this._freeTemps.length >
0)) { |
| 8885 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da
rt", 651, 14); |
| 8687 this._freeTemps.addAll(this._usedTemps); | 8886 this._freeTemps.addAll(this._usedTemps); |
| 8688 this._freeTemps.sort((function (x, y) { | 8887 this._freeTemps.sort((function (x, y) { |
| 8689 return x.compareTo(y); | 8888 return x.compareTo(y); |
| 8690 }) | 8889 }) |
| 8691 ); | 8890 ); |
| 8692 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); | 8891 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); |
| 8693 } | 8892 } |
| 8694 defWriter.writeln(this.writer.get$text()); | 8893 defWriter.writeln(this.writer.get$text()); |
| 8695 if ($ne(names, null)) { | 8894 if ($notnull_bool($ne(names, null))) { |
| 8696 defWriter.exitBlock(('}).bind(null, ' + Strings.join(names, ", ") + ')')); | 8895 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List
$String()), ", ") + ')')); |
| 8697 } | 8896 } |
| 8698 else if (this.get$isClosure() && this.method.name == '') { | 8897 else if ($notnull_bool(this.get$isClosure() && this.method.name == '')) { |
| 8699 defWriter.exitBlock('})'); | 8898 defWriter.exitBlock('})'); |
| 8700 } | 8899 } |
| 8701 else { | 8900 else { |
| 8702 defWriter.exitBlock('}'); | 8901 defWriter.exitBlock('}'); |
| 8703 } | 8902 } |
| 8704 if (this.method.get$isConstructor() && this.method.get$constructorName() != ''
) { | 8903 if ($notnull_bool(this.method.get$isConstructor() && this.method.get$construct
orName() != '')) { |
| 8705 defWriter.writeln(('' + this.method.declaringType.get$jsname() + '.' + this.
method.get$constructorName() + '\$ctor.prototype = ') + ('' + this.method.declar
ingType.get$jsname() + '.prototype;')); | 8904 defWriter.writeln(('' + this.method.declaringType.get$jsname() + '.' + this.
method.get$constructorName() + '\$ctor.prototype = ') + ('' + this.method.declar
ingType.get$jsname() + '.prototype;')); |
| 8706 } | 8905 } |
| 8707 this._provideOptionalParamInfo(defWriter); | 8906 this._provideOptionalParamInfo(defWriter); |
| 8708 if ((this.method instanceof MethodMember) && this.method._providePropertySynta
x) { | 8907 if ($notnull_bool((this.method instanceof MethodMember) && this.method._provid
ePropertySyntax)) { |
| 8709 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot
ype.get\$' + this.method.get$jsname() + ' = function() {')); | 8908 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot
ype.get\$' + this.method.get$jsname() + ' = function() {')); |
| 8710 defWriter.writeln(('return ' + this.method.declaringType.get$jsname() + '.pr
ototype.' + this.method.get$jsname() + '.bind(this);')); | 8909 defWriter.writeln(('return ' + this.method.declaringType.get$jsname() + '.pr
ototype.' + this.method.get$jsname() + '.bind(this);')); |
| 8711 defWriter.exitBlock('}'); | 8910 defWriter.exitBlock('}'); |
| 8712 if (this.method._provideFieldSyntax) { | 8911 if ($notnull_bool(this.method._provideFieldSyntax)) { |
| 8713 world.internalError('bound method accessed with field syntax'); | 8912 world.internalError('bound method accessed with field syntax'); |
| 8714 } | 8913 } |
| 8715 } | 8914 } |
| 8716 } | 8915 } |
| 8717 MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) { | 8916 MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) { |
| 8718 if ((this.method instanceof MethodMember) && this.method._provideOptionalParam
Info) { | 8917 if ($notnull_bool((this.method instanceof MethodMember) && this.method._provid
eOptionalParamInfo)) { |
| 8719 var optNames = []; | 8918 var optNames = []; |
| 8720 var optValues = []; | 8919 var optValues = []; |
| 8721 this.method.genParameterValues(); | 8920 this.method.genParameterValues(); |
| 8722 var $list = this.method.get$parameters(); | 8921 var $list = this.method.get$parameters(); |
| 8723 for (var $i = 0;$i < $list.length; $i++) { | 8922 for (var $i = 0;$i < $list.length; $i++) { |
| 8724 var param = $list.$index($i); | 8923 var param = $list.$index($i); |
| 8725 if (param.get$isOptional()) { | 8924 if ($notnull_bool(param.get$isOptional())) { |
| 8726 optNames.add(param.get$name()); | 8925 optNames.add(param.get$name()); |
| 8727 optValues.add(MethodGenerator._escapeString(param.get$value().code)); | 8926 optValues.add(MethodGenerator._escapeString(param.get$value().code)); |
| 8728 } | 8927 } |
| 8729 } | 8928 } |
| 8730 if (optNames.length > 0) { | 8929 if ($notnull_bool(optNames.length > 0)) { |
| 8731 var start = ''; | 8930 var start = ''; |
| 8732 if (this.method.get$isStatic()) { | 8931 if ($notnull_bool(this.method.get$isStatic())) { |
| 8733 if (!this.method.declaringType.get$isTop()) { | 8932 if ($notnull_bool(!this.method.declaringType.get$isTop())) { |
| 8734 start = this.method.declaringType.get$jsname() + '.'; | 8933 start = this.method.declaringType.get$jsname() + '.'; |
| 8735 } | 8934 } |
| 8736 } | 8935 } |
| 8737 else { | 8936 else { |
| 8738 start = this.method.declaringType.get$jsname() + '.prototype.'; | 8937 start = this.method.declaringType.get$jsname() + '.prototype.'; |
| 8739 } | 8938 } |
| 8740 optNames.addAll(optValues); | 8939 optNames.addAll(optValues); |
| 8741 var optional = "['" + Strings.join(optNames, "', '") + "']"; | 8940 var optional = "['" + Strings.join((optNames && optNames.is$List$String())
, "', '") + "']"; |
| 8742 defWriter.writeln(('' + start + '' + this.method.get$jsname() + '.\$option
al = ' + optional + '')); | 8941 defWriter.writeln(('' + start + '' + this.method.get$jsname() + '.\$option
al = ' + optional + '')); |
| 8743 } | 8942 } |
| 8744 } | 8943 } |
| 8745 } | 8944 } |
| 8746 MethodGenerator.prototype.writeBody = function() { | 8945 MethodGenerator.prototype.writeBody = function() { |
| 8946 var $0; |
| 8747 var initializers = null; | 8947 var initializers = null; |
| 8748 var initializedFields = null; | 8948 var initializedFields = null; |
| 8749 if (this.method.get$isConstructor()) { | 8949 if ($notnull_bool(this.method.get$isConstructor())) { |
| 8750 initializers = []; | 8950 initializers = []; |
| 8751 initializedFields = new HashSetImplementation(); | 8951 initializedFields = new HashSetImplementation(); |
| 8752 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers()
); | 8952 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers()
); |
| 8753 for (var $i = 0;$i < $list.length; $i++) { | 8953 for (var $i = 0;$i < $list.length; $i++) { |
| 8754 var f = $list.$index($i); | 8954 var f = $list.$index($i); |
| 8755 if ((f instanceof FieldMember) && !f.get$isStatic()) { | 8955 if ($notnull_bool((f instanceof FieldMember) && !f.get$isStatic())) { |
| 8756 var cv = f.computeValue(); | 8956 var cv = f.computeValue(); |
| 8757 if ($ne(cv, null)) { | 8957 if ($notnull_bool($ne(cv, null))) { |
| 8758 initializers.add(('this.' + f.get$jsname() + ' = ' + cv.code + '')); | 8958 initializers.add(('this.' + f.get$jsname() + ' = ' + cv.code + '')); |
| 8759 initializedFields.add(f.get$name()); | 8959 initializedFields.add(f.get$name()); |
| 8760 } | 8960 } |
| 8761 } | 8961 } |
| 8762 } | 8962 } |
| 8763 } | 8963 } |
| 8764 this._paramCode = []; | 8964 this._paramCode = []; |
| 8765 var $list = this.method.get$parameters(); | 8965 var $list = this.method.get$parameters(); |
| 8766 for (var $i = 0;$i < $list.length; $i++) { | 8966 for (var $i = 0;$i < $list.length; $i++) { |
| 8767 var p = $list.$index($i); | 8967 var p = $list.$index($i); |
| 8768 if ($ne(initializers, null) && p.get$name().startsWith('this.')) { | 8968 if ($notnull_bool($ne(initializers, null) && p.get$name().startsWith('this.'
))) { |
| 8769 var name = p.get$name().substring(5); | 8969 var name = p.get$name().substring(5); |
| 8770 var field = this.method.declaringType.getMember(name); | 8970 var field = this.method.declaringType.getMember(name); |
| 8771 if (field == null) { | 8971 if ($notnull_bool(field == null)) { |
| 8772 world.error('bad this parameter - no matching field', p.get$definition()
.get$span()); | 8972 world.error('bad this parameter - no matching field', p.get$definition()
.get$span()); |
| 8773 } | 8973 } |
| 8774 if (!field.get$isField()) { | 8974 if ($notnull_bool(!field.get$isField())) { |
| 8775 world.error(('"' + p.get$name() + '" does not refer to a field'), p.get$
definition().get$span()); | 8975 world.error(('"' + p.get$name() + '" does not refer to a field'), p.get$
definition().get$span()); |
| 8776 } | 8976 } |
| 8777 var paramValue = new Value(field.get$returnType(), name, false, false, fal
se); | 8977 var paramValue = new Value(field.get$returnType(), name, false, false, fal
se); |
| 8778 this._paramCode.add(paramValue.code); | 8978 this._paramCode.add(paramValue.code); |
| 8779 initializers.add(('this.' + field.get$jsname() + ' = ' + paramValue.code +
';')); | 8979 initializers.add(('this.' + field.get$jsname() + ' = ' + paramValue.code +
';')); |
| 8780 initializedFields.add(name); | 8980 initializedFields.add(name); |
| 8781 } | 8981 } |
| 8782 else { | 8982 else { |
| 8783 var paramValue = this._scope.create(p.get$name(), p.type, p.get$definition
()); | 8983 var paramValue = this._scope.create($assert_String(p.get$name()), (($0 = p
.type) && $0.is$lang_Type()), (($0 = p.get$definition()) && $0.is$lang_Node())); |
| 8784 this._paramCode.add(paramValue.code); | 8984 this._paramCode.add(paramValue.code); |
| 8785 } | 8985 } |
| 8786 } | 8986 } |
| 8787 var body = this.method.get$definition().body; | 8987 var body = this.method.get$definition().body; |
| 8788 if (body == null && !this.method.get$isConstructor()) { | 8988 if ($notnull_bool(body == null && !this.method.get$isConstructor())) { |
| 8789 world.error(('unexpected empty body for ' + this.method.name + ''), this.met
hod.get$definition().get$span()); | 8989 world.error(('unexpected empty body for ' + this.method.name + ''), this.met
hod.get$definition().get$span()); |
| 8790 } | 8990 } |
| 8791 if ($ne(initializers, null)) { | 8991 if ($notnull_bool($ne(initializers, null))) { |
| 8792 for (var $i = initializers.iterator(); $i.hasNext(); ) { | 8992 for (var $i = initializers.iterator(); $i.hasNext(); ) { |
| 8793 var i = $i.next(); | 8993 var i = $i.next(); |
| 8794 this.writer.writeln(i); | 8994 this.writer.writeln($assert_String(i)); |
| 8795 } | 8995 } |
| 8796 var declaredInitializers = this.method.get$definition().initializers; | 8996 var declaredInitializers = this.method.get$definition().initializers; |
| 8797 if (declaredInitializers != null) { | 8997 if ($notnull_bool(declaredInitializers != null)) { |
| 8798 var initializerCall = null; | 8998 var initializerCall = null; |
| 8799 for (var $i = 0;$i < declaredInitializers.length; $i++) { | 8999 for (var $i = 0;$i < declaredInitializers.length; $i++) { |
| 8800 var init = declaredInitializers.$index($i); | 9000 var init = declaredInitializers.$index($i); |
| 8801 if ((init instanceof CallExpression)) { | 9001 if ($notnull_bool((init instanceof CallExpression))) { |
| 8802 if ($ne(initializerCall, null)) { | 9002 if ($notnull_bool($ne(initializerCall, null))) { |
| 8803 world.error('only one initializer redirecting call is allowed', init
.get$span()); | 9003 world.error('only one initializer redirecting call is allowed', init
.get$span()); |
| 8804 } | 9004 } |
| 8805 initializerCall = init; | 9005 initializerCall = init; |
| 8806 } | 9006 } |
| 8807 else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign(
init.op.kind) == 0) { | 9007 else if ($notnull_bool((init instanceof BinaryExpression) && TokenKind.k
indFromAssign(init.op.kind) == 0)) { |
| 8808 var left = init.x; | 9008 var left = init.x; |
| 8809 if (!((left instanceof DotExpression) && (left.self instanceof ThisExp
ression) || (left instanceof VarExpression))) { | 9009 if ($notnull_bool(!((left instanceof DotExpression) && (left.self inst
anceof ThisExpression) || (left instanceof VarExpression)))) { |
| 8810 world.error('invalid left side of initializer', left.get$span()); | 9010 world.error('invalid left side of initializer', left.get$span()); |
| 8811 continue; | 9011 continue; |
| 8812 } | 9012 } |
| 8813 initializedFields.add(left.get$name().get$name()); | 9013 initializedFields.add(left.get$name().get$name()); |
| 8814 var assign = this._makeThisValue(null).set_$4(this, left.get$name().ge
t$name(), left.get$name(), this.visitValue(init.y)); | 9014 var assign = this._makeThisValue(null).set_$4(this, left.get$name().ge
t$name(), left.get$name(), this.visitValue(init.y)); |
| 8815 this.writer.writeln(('' + assign.code + ';')); | 9015 this.writer.writeln(('' + assign.code + ';')); |
| 8816 } | 9016 } |
| 8817 else { | 9017 else { |
| 8818 world.error('invalid initializer', init.get$span()); | 9018 world.error('invalid initializer', init.get$span()); |
| 8819 } | 9019 } |
| 8820 } | 9020 } |
| 8821 if ($ne(initializerCall, null)) { | 9021 if ($notnull_bool($ne(initializerCall, null))) { |
| 8822 var target = this._writeInitializerCall(initializerCall); | 9022 var target = this._writeInitializerCall((initializerCall && initializerC
all.is$CallExpression())); |
| 8823 if (!target.isSuper) { | 9023 if ($notnull_bool(!target.isSuper)) { |
| 8824 if (initializers.length > 0) { | 9024 if ($notnull_bool(initializers.length > 0)) { |
| 8825 var $list = this.method.get$parameters(); | 9025 var $list = this.method.get$parameters(); |
| 8826 for (var $i = 0;$i < $list.length; $i++) { | 9026 for (var $i = 0;$i < $list.length; $i++) { |
| 8827 var p = $list.$index($i); | 9027 var p = $list.$index($i); |
| 8828 if (p.get$name().startsWith('this.')) { | 9028 if ($notnull_bool(p.get$name().startsWith('this.'))) { |
| 8829 world.error('no initialization allowed on redirecting constructo
rs', p.get$definition().get$span()); | 9029 world.error('no initialization allowed on redirecting constructo
rs', p.get$definition().get$span()); |
| 8830 break; | 9030 break; |
| 8831 } | 9031 } |
| 8832 } | 9032 } |
| 8833 } | 9033 } |
| 8834 if (declaredInitializers.length > 1) { | 9034 if ($notnull_bool(declaredInitializers.length > 1)) { |
| 8835 var init = $eq(declaredInitializers.$index(0), initializerCall) ? de
claredInitializers.$index(1) : declaredInitializers.$index(0); | 9035 var init = $notnull_bool($eq(declaredInitializers.$index(0), initial
izerCall)) ? declaredInitializers.$index(1) : declaredInitializers.$index(0); |
| 8836 world.error('no initialization allowed on redirecting constructors',
init.get$span()); | 9036 world.error('no initialization allowed on redirecting constructors',
init.get$span()); |
| 8837 } | 9037 } |
| 8838 initializedFields = null; | 9038 initializedFields = null; |
| 8839 } | 9039 } |
| 8840 } | 9040 } |
| 8841 else { | 9041 else { |
| 8842 } | 9042 } |
| 8843 } | 9043 } |
| 8844 this.writer.comment('// Initializers done'); | 9044 this.writer.comment('// Initializers done'); |
| 8845 } | 9045 } |
| 8846 if ($ne(initializedFields, null)) { | 9046 if ($notnull_bool($ne(initializedFields, null))) { |
| 8847 var $list = this.method.declaringType.members.getKeys(); | 9047 var $list = this.method.declaringType.members.getKeys(); |
| 8848 for (var $i = this.method.declaringType.members.getKeys().iterator(); $i.has
Next(); ) { | 9048 for (var $i = this.method.declaringType.members.getKeys().iterator(); $i.has
Next(); ) { |
| 8849 var name = $i.next(); | 9049 var name = $i.next(); |
| 8850 var member = this.method.declaringType.members.$index(name); | 9050 var member = this.method.declaringType.members.$index(name); |
| 8851 if ((member instanceof FieldMember) && member.isFinal && !member.get$isSta
tic() && !initializedFields.contains(name)) { | 9051 if ($notnull_bool((member instanceof FieldMember) && member.isFinal && !me
mber.get$isStatic() && !initializedFields.contains(name))) { |
| 8852 world.error(('Field "' + name + '" is final and was not initialized'), t
his.method.get$definition().get$span()); | 9052 world.error(('Field "' + name + '" is final and was not initialized'), t
his.method.get$definition().get$span()); |
| 8853 } | 9053 } |
| 8854 } | 9054 } |
| 8855 } | 9055 } |
| 8856 this.visitStatementsInBlock(body); | 9056 this.visitStatementsInBlock((body && body.is$lang_Statement())); |
| 8857 } | 9057 } |
| 8858 MethodGenerator.prototype._writeInitializerCall = function(node) { | 9058 MethodGenerator.prototype._writeInitializerCall = function(node) { |
| 8859 var contructorName = ''; | 9059 var contructorName = ''; |
| 8860 var targetExp = node.target; | 9060 var targetExp = node.target; |
| 8861 if ((targetExp instanceof DotExpression)) { | 9061 if ($notnull_bool((targetExp instanceof DotExpression))) { |
| 8862 var dot = targetExp; | 9062 var dot = targetExp; |
| 8863 targetExp = dot.self; | 9063 targetExp = dot.self; |
| 8864 contructorName = dot.name.name; | 9064 contructorName = dot.name.name; |
| 8865 } | 9065 } |
| 8866 var target = null; | 9066 var target = null; |
| 8867 if ((targetExp instanceof SuperExpression)) { | 9067 if ($notnull_bool((targetExp instanceof SuperExpression))) { |
| 8868 target = this._makeSuperValue(targetExp); | 9068 target = this._makeSuperValue((targetExp && targetExp.is$lang_Node())); |
| 8869 } | 9069 } |
| 8870 else if ((targetExp instanceof ThisExpression)) { | 9070 else if ($notnull_bool((targetExp instanceof ThisExpression))) { |
| 8871 target = this._makeThisValue(targetExp); | 9071 target = this._makeThisValue((targetExp && targetExp.is$lang_Node())); |
| 8872 } | 9072 } |
| 8873 else { | 9073 else { |
| 8874 world.error('bad call in initializers', node.span); | 9074 world.error('bad call in initializers', node.span); |
| 8875 } | 9075 } |
| 8876 var m = target.type.getConstructor(contructorName); | 9076 var m = target.type.getConstructor(contructorName); |
| 8877 this.method.set$initDelegate(m); | 9077 this.method.set$initDelegate(m); |
| 8878 var other = m; | 9078 var other = m; |
| 8879 while ($ne(other, null)) { | 9079 while ($notnull_bool($ne(other, null))) { |
| 8880 if ($eq(other, this.method)) { | 9080 if ($notnull_bool($eq(other, this.method))) { |
| 8881 world.error('initialization cycle', node.span); | 9081 world.error('initialization cycle', node.span); |
| 8882 break; | 9082 break; |
| 8883 } | 9083 } |
| 8884 other = other.get$initDelegate(); | 9084 other = other.get$initDelegate(); |
| 8885 } | 9085 } |
| 8886 world.gen.genMethod(m); | 9086 world.gen.genMethod((m && m.is$Member())); |
| 8887 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments)); | 9087 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments)); |
| 8888 if ($ne(target.type, world.objectType)) { | 9088 if ($notnull_bool($ne(target.type, world.objectType))) { |
| 8889 this.writer.writeln(('' + value.code + ';')); | 9089 this.writer.writeln(('' + value.code + ';')); |
| 8890 } | 9090 } |
| 8891 return target; | 9091 return target; |
| 8892 } | 9092 } |
| 8893 MethodGenerator.prototype._makeArgs = function(arguments) { | 9093 MethodGenerator.prototype._makeArgs = function(arguments) { |
| 9094 var $0; |
| 8894 var args = []; | 9095 var args = []; |
| 8895 var seenLabel = false; | 9096 var seenLabel = false; |
| 8896 for (var $i = 0;$i < arguments.length; $i++) { | 9097 for (var $i = 0;$i < arguments.length; $i++) { |
| 8897 var arg = arguments.$index($i); | 9098 var arg = arguments.$index($i); |
| 8898 if (arg.label != null) { | 9099 if ($notnull_bool(arg.label != null)) { |
| 8899 seenLabel = true; | 9100 seenLabel = true; |
| 8900 } | 9101 } |
| 8901 else if (seenLabel) { | 9102 else if ($notnull_bool(seenLabel)) { |
| 8902 world.error('bare argument can not follow named arguments', arg.get$span()
); | 9103 world.error('bare argument can not follow named arguments', arg.get$span()
); |
| 8903 } | 9104 } |
| 8904 args.add(this.visitValue(arg.get$value())); | 9105 args.add(this.visitValue((($0 = arg.get$value()) && $0.is$lang_Expression())
)); |
| 8905 } | 9106 } |
| 8906 return new Arguments(arguments, args); | 9107 return new Arguments(arguments, args); |
| 8907 } | 9108 } |
| 8908 MethodGenerator._escapeString = function(text) { | 9109 MethodGenerator._escapeString = function(text) { |
| 8909 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', '
\\n').replaceAll('\r', '\\r'); | 9110 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', '
\\n').replaceAll('\r', '\\r'); |
| 8910 } | 9111 } |
| 8911 MethodGenerator.prototype.visitStatementsInBlock = function(body) { | 9112 MethodGenerator.prototype.visitStatementsInBlock = function(body) { |
| 8912 if ((body instanceof BlockStatement)) { | 9113 var $0; |
| 9114 if ($notnull_bool((body instanceof BlockStatement))) { |
| 8913 var $list = body.body; | 9115 var $list = body.body; |
| 8914 for (var $i = body.body.iterator(); $i.hasNext(); ) { | 9116 for (var $i = body.body.iterator(); $i.hasNext(); ) { |
| 8915 var stmt = $i.next(); | 9117 var stmt = $i.next(); |
| 8916 stmt.visit(this); | 9118 stmt.visit(this); |
| 8917 } | 9119 } |
| 8918 } | 9120 } |
| 8919 else { | 9121 else { |
| 8920 if (body != null) body.visit(this); | 9122 if ($notnull_bool(body != null)) body.visit(this); |
| 8921 } | 9123 } |
| 8922 return false; | 9124 return false; |
| 8923 } | 9125 } |
| 8924 MethodGenerator.prototype._pushBlock = function(reentrant) { | 9126 MethodGenerator.prototype._pushBlock = function(reentrant) { |
| 8925 this._scope = new BlockScope(this, this._scope, reentrant); | 9127 this._scope = new BlockScope(this, this._scope, reentrant); |
| 8926 } | 9128 } |
| 8927 MethodGenerator.prototype._popBlock = function() { | 9129 MethodGenerator.prototype._popBlock = function() { |
| 8928 this._scope = this._scope.parent; | 9130 this._scope = this._scope.parent; |
| 8929 } | 9131 } |
| 8930 MethodGenerator.prototype._makeLambdaMethod = function(name, func) { | 9132 MethodGenerator.prototype._makeLambdaMethod = function(name, func) { |
| 8931 var meth = new MethodMember(name, this.method.declaringType, func); | 9133 var meth = new MethodMember(name, this.method.declaringType, func); |
| 8932 meth.isLambda = true; | 9134 meth.isLambda = true; |
| 8933 meth.resolve(this.method.declaringType); | 9135 meth.resolve(this.method.declaringType); |
| 8934 world.gen.genMethod(meth, this); | 9136 world.gen.genMethod((meth && meth.is$Member()), this); |
| 8935 return meth; | 9137 return meth; |
| 8936 } | 9138 } |
| 8937 MethodGenerator.prototype.visitBool = function(node) { | 9139 MethodGenerator.prototype.visitBool = function(node) { |
| 8938 return this.visitTypedValue(node, world.boolType); | 9140 return this.visitValue(node).convertToNonNullBool(this, node); |
| 8939 } | 9141 } |
| 8940 MethodGenerator.prototype.visitValue = function(node) { | 9142 MethodGenerator.prototype.visitValue = function(node) { |
| 8941 if (node == null) return null; | 9143 if ($notnull_bool(node == null)) return null; |
| 8942 var value = node.visit(this); | 9144 var value = node.visit(this); |
| 8943 value.checkFirstClass(node.span); | 9145 value.checkFirstClass(node.span); |
| 8944 return value; | 9146 return value; |
| 8945 } | 9147 } |
| 8946 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) { | 9148 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) { |
| 8947 return this.visitValue(node).convertTo(this, expectedType, node, false); | 9149 return this.visitValue(node).convertTo(this, expectedType, node, false); |
| 8948 } | 9150 } |
| 8949 MethodGenerator.prototype.visitVoid = function(node) { | 9151 MethodGenerator.prototype.visitVoid = function(node) { |
| 8950 if ((node instanceof PostfixExpression)) { | 9152 if ($notnull_bool((node instanceof PostfixExpression))) { |
| 8951 var value = this.visitPostfixExpression(node, true); | 9153 var value = this.visitPostfixExpression((node && node.is$PostfixExpression()
), true); |
| 8952 value.checkFirstClass(node.span); | 9154 value.checkFirstClass(node.span); |
| 8953 return value; | 9155 return value; |
| 8954 } | 9156 } |
| 8955 return this.visitValue(node); | 9157 return this.visitValue(node); |
| 8956 } | 9158 } |
| 8957 MethodGenerator.prototype.visitDietStatement = function(node) { | 9159 MethodGenerator.prototype.visitDietStatement = function(node) { |
| 9160 var $0; |
| 8958 var parser = new lang_Parser(node.span.file, false, node.span.start); | 9161 var parser = new lang_Parser(node.span.file, false, node.span.start); |
| 8959 this.visitStatementsInBlock(parser.block()); | 9162 this.visitStatementsInBlock((($0 = parser.block()) && $0.is$lang_Statement()))
; |
| 8960 return false; | 9163 return false; |
| 8961 } | 9164 } |
| 8962 MethodGenerator.prototype.visitVariableDefinition = function(node) { | 9165 MethodGenerator.prototype.visitVariableDefinition = function(node) { |
| 9166 var $0; |
| 8963 var isFinal = false; | 9167 var isFinal = false; |
| 8964 if (node.modifiers != null && node.modifiers.$index(0).kind == 96/*TokenKind.F
INAL*/) { | 9168 if ($notnull_bool(node.modifiers != null && node.modifiers.$index(0).kind == 9
7/*TokenKind.FINAL*/)) { |
| 8965 isFinal = true; | 9169 isFinal = true; |
| 8966 } | 9170 } |
| 8967 this.writer.write('var '); | 9171 this.writer.write('var '); |
| 8968 var type = this.method.resolveType(node.type, false); | 9172 var type = this.method.resolveType(node.type, false); |
| 8969 for (var i = 0; | 9173 for (var i = 0; |
| 8970 i < node.names.length; i++) { | 9174 $notnull_bool(i < node.names.length); i++) { |
| 8971 var thisType = type; | 9175 var thisType = type; |
| 8972 if (i > 0) { | 9176 if ($notnull_bool(i > 0)) { |
| 8973 this.writer.write(', '); | 9177 this.writer.write(', '); |
| 8974 } | 9178 } |
| 8975 var name = node.names.$index(i).get$name(); | 9179 var name = node.names.$index(i).get$name(); |
| 8976 var value = this.visitValue(node.values.$index(i)); | 9180 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr
ession())); |
| 8977 if (isFinal) { | 9181 if ($notnull_bool(isFinal)) { |
| 8978 if (value == null) { | 9182 if ($notnull_bool(value == null)) { |
| 8979 world.error('no value specified for final variable', node.span); | 9183 world.error('no value specified for final variable', node.span); |
| 8980 } | 9184 } |
| 8981 else { | 9185 else { |
| 8982 if (thisType.get$isVar()) thisType = value.type; | 9186 if ($notnull_bool(thisType.get$isVar())) thisType = value.type; |
| 8983 } | 9187 } |
| 8984 } | 9188 } |
| 8985 var val = this._scope.create(name, thisType, node.names.$index(i)); | 9189 var val = this._scope.create($assert_String(name), (thisType && thisType.is$
lang_Type()), (($0 = node.names.$index(i)) && $0.is$lang_Node())); |
| 8986 if (value == null) { | 9190 if ($notnull_bool(value == null)) { |
| 8987 this.writer.write(('' + val.code + '')); | 9191 this.writer.write(('' + val.code + '')); |
| 8988 } | 9192 } |
| 8989 else { | 9193 else { |
| 8990 this.writer.write(('' + val.code + ' = ' + value.code + '')); | 9194 this.writer.write(('' + val.code + ' = ' + value.code + '')); |
| 8991 } | 9195 } |
| 8992 } | 9196 } |
| 8993 this.writer.writeln(';'); | 9197 this.writer.writeln(';'); |
| 8994 return false; | 9198 return false; |
| 8995 } | 9199 } |
| 8996 MethodGenerator.prototype.visitFunctionDefinition = function(node) { | 9200 MethodGenerator.prototype.visitFunctionDefinition = function(node) { |
| 9201 var $0; |
| 8997 var name = world.toJsIdentifier(node.name.name); | 9202 var name = world.toJsIdentifier(node.name.name); |
| 8998 var meth = this._makeLambdaMethod(name, node); | 9203 var meth = this._makeLambdaMethod($assert_String(name), node); |
| 8999 var funcValue = this._scope.create(name, meth.get$functionType(), this.method.
get$definition()); | 9204 var funcValue = this._scope.create($assert_String(name), meth.get$functionType
(), (($0 = this.method.get$definition()) && $0.is$lang_Node())); |
| 9000 meth.generator.writeDefinition(this.writer, null); | 9205 meth.generator.writeDefinition(this.writer, null); |
| 9001 return false; | 9206 return false; |
| 9002 } | 9207 } |
| 9003 MethodGenerator.prototype.visitReturnStatement = function(node) { | 9208 MethodGenerator.prototype.visitReturnStatement = function(node) { |
| 9004 if (node.value == null) { | 9209 if ($notnull_bool(node.value == null)) { |
| 9005 this.writer.writeln('return;'); | 9210 this.writer.writeln('return;'); |
| 9006 } | 9211 } |
| 9007 else { | 9212 else { |
| 9008 if (this.method.get$isConstructor()) { | 9213 if ($notnull_bool(this.method.get$isConstructor())) { |
| 9009 world.error('return of value not allowed from constructor', node.span); | 9214 world.error('return of value not allowed from constructor', node.span); |
| 9010 } | 9215 } |
| 9011 this.writer.writeln(('return ' + this.visitValue(node.value).code + ';')); | 9216 this.writer.writeln(('return ' + this.visitValue(node.value).code + ';')); |
| 9012 } | 9217 } |
| 9013 return true; | 9218 return true; |
| 9014 } | 9219 } |
| 9015 MethodGenerator.prototype.visitThrowStatement = function(node) { | 9220 MethodGenerator.prototype.visitThrowStatement = function(node) { |
| 9016 if (node.value != null) { | 9221 if ($notnull_bool(node.value != null)) { |
| 9017 var value = this.visitValue(node.value); | 9222 var value = this.visitValue(node.value); |
| 9018 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY()); | 9223 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY()); |
| 9019 this.writer.writeln(('\$throw(' + value.code + ');')); | 9224 this.writer.writeln(('\$throw(' + value.code + ');')); |
| 9020 } | 9225 } |
| 9021 else { | 9226 else { |
| 9022 var rethrow = this._scope.getRethrow(); | 9227 var rethrow = this._scope.getRethrow(); |
| 9023 if (rethrow == null) { | 9228 if ($notnull_bool(rethrow == null)) { |
| 9024 world.error('rethrow outside of catch', node.span); | 9229 world.error('rethrow outside of catch', node.span); |
| 9025 } | 9230 } |
| 9026 else { | 9231 else { |
| 9027 this.writer.writeln(('throw ' + rethrow.code + ';')); | 9232 this.writer.writeln(('throw ' + rethrow.code + ';')); |
| 9028 } | 9233 } |
| 9029 } | 9234 } |
| 9030 return true; | 9235 return true; |
| 9031 } | 9236 } |
| 9032 MethodGenerator.prototype.visitAssertStatement = function(node) { | 9237 MethodGenerator.prototype.visitAssertStatement = function(node) { |
| 9238 var $0; |
| 9033 var test = this.visitValue(node.test); | 9239 var test = this.visitValue(node.test); |
| 9034 if (options.enableAsserts) { | 9240 if ($notnull_bool(options.enableAsserts)) { |
| 9035 var err = world.corelib.types.$index('AssertError'); | 9241 var err = world.corelib.types.$index('AssertError'); |
| 9036 world.gen.genMethod(err.getConstructor('')); | 9242 world.gen.genMethod((($0 = err.getConstructor('')) && $0.is$Member())); |
| 9037 world.gen.genMethod(err.members.$index('toString')); | 9243 world.gen.genMethod((($0 = err.members.$index('toString')) && $0.is$Member()
)); |
| 9038 var span = node.test.span; | 9244 var span = node.test.span; |
| 9039 var line = span.file.getLine(span.start); | 9245 var line = span.file.getLine(span.start); |
| 9040 var column = span.file.getColumn(line, span.start); | 9246 var column = span.file.getColumn($assert_num(line), span.start); |
| 9041 this.writer.writeln(('\$assert(' + test.code + ', "' + MethodGenerator._esca
peString(span.get$text()) + '",') + (' "' + span.file.filename + '", ' + (line +
1) + ', ' + (column + 1) + ');')); | 9247 this.writer.writeln(('\$assert(' + test.code + ', "' + MethodGenerator._esca
peString(span.get$text()) + '",') + (' "' + span.file.filename + '", ' + (line +
1) + ', ' + (column + 1) + ');')); |
| 9042 } | 9248 } |
| 9043 return false; | 9249 return false; |
| 9044 } | 9250 } |
| 9045 MethodGenerator.prototype.visitBreakStatement = function(node) { | 9251 MethodGenerator.prototype.visitBreakStatement = function(node) { |
| 9046 if (node.label == null) { | 9252 if ($notnull_bool(node.label == null)) { |
| 9047 this.writer.writeln('break;'); | 9253 this.writer.writeln('break;'); |
| 9048 } | 9254 } |
| 9049 else { | 9255 else { |
| 9050 this.writer.writeln(('break ' + node.label.name + ';')); | 9256 this.writer.writeln(('break ' + node.label.name + ';')); |
| 9051 } | 9257 } |
| 9052 return true; | 9258 return true; |
| 9053 } | 9259 } |
| 9054 MethodGenerator.prototype.visitContinueStatement = function(node) { | 9260 MethodGenerator.prototype.visitContinueStatement = function(node) { |
| 9055 if (node.label == null) { | 9261 if ($notnull_bool(node.label == null)) { |
| 9056 this.writer.writeln('continue;'); | 9262 this.writer.writeln('continue;'); |
| 9057 } | 9263 } |
| 9058 else { | 9264 else { |
| 9059 this.writer.writeln(('continue ' + node.label.name + ';')); | 9265 this.writer.writeln(('continue ' + node.label.name + ';')); |
| 9060 } | 9266 } |
| 9061 return true; | 9267 return true; |
| 9062 } | 9268 } |
| 9063 MethodGenerator.prototype.visitIfStatement = function(node) { | 9269 MethodGenerator.prototype.visitIfStatement = function(node) { |
| 9064 var test = this.visitBool(node.test); | 9270 var test = this.visitBool(node.test); |
| 9065 this.writer.write(('if (' + test.code + ') ')); | 9271 this.writer.write(('if (' + test.code + ') ')); |
| 9066 var exit1 = node.trueBranch.visit(this); | 9272 var exit1 = node.trueBranch.visit(this); |
| 9067 if (node.falseBranch != null) { | 9273 if ($notnull_bool(node.falseBranch != null)) { |
| 9068 this.writer.write('else '); | 9274 this.writer.write('else '); |
| 9069 if (node.falseBranch.visit(this) && exit1) { | 9275 if ($notnull_bool(node.falseBranch.visit(this) && exit1)) { |
| 9070 return true; | 9276 return true; |
| 9071 } | 9277 } |
| 9072 } | 9278 } |
| 9073 return false; | 9279 return false; |
| 9074 } | 9280 } |
| 9075 MethodGenerator.prototype.visitWhileStatement = function(node) { | 9281 MethodGenerator.prototype.visitWhileStatement = function(node) { |
| 9076 var test = this.visitBool(node.test); | 9282 var test = this.visitBool(node.test); |
| 9077 this.writer.write(('while (' + test.code + ') ')); | 9283 this.writer.write(('while (' + test.code + ') ')); |
| 9078 this._pushBlock(true); | 9284 this._pushBlock(true); |
| 9079 node.body.visit(this); | 9285 node.body.visit(this); |
| 9080 this._popBlock(); | 9286 this._popBlock(); |
| 9081 return false; | 9287 return false; |
| 9082 } | 9288 } |
| 9083 MethodGenerator.prototype.visitDoStatement = function(node) { | 9289 MethodGenerator.prototype.visitDoStatement = function(node) { |
| 9084 this.writer.write('do '); | 9290 this.writer.write('do '); |
| 9085 this._pushBlock(true); | 9291 this._pushBlock(true); |
| 9086 node.body.visit(this); | 9292 node.body.visit(this); |
| 9087 this._popBlock(); | 9293 this._popBlock(); |
| 9088 var test = this.visitBool(node.test); | 9294 var test = this.visitBool(node.test); |
| 9089 this.writer.writeln(('while (' + test.code + ')')); | 9295 this.writer.writeln(('while (' + test.code + ')')); |
| 9090 return false; | 9296 return false; |
| 9091 } | 9297 } |
| 9092 MethodGenerator.prototype.visitForStatement = function(node) { | 9298 MethodGenerator.prototype.visitForStatement = function(node) { |
| 9093 this._pushBlock(false); | 9299 this._pushBlock(false); |
| 9094 this.writer.write('for ('); | 9300 this.writer.write('for ('); |
| 9095 if (node.init != null) node.init.visit(this); | 9301 if ($notnull_bool(node.init != null)) node.init.visit(this); |
| 9096 else this.writer.write(';'); | 9302 else this.writer.write(';'); |
| 9097 if (node.test != null) { | 9303 if ($notnull_bool(node.test != null)) { |
| 9098 var test = this.visitBool(node.test); | 9304 var test = this.visitBool(node.test); |
| 9099 this.writer.write((' ' + test.code + '; ')); | 9305 this.writer.write((' ' + test.code + '; ')); |
| 9100 } | 9306 } |
| 9101 else { | 9307 else { |
| 9102 this.writer.write('; '); | 9308 this.writer.write('; '); |
| 9103 } | 9309 } |
| 9104 var needsComma = false; | 9310 var needsComma = false; |
| 9105 var $list = node.step; | 9311 var $list = node.step; |
| 9106 for (var $i = 0;$i < $list.length; $i++) { | 9312 for (var $i = 0;$i < $list.length; $i++) { |
| 9107 var s = $list.$index($i); | 9313 var s = $list.$index($i); |
| 9108 if (needsComma) this.writer.write(', '); | 9314 if ($notnull_bool(needsComma)) this.writer.write(', '); |
| 9109 var sv = this.visitVoid(s); | 9315 var sv = this.visitVoid((s && s.is$lang_Expression())); |
| 9110 this.writer.write(sv.code); | 9316 this.writer.write(sv.code); |
| 9111 needsComma = true; | 9317 needsComma = true; |
| 9112 } | 9318 } |
| 9113 this.writer.write(') '); | 9319 this.writer.write(') '); |
| 9114 this._pushBlock(true); | 9320 this._pushBlock(true); |
| 9115 node.body.visit(this); | 9321 node.body.visit(this); |
| 9116 this._popBlock(); | 9322 this._popBlock(); |
| 9117 this._popBlock(); | 9323 this._popBlock(); |
| 9118 return false; | 9324 return false; |
| 9119 } | 9325 } |
| 9120 MethodGenerator.prototype.visitForInStatement = function(node) { | 9326 MethodGenerator.prototype.visitForInStatement = function(node) { |
| 9327 var $0; |
| 9121 var itemType = this.method.resolveType(node.item.type, false); | 9328 var itemType = this.method.resolveType(node.item.type, false); |
| 9122 var itemName = node.item.name.name; | 9329 var itemName = node.item.name.name; |
| 9123 var list = node.list.visit(this); | 9330 var list = node.list.visit(this); |
| 9124 this._pushBlock(true); | 9331 this._pushBlock(true); |
| 9125 var item = this._scope.create(itemName, itemType, node.item.name); | 9332 var item = this._scope.create($assert_String(itemName), (itemType && itemType.
is$lang_Type()), node.item.name); |
| 9126 var listVar = list; | 9333 var listVar = list; |
| 9127 if (list.needsTemp) { | 9334 if ($notnull_bool(list.needsTemp)) { |
| 9128 listVar = this._scope.create('\$list', list.type, null); | 9335 listVar = this._scope.create('\$list', (($0 = list.type) && $0.is$lang_Type(
)), null); |
| 9129 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';')); | 9336 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';')); |
| 9130 } | 9337 } |
| 9131 if (list.type.get$isList()) { | 9338 if ($notnull_bool(list.type.get$isList())) { |
| 9132 var tmpi = this._scope.create('\$i', world.numType, null); | 9339 var tmpi = this._scope.create('\$i', world.numType, null); |
| 9133 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code
+ ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {')); | 9340 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code
+ ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {')); |
| 9134 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [
tmpi]), false); | 9341 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [
tmpi]), false); |
| 9135 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';')); | 9342 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';')); |
| 9136 } | 9343 } |
| 9137 else { | 9344 else { |
| 9138 this._pushBlock(false); | 9345 this._pushBlock(false); |
| 9139 var c = world.get$coreimpl().types.$index('ListIterator').getConstructor('')
; | 9346 var c = world.get$coreimpl().types.$index('ListIterator').getConstructor('')
; |
| 9140 c.invoke$4(this, node, null, new Arguments(null, [new Value(null, 'l', false
, true, false)])); | 9347 c.invoke$4(this, node, null, new Arguments(null, [new Value(null, 'l', false
, true, false)])); |
| 9141 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT
Y()); | 9348 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT
Y()); |
| 9142 var tmpi = this._scope.create('\$i', iterator.type, null); | 9349 var tmpi = this._scope.create('\$i', (($0 = iterator.type) && $0.is$lang_Typ
e()), null); |
| 9143 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY(
)); | 9350 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY(
)); |
| 9144 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY()); | 9351 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY()); |
| 9145 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + ';
' + hasNext.code + '; ) {')); | 9352 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + ';
' + hasNext.code + '; ) {')); |
| 9146 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';')); | 9353 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';')); |
| 9147 } | 9354 } |
| 9148 this.visitStatementsInBlock(node.body); | 9355 this.visitStatementsInBlock(node.body); |
| 9149 this.writer.exitBlock('}'); | 9356 this.writer.exitBlock('}'); |
| 9150 this._popBlock(); | 9357 this._popBlock(); |
| 9151 return false; | 9358 return false; |
| 9152 } | 9359 } |
| 9153 MethodGenerator.prototype._genToDartException = function(ex) { | 9360 MethodGenerator.prototype._genToDartException = function(ex) { |
| 9154 var types = const$392/*const [ | 9361 var $0; |
| 9362 var types = const$393/*const [ |
| 9155 'NullPointerException', 'ObjectNotClosureException', | 9363 'NullPointerException', 'ObjectNotClosureException', |
| 9156 'NoSuchMethodException', 'StackOverflowException']*/; | 9364 'NoSuchMethodException', 'StackOverflowException']*/; |
| 9157 for (var $i = types.iterator(); $i.hasNext(); ) { | 9365 for (var $i = types.iterator(); $i.hasNext(); ) { |
| 9158 var name = $i.next(); | 9366 var name = $i.next(); |
| 9159 world.corelib.types.$index(name).markUsed(); | 9367 world.corelib.types.$index(name).markUsed(); |
| 9160 } | 9368 } |
| 9161 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');')); | 9369 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');')); |
| 9162 } | 9370 } |
| 9163 MethodGenerator.prototype.visitTryStatement = function(node) { | 9371 MethodGenerator.prototype.visitTryStatement = function(node) { |
| 9372 var $0; |
| 9164 this.writer.enterBlock('try {'); | 9373 this.writer.enterBlock('try {'); |
| 9165 this._pushBlock(false); | 9374 this._pushBlock(false); |
| 9166 this.visitStatementsInBlock(node.body); | 9375 this.visitStatementsInBlock(node.body); |
| 9167 this._popBlock(); | 9376 this._popBlock(); |
| 9168 if (node.catches.length == 1) { | 9377 if ($notnull_bool(node.catches.length == 1)) { |
| 9169 var catch_ = node.catches.$index(0); | 9378 var catch_ = node.catches.$index(0); |
| 9170 this._pushBlock(false); | 9379 this._pushBlock(false); |
| 9171 var ex = this._scope.declare(catch_.get$exception()); | 9380 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare
dIdentifier())); |
| 9172 this._scope.rethrow = ex; | 9381 this._scope.rethrow = (ex && ex.is$Value()); |
| 9173 this.writer.nextBlock(('} catch (' + ex.code + ') {')); | 9382 this.writer.nextBlock(('} catch (' + ex.code + ') {')); |
| 9174 if (catch_.trace != null) { | 9383 if ($notnull_bool(catch_.trace != null)) { |
| 9175 var trace = this._scope.declare(catch_.trace); | 9384 var trace = this._scope.declare(catch_.trace); |
| 9176 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); | 9385 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); |
| 9177 } | 9386 } |
| 9178 this._genToDartException(ex.code); | 9387 this._genToDartException(ex.code); |
| 9179 if (!ex.type.get$isVar()) { | 9388 if ($notnull_bool(!ex.type.get$isVar())) { |
| 9180 var test = ex.instanceOf(this, ex.type, catch_.get$exception().get$span(),
false, true); | 9389 var test = ex.instanceOf(this, (($0 = ex.type) && $0.is$lang_Type()), catc
h_.get$exception().get$span(), false, true); |
| 9181 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';')); | 9390 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';')); |
| 9182 } | 9391 } |
| 9183 this.visitStatementsInBlock(node.catches.$index(0).body); | 9392 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan
g_Statement())); |
| 9184 this._popBlock(); | 9393 this._popBlock(); |
| 9185 } | 9394 } |
| 9186 else if (node.catches.length > 0) { | 9395 else if ($notnull_bool(node.catches.length > 0)) { |
| 9187 this._pushBlock(false); | 9396 this._pushBlock(false); |
| 9188 var ex = this._scope.create('\$ex', world.varType, null); | 9397 var ex = this._scope.create('\$ex', world.varType, null); |
| 9189 this._scope.rethrow = ex; | 9398 this._scope.rethrow = (ex && ex.is$Value()); |
| 9190 this.writer.nextBlock(('} catch (' + ex.code + ') {')); | 9399 this.writer.nextBlock(('} catch (' + ex.code + ') {')); |
| 9191 var trace = null; | 9400 var trace = null; |
| 9192 if (node.catches.some((function (c) { | 9401 if ($notnull_bool(node.catches.some((function (c) { |
| 9193 return c.trace != null; | 9402 return c.trace != null; |
| 9194 }) | 9403 }) |
| 9195 )) { | 9404 ))) { |
| 9196 trace = this._scope.create('\$trace', world.varType, null); | 9405 trace = this._scope.create('\$trace', world.varType, null); |
| 9197 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); | 9406 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); |
| 9198 } | 9407 } |
| 9199 this._genToDartException(ex.code); | 9408 this._genToDartException(ex.code); |
| 9200 var needsRethrow = true; | 9409 var needsRethrow = true; |
| 9201 for (var i = 0; | 9410 for (var i = 0; |
| 9202 i < node.catches.length; i++) { | 9411 $notnull_bool(i < node.catches.length); i++) { |
| 9203 var catch_ = node.catches.$index(i); | 9412 var catch_ = node.catches.$index(i); |
| 9204 this._pushBlock(false); | 9413 this._pushBlock(false); |
| 9205 var tmp = this._scope.declare(catch_.get$exception()); | 9414 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl
aredIdentifier())); |
| 9206 if (!tmp.type.get$isVar()) { | 9415 if ($notnull_bool(!tmp.type.get$isVar())) { |
| 9207 var test = ex.instanceOf(this, tmp.type, catch_.get$exception().get$span
(), true, true); | 9416 var test = ex.instanceOf(this, (($0 = tmp.type) && $0.is$lang_Type()), c
atch_.get$exception().get$span(), true, true); |
| 9208 if (i == 0) { | 9417 if ($notnull_bool(i == 0)) { |
| 9209 this.writer.enterBlock(('if (' + test.code + ') {')); | 9418 this.writer.enterBlock(('if (' + test.code + ') {')); |
| 9210 } | 9419 } |
| 9211 else { | 9420 else { |
| 9212 this.writer.nextBlock(('} else if (' + test.code + ') {')); | 9421 this.writer.nextBlock(('} else if (' + test.code + ') {')); |
| 9213 } | 9422 } |
| 9214 } | 9423 } |
| 9215 else if (i > 0) { | 9424 else if ($notnull_bool(i > 0)) { |
| 9216 this.writer.nextBlock('} else {'); | 9425 this.writer.nextBlock('} else {'); |
| 9217 } | 9426 } |
| 9218 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';')); | 9427 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';')); |
| 9219 if (catch_.trace != null) { | 9428 if ($notnull_bool(catch_.trace != null)) { |
| 9220 var tmptrace = this._scope.declare(catch_.trace); | 9429 var tmptrace = this._scope.declare(catch_.trace); |
| 9221 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';'))
; | 9430 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';'))
; |
| 9222 } | 9431 } |
| 9223 this.visitStatementsInBlock(catch_.body); | 9432 this.visitStatementsInBlock((($0 = catch_.body) && $0.is$lang_Statement())
); |
| 9224 this._popBlock(); | 9433 this._popBlock(); |
| 9225 if (tmp.type.get$isVar()) { | 9434 if ($notnull_bool(tmp.type.get$isVar())) { |
| 9226 if (i + 1 < node.catches.length) { | 9435 if ($notnull_bool(i + 1 < node.catches.length)) { |
| 9227 world.warning('Unreachable catch clause', node.catches.$index(i + 1)); | 9436 world.warning('Unreachable catch clause', (($0 = node.catches.$index(i
+ 1)) && $0.is$SourceSpan())); |
| 9228 } | 9437 } |
| 9229 if (i > 0) { | 9438 if ($notnull_bool(i > 0)) { |
| 9230 this.writer.exitBlock('}'); | 9439 this.writer.exitBlock('}'); |
| 9231 } | 9440 } |
| 9232 needsRethrow = false; | 9441 needsRethrow = false; |
| 9233 break; | 9442 break; |
| 9234 } | 9443 } |
| 9235 } | 9444 } |
| 9236 if (needsRethrow) { | 9445 if ($notnull_bool(needsRethrow)) { |
| 9237 this.writer.nextBlock('} else {'); | 9446 this.writer.nextBlock('} else {'); |
| 9238 this.writer.writeln(('throw ' + ex.code + ';')); | 9447 this.writer.writeln(('throw ' + ex.code + ';')); |
| 9239 this.writer.exitBlock('}'); | 9448 this.writer.exitBlock('}'); |
| 9240 } | 9449 } |
| 9241 this._popBlock(); | 9450 this._popBlock(); |
| 9242 } | 9451 } |
| 9243 if (node.finallyBlock != null) { | 9452 if ($notnull_bool(node.finallyBlock != null)) { |
| 9244 this.writer.nextBlock('} finally {'); | 9453 this.writer.nextBlock('} finally {'); |
| 9245 this._pushBlock(false); | 9454 this._pushBlock(false); |
| 9246 this.visitStatementsInBlock(node.finallyBlock); | 9455 this.visitStatementsInBlock(node.finallyBlock); |
| 9247 this._popBlock(); | 9456 this._popBlock(); |
| 9248 } | 9457 } |
| 9249 this.writer.exitBlock('}'); | 9458 this.writer.exitBlock('}'); |
| 9250 return false; | 9459 return false; |
| 9251 } | 9460 } |
| 9252 MethodGenerator.prototype.visitSwitchStatement = function(node) { | 9461 MethodGenerator.prototype.visitSwitchStatement = function(node) { |
| 9253 var test = this.visitValue(node.test); | 9462 var test = this.visitValue(node.test); |
| 9254 this.writer.enterBlock(('switch (' + test.code + ') {')); | 9463 this.writer.enterBlock(('switch (' + test.code + ') {')); |
| 9255 var $list = node.cases; | 9464 var $list = node.cases; |
| 9256 for (var $i = 0;$i < $list.length; $i++) { | 9465 for (var $i = 0;$i < $list.length; $i++) { |
| 9257 var case_ = $list.$index($i); | 9466 var case_ = $list.$index($i); |
| 9258 if (case_.label != null) { | 9467 if ($notnull_bool(case_.label != null)) { |
| 9259 world.error('unimplemented: labeled case statement', case_.get$span()); | 9468 world.error('unimplemented: labeled case statement', case_.get$span()); |
| 9260 } | 9469 } |
| 9261 this._pushBlock(false); | 9470 this._pushBlock(false); |
| 9262 for (var i = 0; | 9471 for (var i = 0; |
| 9263 i < case_.cases.length; i++) { | 9472 $notnull_bool(i < case_.cases.length); i++) { |
| 9264 var expr = case_.cases.$index(i); | 9473 var expr = case_.cases.$index(i); |
| 9265 if (expr == null) { | 9474 if ($notnull_bool(expr == null)) { |
| 9266 if (i < case_.cases.length - 1) { | 9475 if ($notnull_bool(i < case_.cases.length - 1)) { |
| 9267 world.error('default clause must be the last case', case_.get$span()); | 9476 world.error('default clause must be the last case', case_.get$span()); |
| 9268 } | 9477 } |
| 9269 this.writer.writeln('default:'); | 9478 this.writer.writeln('default:'); |
| 9270 } | 9479 } |
| 9271 else { | 9480 else { |
| 9272 var value = this.visitValue(expr); | 9481 var value = this.visitValue((expr && expr.is$lang_Expression())); |
| 9273 this.writer.writeln(('case ' + value.code + ':')); | 9482 this.writer.writeln(('case ' + value.code + ':')); |
| 9274 } | 9483 } |
| 9275 } | 9484 } |
| 9276 this.writer.enterBlock(''); | 9485 this.writer.enterBlock(''); |
| 9277 var caseExits = this._visitAllStatements(case_.statements, false); | 9486 var caseExits = this._visitAllStatements(case_.statements, false); |
| 9278 if ($ne(case_, node.cases.$index(node.cases.length - 1)) && !caseExits) { | 9487 if ($notnull_bool($ne(case_, node.cases.$index(node.cases.length - 1)) && !c
aseExits)) { |
| 9279 var span = case_.statements.$index(case_.statements.length - 1).get$span()
; | 9488 var span = case_.statements.$index(case_.statements.length - 1).get$span()
; |
| 9280 this.writer.writeln('\$throw(new FallThroughError());'); | 9489 this.writer.writeln('\$throw(new FallThroughError());'); |
| 9281 } | 9490 } |
| 9282 this.writer.exitBlock(''); | 9491 this.writer.exitBlock(''); |
| 9283 this._popBlock(); | 9492 this._popBlock(); |
| 9284 } | 9493 } |
| 9285 this.writer.exitBlock('}'); | 9494 this.writer.exitBlock('}'); |
| 9286 return false; | 9495 return false; |
| 9287 } | 9496 } |
| 9288 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { | 9497 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { |
| 9289 for (var i = 0; | 9498 for (var i = 0; |
| 9290 i < statementList.length; i++) { | 9499 $notnull_bool(i < statementList.length); i++) { |
| 9291 var stmt = statementList.$index(i); | 9500 var stmt = statementList.$index(i); |
| 9292 exits = stmt.visit(this); | 9501 exits = stmt.visit(this); |
| 9293 if ($ne(stmt, statementList.$index(statementList.length - 1)) && exits) { | 9502 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1))
&& exits)) { |
| 9294 world.warning('unreachable code', statementList.$index(i + 1).get$span()); | 9503 world.warning('unreachable code', statementList.$index(i + 1).get$span()); |
| 9295 } | 9504 } |
| 9296 } | 9505 } |
| 9297 return exits; | 9506 return exits; |
| 9298 } | 9507 } |
| 9299 MethodGenerator.prototype.visitBlockStatement = function(node) { | 9508 MethodGenerator.prototype.visitBlockStatement = function(node) { |
| 9300 this._pushBlock(false); | 9509 this._pushBlock(false); |
| 9301 this.writer.enterBlock('{'); | 9510 this.writer.enterBlock('{'); |
| 9302 var exits = this._visitAllStatements(node.body, false); | 9511 var exits = this._visitAllStatements(node.body, false); |
| 9303 this.writer.exitBlock('}'); | 9512 this.writer.exitBlock('}'); |
| 9304 this._popBlock(); | 9513 this._popBlock(); |
| 9305 return exits; | 9514 return exits; |
| 9306 } | 9515 } |
| 9307 MethodGenerator.prototype.visitLabeledStatement = function(node) { | 9516 MethodGenerator.prototype.visitLabeledStatement = function(node) { |
| 9308 this.writer.writeln(('' + node.name.name + ':')); | 9517 this.writer.writeln(('' + node.name.name + ':')); |
| 9309 node.body.visit(this); | 9518 node.body.visit(this); |
| 9310 return false; | 9519 return false; |
| 9311 } | 9520 } |
| 9312 MethodGenerator.prototype.visitExpressionStatement = function(node) { | 9521 MethodGenerator.prototype.visitExpressionStatement = function(node) { |
| 9313 if ((node.body instanceof VarExpression) || (node.body instanceof ThisExpressi
on)) { | 9522 if ($notnull_bool((node.body instanceof VarExpression) || (node.body instanceo
f ThisExpression))) { |
| 9314 world.warning('variable used as statement', node.span); | 9523 world.warning('variable used as statement', node.span); |
| 9315 } | 9524 } |
| 9316 var value = this.visitVoid(node.body); | 9525 var value = this.visitVoid(node.body); |
| 9317 this.writer.writeln(('' + value.code + ';')); | 9526 this.writer.writeln(('' + value.code + ';')); |
| 9318 return false; | 9527 return false; |
| 9319 } | 9528 } |
| 9320 MethodGenerator.prototype.visitEmptyStatement = function(node) { | 9529 MethodGenerator.prototype.visitEmptyStatement = function(node) { |
| 9321 this.writer.writeln(';'); | 9530 this.writer.writeln(';'); |
| 9322 return false; | 9531 return false; |
| 9323 } | 9532 } |
| 9324 MethodGenerator.prototype._checkNonStatic = function(node) { | 9533 MethodGenerator.prototype._checkNonStatic = function(node) { |
| 9325 if (this.method.get$isStatic()) { | 9534 if ($notnull_bool(this.method.get$isStatic())) { |
| 9326 world.warning('not allowed in static method', node.span); | 9535 world.warning('not allowed in static method', node.span); |
| 9327 } | 9536 } |
| 9328 } | 9537 } |
| 9329 MethodGenerator.prototype._makeSuperValue = function(node) { | 9538 MethodGenerator.prototype._makeSuperValue = function(node) { |
| 9330 var parentType = this.method.declaringType.get$parent(); | 9539 var parentType = this.method.declaringType.get$parent(); |
| 9331 this._checkNonStatic(node); | 9540 this._checkNonStatic(node); |
| 9332 if (parentType == null) { | 9541 if ($notnull_bool(parentType == null)) { |
| 9333 world.error('no super class', node.span); | 9542 world.error('no super class', node.span); |
| 9334 } | 9543 } |
| 9335 return new Value(parentType, 'this', true, true, false); | 9544 return new Value(parentType, 'this', true, true, false); |
| 9336 } | 9545 } |
| 9337 MethodGenerator.prototype._getOutermostMethod = function() { | 9546 MethodGenerator.prototype._getOutermostMethod = function() { |
| 9338 var result = this; | 9547 var result = this; |
| 9339 while (result.enclosingMethod != null) { | 9548 while ($notnull_bool(result.enclosingMethod != null)) { |
| 9340 result = result.enclosingMethod; | 9549 result = result.enclosingMethod; |
| 9341 } | 9550 } |
| 9342 return result; | 9551 return result; |
| 9343 } | 9552 } |
| 9344 MethodGenerator.prototype._makeThisValue = function(node) { | 9553 MethodGenerator.prototype._makeThisValue = function(node) { |
| 9345 if (this.enclosingMethod != null) { | 9554 if ($notnull_bool(this.enclosingMethod != null)) { |
| 9346 var outermostMethod = this._getOutermostMethod(); | 9555 var outermostMethod = this._getOutermostMethod(); |
| 9347 outermostMethod._checkNonStatic(node); | 9556 outermostMethod._checkNonStatic(node); |
| 9348 outermostMethod.needsThis = true; | 9557 outermostMethod.needsThis = true; |
| 9349 return new Value(outermostMethod.method.declaringType, '\$this', false, true
, false); | 9558 return new Value(outermostMethod.method.declaringType, '\$this', false, true
, false); |
| 9350 } | 9559 } |
| 9351 else { | 9560 else { |
| 9352 this._checkNonStatic(node); | 9561 this._checkNonStatic(node); |
| 9353 return new Value(this.method.declaringType, 'this', false, true, false); | 9562 return new Value(this.method.declaringType, 'this', false, true, false); |
| 9354 } | 9563 } |
| 9355 } | 9564 } |
| 9356 MethodGenerator.prototype.visitLambdaExpression = function(node) { | 9565 MethodGenerator.prototype.visitLambdaExpression = function(node) { |
| 9357 var name = ''; | 9566 var name = ''; |
| 9358 if (node.func.name != null) { | 9567 if ($notnull_bool(node.func.name != null)) { |
| 9359 name = world.toJsIdentifier(node.func.name.name); | 9568 name = world.toJsIdentifier(node.func.name.name); |
| 9360 } | 9569 } |
| 9361 var meth = this._makeLambdaMethod(name, node.func); | 9570 var meth = this._makeLambdaMethod($assert_String(name), node.func); |
| 9362 var w = new CodeWriter(); | 9571 var w = new CodeWriter(); |
| 9363 meth.generator.writeDefinition(w, node); | 9572 meth.generator.writeDefinition((w && w.is$CodeWriter()), node); |
| 9364 return new Value(meth.get$functionType(), w.get$text(), false, true, false); | 9573 return new Value(meth.get$functionType(), w.get$text(), false, true, false); |
| 9365 } | 9574 } |
| 9366 MethodGenerator.prototype.visitCallExpression = function(node) { | 9575 MethodGenerator.prototype.visitCallExpression = function(node) { |
| 9367 var target; | 9576 var target; |
| 9368 var position = node.target; | 9577 var position = node.target; |
| 9369 var name = '\$call'; | 9578 var name = '\$call'; |
| 9370 if ((node.target instanceof DotExpression)) { | 9579 if ($notnull_bool((node.target instanceof DotExpression))) { |
| 9371 target = node.target.self.visit(this); | 9580 target = node.target.self.visit(this); |
| 9372 name = node.target.get$name().get$name(); | 9581 name = node.target.get$name().get$name(); |
| 9373 position = node.target.get$name(); | 9582 position = node.target.get$name(); |
| 9374 } | 9583 } |
| 9375 else if ((node.target instanceof VarExpression)) { | 9584 else if ($notnull_bool((node.target instanceof VarExpression))) { |
| 9376 name = node.target.get$name().get$name(); | 9585 name = node.target.get$name().get$name(); |
| 9377 var meth = this.method.declaringType.resolveMember(name); | 9586 var meth = this.method.declaringType.resolveMember(name); |
| 9378 if ($ne(meth, null)) { | 9587 if ($notnull_bool($ne(meth, null))) { |
| 9379 target = this._makeThisOrType(); | 9588 target = this._makeThisOrType(); |
| 9380 return meth.invoke$4(this, node.target, target, this._makeArgs(node.argume
nts)); | 9589 return meth.invoke$4(this, node.target, target, this._makeArgs(node.argume
nts)); |
| 9381 } | 9590 } |
| 9382 meth = this.method.declaringType.get$library().lookup(name, node.target.span
); | 9591 meth = this.method.declaringType.get$library().lookup($assert_String(name),
node.target.span); |
| 9383 if ($ne(meth, null)) { | 9592 if ($notnull_bool($ne(meth, null))) { |
| 9384 return meth.invoke$4(this, node.target, null, this._makeArgs(node.argument
s)); | 9593 return meth.invoke$4(this, node.target, null, this._makeArgs(node.argument
s)); |
| 9385 } | 9594 } |
| 9386 name = '\$call'; | 9595 name = '\$call'; |
| 9387 target = node.target.visit(this); | 9596 target = node.target.visit(this); |
| 9388 } | 9597 } |
| 9389 else { | 9598 else { |
| 9390 target = node.target.visit(this); | 9599 target = node.target.visit(this); |
| 9391 } | 9600 } |
| 9392 return target.invoke$4(this, name, position, this._makeArgs(node.arguments)); | 9601 return target.invoke$4(this, name, position, this._makeArgs(node.arguments)); |
| 9393 } | 9602 } |
| 9394 MethodGenerator.prototype.visitIndexExpression = function(node) { | 9603 MethodGenerator.prototype.visitIndexExpression = function(node) { |
| 9395 var target = this.visitValue(node.target); | 9604 var target = this.visitValue(node.target); |
| 9396 var index = this.visitValue(node.index); | 9605 var index = this.visitValue(node.index); |
| 9397 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); | 9606 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); |
| 9398 } | 9607 } |
| 9399 MethodGenerator.prototype.visitBinaryExpression = function(node) { | 9608 MethodGenerator.prototype.visitBinaryExpression = function(node) { |
| 9400 var kind = node.op.kind; | 9609 var kind = node.op.kind; |
| 9401 if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) { | 9610 if ($notnull_bool(kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/))
{ |
| 9402 var x = this.visitValue(node.x); | 9611 var x = this.visitValue(node.x); |
| 9403 var y = this.visitValue(node.y); | 9612 var y = this.visitValue(node.y); |
| 9404 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); | 9613 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); |
| 9405 if (x.get$isConst() && y.get$isConst()) { | 9614 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { |
| 9406 var value = (kind == 35/*TokenKind.AND*/) ? x.get$actualValue() && y.get$a
ctualValue() : x.get$actualValue() || y.get$actualValue(); | 9615 var value = $notnull_bool((kind == 35/*TokenKind.AND*/)) ? x.get$actualVal
ue() && y.get$actualValue() : x.get$actualValue() || y.get$actualValue(); |
| 9407 return EvaluatedValue.EvaluatedValue$factory(x.type, value, ('' + value +
''), node.span); | 9616 return EvaluatedValue.EvaluatedValue$factory(x.type, value, ('' + value +
''), node.span); |
| 9408 } | 9617 } |
| 9409 return new Value(null, code, false, true, false); | 9618 return new Value(null, code, false, true, false); |
| 9410 } | 9619 } |
| 9411 else if (kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenKind.NE_STRICT*
/) { | 9620 else if ($notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenK
ind.NE_STRICT*/)) { |
| 9412 var x = this.visitValue(node.x); | 9621 var x = this.visitValue(node.x); |
| 9413 var y = this.visitValue(node.y); | 9622 var y = this.visitValue(node.y); |
| 9414 if (x.get$isConst() && y.get$isConst()) { | 9623 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { |
| 9415 var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(x.get$actualValue(), y
.get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue()); | 9624 var value = $notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/) ? $eq(x.get$a
ctualValue(), y.get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue(
)); |
| 9416 return EvaluatedValue.EvaluatedValue$factory(world.boolType, value, ("" +
value + ""), node.span); | 9625 return EvaluatedValue.EvaluatedValue$factory(world.boolType, value, ("" +
value + ""), node.span); |
| 9417 } | 9626 } |
| 9418 if (x.code == 'null' || y.code == 'null') { | 9627 if ($notnull_bool(x.code == 'null' || y.code == 'null')) { |
| 9419 var op = node.op.toString().substring(0, 2); | 9628 var op = node.op.toString().substring(0, 2); |
| 9420 return new Value(null, ('' + x.code + ' ' + op + ' ' + y.code + ''), false
, true, false); | 9629 return new Value(null, ('' + x.code + ' ' + op + ' ' + y.code + ''), false
, true, false); |
| 9421 } | 9630 } |
| 9422 else { | 9631 else { |
| 9423 return new Value(null, ('' + x.code + ' ' + node.op + ' ' + y.code + ''),
false, true, false); | 9632 return new Value(null, ('' + x.code + ' ' + node.op + ' ' + y.code + ''),
false, true, false); |
| 9424 } | 9633 } |
| 9425 } | 9634 } |
| 9426 var assignKind = TokenKind.kindFromAssign(node.op.kind); | 9635 var assignKind = TokenKind.kindFromAssign(node.op.kind); |
| 9427 if (assignKind == -1) { | 9636 if ($notnull_bool(assignKind == -1)) { |
| 9428 var x = this.visitValue(node.x); | 9637 var x = this.visitValue(node.x); |
| 9429 var y = this.visitValue(node.y); | 9638 var y = this.visitValue(node.y); |
| 9430 var name = TokenKind.binaryMethodName(node.op.kind); | 9639 var name = TokenKind.binaryMethodName(node.op.kind); |
| 9431 if (node.op.kind == 49/*TokenKind.NE*/) { | 9640 if ($notnull_bool(node.op.kind == 49/*TokenKind.NE*/)) { |
| 9432 name = '\$ne'; | 9641 name = '\$ne'; |
| 9433 } | 9642 } |
| 9434 if (name == null) { | 9643 if ($notnull_bool(name == null)) { |
| 9435 world.internalError(('unimplemented binary op ' + node.op + ''), node.span
); | 9644 world.internalError(('unimplemented binary op ' + node.op + ''), node.span
); |
| 9436 return; | 9645 return; |
| 9437 } | 9646 } |
| 9438 return x.invoke$4(this, name, node, new Arguments(null, [y])); | 9647 return x.invoke$4(this, name, node, new Arguments(null, [y])); |
| 9439 } | 9648 } |
| 9440 else { | 9649 else { |
| 9441 return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null)); | 9650 return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null)); |
| 9442 } | 9651 } |
| 9443 } | 9652 } |
| 9444 MethodGenerator.prototype._visitAssign = function(kind, xn, yn, position, captur
eOriginal) { | 9653 MethodGenerator.prototype._visitAssign = function(kind, xn, yn, position, captur
eOriginal) { |
| 9445 if (captureOriginal == null) { | 9654 if ($notnull_bool(captureOriginal == null)) { |
| 9446 captureOriginal = (function (x) { | 9655 captureOriginal = (function (x) { |
| 9447 return x; | 9656 return x; |
| 9448 }) | 9657 }) |
| 9449 ; | 9658 ; |
| 9450 } | 9659 } |
| 9451 if ((xn instanceof VarExpression)) { | 9660 if ($notnull_bool((xn instanceof VarExpression))) { |
| 9452 return this._visitVarAssign(kind, xn, yn, position, captureOriginal); | 9661 return this._visitVarAssign(kind, (xn && xn.is$VarExpression()), yn, positio
n, captureOriginal); |
| 9453 } | 9662 } |
| 9454 else if ((xn instanceof IndexExpression)) { | 9663 else if ($notnull_bool((xn instanceof IndexExpression))) { |
| 9455 return this._visitIndexAssign(kind, xn, yn, position, captureOriginal); | 9664 return this._visitIndexAssign(kind, (xn && xn.is$IndexExpression()), yn, pos
ition, captureOriginal); |
| 9456 } | 9665 } |
| 9457 else if ((xn instanceof DotExpression)) { | 9666 else if ($notnull_bool((xn instanceof DotExpression))) { |
| 9458 return this._visitDotAssign(kind, xn, yn, position, captureOriginal); | 9667 return this._visitDotAssign(kind, (xn && xn.is$DotExpression()), yn, positio
n, captureOriginal); |
| 9459 } | 9668 } |
| 9460 else { | 9669 else { |
| 9461 world.error('illegal lhs', position.span); | 9670 world.error('illegal lhs', position.span); |
| 9462 } | 9671 } |
| 9463 } | 9672 } |
| 9464 MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap
tureOriginal) { | 9673 MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap
tureOriginal) { |
| 9674 var $0; |
| 9465 var x = this._scope.lookup(xn.name.name); | 9675 var x = this._scope.lookup(xn.name.name); |
| 9466 var y = this.visitValue(yn); | 9676 var y = this.visitValue(yn); |
| 9467 if (x == null) { | 9677 if ($notnull_bool(x == null)) { |
| 9468 var members = this.method.declaringType.resolveMember(xn.name.name); | 9678 var members = this.method.declaringType.resolveMember(xn.name.name); |
| 9469 if ($ne(members, null)) { | 9679 if ($notnull_bool($ne(members, null))) { |
| 9470 x = this._makeThisOrType(); | 9680 x = this._makeThisOrType(); |
| 9471 } | 9681 } |
| 9472 else { | 9682 else { |
| 9473 var member = this.method.declaringType.get$library().lookup(xn.name.name,
xn.name.span); | 9683 var member = this.method.declaringType.get$library().lookup(xn.name.name,
xn.name.span); |
| 9474 if (member == null) { | 9684 if ($notnull_bool(member == null)) { |
| 9475 world.warning(('can not resolve ' + xn.name.name + ''), xn.span); | 9685 world.warning(('can not resolve ' + xn.name.name + ''), xn.span); |
| 9476 return this._makeMissingValue(xn.name.name); | 9686 return this._makeMissingValue(xn.name.name); |
| 9477 } | 9687 } |
| 9478 members = new MemberSet(member); | 9688 members = new MemberSet(member); |
| 9479 } | 9689 } |
| 9480 if (!members.get$treatAsField() || members.get$containsMethods()) { | 9690 if ($notnull_bool(!members.get$treatAsField() || members.get$containsMethods
())) { |
| 9481 if (kind != 0) { | 9691 if ($notnull_bool(kind != 0)) { |
| 9482 var right = members.get_$3(this, position, x); | 9692 var right = members.get_$3(this, position, x); |
| 9483 right = captureOriginal(right); | 9693 right = captureOriginal((right && right.is$Value())); |
| 9484 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new
Arguments(null, [y])); | 9694 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new
Arguments(null, [y])); |
| 9485 } | 9695 } |
| 9486 return members.set_$4(this, position, x, y); | 9696 return members.set_$4(this, position, x, y); |
| 9487 } | 9697 } |
| 9488 x = members.get_$3(this, position, x); | 9698 x = members.get_$3(this, position, x); |
| 9489 } | 9699 } |
| 9490 y = y.convertTo(this, x.type, yn, false); | 9700 y = y.convertTo(this, (($0 = x.type) && $0.is$lang_Type()), yn, false); |
| 9491 if (kind == 0) { | 9701 if ($notnull_bool(kind == 0)) { |
| 9492 x = captureOriginal(x); | 9702 x = captureOriginal((x && x.is$Value())); |
| 9493 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), false, true, f
alse); | 9703 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), false, true, f
alse); |
| 9494 } | 9704 } |
| 9495 else if (x.type.get$isNum() && y.type.get$isNum() && (kind != 46/*TokenKind.TR
UNCDIV*/)) { | 9705 else if ($notnull_bool(x.type.get$isNum() && y.type.get$isNum() && (kind != 46
/*TokenKind.TRUNCDIV*/))) { |
| 9496 x = captureOriginal(x); | 9706 x = captureOriginal((x && x.is$Value())); |
| 9497 var op = TokenKind.kindToString(kind); | 9707 var op = TokenKind.kindToString(kind); |
| 9498 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), fals
e, true, false); | 9708 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), fals
e, true, false); |
| 9499 } | 9709 } |
| 9500 else { | 9710 else { |
| 9501 var right = x; | 9711 var right = x; |
| 9502 right = captureOriginal(right); | 9712 right = captureOriginal((right && right.is$Value())); |
| 9503 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); | 9713 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); |
| 9504 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), false, true, f
alse); | 9714 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), false, true, f
alse); |
| 9505 } | 9715 } |
| 9506 } | 9716 } |
| 9507 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c
aptureOriginal) { | 9717 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c
aptureOriginal) { |
| 9508 var target = this.visitValue(xn.target); | 9718 var target = this.visitValue(xn.target); |
| 9509 var index = this.visitValue(xn.index); | 9719 var index = this.visitValue(xn.index); |
| 9510 var y = this.visitValue(yn); | 9720 var y = this.visitValue(yn); |
| 9511 var tmptarget = target; | 9721 var tmptarget = target; |
| 9512 var tmpindex = index; | 9722 var tmpindex = index; |
| 9513 if (kind != 0) { | 9723 if ($notnull_bool(kind != 0)) { |
| 9514 tmptarget = this.getTemp(target); | 9724 tmptarget = this.getTemp((target && target.is$Value())); |
| 9515 tmpindex = this.getTemp(index); | 9725 tmpindex = this.getTemp((index && index.is$Value())); |
| 9516 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null
, [this.assignTemp(tmpindex, index)])); | 9726 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null
, [this.assignTemp((tmpindex && tmpindex.is$Value()), (index && index.is$Value()
))])); |
| 9517 right = captureOriginal(right); | 9727 right = captureOriginal((right && right.is$Value())); |
| 9518 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); | 9728 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); |
| 9519 } | 9729 } |
| 9520 var ret = this.assignTemp(tmptarget, target).invoke(this, '\$setindex', positi
on, new Arguments(null, [index, y]), false); | 9730 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ
et.is$Value())).invoke(this, '\$setindex', position, new Arguments(null, [index,
y]), false); |
| 9521 if ($ne(tmptarget, target)) this.freeTemp(tmptarget); | 9731 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg
et.is$Value())); |
| 9522 if ($ne(tmpindex, index)) this.freeTemp(tmpindex); | 9732 if ($notnull_bool($ne(tmpindex, index))) this.freeTemp((tmpindex && tmpindex.i
s$Value())); |
| 9523 return ret; | 9733 return ret; |
| 9524 } | 9734 } |
| 9525 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap
tureOriginal) { | 9735 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap
tureOriginal) { |
| 9526 var target = xn.self.visit(this); | 9736 var target = xn.self.visit(this); |
| 9527 var y = this.visitValue(yn); | 9737 var y = this.visitValue(yn); |
| 9528 var tmptarget = target; | 9738 var tmptarget = target; |
| 9529 if (kind != 0) { | 9739 if ($notnull_bool(kind != 0)) { |
| 9530 tmptarget = this.getTemp(target); | 9740 tmptarget = this.getTemp((target && target.is$Value())); |
| 9531 var right = tmptarget.get_$3(this, xn.name.name, xn.name); | 9741 var right = tmptarget.get_$3(this, xn.name.name, xn.name); |
| 9532 right = captureOriginal(right); | 9742 right = captureOriginal((right && right.is$Value())); |
| 9533 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); | 9743 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); |
| 9534 } | 9744 } |
| 9535 var ret = this.assignTemp(tmptarget, target).set_(this, xn.name.name, xn.name,
y, false); | 9745 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); |
| 9536 if ($ne(tmptarget, target)) this.freeTemp(tmptarget); | 9746 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg
et.is$Value())); |
| 9537 return ret; | 9747 return ret; |
| 9538 } | 9748 } |
| 9539 MethodGenerator.prototype.visitUnaryExpression = function(node) { | 9749 MethodGenerator.prototype.visitUnaryExpression = function(node) { |
| 9540 var value = this.visitValue(node.self); | 9750 var value = this.visitValue(node.self); |
| 9541 switch (node.op.kind) { | 9751 switch (node.op.kind) { |
| 9542 case 16/*TokenKind.INCR*/: | 9752 case 16/*TokenKind.INCR*/: |
| 9543 case 17/*TokenKind.DECR*/: | 9753 case 17/*TokenKind.DECR*/: |
| 9544 | 9754 |
| 9545 if (value.type.get$isNum()) { | 9755 if ($notnull_bool(value.type.get$isNum())) { |
| 9546 return new Value(value.type, ('' + node.op + '' + value.code + ''), fals
e, true, false); | 9756 return new Value(value.type, ('' + node.op + '' + value.code + ''), fals
e, true, false); |
| 9547 } | 9757 } |
| 9548 else { | 9758 else { |
| 9549 var kind = (16/*TokenKind.INCR*/ == node.op.kind ? 42/*TokenKind.ADD*/ :
43/*TokenKind.SUB*/); | 9759 var kind = ($notnull_bool(16/*TokenKind.INCR*/ == node.op.kind) ? 42/*To
kenKind.ADD*/ : 43/*TokenKind.SUB*/); |
| 9550 var operand = new LiteralExpression(1, new TypeReference(node.span, worl
d.numType), '1', node.span); | 9760 var operand = new LiteralExpression(1, new TypeReference(node.span, worl
d.numType), '1', node.span); |
| 9551 return this._visitAssign(kind, node.self, operand, node, to$call$1(null)
); | 9761 return this._visitAssign($assert_num(kind), node.self, (operand && opera
nd.is$lang_Expression()), node, to$call$1(null)); |
| 9552 } | 9762 } |
| 9553 | 9763 |
| 9554 case 19/*TokenKind.NOT*/: | 9764 case 19/*TokenKind.NOT*/: |
| 9555 | 9765 |
| 9556 if (value.type.get$isBool() && value.get$isConst()) { | 9766 if ($notnull_bool(value.type.get$isBool() && value.get$isConst())) { |
| 9557 var newVal = !value.get$actualValue(); | 9767 var newVal = !value.get$actualValue(); |
| 9558 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, ('' + n
ewVal + ''), node.span); | 9768 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, ('' + n
ewVal + ''), node.span); |
| 9559 } | 9769 } |
| 9560 else { | 9770 else { |
| 9561 return new Value(world.boolType, ('!' + value.code + ''), false, true, f
alse); | 9771 return new Value(world.boolType, ('!' + value.code + ''), false, true, f
alse); |
| 9562 } | 9772 } |
| 9563 | 9773 |
| 9564 case 42/*TokenKind.ADD*/: | 9774 case 42/*TokenKind.ADD*/: |
| 9565 case 43/*TokenKind.SUB*/: | 9775 case 43/*TokenKind.SUB*/: |
| 9566 case 18/*TokenKind.BIT_NOT*/: | 9776 case 18/*TokenKind.BIT_NOT*/: |
| 9567 | 9777 |
| 9568 if (value.type.get$isNum()) { | 9778 if ($notnull_bool(value.type.get$isNum())) { |
| 9569 if (value.get$isConst()) { | 9779 if ($notnull_bool(value.get$isConst())) { |
| 9570 if (node.op.kind == 42/*TokenKind.ADD*/) { | 9780 if ($notnull_bool(node.op.kind == 42/*TokenKind.ADD*/)) { |
| 9571 return value; | 9781 return value; |
| 9572 } | 9782 } |
| 9573 else if (node.op.kind == 43/*TokenKind.SUB*/) { | 9783 else if ($notnull_bool(node.op.kind == 43/*TokenKind.SUB*/)) { |
| 9574 var newVal = $negate(value.get$actualValue()); | 9784 var newVal = $negate(value.get$actualValue()); |
| 9575 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, (''
+ newVal + ''), node.span); | 9785 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, (''
+ newVal + ''), node.span); |
| 9576 } | 9786 } |
| 9577 else { | 9787 else { |
| 9578 var newVal = (~value.get$actualValue().toInt()).toDouble(); | 9788 var newVal = (~value.get$actualValue().toInt()).toDouble(); |
| 9579 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, (''
+ newVal + ''), node.span); | 9789 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, (''
+ newVal + ''), node.span); |
| 9580 } | 9790 } |
| 9581 } | 9791 } |
| 9582 return new Value(value.type, ('' + node.op + '' + value.code + ''), fals
e, true, false); | 9792 return new Value(value.type, ('' + node.op + '' + value.code + ''), fals
e, true, false); |
| 9583 } | 9793 } |
| 9584 else { | 9794 else { |
| 9585 var name; | 9795 var name; |
| 9586 if (node.op.kind == 18/*TokenKind.BIT_NOT*/) name = '\$bit_not'; | 9796 if ($notnull_bool(node.op.kind == 18/*TokenKind.BIT_NOT*/)) name = '\$bi
t_not'; |
| 9587 else if (node.op.kind == 43/*TokenKind.SUB*/) name = '\$negate'; | 9797 else if ($notnull_bool(node.op.kind == 43/*TokenKind.SUB*/)) name = '\$n
egate'; |
| 9588 else world.internalError(('unimplemented: unary ' + node.op + ' on var')
, node.span); | 9798 else world.internalError(('unimplemented: unary ' + node.op + ' on var')
, node.span); |
| 9589 return new Value(world.varType, ('' + name + '(' + value.code + ')'), fa
lse, true, false); | 9799 return new Value(world.varType, ('' + name + '(' + value.code + ')'), fa
lse, true, false); |
| 9590 } | 9800 } |
| 9591 | 9801 |
| 9592 default: | 9802 default: |
| 9593 | 9803 |
| 9594 world.internalError(('unimplemented: ' + node.op + ''), node.span); | 9804 world.internalError(('unimplemented: ' + node.op + ''), node.span); |
| 9595 | 9805 |
| 9596 } | 9806 } |
| 9597 } | 9807 } |
| 9598 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { | 9808 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { |
| 9599 var $this = this; // closure support | 9809 var $this = this; // closure support |
| 9600 var value = this.visitValue(node.body); | 9810 var value = this.visitValue(node.body); |
| 9601 if (value.type.get$isNum()) { | 9811 if ($notnull_bool(value.type.get$isNum())) { |
| 9602 return new Value(value.type, ('' + value.code + '' + node.op + ''), false, t
rue, false); | 9812 return new Value(value.type, ('' + value.code + '' + node.op + ''), false, t
rue, false); |
| 9603 } | 9813 } |
| 9604 var kind = (16/*TokenKind.INCR*/ == node.op.kind) ? 42/*TokenKind.ADD*/ : 43/*
TokenKind.SUB*/; | 9814 var kind = $notnull_bool((16/*TokenKind.INCR*/ == node.op.kind)) ? 42/*TokenKi
nd.ADD*/ : 43/*TokenKind.SUB*/; |
| 9605 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT
ype), '1', node.span); | 9815 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT
ype), '1', node.span); |
| 9606 var tmpleft = null, left = null; | 9816 var tmpleft = null, left = null; |
| 9607 var ret = this._visitAssign(kind, node.body, operand, node, (function (l) { | 9817 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand.
is$lang_Expression()), node, (function (l) { |
| 9608 if (isVoid) { | 9818 if ($notnull_bool(isVoid)) { |
| 9609 return l; | 9819 return l; |
| 9610 } | 9820 } |
| 9611 else { | 9821 else { |
| 9612 left = l; | 9822 left = l; |
| 9613 tmpleft = $this.forceTemp(l); | 9823 tmpleft = $this.forceTemp((l && l.is$Value())); |
| 9614 return $this.assignTemp(tmpleft, left); | 9824 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$
Value())); |
| 9615 } | 9825 } |
| 9616 }) | 9826 }) |
| 9617 ); | 9827 ); |
| 9618 if ($ne(tmpleft, null)) { | 9828 if ($notnull_bool($ne(tmpleft, null))) { |
| 9619 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), fals
e, true, false); | 9829 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), fals
e, true, false); |
| 9620 } | 9830 } |
| 9621 if ($ne(tmpleft, left)) { | 9831 if ($notnull_bool($ne(tmpleft, left))) { |
| 9622 this.freeTemp(tmpleft); | 9832 this.freeTemp((tmpleft && tmpleft.is$Value())); |
| 9623 } | 9833 } |
| 9624 return ret; | 9834 return ret; |
| 9625 } | 9835 } |
| 9626 MethodGenerator.prototype.visitNewExpression = function(node) { | 9836 MethodGenerator.prototype.visitNewExpression = function(node) { |
| 9837 var $0; |
| 9627 var typeRef = node.type; | 9838 var typeRef = node.type; |
| 9628 var constructorName = ''; | 9839 var constructorName = ''; |
| 9629 if (node.name != null) { | 9840 if ($notnull_bool(node.name != null)) { |
| 9630 constructorName = node.name.name; | 9841 constructorName = node.name.name; |
| 9631 } | 9842 } |
| 9632 if ($eq(constructorName, '') && !(typeRef instanceof GenericTypeReference) &&
typeRef.names != null) { | 9843 if ($notnull_bool($eq(constructorName, '') && !(typeRef instanceof GenericType
Reference) && typeRef.names != null)) { |
| 9633 var names = ListFactory.ListFactory$from$factory(typeRef.names); | 9844 var names = ListFactory.ListFactory$from$factory(typeRef.names); |
| 9634 constructorName = names.removeLast().get$name(); | 9845 constructorName = names.removeLast().get$name(); |
| 9635 if (names.length == 0) names = null; | 9846 if ($notnull_bool(names.length == 0)) names = null; |
| 9636 typeRef = new NameTypeReference(typeRef.isFinal, typeRef.get$name(), names,
typeRef.get$span()); | 9847 typeRef = new NameTypeReference(typeRef.isFinal, typeRef.get$name(), names,
typeRef.get$span()); |
| 9637 } | 9848 } |
| 9638 var type = this.method.resolveType(typeRef, true); | 9849 var type = this.method.resolveType(typeRef, true); |
| 9639 if (type.get$isTop()) { | 9850 if ($notnull_bool(type.get$isTop())) { |
| 9640 type = type.get$library().findTypeByName(constructorName); | 9851 type = type.get$library().findTypeByName($assert_String(constructorName)); |
| 9641 constructorName = ''; | 9852 constructorName = ''; |
| 9642 } | 9853 } |
| 9643 var m = type.getConstructor(constructorName); | 9854 var m = type.getConstructor(constructorName); |
| 9644 if (m == null) { | 9855 if ($notnull_bool(m == null)) { |
| 9645 var name = type.get$jsname(); | 9856 var name = type.get$jsname(); |
| 9646 if (type.get$isVar()) { | 9857 if ($notnull_bool(type.get$isVar())) { |
| 9647 name = typeRef.get$name().get$name(); | 9858 name = typeRef.get$name().get$name(); |
| 9648 } | 9859 } |
| 9649 world.error(('no matching constructor for ' + name + ''), node.span); | 9860 world.error(('no matching constructor for ' + name + ''), node.span); |
| 9650 return this._makeMissingValue(name); | 9861 return this._makeMissingValue($assert_String(name)); |
| 9651 } | 9862 } |
| 9652 if (node.isConst) { | 9863 if ($notnull_bool(node.isConst)) { |
| 9653 if (!m.get$isConst()) { | 9864 if ($notnull_bool(!m.get$isConst())) { |
| 9654 world.error('can\'t use const on a non-const constructor', node.span); | 9865 world.error('can\'t use const on a non-const constructor', node.span); |
| 9655 } | 9866 } |
| 9656 var $list = node.arguments; | 9867 var $list = node.arguments; |
| 9657 for (var $i = 0;$i < $list.length; $i++) { | 9868 for (var $i = 0;$i < $list.length; $i++) { |
| 9658 var arg = $list.$index($i); | 9869 var arg = $list.$index($i); |
| 9659 if (!this.visitValue(arg.get$value()).get$isConst()) { | 9870 if ($notnull_bool(!this.visitValue((($0 = arg.get$value()) && $0.is$lang_E
xpression())).get$isConst())) { |
| 9660 world.error('const constructor expects const arguments', arg.get$span())
; | 9871 world.error('const constructor expects const arguments', arg.get$span())
; |
| 9661 } | 9872 } |
| 9662 } | 9873 } |
| 9663 } | 9874 } |
| 9664 return m.invoke$4(this, node, null, this._makeArgs(node.arguments)); | 9875 return m.invoke$4(this, node, null, this._makeArgs(node.arguments)); |
| 9665 } | 9876 } |
| 9666 MethodGenerator.prototype.visitListExpression = function(node) { | 9877 MethodGenerator.prototype.visitListExpression = function(node) { |
| 9667 var argsCode = []; | 9878 var argsCode = []; |
| 9668 var argValues = []; | 9879 var argValues = []; |
| 9669 var $list = node.values; | 9880 var $list = node.values; |
| 9670 for (var $i = 0;$i < $list.length; $i++) { | 9881 for (var $i = 0;$i < $list.length; $i++) { |
| 9671 var item = $list.$index($i); | 9882 var item = $list.$index($i); |
| 9672 var arg = this.visitValue(item); | 9883 var arg = this.visitValue((item && item.is$lang_Expression())); |
| 9673 argValues.add(arg); | 9884 argValues.add(arg); |
| 9674 if (node.isConst) { | 9885 if ($notnull_bool(node.isConst)) { |
| 9675 if (!arg.get$isConst()) { | 9886 if ($notnull_bool(!arg.get$isConst())) { |
| 9676 world.error('const list can only contain const values', item.get$span())
; | 9887 world.error('const list can only contain const values', item.get$span())
; |
| 9677 argsCode.add(arg.code); | 9888 argsCode.add(arg.code); |
| 9678 } | 9889 } |
| 9679 else { | 9890 else { |
| 9680 argsCode.add(arg.canonicalCode); | 9891 argsCode.add(arg.canonicalCode); |
| 9681 } | 9892 } |
| 9682 } | 9893 } |
| 9683 else { | 9894 else { |
| 9684 argsCode.add(arg.code); | 9895 argsCode.add(arg.code); |
| 9685 } | 9896 } |
| 9686 } | 9897 } |
| 9687 world.get$coreimpl().types.$index('ListFactory').markUsed(); | 9898 world.get$coreimpl().types.$index('ListFactory').markUsed(); |
| 9688 var code = ('[' + Strings.join(argsCode, ", ") + ']'); | 9899 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ")
+ ']'); |
| 9689 var value = new Value(world.listType, code, false, true, false); | 9900 var value = new Value(world.listType, code, false, true, false); |
| 9690 if (node.isConst) { | 9901 if ($notnull_bool(node.isConst)) { |
| 9691 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); | 9902 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); |
| 9692 var immutableListCtor = immutableList.getConstructor('from'); | 9903 var immutableListCtor = immutableList.getConstructor('from'); |
| 9693 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null
, [value])); | 9904 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null
, [value])); |
| 9694 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory(immut
ableList, argValues, ('const ' + code + ''), result.code, node.span), argValues)
; | 9905 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory((immu
tableList && immutableList.is$lang_Type()), (argValues && argValues.is$List$Eval
uatedValue()), ('const ' + code + ''), result.code, node.span), (argValues && ar
gValues.is$List$Value())); |
| 9695 } | 9906 } |
| 9696 return value; | 9907 return value; |
| 9697 } | 9908 } |
| 9698 MethodGenerator.prototype.visitMapExpression = function(node) { | 9909 MethodGenerator.prototype.visitMapExpression = function(node) { |
| 9910 var $0; |
| 9699 var mapImplType = world.gen.useMapFactory(); | 9911 var mapImplType = world.gen.useMapFactory(); |
| 9700 var argValues = []; | 9912 var argValues = []; |
| 9701 var argsCode = []; | 9913 var argsCode = []; |
| 9702 for (var i = 0; | 9914 for (var i = 0; |
| 9703 i < node.items.length; i += 2) { | 9915 $notnull_bool(i < node.items.length); i += 2) { |
| 9704 var key = this.visitTypedValue(node.items.$index(i), world.stringType); | 9916 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex
pression()), world.stringType); |
| 9705 var valueItem = node.items.$index(i + 1); | 9917 var valueItem = node.items.$index(i + 1); |
| 9706 var value = this.visitValue(valueItem); | 9918 var value = this.visitValue((valueItem && valueItem.is$lang_Expression())); |
| 9707 argValues.add(key); | 9919 argValues.add(key); |
| 9708 argValues.add(value); | 9920 argValues.add(value); |
| 9709 if (node.isConst) { | 9921 if ($notnull_bool(node.isConst)) { |
| 9710 if (!key.get$isConst() || !value.get$isConst()) { | 9922 if ($notnull_bool(!key.get$isConst() || !value.get$isConst())) { |
| 9711 world.error('const map can only contain const values', valueItem.get$spa
n()); | 9923 world.error('const map can only contain const values', valueItem.get$spa
n()); |
| 9712 argsCode.add(key.code); | 9924 argsCode.add(key.code); |
| 9713 argsCode.add(value.code); | 9925 argsCode.add(value.code); |
| 9714 } | 9926 } |
| 9715 else { | 9927 else { |
| 9716 argsCode.add(key.canonicalCode); | 9928 argsCode.add(key.canonicalCode); |
| 9717 argsCode.add(value.canonicalCode); | 9929 argsCode.add(value.canonicalCode); |
| 9718 } | 9930 } |
| 9719 } | 9931 } |
| 9720 else { | 9932 else { |
| 9721 argsCode.add(key.code); | 9933 argsCode.add(key.code); |
| 9722 argsCode.add(value.code); | 9934 argsCode.add(value.code); |
| 9723 } | 9935 } |
| 9724 } | 9936 } |
| 9725 var argList = ('[' + Strings.join(argsCode, ", ") + ']'); | 9937 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ",
") + ']'); |
| 9726 var code = ('\$map(' + argList + ')'); | 9938 var code = ('\$map(' + argList + ')'); |
| 9727 if (node.isConst) { | 9939 if ($notnull_bool(node.isConst)) { |
| 9728 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap'); | 9940 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap'); |
| 9729 var immutableMapCtor = immutableMap.getConstructor(''); | 9941 var immutableMapCtor = immutableMap.getConstructor(''); |
| 9730 var argsValue = new Value(world.listType, argList, false, true, false); | 9942 var argsValue = new Value(world.listType, argList, false, true, false); |
| 9731 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null,
[argsValue])); | 9943 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null,
[argsValue])); |
| 9732 var value = ConstMapValue.ConstMapValue$factory(immutableMap, argValues, cod
e, result.code, node.span); | 9944 var value = ConstMapValue.ConstMapValue$factory((immutableMap && immutableMa
p.is$lang_Type()), (argValues && argValues.is$List$EvaluatedValue()), code, resu
lt.code, node.span); |
| 9733 return world.gen.globalForConst(value, argValues); | 9945 return world.gen.globalForConst(value, (argValues && argValues.is$List$Value
())); |
| 9734 } | 9946 } |
| 9735 return new Value(mapImplType, code, false, true, false); | 9947 return new Value(mapImplType, code, false, true, false); |
| 9736 } | 9948 } |
| 9737 MethodGenerator.prototype.visitConditionalExpression = function(node) { | 9949 MethodGenerator.prototype.visitConditionalExpression = function(node) { |
| 9950 var $0; |
| 9738 var test = this.visitBool(node.test); | 9951 var test = this.visitBool(node.test); |
| 9739 var trueBranch = this.visitValue(node.trueBranch); | 9952 var trueBranch = this.visitValue(node.trueBranch); |
| 9740 var falseBranch = this.visitValue(node.falseBranch); | 9953 var falseBranch = this.visitValue(node.falseBranch); |
| 9741 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod
e + ''); | 9954 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod
e + ''); |
| 9742 return new Value(lang_Type.union(trueBranch.type, falseBranch.type), code, fal
se, true, false); | 9955 return new Value(lang_Type.union((($0 = trueBranch.type) && $0.is$lang_Type())
, (($0 = falseBranch.type) && $0.is$lang_Type())), code, false, true, false); |
| 9743 } | 9956 } |
| 9744 MethodGenerator.prototype.visitIsExpression = function(node) { | 9957 MethodGenerator.prototype.visitIsExpression = function(node) { |
| 9745 var value = this.visitValue(node.x); | 9958 var value = this.visitValue(node.x); |
| 9746 var type = this.method.resolveType(node.type, false); | 9959 var type = this.method.resolveType(node.type, false); |
| 9747 return value.instanceOf(this, type, node.span, node.isTrue, false); | 9960 return value.instanceOf(this, (type && type.is$lang_Type()), node.span, node.i
sTrue, false); |
| 9748 } | 9961 } |
| 9749 MethodGenerator.prototype.visitParenExpression = function(node) { | 9962 MethodGenerator.prototype.visitParenExpression = function(node) { |
| 9750 var body = this.visitValue(node.body); | 9963 var body = this.visitValue(node.body); |
| 9751 if (body.get$isConst()) { | 9964 if ($notnull_bool(body.get$isConst())) { |
| 9752 return EvaluatedValue.EvaluatedValue$factory(body.type, body.get$actualValue
(), ('(' + body.canonicalCode + ')'), node.span); | 9965 return EvaluatedValue.EvaluatedValue$factory(body.type, body.get$actualValue
(), ('(' + body.canonicalCode + ')'), node.span); |
| 9753 } | 9966 } |
| 9754 return new Value(body.type, ('(' + body.code + ')'), false, true, false); | 9967 return new Value(body.type, ('(' + body.code + ')'), false, true, false); |
| 9755 } | 9968 } |
| 9756 MethodGenerator.prototype.visitDotExpression = function(node) { | 9969 MethodGenerator.prototype.visitDotExpression = function(node) { |
| 9757 var target = node.self.visit(this); | 9970 var target = node.self.visit(this); |
| 9758 return target.get_$3(this, node.name.name, node.name); | 9971 return target.get_$3(this, node.name.name, node.name); |
| 9759 } | 9972 } |
| 9760 MethodGenerator.prototype.visitVarExpression = function(node) { | 9973 MethodGenerator.prototype.visitVarExpression = function(node) { |
| 9761 var ret = this._scope.lookup(node.name.name); | 9974 var ret = this._scope.lookup(node.name.name); |
| 9762 if ($ne(ret, null)) return ret; | 9975 if ($notnull_bool($ne(ret, null))) return ret; |
| 9763 ret = this.method.declaringType.resolveMember(node.name.name); | 9976 ret = this.method.declaringType.resolveMember(node.name.name); |
| 9764 if ($ne(ret, null)) { | 9977 if ($notnull_bool($ne(ret, null))) { |
| 9765 return ret.get_$3(this, node, this._makeThisOrType()); | 9978 return ret.get_$3(this, node, this._makeThisOrType()); |
| 9766 } | 9979 } |
| 9767 ret = this.method.declaringType.get$library().lookup(node.name.name, node.span
); | 9980 ret = this.method.declaringType.get$library().lookup(node.name.name, node.span
); |
| 9768 if ($ne(ret, null)) { | 9981 if ($notnull_bool($ne(ret, null))) { |
| 9769 return ret.get_$3(this, node); | 9982 return ret.get_$3(this, node); |
| 9770 } | 9983 } |
| 9771 world.warning(('can not resolve ' + node.name.name + ''), node.span); | 9984 world.warning(('can not resolve ' + node.name.name + ''), node.span); |
| 9772 return this._makeMissingValue(node.name.name); | 9985 return this._makeMissingValue(node.name.name); |
| 9773 } | 9986 } |
| 9774 MethodGenerator.prototype._makeMissingValue = function(name) { | 9987 MethodGenerator.prototype._makeMissingValue = function(name) { |
| 9775 return new Value(null, ('' + name + '()/*NotFound*/'), false, true, false); | 9988 return new Value(null, ('' + name + '()/*NotFound*/'), false, true, false); |
| 9776 } | 9989 } |
| 9777 MethodGenerator.prototype._makeThisOrType = function() { | 9990 MethodGenerator.prototype._makeThisOrType = function() { |
| 9778 var outermost = this._getOutermostMethod(); | 9991 var outermost = this._getOutermostMethod(); |
| 9779 if (outermost.method.get$isStatic()) { | 9992 if ($notnull_bool(outermost.method.get$isStatic())) { |
| 9780 return this._makeTypeValue(outermost.method.declaringType); | 9993 return this._makeTypeValue(outermost.method.declaringType); |
| 9781 } | 9994 } |
| 9782 else { | 9995 else { |
| 9783 return this._makeThisValue(null); | 9996 return this._makeThisValue(null); |
| 9784 } | 9997 } |
| 9785 } | 9998 } |
| 9786 MethodGenerator.prototype._makeTypeValue = function(type) { | 9999 MethodGenerator.prototype._makeTypeValue = function(type) { |
| 9787 return new Value(type, type.get$jsname(), false, false, true); | 10000 return new Value(type, type.get$jsname(), false, false, true); |
| 9788 } | 10001 } |
| 9789 MethodGenerator.prototype.visitThisExpression = function(node) { | 10002 MethodGenerator.prototype.visitThisExpression = function(node) { |
| 9790 return this._makeThisValue(node); | 10003 return this._makeThisValue(node); |
| 9791 } | 10004 } |
| 9792 MethodGenerator.prototype.visitSuperExpression = function(node) { | 10005 MethodGenerator.prototype.visitSuperExpression = function(node) { |
| 9793 return this._makeSuperValue(node); | 10006 return this._makeSuperValue(node); |
| 9794 } | 10007 } |
| 9795 MethodGenerator.prototype.visitNullExpression = function(node) { | 10008 MethodGenerator.prototype.visitNullExpression = function(node) { |
| 9796 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null); | 10009 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null); |
| 9797 } | 10010 } |
| 9798 MethodGenerator.prototype.visitLiteralExpression = function(node) { | 10011 MethodGenerator.prototype.visitLiteralExpression = function(node) { |
| 9799 var $0; | 10012 var $0; |
| 9800 var type = node.type.type; | 10013 var type = node.type.type; |
| 9801 if (!!(($0 = node.value) && $0.is$List)) { | 10014 $assert($ne(type, null), "type != null", "gen.dart", 2018, 12); |
| 10015 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { |
| 9802 var items = []; | 10016 var items = []; |
| 9803 var $list = node.value; | 10017 var $list = node.value; |
| 9804 for (var $i = node.value.iterator(); $i.hasNext(); ) { | 10018 for (var $i = node.value.iterator(); $i.hasNext(); ) { |
| 9805 var item = $i.next(); | 10019 var item = $i.next(); |
| 9806 var val = this.visitValue(item); | 10020 var val = this.visitValue((item && item.is$lang_Expression())); |
| 9807 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); | 10021 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); |
| 9808 var code = val.code; | 10022 var code = val.code; |
| 9809 if ((item instanceof BinaryExpression) || (item instanceof ConditionalExpr
ession)) { | 10023 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C
onditionalExpression))) { |
| 9810 code = ('(' + code + ')'); | 10024 code = ('(' + code + ')'); |
| 9811 } | 10025 } |
| 9812 items.add(code); | 10026 items.add(code); |
| 9813 } | 10027 } |
| 9814 return new Value(type, ('(' + Strings.join(items, " + ") + ')'), false, true
, false); | 10028 return new Value(type, ('(' + Strings.join((items && items.is$List$String())
, " + ") + ')'), false, true, false); |
| 9815 } | 10029 } |
| 9816 var text = node.text; | 10030 var text = node.text; |
| 9817 if (type.get$isString()) { | 10031 if ($notnull_bool(type.get$isString())) { |
| 9818 if (text.startsWith('@')) { | 10032 if ($notnull_bool(text.startsWith('@'))) { |
| 9819 text = MethodGenerator._escapeString(parseStringLiteral(text)); | 10033 text = MethodGenerator._escapeString(parseStringLiteral($assert_String(tex
t))); |
| 9820 text = ('"' + text + '"'); | 10034 text = ('"' + text + '"'); |
| 9821 } | 10035 } |
| 9822 else if (isMultilineString(text)) { | 10036 else if ($notnull_bool(isMultilineString($assert_String(text)))) { |
| 9823 text = parseStringLiteral(text); | 10037 text = parseStringLiteral($assert_String(text)); |
| 9824 text = text.replaceAll('\n', '\\n'); | 10038 text = text.replaceAll('\n', '\\n'); |
| 9825 text = text.replaceAll('"', '\\"'); | 10039 text = text.replaceAll('"', '\\"'); |
| 9826 text = ('"' + text + '"'); | 10040 text = ('"' + text + '"'); |
| 9827 } | 10041 } |
| 9828 if (text !== node.text) { | 10042 if ($notnull_bool(text !== node.text)) { |
| 9829 node.value = text; | 10043 node.value = text; |
| 9830 node.text = text; | 10044 node.text = $assert_String(text); |
| 9831 } | 10045 } |
| 9832 } | 10046 } |
| 9833 return EvaluatedValue.EvaluatedValue$factory(type, node.value, node.text, null
); | 10047 return EvaluatedValue.EvaluatedValue$factory(type, node.value, node.text, null
); |
| 9834 } | 10048 } |
| 9835 MethodGenerator.prototype.visitPostfixExpression$1 = function($0) { | 10049 MethodGenerator.prototype.visitPostfixExpression$1 = function($0) { |
| 9836 return this.visitPostfixExpression($0, false); | 10050 return this.visitPostfixExpression(($0 && $0.is$PostfixExpression()), false); |
| 9837 } | 10051 } |
| 9838 ; | 10052 ; |
| 9839 // ********** Code for Arguments ************** | 10053 // ********** Code for Arguments ************** |
| 9840 function Arguments(nodes, values) { | 10054 function Arguments(nodes, values) { |
| 9841 this.nodes = nodes; | 10055 this.nodes = nodes; |
| 9842 this.values = values; | 10056 this.values = values; |
| 9843 // Initializers done | 10057 // Initializers done |
| 9844 } | 10058 } |
| 10059 Arguments.prototype.is$Arguments = function(){return this;}; |
| 9845 Arguments.Arguments$bare$factory = function(arity) { | 10060 Arguments.Arguments$bare$factory = function(arity) { |
| 9846 var values0 = []; | 10061 var values0 = []; |
| 9847 for (var i = 0; | 10062 for (var i = 0; |
| 9848 i < arity; i++) { | 10063 $notnull_bool(i < arity); i++) { |
| 9849 values0.add(new Value(world.varType, ('\$' + i + ''), false, false, false)); | 10064 values0.add(new Value(world.varType, ('\$' + i + ''), false, false, false)); |
| 9850 } | 10065 } |
| 9851 return new Arguments(null, values0); | 10066 return new Arguments(null, values0); |
| 9852 } | 10067 } |
| 9853 Arguments.get$EMPTY = function() { | 10068 Arguments.get$EMPTY = function() { |
| 9854 if (Arguments._empty == null) { | 10069 if ($notnull_bool(Arguments._empty == null)) { |
| 9855 Arguments._empty = new Arguments(null, []); | 10070 Arguments._empty = new Arguments(null, []); |
| 9856 } | 10071 } |
| 9857 return Arguments._empty; | 10072 return Arguments._empty; |
| 9858 } | 10073 } |
| 9859 Arguments.prototype.get$nameCount = function() { | 10074 Arguments.prototype.get$nameCount = function() { |
| 9860 return this.get$length() - this.get$bareCount(); | 10075 return this.get$length() - this.get$bareCount(); |
| 9861 } | 10076 } |
| 9862 Arguments.prototype.get$hasNames = function() { | 10077 Arguments.prototype.get$hasNames = function() { |
| 9863 return this.get$bareCount() < this.get$length(); | 10078 return this.get$bareCount() < this.get$length(); |
| 9864 } | 10079 } |
| 9865 Arguments.prototype.get$length = function() { | 10080 Arguments.prototype.get$length = function() { |
| 9866 return this.values.length; | 10081 return this.values.length; |
| 9867 } | 10082 } |
| 9868 Object.defineProperty(Arguments.prototype, "length", { | 10083 Object.defineProperty(Arguments.prototype, "length", { |
| 9869 get: Arguments.prototype.get$length, | 10084 get: Arguments.prototype.get$length, |
| 9870 }); | 10085 }); |
| 9871 Arguments.prototype.getName = function(i) { | 10086 Arguments.prototype.getName = function(i) { |
| 9872 return this.nodes.$index(i).label.name; | 10087 return this.nodes.$index(i).label.name; |
| 9873 } | 10088 } |
| 9874 Arguments.prototype.getIndexOfName = function(name) { | 10089 Arguments.prototype.getIndexOfName = function(name) { |
| 9875 for (var i = this.get$bareCount(); | 10090 for (var i = this.get$bareCount(); |
| 9876 i < this.get$length(); i++) { | 10091 $notnull_bool(i < this.get$length()); i++) { |
| 9877 if (this.getName(i) == name) { | 10092 if ($notnull_bool(this.getName(i) == name)) { |
| 9878 return i; | 10093 return i; |
| 9879 } | 10094 } |
| 9880 } | 10095 } |
| 9881 return -1; | 10096 return -1; |
| 9882 } | 10097 } |
| 9883 Arguments.prototype.getValue = function(name) { | 10098 Arguments.prototype.getValue = function(name) { |
| 9884 var i = this.getIndexOfName(name); | 10099 var i = this.getIndexOfName(name); |
| 9885 return i >= 0 ? this.values.$index(i) : null; | 10100 return $notnull_bool(i >= 0) ? this.values.$index(i) : null; |
| 9886 } | 10101 } |
| 9887 Arguments.prototype.get$bareCount = function() { | 10102 Arguments.prototype.get$bareCount = function() { |
| 9888 if (this._bareCount == null) { | 10103 if ($notnull_bool(this._bareCount == null)) { |
| 9889 this._bareCount = this.get$length(); | 10104 this._bareCount = this.get$length(); |
| 9890 if (this.nodes != null) { | 10105 if ($notnull_bool(this.nodes != null)) { |
| 9891 for (var i = 0; | 10106 for (var i = 0; |
| 9892 i < this.nodes.length; i++) { | 10107 $notnull_bool(i < this.nodes.length); i++) { |
| 9893 if (this.nodes.$index(i).label != null) { | 10108 if ($notnull_bool(this.nodes.$index(i).label != null)) { |
| 9894 this._bareCount = i; | 10109 this._bareCount = i; |
| 9895 break; | 10110 break; |
| 9896 } | 10111 } |
| 9897 } | 10112 } |
| 9898 } | 10113 } |
| 9899 } | 10114 } |
| 9900 return this._bareCount; | 10115 return this._bareCount; |
| 9901 } | 10116 } |
| 9902 Arguments.prototype.getCode = function() { | 10117 Arguments.prototype.getCode = function() { |
| 9903 var argsCode = []; | 10118 var argsCode = []; |
| 9904 for (var i = 0; | 10119 for (var i = 0; |
| 9905 i < this.get$length(); i++) { | 10120 $notnull_bool(i < this.get$length()); i++) { |
| 9906 argsCode.add(this.values.$index(i).code); | 10121 argsCode.add(this.values.$index(i).code); |
| 9907 } | 10122 } |
| 9908 Arguments.removeTrailingNulls(argsCode); | 10123 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); |
| 9909 return Strings.join(argsCode, ", "); | 10124 return Strings.join((argsCode && argsCode.is$List$String()), ", "); |
| 9910 } | 10125 } |
| 9911 Arguments.removeTrailingNulls = function(argsCode) { | 10126 Arguments.removeTrailingNulls = function(argsCode) { |
| 9912 while (argsCode.length > 0 && $eq(argsCode.last(), 'null')) { | 10127 while ($notnull_bool(argsCode.length > 0 && $eq(argsCode.last(), 'null'))) { |
| 9913 argsCode.removeLast(); | 10128 argsCode.removeLast(); |
| 9914 } | 10129 } |
| 9915 } | 10130 } |
| 9916 Arguments.prototype.getNames = function() { | 10131 Arguments.prototype.getNames = function() { |
| 9917 var names = []; | 10132 var names = []; |
| 9918 for (var i = this.get$bareCount(); | 10133 for (var i = this.get$bareCount(); |
| 9919 i < this.get$length(); i++) { | 10134 $notnull_bool(i < this.get$length()); i++) { |
| 9920 names.add(this.getName(i)); | 10135 names.add(this.getName(i)); |
| 9921 } | 10136 } |
| 9922 return names; | 10137 return names; |
| 9923 } | 10138 } |
| 9924 Arguments.prototype.toCallStubArgs = function() { | 10139 Arguments.prototype.toCallStubArgs = function() { |
| 9925 var result = []; | 10140 var result = []; |
| 9926 for (var i = 0; | 10141 for (var i = 0; |
| 9927 i < this.get$bareCount(); i++) { | 10142 $notnull_bool(i < this.get$bareCount()); i++) { |
| 9928 result.add(new Value(world.varType, ('\$' + i + ''), false, false, false)); | 10143 result.add(new Value(world.varType, ('\$' + i + ''), false, false, false)); |
| 9929 } | 10144 } |
| 9930 for (var i = this.get$bareCount(); | 10145 for (var i = this.get$bareCount(); |
| 9931 i < this.get$length(); i++) { | 10146 $notnull_bool(i < this.get$length()); i++) { |
| 9932 var name = this.getName(i); | 10147 var name = this.getName(i); |
| 9933 if (name == null) name = ('\$' + i + ''); | 10148 if ($notnull_bool(name == null)) name = ('\$' + i + ''); |
| 9934 result.add(new Value(world.varType, name, false, false, false)); | 10149 result.add(new Value(world.varType, name, false, false, false)); |
| 9935 } | 10150 } |
| 9936 return new Arguments(this.nodes, result); | 10151 return new Arguments(this.nodes, result); |
| 9937 } | 10152 } |
| 9938 // ********** Code for LibraryImport ************** | 10153 // ********** Code for LibraryImport ************** |
| 9939 function LibraryImport(library, prefix) { | 10154 function LibraryImport(library, prefix) { |
| 9940 this.library = library; | 10155 this.library = library; |
| 9941 this.prefix = prefix; | 10156 this.prefix = prefix; |
| 9942 // Initializers done | 10157 // Initializers done |
| 9943 } | 10158 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 9958 } | 10173 } |
| 9959 Library.prototype.get$name = function() { return this.name; }; | 10174 Library.prototype.get$name = function() { return this.name; }; |
| 9960 Library.prototype.set$name = function(value) { return this.name = value; }; | 10175 Library.prototype.set$name = function(value) { return this.name = value; }; |
| 9961 Library.prototype.get$isCore = function() { | 10176 Library.prototype.get$isCore = function() { |
| 9962 return $eq(this, world.corelib); | 10177 return $eq(this, world.corelib); |
| 9963 } | 10178 } |
| 9964 Library.prototype.get$isCoreImpl = function() { | 10179 Library.prototype.get$isCoreImpl = function() { |
| 9965 return $eq(this, world.get$coreimpl()); | 10180 return $eq(this, world.get$coreimpl()); |
| 9966 } | 10181 } |
| 9967 Library.prototype.get$jsname = function() { | 10182 Library.prototype.get$jsname = function() { |
| 9968 if (this._jsname == null) { | 10183 if ($notnull_bool(this._jsname == null)) { |
| 9969 this._jsname = this.name.replaceAll('.', '_').replaceAll(':', '_').replaceAl
l(' ', '_'); | 10184 this._jsname = this.name.replaceAll('.', '_').replaceAll(':', '_').replaceAl
l(' ', '_'); |
| 9970 } | 10185 } |
| 9971 return this._jsname; | 10186 return this._jsname; |
| 9972 } | 10187 } |
| 9973 Library.prototype.get$span = function() { | 10188 Library.prototype.get$span = function() { |
| 9974 return new SourceSpan(this.baseSource, 0, 0); | 10189 return new SourceSpan(this.baseSource, 0, 0); |
| 9975 } | 10190 } |
| 9976 Library.prototype.makeFullPath = function(filename) { | 10191 Library.prototype.makeFullPath = function(filename) { |
| 9977 if (filename.startsWith('dart:')) return filename; | 10192 if ($notnull_bool(filename.startsWith('dart:'))) return filename; |
| 9978 if (filename.startsWith('/')) return filename; | 10193 if ($notnull_bool(filename.startsWith('/'))) return filename; |
| 9979 if (filename.startsWith('file:///')) return filename; | 10194 if ($notnull_bool(filename.startsWith('file:///'))) return filename; |
| 9980 if (filename.startsWith('http://')) return filename; | 10195 if ($notnull_bool(filename.startsWith('http://'))) return filename; |
| 9981 return joinPaths(this.sourceDir, filename); | 10196 return joinPaths(this.sourceDir, filename); |
| 9982 } | 10197 } |
| 9983 Library.prototype.addImport = function(fullname, prefix) { | 10198 Library.prototype.addImport = function(fullname, prefix) { |
| 9984 this.imports.add(new LibraryImport(world.getOrAddLibrary(fullname), prefix)); | 10199 this.imports.add(new LibraryImport(world.getOrAddLibrary(fullname), prefix)); |
| 9985 } | 10200 } |
| 9986 Library.prototype.addNative = function(fullname) { | 10201 Library.prototype.addNative = function(fullname) { |
| 9987 this.natives.add(world.reader.readFile(fullname)); | 10202 this.natives.add(world.reader.readFile(fullname)); |
| 9988 } | 10203 } |
| 9989 Library.prototype._findMembers = function(name0) { | 10204 Library.prototype._findMembers = function(name0) { |
| 9990 if (name0.startsWith('_')) { | 10205 if ($notnull_bool(name0.startsWith('_'))) { |
| 9991 return this._privateMembers.$index(name0); | 10206 return this._privateMembers.$index(name0); |
| 9992 } | 10207 } |
| 9993 else { | 10208 else { |
| 9994 return world._members.$index(name0); | 10209 return world._members.$index(name0); |
| 9995 } | 10210 } |
| 9996 } | 10211 } |
| 9997 Library.prototype._addMember = function(member) { | 10212 Library.prototype._addMember = function(member) { |
| 9998 if (member.get$isPrivate()) { | 10213 var $0; |
| 9999 if (member.get$isStatic()) { | 10214 if ($notnull_bool(member.get$isPrivate())) { |
| 10000 if (member.declaringType.get$isTop()) { | 10215 if ($notnull_bool(member.get$isStatic())) { |
| 10216 if ($notnull_bool(member.declaringType.get$isTop())) { |
| 10001 world._addTopName(member); | 10217 world._addTopName(member); |
| 10002 } | 10218 } |
| 10003 return; | 10219 return; |
| 10004 } | 10220 } |
| 10005 var mset = this._privateMembers.$index(member.name); | 10221 var mset = this._privateMembers.$index(member.name); |
| 10006 if (mset == null) { | 10222 if ($notnull_bool(mset == null)) { |
| 10007 var $list = world.libraries.getValues(); | 10223 var $list = world.libraries.getValues(); |
| 10008 for (var $i = world.libraries.getValues().iterator(); $i.hasNext(); ) { | 10224 for (var $i = world.libraries.getValues().iterator(); $i.hasNext(); ) { |
| 10009 var lib = $i.next(); | 10225 var lib = $i.next(); |
| 10010 if (lib._privateMembers.containsKey(member.name)) { | 10226 if ($notnull_bool(lib._privateMembers.containsKey(member.name))) { |
| 10011 member.set$jsname(('_' + this.get$jsname() + '' + member.name + '')); | 10227 member.set$jsname(('_' + this.get$jsname() + '' + member.name + '')); |
| 10012 break; | 10228 break; |
| 10013 } | 10229 } |
| 10014 } | 10230 } |
| 10015 mset = new MemberSet(member); | 10231 mset = new MemberSet(member); |
| 10016 this._privateMembers.$setindex(member.name, mset); | 10232 this._privateMembers.$setindex(member.name, mset); |
| 10017 } | 10233 } |
| 10018 else { | 10234 else { |
| 10019 mset.members.add(member); | 10235 mset.members.add(member); |
| 10020 } | 10236 } |
| 10021 } | 10237 } |
| 10022 else { | 10238 else { |
| 10023 world._addMember(member); | 10239 world._addMember(member); |
| 10024 } | 10240 } |
| 10025 } | 10241 } |
| 10026 Library.prototype.getOrAddFunctionType = function(name0, func, inType) { | 10242 Library.prototype.getOrAddFunctionType = function(name0, func, inType) { |
| 10027 var def = new FunctionTypeDefinition(func, null, func.span); | 10243 var def = new FunctionTypeDefinition(func, null, func.span); |
| 10028 var type = new DefinedType(name0, this, def, false); | 10244 var type = new DefinedType(name0, this, def, false); |
| 10029 type.addMethod('\$call', func); | 10245 type.addMethod('\$call', func); |
| 10030 type.members.$index('\$call').resolve(inType); | 10246 type.members.$index('\$call').resolve(inType); |
| 10031 type.interfaces = [world.functionType]; | 10247 type.interfaces = [world.functionType]; |
| 10032 return type; | 10248 return type; |
| 10033 } | 10249 } |
| 10034 Library.prototype.addType = function(name0, definition, isClass) { | 10250 Library.prototype.addType = function(name0, definition, isClass) { |
| 10035 if (this.types.containsKey(name0)) { | 10251 if ($notnull_bool(this.types.containsKey(name0))) { |
| 10036 var existingType = this.types.$index(name0); | 10252 var existingType = this.types.$index(name0); |
| 10037 if (this.get$isCore() && existingType.get$definition() == null) { | 10253 if ($notnull_bool(this.get$isCore() && existingType.get$definition() == null
)) { |
| 10038 existingType.setDefinition(definition); | 10254 existingType.setDefinition((definition && definition.is$Definition())); |
| 10039 } | 10255 } |
| 10040 else { | 10256 else { |
| 10041 world.warning(('duplicate definition of ' + name0 + ''), definition.span); | 10257 world.warning(('duplicate definition of ' + name0 + ''), definition.span); |
| 10042 } | 10258 } |
| 10043 } | 10259 } |
| 10044 else { | 10260 else { |
| 10045 this.types.$setindex(name0, new DefinedType(name0, this, definition, isClass
)); | 10261 this.types.$setindex(name0, new DefinedType(name0, this, (definition && defi
nition.is$Definition()), isClass)); |
| 10046 } | 10262 } |
| 10047 return this.types.$index(name0); | 10263 return this.types.$index(name0); |
| 10048 } | 10264 } |
| 10049 Library.prototype.findType = function(type) { | 10265 Library.prototype.findType = function(type) { |
| 10050 var result = this.findTypeByName(type.name.name); | 10266 var result = this.findTypeByName(type.name.name); |
| 10051 if (result == null) return null; | 10267 if ($notnull_bool(result == null)) return null; |
| 10052 if (type.names != null) { | 10268 if ($notnull_bool(type.names != null)) { |
| 10053 if (type.names.length > 1) { | 10269 if ($notnull_bool(type.names.length > 1)) { |
| 10054 return null; | 10270 return null; |
| 10055 } | 10271 } |
| 10056 if (!result.get$isTop()) { | 10272 if ($notnull_bool(!result.get$isTop())) { |
| 10057 return null; | 10273 return null; |
| 10058 } | 10274 } |
| 10059 return result.get$library().findTypeByName(type.names.$index(0).get$name()); | 10275 return result.get$library().findTypeByName($assert_String(type.names.$index(
0).get$name())); |
| 10060 } | 10276 } |
| 10061 return result; | 10277 return result; |
| 10062 } | 10278 } |
| 10063 Library.prototype.findTypeByName = function(name0) { | 10279 Library.prototype.findTypeByName = function(name0) { |
| 10064 var ret = this.types.$index(name0); | 10280 var ret = this.types.$index(name0); |
| 10065 var $list = this.imports; | 10281 var $list = this.imports; |
| 10066 for (var $i = 0;$i < $list.length; $i++) { | 10282 for (var $i = 0;$i < $list.length; $i++) { |
| 10067 var imported = $list.$index($i); | 10283 var imported = $list.$index($i); |
| 10068 var newRet = null; | 10284 var newRet = null; |
| 10069 if (imported.prefix == null) { | 10285 if ($notnull_bool(imported.prefix == null)) { |
| 10070 newRet = imported.get$library().types.$index(name0); | 10286 newRet = imported.get$library().types.$index(name0); |
| 10071 } | 10287 } |
| 10072 else if (imported.prefix == name0) { | 10288 else if ($notnull_bool(imported.prefix == name0)) { |
| 10073 newRet = imported.get$library().topType; | 10289 newRet = imported.get$library().topType; |
| 10074 } | 10290 } |
| 10075 if ($ne(newRet, null)) { | 10291 if ($notnull_bool($ne(newRet, null))) { |
| 10076 if ($ne(ret, null) && $ne(ret, newRet)) { | 10292 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { |
| 10077 world.error(('conflicting types for "' + name0 + '"'), ret.get$span()); | 10293 world.error(('conflicting types for "' + name0 + '"'), ret.get$span()); |
| 10078 world.error(('conflicting types for "' + name0 + '"'), newRet.get$span()
); | 10294 world.error(('conflicting types for "' + name0 + '"'), newRet.get$span()
); |
| 10079 } | 10295 } |
| 10080 else { | 10296 else { |
| 10081 ret = newRet; | 10297 ret = newRet; |
| 10082 } | 10298 } |
| 10083 } | 10299 } |
| 10084 } | 10300 } |
| 10085 return ret; | 10301 return ret; |
| 10086 } | 10302 } |
| 10087 Library.prototype.lookup = function(name0, span0) { | 10303 Library.prototype.lookup = function(name0, span0) { |
| 10088 var retType = this.findTypeByName(name0); | 10304 var retType = this.findTypeByName(name0); |
| 10089 var ret = null; | 10305 var ret = null; |
| 10090 if ($ne(retType, null)) { | 10306 if ($notnull_bool($ne(retType, null))) { |
| 10091 ret = retType.get$typeMember(); | 10307 ret = retType.get$typeMember(); |
| 10092 } | 10308 } |
| 10093 var newRet = this.topType.getMember(name0); | 10309 var newRet = this.topType.getMember(name0); |
| 10094 if ($ne(newRet, null)) { | 10310 if ($notnull_bool($ne(newRet, null))) { |
| 10095 if ($ne(ret, null) && $ne(ret, newRet)) { | 10311 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { |
| 10096 world.error(('conflicting members for "' + name0 + '"'), span0); | 10312 world.error(('conflicting members for "' + name0 + '"'), span0); |
| 10097 world.error(('conflicting members for "' + name0 + '"'), ret.get$span()); | 10313 world.error(('conflicting members for "' + name0 + '"'), ret.get$span()); |
| 10098 world.error(('conflicting members for "' + name0 + '"'), newRet.get$span()
); | 10314 world.error(('conflicting members for "' + name0 + '"'), newRet.get$span()
); |
| 10099 } | 10315 } |
| 10100 else { | 10316 else { |
| 10101 ret = newRet; | 10317 ret = newRet; |
| 10102 } | 10318 } |
| 10103 } | 10319 } |
| 10104 var $list = this.imports; | 10320 var $list = this.imports; |
| 10105 for (var $i = 0;$i < $list.length; $i++) { | 10321 for (var $i = 0;$i < $list.length; $i++) { |
| 10106 var imported = $list.$index($i); | 10322 var imported = $list.$index($i); |
| 10107 if (imported.prefix == null) { | 10323 if ($notnull_bool(imported.prefix == null)) { |
| 10108 newRet = imported.get$library().topType.getMember(name0); | 10324 newRet = imported.get$library().topType.getMember(name0); |
| 10109 if ($ne(newRet, null)) { | 10325 if ($notnull_bool($ne(newRet, null))) { |
| 10110 if ($ne(ret, null) && $ne(ret, newRet)) { | 10326 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { |
| 10111 world.error(('conflicting members for "' + name0 + '"'), span0); | 10327 world.error(('conflicting members for "' + name0 + '"'), span0); |
| 10112 world.error(('conflicting members for "' + name0 + '"'), ret.get$span(
)); | 10328 world.error(('conflicting members for "' + name0 + '"'), ret.get$span(
)); |
| 10113 world.error(('conflicting members for "' + name0 + '"'), newRet.get$sp
an()); | 10329 world.error(('conflicting members for "' + name0 + '"'), newRet.get$sp
an()); |
| 10114 } | 10330 } |
| 10115 else { | 10331 else { |
| 10116 ret = newRet; | 10332 ret = newRet; |
| 10117 } | 10333 } |
| 10118 } | 10334 } |
| 10119 } | 10335 } |
| 10120 } | 10336 } |
| 10121 return ret; | 10337 return ret; |
| 10122 } | 10338 } |
| 10123 Library.prototype.resolve = function() { | 10339 Library.prototype.resolve = function() { |
| 10124 if (this.name == null) { | 10340 var $0; |
| 10341 if ($notnull_bool(this.name == null)) { |
| 10125 this.name = this.baseSource.filename; | 10342 this.name = this.baseSource.filename; |
| 10126 var index = this.name.lastIndexOf('/', this.name.length); | 10343 var index = this.name.lastIndexOf('/', this.name.length); |
| 10127 if (index >= 0) { | 10344 if ($notnull_bool(index >= 0)) { |
| 10128 this.name = this.name.substring(index + 1); | 10345 this.name = this.name.substring(index + 1); |
| 10129 } | 10346 } |
| 10130 index = this.name.indexOf('.', 0); | 10347 index = this.name.indexOf('.', 0); |
| 10131 if (index > 0) { | 10348 if ($notnull_bool(index > 0)) { |
| 10132 this.name = this.name.substring(0, index); | 10349 this.name = this.name.substring(0, index); |
| 10133 } | 10350 } |
| 10134 } | 10351 } |
| 10135 var $list = this.types.getValues(); | 10352 var $list = this.types.getValues(); |
| 10136 for (var $i = this.types.getValues().iterator(); $i.hasNext(); ) { | 10353 for (var $i = this.types.getValues().iterator(); $i.hasNext(); ) { |
| 10137 var type = $i.next(); | 10354 var type = $i.next(); |
| 10138 type.resolve(); | 10355 type.resolve(); |
| 10139 } | 10356 } |
| 10140 } | 10357 } |
| 10141 Library.prototype.toString = function() { | 10358 Library.prototype.toString = function() { |
| 10142 return this.baseSource.filename; | 10359 return this.baseSource.filename; |
| 10143 } | 10360 } |
| 10144 // ********** Code for LibraryVisitor ************** | 10361 // ********** Code for LibraryVisitor ************** |
| 10145 function LibraryVisitor(library) { | 10362 function LibraryVisitor(library) { |
| 10146 this.library = library; | 10363 this.library = library; |
| 10147 // Initializers done | 10364 // Initializers done |
| 10148 this.currentType = this.library.topType; | 10365 this.currentType = this.library.topType; |
| 10149 this.sources = []; | 10366 this.sources = []; |
| 10150 this.addSource(this.library.baseSource); | 10367 this.addSource(this.library.baseSource); |
| 10151 } | 10368 } |
| 10152 LibraryVisitor.prototype.get$library = function() { return this.library; }; | 10369 LibraryVisitor.prototype.get$library = function() { return this.library; }; |
| 10153 LibraryVisitor.prototype.addSourceFromName = function(name) { | 10370 LibraryVisitor.prototype.addSourceFromName = function(name) { |
| 10154 var source = world.readFile(this.library.makeFullPath(name)); | 10371 var source = world.readFile(this.library.makeFullPath(name)); |
| 10155 this.sources.add(source); | 10372 this.sources.add(source); |
| 10156 } | 10373 } |
| 10157 LibraryVisitor.prototype.addSource = function(source) { | 10374 LibraryVisitor.prototype.addSource = function(source) { |
| 10375 var $0; |
| 10158 this.library.sources.add(source); | 10376 this.library.sources.add(source); |
| 10159 var parser = new lang_Parser(source, options.dietParse, 0); | 10377 var parser = new lang_Parser(source, options.dietParse, 0); |
| 10160 var unit = parser.compilationUnit(); | 10378 var unit = parser.compilationUnit(); |
| 10161 for (var $i = 0;$i < unit.length; $i++) { | 10379 for (var $i = 0;$i < unit.length; $i++) { |
| 10162 var def = unit.$index($i); | 10380 var def = unit.$index($i); |
| 10163 def.visit(this); | 10381 def.visit(this); |
| 10164 } | 10382 } |
| 10165 var newSources = this.sources; | 10383 var newSources = this.sources; |
| 10166 this.sources = []; | 10384 this.sources = []; |
| 10167 for (var $i = newSources.iterator(); $i.hasNext(); ) { | 10385 for (var $i = newSources.iterator(); $i.hasNext(); ) { |
| 10168 var source0 = $i.next(); | 10386 var source0 = $i.next(); |
| 10169 this.addSource(source0); | 10387 this.addSource((source0 && source0.is$SourceFile())); |
| 10170 } | 10388 } |
| 10171 } | 10389 } |
| 10172 LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { | 10390 LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { |
| 10173 var name; | 10391 var name; |
| 10174 switch (node.name.name) { | 10392 switch (node.name.name) { |
| 10175 case "library": | 10393 case "library": |
| 10176 | 10394 |
| 10177 name = this.getSingleStringArg(node); | 10395 name = this.getSingleStringArg(node); |
| 10178 if (this.library.name == null) { | 10396 if ($notnull_bool(this.library.name == null)) { |
| 10179 this.library.name = name; | 10397 this.library.name = $assert_String(name); |
| 10180 if ($eq(name, 'node') || $eq(name, 'dom')) { | 10398 if ($notnull_bool($eq(name, 'node') || $eq(name, 'dom'))) { |
| 10181 this.library.topType.isNativeType = true; | 10399 this.library.topType.isNativeType = true; |
| 10182 } | 10400 } |
| 10183 } | 10401 } |
| 10184 else { | 10402 else { |
| 10185 world.error('already specified library name', node.span); | 10403 world.error('already specified library name', node.span); |
| 10186 } | 10404 } |
| 10187 break; | 10405 break; |
| 10188 | 10406 |
| 10189 case "import": | 10407 case "import": |
| 10190 | 10408 |
| 10191 name = this.getFirstStringArg(node); | 10409 name = this.getFirstStringArg(node); |
| 10192 var prefix = this.tryGetNamedStringArg(node, 'prefix'); | 10410 var prefix = this.tryGetNamedStringArg(node, 'prefix'); |
| 10193 if (node.arguments.length > 2 || node.arguments.length == 2 && prefix == n
ull) { | 10411 if ($notnull_bool(node.arguments.length > 2 || node.arguments.length == 2
&& prefix == null)) { |
| 10194 world.error('expected at most one "name" argument and one optional "pref
ix"' + (' but found ' + node.arguments.length + ''), node.span); | 10412 world.error('expected at most one "name" argument and one optional "pref
ix"' + (' but found ' + node.arguments.length + ''), node.span); |
| 10195 } | 10413 } |
| 10196 else if ($ne(prefix, null) && prefix.indexOf('.', 0) >= 0) { | 10414 else if ($notnull_bool($ne(prefix, null) && prefix.indexOf('.', 0) >= 0))
{ |
| 10197 world.error('library prefix canot contain "."', node.span); | 10415 world.error('library prefix canot contain "."', node.span); |
| 10198 } | 10416 } |
| 10199 if ($eq(prefix, '')) prefix = null; | 10417 if ($notnull_bool($eq(prefix, ''))) prefix = null; |
| 10200 this.library.addImport(this.library.makeFullPath(name), prefix); | 10418 this.library.addImport(this.library.makeFullPath($assert_String(name)), $a
ssert_String(prefix)); |
| 10201 break; | 10419 break; |
| 10202 | 10420 |
| 10203 case "source": | 10421 case "source": |
| 10204 | 10422 |
| 10205 name = this.getSingleStringArg(node); | 10423 name = this.getSingleStringArg(node); |
| 10206 this.addSourceFromName(name); | 10424 this.addSourceFromName($assert_String(name)); |
| 10207 break; | 10425 break; |
| 10208 | 10426 |
| 10209 case "native": | 10427 case "native": |
| 10210 | 10428 |
| 10211 name = this.getSingleStringArg(node); | 10429 name = this.getSingleStringArg(node); |
| 10212 this.library.addNative(this.library.makeFullPath(name)); | 10430 this.library.addNative(this.library.makeFullPath($assert_String(name))); |
| 10213 break; | 10431 break; |
| 10214 | 10432 |
| 10215 case "resource": | 10433 case "resource": |
| 10216 | 10434 |
| 10217 this.getFirstStringArg(node); | 10435 this.getFirstStringArg(node); |
| 10218 break; | 10436 break; |
| 10219 | 10437 |
| 10220 default: | 10438 default: |
| 10221 | 10439 |
| 10222 world.error(('unknown directive: ' + node.name.name + ''), node.span); | 10440 world.error(('unknown directive: ' + node.name.name + ''), node.span); |
| 10223 | 10441 |
| 10224 } | 10442 } |
| 10225 } | 10443 } |
| 10226 LibraryVisitor.prototype.getSingleStringArg = function(node) { | 10444 LibraryVisitor.prototype.getSingleStringArg = function(node) { |
| 10227 if (node.arguments.length != 1) { | 10445 if ($notnull_bool(node.arguments.length != 1)) { |
| 10228 world.error(('expected exactly one argument but found ' + node.arguments.len
gth + ''), node.span); | 10446 world.error(('expected exactly one argument but found ' + node.arguments.len
gth + ''), node.span); |
| 10229 } | 10447 } |
| 10230 return this.getFirstStringArg(node); | 10448 return this.getFirstStringArg(node); |
| 10231 } | 10449 } |
| 10232 LibraryVisitor.prototype.getFirstStringArg = function(node) { | 10450 LibraryVisitor.prototype.getFirstStringArg = function(node) { |
| 10233 if (node.arguments.length < 1) { | 10451 if ($notnull_bool(node.arguments.length < 1)) { |
| 10234 world.error(('expected at least one argument but found ' + node.arguments.le
ngth + ''), node.span); | 10452 world.error(('expected at least one argument but found ' + node.arguments.le
ngth + ''), node.span); |
| 10235 } | 10453 } |
| 10236 var arg = node.arguments.$index(0); | 10454 var arg = node.arguments.$index(0); |
| 10237 if (arg.label != null) { | 10455 if ($notnull_bool(arg.label != null)) { |
| 10238 world.error('label not allowed for directive', node.span); | 10456 world.error('label not allowed for directive', node.span); |
| 10239 } | 10457 } |
| 10240 return this._parseStringArgument(arg); | 10458 return this._parseStringArgument((arg && arg.is$ArgumentNode())); |
| 10241 } | 10459 } |
| 10242 LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { | 10460 LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { |
| 10461 var $0; |
| 10243 var args = node.arguments.filter((function (a) { | 10462 var args = node.arguments.filter((function (a) { |
| 10244 return a.label != null && a.label.name == argName; | 10463 return a.label != null && a.label.name == argName; |
| 10245 }) | 10464 }) |
| 10246 ); | 10465 ); |
| 10247 if (args.length == 0) { | 10466 if ($notnull_bool(args.length == 0)) { |
| 10248 return null; | 10467 return null; |
| 10249 } | 10468 } |
| 10250 if (args.length > 1) { | 10469 if ($notnull_bool(args.length > 1)) { |
| 10251 world.error(('expected at most one "' + argName + '" argument but found ') +
node.arguments.length, node.span); | 10470 world.error(('expected at most one "' + argName + '" argument but found ') +
node.arguments.length, node.span); |
| 10252 } | 10471 } |
| 10253 for (var $i = args.iterator(); $i.hasNext(); ) { | 10472 for (var $i = args.iterator(); $i.hasNext(); ) { |
| 10254 var arg = $i.next(); | 10473 var arg = $i.next(); |
| 10255 return this._parseStringArgument(arg); | 10474 return this._parseStringArgument((arg && arg.is$ArgumentNode())); |
| 10256 } | 10475 } |
| 10257 } | 10476 } |
| 10258 LibraryVisitor.prototype._parseStringArgument = function(arg) { | 10477 LibraryVisitor.prototype._parseStringArgument = function(arg) { |
| 10259 var expr = arg.value; | 10478 var expr = arg.value; |
| 10260 if (!(expr instanceof LiteralExpression) || !expr.type.type.get$isString()) { | 10479 if ($notnull_bool(!(expr instanceof LiteralExpression) || !expr.type.type.get$
isString())) { |
| 10261 world.error('expected string', expr.get$span()); | 10480 world.error('expected string', expr.get$span()); |
| 10262 } | 10481 } |
| 10263 return parseStringLiteral(expr.get$value()); | 10482 return parseStringLiteral($assert_String(expr.get$value())); |
| 10264 } | 10483 } |
| 10265 LibraryVisitor.prototype.visitTypeDefinition = function(node) { | 10484 LibraryVisitor.prototype.visitTypeDefinition = function(node) { |
| 10266 var oldType = this.currentType; | 10485 var oldType = this.currentType; |
| 10267 this.currentType = this.library.addType(node.name.name, node, node.isClass); | 10486 this.currentType = this.library.addType(node.name.name, node, node.isClass); |
| 10268 var $list = node.body; | 10487 var $list = node.body; |
| 10269 for (var $i = 0;$i < $list.length; $i++) { | 10488 for (var $i = 0;$i < $list.length; $i++) { |
| 10270 var member = $list.$index($i); | 10489 var member = $list.$index($i); |
| 10271 member.visit(this); | 10490 member.visit(this); |
| 10272 } | 10491 } |
| 10273 this.currentType = oldType; | 10492 this.currentType = (oldType && oldType.is$lang_Type()); |
| 10274 } | 10493 } |
| 10275 LibraryVisitor.prototype.visitVariableDefinition = function(node) { | 10494 LibraryVisitor.prototype.visitVariableDefinition = function(node) { |
| 10276 this.currentType.addField(node); | 10495 this.currentType.addField(node); |
| 10277 } | 10496 } |
| 10278 LibraryVisitor.prototype.visitFunctionDefinition = function(node) { | 10497 LibraryVisitor.prototype.visitFunctionDefinition = function(node) { |
| 10279 this.currentType.addMethod(node.name.name, node); | 10498 this.currentType.addMethod(node.name.name, node); |
| 10280 } | 10499 } |
| 10281 LibraryVisitor.prototype.visitFunctionTypeDefinition = function(node) { | 10500 LibraryVisitor.prototype.visitFunctionTypeDefinition = function(node) { |
| 10282 var type = this.library.addType(node.func.name.name, node, false); | 10501 var type = this.library.addType(node.func.name.name, node, false); |
| 10283 type.addMethod('\$call', node.func); | 10502 type.addMethod('\$call', node.func); |
| 10284 } | 10503 } |
| 10285 // ********** Code for lang_Parameter ************** | 10504 // ********** Code for lang_Parameter ************** |
| 10286 function lang_Parameter(definition) { | 10505 function lang_Parameter(definition) { |
| 10287 this.definition = definition; | 10506 this.definition = definition; |
| 10288 // Initializers done | 10507 // Initializers done |
| 10289 } | 10508 } |
| 10290 lang_Parameter.prototype.get$definition = function() { return this.definition; }
; | 10509 lang_Parameter.prototype.get$definition = function() { return this.definition; }
; |
| 10291 lang_Parameter.prototype.set$definition = function(value) { return this.definiti
on = value; }; | 10510 lang_Parameter.prototype.set$definition = function(value) { return this.definiti
on = value; }; |
| 10292 lang_Parameter.prototype.get$name = function() { return this.name; }; | 10511 lang_Parameter.prototype.get$name = function() { return this.name; }; |
| 10293 lang_Parameter.prototype.set$name = function(value) { return this.name = value;
}; | 10512 lang_Parameter.prototype.set$name = function(value) { return this.name = value;
}; |
| 10294 lang_Parameter.prototype.get$value = function() { return this.value; }; | 10513 lang_Parameter.prototype.get$value = function() { return this.value; }; |
| 10295 lang_Parameter.prototype.set$value = function(value) { return this.value = value
; }; | 10514 lang_Parameter.prototype.set$value = function(value) { return this.value = value
; }; |
| 10296 lang_Parameter.prototype.resolve = function(inType) { | 10515 lang_Parameter.prototype.resolve = function(inType) { |
| 10297 this.name = this.definition.name.name; | 10516 this.name = this.definition.name.name; |
| 10298 this.type = inType.resolveType(this.definition.type, false); | 10517 this.type = inType.resolveType(this.definition.type, false); |
| 10299 } | 10518 } |
| 10300 lang_Parameter.prototype.genValue = function(method, context) { | 10519 lang_Parameter.prototype.genValue = function(method, context) { |
| 10301 if (this.definition.value == null || this.value != null) return; | 10520 var $0; |
| 10302 if (context == null) { | 10521 if ($notnull_bool(this.definition.value == null || this.value != null)) return
; |
| 10522 if ($notnull_bool(context == null)) { |
| 10303 context = new MethodGenerator(method, null); | 10523 context = new MethodGenerator(method, null); |
| 10304 } | 10524 } |
| 10305 this.value = this.definition.value.visit(context); | 10525 this.value = (($0 = this.definition.value.visit(context)) && $0.is$Value()); |
| 10306 this.value = this.value.convertTo(context, this.type, this.definition.value, f
alse); | 10526 this.value = this.value.convertTo(context, this.type, this.definition.value, f
alse); |
| 10307 } | 10527 } |
| 10308 lang_Parameter.prototype.copyWithNewType = function(newType) { | 10528 lang_Parameter.prototype.copyWithNewType = function(newType) { |
| 10309 var ret = new lang_Parameter(this.definition); | 10529 var ret = new lang_Parameter(this.definition); |
| 10310 ret.type = newType; | 10530 ret.type = newType; |
| 10311 ret.name = this.name; | 10531 ret.name = this.name; |
| 10312 return ret; | 10532 return ret; |
| 10313 } | 10533 } |
| 10314 lang_Parameter.prototype.get$isOptional = function() { | 10534 lang_Parameter.prototype.get$isOptional = function() { |
| 10315 return this.definition != null && this.definition.value != null; | 10535 return this.definition != null && this.definition.value != null; |
| 10316 } | 10536 } |
| 10317 // ********** Code for Member ************** | 10537 // ********** Code for Member ************** |
| 10318 function Member(name, declaringType) { | 10538 function Member(name, declaringType) { |
| 10319 this.name = name; | 10539 this.name = name; |
| 10320 this.declaringType = declaringType; | 10540 this.declaringType = declaringType; |
| 10321 this.isGenerated = false; | 10541 this.isGenerated = false; |
| 10322 // Initializers done | 10542 // Initializers done |
| 10323 } | 10543 } |
| 10544 Member.prototype.is$Member = function(){return this;}; |
| 10545 Member.prototype.is$Named = function(){return this;}; |
| 10324 Member.prototype.get$name = function() { return this.name; }; | 10546 Member.prototype.get$name = function() { return this.name; }; |
| 10325 Member.prototype.get$jsname = function() { | 10547 Member.prototype.get$jsname = function() { |
| 10326 return this._jsname == null ? this.name : this._jsname; | 10548 return $notnull_bool(this._jsname == null) ? this.name : this._jsname; |
| 10327 } | 10549 } |
| 10328 Member.prototype.set$jsname = function(name0) { | 10550 Member.prototype.set$jsname = function(name0) { |
| 10329 return this._jsname = name0; | 10551 return this._jsname = name0; |
| 10330 } | 10552 } |
| 10331 Member.prototype.get$library = function() { | 10553 Member.prototype.get$library = function() { |
| 10332 return this.declaringType.get$library(); | 10554 return this.declaringType.get$library(); |
| 10333 } | 10555 } |
| 10334 Member.prototype.get$isPrivate = function() { | 10556 Member.prototype.get$isPrivate = function() { |
| 10335 return this.name.startsWith('_'); | 10557 return this.name.startsWith('_'); |
| 10336 } | 10558 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10374 return []; | 10596 return []; |
| 10375 } | 10597 } |
| 10376 Member.prototype.canInvoke = function(context, args) { | 10598 Member.prototype.canInvoke = function(context, args) { |
| 10377 return this.get$canGet() && new Value(this.get$returnType(), null, false, true
, false).canInvoke(context, '\$call', args); | 10599 return this.get$canGet() && new Value(this.get$returnType(), null, false, true
, false).canInvoke(context, '\$call', args); |
| 10378 } | 10600 } |
| 10379 Member.prototype.invoke = function(context, node, target, args, isDynamic) { | 10601 Member.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 10380 var newTarget = this.get_(context, node, target, isDynamic); | 10602 var newTarget = this.get_(context, node, target, isDynamic); |
| 10381 return newTarget.invoke(context, '\$call', node, args, isDynamic); | 10603 return newTarget.invoke(context, '\$call', node, args, isDynamic); |
| 10382 } | 10604 } |
| 10383 Member.prototype.override = function(other) { | 10605 Member.prototype.override = function(other) { |
| 10384 if (this.get$isStatic()) { | 10606 if ($notnull_bool(this.get$isStatic())) { |
| 10385 world.error('static members can not hide parent members', this.get$span(), o
ther.get$span()); | 10607 world.error('static members can not hide parent members', this.get$span(), o
ther.get$span()); |
| 10386 return false; | 10608 return false; |
| 10387 } | 10609 } |
| 10388 else if (other.get$isStatic()) { | 10610 else if ($notnull_bool(other.get$isStatic())) { |
| 10389 world.error('can not override static member', this.get$span(), other.get$spa
n()); | 10611 world.error('can not override static member', this.get$span(), other.get$spa
n()); |
| 10390 return false; | 10612 return false; |
| 10391 } | 10613 } |
| 10392 return true; | 10614 return true; |
| 10393 } | 10615 } |
| 10394 Member.prototype.get$generatedFactoryName = function() { | 10616 Member.prototype.get$generatedFactoryName = function() { |
| 10617 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 132, 12); |
| 10395 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo
rName() + '\$'); | 10618 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo
rName() + '\$'); |
| 10396 if (this.name == '') { | 10619 if ($notnull_bool(this.name == '')) { |
| 10397 return ('' + prefix + 'factory'); | 10620 return ('' + prefix + 'factory'); |
| 10398 } | 10621 } |
| 10399 else { | 10622 else { |
| 10400 return ('' + prefix + '' + this.name + '\$factory'); | 10623 return ('' + prefix + '' + this.name + '\$factory'); |
| 10401 } | 10624 } |
| 10402 } | 10625 } |
| 10403 Member.prototype.get_$3 = Member.prototype.get_; | 10626 Member.prototype.get_$3 = function($0, $1, $2) { |
| 10404 Member.prototype.invoke$4 = function($0, $1, $2, $3) { | 10627 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value())); |
| 10405 return this.invoke($0, $1, $2, $3, false); | |
| 10406 } | 10628 } |
| 10407 ; | 10629 ; |
| 10408 Member.prototype.set_$4 = Member.prototype.set_; | 10630 Member.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 10631 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); |
| 10632 } |
| 10633 ; |
| 10634 Member.prototype.set_$4 = function($0, $1, $2, $3) { |
| 10635 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value())); |
| 10636 } |
| 10637 ; |
| 10409 // ********** Code for TypeMember ************** | 10638 // ********** Code for TypeMember ************** |
| 10410 function TypeMember(type0) { | 10639 function TypeMember(type0) { |
| 10411 this.type = type0; | 10640 this.type = type0; |
| 10412 Member.call(this, type0.name, type0.library.topType); | 10641 Member.call(this, type0.name, type0.library.topType); |
| 10413 // Initializers done | 10642 // Initializers done |
| 10414 } | 10643 } |
| 10415 $inherits(TypeMember, Member); | 10644 $inherits(TypeMember, Member); |
| 10416 TypeMember.prototype.get$span = function() { | 10645 TypeMember.prototype.get$span = function() { |
| 10417 return this.type.definition.span; | 10646 return this.type.definition.span; |
| 10418 } | 10647 } |
| 10419 TypeMember.prototype.get$isStatic = function() { | 10648 TypeMember.prototype.get$isStatic = function() { |
| 10420 return true; | 10649 return true; |
| 10421 } | 10650 } |
| 10422 TypeMember.prototype.get$returnType = function() { | 10651 TypeMember.prototype.get$returnType = function() { |
| 10423 return world.get$isVar(); | 10652 return world.get$isVar(); |
| 10424 } | 10653 } |
| 10425 TypeMember.prototype.canInvoke = function(context, args) { | 10654 TypeMember.prototype.canInvoke = function(context, args) { |
| 10426 return false; | 10655 return false; |
| 10427 } | 10656 } |
| 10428 TypeMember.prototype.get$canGet = function() { | 10657 TypeMember.prototype.get$canGet = function() { |
| 10429 return true; | 10658 return true; |
| 10430 } | 10659 } |
| 10431 TypeMember.prototype.get$canSet = function() { | 10660 TypeMember.prototype.get$canSet = function() { |
| 10432 return false; | 10661 return false; |
| 10433 } | 10662 } |
| 10434 TypeMember.prototype.resolve = function(inType) { | 10663 TypeMember.prototype.resolve = function(inType) { |
| 10435 | 10664 |
| 10436 } | 10665 } |
| 10437 TypeMember.prototype.get_ = function(context, node, target, isDynamic) { | 10666 TypeMember.prototype.get_ = function(context, node, target, isDynamic) { |
| 10667 $assert(target == null || target.type.get$isTop(), "target == null || target.t
ype.isTop", "member.dart", 170, 12); |
| 10438 return new Value(this.type, this.type.get$jsname(), false, false, true); | 10668 return new Value(this.type, this.type.get$jsname(), false, false, true); |
| 10439 } | 10669 } |
| 10440 TypeMember.prototype.set_ = function(context, node, target, value, isDynamic) { | 10670 TypeMember.prototype.set_ = function(context, node, target, value, isDynamic) { |
| 10441 world.error('can not set type', this.type.definition.span); | 10671 world.error('can not set type', this.type.definition.span); |
| 10442 } | 10672 } |
| 10443 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { | 10673 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 10444 world.error('can not invoke type', this.type.definition.span); | 10674 world.error('can not invoke type', this.type.definition.span); |
| 10445 } | 10675 } |
| 10446 TypeMember.prototype.get_$3 = function($0, $1, $2) { | 10676 TypeMember.prototype.get_$3 = function($0, $1, $2) { |
| 10447 return this.get_($0, $1, $2, false); | 10677 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 10448 } | 10678 } |
| 10449 ; | 10679 ; |
| 10450 TypeMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 10680 TypeMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 10451 return this.invoke($0, $1, $2, $3, false); | 10681 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); |
| 10452 } | 10682 } |
| 10453 ; | 10683 ; |
| 10454 TypeMember.prototype.set_$4 = function($0, $1, $2, $3) { | 10684 TypeMember.prototype.set_$4 = function($0, $1, $2, $3) { |
| 10455 return this.set_($0, $1, $2, $3, false); | 10685 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 10456 } | 10686 } |
| 10457 ; | 10687 ; |
| 10458 // ********** Code for FieldMember ************** | 10688 // ********** Code for FieldMember ************** |
| 10459 function FieldMember(name0, declaringType0, definition, value) { | 10689 function FieldMember(name0, declaringType0, definition, value) { |
| 10460 this._providePropertySyntax = false | 10690 this._providePropertySyntax = false |
| 10461 this._computing = false | 10691 this._computing = false |
| 10462 this.definition = definition; | 10692 this.definition = definition; |
| 10463 this.value = value; | 10693 this.value = value; |
| 10464 this.isNative = false; | 10694 this.isNative = false; |
| 10465 Member.call(this, name0, declaringType0); | 10695 Member.call(this, name0, declaringType0); |
| 10466 // Initializers done | 10696 // Initializers done |
| 10467 } | 10697 } |
| 10468 $inherits(FieldMember, Member); | 10698 $inherits(FieldMember, Member); |
| 10699 FieldMember.prototype.is$FieldMember = function(){return this;}; |
| 10469 FieldMember.prototype.get$definition = function() { return this.definition; }; | 10700 FieldMember.prototype.get$definition = function() { return this.definition; }; |
| 10470 FieldMember.prototype.get$value = function() { return this.value; }; | 10701 FieldMember.prototype.get$value = function() { return this.value; }; |
| 10471 FieldMember.prototype.get$isStatic = function() { return this.isStatic; }; | 10702 FieldMember.prototype.get$isStatic = function() { return this.isStatic; }; |
| 10472 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va
lue; }; | 10703 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va
lue; }; |
| 10473 FieldMember.prototype.get$isNative = function() { return this.isNative; }; | 10704 FieldMember.prototype.get$isNative = function() { return this.isNative; }; |
| 10474 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va
lue; }; | 10705 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va
lue; }; |
| 10475 FieldMember.prototype.override = function(other) { | 10706 FieldMember.prototype.override = function(other) { |
| 10476 if (!Member.prototype.override.call(this, other)) return false; | 10707 if ($notnull_bool(!Member.prototype.override.call(this, other))) return false; |
| 10477 if (other.get$isProperty()) { | 10708 if ($notnull_bool(other.get$isProperty())) { |
| 10478 return true; | 10709 return true; |
| 10479 } | 10710 } |
| 10480 else { | 10711 else { |
| 10481 world.error('field can not override anything but property', this.get$span(),
other.get$span()); | 10712 world.error('field can not override anything but property', this.get$span(),
other.get$span()); |
| 10482 return false; | 10713 return false; |
| 10483 } | 10714 } |
| 10484 } | 10715 } |
| 10485 FieldMember.prototype.get$prefersPropertySyntax = function() { | 10716 FieldMember.prototype.get$prefersPropertySyntax = function() { |
| 10486 return false; | 10717 return false; |
| 10487 } | 10718 } |
| 10488 FieldMember.prototype.get$requiresFieldSyntax = function() { | 10719 FieldMember.prototype.get$requiresFieldSyntax = function() { |
| 10489 return this.isNative; | 10720 return this.isNative; |
| 10490 } | 10721 } |
| 10491 FieldMember.prototype.provideFieldSyntax = function() { | 10722 FieldMember.prototype.provideFieldSyntax = function() { |
| 10492 | 10723 |
| 10493 } | 10724 } |
| 10494 FieldMember.prototype.providePropertySyntax = function() { | 10725 FieldMember.prototype.providePropertySyntax = function() { |
| 10495 return this._providePropertySyntax = true; | 10726 return this._providePropertySyntax = true; |
| 10496 } | 10727 } |
| 10497 FieldMember.prototype.get$span = function() { | 10728 FieldMember.prototype.get$span = function() { |
| 10498 return this.definition == null ? null : this.definition.span; | 10729 return $notnull_bool(this.definition == null) ? null : this.definition.span; |
| 10499 } | 10730 } |
| 10500 FieldMember.prototype.get$returnType = function() { | 10731 FieldMember.prototype.get$returnType = function() { |
| 10501 return this.type; | 10732 return this.type; |
| 10502 } | 10733 } |
| 10503 FieldMember.prototype.get$canGet = function() { | 10734 FieldMember.prototype.get$canGet = function() { |
| 10504 return true; | 10735 return true; |
| 10505 } | 10736 } |
| 10506 FieldMember.prototype.get$canSet = function() { | 10737 FieldMember.prototype.get$canSet = function() { |
| 10507 return !this.isFinal; | 10738 return !this.isFinal; |
| 10508 } | 10739 } |
| 10509 FieldMember.prototype.get$isField = function() { | 10740 FieldMember.prototype.get$isField = function() { |
| 10510 return true; | 10741 return true; |
| 10511 } | 10742 } |
| 10512 FieldMember.prototype.resolve = function(inType) { | 10743 FieldMember.prototype.resolve = function(inType) { |
| 10513 this.isStatic = this.declaringType.get$isTop(); | 10744 this.isStatic = this.declaringType.get$isTop(); |
| 10514 this.isFinal = false; | 10745 this.isFinal = false; |
| 10515 if (this.definition.modifiers != null) { | 10746 if ($notnull_bool(this.definition.modifiers != null)) { |
| 10516 var $list = this.definition.modifiers; | 10747 var $list = this.definition.modifiers; |
| 10517 for (var $i = 0;$i < $list.length; $i++) { | 10748 for (var $i = 0;$i < $list.length; $i++) { |
| 10518 var mod = $list.$index($i); | 10749 var mod = $list.$index($i); |
| 10519 if (mod.kind == 85/*TokenKind.STATIC*/) { | 10750 if ($notnull_bool(mod.kind == 86/*TokenKind.STATIC*/)) { |
| 10520 if (this.isStatic) { | 10751 if ($notnull_bool(this.isStatic)) { |
| 10521 world.error('duplicate static modifier', mod.get$span()); | 10752 world.error('duplicate static modifier', mod.get$span()); |
| 10522 } | 10753 } |
| 10523 this.isStatic = true; | 10754 this.isStatic = true; |
| 10524 } | 10755 } |
| 10525 else if (mod.kind == 96/*TokenKind.FINAL*/) { | 10756 else if ($notnull_bool(mod.kind == 97/*TokenKind.FINAL*/)) { |
| 10526 if (this.isFinal) { | 10757 if ($notnull_bool(this.isFinal)) { |
| 10527 world.error('duplicate final modifier', mod.get$span()); | 10758 world.error('duplicate final modifier', mod.get$span()); |
| 10528 } | 10759 } |
| 10529 this.isFinal = true; | 10760 this.isFinal = true; |
| 10530 } | 10761 } |
| 10531 else { | 10762 else { |
| 10532 world.error(('' + mod + ' modifier not allowed on field'), mod.get$span(
)); | 10763 world.error(('' + mod + ' modifier not allowed on field'), mod.get$span(
)); |
| 10533 } | 10764 } |
| 10534 } | 10765 } |
| 10535 } | 10766 } |
| 10536 this.type = inType.resolveType(this.definition.type, false); | 10767 this.type = inType.resolveType(this.definition.type, false); |
| 10537 if (this.isStatic && this.type.get$hasTypeParams()) { | 10768 if ($notnull_bool(this.isStatic && this.type.get$hasTypeParams())) { |
| 10538 world.error('using type parameter in static context', this.definition.type.s
pan); | 10769 world.error('using type parameter in static context', this.definition.type.s
pan); |
| 10539 } | 10770 } |
| 10540 this.get$library()._addMember(this); | 10771 this.get$library()._addMember(this); |
| 10541 } | 10772 } |
| 10542 FieldMember.prototype.computeValue = function() { | 10773 FieldMember.prototype.computeValue = function() { |
| 10543 if (this.value == null) return null; | 10774 var $0; |
| 10544 if (this._computedValue == null) { | 10775 if ($notnull_bool(this.value == null)) return null; |
| 10545 if (this._computing) { | 10776 if ($notnull_bool(this._computedValue == null)) { |
| 10777 if ($notnull_bool(this._computing)) { |
| 10546 world.error('circular reference', this.value.span); | 10778 world.error('circular reference', this.value.span); |
| 10547 return null; | 10779 return null; |
| 10548 } | 10780 } |
| 10549 this._computing = true; | 10781 this._computing = true; |
| 10550 var finalMethod = new MethodMember('final_context', this.declaringType, null
); | 10782 var finalMethod = new MethodMember('final_context', this.declaringType, null
); |
| 10551 finalMethod.isStatic = true; | 10783 finalMethod.isStatic = true; |
| 10552 var finalGen = new MethodGenerator(finalMethod, null); | 10784 var finalGen = new MethodGenerator(finalMethod, null); |
| 10553 this._computedValue = this.value.visit(finalGen); | 10785 this._computedValue = (($0 = this.value.visit(finalGen)) && $0.is$Value()); |
| 10554 if (!this._computedValue.get$isConst()) { | 10786 if ($notnull_bool(!this._computedValue.get$isConst())) { |
| 10555 if (this.isStatic) { | 10787 if ($notnull_bool(this.isStatic)) { |
| 10556 world.error('non constant static field must be initialized in functions'
, this.value.span); | 10788 world.error('non constant static field must be initialized in functions'
, this.value.span); |
| 10557 } | 10789 } |
| 10558 else { | 10790 else { |
| 10559 world.error('non constant field must be initialized in constructor', thi
s.value.span); | 10791 world.error('non constant field must be initialized in constructor', thi
s.value.span); |
| 10560 } | 10792 } |
| 10561 } | 10793 } |
| 10562 if (this.isStatic) { | 10794 if ($notnull_bool(this.isStatic)) { |
| 10563 this._computedValue = world.gen.globalForStaticField(this, this._computedV
alue, [this._computedValue]); | 10795 this._computedValue = world.gen.globalForStaticField(this, this._computedV
alue, [this._computedValue]); |
| 10564 } | 10796 } |
| 10565 this._computing = false; | 10797 this._computing = false; |
| 10566 } | 10798 } |
| 10567 return this._computedValue; | 10799 return this._computedValue; |
| 10568 } | 10800 } |
| 10569 FieldMember.prototype.get_ = function(context, node, target, isDynamic) { | 10801 FieldMember.prototype.get_ = function(context, node, target, isDynamic) { |
| 10570 if (!isDynamic) { | 10802 if ($notnull_bool(!isDynamic)) { |
| 10571 this.declaringType.markUsed(); | 10803 this.declaringType.markUsed(); |
| 10572 } | 10804 } |
| 10573 if (this.isStatic) { | 10805 if ($notnull_bool(this.isStatic)) { |
| 10574 var cv = this.computeValue(); | 10806 var cv = this.computeValue(); |
| 10575 if (this.isFinal) { | 10807 if ($notnull_bool(this.isFinal)) { |
| 10576 return cv; | 10808 return cv; |
| 10577 } | 10809 } |
| 10578 if (this.declaringType.get$isTop()) { | 10810 if ($notnull_bool(this.declaringType.get$isTop())) { |
| 10579 return new Value(this.type, ('' + this.get$jsname() + ''), false, true, fa
lse); | 10811 return new Value(this.type, ('' + this.get$jsname() + ''), false, true, fa
lse); |
| 10580 } | 10812 } |
| 10581 else { | 10813 else { |
| 10582 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' +
this.get$jsname() + ''), false, true, false); | 10814 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' +
this.get$jsname() + ''), false, true, false); |
| 10583 } | 10815 } |
| 10584 } | 10816 } |
| 10585 else if (target.get$isConst() && this.isFinal) { | 10817 else if ($notnull_bool(target.get$isConst() && this.isFinal)) { |
| 10586 var constTarget = (target instanceof GlobalValue) ? target.exp : target; | 10818 var constTarget = $notnull_bool((target instanceof GlobalValue)) ? target.ex
p : target; |
| 10587 if ((constTarget instanceof ConstObjectValue)) { | 10819 if ($notnull_bool((constTarget instanceof ConstObjectValue))) { |
| 10588 return constTarget.fields.$index(this.name); | 10820 return constTarget.fields.$index(this.name); |
| 10589 } | 10821 } |
| 10590 else if ($eq(constTarget.type, world.stringType) && this.name == 'length') { | 10822 else if ($notnull_bool($eq(constTarget.type, world.stringType) && this.name
== 'length')) { |
| 10591 return new Value(this.type, ('' + constTarget.get$actualValue().length + '
'), false, true, false); | 10823 return new Value(this.type, ('' + constTarget.get$actualValue().length + '
'), false, true, false); |
| 10592 } | 10824 } |
| 10593 } | 10825 } |
| 10594 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''),
false, true, false); | 10826 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''),
false, true, false); |
| 10595 } | 10827 } |
| 10596 FieldMember.prototype.set_ = function(context, node, target, value0, isDynamic)
{ | 10828 FieldMember.prototype.set_ = function(context, node, target, value0, isDynamic)
{ |
| 10597 var lhs = this.get_(context, node, target, isDynamic); | 10829 var lhs = this.get_(context, node, target, isDynamic); |
| 10598 value0 = value0.convertTo(context, this.type, node, isDynamic); | 10830 value0 = value0.convertTo(context, this.type, node, isDynamic); |
| 10599 return new Value(this.type, ('' + lhs.code + ' = ' + value0.code + ''), false,
true, false); | 10831 return new Value(this.type, ('' + lhs.code + ' = ' + value0.code + ''), false,
true, false); |
| 10600 } | 10832 } |
| 10601 FieldMember.prototype.get_$3 = function($0, $1, $2) { | 10833 FieldMember.prototype.get_$3 = function($0, $1, $2) { |
| 10602 return this.get_($0, $1, $2, false); | 10834 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 10603 } | 10835 } |
| 10604 ; | 10836 ; |
| 10605 FieldMember.prototype.set_$4 = function($0, $1, $2, $3) { | 10837 FieldMember.prototype.set_$4 = function($0, $1, $2, $3) { |
| 10606 return this.set_($0, $1, $2, $3, false); | 10838 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 10607 } | 10839 } |
| 10608 ; | 10840 ; |
| 10609 // ********** Code for PropertyMember ************** | 10841 // ********** Code for PropertyMember ************** |
| 10610 function PropertyMember(name0, declaringType0) { | 10842 function PropertyMember(name0, declaringType0) { |
| 10611 this._provideFieldSyntax = false | 10843 this._provideFieldSyntax = false |
| 10612 Member.call(this, name0, declaringType0); | 10844 Member.call(this, name0, declaringType0); |
| 10613 // Initializers done | 10845 // Initializers done |
| 10614 } | 10846 } |
| 10615 $inherits(PropertyMember, Member); | 10847 $inherits(PropertyMember, Member); |
| 10848 PropertyMember.prototype.is$PropertyMember = function(){return this;}; |
| 10616 PropertyMember.prototype.get$span = function() { | 10849 PropertyMember.prototype.get$span = function() { |
| 10617 return this.getter != null ? this.getter.get$span() : null; | 10850 return $notnull_bool(this.getter != null) ? this.getter.get$span() : null; |
| 10618 } | 10851 } |
| 10619 PropertyMember.prototype.get$canGet = function() { | 10852 PropertyMember.prototype.get$canGet = function() { |
| 10620 return this.getter != null; | 10853 return this.getter != null; |
| 10621 } | 10854 } |
| 10622 PropertyMember.prototype.get$canSet = function() { | 10855 PropertyMember.prototype.get$canSet = function() { |
| 10623 return this.setter != null; | 10856 return this.setter != null; |
| 10624 } | 10857 } |
| 10625 PropertyMember.prototype.get$prefersPropertySyntax = function() { | 10858 PropertyMember.prototype.get$prefersPropertySyntax = function() { |
| 10626 return true; | 10859 return true; |
| 10627 } | 10860 } |
| 10628 PropertyMember.prototype.get$requiresFieldSyntax = function() { | 10861 PropertyMember.prototype.get$requiresFieldSyntax = function() { |
| 10629 return false; | 10862 return false; |
| 10630 } | 10863 } |
| 10631 PropertyMember.prototype.provideFieldSyntax = function() { | 10864 PropertyMember.prototype.provideFieldSyntax = function() { |
| 10632 return this._provideFieldSyntax = true; | 10865 return this._provideFieldSyntax = true; |
| 10633 } | 10866 } |
| 10634 PropertyMember.prototype.providePropertySyntax = function() { | 10867 PropertyMember.prototype.providePropertySyntax = function() { |
| 10635 | 10868 |
| 10636 } | 10869 } |
| 10637 PropertyMember.prototype.get$isStatic = function() { | 10870 PropertyMember.prototype.get$isStatic = function() { |
| 10638 return this.getter == null ? this.setter.isStatic : this.getter.isStatic; | 10871 return $notnull_bool(this.getter == null) ? this.setter.isStatic : this.getter
.isStatic; |
| 10639 } | 10872 } |
| 10640 PropertyMember.prototype.get$isProperty = function() { | 10873 PropertyMember.prototype.get$isProperty = function() { |
| 10641 return true; | 10874 return true; |
| 10642 } | 10875 } |
| 10643 PropertyMember.prototype.get$returnType = function() { | 10876 PropertyMember.prototype.get$returnType = function() { |
| 10644 return this.getter == null ? this.setter.returnType : this.getter.returnType; | 10877 return $notnull_bool(this.getter == null) ? this.setter.returnType : this.gett
er.returnType; |
| 10645 } | 10878 } |
| 10646 PropertyMember.prototype.override = function(other) { | 10879 PropertyMember.prototype.override = function(other) { |
| 10647 if (!Member.prototype.override.call(this, other)) return false; | 10880 if ($notnull_bool(!Member.prototype.override.call(this, other))) return false; |
| 10648 if (other.get$isProperty() || other.get$isField()) { | 10881 if ($notnull_bool(other.get$isProperty() || other.get$isField())) { |
| 10649 if (other.get$isProperty()) this.addFromParent(other); | 10882 if ($notnull_bool(other.get$isProperty())) this.addFromParent(other); |
| 10650 return true; | 10883 return true; |
| 10651 } | 10884 } |
| 10652 else { | 10885 else { |
| 10653 world.error('property can only override field or property', this.get$span(),
other.get$span()); | 10886 world.error('property can only override field or property', this.get$span(),
other.get$span()); |
| 10654 return false; | 10887 return false; |
| 10655 } | 10888 } |
| 10656 } | 10889 } |
| 10657 PropertyMember.prototype.get_ = function(context, node, target, isDynamic) { | 10890 PropertyMember.prototype.get_ = function(context, node, target, isDynamic) { |
| 10658 if (this.getter == null) { | 10891 if ($notnull_bool(this.getter == null)) { |
| 10659 return target.invokeNoSuchMethod(context, ('get:' + this.name + ''), node); | 10892 return target.invokeNoSuchMethod(context, ('get:' + this.name + ''), node); |
| 10660 } | 10893 } |
| 10661 return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), false)
; | 10894 return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), false)
; |
| 10662 } | 10895 } |
| 10663 PropertyMember.prototype.set_ = function(context, node, target, value, isDynamic
) { | 10896 PropertyMember.prototype.set_ = function(context, node, target, value, isDynamic
) { |
| 10664 return this.setter.invoke(context, node, target, new Arguments(null, [value]),
isDynamic); | 10897 return this.setter.invoke(context, node, target, new Arguments(null, [value]),
isDynamic); |
| 10665 } | 10898 } |
| 10666 PropertyMember.prototype.addFromParent = function(parentMember) { | 10899 PropertyMember.prototype.addFromParent = function(parentMember) { |
| 10667 if ((parentMember instanceof ConcreteMember)) { | 10900 if ($notnull_bool((parentMember instanceof ConcreteMember))) { |
| 10668 parentMember = parentMember.baseMember; | 10901 parentMember = parentMember.baseMember; |
| 10669 } | 10902 } |
| 10670 if (this.getter == null) this.getter = parentMember.getter; | 10903 if ($notnull_bool(this.getter == null)) this.getter = parentMember.getter; |
| 10671 if (this.setter == null) this.setter = parentMember.setter; | 10904 if ($notnull_bool(this.setter == null)) this.setter = parentMember.setter; |
| 10672 } | 10905 } |
| 10673 PropertyMember.prototype.resolve = function(inType) { | 10906 PropertyMember.prototype.resolve = function(inType) { |
| 10674 if (this.getter != null) this.getter.resolve(inType); | 10907 if ($notnull_bool(this.getter != null)) this.getter.resolve(inType); |
| 10675 if (this.setter != null) this.setter.resolve(inType); | 10908 if ($notnull_bool(this.setter != null)) this.setter.resolve(inType); |
| 10676 this.get$library()._addMember(this); | 10909 this.get$library()._addMember(this); |
| 10677 } | 10910 } |
| 10678 PropertyMember.prototype.get_$3 = function($0, $1, $2) { | 10911 PropertyMember.prototype.get_$3 = function($0, $1, $2) { |
| 10679 return this.get_($0, $1, $2, false); | 10912 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 10680 } | 10913 } |
| 10681 ; | 10914 ; |
| 10682 PropertyMember.prototype.set_$4 = function($0, $1, $2, $3) { | 10915 PropertyMember.prototype.set_$4 = function($0, $1, $2, $3) { |
| 10683 return this.set_($0, $1, $2, $3, false); | 10916 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 10684 } | 10917 } |
| 10685 ; | 10918 ; |
| 10686 // ********** Code for ConcreteMember ************** | 10919 // ********** Code for ConcreteMember ************** |
| 10687 function ConcreteMember(name0, declaringType0, baseMember) { | 10920 function ConcreteMember(name0, declaringType0, baseMember) { |
| 10688 this.baseMember = baseMember; | 10921 this.baseMember = baseMember; |
| 10689 Member.call(this, name0, declaringType0); | 10922 Member.call(this, name0, declaringType0); |
| 10690 // Initializers done | 10923 // Initializers done |
| 10691 this.parameters = []; | 10924 this.parameters = []; |
| 10692 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring
Type0); | 10925 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring
Type0); |
| 10693 var $list = this.baseMember.get$parameters(); | 10926 var $list = this.baseMember.get$parameters(); |
| 10694 for (var $i = 0;$i < $list.length; $i++) { | 10927 for (var $i = 0;$i < $list.length; $i++) { |
| 10695 var p = $list.$index($i); | 10928 var p = $list.$index($i); |
| 10696 var newType = p.type.resolveTypeParams(declaringType0); | 10929 var newType = p.type.resolveTypeParams(declaringType0); |
| 10697 if ($ne(newType, p.type)) { | 10930 if ($notnull_bool($ne(newType, p.type))) { |
| 10698 this.parameters.add(p.copyWithNewType(newType)); | 10931 this.parameters.add(p.copyWithNewType((newType && newType.is$lang_Type()))
); |
| 10699 } | 10932 } |
| 10700 else { | 10933 else { |
| 10701 this.parameters.add(p); | 10934 this.parameters.add(p); |
| 10702 } | 10935 } |
| 10703 } | 10936 } |
| 10704 } | 10937 } |
| 10705 $inherits(ConcreteMember, Member); | 10938 $inherits(ConcreteMember, Member); |
| 10706 ConcreteMember.prototype.get$returnType = function() { return this.returnType; }
; | 10939 ConcreteMember.prototype.get$returnType = function() { return this.returnType; }
; |
| 10707 ConcreteMember.prototype.set$returnType = function(value) { return this.returnTy
pe = value; }; | 10940 ConcreteMember.prototype.set$returnType = function(value) { return this.returnTy
pe = value; }; |
| 10708 ConcreteMember.prototype.get$parameters = function() { return this.parameters; }
; | 10941 ConcreteMember.prototype.get$parameters = function() { return this.parameters; }
; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10784 var ret = this.baseMember.get_(context, node, target, isDynamic); | 11017 var ret = this.baseMember.get_(context, node, target, isDynamic); |
| 10785 return new Value(this.returnType, ret.code, false, true, false); | 11018 return new Value(this.returnType, ret.code, false, true, false); |
| 10786 } | 11019 } |
| 10787 ConcreteMember.prototype.set_ = function(context, node, target, value, isDynamic
) { | 11020 ConcreteMember.prototype.set_ = function(context, node, target, value, isDynamic
) { |
| 10788 var ret = this.baseMember.set_(context, node, target, value, isDynamic); | 11021 var ret = this.baseMember.set_(context, node, target, value, isDynamic); |
| 10789 return new Value(this.returnType, ret.code, false, true, false); | 11022 return new Value(this.returnType, ret.code, false, true, false); |
| 10790 } | 11023 } |
| 10791 ConcreteMember.prototype.invoke = function(context, node, target, args, isDynami
c) { | 11024 ConcreteMember.prototype.invoke = function(context, node, target, args, isDynami
c) { |
| 10792 var ret = this.baseMember.invoke(context, node, target, args, isDynamic); | 11025 var ret = this.baseMember.invoke(context, node, target, args, isDynamic); |
| 10793 var code = ret.code; | 11026 var code = ret.code; |
| 10794 if (this.get$isConstructor()) { | 11027 if ($notnull_bool(this.get$isConstructor())) { |
| 10795 code = code.replaceFirst(this.declaringType.get$genericType().get$jsname(),
this.declaringType.get$jsname()); | 11028 code = code.replaceFirst(this.declaringType.get$genericType().get$jsname(),
this.declaringType.get$jsname()); |
| 10796 } | 11029 } |
| 10797 this.declaringType.genMethod(this); | 11030 this.declaringType.genMethod(this); |
| 10798 return new Value(this.returnType, code, false, true, false); | 11031 return new Value(this.returnType, code, false, true, false); |
| 10799 } | 11032 } |
| 10800 ConcreteMember.prototype.get_$3 = function($0, $1, $2) { | 11033 ConcreteMember.prototype.get_$3 = function($0, $1, $2) { |
| 10801 return this.get_($0, $1, $2, false); | 11034 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 10802 } | 11035 } |
| 10803 ; | 11036 ; |
| 10804 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 11037 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 10805 return this.invoke($0, $1, $2, $3, false); | 11038 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); |
| 10806 } | 11039 } |
| 10807 ; | 11040 ; |
| 10808 ConcreteMember.prototype.set_$4 = function($0, $1, $2, $3) { | 11041 ConcreteMember.prototype.set_$4 = function($0, $1, $2, $3) { |
| 10809 return this.set_($0, $1, $2, $3, false); | 11042 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 10810 } | 11043 } |
| 10811 ; | 11044 ; |
| 10812 // ********** Code for MethodMember ************** | 11045 // ********** Code for MethodMember ************** |
| 10813 function MethodMember(name0, declaringType0, definition) { | 11046 function MethodMember(name0, declaringType0, definition) { |
| 10814 this.isStatic = false | 11047 this.isStatic = false |
| 10815 this.isAbstract = false | 11048 this.isAbstract = false |
| 10816 this.isConst = false | 11049 this.isConst = false |
| 10817 this.isFactory = false | 11050 this.isFactory = false |
| 10818 this.isLambda = false | 11051 this.isLambda = false |
| 10819 this._providePropertySyntax = false | 11052 this._providePropertySyntax = false |
| 10820 this._provideFieldSyntax = false | 11053 this._provideFieldSyntax = false |
| 10821 this._provideOptionalParamInfo = false | 11054 this._provideOptionalParamInfo = false |
| 10822 this.definition = definition; | 11055 this.definition = definition; |
| 10823 Member.call(this, name0, declaringType0); | 11056 Member.call(this, name0, declaringType0); |
| 10824 // Initializers done | 11057 // Initializers done |
| 10825 } | 11058 } |
| 10826 $inherits(MethodMember, Member); | 11059 $inherits(MethodMember, Member); |
| 11060 MethodMember.prototype.is$MethodMember = function(){return this;}; |
| 10827 MethodMember.prototype.get$definition = function() { return this.definition; }; | 11061 MethodMember.prototype.get$definition = function() { return this.definition; }; |
| 10828 MethodMember.prototype.set$definition = function(value) { return this.definition
= value; }; | 11062 MethodMember.prototype.set$definition = function(value) { return this.definition
= value; }; |
| 10829 MethodMember.prototype.get$returnType = function() { return this.returnType; }; | 11063 MethodMember.prototype.get$returnType = function() { return this.returnType; }; |
| 10830 MethodMember.prototype.set$returnType = function(value) { return this.returnType
= value; }; | 11064 MethodMember.prototype.set$returnType = function(value) { return this.returnType
= value; }; |
| 10831 MethodMember.prototype.get$parameters = function() { return this.parameters; }; | 11065 MethodMember.prototype.get$parameters = function() { return this.parameters; }; |
| 10832 MethodMember.prototype.set$parameters = function(value) { return this.parameters
= value; }; | 11066 MethodMember.prototype.set$parameters = function(value) { return this.parameters
= value; }; |
| 10833 MethodMember.prototype.get$isStatic = function() { return this.isStatic; }; | 11067 MethodMember.prototype.get$isStatic = function() { return this.isStatic; }; |
| 10834 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v
alue; }; | 11068 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v
alue; }; |
| 10835 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; }; | 11069 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; }; |
| 10836 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract
= value; }; | 11070 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract
= value; }; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 10849 MethodMember.prototype.get$isNative = function() { | 11083 MethodMember.prototype.get$isNative = function() { |
| 10850 return (this.definition.body instanceof NativeStatement); | 11084 return (this.definition.body instanceof NativeStatement); |
| 10851 } | 11085 } |
| 10852 MethodMember.prototype.get$canGet = function() { | 11086 MethodMember.prototype.get$canGet = function() { |
| 10853 return false; | 11087 return false; |
| 10854 } | 11088 } |
| 10855 MethodMember.prototype.get$canSet = function() { | 11089 MethodMember.prototype.get$canSet = function() { |
| 10856 return false; | 11090 return false; |
| 10857 } | 11091 } |
| 10858 MethodMember.prototype.get$span = function() { | 11092 MethodMember.prototype.get$span = function() { |
| 10859 return this.definition == null ? null : this.definition.span; | 11093 return $notnull_bool(this.definition == null) ? null : this.definition.span; |
| 10860 } | 11094 } |
| 10861 MethodMember.prototype.get$constructorName = function() { | 11095 MethodMember.prototype.get$constructorName = function() { |
| 10862 if (this.definition.returnType == null) return ''; | 11096 if ($notnull_bool(this.definition.returnType == null)) return ''; |
| 10863 if (this.definition.returnType.names != null) { | 11097 if ($notnull_bool(this.definition.returnType.names != null)) { |
| 10864 return this.definition.returnType.names.$index(0).get$name(); | 11098 return this.definition.returnType.names.$index(0).get$name(); |
| 10865 } | 11099 } |
| 10866 else if ($ne(this.definition.returnType.get$name(), null)) { | 11100 else if ($notnull_bool($ne(this.definition.returnType.get$name(), null))) { |
| 10867 return this.definition.returnType.get$name().get$name(); | 11101 return this.definition.returnType.get$name().get$name(); |
| 10868 } | 11102 } |
| 10869 world.internalError('no valid constructor name', this.definition.span); | 11103 world.internalError('no valid constructor name', this.definition.span); |
| 10870 } | 11104 } |
| 10871 MethodMember.prototype.get$functionType = function() { | 11105 MethodMember.prototype.get$functionType = function() { |
| 10872 if (this._functionType == null) { | 11106 if ($notnull_bool(this._functionType == null)) { |
| 10873 this._functionType = this.declaringType.get$library().getOrAddFunctionType(t
his.name, this.definition, this.declaringType); | 11107 this._functionType = this.declaringType.get$library().getOrAddFunctionType(t
his.name, this.definition, this.declaringType); |
| 10874 if (this.parameters == null) { | 11108 if ($notnull_bool(this.parameters == null)) { |
| 10875 this.resolve(this.declaringType); | 11109 this.resolve(this.declaringType); |
| 10876 } | 11110 } |
| 10877 } | 11111 } |
| 10878 return this._functionType; | 11112 return this._functionType; |
| 10879 } | 11113 } |
| 10880 MethodMember.prototype.override = function(other) { | 11114 MethodMember.prototype.override = function(other) { |
| 10881 if (!Member.prototype.override.call(this, other)) return false; | 11115 if ($notnull_bool(!Member.prototype.override.call(this, other))) return false; |
| 10882 if (other.get$isMethod()) { | 11116 if ($notnull_bool(other.get$isMethod())) { |
| 10883 return true; | 11117 return true; |
| 10884 } | 11118 } |
| 10885 else { | 11119 else { |
| 10886 world.error('method can only override methods', this.get$span(), other.get$s
pan()); | 11120 world.error('method can only override methods', this.get$span(), other.get$s
pan()); |
| 10887 return false; | 11121 return false; |
| 10888 } | 11122 } |
| 10889 } | 11123 } |
| 10890 MethodMember.prototype.canInvoke = function(context, args) { | 11124 MethodMember.prototype.canInvoke = function(context, args) { |
| 10891 var bareCount = args.get$bareCount(); | 11125 var bareCount = args.get$bareCount(); |
| 10892 if (bareCount > this.parameters.length) return false; | 11126 if ($notnull_bool(bareCount > this.parameters.length)) return false; |
| 10893 if (bareCount == this.parameters.length) { | 11127 if ($notnull_bool(bareCount == this.parameters.length)) { |
| 10894 if (bareCount != args.get$length()) return false; | 11128 if ($notnull_bool(bareCount != args.get$length())) return false; |
| 10895 } | 11129 } |
| 10896 else { | 11130 else { |
| 10897 if (!this.parameters.$index(bareCount).get$isOptional()) return false; | 11131 if ($notnull_bool(!this.parameters.$index(bareCount).get$isOptional())) retu
rn false; |
| 10898 for (var i = bareCount; | 11132 for (var i = bareCount; |
| 10899 i < args.get$length(); i++) { | 11133 $notnull_bool(i < args.get$length()); i++) { |
| 10900 if (this.indexOfParameter(args.getName(i)) < 0) { | 11134 if ($notnull_bool(this.indexOfParameter(args.getName(i)) < 0)) { |
| 10901 return false; | 11135 return false; |
| 10902 } | 11136 } |
| 10903 } | 11137 } |
| 10904 } | 11138 } |
| 10905 return true; | 11139 return true; |
| 10906 } | 11140 } |
| 10907 MethodMember.prototype.indexOfParameter = function(name0) { | 11141 MethodMember.prototype.indexOfParameter = function(name0) { |
| 10908 for (var i = 0; | 11142 for (var i = 0; |
| 10909 i < this.parameters.length; i++) { | 11143 $notnull_bool(i < this.parameters.length); i++) { |
| 10910 var p = this.parameters.$index(i); | 11144 var p = this.parameters.$index(i); |
| 10911 if (p.get$isOptional() && $eq(p.get$name(), name0)) { | 11145 if ($notnull_bool(p.get$isOptional() && $eq(p.get$name(), name0))) { |
| 10912 return i; | 11146 return i; |
| 10913 } | 11147 } |
| 10914 } | 11148 } |
| 10915 return -1; | 11149 return -1; |
| 10916 } | 11150 } |
| 10917 MethodMember.prototype.resolveType = function(node, isRequired) { | 11151 MethodMember.prototype.resolveType = function(node, isRequired) { |
| 10918 var type = this.declaringType.resolveType(node, isRequired); | 11152 var type = this.declaringType.resolveType(node, isRequired); |
| 10919 if (this.isStatic && type.get$hasTypeParams()) { | 11153 if ($notnull_bool(this.isStatic && type.get$hasTypeParams())) { |
| 10920 world.error('using type parameter in static context', node.span); | 11154 world.error('using type parameter in static context', node.span); |
| 10921 } | 11155 } |
| 10922 return type; | 11156 return type; |
| 10923 } | 11157 } |
| 10924 MethodMember.prototype.get$prefersPropertySyntax = function() { | 11158 MethodMember.prototype.get$prefersPropertySyntax = function() { |
| 10925 return true; | 11159 return true; |
| 10926 } | 11160 } |
| 10927 MethodMember.prototype.get$requiresFieldSyntax = function() { | 11161 MethodMember.prototype.get$requiresFieldSyntax = function() { |
| 10928 return false; | 11162 return false; |
| 10929 } | 11163 } |
| 10930 MethodMember.prototype.provideFieldSyntax = function() { | 11164 MethodMember.prototype.provideFieldSyntax = function() { |
| 10931 return this._provideFieldSyntax = true; | 11165 return this._provideFieldSyntax = true; |
| 10932 } | 11166 } |
| 10933 MethodMember.prototype.providePropertySyntax = function() { | 11167 MethodMember.prototype.providePropertySyntax = function() { |
| 10934 return this._providePropertySyntax = true; | 11168 return this._providePropertySyntax = true; |
| 10935 } | 11169 } |
| 10936 MethodMember.prototype.set_ = function(context, Node0, target, value, isDynamic)
{ | 11170 MethodMember.prototype.set_ = function(context, Node0, target, value, isDynamic)
{ |
| 10937 world.error('can not set method', this.definition.span); | 11171 world.error('can not set method', this.definition.span); |
| 10938 } | 11172 } |
| 10939 MethodMember.prototype.get_ = function(context, node, target, isDynamic) { | 11173 MethodMember.prototype.get_ = function(context, node, target, isDynamic) { |
| 10940 this.declaringType.genMethod(this); | 11174 this.declaringType.genMethod(this); |
| 10941 this._provideOptionalParamInfo = true; | 11175 this._provideOptionalParamInfo = true; |
| 10942 if (this.isStatic) { | 11176 if ($notnull_bool(this.isStatic)) { |
| 10943 var type = this.declaringType.get$isTop() ? '' : ('' + this.declaringType.ge
t$jsname() + '.'); | 11177 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d
eclaringType.get$jsname() + '.'); |
| 10944 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname(
) + ''), false, true, false); | 11178 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname(
) + ''), false, true, false); |
| 10945 } | 11179 } |
| 10946 this._providePropertySyntax = true; | 11180 this._providePropertySyntax = true; |
| 10947 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this.
get$jsname() + '()'), false, true, false); | 11181 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this.
get$jsname() + '()'), false, true, false); |
| 10948 } | 11182 } |
| 10949 MethodMember.prototype.namesInOrder = function(args) { | 11183 MethodMember.prototype.namesInOrder = function(args) { |
| 10950 if (!args.get$hasNames()) return true; | 11184 if ($notnull_bool(!args.get$hasNames())) return true; |
| 10951 var lastParameter = null; | 11185 var lastParameter = null; |
| 10952 for (var i = args.get$bareCount(); | 11186 for (var i = args.get$bareCount(); |
| 10953 i < this.parameters.length; i++) { | 11187 $notnull_bool(i < this.parameters.length); i++) { |
| 10954 var p = args.getIndexOfName(this.parameters.$index(i).get$name()); | 11188 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam
e())); |
| 10955 if (p >= 0 && args.values.$index(p).needsTemp) { | 11189 if ($notnull_bool(p >= 0 && args.values.$index(p).needsTemp)) { |
| 10956 if (lastParameter != null && lastParameter > p) { | 11190 if ($notnull_bool(lastParameter != null && lastParameter > $assert_num(p))
) { |
| 10957 return false; | 11191 return false; |
| 10958 } | 11192 } |
| 10959 lastParameter = p; | 11193 lastParameter = $assert_num(p); |
| 11194 } |
| 11195 } |
| 11196 return true; |
| 11197 } |
| 11198 MethodMember.prototype.needsArgumentConversion = function(args) { |
| 11199 var $0; |
| 11200 var bareCount = args.get$bareCount(); |
| 11201 for (var i = 0; |
| 11202 $notnull_bool(i < bareCount); i++) { |
| 11203 var arg = args.values.$index(i); |
| 11204 if ($notnull_bool(arg.needsConversion((($0 = this.parameters.$index(i).type)
&& $0.is$lang_Type())))) { |
| 11205 return false; |
| 11206 } |
| 11207 } |
| 11208 if ($notnull_bool(bareCount < this.parameters.length)) { |
| 11209 this.genParameterValues(); |
| 11210 for (var i = bareCount; |
| 11211 $notnull_bool(i < this.parameters.length); i++) { |
| 11212 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name(
))); |
| 11213 if ($notnull_bool($ne(arg, null) && arg.needsConversion((($0 = this.parame
ters.$index(i).type) && $0.is$lang_Type())))) { |
| 11214 return false; |
| 11215 } |
| 10960 } | 11216 } |
| 10961 } | 11217 } |
| 10962 return true; | 11218 return true; |
| 10963 } | 11219 } |
| 10964 MethodMember._argCountMsg = function(actual, expected, atLeast) { | 11220 MethodMember._argCountMsg = function(actual, expected, atLeast) { |
| 10965 return 'wrong number of arguments, expected ' + ('' + (atLeast ? "at least " :
"") + '' + expected + ' but found ' + actual + ''); | 11221 return 'wrong number of arguments, expected ' + ('' + ($notnull_bool(atLeast)
? "at least " : "") + '' + expected + ' but found ' + actual + ''); |
| 10966 } | 11222 } |
| 10967 MethodMember.prototype._argError = function(context, node, target, args, msg) { | 11223 MethodMember.prototype._argError = function(context, node, target, args, msg) { |
| 10968 if (this.isStatic || this.get$isConstructor()) { | 11224 if ($notnull_bool(this.isStatic || this.get$isConstructor())) { |
| 10969 world.error(msg, node.span); | 11225 world.error(msg, node.span); |
| 10970 } | 11226 } |
| 10971 else { | 11227 else { |
| 10972 world.warning(msg, node.span); | 11228 world.warning(msg, node.span); |
| 10973 } | 11229 } |
| 10974 return target.invokeNoSuchMethod(context, this.name, node, args); | 11230 return target.invokeNoSuchMethod(context, this.name, node, args); |
| 10975 } | 11231 } |
| 10976 MethodMember.prototype.genParameterValues = function() { | 11232 MethodMember.prototype.genParameterValues = function() { |
| 10977 var $list = this.parameters; | 11233 var $list = this.parameters; |
| 10978 for (var $i = 0;$i < $list.length; $i++) { | 11234 for (var $i = 0;$i < $list.length; $i++) { |
| 10979 var p = $list.$index($i); | 11235 var p = $list.$index($i); |
| 10980 p.genValue(this, this.generator); | 11236 p.genValue(this, this.generator); |
| 10981 } | 11237 } |
| 10982 } | 11238 } |
| 10983 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
{ | 11239 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
{ |
| 10984 if (this.parameters == null) { | 11240 var $0; |
| 11241 if ($notnull_bool(this.parameters == null)) { |
| 10985 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.'
+ this.name + '')); | 11242 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.'
+ this.name + '')); |
| 10986 this.resolve(this.declaringType); | 11243 this.resolve(this.declaringType); |
| 10987 } | 11244 } |
| 10988 this.declaringType.genMethod(this); | 11245 this.declaringType.genMethod(this); |
| 10989 if (this.isStatic || this.isFactory) { | 11246 if ($notnull_bool(this.isStatic || this.isFactory)) { |
| 10990 this.declaringType.markUsed(); | 11247 this.declaringType.markUsed(); |
| 10991 } | 11248 } |
| 10992 if (!this.namesInOrder(args)) { | 11249 if ($notnull_bool(!this.namesInOrder(args))) { |
| 10993 return context.findMembers(this.name).invokeOnVar(context, node, target, arg
s); | 11250 return context.findMembers(this.name).invokeOnVar(context, node, target, arg
s); |
| 10994 } | 11251 } |
| 10995 var argsCode = []; | 11252 var argsCode = []; |
| 10996 if (target != null && (this.get$isConstructor() || target.isSuper)) { | 11253 if ($notnull_bool(target != null && (this.get$isConstructor() || target.isSupe
r))) { |
| 10997 argsCode.add('this'); | 11254 argsCode.add('this'); |
| 10998 } | 11255 } |
| 10999 var bareCount = args.get$bareCount(); | 11256 var bareCount = args.get$bareCount(); |
| 11000 for (var i = 0; | 11257 for (var i = 0; |
| 11001 i < bareCount; i++) { | 11258 $notnull_bool(i < bareCount); i++) { |
| 11002 var arg = args.values.$index(i); | 11259 var arg = args.values.$index(i); |
| 11003 if (i >= this.parameters.length) { | 11260 if ($notnull_bool(i >= this.parameters.length)) { |
| 11004 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len
gth, false); | 11261 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len
gth, false); |
| 11005 return this._argError(context, node, target, args, msg); | 11262 return this._argError(context, node, target, args, $assert_String(msg)); |
| 11006 } | 11263 } |
| 11007 arg = arg.convertTo(context, this.parameters.$index(i).type, node, isDynamic
); | 11264 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $0.is
$lang_Type()), node, isDynamic); |
| 11008 if (this.isConst && arg.get$isConst()) { | 11265 if ($notnull_bool(this.isConst && arg.get$isConst())) { |
| 11009 argsCode.add(arg.canonicalCode); | 11266 argsCode.add(arg.canonicalCode); |
| 11010 } | 11267 } |
| 11011 else { | 11268 else { |
| 11012 argsCode.add(arg.code); | 11269 argsCode.add(arg.code); |
| 11013 } | 11270 } |
| 11014 } | 11271 } |
| 11015 if (bareCount < this.parameters.length) { | 11272 if ($notnull_bool(bareCount < this.parameters.length)) { |
| 11016 this.genParameterValues(); | 11273 this.genParameterValues(); |
| 11017 var namedArgsUsed = 0; | 11274 var namedArgsUsed = 0; |
| 11018 for (var i = bareCount; | 11275 for (var i = bareCount; |
| 11019 i < this.parameters.length; i++) { | 11276 $notnull_bool(i < this.parameters.length); i++) { |
| 11020 var arg = args.getValue(this.parameters.$index(i).get$name()); | 11277 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name(
))); |
| 11021 if (arg == null) { | 11278 if ($notnull_bool(arg == null)) { |
| 11022 arg = this.parameters.$index(i).get$value(); | 11279 arg = this.parameters.$index(i).get$value(); |
| 11023 } | 11280 } |
| 11024 else { | 11281 else { |
| 11025 arg = arg.convertTo(context, this.parameters.$index(i).type, node, isDyn
amic); | 11282 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $
0.is$lang_Type()), node, isDynamic); |
| 11026 namedArgsUsed++; | 11283 namedArgsUsed++; |
| 11027 } | 11284 } |
| 11028 if (arg == null || !this.parameters.$index(i).get$isOptional()) { | 11285 if ($notnull_bool(arg == null || !this.parameters.$index(i).get$isOptional
())) { |
| 11029 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i +
1, true); | 11286 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i +
1, true); |
| 11030 return this._argError(context, node, target, args, msg); | 11287 return this._argError(context, node, target, args, $assert_String(msg)); |
| 11031 } | 11288 } |
| 11032 else { | 11289 else { |
| 11033 argsCode.add(this.isConst && arg.get$isConst() ? arg.canonicalCode : arg
.code); | 11290 argsCode.add($notnull_bool(this.isConst && arg.get$isConst()) ? arg.cano
nicalCode : arg.code); |
| 11034 } | 11291 } |
| 11035 } | 11292 } |
| 11036 if (namedArgsUsed < args.get$nameCount()) { | 11293 if ($notnull_bool(namedArgsUsed < args.get$nameCount())) { |
| 11037 var seen = new HashSetImplementation$String(); | 11294 var seen = new HashSetImplementation$String(); |
| 11038 for (var i = bareCount; | 11295 for (var i = bareCount; |
| 11039 i < args.get$length(); i++) { | 11296 $notnull_bool(i < args.get$length()); i++) { |
| 11040 var name0 = args.getName(i); | 11297 var name0 = args.getName(i); |
| 11041 if (seen.contains(name0)) { | 11298 if ($notnull_bool(seen.contains(name0))) { |
| 11042 return this._argError(context, node, target, args, ('duplicate argumen
t "' + name0 + '"')); | 11299 return this._argError(context, node, target, args, ('duplicate argumen
t "' + name0 + '"')); |
| 11043 } | 11300 } |
| 11044 seen.add(name0); | 11301 seen.add(name0); |
| 11045 var p = this.indexOfParameter(name0); | 11302 var p = this.indexOfParameter($assert_String(name0)); |
| 11046 if (p < 0) { | 11303 if ($notnull_bool(p < 0)) { |
| 11047 return this._argError(context, node, target, args, ('method does not h
ave optional parameter "' + name0 + '"')); | 11304 return this._argError(context, node, target, args, ('method does not h
ave optional parameter "' + name0 + '"')); |
| 11048 } | 11305 } |
| 11049 else if (p < bareCount) { | 11306 else if ($notnull_bool(p < bareCount)) { |
| 11050 return this._argError(context, node, target, args, ('argument "' + nam
e0 + '" passed as positional and named')); | 11307 return this._argError(context, node, target, args, ('argument "' + nam
e0 + '" passed as positional and named')); |
| 11051 } | 11308 } |
| 11052 } | 11309 } |
| 11053 world.internalError(('wrong named arguments calling ' + this.name + ''), n
ode.span); | 11310 world.internalError(('wrong named arguments calling ' + this.name + ''), n
ode.span); |
| 11054 } | 11311 } |
| 11055 Arguments.removeTrailingNulls(argsCode); | 11312 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); |
| 11056 } | 11313 } |
| 11057 var argsString = Strings.join(argsCode, ', '); | 11314 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); |
| 11058 if (this.get$isConstructor()) { | 11315 if ($notnull_bool(this.get$isConstructor())) { |
| 11059 return this._invokeConstructor(context, node, target, args, argsString); | 11316 return this._invokeConstructor(context, node, target, args, argsString); |
| 11060 } | 11317 } |
| 11061 if (this.name.startsWith('\$')) { | 11318 if ($notnull_bool(this.name.startsWith('\$'))) { |
| 11062 return this._invokeBuiltin(context, node, target, args, argsCode); | 11319 return this._invokeBuiltin(context, node, target, args, argsCode); |
| 11063 } | 11320 } |
| 11064 if (target != null && target.isSuper) { | 11321 if ($notnull_bool(target != null && target.isSuper)) { |
| 11065 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
prototype.' + this.get$jsname() + '.call(' + argsString + ')'), false, true, fal
se); | 11322 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
prototype.' + this.get$jsname() + '.call(' + argsString + ')'), false, true, fal
se); |
| 11066 } | 11323 } |
| 11067 if (this.isFactory) { | 11324 if ($notnull_bool(this.isFactory)) { |
| 11068 return new Value(this.returnType, ('' + this.get$generatedFactoryName() + '(
' + argsString + ')'), false, true, false); | 11325 return new Value(this.returnType, ('' + this.get$generatedFactoryName() + '(
' + argsString + ')'), false, true, false); |
| 11069 } | 11326 } |
| 11070 if (this.isStatic) { | 11327 if ($notnull_bool(this.isStatic)) { |
| 11071 if (this.declaringType.get$isTop()) { | 11328 if ($notnull_bool(this.declaringType.get$isTop())) { |
| 11072 return new Value(this.returnType, ('' + this.get$jsname() + '(' + argsStri
ng + ')'), false, true, false); | 11329 return new Value(this.returnType, ('' + this.get$jsname() + '(' + argsStri
ng + ')'), false, true, false); |
| 11073 } | 11330 } |
| 11074 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
' + this.get$jsname() + '(' + argsString + ')'), false, true, false); | 11331 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
' + this.get$jsname() + '(' + argsString + ')'), false, true, false); |
| 11075 } | 11332 } |
| 11076 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')
'); | 11333 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')
'); |
| 11077 if (target.get$isConst()) { | 11334 if ($notnull_bool(target.get$isConst())) { |
| 11078 if ((target instanceof GlobalValue)) { | 11335 if ($notnull_bool((target instanceof GlobalValue))) { |
| 11079 target = target.exp; | 11336 target = target.exp; |
| 11080 } | 11337 } |
| 11081 if (this.name == 'get\$length') { | 11338 if ($notnull_bool(this.name == 'get\$length')) { |
| 11082 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue
)) { | 11339 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof
ConstMapValue))) { |
| 11083 code = ('' + target.values.length + ''); | 11340 code = ('' + target.values.length + ''); |
| 11084 } | 11341 } |
| 11085 } | 11342 } |
| 11086 else if (this.name == 'isEmpty') { | 11343 else if ($notnull_bool(this.name == 'isEmpty')) { |
| 11087 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue
)) { | 11344 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof
ConstMapValue))) { |
| 11088 code = ('' + target.values.isEmpty() + ''); | 11345 code = ('' + target.values.isEmpty() + ''); |
| 11089 } | 11346 } |
| 11090 } | 11347 } |
| 11091 } | 11348 } |
| 11092 return new Value(this.returnType, code, false, true, false); | 11349 return new Value(this.returnType, code, false, true, false); |
| 11093 } | 11350 } |
| 11094 MethodMember.prototype._invokeConstructor = function(context, node, target, args
, argsString) { | 11351 MethodMember.prototype._invokeConstructor = function(context, node, target, args
, argsString) { |
| 11095 this.declaringType.markUsed(); | 11352 this.declaringType.markUsed(); |
| 11096 if (target != null) { | 11353 if ($notnull_bool(target != null)) { |
| 11097 var code = (this.get$constructorName() != '') ? ('' + this.declaringType.get
$jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + argsString + ')'
) : ('' + this.declaringType.get$jsname() + '.call(' + argsString + ')'); | 11354 var code = $notnull_bool((this.get$constructorName() != '')) ? ('' + this.de
claringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + a
rgsString + ')') : ('' + this.declaringType.get$jsname() + '.call(' + argsString
+ ')'); |
| 11098 return new Value(this.declaringType, code, false, true, false); | 11355 return new Value(this.declaringType, code, false, true, false); |
| 11099 } | 11356 } |
| 11100 else { | 11357 else { |
| 11101 var code = (this.get$constructorName() != '') ? ('new ' + this.declaringType
.get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + argsString + ')')
: ('new ' + this.declaringType.get$jsname() + '(' + argsString + ')'); | 11358 var code = $notnull_bool((this.get$constructorName() != '')) ? ('new ' + thi
s.declaringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + ar
gsString + ')') : ('new ' + this.declaringType.get$jsname() + '(' + argsString +
')'); |
| 11102 if (this.isConst && node.get$isConst()) { | 11359 if ($notnull_bool(this.isConst && node.get$isConst())) { |
| 11103 return this._invokeConstConstructor(node, code, target, args); | 11360 return this._invokeConstConstructor(node, $assert_String(code), target, ar
gs); |
| 11104 } | 11361 } |
| 11105 else { | 11362 else { |
| 11106 return new Value(this.declaringType, code, false, true, false); | 11363 return new Value(this.declaringType, code, false, true, false); |
| 11107 } | 11364 } |
| 11108 } | 11365 } |
| 11109 } | 11366 } |
| 11110 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
gs) { | 11367 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
gs) { |
| 11368 var $0; |
| 11111 var fields = new HashMapImplementation$String$EvaluatedValue(); | 11369 var fields = new HashMapImplementation$String$EvaluatedValue(); |
| 11112 for (var i = 0; | 11370 for (var i = 0; |
| 11113 i < this.parameters.length; i++) { | 11371 $notnull_bool(i < this.parameters.length); i++) { |
| 11114 var param = this.parameters.$index(i).get$name(); | 11372 var param = this.parameters.$index(i).get$name(); |
| 11115 if (param.startsWith('this.')) { | 11373 if ($notnull_bool(param.startsWith('this.'))) { |
| 11116 var fname = param.substring(5); | 11374 var fname = param.substring(5); |
| 11117 var value = null; | 11375 var value = null; |
| 11118 if (i < args.get$length()) { | 11376 if ($notnull_bool(i < args.get$length())) { |
| 11119 value = args.values.$index(i); | 11377 value = args.values.$index(i); |
| 11120 } | 11378 } |
| 11121 else { | 11379 else { |
| 11122 value = args.getValue(this.parameters.$index(i).get$name()); | 11380 value = args.getValue($assert_String(this.parameters.$index(i).get$name(
))); |
| 11123 if (value == null) { | 11381 if ($notnull_bool(value == null)) { |
| 11124 value = this.parameters.$index(i).get$value(); | 11382 value = this.parameters.$index(i).get$value(); |
| 11125 } | 11383 } |
| 11126 } | 11384 } |
| 11127 fields.$setindex(fname, value); | 11385 fields.$setindex(fname, value); |
| 11128 } | 11386 } |
| 11129 } | 11387 } |
| 11130 if (this.definition.initializers != null) { | 11388 if ($notnull_bool(this.definition.initializers != null)) { |
| 11131 this.generator._pushBlock(false); | 11389 this.generator._pushBlock(false); |
| 11132 for (var j = 0; | 11390 for (var j = 0; |
| 11133 j < this.definition.formals.length; j++) { | 11391 $notnull_bool(j < this.definition.formals.length); j++) { |
| 11134 var name0 = this.definition.formals.$index(j).get$name().get$name(); | 11392 var name0 = this.definition.formals.$index(j).get$name().get$name(); |
| 11135 var value = null; | 11393 var value = null; |
| 11136 if (j < args.get$length()) { | 11394 if ($notnull_bool(j < args.get$length())) { |
| 11137 value = args.values.$index(j); | 11395 value = args.values.$index(j); |
| 11138 } | 11396 } |
| 11139 else { | 11397 else { |
| 11140 value = args.getValue(this.parameters.$index(j).get$name()); | 11398 value = args.getValue($assert_String(this.parameters.$index(j).get$name(
))); |
| 11141 if (value == null) { | 11399 if ($notnull_bool(value == null)) { |
| 11142 value = this.parameters.$index(j).get$value(); | 11400 value = this.parameters.$index(j).get$value(); |
| 11143 } | 11401 } |
| 11144 } | 11402 } |
| 11145 this.generator._scope._vars.$setindex(name0, value); | 11403 this.generator._scope._vars.$setindex(name0, value); |
| 11146 } | 11404 } |
| 11147 var $list = this.definition.initializers; | 11405 var $list = this.definition.initializers; |
| 11148 for (var $i = 0;$i < $list.length; $i++) { | 11406 for (var $i = 0;$i < $list.length; $i++) { |
| 11149 var init = $list.$index($i); | 11407 var init = $list.$index($i); |
| 11150 if ((init instanceof CallExpression)) { | 11408 if ($notnull_bool((init instanceof CallExpression))) { |
| 11151 var delegateArgs = this.generator._makeArgs(init.get$arguments()); | 11409 var delegateArgs = this.generator._makeArgs((($0 = init.get$arguments())
&& $0.is$List$ArgumentNode())); |
| 11152 var value = this.initDelegate.invoke(this.generator, node, target, deleg
ateArgs, false); | 11410 var value = this.initDelegate.invoke(this.generator, node, target, deleg
ateArgs, false); |
| 11153 if ((init.target instanceof ThisExpression)) { | 11411 if ($notnull_bool((init.target instanceof ThisExpression))) { |
| 11154 return value; | 11412 return value; |
| 11155 } | 11413 } |
| 11156 else { | 11414 else { |
| 11157 if ((value instanceof GlobalValue)) { | 11415 if ($notnull_bool((value instanceof GlobalValue))) { |
| 11158 value = value.exp; | 11416 value = value.exp; |
| 11159 } | 11417 } |
| 11160 var $list0 = value.fields.getKeys(); | 11418 var $list0 = value.fields.getKeys(); |
| 11161 for (var $i0 = value.fields.getKeys().iterator(); $i0.hasNext(); ) { | 11419 for (var $i0 = value.fields.getKeys().iterator(); $i0.hasNext(); ) { |
| 11162 var fname = $i0.next(); | 11420 var fname = $i0.next(); |
| 11163 fields.$setindex(fname, value.fields.$index(fname)); | 11421 fields.$setindex(fname, value.fields.$index(fname)); |
| 11164 } | 11422 } |
| 11165 } | 11423 } |
| 11166 } | 11424 } |
| 11167 else { | 11425 else { |
| 11168 var fname = init.x.get$name().get$name(); | 11426 var fname = init.x.get$name().get$name(); |
| 11169 var val = this.generator.visitValue(init.y); | 11427 var val = this.generator.visitValue(init.y); |
| 11170 fields.$setindex(fname, val); | 11428 fields.$setindex(fname, val); |
| 11171 } | 11429 } |
| 11172 } | 11430 } |
| 11173 this.generator._popBlock(); | 11431 this.generator._popBlock(); |
| 11174 } | 11432 } |
| 11175 var $list = this.declaringType.members.getValues(); | 11433 var $list = this.declaringType.members.getValues(); |
| 11176 for (var $i = this.declaringType.members.getValues().iterator(); $i.hasNext();
) { | 11434 for (var $i = this.declaringType.members.getValues().iterator(); $i.hasNext();
) { |
| 11177 var f = $i.next(); | 11435 var f = $i.next(); |
| 11178 if ((f instanceof FieldMember) && !f.get$isStatic() && $ne(f.get$value(), nu
ll) && !fields.containsKey(f.get$name())) { | 11436 if ($notnull_bool((f instanceof FieldMember) && !f.get$isStatic() && $ne(f.g
et$value(), null) && !fields.containsKey(f.get$name()))) { |
| 11179 fields.$setindex(f.get$name(), f.computeValue()); | 11437 fields.$setindex(f.get$name(), f.computeValue()); |
| 11180 } | 11438 } |
| 11181 } | 11439 } |
| 11182 return world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(this
.declaringType, fields, code, node.span), args.values); | 11440 return world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(this
.declaringType, fields, code, node.span), args.values); |
| 11183 } | 11441 } |
| 11184 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
gsCode) { | 11442 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
gsCode) { |
| 11185 var allConst = target.get$isConst() && args.values.every((function (arg) { | 11443 var allConst = target.get$isConst() && args.values.every((function (arg) { |
| 11186 return arg.get$isConst(); | 11444 return arg.get$isConst(); |
| 11187 }) | 11445 }) |
| 11188 ); | 11446 ); |
| 11189 if (this.declaringType.get$isNum()) { | 11447 if ($notnull_bool(this.declaringType.get$isNum())) { |
| 11190 if (!allConst) { | 11448 if ($notnull_bool(!allConst)) { |
| 11191 var code; | 11449 var code; |
| 11192 if (this.name == '\$negate') { | 11450 if ($notnull_bool(this.name == '\$negate')) { |
| 11193 code = ('-' + target.code + ''); | 11451 code = ('-' + target.code + ''); |
| 11194 } | 11452 } |
| 11195 else if (this.name == '\$bit_not') { | 11453 else if ($notnull_bool(this.name == '\$bit_not')) { |
| 11196 code = ('~' + target.code + ''); | 11454 code = ('~' + target.code + ''); |
| 11197 } | 11455 } |
| 11198 else if (this.name == '\$truncdiv') { | 11456 else if ($notnull_bool(this.name == '\$truncdiv')) { |
| 11199 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) +
')'); | 11457 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) +
')'); |
| 11200 } | 11458 } |
| 11201 else if (this.name == '\$mod') { | 11459 else if ($notnull_bool(this.name == '\$mod')) { |
| 11202 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) +
')'); | 11460 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) +
')'); |
| 11203 } | 11461 } |
| 11204 else { | 11462 else { |
| 11205 var op = TokenKind.rawOperatorFromMethod(this.name); | 11463 var op = TokenKind.rawOperatorFromMethod(this.name); |
| 11206 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''); | 11464 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''); |
| 11207 } | 11465 } |
| 11208 return new Value(this.returnType, code, false, true, false); | 11466 return new Value(this.returnType, code, false, true, false); |
| 11209 } | 11467 } |
| 11210 else { | 11468 else { |
| 11211 var value; | 11469 var value; |
| 11212 var val0, val1, ival0, ival1; | 11470 var val0, val1, ival0, ival1; |
| 11213 val0 = target.get$dynamic().get$actualValue(); | 11471 val0 = $assert_num(target.get$dynamic().get$actualValue()); |
| 11214 ival0 = val0.toInt(); | 11472 ival0 = val0.toInt(); |
| 11215 if (args.values.length > 0) { | 11473 if ($notnull_bool(args.values.length > 0)) { |
| 11216 val1 = args.values.$index(0).get$dynamic().get$actualValue(); | 11474 val1 = $assert_num(args.values.$index(0).get$dynamic().get$actualValue()
); |
| 11217 ival1 = val1.toInt(); | 11475 ival1 = val1.toInt(); |
| 11218 } | 11476 } |
| 11219 switch (this.name) { | 11477 switch (this.name) { |
| 11220 case '\$negate': | 11478 case '\$negate': |
| 11221 | 11479 |
| 11222 value = -val0; | 11480 value = -val0; |
| 11223 break; | 11481 break; |
| 11224 | 11482 |
| 11225 case '\$add': | 11483 case '\$add': |
| 11226 | 11484 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11314 | 11572 |
| 11315 case '\$shr': | 11573 case '\$shr': |
| 11316 | 11574 |
| 11317 value = (ival0 >>> ival1).toDouble(); | 11575 value = (ival0 >>> ival1).toDouble(); |
| 11318 break; | 11576 break; |
| 11319 | 11577 |
| 11320 } | 11578 } |
| 11321 return EvaluatedValue.EvaluatedValue$factory(this.returnType, value, ("" +
value + ""), node.span); | 11579 return EvaluatedValue.EvaluatedValue$factory(this.returnType, value, ("" +
value + ""), node.span); |
| 11322 } | 11580 } |
| 11323 } | 11581 } |
| 11324 else if (this.declaringType.get$isString()) { | 11582 else if ($notnull_bool(this.declaringType.get$isString())) { |
| 11325 if (this.name == '\$index') { | 11583 if ($notnull_bool(this.name == '\$index')) { |
| 11326 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i
ndex(0) + ']'), false, true, false); | 11584 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i
ndex(0) + ']'), false, true, false); |
| 11327 } | 11585 } |
| 11328 else if (this.name == '\$add') { | 11586 else if ($notnull_bool(this.name == '\$add')) { |
| 11329 if (allConst) { | 11587 if ($notnull_bool(allConst)) { |
| 11330 var val0 = target.get$dynamic().get$actualValue(); | 11588 var val0 = target.get$dynamic().get$actualValue(); |
| 11331 val0 = val0.substring(1, val0.length - 1); | 11589 val0 = val0.substring(1, val0.length - 1); |
| 11332 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); | 11590 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); |
| 11333 if (args.values.$index(0).type.get$isString()) { | 11591 if ($notnull_bool(args.values.$index(0).type.get$isString())) { |
| 11334 val1 = val1.substring(1, val1.length - 1); | 11592 val1 = val1.substring(1, val1.length - 1); |
| 11335 } | 11593 } |
| 11336 var value = ('' + val0 + '' + val1 + ''); | 11594 var value = ('' + val0 + '' + val1 + ''); |
| 11337 value = '"' + value.replaceAll('"', '\\"') + '"'; | 11595 value = '"' + value.replaceAll('"', '\\"') + '"'; |
| 11338 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, va
lue, node.span); | 11596 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, va
lue, node.span); |
| 11339 } | 11597 } |
| 11340 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM
PTY()); | 11598 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM
PTY()); |
| 11341 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode.
$index(0) + ''), false, true, false); | 11599 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode.
$index(0) + ''), false, true, false); |
| 11342 } | 11600 } |
| 11343 } | 11601 } |
| 11344 else if (this.declaringType.get$isNativeType()) { | 11602 else if ($notnull_bool(this.declaringType.get$isNativeType())) { |
| 11345 if (this.name == '\$index') { | 11603 if ($notnull_bool(this.name == '\$index')) { |
| 11346 return new Value(null, ('' + target.code + '[' + argsCode.$index(0) + ']')
, false, true, false); | 11604 return new Value(null, ('' + target.code + '[' + argsCode.$index(0) + ']')
, false, true, false); |
| 11347 } | 11605 } |
| 11348 else if (this.name == '\$setindex') { | 11606 else if ($notnull_bool(this.name == '\$setindex')) { |
| 11349 return new Value(null, ('' + target.code + '[' + argsCode.$index(0) + '] =
' + argsCode.$index(1) + ''), false, true, false); | 11607 return new Value(null, ('' + target.code + '[' + argsCode.$index(0) + '] =
' + argsCode.$index(1) + ''), false, true, false); |
| 11350 } | 11608 } |
| 11351 } | 11609 } |
| 11352 if (this.name == '\$eq' || this.name == '\$ne') { | 11610 if ($notnull_bool(this.name == '\$eq' || this.name == '\$ne')) { |
| 11353 var op = this.name == '\$eq' ? '==' : '!='; | 11611 var op = $notnull_bool(this.name == '\$eq') ? '==' : '!='; |
| 11354 if (allConst) { | 11612 if ($notnull_bool(allConst)) { |
| 11355 var val0 = target.get$dynamic().get$actualValue(); | 11613 var val0 = target.get$dynamic().get$actualValue(); |
| 11356 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); | 11614 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); |
| 11357 var newVal = this.name == '\$eq' ? $eq(val0, val1) : $ne(val0, val1); | 11615 var newVal = $notnull_bool(this.name == '\$eq') ? $eq(val0, val1) : $ne(va
l0, val1); |
| 11358 return EvaluatedValue.EvaluatedValue$factory(world.boolType, newVal, ("" +
newVal + ""), node.span); | 11616 return EvaluatedValue.EvaluatedValue$factory(world.boolType, newVal, ("" +
newVal + ""), node.span); |
| 11359 } | 11617 } |
| 11360 if ($eq(argsCode.$index(0), 'null')) { | 11618 if ($notnull_bool($eq(argsCode.$index(0), 'null'))) { |
| 11361 return new Value(this.returnType, ('' + target.code + ' ' + op + ' null'),
false, true, false); | 11619 return new Value(this.returnType, ('' + target.code + ' ' + op + ' null'),
false, true, false); |
| 11362 } | 11620 } |
| 11363 else if (target.type.get$isNum() || target.type.get$isString()) { | 11621 else if ($notnull_bool(target.type.get$isNum() || target.type.get$isString()
)) { |
| 11364 return new Value(this.returnType, ('' + target.code + ' ' + op + ' ' + arg
sCode.$index(0) + ''), false, true, false); | 11622 return new Value(this.returnType, ('' + target.code + ' ' + op + ' ' + arg
sCode.$index(0) + ''), false, true, false); |
| 11365 } | 11623 } |
| 11366 return new Value(this.returnType, ('' + this.name + '(' + target.code + ', '
+ argsCode.$index(0) + ')'), false, true, false); | 11624 return new Value(this.returnType, ('' + this.name + '(' + target.code + ', '
+ argsCode.$index(0) + ')'), false, true, false); |
| 11367 } | 11625 } |
| 11368 if (this.name == '\$call') { | 11626 if ($notnull_bool(this.name == '\$call')) { |
| 11369 this.declaringType.markUsed(); | 11627 this.declaringType.markUsed(); |
| 11370 return new Value(this.returnType, ('' + target.code + '(' + Strings.join(arg
sCode, ", ") + ')'), false, true, false); | 11628 return new Value(this.returnType, ('' + target.code + '(' + Strings.join((ar
gsCode && argsCode.is$List$String()), ", ") + ')'), false, true, false); |
| 11371 } | 11629 } |
| 11372 return target.invokeSpecial(this.get$jsname(), args, this.returnType); | 11630 return target.invokeSpecial(this.get$jsname(), args, this.returnType); |
| 11373 } | 11631 } |
| 11374 MethodMember.prototype.resolve = function(inType) { | 11632 MethodMember.prototype.resolve = function(inType) { |
| 11375 this.isStatic = inType.get$isTop(); | 11633 this.isStatic = inType.get$isTop(); |
| 11376 this.isConst = false; | 11634 this.isConst = false; |
| 11377 this.isFactory = false; | 11635 this.isFactory = false; |
| 11378 this.isAbstract = false; | 11636 this.isAbstract = false; |
| 11379 if (this.definition.modifiers != null) { | 11637 if ($notnull_bool(this.definition.modifiers != null)) { |
| 11380 var $list = this.definition.modifiers; | 11638 var $list = this.definition.modifiers; |
| 11381 for (var $i = 0;$i < $list.length; $i++) { | 11639 for (var $i = 0;$i < $list.length; $i++) { |
| 11382 var mod = $list.$index($i); | 11640 var mod = $list.$index($i); |
| 11383 if (mod.kind == 85/*TokenKind.STATIC*/) { | 11641 if ($notnull_bool(mod.kind == 86/*TokenKind.STATIC*/)) { |
| 11384 if (this.isStatic) { | 11642 if ($notnull_bool(this.isStatic)) { |
| 11385 world.error('duplicate static modifier', mod.get$span()); | 11643 world.error('duplicate static modifier', mod.get$span()); |
| 11386 } | 11644 } |
| 11387 this.isStatic = true; | 11645 this.isStatic = true; |
| 11388 } | 11646 } |
| 11389 else if (this.get$isConstructor() && mod.kind == 90/*TokenKind.CONST*/) { | 11647 else if ($notnull_bool(this.get$isConstructor() && mod.kind == 91/*TokenKi
nd.CONST*/)) { |
| 11390 if (this.isConst) { | 11648 if ($notnull_bool(this.isConst)) { |
| 11391 world.error('duplicate const modifier', mod.get$span()); | 11649 world.error('duplicate const modifier', mod.get$span()); |
| 11392 } | 11650 } |
| 11393 this.isConst = true; | 11651 this.isConst = true; |
| 11394 } | 11652 } |
| 11395 else if (mod.kind == 74/*TokenKind.FACTORY*/) { | 11653 else if ($notnull_bool(mod.kind == 75/*TokenKind.FACTORY*/)) { |
| 11396 if (this.isFactory) { | 11654 if ($notnull_bool(this.isFactory)) { |
| 11397 world.error('duplicate factory modifier', mod.get$span()); | 11655 world.error('duplicate factory modifier', mod.get$span()); |
| 11398 } | 11656 } |
| 11399 this.isFactory = true; | 11657 this.isFactory = true; |
| 11400 } | 11658 } |
| 11401 else if (mod.kind == 70/*TokenKind.ABSTRACT*/) { | 11659 else if ($notnull_bool(mod.kind == 71/*TokenKind.ABSTRACT*/)) { |
| 11402 if (this.isAbstract) { | 11660 if ($notnull_bool(this.isAbstract)) { |
| 11403 world.error('duplicate abstract modifier', mod.get$span()); | 11661 world.error('duplicate abstract modifier', mod.get$span()); |
| 11404 } | 11662 } |
| 11405 this.isAbstract = true; | 11663 this.isAbstract = true; |
| 11406 } | 11664 } |
| 11407 else { | 11665 else { |
| 11408 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span
()); | 11666 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span
()); |
| 11409 } | 11667 } |
| 11410 } | 11668 } |
| 11411 } | 11669 } |
| 11412 if (this.isFactory) { | 11670 if ($notnull_bool(this.isFactory)) { |
| 11413 this.isStatic = true; | 11671 this.isStatic = true; |
| 11414 } | 11672 } |
| 11415 if (this.isAbstract) { | 11673 if ($notnull_bool(this.isAbstract)) { |
| 11416 if (this.definition.body != null) { | 11674 if ($notnull_bool(this.definition.body != null)) { |
| 11417 world.error('abstract method can not have a body', this.definition.body.sp
an); | 11675 world.error('abstract method can not have a body', this.definition.body.sp
an); |
| 11418 } | 11676 } |
| 11419 if (this.isStatic) { | 11677 if ($notnull_bool(this.isStatic)) { |
| 11420 world.error('static method can not be abstract', this.definition.span); | 11678 world.error('static method can not be abstract', this.definition.span); |
| 11421 } | 11679 } |
| 11422 } | 11680 } |
| 11423 else { | 11681 else { |
| 11424 } | 11682 } |
| 11425 if (this.get$isConstructor()) { | 11683 if ($notnull_bool(this.get$isConstructor())) { |
| 11426 this.returnType = this.declaringType; | 11684 this.returnType = this.declaringType; |
| 11427 } | 11685 } |
| 11428 else { | 11686 else { |
| 11429 this.returnType = inType.resolveType(this.definition.returnType, false); | 11687 this.returnType = inType.resolveType(this.definition.returnType, false); |
| 11430 if (this.isStatic && this.returnType.get$hasTypeParams()) { | 11688 if ($notnull_bool(this.isStatic && this.returnType.get$hasTypeParams())) { |
| 11431 world.error('using type parameter in static context', this.definition.retu
rnType.span); | 11689 world.error('using type parameter in static context', this.definition.retu
rnType.span); |
| 11432 } | 11690 } |
| 11433 } | 11691 } |
| 11434 this.parameters = []; | 11692 this.parameters = []; |
| 11435 var $list = this.definition.formals; | 11693 var $list = this.definition.formals; |
| 11436 for (var $i = 0;$i < $list.length; $i++) { | 11694 for (var $i = 0;$i < $list.length; $i++) { |
| 11437 var formal = $list.$index($i); | 11695 var formal = $list.$index($i); |
| 11438 var param = new lang_Parameter(formal); | 11696 var param = new lang_Parameter(formal); |
| 11439 param.resolve(inType); | 11697 param.resolve(inType); |
| 11440 this.parameters.add(param); | 11698 this.parameters.add(param); |
| 11441 if (this.isStatic && param.type.get$hasTypeParams()) { | 11699 if ($notnull_bool(this.isStatic && param.type.get$hasTypeParams())) { |
| 11442 world.error('using type parameter in static context', formal.get$span()); | 11700 world.error('using type parameter in static context', formal.get$span()); |
| 11443 } | 11701 } |
| 11444 } | 11702 } |
| 11445 if (!this.isLambda) { | 11703 if ($notnull_bool(!this.isLambda)) { |
| 11446 this.get$library()._addMember(this); | 11704 this.get$library()._addMember(this); |
| 11447 } | 11705 } |
| 11448 } | 11706 } |
| 11449 MethodMember.prototype.get_$3 = function($0, $1, $2) { | 11707 MethodMember.prototype.get_$3 = function($0, $1, $2) { |
| 11450 return this.get_($0, $1, $2, false); | 11708 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 11451 } | 11709 } |
| 11452 ; | 11710 ; |
| 11453 MethodMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 11711 MethodMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 11454 return this.invoke($0, $1, $2, $3, false); | 11712 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); |
| 11455 } | 11713 } |
| 11456 ; | 11714 ; |
| 11457 MethodMember.prototype.set_$4 = function($0, $1, $2, $3) { | 11715 MethodMember.prototype.set_$4 = function($0, $1, $2, $3) { |
| 11458 return this.set_($0, $1, $2, $3, false); | 11716 return this.set_(($0 && $0.is$MethodGenerator()), $1, ($2 && $2.is$Value()), (
$3 && $3.is$Value()), false); |
| 11459 } | 11717 } |
| 11460 ; | 11718 ; |
| 11461 // ********** Code for MemberSet ************** | 11719 // ********** Code for MemberSet ************** |
| 11462 function MemberSet(member) { | 11720 function MemberSet(member) { |
| 11463 this.name = member.name; | 11721 this.name = member.name; |
| 11464 this.members = [member]; | 11722 this.members = [member]; |
| 11465 this.jsname = member.get$jsname(); | 11723 this.jsname = member.get$jsname(); |
| 11466 // Initializers done | 11724 // Initializers done |
| 11467 } | 11725 } |
| 11468 MemberSet.prototype.get$name = function() { return this.name; }; | 11726 MemberSet.prototype.get$name = function() { return this.name; }; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 11483 return this.members.some((function (m) { | 11741 return this.members.some((function (m) { |
| 11484 return m.canInvoke(context, args); | 11742 return m.canInvoke(context, args); |
| 11485 }) | 11743 }) |
| 11486 ); | 11744 ); |
| 11487 } | 11745 } |
| 11488 MemberSet.prototype.get$library = function() { | 11746 MemberSet.prototype.get$library = function() { |
| 11489 var ret = this.members.$index(0).declaringType.get$library(); | 11747 var ret = this.members.$index(0).declaringType.get$library(); |
| 11490 var $list = this.members; | 11748 var $list = this.members; |
| 11491 for (var $i = 0;$i < $list.length; $i++) { | 11749 for (var $i = 0;$i < $list.length; $i++) { |
| 11492 var m = $list.$index($i); | 11750 var m = $list.$index($i); |
| 11493 if ($ne(m.declaringType.get$library(), ret)) return null; | 11751 if ($notnull_bool($ne(m.declaringType.get$library(), ret))) return null; |
| 11494 } | 11752 } |
| 11495 return ret; | 11753 return ret; |
| 11496 } | 11754 } |
| 11497 MemberSet.prototype._makeError = function(node, target, action) { | 11755 MemberSet.prototype._makeError = function(node, target, action) { |
| 11498 if (!target.type.get$isVar()) { | 11756 if ($notnull_bool(!target.type.get$isVar())) { |
| 11499 world.warning(('could not find applicable ' + action + ' for "' + this.name
+ '"'), node.span); | 11757 world.warning(('could not find applicable ' + action + ' for "' + this.name
+ '"'), node.span); |
| 11500 } | 11758 } |
| 11501 return new Value(null, ('' + target.code + '.' + this.jsname + '() /*no applic
able ' + action + '*/'), false, true, false); | 11759 return new Value(null, ('' + target.code + '.' + this.jsname + '() /*no applic
able ' + action + '*/'), false, true, false); |
| 11502 } | 11760 } |
| 11503 MemberSet.prototype.get$treatAsField = function() { | 11761 MemberSet.prototype.get$treatAsField = function() { |
| 11504 if (this._treatAsField == null) { | 11762 if ($notnull_bool(this._treatAsField == null)) { |
| 11505 this._treatAsField = true; | 11763 this._treatAsField = true; |
| 11506 var $list = this.members; | 11764 var $list = this.members; |
| 11507 for (var $i = 0;$i < $list.length; $i++) { | 11765 for (var $i = 0;$i < $list.length; $i++) { |
| 11508 var member = $list.$index($i); | 11766 var member = $list.$index($i); |
| 11509 if (member.get$requiresFieldSyntax()) { | 11767 if ($notnull_bool(member.get$requiresFieldSyntax())) { |
| 11510 this._treatAsField = true; | 11768 this._treatAsField = true; |
| 11511 break; | 11769 break; |
| 11512 } | 11770 } |
| 11513 if (member.get$prefersPropertySyntax()) { | 11771 if ($notnull_bool(member.get$prefersPropertySyntax())) { |
| 11514 this._treatAsField = false; | 11772 this._treatAsField = false; |
| 11515 } | 11773 } |
| 11516 } | 11774 } |
| 11517 var $list = this.members; | 11775 var $list = this.members; |
| 11518 for (var $i = 0;$i < $list.length; $i++) { | 11776 for (var $i = 0;$i < $list.length; $i++) { |
| 11519 var member = $list.$index($i); | 11777 var member = $list.$index($i); |
| 11520 if (this._treatAsField) { | 11778 if ($notnull_bool(this._treatAsField)) { |
| 11521 member.provideFieldSyntax(); | 11779 member.provideFieldSyntax(); |
| 11522 } | 11780 } |
| 11523 else { | 11781 else { |
| 11524 member.providePropertySyntax(); | 11782 member.providePropertySyntax(); |
| 11525 } | 11783 } |
| 11526 } | 11784 } |
| 11527 } | 11785 } |
| 11528 return this._treatAsField; | 11786 return this._treatAsField; |
| 11529 } | 11787 } |
| 11530 MemberSet.prototype.get_ = function(context, node, target, isDynamic) { | 11788 MemberSet.prototype.get_ = function(context, node, target, isDynamic) { |
| 11531 if (this.members.length == 1) { | 11789 var $0; |
| 11790 if ($notnull_bool(this.members.length == 1)) { |
| 11532 return this.members.$index(0).get_(context, node, target, isDynamic); | 11791 return this.members.$index(0).get_(context, node, target, isDynamic); |
| 11533 } | 11792 } |
| 11534 var targets = this.members.filter((function (m) { | 11793 var targets = this.members.filter((function (m) { |
| 11535 return m.get$canGet(); | 11794 return m.get$canGet(); |
| 11536 }) | 11795 }) |
| 11537 ); | 11796 ); |
| 11538 if (targets.length == 1) { | 11797 if ($notnull_bool(targets.length == 1)) { |
| 11539 return targets.$index(0).get_(context, node, target, isDynamic); | 11798 return targets.$index(0).get_(context, node, target, isDynamic); |
| 11540 } | 11799 } |
| 11541 var returnValue = null; | 11800 var returnValue = null; |
| 11542 for (var $i = targets.iterator(); $i.hasNext(); ) { | 11801 for (var $i = targets.iterator(); $i.hasNext(); ) { |
| 11543 var member = $i.next(); | 11802 var member = $i.next(); |
| 11544 var value = member.get_(context, node, target, true); | 11803 var value = member.get_(context, node, target, true); |
| 11545 returnValue = this._tryUnion(returnValue, value, node); | 11804 returnValue = this._tryUnion(returnValue, value, node); |
| 11546 } | 11805 } |
| 11547 if (returnValue == null) { | 11806 if ($notnull_bool(returnValue == null)) { |
| 11548 return this._makeError(node, target, 'getter'); | 11807 return this._makeError(node, target, 'getter'); |
| 11549 } | 11808 } |
| 11550 if (returnValue.code == null) { | 11809 if ($notnull_bool(returnValue.code == null)) { |
| 11551 if (this.get$treatAsField()) { | 11810 if ($notnull_bool(this.get$treatAsField())) { |
| 11552 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
''), false, true, false); | 11811 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
''), false, true, false); |
| 11553 } | 11812 } |
| 11554 else { | 11813 else { |
| 11555 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn
ame + '()'), false, true, false); | 11814 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn
ame + '()'), false, true, false); |
| 11556 } | 11815 } |
| 11557 } | 11816 } |
| 11558 return returnValue; | 11817 return returnValue; |
| 11559 } | 11818 } |
| 11560 MemberSet.prototype.set_ = function(context, node, target, value, isDynamic) { | 11819 MemberSet.prototype.set_ = function(context, node, target, value, isDynamic) { |
| 11561 if (this.members.length == 1) { | 11820 var $0; |
| 11821 if ($notnull_bool(this.members.length == 1)) { |
| 11562 return this.members.$index(0).set_(context, node, target, value, isDynamic); | 11822 return this.members.$index(0).set_(context, node, target, value, isDynamic); |
| 11563 } | 11823 } |
| 11564 var targets = this.members.filter((function (m) { | 11824 var targets = this.members.filter((function (m) { |
| 11565 return m.get$canSet(); | 11825 return m.get$canSet(); |
| 11566 }) | 11826 }) |
| 11567 ); | 11827 ); |
| 11568 if (targets.length == 1) { | 11828 if ($notnull_bool(targets.length == 1)) { |
| 11569 return targets.$index(0).set_(context, node, target, value, isDynamic); | 11829 return targets.$index(0).set_(context, node, target, value, isDynamic); |
| 11570 } | 11830 } |
| 11571 var returnValue = null; | 11831 var returnValue = null; |
| 11572 for (var $i = targets.iterator(); $i.hasNext(); ) { | 11832 for (var $i = targets.iterator(); $i.hasNext(); ) { |
| 11573 var member = $i.next(); | 11833 var member = $i.next(); |
| 11574 var res = member.set_(context, node, target, value, true); | 11834 var res = member.set_(context, node, target, value, true); |
| 11575 returnValue = this._tryUnion(returnValue, res, node); | 11835 returnValue = this._tryUnion(returnValue, (res && res.is$Value()), node); |
| 11576 } | 11836 } |
| 11577 if (returnValue == null) { | 11837 if ($notnull_bool(returnValue == null)) { |
| 11578 return this._makeError(node, target, 'setter'); | 11838 return this._makeError(node, target, 'setter'); |
| 11579 } | 11839 } |
| 11580 if (returnValue.code == null) { | 11840 if ($notnull_bool(returnValue.code == null)) { |
| 11581 if (this.get$treatAsField()) { | 11841 if ($notnull_bool(this.get$treatAsField())) { |
| 11582 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
' = ' + value.code + ''), false, true, false); | 11842 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
' = ' + value.code + ''), false, true, false); |
| 11583 } | 11843 } |
| 11584 else { | 11844 else { |
| 11585 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn
ame + '(' + value.code + ')'), false, true, false); | 11845 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn
ame + '(' + value.code + ')'), false, true, false); |
| 11586 } | 11846 } |
| 11587 } | 11847 } |
| 11588 return returnValue; | 11848 return returnValue; |
| 11589 } | 11849 } |
| 11590 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { | 11850 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 11591 if (this.members.length == 1) { | 11851 var $0; |
| 11852 if ($notnull_bool(this.members.length == 1)) { |
| 11592 return this.members.$index(0).invoke(context, node, target, args, isDynamic)
; | 11853 return this.members.$index(0).invoke(context, node, target, args, isDynamic)
; |
| 11593 } | 11854 } |
| 11594 var targets = this.members.filter((function (m) { | 11855 var targets = this.members.filter((function (m) { |
| 11595 return m.canInvoke(context, args); | 11856 return m.canInvoke(context, args); |
| 11596 }) | 11857 }) |
| 11597 ); | 11858 ); |
| 11598 if (targets.length == 1) { | 11859 if ($notnull_bool(targets.length == 1)) { |
| 11599 return targets.$index(0).invoke(context, node, target, args, isDynamic); | 11860 return targets.$index(0).invoke(context, node, target, args, isDynamic); |
| 11600 } | 11861 } |
| 11601 var returnValue = null; | 11862 var returnValue = null; |
| 11602 for (var $i = targets.iterator(); $i.hasNext(); ) { | 11863 for (var $i = targets.iterator(); $i.hasNext(); ) { |
| 11603 var member = $i.next(); | 11864 var member = $i.next(); |
| 11604 var res = member.invoke(context, node, target, args, true); | 11865 var res = member.invoke(context, node, target, args, true); |
| 11605 returnValue = this._tryUnion(returnValue, res, node); | 11866 returnValue = this._tryUnion(returnValue, (res && res.is$Value()), node); |
| 11606 } | 11867 } |
| 11607 if (returnValue == null) { | 11868 if ($notnull_bool(returnValue == null)) { |
| 11608 return this._makeError(node, target, 'method'); | 11869 return this._makeError(node, target, 'method'); |
| 11609 } | 11870 } |
| 11610 if (returnValue.code == null) { | 11871 if ($notnull_bool(returnValue.code == null)) { |
| 11611 if (this.name.startsWith('\$')) { | 11872 if ($notnull_bool(this.name.startsWith('\$'))) { |
| 11612 return target.invokeSpecial(this.name, args, returnValue.type); | 11873 return target.invokeSpecial(this.name, args, returnValue.type); |
| 11613 } | 11874 } |
| 11614 else { | 11875 else { |
| 11615 return this.invokeOnVar(context, node, target, args); | 11876 return this.invokeOnVar(context, node, target, args); |
| 11616 } | 11877 } |
| 11617 } | 11878 } |
| 11618 return returnValue; | 11879 return returnValue; |
| 11619 } | 11880 } |
| 11620 MemberSet.prototype.invokeOnVar = function(context, node, target, args) { | 11881 MemberSet.prototype.invokeOnVar = function(context, node, target, args) { |
| 11621 return this.getVarMember(context, node, args).invoke(context, node, target, ar
gs); | 11882 return this.getVarMember(context, node, args).invoke(context, node, target, ar
gs); |
| 11622 } | 11883 } |
| 11623 MemberSet.prototype._tryUnion = function(x, y, node) { | 11884 MemberSet.prototype._tryUnion = function(x, y, node) { |
| 11624 if (x == null) return y; | 11885 if ($notnull_bool(x == null)) return y; |
| 11625 var type = lang_Type.union(x.type, y.type); | 11886 var type = lang_Type.union(x.type, y.type); |
| 11626 if (x.code == y.code) { | 11887 if ($notnull_bool(x.code == y.code)) { |
| 11627 if ($eq(type, x.type)) { | 11888 if ($notnull_bool($eq(type, x.type))) { |
| 11628 return x; | 11889 return x; |
| 11629 } | 11890 } |
| 11630 else if (x.get$isConst() || y.get$isConst()) { | 11891 else if ($notnull_bool(x.get$isConst() || y.get$isConst())) { |
| 11631 world.internalError("unexpected: union of const values "); | 11892 world.internalError("unexpected: union of const values "); |
| 11632 } | 11893 } |
| 11633 else { | 11894 else { |
| 11634 return new Value(type, x.code, x.isSuper && y.isSuper, x.needsTemp || y.ne
edsTemp, x.isType && y.isType); | 11895 return new Value(type, x.code, x.isSuper && y.isSuper, x.needsTemp || y.ne
edsTemp, x.isType && y.isType); |
| 11635 } | 11896 } |
| 11636 } | 11897 } |
| 11637 else { | 11898 else { |
| 11638 return new Value(type, null, false, true, false); | 11899 return new Value(type, null, false, true, false); |
| 11639 } | 11900 } |
| 11640 } | 11901 } |
| 11641 MemberSet.prototype.getVarMember = function(context, node, args) { | 11902 MemberSet.prototype.getVarMember = function(context, node, args) { |
| 11642 if (world.objectType.varStubs == null) { | 11903 if ($notnull_bool(world.objectType.varStubs == null)) { |
| 11643 world.objectType.varStubs = $map([]); | 11904 world.objectType.varStubs = $map([]); |
| 11644 } | 11905 } |
| 11645 var stubName = _getCallStubName(this.name, args); | 11906 var stubName = _getCallStubName(this.name, args); |
| 11646 var stub = world.objectType.varStubs.$index(stubName); | 11907 var stub = world.objectType.varStubs.$index(stubName); |
| 11647 if (stub == null) { | 11908 if ($notnull_bool(stub == null)) { |
| 11648 var mset = context.findMembers(this.name).members; | 11909 var mset = context.findMembers(this.name).members; |
| 11649 var targets = mset.filter((function (m) { | 11910 var targets = mset.filter((function (m) { |
| 11650 return m.canInvoke(context, args); | 11911 return m.canInvoke(context, args); |
| 11651 }) | 11912 }) |
| 11652 ); | 11913 ); |
| 11653 var returnType = reduce(map(targets, (function (t) { | 11914 var returnType = reduce(map((targets && targets.is$Iterable()), (function (t
) { |
| 11654 return t.get$returnType(); | 11915 return t.get$returnType(); |
| 11655 }) | 11916 }) |
| 11656 ), lang_Type.union); | 11917 ), lang_Type.union); |
| 11657 stub = new VarMethodSet(stubName, targets, args, returnType); | 11918 stub = new VarMethodSet($assert_String(stubName), targets, args, returnType)
; |
| 11658 world.objectType.varStubs.$setindex(stubName, stub); | 11919 world.objectType.varStubs.$setindex(stubName, stub); |
| 11659 } | 11920 } |
| 11660 return stub; | 11921 return stub; |
| 11661 } | 11922 } |
| 11662 MemberSet.prototype.get_$3 = function($0, $1, $2) { | 11923 MemberSet.prototype.get_$3 = function($0, $1, $2) { |
| 11663 return this.get_($0, $1, $2, false); | 11924 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 11664 } | 11925 } |
| 11665 ; | 11926 ; |
| 11666 MemberSet.prototype.invoke$4 = function($0, $1, $2, $3) { | 11927 MemberSet.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 11667 return this.invoke($0, $1, $2, $3, false); | 11928 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); |
| 11668 } | 11929 } |
| 11669 ; | 11930 ; |
| 11670 MemberSet.prototype.set_$4 = function($0, $1, $2, $3) { | 11931 MemberSet.prototype.set_$4 = function($0, $1, $2, $3) { |
| 11671 return this.set_($0, $1, $2, $3, false); | 11932 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 11672 } | 11933 } |
| 11673 ; | 11934 ; |
| 11674 // ********** Code for FactoryMap ************** | 11935 // ********** Code for FactoryMap ************** |
| 11675 function FactoryMap() { | 11936 function FactoryMap() { |
| 11676 this.factories = $map([]); | 11937 this.factories = $map([]); |
| 11677 // Initializers done | 11938 // Initializers done |
| 11678 } | 11939 } |
| 11679 FactoryMap.prototype.getFactoriesFor = function(typeName) { | 11940 FactoryMap.prototype.getFactoriesFor = function(typeName) { |
| 11680 var ret = this.factories.$index(typeName); | 11941 var ret = this.factories.$index(typeName); |
| 11681 if (ret == null) { | 11942 if ($notnull_bool(ret == null)) { |
| 11682 ret = $map([]); | 11943 ret = $map([]); |
| 11683 this.factories.$setindex(typeName, ret); | 11944 this.factories.$setindex(typeName, ret); |
| 11684 } | 11945 } |
| 11685 return ret; | 11946 return ret; |
| 11686 } | 11947 } |
| 11687 FactoryMap.prototype.addFactory = function(typeName, name, member) { | 11948 FactoryMap.prototype.addFactory = function(typeName, name, member) { |
| 11688 this.getFactoriesFor(typeName).$setindex(name, member); | 11949 this.getFactoriesFor(typeName).$setindex(name, member); |
| 11689 } | 11950 } |
| 11690 FactoryMap.prototype.getFactory = function(typeName, name) { | 11951 FactoryMap.prototype.getFactory = function(typeName, name) { |
| 11691 return this.getFactoriesFor(typeName).$index(name); | 11952 return this.getFactoriesFor(typeName).$index(name); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 11708 this.end = end; | 11969 this.end = end; |
| 11709 // Initializers done | 11970 // Initializers done |
| 11710 } | 11971 } |
| 11711 lang_Token.prototype.get$source = function() { return this.source; }; | 11972 lang_Token.prototype.get$source = function() { return this.source; }; |
| 11712 lang_Token.prototype.get$text = function() { | 11973 lang_Token.prototype.get$text = function() { |
| 11713 return this.source.get$text().substring(this.start, this.end); | 11974 return this.source.get$text().substring(this.start, this.end); |
| 11714 } | 11975 } |
| 11715 lang_Token.prototype.toString = function() { | 11976 lang_Token.prototype.toString = function() { |
| 11716 var kindText = TokenKind.kindToString(this.kind); | 11977 var kindText = TokenKind.kindToString(this.kind); |
| 11717 var actualText = this.get$text(); | 11978 var actualText = this.get$text(); |
| 11718 if ($ne(kindText, actualText)) { | 11979 if ($notnull_bool($ne(kindText, actualText))) { |
| 11719 if (actualText.length > 10) { | 11980 if ($notnull_bool(actualText.length > 10)) { |
| 11720 actualText = actualText.substring(0, 8) + '...'; | 11981 actualText = actualText.substring(0, 8) + '...'; |
| 11721 } | 11982 } |
| 11722 return ('' + kindText + '(' + actualText + ')'); | 11983 return ('' + kindText + '(' + actualText + ')'); |
| 11723 } | 11984 } |
| 11724 else { | 11985 else { |
| 11725 return kindText; | 11986 return kindText; |
| 11726 } | 11987 } |
| 11727 } | 11988 } |
| 11728 lang_Token.prototype.get$span = function() { | 11989 lang_Token.prototype.get$span = function() { |
| 11729 return new SourceSpan(this.source, this.start, this.end); | 11990 return new SourceSpan(this.source, this.start, this.end); |
| 11730 } | 11991 } |
| 11731 // ********** Code for SourceFile ************** | 11992 // ********** Code for SourceFile ************** |
| 11732 function SourceFile(filename, _text) { | 11993 function SourceFile(filename, _text) { |
| 11733 this.filename = filename; | 11994 this.filename = filename; |
| 11734 this._text = _text; | 11995 this._text = _text; |
| 11735 // Initializers done | 11996 // Initializers done |
| 11736 } | 11997 } |
| 11998 SourceFile.prototype.is$SourceFile = function(){return this;}; |
| 11737 SourceFile.prototype.get$text = function() { | 11999 SourceFile.prototype.get$text = function() { |
| 11738 return this._text; | 12000 return this._text; |
| 11739 } | 12001 } |
| 11740 SourceFile.prototype.get$lineStarts = function() { | 12002 SourceFile.prototype.get$lineStarts = function() { |
| 11741 if (this._lineStarts == null) { | 12003 if ($notnull_bool(this._lineStarts == null)) { |
| 11742 var starts = [0]; | 12004 var starts = [0]; |
| 11743 var index = 0; | 12005 var index = 0; |
| 11744 while (index < this.get$text().length) { | 12006 while ($notnull_bool(index < this.get$text().length)) { |
| 11745 index = this.get$text().indexOf('\n', index) + 1; | 12007 index = this.get$text().indexOf('\n', index) + 1; |
| 11746 if (index <= 0) break; | 12008 if ($notnull_bool(index <= 0)) break; |
| 11747 starts.add(index); | 12009 starts.add(index); |
| 11748 } | 12010 } |
| 11749 starts.add(this.get$text().length + 1); | 12011 starts.add(this.get$text().length + 1); |
| 11750 this._lineStarts = starts; | 12012 this._lineStarts = (starts && starts.is$List$int()); |
| 11751 } | 12013 } |
| 11752 return this._lineStarts; | 12014 return this._lineStarts; |
| 11753 } | 12015 } |
| 11754 SourceFile.prototype.getLine = function(position) { | 12016 SourceFile.prototype.getLine = function(position) { |
| 11755 var starts = this.get$lineStarts(); | 12017 var starts = this.get$lineStarts(); |
| 11756 for (var i = 0; | 12018 for (var i = 0; |
| 11757 i < starts.length; i++) { | 12019 $notnull_bool(i < starts.length); i++) { |
| 11758 if (starts.$index(i) > position) return i - 1; | 12020 if ($notnull_bool(starts.$index(i) > position)) return i - 1; |
| 11759 } | 12021 } |
| 11760 world.internalError('bad position'); | 12022 world.internalError('bad position'); |
| 11761 } | 12023 } |
| 11762 SourceFile.prototype.getColumn = function(line, position) { | 12024 SourceFile.prototype.getColumn = function(line, position) { |
| 11763 return position - this.get$lineStarts().$index(line); | 12025 return position - $assert_num(this.get$lineStarts().$index(line)); |
| 11764 } | 12026 } |
| 11765 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT
ext) { | 12027 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT
ext) { |
| 11766 var line = this.getLine(start); | 12028 var line = this.getLine(start); |
| 11767 var column = this.getColumn(line, start); | 12029 var column = this.getColumn($assert_num(line), start); |
| 11768 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' +
(column + 1) + ': ' + message + '')); | 12030 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' +
(column + 1) + ': ' + message + '')); |
| 11769 if (includeText) { | 12031 if ($notnull_bool(includeText)) { |
| 11770 buf.add('\n'); | 12032 buf.add('\n'); |
| 11771 var textLine; | 12033 var textLine; |
| 11772 if ((line + 2) < this._lineStarts.length) { | 12034 if ($notnull_bool((line + 2) < this._lineStarts.length)) { |
| 11773 textLine = this.get$text().substring(this._lineStarts.$index(line), this._
lineStarts.$index(line + 1)); | 12035 textLine = this.get$text().substring(this._lineStarts.$index(line), this._
lineStarts.$index(line + 1)); |
| 11774 } | 12036 } |
| 11775 else { | 12037 else { |
| 11776 textLine = this.get$text().substring(this._lineStarts.$index(line)) + '\n'
; | 12038 textLine = this.get$text().substring(this._lineStarts.$index(line)) + '\n'
; |
| 11777 } | 12039 } |
| 11778 buf.add(textLine); | 12040 buf.add(textLine); |
| 11779 var i = 0; | 12041 var i = 0; |
| 11780 for (; i < column; i++) { | 12042 for (; $notnull_bool(i < $assert_num(column)); i++) { |
| 11781 buf.add(' '); | 12043 buf.add(' '); |
| 11782 } | 12044 } |
| 11783 var toColumn = Math.min(column + (end - start), textLine.length); | 12045 var toColumn = Math.min($assert_num(column + (end - start)), textLine.length
); |
| 11784 for (; i < toColumn; i++) { | 12046 for (; $notnull_bool(i < toColumn); i++) { |
| 11785 buf.add('^'); | 12047 buf.add('^'); |
| 11786 } | 12048 } |
| 11787 } | 12049 } |
| 11788 return buf.toString(); | 12050 return buf.toString(); |
| 11789 } | 12051 } |
| 11790 SourceFile.prototype.compareTo = function(other) { | 12052 SourceFile.prototype.compareTo = function(other) { |
| 11791 if (this.orderInLibrary != null && other.orderInLibrary != null) { | 12053 if ($notnull_bool(this.orderInLibrary != null && other.orderInLibrary != null)
) { |
| 11792 return this.orderInLibrary - other.orderInLibrary; | 12054 return this.orderInLibrary - other.orderInLibrary; |
| 11793 } | 12055 } |
| 11794 else { | 12056 else { |
| 11795 return this.filename.compareTo(other.filename); | 12057 return this.filename.compareTo(other.filename); |
| 11796 } | 12058 } |
| 11797 } | 12059 } |
| 11798 // ********** Code for SourceSpan ************** | 12060 // ********** Code for SourceSpan ************** |
| 11799 function SourceSpan(file, start, end) { | 12061 function SourceSpan(file, start, end) { |
| 11800 this.file = file; | 12062 this.file = file; |
| 11801 this.start = start; | 12063 this.start = start; |
| 11802 this.end = end; | 12064 this.end = end; |
| 11803 // Initializers done | 12065 // Initializers done |
| 11804 } | 12066 } |
| 12067 SourceSpan.prototype.is$SourceSpan = function(){return this;}; |
| 11805 SourceSpan.prototype.get$text = function() { | 12068 SourceSpan.prototype.get$text = function() { |
| 11806 return this.file.get$text().substring(this.start, this.end); | 12069 return this.file.get$text().substring(this.start, this.end); |
| 11807 } | 12070 } |
| 11808 SourceSpan.prototype.toMessageString = function(message) { | 12071 SourceSpan.prototype.toMessageString = function(message) { |
| 11809 return this.file.getLocationMessage(message, this.start, this.end, true); | 12072 return this.file.getLocationMessage(message, this.start, this.end, true); |
| 11810 } | 12073 } |
| 11811 SourceSpan.prototype.get$locationText = function() { | 12074 SourceSpan.prototype.get$locationText = function() { |
| 11812 var line = this.file.getLine(this.start); | 12075 var line = this.file.getLine(this.start); |
| 11813 var column = this.file.getColumn(line, this.start); | 12076 var column = this.file.getColumn($assert_num(line), this.start); |
| 11814 return ('' + this.file.filename + ':' + (line + 1) + ':' + (column + 1) + ''); | 12077 return ('' + this.file.filename + ':' + (line + 1) + ':' + (column + 1) + ''); |
| 11815 } | 12078 } |
| 11816 SourceSpan.prototype.compareTo = function(other) { | 12079 SourceSpan.prototype.compareTo = function(other) { |
| 11817 if ($eq(this.file, other.file)) { | 12080 if ($notnull_bool($eq(this.file, other.file))) { |
| 11818 var d = this.start - other.start; | 12081 var d = this.start - other.start; |
| 11819 return d == 0 ? (this.end - other.end) : d; | 12082 return $notnull_bool(d == 0) ? (this.end - other.end) : d; |
| 11820 } | 12083 } |
| 11821 return this.file.compareTo(other.file); | 12084 return this.file.compareTo(other.file); |
| 11822 } | 12085 } |
| 11823 // ********** Code for InterpStack ************** | 12086 // ********** Code for InterpStack ************** |
| 11824 function InterpStack(previous, quote, isMultiline) { | 12087 function InterpStack(previous, quote, isMultiline) { |
| 11825 this.previous = previous; | 12088 this.previous = previous; |
| 11826 this.quote = quote; | 12089 this.quote = quote; |
| 11827 this.isMultiline = isMultiline; | 12090 this.isMultiline = isMultiline; |
| 11828 this.depth = -1; | 12091 this.depth = -1; |
| 11829 // Initializers done | 12092 // Initializers done |
| 11830 } | 12093 } |
| 11831 InterpStack.prototype.pop = function() { | 12094 InterpStack.prototype.pop = function() { |
| 11832 return this.previous; | 12095 return this.previous; |
| 11833 } | 12096 } |
| 11834 InterpStack.push = function(stack, quote0, isMultiline0) { | 12097 InterpStack.push = function(stack, quote0, isMultiline0) { |
| 11835 var newStack = new InterpStack(stack, quote0, isMultiline0); | 12098 var newStack = new InterpStack(stack, quote0, isMultiline0); |
| 11836 if (stack != null) newStack.previous = stack; | 12099 if ($notnull_bool(stack != null)) newStack.previous = stack; |
| 11837 return newStack; | 12100 return newStack; |
| 11838 } | 12101 } |
| 11839 // ********** Code for TokenizerBase ************** | 12102 // ********** Code for TokenizerBase ************** |
| 11840 function TokenizerBase(_source, _skipWhitespace, _index) { | 12103 function TokenizerBase(_source, _skipWhitespace, _index) { |
| 11841 this._source = _source; | 12104 this._source = _source; |
| 11842 this._skipWhitespace = _skipWhitespace; | 12105 this._skipWhitespace = _skipWhitespace; |
| 11843 this._lang_index = _index; | 12106 this._lang_index = _index; |
| 11844 // Initializers done | 12107 // Initializers done |
| 11845 this._text = this._source.get$text(); | 12108 this._text = this._source.get$text(); |
| 11846 } | 12109 } |
| 11847 $inherits(TokenizerBase, TokenizerHelpers); | 12110 $inherits(TokenizerBase, TokenizerHelpers); |
| 11848 TokenizerBase.prototype._nextChar = function() { | 12111 TokenizerBase.prototype._nextChar = function() { |
| 11849 if (this._lang_index < this._text.length) { | 12112 if ($notnull_bool(this._lang_index < this._text.length)) { |
| 11850 return this._text.charCodeAt(this._lang_index++); | 12113 return this._text.charCodeAt(this._lang_index++); |
| 11851 } | 12114 } |
| 11852 else { | 12115 else { |
| 11853 return 0; | 12116 return 0; |
| 11854 } | 12117 } |
| 11855 } | 12118 } |
| 11856 TokenizerBase.prototype._peekChar = function() { | 12119 TokenizerBase.prototype._peekChar = function() { |
| 11857 if (this._lang_index < this._text.length) { | 12120 if ($notnull_bool(this._lang_index < this._text.length)) { |
| 11858 return this._text.charCodeAt(this._lang_index); | 12121 return this._text.charCodeAt(this._lang_index); |
| 11859 } | 12122 } |
| 11860 else { | 12123 else { |
| 11861 return 0; | 12124 return 0; |
| 11862 } | 12125 } |
| 11863 } | 12126 } |
| 11864 TokenizerBase.prototype._maybeEatChar = function(ch) { | 12127 TokenizerBase.prototype._maybeEatChar = function(ch) { |
| 11865 if (this._lang_index < this._text.length) { | 12128 if ($notnull_bool(this._lang_index < this._text.length)) { |
| 11866 if (this._text.charCodeAt(this._lang_index) == ch) { | 12129 if ($notnull_bool(this._text.charCodeAt(this._lang_index) == ch)) { |
| 11867 this._lang_index++; | 12130 this._lang_index++; |
| 11868 return true; | 12131 return true; |
| 11869 } | 12132 } |
| 11870 else { | 12133 else { |
| 11871 return false; | 12134 return false; |
| 11872 } | 12135 } |
| 11873 } | 12136 } |
| 11874 else { | 12137 else { |
| 11875 return false; | 12138 return false; |
| 11876 } | 12139 } |
| 11877 } | 12140 } |
| 11878 TokenizerBase.prototype._finishToken = function(kind) { | 12141 TokenizerBase.prototype._finishToken = function(kind) { |
| 11879 return new lang_Token(kind, this._source, this._startIndex, this._lang_index); | 12142 return new lang_Token(kind, this._source, this._startIndex, this._lang_index); |
| 11880 } | 12143 } |
| 11881 TokenizerBase.prototype._errorToken = function() { | 12144 TokenizerBase.prototype._errorToken = function() { |
| 11882 return this._finishToken(64/*TokenKind.ERROR*/); | 12145 return this._finishToken(65/*TokenKind.ERROR*/); |
| 11883 } | 12146 } |
| 11884 TokenizerBase.prototype.finishWhitespace = function() { | 12147 TokenizerBase.prototype.finishWhitespace = function() { |
| 11885 while (this._lang_index < this._text.length) { | 12148 while ($notnull_bool(this._lang_index < this._text.length)) { |
| 11886 if (!TokenizerHelpers.isWhitespace(this._text.charCodeAt(this._lang_index++)
)) { | 12149 if ($notnull_bool(!TokenizerHelpers.isWhitespace(this._text.charCodeAt(this.
_lang_index++)))) { |
| 11887 this._lang_index--; | 12150 this._lang_index--; |
| 11888 return this.next(); | 12151 return this.next(); |
| 11889 } | 12152 } |
| 11890 } | 12153 } |
| 11891 return this._finishToken(1/*TokenKind.END_OF_FILE*/); | 12154 return this._finishToken(1/*TokenKind.END_OF_FILE*/); |
| 11892 } | 12155 } |
| 11893 TokenizerBase.prototype.finishHashBang = function() { | 12156 TokenizerBase.prototype.finishHashBang = function() { |
| 11894 while (true) { | 12157 while ($notnull_bool(true)) { |
| 11895 var ch = this._nextChar(); | 12158 var ch = this._nextChar(); |
| 11896 if (ch == 0 || ch == 10 || ch == 13) { | 12159 if ($notnull_bool(ch == 0 || ch == 10 || ch == 13)) { |
| 11897 return this._finishToken(13/*TokenKind.HASHBANG*/); | 12160 return this._finishToken(13/*TokenKind.HASHBANG*/); |
| 11898 } | 12161 } |
| 11899 } | 12162 } |
| 11900 } | 12163 } |
| 11901 TokenizerBase.prototype.finishSingleLineComment = function() { | 12164 TokenizerBase.prototype.finishSingleLineComment = function() { |
| 11902 while (true) { | 12165 while ($notnull_bool(true)) { |
| 11903 var ch = this._nextChar(); | 12166 var ch = this._nextChar(); |
| 11904 if (ch == 0 || ch == 10 || ch == 13) { | 12167 if ($notnull_bool(ch == 0 || ch == 10 || ch == 13)) { |
| 11905 if (this._skipWhitespace) { | 12168 if ($notnull_bool(this._skipWhitespace)) { |
| 11906 return this.next(); | 12169 return this.next(); |
| 11907 } | 12170 } |
| 11908 else { | 12171 else { |
| 11909 return this._finishToken(63/*TokenKind.COMMENT*/); | 12172 return this._finishToken(64/*TokenKind.COMMENT*/); |
| 11910 } | 12173 } |
| 11911 } | 12174 } |
| 11912 } | 12175 } |
| 11913 } | 12176 } |
| 11914 TokenizerBase.prototype.finishMultiLineComment = function() { | 12177 TokenizerBase.prototype.finishMultiLineComment = function() { |
| 11915 while (true) { | 12178 while ($notnull_bool(true)) { |
| 11916 var ch = this._nextChar(); | 12179 var ch = this._nextChar(); |
| 11917 if (ch == 0) { | 12180 if ($notnull_bool(ch == 0)) { |
| 11918 return this._finishToken(66/*TokenKind.INCOMPLETE_COMMENT*/); | 12181 return this._finishToken(67/*TokenKind.INCOMPLETE_COMMENT*/); |
| 11919 } | 12182 } |
| 11920 else if (ch == 42) { | 12183 else if ($notnull_bool(ch == 42)) { |
| 11921 if (this._maybeEatChar(47)) { | 12184 if ($notnull_bool(this._maybeEatChar(47))) { |
| 11922 if (this._skipWhitespace) { | 12185 if ($notnull_bool(this._skipWhitespace)) { |
| 11923 return this.next(); | 12186 return this.next(); |
| 11924 } | 12187 } |
| 11925 else { | 12188 else { |
| 11926 return this._finishToken(63/*TokenKind.COMMENT*/); | 12189 return this._finishToken(64/*TokenKind.COMMENT*/); |
| 11927 } | 12190 } |
| 11928 } | 12191 } |
| 11929 } | 12192 } |
| 11930 } | 12193 } |
| 11931 return this._errorToken(); | 12194 return this._errorToken(); |
| 11932 } | 12195 } |
| 11933 TokenizerBase.prototype.eatDigits = function() { | 12196 TokenizerBase.prototype.eatDigits = function() { |
| 11934 while (this._lang_index < this._text.length) { | 12197 while ($notnull_bool(this._lang_index < this._text.length)) { |
| 11935 if (TokenizerHelpers.isDigit(this._text.charCodeAt(this._lang_index))) { | 12198 if ($notnull_bool(TokenizerHelpers.isDigit(this._text.charCodeAt(this._lang_
index)))) { |
| 11936 this._lang_index++; | 12199 this._lang_index++; |
| 11937 } | 12200 } |
| 11938 else { | 12201 else { |
| 11939 return; | 12202 return; |
| 11940 } | 12203 } |
| 11941 } | 12204 } |
| 11942 } | 12205 } |
| 11943 TokenizerBase.prototype.eatHexDigits = function() { | 12206 TokenizerBase.prototype.eatHexDigits = function() { |
| 11944 while (this._lang_index < this._text.length) { | 12207 while ($notnull_bool(this._lang_index < this._text.length)) { |
| 11945 if (TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._lang_index))) { | 12208 if ($notnull_bool(TokenizerHelpers.isHexDigit(this._text.charCodeAt(this._la
ng_index)))) { |
| 11946 this._lang_index++; | 12209 this._lang_index++; |
| 11947 } | 12210 } |
| 11948 else { | 12211 else { |
| 11949 return; | 12212 return; |
| 11950 } | 12213 } |
| 11951 } | 12214 } |
| 11952 } | 12215 } |
| 11953 TokenizerBase.prototype.maybeEatHexDigit = function() { | 12216 TokenizerBase.prototype.maybeEatHexDigit = function() { |
| 11954 if (this._lang_index < this._text.length && TokenizerHelpers.isHexDigit(this._
text.charCodeAt(this._lang_index))) { | 12217 if ($notnull_bool(this._lang_index < this._text.length && TokenizerHelpers.isH
exDigit(this._text.charCodeAt(this._lang_index)))) { |
| 11955 this._lang_index++; | 12218 this._lang_index++; |
| 11956 return true; | 12219 return true; |
| 11957 } | 12220 } |
| 11958 return false; | 12221 return false; |
| 11959 } | 12222 } |
| 11960 TokenizerBase.prototype.finishHex = function() { | 12223 TokenizerBase.prototype.finishHex = function() { |
| 11961 this.eatHexDigits(); | 12224 this.eatHexDigits(); |
| 11962 return this._finishToken(61/*TokenKind.HEX_NUMBER*/); | 12225 return this._finishToken(61/*TokenKind.HEX_INTEGER*/); |
| 11963 } | 12226 } |
| 11964 TokenizerBase.prototype.finishNumber = function() { | 12227 TokenizerBase.prototype.finishNumber = function() { |
| 11965 this.eatDigits(); | 12228 this.eatDigits(); |
| 11966 if (this._peekChar() == 46) { | 12229 if ($notnull_bool(this._peekChar() == 46)) { |
| 11967 this._nextChar(); | 12230 this._nextChar(); |
| 11968 if (TokenizerHelpers.isDigit(this._peekChar())) { | 12231 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { |
| 11969 this.eatDigits(); | 12232 this.eatDigits(); |
| 12233 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); |
| 11970 } | 12234 } |
| 11971 else { | 12235 else { |
| 11972 this._lang_index--; | 12236 this._lang_index--; |
| 11973 } | 12237 } |
| 11974 } | 12238 } |
| 11975 return this.finishNumberExtra(); | 12239 return this.finishNumberExtra(60/*TokenKind.INTEGER*/); |
| 11976 } | 12240 } |
| 11977 TokenizerBase.prototype.finishNumberExtra = function() { | 12241 TokenizerBase.prototype.finishNumberExtra = function(kind) { |
| 11978 if (this._maybeEatChar(101) || this._maybeEatChar(69)) { | 12242 if ($notnull_bool(this._maybeEatChar(101) || this._maybeEatChar(69))) { |
| 12243 kind = 62/*TokenKind.DOUBLE*/; |
| 11979 this._maybeEatChar(45); | 12244 this._maybeEatChar(45); |
| 11980 this._maybeEatChar(43); | 12245 this._maybeEatChar(43); |
| 11981 this.eatDigits(); | 12246 this.eatDigits(); |
| 11982 } | 12247 } |
| 11983 if (this._peekChar() != 0 && TokenizerHelpers.isIdentifierStart(this._peekChar
())) { | 12248 if ($notnull_bool(this._peekChar() != 0 && TokenizerHelpers.isIdentifierStart(
this._peekChar()))) { |
| 11984 this._nextChar(); | 12249 this._nextChar(); |
| 11985 return this._errorToken(); | 12250 return this._errorToken(); |
| 11986 } | 12251 } |
| 11987 return this._finishToken(60/*TokenKind.NUMBER*/); | 12252 return this._finishToken(kind); |
| 11988 } | 12253 } |
| 11989 TokenizerBase.prototype.finishMultilineString = function(quote) { | 12254 TokenizerBase.prototype.finishMultilineString = function(quote) { |
| 11990 while (true) { | 12255 while ($notnull_bool(true)) { |
| 11991 var ch = this._nextChar(); | 12256 var ch = this._nextChar(); |
| 11992 if (ch == 0) { | 12257 if ($notnull_bool(ch == 0)) { |
| 11993 var kind = quote == 34 ? 67/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/ :
68/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; | 12258 var kind = $notnull_bool(quote == 34) ? 68/*TokenKind.INCOMPLETE_MULTILINE
_STRING_DQ*/ : 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; |
| 11994 return this._finishToken(kind); | 12259 return this._finishToken(kind); |
| 11995 } | 12260 } |
| 11996 else if (ch == quote) { | 12261 else if ($notnull_bool(ch == quote)) { |
| 11997 if (this._maybeEatChar(quote)) { | 12262 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 11998 if (this._maybeEatChar(quote)) { | 12263 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 11999 return this._finishToken(58/*TokenKind.STRING*/); | 12264 return this._finishToken(58/*TokenKind.STRING*/); |
| 12000 } | 12265 } |
| 12001 } | 12266 } |
| 12002 } | 12267 } |
| 12003 else if (ch == 36) { | 12268 else if ($notnull_bool(ch == 36)) { |
| 12004 this._interpStack = InterpStack.push(this._interpStack, quote, true); | 12269 this._interpStack = InterpStack.push(this._interpStack, quote, true); |
| 12005 return this._finishToken(65/*TokenKind.INCOMPLETE_STRING*/); | 12270 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 12006 } | 12271 } |
| 12007 else if (ch == 92) { | 12272 else if ($notnull_bool(ch == 92)) { |
| 12008 if (!this.eatEscapeSequence()) { | 12273 if ($notnull_bool(!this.eatEscapeSequence())) { |
| 12009 return this._errorToken(); | 12274 return this._errorToken(); |
| 12010 } | 12275 } |
| 12011 } | 12276 } |
| 12012 } | 12277 } |
| 12013 } | 12278 } |
| 12014 TokenizerBase.prototype._finishOpenBrace = function() { | 12279 TokenizerBase.prototype._finishOpenBrace = function() { |
| 12015 var $0; | 12280 var $0; |
| 12016 if (this._interpStack != null) { | 12281 if ($notnull_bool(this._interpStack != null)) { |
| 12017 if (this._interpStack.depth == -1) { | 12282 if ($notnull_bool(this._interpStack.depth == -1)) { |
| 12018 this._interpStack.depth = 1; | 12283 this._interpStack.depth = 1; |
| 12019 } | 12284 } |
| 12020 else { | 12285 else { |
| 12286 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenize
r.dart", 257, 16); |
| 12021 ($0 = this._interpStack).depth = $0.depth + 1; | 12287 ($0 = this._interpStack).depth = $0.depth + 1; |
| 12022 } | 12288 } |
| 12023 } | 12289 } |
| 12024 return this._finishToken(6/*TokenKind.LBRACE*/); | 12290 return this._finishToken(6/*TokenKind.LBRACE*/); |
| 12025 } | 12291 } |
| 12026 TokenizerBase.prototype._finishCloseBrace = function() { | 12292 TokenizerBase.prototype._finishCloseBrace = function() { |
| 12027 var $0; | 12293 var $0; |
| 12028 if (this._interpStack != null) { | 12294 if ($notnull_bool(this._interpStack != null)) { |
| 12029 ($0 = this._interpStack).depth = $0.depth - 1; | 12295 ($0 = this._interpStack).depth = $0.depth - 1; |
| 12296 $assert(this._interpStack.depth >= 0, "_interpStack.depth >= 0", "tokenizer.
dart", 267, 14); |
| 12030 } | 12297 } |
| 12031 return this._finishToken(7/*TokenKind.RBRACE*/); | 12298 return this._finishToken(7/*TokenKind.RBRACE*/); |
| 12032 } | 12299 } |
| 12033 TokenizerBase.prototype.finishString = function(quote) { | 12300 TokenizerBase.prototype.finishString = function(quote) { |
| 12034 if (this._maybeEatChar(quote)) { | 12301 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 12035 if (this._maybeEatChar(quote)) { | 12302 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 12036 return this.finishMultilineString(quote); | 12303 return this.finishMultilineString(quote); |
| 12037 } | 12304 } |
| 12038 else { | 12305 else { |
| 12039 return this._finishToken(58/*TokenKind.STRING*/); | 12306 return this._finishToken(58/*TokenKind.STRING*/); |
| 12040 } | 12307 } |
| 12041 } | 12308 } |
| 12042 return this.finishStringBody(quote); | 12309 return this.finishStringBody(quote); |
| 12043 } | 12310 } |
| 12044 TokenizerBase.prototype.finishRawString = function(quote) { | 12311 TokenizerBase.prototype.finishRawString = function(quote) { |
| 12045 if (this._maybeEatChar(quote)) { | 12312 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 12046 if (this._maybeEatChar(quote)) { | 12313 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 12047 return this.finishMultilineRawString(quote); | 12314 return this.finishMultilineRawString(quote); |
| 12048 } | 12315 } |
| 12049 else { | 12316 else { |
| 12050 return this._finishToken(58/*TokenKind.STRING*/); | 12317 return this._finishToken(58/*TokenKind.STRING*/); |
| 12051 } | 12318 } |
| 12052 } | 12319 } |
| 12053 while (true) { | 12320 while ($notnull_bool(true)) { |
| 12054 var ch = this._nextChar(); | 12321 var ch = this._nextChar(); |
| 12055 if (ch == quote) { | 12322 if ($notnull_bool(ch == quote)) { |
| 12056 return this._finishToken(58/*TokenKind.STRING*/); | 12323 return this._finishToken(58/*TokenKind.STRING*/); |
| 12057 } | 12324 } |
| 12058 else if (ch == 0) { | 12325 else if ($notnull_bool(ch == 0)) { |
| 12059 return this._finishToken(65/*TokenKind.INCOMPLETE_STRING*/); | 12326 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 12060 } | 12327 } |
| 12061 } | 12328 } |
| 12062 } | 12329 } |
| 12063 TokenizerBase.prototype.finishMultilineRawString = function(quote) { | 12330 TokenizerBase.prototype.finishMultilineRawString = function(quote) { |
| 12064 while (true) { | 12331 while ($notnull_bool(true)) { |
| 12065 var ch = this._nextChar(); | 12332 var ch = this._nextChar(); |
| 12066 if (ch == 0) { | 12333 if ($notnull_bool(ch == 0)) { |
| 12067 var kind = quote == 34 ? 67/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/ :
68/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; | 12334 var kind = $notnull_bool(quote == 34) ? 68/*TokenKind.INCOMPLETE_MULTILINE
_STRING_DQ*/ : 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; |
| 12068 return this._finishToken(kind); | 12335 return this._finishToken(kind); |
| 12069 } | 12336 } |
| 12070 else if (ch == quote && this._maybeEatChar(quote) && this._maybeEatChar(quot
e)) { | 12337 else if ($notnull_bool(ch == quote && this._maybeEatChar(quote) && this._may
beEatChar(quote))) { |
| 12071 return this._finishToken(58/*TokenKind.STRING*/); | 12338 return this._finishToken(58/*TokenKind.STRING*/); |
| 12072 } | 12339 } |
| 12073 } | 12340 } |
| 12074 } | 12341 } |
| 12075 TokenizerBase.prototype.finishStringBody = function(quote) { | 12342 TokenizerBase.prototype.finishStringBody = function(quote) { |
| 12076 while (true) { | 12343 while ($notnull_bool(true)) { |
| 12077 var ch = this._nextChar(); | 12344 var ch = this._nextChar(); |
| 12078 if (ch == quote) { | 12345 if ($notnull_bool(ch == quote)) { |
| 12079 return this._finishToken(58/*TokenKind.STRING*/); | 12346 return this._finishToken(58/*TokenKind.STRING*/); |
| 12080 } | 12347 } |
| 12081 else if (ch == 36) { | 12348 else if ($notnull_bool(ch == 36)) { |
| 12082 this._interpStack = InterpStack.push(this._interpStack, quote, false); | 12349 this._interpStack = InterpStack.push(this._interpStack, quote, false); |
| 12083 return this._finishToken(65/*TokenKind.INCOMPLETE_STRING*/); | 12350 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 12084 } | 12351 } |
| 12085 else if (ch == 0) { | 12352 else if ($notnull_bool(ch == 0)) { |
| 12086 return this._finishToken(65/*TokenKind.INCOMPLETE_STRING*/); | 12353 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 12087 } | 12354 } |
| 12088 else if (ch == 92) { | 12355 else if ($notnull_bool(ch == 92)) { |
| 12089 if (!this.eatEscapeSequence()) { | 12356 if ($notnull_bool(!this.eatEscapeSequence())) { |
| 12090 return this._errorToken(); | 12357 return this._errorToken(); |
| 12091 } | 12358 } |
| 12092 } | 12359 } |
| 12093 } | 12360 } |
| 12094 } | 12361 } |
| 12095 TokenizerBase.prototype.eatEscapeSequence = function() { | 12362 TokenizerBase.prototype.eatEscapeSequence = function() { |
| 12096 var hex; | 12363 var hex; |
| 12097 switch (this._nextChar()) { | 12364 switch (this._nextChar()) { |
| 12098 case 120: | 12365 case 120: |
| 12099 | 12366 |
| 12100 return this.maybeEatHexDigit() && this.maybeEatHexDigit(); | 12367 return this.maybeEatHexDigit() && this.maybeEatHexDigit(); |
| 12101 | 12368 |
| 12102 case 117: | 12369 case 117: |
| 12103 | 12370 |
| 12104 if (this._maybeEatChar(123)) { | 12371 if ($notnull_bool(this._maybeEatChar(123))) { |
| 12105 var start = this._lang_index; | 12372 var start = this._lang_index; |
| 12106 this.eatHexDigits(); | 12373 this.eatHexDigits(); |
| 12107 var chars = this._lang_index - start; | 12374 var chars = this._lang_index - start; |
| 12108 if (chars > 0 && chars <= 6 && this._maybeEatChar(125)) { | 12375 if ($notnull_bool(chars > 0 && chars <= 6 && this._maybeEatChar(125))) { |
| 12109 hex = this._text.substring(start, start + chars); | 12376 hex = this._text.substring(start, start + chars); |
| 12110 break; | 12377 break; |
| 12111 } | 12378 } |
| 12112 else { | 12379 else { |
| 12113 return false; | 12380 return false; |
| 12114 } | 12381 } |
| 12115 } | 12382 } |
| 12116 else { | 12383 else { |
| 12117 if (this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatH
exDigit() && this.maybeEatHexDigit()) { | 12384 if ($notnull_bool(this.maybeEatHexDigit() && this.maybeEatHexDigit() &&
this.maybeEatHexDigit() && this.maybeEatHexDigit())) { |
| 12118 hex = this._text.substring(this._lang_index - 4, this._lang_index); | 12385 hex = this._text.substring(this._lang_index - 4, this._lang_index); |
| 12119 break; | 12386 break; |
| 12120 } | 12387 } |
| 12121 else { | 12388 else { |
| 12122 return false; | 12389 return false; |
| 12123 } | 12390 } |
| 12124 } | 12391 } |
| 12125 | 12392 |
| 12126 default: | 12393 default: |
| 12127 | 12394 |
| 12128 return true; | 12395 return true; |
| 12129 | 12396 |
| 12130 } | 12397 } |
| 12131 var n = lang_Parser.parseHex(hex); | 12398 var n = lang_Parser.parseHex(hex); |
| 12132 return n < 0xD800 || n > 0xDFFF && n <= 0x10FFFF; | 12399 return n < 0xD800 || n > 0xDFFF && n <= 0x10FFFF; |
| 12133 } | 12400 } |
| 12134 TokenizerBase.prototype.finishDot = function() { | 12401 TokenizerBase.prototype.finishDot = function() { |
| 12135 if (TokenizerHelpers.isDigit(this._peekChar())) { | 12402 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { |
| 12136 this.eatDigits(); | 12403 this.eatDigits(); |
| 12137 return this.finishNumberExtra(); | 12404 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); |
| 12138 } | 12405 } |
| 12139 else { | 12406 else { |
| 12140 return this._finishToken(14/*TokenKind.DOT*/); | 12407 return this._finishToken(14/*TokenKind.DOT*/); |
| 12141 } | 12408 } |
| 12142 } | 12409 } |
| 12143 TokenizerBase.prototype.finishIdentifier = function() { | 12410 TokenizerBase.prototype.finishIdentifier = function() { |
| 12144 while (this._lang_index < this._text.length) { | 12411 while ($notnull_bool(this._lang_index < this._text.length)) { |
| 12145 if (!TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(this._lang_inde
x++))) { | 12412 if ($notnull_bool(!TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(t
his._lang_index++)))) { |
| 12146 this._lang_index--; | 12413 this._lang_index--; |
| 12147 break; | 12414 break; |
| 12148 } | 12415 } |
| 12149 } | 12416 } |
| 12150 var kind = this.getIdentifierKind(); | 12417 var kind = this.getIdentifierKind(); |
| 12151 if (this._interpStack != null && this._interpStack.depth == -1) { | 12418 if ($notnull_bool(this._interpStack != null && this._interpStack.depth == -1))
{ |
| 12152 this._interpStack.depth = 0; | 12419 this._interpStack.depth = 0; |
| 12153 } | 12420 } |
| 12154 if (kind == 69/*TokenKind.IDENTIFIER*/) { | 12421 if ($notnull_bool(kind == 70/*TokenKind.IDENTIFIER*/)) { |
| 12155 return this._finishToken(69/*TokenKind.IDENTIFIER*/); | 12422 return this._finishToken(70/*TokenKind.IDENTIFIER*/); |
| 12156 } | 12423 } |
| 12157 else { | 12424 else { |
| 12158 return this._finishToken(kind); | 12425 return this._finishToken(kind); |
| 12159 } | 12426 } |
| 12160 } | 12427 } |
| 12161 // ********** Code for Tokenizer ************** | 12428 // ********** Code for Tokenizer ************** |
| 12162 function Tokenizer(source, skipWhitespace, index) { | 12429 function Tokenizer(source, skipWhitespace, index) { |
| 12163 TokenizerBase.call(this, source, skipWhitespace, index); | 12430 TokenizerBase.call(this, source, skipWhitespace, index); |
| 12164 // Initializers done | 12431 // Initializers done |
| 12165 } | 12432 } |
| 12166 $inherits(Tokenizer, TokenizerBase); | 12433 $inherits(Tokenizer, TokenizerBase); |
| 12167 Tokenizer.prototype.next = function() { | 12434 Tokenizer.prototype.next = function() { |
| 12168 this._startIndex = this._lang_index; | 12435 this._startIndex = this._lang_index; |
| 12169 if (this._interpStack != null && this._interpStack.depth == 0) { | 12436 if ($notnull_bool(this._interpStack != null && this._interpStack.depth == 0))
{ |
| 12170 var istack = this._interpStack; | 12437 var istack = this._interpStack; |
| 12171 this._interpStack = this._interpStack.pop(); | 12438 this._interpStack = this._interpStack.pop(); |
| 12172 if (istack.isMultiline) { | 12439 if ($notnull_bool(istack.isMultiline)) { |
| 12173 return this.finishMultilineString(istack.quote); | 12440 return this.finishMultilineString(istack.quote); |
| 12174 } | 12441 } |
| 12175 else { | 12442 else { |
| 12176 return this.finishStringBody(istack.quote); | 12443 return this.finishStringBody(istack.quote); |
| 12177 } | 12444 } |
| 12178 } | 12445 } |
| 12179 var ch; | 12446 var ch; |
| 12180 ch = this._nextChar(); | 12447 ch = this._nextChar(); |
| 12181 switch (ch) { | 12448 switch (ch) { |
| 12182 case 0: | 12449 case 0: |
| 12183 | 12450 |
| 12184 return this._finishToken(1/*TokenKind.END_OF_FILE*/); | 12451 return this._finishToken(1/*TokenKind.END_OF_FILE*/); |
| 12185 | 12452 |
| 12186 case 32: | 12453 case 32: |
| 12187 case 9: | 12454 case 9: |
| 12188 case 10: | 12455 case 10: |
| 12189 case 13: | 12456 case 13: |
| 12190 | 12457 |
| 12191 return this.finishWhitespace(); | 12458 return this.finishWhitespace(); |
| 12192 | 12459 |
| 12193 case 33: | 12460 case 33: |
| 12194 | 12461 |
| 12195 if (this._maybeEatChar(61)) { | 12462 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12196 if (this._maybeEatChar(61)) { | 12463 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12197 return this._finishToken(51/*TokenKind.NE_STRICT*/); | 12464 return this._finishToken(51/*TokenKind.NE_STRICT*/); |
| 12198 } | 12465 } |
| 12199 else { | 12466 else { |
| 12200 return this._finishToken(49/*TokenKind.NE*/); | 12467 return this._finishToken(49/*TokenKind.NE*/); |
| 12201 } | 12468 } |
| 12202 } | 12469 } |
| 12203 else { | 12470 else { |
| 12204 return this._finishToken(19/*TokenKind.NOT*/); | 12471 return this._finishToken(19/*TokenKind.NOT*/); |
| 12205 } | 12472 } |
| 12206 | 12473 |
| 12207 case 34: | 12474 case 34: |
| 12208 | 12475 |
| 12209 return this.finishString(34); | 12476 return this.finishString(34); |
| 12210 | 12477 |
| 12211 case 35: | 12478 case 35: |
| 12212 | 12479 |
| 12213 if (this._maybeEatChar(33)) { | 12480 if ($notnull_bool(this._maybeEatChar(33))) { |
| 12214 return this.finishHashBang(); | 12481 return this.finishHashBang(); |
| 12215 } | 12482 } |
| 12216 else { | 12483 else { |
| 12217 return this._finishToken(12/*TokenKind.HASH*/); | 12484 return this._finishToken(12/*TokenKind.HASH*/); |
| 12218 } | 12485 } |
| 12219 | 12486 |
| 12220 case 36: | 12487 case 36: |
| 12221 | 12488 |
| 12222 if (this._maybeEatChar(34)) { | 12489 if ($notnull_bool(this._maybeEatChar(34))) { |
| 12223 return this.finishString(34); | 12490 return this.finishString(34); |
| 12224 } | 12491 } |
| 12225 else if (this._maybeEatChar(39)) { | 12492 else if ($notnull_bool(this._maybeEatChar(39))) { |
| 12226 return this.finishString(39); | 12493 return this.finishString(39); |
| 12227 } | 12494 } |
| 12228 else { | 12495 else { |
| 12229 return this.finishIdentifier(); | 12496 return this.finishIdentifier(); |
| 12230 } | 12497 } |
| 12231 | 12498 |
| 12232 case 37: | 12499 case 37: |
| 12233 | 12500 |
| 12234 if (this._maybeEatChar(61)) { | 12501 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12235 return this._finishToken(32/*TokenKind.ASSIGN_MOD*/); | 12502 return this._finishToken(32/*TokenKind.ASSIGN_MOD*/); |
| 12236 } | 12503 } |
| 12237 else { | 12504 else { |
| 12238 return this._finishToken(47/*TokenKind.MOD*/); | 12505 return this._finishToken(47/*TokenKind.MOD*/); |
| 12239 } | 12506 } |
| 12240 | 12507 |
| 12241 case 38: | 12508 case 38: |
| 12242 | 12509 |
| 12243 if (this._maybeEatChar(38)) { | 12510 if ($notnull_bool(this._maybeEatChar(38))) { |
| 12244 return this._finishToken(35/*TokenKind.AND*/); | 12511 return this._finishToken(35/*TokenKind.AND*/); |
| 12245 } | 12512 } |
| 12246 else if (this._maybeEatChar(61)) { | 12513 else if ($notnull_bool(this._maybeEatChar(61))) { |
| 12247 return this._finishToken(23/*TokenKind.ASSIGN_AND*/); | 12514 return this._finishToken(23/*TokenKind.ASSIGN_AND*/); |
| 12248 } | 12515 } |
| 12249 else { | 12516 else { |
| 12250 return this._finishToken(38/*TokenKind.BIT_AND*/); | 12517 return this._finishToken(38/*TokenKind.BIT_AND*/); |
| 12251 } | 12518 } |
| 12252 | 12519 |
| 12253 case 39: | 12520 case 39: |
| 12254 | 12521 |
| 12255 return this.finishString(39); | 12522 return this.finishString(39); |
| 12256 | 12523 |
| 12257 case 40: | 12524 case 40: |
| 12258 | 12525 |
| 12259 return this._finishToken(2/*TokenKind.LPAREN*/); | 12526 return this._finishToken(2/*TokenKind.LPAREN*/); |
| 12260 | 12527 |
| 12261 case 41: | 12528 case 41: |
| 12262 | 12529 |
| 12263 return this._finishToken(3/*TokenKind.RPAREN*/); | 12530 return this._finishToken(3/*TokenKind.RPAREN*/); |
| 12264 | 12531 |
| 12265 case 42: | 12532 case 42: |
| 12266 | 12533 |
| 12267 if (this._maybeEatChar(61)) { | 12534 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12268 return this._finishToken(29/*TokenKind.ASSIGN_MUL*/); | 12535 return this._finishToken(29/*TokenKind.ASSIGN_MUL*/); |
| 12269 } | 12536 } |
| 12270 else { | 12537 else { |
| 12271 return this._finishToken(44/*TokenKind.MUL*/); | 12538 return this._finishToken(44/*TokenKind.MUL*/); |
| 12272 } | 12539 } |
| 12273 | 12540 |
| 12274 case 43: | 12541 case 43: |
| 12275 | 12542 |
| 12276 if (this._maybeEatChar(43)) { | 12543 if ($notnull_bool(this._maybeEatChar(43))) { |
| 12277 return this._finishToken(16/*TokenKind.INCR*/); | 12544 return this._finishToken(16/*TokenKind.INCR*/); |
| 12278 } | 12545 } |
| 12279 else if (this._maybeEatChar(61)) { | 12546 else if ($notnull_bool(this._maybeEatChar(61))) { |
| 12280 return this._finishToken(27/*TokenKind.ASSIGN_ADD*/); | 12547 return this._finishToken(27/*TokenKind.ASSIGN_ADD*/); |
| 12281 } | 12548 } |
| 12282 else { | 12549 else { |
| 12283 return this._finishToken(42/*TokenKind.ADD*/); | 12550 return this._finishToken(42/*TokenKind.ADD*/); |
| 12284 } | 12551 } |
| 12285 | 12552 |
| 12286 case 44: | 12553 case 44: |
| 12287 | 12554 |
| 12288 return this._finishToken(11/*TokenKind.COMMA*/); | 12555 return this._finishToken(11/*TokenKind.COMMA*/); |
| 12289 | 12556 |
| 12290 case 45: | 12557 case 45: |
| 12291 | 12558 |
| 12292 if (this._maybeEatChar(45)) { | 12559 if ($notnull_bool(this._maybeEatChar(45))) { |
| 12293 return this._finishToken(17/*TokenKind.DECR*/); | 12560 return this._finishToken(17/*TokenKind.DECR*/); |
| 12294 } | 12561 } |
| 12295 else if (this._maybeEatChar(61)) { | 12562 else if ($notnull_bool(this._maybeEatChar(61))) { |
| 12296 return this._finishToken(28/*TokenKind.ASSIGN_SUB*/); | 12563 return this._finishToken(28/*TokenKind.ASSIGN_SUB*/); |
| 12297 } | 12564 } |
| 12298 else { | 12565 else { |
| 12299 return this._finishToken(43/*TokenKind.SUB*/); | 12566 return this._finishToken(43/*TokenKind.SUB*/); |
| 12300 } | 12567 } |
| 12301 | 12568 |
| 12302 case 46: | 12569 case 46: |
| 12303 | 12570 |
| 12304 if (this._maybeEatChar(46)) { | 12571 if ($notnull_bool(this._maybeEatChar(46))) { |
| 12305 if (this._maybeEatChar(46)) { | 12572 if ($notnull_bool(this._maybeEatChar(46))) { |
| 12306 return this._finishToken(15/*TokenKind.ELLIPSIS*/); | 12573 return this._finishToken(15/*TokenKind.ELLIPSIS*/); |
| 12307 } | 12574 } |
| 12308 else { | 12575 else { |
| 12309 return this._errorToken(); | 12576 return this._errorToken(); |
| 12310 } | 12577 } |
| 12311 } | 12578 } |
| 12312 else { | 12579 else { |
| 12313 return this.finishDot(); | 12580 return this.finishDot(); |
| 12314 } | 12581 } |
| 12315 | 12582 |
| 12316 case 47: | 12583 case 47: |
| 12317 | 12584 |
| 12318 if (this._maybeEatChar(42)) { | 12585 if ($notnull_bool(this._maybeEatChar(42))) { |
| 12319 return this.finishMultiLineComment(); | 12586 return this.finishMultiLineComment(); |
| 12320 } | 12587 } |
| 12321 else if (this._maybeEatChar(47)) { | 12588 else if ($notnull_bool(this._maybeEatChar(47))) { |
| 12322 return this.finishSingleLineComment(); | 12589 return this.finishSingleLineComment(); |
| 12323 } | 12590 } |
| 12324 else if (this._maybeEatChar(61)) { | 12591 else if ($notnull_bool(this._maybeEatChar(61))) { |
| 12325 return this._finishToken(30/*TokenKind.ASSIGN_DIV*/); | 12592 return this._finishToken(30/*TokenKind.ASSIGN_DIV*/); |
| 12326 } | 12593 } |
| 12327 else { | 12594 else { |
| 12328 return this._finishToken(45/*TokenKind.DIV*/); | 12595 return this._finishToken(45/*TokenKind.DIV*/); |
| 12329 } | 12596 } |
| 12330 | 12597 |
| 12331 case 48: | 12598 case 48: |
| 12332 | 12599 |
| 12333 if (this._maybeEatChar(88)) { | 12600 if ($notnull_bool(this._maybeEatChar(88))) { |
| 12334 return this.finishHex(); | 12601 return this.finishHex(); |
| 12335 } | 12602 } |
| 12336 else if (this._maybeEatChar(120)) { | 12603 else if ($notnull_bool(this._maybeEatChar(120))) { |
| 12337 return this.finishHex(); | 12604 return this.finishHex(); |
| 12338 } | 12605 } |
| 12339 else { | 12606 else { |
| 12340 return this.finishNumber(); | 12607 return this.finishNumber(); |
| 12341 } | 12608 } |
| 12342 | 12609 |
| 12343 case 58: | 12610 case 58: |
| 12344 | 12611 |
| 12345 return this._finishToken(8/*TokenKind.COLON*/); | 12612 return this._finishToken(8/*TokenKind.COLON*/); |
| 12346 | 12613 |
| 12347 case 59: | 12614 case 59: |
| 12348 | 12615 |
| 12349 return this._finishToken(10/*TokenKind.SEMICOLON*/); | 12616 return this._finishToken(10/*TokenKind.SEMICOLON*/); |
| 12350 | 12617 |
| 12351 case 60: | 12618 case 60: |
| 12352 | 12619 |
| 12353 if (this._maybeEatChar(60)) { | 12620 if ($notnull_bool(this._maybeEatChar(60))) { |
| 12354 if (this._maybeEatChar(61)) { | 12621 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12355 return this._finishToken(24/*TokenKind.ASSIGN_SHL*/); | 12622 return this._finishToken(24/*TokenKind.ASSIGN_SHL*/); |
| 12356 } | 12623 } |
| 12357 else { | 12624 else { |
| 12358 return this._finishToken(39/*TokenKind.SHL*/); | 12625 return this._finishToken(39/*TokenKind.SHL*/); |
| 12359 } | 12626 } |
| 12360 } | 12627 } |
| 12361 else if (this._maybeEatChar(61)) { | 12628 else if ($notnull_bool(this._maybeEatChar(61))) { |
| 12362 return this._finishToken(54/*TokenKind.LTE*/); | 12629 return this._finishToken(54/*TokenKind.LTE*/); |
| 12363 } | 12630 } |
| 12364 else { | 12631 else { |
| 12365 return this._finishToken(52/*TokenKind.LT*/); | 12632 return this._finishToken(52/*TokenKind.LT*/); |
| 12366 } | 12633 } |
| 12367 | 12634 |
| 12368 case 61: | 12635 case 61: |
| 12369 | 12636 |
| 12370 if (this._maybeEatChar(61)) { | 12637 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12371 if (this._maybeEatChar(61)) { | 12638 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12372 return this._finishToken(50/*TokenKind.EQ_STRICT*/); | 12639 return this._finishToken(50/*TokenKind.EQ_STRICT*/); |
| 12373 } | 12640 } |
| 12374 else { | 12641 else { |
| 12375 return this._finishToken(48/*TokenKind.EQ*/); | 12642 return this._finishToken(48/*TokenKind.EQ*/); |
| 12376 } | 12643 } |
| 12377 } | 12644 } |
| 12378 else if (this._maybeEatChar(62)) { | 12645 else if ($notnull_bool(this._maybeEatChar(62))) { |
| 12379 return this._finishToken(9/*TokenKind.ARROW*/); | 12646 return this._finishToken(9/*TokenKind.ARROW*/); |
| 12380 } | 12647 } |
| 12381 else { | 12648 else { |
| 12382 return this._finishToken(20/*TokenKind.ASSIGN*/); | 12649 return this._finishToken(20/*TokenKind.ASSIGN*/); |
| 12383 } | 12650 } |
| 12384 | 12651 |
| 12385 case 62: | 12652 case 62: |
| 12386 | 12653 |
| 12387 if (this._maybeEatChar(61)) { | 12654 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12388 return this._finishToken(55/*TokenKind.GTE*/); | 12655 return this._finishToken(55/*TokenKind.GTE*/); |
| 12389 } | 12656 } |
| 12390 else if (this._maybeEatChar(62)) { | 12657 else if ($notnull_bool(this._maybeEatChar(62))) { |
| 12391 if (this._maybeEatChar(61)) { | 12658 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12392 return this._finishToken(25/*TokenKind.ASSIGN_SAR*/); | 12659 return this._finishToken(25/*TokenKind.ASSIGN_SAR*/); |
| 12393 } | 12660 } |
| 12394 else if (this._maybeEatChar(62)) { | 12661 else if ($notnull_bool(this._maybeEatChar(62))) { |
| 12395 if (this._maybeEatChar(61)) { | 12662 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12396 return this._finishToken(26/*TokenKind.ASSIGN_SHR*/); | 12663 return this._finishToken(26/*TokenKind.ASSIGN_SHR*/); |
| 12397 } | 12664 } |
| 12398 else { | 12665 else { |
| 12399 return this._finishToken(41/*TokenKind.SHR*/); | 12666 return this._finishToken(41/*TokenKind.SHR*/); |
| 12400 } | 12667 } |
| 12401 } | 12668 } |
| 12402 else { | 12669 else { |
| 12403 return this._finishToken(40/*TokenKind.SAR*/); | 12670 return this._finishToken(40/*TokenKind.SAR*/); |
| 12404 } | 12671 } |
| 12405 } | 12672 } |
| 12406 else { | 12673 else { |
| 12407 return this._finishToken(53/*TokenKind.GT*/); | 12674 return this._finishToken(53/*TokenKind.GT*/); |
| 12408 } | 12675 } |
| 12409 | 12676 |
| 12410 case 63: | 12677 case 63: |
| 12411 | 12678 |
| 12412 return this._finishToken(33/*TokenKind.CONDITIONAL*/); | 12679 return this._finishToken(33/*TokenKind.CONDITIONAL*/); |
| 12413 | 12680 |
| 12414 case 64: | 12681 case 64: |
| 12415 | 12682 |
| 12416 if (this._maybeEatChar(34)) { | 12683 if ($notnull_bool(this._maybeEatChar(34))) { |
| 12417 return this.finishRawString(34); | 12684 return this.finishRawString(34); |
| 12418 } | 12685 } |
| 12419 else if (this._maybeEatChar(39)) { | 12686 else if ($notnull_bool(this._maybeEatChar(39))) { |
| 12420 return this.finishRawString(39); | 12687 return this.finishRawString(39); |
| 12421 } | 12688 } |
| 12422 else { | 12689 else { |
| 12423 return this._errorToken(); | 12690 return this._errorToken(); |
| 12424 } | 12691 } |
| 12425 | 12692 |
| 12426 case 91: | 12693 case 91: |
| 12427 | 12694 |
| 12428 if (this._maybeEatChar(93)) { | 12695 if ($notnull_bool(this._maybeEatChar(93))) { |
| 12429 if (this._maybeEatChar(61)) { | 12696 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12430 return this._finishToken(57/*TokenKind.SETINDEX*/); | 12697 return this._finishToken(57/*TokenKind.SETINDEX*/); |
| 12431 } | 12698 } |
| 12432 else { | 12699 else { |
| 12433 return this._finishToken(56/*TokenKind.INDEX*/); | 12700 return this._finishToken(56/*TokenKind.INDEX*/); |
| 12434 } | 12701 } |
| 12435 } | 12702 } |
| 12436 else { | 12703 else { |
| 12437 return this._finishToken(4/*TokenKind.LBRACK*/); | 12704 return this._finishToken(4/*TokenKind.LBRACK*/); |
| 12438 } | 12705 } |
| 12439 | 12706 |
| 12440 case 93: | 12707 case 93: |
| 12441 | 12708 |
| 12442 return this._finishToken(5/*TokenKind.RBRACK*/); | 12709 return this._finishToken(5/*TokenKind.RBRACK*/); |
| 12443 | 12710 |
| 12444 case 94: | 12711 case 94: |
| 12445 | 12712 |
| 12446 if (this._maybeEatChar(61)) { | 12713 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12447 return this._finishToken(22/*TokenKind.ASSIGN_XOR*/); | 12714 return this._finishToken(22/*TokenKind.ASSIGN_XOR*/); |
| 12448 } | 12715 } |
| 12449 else { | 12716 else { |
| 12450 return this._finishToken(37/*TokenKind.BIT_XOR*/); | 12717 return this._finishToken(37/*TokenKind.BIT_XOR*/); |
| 12451 } | 12718 } |
| 12452 | 12719 |
| 12453 case 123: | 12720 case 123: |
| 12454 | 12721 |
| 12455 return this._finishOpenBrace(); | 12722 return this._finishOpenBrace(); |
| 12456 | 12723 |
| 12457 case 124: | 12724 case 124: |
| 12458 | 12725 |
| 12459 if (this._maybeEatChar(61)) { | 12726 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12460 return this._finishToken(21/*TokenKind.ASSIGN_OR*/); | 12727 return this._finishToken(21/*TokenKind.ASSIGN_OR*/); |
| 12461 } | 12728 } |
| 12462 else if (this._maybeEatChar(124)) { | 12729 else if ($notnull_bool(this._maybeEatChar(124))) { |
| 12463 return this._finishToken(34/*TokenKind.OR*/); | 12730 return this._finishToken(34/*TokenKind.OR*/); |
| 12464 } | 12731 } |
| 12465 else { | 12732 else { |
| 12466 return this._finishToken(36/*TokenKind.BIT_OR*/); | 12733 return this._finishToken(36/*TokenKind.BIT_OR*/); |
| 12467 } | 12734 } |
| 12468 | 12735 |
| 12469 case 125: | 12736 case 125: |
| 12470 | 12737 |
| 12471 return this._finishCloseBrace(); | 12738 return this._finishCloseBrace(); |
| 12472 | 12739 |
| 12473 case 126: | 12740 case 126: |
| 12474 | 12741 |
| 12475 if (this._maybeEatChar(47)) { | 12742 if ($notnull_bool(this._maybeEatChar(47))) { |
| 12476 if (this._maybeEatChar(61)) { | 12743 if ($notnull_bool(this._maybeEatChar(61))) { |
| 12477 return this._finishToken(31/*TokenKind.ASSIGN_TRUNCDIV*/); | 12744 return this._finishToken(31/*TokenKind.ASSIGN_TRUNCDIV*/); |
| 12478 } | 12745 } |
| 12479 else { | 12746 else { |
| 12480 return this._finishToken(46/*TokenKind.TRUNCDIV*/); | 12747 return this._finishToken(46/*TokenKind.TRUNCDIV*/); |
| 12481 } | 12748 } |
| 12482 } | 12749 } |
| 12483 else { | 12750 else { |
| 12484 return this._finishToken(18/*TokenKind.BIT_NOT*/); | 12751 return this._finishToken(18/*TokenKind.BIT_NOT*/); |
| 12485 } | 12752 } |
| 12486 | 12753 |
| 12487 default: | 12754 default: |
| 12488 | 12755 |
| 12489 if (TokenizerHelpers.isIdentifierStart(ch)) { | 12756 if ($notnull_bool(TokenizerHelpers.isIdentifierStart(ch))) { |
| 12490 return this.finishIdentifier(); | 12757 return this.finishIdentifier(); |
| 12491 } | 12758 } |
| 12492 else if (TokenizerHelpers.isDigit(ch)) { | 12759 else if ($notnull_bool(TokenizerHelpers.isDigit(ch))) { |
| 12493 return this.finishNumber(); | 12760 return this.finishNumber(); |
| 12494 } | 12761 } |
| 12495 else { | 12762 else { |
| 12496 return this._errorToken(); | 12763 return this._errorToken(); |
| 12497 } | 12764 } |
| 12498 | 12765 |
| 12499 } | 12766 } |
| 12500 } | 12767 } |
| 12501 Tokenizer.prototype.getIdentifierKind = function() { | 12768 Tokenizer.prototype.getIdentifierKind = function() { |
| 12502 var i0 = this._startIndex; | 12769 var i0 = this._startIndex; |
| 12503 switch (this._lang_index - i0) { | 12770 switch (this._lang_index - i0) { |
| 12504 case 2: | 12771 case 2: |
| 12505 | 12772 |
| 12506 if (this._text.charCodeAt(i0) == 100) { | 12773 if ($notnull_bool(this._text.charCodeAt(i0) == 100)) { |
| 12507 if (this._text.charCodeAt(i0 + 1) == 111) return 93/*TokenKind.DO*/; | 12774 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111)) return 94/*Toke
nKind.DO*/; |
| 12508 } | 12775 } |
| 12509 else if (this._text.charCodeAt(i0) == 105) { | 12776 else if ($notnull_bool(this._text.charCodeAt(i0) == 105)) { |
| 12510 if (this._text.charCodeAt(i0 + 1) == 102) { | 12777 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 102)) { |
| 12511 return 99/*TokenKind.IF*/; | 12778 return 100/*TokenKind.IF*/; |
| 12512 } | 12779 } |
| 12513 else if (this._text.charCodeAt(i0 + 1) == 110) { | 12780 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 110)) { |
| 12514 return 100/*TokenKind.IN*/; | 12781 return 101/*TokenKind.IN*/; |
| 12515 } | 12782 } |
| 12516 else if (this._text.charCodeAt(i0 + 1) == 115) { | 12783 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 115)) { |
| 12517 return 101/*TokenKind.IS*/; | 12784 return 102/*TokenKind.IS*/; |
| 12518 } | 12785 } |
| 12519 } | 12786 } |
| 12520 return 69/*TokenKind.IDENTIFIER*/; | 12787 return 70/*TokenKind.IDENTIFIER*/; |
| 12521 | 12788 |
| 12522 case 3: | 12789 case 3: |
| 12523 | 12790 |
| 12524 if (this._text.charCodeAt(i0) == 102) { | 12791 if ($notnull_bool(this._text.charCodeAt(i0) == 102)) { |
| 12525 if (this._text.charCodeAt(i0 + 1) == 111 && this._text.charCodeAt(i0 + 2
) == 114) return 98/*TokenKind.FOR*/; | 12792 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111 && this._text.cha
rCodeAt(i0 + 2) == 114)) return 99/*TokenKind.FOR*/; |
| 12526 } | 12793 } |
| 12527 else if (this._text.charCodeAt(i0) == 103) { | 12794 else if ($notnull_bool(this._text.charCodeAt(i0) == 103)) { |
| 12528 if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2
) == 116) return 75/*TokenKind.GET*/; | 12795 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha
rCodeAt(i0 + 2) == 116)) return 76/*TokenKind.GET*/; |
| 12529 } | 12796 } |
| 12530 else if (this._text.charCodeAt(i0) == 110) { | 12797 else if ($notnull_bool(this._text.charCodeAt(i0) == 110)) { |
| 12531 if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2
) == 119) return 102/*TokenKind.NEW*/; | 12798 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha
rCodeAt(i0 + 2) == 119)) return 103/*TokenKind.NEW*/; |
| 12532 } | 12799 } |
| 12533 else if (this._text.charCodeAt(i0) == 115) { | 12800 else if ($notnull_bool(this._text.charCodeAt(i0) == 115)) { |
| 12534 if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2
) == 116) return 83/*TokenKind.SET*/; | 12801 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha
rCodeAt(i0 + 2) == 116)) return 84/*TokenKind.SET*/; |
| 12535 } | 12802 } |
| 12536 else if (this._text.charCodeAt(i0) == 116) { | 12803 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) { |
| 12537 if (this._text.charCodeAt(i0 + 1) == 114 && this._text.charCodeAt(i0 + 2
) == 121) return 110/*TokenKind.TRY*/; | 12804 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114 && this._text.cha
rCodeAt(i0 + 2) == 121)) return 111/*TokenKind.TRY*/; |
| 12538 } | 12805 } |
| 12539 else if (this._text.charCodeAt(i0) == 118) { | 12806 else if ($notnull_bool(this._text.charCodeAt(i0) == 118)) { |
| 12540 if (this._text.charCodeAt(i0 + 1) == 97 && this._text.charCodeAt(i0 + 2)
== 114) return 111/*TokenKind.VAR*/; | 12807 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97 && this._text.char
CodeAt(i0 + 2) == 114)) return 112/*TokenKind.VAR*/; |
| 12541 } | 12808 } |
| 12542 return 69/*TokenKind.IDENTIFIER*/; | 12809 return 70/*TokenKind.IDENTIFIER*/; |
| 12543 | 12810 |
| 12544 case 4: | 12811 case 4: |
| 12545 | 12812 |
| 12546 if (this._text.charCodeAt(i0) == 99) { | 12813 if ($notnull_bool(this._text.charCodeAt(i0) == 99)) { |
| 12547 if (this._text.charCodeAt(i0 + 1) == 97 && this._text.charCodeAt(i0 + 2)
== 115 && this._text.charCodeAt(i0 + 3) == 101) return 88/*TokenKind.CASE*/; | 12814 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97 && this._text.char
CodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 101)) return 89/*Token
Kind.CASE*/; |
| 12548 } | 12815 } |
| 12549 else if (this._text.charCodeAt(i0) == 101) { | 12816 else if ($notnull_bool(this._text.charCodeAt(i0) == 101)) { |
| 12550 if (this._text.charCodeAt(i0 + 1) == 108 && this._text.charCodeAt(i0 + 2
) == 115 && this._text.charCodeAt(i0 + 3) == 101) return 94/*TokenKind.ELSE*/; | 12817 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 108 && this._text.cha
rCodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 101)) return 95/*Toke
nKind.ELSE*/; |
| 12551 } | 12818 } |
| 12552 else if (this._text.charCodeAt(i0) == 110) { | 12819 else if ($notnull_bool(this._text.charCodeAt(i0) == 110)) { |
| 12553 if (this._text.charCodeAt(i0 + 1) == 117 && this._text.charCodeAt(i0 + 2
) == 108 && this._text.charCodeAt(i0 + 3) == 108) return 103/*TokenKind.NULL*/; | 12820 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 117 && this._text.cha
rCodeAt(i0 + 2) == 108 && this._text.charCodeAt(i0 + 3) == 108)) return 104/*Tok
enKind.NULL*/; |
| 12554 } | 12821 } |
| 12555 else if (this._text.charCodeAt(i0) == 116) { | 12822 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) { |
| 12556 if (this._text.charCodeAt(i0 + 1) == 104) { | 12823 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104)) { |
| 12557 if (this._text.charCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 +
3) == 115) return 107/*TokenKind.THIS*/; | 12824 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 105 && this._text.c
harCodeAt(i0 + 3) == 115)) return 108/*TokenKind.THIS*/; |
| 12558 } | 12825 } |
| 12559 else if (this._text.charCodeAt(i0 + 1) == 114) { | 12826 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114)) { |
| 12560 if (this._text.charCodeAt(i0 + 2) == 117 && this._text.charCodeAt(i0 +
3) == 101) return 109/*TokenKind.TRUE*/; | 12827 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 117 && this._text.c
harCodeAt(i0 + 3) == 101)) return 110/*TokenKind.TRUE*/; |
| 12561 } | 12828 } |
| 12562 } | 12829 } |
| 12563 else if (this._text.charCodeAt(i0) == 118) { | 12830 else if ($notnull_bool(this._text.charCodeAt(i0) == 118)) { |
| 12564 if (this._text.charCodeAt(i0 + 1) == 111 && this._text.charCodeAt(i0 + 2
) == 105 && this._text.charCodeAt(i0 + 3) == 100) return 112/*TokenKind.VOID*/; | 12831 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111 && this._text.cha
rCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 + 3) == 100)) return 113/*Tok
enKind.VOID*/; |
| 12565 } | 12832 } |
| 12566 return 69/*TokenKind.IDENTIFIER*/; | 12833 return 70/*TokenKind.IDENTIFIER*/; |
| 12567 | 12834 |
| 12568 case 5: | 12835 case 5: |
| 12569 | 12836 |
| 12570 if (this._text.charCodeAt(i0) == 98) { | 12837 if ($notnull_bool(this._text.charCodeAt(i0) == 98)) { |
| 12571 if (this._text.charCodeAt(i0 + 1) == 114 && this._text.charCodeAt(i0 + 2
) == 101 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4)
== 107) return 87/*TokenKind.BREAK*/; | 12838 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114 && this._text.cha
rCodeAt(i0 + 2) == 101 && this._text.charCodeAt(i0 + 3) == 97 && this._text.char
CodeAt(i0 + 4) == 107)) return 88/*TokenKind.BREAK*/; |
| 12572 } | 12839 } |
| 12573 else if (this._text.charCodeAt(i0) == 99) { | 12840 else if ($notnull_bool(this._text.charCodeAt(i0) == 99)) { |
| 12574 if (this._text.charCodeAt(i0 + 1) == 97) { | 12841 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { |
| 12575 if (this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 +
3) == 99 && this._text.charCodeAt(i0 + 4) == 104) return 89/*TokenKind.CATCH*/; | 12842 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 116 && this._text.c
harCodeAt(i0 + 3) == 99 && this._text.charCodeAt(i0 + 4) == 104)) return 90/*Tok
enKind.CATCH*/; |
| 12576 } | 12843 } |
| 12577 else if (this._text.charCodeAt(i0 + 1) == 108) { | 12844 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 108)) { |
| 12578 if (this._text.charCodeAt(i0 + 2) == 97 && this._text.charCodeAt(i0 +
3) == 115 && this._text.charCodeAt(i0 + 4) == 115) return 72/*TokenKind.CLASS*/; | 12845 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 97 && this._text.ch
arCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 115)) return 73/*Tok
enKind.CLASS*/; |
| 12579 } | 12846 } |
| 12580 else if (this._text.charCodeAt(i0 + 1) == 111) { | 12847 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111)) { |
| 12581 if (this._text.charCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 +
3) == 115 && this._text.charCodeAt(i0 + 4) == 116) return 90/*TokenKind.CONST*/
; | 12848 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c
harCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 116)) return 91/*To
kenKind.CONST*/; |
| 12582 } | 12849 } |
| 12583 } | 12850 } |
| 12584 else if (this._text.charCodeAt(i0) == 102) { | 12851 else if ($notnull_bool(this._text.charCodeAt(i0) == 102)) { |
| 12585 if (this._text.charCodeAt(i0 + 1) == 97) { | 12852 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { |
| 12586 if (this._text.charCodeAt(i0 + 2) == 108 && this._text.charCodeAt(i0 +
3) == 115 && this._text.charCodeAt(i0 + 4) == 101) return 95/*TokenKind.FALSE*/
; | 12853 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 108 && this._text.c
harCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 101)) return 96/*To
kenKind.FALSE*/; |
| 12587 } | 12854 } |
| 12588 else if (this._text.charCodeAt(i0 + 1) == 105) { | 12855 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105)) { |
| 12589 if (this._text.charCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 +
3) == 97 && this._text.charCodeAt(i0 + 4) == 108) return 96/*TokenKind.FINAL*/; | 12856 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c
harCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 108)) return 97/*Tok
enKind.FINAL*/; |
| 12590 } | 12857 } |
| 12591 } | 12858 } |
| 12592 else if (this._text.charCodeAt(i0) == 115) { | 12859 else if ($notnull_bool(this._text.charCodeAt(i0) == 115)) { |
| 12593 if (this._text.charCodeAt(i0 + 1) == 117 && this._text.charCodeAt(i0 + 2
) == 112 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4
) == 114) return 105/*TokenKind.SUPER*/; | 12860 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 117 && this._text.cha
rCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 101 && this._text.cha
rCodeAt(i0 + 4) == 114)) return 106/*TokenKind.SUPER*/; |
| 12594 } | 12861 } |
| 12595 else if (this._text.charCodeAt(i0) == 116) { | 12862 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) { |
| 12596 if (this._text.charCodeAt(i0 + 1) == 104 && this._text.charCodeAt(i0 + 2
) == 114 && this._text.charCodeAt(i0 + 3) == 111 && this._text.charCodeAt(i0 + 4
) == 119) return 108/*TokenKind.THROW*/; | 12863 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104 && this._text.cha
rCodeAt(i0 + 2) == 114 && this._text.charCodeAt(i0 + 3) == 111 && this._text.cha
rCodeAt(i0 + 4) == 119)) return 109/*TokenKind.THROW*/; |
| 12597 } | 12864 } |
| 12598 else if (this._text.charCodeAt(i0) == 119) { | 12865 else if ($notnull_bool(this._text.charCodeAt(i0) == 119)) { |
| 12599 if (this._text.charCodeAt(i0 + 1) == 104 && this._text.charCodeAt(i0 + 2
) == 105 && this._text.charCodeAt(i0 + 3) == 108 && this._text.charCodeAt(i0 + 4
) == 101) return 113/*TokenKind.WHILE*/; | 12866 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104 && this._text.cha
rCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 + 3) == 108 && this._text.cha
rCodeAt(i0 + 4) == 101)) return 114/*TokenKind.WHILE*/; |
| 12600 } | 12867 } |
| 12601 return 69/*TokenKind.IDENTIFIER*/; | 12868 return 70/*TokenKind.IDENTIFIER*/; |
| 12602 | 12869 |
| 12603 case 6: | 12870 case 6: |
| 12604 | 12871 |
| 12605 if (this._text.charCodeAt(i0) == 97) { | 12872 if ($notnull_bool(this._text.charCodeAt(i0) == 97)) { |
| 12606 if (this._text.charCodeAt(i0 + 1) == 115 && this._text.charCodeAt(i0 + 2
) == 115 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4
) == 114 && this._text.charCodeAt(i0 + 5) == 116) return 71/*TokenKind.ASSERT*/; | 12873 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 115 && this._text.cha
rCodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 101 && this._text.cha
rCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 116)) return 72/*Toke
nKind.ASSERT*/; |
| 12607 } | 12874 } |
| 12608 else if (this._text.charCodeAt(i0) == 105) { | 12875 else if ($notnull_bool(this._text.charCodeAt(i0) == 105)) { |
| 12609 if (this._text.charCodeAt(i0 + 1) == 109 && this._text.charCodeAt(i0 + 2
) == 112 && this._text.charCodeAt(i0 + 3) == 111 && this._text.charCodeAt(i0 + 4
) == 114 && this._text.charCodeAt(i0 + 5) == 116) return 77/*TokenKind.IMPORT*/; | 12876 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 109 && this._text.cha
rCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 111 && this._text.cha
rCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 116)) return 78/*Toke
nKind.IMPORT*/; |
| 12610 } | 12877 } |
| 12611 else if (this._text.charCodeAt(i0) == 110) { | 12878 else if ($notnull_bool(this._text.charCodeAt(i0) == 110)) { |
| 12612 if (this._text.charCodeAt(i0 + 1) == 97) { | 12879 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { |
| 12613 if (this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 +
3) == 105 && this._text.charCodeAt(i0 + 4) == 118 && this._text.charCodeAt(i0 +
5) == 101) return 80/*TokenKind.NATIVE*/; | 12880 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 116 && this._text.c
harCodeAt(i0 + 3) == 105 && this._text.charCodeAt(i0 + 4) == 118 && this._text.c
harCodeAt(i0 + 5) == 101)) return 81/*TokenKind.NATIVE*/; |
| 12614 } | 12881 } |
| 12615 else if (this._text.charCodeAt(i0 + 1) == 101) { | 12882 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101)) { |
| 12616 if (this._text.charCodeAt(i0 + 2) == 103 && this._text.charCodeAt(i0 +
3) == 97 && this._text.charCodeAt(i0 + 4) == 116 && this._text.charCodeAt(i0 +
5) == 101) return 81/*TokenKind.NEGATE*/; | 12883 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 103 && this._text.c
harCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 116 && this._text.ch
arCodeAt(i0 + 5) == 101)) return 82/*TokenKind.NEGATE*/; |
| 12617 } | 12884 } |
| 12618 } | 12885 } |
| 12619 else if (this._text.charCodeAt(i0) == 114) { | 12886 else if ($notnull_bool(this._text.charCodeAt(i0) == 114)) { |
| 12620 if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2
) == 116 && this._text.charCodeAt(i0 + 3) == 117 && this._text.charCodeAt(i0 + 4
) == 114 && this._text.charCodeAt(i0 + 5) == 110) return 104/*TokenKind.RETURN*/
; | 12887 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha
rCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 117 && this._text.cha
rCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 110)) return 105/*Tok
enKind.RETURN*/; |
| 12621 } | 12888 } |
| 12622 else if (this._text.charCodeAt(i0) == 115) { | 12889 else if ($notnull_bool(this._text.charCodeAt(i0) == 115)) { |
| 12623 if (this._text.charCodeAt(i0 + 1) == 111) { | 12890 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111)) { |
| 12624 if (this._text.charCodeAt(i0 + 2) == 117 && this._text.charCodeAt(i0 +
3) == 114 && this._text.charCodeAt(i0 + 4) == 99 && this._text.charCodeAt(i0 +
5) == 101) return 84/*TokenKind.SOURCE*/; | 12891 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 117 && this._text.c
harCodeAt(i0 + 3) == 114 && this._text.charCodeAt(i0 + 4) == 99 && this._text.ch
arCodeAt(i0 + 5) == 101)) return 85/*TokenKind.SOURCE*/; |
| 12625 } | 12892 } |
| 12626 else if (this._text.charCodeAt(i0 + 1) == 116) { | 12893 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 116)) { |
| 12627 if (this._text.charCodeAt(i0 + 2) == 97 && this._text.charCodeAt(i0 +
3) == 116 && this._text.charCodeAt(i0 + 4) == 105 && this._text.charCodeAt(i0 +
5) == 99) return 85/*TokenKind.STATIC*/; | 12894 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 97 && this._text.ch
arCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 105 && this._text.ch
arCodeAt(i0 + 5) == 99)) return 86/*TokenKind.STATIC*/; |
| 12628 } | 12895 } |
| 12629 else if (this._text.charCodeAt(i0 + 1) == 119) { | 12896 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 119)) { |
| 12630 if (this._text.charCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 +
3) == 116 && this._text.charCodeAt(i0 + 4) == 99 && this._text.charCodeAt(i0 +
5) == 104) return 106/*TokenKind.SWITCH*/; | 12897 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 105 && this._text.c
harCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 99 && this._text.ch
arCodeAt(i0 + 5) == 104)) return 107/*TokenKind.SWITCH*/; |
| 12631 } | 12898 } |
| 12632 } | 12899 } |
| 12633 return 69/*TokenKind.IDENTIFIER*/; | 12900 return 70/*TokenKind.IDENTIFIER*/; |
| 12634 | 12901 |
| 12635 case 7: | 12902 case 7: |
| 12636 | 12903 |
| 12637 if (this._text.charCodeAt(i0) == 100) { | 12904 if ($notnull_bool(this._text.charCodeAt(i0) == 100)) { |
| 12638 if (this._text.charCodeAt(i0 + 1) == 101 && this._text.charCodeAt(i0 + 2
) == 102 && this._text.charCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4)
== 117 && this._text.charCodeAt(i0 + 5) == 108 && this._text.charCodeAt(i0 + 6)
== 116) return 92/*TokenKind.DEFAULT*/; | 12905 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha
rCodeAt(i0 + 2) == 102 && this._text.charCodeAt(i0 + 3) == 97 && this._text.char
CodeAt(i0 + 4) == 117 && this._text.charCodeAt(i0 + 5) == 108 && this._text.char
CodeAt(i0 + 6) == 116)) return 93/*TokenKind.DEFAULT*/; |
| 12639 } | 12906 } |
| 12640 else if (this._text.charCodeAt(i0) == 101) { | 12907 else if ($notnull_bool(this._text.charCodeAt(i0) == 101)) { |
| 12641 if (this._text.charCodeAt(i0 + 1) == 120 && this._text.charCodeAt(i0 + 2
) == 116 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4
) == 110 && this._text.charCodeAt(i0 + 5) == 100 && this._text.charCodeAt(i0 + 6
) == 115) return 73/*TokenKind.EXTENDS*/; | 12908 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 120 && this._text.cha
rCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 101 && this._text.cha
rCodeAt(i0 + 4) == 110 && this._text.charCodeAt(i0 + 5) == 100 && this._text.cha
rCodeAt(i0 + 6) == 115)) return 74/*TokenKind.EXTENDS*/; |
| 12642 } | 12909 } |
| 12643 else if (this._text.charCodeAt(i0) == 102) { | 12910 else if ($notnull_bool(this._text.charCodeAt(i0) == 102)) { |
| 12644 if (this._text.charCodeAt(i0 + 1) == 97) { | 12911 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { |
| 12645 if (this._text.charCodeAt(i0 + 2) == 99 && this._text.charCodeAt(i0 +
3) == 116 && this._text.charCodeAt(i0 + 4) == 111 && this._text.charCodeAt(i0 +
5) == 114 && this._text.charCodeAt(i0 + 6) == 121) return 74/*TokenKind.FACTORY*
/; | 12912 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 99 && this._text.ch
arCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 111 && this._text.ch
arCodeAt(i0 + 5) == 114 && this._text.charCodeAt(i0 + 6) == 121)) return 75/*Tok
enKind.FACTORY*/; |
| 12646 } | 12913 } |
| 12647 else if (this._text.charCodeAt(i0 + 1) == 105) { | 12914 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105)) { |
| 12648 if (this._text.charCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 +
3) == 97 && this._text.charCodeAt(i0 + 4) == 108 && this._text.charCodeAt(i0 +
5) == 108 && this._text.charCodeAt(i0 + 6) == 121) return 97/*TokenKind.FINALLY*
/; | 12915 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c
harCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 108 && this._text.ch
arCodeAt(i0 + 5) == 108 && this._text.charCodeAt(i0 + 6) == 121)) return 98/*Tok
enKind.FINALLY*/; |
| 12649 } | 12916 } |
| 12650 } | 12917 } |
| 12651 else if (this._text.charCodeAt(i0) == 108) { | 12918 else if ($notnull_bool(this._text.charCodeAt(i0) == 108)) { |
| 12652 if (this._text.charCodeAt(i0 + 1) == 105 && this._text.charCodeAt(i0 + 2
) == 98 && this._text.charCodeAt(i0 + 3) == 114 && this._text.charCodeAt(i0 + 4)
== 97 && this._text.charCodeAt(i0 + 5) == 114 && this._text.charCodeAt(i0 + 6)
== 121) return 79/*TokenKind.LIBRARY*/; | 12919 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105 && this._text.cha
rCodeAt(i0 + 2) == 98 && this._text.charCodeAt(i0 + 3) == 114 && this._text.char
CodeAt(i0 + 4) == 97 && this._text.charCodeAt(i0 + 5) == 114 && this._text.charC
odeAt(i0 + 6) == 121)) return 80/*TokenKind.LIBRARY*/; |
| 12653 } | 12920 } |
| 12654 else if (this._text.charCodeAt(i0) == 116) { | 12921 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) { |
| 12655 if (this._text.charCodeAt(i0 + 1) == 121 && this._text.charCodeAt(i0 + 2
) == 112 && this._text.charCodeAt(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4
) == 100 && this._text.charCodeAt(i0 + 5) == 101 && this._text.charCodeAt(i0 + 6
) == 102) return 86/*TokenKind.TYPEDEF*/; | 12922 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 121 && this._text.cha
rCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 101 && this._text.cha
rCodeAt(i0 + 4) == 100 && this._text.charCodeAt(i0 + 5) == 101 && this._text.cha
rCodeAt(i0 + 6) == 102)) return 87/*TokenKind.TYPEDEF*/; |
| 12656 } | 12923 } |
| 12657 return 69/*TokenKind.IDENTIFIER*/; | 12924 return 70/*TokenKind.IDENTIFIER*/; |
| 12658 | 12925 |
| 12659 case 8: | 12926 case 8: |
| 12660 | 12927 |
| 12661 if (this._text.charCodeAt(i0) == 97) { | 12928 if ($notnull_bool(this._text.charCodeAt(i0) == 97)) { |
| 12662 if (this._text.charCodeAt(i0 + 1) == 98 && this._text.charCodeAt(i0 + 2)
== 115 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4)
== 114 && this._text.charCodeAt(i0 + 5) == 97 && this._text.charCodeAt(i0 + 6)
== 99 && this._text.charCodeAt(i0 + 7) == 116) return 70/*TokenKind.ABSTRACT*/; | 12929 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 98 && this._text.char
CodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 116 && this._text.char
CodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 97 && this._text.charC
odeAt(i0 + 6) == 99 && this._text.charCodeAt(i0 + 7) == 116)) return 71/*TokenKi
nd.ABSTRACT*/; |
| 12663 } | 12930 } |
| 12664 else if (this._text.charCodeAt(i0) == 99) { | 12931 else if ($notnull_bool(this._text.charCodeAt(i0) == 99)) { |
| 12665 if (this._text.charCodeAt(i0 + 1) == 111 && this._text.charCodeAt(i0 + 2
) == 110 && this._text.charCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4
) == 105 && this._text.charCodeAt(i0 + 5) == 110 && this._text.charCodeAt(i0 + 6
) == 117 && this._text.charCodeAt(i0 + 7) == 101) return 91/*TokenKind.CONTINUE*
/; | 12932 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111 && this._text.cha
rCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 + 3) == 116 && this._text.cha
rCodeAt(i0 + 4) == 105 && this._text.charCodeAt(i0 + 5) == 110 && this._text.cha
rCodeAt(i0 + 6) == 117 && this._text.charCodeAt(i0 + 7) == 101)) return 92/*Toke
nKind.CONTINUE*/; |
| 12666 } | 12933 } |
| 12667 else if (this._text.charCodeAt(i0) == 111) { | 12934 else if ($notnull_bool(this._text.charCodeAt(i0) == 111)) { |
| 12668 if (this._text.charCodeAt(i0 + 1) == 112 && this._text.charCodeAt(i0 + 2
) == 101 && this._text.charCodeAt(i0 + 3) == 114 && this._text.charCodeAt(i0 + 4
) == 97 && this._text.charCodeAt(i0 + 5) == 116 && this._text.charCodeAt(i0 + 6)
== 111 && this._text.charCodeAt(i0 + 7) == 114) return 82/*TokenKind.OPERATOR*/
; | 12935 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 112 && this._text.cha
rCodeAt(i0 + 2) == 101 && this._text.charCodeAt(i0 + 3) == 114 && this._text.cha
rCodeAt(i0 + 4) == 97 && this._text.charCodeAt(i0 + 5) == 116 && this._text.char
CodeAt(i0 + 6) == 111 && this._text.charCodeAt(i0 + 7) == 114)) return 83/*Token
Kind.OPERATOR*/; |
| 12669 } | 12936 } |
| 12670 return 69/*TokenKind.IDENTIFIER*/; | 12937 return 70/*TokenKind.IDENTIFIER*/; |
| 12671 | 12938 |
| 12672 case 9: | 12939 case 9: |
| 12673 | 12940 |
| 12674 if (this._text.charCodeAt(i0) == 105 && this._text.charCodeAt(i0 + 1) == 1
10 && this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 1
01 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 1
02 && this._text.charCodeAt(i0 + 6) == 97 && this._text.charCodeAt(i0 + 7) == 99
&& this._text.charCodeAt(i0 + 8) == 101) return 78/*TokenKind.INTERFACE*/; | 12941 if ($notnull_bool(this._text.charCodeAt(i0) == 105 && this._text.charCodeA
t(i0 + 1) == 110 && this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeA
t(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCodeA
t(i0 + 5) == 102 && this._text.charCodeAt(i0 + 6) == 97 && this._text.charCodeAt
(i0 + 7) == 99 && this._text.charCodeAt(i0 + 8) == 101)) return 79/*TokenKind.IN
TERFACE*/; |
| 12675 return 69/*TokenKind.IDENTIFIER*/; | 12942 return 70/*TokenKind.IDENTIFIER*/; |
| 12676 | 12943 |
| 12677 case 10: | 12944 case 10: |
| 12678 | 12945 |
| 12679 if (this._text.charCodeAt(i0) == 105 && this._text.charCodeAt(i0 + 1) == 1
09 && this._text.charCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 1
08 && this._text.charCodeAt(i0 + 4) == 101 && this._text.charCodeAt(i0 + 5) == 1
09 && this._text.charCodeAt(i0 + 6) == 101 && this._text.charCodeAt(i0 + 7) == 1
10 && this._text.charCodeAt(i0 + 8) == 116 && this._text.charCodeAt(i0 + 9) == 1
15) return 76/*TokenKind.IMPLEMENTS*/; | 12946 if ($notnull_bool(this._text.charCodeAt(i0) == 105 && this._text.charCodeA
t(i0 + 1) == 109 && this._text.charCodeAt(i0 + 2) == 112 && this._text.charCodeA
t(i0 + 3) == 108 && this._text.charCodeAt(i0 + 4) == 101 && this._text.charCodeA
t(i0 + 5) == 109 && this._text.charCodeAt(i0 + 6) == 101 && this._text.charCodeA
t(i0 + 7) == 110 && this._text.charCodeAt(i0 + 8) == 116 && this._text.charCodeA
t(i0 + 9) == 115)) return 77/*TokenKind.IMPLEMENTS*/; |
| 12680 return 69/*TokenKind.IDENTIFIER*/; | 12947 return 70/*TokenKind.IDENTIFIER*/; |
| 12681 | 12948 |
| 12682 default: | 12949 default: |
| 12683 | 12950 |
| 12684 return 69/*TokenKind.IDENTIFIER*/; | 12951 return 70/*TokenKind.IDENTIFIER*/; |
| 12685 | 12952 |
| 12686 } | 12953 } |
| 12687 } | 12954 } |
| 12688 // ********** Code for TokenizerHelpers ************** | 12955 // ********** Code for TokenizerHelpers ************** |
| 12689 function TokenizerHelpers() {} | 12956 function TokenizerHelpers() {} |
| 12690 TokenizerHelpers.isIdentifierStart = function(c) { | 12957 TokenizerHelpers.isIdentifierStart = function(c) { |
| 12691 return ((c >= 97 && c <= 122) || (c >= 65 && c <= 90) || c == 95); | 12958 return ((c >= 97 && c <= 122) || (c >= 65 && c <= 90) || c == 95); |
| 12692 } | 12959 } |
| 12693 TokenizerHelpers.isDigit = function(c) { | 12960 TokenizerHelpers.isDigit = function(c) { |
| 12694 return (c >= 48 && c <= 57); | 12961 return (c >= 48 && c <= 57); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12935 return "[]="; | 13202 return "[]="; |
| 12936 | 13203 |
| 12937 case 58/*TokenKind.STRING*/: | 13204 case 58/*TokenKind.STRING*/: |
| 12938 | 13205 |
| 12939 return "string"; | 13206 return "string"; |
| 12940 | 13207 |
| 12941 case 59/*TokenKind.STRING_PART*/: | 13208 case 59/*TokenKind.STRING_PART*/: |
| 12942 | 13209 |
| 12943 return "string part"; | 13210 return "string part"; |
| 12944 | 13211 |
| 12945 case 60/*TokenKind.NUMBER*/: | 13212 case 60/*TokenKind.INTEGER*/: |
| 12946 | 13213 |
| 12947 return "number"; | 13214 return "integer"; |
| 12948 | 13215 |
| 12949 case 61/*TokenKind.HEX_NUMBER*/: | 13216 case 61/*TokenKind.HEX_INTEGER*/: |
| 12950 | 13217 |
| 12951 return "hex number"; | 13218 return "hex integer"; |
| 12952 | 13219 |
| 12953 case 62/*TokenKind.WHITESPACE*/: | 13220 case 62/*TokenKind.DOUBLE*/: |
| 13221 |
| 13222 return "double"; |
| 13223 |
| 13224 case 63/*TokenKind.WHITESPACE*/: |
| 12954 | 13225 |
| 12955 return "whitespace"; | 13226 return "whitespace"; |
| 12956 | 13227 |
| 12957 case 63/*TokenKind.COMMENT*/: | 13228 case 64/*TokenKind.COMMENT*/: |
| 12958 | 13229 |
| 12959 return "comment"; | 13230 return "comment"; |
| 12960 | 13231 |
| 12961 case 64/*TokenKind.ERROR*/: | 13232 case 65/*TokenKind.ERROR*/: |
| 12962 | 13233 |
| 12963 return "error"; | 13234 return "error"; |
| 12964 | 13235 |
| 12965 case 65/*TokenKind.INCOMPLETE_STRING*/: | 13236 case 66/*TokenKind.INCOMPLETE_STRING*/: |
| 12966 | 13237 |
| 12967 return "incomplete string"; | 13238 return "incomplete string"; |
| 12968 | 13239 |
| 12969 case 66/*TokenKind.INCOMPLETE_COMMENT*/: | 13240 case 67/*TokenKind.INCOMPLETE_COMMENT*/: |
| 12970 | 13241 |
| 12971 return "incomplete comment"; | 13242 return "incomplete comment"; |
| 12972 | 13243 |
| 12973 case 67/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/: | 13244 case 68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/: |
| 12974 | 13245 |
| 12975 return "incomplete multiline string dq"; | 13246 return "incomplete multiline string dq"; |
| 12976 | 13247 |
| 12977 case 68/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/: | 13248 case 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/: |
| 12978 | 13249 |
| 12979 return "incomplete multiline string sq"; | 13250 return "incomplete multiline string sq"; |
| 12980 | 13251 |
| 12981 case 69/*TokenKind.IDENTIFIER*/: | 13252 case 70/*TokenKind.IDENTIFIER*/: |
| 12982 | 13253 |
| 12983 return "identifier"; | 13254 return "identifier"; |
| 12984 | 13255 |
| 12985 case 70/*TokenKind.ABSTRACT*/: | 13256 case 71/*TokenKind.ABSTRACT*/: |
| 12986 | 13257 |
| 12987 return "pseudo-keyword 'abstract'"; | 13258 return "pseudo-keyword 'abstract'"; |
| 12988 | 13259 |
| 12989 case 71/*TokenKind.ASSERT*/: | 13260 case 72/*TokenKind.ASSERT*/: |
| 12990 | 13261 |
| 12991 return "pseudo-keyword 'assert'"; | 13262 return "pseudo-keyword 'assert'"; |
| 12992 | 13263 |
| 12993 case 72/*TokenKind.CLASS*/: | 13264 case 73/*TokenKind.CLASS*/: |
| 12994 | 13265 |
| 12995 return "pseudo-keyword 'class'"; | 13266 return "pseudo-keyword 'class'"; |
| 12996 | 13267 |
| 12997 case 73/*TokenKind.EXTENDS*/: | 13268 case 74/*TokenKind.EXTENDS*/: |
| 12998 | 13269 |
| 12999 return "pseudo-keyword 'extends'"; | 13270 return "pseudo-keyword 'extends'"; |
| 13000 | 13271 |
| 13001 case 74/*TokenKind.FACTORY*/: | 13272 case 75/*TokenKind.FACTORY*/: |
| 13002 | 13273 |
| 13003 return "pseudo-keyword 'factory'"; | 13274 return "pseudo-keyword 'factory'"; |
| 13004 | 13275 |
| 13005 case 75/*TokenKind.GET*/: | 13276 case 76/*TokenKind.GET*/: |
| 13006 | 13277 |
| 13007 return "pseudo-keyword 'get'"; | 13278 return "pseudo-keyword 'get'"; |
| 13008 | 13279 |
| 13009 case 76/*TokenKind.IMPLEMENTS*/: | 13280 case 77/*TokenKind.IMPLEMENTS*/: |
| 13010 | 13281 |
| 13011 return "pseudo-keyword 'implements'"; | 13282 return "pseudo-keyword 'implements'"; |
| 13012 | 13283 |
| 13013 case 77/*TokenKind.IMPORT*/: | 13284 case 78/*TokenKind.IMPORT*/: |
| 13014 | 13285 |
| 13015 return "pseudo-keyword 'import'"; | 13286 return "pseudo-keyword 'import'"; |
| 13016 | 13287 |
| 13017 case 78/*TokenKind.INTERFACE*/: | 13288 case 79/*TokenKind.INTERFACE*/: |
| 13018 | 13289 |
| 13019 return "pseudo-keyword 'interface'"; | 13290 return "pseudo-keyword 'interface'"; |
| 13020 | 13291 |
| 13021 case 79/*TokenKind.LIBRARY*/: | 13292 case 80/*TokenKind.LIBRARY*/: |
| 13022 | 13293 |
| 13023 return "pseudo-keyword 'library'"; | 13294 return "pseudo-keyword 'library'"; |
| 13024 | 13295 |
| 13025 case 80/*TokenKind.NATIVE*/: | 13296 case 81/*TokenKind.NATIVE*/: |
| 13026 | 13297 |
| 13027 return "pseudo-keyword 'native'"; | 13298 return "pseudo-keyword 'native'"; |
| 13028 | 13299 |
| 13029 case 81/*TokenKind.NEGATE*/: | 13300 case 82/*TokenKind.NEGATE*/: |
| 13030 | 13301 |
| 13031 return "pseudo-keyword 'negate'"; | 13302 return "pseudo-keyword 'negate'"; |
| 13032 | 13303 |
| 13033 case 82/*TokenKind.OPERATOR*/: | 13304 case 83/*TokenKind.OPERATOR*/: |
| 13034 | 13305 |
| 13035 return "pseudo-keyword 'operator'"; | 13306 return "pseudo-keyword 'operator'"; |
| 13036 | 13307 |
| 13037 case 83/*TokenKind.SET*/: | 13308 case 84/*TokenKind.SET*/: |
| 13038 | 13309 |
| 13039 return "pseudo-keyword 'set'"; | 13310 return "pseudo-keyword 'set'"; |
| 13040 | 13311 |
| 13041 case 84/*TokenKind.SOURCE*/: | 13312 case 85/*TokenKind.SOURCE*/: |
| 13042 | 13313 |
| 13043 return "pseudo-keyword 'source'"; | 13314 return "pseudo-keyword 'source'"; |
| 13044 | 13315 |
| 13045 case 85/*TokenKind.STATIC*/: | 13316 case 86/*TokenKind.STATIC*/: |
| 13046 | 13317 |
| 13047 return "pseudo-keyword 'static'"; | 13318 return "pseudo-keyword 'static'"; |
| 13048 | 13319 |
| 13049 case 86/*TokenKind.TYPEDEF*/: | 13320 case 87/*TokenKind.TYPEDEF*/: |
| 13050 | 13321 |
| 13051 return "pseudo-keyword 'typedef'"; | 13322 return "pseudo-keyword 'typedef'"; |
| 13052 | 13323 |
| 13053 case 87/*TokenKind.BREAK*/: | 13324 case 88/*TokenKind.BREAK*/: |
| 13054 | 13325 |
| 13055 return "keyword 'break'"; | 13326 return "keyword 'break'"; |
| 13056 | 13327 |
| 13057 case 88/*TokenKind.CASE*/: | 13328 case 89/*TokenKind.CASE*/: |
| 13058 | 13329 |
| 13059 return "keyword 'case'"; | 13330 return "keyword 'case'"; |
| 13060 | 13331 |
| 13061 case 89/*TokenKind.CATCH*/: | 13332 case 90/*TokenKind.CATCH*/: |
| 13062 | 13333 |
| 13063 return "keyword 'catch'"; | 13334 return "keyword 'catch'"; |
| 13064 | 13335 |
| 13065 case 90/*TokenKind.CONST*/: | 13336 case 91/*TokenKind.CONST*/: |
| 13066 | 13337 |
| 13067 return "keyword 'const'"; | 13338 return "keyword 'const'"; |
| 13068 | 13339 |
| 13069 case 91/*TokenKind.CONTINUE*/: | 13340 case 92/*TokenKind.CONTINUE*/: |
| 13070 | 13341 |
| 13071 return "keyword 'continue'"; | 13342 return "keyword 'continue'"; |
| 13072 | 13343 |
| 13073 case 92/*TokenKind.DEFAULT*/: | 13344 case 93/*TokenKind.DEFAULT*/: |
| 13074 | 13345 |
| 13075 return "keyword 'default'"; | 13346 return "keyword 'default'"; |
| 13076 | 13347 |
| 13077 case 93/*TokenKind.DO*/: | 13348 case 94/*TokenKind.DO*/: |
| 13078 | 13349 |
| 13079 return "keyword 'do'"; | 13350 return "keyword 'do'"; |
| 13080 | 13351 |
| 13081 case 94/*TokenKind.ELSE*/: | 13352 case 95/*TokenKind.ELSE*/: |
| 13082 | 13353 |
| 13083 return "keyword 'else'"; | 13354 return "keyword 'else'"; |
| 13084 | 13355 |
| 13085 case 95/*TokenKind.FALSE*/: | 13356 case 96/*TokenKind.FALSE*/: |
| 13086 | 13357 |
| 13087 return "keyword 'false'"; | 13358 return "keyword 'false'"; |
| 13088 | 13359 |
| 13089 case 96/*TokenKind.FINAL*/: | 13360 case 97/*TokenKind.FINAL*/: |
| 13090 | 13361 |
| 13091 return "keyword 'final'"; | 13362 return "keyword 'final'"; |
| 13092 | 13363 |
| 13093 case 97/*TokenKind.FINALLY*/: | 13364 case 98/*TokenKind.FINALLY*/: |
| 13094 | 13365 |
| 13095 return "keyword 'finally'"; | 13366 return "keyword 'finally'"; |
| 13096 | 13367 |
| 13097 case 98/*TokenKind.FOR*/: | 13368 case 99/*TokenKind.FOR*/: |
| 13098 | 13369 |
| 13099 return "keyword 'for'"; | 13370 return "keyword 'for'"; |
| 13100 | 13371 |
| 13101 case 99/*TokenKind.IF*/: | 13372 case 100/*TokenKind.IF*/: |
| 13102 | 13373 |
| 13103 return "keyword 'if'"; | 13374 return "keyword 'if'"; |
| 13104 | 13375 |
| 13105 case 100/*TokenKind.IN*/: | 13376 case 101/*TokenKind.IN*/: |
| 13106 | 13377 |
| 13107 return "keyword 'in'"; | 13378 return "keyword 'in'"; |
| 13108 | 13379 |
| 13109 case 101/*TokenKind.IS*/: | 13380 case 102/*TokenKind.IS*/: |
| 13110 | 13381 |
| 13111 return "keyword 'is'"; | 13382 return "keyword 'is'"; |
| 13112 | 13383 |
| 13113 case 102/*TokenKind.NEW*/: | 13384 case 103/*TokenKind.NEW*/: |
| 13114 | 13385 |
| 13115 return "keyword 'new'"; | 13386 return "keyword 'new'"; |
| 13116 | 13387 |
| 13117 case 103/*TokenKind.NULL*/: | 13388 case 104/*TokenKind.NULL*/: |
| 13118 | 13389 |
| 13119 return "keyword 'null'"; | 13390 return "keyword 'null'"; |
| 13120 | 13391 |
| 13121 case 104/*TokenKind.RETURN*/: | 13392 case 105/*TokenKind.RETURN*/: |
| 13122 | 13393 |
| 13123 return "keyword 'return'"; | 13394 return "keyword 'return'"; |
| 13124 | 13395 |
| 13125 case 105/*TokenKind.SUPER*/: | 13396 case 106/*TokenKind.SUPER*/: |
| 13126 | 13397 |
| 13127 return "keyword 'super'"; | 13398 return "keyword 'super'"; |
| 13128 | 13399 |
| 13129 case 106/*TokenKind.SWITCH*/: | 13400 case 107/*TokenKind.SWITCH*/: |
| 13130 | 13401 |
| 13131 return "keyword 'switch'"; | 13402 return "keyword 'switch'"; |
| 13132 | 13403 |
| 13133 case 107/*TokenKind.THIS*/: | 13404 case 108/*TokenKind.THIS*/: |
| 13134 | 13405 |
| 13135 return "keyword 'this'"; | 13406 return "keyword 'this'"; |
| 13136 | 13407 |
| 13137 case 108/*TokenKind.THROW*/: | 13408 case 109/*TokenKind.THROW*/: |
| 13138 | 13409 |
| 13139 return "keyword 'throw'"; | 13410 return "keyword 'throw'"; |
| 13140 | 13411 |
| 13141 case 109/*TokenKind.TRUE*/: | 13412 case 110/*TokenKind.TRUE*/: |
| 13142 | 13413 |
| 13143 return "keyword 'true'"; | 13414 return "keyword 'true'"; |
| 13144 | 13415 |
| 13145 case 110/*TokenKind.TRY*/: | 13416 case 111/*TokenKind.TRY*/: |
| 13146 | 13417 |
| 13147 return "keyword 'try'"; | 13418 return "keyword 'try'"; |
| 13148 | 13419 |
| 13149 case 111/*TokenKind.VAR*/: | 13420 case 112/*TokenKind.VAR*/: |
| 13150 | 13421 |
| 13151 return "keyword 'var'"; | 13422 return "keyword 'var'"; |
| 13152 | 13423 |
| 13153 case 112/*TokenKind.VOID*/: | 13424 case 113/*TokenKind.VOID*/: |
| 13154 | 13425 |
| 13155 return "keyword 'void'"; | 13426 return "keyword 'void'"; |
| 13156 | 13427 |
| 13157 case 113/*TokenKind.WHILE*/: | 13428 case 114/*TokenKind.WHILE*/: |
| 13158 | 13429 |
| 13159 return "keyword 'while'"; | 13430 return "keyword 'while'"; |
| 13160 | 13431 |
| 13161 default: | 13432 default: |
| 13162 | 13433 |
| 13163 return "TokenKind(" + kind.toString() + ")"; | 13434 return "TokenKind(" + kind.toString() + ")"; |
| 13164 | 13435 |
| 13165 } | 13436 } |
| 13166 } | 13437 } |
| 13167 TokenKind.isIdentifier = function(kind) { | 13438 TokenKind.isIdentifier = function(kind) { |
| 13168 return kind >= 69/*TokenKind.IDENTIFIER*/ && kind < 87/*TokenKind.BREAK*/; | 13439 return kind >= 70/*TokenKind.IDENTIFIER*/ && kind < 88/*TokenKind.BREAK*/; |
| 13169 } | 13440 } |
| 13170 TokenKind.infixPrecedence = function(kind) { | 13441 TokenKind.infixPrecedence = function(kind) { |
| 13171 switch (kind) { | 13442 switch (kind) { |
| 13172 case 20/*TokenKind.ASSIGN*/: | 13443 case 20/*TokenKind.ASSIGN*/: |
| 13173 | 13444 |
| 13174 return 2; | 13445 return 2; |
| 13175 | 13446 |
| 13176 case 21/*TokenKind.ASSIGN_OR*/: | 13447 case 21/*TokenKind.ASSIGN_OR*/: |
| 13177 | 13448 |
| 13178 return 2; | 13449 return 2; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13306 return 10; | 13577 return 10; |
| 13307 | 13578 |
| 13308 case 54/*TokenKind.LTE*/: | 13579 case 54/*TokenKind.LTE*/: |
| 13309 | 13580 |
| 13310 return 10; | 13581 return 10; |
| 13311 | 13582 |
| 13312 case 55/*TokenKind.GTE*/: | 13583 case 55/*TokenKind.GTE*/: |
| 13313 | 13584 |
| 13314 return 10; | 13585 return 10; |
| 13315 | 13586 |
| 13316 case 101/*TokenKind.IS*/: | 13587 case 102/*TokenKind.IS*/: |
| 13317 | 13588 |
| 13318 return 10; | 13589 return 10; |
| 13319 | 13590 |
| 13320 default: | 13591 default: |
| 13321 | 13592 |
| 13322 return -1; | 13593 return -1; |
| 13323 | 13594 |
| 13324 } | 13595 } |
| 13325 } | 13596 } |
| 13326 TokenKind.rawOperatorFromMethod = function(name) { | 13597 TokenKind.rawOperatorFromMethod = function(name) { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13489 | 13760 |
| 13490 return '\$index'; | 13761 return '\$index'; |
| 13491 | 13762 |
| 13492 case 57/*TokenKind.SETINDEX*/: | 13763 case 57/*TokenKind.SETINDEX*/: |
| 13493 | 13764 |
| 13494 return '\$setindex'; | 13765 return '\$setindex'; |
| 13495 | 13766 |
| 13496 } | 13767 } |
| 13497 } | 13768 } |
| 13498 TokenKind.kindFromAssign = function(kind) { | 13769 TokenKind.kindFromAssign = function(kind) { |
| 13499 if (kind == 20/*TokenKind.ASSIGN*/) return 0; | 13770 if ($notnull_bool(kind == 20/*TokenKind.ASSIGN*/)) return 0; |
| 13500 if (kind > 20/*TokenKind.ASSIGN*/ && kind <= 32/*TokenKind.ASSIGN_MOD*/) { | 13771 if ($notnull_bool(kind > 20/*TokenKind.ASSIGN*/ && kind <= 32/*TokenKind.ASSIG
N_MOD*/)) { |
| 13501 return kind + (15)/*(ADD - ASSIGN_ADD)*/; | 13772 return kind + (15)/*(ADD - ASSIGN_ADD)*/; |
| 13502 } | 13773 } |
| 13503 return -1; | 13774 return -1; |
| 13504 } | 13775 } |
| 13505 // ********** Code for lang_Parser ************** | 13776 // ********** Code for lang_Parser ************** |
| 13506 function lang_Parser(source, diet, startOffset) { | 13777 function lang_Parser(source, diet, startOffset) { |
| 13507 this.source = source; | 13778 this.source = source; |
| 13508 this.diet = diet; | 13779 this.diet = diet; |
| 13509 // Initializers done | 13780 // Initializers done |
| 13510 this.tokenizer = new Tokenizer(this.source, true, startOffset); | 13781 this.tokenizer = new Tokenizer(this.source, true, startOffset); |
| 13511 this._peekToken = this.tokenizer.next(); | 13782 this._peekToken = this.tokenizer.next(); |
| 13512 this._previousToken = null; | 13783 this._previousToken = null; |
| 13513 this._inInitializers = false; | 13784 this._inInitializers = false; |
| 13514 } | 13785 } |
| 13515 lang_Parser.prototype.get$source = function() { return this.source; }; | 13786 lang_Parser.prototype.get$source = function() { return this.source; }; |
| 13516 lang_Parser.prototype.isPrematureEndOfFile = function() { | 13787 lang_Parser.prototype.isPrematureEndOfFile = function() { |
| 13517 if (this._maybeEat(1/*TokenKind.END_OF_FILE*/)) { | 13788 if ($notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/))) { |
| 13518 this._lang_error('unexpected end of file', this._peekToken.get$span()); | 13789 this._lang_error('unexpected end of file', this._peekToken.get$span()); |
| 13519 return true; | 13790 return true; |
| 13520 } | 13791 } |
| 13521 else { | 13792 else { |
| 13522 return false; | 13793 return false; |
| 13523 } | 13794 } |
| 13524 } | 13795 } |
| 13525 lang_Parser.prototype._peek = function() { | 13796 lang_Parser.prototype._peek = function() { |
| 13526 return this._peekToken.kind; | 13797 return this._peekToken.kind; |
| 13527 } | 13798 } |
| 13528 lang_Parser.prototype._lang_next = function() { | 13799 lang_Parser.prototype._lang_next = function() { |
| 13529 this._previousToken = this._peekToken; | 13800 this._previousToken = this._peekToken; |
| 13530 this._peekToken = this.tokenizer.next(); | 13801 this._peekToken = this.tokenizer.next(); |
| 13531 return this._previousToken; | 13802 return this._previousToken; |
| 13532 } | 13803 } |
| 13533 lang_Parser.prototype._peekKind = function(kind) { | 13804 lang_Parser.prototype._peekKind = function(kind) { |
| 13534 return this._peekToken.kind == kind; | 13805 return this._peekToken.kind == kind; |
| 13535 } | 13806 } |
| 13536 lang_Parser.prototype._peekIdentifier = function() { | 13807 lang_Parser.prototype._peekIdentifier = function() { |
| 13537 return TokenKind.isIdentifier(this._peekToken.kind); | 13808 return TokenKind.isIdentifier(this._peekToken.kind); |
| 13538 } | 13809 } |
| 13539 lang_Parser.prototype._maybeEat = function(kind) { | 13810 lang_Parser.prototype._maybeEat = function(kind) { |
| 13540 if (this._peekToken.kind == kind) { | 13811 if ($notnull_bool(this._peekToken.kind == kind)) { |
| 13541 this._previousToken = this._peekToken; | 13812 this._previousToken = this._peekToken; |
| 13542 this._peekToken = this.tokenizer.next(); | 13813 this._peekToken = this.tokenizer.next(); |
| 13543 return true; | 13814 return true; |
| 13544 } | 13815 } |
| 13545 else { | 13816 else { |
| 13546 return false; | 13817 return false; |
| 13547 } | 13818 } |
| 13548 } | 13819 } |
| 13549 lang_Parser.prototype._eat = function(kind) { | 13820 lang_Parser.prototype._eat = function(kind) { |
| 13550 if (!this._maybeEat(kind)) { | 13821 if ($notnull_bool(!this._maybeEat(kind))) { |
| 13551 this._errorExpected(TokenKind.kindToString(kind)); | 13822 this._errorExpected(TokenKind.kindToString(kind)); |
| 13552 } | 13823 } |
| 13553 } | 13824 } |
| 13554 lang_Parser.prototype._eatSemicolon = function() { | 13825 lang_Parser.prototype._eatSemicolon = function() { |
| 13555 this._eat(10/*TokenKind.SEMICOLON*/); | 13826 this._eat(10/*TokenKind.SEMICOLON*/); |
| 13556 } | 13827 } |
| 13557 lang_Parser.prototype._errorExpected = function(expected) { | 13828 lang_Parser.prototype._errorExpected = function(expected) { |
| 13558 var tok = this._lang_next(); | 13829 var tok = this._lang_next(); |
| 13559 var message = ('expected ' + expected + ', but found ' + tok + ''); | 13830 var message = ('expected ' + expected + ', but found ' + tok + ''); |
| 13560 this._lang_error(message, tok.get$span()); | 13831 this._lang_error($assert_String(message), tok.get$span()); |
| 13561 } | 13832 } |
| 13562 lang_Parser.prototype._lang_error = function(message, location) { | 13833 lang_Parser.prototype._lang_error = function(message, location) { |
| 13563 if (location == null) { | 13834 if ($notnull_bool(location == null)) { |
| 13564 location = this._peekToken.get$span(); | 13835 location = this._peekToken.get$span(); |
| 13565 } | 13836 } |
| 13566 world.fatal(message, location); | 13837 world.fatal(message, location); |
| 13567 } | 13838 } |
| 13568 lang_Parser.prototype._skipBlock = function() { | 13839 lang_Parser.prototype._skipBlock = function() { |
| 13569 var depth = 1; | 13840 var depth = 1; |
| 13570 this._eat(6/*TokenKind.LBRACE*/); | 13841 this._eat(6/*TokenKind.LBRACE*/); |
| 13571 while (true) { | 13842 while ($notnull_bool(true)) { |
| 13572 var tok = this._lang_next(); | 13843 var tok = this._lang_next(); |
| 13573 if (tok.kind == 6/*TokenKind.LBRACE*/) { | 13844 if ($notnull_bool(tok.kind == 6/*TokenKind.LBRACE*/)) { |
| 13574 depth += 1; | 13845 depth += 1; |
| 13575 } | 13846 } |
| 13576 else if (tok.kind == 7/*TokenKind.RBRACE*/) { | 13847 else if ($notnull_bool(tok.kind == 7/*TokenKind.RBRACE*/)) { |
| 13577 depth -= 1; | 13848 depth -= 1; |
| 13578 if (depth == 0) return; | 13849 if ($notnull_bool(depth == 0)) return; |
| 13579 } | 13850 } |
| 13580 else if (tok.kind == 1/*TokenKind.END_OF_FILE*/) { | 13851 else if ($notnull_bool(tok.kind == 1/*TokenKind.END_OF_FILE*/)) { |
| 13581 this._lang_error('unexpected end of file during diet parse', tok.get$span(
)); | 13852 this._lang_error('unexpected end of file during diet parse', tok.get$span(
)); |
| 13582 return; | 13853 return; |
| 13583 } | 13854 } |
| 13584 } | 13855 } |
| 13585 } | 13856 } |
| 13586 lang_Parser.prototype._makeSpan = function(start) { | 13857 lang_Parser.prototype._makeSpan = function(start) { |
| 13587 return new SourceSpan(this.source, start, this._previousToken.end); | 13858 return new SourceSpan(this.source, start, this._previousToken.end); |
| 13588 } | 13859 } |
| 13589 lang_Parser.prototype.compilationUnit = function() { | 13860 lang_Parser.prototype.compilationUnit = function() { |
| 13590 var ret = []; | 13861 var ret = []; |
| 13591 this._maybeEat(13/*TokenKind.HASHBANG*/); | 13862 this._maybeEat(13/*TokenKind.HASHBANG*/); |
| 13592 while (this._peekKind(12/*TokenKind.HASH*/)) { | 13863 while ($notnull_bool(this._peekKind(12/*TokenKind.HASH*/))) { |
| 13593 ret.add(this.directive()); | 13864 ret.add(this.directive()); |
| 13594 } | 13865 } |
| 13595 while (!this._maybeEat(1/*TokenKind.END_OF_FILE*/)) { | 13866 while ($notnull_bool(!this._maybeEat(1/*TokenKind.END_OF_FILE*/))) { |
| 13596 ret.add(this.topLevelDefinition()); | 13867 ret.add(this.topLevelDefinition()); |
| 13597 } | 13868 } |
| 13598 return ret; | 13869 return ret; |
| 13599 } | 13870 } |
| 13600 lang_Parser.prototype.directive = function() { | 13871 lang_Parser.prototype.directive = function() { |
| 13601 var start = this._peekToken.start; | 13872 var start = this._peekToken.start; |
| 13602 this._eat(12/*TokenKind.HASH*/); | 13873 this._eat(12/*TokenKind.HASH*/); |
| 13603 var name = this.identifier(); | 13874 var name = this.identifier(); |
| 13604 var args = this.arguments(); | 13875 var args = this.arguments(); |
| 13605 this._eatSemicolon(); | 13876 this._eatSemicolon(); |
| 13606 return new DirectiveDefinition(name, args, this._makeSpan(start)); | 13877 return new DirectiveDefinition(name, args, this._makeSpan(start)); |
| 13607 } | 13878 } |
| 13608 lang_Parser.prototype.topLevelDefinition = function() { | 13879 lang_Parser.prototype.topLevelDefinition = function() { |
| 13609 switch (this._peek()) { | 13880 switch (this._peek()) { |
| 13610 case 72/*TokenKind.CLASS*/: | 13881 case 73/*TokenKind.CLASS*/: |
| 13611 | 13882 |
| 13612 return this.classDefinition(72/*TokenKind.CLASS*/); | 13883 return this.classDefinition(73/*TokenKind.CLASS*/); |
| 13613 | 13884 |
| 13614 case 78/*TokenKind.INTERFACE*/: | 13885 case 79/*TokenKind.INTERFACE*/: |
| 13615 | 13886 |
| 13616 return this.classDefinition(78/*TokenKind.INTERFACE*/); | 13887 return this.classDefinition(79/*TokenKind.INTERFACE*/); |
| 13617 | 13888 |
| 13618 case 86/*TokenKind.TYPEDEF*/: | 13889 case 87/*TokenKind.TYPEDEF*/: |
| 13619 | 13890 |
| 13620 return this.functionTypeAlias(); | 13891 return this.functionTypeAlias(); |
| 13621 | 13892 |
| 13622 default: | 13893 default: |
| 13623 | 13894 |
| 13624 return this.declaration(true); | 13895 return this.declaration(true); |
| 13625 | 13896 |
| 13626 } | 13897 } |
| 13627 } | 13898 } |
| 13628 lang_Parser.prototype.classDefinition = function(kind) { | 13899 lang_Parser.prototype.classDefinition = function(kind) { |
| 13629 var start = this._peekToken.start; | 13900 var start = this._peekToken.start; |
| 13630 this._eat(kind); | 13901 this._eat(kind); |
| 13631 var name = this.identifier(); | 13902 var name = this.identifier(); |
| 13632 var typeParams = null; | 13903 var typeParams = null; |
| 13633 if (this._peekKind(52/*TokenKind.LT*/)) { | 13904 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { |
| 13634 typeParams = this.typeParameters(); | 13905 typeParams = this.typeParameters(); |
| 13635 } | 13906 } |
| 13636 var _extends = null; | 13907 var _extends = null; |
| 13637 if (this._maybeEat(73/*TokenKind.EXTENDS*/)) { | 13908 if ($notnull_bool(this._maybeEat(74/*TokenKind.EXTENDS*/))) { |
| 13638 _extends = this.typeList(); | 13909 _extends = this.typeList(); |
| 13639 } | 13910 } |
| 13640 var _implements = null; | 13911 var _implements = null; |
| 13641 if (this._maybeEat(76/*TokenKind.IMPLEMENTS*/)) { | 13912 if ($notnull_bool(this._maybeEat(77/*TokenKind.IMPLEMENTS*/))) { |
| 13642 _implements = this.typeList(); | 13913 _implements = this.typeList(); |
| 13643 } | 13914 } |
| 13644 var _native = null; | 13915 var _native = null; |
| 13645 if (this._maybeEat(80/*TokenKind.NATIVE*/)) { | 13916 if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { |
| 13646 _native = this.maybeStringLiteral(); | 13917 _native = this.maybeStringLiteral(); |
| 13647 } | 13918 } |
| 13648 var _factory = null; | 13919 var _factory = null; |
| 13649 if (this._maybeEat(74/*TokenKind.FACTORY*/)) { | 13920 if ($notnull_bool(this._maybeEat(75/*TokenKind.FACTORY*/))) { |
| 13650 _factory = this.type(0); | 13921 _factory = this.type(0); |
| 13651 } | 13922 } |
| 13652 var body = []; | 13923 var body = []; |
| 13653 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { | 13924 if ($notnull_bool(this._maybeEat(6/*TokenKind.LBRACE*/))) { |
| 13654 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { | 13925 while ($notnull_bool(!this._maybeEat(7/*TokenKind.RBRACE*/))) { |
| 13655 if (this.isPrematureEndOfFile()) break; | 13926 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 13656 body.add(this.declaration(true)); | 13927 body.add(this.declaration(true)); |
| 13657 } | 13928 } |
| 13658 } | 13929 } |
| 13659 else { | 13930 else { |
| 13660 this._errorExpected('block starting with "{" or ";"'); | 13931 this._errorExpected('block starting with "{" or ";"'); |
| 13661 } | 13932 } |
| 13662 return new TypeDefinition(kind == 72/*TokenKind.CLASS*/, name, typeParams, _ex
tends, _implements, _native, _factory, body, this._makeSpan(start)); | 13933 return new TypeDefinition(kind == 73/*TokenKind.CLASS*/, name, typeParams, _ex
tends, _implements, _native, _factory, body, this._makeSpan(start)); |
| 13663 } | 13934 } |
| 13664 lang_Parser.prototype.functionTypeAlias = function() { | 13935 lang_Parser.prototype.functionTypeAlias = function() { |
| 13665 var start = this._peekToken.start; | 13936 var start = this._peekToken.start; |
| 13666 this._eat(86/*TokenKind.TYPEDEF*/); | 13937 this._eat(87/*TokenKind.TYPEDEF*/); |
| 13667 var di = this.declaredIdentifier(false); | 13938 var di = this.declaredIdentifier(false); |
| 13668 var typeParams = null; | 13939 var typeParams = null; |
| 13669 if (this._peekKind(52/*TokenKind.LT*/)) { | 13940 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { |
| 13670 typeParams = this.typeParameters(); | 13941 typeParams = this.typeParameters(); |
| 13671 } | 13942 } |
| 13672 var formals = this.formalParameterList(); | 13943 var formals = this.formalParameterList(); |
| 13673 this._eatSemicolon(); | 13944 this._eatSemicolon(); |
| 13674 var func = new FunctionDefinition(null, di.type, di.get$name(), formals, null,
null, this._makeSpan(start)); | 13945 var func = new FunctionDefinition(null, di.type, di.get$name(), formals, null,
null, this._makeSpan(start)); |
| 13675 return new FunctionTypeDefinition(func, typeParams, this._makeSpan(start)); | 13946 return new FunctionTypeDefinition(func, typeParams, this._makeSpan(start)); |
| 13676 } | 13947 } |
| 13677 lang_Parser.prototype.initializers = function() { | 13948 lang_Parser.prototype.initializers = function() { |
| 13678 this._inInitializers = true; | 13949 this._inInitializers = true; |
| 13679 var ret = []; | 13950 var ret = []; |
| 13680 do { | 13951 do { |
| 13681 ret.add(this.expression()); | 13952 ret.add(this.expression()); |
| 13682 } | 13953 } |
| 13683 while (this._maybeEat(11/*TokenKind.COMMA*/)) | 13954 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 13684 this._inInitializers = false; | 13955 this._inInitializers = false; |
| 13685 return ret; | 13956 return ret; |
| 13686 } | 13957 } |
| 13687 lang_Parser.prototype.functionBody = function(inExpression) { | 13958 lang_Parser.prototype.functionBody = function(inExpression) { |
| 13688 var start = this._peekToken.start; | 13959 var start = this._peekToken.start; |
| 13689 if (this._maybeEat(9/*TokenKind.ARROW*/)) { | 13960 if ($notnull_bool(this._maybeEat(9/*TokenKind.ARROW*/))) { |
| 13690 var expr = this.expression(); | 13961 var expr = this.expression(); |
| 13691 if (!inExpression) { | 13962 if ($notnull_bool(!inExpression)) { |
| 13692 this._eatSemicolon(); | 13963 this._eatSemicolon(); |
| 13693 } | 13964 } |
| 13694 return new ReturnStatement(expr, this._makeSpan(start)); | 13965 return new ReturnStatement(expr, this._makeSpan(start)); |
| 13695 } | 13966 } |
| 13696 else if (this._peekKind(6/*TokenKind.LBRACE*/)) { | 13967 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { |
| 13697 if (this.diet) { | 13968 if ($notnull_bool(this.diet)) { |
| 13698 this._skipBlock(); | 13969 this._skipBlock(); |
| 13699 return new DietStatement(this._makeSpan(start)); | 13970 return new DietStatement(this._makeSpan(start)); |
| 13700 } | 13971 } |
| 13701 else { | 13972 else { |
| 13702 return this.block(); | 13973 return this.block(); |
| 13703 } | 13974 } |
| 13704 } | 13975 } |
| 13705 else if (!inExpression) { | 13976 else if ($notnull_bool(!inExpression)) { |
| 13706 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { | 13977 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { |
| 13707 return null; | 13978 return null; |
| 13708 } | 13979 } |
| 13709 else if (this._maybeEat(80/*TokenKind.NATIVE*/)) { | 13980 else if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { |
| 13710 var nativeBody = this.maybeStringLiteral(); | 13981 var nativeBody = this.maybeStringLiteral(); |
| 13711 if (this._peekKind(10/*TokenKind.SEMICOLON*/)) { | 13982 if ($notnull_bool(this._peekKind(10/*TokenKind.SEMICOLON*/))) { |
| 13712 this._eatSemicolon(); | 13983 this._eatSemicolon(); |
| 13713 return new NativeStatement(nativeBody, this._makeSpan(start)); | 13984 return new NativeStatement(nativeBody, this._makeSpan(start)); |
| 13714 } | 13985 } |
| 13715 else { | 13986 else { |
| 13716 return this.functionBody(inExpression); | 13987 return this.functionBody(inExpression); |
| 13717 } | 13988 } |
| 13718 } | 13989 } |
| 13719 } | 13990 } |
| 13720 this._lang_error('Expected function body (neither { nor => found)'); | 13991 this._lang_error('Expected function body (neither { nor => found)'); |
| 13721 } | 13992 } |
| 13722 lang_Parser.prototype.finishField = function(start, modifiers, type0, name, valu
e) { | 13993 lang_Parser.prototype.finishField = function(start, modifiers, type0, name, valu
e) { |
| 13723 var names = [name]; | 13994 var names = [name]; |
| 13724 var values = [value]; | 13995 var values = [value]; |
| 13725 while (this._maybeEat(11/*TokenKind.COMMA*/)) { | 13996 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 13726 names.add(this.identifier()); | 13997 names.add(this.identifier()); |
| 13727 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 13998 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { |
| 13728 values.add(this.expression()); | 13999 values.add(this.expression()); |
| 13729 } | 14000 } |
| 13730 else { | 14001 else { |
| 13731 values.add(null); | 14002 values.add(null); |
| 13732 } | 14003 } |
| 13733 } | 14004 } |
| 13734 this._eatSemicolon(); | 14005 this._eatSemicolon(); |
| 13735 return new VariableDefinition(modifiers, type0, names, values, this._makeSpan(
start)); | 14006 return new VariableDefinition(modifiers, type0, names, values, this._makeSpan(
$assert_num(start))); |
| 13736 } | 14007 } |
| 13737 lang_Parser.prototype.finishDefinition = function(start, modifiers, di) { | 14008 lang_Parser.prototype.finishDefinition = function(start, modifiers, di) { |
| 13738 switch (this._peek()) { | 14009 switch (this._peek()) { |
| 13739 case 2/*TokenKind.LPAREN*/: | 14010 case 2/*TokenKind.LPAREN*/: |
| 13740 | 14011 |
| 13741 var formals = this.formalParameterList(); | 14012 var formals = this.formalParameterList(); |
| 13742 var inits = null; | 14013 var inits = null; |
| 13743 if (this._maybeEat(8/*TokenKind.COLON*/)) { | 14014 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { |
| 13744 inits = this.initializers(); | 14015 inits = this.initializers(); |
| 13745 } | 14016 } |
| 13746 var body = this.functionBody(false); | 14017 var body = this.functionBody(false); |
| 13747 if (di.get$name() == null) { | 14018 if ($notnull_bool(di.get$name() == null)) { |
| 13748 di.name = di.type.get$name(); | 14019 di.name = di.type.get$name(); |
| 13749 } | 14020 } |
| 13750 return new FunctionDefinition(modifiers, di.type, di.get$name(), formals,
inits, body, this._makeSpan(start)); | 14021 return new FunctionDefinition(modifiers, di.type, di.get$name(), formals,
inits, body, this._makeSpan($assert_num(start))); |
| 13751 | 14022 |
| 13752 case 20/*TokenKind.ASSIGN*/: | 14023 case 20/*TokenKind.ASSIGN*/: |
| 13753 | 14024 |
| 13754 this._eat(20/*TokenKind.ASSIGN*/); | 14025 this._eat(20/*TokenKind.ASSIGN*/); |
| 13755 var value = this.expression(); | 14026 var value = this.expression(); |
| 13756 return this.finishField(start, modifiers, di.type, di.get$name(), value); | 14027 return this.finishField(start, modifiers, di.type, di.get$name(), value); |
| 13757 | 14028 |
| 13758 case 11/*TokenKind.COMMA*/: | 14029 case 11/*TokenKind.COMMA*/: |
| 13759 case 10/*TokenKind.SEMICOLON*/: | 14030 case 10/*TokenKind.SEMICOLON*/: |
| 13760 | 14031 |
| 13761 return this.finishField(start, modifiers, di.type, di.get$name(), null); | 14032 return this.finishField(start, modifiers, di.type, di.get$name(), null); |
| 13762 | 14033 |
| 13763 default: | 14034 default: |
| 13764 | 14035 |
| 13765 this._errorExpected('declaration'); | 14036 this._errorExpected('declaration'); |
| 13766 return null; | 14037 return null; |
| 13767 | 14038 |
| 13768 } | 14039 } |
| 13769 } | 14040 } |
| 13770 lang_Parser.prototype.declaration = function(includeOperators) { | 14041 lang_Parser.prototype.declaration = function(includeOperators) { |
| 13771 var start = this._peekToken.start; | 14042 var start = this._peekToken.start; |
| 13772 if (this._peekKind(74/*TokenKind.FACTORY*/)) { | 14043 if ($notnull_bool(this._peekKind(75/*TokenKind.FACTORY*/))) { |
| 13773 return this.factoryConstructorDeclaration(); | 14044 return this.factoryConstructorDeclaration(); |
| 13774 } | 14045 } |
| 13775 var modifiers = this._readModifiers(); | 14046 var modifiers = this._readModifiers(); |
| 13776 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators)); | 14047 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators)); |
| 13777 } | 14048 } |
| 13778 lang_Parser.prototype.factoryConstructorDeclaration = function() { | 14049 lang_Parser.prototype.factoryConstructorDeclaration = function() { |
| 13779 var start = this._peekToken.start; | 14050 var start = this._peekToken.start; |
| 13780 var factoryToken = this._lang_next(); | 14051 var factoryToken = this._lang_next(); |
| 13781 var names = [this.identifier()]; | 14052 var names = [this.identifier()]; |
| 13782 while (this._maybeEat(14/*TokenKind.DOT*/)) { | 14053 while ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { |
| 13783 names.add(this.identifier()); | 14054 names.add(this.identifier()); |
| 13784 } | 14055 } |
| 13785 var typeParams = null; | 14056 var typeParams = null; |
| 13786 if (this._peekKind(52/*TokenKind.LT*/)) { | 14057 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { |
| 13787 typeParams = this.typeParameters(); | 14058 typeParams = this.typeParameters(); |
| 13788 } | 14059 } |
| 13789 var name = null; | 14060 var name = null; |
| 13790 var type0 = null; | 14061 var type0 = null; |
| 13791 if (this._maybeEat(14/*TokenKind.DOT*/)) { | 14062 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { |
| 13792 name = this.identifier(); | 14063 name = this.identifier(); |
| 13793 } | 14064 } |
| 13794 else if (typeParams == null) { | 14065 else if ($notnull_bool(typeParams == null)) { |
| 13795 if (names.length > 1) { | 14066 if ($notnull_bool(names.length > 1)) { |
| 13796 name = names.removeLast(); | 14067 name = names.removeLast(); |
| 13797 } | 14068 } |
| 13798 else { | 14069 else { |
| 13799 name = new lang_Identifier('', names.$index(0).get$span()); | 14070 name = new lang_Identifier('', names.$index(0).get$span()); |
| 13800 } | 14071 } |
| 13801 } | 14072 } |
| 13802 else { | 14073 else { |
| 13803 name = new lang_Identifier('', names.$index(0).get$span()); | 14074 name = new lang_Identifier('', names.$index(0).get$span()); |
| 13804 } | 14075 } |
| 13805 if (names.length > 1) { | 14076 if ($notnull_bool(names.length > 1)) { |
| 13806 this._lang_error('unsupported qualified name for factory', names.$index(0).g
et$span()); | 14077 this._lang_error('unsupported qualified name for factory', names.$index(0).g
et$span()); |
| 13807 } | 14078 } |
| 13808 type0 = new NameTypeReference(false, names.$index(0), null, names.$index(0).ge
t$span()); | 14079 type0 = new NameTypeReference(false, names.$index(0), null, names.$index(0).ge
t$span()); |
| 13809 var di = new DeclaredIdentifier(type0, name, this._makeSpan(start)); | 14080 var di = new DeclaredIdentifier(type0, name, this._makeSpan(start)); |
| 13810 return this.finishDefinition(start, [factoryToken], di); | 14081 return this.finishDefinition(start, [factoryToken], di); |
| 13811 } | 14082 } |
| 13812 lang_Parser.prototype.statement = function() { | 14083 lang_Parser.prototype.statement = function() { |
| 13813 switch (this._peek()) { | 14084 switch (this._peek()) { |
| 13814 case 87/*TokenKind.BREAK*/: | 14085 case 88/*TokenKind.BREAK*/: |
| 13815 | 14086 |
| 13816 return this.breakStatement(); | 14087 return this.breakStatement(); |
| 13817 | 14088 |
| 13818 case 91/*TokenKind.CONTINUE*/: | 14089 case 92/*TokenKind.CONTINUE*/: |
| 13819 | 14090 |
| 13820 return this.continueStatement(); | 14091 return this.continueStatement(); |
| 13821 | 14092 |
| 13822 case 104/*TokenKind.RETURN*/: | 14093 case 105/*TokenKind.RETURN*/: |
| 13823 | 14094 |
| 13824 return this.returnStatement(); | 14095 return this.returnStatement(); |
| 13825 | 14096 |
| 13826 case 108/*TokenKind.THROW*/: | 14097 case 109/*TokenKind.THROW*/: |
| 13827 | 14098 |
| 13828 return this.throwStatement(); | 14099 return this.throwStatement(); |
| 13829 | 14100 |
| 13830 case 71/*TokenKind.ASSERT*/: | 14101 case 72/*TokenKind.ASSERT*/: |
| 13831 | 14102 |
| 13832 return this.assertStatement(); | 14103 return this.assertStatement(); |
| 13833 | 14104 |
| 13834 case 113/*TokenKind.WHILE*/: | 14105 case 114/*TokenKind.WHILE*/: |
| 13835 | 14106 |
| 13836 return this.whileStatement(); | 14107 return this.whileStatement(); |
| 13837 | 14108 |
| 13838 case 93/*TokenKind.DO*/: | 14109 case 94/*TokenKind.DO*/: |
| 13839 | 14110 |
| 13840 return this.doStatement(); | 14111 return this.doStatement(); |
| 13841 | 14112 |
| 13842 case 98/*TokenKind.FOR*/: | 14113 case 99/*TokenKind.FOR*/: |
| 13843 | 14114 |
| 13844 return this.forStatement(); | 14115 return this.forStatement(); |
| 13845 | 14116 |
| 13846 case 99/*TokenKind.IF*/: | 14117 case 100/*TokenKind.IF*/: |
| 13847 | 14118 |
| 13848 return this.ifStatement(); | 14119 return this.ifStatement(); |
| 13849 | 14120 |
| 13850 case 106/*TokenKind.SWITCH*/: | 14121 case 107/*TokenKind.SWITCH*/: |
| 13851 | 14122 |
| 13852 return this.switchStatement(); | 14123 return this.switchStatement(); |
| 13853 | 14124 |
| 13854 case 110/*TokenKind.TRY*/: | 14125 case 111/*TokenKind.TRY*/: |
| 13855 | 14126 |
| 13856 return this.tryStatement(); | 14127 return this.tryStatement(); |
| 13857 | 14128 |
| 13858 case 6/*TokenKind.LBRACE*/: | 14129 case 6/*TokenKind.LBRACE*/: |
| 13859 | 14130 |
| 13860 return this.block(); | 14131 return this.block(); |
| 13861 | 14132 |
| 13862 case 10/*TokenKind.SEMICOLON*/: | 14133 case 10/*TokenKind.SEMICOLON*/: |
| 13863 | 14134 |
| 13864 return this.emptyStatement(); | 14135 return this.emptyStatement(); |
| 13865 | 14136 |
| 13866 case 96/*TokenKind.FINAL*/: | 14137 case 97/*TokenKind.FINAL*/: |
| 13867 | 14138 |
| 13868 return this.declaration(false); | 14139 return this.declaration(false); |
| 13869 | 14140 |
| 13870 case 111/*TokenKind.VAR*/: | 14141 case 112/*TokenKind.VAR*/: |
| 13871 | 14142 |
| 13872 return this.declaration(false); | 14143 return this.declaration(false); |
| 13873 | 14144 |
| 13874 default: | 14145 default: |
| 13875 | 14146 |
| 13876 return this.finishExpressionAsStatement(this.expression()); | 14147 return this.finishExpressionAsStatement(this.expression()); |
| 13877 | 14148 |
| 13878 } | 14149 } |
| 13879 } | 14150 } |
| 13880 lang_Parser.prototype.finishExpressionAsStatement = function(expr) { | 14151 lang_Parser.prototype.finishExpressionAsStatement = function(expr) { |
| 13881 var start = expr.get$span().start; | 14152 var start = expr.get$span().start; |
| 13882 if (this._maybeEat(8/*TokenKind.COLON*/)) { | 14153 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { |
| 13883 var label = this._makeLabel(expr); | 14154 var label = this._makeLabel(expr); |
| 13884 return new LabeledStatement(label, this.statement(), this._makeSpan(start)); | 14155 return new LabeledStatement(label, this.statement(), this._makeSpan(start)); |
| 13885 } | 14156 } |
| 13886 if ((expr instanceof LambdaExpression)) { | 14157 if ($notnull_bool((expr instanceof LambdaExpression))) { |
| 13887 if (!(expr.func.body instanceof BlockStatement)) { | 14158 if ($notnull_bool(!(expr.func.body instanceof BlockStatement))) { |
| 13888 this._eatSemicolon(); | 14159 this._eatSemicolon(); |
| 13889 expr.func.span = this._makeSpan(start); | 14160 expr.func.span = this._makeSpan(start); |
| 13890 } | 14161 } |
| 13891 return expr.func; | 14162 return expr.func; |
| 13892 } | 14163 } |
| 13893 else if ((expr instanceof DeclaredIdentifier)) { | 14164 else if ($notnull_bool((expr instanceof DeclaredIdentifier))) { |
| 13894 var value = null; | 14165 var value = null; |
| 13895 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 14166 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { |
| 13896 value = this.expression(); | 14167 value = this.expression(); |
| 13897 } | 14168 } |
| 13898 return this.finishField(start, null, expr.type, expr.get$name(), value); | 14169 return this.finishField(start, null, expr.type, expr.get$name(), value); |
| 13899 } | 14170 } |
| 13900 else if (this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x instanceof Decl
aredIdentifier))) { | 14171 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x i
nstanceof DeclaredIdentifier)))) { |
| 13901 var di = expr.x; | 14172 var di = expr.x; |
| 13902 return this.finishField(start, null, di.type, di.name, expr.y); | 14173 return this.finishField(start, null, di.type, di.name, expr.y); |
| 13903 } | 14174 } |
| 13904 else if (this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat(11/*TokenKind
.COMMA*/)) { | 14175 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat
(11/*TokenKind.COMMA*/))) { |
| 13905 var baseType = this._makeType(expr.x); | 14176 var baseType = this._makeType(expr.x); |
| 13906 var typeArgs = [this._makeType(expr.y)]; | 14177 var typeArgs = [this._makeType(expr.y)]; |
| 13907 var gt = this._finishTypeArguments(baseType, 0, typeArgs); | 14178 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference())
, 0, typeArgs); |
| 13908 var name = this.identifier(); | 14179 var name = this.identifier(); |
| 13909 var value = null; | 14180 var value = null; |
| 13910 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 14181 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { |
| 13911 value = this.expression(); | 14182 value = this.expression(); |
| 13912 } | 14183 } |
| 13913 return this.finishField(expr.get$span().start, null, gt, name, value); | 14184 return this.finishField(expr.get$span().start, null, gt, name, value); |
| 13914 } | 14185 } |
| 13915 else { | 14186 else { |
| 13916 this._eatSemicolon(); | 14187 this._eatSemicolon(); |
| 13917 return new lang_ExpressionStatement(expr, this._makeSpan(expr.get$span().sta
rt)); | 14188 return new lang_ExpressionStatement(expr, this._makeSpan(expr.get$span().sta
rt)); |
| 13918 } | 14189 } |
| 13919 } | 14190 } |
| 13920 lang_Parser.prototype.testCondition = function() { | 14191 lang_Parser.prototype.testCondition = function() { |
| 13921 this._eat(2/*TokenKind.LPAREN*/); | 14192 this._eat(2/*TokenKind.LPAREN*/); |
| 13922 var ret = this.expression(); | 14193 var ret = this.expression(); |
| 13923 this._eat(3/*TokenKind.RPAREN*/); | 14194 this._eat(3/*TokenKind.RPAREN*/); |
| 13924 return ret; | 14195 return ret; |
| 13925 } | 14196 } |
| 13926 lang_Parser.prototype.block = function() { | 14197 lang_Parser.prototype.block = function() { |
| 13927 var start = this._peekToken.start; | 14198 var start = this._peekToken.start; |
| 13928 this._eat(6/*TokenKind.LBRACE*/); | 14199 this._eat(6/*TokenKind.LBRACE*/); |
| 13929 var stmts = []; | 14200 var stmts = []; |
| 13930 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { | 14201 while ($notnull_bool(!this._maybeEat(7/*TokenKind.RBRACE*/))) { |
| 13931 if (this.isPrematureEndOfFile()) break; | 14202 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 13932 stmts.add(this.statement()); | 14203 stmts.add(this.statement()); |
| 13933 } | 14204 } |
| 13934 return new BlockStatement(stmts, this._makeSpan(start)); | 14205 return new BlockStatement(stmts, this._makeSpan(start)); |
| 13935 } | 14206 } |
| 13936 lang_Parser.prototype.emptyStatement = function() { | 14207 lang_Parser.prototype.emptyStatement = function() { |
| 13937 var start = this._peekToken.start; | 14208 var start = this._peekToken.start; |
| 13938 this._eat(10/*TokenKind.SEMICOLON*/); | 14209 this._eat(10/*TokenKind.SEMICOLON*/); |
| 13939 return new EmptyStatement(this._makeSpan(start)); | 14210 return new EmptyStatement(this._makeSpan(start)); |
| 13940 } | 14211 } |
| 13941 lang_Parser.prototype.ifStatement = function() { | 14212 lang_Parser.prototype.ifStatement = function() { |
| 13942 var start = this._peekToken.start; | 14213 var start = this._peekToken.start; |
| 13943 this._eat(99/*TokenKind.IF*/); | 14214 this._eat(100/*TokenKind.IF*/); |
| 13944 var test = this.testCondition(); | 14215 var test = this.testCondition(); |
| 13945 var trueBranch = this.statement(); | 14216 var trueBranch = this.statement(); |
| 13946 var falseBranch = null; | 14217 var falseBranch = null; |
| 13947 if (this._maybeEat(94/*TokenKind.ELSE*/)) { | 14218 if ($notnull_bool(this._maybeEat(95/*TokenKind.ELSE*/))) { |
| 13948 falseBranch = this.statement(); | 14219 falseBranch = this.statement(); |
| 13949 } | 14220 } |
| 13950 return new IfStatement(test, trueBranch, falseBranch, this._makeSpan(start)); | 14221 return new IfStatement(test, trueBranch, falseBranch, this._makeSpan(start)); |
| 13951 } | 14222 } |
| 13952 lang_Parser.prototype.whileStatement = function() { | 14223 lang_Parser.prototype.whileStatement = function() { |
| 13953 var start = this._peekToken.start; | 14224 var start = this._peekToken.start; |
| 13954 this._eat(113/*TokenKind.WHILE*/); | 14225 this._eat(114/*TokenKind.WHILE*/); |
| 13955 var test = this.testCondition(); | 14226 var test = this.testCondition(); |
| 13956 var body = this.statement(); | 14227 var body = this.statement(); |
| 13957 return new WhileStatement(test, body, this._makeSpan(start)); | 14228 return new WhileStatement(test, body, this._makeSpan(start)); |
| 13958 } | 14229 } |
| 13959 lang_Parser.prototype.doStatement = function() { | 14230 lang_Parser.prototype.doStatement = function() { |
| 13960 var start = this._peekToken.start; | 14231 var start = this._peekToken.start; |
| 13961 this._eat(93/*TokenKind.DO*/); | 14232 this._eat(94/*TokenKind.DO*/); |
| 13962 var body = this.statement(); | 14233 var body = this.statement(); |
| 13963 this._eat(113/*TokenKind.WHILE*/); | 14234 this._eat(114/*TokenKind.WHILE*/); |
| 13964 var test = this.testCondition(); | 14235 var test = this.testCondition(); |
| 13965 this._eatSemicolon(); | 14236 this._eatSemicolon(); |
| 13966 return new DoStatement(body, test, this._makeSpan(start)); | 14237 return new DoStatement(body, test, this._makeSpan(start)); |
| 13967 } | 14238 } |
| 13968 lang_Parser.prototype.forStatement = function() { | 14239 lang_Parser.prototype.forStatement = function() { |
| 13969 var start = this._peekToken.start; | 14240 var start = this._peekToken.start; |
| 13970 this._eat(98/*TokenKind.FOR*/); | 14241 this._eat(99/*TokenKind.FOR*/); |
| 13971 this._eat(2/*TokenKind.LPAREN*/); | 14242 this._eat(2/*TokenKind.LPAREN*/); |
| 13972 var init = this.forInitializerStatement(start); | 14243 var init = this.forInitializerStatement(start); |
| 13973 if ((init instanceof ForInStatement)) { | 14244 if ($notnull_bool((init instanceof ForInStatement))) { |
| 13974 return init; | 14245 return init; |
| 13975 } | 14246 } |
| 13976 var test = null; | 14247 var test = null; |
| 13977 if (!this._maybeEat(10/*TokenKind.SEMICOLON*/)) { | 14248 if ($notnull_bool(!this._maybeEat(10/*TokenKind.SEMICOLON*/))) { |
| 13978 test = this.expression(); | 14249 test = this.expression(); |
| 13979 this._eatSemicolon(); | 14250 this._eatSemicolon(); |
| 13980 } | 14251 } |
| 13981 var step = []; | 14252 var step = []; |
| 13982 if (!this._maybeEat(3/*TokenKind.RPAREN*/)) { | 14253 if ($notnull_bool(!this._maybeEat(3/*TokenKind.RPAREN*/))) { |
| 13983 step.add(this.expression()); | 14254 step.add(this.expression()); |
| 13984 while (this._maybeEat(11/*TokenKind.COMMA*/)) { | 14255 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 13985 step.add(this.expression()); | 14256 step.add(this.expression()); |
| 13986 } | 14257 } |
| 13987 this._eat(3/*TokenKind.RPAREN*/); | 14258 this._eat(3/*TokenKind.RPAREN*/); |
| 13988 } | 14259 } |
| 13989 var body = this.statement(); | 14260 var body = this.statement(); |
| 13990 return new ForStatement(init, test, step, body, this._makeSpan(start)); | 14261 return new ForStatement(init, test, step, body, this._makeSpan(start)); |
| 13991 } | 14262 } |
| 13992 lang_Parser.prototype.forInitializerStatement = function(start) { | 14263 lang_Parser.prototype.forInitializerStatement = function(start) { |
| 13993 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { | 14264 var $0; |
| 14265 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { |
| 13994 return null; | 14266 return null; |
| 13995 } | 14267 } |
| 13996 else { | 14268 else { |
| 13997 var init = this.expression(); | 14269 var init = this.expression(); |
| 13998 if (this._peekKind(11/*TokenKind.COMMA*/) && this._isBin(init, 52/*TokenKind
.LT*/)) { | 14270 if ($notnull_bool(this._peekKind(11/*TokenKind.COMMA*/) && this._isBin(init,
52/*TokenKind.LT*/))) { |
| 13999 this._eat(11/*TokenKind.COMMA*/); | 14271 this._eat(11/*TokenKind.COMMA*/); |
| 14000 var baseType = this._makeType(init.x); | 14272 var baseType = this._makeType(init.x); |
| 14001 var typeArgs = [this._makeType(init.y)]; | 14273 var typeArgs = [this._makeType(init.y)]; |
| 14002 var gt = this._finishTypeArguments(baseType, 0, typeArgs); | 14274 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference(
)), 0, typeArgs); |
| 14003 var name = this.identifier(); | 14275 var name = this.identifier(); |
| 14004 init = new DeclaredIdentifier(gt, name, this._makeSpan(init.get$span().sta
rt)); | 14276 init = new DeclaredIdentifier(gt, name, this._makeSpan(init.get$span().sta
rt)); |
| 14005 } | 14277 } |
| 14006 if (this._maybeEat(100/*TokenKind.IN*/)) { | 14278 if ($notnull_bool(this._maybeEat(101/*TokenKind.IN*/))) { |
| 14007 return this._finishForIn(start, this._makeDeclaredIdentifier(init)); | 14279 return this._finishForIn(start, (($0 = this._makeDeclaredIdentifier(init))
&& $0.is$DeclaredIdentifier())); |
| 14008 } | 14280 } |
| 14009 else { | 14281 else { |
| 14010 return this.finishExpressionAsStatement(init); | 14282 return this.finishExpressionAsStatement(init); |
| 14011 } | 14283 } |
| 14012 } | 14284 } |
| 14013 } | 14285 } |
| 14014 lang_Parser.prototype._finishForIn = function(start, di) { | 14286 lang_Parser.prototype._finishForIn = function(start, di) { |
| 14015 var expr = this.expression(); | 14287 var expr = this.expression(); |
| 14016 this._eat(3/*TokenKind.RPAREN*/); | 14288 this._eat(3/*TokenKind.RPAREN*/); |
| 14017 var body = this.statement(); | 14289 var body = this.statement(); |
| 14018 return new ForInStatement(di, expr, body, this._makeSpan(start)); | 14290 return new ForInStatement(di, expr, body, this._makeSpan(start)); |
| 14019 } | 14291 } |
| 14020 lang_Parser.prototype.tryStatement = function() { | 14292 lang_Parser.prototype.tryStatement = function() { |
| 14021 var start = this._peekToken.start; | 14293 var start = this._peekToken.start; |
| 14022 this._eat(110/*TokenKind.TRY*/); | 14294 this._eat(111/*TokenKind.TRY*/); |
| 14023 var body = this.block(); | 14295 var body = this.block(); |
| 14024 var catches = []; | 14296 var catches = []; |
| 14025 while (this._peekKind(89/*TokenKind.CATCH*/)) { | 14297 while ($notnull_bool(this._peekKind(90/*TokenKind.CATCH*/))) { |
| 14026 catches.add(this.catchNode()); | 14298 catches.add(this.catchNode()); |
| 14027 } | 14299 } |
| 14028 var finallyBlock = null; | 14300 var finallyBlock = null; |
| 14029 if (this._maybeEat(97/*TokenKind.FINALLY*/)) { | 14301 if ($notnull_bool(this._maybeEat(98/*TokenKind.FINALLY*/))) { |
| 14030 finallyBlock = this.block(); | 14302 finallyBlock = this.block(); |
| 14031 } | 14303 } |
| 14032 return new TryStatement(body, catches, finallyBlock, this._makeSpan(start)); | 14304 return new TryStatement(body, catches, finallyBlock, this._makeSpan(start)); |
| 14033 } | 14305 } |
| 14034 lang_Parser.prototype.catchNode = function() { | 14306 lang_Parser.prototype.catchNode = function() { |
| 14035 var start = this._peekToken.start; | 14307 var start = this._peekToken.start; |
| 14036 this._eat(89/*TokenKind.CATCH*/); | 14308 this._eat(90/*TokenKind.CATCH*/); |
| 14037 this._eat(2/*TokenKind.LPAREN*/); | 14309 this._eat(2/*TokenKind.LPAREN*/); |
| 14038 var exc = this.declaredIdentifier(false); | 14310 var exc = this.declaredIdentifier(false); |
| 14039 var trace = null; | 14311 var trace = null; |
| 14040 if (this._maybeEat(11/*TokenKind.COMMA*/)) { | 14312 if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 14041 trace = this.declaredIdentifier(false); | 14313 trace = this.declaredIdentifier(false); |
| 14042 } | 14314 } |
| 14043 this._eat(3/*TokenKind.RPAREN*/); | 14315 this._eat(3/*TokenKind.RPAREN*/); |
| 14044 var body = this.block(); | 14316 var body = this.block(); |
| 14045 return new CatchNode(exc, trace, body, this._makeSpan(start)); | 14317 return new CatchNode(exc, trace, body, this._makeSpan(start)); |
| 14046 } | 14318 } |
| 14047 lang_Parser.prototype.switchStatement = function() { | 14319 lang_Parser.prototype.switchStatement = function() { |
| 14048 var start = this._peekToken.start; | 14320 var start = this._peekToken.start; |
| 14049 this._eat(106/*TokenKind.SWITCH*/); | 14321 this._eat(107/*TokenKind.SWITCH*/); |
| 14050 var test = this.testCondition(); | 14322 var test = this.testCondition(); |
| 14051 var cases = []; | 14323 var cases = []; |
| 14052 this._eat(6/*TokenKind.LBRACE*/); | 14324 this._eat(6/*TokenKind.LBRACE*/); |
| 14053 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { | 14325 while ($notnull_bool(!this._maybeEat(7/*TokenKind.RBRACE*/))) { |
| 14054 cases.add(this.caseNode()); | 14326 cases.add(this.caseNode()); |
| 14055 } | 14327 } |
| 14056 return new SwitchStatement(test, cases, this._makeSpan(start)); | 14328 return new SwitchStatement(test, cases, this._makeSpan(start)); |
| 14057 } | 14329 } |
| 14058 lang_Parser.prototype._peekCaseEnd = function() { | 14330 lang_Parser.prototype._peekCaseEnd = function() { |
| 14059 var kind = this._peek(); | 14331 var kind = this._peek(); |
| 14060 return $eq(kind, 7/*TokenKind.RBRACE*/) || $eq(kind, 88/*TokenKind.CASE*/) ||
$eq(kind, 92/*TokenKind.DEFAULT*/); | 14332 return $eq(kind, 7/*TokenKind.RBRACE*/) || $eq(kind, 89/*TokenKind.CASE*/) ||
$eq(kind, 93/*TokenKind.DEFAULT*/); |
| 14061 } | 14333 } |
| 14062 lang_Parser.prototype.caseNode = function() { | 14334 lang_Parser.prototype.caseNode = function() { |
| 14063 var start = this._peekToken.start; | 14335 var start = this._peekToken.start; |
| 14064 var label = null; | 14336 var label = null; |
| 14065 if (this._peekIdentifier()) { | 14337 if ($notnull_bool(this._peekIdentifier())) { |
| 14066 label = this.identifier(); | 14338 label = this.identifier(); |
| 14067 this._eat(8/*TokenKind.COLON*/); | 14339 this._eat(8/*TokenKind.COLON*/); |
| 14068 } | 14340 } |
| 14069 var cases = []; | 14341 var cases = []; |
| 14070 while (true) { | 14342 while ($notnull_bool(true)) { |
| 14071 if (this._maybeEat(88/*TokenKind.CASE*/)) { | 14343 if ($notnull_bool(this._maybeEat(89/*TokenKind.CASE*/))) { |
| 14072 cases.add(this.expression()); | 14344 cases.add(this.expression()); |
| 14073 this._eat(8/*TokenKind.COLON*/); | 14345 this._eat(8/*TokenKind.COLON*/); |
| 14074 } | 14346 } |
| 14075 else if (this._maybeEat(92/*TokenKind.DEFAULT*/)) { | 14347 else if ($notnull_bool(this._maybeEat(93/*TokenKind.DEFAULT*/))) { |
| 14076 cases.add(null); | 14348 cases.add(null); |
| 14077 this._eat(8/*TokenKind.COLON*/); | 14349 this._eat(8/*TokenKind.COLON*/); |
| 14078 } | 14350 } |
| 14079 else { | 14351 else { |
| 14080 break; | 14352 break; |
| 14081 } | 14353 } |
| 14082 } | 14354 } |
| 14083 if (cases.length == 0) { | 14355 if ($notnull_bool(cases.length == 0)) { |
| 14084 this._lang_error('case or default'); | 14356 this._lang_error('case or default'); |
| 14085 } | 14357 } |
| 14086 var stmts = []; | 14358 var stmts = []; |
| 14087 while (!this._peekCaseEnd()) { | 14359 while ($notnull_bool(!this._peekCaseEnd())) { |
| 14088 if (this.isPrematureEndOfFile()) break; | 14360 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 14089 stmts.add(this.statement()); | 14361 stmts.add(this.statement()); |
| 14090 } | 14362 } |
| 14091 return new CaseNode(label, cases, stmts, this._makeSpan(start)); | 14363 return new CaseNode(label, cases, stmts, this._makeSpan(start)); |
| 14092 } | 14364 } |
| 14093 lang_Parser.prototype.returnStatement = function() { | 14365 lang_Parser.prototype.returnStatement = function() { |
| 14094 var start = this._peekToken.start; | 14366 var start = this._peekToken.start; |
| 14095 this._eat(104/*TokenKind.RETURN*/); | 14367 this._eat(105/*TokenKind.RETURN*/); |
| 14096 var expr; | 14368 var expr; |
| 14097 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { | 14369 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { |
| 14098 expr = null; | 14370 expr = null; |
| 14099 } | 14371 } |
| 14100 else { | 14372 else { |
| 14101 expr = this.expression(); | 14373 expr = this.expression(); |
| 14102 this._eatSemicolon(); | 14374 this._eatSemicolon(); |
| 14103 } | 14375 } |
| 14104 return new ReturnStatement(expr, this._makeSpan(start)); | 14376 return new ReturnStatement(expr, this._makeSpan(start)); |
| 14105 } | 14377 } |
| 14106 lang_Parser.prototype.throwStatement = function() { | 14378 lang_Parser.prototype.throwStatement = function() { |
| 14107 var start = this._peekToken.start; | 14379 var start = this._peekToken.start; |
| 14108 this._eat(108/*TokenKind.THROW*/); | 14380 this._eat(109/*TokenKind.THROW*/); |
| 14109 var expr; | 14381 var expr; |
| 14110 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { | 14382 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { |
| 14111 expr = null; | 14383 expr = null; |
| 14112 } | 14384 } |
| 14113 else { | 14385 else { |
| 14114 expr = this.expression(); | 14386 expr = this.expression(); |
| 14115 this._eatSemicolon(); | 14387 this._eatSemicolon(); |
| 14116 } | 14388 } |
| 14117 return new ThrowStatement(expr, this._makeSpan(start)); | 14389 return new ThrowStatement(expr, this._makeSpan(start)); |
| 14118 } | 14390 } |
| 14119 lang_Parser.prototype.assertStatement = function() { | 14391 lang_Parser.prototype.assertStatement = function() { |
| 14120 var start = this._peekToken.start; | 14392 var start = this._peekToken.start; |
| 14121 this._eat(71/*TokenKind.ASSERT*/); | 14393 this._eat(72/*TokenKind.ASSERT*/); |
| 14122 this._eat(2/*TokenKind.LPAREN*/); | 14394 this._eat(2/*TokenKind.LPAREN*/); |
| 14123 var expr = this.expression(); | 14395 var expr = this.expression(); |
| 14124 this._eat(3/*TokenKind.RPAREN*/); | 14396 this._eat(3/*TokenKind.RPAREN*/); |
| 14125 this._eatSemicolon(); | 14397 this._eatSemicolon(); |
| 14126 return new AssertStatement(expr, this._makeSpan(start)); | 14398 return new AssertStatement(expr, this._makeSpan(start)); |
| 14127 } | 14399 } |
| 14128 lang_Parser.prototype.breakStatement = function() { | 14400 lang_Parser.prototype.breakStatement = function() { |
| 14129 var start = this._peekToken.start; | 14401 var start = this._peekToken.start; |
| 14130 this._eat(87/*TokenKind.BREAK*/); | 14402 this._eat(88/*TokenKind.BREAK*/); |
| 14131 var name = null; | 14403 var name = null; |
| 14132 if (this._peekIdentifier()) { | 14404 if ($notnull_bool(this._peekIdentifier())) { |
| 14133 name = this.identifier(); | 14405 name = this.identifier(); |
| 14134 } | 14406 } |
| 14135 this._eatSemicolon(); | 14407 this._eatSemicolon(); |
| 14136 return new BreakStatement(name, this._makeSpan(start)); | 14408 return new BreakStatement(name, this._makeSpan(start)); |
| 14137 } | 14409 } |
| 14138 lang_Parser.prototype.continueStatement = function() { | 14410 lang_Parser.prototype.continueStatement = function() { |
| 14139 var start = this._peekToken.start; | 14411 var start = this._peekToken.start; |
| 14140 this._eat(91/*TokenKind.CONTINUE*/); | 14412 this._eat(92/*TokenKind.CONTINUE*/); |
| 14141 var name = null; | 14413 var name = null; |
| 14142 if (this._peekIdentifier()) { | 14414 if ($notnull_bool(this._peekIdentifier())) { |
| 14143 name = this.identifier(); | 14415 name = this.identifier(); |
| 14144 } | 14416 } |
| 14145 this._eatSemicolon(); | 14417 this._eatSemicolon(); |
| 14146 return new ContinueStatement(name, this._makeSpan(start)); | 14418 return new ContinueStatement(name, this._makeSpan(start)); |
| 14147 } | 14419 } |
| 14148 lang_Parser.prototype.expression = function() { | 14420 lang_Parser.prototype.expression = function() { |
| 14149 return this.infixExpression(0); | 14421 return this.infixExpression(0); |
| 14150 } | 14422 } |
| 14151 lang_Parser.prototype._makeType = function(expr) { | 14423 lang_Parser.prototype._makeType = function(expr) { |
| 14152 if ((expr instanceof VarExpression)) { | 14424 if ($notnull_bool((expr instanceof VarExpression))) { |
| 14153 return new NameTypeReference(false, expr.get$name(), null, expr.get$span()); | 14425 return new NameTypeReference(false, expr.get$name(), null, expr.get$span()); |
| 14154 } | 14426 } |
| 14155 else if ((expr instanceof DotExpression)) { | 14427 else if ($notnull_bool((expr instanceof DotExpression))) { |
| 14156 var type0 = this._makeType(expr.self); | 14428 var type0 = this._makeType(expr.self); |
| 14157 if (type0.names == null) { | 14429 if ($notnull_bool(type0.names == null)) { |
| 14158 type0.names = [expr.get$name()]; | 14430 type0.names = [expr.get$name()]; |
| 14159 } | 14431 } |
| 14160 else { | 14432 else { |
| 14161 type0.names.add(expr.get$name()); | 14433 type0.names.add(expr.get$name()); |
| 14162 } | 14434 } |
| 14163 type0.span = expr.get$span(); | 14435 type0.span = expr.get$span(); |
| 14164 return type0; | 14436 return type0; |
| 14165 } | 14437 } |
| 14166 else { | 14438 else { |
| 14167 this._lang_error('expected type reference'); | 14439 this._lang_error('expected type reference'); |
| 14168 return null; | 14440 return null; |
| 14169 } | 14441 } |
| 14170 } | 14442 } |
| 14171 lang_Parser.prototype.infixExpression = function(precedence) { | 14443 lang_Parser.prototype.infixExpression = function(precedence) { |
| 14172 return this.finishInfixExpression(this.unaryExpression(), precedence); | 14444 var $0; |
| 14445 return this.finishInfixExpression((($0 = this.unaryExpression()) && $0.is$lang
_Expression()), precedence); |
| 14173 } | 14446 } |
| 14174 lang_Parser.prototype._finishDeclaredId = function(type0) { | 14447 lang_Parser.prototype._finishDeclaredId = function(type0) { |
| 14175 var name = this.identifier(); | 14448 var name = this.identifier(); |
| 14176 return this.finishPostfixExpression(new DeclaredIdentifier(type0, name, this._
makeSpan(type0.get$span().start))); | 14449 return this.finishPostfixExpression(new DeclaredIdentifier(type0, name, this._
makeSpan(type0.get$span().start))); |
| 14177 } | 14450 } |
| 14178 lang_Parser.prototype._fixAsType = function(x) { | 14451 lang_Parser.prototype._fixAsType = function(x) { |
| 14179 if (this._maybeEat(53/*TokenKind.GT*/)) { | 14452 $assert(this._isBin(x, 52/*TokenKind.LT*/), "_isBin(x, TokenKind.LT)", "parser
.dart", 771, 12); |
| 14453 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { |
| 14180 var base = this._makeType(x.x); | 14454 var base = this._makeType(x.x); |
| 14181 var typeParam = this._makeType(x.y); | 14455 var typeParam = this._makeType(x.y); |
| 14182 var type0 = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.
span.start)); | 14456 var type0 = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.
span.start)); |
| 14183 return this._finishDeclaredId(type0); | 14457 return this._finishDeclaredId(type0); |
| 14184 } | 14458 } |
| 14185 else { | 14459 else { |
| 14460 $assert(this._peekKind(52/*TokenKind.LT*/), "_peekKind(TokenKind.LT)", "pars
er.dart", 782, 14); |
| 14186 var base = this._makeType(x.x); | 14461 var base = this._makeType(x.x); |
| 14187 var paramBase = this._makeType(x.y); | 14462 var paramBase = this._makeType(x.y); |
| 14188 var firstParam = this.addTypeArguments(paramBase, 1); | 14463 var firstParam = this.addTypeArguments((paramBase && paramBase.is$TypeRefere
nce()), 1); |
| 14189 var type0; | 14464 var type0; |
| 14190 if (firstParam.depth <= 0) { | 14465 if ($notnull_bool(firstParam.depth <= 0)) { |
| 14191 type0 = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.s
pan.start)); | 14466 type0 = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.s
pan.start)); |
| 14192 } | 14467 } |
| 14193 else if (this._maybeEat(11/*TokenKind.COMMA*/)) { | 14468 else if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 14194 type0 = this._finishTypeArguments(base, 0, [firstParam]); | 14469 type0 = this._finishTypeArguments((base && base.is$TypeReference()), 0, [f
irstParam]); |
| 14195 } | 14470 } |
| 14196 else { | 14471 else { |
| 14197 this._eat(53/*TokenKind.GT*/); | 14472 this._eat(53/*TokenKind.GT*/); |
| 14198 type0 = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.s
pan.start)); | 14473 type0 = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.s
pan.start)); |
| 14199 } | 14474 } |
| 14200 return this._finishDeclaredId(type0); | 14475 return this._finishDeclaredId(type0); |
| 14201 } | 14476 } |
| 14202 } | 14477 } |
| 14203 lang_Parser.prototype.finishInfixExpression = function(x, precedence) { | 14478 lang_Parser.prototype.finishInfixExpression = function(x, precedence) { |
| 14204 while (true) { | 14479 while ($notnull_bool(true)) { |
| 14205 var kind = this._peek(); | 14480 var kind = this._peek(); |
| 14206 var prec = TokenKind.infixPrecedence(this._peek()); | 14481 var prec = TokenKind.infixPrecedence(this._peek()); |
| 14207 if (prec >= precedence) { | 14482 if ($notnull_bool(prec >= precedence)) { |
| 14208 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) { | 14483 if ($notnull_bool(kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/
)) { |
| 14209 if (this._isBin(x, 52/*TokenKind.LT*/)) { | 14484 if ($notnull_bool(this._isBin(x, 52/*TokenKind.LT*/))) { |
| 14210 return this._fixAsType(x); | 14485 return this._fixAsType((x && x.is$BinaryExpression())); |
| 14211 } | 14486 } |
| 14212 } | 14487 } |
| 14213 var op = this._lang_next(); | 14488 var op = this._lang_next(); |
| 14214 if (op.kind == 101/*TokenKind.IS*/) { | 14489 if ($notnull_bool(op.kind == 102/*TokenKind.IS*/)) { |
| 14215 var isTrue = !this._maybeEat(19/*TokenKind.NOT*/); | 14490 var isTrue = !this._maybeEat(19/*TokenKind.NOT*/); |
| 14216 var typeRef = this.type(0); | 14491 var typeRef = this.type(0); |
| 14217 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); | 14492 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); |
| 14218 continue; | 14493 continue; |
| 14219 } | 14494 } |
| 14220 var y = this.infixExpression($eq(prec, 2) ? prec : prec + 1); | 14495 var y = this.infixExpression($assert_num($notnull_bool($eq(prec, 2)) ? pre
c : prec + 1)); |
| 14221 if (op.kind == 33/*TokenKind.CONDITIONAL*/) { | 14496 if ($notnull_bool(op.kind == 33/*TokenKind.CONDITIONAL*/)) { |
| 14222 this._eat(8/*TokenKind.COLON*/); | 14497 this._eat(8/*TokenKind.COLON*/); |
| 14223 var z = this.infixExpression(prec + 1); | 14498 var z = this.infixExpression($assert_num(prec + 1)); |
| 14224 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start)); | 14499 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start)); |
| 14225 } | 14500 } |
| 14226 else { | 14501 else { |
| 14227 x = new BinaryExpression(op, x, y, this._makeSpan(x.span.start)); | 14502 x = new BinaryExpression(op, x, y, this._makeSpan(x.span.start)); |
| 14228 } | 14503 } |
| 14229 } | 14504 } |
| 14230 else { | 14505 else { |
| 14231 break; | 14506 break; |
| 14232 } | 14507 } |
| 14233 } | 14508 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 14245 return true; | 14520 return true; |
| 14246 | 14521 |
| 14247 default: | 14522 default: |
| 14248 | 14523 |
| 14249 return false; | 14524 return false; |
| 14250 | 14525 |
| 14251 } | 14526 } |
| 14252 } | 14527 } |
| 14253 lang_Parser.prototype.unaryExpression = function() { | 14528 lang_Parser.prototype.unaryExpression = function() { |
| 14254 var start = this._peekToken.start; | 14529 var start = this._peekToken.start; |
| 14255 if (this._isPrefixUnaryOperator(this._peek())) { | 14530 if ($notnull_bool(this._isPrefixUnaryOperator(this._peek()))) { |
| 14256 var tok = this._lang_next(); | 14531 var tok = this._lang_next(); |
| 14257 var expr = this.unaryExpression(); | 14532 var expr = this.unaryExpression(); |
| 14258 return new UnaryExpression(tok, expr, this._makeSpan(start)); | 14533 return new UnaryExpression(tok, expr, this._makeSpan(start)); |
| 14259 } | 14534 } |
| 14260 return this.finishPostfixExpression(this.primary()); | 14535 return this.finishPostfixExpression(this.primary()); |
| 14261 } | 14536 } |
| 14262 lang_Parser.prototype.argument = function() { | 14537 lang_Parser.prototype.argument = function() { |
| 14263 var start = this._peekToken.start; | 14538 var start = this._peekToken.start; |
| 14264 var expr; | 14539 var expr; |
| 14265 var label = null; | 14540 var label = null; |
| 14266 if (this._maybeEat(15/*TokenKind.ELLIPSIS*/)) { | 14541 if ($notnull_bool(this._maybeEat(15/*TokenKind.ELLIPSIS*/))) { |
| 14267 label = new lang_Identifier('...', this._makeSpan(start)); | 14542 label = new lang_Identifier('...', this._makeSpan(start)); |
| 14268 } | 14543 } |
| 14269 expr = this.expression(); | 14544 expr = this.expression(); |
| 14270 if (label == null && this._maybeEat(8/*TokenKind.COLON*/)) { | 14545 if ($notnull_bool(label == null && this._maybeEat(8/*TokenKind.COLON*/))) { |
| 14271 label = this._makeLabel(expr); | 14546 label = this._makeLabel(expr); |
| 14272 expr = this.expression(); | 14547 expr = this.expression(); |
| 14273 } | 14548 } |
| 14274 return new ArgumentNode(label, expr, this._makeSpan(start)); | 14549 return new ArgumentNode(label, expr, this._makeSpan(start)); |
| 14275 } | 14550 } |
| 14276 lang_Parser.prototype.arguments = function() { | 14551 lang_Parser.prototype.arguments = function() { |
| 14277 var args = []; | 14552 var args = []; |
| 14278 this._eat(2/*TokenKind.LPAREN*/); | 14553 this._eat(2/*TokenKind.LPAREN*/); |
| 14279 if (!this._maybeEat(3/*TokenKind.RPAREN*/)) { | 14554 if ($notnull_bool(!this._maybeEat(3/*TokenKind.RPAREN*/))) { |
| 14280 do { | 14555 do { |
| 14281 args.add(this.argument()); | 14556 args.add(this.argument()); |
| 14282 } | 14557 } |
| 14283 while (this._maybeEat(11/*TokenKind.COMMA*/)) | 14558 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 14284 this._eat(3/*TokenKind.RPAREN*/); | 14559 this._eat(3/*TokenKind.RPAREN*/); |
| 14285 } | 14560 } |
| 14286 return args; | 14561 return args; |
| 14287 } | 14562 } |
| 14288 lang_Parser.prototype.get$arguments = function() { | 14563 lang_Parser.prototype.get$arguments = function() { |
| 14289 return lang_Parser.prototype.arguments.bind(this); | 14564 return lang_Parser.prototype.arguments.bind(this); |
| 14290 } | 14565 } |
| 14291 lang_Parser.prototype.finishPostfixExpression = function(expr) { | 14566 lang_Parser.prototype.finishPostfixExpression = function(expr) { |
| 14292 switch (this._peek()) { | 14567 switch (this._peek()) { |
| 14293 case 2/*TokenKind.LPAREN*/: | 14568 case 2/*TokenKind.LPAREN*/: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 14310 | 14585 |
| 14311 case 16/*TokenKind.INCR*/: | 14586 case 16/*TokenKind.INCR*/: |
| 14312 case 17/*TokenKind.DECR*/: | 14587 case 17/*TokenKind.DECR*/: |
| 14313 | 14588 |
| 14314 var tok = this._lang_next(); | 14589 var tok = this._lang_next(); |
| 14315 return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().sta
rt)); | 14590 return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().sta
rt)); |
| 14316 | 14591 |
| 14317 case 9/*TokenKind.ARROW*/: | 14592 case 9/*TokenKind.ARROW*/: |
| 14318 case 6/*TokenKind.LBRACE*/: | 14593 case 6/*TokenKind.LBRACE*/: |
| 14319 | 14594 |
| 14320 if (this._inInitializers) return expr; | 14595 if ($notnull_bool(this._inInitializers)) return expr; |
| 14321 var body = this.functionBody(true); | 14596 var body = this.functionBody(true); |
| 14322 return this._makeFunction(expr, body); | 14597 return this._makeFunction(expr, body); |
| 14323 | 14598 |
| 14324 default: | 14599 default: |
| 14325 | 14600 |
| 14326 if (this._peekIdentifier()) { | 14601 if ($notnull_bool(this._peekIdentifier())) { |
| 14327 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp
e(expr), this.identifier(), this._makeSpan(expr.get$span().start))); | 14602 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp
e(expr), this.identifier(), this._makeSpan(expr.get$span().start))); |
| 14328 } | 14603 } |
| 14329 else { | 14604 else { |
| 14330 return expr; | 14605 return expr; |
| 14331 } | 14606 } |
| 14332 | 14607 |
| 14333 } | 14608 } |
| 14334 } | 14609 } |
| 14335 lang_Parser.prototype._isBin = function(expr, kind) { | 14610 lang_Parser.prototype._isBin = function(expr, kind) { |
| 14336 return (expr instanceof BinaryExpression) && expr.op.kind == kind; | 14611 return (expr instanceof BinaryExpression) && expr.op.kind == kind; |
| 14337 } | 14612 } |
| 14338 lang_Parser.prototype._boolTypeRef = function(span) { | 14613 lang_Parser.prototype._boolTypeRef = function(span) { |
| 14339 return new TypeReference(span, world.boolType); | 14614 return new TypeReference(span, world.boolType); |
| 14340 } | 14615 } |
| 14341 lang_Parser.prototype._numTypeRef = function(span) { | 14616 lang_Parser.prototype._intTypeRef = function(span) { |
| 14342 return new TypeReference(span, world.numType); | 14617 return new TypeReference(span, world.intType); |
| 14618 } |
| 14619 lang_Parser.prototype._doubleTypeRef = function(span) { |
| 14620 return new TypeReference(span, world.doubleType); |
| 14343 } | 14621 } |
| 14344 lang_Parser.prototype._stringTypeRef = function(span) { | 14622 lang_Parser.prototype._stringTypeRef = function(span) { |
| 14345 return new TypeReference(span, world.stringType); | 14623 return new TypeReference(span, world.stringType); |
| 14346 } | 14624 } |
| 14347 lang_Parser.prototype.primary = function() { | 14625 lang_Parser.prototype.primary = function() { |
| 14348 var start = this._peekToken.start; | 14626 var start = this._peekToken.start; |
| 14349 switch (this._peek()) { | 14627 switch (this._peek()) { |
| 14350 case 107/*TokenKind.THIS*/: | 14628 case 108/*TokenKind.THIS*/: |
| 14351 | 14629 |
| 14352 this._eat(107/*TokenKind.THIS*/); | 14630 this._eat(108/*TokenKind.THIS*/); |
| 14353 return new ThisExpression(this._makeSpan(start)); | 14631 return new ThisExpression(this._makeSpan(start)); |
| 14354 | 14632 |
| 14355 case 105/*TokenKind.SUPER*/: | 14633 case 106/*TokenKind.SUPER*/: |
| 14356 | 14634 |
| 14357 this._eat(105/*TokenKind.SUPER*/); | 14635 this._eat(106/*TokenKind.SUPER*/); |
| 14358 return new SuperExpression(this._makeSpan(start)); | 14636 return new SuperExpression(this._makeSpan(start)); |
| 14359 | 14637 |
| 14360 case 90/*TokenKind.CONST*/: | 14638 case 91/*TokenKind.CONST*/: |
| 14361 | 14639 |
| 14362 this._eat(90/*TokenKind.CONST*/); | 14640 this._eat(91/*TokenKind.CONST*/); |
| 14363 if (this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/*TokenKind.
INDEX*/)) { | 14641 if ($notnull_bool(this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(
56/*TokenKind.INDEX*/))) { |
| 14364 return this.finishListLiteral(start, true, null); | 14642 return this.finishListLiteral(start, true, null); |
| 14365 } | 14643 } |
| 14366 else if (this._peekKind(6/*TokenKind.LBRACE*/)) { | 14644 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { |
| 14367 return this.finishMapLiteral(start, true, null); | 14645 return this.finishMapLiteral(start, true, null); |
| 14368 } | 14646 } |
| 14369 else if (this._peekKind(52/*TokenKind.LT*/)) { | 14647 else if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { |
| 14370 return this.finishTypedLiteral(start, true); | 14648 return this.finishTypedLiteral(start, true); |
| 14371 } | 14649 } |
| 14372 else { | 14650 else { |
| 14373 return this.finishNewExpression(start, true); | 14651 return this.finishNewExpression(start, true); |
| 14374 } | 14652 } |
| 14375 | 14653 |
| 14376 case 102/*TokenKind.NEW*/: | 14654 case 103/*TokenKind.NEW*/: |
| 14377 | 14655 |
| 14378 this._eat(102/*TokenKind.NEW*/); | 14656 this._eat(103/*TokenKind.NEW*/); |
| 14379 return this.finishNewExpression(start, false); | 14657 return this.finishNewExpression(start, false); |
| 14380 | 14658 |
| 14381 case 2/*TokenKind.LPAREN*/: | 14659 case 2/*TokenKind.LPAREN*/: |
| 14382 | 14660 |
| 14383 return this._parenOrLambda(); | 14661 return this._parenOrLambda(); |
| 14384 | 14662 |
| 14385 case 4/*TokenKind.LBRACK*/: | 14663 case 4/*TokenKind.LBRACK*/: |
| 14386 case 56/*TokenKind.INDEX*/: | 14664 case 56/*TokenKind.INDEX*/: |
| 14387 | 14665 |
| 14388 return this.finishListLiteral(start, false, null); | 14666 return this.finishListLiteral(start, false, null); |
| 14389 | 14667 |
| 14390 case 6/*TokenKind.LBRACE*/: | 14668 case 6/*TokenKind.LBRACE*/: |
| 14391 | 14669 |
| 14392 return this.finishMapLiteral(start, false, null); | 14670 return this.finishMapLiteral(start, false, null); |
| 14393 | 14671 |
| 14394 case 103/*TokenKind.NULL*/: | 14672 case 104/*TokenKind.NULL*/: |
| 14395 | 14673 |
| 14396 this._eat(103/*TokenKind.NULL*/); | 14674 this._eat(104/*TokenKind.NULL*/); |
| 14397 return new NullExpression(this._makeSpan(start)); | 14675 return new NullExpression(this._makeSpan(start)); |
| 14398 | 14676 |
| 14399 case 109/*TokenKind.TRUE*/: | 14677 case 110/*TokenKind.TRUE*/: |
| 14400 | 14678 |
| 14401 this._eat(109/*TokenKind.TRUE*/); | 14679 this._eat(110/*TokenKind.TRUE*/); |
| 14402 return new LiteralExpression(true, this._boolTypeRef(this._makeSpan(start)
), 'true', this._makeSpan(start)); | 14680 return new LiteralExpression(true, this._boolTypeRef(this._makeSpan(start)
), 'true', this._makeSpan(start)); |
| 14403 | 14681 |
| 14404 case 95/*TokenKind.FALSE*/: | 14682 case 96/*TokenKind.FALSE*/: |
| 14405 | 14683 |
| 14406 this._eat(95/*TokenKind.FALSE*/); | 14684 this._eat(96/*TokenKind.FALSE*/); |
| 14407 return new LiteralExpression(false, this._boolTypeRef(this._makeSpan(start
)), 'false', this._makeSpan(start)); | 14685 return new LiteralExpression(false, this._boolTypeRef(this._makeSpan(start
)), 'false', this._makeSpan(start)); |
| 14408 | 14686 |
| 14409 case 61/*TokenKind.HEX_NUMBER*/: | 14687 case 61/*TokenKind.HEX_INTEGER*/: |
| 14410 | 14688 |
| 14411 var t = this._lang_next(); | 14689 var t = this._lang_next(); |
| 14412 return new LiteralExpression(lang_Parser.parseHex(t.get$text().substring(2
)), this._numTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)
); | 14690 return new LiteralExpression(lang_Parser.parseHex(t.get$text().substring(2
)), this._intTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)
); |
| 14413 | 14691 |
| 14414 case 60/*TokenKind.NUMBER*/: | 14692 case 60/*TokenKind.INTEGER*/: |
| 14415 | 14693 |
| 14416 var t = this._lang_next(); | 14694 var t = this._lang_next(); |
| 14417 return new LiteralExpression(Math.parseDouble(t.get$text()), this._numType
Ref(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); | 14695 return new LiteralExpression(Math.parseInt(t.get$text()), this._intTypeRef
(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); |
| 14696 |
| 14697 case 62/*TokenKind.DOUBLE*/: |
| 14698 |
| 14699 var t = this._lang_next(); |
| 14700 return new LiteralExpression(Math.parseDouble(t.get$text()), this._doubleT
ypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); |
| 14418 | 14701 |
| 14419 case 58/*TokenKind.STRING*/: | 14702 case 58/*TokenKind.STRING*/: |
| 14420 | 14703 |
| 14421 return this.stringLiteralExpr(); | 14704 return this.stringLiteralExpr(); |
| 14422 | 14705 |
| 14423 case 65/*TokenKind.INCOMPLETE_STRING*/: | 14706 case 66/*TokenKind.INCOMPLETE_STRING*/: |
| 14424 | 14707 |
| 14425 return this.stringInterpolation(); | 14708 return this.stringInterpolation(); |
| 14426 | 14709 |
| 14427 case 52/*TokenKind.LT*/: | 14710 case 52/*TokenKind.LT*/: |
| 14428 | 14711 |
| 14429 return this.finishTypedLiteral(start, false); | 14712 return this.finishTypedLiteral(start, false); |
| 14430 | 14713 |
| 14431 case 112/*TokenKind.VOID*/: | 14714 case 113/*TokenKind.VOID*/: |
| 14432 case 111/*TokenKind.VAR*/: | 14715 case 112/*TokenKind.VAR*/: |
| 14433 case 96/*TokenKind.FINAL*/: | 14716 case 97/*TokenKind.FINAL*/: |
| 14434 | 14717 |
| 14435 return this.declaredIdentifier(false); | 14718 return this.declaredIdentifier(false); |
| 14436 | 14719 |
| 14437 default: | 14720 default: |
| 14438 | 14721 |
| 14439 if (!this._peekIdentifier()) { | 14722 if ($notnull_bool(!this._peekIdentifier())) { |
| 14440 this._errorExpected('expression'); | 14723 this._errorExpected('expression'); |
| 14441 } | 14724 } |
| 14442 return new VarExpression(this.identifier(), this._makeSpan(start)); | 14725 return new VarExpression(this.identifier(), this._makeSpan(start)); |
| 14443 | 14726 |
| 14444 } | 14727 } |
| 14445 } | 14728 } |
| 14446 lang_Parser.prototype.stringInterpolation = function() { | 14729 lang_Parser.prototype.stringInterpolation = function() { |
| 14447 var start = this._peekToken.start; | 14730 var start = this._peekToken.start; |
| 14448 var lits = []; | 14731 var lits = []; |
| 14449 var startQuote = null, endQuote = null; | 14732 var startQuote = null, endQuote = null; |
| 14450 while (this._peekKind(65/*TokenKind.INCOMPLETE_STRING*/)) { | 14733 while ($notnull_bool(this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/))) { |
| 14451 var token = this._lang_next(); | 14734 var token = this._lang_next(); |
| 14452 var text = token.get$text(); | 14735 var text = token.get$text(); |
| 14453 if (startQuote == null) { | 14736 if ($notnull_bool(startQuote == null)) { |
| 14454 if (isMultilineString(text)) { | 14737 if ($notnull_bool(isMultilineString($assert_String(text)))) { |
| 14455 endQuote = text.substring(0, 3); | 14738 endQuote = text.substring(0, 3); |
| 14456 startQuote = endQuote + '\n'; | 14739 startQuote = endQuote + '\n'; |
| 14457 } | 14740 } |
| 14458 else { | 14741 else { |
| 14459 startQuote = endQuote = text.$index(0); | 14742 startQuote = endQuote = text.$index(0); |
| 14460 } | 14743 } |
| 14461 text = text.substring(0, text.length - 1) + endQuote; | 14744 text = text.substring(0, text.length - 1) + endQuote; |
| 14462 } | 14745 } |
| 14463 else { | 14746 else { |
| 14464 text = startQuote + text.substring(0, text.length - 1) + endQuote; | 14747 text = startQuote + text.substring(0, text.length - 1) + endQuote; |
| 14465 } | 14748 } |
| 14466 lits.add(this.makeStringLiteral(text, token.get$span())); | 14749 lits.add(this.makeStringLiteral($assert_String(text), token.get$span())); |
| 14467 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { | 14750 if ($notnull_bool(this._maybeEat(6/*TokenKind.LBRACE*/))) { |
| 14468 lits.add(this.expression()); | 14751 lits.add(this.expression()); |
| 14469 this._eat(7/*TokenKind.RBRACE*/); | 14752 this._eat(7/*TokenKind.RBRACE*/); |
| 14470 } | 14753 } |
| 14471 else { | 14754 else { |
| 14472 var id = this.identifier(); | 14755 var id = this.identifier(); |
| 14473 lits.add(new VarExpression(id, id.get$span())); | 14756 lits.add(new VarExpression(id, id.get$span())); |
| 14474 } | 14757 } |
| 14475 } | 14758 } |
| 14476 var tok = this._lang_next(); | 14759 var tok = this._lang_next(); |
| 14477 if (tok.kind != 58/*TokenKind.STRING*/) { | 14760 if ($notnull_bool(tok.kind != 58/*TokenKind.STRING*/)) { |
| 14478 this._errorExpected('interpolated string'); | 14761 this._errorExpected('interpolated string'); |
| 14479 } | 14762 } |
| 14480 var text = startQuote + tok.get$text(); | 14763 var text = startQuote + tok.get$text(); |
| 14481 lits.add(this.makeStringLiteral(text, tok.get$span())); | 14764 lits.add(this.makeStringLiteral($assert_String(text), tok.get$span())); |
| 14482 var span = this._makeSpan(start); | 14765 var span = this._makeSpan(start); |
| 14483 return new LiteralExpression(lits, this._stringTypeRef(span), '\$\$\$', span); | 14766 return new LiteralExpression(lits, this._stringTypeRef((span && span.is$Source
Span())), '\$\$\$', (span && span.is$SourceSpan())); |
| 14484 } | 14767 } |
| 14485 lang_Parser.prototype.makeStringLiteral = function(text, span) { | 14768 lang_Parser.prototype.makeStringLiteral = function(text, span) { |
| 14486 return new LiteralExpression(text, this._stringTypeRef(span), text, span); | 14769 return new LiteralExpression(text, this._stringTypeRef(span), text, span); |
| 14487 } | 14770 } |
| 14488 lang_Parser.prototype.stringLiteralExpr = function() { | 14771 lang_Parser.prototype.stringLiteralExpr = function() { |
| 14489 var token = this._lang_next(); | 14772 var token = this._lang_next(); |
| 14490 return this.makeStringLiteral(token.get$text(), token.get$span()); | 14773 return this.makeStringLiteral(token.get$text(), token.get$span()); |
| 14491 } | 14774 } |
| 14492 lang_Parser.prototype.maybeStringLiteral = function() { | 14775 lang_Parser.prototype.maybeStringLiteral = function() { |
| 14493 var kind = this._peek(); | 14776 var kind = this._peek(); |
| 14494 if ($eq(kind, 58/*TokenKind.STRING*/)) { | 14777 if ($notnull_bool($eq(kind, 58/*TokenKind.STRING*/))) { |
| 14495 return parseStringLiteral(this._lang_next().get$text()); | 14778 return parseStringLiteral(this._lang_next().get$text()); |
| 14496 } | 14779 } |
| 14497 else if ($eq(kind, 59/*TokenKind.STRING_PART*/)) { | 14780 else if ($notnull_bool($eq(kind, 59/*TokenKind.STRING_PART*/))) { |
| 14498 this._lang_next(); | 14781 this._lang_next(); |
| 14499 this._errorExpected('string literal, but found interpolated string start'); | 14782 this._errorExpected('string literal, but found interpolated string start'); |
| 14500 } | 14783 } |
| 14501 else if ($eq(kind, 65/*TokenKind.INCOMPLETE_STRING*/)) { | 14784 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) { |
| 14502 this._lang_next(); | 14785 this._lang_next(); |
| 14503 this._errorExpected('string literal, but found incomplete string'); | 14786 this._errorExpected('string literal, but found incomplete string'); |
| 14504 } | 14787 } |
| 14505 return null; | 14788 return null; |
| 14506 } | 14789 } |
| 14507 lang_Parser.prototype._parenOrLambda = function() { | 14790 lang_Parser.prototype._parenOrLambda = function() { |
| 14508 var start = this._peekToken.start; | 14791 var start = this._peekToken.start; |
| 14509 var args = this.arguments(); | 14792 var args = this.arguments(); |
| 14510 if (!this._inInitializers && (this._peekKind(9/*TokenKind.ARROW*/) || this._pe
ekKind(6/*TokenKind.LBRACE*/))) { | 14793 if ($notnull_bool(!this._inInitializers && (this._peekKind(9/*TokenKind.ARROW*
/) || this._peekKind(6/*TokenKind.LBRACE*/)))) { |
| 14511 var body = this.functionBody(true); | 14794 var body = this.functionBody(true); |
| 14512 var formals = this._makeFormals(args); | 14795 var formals = this._makeFormals(args); |
| 14513 var func = new FunctionDefinition(null, null, null, formals, null, body, thi
s._makeSpan(start)); | 14796 var func = new FunctionDefinition(null, null, null, formals, null, body, thi
s._makeSpan(start)); |
| 14514 return new LambdaExpression(func, func.get$span()); | 14797 return new LambdaExpression(func, func.get$span()); |
| 14515 } | 14798 } |
| 14516 else { | 14799 else { |
| 14517 if (args.length == 1) { | 14800 if ($notnull_bool(args.length == 1)) { |
| 14518 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star
t)); | 14801 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star
t)); |
| 14519 } | 14802 } |
| 14520 else { | 14803 else { |
| 14521 this._lang_error('unexpected comma expression'); | 14804 this._lang_error('unexpected comma expression'); |
| 14522 return args.$index(0).get$value(); | 14805 return args.$index(0).get$value(); |
| 14523 } | 14806 } |
| 14524 } | 14807 } |
| 14525 } | 14808 } |
| 14526 lang_Parser.prototype._typeAsIdentifier = function(type0) { | 14809 lang_Parser.prototype._typeAsIdentifier = function(type0) { |
| 14527 return type0.get$name(); | 14810 return type0.get$name(); |
| 14528 } | 14811 } |
| 14529 lang_Parser.prototype._specialIdentifier = function(includeOperators) { | 14812 lang_Parser.prototype._specialIdentifier = function(includeOperators) { |
| 14530 var start = this._peekToken.start; | 14813 var start = this._peekToken.start; |
| 14531 var name; | 14814 var name; |
| 14532 switch (this._peek()) { | 14815 switch (this._peek()) { |
| 14533 case 15/*TokenKind.ELLIPSIS*/: | 14816 case 15/*TokenKind.ELLIPSIS*/: |
| 14534 | 14817 |
| 14535 this._eat(15/*TokenKind.ELLIPSIS*/); | 14818 this._eat(15/*TokenKind.ELLIPSIS*/); |
| 14536 this._lang_error('rest no longer supported', this._previousToken.get$span(
)); | 14819 this._lang_error('rest no longer supported', this._previousToken.get$span(
)); |
| 14537 name = this.identifier().get$name(); | 14820 name = $assert_String(this.identifier().get$name()); |
| 14538 break; | 14821 break; |
| 14539 | 14822 |
| 14540 case 107/*TokenKind.THIS*/: | 14823 case 108/*TokenKind.THIS*/: |
| 14541 | 14824 |
| 14542 this._eat(107/*TokenKind.THIS*/); | 14825 this._eat(108/*TokenKind.THIS*/); |
| 14543 this._eat(14/*TokenKind.DOT*/); | 14826 this._eat(14/*TokenKind.DOT*/); |
| 14544 name = ('this.' + this.identifier().get$name() + ''); | 14827 name = ('this.' + this.identifier().get$name() + ''); |
| 14545 break; | 14828 break; |
| 14546 | 14829 |
| 14547 case 75/*TokenKind.GET*/: | 14830 case 76/*TokenKind.GET*/: |
| 14548 | 14831 |
| 14549 if (!includeOperators) return null; | 14832 if ($notnull_bool(!includeOperators)) return null; |
| 14550 this._eat(75/*TokenKind.GET*/); | 14833 this._eat(76/*TokenKind.GET*/); |
| 14551 if (this._peekIdentifier()) { | 14834 if ($notnull_bool(this._peekIdentifier())) { |
| 14552 name = ('get\$' + this.identifier().get$name() + ''); | 14835 name = ('get\$' + this.identifier().get$name() + ''); |
| 14553 } | 14836 } |
| 14554 else { | 14837 else { |
| 14555 name = 'get'; | 14838 name = 'get'; |
| 14556 } | 14839 } |
| 14557 break; | 14840 break; |
| 14558 | 14841 |
| 14559 case 83/*TokenKind.SET*/: | 14842 case 84/*TokenKind.SET*/: |
| 14560 | 14843 |
| 14561 if (!includeOperators) return null; | 14844 if ($notnull_bool(!includeOperators)) return null; |
| 14562 this._eat(83/*TokenKind.SET*/); | 14845 this._eat(84/*TokenKind.SET*/); |
| 14563 if (this._peekIdentifier()) { | 14846 if ($notnull_bool(this._peekIdentifier())) { |
| 14564 name = ('set\$' + this.identifier().get$name() + ''); | 14847 name = ('set\$' + this.identifier().get$name() + ''); |
| 14565 } | 14848 } |
| 14566 else { | 14849 else { |
| 14567 name = 'set'; | 14850 name = 'set'; |
| 14568 } | 14851 } |
| 14569 break; | 14852 break; |
| 14570 | 14853 |
| 14571 case 82/*TokenKind.OPERATOR*/: | 14854 case 83/*TokenKind.OPERATOR*/: |
| 14572 | 14855 |
| 14573 if (!includeOperators) return null; | 14856 if ($notnull_bool(!includeOperators)) return null; |
| 14574 this._eat(82/*TokenKind.OPERATOR*/); | 14857 this._eat(83/*TokenKind.OPERATOR*/); |
| 14575 var kind = this._peek(); | 14858 var kind = this._peek(); |
| 14576 if ($eq(kind, 81/*TokenKind.NEGATE*/)) { | 14859 if ($notnull_bool($eq(kind, 82/*TokenKind.NEGATE*/))) { |
| 14577 name = '\$negate'; | 14860 name = '\$negate'; |
| 14578 this._lang_next(); | 14861 this._lang_next(); |
| 14579 } | 14862 } |
| 14580 else { | 14863 else { |
| 14581 name = TokenKind.binaryMethodName(kind); | 14864 name = TokenKind.binaryMethodName($assert_num(kind)); |
| 14582 if (name == null) { | 14865 if ($notnull_bool(name == null)) { |
| 14583 name = 'operator'; | 14866 name = 'operator'; |
| 14584 } | 14867 } |
| 14585 else { | 14868 else { |
| 14586 this._lang_next(); | 14869 this._lang_next(); |
| 14587 } | 14870 } |
| 14588 } | 14871 } |
| 14589 break; | 14872 break; |
| 14590 | 14873 |
| 14591 default: | 14874 default: |
| 14592 | 14875 |
| 14593 return null; | 14876 return null; |
| 14594 | 14877 |
| 14595 } | 14878 } |
| 14596 return new lang_Identifier(name, this._makeSpan(start)); | 14879 return new lang_Identifier(name, this._makeSpan(start)); |
| 14597 } | 14880 } |
| 14598 lang_Parser.prototype.declaredIdentifier = function(includeOperators) { | 14881 lang_Parser.prototype.declaredIdentifier = function(includeOperators) { |
| 14599 var start = this._peekToken.start; | 14882 var start = this._peekToken.start; |
| 14600 var myType = null; | 14883 var myType = null; |
| 14601 var name = this._specialIdentifier(includeOperators); | 14884 var name = this._specialIdentifier(includeOperators); |
| 14602 if (name == null) { | 14885 if ($notnull_bool(name == null)) { |
| 14603 myType = this.type(0); | 14886 myType = this.type(0); |
| 14604 name = this._specialIdentifier(includeOperators); | 14887 name = this._specialIdentifier(includeOperators); |
| 14605 if (name == null) { | 14888 if ($notnull_bool(name == null)) { |
| 14606 if (this._peekIdentifier()) { | 14889 if ($notnull_bool(this._peekIdentifier())) { |
| 14607 name = this.identifier(); | 14890 name = this.identifier(); |
| 14608 } | 14891 } |
| 14609 else if ((myType instanceof NameTypeReference) && myType.names == null) { | 14892 else if ($notnull_bool((myType instanceof NameTypeReference) && myType.nam
es == null)) { |
| 14610 name = this._typeAsIdentifier(myType); | 14893 name = this._typeAsIdentifier(myType); |
| 14611 myType = null; | 14894 myType = null; |
| 14612 } | 14895 } |
| 14613 else { | 14896 else { |
| 14614 } | 14897 } |
| 14615 } | 14898 } |
| 14616 } | 14899 } |
| 14617 return new DeclaredIdentifier(myType, name, this._makeSpan(start)); | 14900 return new DeclaredIdentifier(myType, name, this._makeSpan(start)); |
| 14618 } | 14901 } |
| 14619 lang_Parser._hexDigit = function(c) { | 14902 lang_Parser._hexDigit = function(c) { |
| 14620 if (c >= 48 && c <= 57) { | 14903 if ($notnull_bool(c >= 48 && c <= 57)) { |
| 14621 return c - 48; | 14904 return c - 48; |
| 14622 } | 14905 } |
| 14623 else if (c >= 97 && c <= 102) { | 14906 else if ($notnull_bool(c >= 97 && c <= 102)) { |
| 14624 return c - 87; | 14907 return c - 87; |
| 14625 } | 14908 } |
| 14626 else if (c >= 65 && c <= 70) { | 14909 else if ($notnull_bool(c >= 65 && c <= 70)) { |
| 14627 return c - 55; | 14910 return c - 55; |
| 14628 } | 14911 } |
| 14629 else { | 14912 else { |
| 14630 return -1; | 14913 return -1; |
| 14631 } | 14914 } |
| 14632 } | 14915 } |
| 14633 lang_Parser.parseHex = function(hex) { | 14916 lang_Parser.parseHex = function(hex) { |
| 14634 var result = 0; | 14917 var result = 0; |
| 14635 for (var i = 0; | 14918 for (var i = 0; |
| 14636 i < hex.length; i++) { | 14919 $notnull_bool(i < hex.length); i++) { |
| 14637 var digit = lang_Parser._hexDigit(hex.charCodeAt(i)); | 14920 var digit = lang_Parser._hexDigit(hex.charCodeAt(i)); |
| 14638 result = (result << 4) + digit; | 14921 $assert($ne(digit, -1), "digit != -1", "parser.dart", 1238, 14); |
| 14922 result = (result << 4) + $assert_num(digit); |
| 14639 } | 14923 } |
| 14640 return result; | 14924 return result; |
| 14641 } | 14925 } |
| 14642 lang_Parser.prototype.finishNewExpression = function(start, isConst) { | 14926 lang_Parser.prototype.finishNewExpression = function(start, isConst) { |
| 14643 var type0 = this.type(0); | 14927 var type0 = this.type(0); |
| 14644 var name = null; | 14928 var name = null; |
| 14645 if (this._maybeEat(14/*TokenKind.DOT*/)) { | 14929 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { |
| 14646 name = this.identifier(); | 14930 name = this.identifier(); |
| 14647 } | 14931 } |
| 14648 var args = this.arguments(); | 14932 var args = this.arguments(); |
| 14649 return new lang_NewExpression(isConst, type0, name, args, this._makeSpan(start
)); | 14933 return new lang_NewExpression(isConst, type0, name, args, this._makeSpan(start
)); |
| 14650 } | 14934 } |
| 14651 lang_Parser.prototype.finishListLiteral = function(start, isConst, type0) { | 14935 lang_Parser.prototype.finishListLiteral = function(start, isConst, type0) { |
| 14652 if (this._maybeEat(56/*TokenKind.INDEX*/)) { | 14936 if ($notnull_bool(this._maybeEat(56/*TokenKind.INDEX*/))) { |
| 14653 return new ListExpression(isConst, type0, [], this._makeSpan(start)); | 14937 return new ListExpression(isConst, type0, [], this._makeSpan(start)); |
| 14654 } | 14938 } |
| 14655 var values = []; | 14939 var values = []; |
| 14656 this._eat(4/*TokenKind.LBRACK*/); | 14940 this._eat(4/*TokenKind.LBRACK*/); |
| 14657 while (!this._maybeEat(5/*TokenKind.RBRACK*/)) { | 14941 while ($notnull_bool(!this._maybeEat(5/*TokenKind.RBRACK*/))) { |
| 14658 if (this.isPrematureEndOfFile()) break; | 14942 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 14659 values.add(this.expression()); | 14943 values.add(this.expression()); |
| 14660 if (!this._maybeEat(11/*TokenKind.COMMA*/)) { | 14944 if ($notnull_bool(!this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 14661 this._eat(5/*TokenKind.RBRACK*/); | 14945 this._eat(5/*TokenKind.RBRACK*/); |
| 14662 break; | 14946 break; |
| 14663 } | 14947 } |
| 14664 } | 14948 } |
| 14665 return new ListExpression(isConst, type0, values, this._makeSpan(start)); | 14949 return new ListExpression(isConst, type0, values, this._makeSpan(start)); |
| 14666 } | 14950 } |
| 14667 lang_Parser.prototype.finishMapLiteral = function(start, isConst, type0) { | 14951 lang_Parser.prototype.finishMapLiteral = function(start, isConst, type0) { |
| 14668 var items = []; | 14952 var items = []; |
| 14669 this._eat(6/*TokenKind.LBRACE*/); | 14953 this._eat(6/*TokenKind.LBRACE*/); |
| 14670 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { | 14954 while ($notnull_bool(!this._maybeEat(7/*TokenKind.RBRACE*/))) { |
| 14671 if (this.isPrematureEndOfFile()) break; | 14955 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 14672 items.add(this.expression()); | 14956 items.add(this.expression()); |
| 14673 this._eat(8/*TokenKind.COLON*/); | 14957 this._eat(8/*TokenKind.COLON*/); |
| 14674 items.add(this.expression()); | 14958 items.add(this.expression()); |
| 14675 if (!this._maybeEat(11/*TokenKind.COMMA*/)) { | 14959 if ($notnull_bool(!this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 14676 this._eat(7/*TokenKind.RBRACE*/); | 14960 this._eat(7/*TokenKind.RBRACE*/); |
| 14677 break; | 14961 break; |
| 14678 } | 14962 } |
| 14679 } | 14963 } |
| 14680 return new MapExpression(isConst, type0, items, this._makeSpan(start)); | 14964 return new MapExpression(isConst, type0, items, this._makeSpan(start)); |
| 14681 } | 14965 } |
| 14682 lang_Parser.prototype.finishTypedLiteral = function(start, isConst) { | 14966 lang_Parser.prototype.finishTypedLiteral = function(start, isConst) { |
| 14683 var span = this._makeSpan(start); | 14967 var span = this._makeSpan(start); |
| 14684 var typeToBeNamedLater = new NameTypeReference(false, null, null, span); | 14968 var typeToBeNamedLater = new NameTypeReference(false, null, null, (span && spa
n.is$SourceSpan())); |
| 14685 var genericType = this.addTypeArguments(typeToBeNamedLater, 0); | 14969 var genericType = this.addTypeArguments((typeToBeNamedLater && typeToBeNamedLa
ter.is$TypeReference()), 0); |
| 14686 if (this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/*TokenKind.INDE
X*/)) { | 14970 if ($notnull_bool(this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/*
TokenKind.INDEX*/))) { |
| 14687 return this.finishListLiteral(start, isConst, genericType); | 14971 return this.finishListLiteral(start, isConst, (genericType && genericType.is
$TypeReference())); |
| 14688 } | 14972 } |
| 14689 else if (this._peekKind(6/*TokenKind.LBRACE*/)) { | 14973 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { |
| 14690 return this.finishMapLiteral(start, isConst, genericType); | 14974 return this.finishMapLiteral(start, isConst, (genericType && genericType.is$
TypeReference())); |
| 14691 } | 14975 } |
| 14692 else { | 14976 else { |
| 14693 this._errorExpected('array or map literal'); | 14977 this._errorExpected('array or map literal'); |
| 14694 } | 14978 } |
| 14695 } | 14979 } |
| 14696 lang_Parser.prototype._readModifiers = function() { | 14980 lang_Parser.prototype._readModifiers = function() { |
| 14697 var modifiers = null; | 14981 var modifiers = null; |
| 14698 while (true) { | 14982 while ($notnull_bool(true)) { |
| 14699 switch (this._peek()) { | 14983 switch (this._peek()) { |
| 14700 case 85/*TokenKind.STATIC*/: | 14984 case 86/*TokenKind.STATIC*/: |
| 14701 case 96/*TokenKind.FINAL*/: | 14985 case 97/*TokenKind.FINAL*/: |
| 14702 case 90/*TokenKind.CONST*/: | 14986 case 91/*TokenKind.CONST*/: |
| 14703 case 70/*TokenKind.ABSTRACT*/: | 14987 case 71/*TokenKind.ABSTRACT*/: |
| 14704 case 74/*TokenKind.FACTORY*/: | 14988 case 75/*TokenKind.FACTORY*/: |
| 14705 | 14989 |
| 14706 if (modifiers == null) modifiers = []; | 14990 if ($notnull_bool(modifiers == null)) modifiers = []; |
| 14707 modifiers.add(this._lang_next()); | 14991 modifiers.add(this._lang_next()); |
| 14708 break; | 14992 break; |
| 14709 | 14993 |
| 14710 default: | 14994 default: |
| 14711 | 14995 |
| 14712 return modifiers; | 14996 return modifiers; |
| 14713 | 14997 |
| 14714 } | 14998 } |
| 14715 } | 14999 } |
| 14716 return null; | 15000 return null; |
| 14717 } | 15001 } |
| 14718 lang_Parser.prototype.typeParameter = function() { | 15002 lang_Parser.prototype.typeParameter = function() { |
| 14719 var start = this._peekToken.start; | 15003 var start = this._peekToken.start; |
| 14720 var name = this.identifier(); | 15004 var name = this.identifier(); |
| 14721 var myType = null; | 15005 var myType = null; |
| 14722 if (this._maybeEat(73/*TokenKind.EXTENDS*/)) { | 15006 if ($notnull_bool(this._maybeEat(74/*TokenKind.EXTENDS*/))) { |
| 14723 myType = this.type(1); | 15007 myType = this.type(1); |
| 14724 } | 15008 } |
| 14725 return new TypeParameter(name, myType, this._makeSpan(start)); | 15009 return new TypeParameter(name, myType, this._makeSpan(start)); |
| 14726 } | 15010 } |
| 14727 lang_Parser.prototype.typeParameters = function() { | 15011 lang_Parser.prototype.typeParameters = function() { |
| 14728 this._eat(52/*TokenKind.LT*/); | 15012 this._eat(52/*TokenKind.LT*/); |
| 14729 var closed = false; | 15013 var closed = false; |
| 14730 var ret = []; | 15014 var ret = []; |
| 14731 do { | 15015 do { |
| 14732 var tp = this.typeParameter(); | 15016 var tp = this.typeParameter(); |
| 14733 ret.add(tp); | 15017 ret.add(tp); |
| 14734 if ((tp.extendsType instanceof GenericTypeReference) && tp.extendsType.depth
== 0) { | 15018 if ($notnull_bool((tp.extendsType instanceof GenericTypeReference) && tp.ext
endsType.depth == 0)) { |
| 14735 closed = true; | 15019 closed = true; |
| 14736 break; | 15020 break; |
| 14737 } | 15021 } |
| 14738 } | 15022 } |
| 14739 while (this._maybeEat(11/*TokenKind.COMMA*/)) | 15023 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 14740 if (!closed) { | 15024 if ($notnull_bool(!closed)) { |
| 14741 this._eat(53/*TokenKind.GT*/); | 15025 this._eat(53/*TokenKind.GT*/); |
| 14742 } | 15026 } |
| 14743 return ret; | 15027 return ret; |
| 14744 } | 15028 } |
| 14745 lang_Parser.prototype.get$typeParameters = function() { | 15029 lang_Parser.prototype.get$typeParameters = function() { |
| 14746 return lang_Parser.prototype.typeParameters.bind(this); | 15030 return lang_Parser.prototype.typeParameters.bind(this); |
| 14747 } | 15031 } |
| 14748 lang_Parser.prototype._eatClosingAngle = function(depth) { | 15032 lang_Parser.prototype._eatClosingAngle = function(depth) { |
| 14749 if (this._maybeEat(53/*TokenKind.GT*/)) { | 15033 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { |
| 14750 return depth; | 15034 return depth; |
| 14751 } | 15035 } |
| 14752 else if (depth > 0 && this._maybeEat(40/*TokenKind.SAR*/)) { | 15036 else if ($notnull_bool(depth > 0 && this._maybeEat(40/*TokenKind.SAR*/))) { |
| 14753 return depth - 1; | 15037 return depth - 1; |
| 14754 } | 15038 } |
| 14755 else if (depth > 1 && this._maybeEat(41/*TokenKind.SHR*/)) { | 15039 else if ($notnull_bool(depth > 1 && this._maybeEat(41/*TokenKind.SHR*/))) { |
| 14756 return depth - 2; | 15040 return depth - 2; |
| 14757 } | 15041 } |
| 14758 else { | 15042 else { |
| 14759 this._errorExpected('>'); | 15043 this._errorExpected('>'); |
| 14760 return depth; | 15044 return depth; |
| 14761 } | 15045 } |
| 14762 } | 15046 } |
| 14763 lang_Parser.prototype.addTypeArguments = function(baseType, depth) { | 15047 lang_Parser.prototype.addTypeArguments = function(baseType, depth) { |
| 14764 this._eat(52/*TokenKind.LT*/); | 15048 this._eat(52/*TokenKind.LT*/); |
| 14765 return this._finishTypeArguments(baseType, depth, []); | 15049 return this._finishTypeArguments(baseType, depth, []); |
| 14766 } | 15050 } |
| 14767 lang_Parser.prototype._finishTypeArguments = function(baseType, depth, types) { | 15051 lang_Parser.prototype._finishTypeArguments = function(baseType, depth, types) { |
| 14768 var delta = -1; | 15052 var delta = -1; |
| 14769 do { | 15053 do { |
| 14770 var myType = this.type(depth + 1); | 15054 var myType = this.type(depth + 1); |
| 14771 types.add(myType); | 15055 types.add(myType); |
| 14772 if ((myType instanceof GenericTypeReference) && myType.depth <= depth) { | 15056 if ($notnull_bool((myType instanceof GenericTypeReference) && myType.depth <
= depth)) { |
| 14773 delta = depth - myType.depth; | 15057 delta = depth - myType.depth; |
| 14774 break; | 15058 break; |
| 14775 } | 15059 } |
| 14776 } | 15060 } |
| 14777 while (this._maybeEat(11/*TokenKind.COMMA*/)) | 15061 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 14778 if (delta >= 0) { | 15062 if ($notnull_bool(delta >= 0)) { |
| 14779 depth = depth - delta; | 15063 depth -= $assert_num(delta); |
| 14780 } | 15064 } |
| 14781 else { | 15065 else { |
| 14782 depth = this._eatClosingAngle(depth); | 15066 depth = this._eatClosingAngle(depth); |
| 14783 } | 15067 } |
| 14784 var span = this._makeSpan(baseType.span.start); | 15068 var span = this._makeSpan(baseType.span.start); |
| 14785 return new GenericTypeReference(baseType, types, depth, span); | 15069 return new GenericTypeReference(baseType, types, depth, (span && span.is$Sourc
eSpan())); |
| 14786 } | 15070 } |
| 14787 lang_Parser.prototype.typeList = function() { | 15071 lang_Parser.prototype.typeList = function() { |
| 14788 var types = []; | 15072 var types = []; |
| 14789 do { | 15073 do { |
| 14790 types.add(this.type(0)); | 15074 types.add(this.type(0)); |
| 14791 } | 15075 } |
| 14792 while (this._maybeEat(11/*TokenKind.COMMA*/)) | 15076 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 14793 return types; | 15077 return types; |
| 14794 } | 15078 } |
| 14795 lang_Parser.prototype.type = function(depth) { | 15079 lang_Parser.prototype.type = function(depth) { |
| 14796 var start = this._peekToken.start; | 15080 var start = this._peekToken.start; |
| 14797 var name; | 15081 var name; |
| 14798 var names = null; | 15082 var names = null; |
| 14799 var typeArgs = null; | 15083 var typeArgs = null; |
| 14800 var isFinal = false; | 15084 var isFinal = false; |
| 14801 switch (this._peek()) { | 15085 switch (this._peek()) { |
| 14802 case 112/*TokenKind.VOID*/: | 15086 case 113/*TokenKind.VOID*/: |
| 14803 | 15087 |
| 14804 return new TypeReference(this._lang_next().get$span(), world.voidType); | 15088 return new TypeReference(this._lang_next().get$span(), world.voidType); |
| 14805 | 15089 |
| 14806 case 111/*TokenKind.VAR*/: | 15090 case 112/*TokenKind.VAR*/: |
| 14807 | 15091 |
| 14808 return new TypeReference(this._lang_next().get$span(), world.varType); | 15092 return new TypeReference(this._lang_next().get$span(), world.varType); |
| 14809 | 15093 |
| 14810 case 96/*TokenKind.FINAL*/: | 15094 case 97/*TokenKind.FINAL*/: |
| 14811 | 15095 |
| 14812 this._eat(96/*TokenKind.FINAL*/); | 15096 this._eat(97/*TokenKind.FINAL*/); |
| 14813 isFinal = true; | 15097 isFinal = true; |
| 14814 name = this.identifier(); | 15098 name = this.identifier(); |
| 14815 break; | 15099 break; |
| 14816 | 15100 |
| 14817 default: | 15101 default: |
| 14818 | 15102 |
| 14819 name = this.identifier(); | 15103 name = this.identifier(); |
| 14820 break; | 15104 break; |
| 14821 | 15105 |
| 14822 } | 15106 } |
| 14823 while (this._maybeEat(14/*TokenKind.DOT*/)) { | 15107 while ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { |
| 14824 if (names == null) names = []; | 15108 if ($notnull_bool(names == null)) names = []; |
| 14825 names.add(this.identifier()); | 15109 names.add(this.identifier()); |
| 14826 } | 15110 } |
| 14827 var typeRef = new NameTypeReference(isFinal, name, names, this._makeSpan(start
)); | 15111 var typeRef = new NameTypeReference(isFinal, name, names, this._makeSpan(start
)); |
| 14828 if (this._peekKind(52/*TokenKind.LT*/)) { | 15112 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { |
| 14829 return this.addTypeArguments(typeRef, depth); | 15113 return this.addTypeArguments((typeRef && typeRef.is$TypeReference()), depth)
; |
| 14830 } | 15114 } |
| 14831 else { | 15115 else { |
| 14832 return typeRef; | 15116 return typeRef; |
| 14833 } | 15117 } |
| 14834 } | 15118 } |
| 14835 lang_Parser.prototype.formalParameter = function(inOptionalBlock) { | 15119 lang_Parser.prototype.formalParameter = function(inOptionalBlock) { |
| 14836 var start = this._peekToken.start; | 15120 var start = this._peekToken.start; |
| 14837 var isThis = false; | 15121 var isThis = false; |
| 14838 var isRest = false; | 15122 var isRest = false; |
| 14839 var di = this.declaredIdentifier(false); | 15123 var di = this.declaredIdentifier(false); |
| 14840 var type0 = di.type; | 15124 var type0 = di.type; |
| 14841 var name = di.get$name(); | 15125 var name = di.get$name(); |
| 14842 var value = null; | 15126 var value = null; |
| 14843 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 15127 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { |
| 14844 if (!inOptionalBlock) { | 15128 if ($notnull_bool(!inOptionalBlock)) { |
| 14845 this._lang_error('default values only allowed inside [optional] section'); | 15129 this._lang_error('default values only allowed inside [optional] section'); |
| 14846 } | 15130 } |
| 14847 value = this.expression(); | 15131 value = this.expression(); |
| 14848 } | 15132 } |
| 14849 else if (this._peekKind(2/*TokenKind.LPAREN*/)) { | 15133 else if ($notnull_bool(this._peekKind(2/*TokenKind.LPAREN*/))) { |
| 14850 var formals = this.formalParameterList(); | 15134 var formals = this.formalParameterList(); |
| 14851 var func = new FunctionDefinition(null, type0, name, formals, null, null, th
is._makeSpan(start)); | 15135 var func = new FunctionDefinition(null, type0, name, formals, null, null, th
is._makeSpan(start)); |
| 14852 type0 = new FunctionTypeReference(false, func, func.get$span()); | 15136 type0 = new FunctionTypeReference(false, func, func.get$span()); |
| 14853 } | 15137 } |
| 14854 if (inOptionalBlock && value == null) { | 15138 if ($notnull_bool(inOptionalBlock && value == null)) { |
| 14855 value = new NullExpression(this._makeSpan(start)); | 15139 value = new NullExpression(this._makeSpan(start)); |
| 14856 } | 15140 } |
| 14857 return new FormalNode(isThis, isRest, type0, name, value, this._makeSpan(start
)); | 15141 return new FormalNode(isThis, isRest, type0, name, value, this._makeSpan(start
)); |
| 14858 } | 15142 } |
| 14859 lang_Parser.prototype.formalParameterList = function() { | 15143 lang_Parser.prototype.formalParameterList = function() { |
| 14860 this._eat(2/*TokenKind.LPAREN*/); | 15144 this._eat(2/*TokenKind.LPAREN*/); |
| 14861 var formals = []; | 15145 var formals = []; |
| 14862 var inOptionalBlock = false; | 15146 var inOptionalBlock = false; |
| 14863 if (!this._maybeEat(3/*TokenKind.RPAREN*/)) { | 15147 if ($notnull_bool(!this._maybeEat(3/*TokenKind.RPAREN*/))) { |
| 14864 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { | 15148 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { |
| 14865 inOptionalBlock = true; | 15149 inOptionalBlock = true; |
| 14866 } | 15150 } |
| 14867 formals.add(this.formalParameter(inOptionalBlock)); | 15151 formals.add(this.formalParameter($assert_bool(inOptionalBlock))); |
| 14868 while (this._maybeEat(11/*TokenKind.COMMA*/)) { | 15152 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 14869 if (this._maybeEat(4/*TokenKind.LBRACK*/)) { | 15153 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { |
| 14870 if (inOptionalBlock) { | 15154 if ($notnull_bool(inOptionalBlock)) { |
| 14871 this._lang_error('already inside an optional block', this._previousTok
en.get$span()); | 15155 this._lang_error('already inside an optional block', this._previousTok
en.get$span()); |
| 14872 } | 15156 } |
| 14873 inOptionalBlock = true; | 15157 inOptionalBlock = true; |
| 14874 } | 15158 } |
| 14875 formals.add(this.formalParameter(inOptionalBlock)); | 15159 formals.add(this.formalParameter($assert_bool(inOptionalBlock))); |
| 14876 } | 15160 } |
| 14877 if (inOptionalBlock) { | 15161 if ($notnull_bool(inOptionalBlock)) { |
| 14878 this._eat(5/*TokenKind.RBRACK*/); | 15162 this._eat(5/*TokenKind.RBRACK*/); |
| 14879 } | 15163 } |
| 14880 this._eat(3/*TokenKind.RPAREN*/); | 15164 this._eat(3/*TokenKind.RPAREN*/); |
| 14881 } | 15165 } |
| 14882 return formals; | 15166 return formals; |
| 14883 } | 15167 } |
| 14884 lang_Parser.prototype.identifier = function() { | 15168 lang_Parser.prototype.identifier = function() { |
| 14885 var tok = this._lang_next(); | 15169 var tok = this._lang_next(); |
| 14886 if (!TokenKind.isIdentifier(tok.kind)) { | 15170 if ($notnull_bool(!TokenKind.isIdentifier(tok.kind))) { |
| 14887 this._lang_error(('expected identifier, but found ' + tok + ''), tok.get$spa
n()); | 15171 this._lang_error(('expected identifier, but found ' + tok + ''), tok.get$spa
n()); |
| 14888 } | 15172 } |
| 14889 return new lang_Identifier(tok.get$text(), this._makeSpan(tok.start)); | 15173 return new lang_Identifier(tok.get$text(), this._makeSpan(tok.start)); |
| 14890 } | 15174 } |
| 14891 lang_Parser.prototype._makeFunction = function(expr, body) { | 15175 lang_Parser.prototype._makeFunction = function(expr, body) { |
| 14892 var name, type0; | 15176 var name, type0; |
| 14893 if ((expr instanceof CallExpression)) { | 15177 if ($notnull_bool((expr instanceof CallExpression))) { |
| 14894 if ((expr.target instanceof VarExpression)) { | 15178 if ($notnull_bool((expr.target instanceof VarExpression))) { |
| 14895 name = expr.target.get$name(); | 15179 name = expr.target.get$name(); |
| 14896 type0 = null; | 15180 type0 = null; |
| 14897 } | 15181 } |
| 14898 else if ((expr.target instanceof DeclaredIdentifier)) { | 15182 else if ($notnull_bool((expr.target instanceof DeclaredIdentifier))) { |
| 14899 name = expr.target.get$name(); | 15183 name = expr.target.get$name(); |
| 14900 type0 = expr.target.type; | 15184 type0 = expr.target.type; |
| 14901 } | 15185 } |
| 14902 else { | 15186 else { |
| 14903 this._lang_error('bad function'); | 15187 this._lang_error('bad function'); |
| 14904 } | 15188 } |
| 14905 var formals = this._makeFormals(expr.get$arguments()); | 15189 var formals = this._makeFormals(expr.get$arguments()); |
| 14906 var span = new SourceSpan(expr.get$span().file, expr.get$span().start, body.
get$span().end); | 15190 var span = new SourceSpan(expr.get$span().file, expr.get$span().start, body.
get$span().end); |
| 14907 var func = new FunctionDefinition(null, type0, name, formals, null, body, sp
an); | 15191 var func = new FunctionDefinition(null, type0, name, formals, null, body, (s
pan && span.is$SourceSpan())); |
| 14908 return new LambdaExpression(func, func.get$span()); | 15192 return new LambdaExpression(func, func.get$span()); |
| 14909 } | 15193 } |
| 14910 else { | 15194 else { |
| 14911 this._lang_error('expected function'); | 15195 this._lang_error('expected function'); |
| 14912 } | 15196 } |
| 14913 } | 15197 } |
| 14914 lang_Parser.prototype._makeFormal = function(expr) { | 15198 lang_Parser.prototype._makeFormal = function(expr) { |
| 14915 if ((expr instanceof VarExpression)) { | 15199 if ($notnull_bool((expr instanceof VarExpression))) { |
| 14916 return new FormalNode(false, false, null, expr.get$name(), null, expr.get$sp
an()); | 15200 return new FormalNode(false, false, null, expr.get$name(), null, expr.get$sp
an()); |
| 14917 } | 15201 } |
| 14918 else if ((expr instanceof DeclaredIdentifier)) { | 15202 else if ($notnull_bool((expr instanceof DeclaredIdentifier))) { |
| 14919 return new FormalNode(false, false, expr.type, expr.get$name(), null, expr.g
et$span()); | 15203 return new FormalNode(false, false, expr.type, expr.get$name(), null, expr.g
et$span()); |
| 14920 } | 15204 } |
| 14921 else if (this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x instanceof Decl
aredIdentifier))) { | 15205 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x i
nstanceof DeclaredIdentifier)))) { |
| 14922 var di = expr.x; | 15206 var di = expr.x; |
| 14923 return new FormalNode(false, false, di.type, di.name, expr.y, expr.get$span(
)); | 15207 return new FormalNode(false, false, di.type, di.name, expr.y, expr.get$span(
)); |
| 14924 } | 15208 } |
| 14925 else if (this._isBin(expr, 52/*TokenKind.LT*/)) { | 15209 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/))) { |
| 14926 return null; | 15210 return null; |
| 14927 } | 15211 } |
| 14928 else if ((expr instanceof ListExpression)) { | 15212 else if ($notnull_bool((expr instanceof ListExpression))) { |
| 14929 return this._makeFormalsFromList(expr); | 15213 return this._makeFormalsFromList(expr); |
| 14930 } | 15214 } |
| 14931 else { | 15215 else { |
| 14932 this._lang_error('expected formal', expr.get$span()); | 15216 this._lang_error('expected formal', expr.get$span()); |
| 14933 } | 15217 } |
| 14934 } | 15218 } |
| 14935 lang_Parser.prototype._makeFormalsFromList = function(expr) { | 15219 lang_Parser.prototype._makeFormalsFromList = function(expr) { |
| 14936 if (expr.get$isConst()) { | 15220 if ($notnull_bool(expr.get$isConst())) { |
| 14937 this._lang_error('expected formal, but found "const"', expr.get$span()); | 15221 this._lang_error('expected formal, but found "const"', expr.get$span()); |
| 14938 } | 15222 } |
| 14939 else if ($ne(expr.type, null)) { | 15223 else if ($notnull_bool($ne(expr.type, null))) { |
| 14940 this._lang_error('expected formal, but found generic type arguments', expr.t
ype.get$span()); | 15224 this._lang_error('expected formal, but found generic type arguments', expr.t
ype.get$span()); |
| 14941 } | 15225 } |
| 14942 return this._makeFormalsFromExpressions(expr.values, false); | 15226 return this._makeFormalsFromExpressions(expr.values, false); |
| 14943 } | 15227 } |
| 14944 lang_Parser.prototype._makeFormals = function(arguments0) { | 15228 lang_Parser.prototype._makeFormals = function(arguments0) { |
| 14945 var expressions = []; | 15229 var expressions = []; |
| 14946 for (var i = 0; | 15230 for (var i = 0; |
| 14947 i < arguments0.length; i++) { | 15231 $notnull_bool(i < arguments0.length); i++) { |
| 14948 var arg = arguments0.$index(i); | 15232 var arg = arguments0.$index(i); |
| 14949 if (arg.label != null) { | 15233 if ($notnull_bool(arg.label != null)) { |
| 14950 this._lang_error('expected formal, but found ":"'); | 15234 this._lang_error('expected formal, but found ":"'); |
| 14951 } | 15235 } |
| 14952 expressions.add(arg.get$value()); | 15236 expressions.add(arg.get$value()); |
| 14953 } | 15237 } |
| 14954 return this._makeFormalsFromExpressions(expressions, true); | 15238 return this._makeFormalsFromExpressions(expressions, true); |
| 14955 } | 15239 } |
| 14956 lang_Parser.prototype._makeFormalsFromExpressions = function(expressions, allowO
ptional) { | 15240 lang_Parser.prototype._makeFormalsFromExpressions = function(expressions, allowO
ptional) { |
| 14957 var formals = []; | 15241 var formals = []; |
| 14958 for (var i = 0; | 15242 for (var i = 0; |
| 14959 i < expressions.length; i++) { | 15243 $notnull_bool(i < expressions.length); i++) { |
| 14960 var formal = this._makeFormal(expressions.$index(i)); | 15244 var formal = this._makeFormal(expressions.$index(i)); |
| 14961 if (formal == null) { | 15245 if ($notnull_bool(formal == null)) { |
| 14962 var baseType = this._makeType(expressions.$index(i).x); | 15246 var baseType = this._makeType(expressions.$index(i).x); |
| 14963 var typeParams = [this._makeType(expressions.$index(i).y)]; | 15247 var typeParams = [this._makeType(expressions.$index(i).y)]; |
| 14964 i++; | 15248 i++; |
| 14965 while (i < expressions.length) { | 15249 while ($notnull_bool(i < expressions.length)) { |
| 14966 var expr = expressions.$index(i++); | 15250 var expr = expressions.$index(i++); |
| 14967 if (this._isBin(expr, 53/*TokenKind.GT*/)) { | 15251 if ($notnull_bool(this._isBin(expr, 53/*TokenKind.GT*/))) { |
| 14968 typeParams.add(this._makeType(expr.x)); | 15252 typeParams.add(this._makeType(expr.x)); |
| 14969 var type0 = new GenericTypeReference(baseType, typeParams, 0, this._ma
keSpan(baseType.get$span().start)); | 15253 var type0 = new GenericTypeReference(baseType, typeParams, 0, this._ma
keSpan(baseType.get$span().start)); |
| 14970 var name = null; | 15254 var name = null; |
| 14971 if ((expr.y instanceof VarExpression)) { | 15255 if ($notnull_bool((expr.y instanceof VarExpression))) { |
| 14972 var ve = expr.y; | 15256 var ve = expr.y; |
| 14973 name = ve.name; | 15257 name = ve.name; |
| 14974 } | 15258 } |
| 14975 else { | 15259 else { |
| 14976 this._lang_error('expected formal', expr.get$span()); | 15260 this._lang_error('expected formal', expr.get$span()); |
| 14977 } | 15261 } |
| 14978 formal = new FormalNode(false, false, type0, name, null, this._makeSpa
n(expressions.$index(0).get$span().start)); | 15262 formal = new FormalNode(false, false, type0, name, null, this._makeSpa
n(expressions.$index(0).get$span().start)); |
| 14979 break; | 15263 break; |
| 14980 } | 15264 } |
| 14981 else { | 15265 else { |
| 14982 typeParams.add(this._makeType(expr)); | 15266 typeParams.add(this._makeType(expr)); |
| 14983 } | 15267 } |
| 14984 } | 15268 } |
| 14985 formals.add(formal); | 15269 formals.add(formal); |
| 14986 } | 15270 } |
| 14987 else if (!!(formal && formal.is$List)) { | 15271 else if ($notnull_bool(!!(formal && formal.is$List))) { |
| 14988 formals.addAll(formal); | 15272 formals.addAll(formal); |
| 14989 if (!allowOptional) { | 15273 if ($notnull_bool(!allowOptional)) { |
| 14990 this._lang_error('unexpected nested optional formal', expressions.$index
(i).get$span()); | 15274 this._lang_error('unexpected nested optional formal', expressions.$index
(i).get$span()); |
| 14991 } | 15275 } |
| 14992 } | 15276 } |
| 14993 else { | 15277 else { |
| 14994 formals.add(formal); | 15278 formals.add(formal); |
| 14995 } | 15279 } |
| 14996 } | 15280 } |
| 14997 return formals; | 15281 return formals; |
| 14998 } | 15282 } |
| 14999 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { | 15283 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { |
| 15000 if ((e instanceof VarExpression)) { | 15284 if ($notnull_bool((e instanceof VarExpression))) { |
| 15001 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); | 15285 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); |
| 15002 } | 15286 } |
| 15003 else if ((e instanceof DeclaredIdentifier)) { | 15287 else if ($notnull_bool((e instanceof DeclaredIdentifier))) { |
| 15004 return e; | 15288 return e; |
| 15005 } | 15289 } |
| 15006 else { | 15290 else { |
| 15007 this._lang_error('expected declared identifier'); | 15291 this._lang_error('expected declared identifier'); |
| 15008 return new DeclaredIdentifier(null, null, e.get$span()); | 15292 return new DeclaredIdentifier(null, null, e.get$span()); |
| 15009 } | 15293 } |
| 15010 } | 15294 } |
| 15011 lang_Parser.prototype._makeLabel = function(expr) { | 15295 lang_Parser.prototype._makeLabel = function(expr) { |
| 15012 if ((expr instanceof VarExpression)) { | 15296 if ($notnull_bool((expr instanceof VarExpression))) { |
| 15013 return expr.get$name(); | 15297 return expr.get$name(); |
| 15014 } | 15298 } |
| 15015 else { | 15299 else { |
| 15016 this._errorExpected('label'); | 15300 this._errorExpected('label'); |
| 15017 return null; | 15301 return null; |
| 15018 } | 15302 } |
| 15019 } | 15303 } |
| 15020 // ********** Code for lang_Node ************** | 15304 // ********** Code for lang_Node ************** |
| 15021 function lang_Node(span) { | 15305 function lang_Node(span) { |
| 15022 this.span = span; | 15306 this.span = span; |
| 15023 // Initializers done | 15307 // Initializers done |
| 15024 } | 15308 } |
| 15309 lang_Node.prototype.is$lang_Node = function(){return this;}; |
| 15025 lang_Node.prototype.get$span = function() { return this.span; }; | 15310 lang_Node.prototype.get$span = function() { return this.span; }; |
| 15026 lang_Node.prototype.set$span = function(value) { return this.span = value; }; | 15311 lang_Node.prototype.set$span = function(value) { return this.span = value; }; |
| 15027 // ********** Code for Definition ************** | 15312 // ********** Code for Definition ************** |
| 15028 function Definition(span0) { | 15313 function Definition(span0) { |
| 15029 lang_Statement.call(this, span0); | 15314 lang_Statement.call(this, span0); |
| 15030 // Initializers done | 15315 // Initializers done |
| 15031 } | 15316 } |
| 15032 $inherits(Definition, lang_Statement); | 15317 $inherits(Definition, lang_Statement); |
| 15318 Definition.prototype.is$Definition = function(){return this;}; |
| 15033 Definition.prototype.get$typeParameters = function() { | 15319 Definition.prototype.get$typeParameters = function() { |
| 15034 return null; | 15320 return null; |
| 15035 } | 15321 } |
| 15036 // ********** Code for lang_Statement ************** | 15322 // ********** Code for lang_Statement ************** |
| 15037 function lang_Statement(span0) { | 15323 function lang_Statement(span0) { |
| 15038 lang_Node.call(this, span0); | 15324 lang_Node.call(this, span0); |
| 15039 // Initializers done | 15325 // Initializers done |
| 15040 } | 15326 } |
| 15041 $inherits(lang_Statement, lang_Node); | 15327 $inherits(lang_Statement, lang_Node); |
| 15328 lang_Statement.prototype.is$lang_Statement = function(){return this;}; |
| 15042 // ********** Code for lang_Expression ************** | 15329 // ********** Code for lang_Expression ************** |
| 15043 function lang_Expression(span0) { | 15330 function lang_Expression(span0) { |
| 15044 lang_Node.call(this, span0); | 15331 lang_Node.call(this, span0); |
| 15045 // Initializers done | 15332 // Initializers done |
| 15046 } | 15333 } |
| 15047 $inherits(lang_Expression, lang_Node); | 15334 $inherits(lang_Expression, lang_Node); |
| 15335 lang_Expression.prototype.is$lang_Expression = function(){return this;}; |
| 15048 // ********** Code for TypeReference ************** | 15336 // ********** Code for TypeReference ************** |
| 15049 function TypeReference(span0, type) { | 15337 function TypeReference(span0, type) { |
| 15050 this.type = type; | 15338 this.type = type; |
| 15051 lang_Node.call(this, span0); | 15339 lang_Node.call(this, span0); |
| 15052 // Initializers done | 15340 // Initializers done |
| 15053 } | 15341 } |
| 15054 $inherits(TypeReference, lang_Node); | 15342 $inherits(TypeReference, lang_Node); |
| 15343 TypeReference.prototype.is$TypeReference = function(){return this;}; |
| 15055 TypeReference.prototype.visit = function(visitor) { | 15344 TypeReference.prototype.visit = function(visitor) { |
| 15056 return visitor.visitTypeReference(this); | 15345 return visitor.visitTypeReference(this); |
| 15057 } | 15346 } |
| 15058 // ********** Code for DirectiveDefinition ************** | 15347 // ********** Code for DirectiveDefinition ************** |
| 15059 function DirectiveDefinition(name, arguments, span0) { | 15348 function DirectiveDefinition(name, arguments, span0) { |
| 15060 this.name = name; | 15349 this.name = name; |
| 15061 this.arguments = arguments; | 15350 this.arguments = arguments; |
| 15062 Definition.call(this, span0); | 15351 Definition.call(this, span0); |
| 15063 // Initializers done | 15352 // Initializers done |
| 15064 } | 15353 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15124 this.modifiers = modifiers; | 15413 this.modifiers = modifiers; |
| 15125 this.returnType = returnType; | 15414 this.returnType = returnType; |
| 15126 this.name = name; | 15415 this.name = name; |
| 15127 this.formals = formals; | 15416 this.formals = formals; |
| 15128 this.initializers = initializers; | 15417 this.initializers = initializers; |
| 15129 this.body = body; | 15418 this.body = body; |
| 15130 Definition.call(this, span0); | 15419 Definition.call(this, span0); |
| 15131 // Initializers done | 15420 // Initializers done |
| 15132 } | 15421 } |
| 15133 $inherits(FunctionDefinition, Definition); | 15422 $inherits(FunctionDefinition, Definition); |
| 15423 FunctionDefinition.prototype.is$FunctionDefinition = function(){return this;}; |
| 15134 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp
e; }; | 15424 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp
e; }; |
| 15135 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu
rnType = value; }; | 15425 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu
rnType = value; }; |
| 15136 FunctionDefinition.prototype.get$name = function() { return this.name; }; | 15426 FunctionDefinition.prototype.get$name = function() { return this.name; }; |
| 15137 FunctionDefinition.prototype.set$name = function(value) { return this.name = val
ue; }; | 15427 FunctionDefinition.prototype.set$name = function(value) { return this.name = val
ue; }; |
| 15138 FunctionDefinition.prototype.visit = function(visitor) { | 15428 FunctionDefinition.prototype.visit = function(visitor) { |
| 15139 return visitor.visitFunctionDefinition(this); | 15429 return visitor.visitFunctionDefinition(this); |
| 15140 } | 15430 } |
| 15141 // ********** Code for ReturnStatement ************** | 15431 // ********** Code for ReturnStatement ************** |
| 15142 function ReturnStatement(value, span0) { | 15432 function ReturnStatement(value, span0) { |
| 15143 this.value = value; | 15433 this.value = value; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15346 return visitor.visitLambdaExpression(this); | 15636 return visitor.visitLambdaExpression(this); |
| 15347 } | 15637 } |
| 15348 // ********** Code for CallExpression ************** | 15638 // ********** Code for CallExpression ************** |
| 15349 function CallExpression(target, arguments, span0) { | 15639 function CallExpression(target, arguments, span0) { |
| 15350 this.target = target; | 15640 this.target = target; |
| 15351 this.arguments = arguments; | 15641 this.arguments = arguments; |
| 15352 lang_Expression.call(this, span0); | 15642 lang_Expression.call(this, span0); |
| 15353 // Initializers done | 15643 // Initializers done |
| 15354 } | 15644 } |
| 15355 $inherits(CallExpression, lang_Expression); | 15645 $inherits(CallExpression, lang_Expression); |
| 15646 CallExpression.prototype.is$CallExpression = function(){return this;}; |
| 15356 CallExpression.prototype.get$arguments = function() { return this.arguments; }; | 15647 CallExpression.prototype.get$arguments = function() { return this.arguments; }; |
| 15357 CallExpression.prototype.set$arguments = function(value) { return this.arguments
= value; }; | 15648 CallExpression.prototype.set$arguments = function(value) { return this.arguments
= value; }; |
| 15358 CallExpression.prototype.visit = function(visitor) { | 15649 CallExpression.prototype.visit = function(visitor) { |
| 15359 return visitor.visitCallExpression(this); | 15650 return visitor.visitCallExpression(this); |
| 15360 } | 15651 } |
| 15361 // ********** Code for IndexExpression ************** | 15652 // ********** Code for IndexExpression ************** |
| 15362 function IndexExpression(target, index, span0) { | 15653 function IndexExpression(target, index, span0) { |
| 15363 this.target = target; | 15654 this.target = target; |
| 15364 this.index = index; | 15655 this.index = index; |
| 15365 lang_Expression.call(this, span0); | 15656 lang_Expression.call(this, span0); |
| 15366 // Initializers done | 15657 // Initializers done |
| 15367 } | 15658 } |
| 15368 $inherits(IndexExpression, lang_Expression); | 15659 $inherits(IndexExpression, lang_Expression); |
| 15660 IndexExpression.prototype.is$IndexExpression = function(){return this;}; |
| 15369 IndexExpression.prototype.visit = function(visitor) { | 15661 IndexExpression.prototype.visit = function(visitor) { |
| 15370 return visitor.visitIndexExpression(this); | 15662 return visitor.visitIndexExpression(this); |
| 15371 } | 15663 } |
| 15372 // ********** Code for BinaryExpression ************** | 15664 // ********** Code for BinaryExpression ************** |
| 15373 function BinaryExpression(op, x, y, span0) { | 15665 function BinaryExpression(op, x, y, span0) { |
| 15374 this.op = op; | 15666 this.op = op; |
| 15375 this.x = x; | 15667 this.x = x; |
| 15376 this.y = y; | 15668 this.y = y; |
| 15377 lang_Expression.call(this, span0); | 15669 lang_Expression.call(this, span0); |
| 15378 // Initializers done | 15670 // Initializers done |
| 15379 } | 15671 } |
| 15380 $inherits(BinaryExpression, lang_Expression); | 15672 $inherits(BinaryExpression, lang_Expression); |
| 15673 BinaryExpression.prototype.is$BinaryExpression = function(){return this;}; |
| 15381 BinaryExpression.prototype.visit = function(visitor) { | 15674 BinaryExpression.prototype.visit = function(visitor) { |
| 15382 return visitor.visitBinaryExpression(this); | 15675 return visitor.visitBinaryExpression(this); |
| 15383 } | 15676 } |
| 15384 // ********** Code for UnaryExpression ************** | 15677 // ********** Code for UnaryExpression ************** |
| 15385 function UnaryExpression(op, self, span0) { | 15678 function UnaryExpression(op, self, span0) { |
| 15386 this.op = op; | 15679 this.op = op; |
| 15387 this.self = self; | 15680 this.self = self; |
| 15388 lang_Expression.call(this, span0); | 15681 lang_Expression.call(this, span0); |
| 15389 // Initializers done | 15682 // Initializers done |
| 15390 } | 15683 } |
| 15391 $inherits(UnaryExpression, lang_Expression); | 15684 $inherits(UnaryExpression, lang_Expression); |
| 15392 UnaryExpression.prototype.visit = function(visitor) { | 15685 UnaryExpression.prototype.visit = function(visitor) { |
| 15393 return visitor.visitUnaryExpression(this); | 15686 return visitor.visitUnaryExpression(this); |
| 15394 } | 15687 } |
| 15395 // ********** Code for PostfixExpression ************** | 15688 // ********** Code for PostfixExpression ************** |
| 15396 function PostfixExpression(body, op, span0) { | 15689 function PostfixExpression(body, op, span0) { |
| 15397 this.body = body; | 15690 this.body = body; |
| 15398 this.op = op; | 15691 this.op = op; |
| 15399 lang_Expression.call(this, span0); | 15692 lang_Expression.call(this, span0); |
| 15400 // Initializers done | 15693 // Initializers done |
| 15401 } | 15694 } |
| 15402 $inherits(PostfixExpression, lang_Expression); | 15695 $inherits(PostfixExpression, lang_Expression); |
| 15696 PostfixExpression.prototype.is$PostfixExpression = function(){return this;}; |
| 15403 PostfixExpression.prototype.visit = function(visitor) { | 15697 PostfixExpression.prototype.visit = function(visitor) { |
| 15404 return visitor.visitPostfixExpression$1(this); | 15698 return visitor.visitPostfixExpression$1(this); |
| 15405 } | 15699 } |
| 15406 // ********** Code for lang_NewExpression ************** | 15700 // ********** Code for lang_NewExpression ************** |
| 15407 function lang_NewExpression(isConst, type, name, arguments, span0) { | 15701 function lang_NewExpression(isConst, type, name, arguments, span0) { |
| 15408 this.isConst = isConst; | 15702 this.isConst = isConst; |
| 15409 this.type = type; | 15703 this.type = type; |
| 15410 this.name = name; | 15704 this.name = name; |
| 15411 this.arguments = arguments; | 15705 this.arguments = arguments; |
| 15412 lang_Expression.call(this, span0); | 15706 lang_Expression.call(this, span0); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15485 return visitor.visitParenExpression(this); | 15779 return visitor.visitParenExpression(this); |
| 15486 } | 15780 } |
| 15487 // ********** Code for DotExpression ************** | 15781 // ********** Code for DotExpression ************** |
| 15488 function DotExpression(self, name, span0) { | 15782 function DotExpression(self, name, span0) { |
| 15489 this.self = self; | 15783 this.self = self; |
| 15490 this.name = name; | 15784 this.name = name; |
| 15491 lang_Expression.call(this, span0); | 15785 lang_Expression.call(this, span0); |
| 15492 // Initializers done | 15786 // Initializers done |
| 15493 } | 15787 } |
| 15494 $inherits(DotExpression, lang_Expression); | 15788 $inherits(DotExpression, lang_Expression); |
| 15789 DotExpression.prototype.is$DotExpression = function(){return this;}; |
| 15495 DotExpression.prototype.get$name = function() { return this.name; }; | 15790 DotExpression.prototype.get$name = function() { return this.name; }; |
| 15496 DotExpression.prototype.set$name = function(value) { return this.name = value; }
; | 15791 DotExpression.prototype.set$name = function(value) { return this.name = value; }
; |
| 15497 DotExpression.prototype.visit = function(visitor) { | 15792 DotExpression.prototype.visit = function(visitor) { |
| 15498 return visitor.visitDotExpression(this); | 15793 return visitor.visitDotExpression(this); |
| 15499 } | 15794 } |
| 15500 // ********** Code for VarExpression ************** | 15795 // ********** Code for VarExpression ************** |
| 15501 function VarExpression(name, span0) { | 15796 function VarExpression(name, span0) { |
| 15502 this.name = name; | 15797 this.name = name; |
| 15503 lang_Expression.call(this, span0); | 15798 lang_Expression.call(this, span0); |
| 15504 // Initializers done | 15799 // Initializers done |
| 15505 } | 15800 } |
| 15506 $inherits(VarExpression, lang_Expression); | 15801 $inherits(VarExpression, lang_Expression); |
| 15802 VarExpression.prototype.is$VarExpression = function(){return this;}; |
| 15507 VarExpression.prototype.get$name = function() { return this.name; }; | 15803 VarExpression.prototype.get$name = function() { return this.name; }; |
| 15508 VarExpression.prototype.set$name = function(value) { return this.name = value; }
; | 15804 VarExpression.prototype.set$name = function(value) { return this.name = value; }
; |
| 15509 VarExpression.prototype.visit = function(visitor) { | 15805 VarExpression.prototype.visit = function(visitor) { |
| 15510 return visitor.visitVarExpression(this); | 15806 return visitor.visitVarExpression(this); |
| 15511 } | 15807 } |
| 15512 // ********** Code for ThisExpression ************** | 15808 // ********** Code for ThisExpression ************** |
| 15513 function ThisExpression(span0) { | 15809 function ThisExpression(span0) { |
| 15514 lang_Expression.call(this, span0); | 15810 lang_Expression.call(this, span0); |
| 15515 // Initializers done | 15811 // Initializers done |
| 15516 } | 15812 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15554 } | 15850 } |
| 15555 // ********** Code for NameTypeReference ************** | 15851 // ********** Code for NameTypeReference ************** |
| 15556 function NameTypeReference(isFinal, name, names, span0) { | 15852 function NameTypeReference(isFinal, name, names, span0) { |
| 15557 this.isFinal = isFinal; | 15853 this.isFinal = isFinal; |
| 15558 this.name = name; | 15854 this.name = name; |
| 15559 this.names = names; | 15855 this.names = names; |
| 15560 TypeReference.call(this, span0); | 15856 TypeReference.call(this, span0); |
| 15561 // Initializers done | 15857 // Initializers done |
| 15562 } | 15858 } |
| 15563 $inherits(NameTypeReference, TypeReference); | 15859 $inherits(NameTypeReference, TypeReference); |
| 15860 NameTypeReference.prototype.is$NameTypeReference = function(){return this;}; |
| 15564 NameTypeReference.prototype.get$name = function() { return this.name; }; | 15861 NameTypeReference.prototype.get$name = function() { return this.name; }; |
| 15565 NameTypeReference.prototype.set$name = function(value) { return this.name = valu
e; }; | 15862 NameTypeReference.prototype.set$name = function(value) { return this.name = valu
e; }; |
| 15566 NameTypeReference.prototype.visit = function(visitor) { | 15863 NameTypeReference.prototype.visit = function(visitor) { |
| 15567 return visitor.visitNameTypeReference(this); | 15864 return visitor.visitNameTypeReference(this); |
| 15568 } | 15865 } |
| 15569 // ********** Code for GenericTypeReference ************** | 15866 // ********** Code for GenericTypeReference ************** |
| 15570 function GenericTypeReference(baseType, typeArguments, depth, span0) { | 15867 function GenericTypeReference(baseType, typeArguments, depth, span0) { |
| 15571 this.baseType = baseType; | 15868 this.baseType = baseType; |
| 15572 this.typeArguments = typeArguments; | 15869 this.typeArguments = typeArguments; |
| 15573 this.depth = depth; | 15870 this.depth = depth; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 15590 return visitor.visitFunctionTypeReference(this); | 15887 return visitor.visitFunctionTypeReference(this); |
| 15591 } | 15888 } |
| 15592 // ********** Code for ArgumentNode ************** | 15889 // ********** Code for ArgumentNode ************** |
| 15593 function ArgumentNode(label, value, span0) { | 15890 function ArgumentNode(label, value, span0) { |
| 15594 this.label = label; | 15891 this.label = label; |
| 15595 this.value = value; | 15892 this.value = value; |
| 15596 lang_Node.call(this, span0); | 15893 lang_Node.call(this, span0); |
| 15597 // Initializers done | 15894 // Initializers done |
| 15598 } | 15895 } |
| 15599 $inherits(ArgumentNode, lang_Node); | 15896 $inherits(ArgumentNode, lang_Node); |
| 15897 ArgumentNode.prototype.is$ArgumentNode = function(){return this;}; |
| 15600 ArgumentNode.prototype.get$value = function() { return this.value; }; | 15898 ArgumentNode.prototype.get$value = function() { return this.value; }; |
| 15601 ArgumentNode.prototype.set$value = function(value) { return this.value = value;
}; | 15899 ArgumentNode.prototype.set$value = function(value) { return this.value = value;
}; |
| 15602 ArgumentNode.prototype.visit = function(visitor) { | 15900 ArgumentNode.prototype.visit = function(visitor) { |
| 15603 return visitor.visitArgumentNode(this); | 15901 return visitor.visitArgumentNode(this); |
| 15604 } | 15902 } |
| 15605 // ********** Code for FormalNode ************** | 15903 // ********** Code for FormalNode ************** |
| 15606 function FormalNode(isThis, isRest, type, name, value, span0) { | 15904 function FormalNode(isThis, isRest, type, name, value, span0) { |
| 15607 this.isThis = isThis; | 15905 this.isThis = isThis; |
| 15608 this.isRest = isRest; | 15906 this.isRest = isRest; |
| 15609 this.type = type; | 15907 this.type = type; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15672 return visitor.visitIdentifier(this); | 15970 return visitor.visitIdentifier(this); |
| 15673 } | 15971 } |
| 15674 // ********** Code for DeclaredIdentifier ************** | 15972 // ********** Code for DeclaredIdentifier ************** |
| 15675 function DeclaredIdentifier(type, name, span0) { | 15973 function DeclaredIdentifier(type, name, span0) { |
| 15676 this.type = type; | 15974 this.type = type; |
| 15677 this.name = name; | 15975 this.name = name; |
| 15678 lang_Expression.call(this, span0); | 15976 lang_Expression.call(this, span0); |
| 15679 // Initializers done | 15977 // Initializers done |
| 15680 } | 15978 } |
| 15681 $inherits(DeclaredIdentifier, lang_Expression); | 15979 $inherits(DeclaredIdentifier, lang_Expression); |
| 15980 DeclaredIdentifier.prototype.is$DeclaredIdentifier = function(){return this;}; |
| 15682 DeclaredIdentifier.prototype.get$name = function() { return this.name; }; | 15981 DeclaredIdentifier.prototype.get$name = function() { return this.name; }; |
| 15683 DeclaredIdentifier.prototype.set$name = function(value) { return this.name = val
ue; }; | 15982 DeclaredIdentifier.prototype.set$name = function(value) { return this.name = val
ue; }; |
| 15684 DeclaredIdentifier.prototype.visit = function(visitor) { | 15983 DeclaredIdentifier.prototype.visit = function(visitor) { |
| 15685 return visitor.visitDeclaredIdentifier(this); | 15984 return visitor.visitDeclaredIdentifier(this); |
| 15686 } | 15985 } |
| 15687 // ********** Code for lang_Type ************** | 15986 // ********** Code for lang_Type ************** |
| 15688 function lang_Type(name) { | 15987 function lang_Type(name) { |
| 15689 this.name = name; | 15988 this.name = name; |
| 15690 this.isTested = false; | 15989 this.isTested = false; |
| 15691 // Initializers done | 15990 // Initializers done |
| 15692 } | 15991 } |
| 15992 lang_Type.prototype.is$lang_Type = function(){return this;}; |
| 15993 lang_Type.prototype.is$Named = function(){return this;}; |
| 15693 lang_Type.prototype.get$name = function() { return this.name; }; | 15994 lang_Type.prototype.get$name = function() { return this.name; }; |
| 15694 lang_Type.prototype.markUsed = function() { | 15995 lang_Type.prototype.markUsed = function() { |
| 15695 | 15996 |
| 15696 } | 15997 } |
| 15697 lang_Type.prototype.get$typeMember = function() { | 15998 lang_Type.prototype.get$typeMember = function() { |
| 15698 if (this._typeMember == null) { | 15999 var $0; |
| 15699 this._typeMember = new TypeMember(this); | 16000 if ($notnull_bool(this._typeMember == null)) { |
| 16001 this._typeMember = new TypeMember((($0 = this) && $0.is$DefinedType())); |
| 15700 } | 16002 } |
| 15701 return this._typeMember; | 16003 return this._typeMember; |
| 15702 } | 16004 } |
| 15703 lang_Type.prototype.getMember = function(name0) { | 16005 lang_Type.prototype.getMember = function(name0) { |
| 15704 return null; | 16006 return null; |
| 15705 } | 16007 } |
| 15706 lang_Type.prototype.get$isVar = function() { | 16008 lang_Type.prototype.get$isVar = function() { |
| 15707 return false; | 16009 return false; |
| 15708 } | 16010 } |
| 15709 lang_Type.prototype.get$isTop = function() { | 16011 lang_Type.prototype.get$isTop = function() { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15751 lang_Type.prototype.get$isNative = function() { | 16053 lang_Type.prototype.get$isNative = function() { |
| 15752 return this.get$isNativeType(); | 16054 return this.get$isNativeType(); |
| 15753 } | 16055 } |
| 15754 lang_Type.prototype.get$hasTypeParams = function() { | 16056 lang_Type.prototype.get$hasTypeParams = function() { |
| 15755 return false; | 16057 return false; |
| 15756 } | 16058 } |
| 15757 lang_Type.prototype.get$typeofName = function() { | 16059 lang_Type.prototype.get$typeofName = function() { |
| 15758 return null; | 16060 return null; |
| 15759 } | 16061 } |
| 15760 lang_Type.prototype.get$jsname = function() { | 16062 lang_Type.prototype.get$jsname = function() { |
| 15761 return this._jsname == null ? this.name : this._jsname; | 16063 return $notnull_bool(this._jsname == null) ? this.name : this._jsname; |
| 15762 } | 16064 } |
| 15763 lang_Type.prototype.set$jsname = function(name0) { | 16065 lang_Type.prototype.set$jsname = function(name0) { |
| 15764 return this._jsname = name0; | 16066 return this._jsname = name0; |
| 15765 } | 16067 } |
| 15766 lang_Type.prototype.get$typeArgsInOrder = function() { | 16068 lang_Type.prototype.get$typeArgsInOrder = function() { |
| 15767 return null; | 16069 return null; |
| 15768 } | 16070 } |
| 15769 lang_Type.prototype.get$genericType = function() { | 16071 lang_Type.prototype.get$genericType = function() { |
| 15770 return this; | 16072 return this; |
| 15771 } | 16073 } |
| 15772 lang_Type.prototype.get$interfaces = function() { | 16074 lang_Type.prototype.get$interfaces = function() { |
| 15773 return null; | 16075 return null; |
| 15774 } | 16076 } |
| 15775 lang_Type.prototype.get$parent = function() { | 16077 lang_Type.prototype.get$parent = function() { |
| 15776 return null; | 16078 return null; |
| 15777 } | 16079 } |
| 15778 lang_Type.prototype.getAllMembers = function() { | 16080 lang_Type.prototype.getAllMembers = function() { |
| 15779 return $map([]); | 16081 return $map([]); |
| 15780 } | 16082 } |
| 15781 lang_Type.prototype.hashCode = function() { | 16083 lang_Type.prototype.hashCode = function() { |
| 15782 return this.name.hashCode(); | 16084 return this.name.hashCode(); |
| 15783 } | 16085 } |
| 15784 lang_Type.prototype.ensureSubtypeOf = function(other, span0, typeErrors) { | 16086 lang_Type.prototype.ensureSubtypeOf = function(other, span0, typeErrors) { |
| 15785 if (!this.isSubtypeOf(other)) { | 16087 if ($notnull_bool(!this.isSubtypeOf(other))) { |
| 15786 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name + ''); | 16088 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name + ''); |
| 15787 if (typeErrors) { | 16089 if ($notnull_bool(typeErrors)) { |
| 15788 world.error(msg, span0); | 16090 world.error($assert_String(msg), span0); |
| 15789 } | 16091 } |
| 15790 else { | 16092 else { |
| 15791 world.warning(msg, span0); | 16093 world.warning($assert_String(msg), span0); |
| 15792 } | 16094 } |
| 15793 } | 16095 } |
| 15794 } | 16096 } |
| 15795 lang_Type.prototype.needsVarCall = function(args) { | 16097 lang_Type.prototype.needsVarCall = function(args) { |
| 15796 if (this.get$isVarOrFunction()) { | 16098 if ($notnull_bool(this.get$isVarOrFunction())) { |
| 15797 return true; | 16099 return true; |
| 15798 } | 16100 } |
| 15799 var call = this.getCallMethod(); | 16101 var call = this.getCallMethod(); |
| 15800 if ($ne(call, null)) { | 16102 if ($notnull_bool($ne(call, null))) { |
| 15801 if (args.get$length() != call.get$parameters().length || !call.namesInOrder(
args)) { | 16103 if ($notnull_bool(args.get$length() != call.get$parameters().length || !call
.namesInOrder(args))) { |
| 15802 return true; | 16104 return true; |
| 15803 } | 16105 } |
| 15804 } | 16106 } |
| 15805 return false; | 16107 return false; |
| 15806 } | 16108 } |
| 15807 lang_Type.union = function(x, y) { | 16109 lang_Type.union = function(x, y) { |
| 15808 if ($eq(x, y)) return x; | 16110 if ($notnull_bool($eq(x, y))) return x; |
| 15809 if (x.get$isNum() && y.get$isNum()) return world.numType; | 16111 if ($notnull_bool(x.get$isNum() && y.get$isNum())) return world.numType; |
| 15810 if (x.get$isString() && y.get$isString()) return world.stringType; | 16112 if ($notnull_bool(x.get$isString() && y.get$isString())) return world.stringTy
pe; |
| 15811 return world.varType; | 16113 return world.varType; |
| 15812 } | 16114 } |
| 15813 lang_Type.prototype.isAssignable = function(other) { | 16115 lang_Type.prototype.isAssignable = function(other) { |
| 15814 return this.isSubtypeOf(other) || other.isSubtypeOf(this); | 16116 return this.isSubtypeOf(other) || other.isSubtypeOf(this); |
| 15815 } | 16117 } |
| 15816 lang_Type.prototype._isDirectSupertypeOf = function(other) { | 16118 lang_Type.prototype._isDirectSupertypeOf = function(other) { |
| 15817 var $this = this; // closure support | 16119 var $this = this; // closure support |
| 15818 if (other.get$isClass()) { | 16120 if ($notnull_bool(other.get$isClass())) { |
| 15819 return $eq(other.get$parent(), this) || this.get$isObject() && other.get$par
ent() == null; | 16121 return $eq(other.get$parent(), this) || this.get$isObject() && other.get$par
ent() == null; |
| 15820 } | 16122 } |
| 15821 else { | 16123 else { |
| 15822 if (other.get$interfaces() == null || other.get$interfaces().isEmpty()) { | 16124 if ($notnull_bool(other.get$interfaces() == null || other.get$interfaces().i
sEmpty())) { |
| 15823 return this.get$isObject(); | 16125 return this.get$isObject(); |
| 15824 } | 16126 } |
| 15825 else { | 16127 else { |
| 15826 return other.get$interfaces().some((function (i) { | 16128 return other.get$interfaces().some((function (i) { |
| 15827 return $eq(i, $this); | 16129 return $eq(i, $this); |
| 15828 }) | 16130 }) |
| 15829 ); | 16131 ); |
| 15830 } | 16132 } |
| 15831 } | 16133 } |
| 15832 } | 16134 } |
| 15833 lang_Type.prototype.isSubtypeOf = function(other) { | 16135 lang_Type.prototype.isSubtypeOf = function(other) { |
| 15834 if ((other instanceof ParameterType)) { | 16136 if ($notnull_bool((other instanceof ParameterType))) { |
| 15835 return true; | 16137 return true; |
| 15836 } | 16138 } |
| 15837 if ($eq(this, other)) return true; | 16139 if ($notnull_bool($eq(this, other))) return true; |
| 15838 if (this.get$isVar()) return true; | 16140 if ($notnull_bool(this.get$isVar())) return true; |
| 15839 if (other.get$isVar()) return true; | 16141 if ($notnull_bool(other.get$isVar())) return true; |
| 15840 if (other._isDirectSupertypeOf(this)) return true; | 16142 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true; |
| 15841 var call = this.getCallMethod(); | 16143 var call = this.getCallMethod(); |
| 15842 var otherCall = other.getCallMethod(); | 16144 var otherCall = other.getCallMethod(); |
| 15843 if ($ne(call, null) && $ne(otherCall, null)) { | 16145 if ($notnull_bool($ne(call, null) && $ne(otherCall, null))) { |
| 15844 return lang_Type._isFunctionSubtypeOf(call, otherCall); | 16146 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth
erCall && otherCall.is$MethodMember())); |
| 15845 } | 16147 } |
| 15846 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) { | 16148 if ($notnull_bool($eq(this.get$genericType(), other.get$genericType()) && $ne(
this.get$typeArgsInOrder(), null) && $ne(other.get$typeArgsInOrder(), null) && t
his.get$typeArgsInOrder().length == other.get$typeArgsInOrder().length)) { |
| 15847 var t = this.get$typeArgsInOrder().iterator(); | 16149 var t = this.get$typeArgsInOrder().iterator(); |
| 15848 var s = other.get$typeArgsInOrder().iterator(); | 16150 var s = other.get$typeArgsInOrder().iterator(); |
| 15849 while (t.hasNext()) { | 16151 while ($notnull_bool(t.hasNext())) { |
| 15850 if (!t.next().isSubtypeOf(s.next())) return false; | 16152 if ($notnull_bool(!t.next().isSubtypeOf(s.next()))) return false; |
| 15851 } | 16153 } |
| 15852 return true; | 16154 return true; |
| 15853 } | 16155 } |
| 15854 if (this.get$parent() != null && this.get$parent().isSubtypeOf(other)) { | 16156 if ($notnull_bool(this.get$parent() != null && this.get$parent().isSubtypeOf(o
ther))) { |
| 15855 return true; | 16157 return true; |
| 15856 } | 16158 } |
| 15857 if (this.get$interfaces() != null && this.get$interfaces().some((function (i)
{ | 16159 if ($notnull_bool(this.get$interfaces() != null && this.get$interfaces().some(
(function (i) { |
| 15858 return i.isSubtypeOf(other); | 16160 return i.isSubtypeOf(other); |
| 15859 }) | 16161 }) |
| 15860 )) { | 16162 ))) { |
| 15861 return true; | 16163 return true; |
| 15862 } | 16164 } |
| 15863 return false; | 16165 return false; |
| 15864 } | 16166 } |
| 15865 lang_Type._isFunctionSubtypeOf = function(t, s) { | 16167 lang_Type._isFunctionSubtypeOf = function(t, s) { |
| 15866 if (!s.returnType.get$isVoid() && !s.returnType.isAssignable(t.returnType)) { | 16168 var $0; |
| 16169 if ($notnull_bool(!s.returnType.get$isVoid() && !s.returnType.isAssignable(t.r
eturnType))) { |
| 15867 return false; | 16170 return false; |
| 15868 } | 16171 } |
| 15869 var tp = t.parameters; | 16172 var tp = t.parameters; |
| 15870 var sp = s.parameters; | 16173 var sp = s.parameters; |
| 15871 if (tp.length < sp.length) return false; | 16174 if ($notnull_bool(tp.length < sp.length)) return false; |
| 15872 for (var i = 0; | 16175 for (var i = 0; |
| 15873 i < sp.length; i++) { | 16176 $notnull_bool(i < sp.length); i++) { |
| 15874 if ($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOptional())) retur
n false; | 16177 if ($notnull_bool($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOpti
onal()))) return false; |
| 15875 if (tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name(), sp.$index(
i).get$name())) return false; | 16178 if ($notnull_bool(tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name
(), sp.$index(i).get$name()))) return false; |
| 15876 if (!tp.$index(i).type.isAssignable(sp.$index(i).type)) return false; | 16179 if ($notnull_bool(!tp.$index(i).type.isAssignable((($0 = sp.$index(i).type)
&& $0.is$lang_Type())))) return false; |
| 15877 } | 16180 } |
| 15878 if (tp.length > sp.length && !tp.$index(sp.length).get$isOptional()) return fa
lse; | 16181 if ($notnull_bool(tp.length > sp.length && !tp.$index(sp.length).get$isOptiona
l())) return false; |
| 15879 return true; | 16182 return true; |
| 15880 } | 16183 } |
| 15881 // ********** Code for ParameterType ************** | 16184 // ********** Code for ParameterType ************** |
| 15882 function ParameterType(name0, typeParameter) { | 16185 function ParameterType(name0, typeParameter) { |
| 15883 this.typeParameter = typeParameter; | 16186 this.typeParameter = typeParameter; |
| 15884 lang_Type.call(this, name0); | 16187 lang_Type.call(this, name0); |
| 15885 // Initializers done | 16188 // Initializers done |
| 15886 } | 16189 } |
| 15887 $inherits(ParameterType, lang_Type); | 16190 $inherits(ParameterType, lang_Type); |
| 15888 ParameterType.prototype.get$isClass = function() { | 16191 ParameterType.prototype.get$isClass = function() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 15906 ParameterType.prototype.resolveMember = function(memberName) { | 16209 ParameterType.prototype.resolveMember = function(memberName) { |
| 15907 return this.extendsType.resolveMember(memberName); | 16210 return this.extendsType.resolveMember(memberName); |
| 15908 } | 16211 } |
| 15909 ParameterType.prototype.getConstructor = function(constructorName) { | 16212 ParameterType.prototype.getConstructor = function(constructorName) { |
| 15910 world.internalError('no constructors on type parameters yet'); | 16213 world.internalError('no constructors on type parameters yet'); |
| 15911 } | 16214 } |
| 15912 ParameterType.prototype.resolveTypeParams = function(inType) { | 16215 ParameterType.prototype.resolveTypeParams = function(inType) { |
| 15913 return inType.typeArguments.$index(this.name); | 16216 return inType.typeArguments.$index(this.name); |
| 15914 } | 16217 } |
| 15915 ParameterType.prototype.resolve = function(inType) { | 16218 ParameterType.prototype.resolve = function(inType) { |
| 15916 if (this.typeParameter.extendsType != null) { | 16219 if ($notnull_bool(this.typeParameter.extendsType != null)) { |
| 15917 this.extendsType = inType.resolveType(this.typeParameter.extendsType, true); | 16220 this.extendsType = inType.resolveType(this.typeParameter.extendsType, true); |
| 15918 } | 16221 } |
| 15919 else { | 16222 else { |
| 15920 this.extendsType = world.objectType; | 16223 this.extendsType = world.objectType; |
| 15921 } | 16224 } |
| 15922 } | 16225 } |
| 15923 // ********** Code for ConcreteType ************** | 16226 // ********** Code for ConcreteType ************** |
| 15924 function ConcreteType(name0, genericType, typeArguments, typeArgsInOrder) { | 16227 function ConcreteType(name0, genericType, typeArguments, typeArgsInOrder) { |
| 15925 this.genericType = genericType; | 16228 this.genericType = genericType; |
| 15926 this.typeArguments = typeArguments; | 16229 this.typeArguments = typeArguments; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 15953 }) | 16256 }) |
| 15954 ); | 16257 ); |
| 15955 } | 16258 } |
| 15956 ConcreteType.prototype.resolveTypeParams = function(inType) { | 16259 ConcreteType.prototype.resolveTypeParams = function(inType) { |
| 15957 var newTypeArgs = []; | 16260 var newTypeArgs = []; |
| 15958 var needsNewType = false; | 16261 var needsNewType = false; |
| 15959 var $list = this.typeArgsInOrder; | 16262 var $list = this.typeArgsInOrder; |
| 15960 for (var $i = 0;$i < $list.length; $i++) { | 16263 for (var $i = 0;$i < $list.length; $i++) { |
| 15961 var t = $list.$index($i); | 16264 var t = $list.$index($i); |
| 15962 var newType = t.resolveTypeParams(inType); | 16265 var newType = t.resolveTypeParams(inType); |
| 15963 if ($ne(newType, t)) needsNewType = true; | 16266 if ($notnull_bool($ne(newType, t))) needsNewType = true; |
| 15964 newTypeArgs.add(newType); | 16267 newTypeArgs.add(newType); |
| 15965 } | 16268 } |
| 15966 if (!needsNewType) return this; | 16269 if ($notnull_bool(!needsNewType)) return this; |
| 15967 return this.genericType.getOrMakeConcreteType(newTypeArgs); | 16270 return this.genericType.getOrMakeConcreteType(newTypeArgs); |
| 15968 } | 16271 } |
| 15969 ConcreteType.prototype.getOrMakeConcreteType = function(typeArgs) { | 16272 ConcreteType.prototype.getOrMakeConcreteType = function(typeArgs) { |
| 15970 return this.genericType.getOrMakeConcreteType(typeArgs); | 16273 return this.genericType.getOrMakeConcreteType(typeArgs); |
| 15971 } | 16274 } |
| 15972 ConcreteType.prototype.get$parent = function() { | 16275 ConcreteType.prototype.get$parent = function() { |
| 15973 return this.genericType.get$parent(); | 16276 return this.genericType.get$parent(); |
| 15974 } | 16277 } |
| 15975 ConcreteType.prototype.get$interfaces = function() { | 16278 ConcreteType.prototype.get$interfaces = function() { |
| 15976 if (this._interfaces == null && this.genericType.get$interfaces() != null) { | 16279 if ($notnull_bool(this._interfaces == null && this.genericType.get$interfaces(
) != null)) { |
| 15977 this._interfaces = []; | 16280 this._interfaces = []; |
| 15978 var $list = this.genericType.get$interfaces(); | 16281 var $list = this.genericType.get$interfaces(); |
| 15979 for (var $i = 0;$i < $list.length; $i++) { | 16282 for (var $i = 0;$i < $list.length; $i++) { |
| 15980 var i = $list.$index($i); | 16283 var i = $list.$index($i); |
| 15981 this._interfaces.add(i.resolveTypeParams(this)); | 16284 this._interfaces.add(i.resolveTypeParams(this)); |
| 15982 } | 16285 } |
| 15983 } | 16286 } |
| 15984 return this._interfaces; | 16287 return this._interfaces; |
| 15985 } | 16288 } |
| 15986 ConcreteType.prototype.getCallMethod = function() { | 16289 ConcreteType.prototype.getCallMethod = function() { |
| 15987 return this.genericType.getCallMethod(); | 16290 return this.genericType.getCallMethod(); |
| 15988 } | 16291 } |
| 15989 ConcreteType.prototype.getAllMembers = function() { | 16292 ConcreteType.prototype.getAllMembers = function() { |
| 16293 var $0; |
| 15990 var result = this.genericType.getAllMembers(); | 16294 var result = this.genericType.getAllMembers(); |
| 15991 var $list = result.getKeys(); | 16295 var $list = result.getKeys(); |
| 15992 for (var $i = result.getKeys().iterator(); $i.hasNext(); ) { | 16296 for (var $i = result.getKeys().iterator(); $i.hasNext(); ) { |
| 15993 var memberName = $i.next(); | 16297 var memberName = $i.next(); |
| 15994 var myMember = this.members.$index(memberName); | 16298 var myMember = this.members.$index(memberName); |
| 15995 if ($ne(myMember, null)) { | 16299 if ($notnull_bool($ne(myMember, null))) { |
| 15996 result.$setindex(memberName, myMember); | 16300 result.$setindex(memberName, myMember); |
| 15997 } | 16301 } |
| 15998 } | 16302 } |
| 15999 return result; | 16303 return result; |
| 16000 } | 16304 } |
| 16001 ConcreteType.prototype.markUsed = function() { | 16305 ConcreteType.prototype.markUsed = function() { |
| 16002 this.genericType.markUsed(); | 16306 this.genericType.markUsed(); |
| 16003 } | 16307 } |
| 16004 ConcreteType.prototype.genMethod = function(method) { | 16308 ConcreteType.prototype.genMethod = function(method) { |
| 16005 this.genericType.genMethod(method); | 16309 this.genericType.genMethod(method); |
| 16006 } | 16310 } |
| 16007 ConcreteType.prototype.getFactory = function(type, constructorName) { | 16311 ConcreteType.prototype.getFactory = function(type, constructorName) { |
| 16008 return this.genericType.getFactory(type, constructorName); | 16312 return this.genericType.getFactory(type, constructorName); |
| 16009 } | 16313 } |
| 16010 ConcreteType.prototype.getConstructor = function(constructorName) { | 16314 ConcreteType.prototype.getConstructor = function(constructorName) { |
| 16011 var ret = this.constructors.$index(constructorName); | 16315 var ret = this.constructors.$index(constructorName); |
| 16012 if ($ne(ret, null)) return ret; | 16316 if ($notnull_bool($ne(ret, null))) return ret; |
| 16013 ret = this.factories.getFactory(this.name, constructorName); | 16317 ret = this.factories.getFactory(this.name, constructorName); |
| 16014 if ($ne(ret, null)) return ret; | 16318 if ($notnull_bool($ne(ret, null))) return ret; |
| 16015 var genericMember = this.genericType.getConstructor(constructorName); | 16319 var genericMember = this.genericType.getConstructor(constructorName); |
| 16016 if (genericMember == null) return null; | 16320 if ($notnull_bool(genericMember == null)) return null; |
| 16017 if ($ne(genericMember.declaringType, this.genericType)) { | 16321 if ($notnull_bool($ne(genericMember.declaringType, this.genericType))) { |
| 16018 if (!genericMember.declaringType.get$isGeneric()) return genericMember; | 16322 if ($notnull_bool(!genericMember.declaringType.get$isGeneric())) return gene
ricMember; |
| 16019 var newDeclaringType = genericMember.declaringType.getOrMakeConcreteType(thi
s.typeArgsInOrder); | 16323 var newDeclaringType = genericMember.declaringType.getOrMakeConcreteType(thi
s.typeArgsInOrder); |
| 16020 return newDeclaringType.getConstructor(constructorName); | 16324 return newDeclaringType.getConstructor(constructorName); |
| 16021 } | 16325 } |
| 16022 if (genericMember.get$isFactory()) { | 16326 if ($notnull_bool(genericMember.get$isFactory())) { |
| 16023 ret = new ConcreteMember(genericMember.get$name(), this, genericMember); | 16327 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gen
ericMember); |
| 16024 this.factories.addFactory(this.name, constructorName, ret); | 16328 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member(
))); |
| 16025 } | 16329 } |
| 16026 else { | 16330 else { |
| 16027 ret = new ConcreteMember(this.name, this, genericMember); | 16331 ret = new ConcreteMember(this.name, this, genericMember); |
| 16028 this.constructors.$setindex(constructorName, ret); | 16332 this.constructors.$setindex(constructorName, ret); |
| 16029 } | 16333 } |
| 16030 return ret; | 16334 return ret; |
| 16031 } | 16335 } |
| 16032 ConcreteType.prototype.getMember = function(memberName) { | 16336 ConcreteType.prototype.getMember = function(memberName) { |
| 16033 var ret = this.members.$index(memberName); | 16337 var ret = this.members.$index(memberName); |
| 16034 if ($ne(ret, null)) return ret; | 16338 if ($notnull_bool($ne(ret, null))) return ret; |
| 16035 var genericMember = this.genericType.getMember(memberName); | 16339 var genericMember = this.genericType.getMember(memberName); |
| 16036 if (genericMember == null) return null; | 16340 if ($notnull_bool(genericMember == null)) return null; |
| 16037 ret = new ConcreteMember(genericMember.get$name(), this, genericMember); | 16341 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gener
icMember); |
| 16038 this.members.$setindex(memberName, ret); | 16342 this.members.$setindex(memberName, ret); |
| 16039 return ret; | 16343 return ret; |
| 16040 } | 16344 } |
| 16041 ConcreteType.prototype.resolveMember = function(memberName) { | 16345 ConcreteType.prototype.resolveMember = function(memberName) { |
| 16346 var $0; |
| 16042 var mem = this.getMember(memberName); | 16347 var mem = this.getMember(memberName); |
| 16043 if (mem == null) return null; | 16348 if ($notnull_bool(mem == null)) return null; |
| 16044 var ret = new MemberSet(mem); | 16349 var ret = new MemberSet((mem && mem.is$Member())); |
| 16045 if (mem.get$isStatic()) return ret; | 16350 if ($notnull_bool(mem.get$isStatic())) return ret; |
| 16046 var $list = this.genericType.get$subtypes(); | 16351 var $list = this.genericType.get$subtypes(); |
| 16047 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext(); ) { | 16352 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext(); ) { |
| 16048 var t = $i.next(); | 16353 var t = $i.next(); |
| 16049 var m = t.members.$index(memberName); | 16354 var m = t.members.$index(memberName); |
| 16050 if ($ne(m, null)) ret.add(m); | 16355 if ($notnull_bool($ne(m, null))) ret.add(m); |
| 16051 } | 16356 } |
| 16052 return ret; | 16357 return ret; |
| 16053 } | 16358 } |
| 16054 ConcreteType.prototype.resolveType = function(node, isRequired) { | 16359 ConcreteType.prototype.resolveType = function(node, isRequired) { |
| 16055 var ret = this.genericType.resolveType(node, isRequired); | 16360 var ret = this.genericType.resolveType(node, isRequired); |
| 16056 return ret; | 16361 return ret; |
| 16057 } | 16362 } |
| 16058 ConcreteType.prototype.addDirectSubtype = function(type) { | 16363 ConcreteType.prototype.addDirectSubtype = function(type) { |
| 16059 this.genericType.addDirectSubtype(type); | 16364 this.genericType.addDirectSubtype(type); |
| 16060 } | 16365 } |
| 16061 // ********** Code for DefinedType ************** | 16366 // ********** Code for DefinedType ************** |
| 16062 function DefinedType(name0, library, definition0, isClass) { | 16367 function DefinedType(name0, library, definition0, isClass) { |
| 16063 this.isUsed = false | 16368 this.isUsed = false |
| 16064 this.isNativeType = false | 16369 this.isNativeType = false |
| 16065 this.library = library; | 16370 this.library = library; |
| 16066 this.isClass = isClass; | 16371 this.isClass = isClass; |
| 16067 this.directSubtypes = new HashSetImplementation$Type(); | 16372 this.directSubtypes = new HashSetImplementation$Type(); |
| 16068 this.constructors = $map([]); | 16373 this.constructors = $map([]); |
| 16069 this.members = $map([]); | 16374 this.members = $map([]); |
| 16070 this.factories = new FactoryMap(); | 16375 this.factories = new FactoryMap(); |
| 16071 this._resolvedMembers = $map([]); | 16376 this._resolvedMembers = $map([]); |
| 16072 lang_Type.call(this, name0); | 16377 lang_Type.call(this, name0); |
| 16073 // Initializers done | 16378 // Initializers done |
| 16074 this.setDefinition(definition0); | 16379 this.setDefinition(definition0); |
| 16075 } | 16380 } |
| 16076 $inherits(DefinedType, lang_Type); | 16381 $inherits(DefinedType, lang_Type); |
| 16382 DefinedType.prototype.is$DefinedType = function(){return this;}; |
| 16077 DefinedType.prototype.get$definition = function() { return this.definition; }; | 16383 DefinedType.prototype.get$definition = function() { return this.definition; }; |
| 16078 DefinedType.prototype.set$definition = function(value) { return this.definition
= value; }; | 16384 DefinedType.prototype.set$definition = function(value) { return this.definition
= value; }; |
| 16079 DefinedType.prototype.get$library = function() { return this.library; }; | 16385 DefinedType.prototype.get$library = function() { return this.library; }; |
| 16080 DefinedType.prototype.get$isClass = function() { return this.isClass; }; | 16386 DefinedType.prototype.get$isClass = function() { return this.isClass; }; |
| 16081 DefinedType.prototype.get$parent = function() { return this.parent; }; | 16387 DefinedType.prototype.get$parent = function() { return this.parent; }; |
| 16082 DefinedType.prototype.set$parent = function(value) { return this.parent = value;
}; | 16388 DefinedType.prototype.set$parent = function(value) { return this.parent = value;
}; |
| 16083 DefinedType.prototype.get$interfaces = function() { return this.interfaces; }; | 16389 DefinedType.prototype.get$interfaces = function() { return this.interfaces; }; |
| 16084 DefinedType.prototype.set$interfaces = function(value) { return this.interfaces
= value; }; | 16390 DefinedType.prototype.set$interfaces = function(value) { return this.interfaces
= value; }; |
| 16085 DefinedType.prototype.get$typeParameters = function() { return this.typeParamete
rs; }; | 16391 DefinedType.prototype.get$typeParameters = function() { return this.typeParamete
rs; }; |
| 16086 DefinedType.prototype.set$typeParameters = function(value) { return this.typePar
ameters = value; }; | 16392 DefinedType.prototype.set$typeParameters = function(value) { return this.typePar
ameters = value; }; |
| 16087 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; | 16393 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; |
| 16088 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value;
}; | 16394 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value;
}; |
| 16089 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType;
}; | 16395 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType;
}; |
| 16090 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT
ype = value; }; | 16396 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT
ype = value; }; |
| 16091 DefinedType.prototype.setDefinition = function(def) { | 16397 DefinedType.prototype.setDefinition = function(def) { |
| 16398 $assert(this.definition == null, "definition == null", "type.dart", 541, 12); |
| 16092 this.definition = def; | 16399 this.definition = def; |
| 16093 if ((this.definition instanceof TypeDefinition) && this.definition.nativeType
!= null) { | 16400 if ($notnull_bool((this.definition instanceof TypeDefinition) && this.definiti
on.nativeType != null)) { |
| 16094 this.isNativeType = true; | 16401 this.isNativeType = true; |
| 16095 } | 16402 } |
| 16096 if (this.definition != null && this.definition.get$typeParameters() != null) { | 16403 if ($notnull_bool(this.definition != null && this.definition.get$typeParameter
s() != null)) { |
| 16097 this._concreteTypes = $map([]); | 16404 this._concreteTypes = $map([]); |
| 16098 this.typeParameters = []; | 16405 this.typeParameters = []; |
| 16099 var $list = this.definition.get$typeParameters(); | 16406 var $list = this.definition.get$typeParameters(); |
| 16100 for (var $i = 0;$i < $list.length; $i++) { | 16407 for (var $i = 0;$i < $list.length; $i++) { |
| 16101 var tp = $list.$index($i); | 16408 var tp = $list.$index($i); |
| 16102 var paramName = tp.get$name().get$name(); | 16409 var paramName = tp.get$name().get$name(); |
| 16103 this.typeParameters.add(new ParameterType(paramName, tp)); | 16410 this.typeParameters.add(new ParameterType($assert_String(paramName), tp)); |
| 16104 } | 16411 } |
| 16105 } | 16412 } |
| 16106 } | 16413 } |
| 16107 DefinedType.prototype.get$typeArgsInOrder = function() { | 16414 DefinedType.prototype.get$typeArgsInOrder = function() { |
| 16108 if (this.typeParameters == null) return null; | 16415 if ($notnull_bool(this.typeParameters == null)) return null; |
| 16109 if (this._typeArgsInOrder == null) { | 16416 if ($notnull_bool(this._typeArgsInOrder == null)) { |
| 16110 this._typeArgsInOrder = new FixedCollection$Type(world.varType, this.typePar
ameters.length); | 16417 this._typeArgsInOrder = new FixedCollection$Type(world.varType, this.typePar
ameters.length); |
| 16111 } | 16418 } |
| 16112 return this._typeArgsInOrder; | 16419 return this._typeArgsInOrder; |
| 16113 } | 16420 } |
| 16114 DefinedType.prototype.get$isVar = function() { | 16421 DefinedType.prototype.get$isVar = function() { |
| 16115 return $eq(this, world.varType); | 16422 return $eq(this, world.varType); |
| 16116 } | 16423 } |
| 16117 DefinedType.prototype.get$isVoid = function() { | 16424 DefinedType.prototype.get$isVoid = function() { |
| 16118 return $eq(this, world.voidType); | 16425 return $eq(this, world.voidType); |
| 16119 } | 16426 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 16132 DefinedType.prototype.get$isFunction = function() { | 16439 DefinedType.prototype.get$isFunction = function() { |
| 16133 return this.library.get$isCore() && this.name == 'Function'; | 16440 return this.library.get$isCore() && this.name == 'Function'; |
| 16134 } | 16441 } |
| 16135 DefinedType.prototype.get$isList = function() { | 16442 DefinedType.prototype.get$isList = function() { |
| 16136 return this.library.get$isCore() && this.name == 'List'; | 16443 return this.library.get$isCore() && this.name == 'List'; |
| 16137 } | 16444 } |
| 16138 DefinedType.prototype.get$isGeneric = function() { | 16445 DefinedType.prototype.get$isGeneric = function() { |
| 16139 return this.typeParameters != null; | 16446 return this.typeParameters != null; |
| 16140 } | 16447 } |
| 16141 DefinedType.prototype.get$span = function() { | 16448 DefinedType.prototype.get$span = function() { |
| 16142 return this.definition == null ? null : this.definition.span; | 16449 return $notnull_bool(this.definition == null) ? null : this.definition.span; |
| 16143 } | 16450 } |
| 16144 DefinedType.prototype.get$typeofName = function() { | 16451 DefinedType.prototype.get$typeofName = function() { |
| 16145 if (!this.library.get$isCore()) return null; | 16452 if ($notnull_bool(!this.library.get$isCore())) return null; |
| 16146 if (this.get$isBool()) return 'boolean'; | 16453 if ($notnull_bool(this.get$isBool())) return 'boolean'; |
| 16147 else if (this.get$isNum()) return 'number'; | 16454 else if ($notnull_bool(this.get$isNum())) return 'number'; |
| 16148 else if (this.get$isString()) return 'string'; | 16455 else if ($notnull_bool(this.get$isString())) return 'string'; |
| 16149 else if (this.get$isFunction()) return 'function'; | 16456 else if ($notnull_bool(this.get$isFunction())) return 'function'; |
| 16150 else return null; | 16457 else return null; |
| 16151 } | 16458 } |
| 16152 DefinedType.prototype.get$isNum = function() { | 16459 DefinedType.prototype.get$isNum = function() { |
| 16153 return this.library != null && this.library.get$isCore() && (this.name == 'num
' || this.name == 'int' || this.name == 'double'); | 16460 return this.library != null && this.library.get$isCore() && (this.name == 'num
' || this.name == 'int' || this.name == 'double'); |
| 16154 } | 16461 } |
| 16155 DefinedType.prototype.getCallMethod = function() { | 16462 DefinedType.prototype.getCallMethod = function() { |
| 16156 return this.members.$index('\$call'); | 16463 return this.members.$index('\$call'); |
| 16157 } | 16464 } |
| 16158 DefinedType.prototype.getAllMembers = function() { | 16465 DefinedType.prototype.getAllMembers = function() { |
| 16159 return HashMapImplementation.HashMapImplementation$from$factory(this.members); | 16466 return HashMapImplementation.HashMapImplementation$from$factory(this.members); |
| 16160 } | 16467 } |
| 16161 DefinedType.prototype.markUsed = function() { | 16468 DefinedType.prototype.markUsed = function() { |
| 16162 if (this.isUsed) return; | 16469 if ($notnull_bool(this.isUsed)) return; |
| 16163 this.isUsed = true; | 16470 this.isUsed = true; |
| 16164 if (this._lazyGenMethods != null) { | 16471 if ($notnull_bool(this._lazyGenMethods != null)) { |
| 16165 var $list = orderValuesByKeys(this._lazyGenMethods); | 16472 var $list = orderValuesByKeys(this._lazyGenMethods); |
| 16166 for (var $i = 0;$i < $list.length; $i++) { | 16473 for (var $i = 0;$i < $list.length; $i++) { |
| 16167 var method = $list.$index($i); | 16474 var method = $list.$index($i); |
| 16168 world.gen.genMethod(method); | 16475 world.gen.genMethod((method && method.is$Member())); |
| 16169 } | 16476 } |
| 16170 this._lazyGenMethods = null; | 16477 this._lazyGenMethods = null; |
| 16171 } | 16478 } |
| 16172 if (this.parent != null) this.parent.markUsed(); | 16479 if ($notnull_bool(this.parent != null)) this.parent.markUsed(); |
| 16173 } | 16480 } |
| 16174 DefinedType.prototype.genMethod = function(method) { | 16481 DefinedType.prototype.genMethod = function(method) { |
| 16175 if (this.isUsed) { | 16482 if ($notnull_bool(this.isUsed)) { |
| 16176 world.gen.genMethod(method); | 16483 world.gen.genMethod(method); |
| 16177 } | 16484 } |
| 16178 else if (this.isClass) { | 16485 else if ($notnull_bool(this.isClass)) { |
| 16179 if (this._lazyGenMethods == null) this._lazyGenMethods = $map([]); | 16486 if ($notnull_bool(this._lazyGenMethods == null)) this._lazyGenMethods = $map
([]); |
| 16180 this._lazyGenMethods.$setindex(method.name, method); | 16487 this._lazyGenMethods.$setindex(method.name, method); |
| 16181 } | 16488 } |
| 16182 } | 16489 } |
| 16183 DefinedType.prototype._resolveInterfaces = function(types) { | 16490 DefinedType.prototype._resolveInterfaces = function(types) { |
| 16184 if (types == null) return []; | 16491 if ($notnull_bool(types == null)) return []; |
| 16185 var interfaces0 = []; | 16492 var interfaces0 = []; |
| 16186 for (var $i = 0;$i < types.length; $i++) { | 16493 for (var $i = 0;$i < types.length; $i++) { |
| 16187 var type = types.$index($i); | 16494 var type = types.$index($i); |
| 16188 var resolvedInterface = this.resolveType(type, true); | 16495 var resolvedInterface = this.resolveType((type && type.is$TypeReference()),
true); |
| 16189 if (resolvedInterface.get$isClosed() && !(this.library.get$isCore() || this.
library.get$isCoreImpl())) { | 16496 if ($notnull_bool(resolvedInterface.get$isClosed() && !(this.library.get$isC
ore() || this.library.get$isCoreImpl()))) { |
| 16190 world.error(('can not implement "' + resolvedInterface.get$name() + '": ')
+ 'only native implementation allowed', type.get$span()); | 16497 world.error(('can not implement "' + resolvedInterface.get$name() + '": ')
+ 'only native implementation allowed', type.get$span()); |
| 16191 } | 16498 } |
| 16192 resolvedInterface.addDirectSubtype(this); | 16499 resolvedInterface.addDirectSubtype(this); |
| 16193 interfaces0.add(resolvedInterface); | 16500 interfaces0.add(resolvedInterface); |
| 16194 } | 16501 } |
| 16195 return interfaces0; | 16502 return interfaces0; |
| 16196 } | 16503 } |
| 16197 DefinedType.prototype.addDirectSubtype = function(type) { | 16504 DefinedType.prototype.addDirectSubtype = function(type) { |
| 16505 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 657, 12); |
| 16198 this.directSubtypes.add(type); | 16506 this.directSubtypes.add(type); |
| 16199 } | 16507 } |
| 16200 DefinedType.prototype.get$subtypes = function() { | 16508 DefinedType.prototype.get$subtypes = function() { |
| 16201 if (this._subtypes == null) { | 16509 var $0; |
| 16510 if ($notnull_bool(this._subtypes == null)) { |
| 16202 this._subtypes = new HashSetImplementation$Type(); | 16511 this._subtypes = new HashSetImplementation$Type(); |
| 16203 var $list = this.directSubtypes; | 16512 var $list = this.directSubtypes; |
| 16204 for (var $i = this.directSubtypes.iterator(); $i.hasNext(); ) { | 16513 for (var $i = this.directSubtypes.iterator(); $i.hasNext(); ) { |
| 16205 var st = $i.next(); | 16514 var st = $i.next(); |
| 16206 this._subtypes.add(st); | 16515 this._subtypes.add(st); |
| 16207 this._subtypes.addAll(st.get$subtypes()); | 16516 this._subtypes.addAll(st.get$subtypes()); |
| 16208 } | 16517 } |
| 16209 } | 16518 } |
| 16210 return this._subtypes; | 16519 return this._subtypes; |
| 16211 } | 16520 } |
| 16212 DefinedType.prototype._cycleInClassExtends = function() { | 16521 DefinedType.prototype._cycleInClassExtends = function() { |
| 16213 var seen = new HashSetImplementation(); | 16522 var seen = new HashSetImplementation(); |
| 16214 seen.add(this); | 16523 seen.add(this); |
| 16215 var ancestor = this.parent; | 16524 var ancestor = this.parent; |
| 16216 while ($ne(ancestor, null)) { | 16525 while ($notnull_bool($ne(ancestor, null))) { |
| 16217 if (ancestor === this) { | 16526 if ($notnull_bool(ancestor === this)) { |
| 16218 return true; | 16527 return true; |
| 16219 } | 16528 } |
| 16220 if (seen.contains(ancestor)) { | 16529 if ($notnull_bool(seen.contains(ancestor))) { |
| 16221 return false; | 16530 return false; |
| 16222 } | 16531 } |
| 16223 seen.add(ancestor); | 16532 seen.add(ancestor); |
| 16224 ancestor = ancestor.get$parent(); | 16533 ancestor = ancestor.get$parent(); |
| 16225 } | 16534 } |
| 16226 return false; | 16535 return false; |
| 16227 } | 16536 } |
| 16228 DefinedType.prototype._cycleInInterfaceExtends = function() { | 16537 DefinedType.prototype._cycleInInterfaceExtends = function() { |
| 16229 var $this = this; // closure support | 16538 var $this = this; // closure support |
| 16230 var seen = new HashSetImplementation(); | 16539 var seen = new HashSetImplementation(); |
| 16231 seen.add(this); | 16540 seen.add(this); |
| 16232 function _helper(ancestor) { | 16541 function _helper(ancestor) { |
| 16233 if (ancestor == null) return false; | 16542 if ($notnull_bool(ancestor == null)) return false; |
| 16234 if (ancestor === $this) return true; | 16543 if ($notnull_bool(ancestor === $this)) return true; |
| 16235 if (seen.contains(ancestor)) { | 16544 if ($notnull_bool(seen.contains(ancestor))) { |
| 16236 return false; | 16545 return false; |
| 16237 } | 16546 } |
| 16238 seen.add(ancestor); | 16547 seen.add(ancestor); |
| 16239 if (ancestor.get$interfaces() != null) { | 16548 if ($notnull_bool(ancestor.get$interfaces() != null)) { |
| 16240 var $list = ancestor.get$interfaces(); | 16549 var $list = ancestor.get$interfaces(); |
| 16241 for (var $i = 0;$i < $list.length; $i++) { | 16550 for (var $i = 0;$i < $list.length; $i++) { |
| 16242 var parent0 = $list.$index($i); | 16551 var parent0 = $list.$index($i); |
| 16243 if (_helper(parent0)) return true; | 16552 if ($notnull_bool(_helper(parent0))) return true; |
| 16244 } | 16553 } |
| 16245 } | 16554 } |
| 16246 return false; | 16555 return false; |
| 16247 } | 16556 } |
| 16248 for (var i = 0; | 16557 for (var i = 0; |
| 16249 i < this.interfaces.length; i++) { | 16558 $notnull_bool(i < this.interfaces.length); i++) { |
| 16250 if (_helper(this.interfaces.$index(i))) return i; | 16559 if ($notnull_bool(_helper(this.interfaces.$index(i)))) return i; |
| 16251 } | 16560 } |
| 16252 return -1; | 16561 return -1; |
| 16253 } | 16562 } |
| 16254 DefinedType.prototype.resolve = function() { | 16563 DefinedType.prototype.resolve = function() { |
| 16255 var $this = this; // closure support | 16564 var $this = this; // closure support |
| 16256 if ((this.definition instanceof TypeDefinition)) { | 16565 var $0; |
| 16257 if (this.isClass) { | 16566 if ($notnull_bool((this.definition instanceof TypeDefinition))) { |
| 16258 if (this.definition.extendsTypes != null && this.definition.extendsTypes.l
ength > 0) { | 16567 if ($notnull_bool(this.isClass)) { |
| 16259 if (this.definition.extendsTypes.length > 1) { | 16568 if ($notnull_bool(this.definition.extendsTypes != null && this.definition.
extendsTypes.length > 0)) { |
| 16569 if ($notnull_bool(this.definition.extendsTypes.length > 1)) { |
| 16260 world.error('more than one base class', this.definition.extendsTypes.$
index(1).get$span()); | 16570 world.error('more than one base class', this.definition.extendsTypes.$
index(1).get$span()); |
| 16261 } | 16571 } |
| 16262 var extendsTypeRef = this.definition.extendsTypes.$index(0); | 16572 var extendsTypeRef = this.definition.extendsTypes.$index(0); |
| 16263 if ((extendsTypeRef instanceof GenericTypeReference)) { | 16573 if ($notnull_bool((extendsTypeRef instanceof GenericTypeReference))) { |
| 16264 var g = extendsTypeRef; | 16574 var g = extendsTypeRef; |
| 16265 this.parent = this.resolveType(g.baseType, true); | 16575 this.parent = this.resolveType(g.baseType, true); |
| 16266 } | 16576 } |
| 16267 this.parent = this.resolveType(extendsTypeRef, true); | 16577 this.parent = this.resolveType((extendsTypeRef && extendsTypeRef.is$Type
Reference()), true); |
| 16268 if (!this.parent.get$isClass()) { | 16578 if ($notnull_bool(!this.parent.get$isClass())) { |
| 16269 world.error('class may not extend an interface - use implements', this
.definition.extendsTypes.$index(0).get$span()); | 16579 world.error('class may not extend an interface - use implements', this
.definition.extendsTypes.$index(0).get$span()); |
| 16270 } | 16580 } |
| 16271 this.parent.addDirectSubtype(this); | 16581 this.parent.addDirectSubtype(this); |
| 16272 if (this._cycleInClassExtends()) { | 16582 if ($notnull_bool(this._cycleInClassExtends())) { |
| 16273 world.error(('class "' + this.name + '" has a cycle in its inheritance
chain'), extendsTypeRef.get$span()); | 16583 world.error(('class "' + this.name + '" has a cycle in its inheritance
chain'), extendsTypeRef.get$span()); |
| 16274 } | 16584 } |
| 16275 } | 16585 } |
| 16276 else { | 16586 else { |
| 16277 if (!this.get$isObject()) { | 16587 if ($notnull_bool(!this.get$isObject())) { |
| 16278 this.parent = world.objectType; | 16588 this.parent = world.objectType; |
| 16279 } | 16589 } |
| 16280 } | 16590 } |
| 16281 this.interfaces = this._resolveInterfaces(this.definition.implementsTypes)
; | 16591 this.interfaces = this._resolveInterfaces(this.definition.implementsTypes)
; |
| 16282 if (this.definition.factoryType != null) { | 16592 if ($notnull_bool(this.definition.factoryType != null)) { |
| 16283 world.error('factory not allowed on classes', this.definition.factoryTyp
e.span); | 16593 world.error('factory not allowed on classes', this.definition.factoryTyp
e.span); |
| 16284 } | 16594 } |
| 16285 } | 16595 } |
| 16286 else { | 16596 else { |
| 16287 if (this.definition.implementsTypes != null && this.definition.implementsT
ypes.length > 0) { | 16597 if ($notnull_bool(this.definition.implementsTypes != null && this.definiti
on.implementsTypes.length > 0)) { |
| 16288 world.error('implements not allowed on interfaces (use extends)', this.d
efinition.implementsTypes.$index(0).get$span()); | 16598 world.error('implements not allowed on interfaces (use extends)', this.d
efinition.implementsTypes.$index(0).get$span()); |
| 16289 } | 16599 } |
| 16290 this.interfaces = this._resolveInterfaces(this.definition.extendsTypes); | 16600 this.interfaces = this._resolveInterfaces(this.definition.extendsTypes); |
| 16291 var res = this._cycleInInterfaceExtends(); | 16601 var res = this._cycleInInterfaceExtends(); |
| 16292 if (res >= 0) { | 16602 if ($notnull_bool(res >= 0)) { |
| 16293 world.error(('interface "' + this.name + '" has a cycle in its inheritan
ce chain'), this.definition.extendsTypes.$index(res).get$span()); | 16603 world.error(('interface "' + this.name + '" has a cycle in its inheritan
ce chain'), this.definition.extendsTypes.$index(res).get$span()); |
| 16294 } | 16604 } |
| 16295 if (this.definition.factoryType != null) { | 16605 if ($notnull_bool(this.definition.factoryType != null)) { |
| 16296 this.factory_ = this.resolveType(this.definition.factoryType, true); | 16606 this.factory_ = this.resolveType(this.definition.factoryType, true); |
| 16297 if (this.factory_ == null) { | 16607 if ($notnull_bool(this.factory_ == null)) { |
| 16298 world.info(('unresolved factory: ' + this.definition.factoryType.get$n
ame().get$name() + ''), this.definition.factoryType.get$name().get$span()); | 16608 world.info(('unresolved factory: ' + this.definition.factoryType.get$n
ame().get$name() + ''), this.definition.factoryType.get$name().get$span()); |
| 16299 } | 16609 } |
| 16300 } | 16610 } |
| 16301 } | 16611 } |
| 16302 } | 16612 } |
| 16303 else if ((this.definition instanceof FunctionTypeDefinition)) { | 16613 else if ($notnull_bool((this.definition instanceof FunctionTypeDefinition))) { |
| 16304 this.interfaces = [world.functionType]; | 16614 this.interfaces = [world.functionType]; |
| 16305 } | 16615 } |
| 16306 if (this.typeParameters != null) { | 16616 if ($notnull_bool(this.typeParameters != null)) { |
| 16307 var $list = this.typeParameters; | 16617 var $list = this.typeParameters; |
| 16308 for (var $i = 0;$i < $list.length; $i++) { | 16618 for (var $i = 0;$i < $list.length; $i++) { |
| 16309 var tp = $list.$index($i); | 16619 var tp = $list.$index($i); |
| 16310 tp.resolve(this); | 16620 tp.resolve(this); |
| 16311 } | 16621 } |
| 16312 } | 16622 } |
| 16313 world._addType(this); | 16623 world._addType(this); |
| 16314 var $list = this.constructors.getValues(); | 16624 var $list = this.constructors.getValues(); |
| 16315 for (var $i = this.constructors.getValues().iterator(); $i.hasNext(); ) { | 16625 for (var $i = this.constructors.getValues().iterator(); $i.hasNext(); ) { |
| 16316 var c = $i.next(); | 16626 var c = $i.next(); |
| 16317 c.resolve(this); | 16627 c.resolve(this); |
| 16318 } | 16628 } |
| 16319 var $list0 = this.members.getValues(); | 16629 var $list0 = this.members.getValues(); |
| 16320 for (var $i = this.members.getValues().iterator(); $i.hasNext(); ) { | 16630 for (var $i = this.members.getValues().iterator(); $i.hasNext(); ) { |
| 16321 var m = $i.next(); | 16631 var m = $i.next(); |
| 16322 m.resolve(this); | 16632 m.resolve(this); |
| 16323 } | 16633 } |
| 16324 this.factories.forEach((function (f) { | 16634 this.factories.forEach((function (f) { |
| 16325 return f.resolve($this); | 16635 return f.resolve($this); |
| 16326 }) | 16636 }) |
| 16327 ); | 16637 ); |
| 16328 } | 16638 } |
| 16329 DefinedType.prototype.addMethod = function(methodName, definition0) { | 16639 DefinedType.prototype.addMethod = function(methodName, definition0) { |
| 16330 if (methodName == null) methodName = definition0.name.name; | 16640 if ($notnull_bool(methodName == null)) methodName = definition0.name.name; |
| 16331 var method = new MethodMember(methodName, this, definition0); | 16641 var method = new MethodMember(methodName, this, definition0); |
| 16332 if (method.get$isConstructor()) { | 16642 if ($notnull_bool(method.get$isConstructor())) { |
| 16333 if (this.constructors.containsKey(method.get$constructorName())) { | 16643 if ($notnull_bool(this.constructors.containsKey(method.get$constructorName()
))) { |
| 16334 world.error(('duplicate constructor definition of ' + method.get$name() +
''), definition0.span); | 16644 world.error(('duplicate constructor definition of ' + method.get$name() +
''), definition0.span); |
| 16335 return; | 16645 return; |
| 16336 } | 16646 } |
| 16337 this.constructors.$setindex(method.get$constructorName(), method); | 16647 this.constructors.$setindex(method.get$constructorName(), method); |
| 16338 return; | 16648 return; |
| 16339 } | 16649 } |
| 16340 if (definition0.modifiers != null && definition0.modifiers.length == 1 && defi
nition0.modifiers.$index(0).kind == 74/*TokenKind.FACTORY*/) { | 16650 if ($notnull_bool(definition0.modifiers != null && definition0.modifiers.lengt
h == 1 && definition0.modifiers.$index(0).kind == 75/*TokenKind.FACTORY*/)) { |
| 16341 if (this.factories.getFactory(method.get$constructorName(), method.get$name(
)) != null) { | 16651 if ($notnull_bool(this.factories.getFactory(method.get$constructorName(), $a
ssert_String(method.get$name())) != null)) { |
| 16342 world.error(('duplicate factory definition of ' + method.get$name() + ''),
definition0.span); | 16652 world.error(('duplicate factory definition of ' + method.get$name() + ''),
definition0.span); |
| 16343 return; | 16653 return; |
| 16344 } | 16654 } |
| 16345 this.factories.addFactory(method.get$constructorName(), method.get$name(), m
ethod); | 16655 this.factories.addFactory(method.get$constructorName(), $assert_String(metho
d.get$name()), (method && method.is$Member())); |
| 16346 return; | 16656 return; |
| 16347 } | 16657 } |
| 16348 if (methodName.startsWith('get\$') || methodName.startsWith('set\$')) { | 16658 if ($notnull_bool(methodName.startsWith('get\$') || methodName.startsWith('set
\$'))) { |
| 16349 var propName = methodName.substring(4); | 16659 var propName = methodName.substring(4); |
| 16350 var prop = this.members.$index(propName); | 16660 var prop = this.members.$index(propName); |
| 16351 if (prop == null) { | 16661 if ($notnull_bool(prop == null)) { |
| 16352 prop = new PropertyMember(propName, this); | 16662 prop = new PropertyMember($assert_String(propName), this); |
| 16353 this.members.$setindex(propName, prop); | 16663 this.members.$setindex(propName, prop); |
| 16354 } | 16664 } |
| 16355 if (!(prop instanceof PropertyMember)) { | 16665 if ($notnull_bool(!(prop instanceof PropertyMember))) { |
| 16356 world.error(('property conflicts with field name: ' + propName + ''), defi
nition0.span); | 16666 world.error(('property conflicts with field name: ' + propName + ''), defi
nition0.span); |
| 16357 return; | 16667 return; |
| 16358 } | 16668 } |
| 16359 if (methodName[0] == 'g') { | 16669 if ($notnull_bool(methodName[0] == 'g')) { |
| 16360 if (prop.getter != null) { | 16670 if ($notnull_bool(prop.getter != null)) { |
| 16361 world.error(('duplicate getter definition for ' + propName + ''), defini
tion0.span); | 16671 world.error(('duplicate getter definition for ' + propName + ''), defini
tion0.span); |
| 16362 } | 16672 } |
| 16363 prop.getter = method; | 16673 prop.getter = (method && method.is$MethodMember()); |
| 16364 } | 16674 } |
| 16365 else { | 16675 else { |
| 16366 if (prop.setter != null) { | 16676 if ($notnull_bool(prop.setter != null)) { |
| 16367 world.error(('duplicate setter definition for ' + propName + ''), defini
tion0.span); | 16677 world.error(('duplicate setter definition for ' + propName + ''), defini
tion0.span); |
| 16368 } | 16678 } |
| 16369 prop.setter = method; | 16679 prop.setter = (method && method.is$MethodMember()); |
| 16370 } | 16680 } |
| 16371 return; | 16681 return; |
| 16372 } | 16682 } |
| 16373 if (this.members.containsKey(methodName)) { | 16683 if ($notnull_bool(this.members.containsKey(methodName))) { |
| 16374 world.error(('duplicate method definition of ' + method.get$name() + ''), de
finition0.span); | 16684 world.error(('duplicate method definition of ' + method.get$name() + ''), de
finition0.span); |
| 16375 return; | 16685 return; |
| 16376 } | 16686 } |
| 16377 this.members.$setindex(methodName, method); | 16687 this.members.$setindex(methodName, method); |
| 16378 } | 16688 } |
| 16379 DefinedType.prototype.addField = function(definition0) { | 16689 DefinedType.prototype.addField = function(definition0) { |
| 16380 for (var i = 0; | 16690 for (var i = 0; |
| 16381 i < definition0.names.length; i++) { | 16691 $notnull_bool(i < definition0.names.length); i++) { |
| 16382 var name0 = definition0.names.$index(i).get$name(); | 16692 var name0 = definition0.names.$index(i).get$name(); |
| 16383 if (this.members.containsKey(name0)) { | 16693 if ($notnull_bool(this.members.containsKey(name0))) { |
| 16384 world.error(('duplicate field definition of ' + name0 + ''), definition0.s
pan); | 16694 world.error(('duplicate field definition of ' + name0 + ''), definition0.s
pan); |
| 16385 return; | 16695 return; |
| 16386 } | 16696 } |
| 16387 var value = null; | 16697 var value = null; |
| 16388 if (definition0.values != null) { | 16698 if ($notnull_bool(definition0.values != null)) { |
| 16389 value = definition0.values.$index(i); | 16699 value = definition0.values.$index(i); |
| 16390 } | 16700 } |
| 16391 var field = new FieldMember(name0, this, definition0, value); | 16701 var field = new FieldMember($assert_String(name0), this, definition0, value)
; |
| 16392 this.members.$setindex(name0, field); | 16702 this.members.$setindex(name0, field); |
| 16393 if (this.isNativeType) { | 16703 if ($notnull_bool(this.isNativeType)) { |
| 16394 field.isNative = true; | 16704 field.isNative = true; |
| 16395 } | 16705 } |
| 16396 } | 16706 } |
| 16397 } | 16707 } |
| 16398 DefinedType.prototype.getFactory = function(type, constructorName) { | 16708 DefinedType.prototype.getFactory = function(type, constructorName) { |
| 16399 var ret = this.factories.getFactory(type.name, constructorName); | 16709 var ret = this.factories.getFactory(type.name, constructorName); |
| 16400 if ($ne(ret, null)) return ret; | 16710 if ($notnull_bool($ne(ret, null))) return ret; |
| 16401 ret = this.factories.getFactory(this.name, constructorName); | 16711 ret = this.factories.getFactory(this.name, constructorName); |
| 16402 if ($ne(ret, null)) return ret; | 16712 if ($notnull_bool($ne(ret, null))) return ret; |
| 16403 ret = this.constructors.$index(constructorName); | 16713 ret = this.constructors.$index(constructorName); |
| 16404 if ($ne(ret, null)) return ret; | 16714 if ($notnull_bool($ne(ret, null))) return ret; |
| 16405 return this._tryCreateDefaultConstructor(constructorName); | 16715 return this._tryCreateDefaultConstructor(constructorName); |
| 16406 } | 16716 } |
| 16407 DefinedType.prototype.getConstructor = function(constructorName) { | 16717 DefinedType.prototype.getConstructor = function(constructorName) { |
| 16408 var ret = this.constructors.$index(constructorName); | 16718 var ret = this.constructors.$index(constructorName); |
| 16409 if ($ne(ret, null)) { | 16719 if ($notnull_bool($ne(ret, null))) { |
| 16410 if (this.factory_ != null) { | 16720 if ($notnull_bool(this.factory_ != null)) { |
| 16411 return this.factory_.getFactory(this, constructorName); | 16721 return this.factory_.getFactory(this, constructorName); |
| 16412 } | 16722 } |
| 16413 return ret; | 16723 return ret; |
| 16414 } | 16724 } |
| 16415 ret = this.factories.getFactory(this.name, constructorName); | 16725 ret = this.factories.getFactory(this.name, constructorName); |
| 16416 if ($ne(ret, null)) return ret; | 16726 if ($notnull_bool($ne(ret, null))) return ret; |
| 16417 return this._tryCreateDefaultConstructor(constructorName); | 16727 return this._tryCreateDefaultConstructor(constructorName); |
| 16418 } | 16728 } |
| 16419 DefinedType.prototype._tryCreateDefaultConstructor = function(name0) { | 16729 DefinedType.prototype._tryCreateDefaultConstructor = function(name0) { |
| 16420 if (name0 == '' && this.definition != null && this.isClass && this.constructor
s.get$length() == 0) { | 16730 if ($notnull_bool(name0 == '' && this.definition != null && this.isClass && th
is.constructors.get$length() == 0)) { |
| 16421 var span0 = this.definition.span; | 16731 var span0 = this.definition.span; |
| 16422 var inits = null, body = null; | 16732 var inits = null, body = null; |
| 16423 if (this.isNativeType) { | 16733 if ($notnull_bool(this.isNativeType)) { |
| 16424 body = new NativeStatement(null, span0); | 16734 body = new NativeStatement(null, (span0 && span0.is$SourceSpan())); |
| 16425 inits = null; | 16735 inits = null; |
| 16426 } | 16736 } |
| 16427 else { | 16737 else { |
| 16428 body = null; | 16738 body = null; |
| 16429 inits = [new CallExpression(new SuperExpression(span0), [], span0)]; | 16739 inits = [new CallExpression(new SuperExpression((span0 && span0.is$SourceS
pan())), [], (span0 && span0.is$SourceSpan()))]; |
| 16430 } | 16740 } |
| 16431 var c = new FunctionDefinition(null, null, this.definition.get$name(), [], i
nits, body, span0); | 16741 var c = new FunctionDefinition(null, null, this.definition.get$name(), [], i
nits, body, (span0 && span0.is$SourceSpan())); |
| 16432 this.addMethod(null, c); | 16742 this.addMethod(null, (c && c.is$FunctionDefinition())); |
| 16433 this.constructors.$index('').resolve(this); | 16743 this.constructors.$index('').resolve(this); |
| 16434 return this.constructors.$index(''); | 16744 return this.constructors.$index(''); |
| 16435 } | 16745 } |
| 16436 return null; | 16746 return null; |
| 16437 } | 16747 } |
| 16438 DefinedType.prototype.getMember = function(memberName) { | 16748 DefinedType.prototype.getMember = function(memberName) { |
| 16439 var member = this.members.$index(memberName); | 16749 var member = this.members.$index(memberName); |
| 16440 if (member != null) { | 16750 if ($notnull_bool(member != null)) { |
| 16441 var parentMember = this.getMemberInParents(memberName); | 16751 var parentMember = this.getMemberInParents(memberName); |
| 16442 if ($ne(parentMember, null)) { | 16752 if ($notnull_bool($ne(parentMember, null))) { |
| 16443 if (!member.get$isPrivate() || $eq(member.get$library(), parentMember.get$
library())) { | 16753 if ($notnull_bool(!member.get$isPrivate() || $eq(member.get$library(), par
entMember.get$library()))) { |
| 16444 member.override(parentMember); | 16754 member.override(parentMember); |
| 16445 } | 16755 } |
| 16446 } | 16756 } |
| 16447 return member; | 16757 return member; |
| 16448 } | 16758 } |
| 16449 if (this.get$isTop()) { | 16759 if ($notnull_bool(this.get$isTop())) { |
| 16450 var libType = this.library.findTypeByName(memberName); | 16760 var libType = this.library.findTypeByName(memberName); |
| 16451 if ($ne(libType, null)) { | 16761 if ($notnull_bool($ne(libType, null))) { |
| 16452 return libType.get$typeMember(); | 16762 return libType.get$typeMember(); |
| 16453 } | 16763 } |
| 16454 } | 16764 } |
| 16455 return this.getMemberInParents(memberName); | 16765 return this.getMemberInParents(memberName); |
| 16456 } | 16766 } |
| 16457 DefinedType.prototype.getMemberInParents = function(memberName) { | 16767 DefinedType.prototype.getMemberInParents = function(memberName) { |
| 16458 if (this.isClass) { | 16768 if ($notnull_bool(this.isClass)) { |
| 16459 if (this.parent != null) { | 16769 if ($notnull_bool(this.parent != null)) { |
| 16460 return this.parent.getMember(memberName); | 16770 return this.parent.getMember(memberName); |
| 16461 } | 16771 } |
| 16462 else if (this.get$isObject()) { | 16772 else if ($notnull_bool(this.get$isObject())) { |
| 16463 if (memberName == '\$ne') { | 16773 if ($notnull_bool(memberName == '\$ne')) { |
| 16464 var ret = this._createNotEqualMember(); | 16774 var ret = this._createNotEqualMember(); |
| 16465 this.members.$setindex(memberName, ret); | 16775 this.members.$setindex(memberName, ret); |
| 16466 return ret; | 16776 return ret; |
| 16467 } | 16777 } |
| 16468 return null; | 16778 return null; |
| 16469 } | 16779 } |
| 16470 } | 16780 } |
| 16471 else { | 16781 else { |
| 16472 if (this.interfaces != null && this.interfaces.length > 0) { | 16782 if ($notnull_bool(this.interfaces != null && this.interfaces.length > 0)) { |
| 16473 var $list = this.interfaces; | 16783 var $list = this.interfaces; |
| 16474 for (var $i = 0;$i < $list.length; $i++) { | 16784 for (var $i = 0;$i < $list.length; $i++) { |
| 16475 var i = $list.$index($i); | 16785 var i = $list.$index($i); |
| 16476 var ret = i.getMember(memberName); | 16786 var ret = i.getMember(memberName); |
| 16477 if ($ne(ret, null)) { | 16787 if ($notnull_bool($ne(ret, null))) { |
| 16478 return ret; | 16788 return ret; |
| 16479 } | 16789 } |
| 16480 } | 16790 } |
| 16481 return null; | 16791 return null; |
| 16482 } | 16792 } |
| 16483 else { | 16793 else { |
| 16484 return world.objectType.getMember(memberName); | 16794 return world.objectType.getMember(memberName); |
| 16485 } | 16795 } |
| 16486 } | 16796 } |
| 16487 } | 16797 } |
| 16488 DefinedType.prototype.resolveMember = function(memberName) { | 16798 DefinedType.prototype.resolveMember = function(memberName) { |
| 16799 var $0; |
| 16489 var ret = this._resolvedMembers.$index(memberName); | 16800 var ret = this._resolvedMembers.$index(memberName); |
| 16490 if (ret != null) return ret; | 16801 if ($notnull_bool(ret != null)) return ret; |
| 16491 var member = this.getMember(memberName); | 16802 var member = this.getMember(memberName); |
| 16492 if (member == null) { | 16803 if ($notnull_bool(member == null)) { |
| 16493 return null; | 16804 return null; |
| 16494 } | 16805 } |
| 16495 ret = new MemberSet(member); | 16806 ret = new MemberSet(member); |
| 16496 this._resolvedMembers.$setindex(memberName, ret); | 16807 this._resolvedMembers.$setindex(memberName, ret); |
| 16497 if (member.get$isStatic()) { | 16808 if ($notnull_bool(member.get$isStatic())) { |
| 16498 return ret; | 16809 return ret; |
| 16499 } | 16810 } |
| 16500 else { | 16811 else { |
| 16501 var $list = this.get$subtypes(); | 16812 var $list = this.get$subtypes(); |
| 16502 for (var $i = this.get$subtypes().iterator(); $i.hasNext(); ) { | 16813 for (var $i = this.get$subtypes().iterator(); $i.hasNext(); ) { |
| 16503 var t = $i.next(); | 16814 var t = $i.next(); |
| 16504 var m; | 16815 var m; |
| 16505 if (!this.isClass && t.get$isClass()) { | 16816 if ($notnull_bool(!this.isClass && t.get$isClass())) { |
| 16506 m = t.getMember(memberName); | 16817 m = t.getMember(memberName); |
| 16507 } | 16818 } |
| 16508 else { | 16819 else { |
| 16509 m = t.members.$index(memberName); | 16820 m = t.members.$index(memberName); |
| 16510 } | 16821 } |
| 16511 if ($ne(m, null)) ret.add(m); | 16822 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member())); |
| 16512 } | 16823 } |
| 16513 return ret; | 16824 return ret; |
| 16514 } | 16825 } |
| 16515 } | 16826 } |
| 16516 DefinedType.prototype._createNotEqualMember = function() { | 16827 DefinedType.prototype._createNotEqualMember = function() { |
| 16517 var eq = this.members.$index('\$eq'); | 16828 var eq = this.members.$index('\$eq'); |
| 16518 if (eq == null) { | 16829 if ($notnull_bool(eq == null)) { |
| 16519 world.internalError('INTERNAL: object does not define ==', this.definition.s
pan); | 16830 world.internalError('INTERNAL: object does not define ==', this.definition.s
pan); |
| 16520 } | 16831 } |
| 16521 var ne = new MethodMember('\$ne', this, eq.definition); | 16832 var ne = new MethodMember('\$ne', this, eq.definition); |
| 16522 ne.isGenerated = true; | 16833 ne.isGenerated = true; |
| 16523 ne.returnType = eq.returnType; | 16834 ne.returnType = eq.returnType; |
| 16524 ne.parameters = eq.parameters; | 16835 ne.parameters = eq.parameters; |
| 16525 ne.isStatic = eq.isStatic; | 16836 ne.isStatic = eq.isStatic; |
| 16526 ne.isAbstract = eq.isAbstract; | 16837 ne.isAbstract = eq.isAbstract; |
| 16527 return ne; | 16838 return ne; |
| 16528 } | 16839 } |
| 16529 DefinedType._getDottedName = function(type) { | 16840 DefinedType._getDottedName = function(type) { |
| 16530 if (type.names != null) { | 16841 if ($notnull_bool(type.names != null)) { |
| 16531 var names = map(type.names, (function (n) { | 16842 var names = map(type.names, (function (n) { |
| 16532 return n.get$name(); | 16843 return n.get$name(); |
| 16533 }) | 16844 }) |
| 16534 ); | 16845 ); |
| 16535 return type.name.name + '.' + Strings.join(names, '.'); | 16846 return type.name.name + '.' + Strings.join((names && names.is$List$String())
, '.'); |
| 16536 } | 16847 } |
| 16537 else { | 16848 else { |
| 16538 return type.name.name; | 16849 return type.name.name; |
| 16539 } | 16850 } |
| 16540 } | 16851 } |
| 16541 DefinedType.prototype.resolveType = function(node, typeErrors) { | 16852 DefinedType.prototype.resolveType = function(node, typeErrors) { |
| 16542 if (node == null) return world.varType; | 16853 var $0; |
| 16543 if (node.type != null) return node.type; | 16854 if ($notnull_bool(node == null)) return world.varType; |
| 16544 if ((node instanceof NameTypeReference)) { | 16855 if ($notnull_bool(node.type != null)) return node.type; |
| 16856 if ($notnull_bool((node instanceof NameTypeReference))) { |
| 16545 var name0; | 16857 var name0; |
| 16546 if (node.names != null) { | 16858 if ($notnull_bool(node.names != null)) { |
| 16547 name0 = node.names.last().get$name(); | 16859 name0 = $assert_String(node.names.last().get$name()); |
| 16548 } | 16860 } |
| 16549 else { | 16861 else { |
| 16550 name0 = node.get$name().get$name(); | 16862 name0 = $assert_String(node.get$name().get$name()); |
| 16551 } | 16863 } |
| 16552 if (this.typeParameters != null) { | 16864 if ($notnull_bool(this.typeParameters != null)) { |
| 16553 var $list = this.typeParameters; | 16865 var $list = this.typeParameters; |
| 16554 for (var $i = 0;$i < $list.length; $i++) { | 16866 for (var $i = 0;$i < $list.length; $i++) { |
| 16555 var tp = $list.$index($i); | 16867 var tp = $list.$index($i); |
| 16556 if ($eq(tp.get$name(), name0)) { | 16868 if ($notnull_bool($eq(tp.get$name(), name0))) { |
| 16557 node.type = tp; | 16869 node.type = (tp && tp.is$lang_Type()); |
| 16558 } | 16870 } |
| 16559 } | 16871 } |
| 16560 } | 16872 } |
| 16561 if (node.type == null) { | 16873 if ($notnull_bool(node.type == null)) { |
| 16562 node.type = this.library.findType(node); | 16874 node.type = this.library.findType((node && node.is$NameTypeReference())); |
| 16563 } | 16875 } |
| 16564 if (node.type == null) { | 16876 if ($notnull_bool(node.type == null)) { |
| 16565 var message = ('can not find type ' + DefinedType._getDottedName(node) + '
'); | 16877 var message = ('can not find type ' + DefinedType._getDottedName((node &&
node.is$NameTypeReference())) + ''); |
| 16566 if (typeErrors) { | 16878 if ($notnull_bool(typeErrors)) { |
| 16567 world.error(message, node.span); | 16879 world.error($assert_String(message), node.span); |
| 16568 node.type = world.objectType; | 16880 node.type = world.objectType; |
| 16569 } | 16881 } |
| 16570 else { | 16882 else { |
| 16571 world.warning(message, node.span); | 16883 world.warning($assert_String(message), node.span); |
| 16572 node.type = world.varType; | 16884 node.type = world.varType; |
| 16573 } | 16885 } |
| 16574 } | 16886 } |
| 16575 } | 16887 } |
| 16576 else if ((node instanceof GenericTypeReference)) { | 16888 else if ($notnull_bool((node instanceof GenericTypeReference))) { |
| 16577 var baseType = this.resolveType(node.baseType, typeErrors); | 16889 var baseType = this.resolveType(node.baseType, typeErrors); |
| 16578 if (!baseType.get$isGeneric()) { | 16890 if ($notnull_bool(!baseType.get$isGeneric())) { |
| 16579 world.error(('' + baseType.get$name() + ' is not generic'), node.span); | 16891 world.error(('' + baseType.get$name() + ' is not generic'), node.span); |
| 16580 return null; | 16892 return null; |
| 16581 } | 16893 } |
| 16582 if (node.typeArguments.length != baseType.get$typeParameters().length) { | 16894 if ($notnull_bool(node.typeArguments.length != baseType.get$typeParameters()
.length)) { |
| 16583 world.error('wrong number of type arguments', node.span); | 16895 world.error('wrong number of type arguments', node.span); |
| 16584 return null; | 16896 return null; |
| 16585 } | 16897 } |
| 16586 var typeArgs = []; | 16898 var typeArgs = []; |
| 16587 for (var i = 0; | 16899 for (var i = 0; |
| 16588 i < node.typeArguments.length; i++) { | 16900 $notnull_bool(i < node.typeArguments.length); i++) { |
| 16589 var extendsType = baseType.get$typeParameters().$index(i).extendsType; | 16901 var extendsType = baseType.get$typeParameters().$index(i).extendsType; |
| 16590 var typeArg = this.resolveType(node.typeArguments.$index(i), typeErrors); | 16902 var typeArg = this.resolveType((($0 = node.typeArguments.$index(i)) && $0.
is$TypeReference()), typeErrors); |
| 16591 typeArgs.add(typeArg); | 16903 typeArgs.add(typeArg); |
| 16592 if ($ne(extendsType, null) && !(typeArg instanceof ParameterType)) { | 16904 if ($notnull_bool($ne(extendsType, null) && !(typeArg instanceof Parameter
Type))) { |
| 16593 typeArg.ensureSubtypeOf(extendsType, node.typeArguments.$index(i).get$sp
an(), typeErrors); | 16905 typeArg.ensureSubtypeOf((extendsType && extendsType.is$lang_Type()), nod
e.typeArguments.$index(i).get$span(), typeErrors); |
| 16594 } | 16906 } |
| 16595 } | 16907 } |
| 16596 node.type = baseType.getOrMakeConcreteType(typeArgs); | 16908 node.type = baseType.getOrMakeConcreteType(typeArgs); |
| 16597 } | 16909 } |
| 16598 else if ((node instanceof FunctionTypeReference)) { | 16910 else if ($notnull_bool((node instanceof FunctionTypeReference))) { |
| 16599 var name0 = ''; | 16911 var name0 = ''; |
| 16600 if (node.func.name != null) name0 = node.func.name.name; | 16912 if ($notnull_bool(node.func.name != null)) name0 = node.func.name.name; |
| 16601 node.type = this.library.getOrAddFunctionType(name0, node.func, this); | 16913 node.type = this.library.getOrAddFunctionType($assert_String(name0), node.fu
nc, this); |
| 16602 } | 16914 } |
| 16603 else { | 16915 else { |
| 16604 world.internalError('unknown type reference', node.span); | 16916 world.internalError('unknown type reference', node.span); |
| 16605 } | 16917 } |
| 16606 return node.type; | 16918 return node.type; |
| 16607 } | 16919 } |
| 16608 DefinedType.prototype.resolveTypeParams = function(inType) { | 16920 DefinedType.prototype.resolveTypeParams = function(inType) { |
| 16609 return this; | 16921 return this; |
| 16610 } | 16922 } |
| 16611 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { | 16923 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { |
| 16924 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1136, 12); |
| 16612 var names = [this.name]; | 16925 var names = [this.name]; |
| 16613 var typeMap = $map([]); | 16926 var typeMap = $map([]); |
| 16614 for (var i = 0; | 16927 for (var i = 0; |
| 16615 i < typeArgs.length; i++) { | 16928 $notnull_bool(i < typeArgs.length); i++) { |
| 16616 var paramName = this.typeParameters.$index(i).get$name(); | 16929 var paramName = this.typeParameters.$index(i).get$name(); |
| 16617 typeMap.$setindex(paramName, typeArgs.$index(i)); | 16930 typeMap.$setindex(paramName, typeArgs.$index(i)); |
| 16618 names.add(typeArgs.$index(i).get$name()); | 16931 names.add(typeArgs.$index(i).get$name()); |
| 16619 } | 16932 } |
| 16620 var concreteName = Strings.join(names, '\$'); | 16933 var concreteName = Strings.join((names && names.is$List$String()), '\$'); |
| 16621 var ret = this._concreteTypes.$index(concreteName); | 16934 var ret = this._concreteTypes.$index(concreteName); |
| 16622 if (ret == null) { | 16935 if ($notnull_bool(ret == null)) { |
| 16623 ret = new ConcreteType(concreteName, this, typeMap, typeArgs); | 16936 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs
); |
| 16624 this._concreteTypes.$setindex(concreteName, ret); | 16937 this._concreteTypes.$setindex(concreteName, ret); |
| 16625 } | 16938 } |
| 16626 return ret; | 16939 return ret; |
| 16627 } | 16940 } |
| 16628 DefinedType.prototype.getCallStub = function(args) { | 16941 DefinedType.prototype.getCallStub = function(args) { |
| 16942 $assert(this.get$isFunction(), "isFunction", "type.dart", 1156, 12); |
| 16629 var name0 = _getCallStubName('call', args); | 16943 var name0 = _getCallStubName('call', args); |
| 16630 if (this.varStubs == null) this.varStubs = $map([]); | 16944 if ($notnull_bool(this.varStubs == null)) this.varStubs = $map([]); |
| 16631 var stub = this.varStubs.$index(name0); | 16945 var stub = this.varStubs.$index(name0); |
| 16632 if (stub == null) { | 16946 if ($notnull_bool(stub == null)) { |
| 16633 stub = new VarFunctionStub(name0, args); | 16947 stub = new VarFunctionStub($assert_String(name0), args); |
| 16634 this.varStubs.$setindex(name0, stub); | 16948 this.varStubs.$setindex(name0, stub); |
| 16635 } | 16949 } |
| 16636 return stub; | 16950 return stub; |
| 16637 } | 16951 } |
| 16638 // ********** Code for FixedCollection ************** | 16952 // ********** Code for FixedCollection ************** |
| 16639 function FixedCollection(value, length) { | 16953 function FixedCollection(value, length) { |
| 16640 this.value = value; | 16954 this.value = value; |
| 16641 this.length = length; | 16955 this.length = length; |
| 16642 // Initializers done | 16956 // Initializers done |
| 16643 } | 16957 } |
| 16958 FixedCollection.prototype.is$Iterable = function(){return this;}; |
| 16644 FixedCollection.prototype.get$value = function() { return this.value; }; | 16959 FixedCollection.prototype.get$value = function() { return this.value; }; |
| 16645 FixedCollection.prototype.iterator = function() { | 16960 FixedCollection.prototype.iterator = function() { |
| 16646 return new FixedIterator$E(this.value, this.length); | 16961 return new FixedIterator$E(this.value, this.length); |
| 16647 } | 16962 } |
| 16648 FixedCollection.prototype.forEach = function(f) { | 16963 FixedCollection.prototype.forEach = function(f) { |
| 16649 Collections.forEach(this, f); | 16964 Collections.forEach(this, f); |
| 16650 } | 16965 } |
| 16651 FixedCollection.prototype.filter = function(f) { | 16966 FixedCollection.prototype.filter = function(f) { |
| 16652 return Collections.filter(this, new ListFactory$E(), f); | 16967 return Collections.filter(this, new ListFactory$E(), f); |
| 16653 } | 16968 } |
| 16654 FixedCollection.prototype.some = function(f) { | 16969 FixedCollection.prototype.some = function(f) { |
| 16655 return Collections.some(this, f); | 16970 return Collections.some(this, f); |
| 16656 } | 16971 } |
| 16657 FixedCollection.prototype.isEmpty = function() { | 16972 FixedCollection.prototype.isEmpty = function() { |
| 16658 return this.length == 0; | 16973 return this.length == 0; |
| 16659 } | 16974 } |
| 16660 FixedCollection.prototype.forEach$1 = FixedCollection.prototype.forEach; | 16975 FixedCollection.prototype.forEach$1 = FixedCollection.prototype.forEach; |
| 16661 // ********** Code for FixedCollection$Type ************** | 16976 // ********** Code for FixedCollection$Type ************** |
| 16662 function FixedCollection$Type(value, length) { | 16977 function FixedCollection$Type(value, length) { |
| 16663 this.value = value; | 16978 this.value = value; |
| 16664 this.length = length; | 16979 this.length = length; |
| 16665 // Initializers done | 16980 // Initializers done |
| 16666 } | 16981 } |
| 16667 $inherits(FixedCollection$Type, FixedCollection); | 16982 $inherits(FixedCollection$Type, FixedCollection); |
| 16983 FixedCollection$Type.prototype.is$Iterable = function(){return this;}; |
| 16668 // ********** Code for FixedIterator ************** | 16984 // ********** Code for FixedIterator ************** |
| 16669 function FixedIterator(value, length) { | 16985 function FixedIterator(value, length) { |
| 16670 this._index = 0 | 16986 this._index = 0 |
| 16671 this.value = value; | 16987 this.value = value; |
| 16672 this.length = length; | 16988 this.length = length; |
| 16673 // Initializers done | 16989 // Initializers done |
| 16674 } | 16990 } |
| 16675 FixedIterator.prototype.get$value = function() { return this.value; }; | 16991 FixedIterator.prototype.get$value = function() { return this.value; }; |
| 16676 FixedIterator.prototype.hasNext = function() { | 16992 FixedIterator.prototype.hasNext = function() { |
| 16677 return this._index < this.length; | 16993 return this._index < this.length; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 16689 } | 17005 } |
| 16690 $inherits(FixedIterator$E, FixedIterator); | 17006 $inherits(FixedIterator$E, FixedIterator); |
| 16691 // ********** Code for Value ************** | 17007 // ********** Code for Value ************** |
| 16692 function Value(type, code, isSuper, needsTemp, isType) { | 17008 function Value(type, code, isSuper, needsTemp, isType) { |
| 16693 this.type = type; | 17009 this.type = type; |
| 16694 this.code = code; | 17010 this.code = code; |
| 16695 this.isSuper = isSuper; | 17011 this.isSuper = isSuper; |
| 16696 this.needsTemp = needsTemp; | 17012 this.needsTemp = needsTemp; |
| 16697 this.isType = isType; | 17013 this.isType = isType; |
| 16698 // Initializers done | 17014 // Initializers done |
| 16699 if (this.type == null) this.type = world.varType; | 17015 if ($notnull_bool(this.type == null)) this.type = world.varType; |
| 16700 } | 17016 } |
| 17017 Value.prototype.is$Value = function(){return this;}; |
| 16701 Value.prototype.get$isConst = function() { | 17018 Value.prototype.get$isConst = function() { |
| 16702 return false; | 17019 return false; |
| 16703 } | 17020 } |
| 16704 Value.prototype.get_ = function(context, name, node) { | 17021 Value.prototype.get_ = function(context, name, node) { |
| 16705 var member = this._resolveMember(context, name, node); | 17022 var member = this._resolveMember(context, name, node); |
| 16706 if ($ne(member, null)) { | 17023 if ($notnull_bool($ne(member, null))) { |
| 16707 member = member.get_$3(context, node, this); | 17024 member = member.get_$3(context, node, this); |
| 16708 } | 17025 } |
| 16709 if ($ne(member, null)) { | 17026 if ($notnull_bool($ne(member, null))) { |
| 16710 return member; | 17027 return member; |
| 16711 } | 17028 } |
| 16712 else { | 17029 else { |
| 16713 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node); | 17030 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node); |
| 16714 } | 17031 } |
| 16715 } | 17032 } |
| 16716 Value.prototype.set_ = function(context, name, node, value, isDynamic) { | 17033 Value.prototype.set_ = function(context, name, node, value, isDynamic) { |
| 16717 var member = this._resolveMember(context, name, node); | 17034 var member = this._resolveMember(context, name, node); |
| 16718 if ($ne(member, null)) { | 17035 if ($notnull_bool($ne(member, null))) { |
| 16719 member = member.set_(context, node, this, value, isDynamic); | 17036 member = member.set_(context, node, this, value, isDynamic); |
| 16720 } | 17037 } |
| 16721 if ($ne(member, null)) { | 17038 if ($notnull_bool($ne(member, null))) { |
| 16722 return member; | 17039 return member; |
| 16723 } | 17040 } |
| 16724 else { | 17041 else { |
| 16725 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu
ments(null, [value])); | 17042 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu
ments(null, [value])); |
| 16726 } | 17043 } |
| 16727 } | 17044 } |
| 16728 Value.prototype.invoke = function(context, name, node, args, isDynamic) { | 17045 Value.prototype.invoke = function(context, name, node, args, isDynamic) { |
| 16729 if (this.type.get$isVar() && name == '\$ne') { | 17046 if ($notnull_bool(this.type.get$isVar() && name == '\$ne')) { |
| 16730 if (args.values.length != 1) { | 17047 if ($notnull_bool(args.values.length != 1)) { |
| 16731 world.warning('wrong number of arguments for !=', node.span); | 17048 world.warning('wrong number of arguments for !=', node.span); |
| 16732 } | 17049 } |
| 16733 return new Value(null, ('\$ne(' + this.code + ', ' + args.values.$index(0).c
ode + ')'), false, true, false); | 17050 return new Value(null, ('\$ne(' + this.code + ', ' + args.values.$index(0).c
ode + ')'), false, true, false); |
| 16734 } | 17051 } |
| 16735 if (name == '\$call') { | 17052 if ($notnull_bool(name == '\$call')) { |
| 16736 if (this.isType) { | 17053 if ($notnull_bool(this.isType)) { |
| 16737 world.error('must use "new" or "const" to construct a new instance', node.
span); | 17054 world.error('must use "new" or "const" to construct a new instance', node.
span); |
| 16738 } | 17055 } |
| 16739 if (this.type.needsVarCall(args)) { | 17056 if ($notnull_bool(this.type.needsVarCall(args))) { |
| 16740 return this._varCall(context, args); | 17057 return this._varCall(context, args); |
| 16741 } | 17058 } |
| 16742 } | 17059 } |
| 16743 var member = this._resolveMember(context, name, node); | 17060 var member = this._resolveMember(context, name, node); |
| 16744 if (member == null) { | 17061 if ($notnull_bool(member == null)) { |
| 16745 return this.invokeNoSuchMethod(context, name, node, args); | 17062 return this.invokeNoSuchMethod(context, name, node, args); |
| 16746 } | 17063 } |
| 16747 else { | 17064 else { |
| 16748 return member.invoke(context, node, this, args, isDynamic); | 17065 return member.invoke(context, node, this, args, isDynamic); |
| 16749 } | 17066 } |
| 16750 } | 17067 } |
| 16751 Value.prototype.canInvoke = function(context, name, args) { | 17068 Value.prototype.canInvoke = function(context, name, args) { |
| 16752 if (this.type.get$isVar() && name == '\$ne') { | 17069 if ($notnull_bool(this.type.get$isVar() && name == '\$ne')) { |
| 16753 return true; | 17070 return true; |
| 16754 } | 17071 } |
| 16755 if (this.type.get$isVarOrFunction() && name == '\$call') { | 17072 if ($notnull_bool(this.type.get$isVarOrFunction() && name == '\$call')) { |
| 16756 return true; | 17073 return true; |
| 16757 } | 17074 } |
| 16758 var member = this._tryResolveMember(context, name); | 17075 var member = this._tryResolveMember(context, name); |
| 16759 return $ne(member, null) && member.canInvoke(context, args); | 17076 return $ne(member, null) && member.canInvoke(context, args); |
| 16760 } | 17077 } |
| 16761 Value.prototype._tryResolveMember = function(context, name) { | 17078 Value.prototype._tryResolveMember = function(context, name) { |
| 16762 var member = null; | 17079 var member = null; |
| 16763 if (!this.type.get$isVar()) { | 17080 if ($notnull_bool(!this.type.get$isVar())) { |
| 16764 if (this.isSuper) { | 17081 if ($notnull_bool(this.isSuper)) { |
| 16765 return this.type.getMember(name); | 17082 return this.type.getMember(name); |
| 16766 } | 17083 } |
| 16767 else { | 17084 else { |
| 16768 member = this.type.resolveMember(name); | 17085 member = this.type.resolveMember(name); |
| 16769 } | 17086 } |
| 16770 } | 17087 } |
| 16771 if (member == null) { | 17088 if ($notnull_bool(member == null)) { |
| 16772 member = context.findMembers(name); | 17089 member = context.findMembers(name); |
| 16773 } | 17090 } |
| 16774 return member; | 17091 return member; |
| 16775 } | 17092 } |
| 16776 Value.prototype._resolveMember = function(context, name, node) { | 17093 Value.prototype._resolveMember = function(context, name, node) { |
| 16777 var member = this._tryResolveMember(context, name); | 17094 var member = this._tryResolveMember(context, name); |
| 16778 if (member == null) { | 17095 if ($notnull_bool(member == null)) { |
| 16779 if (this._tryResolveMember(context, 'noSuchMethod').members.length > 1) { | 17096 if ($notnull_bool(this._tryResolveMember(context, 'noSuchMethod').members.le
ngth > 1)) { |
| 16780 return null; | 17097 return null; |
| 16781 } | 17098 } |
| 16782 var typeName = this.type.name == null ? this.type.get$library().name : this.
type.name; | 17099 var typeName = $notnull_bool(this.type.name == null) ? this.type.get$library
().name : this.type.name; |
| 16783 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); | 17100 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); |
| 16784 if (this.isType) { | 17101 if ($notnull_bool(this.isType)) { |
| 16785 world.error(message, node.span); | 17102 world.error($assert_String(message), node.span); |
| 16786 } | 17103 } |
| 16787 else { | 17104 else { |
| 16788 world.warning(message, node.span); | 17105 world.warning($assert_String(message), node.span); |
| 16789 } | 17106 } |
| 16790 if (context.findMembers(name) == null) { | 17107 if ($notnull_bool(context.findMembers(name) == null)) { |
| 16791 world.warning(('' + name + ' is not defined anywhere in the world.'), node
.span); | 17108 world.warning(('' + name + ' is not defined anywhere in the world.'), node
.span); |
| 16792 } | 17109 } |
| 16793 } | 17110 } |
| 16794 return member; | 17111 return member; |
| 16795 } | 17112 } |
| 16796 Value.prototype.checkFirstClass = function(span) { | 17113 Value.prototype.checkFirstClass = function(span) { |
| 16797 if (this.isType) { | 17114 if ($notnull_bool(this.isType)) { |
| 16798 world.error('Types are not first class', span); | 17115 world.error('Types are not first class', span); |
| 16799 } | 17116 } |
| 16800 } | 17117 } |
| 16801 Value.prototype._varCall = function(context, args) { | 17118 Value.prototype._varCall = function(context, args) { |
| 16802 var stub = world.functionType.getCallStub(args); | 17119 var stub = world.functionType.getCallStub(args); |
| 16803 return new Value(null, ('' + this.code + '.' + stub.get$name() + '(' + args.ge
tCode() + ')'), false, true, false); | 17120 return new Value(null, ('' + this.code + '.' + stub.get$name() + '(' + args.ge
tCode() + ')'), false, true, false); |
| 16804 } | 17121 } |
| 17122 Value.prototype.needsConversion = function(toType) { |
| 17123 var callMethod = toType.getCallMethod(); |
| 17124 if ($notnull_bool($ne(callMethod, null))) { |
| 17125 var arity = callMethod.get$parameters().length; |
| 17126 var myCall = this.type.getCallMethod(); |
| 17127 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity)
) { |
| 17128 return true; |
| 17129 } |
| 17130 } |
| 17131 if ($notnull_bool(options.enableTypeChecks)) { |
| 17132 var fromType = this.type; |
| 17133 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { |
| 17134 fromType = world.objectType; |
| 17135 } |
| 17136 var bothNum = this.type.get$isNum() && toType.get$isNum(); |
| 17137 return fromType.isSubtypeOf(toType) || bothNum; |
| 17138 } |
| 17139 return false; |
| 17140 } |
| 16805 Value.prototype.convertTo = function(context, toType, node, isDynamic) { | 17141 Value.prototype.convertTo = function(context, toType, node, isDynamic) { |
| 16806 var checked = options.enableTypeChecks && !isDynamic; | 17142 var checked = !isDynamic; |
| 16807 var callMethod = toType.getCallMethod(); | 17143 var callMethod = toType.getCallMethod(); |
| 16808 if ($ne(callMethod, null)) { | 17144 if ($notnull_bool($ne(callMethod, null))) { |
| 16809 if (checked && !toType.isAssignable(this.type)) { | 17145 if ($notnull_bool(checked && !toType.isAssignable(this.type))) { |
| 16810 this.convertWarning(toType, node); | 17146 this.convertWarning(toType, node); |
| 16811 } | 17147 } |
| 16812 var arity = callMethod.get$parameters().length; | 17148 var arity = callMethod.get$parameters().length; |
| 16813 var myCall = this.type.getCallMethod(); | 17149 var myCall = this.type.getCallMethod(); |
| 16814 if (myCall == null || myCall.get$parameters().length != arity) { | 17150 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity)
) { |
| 16815 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory
(arity)); | 17151 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory
(arity)); |
| 16816 return new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), fal
se, true, false); | 17152 return new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), fal
se, true, false); |
| 16817 } | 17153 } |
| 16818 } | 17154 } |
| 16819 if (!options.enableTypeChecks) { | 17155 if ($notnull_bool(!options.enableTypeChecks)) { |
| 16820 return this; | 17156 return this; |
| 16821 } | 17157 } |
| 16822 if (this.type.isSubtypeOf(toType)) { | 17158 var fromType = this.type; |
| 17159 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { |
| 17160 fromType = world.objectType; |
| 17161 } |
| 17162 var bothNum = this.type.get$isNum() && toType.get$isNum(); |
| 17163 if ($notnull_bool(!checked || fromType.isSubtypeOf(toType) || bothNum)) { |
| 16823 return this; | 17164 return this; |
| 16824 } | 17165 } |
| 16825 else if (checked && !toType.isSubtypeOf(this.type)) { | 17166 if ($notnull_bool(!toType.isSubtypeOf(this.type))) { |
| 16826 this.convertWarning(toType, node); | 17167 this.convertWarning(toType, node); |
| 16827 } | 17168 } |
| 16828 return this._typeAssert(context, toType, node); | 17169 return this._typeAssert(context, toType, node); |
| 16829 } | 17170 } |
| 17171 Value.prototype.convertToNonNullBool = function(context, node) { |
| 17172 if ($notnull_bool(!this.type.isAssignable(world.boolType))) { |
| 17173 this.convertWarning(world.boolType, node); |
| 17174 } |
| 17175 if ($notnull_bool(!options.enableTypeChecks)) { |
| 17176 return this; |
| 17177 } |
| 17178 else { |
| 17179 if ($notnull_bool(this.code.startsWith('\$notnull_bool'))) { |
| 17180 return this; |
| 17181 } |
| 17182 else { |
| 17183 return new Value(world.boolType, ('\$notnull_bool(' + this.code + ')'), fa
lse, true, false); |
| 17184 } |
| 17185 } |
| 17186 } |
| 16830 Value.prototype._typeAssert = function(context, toType, node) { | 17187 Value.prototype._typeAssert = function(context, toType, node) { |
| 16831 if ((toType instanceof ParameterType)) { | 17188 if ($notnull_bool((toType instanceof ParameterType))) { |
| 16832 var p = toType; | 17189 var p = toType; |
| 16833 toType = p.extendsType; | 17190 toType = p.extendsType; |
| 16834 } | 17191 } |
| 16835 var temp = context.getTemp(this); | 17192 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) { |
| 16836 var testCode; | 17193 world.internalError(('We thought ' + this.type.name + ' is not a subtype of
' + toType.name + '?')); |
| 16837 if (toType.get$library().get$isCore() && toType.get$typeofName() != null) { | |
| 16838 testCode = ("typeof(" + temp.code + ") == '" + toType.get$typeofName() + "'"
); | |
| 16839 } | 17194 } |
| 16840 else if (toType.get$isClass() && !(toType instanceof ConcreteType)) { | 17195 if ($notnull_bool(toType.get$isNum())) toType = world.numType; |
| 16841 toType.markUsed(); | 17196 var check; |
| 16842 testCode = ('' + temp.code + ' instanceof ' + toType.get$jsname() + ''); | 17197 if ($notnull_bool(toType.get$library().get$isCore() && toType.get$typeofName()
!= null)) { |
| 17198 check = ('\$assert_' + toType.name + '(' + this.code + ')'); |
| 17199 if ($notnull_bool(toType.typeCheckCode == null)) { |
| 17200 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}"); |
| 17201 } |
| 16843 } | 17202 } |
| 16844 else { | 17203 else { |
| 16845 toType.isTested = true; | 17204 toType.isTested = true; |
| 16846 testCode = ('' + temp.code + '.is\$' + toType.get$jsname() + ''); | 17205 var temp = context.getTemp(this); |
| 17206 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + '
&&'); |
| 17207 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); |
| 17208 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value(
))); |
| 16847 } | 17209 } |
| 16848 testCode = ('(' + context.assignTemp(temp, this).code + ' == null || ' + testC
ode + ')'); | 17210 return new Value(toType, check, false, true, false); |
| 16849 var test = new Value(world.boolType, testCode, false, true, false); | |
| 16850 var err = world.corelib.types.$index('TypeError'); | |
| 16851 world.gen.genMethod(err.members.$index('toString')); | |
| 16852 var args = new Arguments(null, [temp, new Value(world.stringType, ('"' + toTyp
e.name + '"'), false, true, false)]); | |
| 16853 var typeErr = err.getConstructor('').invoke$4(context, node, null, args); | |
| 16854 var result = new Value(toType, ('(' + test.code + ' ? ' + temp.code + ' : ') +
('\$throw(' + typeErr.code + '))'), false, true, false); | |
| 16855 if ($ne(temp, this)) context.freeTemp(temp); | |
| 16856 return result; | |
| 16857 } | 17211 } |
| 16858 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck)
{ | 17212 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck)
{ |
| 16859 if (toType.get$isVar()) { | 17213 if ($notnull_bool(toType.get$isVar())) { |
| 16860 world.error('can not resolve type', span); | 17214 world.error('can not resolve type', span); |
| 16861 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n
ull); | 17215 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n
ull); |
| 16862 } | 17216 } |
| 16863 if ((toType instanceof ParameterType)) { | 17217 if ($notnull_bool((toType instanceof ParameterType))) { |
| 16864 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n
ull); | 17218 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n
ull); |
| 16865 } | 17219 } |
| 16866 var testCode = null; | 17220 var testCode = null; |
| 16867 if (toType.get$library().get$isCore()) { | 17221 if ($notnull_bool(toType.get$library().get$isCore())) { |
| 16868 var typeofName = toType.get$typeofName(); | 17222 var typeofName = toType.get$typeofName(); |
| 16869 if ($ne(typeofName, null)) { | 17223 if ($notnull_bool($ne(typeofName, null))) { |
| 16870 testCode = ("(typeof(" + this.code + ") " + (isTrue ? '==' : '!=') + " '"
+ typeofName + "')"); | 17224 testCode = ("(typeof(" + this.code + ") " + ($notnull_bool(isTrue) ? '=='
: '!=') + " '" + typeofName + "')"); |
| 16871 } | 17225 } |
| 16872 } | 17226 } |
| 16873 if (toType.get$isClass() && !(toType instanceof ConcreteType)) { | 17227 if ($notnull_bool(toType.get$isClass() && !(toType instanceof ConcreteType)))
{ |
| 16874 toType.markUsed(); | 17228 toType.markUsed(); |
| 16875 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); | 17229 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); |
| 16876 if (!isTrue) { | 17230 if ($notnull_bool(!isTrue)) { |
| 16877 testCode = '!' + testCode; | 17231 testCode = '!' + testCode; |
| 16878 } | 17232 } |
| 16879 } | 17233 } |
| 16880 if (testCode == null) { | 17234 if ($notnull_bool(testCode == null)) { |
| 16881 toType.isTested = true; | 17235 toType.isTested = true; |
| 16882 var temp = context.getTemp(this); | 17236 var temp = context.getTemp(this); |
| 16883 testCode = ('(' + context.assignTemp(temp, this).code + ' &&'); | 17237 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code +
' &&'); |
| 16884 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')'
); | 17238 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')'
); |
| 16885 if (isTrue) { | 17239 if ($notnull_bool(isTrue)) { |
| 16886 testCode = '!!' + testCode; | 17240 testCode = '!!' + testCode; |
| 16887 } | 17241 } |
| 16888 else { | 17242 else { |
| 16889 testCode = '!' + testCode; | 17243 testCode = '!' + testCode; |
| 16890 } | 17244 } |
| 16891 if ($ne(this, temp)) context.freeTemp(temp); | 17245 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value(
))); |
| 16892 } | 17246 } |
| 16893 return new Value(world.boolType, testCode, false, true, false); | 17247 return new Value(world.boolType, testCode, false, true, false); |
| 16894 } | 17248 } |
| 16895 Value.prototype.convertWarning = function(toType, node) { | 17249 Value.prototype.convertWarning = function(toType, node) { |
| 16896 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType
.name + '"'), node.span); | 17250 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType
.name + '"'), node.span); |
| 16897 } | 17251 } |
| 16898 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { | 17252 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { |
| 16899 var pos = ''; | 17253 var pos = ''; |
| 16900 if (args != null) { | 17254 if ($notnull_bool(args != null)) { |
| 16901 var argsCode = []; | 17255 var argsCode = []; |
| 16902 for (var i = 0; | 17256 for (var i = 0; |
| 16903 i < args.get$length(); i++) { | 17257 $notnull_bool(i < args.get$length()); i++) { |
| 16904 argsCode.add(args.values.$index(i).code); | 17258 argsCode.add(args.values.$index(i).code); |
| 16905 } | 17259 } |
| 16906 pos = Strings.join(argsCode, ", "); | 17260 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); |
| 16907 } | 17261 } |
| 16908 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), false, true,
false), new Value(world.listType, ('[' + pos + ']'), false, true, false)]; | 17262 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), false, true,
false), new Value(world.listType, ('[' + pos + ']'), false, true, false)]; |
| 16909 return this._tryResolveMember(context, 'noSuchMethod').invoke$4(context, node,
this, new Arguments(null, noSuchArgs)); | 17263 return this._tryResolveMember(context, 'noSuchMethod').invoke$4(context, node,
this, new Arguments(null, noSuchArgs)); |
| 16910 } | 17264 } |
| 16911 Value.prototype.invokeSpecial = function(name, args, returnType) { | 17265 Value.prototype.invokeSpecial = function(name, args, returnType) { |
| 17266 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 410, 12
); |
| 17267 $assert(!args.get$hasNames(), "!args.hasNames", "value.dart", 411, 12); |
| 16912 var argsString = args.getCode(); | 17268 var argsString = args.getCode(); |
| 16913 if (name == '\$index' || name == '\$setindex') { | 17269 if ($notnull_bool(name == '\$index' || name == '\$setindex')) { |
| 16914 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString
+ ')'), false, true, false); | 17270 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString
+ ')'), false, true, false); |
| 16915 } | 17271 } |
| 16916 else { | 17272 else { |
| 16917 if (argsString.length > 0) argsString = (', ' + argsString + ''); | 17273 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString +
''); |
| 16918 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString
+ ')'), false, true, false); | 17274 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString
+ ')'), false, true, false); |
| 16919 } | 17275 } |
| 16920 } | 17276 } |
| 16921 Value.prototype.get_$3 = Value.prototype.get_; | 17277 Value.prototype.get_$3 = function($0, $1, $2) { |
| 17278 return this.get_(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 && $
2.is$lang_Node())); |
| 17279 } |
| 17280 ; |
| 16922 Value.prototype.invoke$4 = function($0, $1, $2, $3) { | 17281 Value.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 16923 return this.invoke($0, $1, $2, $3, false); | 17282 return this.invoke(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 &&
$2.is$lang_Node()), ($3 && $3.is$Arguments()), false); |
| 16924 } | 17283 } |
| 16925 ; | 17284 ; |
| 16926 Value.prototype.set_$4 = function($0, $1, $2, $3) { | 17285 Value.prototype.set_$4 = function($0, $1, $2, $3) { |
| 16927 return this.set_($0, $1, $2, $3, false); | 17286 return this.set_(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 && $
2.is$lang_Node()), ($3 && $3.is$Value()), false); |
| 16928 } | 17287 } |
| 16929 ; | 17288 ; |
| 16930 // ********** Code for EvaluatedValue ************** | 17289 // ********** Code for EvaluatedValue ************** |
| 16931 function EvaluatedValue() {} | 17290 function EvaluatedValue() {} |
| 16932 EvaluatedValue._internal$ctor = function(type0, actualValue, canonicalCode, orig
inal, code0) { | 17291 EvaluatedValue._internal$ctor = function(type0, actualValue, canonicalCode, orig
inal, code0) { |
| 16933 this.actualValue = actualValue; | 17292 this.actualValue = actualValue; |
| 16934 this.canonicalCode = canonicalCode; | 17293 this.canonicalCode = canonicalCode; |
| 16935 this.original = original; | 17294 this.original = original; |
| 16936 Value.call(this, type0, code0, false, false, false); | 17295 Value.call(this, type0, code0, false, false, false); |
| 16937 // Initializers done | 17296 // Initializers done |
| 16938 } | 17297 } |
| 16939 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype; | 17298 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype; |
| 16940 $inherits(EvaluatedValue, Value); | 17299 $inherits(EvaluatedValue, Value); |
| 16941 EvaluatedValue.EvaluatedValue$factory = function(type0, actualValue0, canonicalC
ode0, original0) { | 17300 EvaluatedValue.EvaluatedValue$factory = function(type0, actualValue0, canonicalC
ode0, original0) { |
| 16942 return new EvaluatedValue._internal$ctor(type0, actualValue0, canonicalCode0,
original0, EvaluatedValue.codeWithComments(canonicalCode0, original0)); | 17301 return new EvaluatedValue._internal$ctor(type0, actualValue0, canonicalCode0,
original0, EvaluatedValue.codeWithComments($assert_String(canonicalCode0), (orig
inal0 && original0.is$SourceSpan()))); |
| 16943 } | 17302 } |
| 16944 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue;
}; | 17303 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue;
}; |
| 16945 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV
alue = value; }; | 17304 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV
alue = value; }; |
| 16946 EvaluatedValue.prototype.get$isConst = function() { | 17305 EvaluatedValue.prototype.get$isConst = function() { |
| 16947 return true; | 17306 return true; |
| 16948 } | 17307 } |
| 16949 EvaluatedValue.codeWithComments = function(canonicalCode0, original0) { | 17308 EvaluatedValue.codeWithComments = function(canonicalCode0, original0) { |
| 16950 return (original0 != null && original0.get$text() != canonicalCode0) ? ('' + c
anonicalCode0 + '/*' + original0.get$text() + '*/') : canonicalCode0; | 17309 return $notnull_bool((original0 != null && original0.get$text() != canonicalCo
de0)) ? ('' + canonicalCode0 + '/*' + original0.get$text() + '*/') : canonicalCo
de0; |
| 16951 } | 17310 } |
| 16952 // ********** Code for ConstListValue ************** | 17311 // ********** Code for ConstListValue ************** |
| 16953 function ConstListValue() {} | 17312 function ConstListValue() {} |
| 16954 ConstListValue._internal$ctor = function(type0, values, actualValue0, canonicalC
ode0, original0, code0) { | 17313 ConstListValue._internal$ctor = function(type0, values, actualValue0, canonicalC
ode0, original0, code0) { |
| 16955 this.values = values; | 17314 this.values = values; |
| 16956 EvaluatedValue._internal$ctor.call(this, type0, actualValue0, canonicalCode0,
original0, code0); | 17315 EvaluatedValue._internal$ctor.call(this, type0, actualValue0, canonicalCode0,
original0, code0); |
| 16957 // Initializers done | 17316 // Initializers done |
| 16958 } | 17317 } |
| 16959 ConstListValue._internal$ctor.prototype = ConstListValue.prototype; | 17318 ConstListValue._internal$ctor.prototype = ConstListValue.prototype; |
| 16960 $inherits(ConstListValue, EvaluatedValue); | 17319 $inherits(ConstListValue, EvaluatedValue); |
| 16961 ConstListValue.ConstListValue$factory = function(type0, values0, actualValue0, c
anonicalCode0, original0) { | 17320 ConstListValue.ConstListValue$factory = function(type0, values0, actualValue0, c
anonicalCode0, original0) { |
| 16962 return new ConstListValue._internal$ctor(type0, values0, actualValue0, canonic
alCode0, original0, EvaluatedValue.codeWithComments(canonicalCode0, original0)); | 17321 return new ConstListValue._internal$ctor(type0, values0, actualValue0, canonic
alCode0, original0, EvaluatedValue.codeWithComments(canonicalCode0, original0)); |
| 16963 } | 17322 } |
| 16964 // ********** Code for ConstMapValue ************** | 17323 // ********** Code for ConstMapValue ************** |
| 16965 function ConstMapValue() {} | 17324 function ConstMapValue() {} |
| 16966 ConstMapValue._internal$ctor = function(type0, values, actualValue0, canonicalCo
de0, original0, code0) { | 17325 ConstMapValue._internal$ctor = function(type0, values, actualValue0, canonicalCo
de0, original0, code0) { |
| 16967 this.values = values; | 17326 this.values = values; |
| 16968 EvaluatedValue._internal$ctor.call(this, type0, actualValue0, canonicalCode0,
original0, code0); | 17327 EvaluatedValue._internal$ctor.call(this, type0, actualValue0, canonicalCode0,
original0, code0); |
| 16969 // Initializers done | 17328 // Initializers done |
| 16970 } | 17329 } |
| 16971 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype; | 17330 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype; |
| 16972 $inherits(ConstMapValue, EvaluatedValue); | 17331 $inherits(ConstMapValue, EvaluatedValue); |
| 16973 ConstMapValue.ConstMapValue$factory = function(type0, keyValuePairs, actualValue
0, canonicalCode0, original0) { | 17332 ConstMapValue.ConstMapValue$factory = function(type0, keyValuePairs, actualValue
0, canonicalCode0, original0) { |
| 16974 var values0 = new HashMapImplementation$String$EvaluatedValue(); | 17333 var values0 = new HashMapImplementation$String$EvaluatedValue(); |
| 16975 for (var i = 0; | 17334 for (var i = 0; |
| 16976 i < keyValuePairs.length; i += 2) { | 17335 $notnull_bool(i < keyValuePairs.length); i += 2) { |
| 16977 values0.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$
index(i + 1)); | 17336 values0.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$
index(i + 1)); |
| 16978 } | 17337 } |
| 16979 return new ConstMapValue._internal$ctor(type0, values0, actualValue0, canonica
lCode0, original0, EvaluatedValue.codeWithComments(canonicalCode0, original0)); | 17338 return new ConstMapValue._internal$ctor(type0, values0, actualValue0, canonica
lCode0, original0, EvaluatedValue.codeWithComments(canonicalCode0, original0)); |
| 16980 } | 17339 } |
| 16981 // ********** Code for ConstObjectValue ************** | 17340 // ********** Code for ConstObjectValue ************** |
| 16982 function ConstObjectValue() {} | 17341 function ConstObjectValue() {} |
| 16983 ConstObjectValue._internal$ctor = function(type0, fields, actualValue0, canonica
lCode0, original0, code0) { | 17342 ConstObjectValue._internal$ctor = function(type0, fields, actualValue0, canonica
lCode0, original0, code0) { |
| 16984 this.fields = fields; | 17343 this.fields = fields; |
| 16985 EvaluatedValue._internal$ctor.call(this, type0, actualValue0, canonicalCode0,
original0, code0); | 17344 EvaluatedValue._internal$ctor.call(this, type0, actualValue0, canonicalCode0,
original0, code0); |
| 16986 // Initializers done | 17345 // Initializers done |
| 16987 } | 17346 } |
| 16988 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype; | 17347 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype; |
| 16989 $inherits(ConstObjectValue, EvaluatedValue); | 17348 $inherits(ConstObjectValue, EvaluatedValue); |
| 16990 ConstObjectValue.ConstObjectValue$factory = function(type0, fields0, canonicalCo
de0, original0) { | 17349 ConstObjectValue.ConstObjectValue$factory = function(type0, fields0, canonicalCo
de0, original0) { |
| 17350 var $0; |
| 16991 var fieldValues = []; | 17351 var fieldValues = []; |
| 16992 var $list = fields0.getKeys(); | 17352 var $list = fields0.getKeys(); |
| 16993 for (var $i = fields0.getKeys().iterator(); $i.hasNext(); ) { | 17353 for (var $i = fields0.getKeys().iterator(); $i.hasNext(); ) { |
| 16994 var f = $i.next(); | 17354 var f = $i.next(); |
| 16995 fieldValues.add(('' + f + ' = ' + fields0.$index(f).get$actualValue() + ''))
; | 17355 fieldValues.add(('' + f + ' = ' + fields0.$index(f).get$actualValue() + ''))
; |
| 16996 } | 17356 } |
| 16997 fieldValues.sort((function (a, b) { | 17357 fieldValues.sort((function (a, b) { |
| 16998 return a.compareTo(b); | 17358 return a.compareTo(b); |
| 16999 }) | 17359 }) |
| 17000 ); | 17360 ); |
| 17001 var actualValue0 = ('const ' + type0.get$jsname() + ' [') + Strings.join(field
Values, ',') + ']'; | 17361 var actualValue0 = ('const ' + type0.get$jsname() + ' [') + Strings.join(field
Values, ',') + ']'; |
| 17002 return new ConstObjectValue._internal$ctor(type0, fields0, actualValue0, canon
icalCode0, original0, EvaluatedValue.codeWithComments(canonicalCode0, original0)
); | 17362 return new ConstObjectValue._internal$ctor(type0, fields0, actualValue0, canon
icalCode0, original0, EvaluatedValue.codeWithComments(canonicalCode0, original0)
); |
| 17003 } | 17363 } |
| 17004 // ********** Code for GlobalValue ************** | 17364 // ********** Code for GlobalValue ************** |
| 17005 function GlobalValue(type0, code0, isConst0, field, name, exp, canonicalCode, or
iginal, dependencies) { | 17365 function GlobalValue(type0, code0, isConst0, field, name, exp, canonicalCode, or
iginal, dependencies) { |
| 17006 this.field = field; | 17366 this.field = field; |
| 17007 this.name = name; | 17367 this.name = name; |
| 17008 this.exp = exp; | 17368 this.exp = exp; |
| 17009 this.canonicalCode = canonicalCode; | 17369 this.canonicalCode = canonicalCode; |
| 17010 this.original = original; | 17370 this.original = original; |
| 17011 this.dependencies = dependencies; | 17371 this.dependencies = dependencies; |
| 17012 Value.call(this, type0, code0, false, !isConst0, false); | 17372 Value.call(this, type0, code0, false, !isConst0, false); |
| 17013 // Initializers done | 17373 // Initializers done |
| 17014 } | 17374 } |
| 17015 $inherits(GlobalValue, Value); | 17375 $inherits(GlobalValue, Value); |
| 17016 GlobalValue.GlobalValue$fromStatic$factory = function(field0, exp0, dependencies
0) { | 17376 GlobalValue.GlobalValue$fromStatic$factory = function(field0, exp0, dependencies
0) { |
| 17017 var code0 = (exp0.get$isConst() ? exp0.canonicalCode : exp0.code); | 17377 var code0 = ($notnull_bool(exp0.get$isConst()) ? exp0.canonicalCode : exp0.cod
e); |
| 17018 var codeWithComment = ('' + code0 + '/*' + field0.declaringType.name + '.' + f
ield0.get$name() + '*/'); | 17378 var codeWithComment = ('' + code0 + '/*' + field0.declaringType.name + '.' + f
ield0.get$name() + '*/'); |
| 17019 return new GlobalValue(exp0.type, codeWithComment, field0.isFinal, field0, nul
l, exp0, code0, null, dependencies0.filter((function (d) { | 17379 return new GlobalValue(exp0.type, codeWithComment, field0.isFinal, field0, nul
l, exp0, code0, null, dependencies0.filter((function (d) { |
| 17020 return (d instanceof GlobalValue); | 17380 return (d instanceof GlobalValue); |
| 17021 }) | 17381 }) |
| 17022 )); | 17382 )); |
| 17023 } | 17383 } |
| 17024 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp0, dependencie
s0) { | 17384 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp0, dependencie
s0) { |
| 17025 var name0 = ("const\$" + uniqueId + ""); | 17385 var name0 = ("const\$" + uniqueId + ""); |
| 17026 var codeWithComment = ("" + name0 + "/*" + exp0.original.get$text() + "*/"); | 17386 var codeWithComment = ("" + name0 + "/*" + exp0.original.get$text() + "*/"); |
| 17027 return new GlobalValue(exp0.type, codeWithComment, true, null, name0, exp0, na
me0, exp0.original, dependencies0.filter((function (d) { | 17387 return new GlobalValue(exp0.type, codeWithComment, true, null, name0, exp0, na
me0, exp0.original, dependencies0.filter((function (d) { |
| 17028 return (d instanceof GlobalValue); | 17388 return (d instanceof GlobalValue); |
| 17029 }) | 17389 }) |
| 17030 )); | 17390 )); |
| 17031 } | 17391 } |
| 17032 GlobalValue.prototype.get$name = function() { return this.name; }; | 17392 GlobalValue.prototype.get$name = function() { return this.name; }; |
| 17033 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; | 17393 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; |
| 17034 GlobalValue.prototype.get$isConst = function() { | 17394 GlobalValue.prototype.get$isConst = function() { |
| 17035 return this.exp.get$isConst() && (this.field == null || this.field.isFinal); | 17395 return this.exp.get$isConst() && (this.field == null || this.field.isFinal); |
| 17036 } | 17396 } |
| 17037 GlobalValue.prototype.get$actualValue = function() { | 17397 GlobalValue.prototype.get$actualValue = function() { |
| 17038 return this.exp.get$dynamic().get$actualValue(); | 17398 return this.exp.get$dynamic().get$actualValue(); |
| 17039 } | 17399 } |
| 17040 GlobalValue.prototype.compareTo = function(other) { | 17400 GlobalValue.prototype.compareTo = function(other) { |
| 17041 if ($eq(other, this)) { | 17401 if ($notnull_bool($eq(other, this))) { |
| 17042 return 0; | 17402 return 0; |
| 17043 } | 17403 } |
| 17044 else if (this.dependencies.indexOf(other, 0) >= 0) { | 17404 else if ($notnull_bool(this.dependencies.indexOf(other, 0) >= 0)) { |
| 17045 return 1; | 17405 return 1; |
| 17046 } | 17406 } |
| 17047 else if (other.dependencies.indexOf(this, 0) >= 0) { | 17407 else if ($notnull_bool(other.dependencies.indexOf(this, 0) >= 0)) { |
| 17048 return -1; | 17408 return -1; |
| 17049 } | 17409 } |
| 17050 else if (this.dependencies.length > other.dependencies.length) { | 17410 else if ($notnull_bool(this.dependencies.length > other.dependencies.length))
{ |
| 17051 return 1; | 17411 return 1; |
| 17052 } | 17412 } |
| 17053 else if (this.dependencies.length < other.dependencies.length) { | 17413 else if ($notnull_bool(this.dependencies.length < other.dependencies.length))
{ |
| 17054 return -1; | 17414 return -1; |
| 17055 } | 17415 } |
| 17056 else if (this.name == null && other.name != null) { | 17416 else if ($notnull_bool(this.name == null && other.name != null)) { |
| 17057 return 1; | 17417 return 1; |
| 17058 } | 17418 } |
| 17059 else if (this.name != null && other.name == null) { | 17419 else if ($notnull_bool(this.name != null && other.name == null)) { |
| 17060 return -1; | 17420 return -1; |
| 17061 } | 17421 } |
| 17062 else if (this.name != null) { | 17422 else if ($notnull_bool(this.name != null)) { |
| 17063 return this.name.compareTo(other.name); | 17423 return this.name.compareTo(other.name); |
| 17064 } | 17424 } |
| 17065 else { | 17425 else { |
| 17066 return this.field.name.compareTo(other.field.name); | 17426 return this.field.name.compareTo(other.field.name); |
| 17067 } | 17427 } |
| 17068 } | 17428 } |
| 17069 // ********** Code for CompilerException ************** | 17429 // ********** Code for CompilerException ************** |
| 17070 function CompilerException(_message, _location) { | 17430 function CompilerException(_message, _location) { |
| 17071 this._lang_message = _message; | 17431 this._lang_message = _message; |
| 17072 this._location = _location; | 17432 this._location = _location; |
| 17073 // Initializers done | 17433 // Initializers done |
| 17074 } | 17434 } |
| 17075 CompilerException.prototype.toString = function() { | 17435 CompilerException.prototype.toString = function() { |
| 17076 if (this._location != null) { | 17436 if ($notnull_bool(this._location != null)) { |
| 17077 return ('CompilerException: ' + this._location.toMessageString(this._lang_me
ssage) + ''); | 17437 return ('CompilerException: ' + this._location.toMessageString(this._lang_me
ssage) + ''); |
| 17078 } | 17438 } |
| 17079 else { | 17439 else { |
| 17080 return ('CompilerException: ' + this._lang_message + ''); | 17440 return ('CompilerException: ' + this._lang_message + ''); |
| 17081 } | 17441 } |
| 17082 } | 17442 } |
| 17083 // ********** Code for World ************** | 17443 // ********** Code for World ************** |
| 17084 function World(files) { | 17444 function World(files) { |
| 17085 this.errors = 0 | 17445 this.errors = 0 |
| 17086 this.warnings = 0 | 17446 this.warnings = 0 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 17097 } | 17457 } |
| 17098 World.prototype.get$coreimpl = function() { | 17458 World.prototype.get$coreimpl = function() { |
| 17099 return this.libraries.$index('dart:coreimpl'); | 17459 return this.libraries.$index('dart:coreimpl'); |
| 17100 } | 17460 } |
| 17101 World.prototype.get$dom = function() { | 17461 World.prototype.get$dom = function() { |
| 17102 return this.libraries.$index('dart:dom'); | 17462 return this.libraries.$index('dart:dom'); |
| 17103 } | 17463 } |
| 17104 World.prototype.get$functionType = function() { return this.functionType; }; | 17464 World.prototype.get$functionType = function() { return this.functionType; }; |
| 17105 World.prototype.set$functionType = function(value) { return this.functionType =
value; }; | 17465 World.prototype.set$functionType = function(value) { return this.functionType =
value; }; |
| 17106 World.prototype.init = function() { | 17466 World.prototype.init = function() { |
| 17467 var $0; |
| 17107 this.corelib = new Library(this.readFile('dart:core')); | 17468 this.corelib = new Library(this.readFile('dart:core')); |
| 17108 this.libraries.$setindex('dart:core', this.corelib); | 17469 this.libraries.$setindex('dart:core', this.corelib); |
| 17109 this._todo.add(this.corelib); | 17470 this._todo.add(this.corelib); |
| 17110 this.voidType = this._addToCoreLib('void', false); | 17471 this.voidType = (($0 = this._addToCoreLib('void', false)) && $0.is$lang_Type()
); |
| 17111 this.dynamicType = this._addToCoreLib('Dynamic', false); | 17472 this.dynamicType = (($0 = this._addToCoreLib('Dynamic', false)) && $0.is$lang_
Type()); |
| 17112 this.varType = this.dynamicType; | 17473 this.varType = this.dynamicType; |
| 17113 this.objectType = this._addToCoreLib('Object', true); | 17474 this.objectType = (($0 = this._addToCoreLib('Object', true)) && $0.is$lang_Typ
e()); |
| 17114 this.numType = this._addToCoreLib('num', false); | 17475 this.numType = (($0 = this._addToCoreLib('num', false)) && $0.is$lang_Type()); |
| 17115 this.boolType = this._addToCoreLib('bool', false); | 17476 this.intType = (($0 = this._addToCoreLib('int', false)) && $0.is$lang_Type()); |
| 17116 this.stringType = this._addToCoreLib('String', false); | 17477 this.doubleType = (($0 = this._addToCoreLib('double', false)) && $0.is$lang_Ty
pe()); |
| 17117 this.listType = this._addToCoreLib('List', false); | 17478 this.boolType = (($0 = this._addToCoreLib('bool', false)) && $0.is$lang_Type()
); |
| 17118 this.mapType = this._addToCoreLib('Map', false); | 17479 this.stringType = (($0 = this._addToCoreLib('String', false)) && $0.is$lang_Ty
pe()); |
| 17119 this.functionType = this._addToCoreLib('Function', false); | 17480 this.listType = (($0 = this._addToCoreLib('List', false)) && $0.is$lang_Type()
); |
| 17481 this.mapType = (($0 = this._addToCoreLib('Map', false)) && $0.is$lang_Type()); |
| 17482 this.functionType = (($0 = this._addToCoreLib('Function', false)) && $0.is$lan
g_Type()); |
| 17120 } | 17483 } |
| 17121 World.prototype._addMember = function(member) { | 17484 World.prototype._addMember = function(member) { |
| 17122 if (member.get$isStatic()) { | 17485 $assert(!member.get$isPrivate(), "!member.isPrivate", "world.dart", 141, 12); |
| 17123 if (member.declaringType.get$isTop()) { | 17486 if ($notnull_bool(member.get$isStatic())) { |
| 17487 if ($notnull_bool(member.declaringType.get$isTop())) { |
| 17124 this._addTopName(member); | 17488 this._addTopName(member); |
| 17125 } | 17489 } |
| 17126 return; | 17490 return; |
| 17127 } | 17491 } |
| 17128 var mset = this._members.$index(member.name); | 17492 var mset = this._members.$index(member.name); |
| 17129 if (mset == null) { | 17493 if ($notnull_bool(mset == null)) { |
| 17130 mset = new MemberSet(member); | 17494 mset = new MemberSet(member); |
| 17131 this._members.$setindex(mset.get$name(), mset); | 17495 this._members.$setindex(mset.get$name(), mset); |
| 17132 } | 17496 } |
| 17133 else { | 17497 else { |
| 17134 mset.members.add(member); | 17498 mset.members.add(member); |
| 17135 } | 17499 } |
| 17136 } | 17500 } |
| 17137 World.prototype._addTopName = function(named) { | 17501 World.prototype._addTopName = function(named) { |
| 17138 var existing = this._topNames.$index(named.get$name()); | 17502 var existing = this._topNames.$index(named.get$name()); |
| 17139 if ($ne(existing, null)) { | 17503 if ($notnull_bool($ne(existing, null))) { |
| 17140 this.info(('mangling matching top level name "' + named.get$name() + '" in '
) + ('both "' + named.get$library().name + '" and "' + existing.get$library().na
me + '"')); | 17504 this.info(('mangling matching top level name "' + named.get$name() + '" in '
) + ('both "' + named.get$library().name + '" and "' + existing.get$library().na
me + '"')); |
| 17141 if (named.get$isNative()) { | 17505 if ($notnull_bool(named.get$isNative())) { |
| 17142 if (existing.get$isNative()) { | 17506 if ($notnull_bool(existing.get$isNative())) { |
| 17143 world.internalError(('conflicting native names "' + named.get$name() + '
" ') + ('(already defined in ' + existing.get$span().get$locationText() + ')'),
named.get$span()); | 17507 world.internalError(('conflicting native names "' + named.get$name() + '
" ') + ('(already defined in ' + existing.get$span().get$locationText() + ')'),
named.get$span()); |
| 17144 } | 17508 } |
| 17145 else { | 17509 else { |
| 17146 this._topNames.$setindex(named.get$name(), named); | 17510 this._topNames.$setindex(named.get$name(), named); |
| 17147 this._addJavascriptTopName(existing); | 17511 this._addJavascriptTopName((existing && existing.is$Named())); |
| 17148 } | 17512 } |
| 17149 } | 17513 } |
| 17150 else if (named.get$library().get$isCore()) { | 17514 else if ($notnull_bool(named.get$library().get$isCore())) { |
| 17151 if (existing.get$library().get$isCore()) { | 17515 if ($notnull_bool(existing.get$library().get$isCore())) { |
| 17152 world.internalError(('conflicting top-level names in core "' + named.get
$name() + '" ') + ('(previously defined in ' + existing.get$span().get$locationT
ext() + ')'), named.get$span()); | 17516 world.internalError(('conflicting top-level names in core "' + named.get
$name() + '" ') + ('(previously defined in ' + existing.get$span().get$locationT
ext() + ')'), named.get$span()); |
| 17153 } | 17517 } |
| 17154 else { | 17518 else { |
| 17155 this._topNames.$setindex(named.get$name(), named); | 17519 this._topNames.$setindex(named.get$name(), named); |
| 17156 this._addJavascriptTopName(existing); | 17520 this._addJavascriptTopName((existing && existing.is$Named())); |
| 17157 } | 17521 } |
| 17158 } | 17522 } |
| 17159 else { | 17523 else { |
| 17160 this._addJavascriptTopName(named); | 17524 this._addJavascriptTopName(named); |
| 17161 } | 17525 } |
| 17162 } | 17526 } |
| 17163 else { | 17527 else { |
| 17164 this._topNames.$setindex(named.get$name(), named); | 17528 this._topNames.$setindex(named.get$name(), named); |
| 17165 } | 17529 } |
| 17166 } | 17530 } |
| 17167 World.prototype._addJavascriptTopName = function(named) { | 17531 World.prototype._addJavascriptTopName = function(named) { |
| 17168 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name
() + '')); | 17532 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name
() + '')); |
| 17169 var existing = this._topNames.$index(named.get$jsname()); | 17533 var existing = this._topNames.$index(named.get$jsname()); |
| 17170 if ($ne(existing, null) && $ne(existing, named)) { | 17534 if ($notnull_bool($ne(existing, null) && $ne(existing, named))) { |
| 17171 world.internalError(('name mangling failed for "' + named.get$jsname() + '"
') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$span().get
$locationText() + ')'), named.get$span()); | 17535 world.internalError(('name mangling failed for "' + named.get$jsname() + '"
') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$span().get
$locationText() + ')'), named.get$span()); |
| 17172 } | 17536 } |
| 17173 this._topNames.$setindex(named.get$jsname(), named); | 17537 this._topNames.$setindex(named.get$jsname(), named); |
| 17174 } | 17538 } |
| 17175 World.prototype._addType = function(type) { | 17539 World.prototype._addType = function(type) { |
| 17176 if (!type.get$isTop()) this._addTopName(type); | 17540 if ($notnull_bool(!type.get$isTop())) this._addTopName(type); |
| 17177 } | 17541 } |
| 17178 World.prototype._addToCoreLib = function(name, isClass) { | 17542 World.prototype._addToCoreLib = function(name, isClass) { |
| 17179 var ret = new DefinedType(name, this.corelib, null, isClass); | 17543 var ret = new DefinedType(name, this.corelib, null, isClass); |
| 17180 this.corelib.types.$setindex(name, ret); | 17544 this.corelib.types.$setindex(name, ret); |
| 17181 return ret; | 17545 return ret; |
| 17182 } | 17546 } |
| 17183 World.prototype.toJsIdentifier = function(name) { | 17547 World.prototype.toJsIdentifier = function(name) { |
| 17184 if (this._jsKeywords == null) { | 17548 if ($notnull_bool(this._jsKeywords == null)) { |
| 17185 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'])
; | 17549 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'])
; |
| 17186 } | 17550 } |
| 17187 if (this._jsKeywords.contains(name)) { | 17551 if ($notnull_bool(this._jsKeywords.contains(name))) { |
| 17188 return name + '_'; | 17552 return name + '_'; |
| 17189 } | 17553 } |
| 17190 else { | 17554 else { |
| 17191 return name; | 17555 return name; |
| 17192 } | 17556 } |
| 17193 } | 17557 } |
| 17194 World.prototype.compile = function() { | 17558 World.prototype.compile = function() { |
| 17195 if (options.dartScript == null) { | 17559 if ($notnull_bool(options.dartScript == null)) { |
| 17196 this.fatal('no script provided to compile'); | 17560 this.fatal('no script provided to compile'); |
| 17197 return false; | 17561 return false; |
| 17198 } | 17562 } |
| 17199 try { | 17563 try { |
| 17200 this.info(('compiling ' + options.dartScript + ' with corelib ' + this.corel
ib + '')); | 17564 this.info(('compiling ' + options.dartScript + ' with corelib ' + this.corel
ib + '')); |
| 17201 if (!this.runLeg()) this.runCompilationPhases(); | 17565 if ($notnull_bool(!this.runLeg())) this.runCompilationPhases(); |
| 17202 } catch (exc) { | 17566 } catch (exc) { |
| 17203 exc = $toDartException(exc); | 17567 exc = $toDartException(exc); |
| 17204 if (this.get$hasErrors() && !options.throwOnErrors) { | 17568 if ($notnull_bool(this.get$hasErrors() && !options.throwOnErrors)) { |
| 17205 } | 17569 } |
| 17206 else { | 17570 else { |
| 17207 throw exc; | 17571 throw exc; |
| 17208 } | 17572 } |
| 17209 } | 17573 } |
| 17210 this.printStatus(); | 17574 this.printStatus(); |
| 17211 return !this.get$hasErrors(); | 17575 return !this.get$hasErrors(); |
| 17212 } | 17576 } |
| 17213 World.prototype.runLeg = function() { | 17577 World.prototype.runLeg = function() { |
| 17214 var $this = this; // closure support | 17578 var $this = this; // closure support |
| 17215 if (!options.enableLeg) return false; | 17579 if ($notnull_bool(!options.enableLeg)) return false; |
| 17216 var res = this.withTiming('try leg compile', (function () { | 17580 var res = this.withTiming('try leg compile', (function () { |
| 17217 return compile($this); | 17581 return compile($this); |
| 17218 }) | 17582 }) |
| 17219 ); | 17583 ); |
| 17220 if (!res && options.legOnly) { | 17584 if ($notnull_bool(!res && options.legOnly)) { |
| 17221 this.fatal(("Leg could not compile " + options.dartScript + "")); | 17585 this.fatal(("Leg could not compile " + options.dartScript + "")); |
| 17222 } | 17586 } |
| 17223 return res; | 17587 return res; |
| 17224 } | 17588 } |
| 17225 World.prototype.runCompilationPhases = function() { | 17589 World.prototype.runCompilationPhases = function() { |
| 17226 var $this = this; // closure support | 17590 var $this = this; // closure support |
| 17227 var lib = this.withTiming('first pass', (function () { | 17591 var lib = this.withTiming('first pass', (function () { |
| 17228 return $this.processScript(options.dartScript); | 17592 return $this.processScript(options.dartScript); |
| 17229 }) | 17593 }) |
| 17230 ); | 17594 ); |
| 17231 this.withTiming('resolve top level', (function () { | 17595 this.withTiming('resolve top level', (function () { |
| 17232 $this.resolveAll(); | 17596 $this.resolveAll(); |
| 17233 }) | 17597 }) |
| 17234 ); | 17598 ); |
| 17235 this.withTiming('generate code', (function () { | 17599 this.withTiming('generate code', (function () { |
| 17600 var $0; |
| 17236 var mainMembers = lib.topType.resolveMember('main'); | 17601 var mainMembers = lib.topType.resolveMember('main'); |
| 17237 var main = null; | 17602 var main = null; |
| 17238 if (mainMembers == null || mainMembers.members.length == 0) { | 17603 if ($notnull_bool(mainMembers == null || mainMembers.members.length == 0)) { |
| 17239 $this.fatal('no main method specified'); | 17604 $this.fatal('no main method specified'); |
| 17240 } | 17605 } |
| 17241 else if (mainMembers.members.length > 1) { | 17606 else if ($notnull_bool(mainMembers.members.length > 1)) { |
| 17242 var $list = mainMembers.members; | 17607 var $list = mainMembers.members; |
| 17243 for (var $i = mainMembers.members.iterator(); $i.hasNext(); ) { | 17608 for (var $i = mainMembers.members.iterator(); $i.hasNext(); ) { |
| 17244 var m = $i.next(); | 17609 var m = $i.next(); |
| 17245 main = m; | 17610 main = m; |
| 17246 $this.error('more than one main member (using last?)', main.get$span()); | 17611 $this.error('more than one main member (using last?)', main.get$span()); |
| 17247 } | 17612 } |
| 17248 } | 17613 } |
| 17249 else { | 17614 else { |
| 17250 main = mainMembers.members.$index(0); | 17615 main = mainMembers.members.$index(0); |
| 17251 } | 17616 } |
| 17252 var codeWriter = new CodeWriter(); | 17617 var codeWriter = new CodeWriter(); |
| 17253 $this.gen = new WorldGenerator(main, codeWriter); | 17618 $this.gen = new WorldGenerator(main, codeWriter); |
| 17254 $this.gen.run(); | 17619 $this.gen.run(); |
| 17255 $this.jsBytesWritten = codeWriter.get$text().length; | 17620 $this.jsBytesWritten = codeWriter.get$text().length; |
| 17256 }) | 17621 }) |
| 17257 ); | 17622 ); |
| 17258 } | 17623 } |
| 17259 World.prototype.getGeneratedCode = function() { | 17624 World.prototype.getGeneratedCode = function() { |
| 17260 if (this.legCode != null) { | 17625 if ($notnull_bool(this.legCode != null)) { |
| 17626 $assert(options.enableLeg, "options.enableLeg", "world.dart", 304, 14); |
| 17261 return this.legCode; | 17627 return this.legCode; |
| 17262 } | 17628 } |
| 17263 else { | 17629 else { |
| 17264 return this.gen.writer.get$text(); | 17630 return this.gen.writer.get$text(); |
| 17265 } | 17631 } |
| 17266 } | 17632 } |
| 17267 World.prototype.readFile = function(filename) { | 17633 World.prototype.readFile = function(filename) { |
| 17268 try { | 17634 try { |
| 17269 var sourceFile = this.reader.readFile(filename); | 17635 var sourceFile = this.reader.readFile(filename); |
| 17270 this.dartBytesRead += sourceFile.get$text().length; | 17636 this.dartBytesRead += sourceFile.get$text().length; |
| 17271 return sourceFile; | 17637 return sourceFile; |
| 17272 } catch (e) { | 17638 } catch (e) { |
| 17273 e = $toDartException(e); | 17639 e = $toDartException(e); |
| 17274 this.warning(('Error reading file: ' + filename + '')); | 17640 this.warning(('Error reading file: ' + filename + '')); |
| 17275 return new SourceFile(filename, ''); | 17641 return new SourceFile(filename, ''); |
| 17276 } | 17642 } |
| 17277 } | 17643 } |
| 17278 World.prototype.getOrAddLibrary = function(filename) { | 17644 World.prototype.getOrAddLibrary = function(filename) { |
| 17279 var library = this.libraries.$index(filename); | 17645 var library = this.libraries.$index(filename); |
| 17280 if (library == null) { | 17646 if ($notnull_bool(library == null)) { |
| 17281 library = new Library(this.readFile(filename)); | 17647 library = new Library(this.readFile(filename)); |
| 17282 this.info(('read library ' + filename + '')); | 17648 this.info(('read library ' + filename + '')); |
| 17283 if (!library.get$isCore()) { | 17649 if ($notnull_bool(!library.get$isCore())) { |
| 17284 library.imports.add(new LibraryImport(this.corelib)); | 17650 library.imports.add(new LibraryImport(this.corelib)); |
| 17285 } | 17651 } |
| 17286 this.libraries.$setindex(filename, library); | 17652 this.libraries.$setindex(filename, library); |
| 17287 this._todo.add(library); | 17653 this._todo.add(library); |
| 17288 } | 17654 } |
| 17289 return library; | 17655 return library; |
| 17290 } | 17656 } |
| 17291 World.prototype.process = function() { | 17657 World.prototype.process = function() { |
| 17292 while (this._todo.length > 0) { | 17658 while ($notnull_bool(this._todo.length > 0)) { |
| 17293 var todo = this._todo; | 17659 var todo = this._todo; |
| 17294 this._todo = []; | 17660 this._todo = []; |
| 17295 for (var $i = 0;$i < todo.length; $i++) { | 17661 for (var $i = 0;$i < todo.length; $i++) { |
| 17296 var lib = todo.$index($i); | 17662 var lib = todo.$index($i); |
| 17297 new LibraryVisitor(lib); | 17663 new LibraryVisitor(lib); |
| 17298 } | 17664 } |
| 17299 } | 17665 } |
| 17300 } | 17666 } |
| 17301 World.prototype.processScript = function(filename) { | 17667 World.prototype.processScript = function(filename) { |
| 17302 var library = this.getOrAddLibrary(filename); | 17668 var library = this.getOrAddLibrary(filename); |
| 17303 this.process(); | 17669 this.process(); |
| 17304 return library; | 17670 return library; |
| 17305 } | 17671 } |
| 17306 World.prototype.resolveAll = function() { | 17672 World.prototype.resolveAll = function() { |
| 17673 var $0; |
| 17307 var $list = this.libraries.getValues(); | 17674 var $list = this.libraries.getValues(); |
| 17308 for (var $i = this.libraries.getValues().iterator(); $i.hasNext(); ) { | 17675 for (var $i = this.libraries.getValues().iterator(); $i.hasNext(); ) { |
| 17309 var lib = $i.next(); | 17676 var lib = $i.next(); |
| 17310 lib.resolve(); | 17677 lib.resolve(); |
| 17311 } | 17678 } |
| 17312 } | 17679 } |
| 17313 World.prototype._message = function(message, span, span1, throwing) { | 17680 World.prototype._message = function(message, span, span1, throwing) { |
| 17314 var text = message; | 17681 var text = message; |
| 17315 if (span != null) { | 17682 if ($notnull_bool(span != null)) { |
| 17316 text = span.toMessageString(message); | 17683 text = span.toMessageString(message); |
| 17317 } | 17684 } |
| 17318 print(text); | 17685 print(text); |
| 17319 if (span1 != null) { | 17686 if ($notnull_bool(span1 != null)) { |
| 17320 print(span1.toMessageString(message)); | 17687 print(span1.toMessageString(message)); |
| 17321 } | 17688 } |
| 17322 if (throwing) { | 17689 if ($notnull_bool(throwing)) { |
| 17323 $throw(new CompilerException(message, span)); | 17690 $throw(new CompilerException(message, span)); |
| 17324 } | 17691 } |
| 17325 } | 17692 } |
| 17326 World.prototype.error = function(message, span, span1) { | 17693 World.prototype.error = function(message, span, span1) { |
| 17327 this.errors++; | 17694 this.errors++; |
| 17328 this._message(('error: ' + message + ''), span, span1, options.throwOnErrors); | 17695 this._message(('error: ' + message + ''), span, span1, options.throwOnErrors); |
| 17329 } | 17696 } |
| 17330 World.prototype.warning = function(message, span, span1) { | 17697 World.prototype.warning = function(message, span, span1) { |
| 17331 this.warnings++; | 17698 this.warnings++; |
| 17332 if (options.showWarnings) { | 17699 if ($notnull_bool(options.showWarnings)) { |
| 17333 this._message(('warning: ' + message + ''), span, span1, options.throwOnWarn
ings); | 17700 this._message(('warning: ' + message + ''), span, span1, options.throwOnWarn
ings); |
| 17334 } | 17701 } |
| 17335 } | 17702 } |
| 17336 World.prototype.fatal = function(message, span, span1) { | 17703 World.prototype.fatal = function(message, span, span1) { |
| 17337 this.errors++; | 17704 this.errors++; |
| 17338 this.seenFatal = true; | 17705 this.seenFatal = true; |
| 17339 this._message(('fatal: ' + message + ''), span, span1, options.throwOnFatal ||
options.throwOnErrors); | 17706 this._message(('fatal: ' + message + ''), span, span1, $assert_bool(options.th
rowOnFatal || options.throwOnErrors)); |
| 17340 } | 17707 } |
| 17341 World.prototype.internalError = function(message, span, span1) { | 17708 World.prototype.internalError = function(message, span, span1) { |
| 17342 this._message(('We are sorry, but... ' + message + ''), span, span1, true); | 17709 this._message(('We are sorry, but... ' + message + ''), span, span1, true); |
| 17343 } | 17710 } |
| 17344 World.prototype.info = function(message, span, span1) { | 17711 World.prototype.info = function(message, span, span1) { |
| 17345 if (options.showInfo) { | 17712 if ($notnull_bool(options.showInfo)) { |
| 17346 this._message(('info: ' + message + ''), span, span1, false); | 17713 this._message(('info: ' + message + ''), span, span1, false); |
| 17347 } | 17714 } |
| 17348 } | 17715 } |
| 17349 World.prototype.get$hasErrors = function() { | 17716 World.prototype.get$hasErrors = function() { |
| 17350 return this.errors > 0; | 17717 return this.errors > 0; |
| 17351 } | 17718 } |
| 17352 World.prototype.printStatus = function() { | 17719 World.prototype.printStatus = function() { |
| 17353 this.info(('compiled ' + this.dartBytesRead + ' bytes Dart -> ' + this.jsBytes
Written + ' bytes JS')); | 17720 this.info(('compiled ' + this.dartBytesRead + ' bytes Dart -> ' + this.jsBytes
Written + ' bytes JS')); |
| 17354 if (this.get$hasErrors()) { | 17721 if ($notnull_bool(this.get$hasErrors())) { |
| 17355 print(('compilation failed with ' + this.errors + ' errors')); | 17722 print(('compilation failed with ' + this.errors + ' errors')); |
| 17356 } | 17723 } |
| 17357 else { | 17724 else { |
| 17358 if (this.warnings > 0) { | 17725 if ($notnull_bool(this.warnings > 0)) { |
| 17359 this.info(('compilation completed successfully with ' + this.warnings + '
warnings')); | 17726 this.info(('compilation completed successfully with ' + this.warnings + '
warnings')); |
| 17360 } | 17727 } |
| 17361 else { | 17728 else { |
| 17362 this.info('compilation completed sucessfully'); | 17729 this.info('compilation completed sucessfully'); |
| 17363 } | 17730 } |
| 17364 } | 17731 } |
| 17365 } | 17732 } |
| 17366 World.prototype.withTiming = function(name, f) { | 17733 World.prototype.withTiming = function(name, f) { |
| 17367 var sw = new StopWatchImplementation(); | 17734 var sw = new StopWatchImplementation(); |
| 17368 sw.start(); | 17735 sw.start(); |
| 17369 var result = f(); | 17736 var result = f(); |
| 17370 sw.stop(); | 17737 sw.stop(); |
| 17371 this.info(('' + name + ' in ' + sw.elapsedInMs() + 'msec')); | 17738 this.info(('' + name + ' in ' + sw.elapsedInMs() + 'msec')); |
| 17372 return result; | 17739 return result; |
| 17373 } | 17740 } |
| 17374 // ********** Code for FrogOptions ************** | 17741 // ********** Code for FrogOptions ************** |
| 17375 function FrogOptions(homedir, args, files) { | 17742 function FrogOptions(homedir, args, files) { |
| 17743 var $0; |
| 17376 this.enableLeg = false | 17744 this.enableLeg = false |
| 17377 this.legOnly = false | 17745 this.legOnly = false |
| 17378 this.enableAsserts = false | 17746 this.enableAsserts = false |
| 17379 this.enableTypeChecks = false | 17747 this.enableTypeChecks = false |
| 17380 this.verifyImplements = false | 17748 this.verifyImplements = false |
| 17381 this.compileAll = false | 17749 this.compileAll = false |
| 17382 this.dietParse = false | 17750 this.dietParse = false |
| 17383 this.compileOnly = false | 17751 this.compileOnly = false |
| 17384 this.throwOnErrors = false | 17752 this.throwOnErrors = false |
| 17385 this.throwOnWarnings = false | 17753 this.throwOnWarnings = false |
| 17386 this.throwOnFatal = false | 17754 this.throwOnFatal = false |
| 17387 this.showInfo = false | 17755 this.showInfo = false |
| 17388 this.showWarnings = true | 17756 this.showWarnings = true |
| 17389 // Initializers done | 17757 // Initializers done |
| 17390 this.libDir = homedir + '/lib'; | 17758 this.libDir = homedir + '/lib'; |
| 17391 var ignoreUnrecognizedFlags = false; | 17759 var ignoreUnrecognizedFlags = false; |
| 17392 var passedLibDir = false; | 17760 var passedLibDir = false; |
| 17393 this.childArgs = []; | 17761 this.childArgs = []; |
| 17394 loop: | 17762 loop: |
| 17395 for (var i = 2; | 17763 for (var i = 2; |
| 17396 i < args.length; i++) { | 17764 $notnull_bool(i < args.length); i++) { |
| 17397 var arg = args.$index(i); | 17765 var arg = args.$index(i); |
| 17398 switch (arg) { | 17766 switch (arg) { |
| 17399 case '--enable_leg': | 17767 case '--enable_leg': |
| 17400 | 17768 |
| 17401 this.enableLeg = true; | 17769 this.enableLeg = true; |
| 17402 continue loop; | 17770 continue loop; |
| 17403 | 17771 |
| 17404 case '--leg_only': | 17772 case '--leg_only': |
| 17405 | 17773 |
| 17406 this.enableLeg = true; | 17774 this.enableLeg = true; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17453 this.throwOnWarnings = true; | 17821 this.throwOnWarnings = true; |
| 17454 continue loop; | 17822 continue loop; |
| 17455 | 17823 |
| 17456 case '--compile-only': | 17824 case '--compile-only': |
| 17457 | 17825 |
| 17458 this.compileOnly = true; | 17826 this.compileOnly = true; |
| 17459 continue loop; | 17827 continue loop; |
| 17460 | 17828 |
| 17461 default: | 17829 default: |
| 17462 | 17830 |
| 17463 if (arg.endsWith('.dart')) { | 17831 if ($notnull_bool(arg.endsWith('.dart'))) { |
| 17464 this.dartScript = arg; | 17832 this.dartScript = $assert_String(arg); |
| 17465 this.childArgs = args.getRange(i + 1, args.length - i - 1); | 17833 this.childArgs = (($0 = args.getRange(i + 1, args.length - i - 1)) &&
$0.is$List$String()); |
| 17466 break loop; | 17834 break loop; |
| 17467 } | 17835 } |
| 17468 else if (arg.startsWith('--out=')) { | 17836 else if ($notnull_bool(arg.startsWith('--out='))) { |
| 17469 this.outfile = arg.substring('--out='.length); | 17837 this.outfile = arg.substring('--out='.length); |
| 17470 } | 17838 } |
| 17471 else if (arg.startsWith('--libdir=')) { | 17839 else if ($notnull_bool(arg.startsWith('--libdir='))) { |
| 17472 this.libDir = arg.substring('--libdir='.length); | 17840 this.libDir = arg.substring('--libdir='.length); |
| 17473 passedLibDir = true; | 17841 passedLibDir = true; |
| 17474 } | 17842 } |
| 17475 else { | 17843 else { |
| 17476 if (!ignoreUnrecognizedFlags) { | 17844 if ($notnull_bool(!ignoreUnrecognizedFlags)) { |
| 17477 print(('unrecognized flag: "' + arg + '"')); | 17845 print(('unrecognized flag: "' + arg + '"')); |
| 17478 } | 17846 } |
| 17479 } | 17847 } |
| 17480 | 17848 |
| 17481 } | 17849 } |
| 17482 } | 17850 } |
| 17483 if (!passedLibDir && !files.fileExists(this.libDir)) { | 17851 if ($notnull_bool(!passedLibDir && !files.fileExists(this.libDir))) { |
| 17484 var temp = 'frog/lib'; | 17852 var temp = 'frog/lib'; |
| 17485 if (files.fileExists(temp)) { | 17853 if ($notnull_bool(files.fileExists(temp))) { |
| 17486 this.libDir = temp; | 17854 this.libDir = $assert_String(temp); |
| 17487 } | 17855 } |
| 17488 else { | 17856 else { |
| 17489 this.libDir = 'lib'; | 17857 this.libDir = 'lib'; |
| 17490 } | 17858 } |
| 17491 } | 17859 } |
| 17492 } | 17860 } |
| 17493 // ********** Code for LibraryReader ************** | 17861 // ********** Code for LibraryReader ************** |
| 17494 function LibraryReader() { | 17862 function LibraryReader() { |
| 17495 // Initializers done | 17863 // Initializers done |
| 17496 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')]); | 17864 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')]); |
| 17497 } | 17865 } |
| 17498 LibraryReader.prototype.readFile = function(fullname) { | 17866 LibraryReader.prototype.readFile = function(fullname) { |
| 17499 var filename = this._specialLibs.$index(fullname); | 17867 var filename = this._specialLibs.$index(fullname); |
| 17500 if (filename == null) { | 17868 if ($notnull_bool(filename == null)) { |
| 17501 filename = fullname; | 17869 filename = fullname; |
| 17502 } | 17870 } |
| 17503 if (world.files.fileExists(filename)) { | 17871 if ($notnull_bool(world.files.fileExists(filename))) { |
| 17504 return new SourceFile(filename, world.files.readAll(filename)); | 17872 return new SourceFile(filename, world.files.readAll(filename)); |
| 17505 } | 17873 } |
| 17506 else { | 17874 else { |
| 17507 world.error(('File not found: ' + filename + '')); | 17875 world.error(('File not found: ' + filename + '')); |
| 17508 return new SourceFile(filename, ''); | 17876 return new SourceFile(filename, ''); |
| 17509 } | 17877 } |
| 17510 } | 17878 } |
| 17511 // ********** Code for VarMember ************** | 17879 // ********** Code for VarMember ************** |
| 17512 function VarMember(name) { | 17880 function VarMember(name) { |
| 17513 this.name = name; | 17881 this.name = name; |
| 17514 // Initializers done | 17882 // Initializers done |
| 17515 } | 17883 } |
| 17884 VarMember.prototype.is$VarMember = function(){return this;}; |
| 17516 VarMember.prototype.get$name = function() { return this.name; }; | 17885 VarMember.prototype.get$name = function() { return this.name; }; |
| 17517 VarMember.prototype.get$returnType = function() { | 17886 VarMember.prototype.get$returnType = function() { |
| 17518 return world.varType; | 17887 return world.varType; |
| 17519 } | 17888 } |
| 17520 VarMember.prototype.invoke = function(context, node, target, args) { | 17889 VarMember.prototype.invoke = function(context, node, target, args) { |
| 17521 return new Value(this.get$returnType(), ('' + target.code + '.' + this.name +
'(' + args.getCode() + ')'), false, true, false); | 17890 return new Value(this.get$returnType(), ('' + target.code + '.' + this.name +
'(' + args.getCode() + ')'), false, true, false); |
| 17522 } | 17891 } |
| 17523 VarMember.prototype.invoke$4 = VarMember.prototype.invoke; | 17892 VarMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 17893 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments())); |
| 17894 } |
| 17895 ; |
| 17524 // ********** Code for VarFunctionStub ************** | 17896 // ********** Code for VarFunctionStub ************** |
| 17525 function VarFunctionStub(name0, callArgs) { | 17897 function VarFunctionStub(name0, callArgs) { |
| 17526 this.args = callArgs.toCallStubArgs(); | 17898 this.args = callArgs.toCallStubArgs(); |
| 17527 VarMember.call(this, name0); | 17899 VarMember.call(this, name0); |
| 17528 // Initializers done | 17900 // Initializers done |
| 17529 } | 17901 } |
| 17530 $inherits(VarFunctionStub, VarMember); | 17902 $inherits(VarFunctionStub, VarMember); |
| 17531 VarFunctionStub.prototype.generate = function(code) { | 17903 VarFunctionStub.prototype.generate = function(code) { |
| 17532 if (this.args.get$hasNames()) { | 17904 if ($notnull_bool(this.args.get$hasNames())) { |
| 17533 this.generateNamed(code); | 17905 this.generateNamed(code); |
| 17534 } | 17906 } |
| 17535 else { | 17907 else { |
| 17536 this.generatePositional(code); | 17908 this.generatePositional(code); |
| 17537 } | 17909 } |
| 17538 } | 17910 } |
| 17539 VarFunctionStub.prototype.generatePositional = function(w) { | 17911 VarFunctionStub.prototype.generatePositional = function(w) { |
| 17540 var arity = this.args.get$length(); | 17912 var arity = this.args.get$length(); |
| 17541 w.enterBlock(('Function.prototype.to\$' + this.name + ' = function() {')); | 17913 w.enterBlock(('Function.prototype.to\$' + this.name + ' = function() {')); |
| 17542 w.writeln(('this.' + this.name + ' = this.\$genStub(' + arity + ');')); | 17914 w.writeln(('this.' + this.name + ' = this.\$genStub(' + arity + ');')); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 17560 // ********** Code for VarMethodStub ************** | 17932 // ********** Code for VarMethodStub ************** |
| 17561 function VarMethodStub(name0, member, args, body) { | 17933 function VarMethodStub(name0, member, args, body) { |
| 17562 this.member = member; | 17934 this.member = member; |
| 17563 this.args = args; | 17935 this.args = args; |
| 17564 this.body = body; | 17936 this.body = body; |
| 17565 VarMember.call(this, name0); | 17937 VarMember.call(this, name0); |
| 17566 // Initializers done | 17938 // Initializers done |
| 17567 } | 17939 } |
| 17568 $inherits(VarMethodStub, VarMember); | 17940 $inherits(VarMethodStub, VarMember); |
| 17569 VarMethodStub.prototype.get$returnType = function() { | 17941 VarMethodStub.prototype.get$returnType = function() { |
| 17570 return this.member != null ? this.member.get$returnType() : world.varType; | 17942 return $notnull_bool(this.member != null) ? this.member.get$returnType() : wor
ld.varType; |
| 17571 } | 17943 } |
| 17572 VarMethodStub.prototype.get$typeName = function() { | 17944 VarMethodStub.prototype.get$typeName = function() { |
| 17573 return this.member != null ? this.member.declaringType.get$jsname() : 'Object'
; | 17945 return $notnull_bool(this.member != null) ? this.member.declaringType.get$jsna
me() : 'Object'; |
| 17574 } | 17946 } |
| 17575 VarMethodStub.prototype.generate = function(code) { | 17947 VarMethodStub.prototype.generate = function(code) { |
| 17576 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = ')); | 17948 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = ')); |
| 17577 this.generateBody(code); | 17949 this.generateBody(code); |
| 17578 code.writeln(';'); | 17950 code.writeln(';'); |
| 17579 } | 17951 } |
| 17580 VarMethodStub.prototype.generateBody = function(code) { | 17952 VarMethodStub.prototype.generateBody = function(code) { |
| 17581 if (this._useDirectCall(this.member, this.args)) { | 17953 if ($notnull_bool(this._useDirectCall(this.member, this.args))) { |
| 17582 code.write(('' + this.get$typeName() + '.prototype.' + this.member.get$jsnam
e() + '')); | 17954 code.write(('' + this.get$typeName() + '.prototype.' + this.member.get$jsnam
e() + '')); |
| 17583 } | 17955 } |
| 17584 else { | 17956 else { |
| 17585 code.enterBlock(('function(' + this.args.getCode() + ') {')); | 17957 code.enterBlock(('function(' + this.args.getCode() + ') {')); |
| 17586 code.writeln(('return ' + this.body.code + ';')); | 17958 code.writeln(('return ' + this.body.code + ';')); |
| 17587 code.exitBlock('}'); | 17959 code.exitBlock('}'); |
| 17588 } | 17960 } |
| 17589 } | 17961 } |
| 17590 VarMethodStub.prototype._useDirectCall = function(member0, args0) { | 17962 VarMethodStub.prototype._useDirectCall = function(member0, args0) { |
| 17591 if ((member0 instanceof MethodMember) && $ne(member0.declaringType.get$library
(), world.get$dom())) { | 17963 if ($notnull_bool((member0 instanceof MethodMember) && $ne(member0.declaringTy
pe.get$library(), world.get$dom()))) { |
| 17592 var method = member0; | 17964 var method = member0; |
| 17593 method.genParameterValues(); | 17965 if ($notnull_bool(method.needsArgumentConversion(args0))) { |
| 17966 return false; |
| 17967 } |
| 17594 for (var i = args0.get$length(); | 17968 for (var i = args0.get$length(); |
| 17595 i < method.parameters.length; i++) { | 17969 $notnull_bool(i < method.parameters.length); i++) { |
| 17596 if (method.parameters.$index(i).get$value().code != 'null') { | 17970 if ($notnull_bool(method.parameters.$index(i).get$value().code != 'null'))
{ |
| 17597 return false; | 17971 return false; |
| 17598 } | 17972 } |
| 17599 } | 17973 } |
| 17600 return method.namesInOrder(args0); | 17974 return method.namesInOrder(args0); |
| 17601 } | 17975 } |
| 17602 else { | 17976 else { |
| 17603 return false; | 17977 return false; |
| 17604 } | 17978 } |
| 17605 } | 17979 } |
| 17606 // ********** Code for VarMethodSet ************** | 17980 // ********** Code for VarMethodSet ************** |
| 17607 function VarMethodSet(name0, members, callArgs, returnType) { | 17981 function VarMethodSet(name0, members, callArgs, returnType) { |
| 17608 this.members = members; | 17982 this.members = members; |
| 17609 this.returnType = returnType; | 17983 this.returnType = returnType; |
| 17610 this.args = callArgs.toCallStubArgs(); | 17984 this.args = callArgs.toCallStubArgs(); |
| 17611 VarMember.call(this, name0); | 17985 VarMember.call(this, name0); |
| 17612 // Initializers done | 17986 // Initializers done |
| 17613 } | 17987 } |
| 17614 $inherits(VarMethodSet, VarMember); | 17988 $inherits(VarMethodSet, VarMember); |
| 17615 VarMethodSet.prototype.get$returnType = function() { return this.returnType; }; | 17989 VarMethodSet.prototype.get$returnType = function() { return this.returnType; }; |
| 17616 VarMethodSet.prototype.get$baseName = function() { | 17990 VarMethodSet.prototype.get$baseName = function() { |
| 17617 return this.members.$index(0).get$name(); | 17991 return this.members.$index(0).get$name(); |
| 17618 } | 17992 } |
| 17619 VarMethodSet.prototype.invoke = function(context, node, target, args0) { | 17993 VarMethodSet.prototype.invoke = function(context, node, target, args0) { |
| 17620 this._invokeMembers(context, node); | 17994 this._invokeMembers(context, node); |
| 17621 return VarMember.prototype.invoke.call(this, context, node, target, args0); | 17995 return VarMember.prototype.invoke.call(this, context, node, target, args0); |
| 17622 } | 17996 } |
| 17623 VarMethodSet.prototype._invokeMembers = function(context, node) { | 17997 VarMethodSet.prototype._invokeMembers = function(context, node) { |
| 17624 if (this._fallbackStubs != null) return; | 17998 if ($notnull_bool(this._fallbackStubs != null)) return; |
| 17625 this._fallbackStubs = []; | 17999 this._fallbackStubs = []; |
| 17626 var $list = this.members; | 18000 var $list = this.members; |
| 17627 for (var $i = 0;$i < $list.length; $i++) { | 18001 for (var $i = 0;$i < $list.length; $i++) { |
| 17628 var member = $list.$index($i); | 18002 var member = $list.$index($i); |
| 17629 var target = new Value(member.declaringType, 'this', false, true, false); | 18003 var target = new Value(member.declaringType, 'this', false, true, false); |
| 17630 var result = member.invoke$4(context, node, target, this.args); | 18004 var result = member.invoke$4(context, node, target, this.args); |
| 17631 var stub = new VarMethodStub(this.name, member, this.args, result); | 18005 var stub = new VarMethodStub(this.name, member, this.args, result); |
| 17632 var type = member.declaringType; | 18006 var type = member.declaringType; |
| 17633 if ($ne(type.get$library(), world.get$dom()) && !type.get$isObject()) { | 18007 if ($notnull_bool($ne(type.get$library(), world.get$dom()) && !type.get$isOb
ject())) { |
| 17634 VarMethodSet._addVarStub(type, stub); | 18008 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V
arMember())); |
| 17635 } | 18009 } |
| 17636 else { | 18010 else { |
| 17637 this._fallbackStubs.add(stub); | 18011 this._fallbackStubs.add(stub); |
| 17638 } | 18012 } |
| 17639 } | 18013 } |
| 17640 var target = new Value(world.objectType, 'this', false, true, false); | 18014 var target = new Value(world.objectType, 'this', false, true, false); |
| 17641 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, thi
s.args); | 18015 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, thi
s.args); |
| 17642 var stub = new VarMethodStub(this.name, null, this.args, result); | 18016 var stub = new VarMethodStub(this.name, null, this.args, result); |
| 17643 if (this._fallbackStubs.length == 0) { | 18017 if ($notnull_bool(this._fallbackStubs.length == 0)) { |
| 17644 VarMethodSet._addVarStub(world.objectType, stub); | 18018 VarMethodSet._addVarStub(world.objectType, (stub && stub.is$VarMember())); |
| 17645 } | 18019 } |
| 17646 else { | 18020 else { |
| 17647 this._fallbackStubs.add(stub); | 18021 this._fallbackStubs.add(stub); |
| 17648 } | 18022 } |
| 17649 } | 18023 } |
| 17650 VarMethodSet._addVarStub = function(type, stub) { | 18024 VarMethodSet._addVarStub = function(type, stub) { |
| 17651 if (type.varStubs == null) type.varStubs = $map([]); | 18025 if ($notnull_bool(type.varStubs == null)) type.varStubs = $map([]); |
| 17652 type.varStubs.$setindex(stub.name, stub); | 18026 type.varStubs.$setindex(stub.name, stub); |
| 17653 } | 18027 } |
| 17654 VarMethodSet.prototype.generate = function(code) { | 18028 VarMethodSet.prototype.generate = function(code) { |
| 17655 if (this._fallbackStubs.length == 0) return; | 18029 if ($notnull_bool(this._fallbackStubs.length == 0)) return; |
| 17656 code.enterBlock(('\$varMethod("' + this.name + '", {')); | 18030 code.enterBlock(('\$varMethod("' + this.name + '", {')); |
| 17657 var $list = this._fallbackStubs; | 18031 var $list = this._fallbackStubs; |
| 17658 for (var $i = 0;$i < $list.length; $i++) { | 18032 for (var $i = 0;$i < $list.length; $i++) { |
| 17659 var stub = $list.$index($i); | 18033 var stub = $list.$index($i); |
| 17660 code.write(('"' + stub.get$typeName() + '": ')); | 18034 code.write(('"' + stub.get$typeName() + '": ')); |
| 17661 stub.generateBody(code); | 18035 stub.generateBody(code); |
| 17662 code.writeln(','); | 18036 code.writeln(','); |
| 17663 } | 18037 } |
| 17664 code.exitBlock('});'); | 18038 code.exitBlock('});'); |
| 17665 } | 18039 } |
| 17666 VarMethodSet.prototype.invoke$4 = VarMethodSet.prototype.invoke; | 18040 VarMethodSet.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 18041 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments())); |
| 18042 } |
| 18043 ; |
| 17667 // ********** Code for top level ************** | 18044 // ********** Code for top level ************** |
| 17668 function map(source, mapper) { | 18045 function map(source, mapper) { |
| 18046 var $0; |
| 17669 var result = new ListFactory(); | 18047 var result = new ListFactory(); |
| 17670 if (!!(source && source.is$List)) { | 18048 if ($notnull_bool(!!(source && source.is$List))) { |
| 17671 var list = source; | 18049 var list = source; |
| 17672 result.length = list.length; | 18050 result.length = list.length; |
| 17673 for (var i = 0; | 18051 for (var i = 0; |
| 17674 i < list.length; i++) { | 18052 $notnull_bool(i < list.length); i++) { |
| 17675 result.$setindex(i, mapper.call$1(list.$index(i))); | 18053 result.$setindex(i, mapper.call$1(list.$index(i))); |
| 17676 } | 18054 } |
| 17677 } | 18055 } |
| 17678 else { | 18056 else { |
| 17679 for (var $i = source.iterator(); $i.hasNext(); ) { | 18057 for (var $i = source.iterator(); $i.hasNext(); ) { |
| 17680 var item = $i.next(); | 18058 var item = $i.next(); |
| 17681 result.add(mapper.call$1(item)); | 18059 result.add(mapper.call$1(item)); |
| 17682 } | 18060 } |
| 17683 } | 18061 } |
| 17684 return result; | 18062 return result; |
| 17685 } | 18063 } |
| 17686 function reduce(source, callback, initialValue) { | 18064 function reduce(source, callback, initialValue) { |
| 17687 var i = source.iterator(); | 18065 var i = source.iterator(); |
| 17688 var current = initialValue; | 18066 var current = initialValue; |
| 17689 if (current == null && i.hasNext()) { | 18067 if ($notnull_bool(current == null && i.hasNext())) { |
| 17690 current = i.next(); | 18068 current = i.next(); |
| 17691 } | 18069 } |
| 17692 while (i.hasNext()) { | 18070 while ($notnull_bool(i.hasNext())) { |
| 17693 current = callback.call$2(current, i.next()); | 18071 current = callback.call$2(current, i.next()); |
| 17694 } | 18072 } |
| 17695 return current; | 18073 return current; |
| 17696 } | 18074 } |
| 17697 function orderValuesByKeys(map0) { | 18075 function orderValuesByKeys(map0) { |
| 18076 var $0; |
| 17698 var keys = map0.getKeys(); | 18077 var keys = map0.getKeys(); |
| 17699 keys.sort((function (x, y) { | 18078 keys.sort((function (x, y) { |
| 17700 return x.compareTo(y); | 18079 return x.compareTo(y); |
| 17701 }) | 18080 }) |
| 17702 ); | 18081 ); |
| 17703 var values = []; | 18082 var values = []; |
| 17704 for (var $i = keys.iterator(); $i.hasNext(); ) { | 18083 for (var $i = keys.iterator(); $i.hasNext(); ) { |
| 17705 var k = $i.next(); | 18084 var k = $i.next(); |
| 17706 values.add(map0.$index(k)); | 18085 values.add(map0.$index(k)); |
| 17707 } | 18086 } |
| 17708 return values; | 18087 return values; |
| 17709 } | 18088 } |
| 17710 function isMultilineString(text) { | 18089 function isMultilineString(text) { |
| 17711 return text.startsWith('"""') || text.startsWith("'''"); | 18090 return text.startsWith('"""') || text.startsWith("'''"); |
| 17712 } | 18091 } |
| 17713 function isRawMultilineString(text) { | 18092 function isRawMultilineString(text) { |
| 17714 return text.startsWith('@"""') || text.startsWith("@'''"); | 18093 return text.startsWith('@"""') || text.startsWith("@'''"); |
| 17715 } | 18094 } |
| 17716 function parseStringLiteral(lit) { | 18095 function parseStringLiteral(lit) { |
| 17717 if (lit.startsWith('@')) { | 18096 if ($notnull_bool(lit.startsWith('@'))) { |
| 17718 if (isRawMultilineString(lit)) { | 18097 if ($notnull_bool(isRawMultilineString(lit))) { |
| 17719 return stripLeadingNewline(lit.substring(4, lit.length - 3)); | 18098 return stripLeadingNewline(lit.substring(4, lit.length - 3)); |
| 17720 } | 18099 } |
| 17721 else { | 18100 else { |
| 17722 return lit.substring(2, lit.length - 1); | 18101 return lit.substring(2, lit.length - 1); |
| 17723 } | 18102 } |
| 17724 } | 18103 } |
| 17725 else if (isMultilineString(lit)) { | 18104 else if ($notnull_bool(isMultilineString(lit))) { |
| 17726 lit = lit.substring(3, lit.length - 3).replaceAll('\\\$', '\$'); | 18105 lit = lit.substring(3, lit.length - 3).replaceAll('\\\$', '\$'); |
| 17727 return stripLeadingNewline(lit); | 18106 return stripLeadingNewline(lit); |
| 17728 } | 18107 } |
| 17729 else { | 18108 else { |
| 17730 return lit.substring(1, lit.length - 1).replaceAll('\\\$', '\$'); | 18109 return lit.substring(1, lit.length - 1).replaceAll('\\\$', '\$'); |
| 17731 } | 18110 } |
| 17732 } | 18111 } |
| 17733 function stripLeadingNewline(text) { | 18112 function stripLeadingNewline(text) { |
| 17734 if (text.startsWith('\n')) { | 18113 if ($notnull_bool(text.startsWith('\n'))) { |
| 17735 return text.substring(1); | 18114 return text.substring(1); |
| 17736 } | 18115 } |
| 17737 else if (text.startsWith('\r')) { | 18116 else if ($notnull_bool(text.startsWith('\r'))) { |
| 17738 if (text.startsWith('\r\n')) { | 18117 if ($notnull_bool(text.startsWith('\r\n'))) { |
| 17739 return text.substring(2); | 18118 return text.substring(2); |
| 17740 } | 18119 } |
| 17741 else { | 18120 else { |
| 17742 return text.substring(1); | 18121 return text.substring(1); |
| 17743 } | 18122 } |
| 17744 } | 18123 } |
| 17745 else { | 18124 else { |
| 17746 return text; | 18125 return text; |
| 17747 } | 18126 } |
| 17748 } | 18127 } |
| 17749 var world; | 18128 var world; |
| 17750 function initializeWorld(files) { | 18129 function initializeWorld(files) { |
| 18130 $assert(world == null, "world == null", "world.dart", 13, 10); |
| 17751 world = new World(files); | 18131 world = new World(files); |
| 17752 world.init(); | 18132 world.init(); |
| 17753 } | 18133 } |
| 17754 function lang_compile(homedir, args, files) { | 18134 function lang_compile(homedir, args, files) { |
| 17755 parseOptions(homedir, args, files); | 18135 parseOptions(homedir, args, files); |
| 17756 initializeWorld(files); | 18136 initializeWorld(files); |
| 17757 var success = world.compile(); | 18137 var success = world.compile(); |
| 17758 if (options.outfile != null) { | 18138 if ($notnull_bool(options.outfile != null)) { |
| 17759 if (success) { | 18139 if ($notnull_bool(success)) { |
| 17760 var code = world.getGeneratedCode(); | 18140 var code = world.getGeneratedCode(); |
| 17761 if (!options.outfile.endsWith('.js')) { | 18141 if ($notnull_bool(!options.outfile.endsWith('.js'))) { |
| 17762 code = '#!/usr/bin/env node\n' + code; | 18142 code = '#!/usr/bin/env node\n' + code; |
| 17763 } | 18143 } |
| 17764 world.files.writeString(options.outfile, code); | 18144 world.files.writeString(options.outfile, code); |
| 17765 } | 18145 } |
| 17766 else { | 18146 else { |
| 17767 world.files.writeString(options.outfile, "throw 'Sorry, but I could not ge
nerate reasonable code to run.\\n';"); | 18147 world.files.writeString(options.outfile, "throw 'Sorry, but I could not ge
nerate reasonable code to run.\\n';"); |
| 17768 } | 18148 } |
| 17769 } | 18149 } |
| 17770 return success; | 18150 return success; |
| 17771 } | 18151 } |
| 17772 var options; | 18152 var options; |
| 17773 function parseOptions(homedir, args, files) { | 18153 function parseOptions(homedir, args, files) { |
| 18154 $assert(options == null, "options == null", "frog_options.dart", 10, 10); |
| 17774 options = new FrogOptions(homedir, args, files); | 18155 options = new FrogOptions(homedir, args, files); |
| 17775 } | 18156 } |
| 17776 function _getCallStubName(name, args) { | 18157 function _getCallStubName(name, args) { |
| 17777 var nameBuilder = new StringBufferImpl(('' + name + '\$' + args.get$bareCount(
) + '')); | 18158 var nameBuilder = new StringBufferImpl(('' + name + '\$' + args.get$bareCount(
) + '')); |
| 17778 for (var i = args.get$bareCount(); | 18159 for (var i = args.get$bareCount(); |
| 17779 i < args.get$length(); i++) { | 18160 $notnull_bool(i < args.get$length()); i++) { |
| 17780 nameBuilder.add('\$').add(args.getName(i)); | 18161 nameBuilder.add('\$').add(args.getName(i)); |
| 17781 } | 18162 } |
| 17782 return nameBuilder.toString(); | 18163 return nameBuilder.toString(); |
| 17783 } | 18164 } |
| 17784 // ********** Library frog ************** | 18165 // ********** Library frog ************** |
| 17785 // ********** Code for top level ************** | 18166 // ********** Code for top level ************** |
| 17786 function main() { | 18167 function main() { |
| 17787 var homedir = get$path().dirname(get$fs().realpathSync(process.argv.$index(1))
); | 18168 var homedir = get$path().dirname(get$fs().realpathSync($assert_String(process.
argv.$index(1)))); |
| 17788 if (lang_compile(homedir, process.argv, new NodeFileSystem())) { | 18169 var argv = ListFactory.ListFactory$from$factory(process.argv); |
| 18170 if ($notnull_bool(lang_compile($assert_String(homedir), (argv && argv.is$List$
String()), new NodeFileSystem()))) { |
| 17789 var code = world.getGeneratedCode(); | 18171 var code = world.getGeneratedCode(); |
| 17790 if (!options.compileOnly) { | 18172 if ($notnull_bool(!options.compileOnly)) { |
| 17791 process.argv = [process.argv.$index(0), process.argv.$index(1)]; | 18173 process.argv = [argv.$index(0), argv.$index(1)]; |
| 17792 process.argv.addAll(options.childArgs); | 18174 process.argv.addAll(options.childArgs); |
| 17793 get$vm().runInNewContext(code, createSandbox()); | 18175 get$vm().runInNewContext($assert_String(code), createSandbox()); |
| 17794 } | 18176 } |
| 17795 } | 18177 } |
| 17796 else { | 18178 else { |
| 17797 process.exit(1); | 18179 process.exit(1); |
| 17798 } | 18180 } |
| 17799 } | 18181 } |
| 17800 Function.prototype.to$call$0 = function() { | 18182 Function.prototype.to$call$0 = function() { |
| 17801 this.call$0 = this.$genStub(0); | 18183 this.call$0 = this.$genStub(0); |
| 17802 this.to$call$0 = function() { return this.call$0; }; | 18184 this.to$call$0 = function() { return this.call$0; }; |
| 17803 return this.call$0; | 18185 return this.call$0; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 17817 function to$call$1(f) { return f && f.to$call$1(); } | 18199 function to$call$1(f) { return f && f.to$call$1(); } |
| 17818 Function.prototype.to$call$2 = function() { | 18200 Function.prototype.to$call$2 = function() { |
| 17819 this.call$2 = this.$genStub(2); | 18201 this.call$2 = this.$genStub(2); |
| 17820 this.to$call$2 = function() { return this.call$2; }; | 18202 this.to$call$2 = function() { return this.call$2; }; |
| 17821 return this.call$2; | 18203 return this.call$2; |
| 17822 }; | 18204 }; |
| 17823 Function.prototype.call$2 = function($0, $1) { | 18205 Function.prototype.call$2 = function($0, $1) { |
| 17824 return this.to$call$2()($0, $1); | 18206 return this.to$call$2()($0, $1); |
| 17825 }; | 18207 }; |
| 17826 function to$call$2(f) { return f && f.to$call$2(); } | 18208 function to$call$2(f) { return f && f.to$call$2(); } |
| 17827 var const$1 = new StringWrapper('global scope')/*const SourceString('global scop
e')*/; | 18209 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; |
| 17828 var const$133 = new Keyword("break", false)/*const Keyword("break")*/; | 18210 var const$133 = new Keyword("break", false)/*const Keyword("break")*/; |
| 17829 var const$135 = new Keyword("case", false)/*const Keyword("case")*/; | 18211 var const$135 = new Keyword("case", false)/*const Keyword("case")*/; |
| 17830 var const$137 = new Keyword("catch", false)/*const Keyword("catch")*/; | 18212 var const$137 = new Keyword("catch", false)/*const Keyword("catch")*/; |
| 17831 var const$139 = new Keyword("const", false)/*const Keyword("const")*/; | 18213 var const$139 = new Keyword("const", false)/*const Keyword("const")*/; |
| 17832 var const$141 = new Keyword("continue", false)/*const Keyword("continue")*/; | 18214 var const$141 = new Keyword("continue", false)/*const Keyword("continue")*/; |
| 17833 var const$143 = new Keyword("default", false)/*const Keyword("default")*/; | 18215 var const$143 = new Keyword("default", false)/*const Keyword("default")*/; |
| 17834 var const$145 = new Keyword("do", false)/*const Keyword("do")*/; | 18216 var const$145 = new Keyword("do", false)/*const Keyword("do")*/; |
| 17835 var const$147 = new Keyword("else", false)/*const Keyword("else")*/; | 18217 var const$147 = new Keyword("else", false)/*const Keyword("else")*/; |
| 17836 var const$149 = new Keyword("false", false)/*const Keyword("false")*/; | 18218 var const$149 = new Keyword("false", false)/*const Keyword("false")*/; |
| 17837 var const$151 = new Keyword("final", false)/*const Keyword("final")*/; | 18219 var const$151 = new Keyword("final", false)/*const Keyword("final")*/; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 17852 var const$181 = new Keyword("var", false)/*const Keyword("var")*/; | 18234 var const$181 = new Keyword("var", false)/*const Keyword("var")*/; |
| 17853 var const$183 = new Keyword("void", false)/*const Keyword("void")*/; | 18235 var const$183 = new Keyword("void", false)/*const Keyword("void")*/; |
| 17854 var const$185 = new Keyword("while", false)/*const Keyword("while")*/; | 18236 var const$185 = new Keyword("while", false)/*const Keyword("while")*/; |
| 17855 var const$187 = new Keyword("abstract", true)/*const Keyword("abstract", true)*/
; | 18237 var const$187 = new Keyword("abstract", true)/*const Keyword("abstract", true)*/
; |
| 17856 var const$189 = new Keyword("assert", true)/*const Keyword("assert", true)*/; | 18238 var const$189 = new Keyword("assert", true)/*const Keyword("assert", true)*/; |
| 17857 var const$191 = new Keyword("class", true)/*const Keyword("class", true)*/; | 18239 var const$191 = new Keyword("class", true)/*const Keyword("class", true)*/; |
| 17858 var const$193 = new Keyword("extends", true)/*const Keyword("extends", true)*/; | 18240 var const$193 = new Keyword("extends", true)/*const Keyword("extends", true)*/; |
| 17859 var const$195 = new Keyword("factory", true)/*const Keyword("factory", true)*/; | 18241 var const$195 = new Keyword("factory", true)/*const Keyword("factory", true)*/; |
| 17860 var const$197 = new Keyword("get", true)/*const Keyword("get", true)*/; | 18242 var const$197 = new Keyword("get", true)/*const Keyword("get", true)*/; |
| 17861 var const$199 = new Keyword("implements", true)/*const Keyword("implements", tru
e)*/; | 18243 var const$199 = new Keyword("implements", true)/*const Keyword("implements", tru
e)*/; |
| 17862 var const$2 = new StringWrapper('main')/*const SourceString('main')*/; | 18244 var const$2 = new StringWrapper('global scope')/*const SourceString('global scop
e')*/; |
| 17863 var const$201 = new Keyword("import", true)/*const Keyword("import", true)*/; | 18245 var const$201 = new Keyword("import", true)/*const Keyword("import", true)*/; |
| 17864 var const$203 = new Keyword("interface", true)/*const Keyword("interface", true)
*/; | 18246 var const$203 = new Keyword("interface", true)/*const Keyword("interface", true)
*/; |
| 17865 var const$205 = new Keyword("library", true)/*const Keyword("library", true)*/; | 18247 var const$205 = new Keyword("library", true)/*const Keyword("library", true)*/; |
| 17866 var const$207 = new Keyword("native", true)/*const Keyword("native", true)*/; | 18248 var const$207 = new Keyword("native", true)/*const Keyword("native", true)*/; |
| 17867 var const$209 = new Keyword("negate", true)/*const Keyword("negate", true)*/; | 18249 var const$209 = new Keyword("negate", true)/*const Keyword("negate", true)*/; |
| 17868 var const$211 = new Keyword("operator", true)/*const Keyword("operator", true)*/
; | 18250 var const$211 = new Keyword("operator", true)/*const Keyword("operator", true)*/
; |
| 17869 var const$213 = new Keyword("set", true)/*const Keyword("set", true)*/; | 18251 var const$213 = new Keyword("set", true)/*const Keyword("set", true)*/; |
| 17870 var const$215 = new Keyword("source", true)/*const Keyword("source", true)*/; | 18252 var const$215 = new Keyword("source", true)/*const Keyword("source", true)*/; |
| 17871 var const$217 = new Keyword("static", true)/*const Keyword("static", true)*/; | 18253 var const$217 = new Keyword("static", true)/*const Keyword("static", true)*/; |
| 17872 var const$219 = new Keyword("typedef", true)/*const Keyword("typedef", true)*/; | 18254 var const$219 = new Keyword("typedef", true)/*const Keyword("typedef", true)*/; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17907 var const$259 = new StringWrapper("-")/*const SourceString("-")*/; | 18289 var const$259 = new StringWrapper("-")/*const SourceString("-")*/; |
| 17908 var const$260 = new StringWrapper("*")/*const SourceString("*")*/; | 18290 var const$260 = new StringWrapper("*")/*const SourceString("*")*/; |
| 17909 var const$261 = new StringWrapper("/")/*const SourceString("/")*/; | 18291 var const$261 = new StringWrapper("/")/*const SourceString("/")*/; |
| 17910 var const$262 = new StringWrapper("~/")/*const SourceString("~/")*/; | 18292 var const$262 = new StringWrapper("~/")/*const SourceString("~/")*/; |
| 17911 var const$265 = new ExceptionImplementation("Internal Error (Leg): UNREACHABLE")
/*const Exception("Internal Error (Leg): UNREACHABLE")*/; | 18293 var const$265 = new ExceptionImplementation("Internal Error (Leg): UNREACHABLE")
/*const Exception("Internal Error (Leg): UNREACHABLE")*/; |
| 17912 var const$266 = new StringWrapper('\$add')/*const SourceString('\$add')*/; | 18294 var const$266 = new StringWrapper('\$add')/*const SourceString('\$add')*/; |
| 17913 var const$267 = new StringWrapper('\$div')/*const SourceString('\$div')*/; | 18295 var const$267 = new StringWrapper('\$div')/*const SourceString('\$div')*/; |
| 17914 var const$268 = new StringWrapper('\$mul')/*const SourceString('\$mul')*/; | 18296 var const$268 = new StringWrapper('\$mul')/*const SourceString('\$mul')*/; |
| 17915 var const$269 = new StringWrapper('\$sub')/*const SourceString('\$sub')*/; | 18297 var const$269 = new StringWrapper('\$sub')/*const SourceString('\$sub')*/; |
| 17916 var const$270 = new StringWrapper('\$tdiv')/*const SourceString('\$tdiv')*/; | 18298 var const$270 = new StringWrapper('\$tdiv')/*const SourceString('\$tdiv')*/; |
| 17917 var const$392 = ImmutableList.ImmutableList$from$factory(['NullPointerException'
, 'ObjectNotClosureException', 'NoSuchMethodException', 'StackOverflowException'
])/*const [ | 18299 var const$3 = new StringWrapper('main')/*const SourceString('main')*/; |
| 18300 var const$393 = ImmutableList.ImmutableList$from$factory(['NullPointerException'
, 'ObjectNotClosureException', 'NoSuchMethodException', 'StackOverflowException'
])/*const [ |
| 17918 'NullPointerException', 'ObjectNotClosureException', | 18301 'NullPointerException', 'ObjectNotClosureException', |
| 17919 'NoSuchMethodException', 'StackOverflowException']*/; | 18302 'NoSuchMethodException', 'StackOverflowException']*/; |
| 17920 var const$4 = new NoMoreElementsException()/*const NoMoreElementsException()*/; | |
| 17921 var const$5 = new EmptyQueueException()/*const EmptyQueueException()*/; | 18303 var const$5 = new EmptyQueueException()/*const EmptyQueueException()*/; |
| 17922 HTracer._singleton = null; | 18304 HTracer._singleton = null; |
| 17923 var const$222 = ImmutableList.ImmutableList$from$factory([const$133, const$135,
const$137, const$139, const$141, const$143, const$145, const$147, const$149, con
st$151, const$153, const$155, const$157, const$159, const$161, const$163, const$
165, const$167, const$169, const$171, const$173, const$175, const$177, const$179
, const$181, const$183, const$185, const$187, const$189, const$191, const$193, c
onst$195, const$197, const$199, const$201, const$203, const$205, const$207, cons
t$209, const$211, const$213, const$215, const$217, const$219])/*const <Keyword>
[ | 18305 var const$222 = ImmutableList.ImmutableList$from$factory([const$133, const$135,
const$137, const$139, const$141, const$143, const$145, const$147, const$149, con
st$151, const$153, const$155, const$157, const$159, const$161, const$163, const$
165, const$167, const$169, const$171, const$173, const$175, const$177, const$179
, const$181, const$183, const$185, const$187, const$189, const$191, const$193, c
onst$195, const$197, const$199, const$201, const$203, const$205, const$207, cons
t$209, const$211, const$213, const$215, const$217, const$219])/*const <Keyword>
[ |
| 17924 BREAK, | 18306 BREAK, |
| 17925 CASE, | 18307 CASE, |
| 17926 CATCH, | 18308 CATCH, |
| 17927 CONST, | 18309 CONST, |
| 17928 CONTINUE, | 18310 CONTINUE, |
| 17929 DEFAULT, | 18311 DEFAULT, |
| 17930 DO, | 18312 DO, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 17959 INTERFACE, | 18341 INTERFACE, |
| 17960 LIBRARY, | 18342 LIBRARY, |
| 17961 NATIVE, | 18343 NATIVE, |
| 17962 NEGATE, | 18344 NEGATE, |
| 17963 OPERATOR, | 18345 OPERATOR, |
| 17964 SET, | 18346 SET, |
| 17965 SOURCE, | 18347 SOURCE, |
| 17966 STATIC, | 18348 STATIC, |
| 17967 TYPEDEF ]*/; | 18349 TYPEDEF ]*/; |
| 17968 main(); | 18350 main(); |
| OLD | NEW |