| OLD | NEW |
| 1 #!/usr/bin/env node | 1 #!/usr/bin/env node |
| 2 // ********** Library dart:core ************** | 2 // ********** Library dart:core ************** |
| 3 // ********** Natives core.js ************** | 3 // ********** Natives core.js ************** |
| 4 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 4 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 5 // for details. All rights reserved. Use of this source code is governed by a | 5 // for details. All rights reserved. Use of this source code is governed by a |
| 6 // BSD-style license that can be found in the LICENSE file. | 6 // BSD-style license that can be found in the LICENSE file. |
| 7 | 7 |
| 8 // TODO(jimhug): Completeness - see tests/corelib | 8 // TODO(jimhug): Completeness - see tests/corelib |
| 9 | 9 |
| 10 /** Implements extends for dart classes on javascript prototypes. */ | 10 /** Implements extends for dart classes on javascript prototypes. */ |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 // ********** Code for ListIterator ************** | 566 // ********** Code for ListIterator ************** |
| 567 function ListIterator(array) { | 567 function ListIterator(array) { |
| 568 this._array = array; | 568 this._array = array; |
| 569 this._pos = 0; | 569 this._pos = 0; |
| 570 // Initializers done | 570 // Initializers done |
| 571 } | 571 } |
| 572 ListIterator.prototype.hasNext = function() { | 572 ListIterator.prototype.hasNext = function() { |
| 573 return this._array.length > this._pos; | 573 return this._array.length > this._pos; |
| 574 } | 574 } |
| 575 ListIterator.prototype.next = function() { | 575 ListIterator.prototype.next = function() { |
| 576 if ($notnull_bool(!this.hasNext())) { | 576 if ($notnull_bool(!$notnull_bool(this.hasNext()))) { |
| 577 $throw(const$0/*const NoMoreElementsException()*/); | 577 $throw(const$0/*const NoMoreElementsException()*/); |
| 578 } | 578 } |
| 579 return this._array.$index(this._pos++); | 579 return this._array.$index(this._pos++); |
| 580 } | 580 } |
| 581 // ********** Code for ImmutableList ************** | 581 // ********** Code for ImmutableList ************** |
| 582 function ImmutableList(length0) { | 582 function ImmutableList(length0) { |
| 583 this._length = length0; | 583 this._length = length0; |
| 584 ListFactory$E.call(this, length0); | 584 ListFactory$E.call(this, length0); |
| 585 // Initializers done | 585 // Initializers done |
| 586 } | 586 } |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 } | 1177 } |
| 1178 return set; | 1178 return set; |
| 1179 } | 1179 } |
| 1180 HashSetImplementation.prototype.add = function(value) { | 1180 HashSetImplementation.prototype.add = function(value) { |
| 1181 this._backingMap.$setindex(value, value); | 1181 this._backingMap.$setindex(value, value); |
| 1182 } | 1182 } |
| 1183 HashSetImplementation.prototype.contains = function(value) { | 1183 HashSetImplementation.prototype.contains = function(value) { |
| 1184 return this._backingMap.containsKey(value); | 1184 return this._backingMap.containsKey(value); |
| 1185 } | 1185 } |
| 1186 HashSetImplementation.prototype.remove = function(value) { | 1186 HashSetImplementation.prototype.remove = function(value) { |
| 1187 if ($notnull_bool(!this._backingMap.containsKey(value))) return false; | 1187 if ($notnull_bool(!$notnull_bool(this._backingMap.containsKey(value)))) return
false; |
| 1188 this._backingMap.remove(value); | 1188 this._backingMap.remove(value); |
| 1189 return true; | 1189 return true; |
| 1190 } | 1190 } |
| 1191 HashSetImplementation.prototype.addAll = function(collection) { | 1191 HashSetImplementation.prototype.addAll = function(collection) { |
| 1192 var $this = this; // closure support | 1192 var $this = this; // closure support |
| 1193 collection.forEach(function _(value) { | 1193 collection.forEach(function _(value) { |
| 1194 $this.add(value); | 1194 $this.add(value); |
| 1195 } | 1195 } |
| 1196 ); | 1196 ); |
| 1197 } | 1197 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 this._advance(); | 1255 this._advance(); |
| 1256 } | 1256 } |
| 1257 HashSetIterator.prototype.hasNext = function() { | 1257 HashSetIterator.prototype.hasNext = function() { |
| 1258 if ($notnull_bool(this._nextValidIndex >= this._entries.length)) return false; | 1258 if ($notnull_bool(this._nextValidIndex >= this._entries.length)) return false; |
| 1259 if ($notnull_bool(this._entries.$index(this._nextValidIndex) === HashMapImplem
entation._deletedKey)) { | 1259 if ($notnull_bool(this._entries.$index(this._nextValidIndex) === HashMapImplem
entation._deletedKey)) { |
| 1260 this._advance(); | 1260 this._advance(); |
| 1261 } | 1261 } |
| 1262 return this._nextValidIndex < this._entries.length; | 1262 return this._nextValidIndex < this._entries.length; |
| 1263 } | 1263 } |
| 1264 HashSetIterator.prototype.next = function() { | 1264 HashSetIterator.prototype.next = function() { |
| 1265 if ($notnull_bool(!this.hasNext())) { | 1265 if ($notnull_bool(!$notnull_bool(this.hasNext()))) { |
| 1266 $throw(const$0/*const NoMoreElementsException()*/); | 1266 $throw(const$0/*const NoMoreElementsException()*/); |
| 1267 } | 1267 } |
| 1268 var res = this._entries.$index(this._nextValidIndex); | 1268 var res = this._entries.$index(this._nextValidIndex); |
| 1269 this._advance(); | 1269 this._advance(); |
| 1270 return res; | 1270 return res; |
| 1271 } | 1271 } |
| 1272 HashSetIterator.prototype._advance = function() { | 1272 HashSetIterator.prototype._advance = function() { |
| 1273 var length = this._entries.length; | 1273 var length = this._entries.length; |
| 1274 var entry; | 1274 var entry; |
| 1275 var deletedKey = HashMapImplementation._deletedKey; | 1275 var deletedKey = HashMapImplementation._deletedKey; |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 // ********** Code for _DoubleLinkedQueueIterator ************** | 1661 // ********** Code for _DoubleLinkedQueueIterator ************** |
| 1662 function _DoubleLinkedQueueIterator(_sentinel) { | 1662 function _DoubleLinkedQueueIterator(_sentinel) { |
| 1663 this._sentinel = _sentinel; | 1663 this._sentinel = _sentinel; |
| 1664 // Initializers done | 1664 // Initializers done |
| 1665 this._currentEntry = this._sentinel; | 1665 this._currentEntry = this._sentinel; |
| 1666 } | 1666 } |
| 1667 _DoubleLinkedQueueIterator.prototype.hasNext = function() { | 1667 _DoubleLinkedQueueIterator.prototype.hasNext = function() { |
| 1668 return this._currentEntry._next !== this._sentinel; | 1668 return this._currentEntry._next !== this._sentinel; |
| 1669 } | 1669 } |
| 1670 _DoubleLinkedQueueIterator.prototype.next = function() { | 1670 _DoubleLinkedQueueIterator.prototype.next = function() { |
| 1671 if ($notnull_bool(!this.hasNext())) { | 1671 if ($notnull_bool(!$notnull_bool(this.hasNext()))) { |
| 1672 $throw(const$0/*const NoMoreElementsException()*/); | 1672 $throw(const$0/*const NoMoreElementsException()*/); |
| 1673 } | 1673 } |
| 1674 this._currentEntry = this._currentEntry._next; | 1674 this._currentEntry = this._currentEntry._next; |
| 1675 return this._currentEntry.get$element(); | 1675 return this._currentEntry.get$element(); |
| 1676 } | 1676 } |
| 1677 // ********** Code for _DoubleLinkedQueueIterator$E ************** | 1677 // ********** Code for _DoubleLinkedQueueIterator$E ************** |
| 1678 function _DoubleLinkedQueueIterator$E(_sentinel) { | 1678 function _DoubleLinkedQueueIterator$E(_sentinel) { |
| 1679 this._sentinel = _sentinel; | 1679 this._sentinel = _sentinel; |
| 1680 // Initializers done | 1680 // Initializers done |
| 1681 this._currentEntry = this._sentinel; | 1681 this._currentEntry = this._sentinel; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1862 DateImplementation.fromEpoch$ctor.prototype = DateImplementation.prototype; | 1862 DateImplementation.fromEpoch$ctor.prototype = DateImplementation.prototype; |
| 1863 DateImplementation.now$ctor = function() { | 1863 DateImplementation.now$ctor = function() { |
| 1864 this.timeZone = new TimeZoneImplementation.local$ctor(); | 1864 this.timeZone = new TimeZoneImplementation.local$ctor(); |
| 1865 this.value = DateImplementation._now(); | 1865 this.value = DateImplementation._now(); |
| 1866 // Initializers done | 1866 // Initializers done |
| 1867 this._asJs(); | 1867 this._asJs(); |
| 1868 } | 1868 } |
| 1869 DateImplementation.now$ctor.prototype = DateImplementation.prototype; | 1869 DateImplementation.now$ctor.prototype = DateImplementation.prototype; |
| 1870 DateImplementation.prototype.get$value = function() { return this.value; }; | 1870 DateImplementation.prototype.get$value = function() { return this.value; }; |
| 1871 DateImplementation.prototype.$eq = function(other) { | 1871 DateImplementation.prototype.$eq = function(other) { |
| 1872 if ($notnull_bool(!((other instanceof DateImplementation)))) return false; | 1872 if ($notnull_bool(!$notnull_bool(((other instanceof DateImplementation))))) re
turn false; |
| 1873 return (this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone
)); | 1873 return (this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone
)); |
| 1874 } | 1874 } |
| 1875 DateImplementation.prototype.compareTo = function(other) { | 1875 DateImplementation.prototype.compareTo = function(other) { |
| 1876 return this.value.compareTo(other.value); | 1876 return this.value.compareTo(other.value); |
| 1877 } | 1877 } |
| 1878 DateImplementation.prototype.get$year = function() { | 1878 DateImplementation.prototype.get$year = function() { |
| 1879 return this.isUtc ? this._asJs().getUTCFullYear() : | 1879 return this.isUtc ? this._asJs().getUTCFullYear() : |
| 1880 this._asJs().getFullYear(); | 1880 this._asJs().getFullYear(); |
| 1881 } | 1881 } |
| 1882 DateImplementation.prototype.get$month = function() { | 1882 DateImplementation.prototype.get$month = function() { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1935 return this.date; | 1935 return this.date; |
| 1936 } | 1936 } |
| 1937 // ********** Code for TimeZoneImplementation ************** | 1937 // ********** Code for TimeZoneImplementation ************** |
| 1938 function TimeZoneImplementation() {} | 1938 function TimeZoneImplementation() {} |
| 1939 TimeZoneImplementation.local$ctor = function() { | 1939 TimeZoneImplementation.local$ctor = function() { |
| 1940 this.isUtc = false; | 1940 this.isUtc = false; |
| 1941 // Initializers done | 1941 // Initializers done |
| 1942 } | 1942 } |
| 1943 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype; | 1943 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype; |
| 1944 TimeZoneImplementation.prototype.$eq = function(other) { | 1944 TimeZoneImplementation.prototype.$eq = function(other) { |
| 1945 if ($notnull_bool(!((other instanceof TimeZoneImplementation)))) return false; | 1945 if ($notnull_bool(!$notnull_bool(((other instanceof TimeZoneImplementation))))
) return false; |
| 1946 return $eq(this.isUtc, other.isUtc); | 1946 return $eq(this.isUtc, other.isUtc); |
| 1947 } | 1947 } |
| 1948 TimeZoneImplementation.prototype.toString = function() { | 1948 TimeZoneImplementation.prototype.toString = function() { |
| 1949 if ($notnull_bool(this.isUtc)) return "TimeZone (UTC)"; | 1949 if ($notnull_bool(this.isUtc)) return "TimeZone (UTC)"; |
| 1950 return "TimeZone (Local)"; | 1950 return "TimeZone (Local)"; |
| 1951 } | 1951 } |
| 1952 // ********** Code for top level ************** | 1952 // ********** Code for top level ************** |
| 1953 function MatchImplementation(pattern, str, _start, _end, _groups) { | 1953 function MatchImplementation(pattern, str, _start, _end, _groups) { |
| 1954 this.pattern = pattern; | 1954 this.pattern = pattern; |
| 1955 this.str = str; | 1955 this.str = str; |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2644 case 99/*null.$c*/: | 2644 case 99/*null.$c*/: |
| 2645 case 100/*null.$d*/: | 2645 case 100/*null.$d*/: |
| 2646 case 101/*null.$e*/: | 2646 case 101/*null.$e*/: |
| 2647 case 102/*null.$f*/: | 2647 case 102/*null.$f*/: |
| 2648 | 2648 |
| 2649 hasDigits = true; | 2649 hasDigits = true; |
| 2650 break; | 2650 break; |
| 2651 | 2651 |
| 2652 default: | 2652 default: |
| 2653 | 2653 |
| 2654 if ($notnull_bool(!hasDigits)) { | 2654 if ($notnull_bool(!$notnull_bool(hasDigits))) { |
| 2655 $throw(new MalformedInputException(this.charOffset)); | 2655 $throw(new MalformedInputException(this.charOffset)); |
| 2656 } | 2656 } |
| 2657 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); | 2657 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); |
| 2658 return next; | 2658 return next; |
| 2659 | 2659 |
| 2660 } | 2660 } |
| 2661 } | 2661 } |
| 2662 } | 2662 } |
| 2663 ArrayBasedScanner$String.prototype.tokenizeDotOrNumber = function(next) { | 2663 ArrayBasedScanner$String.prototype.tokenizeDotOrNumber = function(next) { |
| 2664 var start = this.byteOffset; | 2664 var start = this.byteOffset; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2686 default: | 2686 default: |
| 2687 | 2687 |
| 2688 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 2688 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 2689 return next; | 2689 return next; |
| 2690 | 2690 |
| 2691 } | 2691 } |
| 2692 } | 2692 } |
| 2693 ArrayBasedScanner$String.prototype.tokenizeFractionPart = function(next, start)
{ | 2693 ArrayBasedScanner$String.prototype.tokenizeFractionPart = function(next, start)
{ |
| 2694 var done = false; | 2694 var done = false; |
| 2695 LOOP: | 2695 LOOP: |
| 2696 while ($notnull_bool(!done)) { | 2696 while ($notnull_bool(!$notnull_bool(done))) { |
| 2697 switch (next) { | 2697 switch (next) { |
| 2698 case 48/*null.$0*/: | 2698 case 48/*null.$0*/: |
| 2699 case 49/*null.$1*/: | 2699 case 49/*null.$1*/: |
| 2700 case 50/*null.$2*/: | 2700 case 50/*null.$2*/: |
| 2701 case 51/*null.$3*/: | 2701 case 51/*null.$3*/: |
| 2702 case 52/*null.$4*/: | 2702 case 52/*null.$4*/: |
| 2703 case 53/*null.$5*/: | 2703 case 53/*null.$5*/: |
| 2704 case 54/*null.$6*/: | 2704 case 54/*null.$6*/: |
| 2705 case 55/*null.$7*/: | 2705 case 55/*null.$7*/: |
| 2706 case 56/*null.$8*/: | 2706 case 56/*null.$8*/: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2745 case 54/*null.$6*/: | 2745 case 54/*null.$6*/: |
| 2746 case 55/*null.$7*/: | 2746 case 55/*null.$7*/: |
| 2747 case 56/*null.$8*/: | 2747 case 56/*null.$8*/: |
| 2748 case 57/*null.$9*/: | 2748 case 57/*null.$9*/: |
| 2749 | 2749 |
| 2750 hasDigits = true; | 2750 hasDigits = true; |
| 2751 break; | 2751 break; |
| 2752 | 2752 |
| 2753 default: | 2753 default: |
| 2754 | 2754 |
| 2755 if ($notnull_bool(!hasDigits)) { | 2755 if ($notnull_bool(!$notnull_bool(hasDigits))) { |
| 2756 $throw(new MalformedInputException(this.charOffset)); | 2756 $throw(new MalformedInputException(this.charOffset)); |
| 2757 } | 2757 } |
| 2758 return next; | 2758 return next; |
| 2759 | 2759 |
| 2760 } | 2760 } |
| 2761 next = this.advance(); | 2761 next = this.advance(); |
| 2762 } | 2762 } |
| 2763 } | 2763 } |
| 2764 ArrayBasedScanner$String.prototype.tokenizeSlashOrComment = function(next) { | 2764 ArrayBasedScanner$String.prototype.tokenizeSlashOrComment = function(next) { |
| 2765 next = this.advance(); | 2765 next = this.advance(); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2974 return LinkFactory.Link$factory(element, this); | 2974 return LinkFactory.Link$factory(element, this); |
| 2975 } | 2975 } |
| 2976 AbstractLink.prototype.iterator = function() { | 2976 AbstractLink.prototype.iterator = function() { |
| 2977 return this.toList().iterator(); | 2977 return this.toList().iterator(); |
| 2978 } | 2978 } |
| 2979 AbstractLink.prototype.printOn = function(buffer, separatedBy) { | 2979 AbstractLink.prototype.printOn = function(buffer, separatedBy) { |
| 2980 var $0; | 2980 var $0; |
| 2981 if ($notnull_bool(this.isEmpty())) return; | 2981 if ($notnull_bool(this.isEmpty())) return; |
| 2982 buffer.add(this.get$head()); | 2982 buffer.add(this.get$head()); |
| 2983 for (var link = this.get$tail(); | 2983 for (var link = this.get$tail(); |
| 2984 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link(
))) { | 2984 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail())
&& $0.is$Link())) { |
| 2985 buffer.add(separatedBy); | 2985 buffer.add(separatedBy); |
| 2986 buffer.add(link.get$head()); | 2986 buffer.add(link.get$head()); |
| 2987 } | 2987 } |
| 2988 } | 2988 } |
| 2989 AbstractLink.prototype.toString = function() { | 2989 AbstractLink.prototype.toString = function() { |
| 2990 var buffer = new StringBufferImpl(""); | 2990 var buffer = new StringBufferImpl(""); |
| 2991 buffer.add('[ '); | 2991 buffer.add('[ '); |
| 2992 this.printOn(buffer, ', '); | 2992 this.printOn(buffer, ', '); |
| 2993 buffer.add(' ]'); | 2993 buffer.add(' ]'); |
| 2994 return buffer.toString(); | 2994 return buffer.toString(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3081 LinkEntry.prototype.get$tail = function() { | 3081 LinkEntry.prototype.get$tail = function() { |
| 3082 return this.realTail; | 3082 return this.realTail; |
| 3083 } | 3083 } |
| 3084 LinkEntry.prototype.isEmpty = function() { | 3084 LinkEntry.prototype.isEmpty = function() { |
| 3085 return false; | 3085 return false; |
| 3086 } | 3086 } |
| 3087 LinkEntry.prototype.toList = function() { | 3087 LinkEntry.prototype.toList = function() { |
| 3088 var $0; | 3088 var $0; |
| 3089 var list = new ListFactory$T(); | 3089 var list = new ListFactory$T(); |
| 3090 for (var link = this; | 3090 for (var link = this; |
| 3091 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
T())) { | 3091 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail())
&& $0.is$Link$T())) { |
| 3092 list.addLast(link.get$head()); | 3092 list.addLast(link.get$head()); |
| 3093 } | 3093 } |
| 3094 return list; | 3094 return list; |
| 3095 } | 3095 } |
| 3096 // ********** Code for LinkEntry$T ************** | 3096 // ********** Code for LinkEntry$T ************** |
| 3097 function LinkEntry$T(head, realTail) { | 3097 function LinkEntry$T(head, realTail) { |
| 3098 this.head = head; | 3098 this.head = head; |
| 3099 this.realTail = realTail; | 3099 this.realTail = realTail; |
| 3100 // Initializers done | 3100 // Initializers done |
| 3101 } | 3101 } |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3636 case 99/*null.$c*/: | 3636 case 99/*null.$c*/: |
| 3637 case 100/*null.$d*/: | 3637 case 100/*null.$d*/: |
| 3638 case 101/*null.$e*/: | 3638 case 101/*null.$e*/: |
| 3639 case 102/*null.$f*/: | 3639 case 102/*null.$f*/: |
| 3640 | 3640 |
| 3641 hasDigits = true; | 3641 hasDigits = true; |
| 3642 break; | 3642 break; |
| 3643 | 3643 |
| 3644 default: | 3644 default: |
| 3645 | 3645 |
| 3646 if ($notnull_bool(!hasDigits)) { | 3646 if ($notnull_bool(!$notnull_bool(hasDigits))) { |
| 3647 $throw(new MalformedInputException(this.get$charOffset())); | 3647 $throw(new MalformedInputException(this.get$charOffset())); |
| 3648 } | 3648 } |
| 3649 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); | 3649 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); |
| 3650 return next; | 3650 return next; |
| 3651 | 3651 |
| 3652 } | 3652 } |
| 3653 } | 3653 } |
| 3654 } | 3654 } |
| 3655 AbstractScanner.prototype.tokenizeDotOrNumber = function(next) { | 3655 AbstractScanner.prototype.tokenizeDotOrNumber = function(next) { |
| 3656 var start = this.get$byteOffset(); | 3656 var start = this.get$byteOffset(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3678 default: | 3678 default: |
| 3679 | 3679 |
| 3680 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 3680 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 3681 return next; | 3681 return next; |
| 3682 | 3682 |
| 3683 } | 3683 } |
| 3684 } | 3684 } |
| 3685 AbstractScanner.prototype.tokenizeFractionPart = function(next, start) { | 3685 AbstractScanner.prototype.tokenizeFractionPart = function(next, start) { |
| 3686 var done = false; | 3686 var done = false; |
| 3687 LOOP: | 3687 LOOP: |
| 3688 while ($notnull_bool(!done)) { | 3688 while ($notnull_bool(!$notnull_bool(done))) { |
| 3689 switch (next) { | 3689 switch (next) { |
| 3690 case 48/*null.$0*/: | 3690 case 48/*null.$0*/: |
| 3691 case 49/*null.$1*/: | 3691 case 49/*null.$1*/: |
| 3692 case 50/*null.$2*/: | 3692 case 50/*null.$2*/: |
| 3693 case 51/*null.$3*/: | 3693 case 51/*null.$3*/: |
| 3694 case 52/*null.$4*/: | 3694 case 52/*null.$4*/: |
| 3695 case 53/*null.$5*/: | 3695 case 53/*null.$5*/: |
| 3696 case 54/*null.$6*/: | 3696 case 54/*null.$6*/: |
| 3697 case 55/*null.$7*/: | 3697 case 55/*null.$7*/: |
| 3698 case 56/*null.$8*/: | 3698 case 56/*null.$8*/: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3737 case 54/*null.$6*/: | 3737 case 54/*null.$6*/: |
| 3738 case 55/*null.$7*/: | 3738 case 55/*null.$7*/: |
| 3739 case 56/*null.$8*/: | 3739 case 56/*null.$8*/: |
| 3740 case 57/*null.$9*/: | 3740 case 57/*null.$9*/: |
| 3741 | 3741 |
| 3742 hasDigits = true; | 3742 hasDigits = true; |
| 3743 break; | 3743 break; |
| 3744 | 3744 |
| 3745 default: | 3745 default: |
| 3746 | 3746 |
| 3747 if ($notnull_bool(!hasDigits)) { | 3747 if ($notnull_bool(!$notnull_bool(hasDigits))) { |
| 3748 $throw(new MalformedInputException(this.get$charOffset())); | 3748 $throw(new MalformedInputException(this.get$charOffset())); |
| 3749 } | 3749 } |
| 3750 return next; | 3750 return next; |
| 3751 | 3751 |
| 3752 } | 3752 } |
| 3753 next = this.advance(); | 3753 next = this.advance(); |
| 3754 } | 3754 } |
| 3755 } | 3755 } |
| 3756 AbstractScanner.prototype.tokenizeSlashOrComment = function(next) { | 3756 AbstractScanner.prototype.tokenizeSlashOrComment = function(next) { |
| 3757 next = this.advance(); | 3757 next = this.advance(); |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4439 case 99/*null.$c*/: | 4439 case 99/*null.$c*/: |
| 4440 case 100/*null.$d*/: | 4440 case 100/*null.$d*/: |
| 4441 case 101/*null.$e*/: | 4441 case 101/*null.$e*/: |
| 4442 case 102/*null.$f*/: | 4442 case 102/*null.$f*/: |
| 4443 | 4443 |
| 4444 hasDigits = true; | 4444 hasDigits = true; |
| 4445 break; | 4445 break; |
| 4446 | 4446 |
| 4447 default: | 4447 default: |
| 4448 | 4448 |
| 4449 if ($notnull_bool(!hasDigits)) { | 4449 if ($notnull_bool(!$notnull_bool(hasDigits))) { |
| 4450 $throw(new MalformedInputException(this.get$charOffset())); | 4450 $throw(new MalformedInputException(this.get$charOffset())); |
| 4451 } | 4451 } |
| 4452 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); | 4452 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri
ng(start)); |
| 4453 return next; | 4453 return next; |
| 4454 | 4454 |
| 4455 } | 4455 } |
| 4456 } | 4456 } |
| 4457 } | 4457 } |
| 4458 AbstractScanner$S.prototype.tokenizeDotOrNumber = function(next) { | 4458 AbstractScanner$S.prototype.tokenizeDotOrNumber = function(next) { |
| 4459 var start = this.get$byteOffset(); | 4459 var start = this.get$byteOffset(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4481 default: | 4481 default: |
| 4482 | 4482 |
| 4483 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); | 4483 this.appendStringToken(46/*null.PERIOD_TOKEN*/, "."); |
| 4484 return next; | 4484 return next; |
| 4485 | 4485 |
| 4486 } | 4486 } |
| 4487 } | 4487 } |
| 4488 AbstractScanner$S.prototype.tokenizeFractionPart = function(next, start) { | 4488 AbstractScanner$S.prototype.tokenizeFractionPart = function(next, start) { |
| 4489 var done = false; | 4489 var done = false; |
| 4490 LOOP: | 4490 LOOP: |
| 4491 while ($notnull_bool(!done)) { | 4491 while ($notnull_bool(!$notnull_bool(done))) { |
| 4492 switch (next) { | 4492 switch (next) { |
| 4493 case 48/*null.$0*/: | 4493 case 48/*null.$0*/: |
| 4494 case 49/*null.$1*/: | 4494 case 49/*null.$1*/: |
| 4495 case 50/*null.$2*/: | 4495 case 50/*null.$2*/: |
| 4496 case 51/*null.$3*/: | 4496 case 51/*null.$3*/: |
| 4497 case 52/*null.$4*/: | 4497 case 52/*null.$4*/: |
| 4498 case 53/*null.$5*/: | 4498 case 53/*null.$5*/: |
| 4499 case 54/*null.$6*/: | 4499 case 54/*null.$6*/: |
| 4500 case 55/*null.$7*/: | 4500 case 55/*null.$7*/: |
| 4501 case 56/*null.$8*/: | 4501 case 56/*null.$8*/: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4540 case 54/*null.$6*/: | 4540 case 54/*null.$6*/: |
| 4541 case 55/*null.$7*/: | 4541 case 55/*null.$7*/: |
| 4542 case 56/*null.$8*/: | 4542 case 56/*null.$8*/: |
| 4543 case 57/*null.$9*/: | 4543 case 57/*null.$9*/: |
| 4544 | 4544 |
| 4545 hasDigits = true; | 4545 hasDigits = true; |
| 4546 break; | 4546 break; |
| 4547 | 4547 |
| 4548 default: | 4548 default: |
| 4549 | 4549 |
| 4550 if ($notnull_bool(!hasDigits)) { | 4550 if ($notnull_bool(!$notnull_bool(hasDigits))) { |
| 4551 $throw(new MalformedInputException(this.get$charOffset())); | 4551 $throw(new MalformedInputException(this.get$charOffset())); |
| 4552 } | 4552 } |
| 4553 return next; | 4553 return next; |
| 4554 | 4554 |
| 4555 } | 4555 } |
| 4556 next = this.advance(); | 4556 next = this.advance(); |
| 4557 } | 4557 } |
| 4558 } | 4558 } |
| 4559 AbstractScanner$S.prototype.tokenizeSlashOrComment = function(next) { | 4559 AbstractScanner$S.prototype.tokenizeSlashOrComment = function(next) { |
| 4560 next = this.advance(); | 4560 next = this.advance(); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4874 } | 4874 } |
| 4875 return token; | 4875 return token; |
| 4876 } | 4876 } |
| 4877 Parser.prototype.parseFactoryClauseOpt = function(token) { | 4877 Parser.prototype.parseFactoryClauseOpt = function(token) { |
| 4878 if ($notnull_bool(this.optional(const$195/*Keyword.FACTORY*/, token))) { | 4878 if ($notnull_bool(this.optional(const$195/*Keyword.FACTORY*/, token))) { |
| 4879 return this.parseType(this.next(token)); | 4879 return this.parseType(this.next(token)); |
| 4880 } | 4880 } |
| 4881 return token; | 4881 return token; |
| 4882 } | 4882 } |
| 4883 Parser.prototype.skipBlock = function(token) { | 4883 Parser.prototype.skipBlock = function(token) { |
| 4884 if ($notnull_bool(!this.optional(const$232/*const SourceString("{")*/, token))
) { | 4884 if ($notnull_bool(!$notnull_bool(this.optional(const$232/*const SourceString("
{")*/, token)))) { |
| 4885 return this.listener.expectedBlock(token); | 4885 return this.listener.expectedBlock(token); |
| 4886 } | 4886 } |
| 4887 token = this.next(token); | 4887 token = this.next(token); |
| 4888 var nesting = 1; | 4888 var nesting = 1; |
| 4889 do { | 4889 do { |
| 4890 switch (token.kind) { | 4890 switch (token.kind) { |
| 4891 case 123/*null.LBRACE_TOKEN*/: | 4891 case 123/*null.LBRACE_TOKEN*/: |
| 4892 | 4892 |
| 4893 nesting++; | 4893 nesting++; |
| 4894 break; | 4894 break; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4937 Parser.prototype.parseIdentifier = function(token) { | 4937 Parser.prototype.parseIdentifier = function(token) { |
| 4938 if ($notnull_bool(this.isIdentifier(token))) { | 4938 if ($notnull_bool(this.isIdentifier(token))) { |
| 4939 this.listener.identifier(token); | 4939 this.listener.identifier(token); |
| 4940 } | 4940 } |
| 4941 else { | 4941 else { |
| 4942 this.listener.notIdentifier(token); | 4942 this.listener.notIdentifier(token); |
| 4943 } | 4943 } |
| 4944 return this.next(token); | 4944 return this.next(token); |
| 4945 } | 4945 } |
| 4946 Parser.prototype.parseTypeVariablesOpt = function(token) { | 4946 Parser.prototype.parseTypeVariablesOpt = function(token) { |
| 4947 if ($notnull_bool(!this.optional(const$228/*const SourceString("<")*/, token))
) { | 4947 if ($notnull_bool(!$notnull_bool(this.optional(const$228/*const SourceString("
<")*/, token)))) { |
| 4948 return token; | 4948 return token; |
| 4949 } | 4949 } |
| 4950 this.listener.beginTypeVariables(token); | 4950 this.listener.beginTypeVariables(token); |
| 4951 do { | 4951 do { |
| 4952 token = this.parseTypeVariable(this.next(token)); | 4952 token = this.parseTypeVariable(this.next(token)); |
| 4953 } | 4953 } |
| 4954 while ($notnull_bool(this.optional(const$230/*const SourceString(",")*/, token
))) | 4954 while ($notnull_bool(this.optional(const$230/*const SourceString(",")*/, token
))) |
| 4955 return this.expect(const$231/*const SourceString(">")*/, token); | 4955 return this.expect(const$231/*const SourceString(">")*/, token); |
| 4956 } | 4956 } |
| 4957 Parser.prototype.expect = function(string, token) { | 4957 Parser.prototype.expect = function(string, token) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5041 } | 5041 } |
| 5042 else if ($notnull_bool(this.optional(const$238/*const SourceString("=")*/, tok
en) || this.optional(const$236/*const SourceString(";")*/, token))) { | 5042 else if ($notnull_bool(this.optional(const$238/*const SourceString("=")*/, tok
en) || this.optional(const$236/*const SourceString(";")*/, token))) { |
| 5043 this.listener.topLevelField(start); | 5043 this.listener.topLevelField(start); |
| 5044 } | 5044 } |
| 5045 else { | 5045 else { |
| 5046 token = this.listener.unexpected(token); | 5046 token = this.listener.unexpected(token); |
| 5047 } | 5047 } |
| 5048 while ($notnull_bool(token != null && token.kind != 123/*null.LBRACE_TOKEN*/ &
& token.kind != 59/*null.SEMICOLON_TOKEN*/)) { | 5048 while ($notnull_bool(token != null && token.kind != 123/*null.LBRACE_TOKEN*/ &
& token.kind != 59/*null.SEMICOLON_TOKEN*/)) { |
| 5049 token = this.next(token); | 5049 token = this.next(token); |
| 5050 } | 5050 } |
| 5051 if ($notnull_bool(!this.optional(const$236/*const SourceString(";")*/, token))
) { | 5051 if ($notnull_bool(!$notnull_bool(this.optional(const$236/*const SourceString("
;")*/, token)))) { |
| 5052 token = this.skipBlock(token); | 5052 token = this.skipBlock(token); |
| 5053 } | 5053 } |
| 5054 this.listener.endTopLevelMember(token); | 5054 this.listener.endTopLevelMember(token); |
| 5055 return token.next; | 5055 return token.next; |
| 5056 } | 5056 } |
| 5057 Parser.prototype.parseLibraryTags = function(token) { | 5057 Parser.prototype.parseLibraryTags = function(token) { |
| 5058 this.listener.beginLibraryTag(token); | 5058 this.listener.beginLibraryTag(token); |
| 5059 token = this.parseIdentifier(this.next(token)); | 5059 token = this.parseIdentifier(this.next(token)); |
| 5060 token = this.expect(const$234/*const SourceString("(")*/, token); | 5060 token = this.expect(const$234/*const SourceString("(")*/, token); |
| 5061 while ($notnull_bool(token != null && token.kind != 40/*null.LPAREN_TOKEN*/ &&
token.kind != 41/*null.RPAREN_TOKEN*/)) { | 5061 while ($notnull_bool(token != null && token.kind != 40/*null.LPAREN_TOKEN*/ &&
token.kind != 41/*null.RPAREN_TOKEN*/)) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5099 } | 5099 } |
| 5100 BodyParser.prototype.parseFunctionBody = function(token) { | 5100 BodyParser.prototype.parseFunctionBody = function(token) { |
| 5101 if ($notnull_bool(this.optional(const$236/*const SourceString(";")*/, token)))
{ | 5101 if ($notnull_bool(this.optional(const$236/*const SourceString(";")*/, token)))
{ |
| 5102 this.listener.endFunctionBody(0, null, token); | 5102 this.listener.endFunctionBody(0, null, token); |
| 5103 return token.next; | 5103 return token.next; |
| 5104 } | 5104 } |
| 5105 var begin = token; | 5105 var begin = token; |
| 5106 var statementCount = 0; | 5106 var statementCount = 0; |
| 5107 this.listener.beginFunctionBody(begin); | 5107 this.listener.beginFunctionBody(begin); |
| 5108 token = this.checkEof(this.expect(const$232/*const SourceString("{")*/, token)
); | 5108 token = this.checkEof(this.expect(const$232/*const SourceString("{")*/, token)
); |
| 5109 while ($notnull_bool(!this.optional(const$239/*const SourceString("}")*/, toke
n))) { | 5109 while ($notnull_bool(!$notnull_bool(this.optional(const$239/*const SourceStrin
g("}")*/, token)))) { |
| 5110 token = this.parseStatement(token); | 5110 token = this.parseStatement(token); |
| 5111 ++statementCount; | 5111 ++statementCount; |
| 5112 } | 5112 } |
| 5113 this.listener.endFunctionBody(statementCount, begin, token); | 5113 this.listener.endFunctionBody(statementCount, begin, token); |
| 5114 return this.expect(const$239/*const SourceString("}")*/, token); | 5114 return this.expect(const$239/*const SourceString("}")*/, token); |
| 5115 } | 5115 } |
| 5116 BodyParser.prototype.parseStatement = function(token) { | 5116 BodyParser.prototype.parseStatement = function(token) { |
| 5117 this.checkEof(token); | 5117 this.checkEof(token); |
| 5118 if ($notnull_bool($eq(token.get$value(), const$240/*const SourceString('{')*/)
)) { | 5118 if ($notnull_bool($eq(token.get$value(), const$240/*const SourceString('{')*/)
)) { |
| 5119 return this.parseBlock(token); | 5119 return this.parseBlock(token); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5410 return token.next; | 5410 return token.next; |
| 5411 } | 5411 } |
| 5412 BodyParser.prototype.parseSend = function(token) { | 5412 BodyParser.prototype.parseSend = function(token) { |
| 5413 this.listener.beginSend(token); | 5413 this.listener.beginSend(token); |
| 5414 token = this.parseIdentifier(token); | 5414 token = this.parseIdentifier(token); |
| 5415 token = this.parseArgumentsOpt(token); | 5415 token = this.parseArgumentsOpt(token); |
| 5416 this.listener.endSend(token); | 5416 this.listener.endSend(token); |
| 5417 return token; | 5417 return token; |
| 5418 } | 5418 } |
| 5419 BodyParser.prototype.parseArgumentsOpt = function(token) { | 5419 BodyParser.prototype.parseArgumentsOpt = function(token) { |
| 5420 if ($notnull_bool(!this.optional(const$234/*const SourceString("(")*/, token))
) { | 5420 if ($notnull_bool(!$notnull_bool(this.optional(const$234/*const SourceString("
(")*/, token)))) { |
| 5421 this.listener.handleNoArgumentsOpt(token); | 5421 this.listener.handleNoArgumentsOpt(token); |
| 5422 return token; | 5422 return token; |
| 5423 } | 5423 } |
| 5424 else return this.parseArguments(token); | 5424 else return this.parseArguments(token); |
| 5425 } | 5425 } |
| 5426 BodyParser.prototype.parseArguments = function(token) { | 5426 BodyParser.prototype.parseArguments = function(token) { |
| 5427 var begin = token; | 5427 var begin = token; |
| 5428 this.listener.beginArguments(begin); | 5428 this.listener.beginArguments(begin); |
| 5429 $assert($eq(const$234/*const SourceString("(")*/, token.get$value()), "const S
ourceString(\"(\") == token.value", "leg/scanner/parser.dart", 559, 12); | 5429 $assert($eq(const$234/*const SourceString("(")*/, token.get$value()), "const S
ourceString(\"(\") == token.value", "leg/scanner/parser.dart", 559, 12); |
| 5430 var argumentCount = 0; | 5430 var argumentCount = 0; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5481 token = this.parseStatement(token.next); | 5481 token = this.parseStatement(token.next); |
| 5482 } | 5482 } |
| 5483 this.listener.endIfStatement(ifToken, elseToken); | 5483 this.listener.endIfStatement(ifToken, elseToken); |
| 5484 return token; | 5484 return token; |
| 5485 } | 5485 } |
| 5486 BodyParser.prototype.parseBlock = function(token) { | 5486 BodyParser.prototype.parseBlock = function(token) { |
| 5487 var begin = token; | 5487 var begin = token; |
| 5488 this.listener.beginBlock(begin); | 5488 this.listener.beginBlock(begin); |
| 5489 var statementCount = 0; | 5489 var statementCount = 0; |
| 5490 token = this.expect(const$240/*const SourceString('{')*/, token); | 5490 token = this.expect(const$240/*const SourceString('{')*/, token); |
| 5491 while ($notnull_bool(!this.optional(const$239/*const SourceString("}")*/, toke
n))) { | 5491 while ($notnull_bool(!$notnull_bool(this.optional(const$239/*const SourceStrin
g("}")*/, token)))) { |
| 5492 token = this.parseStatement(token); | 5492 token = this.parseStatement(token); |
| 5493 ++statementCount; | 5493 ++statementCount; |
| 5494 } | 5494 } |
| 5495 this.listener.endBlock(statementCount, begin, token); | 5495 this.listener.endBlock(statementCount, begin, token); |
| 5496 return this.expect(const$239/*const SourceString("}")*/, token); | 5496 return this.expect(const$239/*const SourceString("}")*/, token); |
| 5497 } | 5497 } |
| 5498 // ********** Code for Listener ************** | 5498 // ********** Code for Listener ************** |
| 5499 function Listener(canceler) { | 5499 function Listener(canceler) { |
| 5500 this.classCount = 0 | 5500 this.classCount = 0 |
| 5501 this.aliasCount = 0 | 5501 this.aliasCount = 0 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5699 } | 5699 } |
| 5700 BodyListener.prototype.handleBinaryExpression = function(token) { | 5700 BodyListener.prototype.handleBinaryExpression = function(token) { |
| 5701 var arguments = new NodeList(null, LinkFactory.Link$factory(this.popNode()), n
ull, null); | 5701 var arguments = new NodeList(null, LinkFactory.Link$factory(this.popNode()), n
ull, null); |
| 5702 this.pushNode(new Send(this.popNode(), new Operator(token), arguments)); | 5702 this.pushNode(new Send(this.popNode(), new Operator(token), arguments)); |
| 5703 } | 5703 } |
| 5704 BodyListener.prototype.handleAssignmentExpression = function(token) { | 5704 BodyListener.prototype.handleAssignmentExpression = function(token) { |
| 5705 var arguments = new NodeList.singleton$ctor(this.popNode()); | 5705 var arguments = new NodeList.singleton$ctor(this.popNode()); |
| 5706 var node = this.popNode(); | 5706 var node = this.popNode(); |
| 5707 if ($notnull_bool(!(node instanceof Send))) this.canceler.cancel(('not assigna
ble: ' + node + '')); | 5707 if ($notnull_bool(!(node instanceof Send))) this.canceler.cancel(('not assigna
ble: ' + node + '')); |
| 5708 var send = node; | 5708 var send = node; |
| 5709 if ($notnull_bool(!send.get$isPropertyAccess())) this.canceler.cancel(('not as
signable: ' + node + '')); | 5709 if ($notnull_bool(!$notnull_bool(send.get$isPropertyAccess()))) this.canceler.
cancel(('not assignable: ' + node + '')); |
| 5710 if ($notnull_bool((send instanceof SetterSend))) this.canceler.cancel('chained
assignment'); | 5710 if ($notnull_bool((send instanceof SetterSend))) this.canceler.cancel('chained
assignment'); |
| 5711 this.pushNode(new SetterSend(send.receiver, send.selector, token, arguments)); | 5711 this.pushNode(new SetterSend(send.receiver, send.selector, token, arguments)); |
| 5712 } | 5712 } |
| 5713 BodyListener.prototype.handleConditionalExpression = function(question, colon) { | 5713 BodyListener.prototype.handleConditionalExpression = function(question, colon) { |
| 5714 var elseExpression = this.popNode(); | 5714 var elseExpression = this.popNode(); |
| 5715 var thenExpression = this.popNode(); | 5715 var thenExpression = this.popNode(); |
| 5716 var condition = this.popNode(); | 5716 var condition = this.popNode(); |
| 5717 this.canceler.cancel('conditional expression not implemented yet'); | 5717 this.canceler.cancel('conditional expression not implemented yet'); |
| 5718 } | 5718 } |
| 5719 BodyListener.prototype.beginSend = function(token) { | 5719 BodyListener.prototype.beginSend = function(token) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5791 BodyListener.prototype.endBlock = function(count, beginToken, endToken) { | 5791 BodyListener.prototype.endBlock = function(count, beginToken, endToken) { |
| 5792 this.pushNode(new Block(this.makeNodeList(count, beginToken, endToken, null)))
; | 5792 this.pushNode(new Block(this.makeNodeList(count, beginToken, endToken, null)))
; |
| 5793 } | 5793 } |
| 5794 BodyListener.prototype.pushNode = function(node) { | 5794 BodyListener.prototype.pushNode = function(node) { |
| 5795 var $0; | 5795 var $0; |
| 5796 this.nodes = (($0 = this.nodes.prepend(node)) && $0.is$Link$Node()); | 5796 this.nodes = (($0 = this.nodes.prepend(node)) && $0.is$Link$Node()); |
| 5797 this.logger.log(("push " + this.nodes + "")); | 5797 this.logger.log(("push " + this.nodes + "")); |
| 5798 } | 5798 } |
| 5799 BodyListener.prototype.popNode = function() { | 5799 BodyListener.prototype.popNode = function() { |
| 5800 var $0; | 5800 var $0; |
| 5801 $assert(!this.nodes.isEmpty(), "!nodes.isEmpty()", "leg/scanner/listener.dart"
, 360, 12); | 5801 $assert(!$notnull_bool(this.nodes.isEmpty()), "!nodes.isEmpty()", "leg/scanner
/listener.dart", 360, 12); |
| 5802 var node = this.nodes.get$head(); | 5802 var node = this.nodes.get$head(); |
| 5803 this.nodes = (($0 = this.nodes.get$tail()) && $0.is$Link$Node()); | 5803 this.nodes = (($0 = this.nodes.get$tail()) && $0.is$Link$Node()); |
| 5804 this.logger.log(("pop " + this.nodes + "")); | 5804 this.logger.log(("pop " + this.nodes + "")); |
| 5805 return node; | 5805 return node; |
| 5806 } | 5806 } |
| 5807 BodyListener.prototype.makeNodeList = function(count, beginToken, endToken, deli
miter) { | 5807 BodyListener.prototype.makeNodeList = function(count, beginToken, endToken, deli
miter) { |
| 5808 var $0; | 5808 var $0; |
| 5809 var nodes0 = const$227/*const EmptyLink<DeclarationBuilder>()*/; | 5809 var nodes0 = const$227/*const EmptyLink<DeclarationBuilder>()*/; |
| 5810 for (; $notnull_bool(count > 0); --count) { | 5810 for (; $notnull_bool(count > 0); --count) { |
| 5811 nodes0 = (($0 = nodes0.prepend(this.popNode())) && $0.is$Link$Node()); | 5811 nodes0 = (($0 = nodes0.prepend(this.popNode())) && $0.is$Link$Node()); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6121 NodeList.singleton$ctor.prototype = NodeList.prototype; | 6121 NodeList.singleton$ctor.prototype = NodeList.prototype; |
| 6122 $inherits(NodeList, Node); | 6122 $inherits(NodeList, Node); |
| 6123 NodeList.prototype.accept = function(visitor) { | 6123 NodeList.prototype.accept = function(visitor) { |
| 6124 return visitor.visitNodeList(this); | 6124 return visitor.visitNodeList(this); |
| 6125 } | 6125 } |
| 6126 NodeList.prototype.getBeginToken = function() { | 6126 NodeList.prototype.getBeginToken = function() { |
| 6127 var $0; | 6127 var $0; |
| 6128 if ($notnull_bool(this.beginToken != null)) return this.beginToken; | 6128 if ($notnull_bool(this.beginToken != null)) return this.beginToken; |
| 6129 if ($notnull_bool(this.nodes != null)) { | 6129 if ($notnull_bool(this.nodes != null)) { |
| 6130 for (var link = this.nodes; | 6130 for (var link = this.nodes; |
| 6131 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Lin
k$Node())) { | 6131 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail(
)) && $0.is$Link$Node())) { |
| 6132 if ($notnull_bool(link.get$head().getBeginToken() != null)) { | 6132 if ($notnull_bool(link.get$head().getBeginToken() != null)) { |
| 6133 return link.get$head().getBeginToken(); | 6133 return link.get$head().getBeginToken(); |
| 6134 } | 6134 } |
| 6135 if ($notnull_bool(link.get$head().getEndToken() != null)) { | 6135 if ($notnull_bool(link.get$head().getEndToken() != null)) { |
| 6136 return link.get$head().getEndToken(); | 6136 return link.get$head().getEndToken(); |
| 6137 } | 6137 } |
| 6138 } | 6138 } |
| 6139 } | 6139 } |
| 6140 return this.endToken; | 6140 return this.endToken; |
| 6141 } | 6141 } |
| 6142 NodeList.prototype.getEndToken = function() { | 6142 NodeList.prototype.getEndToken = function() { |
| 6143 var $0; | 6143 var $0; |
| 6144 if ($notnull_bool(this.endToken != null)) return this.endToken; | 6144 if ($notnull_bool(this.endToken != null)) return this.endToken; |
| 6145 if ($notnull_bool(this.nodes != null)) { | 6145 if ($notnull_bool(this.nodes != null)) { |
| 6146 var link = this.nodes; | 6146 var link = this.nodes; |
| 6147 while ($notnull_bool(!link.get$tail().isEmpty())) link = (($0 = link.get$tai
l()) && $0.is$Link$Node()); | 6147 while ($notnull_bool(!$notnull_bool(link.get$tail().isEmpty()))) link = (($0
= link.get$tail()) && $0.is$Link$Node()); |
| 6148 if ($notnull_bool(link.get$head().getEndToken() != null)) return link.get$he
ad().getEndToken(); | 6148 if ($notnull_bool(link.get$head().getEndToken() != null)) return link.get$he
ad().getEndToken(); |
| 6149 if ($notnull_bool(link.get$head().getBeginToken() != null)) return link.get$
head().getBeginToken(); | 6149 if ($notnull_bool(link.get$head().getBeginToken() != null)) return link.get$
head().getBeginToken(); |
| 6150 } | 6150 } |
| 6151 return this.beginToken; | 6151 return this.beginToken; |
| 6152 } | 6152 } |
| 6153 // ********** Code for Block ************** | 6153 // ********** Code for Block ************** |
| 6154 function Block(statements) { | 6154 function Block(statements) { |
| 6155 this.statements = statements; | 6155 this.statements = statements; |
| 6156 // Initializers done | 6156 // Initializers done |
| 6157 } | 6157 } |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6503 DebugUnparser.prototype.visitNodeList = function(node) { | 6503 DebugUnparser.prototype.visitNodeList = function(node) { |
| 6504 var $0; | 6504 var $0; |
| 6505 var first = true; | 6505 var first = true; |
| 6506 if ($notnull_bool(node.beginToken != null)) this.sb.add(node.beginToken); | 6506 if ($notnull_bool(node.beginToken != null)) this.sb.add(node.beginToken); |
| 6507 if ($notnull_bool(node.nodes != null)) { | 6507 if ($notnull_bool(node.nodes != null)) { |
| 6508 var delimiter = node.delimiter; | 6508 var delimiter = node.delimiter; |
| 6509 if ($notnull_bool(delimiter == null)) delimiter = new StringWrapper(this.sep
arator); | 6509 if ($notnull_bool(delimiter == null)) delimiter = new StringWrapper(this.sep
arator); |
| 6510 var $list = node.nodes; | 6510 var $list = node.nodes; |
| 6511 for (var $i = node.nodes.iterator(); $i.hasNext(); ) { | 6511 for (var $i = node.nodes.iterator(); $i.hasNext(); ) { |
| 6512 var element = $i.next(); | 6512 var element = $i.next(); |
| 6513 if ($notnull_bool(!first)) delimiter.printOn(this.sb); | 6513 if ($notnull_bool(!$notnull_bool(first))) delimiter.printOn(this.sb); |
| 6514 first = false; | 6514 first = false; |
| 6515 this.visit(element); | 6515 this.visit(element); |
| 6516 } | 6516 } |
| 6517 } | 6517 } |
| 6518 if ($notnull_bool(node.endToken != null)) this.sb.add(node.endToken); | 6518 if ($notnull_bool(node.endToken != null)) this.sb.add(node.endToken); |
| 6519 } | 6519 } |
| 6520 DebugUnparser.prototype.visitOperator = function(node) { | 6520 DebugUnparser.prototype.visitOperator = function(node) { |
| 6521 this.visitIdentifier(node); | 6521 this.visitIdentifier(node); |
| 6522 } | 6522 } |
| 6523 DebugUnparser.prototype.visitParameter = function(node) { | 6523 DebugUnparser.prototype.visitParameter = function(node) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6585 // Initializers done | 6585 // Initializers done |
| 6586 } | 6586 } |
| 6587 $inherits(FunctionElement, Element); | 6587 $inherits(FunctionElement, Element); |
| 6588 FunctionElement.prototype.computeType = function(compiler, types) { | 6588 FunctionElement.prototype.computeType = function(compiler, types) { |
| 6589 var $0; | 6589 var $0; |
| 6590 if ($notnull_bool(this.type != null)) return this.type; | 6590 if ($notnull_bool(this.type != null)) return this.type; |
| 6591 var node = this.parseNode(compiler, compiler); | 6591 var node = this.parseNode(compiler, compiler); |
| 6592 var returnType = getType(node.returnType, types); | 6592 var returnType = getType(node.returnType, types); |
| 6593 var parameterTypes = new LinkBuilderImplementation$Type(); | 6593 var parameterTypes = new LinkBuilderImplementation$Type(); |
| 6594 for (var link = node.parameters.nodes; | 6594 for (var link = node.parameters.nodes; |
| 6595 $notnull_bool(!link.isEmpty()); link = link.get$tail()) { | 6595 $notnull_bool(!$notnull_bool(link.isEmpty())); link = link.get$tail()) { |
| 6596 compiler.cancel('parameters not supported.'); | 6596 compiler.cancel('parameters not supported.'); |
| 6597 var parameter = link.get$head(); | 6597 var parameter = link.get$head(); |
| 6598 parameterTypes.addLast(getType(parameter.typeAnnotation, types)); | 6598 parameterTypes.addLast(getType(parameter.typeAnnotation, types)); |
| 6599 } | 6599 } |
| 6600 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0
.is$Link$Type())); | 6600 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0
.is$Link$Type())); |
| 6601 return this.type; | 6601 return this.type; |
| 6602 } | 6602 } |
| 6603 // ********** Code for top level ************** | 6603 // ********** Code for top level ************** |
| 6604 function getType(annotation, types) { | 6604 function getType(annotation, types) { |
| 6605 if ($notnull_bool(annotation == null || annotation.typeName == null)) { | 6605 if ($notnull_bool(annotation == null || annotation.typeName == null)) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6675 this.stack.add(instruction); | 6675 this.stack.add(instruction); |
| 6676 } | 6676 } |
| 6677 SsaBuilder.prototype.pop = function() { | 6677 SsaBuilder.prototype.pop = function() { |
| 6678 return this.stack.removeLast(); | 6678 return this.stack.removeLast(); |
| 6679 } | 6679 } |
| 6680 SsaBuilder.prototype.visit = function(node) { | 6680 SsaBuilder.prototype.visit = function(node) { |
| 6681 if ($notnull_bool(node != null)) node.accept(this); | 6681 if ($notnull_bool(node != null)) node.accept(this); |
| 6682 } | 6682 } |
| 6683 SsaBuilder.prototype.visitBlock = function(node) { | 6683 SsaBuilder.prototype.visitBlock = function(node) { |
| 6684 this.visit(node.statements); | 6684 this.visit(node.statements); |
| 6685 if ($notnull_bool(!this.stack.isEmpty())) this.compiler.cancel('non-empty inst
ruction stack'); | 6685 if ($notnull_bool(!$notnull_bool(this.stack.isEmpty()))) this.compiler.cancel(
'non-empty instruction stack'); |
| 6686 } | 6686 } |
| 6687 SsaBuilder.prototype.visitExpressionStatement = function(node) { | 6687 SsaBuilder.prototype.visitExpressionStatement = function(node) { |
| 6688 this.visit(node.expression); | 6688 this.visit(node.expression); |
| 6689 this.pop(); | 6689 this.pop(); |
| 6690 } | 6690 } |
| 6691 SsaBuilder.prototype.visitFunctionExpression = function(node) { | 6691 SsaBuilder.prototype.visitFunctionExpression = function(node) { |
| 6692 this.compiler.cancel(); | 6692 this.compiler.cancel(); |
| 6693 } | 6693 } |
| 6694 SsaBuilder.prototype.visitIdentifier = function(node) { | 6694 SsaBuilder.prototype.visitIdentifier = function(node) { |
| 6695 this.compiler.cancel(); | 6695 this.compiler.cancel(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 6718 this.push(new HDivide([left, right])); | 6718 this.push(new HDivide([left, right])); |
| 6719 } | 6719 } |
| 6720 else if ($notnull_bool($eq(const$262/*const SourceString("~/")*/, op.get$sou
rce()))) { | 6720 else if ($notnull_bool($eq(const$262/*const SourceString("~/")*/, op.get$sou
rce()))) { |
| 6721 this.push(new HTruncatingDivide([left, right])); | 6721 this.push(new HTruncatingDivide([left, right])); |
| 6722 } | 6722 } |
| 6723 } | 6723 } |
| 6724 else { | 6724 else { |
| 6725 this.visit(node.argumentsNode); | 6725 this.visit(node.argumentsNode); |
| 6726 var arguments = []; | 6726 var arguments = []; |
| 6727 for (var link = node.get$arguments(); | 6727 for (var link = node.get$arguments(); |
| 6728 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Lin
k$Node())) { | 6728 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail(
)) && $0.is$Link$Node())) { |
| 6729 arguments.add(this.pop()); | 6729 arguments.add(this.pop()); |
| 6730 } | 6730 } |
| 6731 var selector = node.selector; | 6731 var selector = node.selector; |
| 6732 this.push(new HInvoke(selector.get$source(), arguments)); | 6732 this.push(new HInvoke(selector.get$source(), arguments)); |
| 6733 } | 6733 } |
| 6734 } | 6734 } |
| 6735 SsaBuilder.prototype.visitLiteralInt = function(node) { | 6735 SsaBuilder.prototype.visitLiteralInt = function(node) { |
| 6736 this.push(new HLiteral(node.get$value())); | 6736 this.push(new HLiteral(node.get$value())); |
| 6737 } | 6737 } |
| 6738 SsaBuilder.prototype.visitLiteralDouble = function(node) { | 6738 SsaBuilder.prototype.visitLiteralDouble = function(node) { |
| 6739 this.push(new HLiteral(node.get$value())); | 6739 this.push(new HLiteral(node.get$value())); |
| 6740 } | 6740 } |
| 6741 SsaBuilder.prototype.visitLiteralBool = function(node) { | 6741 SsaBuilder.prototype.visitLiteralBool = function(node) { |
| 6742 this.push(new HLiteral(node.get$value())); | 6742 this.push(new HLiteral(node.get$value())); |
| 6743 } | 6743 } |
| 6744 SsaBuilder.prototype.visitLiteralString = function(node) { | 6744 SsaBuilder.prototype.visitLiteralString = function(node) { |
| 6745 this.push(new HLiteral(node.get$value())); | 6745 this.push(new HLiteral(node.get$value())); |
| 6746 } | 6746 } |
| 6747 SsaBuilder.prototype.visitNodeList = function(node) { | 6747 SsaBuilder.prototype.visitNodeList = function(node) { |
| 6748 var $0; | 6748 var $0; |
| 6749 for (var link = node.nodes; | 6749 for (var link = node.nodes; |
| 6750 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 6750 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail())
&& $0.is$Link$Node())) { |
| 6751 this.visit((($0 = link.get$head()) && $0.is$Node())); | 6751 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 6752 } | 6752 } |
| 6753 } | 6753 } |
| 6754 SsaBuilder.prototype.visitOperator = function(node) { | 6754 SsaBuilder.prototype.visitOperator = function(node) { |
| 6755 this.compiler.unimplemented("SsaBuilder::visitOperator"); | 6755 this.compiler.unimplemented("SsaBuilder::visitOperator"); |
| 6756 } | 6756 } |
| 6757 SsaBuilder.prototype.visitParameter = function(node) { | 6757 SsaBuilder.prototype.visitParameter = function(node) { |
| 6758 this.compiler.unimplemented("SsaBuilder::visitParameter"); | 6758 this.compiler.unimplemented("SsaBuilder::visitParameter"); |
| 6759 } | 6759 } |
| 6760 SsaBuilder.prototype.visitReturn = function(node) { | 6760 SsaBuilder.prototype.visitReturn = function(node) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6802 function SsaCodeGenerator(compiler, buffer) { | 6802 function SsaCodeGenerator(compiler, buffer) { |
| 6803 this.compiler = compiler; | 6803 this.compiler = compiler; |
| 6804 this.buffer = buffer; | 6804 this.buffer = buffer; |
| 6805 // Initializers done | 6805 // Initializers done |
| 6806 } | 6806 } |
| 6807 SsaCodeGenerator.prototype.visitGraph = function(graph) { | 6807 SsaCodeGenerator.prototype.visitGraph = function(graph) { |
| 6808 var $this = this; // closure support | 6808 var $this = this; // closure support |
| 6809 function visitBasicBlockAndSuccessors(block) { | 6809 function visitBasicBlockAndSuccessors(block) { |
| 6810 var $0; | 6810 var $0; |
| 6811 $this.visit(block); | 6811 $this.visit(block); |
| 6812 if ($notnull_bool(!block.successors.isEmpty())) { | 6812 if ($notnull_bool(!$notnull_bool(block.successors.isEmpty()))) { |
| 6813 $assert(block.successors.length == 1, "block.successors.length == 1", "leg
/ssa/codegen.dart", 39, 16); | 6813 $assert(block.successors.length == 1, "block.successors.length == 1", "leg
/ssa/codegen.dart", 39, 16); |
| 6814 visitBasicBlockAndSuccessors((($0 = block.successors.$index(0)) && $0.is$H
BasicBlock())); | 6814 visitBasicBlockAndSuccessors((($0 = block.successors.$index(0)) && $0.is$H
BasicBlock())); |
| 6815 } | 6815 } |
| 6816 } | 6816 } |
| 6817 visitBasicBlockAndSuccessors(graph.entry); | 6817 visitBasicBlockAndSuccessors(graph.entry); |
| 6818 } | 6818 } |
| 6819 SsaCodeGenerator.prototype.temporary = function(instruction) { | 6819 SsaCodeGenerator.prototype.temporary = function(instruction) { |
| 6820 return ('t' + instruction.id + ''); | 6820 return ('t' + instruction.id + ''); |
| 6821 } | 6821 } |
| 6822 SsaCodeGenerator.prototype.invoke = function(selector, arguments) { | 6822 SsaCodeGenerator.prototype.invoke = function(selector, arguments) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 6843 } | 6843 } |
| 6844 SsaCodeGenerator.prototype.visit = function(node) { | 6844 SsaCodeGenerator.prototype.visit = function(node) { |
| 6845 return node.accept(this); | 6845 return node.accept(this); |
| 6846 } | 6846 } |
| 6847 SsaCodeGenerator.prototype.visitAdd = function(node) { | 6847 SsaCodeGenerator.prototype.visitAdd = function(node) { |
| 6848 this.invoke(const$266/*const SourceString('\$add')*/, node.inputs); | 6848 this.invoke(const$266/*const SourceString('\$add')*/, node.inputs); |
| 6849 } | 6849 } |
| 6850 SsaCodeGenerator.prototype.visitBasicBlock = function(node) { | 6850 SsaCodeGenerator.prototype.visitBasicBlock = function(node) { |
| 6851 var instruction = node.first; | 6851 var instruction = node.first; |
| 6852 while ($notnull_bool(instruction != null)) { | 6852 while ($notnull_bool(instruction != null)) { |
| 6853 if ($notnull_bool(!instruction.canBeSkipped())) { | 6853 if ($notnull_bool(!$notnull_bool(instruction.canBeSkipped()))) { |
| 6854 this.buffer.add(' '); | 6854 this.buffer.add(' '); |
| 6855 if ($notnull_bool(!instruction.get$usedBy().isEmpty())) { | 6855 if ($notnull_bool(!$notnull_bool(instruction.get$usedBy().isEmpty()))) { |
| 6856 this.define(instruction); | 6856 this.define(instruction); |
| 6857 } | 6857 } |
| 6858 else { | 6858 else { |
| 6859 this.visit(instruction); | 6859 this.visit(instruction); |
| 6860 } | 6860 } |
| 6861 this.buffer.add(';\n'); | 6861 this.buffer.add(';\n'); |
| 6862 } | 6862 } |
| 6863 instruction = instruction.next; | 6863 instruction = instruction.next; |
| 6864 } | 6864 } |
| 6865 } | 6865 } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7127 HInstruction.prototype.isInBasicBlock = function() { | 7127 HInstruction.prototype.isInBasicBlock = function() { |
| 7128 return this._usedBy != null; | 7128 return this._usedBy != null; |
| 7129 } | 7129 } |
| 7130 HInstruction.prototype.$eq = function(other) { | 7130 HInstruction.prototype.$eq = function(other) { |
| 7131 return false; | 7131 return false; |
| 7132 } | 7132 } |
| 7133 HInstruction.prototype.hashCode = function() { | 7133 HInstruction.prototype.hashCode = function() { |
| 7134 return 0; | 7134 return 0; |
| 7135 } | 7135 } |
| 7136 HInstruction.prototype.notifyAddedToBlock = function() { | 7136 HInstruction.prototype.notifyAddedToBlock = function() { |
| 7137 $assert(!this.isInBasicBlock(), "!isInBasicBlock()", "leg/ssa/nodes.dart", 283
, 12); | 7137 $assert(!$notnull_bool(this.isInBasicBlock()), "!isInBasicBlock()", "leg/ssa/n
odes.dart", 283, 12); |
| 7138 this._usedBy = []; | 7138 this._usedBy = []; |
| 7139 for (var i = 0; | 7139 for (var i = 0; |
| 7140 $notnull_bool(i < this.inputs.length); i++) { | 7140 $notnull_bool(i < this.inputs.length); i++) { |
| 7141 this.inputs.$index(i).get$usedBy().add(this); | 7141 this.inputs.$index(i).get$usedBy().add(this); |
| 7142 } | 7142 } |
| 7143 $assert(this.isValid(), "isValid()", "leg/ssa/nodes.dart", 289, 12); | 7143 $assert(this.isValid(), "isValid()", "leg/ssa/nodes.dart", 289, 12); |
| 7144 } | 7144 } |
| 7145 HInstruction.prototype.notifyRemovedFromBlock = function() { | 7145 HInstruction.prototype.notifyRemovedFromBlock = function() { |
| 7146 $assert(this.isInBasicBlock(), "isInBasicBlock()", "leg/ssa/nodes.dart", 293,
12); | 7146 $assert(this.isInBasicBlock(), "isInBasicBlock()", "leg/ssa/nodes.dart", 293,
12); |
| 7147 $assert(this.get$usedBy().isEmpty(), "usedBy.isEmpty()", "leg/ssa/nodes.dart",
294, 12); | 7147 $assert(this.get$usedBy().isEmpty(), "usedBy.isEmpty()", "leg/ssa/nodes.dart",
294, 12); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7397 } | 7397 } |
| 7398 return node; | 7398 return node; |
| 7399 } | 7399 } |
| 7400 // ********** Code for SsaDeadCodeEliminator ************** | 7400 // ********** Code for SsaDeadCodeEliminator ************** |
| 7401 function SsaDeadCodeEliminator() { | 7401 function SsaDeadCodeEliminator() { |
| 7402 HGraphVisitor.call(this); | 7402 HGraphVisitor.call(this); |
| 7403 // Initializers done | 7403 // Initializers done |
| 7404 } | 7404 } |
| 7405 $inherits(SsaDeadCodeEliminator, HGraphVisitor); | 7405 $inherits(SsaDeadCodeEliminator, HGraphVisitor); |
| 7406 SsaDeadCodeEliminator.isDeadCode = function(instruction) { | 7406 SsaDeadCodeEliminator.isDeadCode = function(instruction) { |
| 7407 return !instruction.hasSideEffects() && instruction.get$usedBy().isEmpty(); | 7407 return !$notnull_bool(instruction.hasSideEffects()) && instruction.get$usedBy(
).isEmpty(); |
| 7408 } | 7408 } |
| 7409 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) { | 7409 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) { |
| 7410 this.visitPostDominatorTree(graph); | 7410 this.visitPostDominatorTree(graph); |
| 7411 } | 7411 } |
| 7412 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) { | 7412 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) { |
| 7413 var instruction = block.last; | 7413 var instruction = block.last; |
| 7414 while ($notnull_bool(instruction != null)) { | 7414 while ($notnull_bool(instruction != null)) { |
| 7415 var previous = instruction.previous; | 7415 var previous = instruction.previous; |
| 7416 if ($notnull_bool(SsaDeadCodeEliminator.isDeadCode(instruction))) block.remo
ve(instruction); | 7416 if ($notnull_bool(SsaDeadCodeEliminator.isDeadCode(instruction))) block.remo
ve(instruction); |
| 7417 instruction = (previous && previous.is$HInstruction()); | 7417 instruction = (previous && previous.is$HInstruction()); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7659 this.isValid = true | 7659 this.isValid = true |
| 7660 HInstructionVisitor.call(this); | 7660 HInstructionVisitor.call(this); |
| 7661 // Initializers done | 7661 // Initializers done |
| 7662 } | 7662 } |
| 7663 $inherits(HValidator, HInstructionVisitor); | 7663 $inherits(HValidator, HInstructionVisitor); |
| 7664 HValidator.prototype.visitGraph = function(graph0) { | 7664 HValidator.prototype.visitGraph = function(graph0) { |
| 7665 this.graph = graph0; | 7665 this.graph = graph0; |
| 7666 this.visitDominatorTree(graph0); | 7666 this.visitDominatorTree(graph0); |
| 7667 } | 7667 } |
| 7668 HValidator.prototype.visitBasicBlock = function(block) { | 7668 HValidator.prototype.visitBasicBlock = function(block) { |
| 7669 if ($notnull_bool(!this.isValid)) return; | 7669 if ($notnull_bool(!$notnull_bool(this.isValid))) return; |
| 7670 if ($notnull_bool(block.first == null || block.last == null)) this.isValid = f
alse; | 7670 if ($notnull_bool(block.first == null || block.last == null)) this.isValid = f
alse; |
| 7671 if ($notnull_bool(!(block.last instanceof HGoto) && !(block.last instanceof HR
eturn) && !(block.last instanceof HExit))) { | 7671 if ($notnull_bool(!(block.last instanceof HGoto) && !(block.last instanceof HR
eturn) && !(block.last instanceof HExit))) { |
| 7672 this.isValid = false; | 7672 this.isValid = false; |
| 7673 } | 7673 } |
| 7674 if ($notnull_bool((block.last instanceof HGoto) && block.successors.length !=
1)) this.isValid = false; | 7674 if ($notnull_bool((block.last instanceof HGoto) && block.successors.length !=
1)) this.isValid = false; |
| 7675 if ($notnull_bool((block.last instanceof HReturn) && (block.successors.length
!= 1 || !block.successors.$index(0).isExitBlock()))) { | 7675 if ($notnull_bool((block.last instanceof HReturn) && (block.successors.length
!= 1 || !$notnull_bool(block.successors.$index(0).isExitBlock())))) { |
| 7676 this.isValid = false; | 7676 this.isValid = false; |
| 7677 } | 7677 } |
| 7678 if ($notnull_bool((block.last instanceof HExit) && !block.successors.isEmpty()
)) this.isValid = false; | 7678 if ($notnull_bool((block.last instanceof HExit) && !$notnull_bool(block.succes
sors.isEmpty()))) this.isValid = false; |
| 7679 if ($notnull_bool(block.successors.isEmpty() && (block.first !== block.last ||
!(block.last instanceof HExit)))) { | 7679 if ($notnull_bool(block.successors.isEmpty() && (block.first !== block.last ||
!(block.last instanceof HExit)))) { |
| 7680 this.isValid = false; | 7680 this.isValid = false; |
| 7681 } | 7681 } |
| 7682 if ($notnull_bool(!this.isValid)) return; | 7682 if ($notnull_bool(!$notnull_bool(this.isValid))) return; |
| 7683 HInstructionVisitor.prototype.visitBasicBlock.call(this, block); | 7683 HInstructionVisitor.prototype.visitBasicBlock.call(this, block); |
| 7684 } | 7684 } |
| 7685 HValidator.countInstruction = function(instructions, instruction) { | 7685 HValidator.countInstruction = function(instructions, instruction) { |
| 7686 var result = 0; | 7686 var result = 0; |
| 7687 for (var i = 0; | 7687 for (var i = 0; |
| 7688 $notnull_bool(i < instructions.length); i++) { | 7688 $notnull_bool(i < instructions.length); i++) { |
| 7689 if ($notnull_bool(instructions.$index(i) === instruction)) result++; | 7689 if ($notnull_bool(instructions.$index(i) === instruction)) result++; |
| 7690 } | 7690 } |
| 7691 return result; | 7691 return result; |
| 7692 } | 7692 } |
| 7693 HValidator.everyInstruction = function(instructions, f) { | 7693 HValidator.everyInstruction = function(instructions, f) { |
| 7694 var copy = ListFactory.ListFactory$from$factory(instructions); | 7694 var copy = ListFactory.ListFactory$from$factory(instructions); |
| 7695 for (var i = 0; | 7695 for (var i = 0; |
| 7696 $notnull_bool(i < copy.length); i++) { | 7696 $notnull_bool(i < copy.length); i++) { |
| 7697 var current = copy.$index(i); | 7697 var current = copy.$index(i); |
| 7698 if ($notnull_bool(current == null)) continue; | 7698 if ($notnull_bool(current == null)) continue; |
| 7699 var count = 1; | 7699 var count = 1; |
| 7700 for (var j = i + 1; | 7700 for (var j = i + 1; |
| 7701 $notnull_bool(j < copy.length); j++) { | 7701 $notnull_bool(j < copy.length); j++) { |
| 7702 if ($notnull_bool(copy.$index(j) === current)) { | 7702 if ($notnull_bool(copy.$index(j) === current)) { |
| 7703 copy.$setindex(j); | 7703 copy.$setindex(j); |
| 7704 count++; | 7704 count++; |
| 7705 } | 7705 } |
| 7706 } | 7706 } |
| 7707 if ($notnull_bool(!f.call$2(current, count))) return false; | 7707 if ($notnull_bool(!$notnull_bool(f.call$2(current, count)))) return false; |
| 7708 } | 7708 } |
| 7709 return true; | 7709 return true; |
| 7710 } | 7710 } |
| 7711 HValidator.prototype.visitInstruction = function(instruction) { | 7711 HValidator.prototype.visitInstruction = function(instruction) { |
| 7712 var $this = this; // closure support | 7712 var $this = this; // closure support |
| 7713 function hasCorrectInputs(instruction0) { | 7713 function hasCorrectInputs(instruction0) { |
| 7714 var inBasicBlock = instruction0.isInBasicBlock(); | 7714 var inBasicBlock = instruction0.isInBasicBlock(); |
| 7715 return HValidator.everyInstruction(instruction0.inputs, (function (input, co
unt) { | 7715 return HValidator.everyInstruction(instruction0.inputs, (function (input, co
unt) { |
| 7716 if ($notnull_bool(inBasicBlock)) { | 7716 if ($notnull_bool(inBasicBlock)) { |
| 7717 return HValidator.countInstruction(input.get$usedBy(), (instruction0 &&
instruction0.is$HInstruction())) == count; | 7717 return HValidator.countInstruction(input.get$usedBy(), (instruction0 &&
instruction0.is$HInstruction())) == count; |
| 7718 } | 7718 } |
| 7719 else { | 7719 else { |
| 7720 return HValidator.countInstruction(input.get$usedBy(), (instruction0 &&
instruction0.is$HInstruction())) == 0; | 7720 return HValidator.countInstruction(input.get$usedBy(), (instruction0 &&
instruction0.is$HInstruction())) == 0; |
| 7721 } | 7721 } |
| 7722 }) | 7722 }) |
| 7723 ); | 7723 ); |
| 7724 } | 7724 } |
| 7725 function hasCorrectUses(instruction0) { | 7725 function hasCorrectUses(instruction0) { |
| 7726 if ($notnull_bool(!instruction0.isInBasicBlock())) return true; | 7726 if ($notnull_bool(!$notnull_bool(instruction0.isInBasicBlock()))) return tru
e; |
| 7727 return HValidator.everyInstruction(instruction0.get$usedBy(), (function (use
, count) { | 7727 return HValidator.everyInstruction(instruction0.get$usedBy(), (function (use
, count) { |
| 7728 return HValidator.countInstruction(use.inputs, (instruction0 && instructio
n0.is$HInstruction())) == count; | 7728 return HValidator.countInstruction(use.inputs, (instruction0 && instructio
n0.is$HInstruction())) == count; |
| 7729 }) | 7729 }) |
| 7730 ); | 7730 ); |
| 7731 } | 7731 } |
| 7732 this.isValid = $assert_bool(this.isValid && hasCorrectInputs(instruction) && h
asCorrectUses(instruction)); | 7732 this.isValid = $assert_bool(this.isValid && hasCorrectInputs(instruction) && h
asCorrectUses(instruction)); |
| 7733 } | 7733 } |
| 7734 // ********** Code for top level ************** | 7734 // ********** Code for top level ************** |
| 7735 // ********** Library leg ************** | 7735 // ********** Library leg ************** |
| 7736 // ********** Code for WorldCompiler ************** | 7736 // ********** Code for WorldCompiler ************** |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7809 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) { | 7809 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) { |
| 7810 print("------------------"); | 7810 print("------------------"); |
| 7811 print(HTracer.HTracer$singleton$factory()); | 7811 print(HTracer.HTracer$singleton$factory()); |
| 7812 print("------------------"); | 7812 print("------------------"); |
| 7813 } | 7813 } |
| 7814 this.log('compilation succeeded'); | 7814 this.log('compilation succeeded'); |
| 7815 return true; | 7815 return true; |
| 7816 } | 7816 } |
| 7817 Compiler.prototype.runCompiler = function() { | 7817 Compiler.prototype.runCompiler = function() { |
| 7818 this.scanner.scan(this.script); | 7818 this.scanner.scan(this.script); |
| 7819 while ($notnull_bool(!this.worklist.isEmpty())) { | 7819 while ($notnull_bool(!$notnull_bool(this.worklist.isEmpty()))) { |
| 7820 var name = this.worklist.removeLast(); | 7820 var name = this.worklist.removeLast(); |
| 7821 var element = this.universe.find(name); | 7821 var element = this.universe.find(name); |
| 7822 if ($notnull_bool(element == null)) this.cancel(('Could not find ' + name +
'')); | 7822 if ($notnull_bool(element == null)) this.cancel(('Could not find ' + name +
'')); |
| 7823 var tree = element.parseNode(this, this); | 7823 var tree = element.parseNode(this, this); |
| 7824 var elements = this.resolver.resolve(tree); | 7824 var elements = this.resolver.resolve(tree); |
| 7825 this.checker.check(tree, elements); | 7825 this.checker.check(tree, elements); |
| 7826 var graph = this.builder.build(tree); | 7826 var graph = this.builder.build(tree); |
| 7827 this.optimizer.optimize(graph); | 7827 this.optimizer.optimize(graph); |
| 7828 var code = this.generator.generate(tree, graph); | 7828 var code = this.generator.generate(tree, graph); |
| 7829 this.universe.addGeneratedCode(element, code); | 7829 this.universe.addGeneratedCode(element, code); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7914 this.context = this.context.parent; | 7914 this.context = this.context.parent; |
| 7915 return element; | 7915 return element; |
| 7916 } | 7916 } |
| 7917 ResolverVisitor.prototype.visitBlock = function(node) { | 7917 ResolverVisitor.prototype.visitBlock = function(node) { |
| 7918 this.visitIn(node.statements, new Scope(this.context)); | 7918 this.visitIn(node.statements, new Scope(this.context)); |
| 7919 } | 7919 } |
| 7920 ResolverVisitor.prototype.visitExpressionStatement = function(node) { | 7920 ResolverVisitor.prototype.visitExpressionStatement = function(node) { |
| 7921 this.visit(node.expression); | 7921 this.visit(node.expression); |
| 7922 } | 7922 } |
| 7923 ResolverVisitor.prototype.visitFunctionExpression = function(node) { | 7923 ResolverVisitor.prototype.visitFunctionExpression = function(node) { |
| 7924 if ($notnull_bool(!node.parameters.nodes.isEmpty())) this.fail(node); | 7924 if ($notnull_bool(!$notnull_bool(node.parameters.nodes.isEmpty()))) this.fail(
node); |
| 7925 var enclosingElement = this.visit(node.name); | 7925 var enclosingElement = this.visit(node.name); |
| 7926 this.visitIn(node.body, new Scope.enclosing$ctor(this.context, enclosingElemen
t)); | 7926 this.visitIn(node.body, new Scope.enclosing$ctor(this.context, enclosingElemen
t)); |
| 7927 return enclosingElement; | 7927 return enclosingElement; |
| 7928 } | 7928 } |
| 7929 ResolverVisitor.prototype.visitIdentifier = function(node) { | 7929 ResolverVisitor.prototype.visitIdentifier = function(node) { |
| 7930 var element = this.context.lookup(node.get$source()); | 7930 var element = this.context.lookup(node.get$source()); |
| 7931 if ($notnull_bool(element == null)) this.fail(node); | 7931 if ($notnull_bool(element == null)) this.fail(node); |
| 7932 return element; | 7932 return element; |
| 7933 } | 7933 } |
| 7934 ResolverVisitor.prototype.visitIf = function(node) { | 7934 ResolverVisitor.prototype.visitIf = function(node) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7966 } | 7966 } |
| 7967 ResolverVisitor.prototype.visitLiteralBool = function(node) { | 7967 ResolverVisitor.prototype.visitLiteralBool = function(node) { |
| 7968 | 7968 |
| 7969 } | 7969 } |
| 7970 ResolverVisitor.prototype.visitLiteralString = function(node) { | 7970 ResolverVisitor.prototype.visitLiteralString = function(node) { |
| 7971 | 7971 |
| 7972 } | 7972 } |
| 7973 ResolverVisitor.prototype.visitNodeList = function(node) { | 7973 ResolverVisitor.prototype.visitNodeList = function(node) { |
| 7974 var $0; | 7974 var $0; |
| 7975 for (var link = node.nodes; | 7975 for (var link = node.nodes; |
| 7976 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 7976 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail())
&& $0.is$Link$Node())) { |
| 7977 this.visit((($0 = link.get$head()) && $0.is$Node())); | 7977 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 7978 } | 7978 } |
| 7979 } | 7979 } |
| 7980 ResolverVisitor.prototype.visitOperator = function(node) { | 7980 ResolverVisitor.prototype.visitOperator = function(node) { |
| 7981 this.fail(node); | 7981 this.fail(node); |
| 7982 } | 7982 } |
| 7983 ResolverVisitor.prototype.visitReturn = function(node) { | 7983 ResolverVisitor.prototype.visitReturn = function(node) { |
| 7984 this.visit(node.expression); | 7984 this.visit(node.expression); |
| 7985 return null; | 7985 return null; |
| 7986 } | 7986 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 8010 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node())); | 8010 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node())); |
| 8011 this.visit(node.receiver); | 8011 this.visit(node.receiver); |
| 8012 } | 8012 } |
| 8013 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { | 8013 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { |
| 8014 var variableElement = new Element(node.get$source(), this.resolver.context.enc
losingElement); | 8014 var variableElement = new Element(node.get$source(), this.resolver.context.enc
losingElement); |
| 8015 this.resolver.setElement(node, variableElement); | 8015 this.resolver.setElement(node, variableElement); |
| 8016 } | 8016 } |
| 8017 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { | 8017 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { |
| 8018 var $0; | 8018 var $0; |
| 8019 for (var link = node.nodes; | 8019 for (var link = node.nodes; |
| 8020 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 8020 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail())
&& $0.is$Link$Node())) { |
| 8021 this.visit((($0 = link.get$head()) && $0.is$Node())); | 8021 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 8022 } | 8022 } |
| 8023 } | 8023 } |
| 8024 VariableDefinitionsVisitor.prototype.visit = function(node) { | 8024 VariableDefinitionsVisitor.prototype.visit = function(node) { |
| 8025 return node.accept(this); | 8025 return node.accept(this); |
| 8026 } | 8026 } |
| 8027 // ********** Code for Scope ************** | 8027 // ********** Code for Scope ************** |
| 8028 function Scope(parent0) { | 8028 function Scope(parent0) { |
| 8029 Scope.enclosing$ctor.call(this, parent0, parent0.enclosingElement); | 8029 Scope.enclosing$ctor.call(this, parent0, parent0.enclosingElement); |
| 8030 // Initializers done | 8030 // Initializers done |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8073 $inherits(ScannerTask, CompilerTask); | 8073 $inherits(ScannerTask, CompilerTask); |
| 8074 ScannerTask.prototype.get$name = function() { | 8074 ScannerTask.prototype.get$name = function() { |
| 8075 return 'Scanner'; | 8075 return 'Scanner'; |
| 8076 } | 8076 } |
| 8077 ScannerTask.prototype.scan = function(script) { | 8077 ScannerTask.prototype.scan = function(script) { |
| 8078 var $this = this; // closure support | 8078 var $this = this; // closure support |
| 8079 this.measure((function () { | 8079 this.measure((function () { |
| 8080 var $0; | 8080 var $0; |
| 8081 var elements = $this.scanElements(script.get$text()); | 8081 var elements = $this.scanElements(script.get$text()); |
| 8082 for (var link = elements; | 8082 for (var link = elements; |
| 8083 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Lin
k$Element())) { | 8083 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail(
)) && $0.is$Link$Element())) { |
| 8084 $this.compiler.universe.define((($0 = link.get$head()) && $0.is$Element())
); | 8084 $this.compiler.universe.define((($0 = link.get$head()) && $0.is$Element())
); |
| 8085 } | 8085 } |
| 8086 }) | 8086 }) |
| 8087 ); | 8087 ); |
| 8088 } | 8088 } |
| 8089 ScannerTask.prototype.scanElements = function(text) { | 8089 ScannerTask.prototype.scanElements = function(text) { |
| 8090 var tokens = new StringScanner(text).tokenize(); | 8090 var tokens = new StringScanner(text).tokenize(); |
| 8091 var listener = new Listener(this.compiler); | 8091 var listener = new Listener(this.compiler); |
| 8092 var parser = new Parser(listener); | 8092 var parser = new Parser(listener); |
| 8093 parser.parseUnit(tokens); | 8093 parser.parseUnit(tokens); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8142 // Initializers done | 8142 // Initializers done |
| 8143 } | 8143 } |
| 8144 FunctionType.prototype.is$Type = function(){return this;}; | 8144 FunctionType.prototype.is$Type = function(){return this;}; |
| 8145 FunctionType.prototype.get$returnType = function() { return this.returnType; }; | 8145 FunctionType.prototype.get$returnType = function() { return this.returnType; }; |
| 8146 FunctionType.prototype.toString = function() { | 8146 FunctionType.prototype.toString = function() { |
| 8147 var $0; | 8147 var $0; |
| 8148 var sb = new StringBufferImpl(""); | 8148 var sb = new StringBufferImpl(""); |
| 8149 var first = true; | 8149 var first = true; |
| 8150 sb.add('('); | 8150 sb.add('('); |
| 8151 for (var link = this.parameterTypes; | 8151 for (var link = this.parameterTypes; |
| 8152 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Type())) { | 8152 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail())
&& $0.is$Link$Type())) { |
| 8153 if ($notnull_bool(!first)) sb.add(', '); | 8153 if ($notnull_bool(!$notnull_bool(first))) sb.add(', '); |
| 8154 first = false; | 8154 first = false; |
| 8155 sb.add(link.get$head()); | 8155 sb.add(link.get$head()); |
| 8156 } | 8156 } |
| 8157 sb.add((') -> ' + this.returnType + '')); | 8157 sb.add((') -> ' + this.returnType + '')); |
| 8158 return sb.toString(); | 8158 return sb.toString(); |
| 8159 } | 8159 } |
| 8160 // ********** Code for Types ************** | 8160 // ********** Code for Types ************** |
| 8161 function Types() { | 8161 function Types() { |
| 8162 this.VOID = new SimpleType(const$254, new Element(const$254/*const SourceStrin
g('void')*/)); | 8162 this.VOID = new SimpleType(const$254, new Element(const$254/*const SourceStrin
g('void')*/)); |
| 8163 this.INT = new SimpleType(const$255, new Element(const$255/*const SourceString
('int')*/)); | 8163 this.INT = new SimpleType(const$255, new Element(const$255/*const SourceString
('int')*/)); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8210 if ($notnull_bool(node.get$hasElsePart())) this.visit(node.elsePart); | 8210 if ($notnull_bool(node.get$hasElsePart())) this.visit(node.elsePart); |
| 8211 return this.types.VOID; | 8211 return this.types.VOID; |
| 8212 } | 8212 } |
| 8213 TypeCheckerVisitor.prototype.visitSend = function(node) { | 8213 TypeCheckerVisitor.prototype.visitSend = function(node) { |
| 8214 var $0; | 8214 var $0; |
| 8215 var target = this.elements.$index(node); | 8215 var target = this.elements.$index(node); |
| 8216 if ($notnull_bool(target != null)) { | 8216 if ($notnull_bool(target != null)) { |
| 8217 var funType = target.computeType(this.compiler, this.types); | 8217 var funType = target.computeType(this.compiler, this.types); |
| 8218 var formals = funType.parameterTypes; | 8218 var formals = funType.parameterTypes; |
| 8219 var arguments = node.get$arguments(); | 8219 var arguments = node.get$arguments(); |
| 8220 while ($notnull_bool((!formals.isEmpty()) && (!arguments.isEmpty()))) { | 8220 while ($notnull_bool((!$notnull_bool(formals.isEmpty())) && (!$notnull_bool(
arguments.isEmpty())))) { |
| 8221 this.compiler.cancel('parameters not supported.'); | 8221 this.compiler.cancel('parameters not supported.'); |
| 8222 var argumentType = this.visit((($0 = arguments.get$head()) && $0.is$Node()
)); | 8222 var argumentType = this.visit((($0 = arguments.get$head()) && $0.is$Node()
)); |
| 8223 if ($notnull_bool(!this.types.isAssignable((($0 = formals.get$head()) && $
0.is$Type()), (argumentType && argumentType.is$Type())))) { | 8223 if ($notnull_bool(!$notnull_bool(this.types.isAssignable((($0 = formals.ge
t$head()) && $0.is$Type()), (argumentType && argumentType.is$Type()))))) { |
| 8224 var warning = CompilerError.NOT_ASSIGNABLE((argumentType && argumentType
.is$Type()), (($0 = formals.get$head()) && $0.is$Type())); | 8224 var warning = CompilerError.NOT_ASSIGNABLE((argumentType && argumentType
.is$Type()), (($0 = formals.get$head()) && $0.is$Type())); |
| 8225 this.compiler.reportWarning(node, warning); | 8225 this.compiler.reportWarning(node, warning); |
| 8226 } | 8226 } |
| 8227 formals = (($0 = formals.get$tail()) && $0.is$Link$Type()); | 8227 formals = (($0 = formals.get$tail()) && $0.is$Link$Type()); |
| 8228 arguments = (($0 = arguments.get$tail()) && $0.is$Link$Node()); | 8228 arguments = (($0 = arguments.get$tail()) && $0.is$Link$Node()); |
| 8229 } | 8229 } |
| 8230 if ($notnull_bool(!formals.isEmpty())) { | 8230 if ($notnull_bool(!$notnull_bool(formals.isEmpty()))) { |
| 8231 this.compiler.reportWarning(node, 'missing argument'); | 8231 this.compiler.reportWarning(node, 'missing argument'); |
| 8232 } | 8232 } |
| 8233 if ($notnull_bool(!arguments.isEmpty())) { | 8233 if ($notnull_bool(!$notnull_bool(arguments.isEmpty()))) { |
| 8234 this.compiler.reportWarning(node, 'additional arguments'); | 8234 this.compiler.reportWarning(node, 'additional arguments'); |
| 8235 } | 8235 } |
| 8236 return funType.returnType; | 8236 return funType.returnType; |
| 8237 } | 8237 } |
| 8238 else { | 8238 else { |
| 8239 var selector = node.selector; | 8239 var selector = node.selector; |
| 8240 var name = selector.get$source(); | 8240 var name = selector.get$source(); |
| 8241 if ($notnull_bool($eq(name, const$248/*const SourceString('print')*/) || $eq
(name, const$249/*const SourceString('+')*/))) { | 8241 if ($notnull_bool($eq(name, const$248/*const SourceString('print')*/) || $eq
(name, const$249/*const SourceString('+')*/))) { |
| 8242 return this.types.DYNAMIC; | 8242 return this.types.DYNAMIC; |
| 8243 } | 8243 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 8255 } | 8255 } |
| 8256 TypeCheckerVisitor.prototype.visitLiteralBool = function(node) { | 8256 TypeCheckerVisitor.prototype.visitLiteralBool = function(node) { |
| 8257 return this.types.DYNAMIC; | 8257 return this.types.DYNAMIC; |
| 8258 } | 8258 } |
| 8259 TypeCheckerVisitor.prototype.visitLiteralString = function(node) { | 8259 TypeCheckerVisitor.prototype.visitLiteralString = function(node) { |
| 8260 return this.types.DYNAMIC; | 8260 return this.types.DYNAMIC; |
| 8261 } | 8261 } |
| 8262 TypeCheckerVisitor.prototype.visitNodeList = function(node) { | 8262 TypeCheckerVisitor.prototype.visitNodeList = function(node) { |
| 8263 var $0; | 8263 var $0; |
| 8264 for (var link = node.nodes; | 8264 for (var link = node.nodes; |
| 8265 $notnull_bool(!link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$
Node())) { | 8265 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail())
&& $0.is$Link$Node())) { |
| 8266 this.visit((($0 = link.get$head()) && $0.is$Node())); | 8266 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 8267 } | 8267 } |
| 8268 } | 8268 } |
| 8269 TypeCheckerVisitor.prototype.visitOperator = function(node) { | 8269 TypeCheckerVisitor.prototype.visitOperator = function(node) { |
| 8270 return this.types.DYNAMIC; | 8270 return this.types.DYNAMIC; |
| 8271 } | 8271 } |
| 8272 TypeCheckerVisitor.prototype.visitParameter = function(node) { | 8272 TypeCheckerVisitor.prototype.visitParameter = function(node) { |
| 8273 return null; | 8273 return null; |
| 8274 } | 8274 } |
| 8275 TypeCheckerVisitor.prototype.visitReturn = function(node) { | 8275 TypeCheckerVisitor.prototype.visitReturn = function(node) { |
| 8276 var expressionType = this.visit(node.expression); | 8276 var expressionType = this.visit(node.expression); |
| 8277 if ($notnull_bool(!this.types.isAssignable(this.expectedReturnType, expression
Type))) { | 8277 if ($notnull_bool(!$notnull_bool(this.types.isAssignable(this.expectedReturnTy
pe, expressionType)))) { |
| 8278 var error = CompilerError.NOT_ASSIGNABLE(this.expectedReturnType, expression
Type); | 8278 var error = CompilerError.NOT_ASSIGNABLE(this.expectedReturnType, expression
Type); |
| 8279 this.compiler.reportWarning(node, error); | 8279 this.compiler.reportWarning(node, error); |
| 8280 } | 8280 } |
| 8281 return this.types.VOID; | 8281 return this.types.VOID; |
| 8282 } | 8282 } |
| 8283 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) { | 8283 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) { |
| 8284 if ($notnull_bool(node.typeName != null && $ne(node.typeName.get$source(), con
st$254/*const SourceString('void')*/))) { | 8284 if ($notnull_bool(node.typeName != null && $ne(node.typeName.get$source(), con
st$254/*const SourceString('void')*/))) { |
| 8285 this.compiler.cancel(('unsupported type ' + node.typeName + '')); | 8285 this.compiler.cancel(('unsupported type ' + node.typeName + '')); |
| 8286 } | 8286 } |
| 8287 return this.types.VOID; | 8287 return this.types.VOID; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8353 this.write($assert_String(lines.$index(lines.length - 1))); | 8353 this.write($assert_String(lines.$index(lines.length - 1))); |
| 8354 } | 8354 } |
| 8355 else { | 8355 else { |
| 8356 this._buf.add(text0); | 8356 this._buf.add(text0); |
| 8357 } | 8357 } |
| 8358 } | 8358 } |
| 8359 CodeWriter.prototype.writeln = function(text0) { | 8359 CodeWriter.prototype.writeln = function(text0) { |
| 8360 if ($notnull_bool(text0 != null)) { | 8360 if ($notnull_bool(text0 != null)) { |
| 8361 this.write(text0); | 8361 this.write(text0); |
| 8362 } | 8362 } |
| 8363 if ($notnull_bool(!text0.endsWith('\n'))) this._buf.add('\n'/*CodeWriter.NEWLI
NE*/); | 8363 if ($notnull_bool(!$notnull_bool(text0.endsWith('\n')))) this._buf.add('\n'/*C
odeWriter.NEWLINE*/); |
| 8364 this._pendingIndent = true; | 8364 this._pendingIndent = true; |
| 8365 } | 8365 } |
| 8366 CodeWriter.prototype.enterBlock = function(text0) { | 8366 CodeWriter.prototype.enterBlock = function(text0) { |
| 8367 this.writeln(text0); | 8367 this.writeln(text0); |
| 8368 this._indentation++; | 8368 this._indentation++; |
| 8369 } | 8369 } |
| 8370 CodeWriter.prototype.exitBlock = function(text0) { | 8370 CodeWriter.prototype.exitBlock = function(text0) { |
| 8371 this._indentation--; | 8371 this._indentation--; |
| 8372 this.writeln(text0); | 8372 this.writeln(text0); |
| 8373 } | 8373 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 8396 var matchConstructor = world.get$coreimpl().types.$index('MatchImplementation'
).getConstructor(''); | 8396 var matchConstructor = world.get$coreimpl().types.$index('MatchImplementation'
).getConstructor(''); |
| 8397 this.genMethod((matchConstructor && matchConstructor.is$Member())); | 8397 this.genMethod((matchConstructor && matchConstructor.is$Member())); |
| 8398 matchConstructor.generator.writeDefinition(this.writer, null); | 8398 matchConstructor.generator.writeDefinition(this.writer, null); |
| 8399 this.writeTypes(this.main.declaringType.get$library()); | 8399 this.writeTypes(this.main.declaringType.get$library()); |
| 8400 this._writeDynamicStubs(world.functionType); | 8400 this._writeDynamicStubs(world.functionType); |
| 8401 this._writeGlobals(); | 8401 this._writeGlobals(); |
| 8402 this.writer.writeln(('' + mainCall.code + ';')); | 8402 this.writer.writeln(('' + mainCall.code + ';')); |
| 8403 } | 8403 } |
| 8404 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe
ndencies) { | 8404 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe
ndencies) { |
| 8405 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); | 8405 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); |
| 8406 if ($notnull_bool(!this.globals.containsKey(fullname))) { | 8406 if ($notnull_bool(!$notnull_bool(this.globals.containsKey(fullname)))) { |
| 8407 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory(
field, fieldValue, dependencies)); | 8407 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory(
field, fieldValue, dependencies)); |
| 8408 } | 8408 } |
| 8409 return this.globals.$index(fullname); | 8409 return this.globals.$index(fullname); |
| 8410 } | 8410 } |
| 8411 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { | 8411 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { |
| 8412 var code = exp.canonicalCode; | 8412 var code = exp.canonicalCode; |
| 8413 if ($notnull_bool(!this.globals.containsKey(code))) { | 8413 if ($notnull_bool(!$notnull_bool(this.globals.containsKey(code)))) { |
| 8414 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this.
globals.get$length(), exp, dependencies)); | 8414 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this.
globals.get$length(), exp, dependencies)); |
| 8415 } | 8415 } |
| 8416 return this.globals.$index(code); | 8416 return this.globals.$index(code); |
| 8417 } | 8417 } |
| 8418 WorldGenerator.prototype.writeTypes = function(lib) { | 8418 WorldGenerator.prototype.writeTypes = function(lib) { |
| 8419 if ($notnull_bool(lib.isWritten)) return; | 8419 if ($notnull_bool(lib.isWritten)) return; |
| 8420 lib.isWritten = true; | 8420 lib.isWritten = true; |
| 8421 var $list = lib.imports; | 8421 var $list = lib.imports; |
| 8422 for (var $i = 0;$i < $list.length; $i++) { | 8422 for (var $i = 0;$i < $list.length; $i++) { |
| 8423 var import_ = $list.$index($i); | 8423 var import_ = $list.$index($i); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 8448 this.writeType((ct && ct.is$lang_Type())); | 8448 this.writeType((ct && ct.is$lang_Type())); |
| 8449 } | 8449 } |
| 8450 } | 8450 } |
| 8451 } | 8451 } |
| 8452 if ($notnull_bool(type.typeCheckCode != null)) { | 8452 if ($notnull_bool(type.typeCheckCode != null)) { |
| 8453 this.writer.writeln(type.typeCheckCode); | 8453 this.writer.writeln(type.typeCheckCode); |
| 8454 } | 8454 } |
| 8455 } | 8455 } |
| 8456 } | 8456 } |
| 8457 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { | 8457 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { |
| 8458 if ($notnull_bool(!meth.isGenerated && !meth.get$isAbstract() && $ne(meth.get$
definition(), null))) { | 8458 if ($notnull_bool(!$notnull_bool(meth.isGenerated) && !$notnull_bool(meth.get$
isAbstract()) && $ne(meth.get$definition(), null))) { |
| 8459 new MethodGenerator(meth, enclosingMethod).run(); | 8459 new MethodGenerator(meth, enclosingMethod).run(); |
| 8460 } | 8460 } |
| 8461 } | 8461 } |
| 8462 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { | 8462 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { |
| 8463 if ($notnull_bool(!checkType.isTested)) return; | 8463 if ($notnull_bool(!$notnull_bool(checkType.isTested))) return; |
| 8464 var value = 'false'; | 8464 var value = 'false'; |
| 8465 if ($notnull_bool(onType.isSubtypeOf(checkType))) { | 8465 if ($notnull_bool(onType.isSubtypeOf(checkType))) { |
| 8466 value = 'function(){return this;}'; | 8466 value = 'function(){return this;}'; |
| 8467 } | 8467 } |
| 8468 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType.
get$jsname() + ' = ') + ('' + value + ';')); | 8468 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType.
get$jsname() + ' = ') + ('' + value + ';')); |
| 8469 } | 8469 } |
| 8470 WorldGenerator.prototype.writeType = function(type) { | 8470 WorldGenerator.prototype.writeType = function(type) { |
| 8471 var $0; | 8471 var $0; |
| 8472 if ($notnull_bool(type.name != null && (type instanceof ConcreteType) && $eq(t
ype.get$library(), world.get$coreimpl()) && type.name.startsWith('ListFactory'))
) { | 8472 if ($notnull_bool(type.name != null && (type instanceof ConcreteType) && $eq(t
ype.get$library(), world.get$coreimpl()) && type.name.startsWith('ListFactory'))
) { |
| 8473 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType()
.get$jsname() + ';')); | 8473 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType()
.get$jsname() + ';')); |
| 8474 return; | 8474 return; |
| 8475 } | 8475 } |
| 8476 var typeName = $notnull_bool(type.get$jsname() != null) ? type.get$jsname() :
'top level'; | 8476 var typeName = $notnull_bool(type.get$jsname() != null) ? type.get$jsname() :
'top level'; |
| 8477 this.writer.comment(('// ********** Code for ' + typeName + ' **************')
); | 8477 this.writer.comment(('// ********** Code for ' + typeName + ' **************')
); |
| 8478 if ($notnull_bool(type.get$isNativeType() && !type.get$isTop())) { | 8478 if ($notnull_bool(type.get$isNativeType() && !$notnull_bool(type.get$isTop()))
) { |
| 8479 var nativeName = type.get$definition().nativeType; | 8479 var nativeName = type.get$definition().nativeType; |
| 8480 if ($notnull_bool($eq(nativeName, ''))) { | 8480 if ($notnull_bool($eq(nativeName, ''))) { |
| 8481 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 8481 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 8482 } | 8482 } |
| 8483 else if ($notnull_bool(type.get$jsname() != nativeName)) { | 8483 else if ($notnull_bool(type.get$jsname() != nativeName)) { |
| 8484 this.writer.writeln(('' + type.get$jsname() + ' = ' + nativeName + ';')); | 8484 this.writer.writeln(('' + type.get$jsname() + ' = ' + nativeName + ';')); |
| 8485 } | 8485 } |
| 8486 } | 8486 } |
| 8487 if ($notnull_bool(type.get$isTop())) { | 8487 if ($notnull_bool(type.get$isTop())) { |
| 8488 } | 8488 } |
| 8489 else if ($notnull_bool(type.constructors.get$length() == 0)) { | 8489 else if ($notnull_bool(type.constructors.get$length() == 0)) { |
| 8490 if ($notnull_bool(!type.get$isNativeType())) { | 8490 if ($notnull_bool(!$notnull_bool(type.get$isNativeType()))) { |
| 8491 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 8491 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 8492 } | 8492 } |
| 8493 } | 8493 } |
| 8494 else { | 8494 else { |
| 8495 var standardConstructor = type.constructors.$index(''); | 8495 var standardConstructor = type.constructors.$index(''); |
| 8496 if ($notnull_bool(standardConstructor == null || standardConstructor.generat
or == null)) { | 8496 if ($notnull_bool(standardConstructor == null || standardConstructor.generat
or == null)) { |
| 8497 if ($notnull_bool(!type.get$isNativeType())) { | 8497 if ($notnull_bool(!$notnull_bool(type.get$isNativeType()))) { |
| 8498 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); | 8498 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); |
| 8499 } | 8499 } |
| 8500 } | 8500 } |
| 8501 else { | 8501 else { |
| 8502 standardConstructor.generator.writeDefinition(this.writer, null); | 8502 standardConstructor.generator.writeDefinition(this.writer, null); |
| 8503 } | 8503 } |
| 8504 var $list = type.constructors.getValues(); | 8504 var $list = type.constructors.getValues(); |
| 8505 for (var $i = type.constructors.getValues().iterator(); $i.hasNext(); ) { | 8505 for (var $i = type.constructors.getValues().iterator(); $i.hasNext(); ) { |
| 8506 var c = $i.next(); | 8506 var c = $i.next(); |
| 8507 if ($notnull_bool($ne(c.generator, null) && $ne(c, standardConstructor)))
{ | 8507 if ($notnull_bool($ne(c.generator, null) && $ne(c, standardConstructor)))
{ |
| 8508 c.generator.writeDefinition(this.writer, null); | 8508 c.generator.writeDefinition(this.writer, null); |
| 8509 } | 8509 } |
| 8510 } | 8510 } |
| 8511 } | 8511 } |
| 8512 if ($notnull_bool(!type.get$isTop())) { | 8512 if ($notnull_bool(!$notnull_bool(type.get$isTop()))) { |
| 8513 if ($notnull_bool((type instanceof ConcreteType))) { | 8513 if ($notnull_bool((type instanceof ConcreteType))) { |
| 8514 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g
enericType().get$jsname() + ');')); | 8514 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g
enericType().get$jsname() + ');')); |
| 8515 } | 8515 } |
| 8516 else if ($notnull_bool(!type.get$isNativeType())) { | 8516 else if ($notnull_bool(!$notnull_bool(type.get$isNativeType()))) { |
| 8517 if ($notnull_bool(type.get$parent() != null && !type.get$parent().get$isOb
ject())) { | 8517 if ($notnull_bool(type.get$parent() != null && !$notnull_bool(type.get$par
ent().get$isObject()))) { |
| 8518 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get
$parent().get$jsname() + ');')); | 8518 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get
$parent().get$jsname() + ');')); |
| 8519 } | 8519 } |
| 8520 } | 8520 } |
| 8521 } | 8521 } |
| 8522 if ($notnull_bool(!(type instanceof ConcreteType))) { | 8522 if ($notnull_bool(!(type instanceof ConcreteType))) { |
| 8523 this._maybeIsTest(type, type); | 8523 this._maybeIsTest(type, type); |
| 8524 } | 8524 } |
| 8525 if ($notnull_bool(type.get$genericType()._concreteTypes != null)) { | 8525 if ($notnull_bool(type.get$genericType()._concreteTypes != null)) { |
| 8526 var $list = this._orderValues(type.get$genericType()._concreteTypes); | 8526 var $list = this._orderValues(type.get$genericType()._concreteTypes); |
| 8527 for (var $i = 0;$i < $list.length; $i++) { | 8527 for (var $i = 0;$i < $list.length; $i++) { |
| 8528 var ct = $list.$index($i); | 8528 var ct = $list.$index($i); |
| 8529 this._maybeIsTest(type, (ct && ct.is$lang_Type())); | 8529 this._maybeIsTest(type, (ct && ct.is$lang_Type())); |
| 8530 } | 8530 } |
| 8531 } | 8531 } |
| 8532 if ($notnull_bool(type.get$interfaces() != null)) { | 8532 if ($notnull_bool(type.get$interfaces() != null)) { |
| 8533 var seen = new HashSetImplementation(); | 8533 var seen = new HashSetImplementation(); |
| 8534 var worklist = []; | 8534 var worklist = []; |
| 8535 worklist.addAll(type.get$interfaces()); | 8535 worklist.addAll(type.get$interfaces()); |
| 8536 seen.addAll(type.get$interfaces()); | 8536 seen.addAll(type.get$interfaces()); |
| 8537 while ($notnull_bool(!worklist.isEmpty())) { | 8537 while ($notnull_bool(!$notnull_bool(worklist.isEmpty()))) { |
| 8538 var interface_ = worklist.removeLast(); | 8538 var interface_ = worklist.removeLast(); |
| 8539 this._maybeIsTest(type, interface_.get$genericType()); | 8539 this._maybeIsTest(type, interface_.get$genericType()); |
| 8540 if ($notnull_bool(interface_.get$genericType()._concreteTypes != null)) { | 8540 if ($notnull_bool(interface_.get$genericType()._concreteTypes != null)) { |
| 8541 var $list = this._orderValues(interface_.get$genericType()._concreteType
s); | 8541 var $list = this._orderValues(interface_.get$genericType()._concreteType
s); |
| 8542 for (var $i = 0;$i < $list.length; $i++) { | 8542 for (var $i = 0;$i < $list.length; $i++) { |
| 8543 var ct = $list.$index($i); | 8543 var ct = $list.$index($i); |
| 8544 this._maybeIsTest(type, (ct && ct.is$lang_Type())); | 8544 this._maybeIsTest(type, (ct && ct.is$lang_Type())); |
| 8545 } | 8545 } |
| 8546 } | 8546 } |
| 8547 var $list = interface_.get$interfaces(); | 8547 var $list = interface_.get$interfaces(); |
| 8548 for (var $i = 0;$i < $list.length; $i++) { | 8548 for (var $i = 0;$i < $list.length; $i++) { |
| 8549 var other = $list.$index($i); | 8549 var other = $list.$index($i); |
| 8550 if ($notnull_bool(!seen.contains(other))) { | 8550 if ($notnull_bool(!$notnull_bool(seen.contains(other)))) { |
| 8551 worklist.addLast(other); | 8551 worklist.addLast(other); |
| 8552 seen.add(other); | 8552 seen.add(other); |
| 8553 } | 8553 } |
| 8554 } | 8554 } |
| 8555 } | 8555 } |
| 8556 } | 8556 } |
| 8557 type.factories.forEach$1(this.get$_writeMethod()); | 8557 type.factories.forEach$1(this.get$_writeMethod()); |
| 8558 var $list = this._orderValues((($0 = type.members) && $0.is$Map())); | 8558 var $list = this._orderValues((($0 = type.members) && $0.is$Map())); |
| 8559 for (var $i = 0;$i < $list.length; $i++) { | 8559 for (var $i = 0;$i < $list.length; $i++) { |
| 8560 var member = $list.$index($i); | 8560 var member = $list.$index($i); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 8577 var stub = $list.$index($i); | 8577 var stub = $list.$index($i); |
| 8578 stub.generate(this.writer); | 8578 stub.generate(this.writer); |
| 8579 } | 8579 } |
| 8580 } | 8580 } |
| 8581 } | 8581 } |
| 8582 WorldGenerator.prototype._writeStaticField = function(field) { | 8582 WorldGenerator.prototype._writeStaticField = function(field) { |
| 8583 if ($notnull_bool(field.isFinal)) return; | 8583 if ($notnull_bool(field.isFinal)) return; |
| 8584 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); | 8584 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname
() + ""); |
| 8585 if ($notnull_bool(this.globals.containsKey(fullname))) { | 8585 if ($notnull_bool(this.globals.containsKey(fullname))) { |
| 8586 var value = this.globals.$index(fullname); | 8586 var value = this.globals.$index(fullname); |
| 8587 if ($notnull_bool(field.declaringType.get$isTop() && !field.isNative)) { | 8587 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.is
Native))) { |
| 8588 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code
+ ';')); | 8588 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code
+ ';')); |
| 8589 } | 8589 } |
| 8590 else { | 8590 else { |
| 8591 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g
et$jsname() + ' = ' + value.exp.code + ';')); | 8591 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g
et$jsname() + ' = ' + value.exp.code + ';')); |
| 8592 } | 8592 } |
| 8593 } | 8593 } |
| 8594 } | 8594 } |
| 8595 WorldGenerator.prototype._writeField = function(field) { | 8595 WorldGenerator.prototype._writeField = function(field) { |
| 8596 if ($notnull_bool(field.declaringType.get$isTop() && !field.isNative && field.
value == null)) { | 8596 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.isNa
tive) && field.value == null)) { |
| 8597 this.writer.writeln(('var ' + field.get$jsname() + ';')); | 8597 this.writer.writeln(('var ' + field.get$jsname() + ';')); |
| 8598 } | 8598 } |
| 8599 if ($notnull_bool(field._providePropertySyntax)) { | 8599 if ($notnull_bool(field._providePropertySyntax)) { |
| 8600 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get
\$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn
ame() + '; };')); | 8600 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get
\$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn
ame() + '; };')); |
| 8601 if ($notnull_bool(!field.isFinal)) { | 8601 if ($notnull_bool(!$notnull_bool(field.isFinal))) { |
| 8602 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.s
et\$' + field.get$jsname() + ' = ') + ('function(value) { return this.' + field.
get$jsname() + ' = value; };')); | 8602 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.s
et\$' + field.get$jsname() + ' = ') + ('function(value) { return this.' + field.
get$jsname() + ' = value; };')); |
| 8603 } | 8603 } |
| 8604 } | 8604 } |
| 8605 } | 8605 } |
| 8606 WorldGenerator.prototype._writeProperty = function(property) { | 8606 WorldGenerator.prototype._writeProperty = function(property) { |
| 8607 if ($notnull_bool(property.getter != null)) this._writeMethod(property.getter)
; | 8607 if ($notnull_bool(property.getter != null)) this._writeMethod(property.getter)
; |
| 8608 if ($notnull_bool(property.setter != null)) this._writeMethod(property.setter)
; | 8608 if ($notnull_bool(property.setter != null)) this._writeMethod(property.setter)
; |
| 8609 if ($notnull_bool(property._provideFieldSyntax)) { | 8609 if ($notnull_bool(property._provideFieldSyntax)) { |
| 8610 this.writer.enterBlock('Object.defineProperty(' + ('' + property.declaringTy
pe.get$jsname() + '.prototype, "' + property.get$jsname() + '", {')); | 8610 this.writer.enterBlock('Object.defineProperty(' + ('' + property.declaringTy
pe.get$jsname() + '.prototype, "' + property.get$jsname() + '", {')); |
| 8611 if ($notnull_bool(property.getter != null)) { | 8611 if ($notnull_bool(property.getter != null)) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8682 this.reentrant = $assert_bool(this.reentrant || this.parent.reentrant); | 8682 this.reentrant = $assert_bool(this.reentrant || this.parent.reentrant); |
| 8683 } | 8683 } |
| 8684 } | 8684 } |
| 8685 BlockScope.prototype.get$parent = function() { return this.parent; }; | 8685 BlockScope.prototype.get$parent = function() { return this.parent; }; |
| 8686 BlockScope.prototype.set$parent = function(value) { return this.parent = value;
}; | 8686 BlockScope.prototype.set$parent = function(value) { return this.parent = value;
}; |
| 8687 BlockScope.prototype.get$isMethodScope = function() { | 8687 BlockScope.prototype.get$isMethodScope = function() { |
| 8688 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM
ethod); | 8688 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM
ethod); |
| 8689 } | 8689 } |
| 8690 BlockScope.prototype.get$methodScope = function() { | 8690 BlockScope.prototype.get$methodScope = function() { |
| 8691 var s = this; | 8691 var s = this; |
| 8692 while ($notnull_bool(!s.get$isMethodScope())) s = s.get$parent(); | 8692 while ($notnull_bool(!$notnull_bool(s.get$isMethodScope()))) s = s.get$parent(
); |
| 8693 return s; | 8693 return s; |
| 8694 } | 8694 } |
| 8695 BlockScope.prototype.lookup = function(name) { | 8695 BlockScope.prototype.lookup = function(name) { |
| 8696 var ret = this._vars.$index(name); | 8696 var ret = this._vars.$index(name); |
| 8697 if ($notnull_bool($ne(ret, null))) return ret; | 8697 if ($notnull_bool($ne(ret, null))) return ret; |
| 8698 for (var s = this.parent; | 8698 for (var s = this.parent; |
| 8699 $notnull_bool($ne(s, null)); s = s.get$parent()) { | 8699 $notnull_bool($ne(s, null)); s = s.get$parent()) { |
| 8700 ret = s._vars.$index(name); | 8700 ret = s._vars.$index(name); |
| 8701 if ($notnull_bool($ne(ret, null))) { | 8701 if ($notnull_bool($ne(ret, null))) { |
| 8702 if ($notnull_bool($ne(s.enclosingMethod, this.enclosingMethod))) { | 8702 if ($notnull_bool($ne(s.enclosingMethod, this.enclosingMethod))) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8838 names = ListFactory.ListFactory$from$factory(this.captures); | 8838 names = ListFactory.ListFactory$from$factory(this.captures); |
| 8839 names.sort((function (x, y) { | 8839 names.sort((function (x, y) { |
| 8840 return x.compareTo(y); | 8840 return x.compareTo(y); |
| 8841 }) | 8841 }) |
| 8842 ); | 8842 ); |
| 8843 paramCode = ListFactory.ListFactory$from$factory((names && names.is$Iterable
())); | 8843 paramCode = ListFactory.ListFactory$from$factory((names && names.is$Iterable
())); |
| 8844 paramCode.addAll(this._paramCode); | 8844 paramCode.addAll(this._paramCode); |
| 8845 } | 8845 } |
| 8846 var _params = ('(' + Strings.join(this._paramCode, ", ") + ')'); | 8846 var _params = ('(' + Strings.join(this._paramCode, ", ") + ')'); |
| 8847 var params = ('(' + Strings.join((paramCode && paramCode.is$List$String()), ",
") + ')'); | 8847 var params = ('(' + Strings.join((paramCode && paramCode.is$List$String()), ",
") + ')'); |
| 8848 if ($notnull_bool(this.method.declaringType.get$isTop() && !this.get$isClosure
())) { | 8848 if ($notnull_bool(this.method.declaringType.get$isTop() && !$notnull_bool(this
.get$isClosure()))) { |
| 8849 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params +
' {')); | 8849 defWriter.enterBlock(('function ' + this.method.get$jsname() + '' + params +
' {')); |
| 8850 } | 8850 } |
| 8851 else if ($notnull_bool(this.get$isClosure())) { | 8851 else if ($notnull_bool(this.get$isClosure())) { |
| 8852 if ($notnull_bool(this.method.name == '')) { | 8852 if ($notnull_bool(this.method.name == '')) { |
| 8853 defWriter.enterBlock(('(function ' + params + ' {')); | 8853 defWriter.enterBlock(('(function ' + params + ' {')); |
| 8854 } | 8854 } |
| 8855 else if ($notnull_bool($ne(names, null))) { | 8855 else if ($notnull_bool($ne(names, null))) { |
| 8856 if ($notnull_bool(lambda == null)) { | 8856 if ($notnull_bool(lambda == null)) { |
| 8857 defWriter.enterBlock(('var ' + this.method.get$jsname() + ' = (function'
+ params + ' {')); | 8857 defWriter.enterBlock(('var ' + this.method.get$jsname() + ' = (function'
+ params + ' {')); |
| 8858 } | 8858 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8925 for (var $i = 0;$i < $list.length; $i++) { | 8925 for (var $i = 0;$i < $list.length; $i++) { |
| 8926 var param = $list.$index($i); | 8926 var param = $list.$index($i); |
| 8927 if ($notnull_bool(param.get$isOptional())) { | 8927 if ($notnull_bool(param.get$isOptional())) { |
| 8928 optNames.add(param.get$name()); | 8928 optNames.add(param.get$name()); |
| 8929 optValues.add(MethodGenerator._escapeString(param.get$value().code)); | 8929 optValues.add(MethodGenerator._escapeString(param.get$value().code)); |
| 8930 } | 8930 } |
| 8931 } | 8931 } |
| 8932 if ($notnull_bool(optNames.length > 0)) { | 8932 if ($notnull_bool(optNames.length > 0)) { |
| 8933 var start = ''; | 8933 var start = ''; |
| 8934 if ($notnull_bool(this.method.get$isStatic())) { | 8934 if ($notnull_bool(this.method.get$isStatic())) { |
| 8935 if ($notnull_bool(!this.method.declaringType.get$isTop())) { | 8935 if ($notnull_bool(!$notnull_bool(this.method.declaringType.get$isTop()))
) { |
| 8936 start = this.method.declaringType.get$jsname() + '.'; | 8936 start = this.method.declaringType.get$jsname() + '.'; |
| 8937 } | 8937 } |
| 8938 } | 8938 } |
| 8939 else { | 8939 else { |
| 8940 start = this.method.declaringType.get$jsname() + '.prototype.'; | 8940 start = this.method.declaringType.get$jsname() + '.prototype.'; |
| 8941 } | 8941 } |
| 8942 optNames.addAll(optValues); | 8942 optNames.addAll(optValues); |
| 8943 var optional = "['" + Strings.join((optNames && optNames.is$List$String())
, "', '") + "']"; | 8943 var optional = "['" + Strings.join((optNames && optNames.is$List$String())
, "', '") + "']"; |
| 8944 defWriter.writeln(('' + start + '' + this.method.get$jsname() + '.\$option
al = ' + optional + '')); | 8944 defWriter.writeln(('' + start + '' + this.method.get$jsname() + '.\$option
al = ' + optional + '')); |
| 8945 } | 8945 } |
| 8946 } | 8946 } |
| 8947 } | 8947 } |
| 8948 MethodGenerator.prototype.writeBody = function() { | 8948 MethodGenerator.prototype.writeBody = function() { |
| 8949 var $0; | 8949 var $0; |
| 8950 var initializers = null; | 8950 var initializers = null; |
| 8951 var initializedFields = null; | 8951 var initializedFields = null; |
| 8952 if ($notnull_bool(this.method.get$isConstructor())) { | 8952 if ($notnull_bool(this.method.get$isConstructor())) { |
| 8953 initializers = []; | 8953 initializers = []; |
| 8954 initializedFields = new HashSetImplementation(); | 8954 initializedFields = new HashSetImplementation(); |
| 8955 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers()
); | 8955 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers()
); |
| 8956 for (var $i = 0;$i < $list.length; $i++) { | 8956 for (var $i = 0;$i < $list.length; $i++) { |
| 8957 var f = $list.$index($i); | 8957 var f = $list.$index($i); |
| 8958 if ($notnull_bool((f instanceof FieldMember) && !f.get$isStatic())) { | 8958 if ($notnull_bool((f instanceof FieldMember) && !$notnull_bool(f.get$isSta
tic()))) { |
| 8959 var cv = f.computeValue(); | 8959 var cv = f.computeValue(); |
| 8960 if ($notnull_bool($ne(cv, null))) { | 8960 if ($notnull_bool($ne(cv, null))) { |
| 8961 initializers.add(('this.' + f.get$jsname() + ' = ' + cv.code + '')); | 8961 initializers.add(('this.' + f.get$jsname() + ' = ' + cv.code + '')); |
| 8962 initializedFields.add(f.get$name()); | 8962 initializedFields.add(f.get$name()); |
| 8963 } | 8963 } |
| 8964 } | 8964 } |
| 8965 } | 8965 } |
| 8966 } | 8966 } |
| 8967 this._paramCode = []; | 8967 this._paramCode = []; |
| 8968 var $list = this.method.get$parameters(); | 8968 var $list = this.method.get$parameters(); |
| 8969 for (var $i = 0;$i < $list.length; $i++) { | 8969 for (var $i = 0;$i < $list.length; $i++) { |
| 8970 var p = $list.$index($i); | 8970 var p = $list.$index($i); |
| 8971 if ($notnull_bool($ne(initializers, null) && p.get$name().startsWith('this.'
))) { | 8971 if ($notnull_bool($ne(initializers, null) && p.get$name().startsWith('this.'
))) { |
| 8972 var name = p.get$name().substring(5); | 8972 var name = p.get$name().substring(5); |
| 8973 var field = this.method.declaringType.getMember(name); | 8973 var field = this.method.declaringType.getMember(name); |
| 8974 if ($notnull_bool(field == null)) { | 8974 if ($notnull_bool(field == null)) { |
| 8975 world.error('bad this parameter - no matching field', p.get$definition()
.get$span()); | 8975 world.error('bad this parameter - no matching field', p.get$definition()
.get$span()); |
| 8976 } | 8976 } |
| 8977 if ($notnull_bool(!field.get$isField())) { | 8977 if ($notnull_bool(!$notnull_bool(field.get$isField()))) { |
| 8978 world.error(('"' + p.get$name() + '" does not refer to a field'), p.get$
definition().get$span()); | 8978 world.error(('"' + p.get$name() + '" does not refer to a field'), p.get$
definition().get$span()); |
| 8979 } | 8979 } |
| 8980 var paramValue = new Value(field.get$returnType(), name, false, false, fal
se); | 8980 var paramValue = new Value(field.get$returnType(), name, false, false, fal
se); |
| 8981 this._paramCode.add(paramValue.code); | 8981 this._paramCode.add(paramValue.code); |
| 8982 initializers.add(('this.' + field.get$jsname() + ' = ' + paramValue.code +
';')); | 8982 initializers.add(('this.' + field.get$jsname() + ' = ' + paramValue.code +
';')); |
| 8983 initializedFields.add(name); | 8983 initializedFields.add(name); |
| 8984 } | 8984 } |
| 8985 else { | 8985 else { |
| 8986 var paramValue = this._scope.create($assert_String(p.get$name()), (($0 = p
.type) && $0.is$lang_Type()), (($0 = p.get$definition()) && $0.is$lang_Node())); | 8986 var paramValue = this._scope.create($assert_String(p.get$name()), (($0 = p
.type) && $0.is$lang_Type()), (($0 = p.get$definition()) && $0.is$lang_Node())); |
| 8987 this._paramCode.add(paramValue.code); | 8987 this._paramCode.add(paramValue.code); |
| 8988 } | 8988 } |
| 8989 } | 8989 } |
| 8990 var body = this.method.get$definition().body; | 8990 var body = this.method.get$definition().body; |
| 8991 if ($notnull_bool(body == null && !this.method.get$isConstructor())) { | 8991 if ($notnull_bool(body == null && !$notnull_bool(this.method.get$isConstructor
()))) { |
| 8992 world.error(('unexpected empty body for ' + this.method.name + ''), this.met
hod.get$definition().get$span()); | 8992 world.error(('unexpected empty body for ' + this.method.name + ''), this.met
hod.get$definition().get$span()); |
| 8993 } | 8993 } |
| 8994 if ($notnull_bool($ne(initializers, null))) { | 8994 if ($notnull_bool($ne(initializers, null))) { |
| 8995 for (var $i = initializers.iterator(); $i.hasNext(); ) { | 8995 for (var $i = initializers.iterator(); $i.hasNext(); ) { |
| 8996 var i = $i.next(); | 8996 var i = $i.next(); |
| 8997 this.writer.writeln($assert_String(i)); | 8997 this.writer.writeln($assert_String(i)); |
| 8998 } | 8998 } |
| 8999 var declaredInitializers = this.method.get$definition().initializers; | 8999 var declaredInitializers = this.method.get$definition().initializers; |
| 9000 if ($notnull_bool(declaredInitializers != null)) { | 9000 if ($notnull_bool(declaredInitializers != null)) { |
| 9001 var initializerCall = null; | 9001 var initializerCall = null; |
| 9002 for (var $i = 0;$i < declaredInitializers.length; $i++) { | 9002 for (var $i = 0;$i < declaredInitializers.length; $i++) { |
| 9003 var init = declaredInitializers.$index($i); | 9003 var init = declaredInitializers.$index($i); |
| 9004 if ($notnull_bool((init instanceof CallExpression))) { | 9004 if ($notnull_bool((init instanceof CallExpression))) { |
| 9005 if ($notnull_bool($ne(initializerCall, null))) { | 9005 if ($notnull_bool($ne(initializerCall, null))) { |
| 9006 world.error('only one initializer redirecting call is allowed', init
.get$span()); | 9006 world.error('only one initializer redirecting call is allowed', init
.get$span()); |
| 9007 } | 9007 } |
| 9008 initializerCall = init; | 9008 initializerCall = init; |
| 9009 } | 9009 } |
| 9010 else if ($notnull_bool((init instanceof BinaryExpression) && TokenKind.k
indFromAssign(init.op.kind) == 0)) { | 9010 else if ($notnull_bool((init instanceof BinaryExpression) && TokenKind.k
indFromAssign(init.op.kind) == 0)) { |
| 9011 var left = init.x; | 9011 var left = init.x; |
| 9012 if ($notnull_bool(!((left instanceof DotExpression) && (left.self inst
anceof ThisExpression) || (left instanceof VarExpression)))) { | 9012 if ($notnull_bool(!$notnull_bool(((left instanceof DotExpression) && (
left.self instanceof ThisExpression) || (left instanceof VarExpression))))) { |
| 9013 world.error('invalid left side of initializer', left.get$span()); | 9013 world.error('invalid left side of initializer', left.get$span()); |
| 9014 continue; | 9014 continue; |
| 9015 } | 9015 } |
| 9016 initializedFields.add(left.get$name().get$name()); | 9016 initializedFields.add(left.get$name().get$name()); |
| 9017 var assign = this._makeThisValue(null).set_$4(this, left.get$name().ge
t$name(), left.get$name(), this.visitValue(init.y)); | 9017 var assign = this._makeThisValue(null).set_$4(this, left.get$name().ge
t$name(), left.get$name(), this.visitValue(init.y)); |
| 9018 this.writer.writeln(('' + assign.code + ';')); | 9018 this.writer.writeln(('' + assign.code + ';')); |
| 9019 } | 9019 } |
| 9020 else { | 9020 else { |
| 9021 world.error('invalid initializer', init.get$span()); | 9021 world.error('invalid initializer', init.get$span()); |
| 9022 } | 9022 } |
| 9023 } | 9023 } |
| 9024 if ($notnull_bool($ne(initializerCall, null))) { | 9024 if ($notnull_bool($ne(initializerCall, null))) { |
| 9025 var target = this._writeInitializerCall((initializerCall && initializerC
all.is$CallExpression())); | 9025 var target = this._writeInitializerCall((initializerCall && initializerC
all.is$CallExpression())); |
| 9026 if ($notnull_bool(!target.isSuper)) { | 9026 if ($notnull_bool(!$notnull_bool(target.isSuper))) { |
| 9027 if ($notnull_bool(initializers.length > 0)) { | 9027 if ($notnull_bool(initializers.length > 0)) { |
| 9028 var $list = this.method.get$parameters(); | 9028 var $list = this.method.get$parameters(); |
| 9029 for (var $i = 0;$i < $list.length; $i++) { | 9029 for (var $i = 0;$i < $list.length; $i++) { |
| 9030 var p = $list.$index($i); | 9030 var p = $list.$index($i); |
| 9031 if ($notnull_bool(p.get$name().startsWith('this.'))) { | 9031 if ($notnull_bool(p.get$name().startsWith('this.'))) { |
| 9032 world.error('no initialization allowed on redirecting constructo
rs', p.get$definition().get$span()); | 9032 world.error('no initialization allowed on redirecting constructo
rs', p.get$definition().get$span()); |
| 9033 break; | 9033 break; |
| 9034 } | 9034 } |
| 9035 } | 9035 } |
| 9036 } | 9036 } |
| 9037 if ($notnull_bool(declaredInitializers.length > 1)) { | 9037 if ($notnull_bool(declaredInitializers.length > 1)) { |
| 9038 var init = $notnull_bool($eq(declaredInitializers.$index(0), initial
izerCall)) ? declaredInitializers.$index(1) : declaredInitializers.$index(0); | 9038 var init = $notnull_bool($eq(declaredInitializers.$index(0), initial
izerCall)) ? declaredInitializers.$index(1) : declaredInitializers.$index(0); |
| 9039 world.error('no initialization allowed on redirecting constructors',
init.get$span()); | 9039 world.error('no initialization allowed on redirecting constructors',
init.get$span()); |
| 9040 } | 9040 } |
| 9041 initializedFields = null; | 9041 initializedFields = null; |
| 9042 } | 9042 } |
| 9043 } | 9043 } |
| 9044 else { | 9044 else { |
| 9045 } | 9045 } |
| 9046 } | 9046 } |
| 9047 this.writer.comment('// Initializers done'); | 9047 this.writer.comment('// Initializers done'); |
| 9048 } | 9048 } |
| 9049 if ($notnull_bool($ne(initializedFields, null))) { | 9049 if ($notnull_bool($ne(initializedFields, null))) { |
| 9050 var $list = this.method.declaringType.members.getKeys(); | 9050 var $list = this.method.declaringType.members.getKeys(); |
| 9051 for (var $i = this.method.declaringType.members.getKeys().iterator(); $i.has
Next(); ) { | 9051 for (var $i = this.method.declaringType.members.getKeys().iterator(); $i.has
Next(); ) { |
| 9052 var name = $i.next(); | 9052 var name = $i.next(); |
| 9053 var member = this.method.declaringType.members.$index(name); | 9053 var member = this.method.declaringType.members.$index(name); |
| 9054 if ($notnull_bool((member instanceof FieldMember) && member.isFinal && !me
mber.get$isStatic() && !initializedFields.contains(name))) { | 9054 if ($notnull_bool((member instanceof FieldMember) && member.isFinal && !$n
otnull_bool(member.get$isStatic()) && !$notnull_bool(initializedFields.contains(
name)))) { |
| 9055 world.error(('Field "' + name + '" is final and was not initialized'), t
his.method.get$definition().get$span()); | 9055 world.error(('Field "' + name + '" is final and was not initialized'), t
his.method.get$definition().get$span()); |
| 9056 } | 9056 } |
| 9057 } | 9057 } |
| 9058 } | 9058 } |
| 9059 this.visitStatementsInBlock((body && body.is$lang_Statement())); | 9059 this.visitStatementsInBlock((body && body.is$lang_Statement())); |
| 9060 } | 9060 } |
| 9061 MethodGenerator.prototype._writeInitializerCall = function(node) { | 9061 MethodGenerator.prototype._writeInitializerCall = function(node) { |
| 9062 var contructorName = ''; | 9062 var contructorName = ''; |
| 9063 var targetExp = node.target; | 9063 var targetExp = node.target; |
| 9064 if ($notnull_bool((targetExp instanceof DotExpression))) { | 9064 if ($notnull_bool((targetExp instanceof DotExpression))) { |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9381 var catch_ = node.catches.$index(0); | 9381 var catch_ = node.catches.$index(0); |
| 9382 this._pushBlock(false); | 9382 this._pushBlock(false); |
| 9383 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare
dIdentifier())); | 9383 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare
dIdentifier())); |
| 9384 this._scope.rethrow = (ex && ex.is$Value()); | 9384 this._scope.rethrow = (ex && ex.is$Value()); |
| 9385 this.writer.nextBlock(('} catch (' + ex.code + ') {')); | 9385 this.writer.nextBlock(('} catch (' + ex.code + ') {')); |
| 9386 if ($notnull_bool(catch_.trace != null)) { | 9386 if ($notnull_bool(catch_.trace != null)) { |
| 9387 var trace = this._scope.declare(catch_.trace); | 9387 var trace = this._scope.declare(catch_.trace); |
| 9388 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); | 9388 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); |
| 9389 } | 9389 } |
| 9390 this._genToDartException(ex.code); | 9390 this._genToDartException(ex.code); |
| 9391 if ($notnull_bool(!ex.type.get$isVar())) { | 9391 if ($notnull_bool(!$notnull_bool(ex.type.get$isVar()))) { |
| 9392 var test = ex.instanceOf(this, (($0 = ex.type) && $0.is$lang_Type()), catc
h_.get$exception().get$span(), false, true); | 9392 var test = ex.instanceOf(this, (($0 = ex.type) && $0.is$lang_Type()), catc
h_.get$exception().get$span(), false, true); |
| 9393 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';')); | 9393 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';')); |
| 9394 } | 9394 } |
| 9395 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan
g_Statement())); | 9395 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan
g_Statement())); |
| 9396 this._popBlock(); | 9396 this._popBlock(); |
| 9397 } | 9397 } |
| 9398 else if ($notnull_bool(node.catches.length > 0)) { | 9398 else if ($notnull_bool(node.catches.length > 0)) { |
| 9399 this._pushBlock(false); | 9399 this._pushBlock(false); |
| 9400 var ex = this._scope.create('\$ex', world.varType, null); | 9400 var ex = this._scope.create('\$ex', world.varType, null); |
| 9401 this._scope.rethrow = (ex && ex.is$Value()); | 9401 this._scope.rethrow = (ex && ex.is$Value()); |
| 9402 this.writer.nextBlock(('} catch (' + ex.code + ') {')); | 9402 this.writer.nextBlock(('} catch (' + ex.code + ') {')); |
| 9403 var trace = null; | 9403 var trace = null; |
| 9404 if ($notnull_bool(node.catches.some((function (c) { | 9404 if ($notnull_bool(node.catches.some((function (c) { |
| 9405 return c.trace != null; | 9405 return c.trace != null; |
| 9406 }) | 9406 }) |
| 9407 ))) { | 9407 ))) { |
| 9408 trace = this._scope.create('\$trace', world.varType, null); | 9408 trace = this._scope.create('\$trace', world.varType, null); |
| 9409 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); | 9409 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code
+ ');')); |
| 9410 } | 9410 } |
| 9411 this._genToDartException(ex.code); | 9411 this._genToDartException(ex.code); |
| 9412 var needsRethrow = true; | 9412 var needsRethrow = true; |
| 9413 for (var i = 0; | 9413 for (var i = 0; |
| 9414 $notnull_bool(i < node.catches.length); i++) { | 9414 $notnull_bool(i < node.catches.length); i++) { |
| 9415 var catch_ = node.catches.$index(i); | 9415 var catch_ = node.catches.$index(i); |
| 9416 this._pushBlock(false); | 9416 this._pushBlock(false); |
| 9417 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl
aredIdentifier())); | 9417 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl
aredIdentifier())); |
| 9418 if ($notnull_bool(!tmp.type.get$isVar())) { | 9418 if ($notnull_bool(!$notnull_bool(tmp.type.get$isVar()))) { |
| 9419 var test = ex.instanceOf(this, (($0 = tmp.type) && $0.is$lang_Type()), c
atch_.get$exception().get$span(), true, true); | 9419 var test = ex.instanceOf(this, (($0 = tmp.type) && $0.is$lang_Type()), c
atch_.get$exception().get$span(), true, true); |
| 9420 if ($notnull_bool(i == 0)) { | 9420 if ($notnull_bool(i == 0)) { |
| 9421 this.writer.enterBlock(('if (' + test.code + ') {')); | 9421 this.writer.enterBlock(('if (' + test.code + ') {')); |
| 9422 } | 9422 } |
| 9423 else { | 9423 else { |
| 9424 this.writer.nextBlock(('} else if (' + test.code + ') {')); | 9424 this.writer.nextBlock(('} else if (' + test.code + ') {')); |
| 9425 } | 9425 } |
| 9426 } | 9426 } |
| 9427 else if ($notnull_bool(i > 0)) { | 9427 else if ($notnull_bool(i > 0)) { |
| 9428 this.writer.nextBlock('} else {'); | 9428 this.writer.nextBlock('} else {'); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9480 } | 9480 } |
| 9481 this.writer.writeln('default:'); | 9481 this.writer.writeln('default:'); |
| 9482 } | 9482 } |
| 9483 else { | 9483 else { |
| 9484 var value = this.visitValue((expr && expr.is$lang_Expression())); | 9484 var value = this.visitValue((expr && expr.is$lang_Expression())); |
| 9485 this.writer.writeln(('case ' + value.code + ':')); | 9485 this.writer.writeln(('case ' + value.code + ':')); |
| 9486 } | 9486 } |
| 9487 } | 9487 } |
| 9488 this.writer.enterBlock(''); | 9488 this.writer.enterBlock(''); |
| 9489 var caseExits = this._visitAllStatements(case_.statements, false); | 9489 var caseExits = this._visitAllStatements(case_.statements, false); |
| 9490 if ($notnull_bool($ne(case_, node.cases.$index(node.cases.length - 1)) && !c
aseExits)) { | 9490 if ($notnull_bool($ne(case_, node.cases.$index(node.cases.length - 1)) && !$
notnull_bool(caseExits))) { |
| 9491 var span = case_.statements.$index(case_.statements.length - 1).get$span()
; | 9491 var span = case_.statements.$index(case_.statements.length - 1).get$span()
; |
| 9492 this.writer.writeln('\$throw(new FallThroughError());'); | 9492 this.writer.writeln('\$throw(new FallThroughError());'); |
| 9493 } | 9493 } |
| 9494 this.writer.exitBlock(''); | 9494 this.writer.exitBlock(''); |
| 9495 this._popBlock(); | 9495 this._popBlock(); |
| 9496 } | 9496 } |
| 9497 this.writer.exitBlock('}'); | 9497 this.writer.exitBlock('}'); |
| 9498 return false; | 9498 return false; |
| 9499 } | 9499 } |
| 9500 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { | 9500 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9537 if ($notnull_bool(this.get$isStatic())) { | 9537 if ($notnull_bool(this.get$isStatic())) { |
| 9538 world.warning('not allowed in static method', node.span); | 9538 world.warning('not allowed in static method', node.span); |
| 9539 } | 9539 } |
| 9540 } | 9540 } |
| 9541 MethodGenerator.prototype._makeSuperValue = function(node) { | 9541 MethodGenerator.prototype._makeSuperValue = function(node) { |
| 9542 var parentType = this.method.declaringType.get$parent(); | 9542 var parentType = this.method.declaringType.get$parent(); |
| 9543 this._checkNonStatic(node); | 9543 this._checkNonStatic(node); |
| 9544 if ($notnull_bool(parentType == null)) { | 9544 if ($notnull_bool(parentType == null)) { |
| 9545 world.error('no super class', node.span); | 9545 world.error('no super class', node.span); |
| 9546 } | 9546 } |
| 9547 return new Value(parentType, 'this', true, true, false); | 9547 return new Value(parentType, 'this', true, false, false); |
| 9548 } | 9548 } |
| 9549 MethodGenerator.prototype._getOutermostMethod = function() { | 9549 MethodGenerator.prototype._getOutermostMethod = function() { |
| 9550 var result = this; | 9550 var result = this; |
| 9551 while ($notnull_bool(result.enclosingMethod != null)) { | 9551 while ($notnull_bool(result.enclosingMethod != null)) { |
| 9552 result = result.enclosingMethod; | 9552 result = result.enclosingMethod; |
| 9553 } | 9553 } |
| 9554 return result; | 9554 return result; |
| 9555 } | 9555 } |
| 9556 MethodGenerator.prototype._makeThisValue = function(node) { | 9556 MethodGenerator.prototype._makeThisValue = function(node) { |
| 9557 if ($notnull_bool(this.enclosingMethod != null)) { | 9557 if ($notnull_bool(this.enclosingMethod != null)) { |
| 9558 var outermostMethod = this._getOutermostMethod(); | 9558 var outermostMethod = this._getOutermostMethod(); |
| 9559 outermostMethod._checkNonStatic(node); | 9559 outermostMethod._checkNonStatic(node); |
| 9560 outermostMethod.needsThis = true; | 9560 outermostMethod.needsThis = true; |
| 9561 return new Value(outermostMethod.method.declaringType, '\$this', false, true
, false); | 9561 return new Value(outermostMethod.method.declaringType, '\$this', false, fals
e, false); |
| 9562 } | 9562 } |
| 9563 else { | 9563 else { |
| 9564 this._checkNonStatic(node); | 9564 this._checkNonStatic(node); |
| 9565 return new Value(this.method.declaringType, 'this', false, true, false); | 9565 return new Value(this.method.declaringType, 'this', false, false, false); |
| 9566 } | 9566 } |
| 9567 } | 9567 } |
| 9568 MethodGenerator.prototype.visitLambdaExpression = function(node) { | 9568 MethodGenerator.prototype.visitLambdaExpression = function(node) { |
| 9569 var name = ''; | 9569 var name = ''; |
| 9570 if ($notnull_bool(node.func.name != null)) { | 9570 if ($notnull_bool(node.func.name != null)) { |
| 9571 name = world.toJsIdentifier(node.func.name.name); | 9571 name = world.toJsIdentifier(node.func.name.name); |
| 9572 } | 9572 } |
| 9573 var meth = this._makeLambdaMethod($assert_String(name), node.func); | 9573 var meth = this._makeLambdaMethod($assert_String(name), node.func); |
| 9574 var w = new CodeWriter(); | 9574 var w = new CodeWriter(); |
| 9575 meth.generator.writeDefinition((w && w.is$CodeWriter()), node); | 9575 meth.generator.writeDefinition((w && w.is$CodeWriter()), node); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9683 x = this._makeThisOrType(); | 9683 x = this._makeThisOrType(); |
| 9684 } | 9684 } |
| 9685 else { | 9685 else { |
| 9686 var member = this.method.declaringType.get$library().lookup(xn.name.name,
xn.name.span); | 9686 var member = this.method.declaringType.get$library().lookup(xn.name.name,
xn.name.span); |
| 9687 if ($notnull_bool(member == null)) { | 9687 if ($notnull_bool(member == null)) { |
| 9688 world.warning(('can not resolve ' + xn.name.name + ''), xn.span); | 9688 world.warning(('can not resolve ' + xn.name.name + ''), xn.span); |
| 9689 return this._makeMissingValue(xn.name.name); | 9689 return this._makeMissingValue(xn.name.name); |
| 9690 } | 9690 } |
| 9691 members = new MemberSet(member); | 9691 members = new MemberSet(member); |
| 9692 } | 9692 } |
| 9693 if ($notnull_bool(!members.get$treatAsField() || members.get$containsMethods
())) { | 9693 if ($notnull_bool(!$notnull_bool(members.get$treatAsField()) || members.get$
containsMethods())) { |
| 9694 if ($notnull_bool(kind != 0)) { | 9694 if ($notnull_bool(kind != 0)) { |
| 9695 var right = members.get_$3(this, position, x); | 9695 var right = members.get_$3(this, position, x); |
| 9696 right = captureOriginal((right && right.is$Value())); | 9696 right = captureOriginal((right && right.is$Value())); |
| 9697 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new
Arguments(null, [y])); | 9697 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new
Arguments(null, [y])); |
| 9698 } | 9698 } |
| 9699 return members.set_$4(this, position, x, y); | 9699 return members.set_$4(this, position, x, y); |
| 9700 } | 9700 } |
| 9701 x = members.get_$3(this, position, x); | 9701 x = members.get_$3(this, position, x); |
| 9702 } | 9702 } |
| 9703 y = y.convertTo(this, (($0 = x.type) && $0.is$lang_Type()), yn, false); | 9703 y = y.convertTo(this, (($0 = x.type) && $0.is$lang_Type()), yn, false); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 9719 } | 9719 } |
| 9720 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c
aptureOriginal) { | 9720 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c
aptureOriginal) { |
| 9721 var target = this.visitValue(xn.target); | 9721 var target = this.visitValue(xn.target); |
| 9722 var index = this.visitValue(xn.index); | 9722 var index = this.visitValue(xn.index); |
| 9723 var y = this.visitValue(yn); | 9723 var y = this.visitValue(yn); |
| 9724 var tmptarget = target; | 9724 var tmptarget = target; |
| 9725 var tmpindex = index; | 9725 var tmpindex = index; |
| 9726 if ($notnull_bool(kind != 0)) { | 9726 if ($notnull_bool(kind != 0)) { |
| 9727 tmptarget = this.getTemp((target && target.is$Value())); | 9727 tmptarget = this.getTemp((target && target.is$Value())); |
| 9728 tmpindex = this.getTemp((index && index.is$Value())); | 9728 tmpindex = this.getTemp((index && index.is$Value())); |
| 9729 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null
, [this.assignTemp((tmpindex && tmpindex.is$Value()), (index && index.is$Value()
))])); | 9729 index = this.assignTemp((tmpindex && tmpindex.is$Value()), (index && index.i
s$Value())); |
| 9730 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null
, [tmpindex])); |
| 9730 right = captureOriginal((right && right.is$Value())); | 9731 right = captureOriginal((right && right.is$Value())); |
| 9731 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); | 9732 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); |
| 9732 } | 9733 } |
| 9733 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ
et.is$Value())).invoke(this, '\$setindex', position, new Arguments(null, [index,
y]), false); | 9734 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ
et.is$Value())).invoke(this, '\$setindex', position, new Arguments(null, [index,
y]), false); |
| 9734 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg
et.is$Value())); | 9735 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg
et.is$Value())); |
| 9735 if ($notnull_bool($ne(tmpindex, index))) this.freeTemp((tmpindex && tmpindex.i
s$Value())); | 9736 if ($notnull_bool($ne(tmpindex, index))) this.freeTemp((tmpindex && tmpindex.i
s$Value())); |
| 9736 return ret; | 9737 return ret; |
| 9737 } | 9738 } |
| 9738 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap
tureOriginal) { | 9739 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap
tureOriginal) { |
| 9739 var target = xn.self.visit(this); | 9740 var target = xn.self.visit(this); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 9760 } | 9761 } |
| 9761 else { | 9762 else { |
| 9762 var kind = ($notnull_bool(16/*TokenKind.INCR*/ == node.op.kind) ? 42/*To
kenKind.ADD*/ : 43/*TokenKind.SUB*/); | 9763 var kind = ($notnull_bool(16/*TokenKind.INCR*/ == node.op.kind) ? 42/*To
kenKind.ADD*/ : 43/*TokenKind.SUB*/); |
| 9763 var operand = new LiteralExpression(1, new TypeReference(node.span, worl
d.numType), '1', node.span); | 9764 var operand = new LiteralExpression(1, new TypeReference(node.span, worl
d.numType), '1', node.span); |
| 9764 return this._visitAssign($assert_num(kind), node.self, (operand && opera
nd.is$lang_Expression()), node, to$call$1(null)); | 9765 return this._visitAssign($assert_num(kind), node.self, (operand && opera
nd.is$lang_Expression()), node, to$call$1(null)); |
| 9765 } | 9766 } |
| 9766 | 9767 |
| 9767 case 19/*TokenKind.NOT*/: | 9768 case 19/*TokenKind.NOT*/: |
| 9768 | 9769 |
| 9769 if ($notnull_bool(value.type.get$isBool() && value.get$isConst())) { | 9770 if ($notnull_bool(value.type.get$isBool() && value.get$isConst())) { |
| 9770 var newVal = !value.get$actualValue(); | 9771 var newVal = !$notnull_bool(value.get$actualValue()); |
| 9771 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, ('' + n
ewVal + ''), node.span); | 9772 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, ('' + n
ewVal + ''), node.span); |
| 9772 } | 9773 } |
| 9773 else { | 9774 else { |
| 9774 return new Value(world.boolType, ('!' + value.code + ''), false, true, f
alse); | 9775 var newVal = value.convertToNonNullBool(this, node); |
| 9776 return new Value(world.boolType, ('!' + newVal.code + ''), false, true,
false); |
| 9775 } | 9777 } |
| 9776 | 9778 |
| 9777 case 42/*TokenKind.ADD*/: | 9779 case 42/*TokenKind.ADD*/: |
| 9780 |
| 9781 return value.convertTo(this, world.numType, node, false); |
| 9782 |
| 9778 case 43/*TokenKind.SUB*/: | 9783 case 43/*TokenKind.SUB*/: |
| 9779 case 18/*TokenKind.BIT_NOT*/: | 9784 case 18/*TokenKind.BIT_NOT*/: |
| 9780 | 9785 |
| 9781 if ($notnull_bool(value.type.get$isNum())) { | 9786 if ($notnull_bool(node.op.kind == 18/*TokenKind.BIT_NOT*/)) { |
| 9782 if ($notnull_bool(value.get$isConst())) { | 9787 return value.invoke$4(this, '\$bit_not', node, Arguments.get$EMPTY()); |
| 9783 if ($notnull_bool(node.op.kind == 42/*TokenKind.ADD*/)) { | 9788 } |
| 9784 return value; | 9789 else if ($notnull_bool(node.op.kind == 43/*TokenKind.SUB*/)) { |
| 9785 } | 9790 return value.invoke$4(this, '\$negate', node, Arguments.get$EMPTY()); |
| 9786 else if ($notnull_bool(node.op.kind == 43/*TokenKind.SUB*/)) { | |
| 9787 var newVal = $negate(value.get$actualValue()); | |
| 9788 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, (''
+ newVal + ''), node.span); | |
| 9789 } | |
| 9790 else { | |
| 9791 var newVal = (~value.get$actualValue().toInt()).toDouble(); | |
| 9792 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, (''
+ newVal + ''), node.span); | |
| 9793 } | |
| 9794 } | |
| 9795 return new Value(value.type, ('' + node.op + '' + value.code + ''), fals
e, true, false); | |
| 9796 } | 9791 } |
| 9797 else { | 9792 else { |
| 9798 var name; | 9793 world.internalError(('unimplemented: unary ' + node.op + ''), node.span)
; |
| 9799 if ($notnull_bool(node.op.kind == 18/*TokenKind.BIT_NOT*/)) name = '\$bi
t_not'; | |
| 9800 else if ($notnull_bool(node.op.kind == 43/*TokenKind.SUB*/)) name = '\$n
egate'; | |
| 9801 else world.internalError(('unimplemented: unary ' + node.op + ' on var')
, node.span); | |
| 9802 return new Value(world.varType, ('' + name + '(' + value.code + ')'), fa
lse, true, false); | |
| 9803 } | 9794 } |
| 9795 $throw(new FallThroughError()); |
| 9804 | 9796 |
| 9805 default: | 9797 default: |
| 9806 | 9798 |
| 9807 world.internalError(('unimplemented: ' + node.op + ''), node.span); | 9799 world.internalError(('unimplemented: ' + node.op + ''), node.span); |
| 9808 | 9800 |
| 9809 } | 9801 } |
| 9810 } | 9802 } |
| 9811 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { | 9803 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { |
| 9812 var $this = this; // closure support | 9804 var $this = this; // closure support |
| 9813 var value = this.visitValue(node.body); | 9805 var value = this.visitValue(node.body); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9857 var m = type.getConstructor(constructorName); | 9849 var m = type.getConstructor(constructorName); |
| 9858 if ($notnull_bool(m == null)) { | 9850 if ($notnull_bool(m == null)) { |
| 9859 var name = type.get$jsname(); | 9851 var name = type.get$jsname(); |
| 9860 if ($notnull_bool(type.get$isVar())) { | 9852 if ($notnull_bool(type.get$isVar())) { |
| 9861 name = typeRef.get$name().get$name(); | 9853 name = typeRef.get$name().get$name(); |
| 9862 } | 9854 } |
| 9863 world.error(('no matching constructor for ' + name + ''), node.span); | 9855 world.error(('no matching constructor for ' + name + ''), node.span); |
| 9864 return this._makeMissingValue($assert_String(name)); | 9856 return this._makeMissingValue($assert_String(name)); |
| 9865 } | 9857 } |
| 9866 if ($notnull_bool(node.isConst)) { | 9858 if ($notnull_bool(node.isConst)) { |
| 9867 if ($notnull_bool(!m.get$isConst())) { | 9859 if ($notnull_bool(!$notnull_bool(m.get$isConst()))) { |
| 9868 world.error('can\'t use const on a non-const constructor', node.span); | 9860 world.error('can\'t use const on a non-const constructor', node.span); |
| 9869 } | 9861 } |
| 9870 var $list = node.arguments; | 9862 var $list = node.arguments; |
| 9871 for (var $i = 0;$i < $list.length; $i++) { | 9863 for (var $i = 0;$i < $list.length; $i++) { |
| 9872 var arg = $list.$index($i); | 9864 var arg = $list.$index($i); |
| 9873 if ($notnull_bool(!this.visitValue((($0 = arg.get$value()) && $0.is$lang_E
xpression())).get$isConst())) { | 9865 if ($notnull_bool(!$notnull_bool(this.visitValue((($0 = arg.get$value()) &
& $0.is$lang_Expression())).get$isConst()))) { |
| 9874 world.error('const constructor expects const arguments', arg.get$span())
; | 9866 world.error('const constructor expects const arguments', arg.get$span())
; |
| 9875 } | 9867 } |
| 9876 } | 9868 } |
| 9877 } | 9869 } |
| 9878 return m.invoke$4(this, node, null, this._makeArgs(node.arguments)); | 9870 return m.invoke$4(this, node, null, this._makeArgs(node.arguments)); |
| 9879 } | 9871 } |
| 9880 MethodGenerator.prototype.visitListExpression = function(node) { | 9872 MethodGenerator.prototype.visitListExpression = function(node) { |
| 9881 var argsCode = []; | 9873 var argsCode = []; |
| 9882 var argValues = []; | 9874 var argValues = []; |
| 9883 var $list = node.values; | 9875 var $list = node.values; |
| 9884 for (var $i = 0;$i < $list.length; $i++) { | 9876 for (var $i = 0;$i < $list.length; $i++) { |
| 9885 var item = $list.$index($i); | 9877 var item = $list.$index($i); |
| 9886 var arg = this.visitValue((item && item.is$lang_Expression())); | 9878 var arg = this.visitValue((item && item.is$lang_Expression())); |
| 9887 argValues.add(arg); | 9879 argValues.add(arg); |
| 9888 if ($notnull_bool(node.isConst)) { | 9880 if ($notnull_bool(node.isConst)) { |
| 9889 if ($notnull_bool(!arg.get$isConst())) { | 9881 if ($notnull_bool(!$notnull_bool(arg.get$isConst()))) { |
| 9890 world.error('const list can only contain const values', item.get$span())
; | 9882 world.error('const list can only contain const values', item.get$span())
; |
| 9891 argsCode.add(arg.code); | 9883 argsCode.add(arg.code); |
| 9892 } | 9884 } |
| 9893 else { | 9885 else { |
| 9894 argsCode.add(arg.canonicalCode); | 9886 argsCode.add(arg.canonicalCode); |
| 9895 } | 9887 } |
| 9896 } | 9888 } |
| 9897 else { | 9889 else { |
| 9898 argsCode.add(arg.code); | 9890 argsCode.add(arg.code); |
| 9899 } | 9891 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 9915 var argValues = []; | 9907 var argValues = []; |
| 9916 var argsCode = []; | 9908 var argsCode = []; |
| 9917 for (var i = 0; | 9909 for (var i = 0; |
| 9918 $notnull_bool(i < node.items.length); i += 2) { | 9910 $notnull_bool(i < node.items.length); i += 2) { |
| 9919 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex
pression()), world.stringType); | 9911 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex
pression()), world.stringType); |
| 9920 var valueItem = node.items.$index(i + 1); | 9912 var valueItem = node.items.$index(i + 1); |
| 9921 var value = this.visitValue((valueItem && valueItem.is$lang_Expression())); | 9913 var value = this.visitValue((valueItem && valueItem.is$lang_Expression())); |
| 9922 argValues.add(key); | 9914 argValues.add(key); |
| 9923 argValues.add(value); | 9915 argValues.add(value); |
| 9924 if ($notnull_bool(node.isConst)) { | 9916 if ($notnull_bool(node.isConst)) { |
| 9925 if ($notnull_bool(!key.get$isConst() || !value.get$isConst())) { | 9917 if ($notnull_bool(!$notnull_bool(key.get$isConst()) || !$notnull_bool(valu
e.get$isConst()))) { |
| 9926 world.error('const map can only contain const values', valueItem.get$spa
n()); | 9918 world.error('const map can only contain const values', valueItem.get$spa
n()); |
| 9927 argsCode.add(key.code); | 9919 argsCode.add(key.code); |
| 9928 argsCode.add(value.code); | 9920 argsCode.add(value.code); |
| 9929 } | 9921 } |
| 9930 else { | 9922 else { |
| 9931 argsCode.add(key.canonicalCode); | 9923 argsCode.add(key.canonicalCode); |
| 9932 argsCode.add(value.canonicalCode); | 9924 argsCode.add(value.canonicalCode); |
| 9933 } | 9925 } |
| 9934 } | 9926 } |
| 9935 else { | 9927 else { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10007 } | 9999 } |
| 10008 MethodGenerator.prototype.visitSuperExpression = function(node) { | 10000 MethodGenerator.prototype.visitSuperExpression = function(node) { |
| 10009 return this._makeSuperValue(node); | 10001 return this._makeSuperValue(node); |
| 10010 } | 10002 } |
| 10011 MethodGenerator.prototype.visitNullExpression = function(node) { | 10003 MethodGenerator.prototype.visitNullExpression = function(node) { |
| 10012 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null); | 10004 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null); |
| 10013 } | 10005 } |
| 10014 MethodGenerator.prototype.visitLiteralExpression = function(node) { | 10006 MethodGenerator.prototype.visitLiteralExpression = function(node) { |
| 10015 var $0; | 10007 var $0; |
| 10016 var type = node.type.type; | 10008 var type = node.type.type; |
| 10017 $assert($ne(type, null), "type != null", "gen.dart", 2019, 12); | 10009 $assert($ne(type, null), "type != null", "gen.dart", 2011, 12); |
| 10018 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { | 10010 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { |
| 10019 var items = []; | 10011 var items = []; |
| 10020 var $list = node.value; | 10012 var $list = node.value; |
| 10021 for (var $i = node.value.iterator(); $i.hasNext(); ) { | 10013 for (var $i = node.value.iterator(); $i.hasNext(); ) { |
| 10022 var item = $i.next(); | 10014 var item = $i.next(); |
| 10023 var val = this.visitValue((item && item.is$lang_Expression())); | 10015 var val = this.visitValue((item && item.is$lang_Expression())); |
| 10024 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); | 10016 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); |
| 10025 var code = val.code; | 10017 var code = val.code; |
| 10026 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C
onditionalExpression))) { | 10018 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C
onditionalExpression))) { |
| 10027 code = ('(' + code + ')'); | 10019 code = ('(' + code + ')'); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10267 } | 10259 } |
| 10268 return this.types.$index(name0); | 10260 return this.types.$index(name0); |
| 10269 } | 10261 } |
| 10270 Library.prototype.findType = function(type) { | 10262 Library.prototype.findType = function(type) { |
| 10271 var result = this.findTypeByName(type.name.name); | 10263 var result = this.findTypeByName(type.name.name); |
| 10272 if ($notnull_bool(result == null)) return null; | 10264 if ($notnull_bool(result == null)) return null; |
| 10273 if ($notnull_bool(type.names != null)) { | 10265 if ($notnull_bool(type.names != null)) { |
| 10274 if ($notnull_bool(type.names.length > 1)) { | 10266 if ($notnull_bool(type.names.length > 1)) { |
| 10275 return null; | 10267 return null; |
| 10276 } | 10268 } |
| 10277 if ($notnull_bool(!result.get$isTop())) { | 10269 if ($notnull_bool(!$notnull_bool(result.get$isTop()))) { |
| 10278 return null; | 10270 return null; |
| 10279 } | 10271 } |
| 10280 return result.get$library().findTypeByName($assert_String(type.names.$index(
0).get$name())); | 10272 return result.get$library().findTypeByName($assert_String(type.names.$index(
0).get$name())); |
| 10281 } | 10273 } |
| 10282 return result; | 10274 return result; |
| 10283 } | 10275 } |
| 10284 Library.prototype.findTypeByName = function(name0) { | 10276 Library.prototype.findTypeByName = function(name0) { |
| 10285 var ret = this.types.$index(name0); | 10277 var ret = this.types.$index(name0); |
| 10286 var $list = this.imports; | 10278 var $list = this.imports; |
| 10287 for (var $i = 0;$i < $list.length; $i++) { | 10279 for (var $i = 0;$i < $list.length; $i++) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10412 $assert(this.sources.length == 0 || this.isTop, "sources.length == 0 || isTop"
, "library.dart", 293, 12); | 10404 $assert(this.sources.length == 0 || this.isTop, "sources.length == 0 || isTop"
, "library.dart", 293, 12); |
| 10413 this.isTop = false; | 10405 this.isTop = false; |
| 10414 var newSources = this.sources; | 10406 var newSources = this.sources; |
| 10415 this.sources = []; | 10407 this.sources = []; |
| 10416 for (var $i = newSources.iterator(); $i.hasNext(); ) { | 10408 for (var $i = newSources.iterator(); $i.hasNext(); ) { |
| 10417 var source0 = $i.next(); | 10409 var source0 = $i.next(); |
| 10418 this.addSource((source0 && source0.is$SourceFile())); | 10410 this.addSource((source0 && source0.is$SourceFile())); |
| 10419 } | 10411 } |
| 10420 } | 10412 } |
| 10421 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { | 10413 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { |
| 10422 if ($notnull_bool(!this.isTop)) { | 10414 if ($notnull_bool(!$notnull_bool(this.isTop))) { |
| 10423 world.error('directives not allowed in sourced file', node.span); | 10415 world.error('directives not allowed in sourced file', node.span); |
| 10424 return; | 10416 return; |
| 10425 } | 10417 } |
| 10426 var name; | 10418 var name; |
| 10427 switch (node.name.name) { | 10419 switch (node.name.name) { |
| 10428 case "library": | 10420 case "library": |
| 10429 | 10421 |
| 10430 name = this.getSingleStringArg(node); | 10422 name = this.getSingleStringArg(node); |
| 10431 if ($notnull_bool(this.library.name == null)) { | 10423 if ($notnull_bool(this.library.name == null)) { |
| 10432 this.library.name = $assert_String(name); | 10424 this.library.name = $assert_String(name); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10524 if ($notnull_bool(args.length > 1)) { | 10516 if ($notnull_bool(args.length > 1)) { |
| 10525 world.error(('expected at most one "' + argName + '" argument but found ') +
node.arguments.length, node.span); | 10517 world.error(('expected at most one "' + argName + '" argument but found ') +
node.arguments.length, node.span); |
| 10526 } | 10518 } |
| 10527 for (var $i = args.iterator(); $i.hasNext(); ) { | 10519 for (var $i = args.iterator(); $i.hasNext(); ) { |
| 10528 var arg = $i.next(); | 10520 var arg = $i.next(); |
| 10529 return this._parseStringArgument((arg && arg.is$ArgumentNode())); | 10521 return this._parseStringArgument((arg && arg.is$ArgumentNode())); |
| 10530 } | 10522 } |
| 10531 } | 10523 } |
| 10532 _LibraryVisitor.prototype._parseStringArgument = function(arg) { | 10524 _LibraryVisitor.prototype._parseStringArgument = function(arg) { |
| 10533 var expr = arg.value; | 10525 var expr = arg.value; |
| 10534 if ($notnull_bool(!(expr instanceof LiteralExpression) || !expr.type.type.get$
isString())) { | 10526 if ($notnull_bool(!(expr instanceof LiteralExpression) || !$notnull_bool(expr.
type.type.get$isString()))) { |
| 10535 world.error('expected string', expr.get$span()); | 10527 world.error('expected string', expr.get$span()); |
| 10536 } | 10528 } |
| 10537 return parseStringLiteral($assert_String(expr.get$value())); | 10529 return parseStringLiteral($assert_String(expr.get$value())); |
| 10538 } | 10530 } |
| 10539 _LibraryVisitor.prototype.visitTypeDefinition = function(node) { | 10531 _LibraryVisitor.prototype.visitTypeDefinition = function(node) { |
| 10540 var oldType = this.currentType; | 10532 var oldType = this.currentType; |
| 10541 this.currentType = this.library.addType(node.name.name, node, node.isClass); | 10533 this.currentType = this.library.addType(node.name.name, node, node.isClass); |
| 10542 var $list = node.body; | 10534 var $list = node.body; |
| 10543 for (var $i = 0;$i < $list.length; $i++) { | 10535 for (var $i = 0;$i < $list.length; $i++) { |
| 10544 var member = $list.$index($i); | 10536 var member = $list.$index($i); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10766 } | 10758 } |
| 10767 $inherits(FieldMember, Member); | 10759 $inherits(FieldMember, Member); |
| 10768 FieldMember.prototype.is$FieldMember = function(){return this;}; | 10760 FieldMember.prototype.is$FieldMember = function(){return this;}; |
| 10769 FieldMember.prototype.get$definition = function() { return this.definition; }; | 10761 FieldMember.prototype.get$definition = function() { return this.definition; }; |
| 10770 FieldMember.prototype.get$value = function() { return this.value; }; | 10762 FieldMember.prototype.get$value = function() { return this.value; }; |
| 10771 FieldMember.prototype.get$isStatic = function() { return this.isStatic; }; | 10763 FieldMember.prototype.get$isStatic = function() { return this.isStatic; }; |
| 10772 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va
lue; }; | 10764 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va
lue; }; |
| 10773 FieldMember.prototype.get$isNative = function() { return this.isNative; }; | 10765 FieldMember.prototype.get$isNative = function() { return this.isNative; }; |
| 10774 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va
lue; }; | 10766 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va
lue; }; |
| 10775 FieldMember.prototype.override = function(other) { | 10767 FieldMember.prototype.override = function(other) { |
| 10776 if ($notnull_bool(!Member.prototype.override.call(this, other))) return false; | 10768 if ($notnull_bool(!$notnull_bool(Member.prototype.override.call(this, other)))
) return false; |
| 10777 if ($notnull_bool(other.get$isProperty())) { | 10769 if ($notnull_bool(other.get$isProperty())) { |
| 10778 return true; | 10770 return true; |
| 10779 } | 10771 } |
| 10780 else { | 10772 else { |
| 10781 world.error('field can not override anything but property', this.get$span(),
other.get$span()); | 10773 world.error('field can not override anything but property', this.get$span(),
other.get$span()); |
| 10782 return false; | 10774 return false; |
| 10783 } | 10775 } |
| 10784 } | 10776 } |
| 10785 FieldMember.prototype.get$prefersPropertySyntax = function() { | 10777 FieldMember.prototype.get$prefersPropertySyntax = function() { |
| 10786 return false; | 10778 return false; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 10797 FieldMember.prototype.get$span = function() { | 10789 FieldMember.prototype.get$span = function() { |
| 10798 return $notnull_bool(this.definition == null) ? null : this.definition.span; | 10790 return $notnull_bool(this.definition == null) ? null : this.definition.span; |
| 10799 } | 10791 } |
| 10800 FieldMember.prototype.get$returnType = function() { | 10792 FieldMember.prototype.get$returnType = function() { |
| 10801 return this.type; | 10793 return this.type; |
| 10802 } | 10794 } |
| 10803 FieldMember.prototype.get$canGet = function() { | 10795 FieldMember.prototype.get$canGet = function() { |
| 10804 return true; | 10796 return true; |
| 10805 } | 10797 } |
| 10806 FieldMember.prototype.get$canSet = function() { | 10798 FieldMember.prototype.get$canSet = function() { |
| 10807 return !this.isFinal; | 10799 return !$notnull_bool(this.isFinal); |
| 10808 } | 10800 } |
| 10809 FieldMember.prototype.get$isField = function() { | 10801 FieldMember.prototype.get$isField = function() { |
| 10810 return true; | 10802 return true; |
| 10811 } | 10803 } |
| 10812 FieldMember.prototype.resolve = function(inType) { | 10804 FieldMember.prototype.resolve = function(inType) { |
| 10813 this.isStatic = this.declaringType.get$isTop(); | 10805 this.isStatic = this.declaringType.get$isTop(); |
| 10814 this.isFinal = false; | 10806 this.isFinal = false; |
| 10815 if ($notnull_bool(this.definition.modifiers != null)) { | 10807 if ($notnull_bool(this.definition.modifiers != null)) { |
| 10816 var $list = this.definition.modifiers; | 10808 var $list = this.definition.modifiers; |
| 10817 for (var $i = 0;$i < $list.length; $i++) { | 10809 for (var $i = 0;$i < $list.length; $i++) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 10848 if ($notnull_bool(this._computedValue == null)) { | 10840 if ($notnull_bool(this._computedValue == null)) { |
| 10849 if ($notnull_bool(this._computing)) { | 10841 if ($notnull_bool(this._computing)) { |
| 10850 world.error('circular reference', this.value.span); | 10842 world.error('circular reference', this.value.span); |
| 10851 return null; | 10843 return null; |
| 10852 } | 10844 } |
| 10853 this._computing = true; | 10845 this._computing = true; |
| 10854 var finalMethod = new MethodMember('final_context', this.declaringType, null
); | 10846 var finalMethod = new MethodMember('final_context', this.declaringType, null
); |
| 10855 finalMethod.isStatic = true; | 10847 finalMethod.isStatic = true; |
| 10856 var finalGen = new MethodGenerator(finalMethod, null); | 10848 var finalGen = new MethodGenerator(finalMethod, null); |
| 10857 this._computedValue = (($0 = this.value.visit(finalGen)) && $0.is$Value()); | 10849 this._computedValue = (($0 = this.value.visit(finalGen)) && $0.is$Value()); |
| 10858 if ($notnull_bool(!this._computedValue.get$isConst())) { | 10850 if ($notnull_bool(!$notnull_bool(this._computedValue.get$isConst()))) { |
| 10859 if ($notnull_bool(this.isStatic)) { | 10851 if ($notnull_bool(this.isStatic)) { |
| 10860 world.error('non constant static field must be initialized in functions'
, this.value.span); | 10852 world.error('non constant static field must be initialized in functions'
, this.value.span); |
| 10861 } | 10853 } |
| 10862 else { | 10854 else { |
| 10863 world.error('non constant field must be initialized in constructor', thi
s.value.span); | 10855 world.error('non constant field must be initialized in constructor', thi
s.value.span); |
| 10864 } | 10856 } |
| 10865 } | 10857 } |
| 10866 if ($notnull_bool(this.isStatic)) { | 10858 if ($notnull_bool(this.isStatic)) { |
| 10867 this._computedValue = world.gen.globalForStaticField(this, this._computedV
alue, [this._computedValue]); | 10859 this._computedValue = world.gen.globalForStaticField(this, this._computedV
alue, [this._computedValue]); |
| 10868 } | 10860 } |
| 10869 this._computing = false; | 10861 this._computing = false; |
| 10870 } | 10862 } |
| 10871 return this._computedValue; | 10863 return this._computedValue; |
| 10872 } | 10864 } |
| 10873 FieldMember.prototype.get_ = function(context, node, target, isDynamic) { | 10865 FieldMember.prototype.get_ = function(context, node, target, isDynamic) { |
| 10874 if ($notnull_bool(!isDynamic)) { | 10866 if ($notnull_bool(!$notnull_bool(isDynamic))) { |
| 10875 this.declaringType.markUsed(); | 10867 this.declaringType.markUsed(); |
| 10876 } | 10868 } |
| 10877 if ($notnull_bool(this.isStatic)) { | 10869 if ($notnull_bool(this.isStatic)) { |
| 10878 var cv = this.computeValue(); | 10870 var cv = this.computeValue(); |
| 10879 if ($notnull_bool(this.isFinal)) { | 10871 if ($notnull_bool(this.isFinal)) { |
| 10880 return cv; | 10872 return cv; |
| 10881 } | 10873 } |
| 10882 if ($notnull_bool(this.declaringType.get$isTop())) { | 10874 if ($notnull_bool(this.declaringType.get$isTop())) { |
| 10883 return new Value(this.type, ('' + this.get$jsname() + ''), false, true, fa
lse); | 10875 return new Value(this.type, ('' + this.get$jsname() + ''), false, true, fa
lse); |
| 10884 } | 10876 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10942 PropertyMember.prototype.get$isStatic = function() { | 10934 PropertyMember.prototype.get$isStatic = function() { |
| 10943 return $notnull_bool(this.getter == null) ? this.setter.isStatic : this.getter
.isStatic; | 10935 return $notnull_bool(this.getter == null) ? this.setter.isStatic : this.getter
.isStatic; |
| 10944 } | 10936 } |
| 10945 PropertyMember.prototype.get$isProperty = function() { | 10937 PropertyMember.prototype.get$isProperty = function() { |
| 10946 return true; | 10938 return true; |
| 10947 } | 10939 } |
| 10948 PropertyMember.prototype.get$returnType = function() { | 10940 PropertyMember.prototype.get$returnType = function() { |
| 10949 return $notnull_bool(this.getter == null) ? this.setter.returnType : this.gett
er.returnType; | 10941 return $notnull_bool(this.getter == null) ? this.setter.returnType : this.gett
er.returnType; |
| 10950 } | 10942 } |
| 10951 PropertyMember.prototype.override = function(other) { | 10943 PropertyMember.prototype.override = function(other) { |
| 10952 if ($notnull_bool(!Member.prototype.override.call(this, other))) return false; | 10944 if ($notnull_bool(!$notnull_bool(Member.prototype.override.call(this, other)))
) return false; |
| 10953 if ($notnull_bool(other.get$isProperty() || other.get$isField())) { | 10945 if ($notnull_bool(other.get$isProperty() || other.get$isField())) { |
| 10954 if ($notnull_bool(other.get$isProperty())) this.addFromParent(other); | 10946 if ($notnull_bool(other.get$isProperty())) this.addFromParent(other); |
| 10955 return true; | 10947 return true; |
| 10956 } | 10948 } |
| 10957 else { | 10949 else { |
| 10958 world.error('property can only override field or property', this.get$span(),
other.get$span()); | 10950 world.error('property can only override field or property', this.get$span(),
other.get$span()); |
| 10959 return false; | 10951 return false; |
| 10960 } | 10952 } |
| 10961 } | 10953 } |
| 10962 PropertyMember.prototype.get_ = function(context, node, target, isDynamic) { | 10954 PropertyMember.prototype.get_ = function(context, node, target, isDynamic) { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11143 MethodMember.prototype.get$isConst = function() { return this.isConst; }; | 11135 MethodMember.prototype.get$isConst = function() { return this.isConst; }; |
| 11144 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val
ue; }; | 11136 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val
ue; }; |
| 11145 MethodMember.prototype.get$isFactory = function() { return this.isFactory; }; | 11137 MethodMember.prototype.get$isFactory = function() { return this.isFactory; }; |
| 11146 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory =
value; }; | 11138 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory =
value; }; |
| 11147 MethodMember.prototype.get$initDelegate = function() { return this.initDelegate;
}; | 11139 MethodMember.prototype.get$initDelegate = function() { return this.initDelegate;
}; |
| 11148 MethodMember.prototype.set$initDelegate = function(value) { return this.initDele
gate = value; }; | 11140 MethodMember.prototype.set$initDelegate = function(value) { return this.initDele
gate = value; }; |
| 11149 MethodMember.prototype.get$isConstructor = function() { | 11141 MethodMember.prototype.get$isConstructor = function() { |
| 11150 return this.name == this.declaringType.name; | 11142 return this.name == this.declaringType.name; |
| 11151 } | 11143 } |
| 11152 MethodMember.prototype.get$isMethod = function() { | 11144 MethodMember.prototype.get$isMethod = function() { |
| 11153 return !this.get$isConstructor(); | 11145 return !$notnull_bool(this.get$isConstructor()); |
| 11154 } | 11146 } |
| 11155 MethodMember.prototype.get$isNative = function() { | 11147 MethodMember.prototype.get$isNative = function() { |
| 11156 return (this.definition.body instanceof NativeStatement); | 11148 return (this.definition.body instanceof NativeStatement); |
| 11157 } | 11149 } |
| 11158 MethodMember.prototype.get$canGet = function() { | 11150 MethodMember.prototype.get$canGet = function() { |
| 11159 return false; | 11151 return false; |
| 11160 } | 11152 } |
| 11161 MethodMember.prototype.get$canSet = function() { | 11153 MethodMember.prototype.get$canSet = function() { |
| 11162 return false; | 11154 return false; |
| 11163 } | 11155 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 11177 MethodMember.prototype.get$functionType = function() { | 11169 MethodMember.prototype.get$functionType = function() { |
| 11178 if ($notnull_bool(this._functionType == null)) { | 11170 if ($notnull_bool(this._functionType == null)) { |
| 11179 this._functionType = this.get$library().getOrAddFunctionType(this.name, this
.definition, this.declaringType); | 11171 this._functionType = this.get$library().getOrAddFunctionType(this.name, this
.definition, this.declaringType); |
| 11180 if ($notnull_bool(this.parameters == null)) { | 11172 if ($notnull_bool(this.parameters == null)) { |
| 11181 this.resolve(this.declaringType); | 11173 this.resolve(this.declaringType); |
| 11182 } | 11174 } |
| 11183 } | 11175 } |
| 11184 return this._functionType; | 11176 return this._functionType; |
| 11185 } | 11177 } |
| 11186 MethodMember.prototype.override = function(other) { | 11178 MethodMember.prototype.override = function(other) { |
| 11187 if ($notnull_bool(!Member.prototype.override.call(this, other))) return false; | 11179 if ($notnull_bool(!$notnull_bool(Member.prototype.override.call(this, other)))
) return false; |
| 11188 if ($notnull_bool(other.get$isMethod())) { | 11180 if ($notnull_bool(other.get$isMethod())) { |
| 11189 return true; | 11181 return true; |
| 11190 } | 11182 } |
| 11191 else { | 11183 else { |
| 11192 world.error('method can only override methods', this.get$span(), other.get$s
pan()); | 11184 world.error('method can only override methods', this.get$span(), other.get$s
pan()); |
| 11193 return false; | 11185 return false; |
| 11194 } | 11186 } |
| 11195 } | 11187 } |
| 11196 MethodMember.prototype.canInvoke = function(context, args) { | 11188 MethodMember.prototype.canInvoke = function(context, args) { |
| 11197 var bareCount = args.get$bareCount(); | 11189 var bareCount = args.get$bareCount(); |
| 11198 if ($notnull_bool(bareCount > this.parameters.length)) return false; | 11190 if ($notnull_bool(bareCount > this.parameters.length)) return false; |
| 11199 if ($notnull_bool(bareCount == this.parameters.length)) { | 11191 if ($notnull_bool(bareCount == this.parameters.length)) { |
| 11200 if ($notnull_bool(bareCount != args.get$length())) return false; | 11192 if ($notnull_bool(bareCount != args.get$length())) return false; |
| 11201 } | 11193 } |
| 11202 else { | 11194 else { |
| 11203 if ($notnull_bool(!this.parameters.$index(bareCount).get$isOptional())) retu
rn false; | 11195 if ($notnull_bool(!$notnull_bool(this.parameters.$index(bareCount).get$isOpt
ional()))) return false; |
| 11204 for (var i = bareCount; | 11196 for (var i = bareCount; |
| 11205 $notnull_bool(i < args.get$length()); i++) { | 11197 $notnull_bool(i < args.get$length()); i++) { |
| 11206 if ($notnull_bool(this.indexOfParameter(args.getName(i)) < 0)) { | 11198 if ($notnull_bool(this.indexOfParameter(args.getName(i)) < 0)) { |
| 11207 return false; | 11199 return false; |
| 11208 } | 11200 } |
| 11209 } | 11201 } |
| 11210 } | 11202 } |
| 11211 return true; | 11203 return true; |
| 11212 } | 11204 } |
| 11213 MethodMember.prototype.indexOfParameter = function(name0) { | 11205 MethodMember.prototype.indexOfParameter = function(name0) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11246 this.declaringType.genMethod(this); | 11238 this.declaringType.genMethod(this); |
| 11247 this._provideOptionalParamInfo = true; | 11239 this._provideOptionalParamInfo = true; |
| 11248 if ($notnull_bool(this.isStatic)) { | 11240 if ($notnull_bool(this.isStatic)) { |
| 11249 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d
eclaringType.get$jsname() + '.'); | 11241 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d
eclaringType.get$jsname() + '.'); |
| 11250 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname(
) + ''), false, true, false); | 11242 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname(
) + ''), false, true, false); |
| 11251 } | 11243 } |
| 11252 this._providePropertySyntax = true; | 11244 this._providePropertySyntax = true; |
| 11253 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this.
get$jsname() + '()'), false, true, false); | 11245 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this.
get$jsname() + '()'), false, true, false); |
| 11254 } | 11246 } |
| 11255 MethodMember.prototype.namesInOrder = function(args) { | 11247 MethodMember.prototype.namesInOrder = function(args) { |
| 11256 if ($notnull_bool(!args.get$hasNames())) return true; | 11248 if ($notnull_bool(!$notnull_bool(args.get$hasNames()))) return true; |
| 11257 var lastParameter = null; | 11249 var lastParameter = null; |
| 11258 for (var i = args.get$bareCount(); | 11250 for (var i = args.get$bareCount(); |
| 11259 $notnull_bool(i < this.parameters.length); i++) { | 11251 $notnull_bool(i < this.parameters.length); i++) { |
| 11260 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam
e())); | 11252 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam
e())); |
| 11261 if ($notnull_bool(p >= 0 && args.values.$index(p).needsTemp)) { | 11253 if ($notnull_bool(p >= 0 && args.values.$index(p).needsTemp)) { |
| 11262 if ($notnull_bool(lastParameter != null && lastParameter > $assert_num(p))
) { | 11254 if ($notnull_bool(lastParameter != null && lastParameter > $assert_num(p))
) { |
| 11263 return false; | 11255 return false; |
| 11264 } | 11256 } |
| 11265 lastParameter = $assert_num(p); | 11257 lastParameter = $assert_num(p); |
| 11266 } | 11258 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11311 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
{ | 11303 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic)
{ |
| 11312 var $0; | 11304 var $0; |
| 11313 if ($notnull_bool(this.parameters == null)) { | 11305 if ($notnull_bool(this.parameters == null)) { |
| 11314 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.'
+ this.name + '')); | 11306 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.'
+ this.name + '')); |
| 11315 this.resolve(this.declaringType); | 11307 this.resolve(this.declaringType); |
| 11316 } | 11308 } |
| 11317 this.declaringType.genMethod(this); | 11309 this.declaringType.genMethod(this); |
| 11318 if ($notnull_bool(this.isStatic || this.isFactory)) { | 11310 if ($notnull_bool(this.isStatic || this.isFactory)) { |
| 11319 this.declaringType.markUsed(); | 11311 this.declaringType.markUsed(); |
| 11320 } | 11312 } |
| 11321 if ($notnull_bool(!this.namesInOrder(args))) { | 11313 if ($notnull_bool(!$notnull_bool(this.namesInOrder(args)))) { |
| 11322 return context.findMembers(this.name).invokeOnVar(context, node, target, arg
s); | 11314 return context.findMembers(this.name).invokeOnVar(context, node, target, arg
s); |
| 11323 } | 11315 } |
| 11324 var argsCode = []; | 11316 var argsCode = []; |
| 11325 if ($notnull_bool(target != null && (this.get$isConstructor() || target.isSupe
r))) { | 11317 if ($notnull_bool(target != null && (this.get$isConstructor() || target.isSupe
r))) { |
| 11326 argsCode.add('this'); | 11318 argsCode.add('this'); |
| 11327 } | 11319 } |
| 11328 var bareCount = args.get$bareCount(); | 11320 var bareCount = args.get$bareCount(); |
| 11329 for (var i = 0; | 11321 for (var i = 0; |
| 11330 $notnull_bool(i < bareCount); i++) { | 11322 $notnull_bool(i < bareCount); i++) { |
| 11331 var arg = args.values.$index(i); | 11323 var arg = args.values.$index(i); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 11347 for (var i = bareCount; | 11339 for (var i = bareCount; |
| 11348 $notnull_bool(i < this.parameters.length); i++) { | 11340 $notnull_bool(i < this.parameters.length); i++) { |
| 11349 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name(
))); | 11341 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name(
))); |
| 11350 if ($notnull_bool(arg == null)) { | 11342 if ($notnull_bool(arg == null)) { |
| 11351 arg = this.parameters.$index(i).get$value(); | 11343 arg = this.parameters.$index(i).get$value(); |
| 11352 } | 11344 } |
| 11353 else { | 11345 else { |
| 11354 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $
0.is$lang_Type()), node, isDynamic); | 11346 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $
0.is$lang_Type()), node, isDynamic); |
| 11355 namedArgsUsed++; | 11347 namedArgsUsed++; |
| 11356 } | 11348 } |
| 11357 if ($notnull_bool(arg == null || !this.parameters.$index(i).get$isOptional
())) { | 11349 if ($notnull_bool(arg == null || !$notnull_bool(this.parameters.$index(i).
get$isOptional()))) { |
| 11358 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i +
1, true); | 11350 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i +
1, true); |
| 11359 return this._argError(context, node, target, args, $assert_String(msg)); | 11351 return this._argError(context, node, target, args, $assert_String(msg)); |
| 11360 } | 11352 } |
| 11361 else { | 11353 else { |
| 11362 argsCode.add($notnull_bool(this.isConst && arg.get$isConst()) ? arg.cano
nicalCode : arg.code); | 11354 argsCode.add($notnull_bool(this.isConst && arg.get$isConst()) ? arg.cano
nicalCode : arg.code); |
| 11363 } | 11355 } |
| 11364 } | 11356 } |
| 11365 if ($notnull_bool(namedArgsUsed < args.get$nameCount())) { | 11357 if ($notnull_bool(namedArgsUsed < args.get$nameCount())) { |
| 11366 var seen = new HashSetImplementation$String(); | 11358 var seen = new HashSetImplementation$String(); |
| 11367 for (var i = bareCount; | 11359 for (var i = bareCount; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 11380 } | 11372 } |
| 11381 } | 11373 } |
| 11382 world.internalError(('wrong named arguments calling ' + this.name + ''), n
ode.span); | 11374 world.internalError(('wrong named arguments calling ' + this.name + ''), n
ode.span); |
| 11383 } | 11375 } |
| 11384 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); | 11376 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); |
| 11385 } | 11377 } |
| 11386 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); | 11378 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); |
| 11387 if ($notnull_bool(this.get$isConstructor())) { | 11379 if ($notnull_bool(this.get$isConstructor())) { |
| 11388 return this._invokeConstructor(context, node, target, args, argsString); | 11380 return this._invokeConstructor(context, node, target, args, argsString); |
| 11389 } | 11381 } |
| 11382 if ($notnull_bool(target != null && target.isSuper)) { |
| 11383 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
prototype.' + this.get$jsname() + '.call(' + argsString + ')'), false, true, fal
se); |
| 11384 } |
| 11390 if ($notnull_bool(this.name.startsWith('\$'))) { | 11385 if ($notnull_bool(this.name.startsWith('\$'))) { |
| 11391 return this._invokeBuiltin(context, node, target, args, argsCode); | 11386 return this._invokeBuiltin(context, node, target, args, argsCode); |
| 11392 } | 11387 } |
| 11393 if ($notnull_bool(target != null && target.isSuper)) { | |
| 11394 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
prototype.' + this.get$jsname() + '.call(' + argsString + ')'), false, true, fal
se); | |
| 11395 } | |
| 11396 if ($notnull_bool(this.isFactory)) { | 11388 if ($notnull_bool(this.isFactory)) { |
| 11397 return new Value(this.returnType, ('' + this.get$generatedFactoryName() + '(
' + argsString + ')'), false, true, false); | 11389 return new Value(this.returnType, ('' + this.get$generatedFactoryName() + '(
' + argsString + ')'), false, true, false); |
| 11398 } | 11390 } |
| 11399 if ($notnull_bool(this.isStatic)) { | 11391 if ($notnull_bool(this.isStatic)) { |
| 11400 if ($notnull_bool(this.declaringType.get$isTop())) { | 11392 if ($notnull_bool(this.declaringType.get$isTop())) { |
| 11401 return new Value(this.returnType, ('' + this.get$jsname() + '(' + argsStri
ng + ')'), false, true, false); | 11393 return new Value(this.returnType, ('' + this.get$jsname() + '(' + argsStri
ng + ')'), false, true, false); |
| 11402 } | 11394 } |
| 11403 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
' + this.get$jsname() + '(' + argsString + ')'), false, true, false); | 11395 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
' + this.get$jsname() + '(' + argsString + ')'), false, true, false); |
| 11404 } | 11396 } |
| 11405 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')
'); | 11397 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')
'); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11498 var fname = init.x.get$name().get$name(); | 11490 var fname = init.x.get$name().get$name(); |
| 11499 var val = this.generator.visitValue(init.y); | 11491 var val = this.generator.visitValue(init.y); |
| 11500 fields.$setindex(fname, val); | 11492 fields.$setindex(fname, val); |
| 11501 } | 11493 } |
| 11502 } | 11494 } |
| 11503 this.generator._popBlock(); | 11495 this.generator._popBlock(); |
| 11504 } | 11496 } |
| 11505 var $list = this.declaringType.members.getValues(); | 11497 var $list = this.declaringType.members.getValues(); |
| 11506 for (var $i = this.declaringType.members.getValues().iterator(); $i.hasNext();
) { | 11498 for (var $i = this.declaringType.members.getValues().iterator(); $i.hasNext();
) { |
| 11507 var f = $i.next(); | 11499 var f = $i.next(); |
| 11508 if ($notnull_bool((f instanceof FieldMember) && !f.get$isStatic() && $ne(f.g
et$value(), null) && !fields.containsKey(f.get$name()))) { | 11500 if ($notnull_bool((f instanceof FieldMember) && !$notnull_bool(f.get$isStati
c()) && $ne(f.get$value(), null) && !$notnull_bool(fields.containsKey(f.get$name
())))) { |
| 11509 fields.$setindex(f.get$name(), f.computeValue()); | 11501 fields.$setindex(f.get$name(), f.computeValue()); |
| 11510 } | 11502 } |
| 11511 } | 11503 } |
| 11512 return world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(this
.declaringType, fields, code, node.span), args.values); | 11504 return world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(this
.declaringType, fields, code, node.span), args.values); |
| 11513 } | 11505 } |
| 11514 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
gsCode) { | 11506 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
gsCode) { |
| 11515 var allConst = target.get$isConst() && args.values.every((function (arg) { | 11507 var allConst = target.get$isConst() && args.values.every((function (arg) { |
| 11516 return arg.get$isConst(); | 11508 return arg.get$isConst(); |
| 11517 }) | 11509 }) |
| 11518 ); | 11510 ); |
| 11519 if ($notnull_bool(this.declaringType.get$isNum())) { | 11511 if ($notnull_bool(this.declaringType.get$isNum())) { |
| 11520 if ($notnull_bool(!allConst)) { | 11512 if ($notnull_bool(!$notnull_bool(allConst))) { |
| 11521 var code; | 11513 var code; |
| 11522 if ($notnull_bool(this.name == '\$negate')) { | 11514 if ($notnull_bool(this.name == '\$negate')) { |
| 11523 code = ('-' + target.code + ''); | 11515 code = ('-' + target.code + ''); |
| 11524 } | 11516 } |
| 11525 else if ($notnull_bool(this.name == '\$bit_not')) { | 11517 else if ($notnull_bool(this.name == '\$bit_not')) { |
| 11526 code = ('~' + target.code + ''); | 11518 code = ('~' + target.code + ''); |
| 11527 } | 11519 } |
| 11528 else if ($notnull_bool(this.name == '\$truncdiv')) { | 11520 else if ($notnull_bool(this.name == '\$truncdiv')) { |
| 11529 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) +
')'); | 11521 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) +
')'); |
| 11530 } | 11522 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11692 } | 11684 } |
| 11693 else if ($notnull_bool(target.type.get$isNum() || target.type.get$isString()
)) { | 11685 else if ($notnull_bool(target.type.get$isNum() || target.type.get$isString()
)) { |
| 11694 return new Value(this.returnType, ('' + target.code + ' ' + op + ' ' + arg
sCode.$index(0) + ''), false, true, false); | 11686 return new Value(this.returnType, ('' + target.code + ' ' + op + ' ' + arg
sCode.$index(0) + ''), false, true, false); |
| 11695 } | 11687 } |
| 11696 return new Value(this.returnType, ('' + this.name + '(' + target.code + ', '
+ argsCode.$index(0) + ')'), false, true, false); | 11688 return new Value(this.returnType, ('' + this.name + '(' + target.code + ', '
+ argsCode.$index(0) + ')'), false, true, false); |
| 11697 } | 11689 } |
| 11698 if ($notnull_bool(this.name == '\$call')) { | 11690 if ($notnull_bool(this.name == '\$call')) { |
| 11699 this.declaringType.markUsed(); | 11691 this.declaringType.markUsed(); |
| 11700 return new Value(this.returnType, ('' + target.code + '(' + Strings.join((ar
gsCode && argsCode.is$List$String()), ", ") + ')'), false, true, false); | 11692 return new Value(this.returnType, ('' + target.code + '(' + Strings.join((ar
gsCode && argsCode.is$List$String()), ", ") + ')'), false, true, false); |
| 11701 } | 11693 } |
| 11702 return target.invokeSpecial(this.get$jsname(), args, this.returnType); | 11694 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); |
| 11695 return new Value(this.returnType, ('' + target.code + '.' + this.get$jsname()
+ '(' + argsString + ')'), false, true, false); |
| 11703 } | 11696 } |
| 11704 MethodMember.prototype.resolve = function(inType) { | 11697 MethodMember.prototype.resolve = function(inType) { |
| 11705 this.isStatic = inType.get$isTop(); | 11698 this.isStatic = inType.get$isTop(); |
| 11706 this.isConst = false; | 11699 this.isConst = false; |
| 11707 this.isFactory = false; | 11700 this.isFactory = false; |
| 11708 this.isAbstract = !this.declaringType.get$isClass(); | 11701 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass()); |
| 11709 if ($notnull_bool(this.definition.modifiers != null)) { | 11702 if ($notnull_bool(this.definition.modifiers != null)) { |
| 11710 var $list = this.definition.modifiers; | 11703 var $list = this.definition.modifiers; |
| 11711 for (var $i = 0;$i < $list.length; $i++) { | 11704 for (var $i = 0;$i < $list.length; $i++) { |
| 11712 var mod = $list.$index($i); | 11705 var mod = $list.$index($i); |
| 11713 if ($notnull_bool(mod.kind == 86/*TokenKind.STATIC*/)) { | 11706 if ($notnull_bool(mod.kind == 86/*TokenKind.STATIC*/)) { |
| 11714 if ($notnull_bool(this.isStatic)) { | 11707 if ($notnull_bool(this.isStatic)) { |
| 11715 world.error('duplicate static modifier', mod.get$span()); | 11708 world.error('duplicate static modifier', mod.get$span()); |
| 11716 } | 11709 } |
| 11717 this.isStatic = true; | 11710 this.isStatic = true; |
| 11718 } | 11711 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 11740 this.isAbstract = true; | 11733 this.isAbstract = true; |
| 11741 } | 11734 } |
| 11742 else { | 11735 else { |
| 11743 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span
()); | 11736 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span
()); |
| 11744 } | 11737 } |
| 11745 } | 11738 } |
| 11746 } | 11739 } |
| 11747 if ($notnull_bool(this.isFactory)) { | 11740 if ($notnull_bool(this.isFactory)) { |
| 11748 this.isStatic = true; | 11741 this.isStatic = true; |
| 11749 } | 11742 } |
| 11743 if ($notnull_bool(this.name.startsWith('\$') && !$notnull_bool(this.name.start
sWith('\$call')) && this.isStatic)) { |
| 11744 world.error(('operator method may not be static "' + this.name + '"'), this.
get$span()); |
| 11745 } |
| 11750 if ($notnull_bool(this.isAbstract)) { | 11746 if ($notnull_bool(this.isAbstract)) { |
| 11751 if ($notnull_bool(this.definition.body != null && !(this.declaringType.get$d
efinition() instanceof FunctionTypeDefinition))) { | 11747 if ($notnull_bool(this.definition.body != null && !(this.declaringType.get$d
efinition() instanceof FunctionTypeDefinition))) { |
| 11752 world.error('abstract method can not have a body', this.definition.body.sp
an); | 11748 world.error('abstract method can not have a body', this.get$span()); |
| 11753 } | 11749 } |
| 11754 if ($notnull_bool(this.isStatic && !(this.declaringType.get$definition() ins
tanceof FunctionTypeDefinition))) { | 11750 if ($notnull_bool(this.isStatic && !(this.declaringType.get$definition() ins
tanceof FunctionTypeDefinition))) { |
| 11755 world.error('static method can not be abstract', this.definition.span); | 11751 world.error('static method can not be abstract', this.get$span()); |
| 11756 } | 11752 } |
| 11757 } | 11753 } |
| 11758 else { | 11754 else { |
| 11759 if ($notnull_bool(this.definition.body == null && !this.get$isConstructor())
) { | 11755 if ($notnull_bool(this.definition.body == null && !$notnull_bool(this.get$is
Constructor()))) { |
| 11760 world.error('method needs a body', this.get$span()); | 11756 world.error('method needs a body', this.get$span()); |
| 11761 } | 11757 } |
| 11762 } | 11758 } |
| 11763 if ($notnull_bool(this.get$isConstructor())) { | 11759 if ($notnull_bool(this.get$isConstructor())) { |
| 11764 this.returnType = this.declaringType; | 11760 this.returnType = this.declaringType; |
| 11765 } | 11761 } |
| 11766 else { | 11762 else { |
| 11767 this.returnType = inType.resolveType(this.definition.returnType, false); | 11763 this.returnType = inType.resolveType(this.definition.returnType, false); |
| 11768 if ($notnull_bool(this.isStatic && this.returnType.get$hasTypeParams())) { | 11764 if ($notnull_bool(this.isStatic && this.returnType.get$hasTypeParams())) { |
| 11769 world.error('using type parameter in static context', this.definition.retu
rnType.span); | 11765 world.error('using type parameter in static context', this.definition.retu
rnType.span); |
| 11770 } | 11766 } |
| 11771 } | 11767 } |
| 11772 this.parameters = []; | 11768 this.parameters = []; |
| 11773 var $list = this.definition.formals; | 11769 var $list = this.definition.formals; |
| 11774 for (var $i = 0;$i < $list.length; $i++) { | 11770 for (var $i = 0;$i < $list.length; $i++) { |
| 11775 var formal = $list.$index($i); | 11771 var formal = $list.$index($i); |
| 11776 var param = new lang_Parameter(formal); | 11772 var param = new lang_Parameter(formal); |
| 11777 param.resolve(this, inType); | 11773 param.resolve(this, inType); |
| 11778 this.parameters.add(param); | 11774 this.parameters.add(param); |
| 11779 } | 11775 } |
| 11780 if ($notnull_bool(!this.isLambda)) { | 11776 if ($notnull_bool(!$notnull_bool(this.isLambda))) { |
| 11781 this.get$library()._addMember(this); | 11777 this.get$library()._addMember(this); |
| 11782 } | 11778 } |
| 11783 } | 11779 } |
| 11784 MethodMember.prototype.get_$3 = function($0, $1, $2) { | 11780 MethodMember.prototype.get_$3 = function($0, $1, $2) { |
| 11785 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 11781 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 11786 } | 11782 } |
| 11787 ; | 11783 ; |
| 11788 MethodMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 11784 MethodMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 11789 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); | 11785 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); |
| 11790 } | 11786 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 11817 MemberSet.prototype.get$isStatic = function() { | 11813 MemberSet.prototype.get$isStatic = function() { |
| 11818 return this.members.length == 1 && this.members.$index(0).get$isStatic(); | 11814 return this.members.length == 1 && this.members.$index(0).get$isStatic(); |
| 11819 } | 11815 } |
| 11820 MemberSet.prototype.canInvoke = function(context, args) { | 11816 MemberSet.prototype.canInvoke = function(context, args) { |
| 11821 return this.members.some((function (m) { | 11817 return this.members.some((function (m) { |
| 11822 return m.canInvoke(context, args); | 11818 return m.canInvoke(context, args); |
| 11823 }) | 11819 }) |
| 11824 ); | 11820 ); |
| 11825 } | 11821 } |
| 11826 MemberSet.prototype._makeError = function(node, target, action) { | 11822 MemberSet.prototype._makeError = function(node, target, action) { |
| 11827 if ($notnull_bool(!target.type.get$isVar())) { | 11823 if ($notnull_bool(!$notnull_bool(target.type.get$isVar()))) { |
| 11828 world.warning(('could not find applicable ' + action + ' for "' + this.name
+ '"'), node.span); | 11824 world.warning(('could not find applicable ' + action + ' for "' + this.name
+ '"'), node.span); |
| 11829 } | 11825 } |
| 11830 return new Value(null, ('' + target.code + '.' + this.jsname + '() /*no applic
able ' + action + '*/'), false, true, false); | 11826 return new Value(null, ('' + target.code + '.' + this.jsname + '() /*no applic
able ' + action + '*/'), false, true, false); |
| 11831 } | 11827 } |
| 11832 MemberSet.prototype.get$treatAsField = function() { | 11828 MemberSet.prototype.get$treatAsField = function() { |
| 11833 if ($notnull_bool(this._treatAsField == null)) { | 11829 if ($notnull_bool(this._treatAsField == null)) { |
| 11834 this._treatAsField = true; | 11830 this._treatAsField = true; |
| 11835 var $list = this.members; | 11831 var $list = this.members; |
| 11836 for (var $i = 0;$i < $list.length; $i++) { | 11832 for (var $i = 0;$i < $list.length; $i++) { |
| 11837 var member = $list.$index($i); | 11833 var member = $list.$index($i); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12210 } | 12206 } |
| 12211 } | 12207 } |
| 12212 TokenizerBase.prototype._finishToken = function(kind) { | 12208 TokenizerBase.prototype._finishToken = function(kind) { |
| 12213 return new lang_Token(kind, this._source, this._startIndex, this._lang_index); | 12209 return new lang_Token(kind, this._source, this._startIndex, this._lang_index); |
| 12214 } | 12210 } |
| 12215 TokenizerBase.prototype._errorToken = function() { | 12211 TokenizerBase.prototype._errorToken = function() { |
| 12216 return this._finishToken(65/*TokenKind.ERROR*/); | 12212 return this._finishToken(65/*TokenKind.ERROR*/); |
| 12217 } | 12213 } |
| 12218 TokenizerBase.prototype.finishWhitespace = function() { | 12214 TokenizerBase.prototype.finishWhitespace = function() { |
| 12219 while ($notnull_bool(this._lang_index < this._text.length)) { | 12215 while ($notnull_bool(this._lang_index < this._text.length)) { |
| 12220 if ($notnull_bool(!TokenizerHelpers.isWhitespace(this._text.charCodeAt(this.
_lang_index++)))) { | 12216 if ($notnull_bool(!$notnull_bool(TokenizerHelpers.isWhitespace(this._text.ch
arCodeAt(this._lang_index++))))) { |
| 12221 this._lang_index--; | 12217 this._lang_index--; |
| 12222 return this.next(); | 12218 return this.next(); |
| 12223 } | 12219 } |
| 12224 } | 12220 } |
| 12225 return this._finishToken(1/*TokenKind.END_OF_FILE*/); | 12221 return this._finishToken(1/*TokenKind.END_OF_FILE*/); |
| 12226 } | 12222 } |
| 12227 TokenizerBase.prototype.finishHashBang = function() { | 12223 TokenizerBase.prototype.finishHashBang = function() { |
| 12228 while ($notnull_bool(true)) { | 12224 while ($notnull_bool(true)) { |
| 12229 var ch = this._nextChar(); | 12225 var ch = this._nextChar(); |
| 12230 if ($notnull_bool(ch == 0 || ch == 10 || ch == 13)) { | 12226 if ($notnull_bool(ch == 0 || ch == 10 || ch == 13)) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12334 if ($notnull_bool(this._maybeEatChar(quote))) { | 12330 if ($notnull_bool(this._maybeEatChar(quote))) { |
| 12335 return this._finishToken(58/*TokenKind.STRING*/); | 12331 return this._finishToken(58/*TokenKind.STRING*/); |
| 12336 } | 12332 } |
| 12337 } | 12333 } |
| 12338 } | 12334 } |
| 12339 else if ($notnull_bool(ch == 36)) { | 12335 else if ($notnull_bool(ch == 36)) { |
| 12340 this._interpStack = InterpStack.push(this._interpStack, quote, true); | 12336 this._interpStack = InterpStack.push(this._interpStack, quote, true); |
| 12341 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); | 12337 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 12342 } | 12338 } |
| 12343 else if ($notnull_bool(ch == 92)) { | 12339 else if ($notnull_bool(ch == 92)) { |
| 12344 if ($notnull_bool(!this.eatEscapeSequence())) { | 12340 if ($notnull_bool(!$notnull_bool(this.eatEscapeSequence()))) { |
| 12345 return this._errorToken(); | 12341 return this._errorToken(); |
| 12346 } | 12342 } |
| 12347 } | 12343 } |
| 12348 } | 12344 } |
| 12349 } | 12345 } |
| 12350 TokenizerBase.prototype._finishOpenBrace = function() { | 12346 TokenizerBase.prototype._finishOpenBrace = function() { |
| 12351 var $0; | 12347 var $0; |
| 12352 if ($notnull_bool(this._interpStack != null)) { | 12348 if ($notnull_bool(this._interpStack != null)) { |
| 12353 if ($notnull_bool(this._interpStack.depth == -1)) { | 12349 if ($notnull_bool(this._interpStack.depth == -1)) { |
| 12354 this._interpStack.depth = 1; | 12350 this._interpStack.depth = 1; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12417 return this._finishToken(58/*TokenKind.STRING*/); | 12413 return this._finishToken(58/*TokenKind.STRING*/); |
| 12418 } | 12414 } |
| 12419 else if ($notnull_bool(ch == 36)) { | 12415 else if ($notnull_bool(ch == 36)) { |
| 12420 this._interpStack = InterpStack.push(this._interpStack, quote, false); | 12416 this._interpStack = InterpStack.push(this._interpStack, quote, false); |
| 12421 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); | 12417 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 12422 } | 12418 } |
| 12423 else if ($notnull_bool(ch == 0)) { | 12419 else if ($notnull_bool(ch == 0)) { |
| 12424 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); | 12420 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); |
| 12425 } | 12421 } |
| 12426 else if ($notnull_bool(ch == 92)) { | 12422 else if ($notnull_bool(ch == 92)) { |
| 12427 if ($notnull_bool(!this.eatEscapeSequence())) { | 12423 if ($notnull_bool(!$notnull_bool(this.eatEscapeSequence()))) { |
| 12428 return this._errorToken(); | 12424 return this._errorToken(); |
| 12429 } | 12425 } |
| 12430 } | 12426 } |
| 12431 } | 12427 } |
| 12432 } | 12428 } |
| 12433 TokenizerBase.prototype.eatEscapeSequence = function() { | 12429 TokenizerBase.prototype.eatEscapeSequence = function() { |
| 12434 var hex; | 12430 var hex; |
| 12435 switch (this._nextChar()) { | 12431 switch (this._nextChar()) { |
| 12436 case 120: | 12432 case 120: |
| 12437 | 12433 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12473 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { | 12469 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { |
| 12474 this.eatDigits(); | 12470 this.eatDigits(); |
| 12475 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); | 12471 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); |
| 12476 } | 12472 } |
| 12477 else { | 12473 else { |
| 12478 return this._finishToken(14/*TokenKind.DOT*/); | 12474 return this._finishToken(14/*TokenKind.DOT*/); |
| 12479 } | 12475 } |
| 12480 } | 12476 } |
| 12481 TokenizerBase.prototype.finishIdentifier = function() { | 12477 TokenizerBase.prototype.finishIdentifier = function() { |
| 12482 while ($notnull_bool(this._lang_index < this._text.length)) { | 12478 while ($notnull_bool(this._lang_index < this._text.length)) { |
| 12483 if ($notnull_bool(!TokenizerHelpers.isIdentifierPart(this._text.charCodeAt(t
his._lang_index++)))) { | 12479 if ($notnull_bool(!$notnull_bool(TokenizerHelpers.isIdentifierPart(this._tex
t.charCodeAt(this._lang_index++))))) { |
| 12484 this._lang_index--; | 12480 this._lang_index--; |
| 12485 break; | 12481 break; |
| 12486 } | 12482 } |
| 12487 } | 12483 } |
| 12488 var kind = this.getIdentifierKind(); | 12484 var kind = this.getIdentifierKind(); |
| 12489 if ($notnull_bool(this._interpStack != null && this._interpStack.depth == -1))
{ | 12485 if ($notnull_bool(this._interpStack != null && this._interpStack.depth == -1))
{ |
| 12490 this._interpStack.depth = 0; | 12486 this._interpStack.depth = 0; |
| 12491 } | 12487 } |
| 12492 if ($notnull_bool(kind == 70/*TokenKind.IDENTIFIER*/)) { | 12488 if ($notnull_bool(kind == 70/*TokenKind.IDENTIFIER*/)) { |
| 12493 return this._finishToken(70/*TokenKind.IDENTIFIER*/); | 12489 return this._finishToken(70/*TokenKind.IDENTIFIER*/); |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13882 if ($notnull_bool(this._peekToken.kind == kind)) { | 13878 if ($notnull_bool(this._peekToken.kind == kind)) { |
| 13883 this._previousToken = this._peekToken; | 13879 this._previousToken = this._peekToken; |
| 13884 this._peekToken = this.tokenizer.next(); | 13880 this._peekToken = this.tokenizer.next(); |
| 13885 return true; | 13881 return true; |
| 13886 } | 13882 } |
| 13887 else { | 13883 else { |
| 13888 return false; | 13884 return false; |
| 13889 } | 13885 } |
| 13890 } | 13886 } |
| 13891 lang_Parser.prototype._eat = function(kind) { | 13887 lang_Parser.prototype._eat = function(kind) { |
| 13892 if ($notnull_bool(!this._maybeEat(kind))) { | 13888 if ($notnull_bool(!$notnull_bool(this._maybeEat(kind)))) { |
| 13893 this._errorExpected(TokenKind.kindToString(kind)); | 13889 this._errorExpected(TokenKind.kindToString(kind)); |
| 13894 } | 13890 } |
| 13895 } | 13891 } |
| 13896 lang_Parser.prototype._eatSemicolon = function() { | 13892 lang_Parser.prototype._eatSemicolon = function() { |
| 13897 this._eat(10/*TokenKind.SEMICOLON*/); | 13893 this._eat(10/*TokenKind.SEMICOLON*/); |
| 13898 } | 13894 } |
| 13899 lang_Parser.prototype._errorExpected = function(expected) { | 13895 lang_Parser.prototype._errorExpected = function(expected) { |
| 13900 var tok = this._lang_next(); | 13896 var tok = this._lang_next(); |
| 13901 var message = ('expected ' + expected + ', but found ' + tok + ''); | 13897 var message = ('expected ' + expected + ', but found ' + tok + ''); |
| 13902 this._lang_error($assert_String(message), tok.get$span()); | 13898 this._lang_error($assert_String(message), tok.get$span()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 13927 } | 13923 } |
| 13928 lang_Parser.prototype._makeSpan = function(start) { | 13924 lang_Parser.prototype._makeSpan = function(start) { |
| 13929 return new SourceSpan(this.source, start, this._previousToken.end); | 13925 return new SourceSpan(this.source, start, this._previousToken.end); |
| 13930 } | 13926 } |
| 13931 lang_Parser.prototype.compilationUnit = function() { | 13927 lang_Parser.prototype.compilationUnit = function() { |
| 13932 var ret = []; | 13928 var ret = []; |
| 13933 this._maybeEat(13/*TokenKind.HASHBANG*/); | 13929 this._maybeEat(13/*TokenKind.HASHBANG*/); |
| 13934 while ($notnull_bool(this._peekKind(12/*TokenKind.HASH*/))) { | 13930 while ($notnull_bool(this._peekKind(12/*TokenKind.HASH*/))) { |
| 13935 ret.add(this.directive()); | 13931 ret.add(this.directive()); |
| 13936 } | 13932 } |
| 13937 while ($notnull_bool(!this._maybeEat(1/*TokenKind.END_OF_FILE*/))) { | 13933 while ($notnull_bool(!$notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/)
))) { |
| 13938 ret.add(this.topLevelDefinition()); | 13934 ret.add(this.topLevelDefinition()); |
| 13939 } | 13935 } |
| 13940 return ret; | 13936 return ret; |
| 13941 } | 13937 } |
| 13942 lang_Parser.prototype.directive = function() { | 13938 lang_Parser.prototype.directive = function() { |
| 13943 var start = this._peekToken.start; | 13939 var start = this._peekToken.start; |
| 13944 this._eat(12/*TokenKind.HASH*/); | 13940 this._eat(12/*TokenKind.HASH*/); |
| 13945 var name = this.identifier(); | 13941 var name = this.identifier(); |
| 13946 var args = this.arguments(); | 13942 var args = this.arguments(); |
| 13947 this._eatSemicolon(); | 13943 this._eatSemicolon(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13986 var _native = null; | 13982 var _native = null; |
| 13987 if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { | 13983 if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { |
| 13988 _native = this.maybeStringLiteral(); | 13984 _native = this.maybeStringLiteral(); |
| 13989 } | 13985 } |
| 13990 var _factory = null; | 13986 var _factory = null; |
| 13991 if ($notnull_bool(this._maybeEat(75/*TokenKind.FACTORY*/))) { | 13987 if ($notnull_bool(this._maybeEat(75/*TokenKind.FACTORY*/))) { |
| 13992 _factory = this.type(0); | 13988 _factory = this.type(0); |
| 13993 } | 13989 } |
| 13994 var body = []; | 13990 var body = []; |
| 13995 if ($notnull_bool(this._maybeEat(6/*TokenKind.LBRACE*/))) { | 13991 if ($notnull_bool(this._maybeEat(6/*TokenKind.LBRACE*/))) { |
| 13996 while ($notnull_bool(!this._maybeEat(7/*TokenKind.RBRACE*/))) { | 13992 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/))))
{ |
| 13997 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 13993 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 13998 body.add(this.declaration(true)); | 13994 body.add(this.declaration(true)); |
| 13999 } | 13995 } |
| 14000 } | 13996 } |
| 14001 else { | 13997 else { |
| 14002 this._errorExpected('block starting with "{" or ";"'); | 13998 this._errorExpected('block starting with "{" or ";"'); |
| 14003 } | 13999 } |
| 14004 return new TypeDefinition(kind == 73/*TokenKind.CLASS*/, name, typeParams, _ex
tends, _implements, _native, _factory, body, this._makeSpan(start)); | 14000 return new TypeDefinition(kind == 73/*TokenKind.CLASS*/, name, typeParams, _ex
tends, _implements, _native, _factory, body, this._makeSpan(start)); |
| 14005 } | 14001 } |
| 14006 lang_Parser.prototype.functionTypeAlias = function() { | 14002 lang_Parser.prototype.functionTypeAlias = function() { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 14023 ret.add(this.expression()); | 14019 ret.add(this.expression()); |
| 14024 } | 14020 } |
| 14025 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 14021 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 14026 this._inInitializers = false; | 14022 this._inInitializers = false; |
| 14027 return ret; | 14023 return ret; |
| 14028 } | 14024 } |
| 14029 lang_Parser.prototype.functionBody = function(inExpression) { | 14025 lang_Parser.prototype.functionBody = function(inExpression) { |
| 14030 var start = this._peekToken.start; | 14026 var start = this._peekToken.start; |
| 14031 if ($notnull_bool(this._maybeEat(9/*TokenKind.ARROW*/))) { | 14027 if ($notnull_bool(this._maybeEat(9/*TokenKind.ARROW*/))) { |
| 14032 var expr = this.expression(); | 14028 var expr = this.expression(); |
| 14033 if ($notnull_bool(!inExpression)) { | 14029 if ($notnull_bool(!$notnull_bool(inExpression))) { |
| 14034 this._eatSemicolon(); | 14030 this._eatSemicolon(); |
| 14035 } | 14031 } |
| 14036 return new ReturnStatement(expr, this._makeSpan(start)); | 14032 return new ReturnStatement(expr, this._makeSpan(start)); |
| 14037 } | 14033 } |
| 14038 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { | 14034 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { |
| 14039 if ($notnull_bool(this.diet)) { | 14035 if ($notnull_bool(this.diet)) { |
| 14040 this._skipBlock(); | 14036 this._skipBlock(); |
| 14041 return new DietStatement(this._makeSpan(start)); | 14037 return new DietStatement(this._makeSpan(start)); |
| 14042 } | 14038 } |
| 14043 else { | 14039 else { |
| 14044 return this.block(); | 14040 return this.block(); |
| 14045 } | 14041 } |
| 14046 } | 14042 } |
| 14047 else if ($notnull_bool(!inExpression)) { | 14043 else if ($notnull_bool(!$notnull_bool(inExpression))) { |
| 14048 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { | 14044 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { |
| 14049 return null; | 14045 return null; |
| 14050 } | 14046 } |
| 14051 else if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { | 14047 else if ($notnull_bool(this._maybeEat(81/*TokenKind.NATIVE*/))) { |
| 14052 var nativeBody = this.maybeStringLiteral(); | 14048 var nativeBody = this.maybeStringLiteral(); |
| 14053 if ($notnull_bool(this._peekKind(10/*TokenKind.SEMICOLON*/))) { | 14049 if ($notnull_bool(this._peekKind(10/*TokenKind.SEMICOLON*/))) { |
| 14054 this._eatSemicolon(); | 14050 this._eatSemicolon(); |
| 14055 return new NativeStatement(nativeBody, this._makeSpan(start)); | 14051 return new NativeStatement(nativeBody, this._makeSpan(start)); |
| 14056 } | 14052 } |
| 14057 else { | 14053 else { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14262 lang_Parser.prototype.testCondition = function() { | 14258 lang_Parser.prototype.testCondition = function() { |
| 14263 this._eat(2/*TokenKind.LPAREN*/); | 14259 this._eat(2/*TokenKind.LPAREN*/); |
| 14264 var ret = this.expression(); | 14260 var ret = this.expression(); |
| 14265 this._eat(3/*TokenKind.RPAREN*/); | 14261 this._eat(3/*TokenKind.RPAREN*/); |
| 14266 return ret; | 14262 return ret; |
| 14267 } | 14263 } |
| 14268 lang_Parser.prototype.block = function() { | 14264 lang_Parser.prototype.block = function() { |
| 14269 var start = this._peekToken.start; | 14265 var start = this._peekToken.start; |
| 14270 this._eat(6/*TokenKind.LBRACE*/); | 14266 this._eat(6/*TokenKind.LBRACE*/); |
| 14271 var stmts = []; | 14267 var stmts = []; |
| 14272 while ($notnull_bool(!this._maybeEat(7/*TokenKind.RBRACE*/))) { | 14268 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/)))) { |
| 14273 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 14269 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 14274 stmts.add(this.statement()); | 14270 stmts.add(this.statement()); |
| 14275 } | 14271 } |
| 14276 return new BlockStatement(stmts, this._makeSpan(start)); | 14272 return new BlockStatement(stmts, this._makeSpan(start)); |
| 14277 } | 14273 } |
| 14278 lang_Parser.prototype.emptyStatement = function() { | 14274 lang_Parser.prototype.emptyStatement = function() { |
| 14279 var start = this._peekToken.start; | 14275 var start = this._peekToken.start; |
| 14280 this._eat(10/*TokenKind.SEMICOLON*/); | 14276 this._eat(10/*TokenKind.SEMICOLON*/); |
| 14281 return new EmptyStatement(this._makeSpan(start)); | 14277 return new EmptyStatement(this._makeSpan(start)); |
| 14282 } | 14278 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 14309 } | 14305 } |
| 14310 lang_Parser.prototype.forStatement = function() { | 14306 lang_Parser.prototype.forStatement = function() { |
| 14311 var start = this._peekToken.start; | 14307 var start = this._peekToken.start; |
| 14312 this._eat(99/*TokenKind.FOR*/); | 14308 this._eat(99/*TokenKind.FOR*/); |
| 14313 this._eat(2/*TokenKind.LPAREN*/); | 14309 this._eat(2/*TokenKind.LPAREN*/); |
| 14314 var init = this.forInitializerStatement(start); | 14310 var init = this.forInitializerStatement(start); |
| 14315 if ($notnull_bool((init instanceof ForInStatement))) { | 14311 if ($notnull_bool((init instanceof ForInStatement))) { |
| 14316 return init; | 14312 return init; |
| 14317 } | 14313 } |
| 14318 var test = null; | 14314 var test = null; |
| 14319 if ($notnull_bool(!this._maybeEat(10/*TokenKind.SEMICOLON*/))) { | 14315 if ($notnull_bool(!$notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))))
{ |
| 14320 test = this.expression(); | 14316 test = this.expression(); |
| 14321 this._eatSemicolon(); | 14317 this._eatSemicolon(); |
| 14322 } | 14318 } |
| 14323 var step = []; | 14319 var step = []; |
| 14324 if ($notnull_bool(!this._maybeEat(3/*TokenKind.RPAREN*/))) { | 14320 if ($notnull_bool(!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/)))) { |
| 14325 step.add(this.expression()); | 14321 step.add(this.expression()); |
| 14326 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 14322 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 14327 step.add(this.expression()); | 14323 step.add(this.expression()); |
| 14328 } | 14324 } |
| 14329 this._eat(3/*TokenKind.RPAREN*/); | 14325 this._eat(3/*TokenKind.RPAREN*/); |
| 14330 } | 14326 } |
| 14331 var body = this.statement(); | 14327 var body = this.statement(); |
| 14332 return new ForStatement(init, test, step, body, this._makeSpan(start)); | 14328 return new ForStatement(init, test, step, body, this._makeSpan(start)); |
| 14333 } | 14329 } |
| 14334 lang_Parser.prototype.forInitializerStatement = function(start) { | 14330 lang_Parser.prototype.forInitializerStatement = function(start) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14386 this._eat(3/*TokenKind.RPAREN*/); | 14382 this._eat(3/*TokenKind.RPAREN*/); |
| 14387 var body = this.block(); | 14383 var body = this.block(); |
| 14388 return new CatchNode(exc, trace, body, this._makeSpan(start)); | 14384 return new CatchNode(exc, trace, body, this._makeSpan(start)); |
| 14389 } | 14385 } |
| 14390 lang_Parser.prototype.switchStatement = function() { | 14386 lang_Parser.prototype.switchStatement = function() { |
| 14391 var start = this._peekToken.start; | 14387 var start = this._peekToken.start; |
| 14392 this._eat(107/*TokenKind.SWITCH*/); | 14388 this._eat(107/*TokenKind.SWITCH*/); |
| 14393 var test = this.testCondition(); | 14389 var test = this.testCondition(); |
| 14394 var cases = []; | 14390 var cases = []; |
| 14395 this._eat(6/*TokenKind.LBRACE*/); | 14391 this._eat(6/*TokenKind.LBRACE*/); |
| 14396 while ($notnull_bool(!this._maybeEat(7/*TokenKind.RBRACE*/))) { | 14392 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/)))) { |
| 14397 cases.add(this.caseNode()); | 14393 cases.add(this.caseNode()); |
| 14398 } | 14394 } |
| 14399 return new SwitchStatement(test, cases, this._makeSpan(start)); | 14395 return new SwitchStatement(test, cases, this._makeSpan(start)); |
| 14400 } | 14396 } |
| 14401 lang_Parser.prototype._peekCaseEnd = function() { | 14397 lang_Parser.prototype._peekCaseEnd = function() { |
| 14402 var kind = this._peek(); | 14398 var kind = this._peek(); |
| 14403 return $eq(kind, 7/*TokenKind.RBRACE*/) || $eq(kind, 89/*TokenKind.CASE*/) ||
$eq(kind, 93/*TokenKind.DEFAULT*/); | 14399 return $eq(kind, 7/*TokenKind.RBRACE*/) || $eq(kind, 89/*TokenKind.CASE*/) ||
$eq(kind, 93/*TokenKind.DEFAULT*/); |
| 14404 } | 14400 } |
| 14405 lang_Parser.prototype.caseNode = function() { | 14401 lang_Parser.prototype.caseNode = function() { |
| 14406 var start = this._peekToken.start; | 14402 var start = this._peekToken.start; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 14420 this._eat(8/*TokenKind.COLON*/); | 14416 this._eat(8/*TokenKind.COLON*/); |
| 14421 } | 14417 } |
| 14422 else { | 14418 else { |
| 14423 break; | 14419 break; |
| 14424 } | 14420 } |
| 14425 } | 14421 } |
| 14426 if ($notnull_bool(cases.length == 0)) { | 14422 if ($notnull_bool(cases.length == 0)) { |
| 14427 this._lang_error('case or default'); | 14423 this._lang_error('case or default'); |
| 14428 } | 14424 } |
| 14429 var stmts = []; | 14425 var stmts = []; |
| 14430 while ($notnull_bool(!this._peekCaseEnd())) { | 14426 while ($notnull_bool(!$notnull_bool(this._peekCaseEnd()))) { |
| 14431 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 14427 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 14432 stmts.add(this.statement()); | 14428 stmts.add(this.statement()); |
| 14433 } | 14429 } |
| 14434 return new CaseNode(label, cases, stmts, this._makeSpan(start)); | 14430 return new CaseNode(label, cases, stmts, this._makeSpan(start)); |
| 14435 } | 14431 } |
| 14436 lang_Parser.prototype.returnStatement = function() { | 14432 lang_Parser.prototype.returnStatement = function() { |
| 14437 var start = this._peekToken.start; | 14433 var start = this._peekToken.start; |
| 14438 this._eat(105/*TokenKind.RETURN*/); | 14434 this._eat(105/*TokenKind.RETURN*/); |
| 14439 var expr; | 14435 var expr; |
| 14440 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { | 14436 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14551 var kind = this._peek(); | 14547 var kind = this._peek(); |
| 14552 var prec = TokenKind.infixPrecedence(this._peek()); | 14548 var prec = TokenKind.infixPrecedence(this._peek()); |
| 14553 if ($notnull_bool(prec >= precedence)) { | 14549 if ($notnull_bool(prec >= precedence)) { |
| 14554 if ($notnull_bool(kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/
)) { | 14550 if ($notnull_bool(kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/
)) { |
| 14555 if ($notnull_bool(this._isBin(x, 52/*TokenKind.LT*/))) { | 14551 if ($notnull_bool(this._isBin(x, 52/*TokenKind.LT*/))) { |
| 14556 return this._fixAsType((x && x.is$BinaryExpression())); | 14552 return this._fixAsType((x && x.is$BinaryExpression())); |
| 14557 } | 14553 } |
| 14558 } | 14554 } |
| 14559 var op = this._lang_next(); | 14555 var op = this._lang_next(); |
| 14560 if ($notnull_bool(op.kind == 102/*TokenKind.IS*/)) { | 14556 if ($notnull_bool(op.kind == 102/*TokenKind.IS*/)) { |
| 14561 var isTrue = !this._maybeEat(19/*TokenKind.NOT*/); | 14557 var isTrue = !$notnull_bool(this._maybeEat(19/*TokenKind.NOT*/)); |
| 14562 var typeRef = this.type(0); | 14558 var typeRef = this.type(0); |
| 14563 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); | 14559 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); |
| 14564 continue; | 14560 continue; |
| 14565 } | 14561 } |
| 14566 var y = this.infixExpression($assert_num($notnull_bool($eq(prec, 2)) ? pre
c : prec + 1)); | 14562 var y = this.infixExpression($assert_num($notnull_bool($eq(prec, 2)) ? pre
c : prec + 1)); |
| 14567 if ($notnull_bool(op.kind == 33/*TokenKind.CONDITIONAL*/)) { | 14563 if ($notnull_bool(op.kind == 33/*TokenKind.CONDITIONAL*/)) { |
| 14568 this._eat(8/*TokenKind.COLON*/); | 14564 this._eat(8/*TokenKind.COLON*/); |
| 14569 var z = this.infixExpression($assert_num(prec + 1)); | 14565 var z = this.infixExpression($assert_num(prec + 1)); |
| 14570 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start)); | 14566 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start)); |
| 14571 } | 14567 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14615 expr = this.expression(); | 14611 expr = this.expression(); |
| 14616 if ($notnull_bool(label == null && this._maybeEat(8/*TokenKind.COLON*/))) { | 14612 if ($notnull_bool(label == null && this._maybeEat(8/*TokenKind.COLON*/))) { |
| 14617 label = this._makeLabel(expr); | 14613 label = this._makeLabel(expr); |
| 14618 expr = this.expression(); | 14614 expr = this.expression(); |
| 14619 } | 14615 } |
| 14620 return new ArgumentNode(label, expr, this._makeSpan(start)); | 14616 return new ArgumentNode(label, expr, this._makeSpan(start)); |
| 14621 } | 14617 } |
| 14622 lang_Parser.prototype.arguments = function() { | 14618 lang_Parser.prototype.arguments = function() { |
| 14623 var args = []; | 14619 var args = []; |
| 14624 this._eat(2/*TokenKind.LPAREN*/); | 14620 this._eat(2/*TokenKind.LPAREN*/); |
| 14625 if ($notnull_bool(!this._maybeEat(3/*TokenKind.RPAREN*/))) { | 14621 if ($notnull_bool(!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/)))) { |
| 14626 do { | 14622 do { |
| 14627 args.add(this.argument()); | 14623 args.add(this.argument()); |
| 14628 } | 14624 } |
| 14629 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 14625 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 14630 this._eat(3/*TokenKind.RPAREN*/); | 14626 this._eat(3/*TokenKind.RPAREN*/); |
| 14631 } | 14627 } |
| 14632 return args; | 14628 return args; |
| 14633 } | 14629 } |
| 14634 lang_Parser.prototype.get$arguments = function() { | 14630 lang_Parser.prototype.get$arguments = function() { |
| 14635 return lang_Parser.prototype.arguments.bind(this); | 14631 return lang_Parser.prototype.arguments.bind(this); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14783 return this.finishTypedLiteral(start, false); | 14779 return this.finishTypedLiteral(start, false); |
| 14784 | 14780 |
| 14785 case 113/*TokenKind.VOID*/: | 14781 case 113/*TokenKind.VOID*/: |
| 14786 case 112/*TokenKind.VAR*/: | 14782 case 112/*TokenKind.VAR*/: |
| 14787 case 97/*TokenKind.FINAL*/: | 14783 case 97/*TokenKind.FINAL*/: |
| 14788 | 14784 |
| 14789 return this.declaredIdentifier(false); | 14785 return this.declaredIdentifier(false); |
| 14790 | 14786 |
| 14791 default: | 14787 default: |
| 14792 | 14788 |
| 14793 if ($notnull_bool(!this._peekIdentifier())) { | 14789 if ($notnull_bool(!$notnull_bool(this._peekIdentifier()))) { |
| 14794 this._errorExpected('expression'); | 14790 this._errorExpected('expression'); |
| 14795 } | 14791 } |
| 14796 return new VarExpression(this.identifier(), this._makeSpan(start)); | 14792 return new VarExpression(this.identifier(), this._makeSpan(start)); |
| 14797 | 14793 |
| 14798 } | 14794 } |
| 14799 } | 14795 } |
| 14800 lang_Parser.prototype.stringInterpolation = function() { | 14796 lang_Parser.prototype.stringInterpolation = function() { |
| 14801 var start = this._peekToken.start; | 14797 var start = this._peekToken.start; |
| 14802 var lits = []; | 14798 var lits = []; |
| 14803 var startQuote = null, endQuote = null; | 14799 var startQuote = null, endQuote = null; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14854 } | 14850 } |
| 14855 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) { | 14851 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) { |
| 14856 this._lang_next(); | 14852 this._lang_next(); |
| 14857 this._errorExpected('string literal, but found incomplete string'); | 14853 this._errorExpected('string literal, but found incomplete string'); |
| 14858 } | 14854 } |
| 14859 return null; | 14855 return null; |
| 14860 } | 14856 } |
| 14861 lang_Parser.prototype._parenOrLambda = function() { | 14857 lang_Parser.prototype._parenOrLambda = function() { |
| 14862 var start = this._peekToken.start; | 14858 var start = this._peekToken.start; |
| 14863 var args = this.arguments(); | 14859 var args = this.arguments(); |
| 14864 if ($notnull_bool(!this._inInitializers && (this._peekKind(9/*TokenKind.ARROW*
/) || this._peekKind(6/*TokenKind.LBRACE*/)))) { | 14860 if ($notnull_bool(!$notnull_bool(this._inInitializers) && (this._peekKind(9/*T
okenKind.ARROW*/) || this._peekKind(6/*TokenKind.LBRACE*/)))) { |
| 14865 var body = this.functionBody(true); | 14861 var body = this.functionBody(true); |
| 14866 var formals = this._makeFormals(args); | 14862 var formals = this._makeFormals(args); |
| 14867 var func = new FunctionDefinition(null, null, null, formals, null, body, thi
s._makeSpan(start)); | 14863 var func = new FunctionDefinition(null, null, null, formals, null, body, thi
s._makeSpan(start)); |
| 14868 return new LambdaExpression(func, func.get$span()); | 14864 return new LambdaExpression(func, func.get$span()); |
| 14869 } | 14865 } |
| 14870 else { | 14866 else { |
| 14871 if ($notnull_bool(args.length == 1)) { | 14867 if ($notnull_bool(args.length == 1)) { |
| 14872 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star
t)); | 14868 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star
t)); |
| 14873 } | 14869 } |
| 14874 else { | 14870 else { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 14893 | 14889 |
| 14894 case 108/*TokenKind.THIS*/: | 14890 case 108/*TokenKind.THIS*/: |
| 14895 | 14891 |
| 14896 this._eat(108/*TokenKind.THIS*/); | 14892 this._eat(108/*TokenKind.THIS*/); |
| 14897 this._eat(14/*TokenKind.DOT*/); | 14893 this._eat(14/*TokenKind.DOT*/); |
| 14898 name = ('this.' + this.identifier().get$name() + ''); | 14894 name = ('this.' + this.identifier().get$name() + ''); |
| 14899 break; | 14895 break; |
| 14900 | 14896 |
| 14901 case 76/*TokenKind.GET*/: | 14897 case 76/*TokenKind.GET*/: |
| 14902 | 14898 |
| 14903 if ($notnull_bool(!includeOperators)) return null; | 14899 if ($notnull_bool(!$notnull_bool(includeOperators))) return null; |
| 14904 this._eat(76/*TokenKind.GET*/); | 14900 this._eat(76/*TokenKind.GET*/); |
| 14905 if ($notnull_bool(this._peekIdentifier())) { | 14901 if ($notnull_bool(this._peekIdentifier())) { |
| 14906 name = ('get\$' + this.identifier().get$name() + ''); | 14902 name = ('get\$' + this.identifier().get$name() + ''); |
| 14907 } | 14903 } |
| 14908 else { | 14904 else { |
| 14909 name = 'get'; | 14905 name = 'get'; |
| 14910 } | 14906 } |
| 14911 break; | 14907 break; |
| 14912 | 14908 |
| 14913 case 84/*TokenKind.SET*/: | 14909 case 84/*TokenKind.SET*/: |
| 14914 | 14910 |
| 14915 if ($notnull_bool(!includeOperators)) return null; | 14911 if ($notnull_bool(!$notnull_bool(includeOperators))) return null; |
| 14916 this._eat(84/*TokenKind.SET*/); | 14912 this._eat(84/*TokenKind.SET*/); |
| 14917 if ($notnull_bool(this._peekIdentifier())) { | 14913 if ($notnull_bool(this._peekIdentifier())) { |
| 14918 name = ('set\$' + this.identifier().get$name() + ''); | 14914 name = ('set\$' + this.identifier().get$name() + ''); |
| 14919 } | 14915 } |
| 14920 else { | 14916 else { |
| 14921 name = 'set'; | 14917 name = 'set'; |
| 14922 } | 14918 } |
| 14923 break; | 14919 break; |
| 14924 | 14920 |
| 14925 case 83/*TokenKind.OPERATOR*/: | 14921 case 83/*TokenKind.OPERATOR*/: |
| 14926 | 14922 |
| 14927 if ($notnull_bool(!includeOperators)) return null; | 14923 if ($notnull_bool(!$notnull_bool(includeOperators))) return null; |
| 14928 this._eat(83/*TokenKind.OPERATOR*/); | 14924 this._eat(83/*TokenKind.OPERATOR*/); |
| 14929 var kind = this._peek(); | 14925 var kind = this._peek(); |
| 14930 if ($notnull_bool($eq(kind, 82/*TokenKind.NEGATE*/))) { | 14926 if ($notnull_bool($eq(kind, 82/*TokenKind.NEGATE*/))) { |
| 14931 name = '\$negate'; | 14927 name = '\$negate'; |
| 14932 this._lang_next(); | 14928 this._lang_next(); |
| 14933 } | 14929 } |
| 14934 else { | 14930 else { |
| 14935 name = TokenKind.binaryMethodName($assert_num(kind)); | 14931 name = TokenKind.binaryMethodName($assert_num(kind)); |
| 14936 if ($notnull_bool(name == null)) { | 14932 if ($notnull_bool(name == null)) { |
| 14937 name = 'operator'; | 14933 name = 'operator'; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15002 } | 14998 } |
| 15003 var args = this.arguments(); | 14999 var args = this.arguments(); |
| 15004 return new lang_NewExpression(isConst, type0, name, args, this._makeSpan(start
)); | 15000 return new lang_NewExpression(isConst, type0, name, args, this._makeSpan(start
)); |
| 15005 } | 15001 } |
| 15006 lang_Parser.prototype.finishListLiteral = function(start, isConst, type0) { | 15002 lang_Parser.prototype.finishListLiteral = function(start, isConst, type0) { |
| 15007 if ($notnull_bool(this._maybeEat(56/*TokenKind.INDEX*/))) { | 15003 if ($notnull_bool(this._maybeEat(56/*TokenKind.INDEX*/))) { |
| 15008 return new ListExpression(isConst, type0, [], this._makeSpan(start)); | 15004 return new ListExpression(isConst, type0, [], this._makeSpan(start)); |
| 15009 } | 15005 } |
| 15010 var values = []; | 15006 var values = []; |
| 15011 this._eat(4/*TokenKind.LBRACK*/); | 15007 this._eat(4/*TokenKind.LBRACK*/); |
| 15012 while ($notnull_bool(!this._maybeEat(5/*TokenKind.RBRACK*/))) { | 15008 while ($notnull_bool(!$notnull_bool(this._maybeEat(5/*TokenKind.RBRACK*/)))) { |
| 15013 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 15009 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 15014 values.add(this.expression()); | 15010 values.add(this.expression()); |
| 15015 if ($notnull_bool(!this._maybeEat(11/*TokenKind.COMMA*/))) { | 15011 if ($notnull_bool(!$notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/)))) { |
| 15016 this._eat(5/*TokenKind.RBRACK*/); | 15012 this._eat(5/*TokenKind.RBRACK*/); |
| 15017 break; | 15013 break; |
| 15018 } | 15014 } |
| 15019 } | 15015 } |
| 15020 return new ListExpression(isConst, type0, values, this._makeSpan(start)); | 15016 return new ListExpression(isConst, type0, values, this._makeSpan(start)); |
| 15021 } | 15017 } |
| 15022 lang_Parser.prototype.finishMapLiteral = function(start, isConst, type0) { | 15018 lang_Parser.prototype.finishMapLiteral = function(start, isConst, type0) { |
| 15023 var items = []; | 15019 var items = []; |
| 15024 this._eat(6/*TokenKind.LBRACE*/); | 15020 this._eat(6/*TokenKind.LBRACE*/); |
| 15025 while ($notnull_bool(!this._maybeEat(7/*TokenKind.RBRACE*/))) { | 15021 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/)))) { |
| 15026 if ($notnull_bool(this.isPrematureEndOfFile())) break; | 15022 if ($notnull_bool(this.isPrematureEndOfFile())) break; |
| 15027 items.add(this.expression()); | 15023 items.add(this.expression()); |
| 15028 this._eat(8/*TokenKind.COLON*/); | 15024 this._eat(8/*TokenKind.COLON*/); |
| 15029 items.add(this.expression()); | 15025 items.add(this.expression()); |
| 15030 if ($notnull_bool(!this._maybeEat(11/*TokenKind.COMMA*/))) { | 15026 if ($notnull_bool(!$notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/)))) { |
| 15031 this._eat(7/*TokenKind.RBRACE*/); | 15027 this._eat(7/*TokenKind.RBRACE*/); |
| 15032 break; | 15028 break; |
| 15033 } | 15029 } |
| 15034 } | 15030 } |
| 15035 return new MapExpression(isConst, type0, items, this._makeSpan(start)); | 15031 return new MapExpression(isConst, type0, items, this._makeSpan(start)); |
| 15036 } | 15032 } |
| 15037 lang_Parser.prototype.finishTypedLiteral = function(start, isConst) { | 15033 lang_Parser.prototype.finishTypedLiteral = function(start, isConst) { |
| 15038 var span = this._makeSpan(start); | 15034 var span = this._makeSpan(start); |
| 15039 var typeToBeNamedLater = new NameTypeReference(false, null, null, (span && spa
n.is$SourceSpan())); | 15035 var typeToBeNamedLater = new NameTypeReference(false, null, null, (span && spa
n.is$SourceSpan())); |
| 15040 var genericType = this.addTypeArguments((typeToBeNamedLater && typeToBeNamedLa
ter.is$TypeReference()), 0); | 15036 var genericType = this.addTypeArguments((typeToBeNamedLater && typeToBeNamedLa
ter.is$TypeReference()), 0); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15085 var ret = []; | 15081 var ret = []; |
| 15086 do { | 15082 do { |
| 15087 var tp = this.typeParameter(); | 15083 var tp = this.typeParameter(); |
| 15088 ret.add(tp); | 15084 ret.add(tp); |
| 15089 if ($notnull_bool((tp.extendsType instanceof GenericTypeReference) && tp.ext
endsType.depth == 0)) { | 15085 if ($notnull_bool((tp.extendsType instanceof GenericTypeReference) && tp.ext
endsType.depth == 0)) { |
| 15090 closed = true; | 15086 closed = true; |
| 15091 break; | 15087 break; |
| 15092 } | 15088 } |
| 15093 } | 15089 } |
| 15094 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) | 15090 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) |
| 15095 if ($notnull_bool(!closed)) { | 15091 if ($notnull_bool(!$notnull_bool(closed))) { |
| 15096 this._eat(53/*TokenKind.GT*/); | 15092 this._eat(53/*TokenKind.GT*/); |
| 15097 } | 15093 } |
| 15098 return ret; | 15094 return ret; |
| 15099 } | 15095 } |
| 15100 lang_Parser.prototype.get$typeParameters = function() { | 15096 lang_Parser.prototype.get$typeParameters = function() { |
| 15101 return lang_Parser.prototype.typeParameters.bind(this); | 15097 return lang_Parser.prototype.typeParameters.bind(this); |
| 15102 } | 15098 } |
| 15103 lang_Parser.prototype._eatClosingAngle = function(depth) { | 15099 lang_Parser.prototype._eatClosingAngle = function(depth) { |
| 15104 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { | 15100 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { |
| 15105 return depth; | 15101 return depth; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15189 } | 15185 } |
| 15190 lang_Parser.prototype.formalParameter = function(inOptionalBlock) { | 15186 lang_Parser.prototype.formalParameter = function(inOptionalBlock) { |
| 15191 var start = this._peekToken.start; | 15187 var start = this._peekToken.start; |
| 15192 var isThis = false; | 15188 var isThis = false; |
| 15193 var isRest = false; | 15189 var isRest = false; |
| 15194 var di = this.declaredIdentifier(false); | 15190 var di = this.declaredIdentifier(false); |
| 15195 var type0 = di.type; | 15191 var type0 = di.type; |
| 15196 var name = di.get$name(); | 15192 var name = di.get$name(); |
| 15197 var value = null; | 15193 var value = null; |
| 15198 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { | 15194 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { |
| 15199 if ($notnull_bool(!inOptionalBlock)) { | 15195 if ($notnull_bool(!$notnull_bool(inOptionalBlock))) { |
| 15200 this._lang_error('default values only allowed inside [optional] section'); | 15196 this._lang_error('default values only allowed inside [optional] section'); |
| 15201 } | 15197 } |
| 15202 value = this.expression(); | 15198 value = this.expression(); |
| 15203 } | 15199 } |
| 15204 else if ($notnull_bool(this._peekKind(2/*TokenKind.LPAREN*/))) { | 15200 else if ($notnull_bool(this._peekKind(2/*TokenKind.LPAREN*/))) { |
| 15205 var formals = this.formalParameterList(); | 15201 var formals = this.formalParameterList(); |
| 15206 var func = new FunctionDefinition(null, type0, name, formals, null, null, th
is._makeSpan(start)); | 15202 var func = new FunctionDefinition(null, type0, name, formals, null, null, th
is._makeSpan(start)); |
| 15207 type0 = new FunctionTypeReference(false, func, func.get$span()); | 15203 type0 = new FunctionTypeReference(false, func, func.get$span()); |
| 15208 } | 15204 } |
| 15209 if ($notnull_bool(inOptionalBlock && value == null)) { | 15205 if ($notnull_bool(inOptionalBlock && value == null)) { |
| 15210 value = new NullExpression(this._makeSpan(start)); | 15206 value = new NullExpression(this._makeSpan(start)); |
| 15211 } | 15207 } |
| 15212 return new FormalNode(isThis, isRest, type0, name, value, this._makeSpan(start
)); | 15208 return new FormalNode(isThis, isRest, type0, name, value, this._makeSpan(start
)); |
| 15213 } | 15209 } |
| 15214 lang_Parser.prototype.formalParameterList = function() { | 15210 lang_Parser.prototype.formalParameterList = function() { |
| 15215 this._eat(2/*TokenKind.LPAREN*/); | 15211 this._eat(2/*TokenKind.LPAREN*/); |
| 15216 var formals = []; | 15212 var formals = []; |
| 15217 var inOptionalBlock = false; | 15213 var inOptionalBlock = false; |
| 15218 if ($notnull_bool(!this._maybeEat(3/*TokenKind.RPAREN*/))) { | 15214 if ($notnull_bool(!$notnull_bool(this._maybeEat(3/*TokenKind.RPAREN*/)))) { |
| 15219 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { | 15215 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { |
| 15220 inOptionalBlock = true; | 15216 inOptionalBlock = true; |
| 15221 } | 15217 } |
| 15222 formals.add(this.formalParameter($assert_bool(inOptionalBlock))); | 15218 formals.add(this.formalParameter($assert_bool(inOptionalBlock))); |
| 15223 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { | 15219 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { |
| 15224 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { | 15220 if ($notnull_bool(this._maybeEat(4/*TokenKind.LBRACK*/))) { |
| 15225 if ($notnull_bool(inOptionalBlock)) { | 15221 if ($notnull_bool(inOptionalBlock)) { |
| 15226 this._lang_error('already inside an optional block', this._previousTok
en.get$span()); | 15222 this._lang_error('already inside an optional block', this._previousTok
en.get$span()); |
| 15227 } | 15223 } |
| 15228 inOptionalBlock = true; | 15224 inOptionalBlock = true; |
| 15229 } | 15225 } |
| 15230 formals.add(this.formalParameter($assert_bool(inOptionalBlock))); | 15226 formals.add(this.formalParameter($assert_bool(inOptionalBlock))); |
| 15231 } | 15227 } |
| 15232 if ($notnull_bool(inOptionalBlock)) { | 15228 if ($notnull_bool(inOptionalBlock)) { |
| 15233 this._eat(5/*TokenKind.RBRACK*/); | 15229 this._eat(5/*TokenKind.RBRACK*/); |
| 15234 } | 15230 } |
| 15235 this._eat(3/*TokenKind.RPAREN*/); | 15231 this._eat(3/*TokenKind.RPAREN*/); |
| 15236 } | 15232 } |
| 15237 return formals; | 15233 return formals; |
| 15238 } | 15234 } |
| 15239 lang_Parser.prototype.identifier = function() { | 15235 lang_Parser.prototype.identifier = function() { |
| 15240 var tok = this._lang_next(); | 15236 var tok = this._lang_next(); |
| 15241 if ($notnull_bool(!TokenKind.isIdentifier(tok.kind))) { | 15237 if ($notnull_bool(!$notnull_bool(TokenKind.isIdentifier(tok.kind)))) { |
| 15242 this._lang_error(('expected identifier, but found ' + tok + ''), tok.get$spa
n()); | 15238 this._lang_error(('expected identifier, but found ' + tok + ''), tok.get$spa
n()); |
| 15243 } | 15239 } |
| 15244 return new lang_Identifier(tok.get$text(), this._makeSpan(tok.start)); | 15240 return new lang_Identifier(tok.get$text(), this._makeSpan(tok.start)); |
| 15245 } | 15241 } |
| 15246 lang_Parser.prototype._makeFunction = function(expr, body) { | 15242 lang_Parser.prototype._makeFunction = function(expr, body) { |
| 15247 var name, type0; | 15243 var name, type0; |
| 15248 if ($notnull_bool((expr instanceof CallExpression))) { | 15244 if ($notnull_bool((expr instanceof CallExpression))) { |
| 15249 if ($notnull_bool((expr.target instanceof VarExpression))) { | 15245 if ($notnull_bool((expr.target instanceof VarExpression))) { |
| 15250 name = expr.target.get$name(); | 15246 name = expr.target.get$name(); |
| 15251 type0 = null; | 15247 type0 = null; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15334 break; | 15330 break; |
| 15335 } | 15331 } |
| 15336 else { | 15332 else { |
| 15337 typeParams.add(this._makeType(expr)); | 15333 typeParams.add(this._makeType(expr)); |
| 15338 } | 15334 } |
| 15339 } | 15335 } |
| 15340 formals.add(formal); | 15336 formals.add(formal); |
| 15341 } | 15337 } |
| 15342 else if ($notnull_bool(!!(formal && formal.is$List))) { | 15338 else if ($notnull_bool(!!(formal && formal.is$List))) { |
| 15343 formals.addAll(formal); | 15339 formals.addAll(formal); |
| 15344 if ($notnull_bool(!allowOptional)) { | 15340 if ($notnull_bool(!$notnull_bool(allowOptional))) { |
| 15345 this._lang_error('unexpected nested optional formal', expressions.$index
(i).get$span()); | 15341 this._lang_error('unexpected nested optional formal', expressions.$index
(i).get$span()); |
| 15346 } | 15342 } |
| 15347 } | 15343 } |
| 15348 else { | 15344 else { |
| 15349 formals.add(formal); | 15345 formals.add(formal); |
| 15350 } | 15346 } |
| 15351 } | 15347 } |
| 15352 return formals; | 15348 return formals; |
| 15353 } | 15349 } |
| 15354 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { | 15350 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16060 this.isTested = false; | 16056 this.isTested = false; |
| 16061 // Initializers done | 16057 // Initializers done |
| 16062 } | 16058 } |
| 16063 lang_Type.prototype.is$lang_Type = function(){return this;}; | 16059 lang_Type.prototype.is$lang_Type = function(){return this;}; |
| 16064 lang_Type.prototype.is$Named = function(){return this;}; | 16060 lang_Type.prototype.is$Named = function(){return this;}; |
| 16065 lang_Type.prototype.get$name = function() { return this.name; }; | 16061 lang_Type.prototype.get$name = function() { return this.name; }; |
| 16066 lang_Type.prototype.markUsed = function() { | 16062 lang_Type.prototype.markUsed = function() { |
| 16067 | 16063 |
| 16068 } | 16064 } |
| 16069 lang_Type.prototype.get$typeMember = function() { | 16065 lang_Type.prototype.get$typeMember = function() { |
| 16070 var $0; | |
| 16071 if ($notnull_bool(this._typeMember == null)) { | 16066 if ($notnull_bool(this._typeMember == null)) { |
| 16072 this._typeMember = new TypeMember((($0 = this) && $0.is$DefinedType())); | 16067 this._typeMember = new TypeMember((this && this.is$DefinedType())); |
| 16073 } | 16068 } |
| 16074 return this._typeMember; | 16069 return this._typeMember; |
| 16075 } | 16070 } |
| 16076 lang_Type.prototype.getMember = function(name0) { | 16071 lang_Type.prototype.getMember = function(name0) { |
| 16077 return null; | 16072 return null; |
| 16078 } | 16073 } |
| 16079 lang_Type.prototype.get$isVar = function() { | 16074 lang_Type.prototype.get$isVar = function() { |
| 16080 return false; | 16075 return false; |
| 16081 } | 16076 } |
| 16082 lang_Type.prototype.get$isTop = function() { | 16077 lang_Type.prototype.get$isTop = function() { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16148 lang_Type.prototype.get$parent = function() { | 16143 lang_Type.prototype.get$parent = function() { |
| 16149 return null; | 16144 return null; |
| 16150 } | 16145 } |
| 16151 lang_Type.prototype.getAllMembers = function() { | 16146 lang_Type.prototype.getAllMembers = function() { |
| 16152 return $map([]); | 16147 return $map([]); |
| 16153 } | 16148 } |
| 16154 lang_Type.prototype.hashCode = function() { | 16149 lang_Type.prototype.hashCode = function() { |
| 16155 return this.name.hashCode(); | 16150 return this.name.hashCode(); |
| 16156 } | 16151 } |
| 16157 lang_Type.prototype.ensureSubtypeOf = function(other, span0, typeErrors) { | 16152 lang_Type.prototype.ensureSubtypeOf = function(other, span0, typeErrors) { |
| 16158 if ($notnull_bool(!this.isSubtypeOf(other))) { | 16153 if ($notnull_bool(!$notnull_bool(this.isSubtypeOf(other)))) { |
| 16159 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name + ''); | 16154 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name + ''); |
| 16160 if ($notnull_bool(typeErrors)) { | 16155 if ($notnull_bool(typeErrors)) { |
| 16161 world.error($assert_String(msg), span0); | 16156 world.error($assert_String(msg), span0); |
| 16162 } | 16157 } |
| 16163 else { | 16158 else { |
| 16164 world.warning($assert_String(msg), span0); | 16159 world.warning($assert_String(msg), span0); |
| 16165 } | 16160 } |
| 16166 } | 16161 } |
| 16167 } | 16162 } |
| 16168 lang_Type.prototype.needsVarCall = function(args) { | 16163 lang_Type.prototype.needsVarCall = function(args) { |
| 16169 if ($notnull_bool(this.get$isVarOrFunction())) { | 16164 if ($notnull_bool(this.get$isVarOrFunction())) { |
| 16170 return true; | 16165 return true; |
| 16171 } | 16166 } |
| 16172 var call = this.getCallMethod(); | 16167 var call = this.getCallMethod(); |
| 16173 if ($notnull_bool($ne(call, null))) { | 16168 if ($notnull_bool($ne(call, null))) { |
| 16174 if ($notnull_bool(args.get$length() != call.get$parameters().length || !call
.namesInOrder(args))) { | 16169 if ($notnull_bool(args.get$length() != call.get$parameters().length || !$not
null_bool(call.namesInOrder(args)))) { |
| 16175 return true; | 16170 return true; |
| 16176 } | 16171 } |
| 16177 } | 16172 } |
| 16178 return false; | 16173 return false; |
| 16179 } | 16174 } |
| 16180 lang_Type.union = function(x, y) { | 16175 lang_Type.union = function(x, y) { |
| 16181 if ($notnull_bool($eq(x, y))) return x; | 16176 if ($notnull_bool($eq(x, y))) return x; |
| 16182 if ($notnull_bool(x.get$isNum() && y.get$isNum())) return world.numType; | 16177 if ($notnull_bool(x.get$isNum() && y.get$isNum())) return world.numType; |
| 16183 if ($notnull_bool(x.get$isString() && y.get$isString())) return world.stringTy
pe; | 16178 if ($notnull_bool(x.get$isString() && y.get$isString())) return world.stringTy
pe; |
| 16184 return world.varType; | 16179 return world.varType; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 16213 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true; | 16208 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true; |
| 16214 var call = this.getCallMethod(); | 16209 var call = this.getCallMethod(); |
| 16215 var otherCall = other.getCallMethod(); | 16210 var otherCall = other.getCallMethod(); |
| 16216 if ($notnull_bool($ne(call, null) && $ne(otherCall, null))) { | 16211 if ($notnull_bool($ne(call, null) && $ne(otherCall, null))) { |
| 16217 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth
erCall && otherCall.is$MethodMember())); | 16212 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth
erCall && otherCall.is$MethodMember())); |
| 16218 } | 16213 } |
| 16219 if ($notnull_bool($eq(this.get$genericType(), other.get$genericType()) && $ne(
this.get$typeArgsInOrder(), null) && $ne(other.get$typeArgsInOrder(), null) && t
his.get$typeArgsInOrder().length == other.get$typeArgsInOrder().length)) { | 16214 if ($notnull_bool($eq(this.get$genericType(), other.get$genericType()) && $ne(
this.get$typeArgsInOrder(), null) && $ne(other.get$typeArgsInOrder(), null) && t
his.get$typeArgsInOrder().length == other.get$typeArgsInOrder().length)) { |
| 16220 var t = this.get$typeArgsInOrder().iterator(); | 16215 var t = this.get$typeArgsInOrder().iterator(); |
| 16221 var s = other.get$typeArgsInOrder().iterator(); | 16216 var s = other.get$typeArgsInOrder().iterator(); |
| 16222 while ($notnull_bool(t.hasNext())) { | 16217 while ($notnull_bool(t.hasNext())) { |
| 16223 if ($notnull_bool(!t.next().isSubtypeOf(s.next()))) return false; | 16218 if ($notnull_bool(!$notnull_bool(t.next().isSubtypeOf(s.next())))) return
false; |
| 16224 } | 16219 } |
| 16225 return true; | 16220 return true; |
| 16226 } | 16221 } |
| 16227 if ($notnull_bool(this.get$parent() != null && this.get$parent().isSubtypeOf(o
ther))) { | 16222 if ($notnull_bool(this.get$parent() != null && this.get$parent().isSubtypeOf(o
ther))) { |
| 16228 return true; | 16223 return true; |
| 16229 } | 16224 } |
| 16230 if ($notnull_bool(this.get$interfaces() != null && this.get$interfaces().some(
(function (i) { | 16225 if ($notnull_bool(this.get$interfaces() != null && this.get$interfaces().some(
(function (i) { |
| 16231 return i.isSubtypeOf(other); | 16226 return i.isSubtypeOf(other); |
| 16232 }) | 16227 }) |
| 16233 ))) { | 16228 ))) { |
| 16234 return true; | 16229 return true; |
| 16235 } | 16230 } |
| 16236 return false; | 16231 return false; |
| 16237 } | 16232 } |
| 16238 lang_Type._isFunctionSubtypeOf = function(t, s) { | 16233 lang_Type._isFunctionSubtypeOf = function(t, s) { |
| 16239 var $0; | 16234 var $0; |
| 16240 if ($notnull_bool(!s.returnType.get$isVoid() && !s.returnType.isAssignable(t.r
eturnType))) { | 16235 if ($notnull_bool(!$notnull_bool(s.returnType.get$isVoid()) && !$notnull_bool(
s.returnType.isAssignable(t.returnType)))) { |
| 16241 return false; | 16236 return false; |
| 16242 } | 16237 } |
| 16243 var tp = t.parameters; | 16238 var tp = t.parameters; |
| 16244 var sp = s.parameters; | 16239 var sp = s.parameters; |
| 16245 if ($notnull_bool(tp.length < sp.length)) return false; | 16240 if ($notnull_bool(tp.length < sp.length)) return false; |
| 16246 for (var i = 0; | 16241 for (var i = 0; |
| 16247 $notnull_bool(i < sp.length); i++) { | 16242 $notnull_bool(i < sp.length); i++) { |
| 16248 if ($notnull_bool($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOpti
onal()))) return false; | 16243 if ($notnull_bool($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOpti
onal()))) return false; |
| 16249 if ($notnull_bool(tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name
(), sp.$index(i).get$name()))) return false; | 16244 if ($notnull_bool(tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name
(), sp.$index(i).get$name()))) return false; |
| 16250 if ($notnull_bool(!tp.$index(i).type.isAssignable((($0 = sp.$index(i).type)
&& $0.is$lang_Type())))) return false; | 16245 if ($notnull_bool(!$notnull_bool(tp.$index(i).type.isAssignable((($0 = sp.$i
ndex(i).type) && $0.is$lang_Type()))))) return false; |
| 16251 } | 16246 } |
| 16252 if ($notnull_bool(tp.length > sp.length && !tp.$index(sp.length).get$isOptiona
l())) return false; | 16247 if ($notnull_bool(tp.length > sp.length && !$notnull_bool(tp.$index(sp.length)
.get$isOptional()))) return false; |
| 16253 return true; | 16248 return true; |
| 16254 } | 16249 } |
| 16255 // ********** Code for ParameterType ************** | 16250 // ********** Code for ParameterType ************** |
| 16256 function ParameterType(name0, typeParameter) { | 16251 function ParameterType(name0, typeParameter) { |
| 16257 this.typeParameter = typeParameter; | 16252 this.typeParameter = typeParameter; |
| 16258 lang_Type.call(this, name0); | 16253 lang_Type.call(this, name0); |
| 16259 // Initializers done | 16254 // Initializers done |
| 16260 } | 16255 } |
| 16261 $inherits(ParameterType, lang_Type); | 16256 $inherits(ParameterType, lang_Type); |
| 16262 ParameterType.prototype.get$isClass = function() { | 16257 ParameterType.prototype.get$isClass = function() { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16330 ConcreteType.prototype.resolveTypeParams = function(inType) { | 16325 ConcreteType.prototype.resolveTypeParams = function(inType) { |
| 16331 var newTypeArgs = []; | 16326 var newTypeArgs = []; |
| 16332 var needsNewType = false; | 16327 var needsNewType = false; |
| 16333 var $list = this.typeArgsInOrder; | 16328 var $list = this.typeArgsInOrder; |
| 16334 for (var $i = 0;$i < $list.length; $i++) { | 16329 for (var $i = 0;$i < $list.length; $i++) { |
| 16335 var t = $list.$index($i); | 16330 var t = $list.$index($i); |
| 16336 var newType = t.resolveTypeParams(inType); | 16331 var newType = t.resolveTypeParams(inType); |
| 16337 if ($notnull_bool($ne(newType, t))) needsNewType = true; | 16332 if ($notnull_bool($ne(newType, t))) needsNewType = true; |
| 16338 newTypeArgs.add(newType); | 16333 newTypeArgs.add(newType); |
| 16339 } | 16334 } |
| 16340 if ($notnull_bool(!needsNewType)) return this; | 16335 if ($notnull_bool(!$notnull_bool(needsNewType))) return this; |
| 16341 return this.genericType.getOrMakeConcreteType(newTypeArgs); | 16336 return this.genericType.getOrMakeConcreteType(newTypeArgs); |
| 16342 } | 16337 } |
| 16343 ConcreteType.prototype.getOrMakeConcreteType = function(typeArgs) { | 16338 ConcreteType.prototype.getOrMakeConcreteType = function(typeArgs) { |
| 16344 return this.genericType.getOrMakeConcreteType(typeArgs); | 16339 return this.genericType.getOrMakeConcreteType(typeArgs); |
| 16345 } | 16340 } |
| 16346 ConcreteType.prototype.get$parent = function() { | 16341 ConcreteType.prototype.get$parent = function() { |
| 16347 return this.genericType.get$parent(); | 16342 return this.genericType.get$parent(); |
| 16348 } | 16343 } |
| 16349 ConcreteType.prototype.get$interfaces = function() { | 16344 ConcreteType.prototype.get$interfaces = function() { |
| 16350 if ($notnull_bool(this._interfaces == null && this.genericType.get$interfaces(
) != null)) { | 16345 if ($notnull_bool(this._interfaces == null && this.genericType.get$interfaces(
) != null)) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16383 return this.genericType.getFactory(type, constructorName); | 16378 return this.genericType.getFactory(type, constructorName); |
| 16384 } | 16379 } |
| 16385 ConcreteType.prototype.getConstructor = function(constructorName) { | 16380 ConcreteType.prototype.getConstructor = function(constructorName) { |
| 16386 var ret = this.constructors.$index(constructorName); | 16381 var ret = this.constructors.$index(constructorName); |
| 16387 if ($notnull_bool($ne(ret, null))) return ret; | 16382 if ($notnull_bool($ne(ret, null))) return ret; |
| 16388 ret = this.factories.getFactory(this.name, constructorName); | 16383 ret = this.factories.getFactory(this.name, constructorName); |
| 16389 if ($notnull_bool($ne(ret, null))) return ret; | 16384 if ($notnull_bool($ne(ret, null))) return ret; |
| 16390 var genericMember = this.genericType.getConstructor(constructorName); | 16385 var genericMember = this.genericType.getConstructor(constructorName); |
| 16391 if ($notnull_bool(genericMember == null)) return null; | 16386 if ($notnull_bool(genericMember == null)) return null; |
| 16392 if ($notnull_bool($ne(genericMember.declaringType, this.genericType))) { | 16387 if ($notnull_bool($ne(genericMember.declaringType, this.genericType))) { |
| 16393 if ($notnull_bool(!genericMember.declaringType.get$isGeneric())) return gene
ricMember; | 16388 if ($notnull_bool(!$notnull_bool(genericMember.declaringType.get$isGeneric()
))) return genericMember; |
| 16394 var newDeclaringType = genericMember.declaringType.getOrMakeConcreteType(thi
s.typeArgsInOrder); | 16389 var newDeclaringType = genericMember.declaringType.getOrMakeConcreteType(thi
s.typeArgsInOrder); |
| 16395 return newDeclaringType.getConstructor(constructorName); | 16390 return newDeclaringType.getConstructor(constructorName); |
| 16396 } | 16391 } |
| 16397 if ($notnull_bool(genericMember.get$isFactory())) { | 16392 if ($notnull_bool(genericMember.get$isFactory())) { |
| 16398 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gen
ericMember); | 16393 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gen
ericMember); |
| 16399 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member(
))); | 16394 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member(
))); |
| 16400 } | 16395 } |
| 16401 else { | 16396 else { |
| 16402 ret = new ConcreteMember(this.name, this, genericMember); | 16397 ret = new ConcreteMember(this.name, this, genericMember); |
| 16403 this.constructors.$setindex(constructorName, ret); | 16398 this.constructors.$setindex(constructorName, ret); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16513 DefinedType.prototype.get$isList = function() { | 16508 DefinedType.prototype.get$isList = function() { |
| 16514 return this.library.get$isCore() && this.name == 'List'; | 16509 return this.library.get$isCore() && this.name == 'List'; |
| 16515 } | 16510 } |
| 16516 DefinedType.prototype.get$isGeneric = function() { | 16511 DefinedType.prototype.get$isGeneric = function() { |
| 16517 return this.typeParameters != null; | 16512 return this.typeParameters != null; |
| 16518 } | 16513 } |
| 16519 DefinedType.prototype.get$span = function() { | 16514 DefinedType.prototype.get$span = function() { |
| 16520 return $notnull_bool(this.definition == null) ? null : this.definition.span; | 16515 return $notnull_bool(this.definition == null) ? null : this.definition.span; |
| 16521 } | 16516 } |
| 16522 DefinedType.prototype.get$typeofName = function() { | 16517 DefinedType.prototype.get$typeofName = function() { |
| 16523 if ($notnull_bool(!this.library.get$isCore())) return null; | 16518 if ($notnull_bool(!$notnull_bool(this.library.get$isCore()))) return null; |
| 16524 if ($notnull_bool(this.get$isBool())) return 'boolean'; | 16519 if ($notnull_bool(this.get$isBool())) return 'boolean'; |
| 16525 else if ($notnull_bool(this.get$isNum())) return 'number'; | 16520 else if ($notnull_bool(this.get$isNum())) return 'number'; |
| 16526 else if ($notnull_bool(this.get$isString())) return 'string'; | 16521 else if ($notnull_bool(this.get$isString())) return 'string'; |
| 16527 else if ($notnull_bool(this.get$isFunction())) return 'function'; | 16522 else if ($notnull_bool(this.get$isFunction())) return 'function'; |
| 16528 else return null; | 16523 else return null; |
| 16529 } | 16524 } |
| 16530 DefinedType.prototype.get$isNum = function() { | 16525 DefinedType.prototype.get$isNum = function() { |
| 16531 return this.library != null && this.library.get$isCore() && (this.name == 'num
' || this.name == 'int' || this.name == 'double'); | 16526 return this.library != null && this.library.get$isCore() && (this.name == 'num
' || this.name == 'int' || this.name == 'double'); |
| 16532 } | 16527 } |
| 16533 DefinedType.prototype.getCallMethod = function() { | 16528 DefinedType.prototype.getCallMethod = function() { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 16557 if ($notnull_bool(this._lazyGenMethods == null)) this._lazyGenMethods = $map
([]); | 16552 if ($notnull_bool(this._lazyGenMethods == null)) this._lazyGenMethods = $map
([]); |
| 16558 this._lazyGenMethods.$setindex(method.name, method); | 16553 this._lazyGenMethods.$setindex(method.name, method); |
| 16559 } | 16554 } |
| 16560 } | 16555 } |
| 16561 DefinedType.prototype._resolveInterfaces = function(types) { | 16556 DefinedType.prototype._resolveInterfaces = function(types) { |
| 16562 if ($notnull_bool(types == null)) return []; | 16557 if ($notnull_bool(types == null)) return []; |
| 16563 var interfaces0 = []; | 16558 var interfaces0 = []; |
| 16564 for (var $i = 0;$i < types.length; $i++) { | 16559 for (var $i = 0;$i < types.length; $i++) { |
| 16565 var type = types.$index($i); | 16560 var type = types.$index($i); |
| 16566 var resolvedInterface = this.resolveType((type && type.is$TypeReference()),
true); | 16561 var resolvedInterface = this.resolveType((type && type.is$TypeReference()),
true); |
| 16567 if ($notnull_bool(resolvedInterface.get$isClosed() && !(this.library.get$isC
ore() || this.library.get$isCoreImpl()))) { | 16562 if ($notnull_bool(resolvedInterface.get$isClosed() && !$notnull_bool((this.l
ibrary.get$isCore() || this.library.get$isCoreImpl())))) { |
| 16568 world.error(('can not implement "' + resolvedInterface.get$name() + '": ')
+ 'only native implementation allowed', type.get$span()); | 16563 world.error(('can not implement "' + resolvedInterface.get$name() + '": ')
+ 'only native implementation allowed', type.get$span()); |
| 16569 } | 16564 } |
| 16570 resolvedInterface.addDirectSubtype(this); | 16565 resolvedInterface.addDirectSubtype(this); |
| 16571 interfaces0.add(resolvedInterface); | 16566 interfaces0.add(resolvedInterface); |
| 16572 } | 16567 } |
| 16573 return interfaces0; | 16568 return interfaces0; |
| 16574 } | 16569 } |
| 16575 DefinedType.prototype.addDirectSubtype = function(type) { | 16570 DefinedType.prototype.addDirectSubtype = function(type) { |
| 16576 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 657, 12); | 16571 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 657, 12); |
| 16577 this.directSubtypes.add(type); | 16572 this.directSubtypes.add(type); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16639 if ($notnull_bool(this.definition.extendsTypes != null && this.definition.
extendsTypes.length > 0)) { | 16634 if ($notnull_bool(this.definition.extendsTypes != null && this.definition.
extendsTypes.length > 0)) { |
| 16640 if ($notnull_bool(this.definition.extendsTypes.length > 1)) { | 16635 if ($notnull_bool(this.definition.extendsTypes.length > 1)) { |
| 16641 world.error('more than one base class', this.definition.extendsTypes.$
index(1).get$span()); | 16636 world.error('more than one base class', this.definition.extendsTypes.$
index(1).get$span()); |
| 16642 } | 16637 } |
| 16643 var extendsTypeRef = this.definition.extendsTypes.$index(0); | 16638 var extendsTypeRef = this.definition.extendsTypes.$index(0); |
| 16644 if ($notnull_bool((extendsTypeRef instanceof GenericTypeReference))) { | 16639 if ($notnull_bool((extendsTypeRef instanceof GenericTypeReference))) { |
| 16645 var g = extendsTypeRef; | 16640 var g = extendsTypeRef; |
| 16646 this.parent = this.resolveType(g.baseType, true); | 16641 this.parent = this.resolveType(g.baseType, true); |
| 16647 } | 16642 } |
| 16648 this.parent = this.resolveType((extendsTypeRef && extendsTypeRef.is$Type
Reference()), true); | 16643 this.parent = this.resolveType((extendsTypeRef && extendsTypeRef.is$Type
Reference()), true); |
| 16649 if ($notnull_bool(!this.parent.get$isClass())) { | 16644 if ($notnull_bool(!$notnull_bool(this.parent.get$isClass()))) { |
| 16650 world.error('class may not extend an interface - use implements', this
.definition.extendsTypes.$index(0).get$span()); | 16645 world.error('class may not extend an interface - use implements', this
.definition.extendsTypes.$index(0).get$span()); |
| 16651 } | 16646 } |
| 16652 this.parent.addDirectSubtype(this); | 16647 this.parent.addDirectSubtype(this); |
| 16653 if ($notnull_bool(this._cycleInClassExtends())) { | 16648 if ($notnull_bool(this._cycleInClassExtends())) { |
| 16654 world.error(('class "' + this.name + '" has a cycle in its inheritance
chain'), extendsTypeRef.get$span()); | 16649 world.error(('class "' + this.name + '" has a cycle in its inheritance
chain'), extendsTypeRef.get$span()); |
| 16655 } | 16650 } |
| 16656 } | 16651 } |
| 16657 else { | 16652 else { |
| 16658 if ($notnull_bool(!this.get$isObject())) { | 16653 if ($notnull_bool(!$notnull_bool(this.get$isObject()))) { |
| 16659 this.parent = world.objectType; | 16654 this.parent = world.objectType; |
| 16660 } | 16655 } |
| 16661 } | 16656 } |
| 16662 this.interfaces = this._resolveInterfaces(this.definition.implementsTypes)
; | 16657 this.interfaces = this._resolveInterfaces(this.definition.implementsTypes)
; |
| 16663 if ($notnull_bool(this.definition.factoryType != null)) { | 16658 if ($notnull_bool(this.definition.factoryType != null)) { |
| 16664 world.error('factory not allowed on classes', this.definition.factoryTyp
e.span); | 16659 world.error('factory not allowed on classes', this.definition.factoryTyp
e.span); |
| 16665 } | 16660 } |
| 16666 } | 16661 } |
| 16667 else { | 16662 else { |
| 16668 if ($notnull_bool(this.definition.implementsTypes != null && this.definiti
on.implementsTypes.length > 0)) { | 16663 if ($notnull_bool(this.definition.implementsTypes != null && this.definiti
on.implementsTypes.length > 0)) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16814 this.constructors.$index('').resolve(this); | 16809 this.constructors.$index('').resolve(this); |
| 16815 return this.constructors.$index(''); | 16810 return this.constructors.$index(''); |
| 16816 } | 16811 } |
| 16817 return null; | 16812 return null; |
| 16818 } | 16813 } |
| 16819 DefinedType.prototype.getMember = function(memberName) { | 16814 DefinedType.prototype.getMember = function(memberName) { |
| 16820 var member = this.members.$index(memberName); | 16815 var member = this.members.$index(memberName); |
| 16821 if ($notnull_bool(member != null)) { | 16816 if ($notnull_bool(member != null)) { |
| 16822 var parentMember = this.getMemberInParents(memberName); | 16817 var parentMember = this.getMemberInParents(memberName); |
| 16823 if ($notnull_bool($ne(parentMember, null))) { | 16818 if ($notnull_bool($ne(parentMember, null))) { |
| 16824 if ($notnull_bool(!member.get$isPrivate() || $eq(member.get$library(), par
entMember.get$library()))) { | 16819 if ($notnull_bool(!$notnull_bool(member.get$isPrivate()) || $eq(member.get
$library(), parentMember.get$library()))) { |
| 16825 member.override(parentMember); | 16820 member.override(parentMember); |
| 16826 } | 16821 } |
| 16827 } | 16822 } |
| 16828 return member; | 16823 return member; |
| 16829 } | 16824 } |
| 16830 if ($notnull_bool(this.get$isTop())) { | 16825 if ($notnull_bool(this.get$isTop())) { |
| 16831 var libType = this.library.findTypeByName(memberName); | 16826 var libType = this.library.findTypeByName(memberName); |
| 16832 if ($notnull_bool($ne(libType, null))) { | 16827 if ($notnull_bool($ne(libType, null))) { |
| 16833 return libType.get$typeMember(); | 16828 return libType.get$typeMember(); |
| 16834 } | 16829 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16877 ret = new MemberSet(member); | 16872 ret = new MemberSet(member); |
| 16878 this._resolvedMembers.$setindex(memberName, ret); | 16873 this._resolvedMembers.$setindex(memberName, ret); |
| 16879 if ($notnull_bool(member.get$isStatic())) { | 16874 if ($notnull_bool(member.get$isStatic())) { |
| 16880 return ret; | 16875 return ret; |
| 16881 } | 16876 } |
| 16882 else { | 16877 else { |
| 16883 var $list = this.get$subtypes(); | 16878 var $list = this.get$subtypes(); |
| 16884 for (var $i = this.get$subtypes().iterator(); $i.hasNext(); ) { | 16879 for (var $i = this.get$subtypes().iterator(); $i.hasNext(); ) { |
| 16885 var t = $i.next(); | 16880 var t = $i.next(); |
| 16886 var m; | 16881 var m; |
| 16887 if ($notnull_bool(!this.isClass && t.get$isClass())) { | 16882 if ($notnull_bool(!$notnull_bool(this.isClass) && t.get$isClass())) { |
| 16888 m = t.getMember(memberName); | 16883 m = t.getMember(memberName); |
| 16889 } | 16884 } |
| 16890 else { | 16885 else { |
| 16891 m = t.members.$index(memberName); | 16886 m = t.members.$index(memberName); |
| 16892 } | 16887 } |
| 16893 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member())); | 16888 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member())); |
| 16894 } | 16889 } |
| 16895 return ret; | 16890 return ret; |
| 16896 } | 16891 } |
| 16897 } | 16892 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16951 node.type = world.objectType; | 16946 node.type = world.objectType; |
| 16952 } | 16947 } |
| 16953 else { | 16948 else { |
| 16954 world.warning($assert_String(message), node.span); | 16949 world.warning($assert_String(message), node.span); |
| 16955 node.type = world.varType; | 16950 node.type = world.varType; |
| 16956 } | 16951 } |
| 16957 } | 16952 } |
| 16958 } | 16953 } |
| 16959 else if ($notnull_bool((node instanceof GenericTypeReference))) { | 16954 else if ($notnull_bool((node instanceof GenericTypeReference))) { |
| 16960 var baseType = this.resolveType(node.baseType, typeErrors); | 16955 var baseType = this.resolveType(node.baseType, typeErrors); |
| 16961 if ($notnull_bool(!baseType.get$isGeneric())) { | 16956 if ($notnull_bool(!$notnull_bool(baseType.get$isGeneric()))) { |
| 16962 world.error(('' + baseType.get$name() + ' is not generic'), node.span); | 16957 world.error(('' + baseType.get$name() + ' is not generic'), node.span); |
| 16963 return null; | 16958 return null; |
| 16964 } | 16959 } |
| 16965 if ($notnull_bool(node.typeArguments.length != baseType.get$typeParameters()
.length)) { | 16960 if ($notnull_bool(node.typeArguments.length != baseType.get$typeParameters()
.length)) { |
| 16966 world.error('wrong number of type arguments', node.span); | 16961 world.error('wrong number of type arguments', node.span); |
| 16967 return null; | 16962 return null; |
| 16968 } | 16963 } |
| 16969 var typeArgs = []; | 16964 var typeArgs = []; |
| 16970 for (var i = 0; | 16965 for (var i = 0; |
| 16971 $notnull_bool(i < node.typeArguments.length); i++) { | 16966 $notnull_bool(i < node.typeArguments.length); i++) { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17141 return true; | 17136 return true; |
| 17142 } | 17137 } |
| 17143 if ($notnull_bool(this.type.get$isVarOrFunction() && name == '\$call')) { | 17138 if ($notnull_bool(this.type.get$isVarOrFunction() && name == '\$call')) { |
| 17144 return true; | 17139 return true; |
| 17145 } | 17140 } |
| 17146 var member = this._tryResolveMember(context, name); | 17141 var member = this._tryResolveMember(context, name); |
| 17147 return $ne(member, null) && member.canInvoke(context, args); | 17142 return $ne(member, null) && member.canInvoke(context, args); |
| 17148 } | 17143 } |
| 17149 Value.prototype._tryResolveMember = function(context, name) { | 17144 Value.prototype._tryResolveMember = function(context, name) { |
| 17150 var member = null; | 17145 var member = null; |
| 17151 if ($notnull_bool(!this.type.get$isVar())) { | 17146 if ($notnull_bool(!$notnull_bool(this.type.get$isVar()))) { |
| 17152 if ($notnull_bool(this.isSuper)) { | 17147 if ($notnull_bool(this.isSuper)) { |
| 17153 return this.type.getMember(name); | 17148 return this.type.getMember(name); |
| 17154 } | 17149 } |
| 17155 else { | 17150 else { |
| 17156 member = this.type.resolveMember(name); | 17151 member = this.type.resolveMember(name); |
| 17157 } | 17152 } |
| 17158 } | 17153 } |
| 17159 if ($notnull_bool(member == null)) { | 17154 if ($notnull_bool(member == null)) { |
| 17160 member = context.findMembers(name); | 17155 member = context.findMembers(name); |
| 17161 } | 17156 } |
| 17162 return member; | 17157 return member; |
| 17163 } | 17158 } |
| 17164 Value.prototype._resolveMember = function(context, name, node) { | 17159 Value.prototype._resolveMember = function(context, name, node) { |
| 17165 var member = this._tryResolveMember(context, name); | 17160 var member = this._tryResolveMember(context, name); |
| 17166 if ($notnull_bool($ne(member, null))) { | 17161 if ($notnull_bool($ne(member, null))) { |
| 17167 if ($notnull_bool(this.isType && !member.get$isStatic())) { | 17162 if ($notnull_bool(this.isType && !$notnull_bool(member.get$isStatic()))) { |
| 17168 world.error('can not refer to instance member as static', node.span); | 17163 world.error('can not refer to instance member as static', node.span); |
| 17169 } | 17164 } |
| 17170 return member; | 17165 return member; |
| 17171 } | 17166 } |
| 17172 else { | 17167 else { |
| 17173 if ($notnull_bool(this._tryResolveMember(context, 'noSuchMethod').members.le
ngth > 1)) { | 17168 if ($notnull_bool(this._tryResolveMember(context, 'noSuchMethod').members.le
ngth > 1)) { |
| 17174 return null; | 17169 return null; |
| 17175 } | 17170 } |
| 17176 var typeName = $notnull_bool(this.type.name == null) ? this.type.get$library
().name : this.type.name; | 17171 var typeName = $notnull_bool(this.type.name == null) ? this.type.get$library
().name : this.type.name; |
| 17177 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); | 17172 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17209 var fromType = this.type; | 17204 var fromType = this.type; |
| 17210 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { | 17205 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { |
| 17211 fromType = world.objectType; | 17206 fromType = world.objectType; |
| 17212 } | 17207 } |
| 17213 var bothNum = this.type.get$isNum() && toType.get$isNum(); | 17208 var bothNum = this.type.get$isNum() && toType.get$isNum(); |
| 17214 return fromType.isSubtypeOf(toType) || bothNum; | 17209 return fromType.isSubtypeOf(toType) || bothNum; |
| 17215 } | 17210 } |
| 17216 return false; | 17211 return false; |
| 17217 } | 17212 } |
| 17218 Value.prototype.convertTo = function(context, toType, node, isDynamic) { | 17213 Value.prototype.convertTo = function(context, toType, node, isDynamic) { |
| 17219 var checked = !isDynamic; | 17214 var checked = !$notnull_bool(isDynamic); |
| 17220 var callMethod = toType.getCallMethod(); | 17215 var callMethod = toType.getCallMethod(); |
| 17221 if ($notnull_bool($ne(callMethod, null))) { | 17216 if ($notnull_bool($ne(callMethod, null))) { |
| 17222 if ($notnull_bool(checked && !toType.isAssignable(this.type))) { | 17217 if ($notnull_bool(checked && !$notnull_bool(toType.isAssignable(this.type)))
) { |
| 17223 this.convertWarning(toType, node); | 17218 this.convertWarning(toType, node); |
| 17224 } | 17219 } |
| 17225 var arity = callMethod.get$parameters().length; | 17220 var arity = callMethod.get$parameters().length; |
| 17226 var myCall = this.type.getCallMethod(); | 17221 var myCall = this.type.getCallMethod(); |
| 17227 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity)
) { | 17222 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity)
) { |
| 17228 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory
(arity)); | 17223 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory
(arity)); |
| 17229 return new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), fal
se, true, false); | 17224 return new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), fal
se, true, false); |
| 17230 } | 17225 } |
| 17231 } | 17226 } |
| 17232 if ($notnull_bool(!options.enableTypeChecks)) { | 17227 if ($notnull_bool(!$notnull_bool(options.enableTypeChecks))) { |
| 17233 return this; | 17228 return this; |
| 17234 } | 17229 } |
| 17235 var fromType = this.type; | 17230 var fromType = this.type; |
| 17236 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { | 17231 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { |
| 17237 fromType = world.objectType; | 17232 fromType = world.objectType; |
| 17238 } | 17233 } |
| 17239 var bothNum = this.type.get$isNum() && toType.get$isNum(); | 17234 var bothNum = this.type.get$isNum() && toType.get$isNum(); |
| 17240 if ($notnull_bool(!checked || fromType.isSubtypeOf(toType) || bothNum)) { | 17235 if ($notnull_bool(!$notnull_bool(checked) || fromType.isSubtypeOf(toType) || b
othNum)) { |
| 17241 return this; | 17236 return this; |
| 17242 } | 17237 } |
| 17243 if ($notnull_bool(!toType.isSubtypeOf(this.type))) { | 17238 if ($notnull_bool(!$notnull_bool(toType.isSubtypeOf(this.type)))) { |
| 17244 this.convertWarning(toType, node); | 17239 this.convertWarning(toType, node); |
| 17245 } | 17240 } |
| 17246 return this._typeAssert(context, toType, node); | 17241 return this._typeAssert(context, toType, node); |
| 17247 } | 17242 } |
| 17248 Value.prototype.convertToNonNullBool = function(context, node) { | 17243 Value.prototype.convertToNonNullBool = function(context, node) { |
| 17249 if ($notnull_bool(!this.type.isAssignable(world.boolType))) { | 17244 if ($notnull_bool(!$notnull_bool(this.type.isAssignable(world.boolType)))) { |
| 17250 this.convertWarning(world.boolType, node); | 17245 this.convertWarning(world.boolType, node); |
| 17251 } | 17246 } |
| 17252 if ($notnull_bool(!options.enableTypeChecks)) { | 17247 if ($notnull_bool(!$notnull_bool(options.enableTypeChecks))) { |
| 17253 return this; | 17248 return this; |
| 17254 } | 17249 } |
| 17255 else { | 17250 else { |
| 17256 if ($notnull_bool(this.code.startsWith('\$notnull_bool'))) { | 17251 if ($notnull_bool(this.code.startsWith('\$notnull_bool'))) { |
| 17257 return this; | 17252 return this; |
| 17258 } | 17253 } |
| 17259 else { | 17254 else { |
| 17260 return new Value(world.boolType, ('\$notnull_bool(' + this.code + ')'), fa
lse, true, false); | 17255 return new Value(world.boolType, ('\$notnull_bool(' + this.code + ')'), fa
lse, true, false); |
| 17261 } | 17256 } |
| 17262 } | 17257 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17297 var testCode = null; | 17292 var testCode = null; |
| 17298 if ($notnull_bool(toType.get$library().get$isCore())) { | 17293 if ($notnull_bool(toType.get$library().get$isCore())) { |
| 17299 var typeofName = toType.get$typeofName(); | 17294 var typeofName = toType.get$typeofName(); |
| 17300 if ($notnull_bool($ne(typeofName, null))) { | 17295 if ($notnull_bool($ne(typeofName, null))) { |
| 17301 testCode = ("(typeof(" + this.code + ") " + ($notnull_bool(isTrue) ? '=='
: '!=') + " '" + typeofName + "')"); | 17296 testCode = ("(typeof(" + this.code + ") " + ($notnull_bool(isTrue) ? '=='
: '!=') + " '" + typeofName + "')"); |
| 17302 } | 17297 } |
| 17303 } | 17298 } |
| 17304 if ($notnull_bool(toType.get$isClass() && !(toType instanceof ConcreteType)))
{ | 17299 if ($notnull_bool(toType.get$isClass() && !(toType instanceof ConcreteType)))
{ |
| 17305 toType.markUsed(); | 17300 toType.markUsed(); |
| 17306 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); | 17301 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); |
| 17307 if ($notnull_bool(!isTrue)) { | 17302 if ($notnull_bool(!$notnull_bool(isTrue))) { |
| 17308 testCode = '!' + testCode; | 17303 testCode = '!' + testCode; |
| 17309 } | 17304 } |
| 17310 } | 17305 } |
| 17311 if ($notnull_bool(testCode == null)) { | 17306 if ($notnull_bool(testCode == null)) { |
| 17312 toType.isTested = true; | 17307 toType.isTested = true; |
| 17313 var temp = context.getTemp(this); | 17308 var temp = context.getTemp(this); |
| 17314 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code +
' &&'); | 17309 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code +
' &&'); |
| 17315 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')'
); | 17310 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')'
); |
| 17316 if ($notnull_bool(isTrue)) { | 17311 if ($notnull_bool(isTrue)) { |
| 17317 testCode = '!!' + testCode; | 17312 testCode = '!!' + testCode; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 17334 $notnull_bool(i < args.get$length()); i++) { | 17329 $notnull_bool(i < args.get$length()); i++) { |
| 17335 argsCode.add(args.values.$index(i).code); | 17330 argsCode.add(args.values.$index(i).code); |
| 17336 } | 17331 } |
| 17337 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); | 17332 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); |
| 17338 } | 17333 } |
| 17339 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), false, true,
false), new Value(world.listType, ('[' + pos + ']'), false, true, false)]; | 17334 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), false, true,
false), new Value(world.listType, ('[' + pos + ']'), false, true, false)]; |
| 17340 return this._tryResolveMember(context, 'noSuchMethod').invoke$4(context, node,
this, new Arguments(null, noSuchArgs)); | 17335 return this._tryResolveMember(context, 'noSuchMethod').invoke$4(context, node,
this, new Arguments(null, noSuchArgs)); |
| 17341 } | 17336 } |
| 17342 Value.prototype.invokeSpecial = function(name, args, returnType) { | 17337 Value.prototype.invokeSpecial = function(name, args, returnType) { |
| 17343 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 417, 12
); | 17338 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 417, 12
); |
| 17344 $assert(!args.get$hasNames(), "!args.hasNames", "value.dart", 418, 12); | 17339 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4
18, 12); |
| 17345 var argsString = args.getCode(); | 17340 var argsString = args.getCode(); |
| 17346 if ($notnull_bool(name == '\$index' || name == '\$setindex')) { | 17341 if ($notnull_bool(name == '\$index' || name == '\$setindex')) { |
| 17347 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString
+ ')'), false, true, false); | 17342 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString
+ ')'), false, true, false); |
| 17348 } | 17343 } |
| 17349 else { | 17344 else { |
| 17350 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString +
''); | 17345 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString +
''); |
| 17351 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString
+ ')'), false, true, false); | 17346 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString
+ ')'), false, true, false); |
| 17352 } | 17347 } |
| 17353 } | 17348 } |
| 17354 Value.prototype.get_$3 = function($0, $1, $2) { | 17349 Value.prototype.get_$3 = function($0, $1, $2) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17439 return new ConstObjectValue._internal$ctor(type0, fields0, actualValue0, canon
icalCode0, original0, EvaluatedValue.codeWithComments(canonicalCode0, original0)
); | 17434 return new ConstObjectValue._internal$ctor(type0, fields0, actualValue0, canon
icalCode0, original0, EvaluatedValue.codeWithComments(canonicalCode0, original0)
); |
| 17440 } | 17435 } |
| 17441 // ********** Code for GlobalValue ************** | 17436 // ********** Code for GlobalValue ************** |
| 17442 function GlobalValue(type0, code0, isConst0, field, name, exp, canonicalCode, or
iginal, dependencies) { | 17437 function GlobalValue(type0, code0, isConst0, field, name, exp, canonicalCode, or
iginal, dependencies) { |
| 17443 this.field = field; | 17438 this.field = field; |
| 17444 this.name = name; | 17439 this.name = name; |
| 17445 this.exp = exp; | 17440 this.exp = exp; |
| 17446 this.canonicalCode = canonicalCode; | 17441 this.canonicalCode = canonicalCode; |
| 17447 this.original = original; | 17442 this.original = original; |
| 17448 this.dependencies = dependencies; | 17443 this.dependencies = dependencies; |
| 17449 Value.call(this, type0, code0, false, !isConst0, false); | 17444 Value.call(this, type0, code0, false, !$notnull_bool(isConst0), false); |
| 17450 // Initializers done | 17445 // Initializers done |
| 17451 } | 17446 } |
| 17452 $inherits(GlobalValue, Value); | 17447 $inherits(GlobalValue, Value); |
| 17453 GlobalValue.GlobalValue$fromStatic$factory = function(field0, exp0, dependencies
0) { | 17448 GlobalValue.GlobalValue$fromStatic$factory = function(field0, exp0, dependencies
0) { |
| 17454 var code0 = ($notnull_bool(exp0.get$isConst()) ? exp0.canonicalCode : exp0.cod
e); | 17449 var code0 = ($notnull_bool(exp0.get$isConst()) ? exp0.canonicalCode : exp0.cod
e); |
| 17455 var codeWithComment = ('' + code0 + '/*' + field0.declaringType.name + '.' + f
ield0.get$name() + '*/'); | 17450 var codeWithComment = ('' + code0 + '/*' + field0.declaringType.name + '.' + f
ield0.get$name() + '*/'); |
| 17456 return new GlobalValue(exp0.type, codeWithComment, field0.isFinal, field0, nul
l, exp0, code0, null, dependencies0.filter((function (d) { | 17451 return new GlobalValue(exp0.type, codeWithComment, field0.isFinal, field0, nul
l, exp0, code0, null, dependencies0.filter((function (d) { |
| 17457 return (d instanceof GlobalValue); | 17452 return (d instanceof GlobalValue); |
| 17458 }) | 17453 }) |
| 17459 )); | 17454 )); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17552 this.numType = (($0 = this._addToCoreLib('num', false)) && $0.is$lang_Type()); | 17547 this.numType = (($0 = this._addToCoreLib('num', false)) && $0.is$lang_Type()); |
| 17553 this.intType = (($0 = this._addToCoreLib('int', false)) && $0.is$lang_Type()); | 17548 this.intType = (($0 = this._addToCoreLib('int', false)) && $0.is$lang_Type()); |
| 17554 this.doubleType = (($0 = this._addToCoreLib('double', false)) && $0.is$lang_Ty
pe()); | 17549 this.doubleType = (($0 = this._addToCoreLib('double', false)) && $0.is$lang_Ty
pe()); |
| 17555 this.boolType = (($0 = this._addToCoreLib('bool', false)) && $0.is$lang_Type()
); | 17550 this.boolType = (($0 = this._addToCoreLib('bool', false)) && $0.is$lang_Type()
); |
| 17556 this.stringType = (($0 = this._addToCoreLib('String', false)) && $0.is$lang_Ty
pe()); | 17551 this.stringType = (($0 = this._addToCoreLib('String', false)) && $0.is$lang_Ty
pe()); |
| 17557 this.listType = (($0 = this._addToCoreLib('List', false)) && $0.is$lang_Type()
); | 17552 this.listType = (($0 = this._addToCoreLib('List', false)) && $0.is$lang_Type()
); |
| 17558 this.mapType = (($0 = this._addToCoreLib('Map', false)) && $0.is$lang_Type()); | 17553 this.mapType = (($0 = this._addToCoreLib('Map', false)) && $0.is$lang_Type()); |
| 17559 this.functionType = (($0 = this._addToCoreLib('Function', false)) && $0.is$lan
g_Type()); | 17554 this.functionType = (($0 = this._addToCoreLib('Function', false)) && $0.is$lan
g_Type()); |
| 17560 } | 17555 } |
| 17561 World.prototype._addMember = function(member) { | 17556 World.prototype._addMember = function(member) { |
| 17562 $assert(!member.get$isPrivate(), "!member.isPrivate", "world.dart", 141, 12); | 17557 $assert(!$notnull_bool(member.get$isPrivate()), "!member.isPrivate", "world.da
rt", 141, 12); |
| 17563 if ($notnull_bool(member.get$isStatic())) { | 17558 if ($notnull_bool(member.get$isStatic())) { |
| 17564 if ($notnull_bool(member.declaringType.get$isTop())) { | 17559 if ($notnull_bool(member.declaringType.get$isTop())) { |
| 17565 this._addTopName(member); | 17560 this._addTopName(member); |
| 17566 } | 17561 } |
| 17567 return; | 17562 return; |
| 17568 } | 17563 } |
| 17569 var mset = this._members.$index(member.name); | 17564 var mset = this._members.$index(member.name); |
| 17570 if ($notnull_bool(mset == null)) { | 17565 if ($notnull_bool(mset == null)) { |
| 17571 mset = new MemberSet(member); | 17566 mset = new MemberSet(member); |
| 17572 this._members.$setindex(mset.get$name(), mset); | 17567 this._members.$setindex(mset.get$name(), mset); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17607 } | 17602 } |
| 17608 World.prototype._addJavascriptTopName = function(named) { | 17603 World.prototype._addJavascriptTopName = function(named) { |
| 17609 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name
() + '')); | 17604 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name
() + '')); |
| 17610 var existing = this._topNames.$index(named.get$jsname()); | 17605 var existing = this._topNames.$index(named.get$jsname()); |
| 17611 if ($notnull_bool($ne(existing, null) && $ne(existing, named))) { | 17606 if ($notnull_bool($ne(existing, null) && $ne(existing, named))) { |
| 17612 world.internalError(('name mangling failed for "' + named.get$jsname() + '"
') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$span().get
$locationText() + ')'), named.get$span()); | 17607 world.internalError(('name mangling failed for "' + named.get$jsname() + '"
') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$span().get
$locationText() + ')'), named.get$span()); |
| 17613 } | 17608 } |
| 17614 this._topNames.$setindex(named.get$jsname(), named); | 17609 this._topNames.$setindex(named.get$jsname(), named); |
| 17615 } | 17610 } |
| 17616 World.prototype._addType = function(type) { | 17611 World.prototype._addType = function(type) { |
| 17617 if ($notnull_bool(!type.get$isTop())) this._addTopName(type); | 17612 if ($notnull_bool(!$notnull_bool(type.get$isTop()))) this._addTopName(type); |
| 17618 } | 17613 } |
| 17619 World.prototype._addToCoreLib = function(name, isClass) { | 17614 World.prototype._addToCoreLib = function(name, isClass) { |
| 17620 var ret = new DefinedType(name, this.corelib, null, isClass); | 17615 var ret = new DefinedType(name, this.corelib, null, isClass); |
| 17621 this.corelib.types.$setindex(name, ret); | 17616 this.corelib.types.$setindex(name, ret); |
| 17622 return ret; | 17617 return ret; |
| 17623 } | 17618 } |
| 17624 World.prototype.toJsIdentifier = function(name) { | 17619 World.prototype.toJsIdentifier = function(name) { |
| 17625 if ($notnull_bool(this._jsKeywords == null)) { | 17620 if ($notnull_bool(this._jsKeywords == null)) { |
| 17626 this._jsKeywords = HashSetImplementation.HashSetImplementation$from$factory(
['break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 'e
lse', 'finally', 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', '
switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', 'clas
s', 'enum', 'export', 'extends', 'import', 'super', 'implements', 'interface', '
let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'native'])
; | 17621 this._jsKeywords = HashSetImplementation.HashSetImplementation$from$factory(
['break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 'e
lse', 'finally', 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', '
switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', 'clas
s', 'enum', 'export', 'extends', 'import', 'super', 'implements', 'interface', '
let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'native'])
; |
| 17627 } | 17622 } |
| 17628 if ($notnull_bool(this._jsKeywords.contains(name))) { | 17623 if ($notnull_bool(this._jsKeywords.contains(name))) { |
| 17629 return name + '_'; | 17624 return name + '_'; |
| 17630 } | 17625 } |
| 17631 else { | 17626 else { |
| 17632 return name; | 17627 return name; |
| 17633 } | 17628 } |
| 17634 } | 17629 } |
| 17635 World.prototype.compile = function() { | 17630 World.prototype.compile = function() { |
| 17636 if ($notnull_bool(options.dartScript == null)) { | 17631 if ($notnull_bool(options.dartScript == null)) { |
| 17637 this.fatal('no script provided to compile'); | 17632 this.fatal('no script provided to compile'); |
| 17638 return false; | 17633 return false; |
| 17639 } | 17634 } |
| 17640 try { | 17635 try { |
| 17641 this.info(('compiling ' + options.dartScript + ' with corelib ' + this.corel
ib + '')); | 17636 this.info(('compiling ' + options.dartScript + ' with corelib ' + this.corel
ib + '')); |
| 17642 if ($notnull_bool(!this.runLeg())) this.runCompilationPhases(); | 17637 if ($notnull_bool(!$notnull_bool(this.runLeg()))) this.runCompilationPhases(
); |
| 17643 } catch (exc) { | 17638 } catch (exc) { |
| 17644 exc = $toDartException(exc); | 17639 exc = $toDartException(exc); |
| 17645 if ($notnull_bool(this.get$hasErrors() && !options.throwOnErrors)) { | 17640 if ($notnull_bool(this.get$hasErrors() && !$notnull_bool(options.throwOnErro
rs))) { |
| 17646 } | 17641 } |
| 17647 else { | 17642 else { |
| 17648 throw exc; | 17643 throw exc; |
| 17649 } | 17644 } |
| 17650 } | 17645 } |
| 17651 this.printStatus(); | 17646 this.printStatus(); |
| 17652 return !this.get$hasErrors(); | 17647 return !$notnull_bool(this.get$hasErrors()); |
| 17653 } | 17648 } |
| 17654 World.prototype.runLeg = function() { | 17649 World.prototype.runLeg = function() { |
| 17655 var $this = this; // closure support | 17650 var $this = this; // closure support |
| 17656 if ($notnull_bool(!options.enableLeg)) return false; | 17651 if ($notnull_bool(!$notnull_bool(options.enableLeg))) return false; |
| 17657 var res = this.withTiming('try leg compile', (function () { | 17652 var res = this.withTiming('try leg compile', (function () { |
| 17658 return compile($this); | 17653 return compile($this); |
| 17659 }) | 17654 }) |
| 17660 ); | 17655 ); |
| 17661 if ($notnull_bool(!res && options.legOnly)) { | 17656 if ($notnull_bool(!$notnull_bool(res) && options.legOnly)) { |
| 17662 this.fatal(("Leg could not compile " + options.dartScript + "")); | 17657 this.fatal(("Leg could not compile " + options.dartScript + "")); |
| 17663 } | 17658 } |
| 17664 return res; | 17659 return res; |
| 17665 } | 17660 } |
| 17666 World.prototype.runCompilationPhases = function() { | 17661 World.prototype.runCompilationPhases = function() { |
| 17667 var $this = this; // closure support | 17662 var $this = this; // closure support |
| 17668 var lib = this.withTiming('first pass', (function () { | 17663 var lib = this.withTiming('first pass', (function () { |
| 17669 return $this.processScript(options.dartScript); | 17664 return $this.processScript(options.dartScript); |
| 17670 }) | 17665 }) |
| 17671 ); | 17666 ); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17716 e = $toDartException(e); | 17711 e = $toDartException(e); |
| 17717 this.warning(('Error reading file: ' + filename + '')); | 17712 this.warning(('Error reading file: ' + filename + '')); |
| 17718 return new SourceFile(filename, ''); | 17713 return new SourceFile(filename, ''); |
| 17719 } | 17714 } |
| 17720 } | 17715 } |
| 17721 World.prototype.getOrAddLibrary = function(filename) { | 17716 World.prototype.getOrAddLibrary = function(filename) { |
| 17722 var library = this.libraries.$index(filename); | 17717 var library = this.libraries.$index(filename); |
| 17723 if ($notnull_bool(library == null)) { | 17718 if ($notnull_bool(library == null)) { |
| 17724 library = new Library(this.readFile(filename)); | 17719 library = new Library(this.readFile(filename)); |
| 17725 this.info(('read library ' + filename + '')); | 17720 this.info(('read library ' + filename + '')); |
| 17726 if ($notnull_bool(!library.get$isCore() && !library.imports.some((function (
li) { | 17721 if ($notnull_bool(!$notnull_bool(library.get$isCore()) && !$notnull_bool(lib
rary.imports.some((function (li) { |
| 17727 return li.get$library().get$isCore(); | 17722 return li.get$library().get$isCore(); |
| 17728 }) | 17723 }) |
| 17729 ))) { | 17724 )))) { |
| 17730 library.imports.add(new LibraryImport(this.corelib)); | 17725 library.imports.add(new LibraryImport(this.corelib)); |
| 17731 } | 17726 } |
| 17732 this.libraries.$setindex(filename, library); | 17727 this.libraries.$setindex(filename, library); |
| 17733 this._todo.add(library); | 17728 this._todo.add(library); |
| 17734 } | 17729 } |
| 17735 return library; | 17730 return library; |
| 17736 } | 17731 } |
| 17737 World.prototype.process = function() { | 17732 World.prototype.process = function() { |
| 17738 while ($notnull_bool(this._todo.length > 0)) { | 17733 while ($notnull_bool(this._todo.length > 0)) { |
| 17739 var todo = this._todo; | 17734 var todo = this._todo; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17917 break loop; | 17912 break loop; |
| 17918 } | 17913 } |
| 17919 else if ($notnull_bool(arg.startsWith('--out='))) { | 17914 else if ($notnull_bool(arg.startsWith('--out='))) { |
| 17920 this.outfile = arg.substring('--out='.length); | 17915 this.outfile = arg.substring('--out='.length); |
| 17921 } | 17916 } |
| 17922 else if ($notnull_bool(arg.startsWith('--libdir='))) { | 17917 else if ($notnull_bool(arg.startsWith('--libdir='))) { |
| 17923 this.libDir = arg.substring('--libdir='.length); | 17918 this.libDir = arg.substring('--libdir='.length); |
| 17924 passedLibDir = true; | 17919 passedLibDir = true; |
| 17925 } | 17920 } |
| 17926 else { | 17921 else { |
| 17927 if ($notnull_bool(!ignoreUnrecognizedFlags)) { | 17922 if ($notnull_bool(!$notnull_bool(ignoreUnrecognizedFlags))) { |
| 17928 print(('unrecognized flag: "' + arg + '"')); | 17923 print(('unrecognized flag: "' + arg + '"')); |
| 17929 } | 17924 } |
| 17930 } | 17925 } |
| 17931 | 17926 |
| 17932 } | 17927 } |
| 17933 } | 17928 } |
| 17934 if ($notnull_bool(!passedLibDir && !files.fileExists(this.libDir))) { | 17929 if ($notnull_bool(!$notnull_bool(passedLibDir) && !$notnull_bool(files.fileExi
sts(this.libDir)))) { |
| 17935 var temp = 'frog/lib'; | 17930 var temp = 'frog/lib'; |
| 17936 if ($notnull_bool(files.fileExists(temp))) { | 17931 if ($notnull_bool(files.fileExists(temp))) { |
| 17937 this.libDir = $assert_String(temp); | 17932 this.libDir = $assert_String(temp); |
| 17938 } | 17933 } |
| 17939 else { | 17934 else { |
| 17940 this.libDir = 'lib'; | 17935 this.libDir = 'lib'; |
| 17941 } | 17936 } |
| 17942 } | 17937 } |
| 17943 } | 17938 } |
| 17944 // ********** Code for LibraryReader ************** | 17939 // ********** Code for LibraryReader ************** |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18080 VarMethodSet.prototype._invokeMembers = function(context, node) { | 18075 VarMethodSet.prototype._invokeMembers = function(context, node) { |
| 18081 if ($notnull_bool(this._fallbackStubs != null)) return; | 18076 if ($notnull_bool(this._fallbackStubs != null)) return; |
| 18082 this._fallbackStubs = []; | 18077 this._fallbackStubs = []; |
| 18083 var $list = this.members; | 18078 var $list = this.members; |
| 18084 for (var $i = 0;$i < $list.length; $i++) { | 18079 for (var $i = 0;$i < $list.length; $i++) { |
| 18085 var member = $list.$index($i); | 18080 var member = $list.$index($i); |
| 18086 var target = new Value(member.declaringType, 'this', false, true, false); | 18081 var target = new Value(member.declaringType, 'this', false, true, false); |
| 18087 var result = member.invoke$4(context, node, target, this.args); | 18082 var result = member.invoke$4(context, node, target, this.args); |
| 18088 var stub = new VarMethodStub(this.name, member, this.args, result); | 18083 var stub = new VarMethodStub(this.name, member, this.args, result); |
| 18089 var type = member.declaringType; | 18084 var type = member.declaringType; |
| 18090 if ($notnull_bool($ne(type.get$library(), world.get$dom()) && !type.get$isOb
ject())) { | 18085 if ($notnull_bool($ne(type.get$library(), world.get$dom()) && !$notnull_bool
(type.get$isObject()))) { |
| 18091 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V
arMember())); | 18086 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V
arMember())); |
| 18092 } | 18087 } |
| 18093 else { | 18088 else { |
| 18094 this._fallbackStubs.add(stub); | 18089 this._fallbackStubs.add(stub); |
| 18095 } | 18090 } |
| 18096 } | 18091 } |
| 18097 var target = new Value(world.objectType, 'this', false, true, false); | 18092 var target = new Value(world.objectType, 'this', false, true, false); |
| 18098 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, thi
s.args); | 18093 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, thi
s.args); |
| 18099 var stub = new VarMethodStub(this.name, null, this.args, result); | 18094 var stub = new VarMethodStub(this.name, null, this.args, result); |
| 18100 if ($notnull_bool(this._fallbackStubs.length == 0)) { | 18095 if ($notnull_bool(this._fallbackStubs.length == 0)) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18214 world = new World(files); | 18209 world = new World(files); |
| 18215 world.init(); | 18210 world.init(); |
| 18216 } | 18211 } |
| 18217 function lang_compile(homedir, args, files) { | 18212 function lang_compile(homedir, args, files) { |
| 18218 parseOptions(homedir, args, files); | 18213 parseOptions(homedir, args, files); |
| 18219 initializeWorld(files); | 18214 initializeWorld(files); |
| 18220 var success = world.compile(); | 18215 var success = world.compile(); |
| 18221 if ($notnull_bool(options.outfile != null)) { | 18216 if ($notnull_bool(options.outfile != null)) { |
| 18222 if ($notnull_bool(success)) { | 18217 if ($notnull_bool(success)) { |
| 18223 var code = world.getGeneratedCode(); | 18218 var code = world.getGeneratedCode(); |
| 18224 if ($notnull_bool(!options.outfile.endsWith('.js'))) { | 18219 if ($notnull_bool(!$notnull_bool(options.outfile.endsWith('.js')))) { |
| 18225 code = '#!/usr/bin/env node\n' + code; | 18220 code = '#!/usr/bin/env node\n' + code; |
| 18226 } | 18221 } |
| 18227 world.files.writeString(options.outfile, code); | 18222 world.files.writeString(options.outfile, code); |
| 18228 } | 18223 } |
| 18229 else { | 18224 else { |
| 18230 world.files.writeString(options.outfile, "throw 'Sorry, but I could not ge
nerate reasonable code to run.\\n';"); | 18225 world.files.writeString(options.outfile, "throw 'Sorry, but I could not ge
nerate reasonable code to run.\\n';"); |
| 18231 } | 18226 } |
| 18232 } | 18227 } |
| 18233 return success; | 18228 return success; |
| 18234 } | 18229 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 18245 } | 18240 } |
| 18246 return nameBuilder.toString(); | 18241 return nameBuilder.toString(); |
| 18247 } | 18242 } |
| 18248 // ********** Library frog ************** | 18243 // ********** Library frog ************** |
| 18249 // ********** Code for top level ************** | 18244 // ********** Code for top level ************** |
| 18250 function main() { | 18245 function main() { |
| 18251 var homedir = get$path().dirname(get$fs().realpathSync($assert_String(process.
argv.$index(1)))); | 18246 var homedir = get$path().dirname(get$fs().realpathSync($assert_String(process.
argv.$index(1)))); |
| 18252 var argv = ListFactory.ListFactory$from$factory(process.argv); | 18247 var argv = ListFactory.ListFactory$from$factory(process.argv); |
| 18253 if ($notnull_bool(lang_compile($assert_String(homedir), (argv && argv.is$List$
String()), new NodeFileSystem()))) { | 18248 if ($notnull_bool(lang_compile($assert_String(homedir), (argv && argv.is$List$
String()), new NodeFileSystem()))) { |
| 18254 var code = world.getGeneratedCode(); | 18249 var code = world.getGeneratedCode(); |
| 18255 if ($notnull_bool(!options.compileOnly)) { | 18250 if ($notnull_bool(!$notnull_bool(options.compileOnly))) { |
| 18256 process.argv = [argv.$index(0), argv.$index(1)]; | 18251 process.argv = [argv.$index(0), argv.$index(1)]; |
| 18257 process.argv.addAll(options.childArgs); | 18252 process.argv.addAll(options.childArgs); |
| 18258 get$vm().runInNewContext($assert_String(code), createSandbox()); | 18253 get$vm().runInNewContext($assert_String(code), createSandbox()); |
| 18259 } | 18254 } |
| 18260 } | 18255 } |
| 18261 else { | 18256 else { |
| 18262 process.exit(1); | 18257 process.exit(1); |
| 18263 } | 18258 } |
| 18264 } | 18259 } |
| 18265 Function.prototype.to$call$0 = function() { | 18260 Function.prototype.to$call$0 = function() { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18424 INTERFACE, | 18419 INTERFACE, |
| 18425 LIBRARY, | 18420 LIBRARY, |
| 18426 NATIVE, | 18421 NATIVE, |
| 18427 NEGATE, | 18422 NEGATE, |
| 18428 OPERATOR, | 18423 OPERATOR, |
| 18429 SET, | 18424 SET, |
| 18430 SOURCE, | 18425 SOURCE, |
| 18431 STATIC, | 18426 STATIC, |
| 18432 TYPEDEF ]*/; | 18427 TYPEDEF ]*/; |
| 18433 main(); | 18428 main(); |
| OLD | NEW |