Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: frog/frogsh

Issue 8334035: Reduces code generated by dynamic calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | frog/gen.dart » ('j') | frog/gen.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 Object.defineProperty(proto, name, {value: method || methods['Object']}); 332 Object.defineProperty(proto, name, {value: method || methods['Object']});
333 } 333 }
334 // ********** Code for Clock ************** 334 // ********** Code for Clock **************
335 function Clock() {} 335 function Clock() {}
336 Clock.now = function() { 336 Clock.now = function() {
337 return new Date().getTime(); 337 return new Date().getTime();
338 } 338 }
339 Clock.frequency = function() { 339 Clock.frequency = function() {
340 return 1000; 340 return 1000;
341 } 341 }
342 // ********** Code for AssertError **************
343 function AssertError() {}
344 AssertError.prototype.toString = function() {
345 return ("Failed assertion: '" + this.failedAssertion + "' is not true ") + ("i n " + this.url + " at line " + this.line + ", column " + this.column + ".");
346 }
347 // ********** Code for TypeError **************
348 function TypeError() {}
349 $inherits(TypeError, AssertError);
350 TypeError.prototype.toString = function() {
351 return ("Failed type check: type " + this.srcType + " is not assignable to typ e ") + ("" + this.dstType + "");
352 }
353 // ********** Code for FallThroughError **************
354 function FallThroughError() {}
355 FallThroughError.prototype.toString = function() {
356 return ("Switch case fall-through in " + this.url + " at line " + this.line + ".");
357 }
358 // ********** Code for Object ************** 342 // ********** Code for Object **************
359 Object.prototype.get$dynamic = function() { 343 Object.prototype.get$dynamic = function() {
360 return this; 344 return this;
361 } 345 }
362 Object.prototype.noSuchMethod = function(name, args) { 346 Object.prototype.noSuchMethod = function(name, args) {
363 $throw(new NoSuchMethodException(this, name, args)); 347 $throw(new NoSuchMethodException(this, name, args));
364 } 348 }
365 Object.prototype.forEach$1 = function($0) { 349 Object.prototype.forEach$1 = function($0) {
366 return this.noSuchMethod("forEach", [$0]); 350 return this.noSuchMethod("forEach", [$0]);
367 } 351 }
368 ; 352 ;
353 Object.prototype.get_$3 = function($0, $1, $2) {
354 return this.noSuchMethod("get_", [$0, $1, $2]);
355 }
356 ;
369 Object.prototype.invoke$4 = function($0, $1, $2, $3) { 357 Object.prototype.invoke$4 = function($0, $1, $2, $3) {
370 return this.noSuchMethod("invoke", [$0, $1, $2, $3]); 358 return this.noSuchMethod("invoke", [$0, $1, $2, $3]);
371 } 359 }
372 ; 360 ;
373 Object.prototype.printOn$1 = function($0) { 361 Object.prototype.printOn$1 = function($0) {
374 return this.noSuchMethod("printOn", [$0]); 362 return this.noSuchMethod("printOn", [$0]);
375 } 363 }
376 ; 364 ;
377 Object.prototype.set_$4 = function($0, $1, $2, $3) { 365 Object.prototype.set_$4 = function($0, $1, $2, $3) {
378 return this.noSuchMethod("set_", [$0, $1, $2, $3]); 366 return this.noSuchMethod("set_", [$0, $1, $2, $3]);
379 } 367 }
380 ; 368 ;
381 Object.prototype.visitPostfixExpression$1 = function($0) { 369 Object.prototype.visitPostfixExpression$1 = function($0) {
382 return this.noSuchMethod("visitPostfixExpression", [$0]); 370 return this.noSuchMethod("visitPostfixExpression", [$0]);
383 } 371 }
384 ; 372 ;
385 // ********** Code for IndexOutOfRangeException **************
386 function IndexOutOfRangeException() {}
387 IndexOutOfRangeException.prototype.toString = function() {
388 return ("IndexOutOfRangeException: " + this._index + "");
389 }
390 // ********** Code for IllegalAccessException ************** 373 // ********** Code for IllegalAccessException **************
391 function IllegalAccessException() { 374 function IllegalAccessException() {
392 // Initializers done 375 // Initializers done
393 } 376 }
394 IllegalAccessException.prototype.toString = function() { 377 IllegalAccessException.prototype.toString = function() {
395 return "Attempt to modify an immutable object"; 378 return "Attempt to modify an immutable object";
396 } 379 }
397 // ********** Code for NoSuchMethodException ************** 380 // ********** Code for NoSuchMethodException **************
398 function NoSuchMethodException(_receiver, _functionName, _arguments) { 381 function NoSuchMethodException(_receiver, _functionName, _arguments) {
399 this._receiver = _receiver; 382 this._receiver = _receiver;
(...skipping 11 matching lines...) Expand all
411 sb.add(this._arguments.$index(i)); 394 sb.add(this._arguments.$index(i));
412 } 395 }
413 sb.add("]"); 396 sb.add("]");
414 return ("NoSuchMethodException - receiver: '" + this._receiver + "' ") + ("fun ction name: '" + this._functionName + "' arguments: [" + sb + "]"); 397 return ("NoSuchMethodException - receiver: '" + this._receiver + "' ") + ("fun ction name: '" + this._functionName + "' arguments: [" + sb + "]");
415 } 398 }
416 // ********** Code for ObjectNotClosureException ************** 399 // ********** Code for ObjectNotClosureException **************
417 function ObjectNotClosureException() {} 400 function ObjectNotClosureException() {}
418 ObjectNotClosureException.prototype.toString = function() { 401 ObjectNotClosureException.prototype.toString = function() {
419 return "Object is not closure"; 402 return "Object is not closure";
420 } 403 }
421 // ********** Code for IllegalArgumentException **************
422 function IllegalArgumentException() {}
423 IllegalArgumentException.prototype.toString = function() {
424 return ("Illegal argument(s): " + this._args + "");
425 }
426 // ********** Code for StackOverflowException ************** 404 // ********** Code for StackOverflowException **************
427 function StackOverflowException() {} 405 function StackOverflowException() {}
428 StackOverflowException.prototype.toString = function() { 406 StackOverflowException.prototype.toString = function() {
429 return "Stack Overflow"; 407 return "Stack Overflow";
430 } 408 }
431 // ********** Code for BadNumberFormatException ************** 409 // ********** Code for BadNumberFormatException **************
432 function BadNumberFormatException() {} 410 function BadNumberFormatException() {}
433 BadNumberFormatException.prototype.toString = function() { 411 BadNumberFormatException.prototype.toString = function() {
434 return ("BadNumberFormatException: '" + this._s + "'"); 412 return ("BadNumberFormatException: '" + this._s + "'");
435 } 413 }
436 // ********** Code for NullPointerException ************** 414 // ********** Code for NullPointerException **************
437 function NullPointerException() {} 415 function NullPointerException() {}
438 NullPointerException.prototype.toString = function() { 416 NullPointerException.prototype.toString = function() {
439 return "NullPointerException"; 417 return "NullPointerException";
440 } 418 }
441 // ********** Code for NoMoreElementsException ************** 419 // ********** Code for NoMoreElementsException **************
442 function NoMoreElementsException() { 420 function NoMoreElementsException() {
443 // Initializers done 421 // Initializers done
444 } 422 }
445 NoMoreElementsException.prototype.toString = function() { 423 NoMoreElementsException.prototype.toString = function() {
446 return "NoMoreElementsException"; 424 return "NoMoreElementsException";
447 } 425 }
448 // ********** Code for EmptyQueueException ************** 426 // ********** Code for EmptyQueueException **************
449 function EmptyQueueException() { 427 function EmptyQueueException() {
450 // Initializers done 428 // Initializers done
451 } 429 }
452 EmptyQueueException.prototype.toString = function() { 430 EmptyQueueException.prototype.toString = function() {
453 return "EmptyQueueException"; 431 return "EmptyQueueException";
454 } 432 }
455 // ********** Code for UnsupportedOperationException **************
456 function UnsupportedOperationException() {}
457 UnsupportedOperationException.prototype.toString = function() {
458 return ("UnsupportedOperationException: " + this._message + "");
459 }
460 // ********** Code for IllegalJSRegExpException **************
461 function IllegalJSRegExpException() {}
462 IllegalJSRegExpException.prototype.toString = function() {
463 return ("IllegalJSRegExpException: '" + this._pattern + "' '" + this._errmsg + "'");
464 }
465 // ********** Code for ExpectException **************
466 function ExpectException() {}
467 ExpectException.prototype.toString = function() {
468 return this.message;
469 }
470 // ********** Code for Math ************** 433 // ********** Code for Math **************
471 Math.parseInt = function(str) { 434 Math.parseInt = function(str) {
472 var ret = parseInt(str); 435 var ret = parseInt(str);
473 if (isNaN(ret)) $throw(new BadNumberFormatException(str)); 436 if (isNaN(ret)) $throw(new BadNumberFormatException(str));
474 return ret; 437 return ret;
475 } 438 }
476 Math.parseDouble = function(str) { 439 Math.parseDouble = function(str) {
477 var ret = parseFloat(str); 440 var ret = parseFloat(str);
478 if (isNaN(ret) && str != 'NaN') $throw(new BadNumberFormatException(str)); 441 if (isNaN(ret) && str != 'NaN') $throw(new BadNumberFormatException(str));
479 return ret; 442 return ret;
480 } 443 }
481 Math.min = function(a, b) { 444 Math.min = function(a, b) {
482 if (a == b) return a; 445 if (a == b) return a;
483 if (a < b) { 446 if (a < b) {
484 if (isNaN(b)) return b; 447 if (isNaN(b)) return b;
485 else return a; 448 else return a;
486 } 449 }
487 if (isNaN(a)) return a; 450 if (isNaN(a)) return a;
488 else return b; 451 else return b;
489 } 452 }
490 // ********** Code for Dispatcher **************
491 function Dispatcher() {}
492 // ********** Code for Strings ************** 453 // ********** Code for Strings **************
493 function Strings() {} 454 function Strings() {}
494 Strings.String$fromCharCodes$factory = function(charCodes) { 455 Strings.String$fromCharCodes$factory = function(charCodes) {
495 return StringBase.createFromCharCodes(charCodes); 456 return StringBase.createFromCharCodes(charCodes);
496 } 457 }
497 Strings.join = function(strings, separator) { 458 Strings.join = function(strings, separator) {
498 return StringBase.join(strings, separator); 459 return StringBase.join(strings, separator);
499 } 460 }
500 // ********** Code for top level ************** 461 // ********** Code for top level **************
501 function print(obj) { 462 function print(obj) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } 512 }
552 ListFactory.prototype.forEach$1 = ListFactory.prototype.forEach; 513 ListFactory.prototype.forEach$1 = ListFactory.prototype.forEach;
553 ListFactory$DoubleLinkedQueueEntry$KeyValuePair$K$V = ListFactory; 514 ListFactory$DoubleLinkedQueueEntry$KeyValuePair$K$V = ListFactory;
554 ListFactory$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword = ListFactory; 515 ListFactory$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword = ListFactory;
555 ListFactory$E = ListFactory; 516 ListFactory$E = ListFactory;
556 ListFactory$Element = ListFactory; 517 ListFactory$Element = ListFactory;
557 ListFactory$EvaluatedValue = ListFactory; 518 ListFactory$EvaluatedValue = ListFactory;
558 ListFactory$HInstruction = ListFactory; 519 ListFactory$HInstruction = ListFactory;
559 ListFactory$K = ListFactory; 520 ListFactory$K = ListFactory;
560 ListFactory$KeywordState = ListFactory; 521 ListFactory$KeywordState = ListFactory;
561 ListFactory$SplayTreeNode$K$V = ListFactory;
562 ListFactory$String = ListFactory; 522 ListFactory$String = ListFactory;
563 ListFactory$T = ListFactory; 523 ListFactory$T = ListFactory;
564 ListFactory$V = ListFactory; 524 ListFactory$V = ListFactory;
565 // ********** Code for ListIterator ************** 525 // ********** Code for ListIterator **************
566 function ListIterator(array) { 526 function ListIterator(array) {
567 this._array = array; 527 this._array = array;
568 this._pos = 0; 528 this._pos = 0;
569 // Initializers done 529 // Initializers done
570 } 530 }
571 ListIterator.prototype.hasNext = function() { 531 ListIterator.prototype.hasNext = function() {
572 return this._array.length > this._pos; 532 return this._array.length > this._pos;
573 } 533 }
574 ListIterator.prototype.next = function() { 534 ListIterator.prototype.next = function() {
575 if (!this.hasNext()) { 535 if (!this.hasNext()) {
576 $throw(const$15/*const NoMoreElementsException()*/); 536 $throw(const$4/*const NoMoreElementsException()*/);
577 } 537 }
578 return this._array.$index(this._pos++); 538 return this._array.$index(this._pos++);
579 } 539 }
580 // ********** Code for ImmutableList ************** 540 // ********** Code for ImmutableList **************
581 function ImmutableList(length0) { 541 function ImmutableList(length0) {
582 this._length = length0; 542 this._length = length0;
583 ListFactory$E.call(this, length0); 543 ListFactory$E.call(this, length0);
584 // Initializers done 544 // Initializers done
585 } 545 }
586 $inherits(ImmutableList, ListFactory$E); 546 $inherits(ImmutableList, ListFactory$E);
587 ImmutableList.ImmutableList$from$factory = function(other) { 547 ImmutableList.ImmutableList$from$factory = function(other) {
588 var list = new ImmutableList(other.length); 548 var list = new ImmutableList(other.length);
589 for (var i = 0; 549 for (var i = 0;
590 i < other.length; i++) { 550 i < other.length; i++) {
591 list._setindex(i, other.$index(i)); 551 list._setindex(i, other.$index(i));
592 } 552 }
593 return list; 553 return list;
594 } 554 }
595 ImmutableList.prototype.get$length = function() { 555 ImmutableList.prototype.get$length = function() {
596 return this._length; 556 return this._length;
597 } 557 }
598 ImmutableList.prototype.set$length = function(length0) { 558 ImmutableList.prototype.set$length = function(length0) {
599 $throw(const$0/*const IllegalAccessException()*/); 559 $throw(const$221/*const IllegalAccessException()*/);
600 } 560 }
601 Object.defineProperty(ImmutableList.prototype, "length", { 561 Object.defineProperty(ImmutableList.prototype, "length", {
602 get: ImmutableList.prototype.get$length, 562 get: ImmutableList.prototype.get$length,
603 set: ImmutableList.prototype.set$length 563 set: ImmutableList.prototype.set$length
604 }); 564 });
605 ImmutableList.prototype._setindex = function(index, value) { 565 ImmutableList.prototype._setindex = function(index, value) {
606 return this[index] = value; 566 return this[index] = value;
607 } 567 }
608 ImmutableList.prototype.$setindex = function(index, value) { 568 ImmutableList.prototype.$setindex = function(index, value) {
609 $throw(const$0/*const IllegalAccessException()*/); 569 $throw(const$221/*const IllegalAccessException()*/);
610 } 570 }
611 ImmutableList.prototype.sort = function(compare) { 571 ImmutableList.prototype.sort = function(compare) {
612 $throw(const$0/*const IllegalAccessException()*/); 572 $throw(const$221/*const IllegalAccessException()*/);
613 } 573 }
614 ImmutableList.prototype.add = function(element) { 574 ImmutableList.prototype.add = function(element) {
615 $throw(const$0/*const IllegalAccessException()*/); 575 $throw(const$221/*const IllegalAccessException()*/);
616 } 576 }
617 ImmutableList.prototype.addLast = function(element) { 577 ImmutableList.prototype.addLast = function(element) {
618 $throw(const$0/*const IllegalAccessException()*/); 578 $throw(const$221/*const IllegalAccessException()*/);
619 } 579 }
620 ImmutableList.prototype.addAll = function(elements) { 580 ImmutableList.prototype.addAll = function(elements) {
621 $throw(const$0/*const IllegalAccessException()*/); 581 $throw(const$221/*const IllegalAccessException()*/);
622 } 582 }
623 ImmutableList.prototype.clear = function() { 583 ImmutableList.prototype.clear = function() {
624 $throw(const$0/*const IllegalAccessException()*/); 584 $throw(const$221/*const IllegalAccessException()*/);
625 } 585 }
626 ImmutableList.prototype.removeLast = function() { 586 ImmutableList.prototype.removeLast = function() {
627 $throw(const$0/*const IllegalAccessException()*/); 587 $throw(const$221/*const IllegalAccessException()*/);
628 }
629 // ********** Code for ImmutableMap **************
630 function ImmutableMap() {}
631 ImmutableMap.prototype.$index = function(key) {
632 return this._internal.$index(key);
633 }
634 ImmutableMap.prototype.isEmpty = function() {
635 return this._internal.isEmpty();
636 }
637 ImmutableMap.prototype.get$length = function() {
638 return this._internal.get$length();
639 }
640 Object.defineProperty(ImmutableMap.prototype, "length", {
641 get: ImmutableMap.prototype.get$length,
642 });
643 ImmutableMap.prototype.forEach = function(f) {
644 this._internal.forEach(f);
645 }
646 ImmutableMap.prototype.getKeys = function() {
647 return this._internal.getKeys();
648 }
649 ImmutableMap.prototype.getValues = function() {
650 return this._internal.getValues();
651 }
652 ImmutableMap.prototype.containsKey = function(key) {
653 return this._internal.containsKey(key);
654 }
655 ImmutableMap.prototype.$setindex = function(key, value) {
656 $throw(const$0/*const IllegalAccessException()*/);
657 }
658 ImmutableMap.prototype.clear = function() {
659 $throw(const$0/*const IllegalAccessException()*/);
660 }
661 ImmutableMap.prototype.forEach$1 = ImmutableMap.prototype.forEach;
662 // ********** Code for JSSyntaxRegExp **************
663 function JSSyntaxRegExp() {}
664 JSSyntaxRegExp._create$ctor = function(pattern, flags) {
665 this.re = new RegExp(pattern, flags);
666 this.pattern = pattern;
667 this.multiLine = this.re.multiline;
668 this.ignoreCase = this.re.ignoreCase;
669 }
670 JSSyntaxRegExp._create$ctor.prototype = JSSyntaxRegExp.prototype;
671 JSSyntaxRegExp.prototype.firstMatch = function(str) {
672 var m = this.re.exec(str);
673 return m && new MatchImplementation(
674 this.pattern, str, m.index, this.re.lastIndex, m);
675 } 588 }
676 // ********** Code for MatchImplementation ************** 589 // ********** Code for MatchImplementation **************
677 function MatchImplementation() {} 590 function MatchImplementation() {}
678 MatchImplementation.prototype.$index = function(group0) { 591 MatchImplementation.prototype.$index = function(group0) {
679 return this._groups.$index(group0); 592 return this._groups.$index(group0);
680 } 593 }
681 // ********** Code for _AllMatchesIterable **************
682 function _AllMatchesIterable() {}
683 _AllMatchesIterable.prototype.iterator = function() {
684 return new _AllMatchesIterator(this._re, this._str);
685 }
686 // ********** Code for _AllMatchesIterator **************
687 function _AllMatchesIterator(re, _str) {
688 this._str = _str;
689 this._done = false;
690 this._re = new JSSyntaxRegExp._create$ctor(re.pattern, 'g' + (re.multiLine ? ' m' : '') + (re.ignoreCase ? 'i' : ''));
691 // Initializers done
692 }
693 _AllMatchesIterator.prototype.next = function() {
694 if (!this.hasNext()) {
695 $throw(const$15/*const NoMoreElementsException()*/);
696 }
697 var next0 = this._next;
698 this._next = null;
699 return next0;
700 }
701 _AllMatchesIterator.prototype.hasNext = function() {
702 if (this._done) {
703 return false;
704 }
705 else if (this._next != null) {
706 return true;
707 }
708 this._next = this._re.firstMatch(this._str);
709 if (this._next == null) {
710 this._done = true;
711 return false;
712 }
713 else {
714 return true;
715 }
716 }
717 // ********** Code for NumImplementation ************** 594 // ********** Code for NumImplementation **************
718 NumImplementation = Number; 595 NumImplementation = Number;
719 NumImplementation.prototype.remainder = function(other) {
720 return this % other;
721 }
722 NumImplementation.prototype.isNaN = function() { 596 NumImplementation.prototype.isNaN = function() {
723 return isNaN(this); 597 return isNaN(this);
724 } 598 }
725 NumImplementation.prototype.isNegative = function() { 599 NumImplementation.prototype.isNegative = function() {
726 return this == 0 ? (1 / this) < 0 : this < 0; 600 return this == 0 ? (1 / this) < 0 : this < 0;
727 } 601 }
728 NumImplementation.prototype.hashCode = function() { 602 NumImplementation.prototype.hashCode = function() {
729 return this & 0xFFFFFFF; 603 return this & 0xFFFFFFF;
730 } 604 }
731 NumImplementation.prototype.toInt = function() { 605 NumImplementation.prototype.toInt = function() {
(...skipping 30 matching lines...) Expand all
762 else if (this.isNaN()) { 636 else if (this.isNaN()) {
763 if (other.isNaN()) { 637 if (other.isNaN()) {
764 return 0; 638 return 0;
765 } 639 }
766 return 1; 640 return 1;
767 } 641 }
768 else { 642 else {
769 return -1; 643 return -1;
770 } 644 }
771 } 645 }
772 // ********** Code for DurationImplementation **************
773 function DurationImplementation(days, hours, minutes, seconds, milliseconds) {
774 this.inMilliseconds = days * 86400000/*Duration.MILLISECONDS_PER_DAY*/ + hours * 3600000/*Duration.MILLISECONDS_PER_HOUR*/ + minutes * 60000/*Duration.MILLISE CONDS_PER_MINUTE*/ + seconds * 1000/*Duration.MILLISECONDS_PER_SECOND*/ + millis econds;
775 // Initializers done
776 }
777 DurationImplementation.prototype.is$Duration = function(){return this;};
778 DurationImplementation.prototype.get$inHours = function() {
779 return $truncdiv(this.inMilliseconds, 3600000/*Duration.MILLISECONDS_PER_HOUR* /);
780 }
781 DurationImplementation.prototype.get$inMinutes = function() {
782 return $truncdiv(this.inMilliseconds, 60000/*Duration.MILLISECONDS_PER_MINUTE* /);
783 }
784 DurationImplementation.prototype.get$inSeconds = function() {
785 return $truncdiv(this.inMilliseconds, 1000/*Duration.MILLISECONDS_PER_SECOND*/ );
786 }
787 DurationImplementation.prototype.$eq = function(other) {
788 if (!(other && other.is$Duration)) return false;
789 return this.inMilliseconds == other.inMilliseconds;
790 }
791 DurationImplementation.prototype.compareTo = function(other) {
792 return this.inMilliseconds.compareTo(other.inMilliseconds);
793 }
794 DurationImplementation.prototype.toString = function() {
795 function threeDigits(n) {
796 if (n >= 100) return ("" + n + "");
797 if (n > 10) return ("0" + n + "");
798 return ("00" + n + "");
799 }
800 function twoDigits(n) {
801 if (n >= 10) return ("" + n + "");
802 return ("0" + n + "");
803 }
804 if (this.inMilliseconds < 0) {
805 var duration = new DurationImplementation(0, 0, 0, 0, -this.inMilliseconds);
806 return ("-" + duration + "");
807 }
808 var twoDigitMinutes = twoDigits(this.get$inMinutes().remainder(60/*Duration.MI NUTES_PER_HOUR*/));
809 var twoDigitSeconds = twoDigits(this.get$inSeconds().remainder(60/*Duration.SE CONDS_PER_MINUTE*/));
810 var threeDigitMs = threeDigits(this.inMilliseconds.remainder(1000/*Duration.MI LLISECONDS_PER_SECOND*/));
811 return ("" + this.get$inHours() + ":" + twoDigitMinutes + ":" + twoDigitSecond s + "." + threeDigitMs + "");
812 }
813 // ********** Code for ExceptionImplementation ************** 646 // ********** Code for ExceptionImplementation **************
814 function ExceptionImplementation(_msg) { 647 function ExceptionImplementation(_msg) {
815 this._msg = _msg; 648 this._msg = _msg;
816 // Initializers done 649 // Initializers done
817 } 650 }
818 ExceptionImplementation.prototype.toString = function() { 651 ExceptionImplementation.prototype.toString = function() {
819 return (this._msg == null) ? "Exception" : ("Exception: " + this._msg + ""); 652 return (this._msg == null) ? "Exception" : ("Exception: " + this._msg + "");
820 } 653 }
821 // ********** Code for FutureNotCompleteException **************
822 function FutureNotCompleteException() {
823 // Initializers done
824 }
825 // ********** Code for FutureImpl **************
826 function FutureImpl() {}
827 FutureImpl.prototype.get$value = function() {
828 if (!this.get$isComplete()) {
829 $throw(new FutureNotCompleteException());
830 }
831 if (this._exception != null) {
832 $throw(this._exception);
833 }
834 return this._value;
835 }
836 FutureImpl.prototype.get$exception = function() {
837 if (!this.get$isComplete()) {
838 $throw(new FutureNotCompleteException());
839 }
840 return this._exception;
841 }
842 FutureImpl.prototype.get$isComplete = function() {
843 return this._isComplete;
844 }
845 // ********** Code for FutureImpl$T **************
846 function FutureImpl$T() {}
847 $inherits(FutureImpl$T, FutureImpl);
848 // ********** Code for HashMapImplementation ************** 654 // ********** Code for HashMapImplementation **************
849 function HashMapImplementation() { 655 function HashMapImplementation() {
850 // Initializers done 656 // Initializers done
851 if (HashMapImplementation._deletedKey == null) { 657 if (HashMapImplementation._deletedKey == null) {
852 HashMapImplementation._deletedKey = new Object(); 658 HashMapImplementation._deletedKey = new Object();
853 } 659 }
854 this._numberOfEntries = 0; 660 this._numberOfEntries = 0;
855 this._numberOfDeleted = 0; 661 this._numberOfDeleted = 0;
856 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 662 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
857 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 663 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 } 1136 }
1331 HashSetIterator.prototype.hasNext = function() { 1137 HashSetIterator.prototype.hasNext = function() {
1332 if (this._nextValidIndex >= this._entries.length) return false; 1138 if (this._nextValidIndex >= this._entries.length) return false;
1333 if (this._entries.$index(this._nextValidIndex) === HashMapImplementation._dele tedKey) { 1139 if (this._entries.$index(this._nextValidIndex) === HashMapImplementation._dele tedKey) {
1334 this._advance(); 1140 this._advance();
1335 } 1141 }
1336 return this._nextValidIndex < this._entries.length; 1142 return this._nextValidIndex < this._entries.length;
1337 } 1143 }
1338 HashSetIterator.prototype.next = function() { 1144 HashSetIterator.prototype.next = function() {
1339 if (!this.hasNext()) { 1145 if (!this.hasNext()) {
1340 $throw(const$15/*const NoMoreElementsException()*/); 1146 $throw(const$4/*const NoMoreElementsException()*/);
1341 } 1147 }
1342 var res = this._entries.$index(this._nextValidIndex); 1148 var res = this._entries.$index(this._nextValidIndex);
1343 this._advance(); 1149 this._advance();
1344 return res; 1150 return res;
1345 } 1151 }
1346 HashSetIterator.prototype._advance = function() { 1152 HashSetIterator.prototype._advance = function() {
1347 var length = this._entries.length; 1153 var length = this._entries.length;
1348 var entry; 1154 var entry;
1349 var deletedKey = HashMapImplementation._deletedKey; 1155 var deletedKey = HashMapImplementation._deletedKey;
1350 do { 1156 do {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 this._list.clear(); 1256 this._list.clear();
1451 } 1257 }
1452 LinkedHashMapImplementation.prototype.forEach$1 = LinkedHashMapImplementation.pr ototype.forEach; 1258 LinkedHashMapImplementation.prototype.forEach$1 = LinkedHashMapImplementation.pr ototype.forEach;
1453 // ********** Code for LinkedHashMapImplementation$String$Keyword ************** 1259 // ********** Code for LinkedHashMapImplementation$String$Keyword **************
1454 function LinkedHashMapImplementation$String$Keyword() { 1260 function LinkedHashMapImplementation$String$Keyword() {
1455 // Initializers done 1261 // Initializers done
1456 this._map = new HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePa ir$String$Keyword(); 1262 this._map = new HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePa ir$String$Keyword();
1457 this._list = new DoubleLinkedQueue$KeyValuePair$String$Keyword(); 1263 this._list = new DoubleLinkedQueue$KeyValuePair$String$Keyword();
1458 } 1264 }
1459 $inherits(LinkedHashMapImplementation$String$Keyword, LinkedHashMapImplementatio n); 1265 $inherits(LinkedHashMapImplementation$String$Keyword, LinkedHashMapImplementatio n);
1460 // ********** Code for PromiseImpl **************
1461 function PromiseImpl() {}
1462 PromiseImpl.prototype.get$value = function() {
1463 if (!this.isDone()) {
1464 $throw(new ExceptionImplementation("Attempted to get the value of an uncompl eted promise."));
1465 }
1466 if (this.hasError()) {
1467 $throw(this._error);
1468 }
1469 else {
1470 return this._value;
1471 }
1472 }
1473 PromiseImpl.prototype.isDone = function() {
1474 return this._state != 0/*PromiseImpl.CREATED*/ && this._state != 1/*PromiseImp l.RUNNING*/;
1475 }
1476 PromiseImpl.prototype.hasError = function() {
1477 return this._state == 3/*PromiseImpl.COMPLETE_ERROR*/ || this._state == 6/*Pro miseImpl.COMPLETE_ERROR_AFTER_CANCELLED*/;
1478 }
1479 // ********** Code for PromiseImpl$T **************
1480 function PromiseImpl$T() {}
1481 $inherits(PromiseImpl$T, PromiseImpl);
1482 // ********** Code for PromiseImpl$bool **************
1483 function PromiseImpl$bool() {}
1484 $inherits(PromiseImpl$bool, PromiseImpl);
1485 // ********** Code for ProxyBase **************
1486 function ProxyBase() {}
1487 $inherits(ProxyBase, PromiseImpl$bool);
1488 ProxyBase.prototype.$eq = function(other) {
1489 return ((other instanceof ProxyBase)) && $eq(this._promise.get$value(), other. _promise.get$value());
1490 }
1491 // ********** Code for DoubleLinkedQueueEntry ************** 1266 // ********** Code for DoubleLinkedQueueEntry **************
1492 function DoubleLinkedQueueEntry(e) { 1267 function DoubleLinkedQueueEntry(e) {
1493 // Initializers done 1268 // Initializers done
1494 this._element = e; 1269 this._element = e;
1495 } 1270 }
1496 DoubleLinkedQueueEntry.prototype._link = function(p, n) { 1271 DoubleLinkedQueueEntry.prototype._link = function(p, n) {
1497 this._next = n; 1272 this._next = n;
1498 this._previous = p; 1273 this._previous = p;
1499 p._next = this; 1274 p._next = this;
1500 n._previous = this; 1275 n._previous = this;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 function DoubleLinkedQueueEntry$KeyValuePair$String$Keyword() {} 1334 function DoubleLinkedQueueEntry$KeyValuePair$String$Keyword() {}
1560 $inherits(DoubleLinkedQueueEntry$KeyValuePair$String$Keyword, DoubleLinkedQueueE ntry); 1335 $inherits(DoubleLinkedQueueEntry$KeyValuePair$String$Keyword, DoubleLinkedQueueE ntry);
1561 // ********** Code for _DoubleLinkedQueueEntrySentinel ************** 1336 // ********** Code for _DoubleLinkedQueueEntrySentinel **************
1562 function _DoubleLinkedQueueEntrySentinel() { 1337 function _DoubleLinkedQueueEntrySentinel() {
1563 DoubleLinkedQueueEntry$E.call(this, null); 1338 DoubleLinkedQueueEntry$E.call(this, null);
1564 // Initializers done 1339 // Initializers done
1565 this._link(this, this); 1340 this._link(this, this);
1566 } 1341 }
1567 $inherits(_DoubleLinkedQueueEntrySentinel, DoubleLinkedQueueEntry$E); 1342 $inherits(_DoubleLinkedQueueEntrySentinel, DoubleLinkedQueueEntry$E);
1568 _DoubleLinkedQueueEntrySentinel.prototype.remove = function() { 1343 _DoubleLinkedQueueEntrySentinel.prototype.remove = function() {
1569 $throw(const$16/*const EmptyQueueException()*/); 1344 $throw(const$5/*const EmptyQueueException()*/);
1570 } 1345 }
1571 _DoubleLinkedQueueEntrySentinel.prototype._asNonSentinelEntry = function() { 1346 _DoubleLinkedQueueEntrySentinel.prototype._asNonSentinelEntry = function() {
1572 return null; 1347 return null;
1573 } 1348 }
1574 _DoubleLinkedQueueEntrySentinel.prototype.get$element = function() { 1349 _DoubleLinkedQueueEntrySentinel.prototype.get$element = function() {
1575 $throw(const$16/*const EmptyQueueException()*/); 1350 $throw(const$5/*const EmptyQueueException()*/);
1576 } 1351 }
1577 // ********** Code for _DoubleLinkedQueueEntrySentinel$E ************** 1352 // ********** Code for _DoubleLinkedQueueEntrySentinel$E **************
1578 function _DoubleLinkedQueueEntrySentinel$E() { 1353 function _DoubleLinkedQueueEntrySentinel$E() {
1579 DoubleLinkedQueueEntry$E.call(this, null); 1354 DoubleLinkedQueueEntry$E.call(this, null);
1580 // Initializers done 1355 // Initializers done
1581 this._link(this, this); 1356 this._link(this, this);
1582 } 1357 }
1583 $inherits(_DoubleLinkedQueueEntrySentinel$E, _DoubleLinkedQueueEntrySentinel); 1358 $inherits(_DoubleLinkedQueueEntrySentinel$E, _DoubleLinkedQueueEntrySentinel);
1584 _DoubleLinkedQueueEntrySentinel$E.prototype._link = function(p, n) { 1359 _DoubleLinkedQueueEntrySentinel$E.prototype._link = function(p, n) {
1585 this._next = n; 1360 this._next = n;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 function _DoubleLinkedQueueIterator(_sentinel) { 1530 function _DoubleLinkedQueueIterator(_sentinel) {
1756 this._sentinel = _sentinel; 1531 this._sentinel = _sentinel;
1757 // Initializers done 1532 // Initializers done
1758 this._currentEntry = this._sentinel; 1533 this._currentEntry = this._sentinel;
1759 } 1534 }
1760 _DoubleLinkedQueueIterator.prototype.hasNext = function() { 1535 _DoubleLinkedQueueIterator.prototype.hasNext = function() {
1761 return this._currentEntry._next !== this._sentinel; 1536 return this._currentEntry._next !== this._sentinel;
1762 } 1537 }
1763 _DoubleLinkedQueueIterator.prototype.next = function() { 1538 _DoubleLinkedQueueIterator.prototype.next = function() {
1764 if (!this.hasNext()) { 1539 if (!this.hasNext()) {
1765 $throw(const$15/*const NoMoreElementsException()*/); 1540 $throw(const$4/*const NoMoreElementsException()*/);
1766 } 1541 }
1767 this._currentEntry = this._currentEntry._next; 1542 this._currentEntry = this._currentEntry._next;
1768 return this._currentEntry.get$element(); 1543 return this._currentEntry.get$element();
1769 } 1544 }
1770 // ********** Code for _DoubleLinkedQueueIterator$E ************** 1545 // ********** Code for _DoubleLinkedQueueIterator$E **************
1771 function _DoubleLinkedQueueIterator$E(_sentinel) { 1546 function _DoubleLinkedQueueIterator$E(_sentinel) {
1772 this._sentinel = _sentinel; 1547 this._sentinel = _sentinel;
1773 // Initializers done 1548 // Initializers done
1774 this._currentEntry = this._sentinel; 1549 this._currentEntry = this._sentinel;
1775 } 1550 }
(...skipping 26 matching lines...) Expand all
1802 return 0; 1577 return 0;
1803 } 1578 }
1804 return (this._stop == null) ? (Clock.now() - this._start) : (this._stop - this ._start); 1579 return (this._stop == null) ? (Clock.now() - this._start) : (this._stop - this ._start);
1805 } 1580 }
1806 StopWatchImplementation.prototype.elapsedInMs = function() { 1581 StopWatchImplementation.prototype.elapsedInMs = function() {
1807 return $truncdiv((this.elapsed() * 1000), this.frequency()); 1582 return $truncdiv((this.elapsed() * 1000), this.frequency());
1808 } 1583 }
1809 StopWatchImplementation.prototype.frequency = function() { 1584 StopWatchImplementation.prototype.frequency = function() {
1810 return Clock.frequency(); 1585 return Clock.frequency();
1811 } 1586 }
1812 // ********** Code for SplayTreeNode **************
1813 function SplayTreeNode(k, v) {
1814 // Initializers done
1815 this.key = k;
1816 this.value = v;
1817 }
1818 SplayTreeNode.prototype.get$value = function() { return this.value; };
1819 SplayTreeNode.prototype.set$value = function(value) { return this.value = value; };
1820 // ********** Code for SplayTreeNode$K$V **************
1821 function SplayTreeNode$K$V() {}
1822 $inherits(SplayTreeNode$K$V, SplayTreeNode);
1823 // ********** Code for SplayTree **************
1824 function SplayTree() {}
1825 SplayTree.prototype.splay_ = function(key) {
1826 if (this.isEmpty()) return;
1827 var left = this._dummy;
1828 var right = this._dummy;
1829 var current = this._root;
1830 while (true) {
1831 if (key.compareTo(current.key) < 0) {
1832 if (current.left == null) break;
1833 if (key.compareTo(current.left.key) < 0) {
1834 var tmp = current.left;
1835 current.left = tmp.right;
1836 tmp.right = current;
1837 current = tmp;
1838 if (current.left == null) break;
1839 }
1840 right.left = current;
1841 right = current;
1842 current = current.left;
1843 }
1844 else if (key.compareTo(current.key) > 0) {
1845 if (current.right == null) break;
1846 if (key.compareTo(current.right.key) > 0) {
1847 var tmp = current.right;
1848 current.right = tmp.left;
1849 tmp.left = current;
1850 current = tmp;
1851 if (current.right == null) break;
1852 }
1853 left.right = current;
1854 left = current;
1855 current = current.right;
1856 }
1857 else {
1858 break;
1859 }
1860 }
1861 left.right = current.left;
1862 right.left = current.right;
1863 current.left = this._dummy.right;
1864 current.right = this._dummy.left;
1865 this._root = current;
1866 this._dummy.right = null;
1867 this._dummy.left = null;
1868 }
1869 SplayTree.prototype.$index = function(key) {
1870 if (!this.isEmpty()) {
1871 this.splay_(key);
1872 if (this._root.key.compareTo(key) == 0) return this._root.value;
1873 }
1874 return null;
1875 }
1876 SplayTree.prototype.$setindex = function(key, value) {
1877 if (this.isEmpty()) {
1878 this._count++;
1879 this._root = new SplayTreeNode(key, value);
1880 return;
1881 }
1882 this.splay_(key);
1883 if (this._root.key.compareTo(key) == 0) {
1884 this._root.value = value;
1885 return;
1886 }
1887 var node = new SplayTreeNode(key, value);
1888 this._count++;
1889 if (key.compareTo(this._root.key) > 0) {
1890 node.left = this._root;
1891 node.right = this._root.right;
1892 this._root.right = null;
1893 }
1894 else {
1895 node.right = this._root;
1896 node.left = this._root.left;
1897 this._root.left = null;
1898 }
1899 this._root = node;
1900 }
1901 SplayTree.prototype.isEmpty = function() {
1902 return (this._root == null);
1903 }
1904 SplayTree.prototype.forEach = function(f) {
1905 var list = new ListFactory$SplayTreeNode$K$V();
1906 var current = this._root;
1907 while (current != null) {
1908 if (current.left != null) {
1909 list.add(current);
1910 current = current.left;
1911 }
1912 else {
1913 f(current.key, current.value);
1914 while (current.right == null) {
1915 if (list.isEmpty()) return;
1916 current = list.removeLast();
1917 f(current.key, current.value);
1918 }
1919 current = current.right;
1920 }
1921 }
1922 }
1923 SplayTree.prototype.get$length = function() {
1924 return this._count;
1925 }
1926 Object.defineProperty(SplayTree.prototype, "length", {
1927 get: SplayTree.prototype.get$length,
1928 });
1929 SplayTree.prototype.clear = function() {
1930 this._root = null;
1931 this._count = 0;
1932 }
1933 SplayTree.prototype.containsKey = function(key) {
1934 if (!this.isEmpty()) {
1935 this.splay_(key);
1936 if (this._root.key.compareTo(key) == 0) return true;
1937 }
1938 return false;
1939 }
1940 SplayTree.prototype.getKeys = function() {
1941 var list = new ListFactory$K();
1942 this.forEach((function (k, v) {
1943 list.add(k);
1944 })
1945 );
1946 return list;
1947 }
1948 SplayTree.prototype.getValues = function() {
1949 var list = new ListFactory$V();
1950 this.forEach((function (k, v) {
1951 list.add(v);
1952 })
1953 );
1954 return list;
1955 }
1956 SplayTree.prototype.forEach$1 = SplayTree.prototype.forEach;
1957 // ********** Code for StringBufferImpl ************** 1587 // ********** Code for StringBufferImpl **************
1958 function StringBufferImpl(content) { 1588 function StringBufferImpl(content) {
1959 // Initializers done 1589 // Initializers done
1960 this.clear(); 1590 this.clear();
1961 this.add(content); 1591 this.add(content);
1962 } 1592 }
1963 StringBufferImpl.prototype.get$length = function() { 1593 StringBufferImpl.prototype.get$length = function() {
1964 return this._length; 1594 return this._length;
1965 } 1595 }
1966 Object.defineProperty(StringBufferImpl.prototype, "length", { 1596 Object.defineProperty(StringBufferImpl.prototype, "length", {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2175 } 1805 }
2176 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype; 1806 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype;
2177 TimeZoneImplementation.prototype.$eq = function(other) { 1807 TimeZoneImplementation.prototype.$eq = function(other) {
2178 if (!((other instanceof TimeZoneImplementation))) return false; 1808 if (!((other instanceof TimeZoneImplementation))) return false;
2179 return $eq(this.isUtc, other.isUtc); 1809 return $eq(this.isUtc, other.isUtc);
2180 } 1810 }
2181 TimeZoneImplementation.prototype.toString = function() { 1811 TimeZoneImplementation.prototype.toString = function() {
2182 if (this.isUtc) return "TimeZone (UTC)"; 1812 if (this.isUtc) return "TimeZone (UTC)";
2183 return "TimeZone (Local)"; 1813 return "TimeZone (Local)";
2184 } 1814 }
2185 // ********** Code for SendPortImpl **************
2186 function SendPortImpl() {}
2187 SendPortImpl.prototype.$eq = function(other) {
2188 return ((other instanceof SendPortImpl)) && (this._workerId == other._workerId ) && (this._isolateId == other._isolateId) && (this._receivePortId == other._rec eivePortId);
2189 }
2190 SendPortImpl.prototype.hashCode = function() {
2191 return (this._workerId << 16) ^ (this._isolateId << 8) ^ this._receivePortId;
2192 }
2193 // ********** Code for top level ************** 1815 // ********** Code for top level **************
2194 function MatchImplementation(pattern, str, _start, _end, _groups) { 1816 function MatchImplementation(pattern, str, _start, _end, _groups) {
2195 this.pattern = pattern; 1817 this.pattern = pattern;
2196 this.str = str; 1818 this.str = str;
2197 this._start = _start; 1819 this._start = _start;
2198 this._end = _end; 1820 this._end = _end;
2199 this._groups = _groups; 1821 this._groups = _groups;
2200 // Initializers done 1822 // Initializers done
2201 } 1823 }
2202 // ********** Library node ************** 1824 // ********** Library node **************
(...skipping 14 matching lines...) Expand all
2217 return require('vm'); 1839 return require('vm');
2218 } 1840 }
2219 1841
2220 function get$http() { 1842 function get$http() {
2221 return require('http'); 1843 return require('http');
2222 } 1844 }
2223 1845
2224 function get$readline() { 1846 function get$readline() {
2225 return require('readline'); 1847 return require('readline');
2226 } 1848 }
2227 // ********** Code for ServerRequest **************
2228 // ********** Code for Process ************** 1849 // ********** Code for Process **************
2229 // ********** Code for top level ************** 1850 // ********** Code for top level **************
2230 function createSandbox() { 1851 function createSandbox() {
2231 return {'require': require, 'process': process, 'console': console}; 1852 return {'require': require, 'process': process, 'console': console};
2232 } 1853 }
2233 // ********** Library file_system ************** 1854 // ********** Library file_system **************
2234 // ********** Code for top level ************** 1855 // ********** Code for top level **************
2235 function joinPaths(path1, path2) { 1856 function joinPaths(path1, path2) {
2236 var pieces = path1.split('/'); 1857 var pieces = path1.split('/');
2237 var $list = path2.split('/'); 1858 var $list = path2.split('/');
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
3178 } 2799 }
3179 next = this.advance(); 2800 next = this.advance();
3180 } 2801 }
3181 return next; 2802 return next;
3182 } 2803 }
3183 // ********** Code for top level ************** 2804 // ********** Code for top level **************
3184 // ********** Library util_implementation ************** 2805 // ********** Library util_implementation **************
3185 // ********** Code for LinkFactory ************** 2806 // ********** Code for LinkFactory **************
3186 function LinkFactory() {} 2807 function LinkFactory() {}
3187 LinkFactory.Link$factory = function(head, tail) { 2808 LinkFactory.Link$factory = function(head, tail) {
3188 return new LinkEntry(head, (tail == null) ? const$135/*const EmptyLink<Express ion>()*/ : tail); 2809 return new LinkEntry(head, (tail == null) ? const$227/*const EmptyLink<Declara tionBuilder>()*/ : tail);
3189 } 2810 }
3190 // ********** Code for AbstractLink ************** 2811 // ********** Code for AbstractLink **************
3191 function AbstractLink() {} 2812 function AbstractLink() {}
3192 AbstractLink.prototype.get$head = function() { 2813 AbstractLink.prototype.get$head = function() {
3193 $throw("bug"); 2814 $throw("bug");
3194 } 2815 }
3195 AbstractLink.prototype.get$tail = function() { 2816 AbstractLink.prototype.get$tail = function() {
3196 $throw("bug"); 2817 $throw("bug");
3197 } 2818 }
3198 AbstractLink.prototype.prepend = function(element) { 2819 AbstractLink.prototype.prepend = function(element) {
(...skipping 12 matching lines...) Expand all
3211 } 2832 }
3212 } 2833 }
3213 AbstractLink.prototype.toString = function() { 2834 AbstractLink.prototype.toString = function() {
3214 var buffer = new StringBufferImpl(""); 2835 var buffer = new StringBufferImpl("");
3215 buffer.add('[ '); 2836 buffer.add('[ ');
3216 this.printOn(buffer, ', '); 2837 this.printOn(buffer, ', ');
3217 buffer.add(' ]'); 2838 buffer.add(' ]');
3218 return buffer.toString(); 2839 return buffer.toString();
3219 } 2840 }
3220 AbstractLink.prototype.reverse = function() { 2841 AbstractLink.prototype.reverse = function() {
3221 var result = const$135/*const EmptyLink<Expression>()*/; 2842 var result = const$227/*const EmptyLink<DeclarationBuilder>()*/;
3222 for (var link = this; 2843 for (var link = this;
3223 !link.isEmpty(); link = link.get$tail()) { 2844 !link.isEmpty(); link = link.get$tail()) {
3224 result = result.prepend(link.get$head()); 2845 result = result.prepend(link.get$head());
3225 } 2846 }
3226 return result; 2847 return result;
3227 } 2848 }
3228 AbstractLink.prototype.printOn$1 = function($0) { 2849 AbstractLink.prototype.printOn$1 = function($0) {
3229 return this.printOn($0, ''); 2850 return this.printOn($0, '');
3230 } 2851 }
3231 ; 2852 ;
3232 // ********** Code for AbstractLink$T ************** 2853 // ********** Code for AbstractLink$T **************
3233 function AbstractLink$T() {} 2854 function AbstractLink$T() {}
3234 $inherits(AbstractLink$T, AbstractLink); 2855 $inherits(AbstractLink$T, AbstractLink);
3235 AbstractLink$T.prototype.iterator = function() { 2856 AbstractLink$T.prototype.iterator = function() {
3236 return this.toList().iterator(); 2857 return this.toList().iterator();
3237 } 2858 }
3238 // ********** Code for LinkTail ************** 2859 // ********** Code for LinkTail **************
3239 function LinkTail() { 2860 function LinkTail() {
3240 // Initializers done 2861 // Initializers done
3241 } 2862 }
3242 $inherits(LinkTail, AbstractLink$T); 2863 $inherits(LinkTail, AbstractLink$T);
3243 LinkTail.prototype.get$head = function() { 2864 LinkTail.prototype.get$head = function() {
3244 return null; 2865 return null;
3245 } 2866 }
3246 LinkTail.prototype.get$tail = function() { 2867 LinkTail.prototype.get$tail = function() {
3247 return null; 2868 return null;
3248 } 2869 }
3249 LinkTail.prototype.toList = function() { 2870 LinkTail.prototype.toList = function() {
3250 return const$14/*const <HInstruction>[]*/; 2871 return const$226/*const []*/;
3251 } 2872 }
3252 LinkTail.prototype.isEmpty = function() { 2873 LinkTail.prototype.isEmpty = function() {
3253 return true; 2874 return true;
3254 } 2875 }
3255 // ********** Code for LinkTail$DeclarationBuilder ************** 2876 // ********** Code for LinkTail$DeclarationBuilder **************
3256 function LinkTail$DeclarationBuilder() { 2877 function LinkTail$DeclarationBuilder() {
3257 // Initializers done 2878 // Initializers done
3258 } 2879 }
3259 $inherits(LinkTail$DeclarationBuilder, LinkTail); 2880 $inherits(LinkTail$DeclarationBuilder, LinkTail);
3260 // ********** Code for LinkTail$Element ************** 2881 // ********** Code for LinkTail$Element **************
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3303 $inherits(LinkEntry$T, LinkEntry); 2924 $inherits(LinkEntry$T, LinkEntry);
3304 // ********** Code for LinkBuilderImplementation ************** 2925 // ********** Code for LinkBuilderImplementation **************
3305 function LinkBuilderImplementation() { 2926 function LinkBuilderImplementation() {
3306 this.head = null 2927 this.head = null
3307 this.lastLink = null 2928 this.lastLink = null
3308 // Initializers done 2929 // Initializers done
3309 } 2930 }
3310 LinkBuilderImplementation.prototype.get$head = function() { return this.head; }; 2931 LinkBuilderImplementation.prototype.get$head = function() { return this.head; };
3311 LinkBuilderImplementation.prototype.set$head = function(value) { return this.hea d = value; }; 2932 LinkBuilderImplementation.prototype.set$head = function(value) { return this.hea d = value; };
3312 LinkBuilderImplementation.prototype.toLink = function() { 2933 LinkBuilderImplementation.prototype.toLink = function() {
3313 if (this.head == null) return const$135/*const EmptyLink<Expression>()*/; 2934 if (this.head == null) return const$227/*const EmptyLink<DeclarationBuilder>() */;
3314 this.lastLink.realTail = const$135/*const EmptyLink<Expression>()*/; 2935 this.lastLink.realTail = const$227/*const EmptyLink<DeclarationBuilder>()*/;
3315 var link = this.head; 2936 var link = this.head;
3316 this.lastLink = null; 2937 this.lastLink = null;
3317 this.head = null; 2938 this.head = null;
3318 return link; 2939 return link;
3319 } 2940 }
3320 LinkBuilderImplementation.prototype.addLast = function(t) { 2941 LinkBuilderImplementation.prototype.addLast = function(t) {
3321 var entry = new LinkEntry$T(t, null); 2942 var entry = new LinkEntry$T(t, null);
3322 if (this.head == null) { 2943 if (this.head == null) {
3323 this.head = entry; 2944 this.head = entry;
3324 } 2945 }
(...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after
4963 Parser.prototype.checkEof = function(token) { 4584 Parser.prototype.checkEof = function(token) {
4964 if (token == null) { 4585 if (token == null) {
4965 this.listener.unexpectedEof(); 4586 this.listener.unexpectedEof();
4966 $throw("Unexpected EOF"); 4587 $throw("Unexpected EOF");
4967 } 4588 }
4968 return token; 4589 return token;
4969 } 4590 }
4970 Parser.prototype.parseUnit = function(token) { 4591 Parser.prototype.parseUnit = function(token) {
4971 while (token != null) { 4592 while (token != null) {
4972 switch (token.get$value()) { 4593 switch (token.get$value()) {
4973 case const$359/*Keyword.INTERFACE*/: 4594 case const$203/*Keyword.INTERFACE*/:
4974 4595
4975 token = this.parseInterface(token); 4596 token = this.parseInterface(token);
4976 break; 4597 break;
4977 4598
4978 case const$347/*Keyword.CLASS*/: 4599 case const$191/*Keyword.CLASS*/:
4979 4600
4980 token = this.parseClass(token); 4601 token = this.parseClass(token);
4981 break; 4602 break;
4982 4603
4983 case const$375/*Keyword.TYPEDEF*/: 4604 case const$219/*Keyword.TYPEDEF*/:
4984 4605
4985 token = this.parseNamedFunctionAlias(token); 4606 token = this.parseNamedFunctionAlias(token);
4986 break; 4607 break;
4987 4608
4988 case const$380/*const SourceString("#")*/: 4609 case const$237/*const SourceString("#")*/:
4989 4610
4990 token = this.parseLibraryTags(token); 4611 token = this.parseLibraryTags(token);
4991 break; 4612 break;
4992 4613
4993 default: 4614 default:
4994 4615
4995 token = this.parseTopLevelMember(token); 4616 token = this.parseTopLevelMember(token);
4996 break; 4617 break;
4997 4618
4998 } 4619 }
(...skipping 12 matching lines...) Expand all
5011 this.listener.endInterface(token); 4632 this.listener.endInterface(token);
5012 return token.next; 4633 return token.next;
5013 } 4634 }
5014 Parser.prototype.parseNamedFunctionAlias = function(token) { 4635 Parser.prototype.parseNamedFunctionAlias = function(token) {
5015 this.listener.beginFunctionTypeAlias(token); 4636 this.listener.beginFunctionTypeAlias(token);
5016 token = this.parseReturnTypeOpt(this.next(token)); 4637 token = this.parseReturnTypeOpt(this.next(token));
5017 token = this.parseIdentifier(token); 4638 token = this.parseIdentifier(token);
5018 token = this.parseTypeVariablesOpt(token); 4639 token = this.parseTypeVariablesOpt(token);
5019 token = this.parseParameters(token); 4640 token = this.parseParameters(token);
5020 this.listener.endFunctionTypeAlias(token); 4641 this.listener.endFunctionTypeAlias(token);
5021 return this.expect(const$147/*const SourceString(";")*/, token); 4642 return this.expect(const$236/*const SourceString(";")*/, token);
5022 } 4643 }
5023 Parser.prototype.parseReturnTypeOpt = function(token) { 4644 Parser.prototype.parseReturnTypeOpt = function(token) {
5024 if ($eq(token.get$value(), const$136/*Keyword.VOID*/)) { 4645 if ($eq(token.get$value(), const$183/*Keyword.VOID*/)) {
5025 this.listener.voidType(token); 4646 this.listener.voidType(token);
5026 return this.next(token); 4647 return this.next(token);
5027 } 4648 }
5028 else { 4649 else {
5029 return this.parseTypeOpt(token); 4650 return this.parseTypeOpt(token);
5030 } 4651 }
5031 } 4652 }
5032 Parser.prototype.parseParameters = function(token) { 4653 Parser.prototype.parseParameters = function(token) {
5033 this.expect(const$145/*const SourceString("(")*/, token); 4654 this.expect(const$234/*const SourceString("(")*/, token);
5034 if (this.optional(const$146/*const SourceString(")")*/, this.next(token))) { 4655 if (this.optional(const$235/*const SourceString(")")*/, this.next(token))) {
5035 return this.next(this.next(token)); 4656 return this.next(this.next(token));
5036 } 4657 }
5037 do { 4658 do {
5038 token = this.parseTypeOpt(this.next(token)); 4659 token = this.parseTypeOpt(this.next(token));
5039 token = this.parseIdentifier(token); 4660 token = this.parseIdentifier(token);
5040 } 4661 }
5041 while (this.optional(const$143/*const SourceString(",")*/, token)) 4662 while (this.optional(const$230/*const SourceString(",")*/, token))
5042 return this.expect(const$146/*const SourceString(")")*/, token); 4663 return this.expect(const$235/*const SourceString(")")*/, token);
5043 } 4664 }
5044 Parser.prototype.parseTypeOpt = function(token) { 4665 Parser.prototype.parseTypeOpt = function(token) {
5045 switch (true) { 4666 switch (true) {
5046 case this.optional(const$138/*const SourceString("<")*/, this.next(token)): 4667 case this.optional(const$228/*const SourceString("<")*/, this.next(token)):
5047 case this.optional(const$139/*const SourceString(".")*/, this.next(token)): 4668 case this.optional(const$229/*const SourceString(".")*/, this.next(token)):
5048 case this.isIdentifier(this.next(token)): 4669 case this.isIdentifier(this.next(token)):
5049 4670
5050 return this.parseType(token); 4671 return this.parseType(token);
5051 4672
5052 default: 4673 default:
5053 4674
5054 return token; 4675 return token;
5055 4676
5056 } 4677 }
5057 } 4678 }
5058 Parser.prototype.isIdentifier = function(token) { 4679 Parser.prototype.isIdentifier = function(token) {
5059 switch (token.kind) { 4680 switch (token.kind) {
5060 case 97/*null.IDENTIFIER_TOKEN*/: 4681 case 97/*null.IDENTIFIER_TOKEN*/:
5061 4682
5062 return true; 4683 return true;
5063 4684
5064 case 107/*null.KEYWORD_TOKEN*/: 4685 case 107/*null.KEYWORD_TOKEN*/:
5065 4686
5066 return token.get$value().isPseudo; 4687 return token.get$value().isPseudo;
5067 4688
5068 default: 4689 default:
5069 4690
5070 return false; 4691 return false;
5071 4692
5072 } 4693 }
5073 } 4694 }
5074 Parser.prototype.parseSupertypesClauseOpt = function(token) { 4695 Parser.prototype.parseSupertypesClauseOpt = function(token) {
5075 if (this.optional(const$349/*Keyword.EXTENDS*/, token)) { 4696 if (this.optional(const$193/*Keyword.EXTENDS*/, token)) {
5076 do { 4697 do {
5077 token = this.parseType(this.next(token)); 4698 token = this.parseType(this.next(token));
5078 } 4699 }
5079 while (this.optional(const$143/*const SourceString(",")*/, token)) 4700 while (this.optional(const$230/*const SourceString(",")*/, token))
5080 } 4701 }
5081 return token; 4702 return token;
5082 } 4703 }
5083 Parser.prototype.parseFactoryClauseOpt = function(token) { 4704 Parser.prototype.parseFactoryClauseOpt = function(token) {
5084 if (this.optional(const$351/*Keyword.FACTORY*/, token)) { 4705 if (this.optional(const$195/*Keyword.FACTORY*/, token)) {
5085 return this.parseType(this.next(token)); 4706 return this.parseType(this.next(token));
5086 } 4707 }
5087 return token; 4708 return token;
5088 } 4709 }
5089 Parser.prototype.skipBlock = function(token) { 4710 Parser.prototype.skipBlock = function(token) {
5090 if (!this.optional(const$148/*const SourceString("{")*/, token)) { 4711 if (!this.optional(const$232/*const SourceString("{")*/, token)) {
5091 return this.listener.expectedBlock(token); 4712 return this.listener.expectedBlock(token);
5092 } 4713 }
5093 token = this.next(token); 4714 token = this.next(token);
5094 var nesting = 1; 4715 var nesting = 1;
5095 do { 4716 do {
5096 switch (token.kind) { 4717 switch (token.kind) {
5097 case 123/*null.LBRACE_TOKEN*/: 4718 case 123/*null.LBRACE_TOKEN*/:
5098 4719
5099 nesting++; 4720 nesting++;
5100 break; 4721 break;
(...skipping 15 matching lines...) Expand all
5116 Parser.prototype.parseClass = function(token) { 4737 Parser.prototype.parseClass = function(token) {
5117 this.listener.beginClass(token); 4738 this.listener.beginClass(token);
5118 token = this.parseIdentifier(this.next(token)); 4739 token = this.parseIdentifier(this.next(token));
5119 token = this.parseTypeVariablesOpt(token); 4740 token = this.parseTypeVariablesOpt(token);
5120 token = this.parseSuperclassClauseOpt(token); 4741 token = this.parseSuperclassClauseOpt(token);
5121 token = this.parseImplementsOpt(token); 4742 token = this.parseImplementsOpt(token);
5122 token = this.parseNativeClassClauseOpt(token); 4743 token = this.parseNativeClassClauseOpt(token);
5123 return this.parseClassBody(token); 4744 return this.parseClassBody(token);
5124 } 4745 }
5125 Parser.prototype.parseNativeClassClauseOpt = function(token) { 4746 Parser.prototype.parseNativeClassClauseOpt = function(token) {
5126 if (this.optional(const$363/*Keyword.NATIVE*/, token)) { 4747 if (this.optional(const$207/*Keyword.NATIVE*/, token)) {
5127 return this.parseString(this.next(token)); 4748 return this.parseString(this.next(token));
5128 } 4749 }
5129 return token; 4750 return token;
5130 } 4751 }
5131 Parser.prototype.parseString = function(token) { 4752 Parser.prototype.parseString = function(token) {
5132 switch (token.kind) { 4753 switch (token.kind) {
5133 case 39/*null.STRING_TOKEN*/: 4754 case 39/*null.STRING_TOKEN*/:
5134 4755
5135 return this.next(token); 4756 return this.next(token);
5136 4757
5137 default: 4758 default:
5138 4759
5139 return this.listener.expected(const$379/*const SourceString("string")*/, t oken); 4760 return this.listener.expected(const$233/*const SourceString("string")*/, t oken);
5140 4761
5141 } 4762 }
5142 } 4763 }
5143 Parser.prototype.parseIdentifier = function(token) { 4764 Parser.prototype.parseIdentifier = function(token) {
5144 if (this.isIdentifier(token)) { 4765 if (this.isIdentifier(token)) {
5145 this.listener.identifier(token); 4766 this.listener.identifier(token);
5146 } 4767 }
5147 else { 4768 else {
5148 this.listener.notIdentifier(token); 4769 this.listener.notIdentifier(token);
5149 } 4770 }
5150 return this.next(token); 4771 return this.next(token);
5151 } 4772 }
5152 Parser.prototype.parseTypeVariablesOpt = function(token) { 4773 Parser.prototype.parseTypeVariablesOpt = function(token) {
5153 if (!this.optional(const$138/*const SourceString("<")*/, token)) { 4774 if (!this.optional(const$228/*const SourceString("<")*/, token)) {
5154 return token; 4775 return token;
5155 } 4776 }
5156 this.listener.beginTypeVariables(token); 4777 this.listener.beginTypeVariables(token);
5157 do { 4778 do {
5158 token = this.parseTypeVariable(this.next(token)); 4779 token = this.parseTypeVariable(this.next(token));
5159 } 4780 }
5160 while (this.optional(const$143/*const SourceString(",")*/, token)) 4781 while (this.optional(const$230/*const SourceString(",")*/, token))
5161 return this.expect(const$144/*const SourceString(">")*/, token); 4782 return this.expect(const$231/*const SourceString(">")*/, token);
5162 } 4783 }
5163 Parser.prototype.expect = function(string, token) { 4784 Parser.prototype.expect = function(string, token) {
5164 if ($ne(string, token.get$value())) { 4785 if ($ne(string, token.get$value())) {
5165 return this.listener.expected(string, token); 4786 return this.listener.expected(string, token);
5166 } 4787 }
5167 return token.next; 4788 return token.next;
5168 } 4789 }
5169 Parser.prototype.parseTypeVariable = function(token) { 4790 Parser.prototype.parseTypeVariable = function(token) {
5170 this.listener.beginTypeVariable(token); 4791 this.listener.beginTypeVariable(token);
5171 token = this.parseIdentifier(token); 4792 token = this.parseIdentifier(token);
5172 token = this.parseSuperclassClauseOpt(token); 4793 token = this.parseSuperclassClauseOpt(token);
5173 this.listener.endTypeVariable(token); 4794 this.listener.endTypeVariable(token);
5174 return token; 4795 return token;
5175 } 4796 }
5176 Parser.prototype.optional = function(value, token) { 4797 Parser.prototype.optional = function(value, token) {
5177 return $eq(value, token.get$value()); 4798 return $eq(value, token.get$value());
5178 } 4799 }
5179 Parser.prototype.parseSuperclassClauseOpt = function(token) { 4800 Parser.prototype.parseSuperclassClauseOpt = function(token) {
5180 if (this.optional(const$349/*Keyword.EXTENDS*/, token)) { 4801 if (this.optional(const$193/*Keyword.EXTENDS*/, token)) {
5181 return this.parseType(this.next(token)); 4802 return this.parseType(this.next(token));
5182 } 4803 }
5183 return token; 4804 return token;
5184 } 4805 }
5185 Parser.prototype.parseType = function(token) { 4806 Parser.prototype.parseType = function(token) {
5186 if (this.isIdentifier(token)) { 4807 if (this.isIdentifier(token)) {
5187 token = this.parseIdentifier(token); 4808 token = this.parseIdentifier(token);
5188 while (this.optional(const$139/*const SourceString(".")*/, token)) { 4809 while (this.optional(const$229/*const SourceString(".")*/, token)) {
5189 token = this.parseIdentifier(this.next(token)); 4810 token = this.parseIdentifier(this.next(token));
5190 } 4811 }
5191 } 4812 }
5192 else { 4813 else {
5193 token = this.listener.expectedType(token); 4814 token = this.listener.expectedType(token);
5194 } 4815 }
5195 return this.parseTypeArgumentsOpt(token); 4816 return this.parseTypeArgumentsOpt(token);
5196 } 4817 }
5197 Parser.prototype.parseTypeArgumentsOpt = function(token) { 4818 Parser.prototype.parseTypeArgumentsOpt = function(token) {
5198 if (this.optional(const$138/*const SourceString("<")*/, token)) { 4819 if (this.optional(const$228/*const SourceString("<")*/, token)) {
5199 this.listener.beginTypeArguments(this.next(token)); 4820 this.listener.beginTypeArguments(this.next(token));
5200 do { 4821 do {
5201 token = this.parseType(this.next(token)); 4822 token = this.parseType(this.next(token));
5202 } 4823 }
5203 while (this.optional(const$143/*const SourceString(",")*/, token)) 4824 while (this.optional(const$230/*const SourceString(",")*/, token))
5204 return this.expect(const$144/*const SourceString(">")*/, token); 4825 return this.expect(const$231/*const SourceString(">")*/, token);
5205 } 4826 }
5206 return token; 4827 return token;
5207 } 4828 }
5208 Parser.prototype.parseImplementsOpt = function(token) { 4829 Parser.prototype.parseImplementsOpt = function(token) {
5209 if (this.optional(const$355/*Keyword.IMPLEMENTS*/, token)) { 4830 if (this.optional(const$199/*Keyword.IMPLEMENTS*/, token)) {
5210 do { 4831 do {
5211 token = this.parseType(this.next(token)); 4832 token = this.parseType(this.next(token));
5212 } 4833 }
5213 while (this.optional(const$143/*const SourceString(",")*/, token)) 4834 while (this.optional(const$230/*const SourceString(",")*/, token))
5214 } 4835 }
5215 return token; 4836 return token;
5216 } 4837 }
5217 Parser.prototype.parseClassBody = function(token) { 4838 Parser.prototype.parseClassBody = function(token) {
5218 token = this.skipBlock(token); 4839 token = this.skipBlock(token);
5219 this.listener.endClass(token); 4840 this.listener.endClass(token);
5220 return token.next; 4841 return token.next;
5221 } 4842 }
5222 Parser.prototype.parseTopLevelMember = function(token) { 4843 Parser.prototype.parseTopLevelMember = function(token) {
5223 var start = token; 4844 var start = token;
(...skipping 11 matching lines...) Expand all
5235 4856
5236 default: 4857 default:
5237 4858
5238 previous = token; 4859 previous = token;
5239 token = this.next(token); 4860 token = this.next(token);
5240 break; 4861 break;
5241 4862
5242 } 4863 }
5243 } 4864 }
5244 token = this.parseIdentifier(previous); 4865 token = this.parseIdentifier(previous);
5245 if (this.optional(const$145/*const SourceString("(")*/, token)) { 4866 if (this.optional(const$234/*const SourceString("(")*/, token)) {
5246 this.listener.topLevelMethod(start); 4867 this.listener.topLevelMethod(start);
5247 } 4868 }
5248 else if (this.optional(const$381/*const SourceString("=")*/, token) || this.op tional(const$147/*const SourceString(";")*/, token)) { 4869 else if (this.optional(const$238/*const SourceString("=")*/, token) || this.op tional(const$236/*const SourceString(";")*/, token)) {
5249 this.listener.topLevelField(start); 4870 this.listener.topLevelField(start);
5250 } 4871 }
5251 else { 4872 else {
5252 token = this.listener.unexpected(token); 4873 token = this.listener.unexpected(token);
5253 } 4874 }
5254 while (token != null && token.kind != 123/*null.LBRACE_TOKEN*/ && token.kind ! = 59/*null.SEMICOLON_TOKEN*/) { 4875 while (token != null && token.kind != 123/*null.LBRACE_TOKEN*/ && token.kind ! = 59/*null.SEMICOLON_TOKEN*/) {
5255 token = this.next(token); 4876 token = this.next(token);
5256 } 4877 }
5257 if (!this.optional(const$147/*const SourceString(";")*/, token)) { 4878 if (!this.optional(const$236/*const SourceString(";")*/, token)) {
5258 token = this.skipBlock(token); 4879 token = this.skipBlock(token);
5259 } 4880 }
5260 this.listener.endTopLevelMember(token); 4881 this.listener.endTopLevelMember(token);
5261 return token.next; 4882 return token.next;
5262 } 4883 }
5263 Parser.prototype.parseLibraryTags = function(token) { 4884 Parser.prototype.parseLibraryTags = function(token) {
5264 this.listener.beginLibraryTag(token); 4885 this.listener.beginLibraryTag(token);
5265 token = this.parseIdentifier(this.next(token)); 4886 token = this.parseIdentifier(this.next(token));
5266 token = this.expect(const$145/*const SourceString("(")*/, token); 4887 token = this.expect(const$234/*const SourceString("(")*/, token);
5267 while (token != null && token.kind != 40/*null.LPAREN_TOKEN*/ && token.kind != 41/*null.RPAREN_TOKEN*/) { 4888 while (token != null && token.kind != 40/*null.LPAREN_TOKEN*/ && token.kind != 41/*null.RPAREN_TOKEN*/) {
5268 token = this.next(token); 4889 token = this.next(token);
5269 } 4890 }
5270 token = this.expect(const$146/*const SourceString(")")*/, token); 4891 token = this.expect(const$235/*const SourceString(")")*/, token);
5271 return this.expect(const$147/*const SourceString(";")*/, token); 4892 return this.expect(const$236/*const SourceString(";")*/, token);
5272 } 4893 }
5273 // ********** Code for BodyParser ************** 4894 // ********** Code for BodyParser **************
5274 function BodyParser(listener0) { 4895 function BodyParser(listener0) {
5275 Parser.call(this, listener0); 4896 Parser.call(this, listener0);
5276 // Initializers done 4897 // Initializers done
5277 } 4898 }
5278 $inherits(BodyParser, Parser); 4899 $inherits(BodyParser, Parser);
5279 BodyParser.prototype.parseFunction = function(token) { 4900 BodyParser.prototype.parseFunction = function(token) {
5280 this.listener.beginFunction(token); 4901 this.listener.beginFunction(token);
5281 token = this.parseReturnTypeOpt(token); 4902 token = this.parseReturnTypeOpt(token);
5282 this.listener.beginFunctionName(token); 4903 this.listener.beginFunctionName(token);
5283 token = this.parseIdentifier(token); 4904 token = this.parseIdentifier(token);
5284 this.listener.endFunctionName(token); 4905 this.listener.endFunctionName(token);
5285 token = this.parseFormalParameters(token); 4906 token = this.parseFormalParameters(token);
5286 return this.parseFunctionBody(token); 4907 return this.parseFunctionBody(token);
5287 } 4908 }
5288 BodyParser.prototype.parseFormalParameters = function(token) { 4909 BodyParser.prototype.parseFormalParameters = function(token) {
5289 this.listener.beginFormalParameters(token); 4910 this.listener.beginFormalParameters(token);
5290 this.expect(const$145/*const SourceString("(")*/, token); 4911 this.expect(const$234/*const SourceString("(")*/, token);
5291 if (this.optional(const$146/*const SourceString(")")*/, token.next)) { 4912 if (this.optional(const$235/*const SourceString(")")*/, token.next)) {
5292 this.listener.endFormalParameters(token.next); 4913 this.listener.endFormalParameters(token.next);
5293 return token.next.next; 4914 return token.next.next;
5294 } 4915 }
5295 do { 4916 do {
5296 token = this.parseType(this.next(token)); 4917 token = this.parseType(this.next(token));
5297 token = this.parseIdentifier(token); 4918 token = this.parseIdentifier(token);
5298 } 4919 }
5299 while (this.optional(const$143/*const SourceString(",")*/, token)) 4920 while (this.optional(const$230/*const SourceString(",")*/, token))
5300 this.listener.endFormalParameters(token); 4921 this.listener.endFormalParameters(token);
5301 return this.expect(const$146/*const SourceString(")")*/, token); 4922 return this.expect(const$235/*const SourceString(")")*/, token);
5302 } 4923 }
5303 BodyParser.prototype.parseFunctionBody = function(token) { 4924 BodyParser.prototype.parseFunctionBody = function(token) {
5304 if (this.optional(const$147/*const SourceString(";")*/, token)) { 4925 if (this.optional(const$236/*const SourceString(";")*/, token)) {
5305 this.listener.emptyFunctionBody(token); 4926 this.listener.emptyFunctionBody(token);
5306 return token.next; 4927 return token.next;
5307 } 4928 }
5308 this.listener.beginFunctionBody(token); 4929 this.listener.beginFunctionBody(token);
5309 token = this.checkEof(this.expect(const$148/*const SourceString("{")*/, token) ); 4930 token = this.checkEof(this.expect(const$232/*const SourceString("{")*/, token) );
5310 while (!this.optional(const$149/*const SourceString("}")*/, token)) { 4931 while (!this.optional(const$239/*const SourceString("}")*/, token)) {
5311 token = this.parseStatement(token); 4932 token = this.parseStatement(token);
5312 } 4933 }
5313 this.listener.endFunctionBody(token); 4934 this.listener.endFunctionBody(token);
5314 return this.expect(const$149/*const SourceString("}")*/, token); 4935 return this.expect(const$239/*const SourceString("}")*/, token);
5315 } 4936 }
5316 BodyParser.prototype.parseStatement = function(token) { 4937 BodyParser.prototype.parseStatement = function(token) {
5317 this.checkEof(token); 4938 this.checkEof(token);
5318 if ($eq(token.get$value(), const$150/*const SourceString('{')*/)) { 4939 if ($eq(token.get$value(), const$240/*const SourceString('{')*/)) {
5319 return this.parseBlock(token); 4940 return this.parseBlock(token);
5320 } 4941 }
5321 switch (token.get$value()) { 4942 switch (token.get$value()) {
5322 case const$151/*Keyword.RETURN*/: 4943 case const$167/*Keyword.RETURN*/:
5323 4944
5324 return this.parseReturnStatement(token); 4945 return this.parseReturnStatement(token);
5325 4946
5326 case const$160/*Keyword.VAR*/: 4947 case const$181/*Keyword.VAR*/:
5327 4948
5328 return this.parseVariablesDeclaration(token); 4949 return this.parseVariablesDeclaration(token);
5329 4950
5330 case const$164/*Keyword.IF*/: 4951 case const$157/*Keyword.IF*/:
5331 4952
5332 return this.parseIfStatement(token); 4953 return this.parseIfStatement(token);
5333 4954
5334 default: 4955 default:
5335 4956
5336 return this.parseExpressionStatement(token); 4957 return this.parseExpressionStatement(token);
5337 4958
5338 } 4959 }
5339 } 4960 }
5340 BodyParser.prototype.expectSemicolon = function(token) { 4961 BodyParser.prototype.expectSemicolon = function(token) {
5341 return this.expect(const$147/*const SourceString(";")*/, token); 4962 return this.expect(const$236/*const SourceString(";")*/, token);
5342 } 4963 }
5343 BodyParser.prototype.parseReturnStatement = function(token) { 4964 BodyParser.prototype.parseReturnStatement = function(token) {
5344 this.listener.beginReturnStatement(token); 4965 this.listener.beginReturnStatement(token);
5345 token = this.parseExpression(this.next(token)); 4966 token = this.parseExpression(this.next(token));
5346 this.listener.endReturnStatement(token); 4967 this.listener.endReturnStatement(token);
5347 return this.expectSemicolon(token); 4968 return this.expectSemicolon(token);
5348 } 4969 }
5349 BodyParser.prototype.parseExpressionStatement = function(token) { 4970 BodyParser.prototype.parseExpressionStatement = function(token) {
5350 this.listener.beginExpressionStatement(token); 4971 this.listener.beginExpressionStatement(token);
5351 token = this.parseExpression(token); 4972 token = this.parseExpression(token);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
5537 return this.parseLiteralDouble(token); 5158 return this.parseLiteralDouble(token);
5538 5159
5539 case 39/*null.STRING_TOKEN*/: 5160 case 39/*null.STRING_TOKEN*/:
5540 5161
5541 return this.parseLiteralString(token); 5162 return this.parseLiteralString(token);
5542 5163
5543 case 107/*null.KEYWORD_TOKEN*/: 5164 case 107/*null.KEYWORD_TOKEN*/:
5544 5165
5545 { 5166 {
5546 switch (token.get$value()) { 5167 switch (token.get$value()) {
5547 case const$128/*Keyword.TRUE*/: 5168 case const$177/*Keyword.TRUE*/:
5548 case const$130/*Keyword.FALSE*/: 5169 case const$149/*Keyword.FALSE*/:
5549 5170
5550 return this.parseLiteralBool(token); 5171 return this.parseLiteralBool(token);
5551 5172
5552 default: 5173 default:
5553 5174
5554 this.listener.unexpected(token); 5175 this.listener.unexpected(token);
5555 $throw("not yet implemented"); 5176 $throw("not yet implemented");
5556 5177
5557 } 5178 }
5558 } 5179 }
(...skipping 27 matching lines...) Expand all
5586 return token.next; 5207 return token.next;
5587 } 5208 }
5588 BodyParser.prototype.parseSend = function(token) { 5209 BodyParser.prototype.parseSend = function(token) {
5589 this.listener.beginSend(token); 5210 this.listener.beginSend(token);
5590 token = this.parseIdentifier(token); 5211 token = this.parseIdentifier(token);
5591 token = this.parseArgumentsOpt(token); 5212 token = this.parseArgumentsOpt(token);
5592 this.listener.endSend(token); 5213 this.listener.endSend(token);
5593 return token; 5214 return token;
5594 } 5215 }
5595 BodyParser.prototype.parseArgumentsOpt = function(token) { 5216 BodyParser.prototype.parseArgumentsOpt = function(token) {
5596 if (this.optional(const$145/*const SourceString("(")*/, token)) { 5217 if (this.optional(const$234/*const SourceString("(")*/, token)) {
5597 this.listener.beginArguments(token); 5218 this.listener.beginArguments(token);
5598 if (this.optional(const$146/*const SourceString(")")*/, token.next)) { 5219 if (this.optional(const$235/*const SourceString(")")*/, token.next)) {
5599 this.listener.endArguments(token.next); 5220 this.listener.endArguments(token.next);
5600 return token.next.next; 5221 return token.next.next;
5601 } 5222 }
5602 do { 5223 do {
5603 token = this.parseExpression(this.next(token)); 5224 token = this.parseExpression(this.next(token));
5604 } 5225 }
5605 while (this.optional(const$143/*const SourceString(",")*/, token)) 5226 while (this.optional(const$230/*const SourceString(",")*/, token))
5606 this.listener.endArguments(token); 5227 this.listener.endArguments(token);
5607 return this.expect(const$146/*const SourceString(")")*/, token); 5228 return this.expect(const$235/*const SourceString(")")*/, token);
5608 } 5229 }
5609 return token; 5230 return token;
5610 } 5231 }
5611 BodyParser.prototype.parseVariablesDeclaration = function(token) { 5232 BodyParser.prototype.parseVariablesDeclaration = function(token) {
5612 this.listener.beginVariablesDeclaration(token); 5233 this.listener.beginVariablesDeclaration(token);
5613 token = this.parseFinalVarOrType(token); 5234 token = this.parseFinalVarOrType(token);
5614 token = this.parseOptionallyInitializedIdentifier(token); 5235 token = this.parseOptionallyInitializedIdentifier(token);
5615 while (this.optional(const$163/*const SourceString(',')*/, token)) { 5236 while (this.optional(const$243/*const SourceString(',')*/, token)) {
5616 token = this.parseOptionallyInitializedIdentifier(this.next(token)); 5237 token = this.parseOptionallyInitializedIdentifier(this.next(token));
5617 } 5238 }
5618 this.listener.endVariablesDeclaration(token); 5239 this.listener.endVariablesDeclaration(token);
5619 return this.expectSemicolon(token); 5240 return this.expectSemicolon(token);
5620 } 5241 }
5621 BodyParser.prototype.parseOptionallyInitializedIdentifier = function(token) { 5242 BodyParser.prototype.parseOptionallyInitializedIdentifier = function(token) {
5622 this.listener.beginInitializedIdentifier(token); 5243 this.listener.beginInitializedIdentifier(token);
5623 token = this.parseIdentifier(token); 5244 token = this.parseIdentifier(token);
5624 if (this.optional(const$162/*const SourceString('=')*/, token)) { 5245 if (this.optional(const$242/*const SourceString('=')*/, token)) {
5625 var assignment = token; 5246 var assignment = token;
5626 this.listener.beginInitializer(token); 5247 this.listener.beginInitializer(token);
5627 token = this.parseExpression(this.next(token)); 5248 token = this.parseExpression(this.next(token));
5628 this.listener.endInitializer(assignment); 5249 this.listener.endInitializer(assignment);
5629 } 5250 }
5630 this.listener.endInitializedIdentifier(); 5251 this.listener.endInitializedIdentifier();
5631 return token; 5252 return token;
5632 } 5253 }
5633 BodyParser.prototype.parseFinalVarOrType = function(token) { 5254 BodyParser.prototype.parseFinalVarOrType = function(token) {
5634 this.listener.handleVarKeyword(token); 5255 this.listener.handleVarKeyword(token);
5635 return this.expect(const$160/*Keyword.VAR*/, token); 5256 return this.expect(const$181/*Keyword.VAR*/, token);
5636 } 5257 }
5637 BodyParser.prototype.parseIfStatement = function(token) { 5258 BodyParser.prototype.parseIfStatement = function(token) {
5638 this.listener.beginIfStatement(token); 5259 this.listener.beginIfStatement(token);
5639 token = this.expect(const$164/*Keyword.IF*/, token); 5260 token = this.expect(const$157/*Keyword.IF*/, token);
5640 token = this.expect(const$166/*const SourceString('(')*/, token); 5261 token = this.expect(const$244/*const SourceString('(')*/, token);
5641 token = this.parseExpression(token); 5262 token = this.parseExpression(token);
5642 token = this.expect(const$167/*const SourceString(')')*/, token); 5263 token = this.expect(const$245/*const SourceString(')')*/, token);
5643 token = this.parseStatement(token); 5264 token = this.parseStatement(token);
5644 if (this.optional(const$168/*Keyword.ELSE*/, token)) { 5265 if (this.optional(const$147/*Keyword.ELSE*/, token)) {
5645 token = this.parseStatement(token.next); 5266 token = this.parseStatement(token.next);
5646 } 5267 }
5647 return token; 5268 return token;
5648 } 5269 }
5649 BodyParser.prototype.parseBlock = function(token) { 5270 BodyParser.prototype.parseBlock = function(token) {
5650 token = this.expect(const$150/*const SourceString('{')*/, token); 5271 token = this.expect(const$240/*const SourceString('{')*/, token);
5651 while (!this.optional(const$149/*const SourceString("}")*/, token)) { 5272 while (!this.optional(const$239/*const SourceString("}")*/, token)) {
5652 token = this.parseStatement(token); 5273 token = this.parseStatement(token);
5653 } 5274 }
5654 return this.expect(const$149/*const SourceString("}")*/, token); 5275 return this.expect(const$239/*const SourceString("}")*/, token);
5655 } 5276 }
5656 // ********** Code for Listener ************** 5277 // ********** Code for Listener **************
5657 function Listener(canceler) { 5278 function Listener(canceler) {
5658 this.classCount = 0 5279 this.classCount = 0
5659 this.aliasCount = 0 5280 this.aliasCount = 0
5660 this.interfaceCount = 0 5281 this.interfaceCount = 0
5661 this.libraryTagCount = 0 5282 this.libraryTagCount = 0
5662 this.topLevelMemberCount = 0 5283 this.topLevelMemberCount = 0
5663 this.previousIdentifier = null 5284 this.previousIdentifier = null
5664 this.canceler = canceler; 5285 this.canceler = canceler;
5665 this.builders = const$135/*const EmptyLink<Expression>()*/; 5286 this.builders = const$227/*const EmptyLink<DeclarationBuilder>()*/;
5666 this.topLevelElements = const$135/*const EmptyLink<Expression>()*/; 5287 this.topLevelElements = const$227/*const EmptyLink<DeclarationBuilder>()*/;
5667 // Initializers done 5288 // Initializers done
5668 } 5289 }
5669 Listener.prototype.beginLibraryTag = function(token) { 5290 Listener.prototype.beginLibraryTag = function(token) {
5670 this.libraryTagCount++; 5291 this.libraryTagCount++;
5671 } 5292 }
5672 Listener.prototype.beginClass = function(token) { 5293 Listener.prototype.beginClass = function(token) {
5673 this.classCount++; 5294 this.classCount++;
5674 this.push(token, this.get$buildClassElement()); 5295 this.push(token, this.get$buildClassElement());
5675 } 5296 }
5676 Listener.prototype.buildClassElement = function(declaration) { 5297 Listener.prototype.buildClassElement = function(declaration) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
5809 FunctionContext.prototype.set$returnType = function(value) { return this.returnT ype = value; }; 5430 FunctionContext.prototype.set$returnType = function(value) { return this.returnT ype = value; };
5810 FunctionContext.prototype.push = function(statement) { 5431 FunctionContext.prototype.push = function(statement) {
5811 this.statements.addLast(statement); 5432 this.statements.addLast(statement);
5812 } 5433 }
5813 FunctionContext.prototype.buildFunction = function(endToken) { 5434 FunctionContext.prototype.buildFunction = function(endToken) {
5814 var statements0 = new NodeList(this.beginBlockToken, this.statements.toLink(), endToken); 5435 var statements0 = new NodeList(this.beginBlockToken, this.statements.toLink(), endToken);
5815 var block = new Block(statements0); 5436 var block = new Block(statements0);
5816 return new FunctionExpression(this.name.get$head(), this.formals, block, new T ypeAnnotation(this.returnType.get$head())); 5437 return new FunctionExpression(this.name.get$head(), this.formals, block, new T ypeAnnotation(this.returnType.get$head()));
5817 } 5438 }
5818 FunctionContext.prototype.buildFormals = function(endToken) { 5439 FunctionContext.prototype.buildFormals = function(endToken) {
5819 this.formals = new NodeList(this.beginFormalsToken, const$135/*const EmptyLink <Expression>()*/, endToken, const$143); 5440 this.formals = new NodeList(this.beginFormalsToken, const$227/*const EmptyLink <DeclarationBuilder>()*/, endToken, const$230);
5820 } 5441 }
5821 // ********** Code for ExpressionContext ************** 5442 // ********** Code for ExpressionContext **************
5822 function ExpressionContext(previous) { 5443 function ExpressionContext(previous) {
5823 this.previous = previous; 5444 this.previous = previous;
5824 this.expressions = const$135/*const EmptyLink<Expression>()*/; 5445 this.expressions = const$227/*const EmptyLink<DeclarationBuilder>()*/;
5825 // Initializers done 5446 // Initializers done
5826 } 5447 }
5827 ExpressionContext.prototype.push = function(expression) { 5448 ExpressionContext.prototype.push = function(expression) {
5828 this.expressions = this.expressions.prepend(expression); 5449 this.expressions = this.expressions.prepend(expression);
5829 } 5450 }
5830 ExpressionContext.prototype.pop = function() { 5451 ExpressionContext.prototype.pop = function() {
5831 var head = this.expressions.get$head(); 5452 var head = this.expressions.get$head();
5832 this.expressions = this.expressions.get$tail(); 5453 this.expressions = this.expressions.get$tail();
5833 return head; 5454 return head;
5834 } 5455 }
5835 ExpressionContext.prototype.popAll = function() { 5456 ExpressionContext.prototype.popAll = function() {
5836 var result = this.expressions; 5457 var result = this.expressions;
5837 this.expressions = const$135/*const EmptyLink<Expression>()*/; 5458 this.expressions = const$227/*const EmptyLink<DeclarationBuilder>()*/;
5838 return result; 5459 return result;
5839 } 5460 }
5840 // ********** Code for BodyListener ************** 5461 // ********** Code for BodyListener **************
5841 function BodyListener(canceler0, logger) { 5462 function BodyListener(canceler0, logger) {
5842 this.logger = logger; 5463 this.logger = logger;
5843 this.expressionContext = new ExpressionContext(null); 5464 this.expressionContext = new ExpressionContext(null);
5844 Listener.call(this, canceler0); 5465 Listener.call(this, canceler0);
5845 // Initializers done 5466 // Initializers done
5846 } 5467 }
5847 $inherits(BodyListener, Listener); 5468 $inherits(BodyListener, Listener);
5848 BodyListener.prototype.beginFormalParameters = function(token) { 5469 BodyListener.prototype.beginFormalParameters = function(token) {
5849 this.functionContext.beginFormalsToken = token; 5470 this.functionContext.beginFormalsToken = token;
5850 } 5471 }
5851 BodyListener.prototype.endFormalParameters = function(token) { 5472 BodyListener.prototype.endFormalParameters = function(token) {
5852 this.functionContext.buildFormals(token); 5473 this.functionContext.buildFormals(token);
5853 } 5474 }
5854 BodyListener.prototype.beginArguments = function(token) { 5475 BodyListener.prototype.beginArguments = function(token) {
5855 this.pushExpressionContext(token); 5476 this.pushExpressionContext(token);
5856 } 5477 }
5857 BodyListener.prototype.endArguments = function(token) { 5478 BodyListener.prototype.endArguments = function(token) {
5858 var nodes = new NodeList(this.expressionContext.beginToken, this.popAllExpress ions().reverse(), token, const$143); 5479 var nodes = new NodeList(this.expressionContext.beginToken, this.popAllExpress ions().reverse(), token, const$230);
5859 this.popExpressionContext(); 5480 this.popExpressionContext();
5860 this.expressionContext.nodes = nodes; 5481 this.expressionContext.nodes = nodes;
5861 } 5482 }
5862 BodyListener.prototype.beginReturnStatement = function(token) { 5483 BodyListener.prototype.beginReturnStatement = function(token) {
5863 5484
5864 } 5485 }
5865 BodyListener.prototype.endReturnStatement = function(token) { 5486 BodyListener.prototype.endReturnStatement = function(token) {
5866 var expressions = this.popAllExpressions(); 5487 var expressions = this.popAllExpressions();
5867 this.pushStatement(new Return(token, expressions.get$head())); 5488 this.pushStatement(new Return(token, expressions.get$head()));
5868 } 5489 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
6057 } 5678 }
6058 Keyword.prototype.is$SourceString = function(){return this;}; 5679 Keyword.prototype.is$SourceString = function(){return this;};
6059 Keyword.get$keywords = function() { 5680 Keyword.get$keywords = function() {
6060 if (Keyword._keywords == null) { 5681 if (Keyword._keywords == null) {
6061 Keyword._keywords = Keyword.computeKeywordMap(); 5682 Keyword._keywords = Keyword.computeKeywordMap();
6062 } 5683 }
6063 return Keyword._keywords; 5684 return Keyword._keywords;
6064 } 5685 }
6065 Keyword.computeKeywordMap = function() { 5686 Keyword.computeKeywordMap = function() {
6066 var result = new LinkedHashMapImplementation$String$Keyword(); 5687 var result = new LinkedHashMapImplementation$String$Keyword();
6067 for (var $i0 = const$377/*Keyword.values*/.iterator(); $i0.hasNext(); ) { 5688 for (var $i0 = const$222/*Keyword.values*/.iterator(); $i0.hasNext(); ) {
6068 var keyword = $i0.next(); 5689 var keyword = $i0.next();
6069 result.$setindex(keyword.syntax, keyword); 5690 result.$setindex(keyword.syntax, keyword);
6070 } 5691 }
6071 return result; 5692 return result;
6072 } 5693 }
6073 Keyword.prototype.hashCode = function() { 5694 Keyword.prototype.hashCode = function() {
6074 return this.syntax.hashCode(); 5695 return this.syntax.hashCode();
6075 } 5696 }
6076 Keyword.prototype.$eq = function(other) { 5697 Keyword.prototype.$eq = function(other) {
6077 return !!(other && other.is$SourceString) && this.toString() == other.toString (); 5698 return !!(other && other.is$SourceString) && this.toString() == other.toString ();
6078 } 5699 }
6079 Keyword.prototype.printOn = function(sb) { 5700 Keyword.prototype.printOn = function(sb) {
6080 sb.add(this.syntax); 5701 sb.add(this.syntax);
6081 } 5702 }
6082 Keyword.prototype.toString = function() { 5703 Keyword.prototype.toString = function() {
6083 return this.syntax; 5704 return this.syntax;
6084 } 5705 }
6085 Keyword.prototype.printOn$1 = Keyword.prototype.printOn; 5706 Keyword.prototype.printOn$1 = Keyword.prototype.printOn;
6086 // ********** Code for KeywordState ************** 5707 // ********** Code for KeywordState **************
6087 function KeywordState() {} 5708 function KeywordState() {}
6088 KeywordState.get$KEYWORD_STATE = function() { 5709 KeywordState.get$KEYWORD_STATE = function() {
6089 if (KeywordState._KEYWORD_STATE == null) { 5710 if (KeywordState._KEYWORD_STATE == null) {
6090 var strings = new ListFactory$String(const$377/*Keyword.values*/.get$length( )); 5711 var strings = new ListFactory$String(const$222/*Keyword.values*/.get$length( ));
6091 for (var i = 0; 5712 for (var i = 0;
6092 i < const$377/*Keyword.values*/.get$length(); i++) { 5713 i < const$222/*Keyword.values*/.get$length(); i++) {
6093 strings.$setindex(i, const$377/*Keyword.values*/[i].syntax); 5714 strings.$setindex(i, const$222/*Keyword.values*/[i].syntax);
6094 } 5715 }
6095 strings.sort((function (a, b) { 5716 strings.sort((function (a, b) {
6096 return a.compareTo(b); 5717 return a.compareTo(b);
6097 }) 5718 })
6098 ); 5719 );
6099 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin gs, 0, strings.length); 5720 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin gs, 0, strings.length);
6100 } 5721 }
6101 return KeywordState._KEYWORD_STATE; 5722 return KeywordState._KEYWORD_STATE;
6102 } 5723 }
6103 KeywordState.computeKeywordStateTable = function(start, strings, offset, length) { 5724 KeywordState.computeKeywordStateTable = function(start, strings, offset, length) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
6207 return firstBeginToken(this.receiver, this.selector); 5828 return firstBeginToken(this.receiver, this.selector);
6208 } 5829 }
6209 Send.prototype.getEndToken = function() { 5830 Send.prototype.getEndToken = function() {
6210 var token = this.argumentsNode.getEndToken(); 5831 var token = this.argumentsNode.getEndToken();
6211 if (token != null) return token; 5832 if (token != null) return token;
6212 if (this.selector != null) { 5833 if (this.selector != null) {
6213 return this.selector.getEndToken(); 5834 return this.selector.getEndToken();
6214 } 5835 }
6215 return this.receiver.getBeginToken(); 5836 return this.receiver.getBeginToken();
6216 } 5837 }
6217 // ********** Code for NewExpression **************
6218 function NewExpression() {}
6219 $inherits(NewExpression, Expression);
6220 NewExpression.prototype.getBeginToken = function() {
6221 return this.newToken;
6222 }
6223 NewExpression.prototype.getEndToken = function() {
6224 return this.send.getEndToken();
6225 }
6226 // ********** Code for NodeList ************** 5838 // ********** Code for NodeList **************
6227 function NodeList(beginToken, nodes, endToken, delimiter) { 5839 function NodeList(beginToken, nodes, endToken, delimiter) {
6228 this.beginToken = beginToken; 5840 this.beginToken = beginToken;
6229 this.nodes = nodes; 5841 this.nodes = nodes;
6230 this.endToken = endToken; 5842 this.endToken = endToken;
6231 this.delimiter = delimiter; 5843 this.delimiter = delimiter;
6232 // Initializers done 5844 // Initializers done
6233 } 5845 }
6234 NodeList.singleton$ctor = function(node) { 5846 NodeList.singleton$ctor = function(node) {
6235 NodeList.call(this, null, LinkFactory.Link$factory(node)); 5847 NodeList.call(this, null, LinkFactory.Link$factory(node));
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
6391 return visitor.visitLiteralDouble(this); 6003 return visitor.visitLiteralDouble(this);
6392 } 6004 }
6393 // ********** Code for LiteralBool ************** 6005 // ********** Code for LiteralBool **************
6394 function LiteralBool(token0, handler0) { 6006 function LiteralBool(token0, handler0) {
6395 Literal$bool.call(this, token0, handler0); 6007 Literal$bool.call(this, token0, handler0);
6396 // Initializers done 6008 // Initializers done
6397 } 6009 }
6398 $inherits(LiteralBool, Literal$bool); 6010 $inherits(LiteralBool, Literal$bool);
6399 LiteralBool.prototype.get$value = function() { 6011 LiteralBool.prototype.get$value = function() {
6400 switch (this.token.get$value()) { 6012 switch (this.token.get$value()) {
6401 case const$128/*Keyword.TRUE*/: 6013 case const$177/*Keyword.TRUE*/:
6402 6014
6403 return true; 6015 return true;
6404 6016
6405 case const$130/*Keyword.FALSE*/: 6017 case const$149/*Keyword.FALSE*/:
6406 6018
6407 return false; 6019 return false;
6408 6020
6409 default: 6021 default:
6410 6022
6411 (this.handler)(this.token, ("not a bool " + this.token.get$value() + "")); 6023 (this.handler)(this.token, ("not a bool " + this.token.get$value() + ""));
6412 6024
6413 } 6025 }
6414 } 6026 }
6415 LiteralBool.prototype.accept = function(visitor) { 6027 LiteralBool.prototype.accept = function(visitor) {
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
6888 this.visit(argument); 6500 this.visit(argument);
6889 } 6501 }
6890 else { 6502 else {
6891 this.buffer.add(this.temporary(argument)); 6503 this.buffer.add(this.temporary(argument));
6892 } 6504 }
6893 } 6505 }
6894 SsaCodeGenerator.prototype.visit = function(node) { 6506 SsaCodeGenerator.prototype.visit = function(node) {
6895 return node.accept(this); 6507 return node.accept(this);
6896 } 6508 }
6897 SsaCodeGenerator.prototype.visitAdd = function(node) { 6509 SsaCodeGenerator.prototype.visitAdd = function(node) {
6898 this.invoke(const$134/*const SourceString('\$add')*/, node.inputs); 6510 this.invoke(const$256/*const SourceString('\$add')*/, node.inputs);
6899 } 6511 }
6900 SsaCodeGenerator.prototype.visitBasicBlock = function(node) { 6512 SsaCodeGenerator.prototype.visitBasicBlock = function(node) {
6901 var instruction = node.first; 6513 var instruction = node.first;
6902 while (instruction != null) { 6514 while (instruction != null) {
6903 if (!instruction.canBeSkipped()) { 6515 if (!instruction.canBeSkipped()) {
6904 this.buffer.add(' '); 6516 this.buffer.add(' ');
6905 if (!instruction.get$usedBy().isEmpty()) { 6517 if (!instruction.get$usedBy().isEmpty()) {
6906 this.define(instruction); 6518 this.define(instruction);
6907 } 6519 }
6908 else { 6520 else {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
7033 return this.visitInstruction(node); 6645 return this.visitInstruction(node);
7034 } 6646 }
7035 HBaseVisitor.prototype.visitReturn = function(node) { 6647 HBaseVisitor.prototype.visitReturn = function(node) {
7036 return this.visitInstruction(node); 6648 return this.visitInstruction(node);
7037 } 6649 }
7038 // ********** Code for HBasicBlock ************** 6650 // ********** Code for HBasicBlock **************
7039 function HBasicBlock() { 6651 function HBasicBlock() {
7040 this.first = null 6652 this.first = null
7041 this.last = null 6653 this.last = null
7042 this.predecessors = []; 6654 this.predecessors = [];
7043 this.successors = const$14/*const <HInstruction>[]*/; 6655 this.successors = const$226/*const []*/;
7044 // Initializers done 6656 // Initializers done
7045 } 6657 }
7046 HBasicBlock.prototype.number = function(basicBlockId, id0) { 6658 HBasicBlock.prototype.number = function(basicBlockId, id0) {
7047 this.id = basicBlockId; 6659 this.id = basicBlockId;
7048 var instruction = this.first; 6660 var instruction = this.first;
7049 while (instruction != null) { 6661 while (instruction != null) {
7050 instruction.id = id0++; 6662 instruction.id = id0++;
7051 instruction = instruction.next; 6663 instruction = instruction.next;
7052 } 6664 }
7053 return id0; 6665 return id0;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
7126 HInstruction.prototype.canBeGeneratedAtUseSite = function() { 6738 HInstruction.prototype.canBeGeneratedAtUseSite = function() {
7127 return this._canBeGeneratedAtUseSite; 6739 return this._canBeGeneratedAtUseSite;
7128 } 6740 }
7129 HInstruction.prototype.setCanBeGeneratedAtUseSite = function() { 6741 HInstruction.prototype.setCanBeGeneratedAtUseSite = function() {
7130 this._canBeGeneratedAtUseSite = true; 6742 this._canBeGeneratedAtUseSite = true;
7131 } 6743 }
7132 HInstruction.prototype.canBeSkipped = function() { 6744 HInstruction.prototype.canBeSkipped = function() {
7133 return this.canBeGeneratedAtUseSite(); 6745 return this.canBeGeneratedAtUseSite();
7134 } 6746 }
7135 HInstruction.prototype.get$usedBy = function() { 6747 HInstruction.prototype.get$usedBy = function() {
7136 if (this._usedBy == null) return const$14/*const <HInstruction>[]*/; 6748 if (this._usedBy == null) return const$226/*const []*/;
7137 return this._usedBy; 6749 return this._usedBy;
7138 } 6750 }
7139 HInstruction.prototype.isInBasicBlock = function() { 6751 HInstruction.prototype.isInBasicBlock = function() {
7140 return this._usedBy != null; 6752 return this._usedBy != null;
7141 } 6753 }
7142 HInstruction.prototype.$eq = function(other) { 6754 HInstruction.prototype.$eq = function(other) {
7143 return false; 6755 return false;
7144 } 6756 }
7145 HInstruction.prototype.hashCode = function() { 6757 HInstruction.prototype.hashCode = function() {
7146 return 0; 6758 return 0;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
7183 return ('invoke: ' + this.selector + ''); 6795 return ('invoke: ' + this.selector + '');
7184 } 6796 }
7185 HInvoke.prototype.hasSideEffects = function() { 6797 HInvoke.prototype.hasSideEffects = function() {
7186 return true; 6798 return true;
7187 } 6799 }
7188 HInvoke.prototype.accept = function(visitor) { 6800 HInvoke.prototype.accept = function(visitor) {
7189 return visitor.visitInvoke(this); 6801 return visitor.visitInvoke(this);
7190 } 6802 }
7191 // ********** Code for HAdd ************** 6803 // ********** Code for HAdd **************
7192 function HAdd(inputs0) { 6804 function HAdd(inputs0) {
7193 HInvoke.call(this, const$170/*const SourceString('+')*/, inputs0); 6805 HInvoke.call(this, const$251/*const SourceString('+')*/, inputs0);
7194 // Initializers done 6806 // Initializers done
7195 } 6807 }
7196 $inherits(HAdd, HInvoke); 6808 $inherits(HAdd, HInvoke);
7197 HAdd.prototype.hasSideEffects = function() { 6809 HAdd.prototype.hasSideEffects = function() {
7198 return !(this.inputs.$index(0) instanceof HLiteral); 6810 return !(this.inputs.$index(0) instanceof HLiteral);
7199 } 6811 }
7200 HAdd.prototype.accept = function(visitor) { 6812 HAdd.prototype.accept = function(visitor) {
7201 return visitor.visitAdd(this); 6813 return visitor.visitAdd(this);
7202 } 6814 }
7203 // ********** Code for HExit ************** 6815 // ********** Code for HExit **************
7204 function HExit() { 6816 function HExit() {
7205 HInstruction.call(this, const$14/*const <HInstruction>[]*/); 6817 HInstruction.call(this, const$226/*const []*/);
7206 // Initializers done 6818 // Initializers done
7207 } 6819 }
7208 $inherits(HExit, HInstruction); 6820 $inherits(HExit, HInstruction);
7209 HExit.prototype.canBeSkipped = function() { 6821 HExit.prototype.canBeSkipped = function() {
7210 return true; 6822 return true;
7211 } 6823 }
7212 HExit.prototype.toString = function() { 6824 HExit.prototype.toString = function() {
7213 return 'exit'; 6825 return 'exit';
7214 } 6826 }
7215 HExit.prototype.hasSideEffects = function() { 6827 HExit.prototype.hasSideEffects = function() {
7216 return true; 6828 return true;
7217 } 6829 }
7218 HExit.prototype.accept = function(visitor) { 6830 HExit.prototype.accept = function(visitor) {
7219 return visitor.visitExit(this); 6831 return visitor.visitExit(this);
7220 } 6832 }
7221 // ********** Code for HGoto ************** 6833 // ********** Code for HGoto **************
7222 function HGoto() { 6834 function HGoto() {
7223 HInstruction.call(this, const$14/*const <HInstruction>[]*/); 6835 HInstruction.call(this, const$226/*const []*/);
7224 // Initializers done 6836 // Initializers done
7225 } 6837 }
7226 $inherits(HGoto, HInstruction); 6838 $inherits(HGoto, HInstruction);
7227 HGoto.prototype.canBeSkipped = function() { 6839 HGoto.prototype.canBeSkipped = function() {
7228 return true; 6840 return true;
7229 } 6841 }
7230 HGoto.prototype.toString = function() { 6842 HGoto.prototype.toString = function() {
7231 return 'goto'; 6843 return 'goto';
7232 } 6844 }
7233 HGoto.prototype.hasSideEffects = function() { 6845 HGoto.prototype.hasSideEffects = function() {
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
7682 return new SourceSpan(this.script.file, startOffset, endOffset); 7294 return new SourceSpan(this.script.file, startOffset, endOffset);
7683 } 7295 }
7684 WorldCompiler.prototype.reportWarning = function(node, message) { 7296 WorldCompiler.prototype.reportWarning = function(node, message) {
7685 this.world.warning(('' + message + '.'), this.spanFromNode(node)); 7297 this.world.warning(('' + message + '.'), this.spanFromNode(node));
7686 } 7298 }
7687 // ********** Code for Compiler ************** 7299 // ********** Code for Compiler **************
7688 function Compiler(script) { 7300 function Compiler(script) {
7689 this.script = script; 7301 this.script = script;
7690 // Initializers done 7302 // Initializers done
7691 this.universe = new Universe(); 7303 this.universe = new Universe();
7692 this.worklist = DoubleLinkedQueue.DoubleLinkedQueue$from$factory([const$182/*C ompiler.MAIN*/]); 7304 this.worklist = DoubleLinkedQueue.DoubleLinkedQueue$from$factory([const$2/*Com piler.MAIN*/]);
7693 this.scanner = new ScannerTask(this); 7305 this.scanner = new ScannerTask(this);
7694 this.resolver = new ResolverTask(this); 7306 this.resolver = new ResolverTask(this);
7695 this.checker = new TypeCheckerTask(this); 7307 this.checker = new TypeCheckerTask(this);
7696 this.builder = new SsaBuilderTask(this); 7308 this.builder = new SsaBuilderTask(this);
7697 this.optimizer = new SsaOptimizerTask(this); 7309 this.optimizer = new SsaOptimizerTask(this);
7698 this.generator = new SsaCodeGeneratorTask(this); 7310 this.generator = new SsaCodeGeneratorTask(this);
7699 this.tasks = [this.scanner, this.resolver, this.checker, this.builder, this.op timizer, this.generator]; 7311 this.tasks = [this.scanner, this.resolver, this.checker, this.builder, this.op timizer, this.generator];
7700 } 7312 }
7701 Compiler.prototype.cancel = function(reason) { 7313 Compiler.prototype.cancel = function(reason) {
7702 $throw(new CompilerCancelledException(reason)); 7314 $throw(new CompilerCancelledException(reason));
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
7843 ResolverVisitor.prototype.visitIdentifier = function(node) { 7455 ResolverVisitor.prototype.visitIdentifier = function(node) {
7844 var element = this.context.lookup(node.get$source()); 7456 var element = this.context.lookup(node.get$source());
7845 if (element == null) this.fail(node); 7457 if (element == null) this.fail(node);
7846 return element; 7458 return element;
7847 } 7459 }
7848 ResolverVisitor.prototype.visitSend = function(node) { 7460 ResolverVisitor.prototype.visitSend = function(node) {
7849 var selector = node.selector; 7461 var selector = node.selector;
7850 var target = this.compiler.universe.find(selector.get$source()); 7462 var target = this.compiler.universe.find(selector.get$source());
7851 if (target == null) { 7463 if (target == null) {
7852 var name = selector.get$source(); 7464 var name = selector.get$source();
7853 if ($eq(name, const$172/*const SourceString('print')*/) || $eq(name, const$1 70/*const SourceString('+')*/) || $eq(name, const$173/*const SourceString('*')*/ )) { 7465 if ($eq(name, const$250/*const SourceString('print')*/) || $eq(name, const$2 51/*const SourceString('+')*/) || $eq(name, const$252/*const SourceString('*')*/ )) {
7854 } 7466 }
7855 else { 7467 else {
7856 this.fail(node); 7468 this.fail(node);
7857 } 7469 }
7858 } 7470 }
7859 else { 7471 else {
7860 this.compiler.worklist.add(selector.get$source()); 7472 this.compiler.worklist.add(selector.get$source());
7861 } 7473 }
7862 this.visit(node.argumentsNode); 7474 this.visit(node.argumentsNode);
7863 return target; 7475 return target;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
7899 } 7511 }
7900 // ********** Code for VariableDefinitionsVisitor ************** 7512 // ********** Code for VariableDefinitionsVisitor **************
7901 function VariableDefinitionsVisitor(definitions, resolver) { 7513 function VariableDefinitionsVisitor(definitions, resolver) {
7902 this.definitions = definitions; 7514 this.definitions = definitions;
7903 this.resolver = resolver; 7515 this.resolver = resolver;
7904 // Initializers done 7516 // Initializers done
7905 } 7517 }
7906 VariableDefinitionsVisitor.prototype.visitSend = function(node) { 7518 VariableDefinitionsVisitor.prototype.visitSend = function(node) {
7907 var selector = node.selector; 7519 var selector = node.selector;
7908 var name = selector.get$source(); 7520 var name = selector.get$source();
7909 if ($ne(name, const$162/*const SourceString('=')*/)) this.resolver.fail(node); 7521 if ($ne(name, const$242/*const SourceString('=')*/)) this.resolver.fail(node);
7910 this.resolver.visit(node.get$arguments().get$head()); 7522 this.resolver.visit(node.get$arguments().get$head());
7911 this.visit(node.receiver); 7523 this.visit(node.receiver);
7912 } 7524 }
7913 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { 7525 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) {
7914 var variableElement = new Element(node.get$source(), this.resolver.context.ele ment); 7526 var variableElement = new Element(node.get$source(), this.resolver.context.ele ment);
7915 this.resolver.context.elements.$setindex(node.token.get$value(), variableEleme nt); 7527 this.resolver.context.elements.$setindex(node.token.get$value(), variableEleme nt);
7916 } 7528 }
7917 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { 7529 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) {
7918 for (var link = node.nodes; 7530 for (var link = node.nodes;
7919 !link.isEmpty(); link = link.get$tail()) { 7531 !link.isEmpty(); link = link.get$tail()) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
8026 !link.isEmpty(); link = link.get$tail()) { 7638 !link.isEmpty(); link = link.get$tail()) {
8027 if (!first) sb.add(', '); 7639 if (!first) sb.add(', ');
8028 first = false; 7640 first = false;
8029 sb.add(link.get$head()); 7641 sb.add(link.get$head());
8030 } 7642 }
8031 sb.add((') -> ' + this.returnType + '')); 7643 sb.add((') -> ' + this.returnType + ''));
8032 return sb.toString(); 7644 return sb.toString();
8033 } 7645 }
8034 // ********** Code for Types ************** 7646 // ********** Code for Types **************
8035 function Types() { 7647 function Types() {
8036 this.VOID = new SimpleType(const$171, new Element(const$171/*const SourceStrin g('void')*/)); 7648 this.VOID = new SimpleType(const$246, new Element(const$246/*const SourceStrin g('void')*/));
8037 this.INT = new SimpleType(const$175, new Element(const$175/*const SourceString ('int')*/)); 7649 this.INT = new SimpleType(const$247, new Element(const$247/*const SourceString ('int')*/));
8038 this.DYNAMIC = new SimpleType(const$176, new Element(const$176/*const SourceSt ring('Dynamic')*/)); 7650 this.DYNAMIC = new SimpleType(const$248, new Element(const$248/*const SourceSt ring('Dynamic')*/));
8039 this.STRING = new SimpleType(const$177, new Element(const$177/*const SourceStr ing('String')*/)); 7651 this.STRING = new SimpleType(const$249, new Element(const$249/*const SourceStr ing('String')*/));
8040 // Initializers done 7652 // Initializers done
8041 } 7653 }
8042 Types.prototype.isSubtype = function(r, s) { 7654 Types.prototype.isSubtype = function(r, s) {
8043 return r === s || r === this.DYNAMIC || s === this.DYNAMIC; 7655 return r === s || r === this.DYNAMIC || s === this.DYNAMIC;
8044 } 7656 }
8045 Types.prototype.isAssignable = function(r, s) { 7657 Types.prototype.isAssignable = function(r, s) {
8046 return this.isSubtype(r, s) || this.isSubtype(s, r); 7658 return this.isSubtype(r, s) || this.isSubtype(s, r);
8047 } 7659 }
8048 // ********** Code for TypeCheckerVisitor ************** 7660 // ********** Code for TypeCheckerVisitor **************
8049 function TypeCheckerVisitor(compiler, elements, types) { 7661 function TypeCheckerVisitor(compiler, elements, types) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
8098 this.compiler.reportWarning(node, 'missing argument'); 7710 this.compiler.reportWarning(node, 'missing argument');
8099 } 7711 }
8100 if (!arguments.isEmpty()) { 7712 if (!arguments.isEmpty()) {
8101 this.compiler.reportWarning(node, 'additional arguments'); 7713 this.compiler.reportWarning(node, 'additional arguments');
8102 } 7714 }
8103 return funType.returnType; 7715 return funType.returnType;
8104 } 7716 }
8105 else { 7717 else {
8106 var selector = node.selector; 7718 var selector = node.selector;
8107 var name = selector.get$source(); 7719 var name = selector.get$source();
8108 if ($eq(name, const$172/*const SourceString('print')*/) || $eq(name, const$1 70/*const SourceString('+')*/)) { 7720 if ($eq(name, const$250/*const SourceString('print')*/) || $eq(name, const$2 51/*const SourceString('+')*/)) {
8109 return this.types.DYNAMIC; 7721 return this.types.DYNAMIC;
8110 } 7722 }
8111 this.compiler.cancel(('unresolved send ' + name + '.')); 7723 this.compiler.cancel(('unresolved send ' + name + '.'));
8112 } 7724 }
8113 } 7725 }
8114 TypeCheckerVisitor.prototype.visitLiteralInt = function(node) { 7726 TypeCheckerVisitor.prototype.visitLiteralInt = function(node) {
8115 return this.types.INT; 7727 return this.types.INT;
8116 } 7728 }
8117 TypeCheckerVisitor.prototype.visitLiteralDouble = function(node) { 7729 TypeCheckerVisitor.prototype.visitLiteralDouble = function(node) {
8118 return this.types.DYNAMIC; 7730 return this.types.DYNAMIC;
(...skipping 18 matching lines...) Expand all
8137 } 7749 }
8138 TypeCheckerVisitor.prototype.visitReturn = function(node) { 7750 TypeCheckerVisitor.prototype.visitReturn = function(node) {
8139 var expressionType = this.visit(node.expression); 7751 var expressionType = this.visit(node.expression);
8140 if (!this.types.isAssignable(this.expectedReturnType, expressionType)) { 7752 if (!this.types.isAssignable(this.expectedReturnType, expressionType)) {
8141 var error = CompilerError.NOT_ASSIGNABLE(this.expectedReturnType, expression Type); 7753 var error = CompilerError.NOT_ASSIGNABLE(this.expectedReturnType, expression Type);
8142 this.compiler.reportWarning(node, error); 7754 this.compiler.reportWarning(node, error);
8143 } 7755 }
8144 return this.types.VOID; 7756 return this.types.VOID;
8145 } 7757 }
8146 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) { 7758 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) {
8147 if (node.typeName != null && $ne(node.typeName.get$source(), const$171/*const SourceString('void')*/)) { 7759 if (node.typeName != null && $ne(node.typeName.get$source(), const$246/*const SourceString('void')*/)) {
8148 this.compiler.cancel(('unsupported type ' + node.typeName + '')); 7760 this.compiler.cancel(('unsupported type ' + node.typeName + ''));
8149 } 7761 }
8150 return this.types.VOID; 7762 return this.types.VOID;
8151 } 7763 }
8152 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) { 7764 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) {
8153 return this.types.VOID; 7765 return this.types.VOID;
8154 } 7766 }
8155 // ********** Code for Universe ************** 7767 // ********** Code for Universe **************
8156 function Universe() { 7768 function Universe() {
8157 this.elements = $map([]); 7769 this.elements = $map([]);
8158 this.generatedCode = $map([]); 7770 this.generatedCode = $map([]);
8159 this.scope = new Element(const$181/*const SourceString('global scope')*/); 7771 this.scope = new Element(const$1/*const SourceString('global scope')*/);
8160 // Initializers done 7772 // Initializers done
8161 } 7773 }
8162 Universe.prototype.find = function(name) { 7774 Universe.prototype.find = function(name) {
8163 return this.elements.$index(name); 7775 return this.elements.$index(name);
8164 } 7776 }
8165 Universe.prototype.define = function(element) { 7777 Universe.prototype.define = function(element) {
8166 this.elements.$setindex(element.name, element); 7778 this.elements.$setindex(element.name, element);
8167 } 7779 }
8168 Universe.prototype.addGeneratedCode = function(element, code) { 7780 Universe.prototype.addGeneratedCode = function(element, code) {
8169 this.generatedCode.$setindex(element, code); 7781 this.generatedCode.$setindex(element, code);
8170 } 7782 }
8171 // ********** Code for top level ************** 7783 // ********** Code for top level **************
8172 function unreachable() { 7784 function unreachable() {
8173 $throw(const$8/*const Exception("Internal Error (Leg): UNREACHABLE")*/); 7785 $throw(const$255/*const Exception("Internal Error (Leg): UNREACHABLE")*/);
8174 } 7786 }
8175 function compile(world) { 7787 function compile(world) {
8176 var file = world.readFile(options.dartScript); 7788 var file = world.readFile(options.dartScript);
8177 var script = new leg_Script(file); 7789 var script = new leg_Script(file);
8178 var compiler = new WorldCompiler(world, script); 7790 var compiler = new WorldCompiler(world, script);
8179 return compiler.run(); 7791 return compiler.run();
8180 } 7792 }
8181 // ********** Library lang ************** 7793 // ********** Library lang **************
8182 // ********** Code for CodeWriter ************** 7794 // ********** Code for CodeWriter **************
8183 function CodeWriter() { 7795 function CodeWriter() {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
8239 } 7851 }
8240 // ********** Code for WorldGenerator ************** 7852 // ********** Code for WorldGenerator **************
8241 function WorldGenerator(main, writer) { 7853 function WorldGenerator(main, writer) {
8242 this.main = main; 7854 this.main = main;
8243 this.writer = writer; 7855 this.writer = writer;
8244 this.globals = $map([]); 7856 this.globals = $map([]);
8245 // Initializers done 7857 // Initializers done
8246 } 7858 }
8247 WorldGenerator.prototype.run = function() { 7859 WorldGenerator.prototype.run = function() {
8248 var metaGen = new MethodGenerator(this.main, null); 7860 var metaGen = new MethodGenerator(this.main, null);
8249 var mainCall = this.main.invoke(metaGen, null, null, Arguments.get$EMPTY(), tr ue); 7861 var mainCall = this.main.invoke(metaGen, null, null, Arguments.get$EMPTY(), fa lse);
8250 this.main.declaringType.markUsed(); 7862 this.main.declaringType.markUsed();
8251 world.corelib.types.$index('BadNumberFormatException').markUsed(); 7863 world.corelib.types.$index('BadNumberFormatException').markUsed();
8252 world.get$coreimpl().types.$index('MatchImplementation').markUsed(); 7864 world.get$coreimpl().types.$index('MatchImplementation').markUsed();
8253 world.get$coreimpl().types.$index('NumImplementation').markUsed(); 7865 world.get$coreimpl().types.$index('NumImplementation').markUsed();
8254 world.get$coreimpl().types.$index('StringImplementation').markUsed(); 7866 world.get$coreimpl().types.$index('StringImplementation').markUsed();
8255 this.writeTypes(world.get$coreimpl()); 7867 this.writeTypes(world.get$coreimpl());
8256 this.writeTypes(world.corelib); 7868 this.writeTypes(world.corelib);
8257 var matchConstructor = world.get$coreimpl().types.$index('MatchImplementation' ).getConstructor(''); 7869 var matchConstructor = world.get$coreimpl().types.$index('MatchImplementation' ).getConstructor('');
8258 this.genMethod(matchConstructor); 7870 this.genMethod(matchConstructor);
8259 matchConstructor.generator.writeDefinition(this.writer, null); 7871 matchConstructor.generator.writeDefinition(this.writer, null);
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
8978 MethodGenerator.prototype.visitBool = function(node) { 8590 MethodGenerator.prototype.visitBool = function(node) {
8979 return this.visitTypedValue(node, world.boolType); 8591 return this.visitTypedValue(node, world.boolType);
8980 } 8592 }
8981 MethodGenerator.prototype.visitValue = function(node) { 8593 MethodGenerator.prototype.visitValue = function(node) {
8982 if (node == null) return null; 8594 if (node == null) return null;
8983 var value = node.visit(this); 8595 var value = node.visit(this);
8984 value.checkFirstClass(node.span); 8596 value.checkFirstClass(node.span);
8985 return value; 8597 return value;
8986 } 8598 }
8987 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) { 8599 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) {
8988 return this.visitValue(node).convertTo(this, expectedType, node, true); 8600 return this.visitValue(node).convertTo(this, expectedType, node, false);
8989 } 8601 }
8990 MethodGenerator.prototype.visitVoid = function(node) { 8602 MethodGenerator.prototype.visitVoid = function(node) {
8991 if ((node instanceof PostfixExpression)) { 8603 if ((node instanceof PostfixExpression)) {
8992 var value = this.visitPostfixExpression(node, true); 8604 var value = this.visitPostfixExpression(node, true);
8993 value.checkFirstClass(node.span); 8605 value.checkFirstClass(node.span);
8994 return value; 8606 return value;
8995 } 8607 }
8996 return this.visitValue(node); 8608 return this.visitValue(node);
8997 } 8609 }
8998 MethodGenerator.prototype.visitDietStatement = function(node) { 8610 MethodGenerator.prototype.visitDietStatement = function(node) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
9165 this._pushBlock(true); 8777 this._pushBlock(true);
9166 var item = this._scope.create(itemName, itemType, node.item.name); 8778 var item = this._scope.create(itemName, itemType, node.item.name);
9167 var listVar = list; 8779 var listVar = list;
9168 if (list.needsTemp) { 8780 if (list.needsTemp) {
9169 listVar = this._scope.create('\$list', list.type, null); 8781 listVar = this._scope.create('\$list', list.type, null);
9170 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';')); 8782 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';'));
9171 } 8783 }
9172 if (list.type.get$isList()) { 8784 if (list.type.get$isList()) {
9173 var tmpi = this._scope.create('\$i', world.numType, null); 8785 var tmpi = this._scope.create('\$i', world.numType, null);
9174 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code + ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {')); 8786 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code + ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {'));
9175 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [ tmpi]), true); 8787 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [ tmpi]), false);
9176 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';')); 8788 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';'));
9177 } 8789 }
9178 else { 8790 else {
9179 this._pushBlock(false); 8791 this._pushBlock(false);
9180 var c = world.get$coreimpl().types.$index('ListIterator').getConstructor('') ; 8792 var c = world.get$coreimpl().types.$index('ListIterator').getConstructor('') ;
9181 c.invoke$4(this, node, null, new Arguments(null, [new Value(null, 'l', false , true, false)])); 8793 c.invoke$4(this, node, null, new Arguments(null, [new Value(null, 'l', false , true, false)]));
9182 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT Y()); 8794 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT Y());
9183 var tmpi = this._scope.create('\$i', iterator.type, null); 8795 var tmpi = this._scope.create('\$i', iterator.type, null);
9184 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY( )); 8796 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY( ));
9185 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY()); 8797 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY());
9186 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + '; ' + hasNext.code + '; ) {')); 8798 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + '; ' + hasNext.code + '; ) {'));
9187 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';')); 8799 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';'));
9188 } 8800 }
9189 this.visitStatementsInBlock(node.body); 8801 this.visitStatementsInBlock(node.body);
9190 this.writer.exitBlock('}'); 8802 this.writer.exitBlock('}');
9191 this._popBlock(); 8803 this._popBlock();
9192 return false; 8804 return false;
9193 } 8805 }
9194 MethodGenerator.prototype._genToDartException = function(ex) { 8806 MethodGenerator.prototype._genToDartException = function(ex) {
9195 var types = const$180/*const [ 8807 var types = const$374/*const [
9196 'NullPointerException', 'ObjectNotClosureException', 8808 'NullPointerException', 'ObjectNotClosureException',
9197 'NoSuchMethodException', 'StackOverflowException']*/; 8809 'NoSuchMethodException', 'StackOverflowException']*/;
9198 for (var $i = types.iterator(); $i.hasNext(); ) { 8810 for (var $i = types.iterator(); $i.hasNext(); ) {
9199 var name = $i.next(); 8811 var name = $i.next();
9200 world.corelib.types.$index(name).markUsed(); 8812 world.corelib.types.$index(name).markUsed();
9201 } 8813 }
9202 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');')); 8814 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');'));
9203 } 8815 }
9204 MethodGenerator.prototype.visitTryStatement = function(node) { 8816 MethodGenerator.prototype.visitTryStatement = function(node) {
9205 this.writer.enterBlock('try {'); 8817 this.writer.enterBlock('try {');
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
9513 else { 9125 else {
9514 var member = this.method.declaringType.get$library().lookup(xn.name.name, xn.name.span); 9126 var member = this.method.declaringType.get$library().lookup(xn.name.name, xn.name.span);
9515 if (member == null) { 9127 if (member == null) {
9516 world.warning(('can not resolve ' + xn.name.name + ''), xn.span); 9128 world.warning(('can not resolve ' + xn.name.name + ''), xn.span);
9517 return this._makeMissingValue(xn.name.name); 9129 return this._makeMissingValue(xn.name.name);
9518 } 9130 }
9519 members = new MemberSet(member); 9131 members = new MemberSet(member);
9520 } 9132 }
9521 if (!members.get$treatAsField() || members.get$containsMethods()) { 9133 if (!members.get$treatAsField() || members.get$containsMethods()) {
9522 if (kind != 0) { 9134 if (kind != 0) {
9523 var right = members.get_(this, position, x); 9135 var right = members.get_$3(this, position, x);
9524 right = captureOriginal(right); 9136 right = captureOriginal(right);
9525 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arguments(null, [y])); 9137 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arguments(null, [y]));
9526 } 9138 }
9527 return members.set_$4(this, position, x, y); 9139 return members.set_$4(this, position, x, y);
9528 } 9140 }
9529 x = members.get_(this, position, x); 9141 x = members.get_$3(this, position, x);
9530 } 9142 }
9531 y = y.convertTo(this, x.type, yn, true); 9143 y = y.convertTo(this, x.type, yn, false);
9532 if (kind == 0) { 9144 if (kind == 0) {
9533 x = captureOriginal(x); 9145 x = captureOriginal(x);
9534 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), false, true, f alse); 9146 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), false, true, f alse);
9535 } 9147 }
9536 else if (x.type.get$isNum() && y.type.get$isNum() && (kind != 46/*TokenKind.TR UNCDIV*/)) { 9148 else if (x.type.get$isNum() && y.type.get$isNum() && (kind != 46/*TokenKind.TR UNCDIV*/)) {
9537 x = captureOriginal(x); 9149 x = captureOriginal(x);
9538 var op = TokenKind.kindToString(kind); 9150 var op = TokenKind.kindToString(kind);
9539 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), fals e, true, false); 9151 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), fals e, true, false);
9540 } 9152 }
9541 else { 9153 else {
9542 var right = x; 9154 var right = x;
9543 right = captureOriginal(right); 9155 right = captureOriginal(right);
9544 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); 9156 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y]));
9545 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), false, true, f alse); 9157 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), false, true, f alse);
9546 } 9158 }
9547 } 9159 }
9548 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c aptureOriginal) { 9160 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c aptureOriginal) {
9549 var target = this.visitValue(xn.target); 9161 var target = this.visitValue(xn.target);
9550 var index = this.visitValue(xn.index); 9162 var index = this.visitValue(xn.index);
9551 var y = this.visitValue(yn); 9163 var y = this.visitValue(yn);
9552 var tmptarget = target; 9164 var tmptarget = target;
9553 var tmpindex = index; 9165 var tmpindex = index;
9554 if (kind != 0) { 9166 if (kind != 0) {
9555 tmptarget = this.getTemp(target); 9167 tmptarget = this.getTemp(target);
9556 tmpindex = this.getTemp(index); 9168 tmpindex = this.getTemp(index);
9557 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null , [this.assignTemp(tmpindex, index)])); 9169 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null , [this.assignTemp(tmpindex, index)]));
9558 right = captureOriginal(right); 9170 right = captureOriginal(right);
9559 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); 9171 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y]));
9560 } 9172 }
9561 var ret = this.assignTemp(tmptarget, target).invoke(this, '\$setindex', positi on, new Arguments(null, [index, y]), true); 9173 var ret = this.assignTemp(tmptarget, target).invoke(this, '\$setindex', positi on, new Arguments(null, [index, y]), false);
9562 if ($ne(tmptarget, target)) this.freeTemp(tmptarget); 9174 if ($ne(tmptarget, target)) this.freeTemp(tmptarget);
9563 if ($ne(tmpindex, index)) this.freeTemp(tmpindex); 9175 if ($ne(tmpindex, index)) this.freeTemp(tmpindex);
9564 return ret; 9176 return ret;
9565 } 9177 }
9566 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap tureOriginal) { 9178 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap tureOriginal) {
9567 var target = xn.self.visit(this); 9179 var target = xn.self.visit(this);
9568 var y = this.visitValue(yn); 9180 var y = this.visitValue(yn);
9569 var tmptarget = target; 9181 var tmptarget = target;
9570 if (kind != 0) { 9182 if (kind != 0) {
9571 tmptarget = this.getTemp(target); 9183 tmptarget = this.getTemp(target);
9572 var right = tmptarget.get_(this, xn.name.name, xn.name); 9184 var right = tmptarget.get_$3(this, xn.name.name, xn.name);
9573 right = captureOriginal(right); 9185 right = captureOriginal(right);
9574 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); 9186 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y]));
9575 } 9187 }
9576 var ret = this.assignTemp(tmptarget, target).set_(this, xn.name.name, xn.name, y, true); 9188 var ret = this.assignTemp(tmptarget, target).set_(this, xn.name.name, xn.name, y, false);
9577 if ($ne(tmptarget, target)) this.freeTemp(tmptarget); 9189 if ($ne(tmptarget, target)) this.freeTemp(tmptarget);
9578 return ret; 9190 return ret;
9579 } 9191 }
9580 MethodGenerator.prototype.visitUnaryExpression = function(node) { 9192 MethodGenerator.prototype.visitUnaryExpression = function(node) {
9581 var value = this.visitValue(node.self); 9193 var value = this.visitValue(node.self);
9582 switch (node.op.kind) { 9194 switch (node.op.kind) {
9583 case 16/*TokenKind.INCR*/: 9195 case 16/*TokenKind.INCR*/:
9584 case 17/*TokenKind.DECR*/: 9196 case 17/*TokenKind.DECR*/:
9585 9197
9586 if (value.type.get$isNum()) { 9198 if (value.type.get$isNum()) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
9718 argsCode.add(arg.code); 9330 argsCode.add(arg.code);
9719 } 9331 }
9720 else { 9332 else {
9721 argsCode.add(arg.canonicalCode); 9333 argsCode.add(arg.canonicalCode);
9722 } 9334 }
9723 } 9335 }
9724 else { 9336 else {
9725 argsCode.add(arg.code); 9337 argsCode.add(arg.code);
9726 } 9338 }
9727 } 9339 }
9340 world.get$coreimpl().types.$index('ListFactory').markUsed();
9728 var code = ('[' + Strings.join(argsCode, ", ") + ']'); 9341 var code = ('[' + Strings.join(argsCode, ", ") + ']');
9729 var value = new Value(world.listType, code, false, true, false); 9342 var value = new Value(world.listType, code, false, true, false);
9730 if (node.isConst) { 9343 if (node.isConst) {
9731 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); 9344 var immutableList = world.get$coreimpl().types.$index('ImmutableList');
9732 var immutableListCtor = immutableList.getConstructor('from'); 9345 var immutableListCtor = immutableList.getConstructor('from');
9733 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null , [value])); 9346 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null , [value]));
9734 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory(immut ableList, argValues, ('const ' + code + ''), result.code, node.span), argValues) ; 9347 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory(immut ableList, argValues, ('const ' + code + ''), result.code, node.span), argValues) ;
9735 } 9348 }
9736 return value; 9349 return value;
9737 } 9350 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
9788 } 9401 }
9789 MethodGenerator.prototype.visitParenExpression = function(node) { 9402 MethodGenerator.prototype.visitParenExpression = function(node) {
9790 var body = this.visitValue(node.body); 9403 var body = this.visitValue(node.body);
9791 if (body.get$isConst()) { 9404 if (body.get$isConst()) {
9792 return EvaluatedValue.EvaluatedValue$factory(body.type, body.get$actualValue (), ('(' + body.canonicalCode + ')'), node.span); 9405 return EvaluatedValue.EvaluatedValue$factory(body.type, body.get$actualValue (), ('(' + body.canonicalCode + ')'), node.span);
9793 } 9406 }
9794 return new Value(body.type, ('(' + body.code + ')'), false, true, false); 9407 return new Value(body.type, ('(' + body.code + ')'), false, true, false);
9795 } 9408 }
9796 MethodGenerator.prototype.visitDotExpression = function(node) { 9409 MethodGenerator.prototype.visitDotExpression = function(node) {
9797 var target = node.self.visit(this); 9410 var target = node.self.visit(this);
9798 return target.get_(this, node.name.name, node.name); 9411 return target.get_$3(this, node.name.name, node.name);
9799 } 9412 }
9800 MethodGenerator.prototype.visitVarExpression = function(node) { 9413 MethodGenerator.prototype.visitVarExpression = function(node) {
9801 var ret = this._scope.lookup(node.name.name); 9414 var ret = this._scope.lookup(node.name.name);
9802 if ($ne(ret, null)) return ret; 9415 if ($ne(ret, null)) return ret;
9803 ret = this.method.declaringType.resolveMember(node.name.name); 9416 ret = this.method.declaringType.resolveMember(node.name.name);
9804 if ($ne(ret, null)) { 9417 if ($ne(ret, null)) {
9805 return ret.get_(this, node, this._makeThisOrType()); 9418 return ret.get_$3(this, node, this._makeThisOrType());
9806 } 9419 }
9807 ret = this.method.declaringType.get$library().lookup(node.name.name, node.span ); 9420 ret = this.method.declaringType.get$library().lookup(node.name.name, node.span );
9808 if ($ne(ret, null)) { 9421 if ($ne(ret, null)) {
9809 return ret.get_(this, node, null); 9422 return ret.get_$3(this, node);
9810 } 9423 }
9811 world.warning(('can not resolve ' + node.name.name + ''), node.span); 9424 world.warning(('can not resolve ' + node.name.name + ''), node.span);
9812 return this._makeMissingValue(node.name.name); 9425 return this._makeMissingValue(node.name.name);
9813 } 9426 }
9814 MethodGenerator.prototype._makeMissingValue = function(name) { 9427 MethodGenerator.prototype._makeMissingValue = function(name) {
9815 return new Value(null, ('' + name + '()/*NotFound*/'), false, true, false); 9428 return new Value(null, ('' + name + '()/*NotFound*/'), false, true, false);
9816 } 9429 }
9817 MethodGenerator.prototype._makeThisOrType = function() { 9430 MethodGenerator.prototype._makeThisOrType = function() {
9818 var outermost = this._getOutermostMethod(); 9431 var outermost = this._getOutermostMethod();
9819 if (outermost.method.get$isStatic()) { 9432 if (outermost.method.get$isStatic()) {
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
10336 lang_Parameter.prototype.resolve = function(inType) { 9949 lang_Parameter.prototype.resolve = function(inType) {
10337 this.name = this.definition.name.name; 9950 this.name = this.definition.name.name;
10338 this.type = inType.resolveType(this.definition.type, false); 9951 this.type = inType.resolveType(this.definition.type, false);
10339 } 9952 }
10340 lang_Parameter.prototype.genValue = function(method, context) { 9953 lang_Parameter.prototype.genValue = function(method, context) {
10341 if (this.definition.value == null || this.value != null) return; 9954 if (this.definition.value == null || this.value != null) return;
10342 if (context == null) { 9955 if (context == null) {
10343 context = new MethodGenerator(method, null); 9956 context = new MethodGenerator(method, null);
10344 } 9957 }
10345 this.value = this.definition.value.visit(context); 9958 this.value = this.definition.value.visit(context);
10346 this.value = this.value.convertTo(context, this.type, this.definition.value, t rue); 9959 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse);
10347 } 9960 }
10348 lang_Parameter.prototype.copyWithNewType = function(newType) { 9961 lang_Parameter.prototype.copyWithNewType = function(newType) {
10349 var ret = new lang_Parameter(this.definition); 9962 var ret = new lang_Parameter(this.definition);
10350 ret.type = newType; 9963 ret.type = newType;
10351 ret.name = this.name; 9964 ret.name = this.name;
10352 return ret; 9965 return ret;
10353 } 9966 }
10354 lang_Parameter.prototype.get$isOptional = function() { 9967 lang_Parameter.prototype.get$isOptional = function() {
10355 return this.definition != null && this.definition.value != null; 9968 return this.definition != null && this.definition.value != null;
10356 } 9969 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
10409 } 10022 }
10410 Member.prototype.get$definition = function() { 10023 Member.prototype.get$definition = function() {
10411 return null; 10024 return null;
10412 } 10025 }
10413 Member.prototype.get$parameters = function() { 10026 Member.prototype.get$parameters = function() {
10414 return []; 10027 return [];
10415 } 10028 }
10416 Member.prototype.canInvoke = function(context, args) { 10029 Member.prototype.canInvoke = function(context, args) {
10417 return this.get$canGet() && new Value(this.get$returnType(), null, false, true , false).canInvoke(context, '\$call', args); 10030 return this.get$canGet() && new Value(this.get$returnType(), null, false, true , false).canInvoke(context, '\$call', args);
10418 } 10031 }
10419 Member.prototype.invoke = function(context, node, target, args, checked) { 10032 Member.prototype.invoke = function(context, node, target, args, isDynamic) {
10420 var newTarget = this.get_(context, node, target); 10033 var newTarget = this.get_(context, node, target, isDynamic);
10421 return newTarget.invoke(context, '\$call', node, args, checked); 10034 return newTarget.invoke(context, '\$call', node, args, isDynamic);
10422 } 10035 }
10423 Member.prototype.override = function(other) { 10036 Member.prototype.override = function(other) {
10424 if (this.get$isStatic()) { 10037 if (this.get$isStatic()) {
10425 world.error('static members can not hide parent members', this.get$span(), o ther.get$span()); 10038 world.error('static members can not hide parent members', this.get$span(), o ther.get$span());
10426 return false; 10039 return false;
10427 } 10040 }
10428 else if (other.get$isStatic()) { 10041 else if (other.get$isStatic()) {
10429 world.error('can not override static member', this.get$span(), other.get$spa n()); 10042 world.error('can not override static member', this.get$span(), other.get$spa n());
10430 return false; 10043 return false;
10431 } 10044 }
10432 return true; 10045 return true;
10433 } 10046 }
10434 Member.prototype.get$generatedFactoryName = function() { 10047 Member.prototype.get$generatedFactoryName = function() {
10435 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo rName() + '\$'); 10048 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo rName() + '\$');
10436 if (this.name == '') { 10049 if (this.name == '') {
10437 return ('' + prefix + 'factory'); 10050 return ('' + prefix + 'factory');
10438 } 10051 }
10439 else { 10052 else {
10440 return ('' + prefix + '' + this.name + '\$factory'); 10053 return ('' + prefix + '' + this.name + '\$factory');
10441 } 10054 }
10442 } 10055 }
10056 Member.prototype.get_$3 = Member.prototype.get_;
10443 Member.prototype.invoke$4 = function($0, $1, $2, $3) { 10057 Member.prototype.invoke$4 = function($0, $1, $2, $3) {
10444 return this.invoke($0, $1, $2, $3, true); 10058 return this.invoke($0, $1, $2, $3, false);
10445 } 10059 }
10446 ; 10060 ;
10447 Member.prototype.set_$4 = Member.prototype.set_; 10061 Member.prototype.set_$4 = Member.prototype.set_;
10448 // ********** Code for TypeMember ************** 10062 // ********** Code for TypeMember **************
10449 function TypeMember(type0) { 10063 function TypeMember(type0) {
10450 this.type = type0; 10064 this.type = type0;
10451 Member.call(this, type0.name, type0.library.topType); 10065 Member.call(this, type0.name, type0.library.topType);
10452 // Initializers done 10066 // Initializers done
10453 } 10067 }
10454 $inherits(TypeMember, Member); 10068 $inherits(TypeMember, Member);
(...skipping 11 matching lines...) Expand all
10466 } 10080 }
10467 TypeMember.prototype.get$canGet = function() { 10081 TypeMember.prototype.get$canGet = function() {
10468 return true; 10082 return true;
10469 } 10083 }
10470 TypeMember.prototype.get$canSet = function() { 10084 TypeMember.prototype.get$canSet = function() {
10471 return false; 10085 return false;
10472 } 10086 }
10473 TypeMember.prototype.resolve = function(inType) { 10087 TypeMember.prototype.resolve = function(inType) {
10474 10088
10475 } 10089 }
10476 TypeMember.prototype.get_ = function(context, node, target) { 10090 TypeMember.prototype.get_ = function(context, node, target, isDynamic) {
10477 return new Value(this.type, this.type.get$jsname(), false, false, true); 10091 return new Value(this.type, this.type.get$jsname(), false, false, true);
10478 } 10092 }
10479 TypeMember.prototype.set_ = function(context, node, target, value, checked) { 10093 TypeMember.prototype.set_ = function(context, node, target, value, isDynamic) {
10480 world.error('can not set type', this.type.definition.span); 10094 world.error('can not set type', this.type.definition.span);
10481 } 10095 }
10482 TypeMember.prototype.invoke = function(context, node, target, args, checked) { 10096 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) {
10483 world.error('can not invoke type', this.type.definition.span); 10097 world.error('can not invoke type', this.type.definition.span);
10484 } 10098 }
10099 TypeMember.prototype.get_$3 = function($0, $1, $2) {
10100 return this.get_($0, $1, $2, false);
10101 }
10102 ;
10485 TypeMember.prototype.invoke$4 = function($0, $1, $2, $3) { 10103 TypeMember.prototype.invoke$4 = function($0, $1, $2, $3) {
10486 return this.invoke($0, $1, $2, $3, true); 10104 return this.invoke($0, $1, $2, $3, false);
10487 } 10105 }
10488 ; 10106 ;
10489 TypeMember.prototype.set_$4 = function($0, $1, $2, $3) { 10107 TypeMember.prototype.set_$4 = function($0, $1, $2, $3) {
10490 return this.set_($0, $1, $2, $3, true); 10108 return this.set_($0, $1, $2, $3, false);
10491 } 10109 }
10492 ; 10110 ;
10493 // ********** Code for FieldMember ************** 10111 // ********** Code for FieldMember **************
10494 function FieldMember(name0, declaringType0, definition, value) { 10112 function FieldMember(name0, declaringType0, definition, value) {
10495 this._providePropertySyntax = false 10113 this._providePropertySyntax = false
10496 this._computing = false 10114 this._computing = false
10497 this.definition = definition; 10115 this.definition = definition;
10498 this.value = value; 10116 this.value = value;
10499 this.isNative = false; 10117 this.isNative = false;
10500 Member.call(this, name0, declaringType0); 10118 Member.call(this, name0, declaringType0);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
10594 world.error('non constant field must be initialized in constructor', thi s.value.span); 10212 world.error('non constant field must be initialized in constructor', thi s.value.span);
10595 } 10213 }
10596 } 10214 }
10597 if (this.isStatic) { 10215 if (this.isStatic) {
10598 this._computedValue = world.gen.globalForStaticField(this, this._computedV alue, [this._computedValue]); 10216 this._computedValue = world.gen.globalForStaticField(this, this._computedV alue, [this._computedValue]);
10599 } 10217 }
10600 this._computing = false; 10218 this._computing = false;
10601 } 10219 }
10602 return this._computedValue; 10220 return this._computedValue;
10603 } 10221 }
10604 FieldMember.prototype.get_ = function(context, node, target) { 10222 FieldMember.prototype.get_ = function(context, node, target, isDynamic) {
10605 this.declaringType.markUsed(); 10223 if (!isDynamic) {
10224 this.declaringType.markUsed();
10225 }
10606 if (this.isStatic) { 10226 if (this.isStatic) {
10607 var cv = this.computeValue(); 10227 var cv = this.computeValue();
10608 if (this.isFinal) { 10228 if (this.isFinal) {
10609 return cv; 10229 return cv;
10610 } 10230 }
10611 if (this.declaringType.get$isTop()) { 10231 if (this.declaringType.get$isTop()) {
10612 return new Value(this.type, ('' + this.get$jsname() + ''), false, true, fa lse); 10232 return new Value(this.type, ('' + this.get$jsname() + ''), false, true, fa lse);
10613 } 10233 }
10614 else { 10234 else {
10615 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), false, true, false); 10235 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), false, true, false);
10616 } 10236 }
10617 } 10237 }
10618 else if (target.get$isConst() && this.isFinal) { 10238 else if (target.get$isConst() && this.isFinal) {
10619 var constTarget = (target instanceof GlobalValue) ? target.exp : target; 10239 var constTarget = (target instanceof GlobalValue) ? target.exp : target;
10620 if ((constTarget instanceof ConstObjectValue)) { 10240 if ((constTarget instanceof ConstObjectValue)) {
10621 return constTarget.fields.$index(this.name); 10241 return constTarget.fields.$index(this.name);
10622 } 10242 }
10623 else if ($eq(constTarget.type, world.stringType) && this.name == 'length') { 10243 else if ($eq(constTarget.type, world.stringType) && this.name == 'length') {
10624 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), false, true, false); 10244 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), false, true, false);
10625 } 10245 }
10626 } 10246 }
10627 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), false, true, false); 10247 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), false, true, false);
10628 } 10248 }
10629 FieldMember.prototype.set_ = function(context, node, target, value0, checked) { 10249 FieldMember.prototype.set_ = function(context, node, target, value0, isDynamic) {
10630 var lhs = this.get_(context, node, target); 10250 var lhs = this.get_(context, node, target, isDynamic);
10631 value0 = value0.convertTo(context, this.type, node, checked); 10251 value0 = value0.convertTo(context, this.type, node, isDynamic);
10632 return new Value(this.type, ('' + lhs.code + ' = ' + value0.code + ''), false, true, false); 10252 return new Value(this.type, ('' + lhs.code + ' = ' + value0.code + ''), false, true, false);
10633 } 10253 }
10254 FieldMember.prototype.get_$3 = function($0, $1, $2) {
10255 return this.get_($0, $1, $2, false);
10256 }
10257 ;
10634 FieldMember.prototype.set_$4 = function($0, $1, $2, $3) { 10258 FieldMember.prototype.set_$4 = function($0, $1, $2, $3) {
10635 return this.set_($0, $1, $2, $3, true); 10259 return this.set_($0, $1, $2, $3, false);
10636 } 10260 }
10637 ; 10261 ;
10638 // ********** Code for PropertyMember ************** 10262 // ********** Code for PropertyMember **************
10639 function PropertyMember(name0, declaringType0) { 10263 function PropertyMember(name0, declaringType0) {
10640 this._provideFieldSyntax = false 10264 this._provideFieldSyntax = false
10641 Member.call(this, name0, declaringType0); 10265 Member.call(this, name0, declaringType0);
10642 // Initializers done 10266 // Initializers done
10643 } 10267 }
10644 $inherits(PropertyMember, Member); 10268 $inherits(PropertyMember, Member);
10645 PropertyMember.prototype.get$span = function() { 10269 PropertyMember.prototype.get$span = function() {
(...skipping 30 matching lines...) Expand all
10676 if (!Member.prototype.override.call(this, other)) return false; 10300 if (!Member.prototype.override.call(this, other)) return false;
10677 if (other.get$isProperty() || other.get$isField()) { 10301 if (other.get$isProperty() || other.get$isField()) {
10678 if (other.get$isProperty()) this.addFromParent(other); 10302 if (other.get$isProperty()) this.addFromParent(other);
10679 return true; 10303 return true;
10680 } 10304 }
10681 else { 10305 else {
10682 world.error('property can only override field or property', this.get$span(), other.get$span()); 10306 world.error('property can only override field or property', this.get$span(), other.get$span());
10683 return false; 10307 return false;
10684 } 10308 }
10685 } 10309 }
10686 PropertyMember.prototype.get_ = function(context, node, target) { 10310 PropertyMember.prototype.get_ = function(context, node, target, isDynamic) {
10687 if (this.getter == null) { 10311 if (this.getter == null) {
10688 world.warning(('no getter on ' + this.declaringType.name + '.' + this.name + ''), node.span); 10312 return target.invokeNoSuchMethod(context, ('get:' + this.name + ''), node);
10689 return new Value(null, ('' + target.code + '.' + this.name + '()/*NoGetter*/ '), false, true, false);
10690 } 10313 }
10691 return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), true); 10314 return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), false) ;
10692 } 10315 }
10693 PropertyMember.prototype.set_ = function(context, node, target, value, checked) { 10316 PropertyMember.prototype.set_ = function(context, node, target, value, isDynamic ) {
10694 return this.setter.invoke(context, node, target, new Arguments(null, [value]), checked); 10317 return this.setter.invoke(context, node, target, new Arguments(null, [value]), isDynamic);
10695 } 10318 }
10696 PropertyMember.prototype.addFromParent = function(parentMember) { 10319 PropertyMember.prototype.addFromParent = function(parentMember) {
10697 if ((parentMember instanceof ConcreteMember)) { 10320 if ((parentMember instanceof ConcreteMember)) {
10698 parentMember = parentMember.baseMember; 10321 parentMember = parentMember.baseMember;
10699 } 10322 }
10700 if (this.getter == null) this.getter = parentMember.getter; 10323 if (this.getter == null) this.getter = parentMember.getter;
10701 if (this.setter == null) this.setter = parentMember.setter; 10324 if (this.setter == null) this.setter = parentMember.setter;
10702 } 10325 }
10703 PropertyMember.prototype.resolve = function(inType) { 10326 PropertyMember.prototype.resolve = function(inType) {
10704 if (this.getter != null) this.getter.resolve(inType); 10327 if (this.getter != null) this.getter.resolve(inType);
10705 if (this.setter != null) this.setter.resolve(inType); 10328 if (this.setter != null) this.setter.resolve(inType);
10706 this.get$library()._addMember(this); 10329 this.get$library()._addMember(this);
10707 } 10330 }
10331 PropertyMember.prototype.get_$3 = function($0, $1, $2) {
10332 return this.get_($0, $1, $2, false);
10333 }
10334 ;
10708 PropertyMember.prototype.set_$4 = function($0, $1, $2, $3) { 10335 PropertyMember.prototype.set_$4 = function($0, $1, $2, $3) {
10709 return this.set_($0, $1, $2, $3, true); 10336 return this.set_($0, $1, $2, $3, false);
10710 } 10337 }
10711 ; 10338 ;
10712 // ********** Code for ConcreteMember ************** 10339 // ********** Code for ConcreteMember **************
10713 function ConcreteMember(name0, declaringType0, baseMember) { 10340 function ConcreteMember(name0, declaringType0, baseMember) {
10714 this.baseMember = baseMember; 10341 this.baseMember = baseMember;
10715 Member.call(this, name0, declaringType0); 10342 Member.call(this, name0, declaringType0);
10716 // Initializers done 10343 // Initializers done
10717 this.parameters = []; 10344 this.parameters = [];
10718 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring Type0); 10345 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring Type0);
10719 var $list = this.baseMember.get$parameters(); 10346 var $list = this.baseMember.get$parameters();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
10799 ConcreteMember.prototype.set$initDelegate = function(ctor) { 10426 ConcreteMember.prototype.set$initDelegate = function(ctor) {
10800 this.baseMember.set$initDelegate(ctor); 10427 this.baseMember.set$initDelegate(ctor);
10801 } 10428 }
10802 ConcreteMember.prototype.resolveType = function(node, isRequired) { 10429 ConcreteMember.prototype.resolveType = function(node, isRequired) {
10803 var type = this.baseMember.resolveType(node, isRequired); 10430 var type = this.baseMember.resolveType(node, isRequired);
10804 return type.resolveTypeParams(this.declaringType); 10431 return type.resolveTypeParams(this.declaringType);
10805 } 10432 }
10806 ConcreteMember.prototype.override = function(other) { 10433 ConcreteMember.prototype.override = function(other) {
10807 return this.baseMember.override(other); 10434 return this.baseMember.override(other);
10808 } 10435 }
10809 ConcreteMember.prototype.get_ = function(context, node, target) { 10436 ConcreteMember.prototype.get_ = function(context, node, target, isDynamic) {
10810 var ret = this.baseMember.get_(context, node, target); 10437 var ret = this.baseMember.get_(context, node, target, isDynamic);
10811 return new Value(this.returnType, ret.code, false, true, false); 10438 return new Value(this.returnType, ret.code, false, true, false);
10812 } 10439 }
10813 ConcreteMember.prototype.set_ = function(context, node, target, value, checked) { 10440 ConcreteMember.prototype.set_ = function(context, node, target, value, isDynamic ) {
10814 var ret = this.baseMember.set_(context, node, target, value, checked); 10441 var ret = this.baseMember.set_(context, node, target, value, isDynamic);
10815 return new Value(this.returnType, ret.code, false, true, false); 10442 return new Value(this.returnType, ret.code, false, true, false);
10816 } 10443 }
10817 ConcreteMember.prototype.invoke = function(context, node, target, args, checked) { 10444 ConcreteMember.prototype.invoke = function(context, node, target, args, isDynami c) {
10818 var ret = this.baseMember.invoke(context, node, target, args, checked); 10445 var ret = this.baseMember.invoke(context, node, target, args, isDynamic);
10819 var code = ret.code; 10446 var code = ret.code;
10820 if (this.get$isConstructor()) { 10447 if (this.get$isConstructor()) {
10821 code = code.replaceFirst(this.declaringType.get$genericType().get$jsname(), this.declaringType.get$jsname()); 10448 code = code.replaceFirst(this.declaringType.get$genericType().get$jsname(), this.declaringType.get$jsname());
10822 } 10449 }
10823 world.gen.genMethod(this); 10450 this.declaringType.genMethod(this);
10824 return new Value(this.returnType, code, false, true, false); 10451 return new Value(this.returnType, code, false, true, false);
10825 } 10452 }
10453 ConcreteMember.prototype.get_$3 = function($0, $1, $2) {
10454 return this.get_($0, $1, $2, false);
10455 }
10456 ;
10826 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) { 10457 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) {
10827 return this.invoke($0, $1, $2, $3, true); 10458 return this.invoke($0, $1, $2, $3, false);
10828 } 10459 }
10829 ; 10460 ;
10830 ConcreteMember.prototype.set_$4 = function($0, $1, $2, $3) { 10461 ConcreteMember.prototype.set_$4 = function($0, $1, $2, $3) {
10831 return this.set_($0, $1, $2, $3, true); 10462 return this.set_($0, $1, $2, $3, false);
10832 } 10463 }
10833 ; 10464 ;
10834 // ********** Code for MethodMember ************** 10465 // ********** Code for MethodMember **************
10835 function MethodMember(name0, declaringType0, definition) { 10466 function MethodMember(name0, declaringType0, definition) {
10836 this.isStatic = false 10467 this.isStatic = false
10837 this.isAbstract = false 10468 this.isAbstract = false
10838 this.isConst = false 10469 this.isConst = false
10839 this.isFactory = false 10470 this.isFactory = false
10840 this.isLambda = false 10471 this.isLambda = false
10841 this._providePropertySyntax = false 10472 this._providePropertySyntax = false
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
10948 } 10579 }
10949 MethodMember.prototype.get$requiresFieldSyntax = function() { 10580 MethodMember.prototype.get$requiresFieldSyntax = function() {
10950 return false; 10581 return false;
10951 } 10582 }
10952 MethodMember.prototype.provideFieldSyntax = function() { 10583 MethodMember.prototype.provideFieldSyntax = function() {
10953 return this._provideFieldSyntax = true; 10584 return this._provideFieldSyntax = true;
10954 } 10585 }
10955 MethodMember.prototype.providePropertySyntax = function() { 10586 MethodMember.prototype.providePropertySyntax = function() {
10956 return this._providePropertySyntax = true; 10587 return this._providePropertySyntax = true;
10957 } 10588 }
10958 MethodMember.prototype.set_ = function(context, Node0, target, value, checked) { 10589 MethodMember.prototype.set_ = function(context, Node0, target, value, isDynamic) {
10959 world.error('can not set method', this.definition.span); 10590 world.error('can not set method', this.definition.span);
10960 } 10591 }
10961 MethodMember.prototype.get_ = function(context, node, target) { 10592 MethodMember.prototype.get_ = function(context, node, target, isDynamic) {
10962 world.gen.genMethod(this); 10593 this.declaringType.genMethod(this);
10963 this._provideOptionalParamInfo = true; 10594 this._provideOptionalParamInfo = true;
10964 if (this.isStatic) { 10595 if (this.isStatic) {
10965 var type = this.declaringType.get$isTop() ? '' : ('' + this.declaringType.ge t$jsname() + '.'); 10596 var type = this.declaringType.get$isTop() ? '' : ('' + this.declaringType.ge t$jsname() + '.');
10966 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname( ) + ''), false, true, false); 10597 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname( ) + ''), false, true, false);
10967 } 10598 }
10968 this._providePropertySyntax = true; 10599 this._providePropertySyntax = true;
10969 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), false, true, false); 10600 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), false, true, false);
10970 } 10601 }
10971 MethodMember.prototype.namesInOrder = function(args) { 10602 MethodMember.prototype.namesInOrder = function(args) {
10972 if (!args.get$hasNames()) return true; 10603 if (!args.get$hasNames()) return true;
(...skipping 22 matching lines...) Expand all
10995 } 10626 }
10996 return target.invokeNoSuchMethod(context, this.name, node, args); 10627 return target.invokeNoSuchMethod(context, this.name, node, args);
10997 } 10628 }
10998 MethodMember.prototype.genParameterValues = function() { 10629 MethodMember.prototype.genParameterValues = function() {
10999 var $list = this.parameters; 10630 var $list = this.parameters;
11000 for (var $i = 0;$i < $list.length; $i++) { 10631 for (var $i = 0;$i < $list.length; $i++) {
11001 var p = $list.$index($i); 10632 var p = $list.$index($i);
11002 p.genValue(this, this.generator); 10633 p.genValue(this, this.generator);
11003 } 10634 }
11004 } 10635 }
11005 MethodMember.prototype.invoke = function(context, node, target, args, checked) { 10636 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) {
11006 if (this.parameters == null) { 10637 if (this.parameters == null) {
11007 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.' + this.name + '')); 10638 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.' + this.name + ''));
11008 this.resolve(this.declaringType); 10639 this.resolve(this.declaringType);
11009 } 10640 }
11010 if (!this.isGenerated) { 10641 this.declaringType.genMethod(this);
11011 world.gen.genMethod(this);
11012 }
11013 if (this.isStatic || this.isFactory) { 10642 if (this.isStatic || this.isFactory) {
11014 this.declaringType.markUsed(); 10643 this.declaringType.markUsed();
11015 } 10644 }
11016 if (!this.namesInOrder(args)) { 10645 if (!this.namesInOrder(args)) {
11017 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s); 10646 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s);
11018 } 10647 }
11019 var argsCode = []; 10648 var argsCode = [];
11020 if (target != null && (this.get$isConstructor() || target.isSuper)) { 10649 if (target != null && (this.get$isConstructor() || target.isSuper)) {
11021 argsCode.add('this'); 10650 argsCode.add('this');
11022 } 10651 }
11023 var bareCount = args.get$bareCount(); 10652 var bareCount = args.get$bareCount();
11024 for (var i = 0; 10653 for (var i = 0;
11025 i < bareCount; i++) { 10654 i < bareCount; i++) {
11026 var arg = args.values.$index(i); 10655 var arg = args.values.$index(i);
11027 if (i >= this.parameters.length) { 10656 if (i >= this.parameters.length) {
11028 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false); 10657 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false);
11029 return this._argError(context, node, target, args, msg); 10658 return this._argError(context, node, target, args, msg);
11030 } 10659 }
11031 arg = arg.convertTo(context, this.parameters.$index(i).type, node, checked); 10660 arg = arg.convertTo(context, this.parameters.$index(i).type, node, isDynamic );
11032 if (this.isConst && arg.get$isConst()) { 10661 if (this.isConst && arg.get$isConst()) {
11033 argsCode.add(arg.canonicalCode); 10662 argsCode.add(arg.canonicalCode);
11034 } 10663 }
11035 else { 10664 else {
11036 argsCode.add(arg.code); 10665 argsCode.add(arg.code);
11037 } 10666 }
11038 } 10667 }
11039 if (bareCount < this.parameters.length) { 10668 if (bareCount < this.parameters.length) {
11040 this.genParameterValues(); 10669 this.genParameterValues();
11041 var namedArgsUsed = 0; 10670 var namedArgsUsed = 0;
11042 for (var i = bareCount; 10671 for (var i = bareCount;
11043 i < this.parameters.length; i++) { 10672 i < this.parameters.length; i++) {
11044 var arg = args.getValue(this.parameters.$index(i).get$name()); 10673 var arg = args.getValue(this.parameters.$index(i).get$name());
11045 if (arg == null) { 10674 if (arg == null) {
11046 arg = this.parameters.$index(i).get$value(); 10675 arg = this.parameters.$index(i).get$value();
11047 } 10676 }
11048 else { 10677 else {
11049 arg = arg.convertTo(context, this.parameters.$index(i).type, node, check ed); 10678 arg = arg.convertTo(context, this.parameters.$index(i).type, node, isDyn amic);
11050 namedArgsUsed++; 10679 namedArgsUsed++;
11051 } 10680 }
11052 if (arg == null || !this.parameters.$index(i).get$isOptional()) { 10681 if (arg == null || !this.parameters.$index(i).get$isOptional()) {
11053 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + 1, true); 10682 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + 1, true);
11054 return this._argError(context, node, target, args, msg); 10683 return this._argError(context, node, target, args, msg);
11055 } 10684 }
11056 else { 10685 else {
11057 argsCode.add(this.isConst && arg.get$isConst() ? arg.canonicalCode : arg .code); 10686 argsCode.add(this.isConst && arg.get$isConst() ? arg.canonicalCode : arg .code);
11058 } 10687 }
11059 } 10688 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
11166 value = this.parameters.$index(j).get$value(); 10795 value = this.parameters.$index(j).get$value();
11167 } 10796 }
11168 } 10797 }
11169 this.generator._scope._vars.$setindex(name0, value); 10798 this.generator._scope._vars.$setindex(name0, value);
11170 } 10799 }
11171 var $list = this.definition.initializers; 10800 var $list = this.definition.initializers;
11172 for (var $i = 0;$i < $list.length; $i++) { 10801 for (var $i = 0;$i < $list.length; $i++) {
11173 var init = $list.$index($i); 10802 var init = $list.$index($i);
11174 if ((init instanceof CallExpression)) { 10803 if ((init instanceof CallExpression)) {
11175 var delegateArgs = this.generator._makeArgs(init.get$arguments()); 10804 var delegateArgs = this.generator._makeArgs(init.get$arguments());
11176 var value = this.initDelegate.invoke(this.generator, node, target, deleg ateArgs, true); 10805 var value = this.initDelegate.invoke(this.generator, node, target, deleg ateArgs, false);
11177 if ((init.target instanceof ThisExpression)) { 10806 if ((init.target instanceof ThisExpression)) {
11178 return value; 10807 return value;
11179 } 10808 }
11180 else { 10809 else {
11181 if ((value instanceof GlobalValue)) { 10810 if ((value instanceof GlobalValue)) {
11182 value = value.exp; 10811 value = value.exp;
11183 } 10812 }
11184 var $list0 = value.fields.getKeys(); 10813 var $list0 = value.fields.getKeys();
11185 for (var $i0 = value.fields.getKeys().iterator(); $i0.hasNext(); ) { 10814 for (var $i0 = value.fields.getKeys().iterator(); $i0.hasNext(); ) {
11186 var fname = $i0.next(); 10815 var fname = $i0.next();
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
11463 param.resolve(inType); 11092 param.resolve(inType);
11464 this.parameters.add(param); 11093 this.parameters.add(param);
11465 if (this.isStatic && param.type.get$hasTypeParams()) { 11094 if (this.isStatic && param.type.get$hasTypeParams()) {
11466 world.error('using type parameter in static context', formal.get$span()); 11095 world.error('using type parameter in static context', formal.get$span());
11467 } 11096 }
11468 } 11097 }
11469 if (!this.isLambda) { 11098 if (!this.isLambda) {
11470 this.get$library()._addMember(this); 11099 this.get$library()._addMember(this);
11471 } 11100 }
11472 } 11101 }
11102 MethodMember.prototype.get_$3 = function($0, $1, $2) {
11103 return this.get_($0, $1, $2, false);
11104 }
11105 ;
11473 MethodMember.prototype.invoke$4 = function($0, $1, $2, $3) { 11106 MethodMember.prototype.invoke$4 = function($0, $1, $2, $3) {
11474 return this.invoke($0, $1, $2, $3, true); 11107 return this.invoke($0, $1, $2, $3, false);
11475 } 11108 }
11476 ; 11109 ;
11477 MethodMember.prototype.set_$4 = function($0, $1, $2, $3) { 11110 MethodMember.prototype.set_$4 = function($0, $1, $2, $3) {
11478 return this.set_($0, $1, $2, $3, true); 11111 return this.set_($0, $1, $2, $3, false);
11479 } 11112 }
11480 ; 11113 ;
11481 // ********** Code for MemberSet ************** 11114 // ********** Code for MemberSet **************
11482 function MemberSet(member) { 11115 function MemberSet(member) {
11483 this.name = member.name; 11116 this.name = member.name;
11484 this.members = [member]; 11117 this.members = [member];
11485 this.jsname = member.get$jsname(); 11118 this.jsname = member.get$jsname();
11486 // Initializers done 11119 // Initializers done
11487 } 11120 }
11488 MemberSet.prototype.get$name = function() { return this.name; }; 11121 MemberSet.prototype.get$name = function() { return this.name; };
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
11540 if (this._treatAsField) { 11173 if (this._treatAsField) {
11541 member.provideFieldSyntax(); 11174 member.provideFieldSyntax();
11542 } 11175 }
11543 else { 11176 else {
11544 member.providePropertySyntax(); 11177 member.providePropertySyntax();
11545 } 11178 }
11546 } 11179 }
11547 } 11180 }
11548 return this._treatAsField; 11181 return this._treatAsField;
11549 } 11182 }
11550 MemberSet.prototype.get_ = function(context, node, target) { 11183 MemberSet.prototype.get_ = function(context, node, target, isDynamic) {
11551 if (this.members.length == 1) return this.members.$index(0).get_(context, node , target); 11184 if (this.members.length == 1) {
11185 return this.members.$index(0).get_(context, node, target, isDynamic);
11186 }
11187 var targets = this.members.filter((function (m) {
11188 return m.get$canGet();
11189 })
11190 );
11191 if (targets.length == 1) {
11192 return targets.$index(0).get_(context, node, target, isDynamic);
11193 }
11552 var returnValue = null; 11194 var returnValue = null;
11553 var $list = this.members; 11195 for (var $i = targets.iterator(); $i.hasNext(); ) {
11554 for (var $i = 0;$i < $list.length; $i++) { 11196 var member = $i.next();
11555 var member = $list.$index($i); 11197 var value = member.get_(context, node, target, true);
11556 if (!member.get$canGet()) continue;
11557 var value = member.get_(context, node, target);
11558 returnValue = this._tryUnion(returnValue, value, node); 11198 returnValue = this._tryUnion(returnValue, value, node);
11559 } 11199 }
11560 if (returnValue == null) { 11200 if (returnValue == null) {
11561 return this._makeError(node, target, 'getter'); 11201 return this._makeError(node, target, 'getter');
11562 } 11202 }
11563 if (returnValue.code == null) { 11203 if (returnValue.code == null) {
11564 if (this.get$treatAsField()) { 11204 if (this.get$treatAsField()) {
11565 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ''), false, true, false); 11205 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ''), false, true, false);
11566 } 11206 }
11567 else { 11207 else {
11568 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn ame + '()'), false, true, false); 11208 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn ame + '()'), false, true, false);
11569 } 11209 }
11570 } 11210 }
11571 return returnValue; 11211 return returnValue;
11572 } 11212 }
11573 MemberSet.prototype.set_ = function(context, node, target, value, checked) { 11213 MemberSet.prototype.set_ = function(context, node, target, value, isDynamic) {
11574 if (this.members.length == 1) { 11214 if (this.members.length == 1) {
11575 return this.members.$index(0).set_(context, node, target, value, checked); 11215 return this.members.$index(0).set_(context, node, target, value, isDynamic);
11576 } 11216 }
11577 var targets = this.members.filter((function (m) { 11217 var targets = this.members.filter((function (m) {
11578 return m.get$canSet(); 11218 return m.get$canSet();
11579 }) 11219 })
11580 ); 11220 );
11581 if (targets.length == 1) { 11221 if (targets.length == 1) {
11582 return targets.$index(0).set_(context, node, target, value, checked); 11222 return targets.$index(0).set_(context, node, target, value, isDynamic);
11583 } 11223 }
11584 var returnValue = null; 11224 var returnValue = null;
11585 for (var $i = targets.iterator(); $i.hasNext(); ) { 11225 for (var $i = targets.iterator(); $i.hasNext(); ) {
11586 var member = $i.next(); 11226 var member = $i.next();
11587 var setValue = member.set_(context, node, target, value, false); 11227 var res = member.set_(context, node, target, value, true);
11588 returnValue = this._tryUnion(returnValue, setValue, node); 11228 returnValue = this._tryUnion(returnValue, res, node);
11589 } 11229 }
11590 if (returnValue == null) { 11230 if (returnValue == null) {
11591 return this._makeError(node, target, 'setter'); 11231 return this._makeError(node, target, 'setter');
11592 } 11232 }
11593 if (returnValue.code == null) { 11233 if (returnValue.code == null) {
11594 if (this.get$treatAsField()) { 11234 if (this.get$treatAsField()) {
11595 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ' = ' + value.code + ''), false, true, false); 11235 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ' = ' + value.code + ''), false, true, false);
11596 } 11236 }
11597 else { 11237 else {
11598 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn ame + '(' + value.code + ')'), false, true, false); 11238 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn ame + '(' + value.code + ')'), false, true, false);
11599 } 11239 }
11600 } 11240 }
11601 return returnValue; 11241 return returnValue;
11602 } 11242 }
11603 MemberSet.prototype.invoke = function(context, node, target, args, checked) { 11243 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) {
11604 if (this.members.length == 1) { 11244 if (this.members.length == 1) {
11605 return this.members.$index(0).invoke(context, node, target, args, checked); 11245 return this.members.$index(0).invoke(context, node, target, args, isDynamic) ;
11606 } 11246 }
11607 var targets = this.members.filter((function (m) { 11247 var targets = this.members.filter((function (m) {
11608 return m.canInvoke(context, args); 11248 return m.canInvoke(context, args);
11609 }) 11249 })
11610 ); 11250 );
11611 if (targets.length == 1) { 11251 if (targets.length == 1) {
11612 return targets.$index(0).invoke(context, node, target, args, checked); 11252 return targets.$index(0).invoke(context, node, target, args, isDynamic);
11613 } 11253 }
11614 var returnValue = null; 11254 var returnValue = null;
11615 for (var $i = targets.iterator(); $i.hasNext(); ) { 11255 for (var $i = targets.iterator(); $i.hasNext(); ) {
11616 var member = $i.next(); 11256 var member = $i.next();
11617 var value = member.invoke(context, node, target, args, false); 11257 var res = member.invoke(context, node, target, args, true);
11618 returnValue = this._tryUnion(returnValue, value, node); 11258 returnValue = this._tryUnion(returnValue, res, node);
11619 } 11259 }
11620 if (returnValue == null) { 11260 if (returnValue == null) {
11621 return this._makeError(node, target, 'method'); 11261 return this._makeError(node, target, 'method');
11622 } 11262 }
11623 if (returnValue.code == null) { 11263 if (returnValue.code == null) {
11624 if (this.name.startsWith('\$')) { 11264 if (this.name.startsWith('\$')) {
11625 return target.invokeSpecial(this.name, args, returnValue.type); 11265 return target.invokeSpecial(this.name, args, returnValue.type);
11626 } 11266 }
11627 else { 11267 else {
11628 return this.invokeOnVar(context, node, target, args); 11268 return this.invokeOnVar(context, node, target, args);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
11665 ); 11305 );
11666 var returnType = reduce(map(targets, (function (t) { 11306 var returnType = reduce(map(targets, (function (t) {
11667 return t.get$returnType(); 11307 return t.get$returnType();
11668 }) 11308 })
11669 ), lang_Type.union); 11309 ), lang_Type.union);
11670 stub = new VarMethodSet(stubName, targets, args, returnType); 11310 stub = new VarMethodSet(stubName, targets, args, returnType);
11671 world.objectType.varStubs.$setindex(stubName, stub); 11311 world.objectType.varStubs.$setindex(stubName, stub);
11672 } 11312 }
11673 return stub; 11313 return stub;
11674 } 11314 }
11315 MemberSet.prototype.get_$3 = function($0, $1, $2) {
11316 return this.get_($0, $1, $2, false);
11317 }
11318 ;
11675 MemberSet.prototype.invoke$4 = function($0, $1, $2, $3) { 11319 MemberSet.prototype.invoke$4 = function($0, $1, $2, $3) {
11676 return this.invoke($0, $1, $2, $3, true); 11320 return this.invoke($0, $1, $2, $3, false);
11677 } 11321 }
11678 ; 11322 ;
11679 MemberSet.prototype.set_$4 = function($0, $1, $2, $3) { 11323 MemberSet.prototype.set_$4 = function($0, $1, $2, $3) {
11680 return this.set_($0, $1, $2, $3, true); 11324 return this.set_($0, $1, $2, $3, false);
11681 } 11325 }
11682 ; 11326 ;
11683 // ********** Code for FactoryMap ************** 11327 // ********** Code for FactoryMap **************
11684 function FactoryMap() { 11328 function FactoryMap() {
11685 this.factories = $map([]); 11329 this.factories = $map([]);
11686 // Initializers done 11330 // Initializers done
11687 } 11331 }
11688 FactoryMap.prototype.getFactoriesFor = function(typeName) { 11332 FactoryMap.prototype.getFactoriesFor = function(typeName) {
11689 var ret = this.factories.$index(typeName); 11333 var ret = this.factories.$index(typeName);
11690 if (ret == null) { 11334 if (ret == null) {
(...skipping 3364 matching lines...) Expand 10 before | Expand all | Expand 10 after
15055 // ********** Code for TypeReference ************** 14699 // ********** Code for TypeReference **************
15056 function TypeReference(span0, type) { 14700 function TypeReference(span0, type) {
15057 this.type = type; 14701 this.type = type;
15058 lang_Node.call(this, span0); 14702 lang_Node.call(this, span0);
15059 // Initializers done 14703 // Initializers done
15060 } 14704 }
15061 $inherits(TypeReference, lang_Node); 14705 $inherits(TypeReference, lang_Node);
15062 TypeReference.prototype.visit = function(visitor) { 14706 TypeReference.prototype.visit = function(visitor) {
15063 return visitor.visitTypeReference(this); 14707 return visitor.visitTypeReference(this);
15064 } 14708 }
15065 // ********** Code for TreeOutput **************
15066 function TreeOutput() {}
15067 TreeOutput.prototype.write = function(s) {
15068 for (var i = 0;
15069 i < this.depth; i++) {
15070 this.buf.add(' ');
15071 }
15072 this.buf.add(s);
15073 }
15074 TreeOutput.prototype.writeln = function(s) {
15075 this.write(s);
15076 this.buf.add('\n');
15077 }
15078 TreeOutput.prototype.heading = function(name, span) {
15079 this.buf.add(name);
15080 this.buf.add('\n');
15081 }
15082 TreeOutput.prototype.toValue = function(value) {
15083 if (value == null) return 'null';
15084 else if ((value instanceof lang_Identifier)) return value.get$name();
15085 else return value.toString();
15086 }
15087 TreeOutput.prototype.writeNode = function(label, node) {
15088 this.write(label + ': ');
15089 this.depth += 1;
15090 if (node != null) node.visit(this.printer);
15091 else this.writeln('null');
15092 this.depth -= 1;
15093 }
15094 TreeOutput.prototype.writeValue = function(label, value) {
15095 var v = this.toValue(value);
15096 this.writeln(('' + label + ': ' + v + ''));
15097 }
15098 TreeOutput.prototype.writeList = function(label, list) {
15099 this.write(label + ': ');
15100 if (list == null) {
15101 this.buf.add('null');
15102 this.buf.add('\n');
15103 }
15104 else {
15105 for (var $i = 0;$i < list.length; $i++) {
15106 var item = list.$index($i);
15107 this.buf.add(item.toString());
15108 this.buf.add(', ');
15109 }
15110 this.buf.add('\n');
15111 }
15112 }
15113 TreeOutput.prototype.writeNodeList = function(label, list) {
15114 this.writeln(label + ':...');
15115 if (list != null) {
15116 this.depth += 1;
15117 for (var $i = 0;$i < list.length; $i++) {
15118 var node = list.$index($i);
15119 if ($ne(node, null)) {
15120 node.visit(this.printer);
15121 }
15122 else {
15123 this.writeln('null');
15124 }
15125 }
15126 this.depth -= 1;
15127 }
15128 }
15129 // ********** Code for DirectiveDefinition ************** 14709 // ********** Code for DirectiveDefinition **************
15130 function DirectiveDefinition(name, arguments, span0) { 14710 function DirectiveDefinition(name, arguments, span0) {
15131 this.name = name; 14711 this.name = name;
15132 this.arguments = arguments; 14712 this.arguments = arguments;
15133 Definition.call(this, span0); 14713 Definition.call(this, span0);
15134 // Initializers done 14714 // Initializers done
15135 } 14715 }
15136 $inherits(DirectiveDefinition, Definition); 14716 $inherits(DirectiveDefinition, Definition);
15137 DirectiveDefinition.prototype.get$name = function() { return this.name; }; 14717 DirectiveDefinition.prototype.get$name = function() { return this.name; };
15138 DirectiveDefinition.prototype.set$name = function(value) { return this.name = va lue; }; 14718 DirectiveDefinition.prototype.set$name = function(value) { return this.name = va lue; };
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
15748 this.name = name; 15328 this.name = name;
15749 lang_Expression.call(this, span0); 15329 lang_Expression.call(this, span0);
15750 // Initializers done 15330 // Initializers done
15751 } 15331 }
15752 $inherits(DeclaredIdentifier, lang_Expression); 15332 $inherits(DeclaredIdentifier, lang_Expression);
15753 DeclaredIdentifier.prototype.get$name = function() { return this.name; }; 15333 DeclaredIdentifier.prototype.get$name = function() { return this.name; };
15754 DeclaredIdentifier.prototype.set$name = function(value) { return this.name = val ue; }; 15334 DeclaredIdentifier.prototype.set$name = function(value) { return this.name = val ue; };
15755 DeclaredIdentifier.prototype.visit = function(visitor) { 15335 DeclaredIdentifier.prototype.visit = function(visitor) {
15756 return visitor.visitDeclaredIdentifier(this); 15336 return visitor.visitDeclaredIdentifier(this);
15757 } 15337 }
15758 // ********** Code for TreePrinter **************
15759 function TreePrinter() {}
15760 TreePrinter.prototype.visitDirectiveDefinition = function(node) {
15761 this.output.heading('DirectiveDefinition', node.span);
15762 this.output.writeNode('name', node.name);
15763 this.output.writeNodeList('arguments', node.arguments);
15764 }
15765 TreePrinter.prototype.visitTypeDefinition = function(node) {
15766 this.output.heading('TypeDefinition', node.span);
15767 this.output.writeValue('isClass', node.isClass);
15768 this.output.writeNode('name', node.name);
15769 this.output.writeList('typeParameters', node.typeParameters);
15770 this.output.writeNodeList('extendsTypes', node.extendsTypes);
15771 this.output.writeNodeList('implementsTypes', node.implementsTypes);
15772 this.output.writeValue('nativeType', node.nativeType);
15773 this.output.writeNode('factoryType', node.factoryType);
15774 this.output.writeNodeList('body', node.body);
15775 }
15776 TreePrinter.prototype.visitFunctionTypeDefinition = function(node) {
15777 this.output.heading('FunctionTypeDefinition', node.span);
15778 this.output.writeNode('func', node.func);
15779 this.output.writeList('typeParameters', node.typeParameters);
15780 }
15781 TreePrinter.prototype.visitVariableDefinition = function(node) {
15782 this.output.heading('VariableDefinition', node.span);
15783 this.output.writeList('modifiers', node.modifiers);
15784 this.output.writeNode('type', node.type);
15785 this.output.writeNodeList('names', node.names);
15786 this.output.writeNodeList('values', node.values);
15787 }
15788 TreePrinter.prototype.visitFunctionDefinition = function(node) {
15789 this.output.heading('FunctionDefinition', node.span);
15790 this.output.writeList('modifiers', node.modifiers);
15791 this.output.writeNode('returnType', node.returnType);
15792 this.output.writeNode('name', node.name);
15793 this.output.writeNodeList('formals', node.formals);
15794 this.output.writeNodeList('initializers', node.initializers);
15795 this.output.writeNode('body', node.body);
15796 }
15797 TreePrinter.prototype.visitReturnStatement = function(node) {
15798 this.output.heading('ReturnStatement', node.span);
15799 this.output.writeNode('value', node.value);
15800 }
15801 TreePrinter.prototype.visitThrowStatement = function(node) {
15802 this.output.heading('ThrowStatement', node.span);
15803 this.output.writeNode('value', node.value);
15804 }
15805 TreePrinter.prototype.visitAssertStatement = function(node) {
15806 this.output.heading('AssertStatement', node.span);
15807 this.output.writeNode('test', node.test);
15808 }
15809 TreePrinter.prototype.visitBreakStatement = function(node) {
15810 this.output.heading('BreakStatement(' + this.output.toValue(node.label) + ")", node.span);
15811 }
15812 TreePrinter.prototype.visitContinueStatement = function(node) {
15813 this.output.heading('ContinueStatement(' + this.output.toValue(node.label) + " )", node.span);
15814 }
15815 TreePrinter.prototype.visitIfStatement = function(node) {
15816 this.output.heading('IfStatement', node.span);
15817 this.output.writeNode('test', node.test);
15818 this.output.writeNode('trueBranch', node.trueBranch);
15819 this.output.writeNode('falseBranch', node.falseBranch);
15820 }
15821 TreePrinter.prototype.visitWhileStatement = function(node) {
15822 this.output.heading('WhileStatement', node.span);
15823 this.output.writeNode('test', node.test);
15824 this.output.writeNode('body', node.body);
15825 }
15826 TreePrinter.prototype.visitDoStatement = function(node) {
15827 this.output.heading('DoStatement', node.span);
15828 this.output.writeNode('body', node.body);
15829 this.output.writeNode('test', node.test);
15830 }
15831 TreePrinter.prototype.visitForStatement = function(node) {
15832 this.output.heading('ForStatement', node.span);
15833 this.output.writeNode('init', node.init);
15834 this.output.writeNode('test', node.test);
15835 this.output.writeNodeList('step', node.step);
15836 this.output.writeNode('body', node.body);
15837 }
15838 TreePrinter.prototype.visitForInStatement = function(node) {
15839 this.output.heading('ForInStatement', node.span);
15840 this.output.writeNode('item', node.item);
15841 this.output.writeNode('list', node.list);
15842 this.output.writeNode('body', node.body);
15843 }
15844 TreePrinter.prototype.visitTryStatement = function(node) {
15845 this.output.heading('TryStatement', node.span);
15846 this.output.writeNode('body', node.body);
15847 this.output.writeNodeList('catches', node.catches);
15848 this.output.writeNode('finallyBlock', node.finallyBlock);
15849 }
15850 TreePrinter.prototype.visitSwitchStatement = function(node) {
15851 this.output.heading('SwitchStatement', node.span);
15852 this.output.writeNode('test', node.test);
15853 this.output.writeNodeList('cases', node.cases);
15854 }
15855 TreePrinter.prototype.visitBlockStatement = function(node) {
15856 this.output.heading('BlockStatement', node.span);
15857 this.output.writeNodeList('body', node.body);
15858 }
15859 TreePrinter.prototype.visitLabeledStatement = function(node) {
15860 this.output.heading('LabeledStatement', node.span);
15861 this.output.writeNode('name', node.name);
15862 this.output.writeNode('body', node.body);
15863 }
15864 TreePrinter.prototype.visitExpressionStatement = function(node) {
15865 this.output.heading('ExpressionStatement', node.span);
15866 this.output.writeNode('body', node.body);
15867 }
15868 TreePrinter.prototype.visitEmptyStatement = function(node) {
15869 this.output.heading('EmptyStatement', node.span);
15870 }
15871 TreePrinter.prototype.visitDietStatement = function(node) {
15872 this.output.heading('DietStatement', node.span);
15873 }
15874 TreePrinter.prototype.visitNativeStatement = function(node) {
15875 this.output.heading('NativeStatement(' + this.output.toValue(node.body) + ")", node.span);
15876 }
15877 TreePrinter.prototype.visitLambdaExpression = function(node) {
15878 this.output.heading('LambdaExpression', node.span);
15879 this.output.writeNode('func', node.func);
15880 }
15881 TreePrinter.prototype.visitCallExpression = function(node) {
15882 this.output.heading('CallExpression', node.span);
15883 this.output.writeNode('target', node.target);
15884 this.output.writeNodeList('arguments', node.arguments);
15885 }
15886 TreePrinter.prototype.visitIndexExpression = function(node) {
15887 this.output.heading('IndexExpression', node.span);
15888 this.output.writeNode('target', node.target);
15889 this.output.writeNode('index', node.index);
15890 }
15891 TreePrinter.prototype.visitBinaryExpression = function(node) {
15892 this.output.heading('BinaryExpression', node.span);
15893 this.output.writeValue('op', node.op);
15894 this.output.writeNode('x', node.x);
15895 this.output.writeNode('y', node.y);
15896 }
15897 TreePrinter.prototype.visitUnaryExpression = function(node) {
15898 this.output.heading('UnaryExpression', node.span);
15899 this.output.writeValue('op', node.op);
15900 this.output.writeNode('self', node.self);
15901 }
15902 TreePrinter.prototype.visitPostfixExpression = function(node) {
15903 this.output.heading('PostfixExpression', node.span);
15904 this.output.writeNode('body', node.body);
15905 this.output.writeValue('op', node.op);
15906 }
15907 TreePrinter.prototype.visitNewExpression = function(node) {
15908 this.output.heading('NewExpression', node.span);
15909 this.output.writeValue('isConst', node.isConst);
15910 this.output.writeNode('type', node.type);
15911 this.output.writeNode('name', node.name);
15912 this.output.writeNodeList('arguments', node.arguments);
15913 }
15914 TreePrinter.prototype.visitListExpression = function(node) {
15915 this.output.heading('ListExpression', node.span);
15916 this.output.writeValue('isConst', node.isConst);
15917 this.output.writeNode('type', node.type);
15918 this.output.writeNodeList('values', node.values);
15919 }
15920 TreePrinter.prototype.visitMapExpression = function(node) {
15921 this.output.heading('MapExpression', node.span);
15922 this.output.writeValue('isConst', node.isConst);
15923 this.output.writeNode('type', node.type);
15924 this.output.writeNodeList('items', node.items);
15925 }
15926 TreePrinter.prototype.visitConditionalExpression = function(node) {
15927 this.output.heading('ConditionalExpression', node.span);
15928 this.output.writeNode('test', node.test);
15929 this.output.writeNode('trueBranch', node.trueBranch);
15930 this.output.writeNode('falseBranch', node.falseBranch);
15931 }
15932 TreePrinter.prototype.visitIsExpression = function(node) {
15933 this.output.heading('IsExpression', node.span);
15934 this.output.writeValue('isTrue', node.isTrue);
15935 this.output.writeNode('x', node.x);
15936 this.output.writeNode('type', node.type);
15937 }
15938 TreePrinter.prototype.visitParenExpression = function(node) {
15939 this.output.heading('ParenExpression', node.span);
15940 this.output.writeNode('body', node.body);
15941 }
15942 TreePrinter.prototype.visitDotExpression = function(node) {
15943 this.output.heading('DotExpression', node.span);
15944 this.output.writeNode('self', node.self);
15945 this.output.writeNode('name', node.name);
15946 }
15947 TreePrinter.prototype.visitVarExpression = function(node) {
15948 this.output.heading('VarExpression(' + this.output.toValue(node.name) + ")", n ode.span);
15949 }
15950 TreePrinter.prototype.visitThisExpression = function(node) {
15951 this.output.heading('ThisExpression', node.span);
15952 }
15953 TreePrinter.prototype.visitSuperExpression = function(node) {
15954 this.output.heading('SuperExpression', node.span);
15955 }
15956 TreePrinter.prototype.visitNullExpression = function(node) {
15957 this.output.heading('NullExpression', node.span);
15958 }
15959 TreePrinter.prototype.visitLiteralExpression = function(node) {
15960 this.output.heading('LiteralExpression', node.span);
15961 this.output.writeValue('value', node.value);
15962 this.output.writeNode('type', node.type);
15963 this.output.writeValue('text', node.text);
15964 }
15965 TreePrinter.prototype.visitNameTypeReference = function(node) {
15966 this.output.heading('NameTypeReference', node.span);
15967 this.output.writeValue('isFinal', node.isFinal);
15968 this.output.writeNode('name', node.name);
15969 this.output.writeNodeList('names', node.names);
15970 }
15971 TreePrinter.prototype.visitGenericTypeReference = function(node) {
15972 this.output.heading('GenericTypeReference', node.span);
15973 this.output.writeNode('baseType', node.baseType);
15974 this.output.writeNodeList('typeArguments', node.typeArguments);
15975 this.output.writeValue('depth', node.depth);
15976 }
15977 TreePrinter.prototype.visitFunctionTypeReference = function(node) {
15978 this.output.heading('FunctionTypeReference', node.span);
15979 this.output.writeValue('isFinal', node.isFinal);
15980 this.output.writeNode('func', node.func);
15981 }
15982 TreePrinter.prototype.visitArgumentNode = function(node) {
15983 this.output.heading('ArgumentNode', node.span);
15984 this.output.writeNode('label', node.label);
15985 this.output.writeNode('value', node.value);
15986 }
15987 TreePrinter.prototype.visitFormalNode = function(node) {
15988 this.output.heading('FormalNode', node.span);
15989 this.output.writeValue('isThis', node.isThis);
15990 this.output.writeValue('isRest', node.isRest);
15991 this.output.writeNode('type', node.type);
15992 this.output.writeNode('name', node.name);
15993 this.output.writeNode('value', node.value);
15994 }
15995 TreePrinter.prototype.visitCatchNode = function(node) {
15996 this.output.heading('CatchNode', node.span);
15997 this.output.writeNode('exception', node.exception);
15998 this.output.writeNode('trace', node.trace);
15999 this.output.writeNode('body', node.body);
16000 }
16001 TreePrinter.prototype.visitCaseNode = function(node) {
16002 this.output.heading('CaseNode', node.span);
16003 this.output.writeNode('label', node.label);
16004 this.output.writeNodeList('cases', node.cases);
16005 this.output.writeNodeList('statements', node.statements);
16006 }
16007 TreePrinter.prototype.visitTypeParameter = function(node) {
16008 this.output.heading('TypeParameter', node.span);
16009 this.output.writeNode('name', node.name);
16010 this.output.writeNode('extendsType', node.extendsType);
16011 }
16012 TreePrinter.prototype.visitIdentifier = function(node) {
16013 this.output.heading('Identifier(' + this.output.toValue(node.name) + ")", node .span);
16014 }
16015 TreePrinter.prototype.visitDeclaredIdentifier = function(node) {
16016 this.output.heading('DeclaredIdentifier', node.span);
16017 this.output.writeNode('type', node.type);
16018 this.output.writeNode('name', node.name);
16019 }
16020 TreePrinter.prototype.visitTypeReference = function(node) {
16021 this.output.heading('TypeReference(' + this.output.toValue(node.type) + ")", n ode.span);
16022 }
16023 TreePrinter.prototype.visitPostfixExpression$1 = TreePrinter.prototype.visitPost fixExpression;
16024 // ********** Code for lang_Type ************** 15338 // ********** Code for lang_Type **************
16025 function lang_Type(name) { 15339 function lang_Type(name) {
16026 this.name = name; 15340 this.name = name;
16027 this.isTested = false; 15341 this.isTested = false;
16028 // Initializers done 15342 // Initializers done
16029 } 15343 }
16030 lang_Type.prototype.get$name = function() { return this.name; }; 15344 lang_Type.prototype.get$name = function() { return this.name; };
16031 lang_Type.prototype.markUsed = function() { 15345 lang_Type.prototype.markUsed = function() {
16032 15346
16033 } 15347 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
16227 } 15541 }
16228 ParameterType.prototype.get$library = function() { 15542 ParameterType.prototype.get$library = function() {
16229 return null; 15543 return null;
16230 } 15544 }
16231 ParameterType.prototype.get$span = function() { 15545 ParameterType.prototype.get$span = function() {
16232 return this.typeParameter.span; 15546 return this.typeParameter.span;
16233 } 15547 }
16234 ParameterType.prototype.getCallMethod = function() { 15548 ParameterType.prototype.getCallMethod = function() {
16235 return this.extendsType.getCallMethod(); 15549 return this.extendsType.getCallMethod();
16236 } 15550 }
15551 ParameterType.prototype.genMethod = function(method) {
15552 this.extendsType.genMethod(method);
15553 }
16237 ParameterType.prototype.isSubtypeOf = function(child) { 15554 ParameterType.prototype.isSubtypeOf = function(child) {
16238 return true; 15555 return true;
16239 } 15556 }
16240 ParameterType.prototype.resolveMember = function(memberName) { 15557 ParameterType.prototype.resolveMember = function(memberName) {
16241 return this.extendsType.resolveMember(memberName); 15558 return this.extendsType.resolveMember(memberName);
16242 } 15559 }
16243 ParameterType.prototype.getConstructor = function(constructorName) { 15560 ParameterType.prototype.getConstructor = function(constructorName) {
16244 world.internalError('no constructors on type parameters yet'); 15561 world.internalError('no constructors on type parameters yet');
16245 } 15562 }
16246 ParameterType.prototype.resolveTypeParams = function(inType) { 15563 ParameterType.prototype.resolveTypeParams = function(inType) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
16328 var myMember = this.members.$index(memberName); 15645 var myMember = this.members.$index(memberName);
16329 if ($ne(myMember, null)) { 15646 if ($ne(myMember, null)) {
16330 result.$setindex(memberName, myMember); 15647 result.$setindex(memberName, myMember);
16331 } 15648 }
16332 } 15649 }
16333 return result; 15650 return result;
16334 } 15651 }
16335 ConcreteType.prototype.markUsed = function() { 15652 ConcreteType.prototype.markUsed = function() {
16336 this.genericType.markUsed(); 15653 this.genericType.markUsed();
16337 } 15654 }
15655 ConcreteType.prototype.genMethod = function(method) {
15656 this.genericType.genMethod(method);
15657 }
16338 ConcreteType.prototype.getFactory = function(type, constructorName) { 15658 ConcreteType.prototype.getFactory = function(type, constructorName) {
16339 return this.genericType.getFactory(type, constructorName); 15659 return this.genericType.getFactory(type, constructorName);
16340 } 15660 }
16341 ConcreteType.prototype.getConstructor = function(constructorName) { 15661 ConcreteType.prototype.getConstructor = function(constructorName) {
16342 var ret = this.constructors.$index(constructorName); 15662 var ret = this.constructors.$index(constructorName);
16343 if ($ne(ret, null)) return ret; 15663 if ($ne(ret, null)) return ret;
16344 ret = this.factories.getFactory(this.name, constructorName); 15664 ret = this.factories.getFactory(this.name, constructorName);
16345 if ($ne(ret, null)) return ret; 15665 if ($ne(ret, null)) return ret;
16346 var genericMember = this.genericType.getConstructor(constructorName); 15666 var genericMember = this.genericType.getConstructor(constructorName);
16347 if (genericMember == null) return null; 15667 if (genericMember == null) return null;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
16485 } 15805 }
16486 DefinedType.prototype.getCallMethod = function() { 15806 DefinedType.prototype.getCallMethod = function() {
16487 return this.members.$index('\$call'); 15807 return this.members.$index('\$call');
16488 } 15808 }
16489 DefinedType.prototype.getAllMembers = function() { 15809 DefinedType.prototype.getAllMembers = function() {
16490 return HashMapImplementation.HashMapImplementation$from$factory(this.members); 15810 return HashMapImplementation.HashMapImplementation$from$factory(this.members);
16491 } 15811 }
16492 DefinedType.prototype.markUsed = function() { 15812 DefinedType.prototype.markUsed = function() {
16493 if (this.isUsed) return; 15813 if (this.isUsed) return;
16494 this.isUsed = true; 15814 this.isUsed = true;
15815 if (this._lazyGenMethods != null) {
15816 var $list = orderValuesByKeys(this._lazyGenMethods);
15817 for (var $i = 0;$i < $list.length; $i++) {
15818 var method = $list.$index($i);
15819 world.gen.genMethod(method);
15820 }
15821 this._lazyGenMethods = null;
15822 }
16495 if (this.parent != null) this.parent.markUsed(); 15823 if (this.parent != null) this.parent.markUsed();
16496 } 15824 }
15825 DefinedType.prototype.genMethod = function(method) {
15826 if (this.isUsed) {
15827 world.gen.genMethod(method);
15828 }
15829 else if (this.isClass) {
15830 if (this._lazyGenMethods == null) this._lazyGenMethods = $map([]);
15831 this._lazyGenMethods.$setindex(method.name, method);
15832 }
15833 }
16497 DefinedType.prototype._resolveInterfaces = function(types) { 15834 DefinedType.prototype._resolveInterfaces = function(types) {
16498 if (types == null) return []; 15835 if (types == null) return [];
16499 var interfaces0 = []; 15836 var interfaces0 = [];
16500 for (var $i = 0;$i < types.length; $i++) { 15837 for (var $i = 0;$i < types.length; $i++) {
16501 var type = types.$index($i); 15838 var type = types.$index($i);
16502 var resolvedInterface = this.resolveType(type, true); 15839 var resolvedInterface = this.resolveType(type, true);
16503 if (resolvedInterface.get$isClosed() && !(this.library.get$isCore() || this. library.get$isCoreImpl())) { 15840 if (resolvedInterface.get$isClosed() && !(this.library.get$isCore() || this. library.get$isCoreImpl())) {
16504 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span()); 15841 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span());
16505 } 15842 }
16506 resolvedInterface.addDirectSubtype(this); 15843 resolvedInterface.addDirectSubtype(this);
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
17030 this.isType = isType; 16367 this.isType = isType;
17031 // Initializers done 16368 // Initializers done
17032 if (this.type == null) this.type = world.varType; 16369 if (this.type == null) this.type = world.varType;
17033 } 16370 }
17034 Value.prototype.get$isConst = function() { 16371 Value.prototype.get$isConst = function() {
17035 return false; 16372 return false;
17036 } 16373 }
17037 Value.prototype.get_ = function(context, name, node) { 16374 Value.prototype.get_ = function(context, name, node) {
17038 var member = this._resolveMember(context, name, node); 16375 var member = this._resolveMember(context, name, node);
17039 if ($ne(member, null)) { 16376 if ($ne(member, null)) {
17040 member = member.get_(context, node, this); 16377 member = member.get_$3(context, node, this);
17041 } 16378 }
17042 if ($ne(member, null)) { 16379 if ($ne(member, null)) {
17043 return member; 16380 return member;
17044 } 16381 }
17045 else { 16382 else {
17046 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node); 16383 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node);
17047 } 16384 }
17048 } 16385 }
17049 Value.prototype.set_ = function(context, name, node, value, checked) { 16386 Value.prototype.set_ = function(context, name, node, value, isDynamic) {
17050 var member = this._resolveMember(context, name, node); 16387 var member = this._resolveMember(context, name, node);
17051 if ($ne(member, null)) { 16388 if ($ne(member, null)) {
17052 member = member.set_(context, node, this, value, checked); 16389 member = member.set_(context, node, this, value, isDynamic);
17053 } 16390 }
17054 if ($ne(member, null)) { 16391 if ($ne(member, null)) {
17055 return member; 16392 return member;
17056 } 16393 }
17057 else { 16394 else {
17058 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value])); 16395 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value]));
17059 } 16396 }
17060 } 16397 }
17061 Value.prototype.invoke = function(context, name, node, args, checked) { 16398 Value.prototype.invoke = function(context, name, node, args, isDynamic) {
17062 if (this.type.get$isVar() && name == '\$ne') { 16399 if (this.type.get$isVar() && name == '\$ne') {
17063 if (args.values.length != 1) { 16400 if (args.values.length != 1) {
17064 world.warning('wrong number of arguments for !=', node.span); 16401 world.warning('wrong number of arguments for !=', node.span);
17065 } 16402 }
17066 return new Value(null, ('\$ne(' + this.code + ', ' + args.values.$index(0).c ode + ')'), false, true, false); 16403 return new Value(null, ('\$ne(' + this.code + ', ' + args.values.$index(0).c ode + ')'), false, true, false);
17067 } 16404 }
17068 if (name == '\$call') { 16405 if (name == '\$call') {
17069 if (this.isType) { 16406 if (this.isType) {
17070 world.error('must use "new" or "const" to construct a new instance', node. span); 16407 world.error('must use "new" or "const" to construct a new instance', node. span);
17071 } 16408 }
17072 if (this.type.needsVarCall(args)) { 16409 if (this.type.needsVarCall(args)) {
17073 return this._varCall(context, args); 16410 return this._varCall(context, args);
17074 } 16411 }
17075 } 16412 }
17076 var member = this._resolveMember(context, name, node); 16413 var member = this._resolveMember(context, name, node);
17077 if (member == null) { 16414 if (member == null) {
17078 return this.invokeNoSuchMethod(context, name, node, args); 16415 return this.invokeNoSuchMethod(context, name, node, args);
17079 } 16416 }
17080 else { 16417 else {
17081 return member.invoke(context, node, this, args, checked); 16418 return member.invoke(context, node, this, args, isDynamic);
17082 } 16419 }
17083 } 16420 }
17084 Value.prototype.canInvoke = function(context, name, args) { 16421 Value.prototype.canInvoke = function(context, name, args) {
17085 if (this.type.get$isVar() && name == '\$ne') { 16422 if (this.type.get$isVar() && name == '\$ne') {
17086 return true; 16423 return true;
17087 } 16424 }
17088 if (this.type.get$isVarOrFunction() && name == '\$call') { 16425 if (this.type.get$isVarOrFunction() && name == '\$call') {
17089 return true; 16426 return true;
17090 } 16427 }
17091 var member = this._tryResolveMember(context, name); 16428 var member = this._tryResolveMember(context, name);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
17128 } 16465 }
17129 Value.prototype.checkFirstClass = function(span) { 16466 Value.prototype.checkFirstClass = function(span) {
17130 if (this.isType) { 16467 if (this.isType) {
17131 world.error('Types are not first class', span); 16468 world.error('Types are not first class', span);
17132 } 16469 }
17133 } 16470 }
17134 Value.prototype._varCall = function(context, args) { 16471 Value.prototype._varCall = function(context, args) {
17135 var stub = world.functionType.getCallStub(args); 16472 var stub = world.functionType.getCallStub(args);
17136 return new Value(null, ('' + this.code + '.' + stub.get$name() + '(' + args.ge tCode() + ')'), false, true, false); 16473 return new Value(null, ('' + this.code + '.' + stub.get$name() + '(' + args.ge tCode() + ')'), false, true, false);
17137 } 16474 }
17138 Value.prototype.convertTo = function(context, toType, node, checked) { 16475 Value.prototype.convertTo = function(context, toType, node, isDynamic) {
16476 var checked = options.enableTypeChecks && !isDynamic;
17139 var callMethod = toType.getCallMethod(); 16477 var callMethod = toType.getCallMethod();
17140 if ($ne(callMethod, null)) { 16478 if ($ne(callMethod, null)) {
17141 if (checked && options.enableTypeChecks && !toType.isAssignable(this.type)) { 16479 if (checked && !toType.isAssignable(this.type)) {
17142 this.convertWarning(toType, node); 16480 this.convertWarning(toType, node);
17143 } 16481 }
17144 var arity = callMethod.get$parameters().length; 16482 var arity = callMethod.get$parameters().length;
17145 var myCall = this.type.getCallMethod(); 16483 var myCall = this.type.getCallMethod();
17146 if (myCall == null || myCall.get$parameters().length != arity) { 16484 if (myCall == null || myCall.get$parameters().length != arity) {
17147 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory (arity)); 16485 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory (arity));
17148 return new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), fal se, true, false); 16486 return new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), fal se, true, false);
17149 } 16487 }
17150 } 16488 }
17151 if (!options.enableTypeChecks) { 16489 if (!options.enableTypeChecks) {
17152 return this; 16490 return this;
17153 } 16491 }
17154 if (this.type.isSubtypeOf(toType)) { 16492 if (this.type.isSubtypeOf(toType)) {
17155 return this; 16493 return this;
17156 } 16494 }
17157 else if (checked && !toType.isSubtypeOf(this.type)) { 16495 else if (checked && !toType.isSubtypeOf(this.type)) {
17158 this.convertWarning(toType, node); 16496 this.convertWarning(toType, node);
17159 } 16497 }
16498 return this._typeAssert(context, toType, node);
16499 }
16500 Value.prototype._typeAssert = function(context, toType, node) {
16501 if ((toType instanceof ParameterType)) {
16502 var p = toType;
16503 toType = p.extendsType;
16504 }
17160 var temp = context.getTemp(this); 16505 var temp = context.getTemp(this);
17161 var test = context.assignTemp(temp, this); 16506 var testCode;
17162 test = test.instanceOf(context, toType, node.span, true, false); 16507 if (toType.get$library().get$isCore() && toType.get$typeofName() != null) {
16508 testCode = ("typeof(" + temp.code + ") == '" + toType.get$typeofName() + "'" );
16509 }
16510 else if (toType.get$isClass() && !(toType instanceof ConcreteType)) {
16511 toType.markUsed();
16512 testCode = ('' + temp.code + ' instanceof ' + toType.get$jsname() + '');
16513 }
16514 else {
16515 toType.isTested = true;
16516 testCode = ('' + temp.code + '.is\$' + toType.get$jsname() + '');
16517 }
16518 testCode = ('(' + context.assignTemp(temp, this).code + ' == null || ' + testC ode + ')');
16519 var test = new Value(world.boolType, testCode, false, true, false);
17163 var err = world.corelib.types.$index('TypeError'); 16520 var err = world.corelib.types.$index('TypeError');
17164 world.gen.genMethod(err.members.$index('toString')); 16521 world.gen.genMethod(err.members.$index('toString'));
17165 var args = new Arguments(null, [temp, new Value(world.stringType, ('"' + toTyp e.name + '"'), false, true, false)]); 16522 var args = new Arguments(null, [temp, new Value(world.stringType, ('"' + toTyp e.name + '"'), false, true, false)]);
17166 var typeErr = err.getConstructor('').invoke$4(context, node, null, args); 16523 var typeErr = err.getConstructor('').invoke$4(context, node, null, args);
17167 var result = new Value(toType, ('(' + test.code + ' ? ' + temp.code + ' : ') + ('\$throw(' + typeErr.code + '))'), false, true, false); 16524 var result = new Value(toType, ('(' + test.code + ' ? ' + temp.code + ' : ') + ('\$throw(' + typeErr.code + '))'), false, true, false);
17168 if ($ne(temp, this)) context.freeTemp(temp); 16525 if ($ne(temp, this)) context.freeTemp(temp);
17169 return result; 16526 return result;
17170 } 16527 }
17171 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) { 16528 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) {
17172 if (toType.get$isVar()) { 16529 if (toType.get$isVar()) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
17224 Value.prototype.invokeSpecial = function(name, args, returnType) { 16581 Value.prototype.invokeSpecial = function(name, args, returnType) {
17225 var argsString = args.getCode(); 16582 var argsString = args.getCode();
17226 if (name == '\$index' || name == '\$setindex') { 16583 if (name == '\$index' || name == '\$setindex') {
17227 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), false, true, false); 16584 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), false, true, false);
17228 } 16585 }
17229 else { 16586 else {
17230 if (argsString.length > 0) argsString = (', ' + argsString + ''); 16587 if (argsString.length > 0) argsString = (', ' + argsString + '');
17231 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), false, true, false); 16588 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), false, true, false);
17232 } 16589 }
17233 } 16590 }
16591 Value.prototype.get_$3 = Value.prototype.get_;
17234 Value.prototype.invoke$4 = function($0, $1, $2, $3) { 16592 Value.prototype.invoke$4 = function($0, $1, $2, $3) {
17235 return this.invoke($0, $1, $2, $3, true); 16593 return this.invoke($0, $1, $2, $3, false);
17236 } 16594 }
17237 ; 16595 ;
17238 Value.prototype.set_$4 = function($0, $1, $2, $3) { 16596 Value.prototype.set_$4 = function($0, $1, $2, $3) {
17239 return this.set_($0, $1, $2, $3, true); 16597 return this.set_($0, $1, $2, $3, false);
17240 } 16598 }
17241 ; 16599 ;
17242 // ********** Code for EvaluatedValue ************** 16600 // ********** Code for EvaluatedValue **************
17243 function EvaluatedValue() {} 16601 function EvaluatedValue() {}
17244 EvaluatedValue._internal$ctor = function(type0, actualValue, canonicalCode, orig inal, code0) { 16602 EvaluatedValue._internal$ctor = function(type0, actualValue, canonicalCode, orig inal, code0) {
17245 this.actualValue = actualValue; 16603 this.actualValue = actualValue;
17246 this.canonicalCode = canonicalCode; 16604 this.canonicalCode = canonicalCode;
17247 this.original = original; 16605 this.original = original;
17248 Value.call(this, type0, code0, false, false, false); 16606 Value.call(this, type0, code0, false, false, false);
17249 // Initializers done 16607 // Initializers done
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
18118 function to$call$1(f) { return f && f.to$call$1(); } 17476 function to$call$1(f) { return f && f.to$call$1(); }
18119 Function.prototype.to$call$2 = function() { 17477 Function.prototype.to$call$2 = function() {
18120 this.call$2 = this.$genStub(2); 17478 this.call$2 = this.$genStub(2);
18121 this.to$call$2 = function() { return this.call$2; }; 17479 this.to$call$2 = function() { return this.call$2; };
18122 return this.call$2; 17480 return this.call$2;
18123 }; 17481 };
18124 Function.prototype.call$2 = function($0, $1) { 17482 Function.prototype.call$2 = function($0, $1) {
18125 return this.to$call$2()($0, $1); 17483 return this.to$call$2()($0, $1);
18126 }; 17484 };
18127 function to$call$2(f) { return f && f.to$call$2(); } 17485 function to$call$2(f) { return f && f.to$call$2(); }
18128 var const$0 = new IllegalAccessException()/*const IllegalAccessException()*/; 17486 var const$1 = new StringWrapper('global scope')/*const SourceString('global scop e')*/;
18129 var const$128 = new Keyword("true", false)/*const Keyword("true")*/; 17487 var const$133 = new Keyword("break", false)/*const Keyword("break")*/;
18130 var const$130 = new Keyword("false", false)/*const Keyword("false")*/; 17488 var const$135 = new Keyword("case", false)/*const Keyword("case")*/;
18131 var const$134 = new StringWrapper('\$add')/*const SourceString('\$add')*/; 17489 var const$137 = new Keyword("catch", false)/*const Keyword("catch")*/;
18132 var const$135 = new LinkTail()/*const EmptyLink<Expression>()*/; 17490 var const$139 = new Keyword("const", false)/*const Keyword("const")*/;
18133 var const$136 = new Keyword("void", false)/*const Keyword("void")*/; 17491 var const$141 = new Keyword("continue", false)/*const Keyword("continue")*/;
18134 var const$138 = new StringWrapper("<")/*const SourceString("<")*/; 17492 var const$143 = new Keyword("default", false)/*const Keyword("default")*/;
18135 var const$139 = new StringWrapper(".")/*const SourceString(".")*/; 17493 var const$145 = new Keyword("do", false)/*const Keyword("do")*/;
18136 var const$14 = ImmutableList.ImmutableList$from$factory([])/*const <HInstruction >[]*/; 17494 var const$147 = new Keyword("else", false)/*const Keyword("else")*/;
18137 var const$143 = new StringWrapper(",")/*const SourceString(",")*/; 17495 var const$149 = new Keyword("false", false)/*const Keyword("false")*/;
18138 var const$144 = new StringWrapper(">")/*const SourceString(">")*/; 17496 var const$151 = new Keyword("final", false)/*const Keyword("final")*/;
18139 var const$145 = new StringWrapper("(")/*const SourceString("(")*/; 17497 var const$153 = new Keyword("finally", false)/*const Keyword("finally")*/;
18140 var const$146 = new StringWrapper(")")/*const SourceString(")")*/; 17498 var const$155 = new Keyword("for", false)/*const Keyword("for")*/;
18141 var const$147 = new StringWrapper(";")/*const SourceString(";")*/; 17499 var const$157 = new Keyword("if", false)/*const Keyword("if")*/;
18142 var const$148 = new StringWrapper("{")/*const SourceString("{")*/; 17500 var const$159 = new Keyword("in", false)/*const Keyword("in")*/;
18143 var const$149 = new StringWrapper("}")/*const SourceString("}")*/; 17501 var const$161 = new Keyword("is", false)/*const Keyword("is")*/;
18144 var const$15 = new NoMoreElementsException()/*const NoMoreElementsException()*/; 17502 var const$163 = new Keyword("new", false)/*const Keyword("new")*/;
18145 var const$150 = new StringWrapper('{')/*const SourceString('{')*/; 17503 var const$165 = new Keyword("null", false)/*const Keyword("null")*/;
18146 var const$151 = new Keyword("return", false)/*const Keyword("return")*/; 17504 var const$167 = new Keyword("return", false)/*const Keyword("return")*/;
18147 var const$153 = new StringWrapper("return")/*const SourceString("return")*/; 17505 var const$169 = new Keyword("super", false)/*const Keyword("super")*/;
18148 var const$16 = new EmptyQueueException()/*const EmptyQueueException()*/; 17506 var const$171 = new Keyword("switch", false)/*const Keyword("switch")*/;
18149 var const$160 = new Keyword("var", false)/*const Keyword("var")*/; 17507 var const$173 = new Keyword("this", false)/*const Keyword("this")*/;
18150 var const$162 = new StringWrapper('=')/*const SourceString('=')*/; 17508 var const$175 = new Keyword("throw", false)/*const Keyword("throw")*/;
18151 var const$163 = new StringWrapper(',')/*const SourceString(',')*/; 17509 var const$177 = new Keyword("true", false)/*const Keyword("true")*/;
18152 var const$164 = new Keyword("if", false)/*const Keyword("if")*/; 17510 var const$179 = new Keyword("try", false)/*const Keyword("try")*/;
18153 var const$166 = new StringWrapper('(')/*const SourceString('(')*/; 17511 var const$181 = new Keyword("var", false)/*const Keyword("var")*/;
18154 var const$167 = new StringWrapper(')')/*const SourceString(')')*/; 17512 var const$183 = new Keyword("void", false)/*const Keyword("void")*/;
18155 var const$168 = new Keyword("else", false)/*const Keyword("else")*/; 17513 var const$185 = new Keyword("while", false)/*const Keyword("while")*/;
18156 var const$170 = new StringWrapper('+')/*const SourceString('+')*/; 17514 var const$187 = new Keyword("abstract", true)/*const Keyword("abstract", true)*/ ;
18157 var const$171 = new StringWrapper('void')/*const SourceString('void')*/; 17515 var const$189 = new Keyword("assert", true)/*const Keyword("assert", true)*/;
18158 var const$172 = new StringWrapper('print')/*const SourceString('print')*/; 17516 var const$191 = new Keyword("class", true)/*const Keyword("class", true)*/;
18159 var const$173 = new StringWrapper('*')/*const SourceString('*')*/; 17517 var const$193 = new Keyword("extends", true)/*const Keyword("extends", true)*/;
18160 var const$175 = new StringWrapper('int')/*const SourceString('int')*/; 17518 var const$195 = new Keyword("factory", true)/*const Keyword("factory", true)*/;
18161 var const$176 = new StringWrapper('Dynamic')/*const SourceString('Dynamic')*/; 17519 var const$197 = new Keyword("get", true)/*const Keyword("get", true)*/;
18162 var const$177 = new StringWrapper('String')/*const SourceString('String')*/; 17520 var const$199 = new Keyword("implements", true)/*const Keyword("implements", tru e)*/;
18163 var const$180 = ImmutableList.ImmutableList$from$factory(['NullPointerException' , 'ObjectNotClosureException', 'NoSuchMethodException', 'StackOverflowException' ])/*const [ 17521 var const$2 = new StringWrapper('main')/*const SourceString('main')*/;
17522 var const$201 = new Keyword("import", true)/*const Keyword("import", true)*/;
17523 var const$203 = new Keyword("interface", true)/*const Keyword("interface", true) */;
17524 var const$205 = new Keyword("library", true)/*const Keyword("library", true)*/;
17525 var const$207 = new Keyword("native", true)/*const Keyword("native", true)*/;
17526 var const$209 = new Keyword("negate", true)/*const Keyword("negate", true)*/;
17527 var const$211 = new Keyword("operator", true)/*const Keyword("operator", true)*/ ;
17528 var const$213 = new Keyword("set", true)/*const Keyword("set", true)*/;
17529 var const$215 = new Keyword("source", true)/*const Keyword("source", true)*/;
17530 var const$217 = new Keyword("static", true)/*const Keyword("static", true)*/;
17531 var const$219 = new Keyword("typedef", true)/*const Keyword("typedef", true)*/;
17532 var const$221 = new IllegalAccessException()/*const IllegalAccessException()*/;
17533 var const$226 = ImmutableList.ImmutableList$from$factory([])/*const []*/;
17534 var const$227 = new LinkTail()/*const EmptyLink<DeclarationBuilder>()*/;
17535 var const$228 = new StringWrapper("<")/*const SourceString("<")*/;
17536 var const$229 = new StringWrapper(".")/*const SourceString(".")*/;
17537 var const$230 = new StringWrapper(",")/*const SourceString(",")*/;
17538 var const$231 = new StringWrapper(">")/*const SourceString(">")*/;
17539 var const$232 = new StringWrapper("{")/*const SourceString("{")*/;
17540 var const$233 = new StringWrapper("string")/*const SourceString("string")*/;
17541 var const$234 = new StringWrapper("(")/*const SourceString("(")*/;
17542 var const$235 = new StringWrapper(")")/*const SourceString(")")*/;
17543 var const$236 = new StringWrapper(";")/*const SourceString(";")*/;
17544 var const$237 = new StringWrapper("#")/*const SourceString("#")*/;
17545 var const$238 = new StringWrapper("=")/*const SourceString("=")*/;
17546 var const$239 = new StringWrapper("}")/*const SourceString("}")*/;
17547 var const$240 = new StringWrapper('{')/*const SourceString('{')*/;
17548 var const$241 = new StringWrapper("return")/*const SourceString("return")*/;
17549 var const$242 = new StringWrapper('=')/*const SourceString('=')*/;
17550 var const$243 = new StringWrapper(',')/*const SourceString(',')*/;
17551 var const$244 = new StringWrapper('(')/*const SourceString('(')*/;
17552 var const$245 = new StringWrapper(')')/*const SourceString(')')*/;
17553 var const$246 = new StringWrapper('void')/*const SourceString('void')*/;
17554 var const$247 = new StringWrapper('int')/*const SourceString('int')*/;
17555 var const$248 = new StringWrapper('Dynamic')/*const SourceString('Dynamic')*/;
17556 var const$249 = new StringWrapper('String')/*const SourceString('String')*/;
17557 var const$250 = new StringWrapper('print')/*const SourceString('print')*/;
17558 var const$251 = new StringWrapper('+')/*const SourceString('+')*/;
17559 var const$252 = new StringWrapper('*')/*const SourceString('*')*/;
17560 var const$255 = new ExceptionImplementation("Internal Error (Leg): UNREACHABLE") /*const Exception("Internal Error (Leg): UNREACHABLE")*/;
17561 var const$256 = new StringWrapper('\$add')/*const SourceString('\$add')*/;
17562 var const$374 = ImmutableList.ImmutableList$from$factory(['NullPointerException' , 'ObjectNotClosureException', 'NoSuchMethodException', 'StackOverflowException' ])/*const [
18164 'NullPointerException', 'ObjectNotClosureException', 17563 'NullPointerException', 'ObjectNotClosureException',
18165 'NoSuchMethodException', 'StackOverflowException']*/; 17564 'NoSuchMethodException', 'StackOverflowException']*/;
18166 var const$181 = new StringWrapper('global scope')/*const SourceString('global sc ope')*/; 17565 var const$4 = new NoMoreElementsException()/*const NoMoreElementsException()*/;
18167 var const$182 = new StringWrapper('main')/*const SourceString('main')*/; 17566 var const$5 = new EmptyQueueException()/*const EmptyQueueException()*/;
18168 var const$303 = new Keyword("break", false)/*const Keyword("break")*/;
18169 var const$305 = new Keyword("case", false)/*const Keyword("case")*/;
18170 var const$307 = new Keyword("catch", false)/*const Keyword("catch")*/;
18171 var const$309 = new Keyword("const", false)/*const Keyword("const")*/;
18172 var const$311 = new Keyword("continue", false)/*const Keyword("continue")*/;
18173 var const$313 = new Keyword("default", false)/*const Keyword("default")*/;
18174 var const$315 = new Keyword("do", false)/*const Keyword("do")*/;
18175 var const$317 = new Keyword("final", false)/*const Keyword("final")*/;
18176 var const$319 = new Keyword("finally", false)/*const Keyword("finally")*/;
18177 var const$321 = new Keyword("for", false)/*const Keyword("for")*/;
18178 var const$323 = new Keyword("in", false)/*const Keyword("in")*/;
18179 var const$325 = new Keyword("is", false)/*const Keyword("is")*/;
18180 var const$327 = new Keyword("new", false)/*const Keyword("new")*/;
18181 var const$329 = new Keyword("null", false)/*const Keyword("null")*/;
18182 var const$331 = new Keyword("super", false)/*const Keyword("super")*/;
18183 var const$333 = new Keyword("switch", false)/*const Keyword("switch")*/;
18184 var const$335 = new Keyword("this", false)/*const Keyword("this")*/;
18185 var const$337 = new Keyword("throw", false)/*const Keyword("throw")*/;
18186 var const$339 = new Keyword("try", false)/*const Keyword("try")*/;
18187 var const$341 = new Keyword("while", false)/*const Keyword("while")*/;
18188 var const$343 = new Keyword("abstract", true)/*const Keyword("abstract", true)*/ ;
18189 var const$345 = new Keyword("assert", true)/*const Keyword("assert", true)*/;
18190 var const$347 = new Keyword("class", true)/*const Keyword("class", true)*/;
18191 var const$349 = new Keyword("extends", true)/*const Keyword("extends", true)*/;
18192 var const$351 = new Keyword("factory", true)/*const Keyword("factory", true)*/;
18193 var const$353 = new Keyword("get", true)/*const Keyword("get", true)*/;
18194 var const$355 = new Keyword("implements", true)/*const Keyword("implements", tru e)*/;
18195 var const$357 = new Keyword("import", true)/*const Keyword("import", true)*/;
18196 var const$359 = new Keyword("interface", true)/*const Keyword("interface", true) */;
18197 var const$361 = new Keyword("library", true)/*const Keyword("library", true)*/;
18198 var const$363 = new Keyword("native", true)/*const Keyword("native", true)*/;
18199 var const$365 = new Keyword("negate", true)/*const Keyword("negate", true)*/;
18200 var const$367 = new Keyword("operator", true)/*const Keyword("operator", true)*/ ;
18201 var const$369 = new Keyword("set", true)/*const Keyword("set", true)*/;
18202 var const$371 = new Keyword("source", true)/*const Keyword("source", true)*/;
18203 var const$373 = new Keyword("static", true)/*const Keyword("static", true)*/;
18204 var const$375 = new Keyword("typedef", true)/*const Keyword("typedef", true)*/;
18205 var const$379 = new StringWrapper("string")/*const SourceString("string")*/;
18206 var const$380 = new StringWrapper("#")/*const SourceString("#")*/;
18207 var const$381 = new StringWrapper("=")/*const SourceString("=")*/;
18208 var const$8 = new ExceptionImplementation("Internal Error (Leg): UNREACHABLE")/* const Exception("Internal Error (Leg): UNREACHABLE")*/;
18209 HTracer._singleton = null; 17567 HTracer._singleton = null;
18210 var const$377 = ImmutableList.ImmutableList$from$factory([const$303, const$305, const$307, const$309, const$311, const$313, const$315, const$168, const$130, con st$317, const$319, const$321, const$164, const$323, const$325, const$327, const$ 329, const$151, const$331, const$333, const$335, const$337, const$128, const$339 , const$160, const$136, const$341, const$343, const$345, const$347, const$349, c onst$351, const$353, const$355, const$357, const$359, const$361, const$363, cons t$365, const$367, const$369, const$371, const$373, const$375])/*const <Keyword> [ 17568 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> [
18211 BREAK, 17569 BREAK,
18212 CASE, 17570 CASE,
18213 CATCH, 17571 CATCH,
18214 CONST, 17572 CONST,
18215 CONTINUE, 17573 CONTINUE,
18216 DEFAULT, 17574 DEFAULT,
18217 DO, 17575 DO,
18218 ELSE, 17576 ELSE,
18219 FALSE, 17577 FALSE,
18220 FINAL, 17578 FINAL,
(...skipping 24 matching lines...) Expand all
18245 IMPORT, 17603 IMPORT,
18246 INTERFACE, 17604 INTERFACE,
18247 LIBRARY, 17605 LIBRARY,
18248 NATIVE, 17606 NATIVE,
18249 NEGATE, 17607 NEGATE,
18250 OPERATOR, 17608 OPERATOR,
18251 SET, 17609 SET,
18252 SOURCE, 17610 SOURCE,
18253 STATIC, 17611 STATIC,
18254 TYPEDEF ]*/; 17612 TYPEDEF ]*/;
18255 main(); 17613 main();
jimhug 2011/11/07 21:14:21 Yay! 600 fewer lines!
OLDNEW
« no previous file with comments | « no previous file | frog/gen.dart » ('j') | frog/gen.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698