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

Side by Side Diff: frog/frogsh

Issue 8538019: incremental progress on Value (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebased Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | frog/gen.dart » ('j') | frog/gen.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env node 1 #!/usr/bin/env node
2 // ********** Library dart:core ************** 2 // ********** Library dart:core **************
3 // ********** Natives dart:core ************** 3 // ********** Natives dart:core **************
4 /** 4 /**
5 * Generates a dynamic call stub for a function. 5 * Generates a dynamic call stub for a function.
6 * Our goal is to create a stub method like this on-the-fly: 6 * Our goal is to create a stub method like this on-the-fly:
7 * function($0, $1, capture) { this($0, $1, true, capture); } 7 * function($0, $1, capture) { this($0, $1, true, capture); }
8 * 8 *
9 * This stub then replaces the dynamic one on Function, with one that is 9 * This stub then replaces the dynamic one on Function, with one that is
10 * specialized for that particular function, taking into account its default 10 * specialized for that particular function, taking into account its default
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 891
892 function _IsolateJsUtil() {} 892 function _IsolateJsUtil() {}
893 // ********** Code for ListFactory ************** 893 // ********** Code for ListFactory **************
894 ListFactory = Array; 894 ListFactory = Array;
895 ListFactory.prototype.is$ListFactory = function(){return this;}; 895 ListFactory.prototype.is$ListFactory = function(){return this;};
896 ListFactory.prototype.is$List = function(){return this;}; 896 ListFactory.prototype.is$List = function(){return this;};
897 ListFactory.prototype.is$List$ArgumentNode = function(){return this;}; 897 ListFactory.prototype.is$List$ArgumentNode = function(){return this;};
898 ListFactory.prototype.is$List$Definition = function(){return this;}; 898 ListFactory.prototype.is$List$Definition = function(){return this;};
899 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;}; 899 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;};
900 ListFactory.prototype.is$List$String = function(){return this;}; 900 ListFactory.prototype.is$List$String = function(){return this;};
901 ListFactory.prototype.is$List$T = function(){return this;};
902 ListFactory.prototype.is$List$Type = function(){return this;}; 901 ListFactory.prototype.is$List$Type = function(){return this;};
903 ListFactory.prototype.is$List$Value = function(){return this;}; 902 ListFactory.prototype.is$List$Value = function(){return this;};
904 ListFactory.prototype.is$List$int = function(){return this;}; 903 ListFactory.prototype.is$List$int = function(){return this;};
905 ListFactory.prototype.is$Iterable = function(){return this;}; 904 ListFactory.prototype.is$Iterable = function(){return this;};
906 ListFactory.ListFactory$from$factory = function(other) { 905 ListFactory.ListFactory$from$factory = function(other) {
907 var $0;
908 var list = []; 906 var list = [];
909 for (var $i = other.iterator(); $i.hasNext(); ) { 907 for (var $i = other.iterator(); $i.hasNext(); ) {
910 var e = $i.next(); 908 var e = $i.next();
911 list.add(e); 909 list.add(e);
912 } 910 }
913 return (list && list.is$ListFactory()); 911 return (list && list.is$ListFactory());
914 } 912 }
915 ListFactory.prototype.add = function(value) { 913 ListFactory.prototype.add = function(value) {
916 this.push(value); 914 this.push(value);
917 } 915 }
918 ListFactory.prototype.addLast = function(value) { 916 ListFactory.prototype.addLast = function(value) {
919 this.push(value); 917 this.push(value);
920 } 918 }
921 ListFactory.prototype.addAll = function(collection) { 919 ListFactory.prototype.addAll = function(collection) {
922 var $0;
923 for (var $i = collection.iterator(); $i.hasNext(); ) { 920 for (var $i = collection.iterator(); $i.hasNext(); ) {
924 var item = $i.next(); 921 var item = $i.next();
925 this.add(item); 922 this.add(item);
926 } 923 }
927 } 924 }
928 ListFactory.prototype.clear = function() { 925 ListFactory.prototype.clear = function() {
929 this.length = 0; 926 this.length = 0;
930 } 927 }
931 ListFactory.prototype.removeLast = function() { 928 ListFactory.prototype.removeLast = function() {
932 return this.pop(); 929 return this.pop();
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 return $truncdiv((capacity * 3), 4); 1582 return $truncdiv((capacity * 3), 4);
1586 } 1583 }
1587 // ********** Code for HashSetImplementation ************** 1584 // ********** Code for HashSetImplementation **************
1588 function HashSetImplementation() { 1585 function HashSetImplementation() {
1589 // Initializers done 1586 // Initializers done
1590 this._backingMap = new HashMapImplementation$E$E(); 1587 this._backingMap = new HashMapImplementation$E$E();
1591 } 1588 }
1592 HashSetImplementation.prototype.is$HashSetImplementation = function(){return thi s;}; 1589 HashSetImplementation.prototype.is$HashSetImplementation = function(){return thi s;};
1593 HashSetImplementation.prototype.is$Iterable = function(){return this;}; 1590 HashSetImplementation.prototype.is$Iterable = function(){return this;};
1594 HashSetImplementation.HashSetImplementation$from$factory = function(other) { 1591 HashSetImplementation.HashSetImplementation$from$factory = function(other) {
1595 var $0;
1596 var set = new HashSetImplementation(); 1592 var set = new HashSetImplementation();
1597 for (var $i = other.iterator(); $i.hasNext(); ) { 1593 for (var $i = other.iterator(); $i.hasNext(); ) {
1598 var e = $i.next(); 1594 var e = $i.next();
1599 set.add(e); 1595 set.add(e);
1600 } 1596 }
1601 return (set && set.is$HashSetImplementation()); 1597 return (set && set.is$HashSetImplementation());
1602 } 1598 }
1603 HashSetImplementation.prototype.add = function(value) { 1599 HashSetImplementation.prototype.add = function(value) {
1604 this._backingMap.$setindex(value, value); 1600 this._backingMap.$setindex(value, value);
1605 } 1601 }
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 n._previous = this; 1977 n._previous = this;
1982 } 1978 }
1983 // ********** Code for DoubleLinkedQueue ************** 1979 // ********** Code for DoubleLinkedQueue **************
1984 function DoubleLinkedQueue() { 1980 function DoubleLinkedQueue() {
1985 // Initializers done 1981 // Initializers done
1986 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); 1982 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E();
1987 } 1983 }
1988 DoubleLinkedQueue.prototype.is$DoubleLinkedQueue = function(){return this;}; 1984 DoubleLinkedQueue.prototype.is$DoubleLinkedQueue = function(){return this;};
1989 DoubleLinkedQueue.prototype.is$Iterable = function(){return this;}; 1985 DoubleLinkedQueue.prototype.is$Iterable = function(){return this;};
1990 DoubleLinkedQueue.DoubleLinkedQueue$from$factory = function(other) { 1986 DoubleLinkedQueue.DoubleLinkedQueue$from$factory = function(other) {
1991 var $0;
1992 var list = new DoubleLinkedQueue(); 1987 var list = new DoubleLinkedQueue();
1993 for (var $i = other.iterator(); $i.hasNext(); ) { 1988 for (var $i = other.iterator(); $i.hasNext(); ) {
1994 var e = $i.next(); 1989 var e = $i.next();
1995 list.addLast(e); 1990 list.addLast(e);
1996 } 1991 }
1997 return (list && list.is$DoubleLinkedQueue()); 1992 return (list && list.is$DoubleLinkedQueue());
1998 } 1993 }
1999 DoubleLinkedQueue.prototype.addLast = function(value) { 1994 DoubleLinkedQueue.prototype.addLast = function(value) {
2000 this._sentinel.prepend(value); 1995 this._sentinel.prepend(value);
2001 } 1996 }
2002 DoubleLinkedQueue.prototype.add = function(value) { 1997 DoubleLinkedQueue.prototype.add = function(value) {
2003 this.addLast(value); 1998 this.addLast(value);
2004 } 1999 }
2005 DoubleLinkedQueue.prototype.addAll = function(collection) { 2000 DoubleLinkedQueue.prototype.addAll = function(collection) {
2006 var $0;
2007 for (var $i = collection.iterator(); $i.hasNext(); ) { 2001 for (var $i = collection.iterator(); $i.hasNext(); ) {
2008 var e = $i.next(); 2002 var e = $i.next();
2009 this.add(e); 2003 this.add(e);
2010 } 2004 }
2011 } 2005 }
2012 DoubleLinkedQueue.prototype.removeLast = function() { 2006 DoubleLinkedQueue.prototype.removeLast = function() {
2013 return this._sentinel._previous.remove(); 2007 return this._sentinel._previous.remove();
2014 } 2008 }
2015 DoubleLinkedQueue.prototype.last = function() { 2009 DoubleLinkedQueue.prototype.last = function() {
2016 return this._sentinel._previous.get$element(); 2010 return this._sentinel._previous.get$element();
2017 } 2011 }
2018 DoubleLinkedQueue.prototype.lastEntry = function() { 2012 DoubleLinkedQueue.prototype.lastEntry = function() {
2019 return this._sentinel.previousEntry(); 2013 return this._sentinel.previousEntry();
2020 } 2014 }
2021 DoubleLinkedQueue.prototype.get$length = function() { 2015 DoubleLinkedQueue.prototype.get$length = function() {
2022 var counter = 0; 2016 var counter = 0;
2023 this.forEach(function _(element) { 2017 this.forEach(function _(element) {
2024 counter++; 2018 counter++;
2025 } 2019 }
2026 ); 2020 );
2027 return counter; 2021 return counter;
2028 } 2022 }
2029 Object.defineProperty(DoubleLinkedQueue.prototype, "length", { 2023 Object.defineProperty(DoubleLinkedQueue.prototype, "length", {
2030 get: DoubleLinkedQueue.prototype.get$length 2024 get: DoubleLinkedQueue.prototype.get$length
2031 }); 2025 });
2032 DoubleLinkedQueue.prototype.isEmpty = function() { 2026 DoubleLinkedQueue.prototype.isEmpty = function() {
2033 return $assert_bool((this._sentinel._next === this._sentinel)); 2027 return (this._sentinel._next === this._sentinel);
2034 } 2028 }
2035 DoubleLinkedQueue.prototype.forEach = function(f) { 2029 DoubleLinkedQueue.prototype.forEach = function(f) {
2036 var entry = this._sentinel._next; 2030 var entry = this._sentinel._next;
2037 while ($notnull_bool(entry !== this._sentinel)) { 2031 while ($notnull_bool(entry !== this._sentinel)) {
2038 f(entry._element); 2032 f(entry._element);
2039 entry = entry._next; 2033 entry = entry._next;
2040 } 2034 }
2041 } 2035 }
2042 DoubleLinkedQueue.prototype.some = function(f) { 2036 DoubleLinkedQueue.prototype.some = function(f) {
2043 var entry = this._sentinel._next; 2037 var entry = this._sentinel._next;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 // Initializers done 2092 // Initializers done
2099 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$String$Keywo rd(); 2093 this._sentinel = new _DoubleLinkedQueueEntrySentinel$KeyValuePair$String$Keywo rd();
2100 } 2094 }
2101 $inherits(DoubleLinkedQueue$KeyValuePair$String$Keyword, DoubleLinkedQueue); 2095 $inherits(DoubleLinkedQueue$KeyValuePair$String$Keyword, DoubleLinkedQueue);
2102 DoubleLinkedQueue$KeyValuePair$String$Keyword.prototype.is$Iterable = function() {return this;}; 2096 DoubleLinkedQueue$KeyValuePair$String$Keyword.prototype.is$Iterable = function() {return this;};
2103 // ********** Code for DoubleLinkedQueue$SourceString ************** 2097 // ********** Code for DoubleLinkedQueue$SourceString **************
2104 function DoubleLinkedQueue$SourceString() {} 2098 function DoubleLinkedQueue$SourceString() {}
2105 $inherits(DoubleLinkedQueue$SourceString, DoubleLinkedQueue); 2099 $inherits(DoubleLinkedQueue$SourceString, DoubleLinkedQueue);
2106 DoubleLinkedQueue$SourceString.prototype.is$Iterable = function(){return this;}; 2100 DoubleLinkedQueue$SourceString.prototype.is$Iterable = function(){return this;};
2107 DoubleLinkedQueue$SourceString.DoubleLinkedQueue$from$factory = function(other) { 2101 DoubleLinkedQueue$SourceString.DoubleLinkedQueue$from$factory = function(other) {
2108 var $0;
2109 var list = new DoubleLinkedQueue(); 2102 var list = new DoubleLinkedQueue();
2110 for (var $i = other.iterator(); $i.hasNext(); ) { 2103 for (var $i = other.iterator(); $i.hasNext(); ) {
2111 var e = $i.next(); 2104 var e = $i.next();
2112 list.addLast(e); 2105 list.addLast(e);
2113 } 2106 }
2114 return (list && list.is$DoubleLinkedQueue()); 2107 return (list && list.is$DoubleLinkedQueue());
2115 } 2108 }
2116 // ********** Code for _DoubleLinkedQueueIterator ************** 2109 // ********** Code for _DoubleLinkedQueueIterator **************
2117 function _DoubleLinkedQueueIterator(_sentinel) { 2110 function _DoubleLinkedQueueIterator(_sentinel) {
2118 this._sentinel = _sentinel; 2111 this._sentinel = _sentinel;
2119 // Initializers done 2112 // Initializers done
2120 this._currentEntry = this._sentinel; 2113 this._currentEntry = this._sentinel;
2121 } 2114 }
2122 _DoubleLinkedQueueIterator.prototype.is$Iterator$T = function(){return this;}; 2115 _DoubleLinkedQueueIterator.prototype.is$Iterator$T = function(){return this;};
2123 _DoubleLinkedQueueIterator.prototype.hasNext = function() { 2116 _DoubleLinkedQueueIterator.prototype.hasNext = function() {
2124 return $assert_bool(this._currentEntry._next !== this._sentinel); 2117 return this._currentEntry._next !== this._sentinel;
2125 } 2118 }
2126 _DoubleLinkedQueueIterator.prototype.next = function() { 2119 _DoubleLinkedQueueIterator.prototype.next = function() {
2127 if ($notnull_bool(!$notnull_bool(this.hasNext()))) { 2120 if ($notnull_bool(!$notnull_bool(this.hasNext()))) {
2128 $throw(const$0/*const NoMoreElementsException()*/); 2121 $throw(const$0/*const NoMoreElementsException()*/);
2129 } 2122 }
2130 this._currentEntry = this._currentEntry._next; 2123 this._currentEntry = this._currentEntry._next;
2131 return this._currentEntry.get$element(); 2124 return this._currentEntry.get$element();
2132 } 2125 }
2133 // ********** Code for _DoubleLinkedQueueIterator$E ************** 2126 // ********** Code for _DoubleLinkedQueueIterator$E **************
2134 function _DoubleLinkedQueueIterator$E(_sentinel) { 2127 function _DoubleLinkedQueueIterator$E(_sentinel) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2189 return this._length == 0; 2182 return this._length == 0;
2190 } 2183 }
2191 StringBufferImpl.prototype.add = function(obj) { 2184 StringBufferImpl.prototype.add = function(obj) {
2192 var str = obj.toString(); 2185 var str = obj.toString();
2193 if ($notnull_bool(str == null || str.isEmpty())) return this; 2186 if ($notnull_bool(str == null || str.isEmpty())) return this;
2194 this._buffer.add(str); 2187 this._buffer.add(str);
2195 this._length += str.length; 2188 this._length += str.length;
2196 return this; 2189 return this;
2197 } 2190 }
2198 StringBufferImpl.prototype.addAll = function(objects) { 2191 StringBufferImpl.prototype.addAll = function(objects) {
2199 var $0;
2200 for (var $i = objects.iterator(); $i.hasNext(); ) { 2192 for (var $i = objects.iterator(); $i.hasNext(); ) {
2201 var obj = $i.next(); 2193 var obj = $i.next();
2202 this.add(obj); 2194 this.add(obj);
2203 } 2195 }
2204 return this; 2196 return this;
2205 } 2197 }
2206 StringBufferImpl.prototype.clear = function() { 2198 StringBufferImpl.prototype.clear = function() {
2207 this._buffer = new ListFactory$String(); 2199 this._buffer = new ListFactory$String();
2208 this._length = 0; 2200 this._length = 0;
2209 return this; 2201 return this;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 this.hash_ = this.hash_ & ((1 << 29) - 1); 2270 this.hash_ = this.hash_ & ((1 << 29) - 1);
2279 } 2271 }
2280 return this.hash_; 2272 return this.hash_;
2281 } 2273 }
2282 StringImplementation.prototype.compareTo = function(other) { 2274 StringImplementation.prototype.compareTo = function(other) {
2283 return this == other ? 0 : this < other ? -1 : 1; 2275 return this == other ? 0 : this < other ? -1 : 1;
2284 } 2276 }
2285 // ********** Code for Collections ************** 2277 // ********** Code for Collections **************
2286 function Collections() {} 2278 function Collections() {}
2287 Collections.forEach = function(iterable, f) { 2279 Collections.forEach = function(iterable, f) {
2288 var $0;
2289 for (var $i = iterable.iterator(); $i.hasNext(); ) { 2280 for (var $i = iterable.iterator(); $i.hasNext(); ) {
2290 var e = $i.next(); 2281 var e = $i.next();
2291 f(e); 2282 f(e);
2292 } 2283 }
2293 } 2284 }
2294 Collections.some = function(iterable, f) { 2285 Collections.some = function(iterable, f) {
2295 var $0;
2296 for (var $i = iterable.iterator(); $i.hasNext(); ) { 2286 for (var $i = iterable.iterator(); $i.hasNext(); ) {
2297 var e = $i.next(); 2287 var e = $i.next();
2298 if ($notnull_bool(f(e))) return true; 2288 if ($notnull_bool(f(e))) return true;
2299 } 2289 }
2300 return false; 2290 return false;
2301 } 2291 }
2302 Collections.filter = function(source, destination, f) { 2292 Collections.filter = function(source, destination, f) {
2303 var $0;
2304 for (var $i = source.iterator(); $i.hasNext(); ) { 2293 for (var $i = source.iterator(); $i.hasNext(); ) {
2305 var e = $i.next(); 2294 var e = $i.next();
2306 if ($notnull_bool(f(e))) destination.add(e); 2295 if ($notnull_bool(f(e))) destination.add(e);
2307 } 2296 }
2308 return destination; 2297 return destination;
2309 } 2298 }
2310 // ********** Code for DateImplementation ************** 2299 // ********** Code for DateImplementation **************
2311 function DateImplementation() {} 2300 function DateImplementation() {}
2312 DateImplementation.fromEpoch$ctor = function(value, timeZone) { 2301 DateImplementation.fromEpoch$ctor = function(value, timeZone) {
2313 this.value = value; 2302 this.value = value;
2314 this.timeZone = timeZone; 2303 this.timeZone = timeZone;
2315 // Initializers done 2304 // Initializers done
2316 } 2305 }
2317 DateImplementation.fromEpoch$ctor.prototype = DateImplementation.prototype; 2306 DateImplementation.fromEpoch$ctor.prototype = DateImplementation.prototype;
2318 DateImplementation.now$ctor = function() { 2307 DateImplementation.now$ctor = function() {
2319 this.timeZone = new TimeZoneImplementation.local$ctor(); 2308 this.timeZone = new TimeZoneImplementation.local$ctor();
2320 this.value = DateImplementation._now(); 2309 this.value = DateImplementation._now();
2321 // Initializers done 2310 // Initializers done
2322 this._asJs(); 2311 this._asJs();
2323 } 2312 }
2324 DateImplementation.now$ctor.prototype = DateImplementation.prototype; 2313 DateImplementation.now$ctor.prototype = DateImplementation.prototype;
2325 DateImplementation.prototype.get$value = function() { return this.value; }; 2314 DateImplementation.prototype.get$value = function() { return this.value; };
2326 DateImplementation.prototype.$eq = function(other) { 2315 DateImplementation.prototype.$eq = function(other) {
2327 if ($notnull_bool(!$notnull_bool(((other instanceof DateImplementation))))) re turn false; 2316 if ($notnull_bool(!$notnull_bool(((other instanceof DateImplementation))))) re turn false;
2328 return $assert_bool((this.value == other.get$value()) && ($eq(this.timeZone, o ther.timeZone))); 2317 return $notnull_bool((this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone)));
2329 } 2318 }
2330 DateImplementation.prototype.compareTo = function(other) { 2319 DateImplementation.prototype.compareTo = function(other) {
2331 return this.value.compareTo(other.value); 2320 return this.value.compareTo(other.value);
2332 } 2321 }
2333 DateImplementation.prototype.get$year = function() { 2322 DateImplementation.prototype.get$year = function() {
2334 return this.isUtc ? this._asJs().getUTCFullYear() : 2323 return this.isUtc ? this._asJs().getUTCFullYear() :
2335 this._asJs().getFullYear(); 2324 this._asJs().getFullYear();
2336 } 2325 }
2337 DateImplementation.prototype.get$month = function() { 2326 DateImplementation.prototype.get$month = function() {
2338 return this.isUtc ? this._asJs().getMonth() + 1 : 2327 return this.isUtc ? this._asJs().getMonth() + 1 :
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 return {'require': require, 'process': process, 'console': console, 2425 return {'require': require, 'process': process, 'console': console,
2437 'setTimeout': setTimeout, 'clearTimeout': clearTimeout}; 2426 'setTimeout': setTimeout, 'clearTimeout': clearTimeout};
2438 } 2427 }
2439 // ********** Library file_system ************** 2428 // ********** Library file_system **************
2440 // ********** Code for top level ************** 2429 // ********** Code for top level **************
2441 function joinPaths(path1, path2) { 2430 function joinPaths(path1, path2) {
2442 var pieces = path1.split('/'); 2431 var pieces = path1.split('/');
2443 var $list = path2.split('/'); 2432 var $list = path2.split('/');
2444 for (var $i = 0;$i < $list.length; $i++) { 2433 for (var $i = 0;$i < $list.length; $i++) {
2445 var piece = $list.$index($i); 2434 var piece = $list.$index($i);
2446 if ($notnull_bool($eq(piece, '..') && pieces.length > 0 && $ne(pieces.last() , '.') && $ne(pieces.last(), '..'))) { 2435 if ($notnull_bool($eq(piece, '..') && pieces.length > 0) && $ne(pieces.last( ), '.') && $ne(pieces.last(), '..')) {
2447 pieces.removeLast(); 2436 pieces.removeLast();
2448 } 2437 }
2449 else if ($notnull_bool($ne(piece, ''))) { 2438 else if ($notnull_bool($ne(piece, ''))) {
2450 if ($notnull_bool(pieces.length > 0 && $eq(pieces.last(), '.'))) { 2439 if ($notnull_bool(pieces.length > 0 && $eq(pieces.last(), '.'))) {
2451 pieces.removeLast(); 2440 pieces.removeLast();
2452 } 2441 }
2453 pieces.add(piece); 2442 pieces.add(piece);
2454 } 2443 }
2455 } 2444 }
2456 return Strings.join((pieces && pieces.is$List$String()), '/'); 2445 return Strings.join((pieces && pieces.is$List$String()), '/');
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2715 this.extraCharOffset += offset; 2704 this.extraCharOffset += offset;
2716 } 2705 }
2717 ArrayBasedScanner.prototype.appendWhiteSpace = function(next) { 2706 ArrayBasedScanner.prototype.appendWhiteSpace = function(next) {
2718 2707
2719 } 2708 }
2720 ArrayBasedScanner.prototype.appendBeginGroup = function(kind, value) { 2709 ArrayBasedScanner.prototype.appendBeginGroup = function(kind, value) {
2721 var $0; 2710 var $0;
2722 var token = new BeginGroupToken(kind, value, this.tokenStart); 2711 var token = new BeginGroupToken(kind, value, this.tokenStart);
2723 this.tail.next = token; 2712 this.tail.next = token;
2724 this.tail = this.tail.next; 2713 this.tail = this.tail.next;
2725 while ($notnull_bool(kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.group ingStack.isEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN* /)) { 2714 while ($notnull_bool(kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.group ingStack.isEmpty())) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN */) {
2726 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 2715 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2727 } 2716 }
2728 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken()); 2717 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken());
2729 } 2718 }
2730 ArrayBasedScanner.prototype.appendEndGroup = function(kind, value, openKind) { 2719 ArrayBasedScanner.prototype.appendEndGroup = function(kind, value, openKind) {
2731 var $0; 2720 var $0;
2732 var oldTail = this.tail; 2721 var oldTail = this.tail;
2733 this.appendStringToken(kind, value); 2722 this.appendStringToken(kind, value);
2734 if ($notnull_bool(this.groupingStack.isEmpty())) { 2723 if ($notnull_bool(this.groupingStack.isEmpty())) {
2735 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return; 2724 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return;
2736 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 2725 $throw(new MalformedInputException(('Unmatched ' + value + '')));
2737 } 2726 }
2738 while ($notnull_bool(openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.g roupingStack.isEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TO KEN*/)) { 2727 while ($notnull_bool(openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.g roupingStack.isEmpty())) && this.groupingStack.get$head().kind === 60/*null.LT_T OKEN*/) {
2739 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 2728 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2740 } 2729 }
2741 if ($notnull_bool(this.groupingStack.get$head().kind !== openKind)) { 2730 if ($notnull_bool(this.groupingStack.get$head().kind !== openKind)) {
2742 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return; 2731 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return;
2743 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 2732 $throw(new MalformedInputException(('Unmatched ' + value + '')));
2744 } 2733 }
2745 this.groupingStack.get$head().endGroup = oldTail.next; 2734 this.groupingStack.get$head().endGroup = oldTail.next;
2746 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ()); 2735 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ());
2747 } 2736 }
2748 ArrayBasedScanner.prototype.appendGtGt = function(kind, value) { 2737 ArrayBasedScanner.prototype.appendGtGt = function(kind, value) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2825 this.extraCharOffset += offset; 2814 this.extraCharOffset += offset;
2826 } 2815 }
2827 ArrayBasedScanner$SourceString.prototype.appendWhiteSpace = function(next) { 2816 ArrayBasedScanner$SourceString.prototype.appendWhiteSpace = function(next) {
2828 2817
2829 } 2818 }
2830 ArrayBasedScanner$SourceString.prototype.appendBeginGroup = function(kind, value ) { 2819 ArrayBasedScanner$SourceString.prototype.appendBeginGroup = function(kind, value ) {
2831 var $0; 2820 var $0;
2832 var token = new BeginGroupToken(kind, value, this.tokenStart); 2821 var token = new BeginGroupToken(kind, value, this.tokenStart);
2833 this.tail.next = token; 2822 this.tail.next = token;
2834 this.tail = this.tail.next; 2823 this.tail = this.tail.next;
2835 while ($notnull_bool(kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.group ingStack.isEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN* /)) { 2824 while ($notnull_bool(kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.group ingStack.isEmpty())) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN */) {
2836 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 2825 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2837 } 2826 }
2838 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken()); 2827 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken());
2839 } 2828 }
2840 ArrayBasedScanner$SourceString.prototype.appendEndGroup = function(kind, value, openKind) { 2829 ArrayBasedScanner$SourceString.prototype.appendEndGroup = function(kind, value, openKind) {
2841 var $0; 2830 var $0;
2842 var oldTail = this.tail; 2831 var oldTail = this.tail;
2843 this.appendStringToken(kind, value); 2832 this.appendStringToken(kind, value);
2844 if ($notnull_bool(this.groupingStack.isEmpty())) { 2833 if ($notnull_bool(this.groupingStack.isEmpty())) {
2845 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return; 2834 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return;
2846 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 2835 $throw(new MalformedInputException(('Unmatched ' + value + '')));
2847 } 2836 }
2848 while ($notnull_bool(openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.g roupingStack.isEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TO KEN*/)) { 2837 while ($notnull_bool(openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.g roupingStack.isEmpty())) && this.groupingStack.get$head().kind === 60/*null.LT_T OKEN*/) {
2849 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 2838 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2850 } 2839 }
2851 if ($notnull_bool(this.groupingStack.get$head().kind !== openKind)) { 2840 if ($notnull_bool(this.groupingStack.get$head().kind !== openKind)) {
2852 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return; 2841 if ($notnull_bool(openKind === 60/*null.LT_TOKEN*/)) return;
2853 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 2842 $throw(new MalformedInputException(('Unmatched ' + value + '')));
2854 } 2843 }
2855 this.groupingStack.get$head().endGroup = oldTail.next; 2844 this.groupingStack.get$head().endGroup = oldTail.next;
2856 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ()); 2845 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ());
2857 } 2846 }
2858 ArrayBasedScanner$SourceString.prototype.appendGtGt = function(kind, value) { 2847 ArrayBasedScanner$SourceString.prototype.appendGtGt = function(kind, value) {
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
3581 state = KeywordState.get$KEYWORD_STATE().next(next); 3570 state = KeywordState.get$KEYWORD_STATE().next(next);
3582 next = this.advance(); 3571 next = this.advance();
3583 } 3572 }
3584 var isAscii = true; 3573 var isAscii = true;
3585 while ($notnull_bool(true)) { 3574 while ($notnull_bool(true)) {
3586 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { 3575 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) {
3587 if ($notnull_bool(state != null)) { 3576 if ($notnull_bool(state != null)) {
3588 state = state.next(next); 3577 state = state.next(next);
3589 } 3578 }
3590 } 3579 }
3591 else if ($notnull_bool((48/*null.$0*/ <= next && next <= 57/*null.$9*/) || ( 65/*null.$A*/ <= next && next <= 90/*null.$Z*/) || next == 95/*null.$_*/ || next == 36/*null.$DOLLAR*/)) { 3580 else if ($notnull_bool(($notnull_bool(48/*null.$0*/ <= next && next <= 57/*n ull.$9*/)) || ($notnull_bool(65/*null.$A*/ <= next && next <= 90/*null.$Z*/))) | | next == 95/*null.$_*/ || next == 36/*null.$DOLLAR*/) {
3592 state = null; 3581 state = null;
3593 } 3582 }
3594 else if ($notnull_bool(next < 128)) { 3583 else if ($notnull_bool(next < 128)) {
3595 if ($notnull_bool(state != null && state.isLeaf())) { 3584 if ($notnull_bool(state != null && state.isLeaf())) {
3596 this.appendKeywordToken(state.get$keyword()); 3585 this.appendKeywordToken(state.get$keyword());
3597 } 3586 }
3598 else if ($notnull_bool(isAscii)) { 3587 else if ($notnull_bool(isAscii)) {
3599 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start)); 3588 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start));
3600 } 3589 }
3601 else { 3590 else {
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
4395 state = KeywordState.get$KEYWORD_STATE().next(next); 4384 state = KeywordState.get$KEYWORD_STATE().next(next);
4396 next = this.advance(); 4385 next = this.advance();
4397 } 4386 }
4398 var isAscii = true; 4387 var isAscii = true;
4399 while ($notnull_bool(true)) { 4388 while ($notnull_bool(true)) {
4400 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { 4389 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) {
4401 if ($notnull_bool(state != null)) { 4390 if ($notnull_bool(state != null)) {
4402 state = state.next(next); 4391 state = state.next(next);
4403 } 4392 }
4404 } 4393 }
4405 else if ($notnull_bool((48/*null.$0*/ <= next && next <= 57/*null.$9*/) || ( 65/*null.$A*/ <= next && next <= 90/*null.$Z*/) || next == 95/*null.$_*/ || next == 36/*null.$DOLLAR*/)) { 4394 else if ($notnull_bool(($notnull_bool(48/*null.$0*/ <= next && next <= 57/*n ull.$9*/)) || ($notnull_bool(65/*null.$A*/ <= next && next <= 90/*null.$Z*/))) | | next == 95/*null.$_*/ || next == 36/*null.$DOLLAR*/) {
4406 state = null; 4395 state = null;
4407 } 4396 }
4408 else if ($notnull_bool(next < 128)) { 4397 else if ($notnull_bool(next < 128)) {
4409 if ($notnull_bool(state != null && state.isLeaf())) { 4398 if ($notnull_bool(state != null && state.isLeaf())) {
4410 this.appendKeywordToken(state.get$keyword()); 4399 this.appendKeywordToken(state.get$keyword());
4411 } 4400 }
4412 else if ($notnull_bool(isAscii)) { 4401 else if ($notnull_bool(isAscii)) {
4413 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start)); 4402 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start));
4414 } 4403 }
4415 else { 4404 else {
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
5208 state = KeywordState.get$KEYWORD_STATE().next(next); 5197 state = KeywordState.get$KEYWORD_STATE().next(next);
5209 next = this.advance(); 5198 next = this.advance();
5210 } 5199 }
5211 var isAscii = true; 5200 var isAscii = true;
5212 while ($notnull_bool(true)) { 5201 while ($notnull_bool(true)) {
5213 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) { 5202 if ($notnull_bool(97/*null.$a*/ <= next && next <= 122/*null.$z*/)) {
5214 if ($notnull_bool(state != null)) { 5203 if ($notnull_bool(state != null)) {
5215 state = state.next(next); 5204 state = state.next(next);
5216 } 5205 }
5217 } 5206 }
5218 else if ($notnull_bool((48/*null.$0*/ <= next && next <= 57/*null.$9*/) || ( 65/*null.$A*/ <= next && next <= 90/*null.$Z*/) || next == 95/*null.$_*/ || next == 36/*null.$DOLLAR*/)) { 5207 else if ($notnull_bool(($notnull_bool(48/*null.$0*/ <= next && next <= 57/*n ull.$9*/)) || ($notnull_bool(65/*null.$A*/ <= next && next <= 90/*null.$Z*/))) | | next == 95/*null.$_*/ || next == 36/*null.$DOLLAR*/) {
5219 state = null; 5208 state = null;
5220 } 5209 }
5221 else if ($notnull_bool(next < 128)) { 5210 else if ($notnull_bool(next < 128)) {
5222 if ($notnull_bool(state != null && state.isLeaf())) { 5211 if ($notnull_bool(state != null && state.isLeaf())) {
5223 this.appendKeywordToken(state.get$keyword()); 5212 this.appendKeywordToken(state.get$keyword());
5224 } 5213 }
5225 else if ($notnull_bool(isAscii)) { 5214 else if ($notnull_bool(isAscii)) {
5226 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start)); 5215 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start));
5227 } 5216 }
5228 else { 5217 else {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
5537 if ($notnull_bool(this.optional('factory', token))) { 5526 if ($notnull_bool(this.optional('factory', token))) {
5538 return this.parseType(this.next(token)); 5527 return this.parseType(this.next(token));
5539 } 5528 }
5540 return token; 5529 return token;
5541 } 5530 }
5542 PartialParser.prototype.skipBlock = function(token) { 5531 PartialParser.prototype.skipBlock = function(token) {
5543 if ($notnull_bool(!$notnull_bool(this.optional('{', token)))) { 5532 if ($notnull_bool(!$notnull_bool(this.optional('{', token)))) {
5544 return this.listener.expectedBlock(token); 5533 return this.listener.expectedBlock(token);
5545 } 5534 }
5546 var beginGroupToken = (token && token.is$BeginGroupToken()); 5535 var beginGroupToken = (token && token.is$BeginGroupToken());
5547 $assert(beginGroupToken.endGroup == null || beginGroupToken.endGroup.kind === 125/*null.$RBRACE*/, "beginGroupToken.endGroup === null ||\n beginGrou pToken.endGroup.kind === $RBRACE", "parser.dart", 171, 12); 5536 $assert($notnull_bool(beginGroupToken.endGroup == null || beginGroupToken.endG roup.kind === 125/*null.$RBRACE*/), "beginGroupToken.endGroup === null ||\n beginGroupToken.endGroup.kind === $RBRACE", "parser.dart", 171, 12);
5548 return beginGroupToken.endGroup; 5537 return beginGroupToken.endGroup;
5549 } 5538 }
5550 PartialParser.prototype.skipArguments = function(token) { 5539 PartialParser.prototype.skipArguments = function(token) {
5551 return token.endGroup; 5540 return token.endGroup;
5552 } 5541 }
5553 PartialParser.prototype.parseClass = function(token) { 5542 PartialParser.prototype.parseClass = function(token) {
5554 var begin = token; 5543 var begin = token;
5555 this.listener.beginClass(token); 5544 this.listener.beginClass(token);
5556 token = this.parseIdentifier(this.next(token)); 5545 token = this.parseIdentifier(this.next(token));
5557 token = this.parseTypeVariablesOpt(token); 5546 token = this.parseTypeVariablesOpt(token);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
5625 if ($notnull_bool(this.optional('extends', token))) { 5614 if ($notnull_bool(this.optional('extends', token))) {
5626 token = this.parseType(this.next(token)); 5615 token = this.parseType(this.next(token));
5627 } 5616 }
5628 else { 5617 else {
5629 this.listener.handleNoType(token); 5618 this.listener.handleNoType(token);
5630 } 5619 }
5631 this.listener.endTypeVariable(token); 5620 this.listener.endTypeVariable(token);
5632 return token; 5621 return token;
5633 } 5622 }
5634 PartialParser.prototype.optional = function(value, token) { 5623 PartialParser.prototype.optional = function(value, token) {
5635 return $assert_bool(value === token.get$stringValue()); 5624 return value === token.get$stringValue();
5636 } 5625 }
5637 PartialParser.prototype.parseType = function(token) { 5626 PartialParser.prototype.parseType = function(token) {
5638 if ($notnull_bool(this.isIdentifier(token))) { 5627 if ($notnull_bool(this.isIdentifier(token))) {
5639 token = this.parseIdentifier(token); 5628 token = this.parseIdentifier(token);
5640 while ($notnull_bool(this.optional('.', token))) { 5629 while ($notnull_bool(this.optional('.', token))) {
5641 token = this.parseIdentifier(this.next(token)); 5630 token = this.parseIdentifier(this.next(token));
5642 } 5631 }
5643 } 5632 }
5644 else if ($notnull_bool(this.optional('var', token))) { 5633 else if ($notnull_bool(this.optional('var', token))) {
5645 this.listener.handleVarKeyword(token); 5634 this.listener.handleVarKeyword(token);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
5718 isField = true; 5707 isField = true;
5719 break; 5708 break;
5720 } 5709 }
5721 else { 5710 else {
5722 token = this.listener.unexpected(token); 5711 token = this.listener.unexpected(token);
5723 } 5712 }
5724 } 5713 }
5725 if ($notnull_bool(!$notnull_bool(isField))) { 5714 if ($notnull_bool(!$notnull_bool(isField))) {
5726 token = this.next(this.skipArguments((token && token.is$BeginGroupToken()))) ; 5715 token = this.next(this.skipArguments((token && token.is$BeginGroupToken()))) ;
5727 } 5716 }
5728 while ($notnull_bool(token != null && token.kind !== 123/*null.LBRACE_TOKEN*/ && token.kind !== 59/*null.SEMICOLON_TOKEN*/)) { 5717 while ($notnull_bool(token != null && token.kind !== 123/*null.LBRACE_TOKEN*/) && token.kind !== 59/*null.SEMICOLON_TOKEN*/) {
5729 token = this.next(token); 5718 token = this.next(token);
5730 } 5719 }
5731 if ($notnull_bool(!$notnull_bool(this.optional(';', token)))) { 5720 if ($notnull_bool(!$notnull_bool(this.optional(';', token)))) {
5732 token = this.skipBlock(token); 5721 token = this.skipBlock(token);
5733 } 5722 }
5734 if ($notnull_bool(isField)) { 5723 if ($notnull_bool(isField)) {
5735 this.listener.endTopLevelField(start, token); 5724 this.listener.endTopLevelField(start, token);
5736 } 5725 }
5737 else { 5726 else {
5738 this.listener.endTopLevelMethod(start, token); 5727 this.listener.endTopLevelMethod(start, token);
5739 } 5728 }
5740 return token.next; 5729 return token.next;
5741 } 5730 }
5742 PartialParser.prototype.parseLibraryTags = function(token) { 5731 PartialParser.prototype.parseLibraryTags = function(token) {
5743 this.listener.beginLibraryTag(token); 5732 this.listener.beginLibraryTag(token);
5744 token = this.parseIdentifier(this.next(token)); 5733 token = this.parseIdentifier(this.next(token));
5745 token = this.expect('(', token); 5734 token = this.expect('(', token);
5746 while ($notnull_bool(token != null && token.kind !== 40/*null.LPAREN_TOKEN*/ & & token.kind !== 41/*null.RPAREN_TOKEN*/)) { 5735 while ($notnull_bool(token != null && token.kind !== 40/*null.LPAREN_TOKEN*/) && token.kind !== 41/*null.RPAREN_TOKEN*/) {
5747 token = this.next(token); 5736 token = this.next(token);
5748 } 5737 }
5749 token = this.expect(')', token); 5738 token = this.expect(')', token);
5750 return this.expect(';', token); 5739 return this.expect(';', token);
5751 } 5740 }
5752 PartialParser.prototype.beginTypeArguments$1 = function($0) { 5741 PartialParser.prototype.beginTypeArguments$1 = function($0) {
5753 return this.beginTypeArguments.call$1($0); 5742 return this.beginTypeArguments.call$1($0);
5754 } 5743 }
5755 ; 5744 ;
5756 PartialParser.prototype.beginTypeVariables$1 = function($0) { 5745 PartialParser.prototype.beginTypeVariables$1 = function($0) {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
5905 Parser.prototype.parseExpression = function(token) { 5894 Parser.prototype.parseExpression = function(token) {
5906 token = this.parseConditionalExpression(token); 5895 token = this.parseConditionalExpression(token);
5907 if ($notnull_bool(this.isAssignmentOperator(token))) { 5896 if ($notnull_bool(this.isAssignmentOperator(token))) {
5908 var operator = token; 5897 var operator = token;
5909 token = this.parseExpression(this.next(token)); 5898 token = this.parseExpression(this.next(token));
5910 this.listener.handleAssignmentExpression(operator); 5899 this.listener.handleAssignmentExpression(operator);
5911 } 5900 }
5912 return token; 5901 return token;
5913 } 5902 }
5914 Parser.prototype.isAssignmentOperator = function(token) { 5903 Parser.prototype.isAssignmentOperator = function(token) {
5915 return $assert_bool(2 === this.getPrecedence(token)); 5904 return 2 === this.getPrecedence(token);
5916 } 5905 }
5917 Parser.prototype.parseConditionalExpression = function(token) { 5906 Parser.prototype.parseConditionalExpression = function(token) {
5918 token = this.parseBinaryExpression(token, 4); 5907 token = this.parseBinaryExpression(token, 4);
5919 if ($notnull_bool(this.optional('?', token))) { 5908 if ($notnull_bool(this.optional('?', token))) {
5920 var question = token; 5909 var question = token;
5921 token = this.parseExpression(this.next(token)); 5910 token = this.parseExpression(this.next(token));
5922 var colon = token; 5911 var colon = token;
5923 token = this.expect(':', token); 5912 token = this.expect(':', token);
5924 token = this.parseExpression(token); 5913 token = this.parseExpression(token);
5925 this.listener.handleConditionalExpression(question, colon); 5914 this.listener.handleConditionalExpression(question, colon);
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
6869 this.internalString = internalString; 6858 this.internalString = internalString;
6870 this.begin = begin; 6859 this.begin = begin;
6871 this.end = end; 6860 this.end = end;
6872 // Initializers done 6861 // Initializers done
6873 } 6862 }
6874 SubstringWrapper.prototype.is$SourceString = function(){return this;}; 6863 SubstringWrapper.prototype.is$SourceString = function(){return this;};
6875 SubstringWrapper.prototype.hashCode = function() { 6864 SubstringWrapper.prototype.hashCode = function() {
6876 return this.toString().hashCode(); 6865 return this.toString().hashCode();
6877 } 6866 }
6878 SubstringWrapper.prototype.$eq = function(other) { 6867 SubstringWrapper.prototype.$eq = function(other) {
6879 return $assert_bool(!!(other && other.is$SourceString) && this.toString() == o ther.toString()); 6868 return $notnull_bool(!!(other && other.is$SourceString) && this.toString() == other.toString());
6880 } 6869 }
6881 SubstringWrapper.prototype.printOn = function(sb) { 6870 SubstringWrapper.prototype.printOn = function(sb) {
6882 sb.add(this); 6871 sb.add(this);
6883 } 6872 }
6884 SubstringWrapper.prototype.toString = function() { 6873 SubstringWrapper.prototype.toString = function() {
6885 return this.internalString.substring(this.begin, this.end); 6874 return this.internalString.substring(this.begin, this.end);
6886 } 6875 }
6887 SubstringWrapper.prototype.get$stringValue = function() { 6876 SubstringWrapper.prototype.get$stringValue = function() {
6888 return null; 6877 return null;
6889 } 6878 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
6940 // ********** Code for StringWrapper ************** 6929 // ********** Code for StringWrapper **************
6941 function StringWrapper(internalString) { 6930 function StringWrapper(internalString) {
6942 this.internalString = internalString; 6931 this.internalString = internalString;
6943 // Initializers done 6932 // Initializers done
6944 } 6933 }
6945 StringWrapper.prototype.is$SourceString = function(){return this;}; 6934 StringWrapper.prototype.is$SourceString = function(){return this;};
6946 StringWrapper.prototype.hashCode = function() { 6935 StringWrapper.prototype.hashCode = function() {
6947 return this.toString().hashCode(); 6936 return this.toString().hashCode();
6948 } 6937 }
6949 StringWrapper.prototype.$eq = function(other) { 6938 StringWrapper.prototype.$eq = function(other) {
6950 return $assert_bool(!!(other && other.is$SourceString) && this.toString() == o ther.toString()); 6939 return $notnull_bool(!!(other && other.is$SourceString) && this.toString() == other.toString());
6951 } 6940 }
6952 StringWrapper.prototype.printOn = function(sb) { 6941 StringWrapper.prototype.printOn = function(sb) {
6953 sb.add(this.internalString); 6942 sb.add(this.internalString);
6954 } 6943 }
6955 StringWrapper.prototype.toString = function() { 6944 StringWrapper.prototype.toString = function() {
6956 return this.internalString; 6945 return this.internalString;
6957 } 6946 }
6958 StringWrapper.prototype.get$stringValue = function() { 6947 StringWrapper.prototype.get$stringValue = function() {
6959 return this.internalString; 6948 return this.internalString;
6960 } 6949 }
(...skipping 12 matching lines...) Expand all
6973 } 6962 }
6974 Keyword.prototype.is$Keyword = function(){return this;}; 6963 Keyword.prototype.is$Keyword = function(){return this;};
6975 Keyword.prototype.is$SourceString = function(){return this;}; 6964 Keyword.prototype.is$SourceString = function(){return this;};
6976 Keyword.get$keywords = function() { 6965 Keyword.get$keywords = function() {
6977 if ($notnull_bool(Keyword._keywords == null)) { 6966 if ($notnull_bool(Keyword._keywords == null)) {
6978 Keyword._keywords = Keyword.computeKeywordMap(); 6967 Keyword._keywords = Keyword.computeKeywordMap();
6979 } 6968 }
6980 return Keyword._keywords; 6969 return Keyword._keywords;
6981 } 6970 }
6982 Keyword.computeKeywordMap = function() { 6971 Keyword.computeKeywordMap = function() {
6983 var $0;
6984 var result = new LinkedHashMapImplementation$String$Keyword(); 6972 var result = new LinkedHashMapImplementation$String$Keyword();
6985 for (var $i0 = const$234/*Keyword.values*/.iterator(); $i0.hasNext(); ) { 6973 for (var $i0 = const$234/*Keyword.values*/.iterator(); $i0.hasNext(); ) {
6986 var keyword = $i0.next(); 6974 var keyword = $i0.next();
6987 result.$setindex(keyword.syntax, keyword); 6975 result.$setindex(keyword.syntax, keyword);
6988 } 6976 }
6989 return result; 6977 return result;
6990 } 6978 }
6991 Keyword.prototype.hashCode = function() { 6979 Keyword.prototype.hashCode = function() {
6992 return this.syntax.hashCode(); 6980 return this.syntax.hashCode();
6993 } 6981 }
6994 Keyword.prototype.$eq = function(other) { 6982 Keyword.prototype.$eq = function(other) {
6995 return $assert_bool(!!(other && other.is$SourceString) && this.toString() == o ther.toString()); 6983 return $notnull_bool(!!(other && other.is$SourceString) && this.toString() == other.toString());
6996 } 6984 }
6997 Keyword.prototype.printOn = function(sb) { 6985 Keyword.prototype.printOn = function(sb) {
6998 sb.add(this.syntax); 6986 sb.add(this.syntax);
6999 } 6987 }
7000 Keyword.prototype.toString = function() { 6988 Keyword.prototype.toString = function() {
7001 return this.syntax; 6989 return this.syntax;
7002 } 6990 }
7003 Keyword.prototype.get$stringValue = function() { 6991 Keyword.prototype.get$stringValue = function() {
7004 return this.syntax; 6992 return this.syntax;
7005 } 6993 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
7136 // Initializers done 7124 // Initializers done
7137 } 7125 }
7138 $inherits(ClassNode, Node); 7126 $inherits(ClassNode, Node);
7139 ClassNode.prototype.is$ClassNode = function(){return this;}; 7127 ClassNode.prototype.is$ClassNode = function(){return this;};
7140 ClassNode.prototype.get$name = function() { return this.name; }; 7128 ClassNode.prototype.get$name = function() { return this.name; };
7141 ClassNode.prototype.get$interfaces = function() { return this.interfaces; }; 7129 ClassNode.prototype.get$interfaces = function() { return this.interfaces; };
7142 ClassNode.prototype.accept = function(visitor) { 7130 ClassNode.prototype.accept = function(visitor) {
7143 return visitor.visitClassNode(this); 7131 return visitor.visitClassNode(this);
7144 } 7132 }
7145 ClassNode.prototype.get$isInterface = function() { 7133 ClassNode.prototype.get$isInterface = function() {
7146 return $assert_bool(this.beginToken.get$stringValue() === 'interface'); 7134 return this.beginToken.get$stringValue() === 'interface';
7147 } 7135 }
7148 ClassNode.prototype.get$isClass = function() { 7136 ClassNode.prototype.get$isClass = function() {
7149 return !$notnull_bool(this.get$isInterface()); 7137 return !$notnull_bool(this.get$isInterface());
7150 } 7138 }
7151 ClassNode.prototype.getBeginToken = function() { 7139 ClassNode.prototype.getBeginToken = function() {
7152 return this.beginToken; 7140 return this.beginToken;
7153 } 7141 }
7154 ClassNode.prototype.getEndToken = function() { 7142 ClassNode.prototype.getEndToken = function() {
7155 return this.endToken; 7143 return this.endToken;
7156 } 7144 }
(...skipping 14 matching lines...) Expand all
7171 } 7159 }
7172 $inherits(Send, Expression); 7160 $inherits(Send, Expression);
7173 Send.prototype.is$Send = function(){return this;}; 7161 Send.prototype.is$Send = function(){return this;};
7174 Send.prototype.get$arguments = function() { 7162 Send.prototype.get$arguments = function() {
7175 return this.argumentsNode.nodes; 7163 return this.argumentsNode.nodes;
7176 } 7164 }
7177 Send.prototype.accept = function(visitor) { 7165 Send.prototype.accept = function(visitor) {
7178 return visitor.visitSend(this); 7166 return visitor.visitSend(this);
7179 } 7167 }
7180 Send.prototype.get$isPropertyAccess = function() { 7168 Send.prototype.get$isPropertyAccess = function() {
7181 return $assert_bool(this.argumentsNode == null); 7169 return this.argumentsNode == null;
7182 } 7170 }
7183 Send.prototype.get$isFunctionObjectInvocation = function() { 7171 Send.prototype.get$isFunctionObjectInvocation = function() {
7184 return $assert_bool(this.selector == null); 7172 return this.selector == null;
7185 } 7173 }
7186 Send.prototype.getBeginToken = function() { 7174 Send.prototype.getBeginToken = function() {
7187 return firstBeginToken(this.receiver, this.selector); 7175 return firstBeginToken(this.receiver, this.selector);
7188 } 7176 }
7189 Send.prototype.getEndToken = function() { 7177 Send.prototype.getEndToken = function() {
7190 var $0; 7178 var $0;
7191 var token; 7179 var token;
7192 if ($notnull_bool(this.argumentsNode != null)) token = this.argumentsNode.getE ndToken(); 7180 if ($notnull_bool(this.argumentsNode != null)) token = this.argumentsNode.getE ndToken();
7193 if ($notnull_bool(token != null)) return token; 7181 if ($notnull_bool(token != null)) return token;
7194 if ($notnull_bool(this.selector != null)) { 7182 if ($notnull_bool(this.selector != null)) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
7271 function If(condition, thenPart, elsePart, ifToken, elseToken) { 7259 function If(condition, thenPart, elsePart, ifToken, elseToken) {
7272 this.condition = condition; 7260 this.condition = condition;
7273 this.thenPart = thenPart; 7261 this.thenPart = thenPart;
7274 this.elsePart = elsePart; 7262 this.elsePart = elsePart;
7275 this.ifToken = ifToken; 7263 this.ifToken = ifToken;
7276 this.elseToken = elseToken; 7264 this.elseToken = elseToken;
7277 // Initializers done 7265 // Initializers done
7278 } 7266 }
7279 $inherits(If, Statement); 7267 $inherits(If, Statement);
7280 If.prototype.get$hasElsePart = function() { 7268 If.prototype.get$hasElsePart = function() {
7281 return $assert_bool(this.elsePart != null); 7269 return this.elsePart != null;
7282 } 7270 }
7283 If.prototype.accept = function(visitor) { 7271 If.prototype.accept = function(visitor) {
7284 return visitor.visitIf(this); 7272 return visitor.visitIf(this);
7285 } 7273 }
7286 If.prototype.getBeginToken = function() { 7274 If.prototype.getBeginToken = function() {
7287 return this.ifToken; 7275 return this.ifToken;
7288 } 7276 }
7289 If.prototype.getEndToken = function() { 7277 If.prototype.getEndToken = function() {
7290 if ($notnull_bool(this.elsePart == null)) return this.thenPart.getEndToken(); 7278 if ($notnull_bool(this.elsePart == null)) return this.thenPart.getEndToken();
7291 return this.elsePart.getEndToken(); 7279 return this.elsePart.getEndToken();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
7479 } 7467 }
7480 // ********** Code for Return ************** 7468 // ********** Code for Return **************
7481 function Return(beginToken, endToken, expression) { 7469 function Return(beginToken, endToken, expression) {
7482 this.beginToken = beginToken; 7470 this.beginToken = beginToken;
7483 this.endToken = endToken; 7471 this.endToken = endToken;
7484 this.expression = expression; 7472 this.expression = expression;
7485 // Initializers done 7473 // Initializers done
7486 } 7474 }
7487 $inherits(Return, Statement); 7475 $inherits(Return, Statement);
7488 Return.prototype.get$hasExpression = function() { 7476 Return.prototype.get$hasExpression = function() {
7489 return $assert_bool(this.expression != null); 7477 return this.expression != null;
7490 } 7478 }
7491 Return.prototype.accept = function(visitor) { 7479 Return.prototype.accept = function(visitor) {
7492 return visitor.visitReturn(this); 7480 return visitor.visitReturn(this);
7493 } 7481 }
7494 Return.prototype.getBeginToken = function() { 7482 Return.prototype.getBeginToken = function() {
7495 return this.beginToken; 7483 return this.beginToken;
7496 } 7484 }
7497 Return.prototype.getEndToken = function() { 7485 Return.prototype.getEndToken = function() {
7498 return this.endToken; 7486 return this.endToken;
7499 } 7487 }
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
7853 var result = this.current; 7841 var result = this.current;
7854 this.current.close(end); 7842 this.current.close(end);
7855 this.current = null; 7843 this.current = null;
7856 return result; 7844 return result;
7857 } 7845 }
7858 SsaBuilder.prototype.goto = function(from, to) { 7846 SsaBuilder.prototype.goto = function(from, to) {
7859 from.close(new HGoto()); 7847 from.close(new HGoto());
7860 from.addSuccessor(to); 7848 from.addSuccessor(to);
7861 } 7849 }
7862 SsaBuilder.prototype.isAborted = function() { 7850 SsaBuilder.prototype.isAborted = function() {
7863 return $assert_bool(this.current == null); 7851 return this.current == null;
7864 } 7852 }
7865 SsaBuilder.prototype.add = function(instruction) { 7853 SsaBuilder.prototype.add = function(instruction) {
7866 this.current.add(instruction); 7854 this.current.add(instruction);
7867 } 7855 }
7868 SsaBuilder.prototype.push = function(instruction) { 7856 SsaBuilder.prototype.push = function(instruction) {
7869 this.add(instruction); 7857 this.add(instruction);
7870 this.stack.add(instruction); 7858 this.stack.add(instruction);
7871 } 7859 }
7872 SsaBuilder.prototype.pop = function() { 7860 SsaBuilder.prototype.pop = function() {
7873 var $0; 7861 var $0;
7874 return (($0 = this.stack.removeLast()) && $0.is$HInstruction()); 7862 return (($0 = this.stack.removeLast()) && $0.is$HInstruction());
7875 } 7863 }
7876 SsaBuilder.prototype.visit = function(node) { 7864 SsaBuilder.prototype.visit = function(node) {
7877 if ($notnull_bool(node != null)) node.accept(this); 7865 if ($notnull_bool(node != null)) node.accept(this);
7878 } 7866 }
7879 SsaBuilder.prototype.visitParameters = function(parameters) { 7867 SsaBuilder.prototype.visitParameters = function(parameters) {
7880 var $0; 7868 var $0;
7881 var parameterIndex = 0; 7869 var parameterIndex = 0;
7882 for (var link = parameters.nodes; 7870 for (var link = parameters.nodes;
7883 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { 7871 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) {
7884 var container = (($0 = link.get$head()) && $0.is$VariableDefinitions()); 7872 var container = (($0 = link.get$head()) && $0.is$VariableDefinitions());
7885 var identifierLink = container.definitions.nodes; 7873 var identifierLink = container.definitions.nodes;
7886 $assert(!$notnull_bool(identifierLink.isEmpty()) && identifierLink.get$tail( ).isEmpty(), "!identifierLink.isEmpty() && identifierLink.tail.isEmpty()", "buil der.dart", 115, 14); 7874 $assert($notnull_bool(!$notnull_bool(identifierLink.isEmpty()) && identifier Link.get$tail().isEmpty()), "!identifierLink.isEmpty() && identifierLink.tail.is Empty()", "builder.dart", 115, 14);
7887 if ($notnull_bool(!(identifierLink.get$head() instanceof Identifier))) { 7875 if ($notnull_bool(!(identifierLink.get$head() instanceof Identifier))) {
7888 this.compiler.unimplemented("SsaBuilder.visitParameters non-identifier"); 7876 this.compiler.unimplemented("SsaBuilder.visitParameters non-identifier");
7889 } 7877 }
7890 var parameterId = (($0 = identifierLink.get$head()) && $0.is$Identifier()); 7878 var parameterId = (($0 = identifierLink.get$head()) && $0.is$Identifier());
7891 var element = (($0 = this.elements.$index(parameterId)) && $0.is$Element()); 7879 var element = (($0 = this.elements.$index(parameterId)) && $0.is$Element());
7892 var parameterInstruction = new HParameter(parameterIndex++); 7880 var parameterInstruction = new HParameter(parameterIndex++);
7893 this.definitions.$setindex(element, parameterInstruction); 7881 this.definitions.$setindex(element, parameterInstruction);
7894 this.add(parameterInstruction); 7882 this.add(parameterInstruction);
7895 } 7883 }
7896 } 7884 }
7897 SsaBuilder.prototype.visitBlock = function(node) { 7885 SsaBuilder.prototype.visitBlock = function(node) {
7898 var $0; 7886 var $0;
7899 for (var link = node.statements.nodes; 7887 for (var link = node.statements.nodes;
7900 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { 7888 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) {
7901 this.visit((($0 = link.get$head()) && $0.is$Node())); 7889 this.visit((($0 = link.get$head()) && $0.is$Node()));
7902 if ($notnull_bool(this.isAborted())) { 7890 if ($notnull_bool(this.isAborted())) {
7903 if ($notnull_bool(!$notnull_bool(this.stack.isEmpty()))) this.compiler.can cel('non-empty instruction stack'); 7891 if ($notnull_bool(!$notnull_bool(this.stack.isEmpty()))) this.compiler.can cel('non-empty instruction stack');
7904 return; 7892 return;
7905 } 7893 }
7906 } 7894 }
7907 $assert(!(this.current.last instanceof HGoto) && !(this.current.last instanceo f HReturn), "current.last is !HGoto && current.last is !HReturn", "builder.dart" , 138, 12); 7895 $assert($notnull_bool(!(this.current.last instanceof HGoto) && !(this.current. last instanceof HReturn)), "current.last is !HGoto && current.last is !HReturn", "builder.dart", 138, 12);
7908 if ($notnull_bool(!$notnull_bool(this.stack.isEmpty()))) this.compiler.cancel( 'non-empty instruction stack'); 7896 if ($notnull_bool(!$notnull_bool(this.stack.isEmpty()))) this.compiler.cancel( 'non-empty instruction stack');
7909 } 7897 }
7910 SsaBuilder.prototype.visitClassNode = function(node) { 7898 SsaBuilder.prototype.visitClassNode = function(node) {
7911 this.compiler.unimplemented("SsaBuilder.visitClassNode"); 7899 this.compiler.unimplemented("SsaBuilder.visitClassNode");
7912 } 7900 }
7913 SsaBuilder.prototype.visitExpressionStatement = function(node) { 7901 SsaBuilder.prototype.visitExpressionStatement = function(node) {
7914 this.visit(node.expression); 7902 this.visit(node.expression);
7915 this.pop(); 7903 this.pop();
7916 } 7904 }
7917 SsaBuilder.prototype.visitFor = function(node) { 7905 SsaBuilder.prototype.visitFor = function(node) {
7918 var $this = this; // closure support 7906 var $this = this; // closure support
7919 $assert(node.initializer != null && node.condition != null && node.update != n ull && node.body != null, "node.initializer !== null && node.condition !== null &&\n node.update !== null && node.body !== null", "builder.dart", 152, 12); 7907 $assert($notnull_bool(node.initializer != null && node.condition != null) && n ode.update != null && node.body != null, "node.initializer !== null && node.cond ition !== null &&\n node.update !== null && node.body !== null", "buil der.dart", 152, 12);
7920 this.visit(node.initializer); 7908 this.visit(node.initializer);
7921 $assert(!$notnull_bool(this.isAborted()), "!isAborted()", "builder.dart", 156, 12); 7909 $assert(!$notnull_bool(this.isAborted()), "!isAborted()", "builder.dart", 156, 12);
7922 var initializerBlock = this.close(new HGoto()); 7910 var initializerBlock = this.close(new HGoto());
7923 var initializerDefinitions = HashMapImplementation.HashMapImplementation$from$ factory(this.definitions); 7911 var initializerDefinitions = HashMapImplementation.HashMapImplementation$from$ factory(this.definitions);
7924 var conditionBlock = this.graph.addNewBlock(); 7912 var conditionBlock = this.graph.addNewBlock();
7925 conditionBlock.isLoopHeader = true; 7913 conditionBlock.isLoopHeader = true;
7926 initializerBlock.addSuccessor(conditionBlock); 7914 initializerBlock.addSuccessor(conditionBlock);
7927 this.open(conditionBlock); 7915 this.open(conditionBlock);
7928 initializerDefinitions.forEach((function (element, instruction) { 7916 initializerDefinitions.forEach((function (element, instruction) {
7929 var phi = new HPhi(instruction, instruction); 7917 var phi = new HPhi(instruction, instruction);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
7987 conditionExitBlock.addSuccessor(joinBlock); 7975 conditionExitBlock.addSuccessor(joinBlock);
7988 this.open(joinBlock); 7976 this.open(joinBlock);
7989 this.definitions = this.joinDefinitions(joinBlock, conditionDefinitions, this. definitions); 7977 this.definitions = this.joinDefinitions(joinBlock, conditionDefinitions, this. definitions);
7990 } 7978 }
7991 SsaBuilder.prototype.visitFunctionExpression = function(node) { 7979 SsaBuilder.prototype.visitFunctionExpression = function(node) {
7992 this.compiler.unimplemented('SsaBuilder.visitFunctionExpression'); 7980 this.compiler.unimplemented('SsaBuilder.visitFunctionExpression');
7993 } 7981 }
7994 SsaBuilder.prototype.visitIdentifier = function(node) { 7982 SsaBuilder.prototype.visitIdentifier = function(node) {
7995 var $0; 7983 var $0;
7996 var element = (($0 = this.elements.$index(node)) && $0.is$Element()); 7984 var element = (($0 = this.elements.$index(node)) && $0.is$Element());
7997 this.compiler.ensure($assert_bool(element != null)); 7985 this.compiler.ensure(element != null);
7998 var def = (($0 = this.definitions.$index(element)) && $0.is$HInstruction()); 7986 var def = (($0 = this.definitions.$index(element)) && $0.is$HInstruction());
7999 $assert(def != null, "def !== null", "builder.dart", 253, 12); 7987 $assert(def != null, "def !== null", "builder.dart", 253, 12);
8000 this.stack.add(def); 7988 this.stack.add(def);
8001 } 7989 }
8002 SsaBuilder.prototype.joinDefinitions = function(joinBlock, incoming1, incoming2) { 7990 SsaBuilder.prototype.joinDefinitions = function(joinBlock, incoming1, incoming2) {
8003 if ($notnull_bool(incoming1.get$length() > incoming2.get$length())) { 7991 if ($notnull_bool(incoming1.get$length() > incoming2.get$length())) {
8004 return this.joinDefinitions(joinBlock, incoming2, incoming1); 7992 return this.joinDefinitions(joinBlock, incoming2, incoming1);
8005 } 7993 }
8006 var joinedDefinitions = new HashMapImplementation$Element$HInstruction(); 7994 var joinedDefinitions = new HashMapImplementation$Element$HInstruction();
8007 $assert(incoming1.get$length() <= incoming2.get$length(), "incoming1.length <= incoming2.length", "builder.dart", 272, 12); 7995 $assert(incoming1.get$length() <= incoming2.get$length(), "incoming1.length <= incoming2.length", "builder.dart", 272, 12);
(...skipping 26 matching lines...) Expand all
8034 var thenDefinitions = this.definitions; 8022 var thenDefinitions = this.definitions;
8035 this.definitions = conditionDefinitions; 8023 this.definitions = conditionDefinitions;
8036 var elseBlock = null; 8024 var elseBlock = null;
8037 if ($notnull_bool(hasElse)) { 8025 if ($notnull_bool(hasElse)) {
8038 elseBlock = this.graph.addNewBlock(); 8026 elseBlock = this.graph.addNewBlock();
8039 conditionBlock.addSuccessor(elseBlock); 8027 conditionBlock.addSuccessor(elseBlock);
8040 this.open(elseBlock); 8028 this.open(elseBlock);
8041 this.visit(node.elsePart); 8029 this.visit(node.elsePart);
8042 elseBlock = this.current; 8030 elseBlock = this.current;
8043 } 8031 }
8044 if ($notnull_bool(thenBlock == null && elseBlock == null && hasElse)) { 8032 if ($notnull_bool(thenBlock == null && elseBlock == null) && hasElse) {
8045 this.current = null; 8033 this.current = null;
8046 } 8034 }
8047 else { 8035 else {
8048 var joinBlock = this.graph.addNewBlock(); 8036 var joinBlock = this.graph.addNewBlock();
8049 if ($notnull_bool(thenBlock != null)) this.goto(thenBlock, joinBlock); 8037 if ($notnull_bool(thenBlock != null)) this.goto(thenBlock, joinBlock);
8050 if ($notnull_bool(elseBlock != null)) this.goto(elseBlock, joinBlock); 8038 if ($notnull_bool(elseBlock != null)) this.goto(elseBlock, joinBlock);
8051 else if ($notnull_bool(!$notnull_bool(hasElse))) conditionBlock.addSuccessor (joinBlock); 8039 else if ($notnull_bool(!$notnull_bool(hasElse))) conditionBlock.addSuccessor (joinBlock);
8052 this.open(joinBlock); 8040 this.open(joinBlock);
8053 if ($notnull_bool(joinBlock.predecessors.length == 2)) { 8041 if ($notnull_bool(joinBlock.predecessors.length == 2)) {
8054 this.definitions = this.joinDefinitions(joinBlock, this.definitions, thenD efinitions); 8042 this.definitions = this.joinDefinitions(joinBlock, this.definitions, thenD efinitions);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
8160 } 8148 }
8161 SsaBuilder.prototype.visitTypeAnnotation = function(node) { 8149 SsaBuilder.prototype.visitTypeAnnotation = function(node) {
8162 8150
8163 } 8151 }
8164 SsaBuilder.prototype.updateDefinition = function(node) { 8152 SsaBuilder.prototype.updateDefinition = function(node) {
8165 var $0; 8153 var $0;
8166 if ($notnull_bool(node.receiver != null)) { 8154 if ($notnull_bool(node.receiver != null)) {
8167 this.compiler.unimplemented("SsaBuilder: property access"); 8155 this.compiler.unimplemented("SsaBuilder: property access");
8168 } 8156 }
8169 var link = node.get$arguments(); 8157 var link = node.get$arguments();
8170 $assert(!$notnull_bool(link.isEmpty()) && link.get$tail().isEmpty(), "!link.is Empty() && link.tail.isEmpty()", "builder.dart", 456, 12); 8158 $assert($notnull_bool(!$notnull_bool(link.isEmpty()) && link.get$tail().isEmpt y()), "!link.isEmpty() && link.tail.isEmpty()", "builder.dart", 456, 12);
8171 this.visit((($0 = link.get$head()) && $0.is$Node())); 8159 this.visit((($0 = link.get$head()) && $0.is$Node()));
8172 var value = this.pop(); 8160 var value = this.pop();
8173 this.definitions.$setindex(this.elements.$index(node), value); 8161 this.definitions.$setindex(this.elements.$index(node), value);
8174 return value; 8162 return value;
8175 } 8163 }
8176 SsaBuilder.prototype.visitVariableDefinitions = function(node) { 8164 SsaBuilder.prototype.visitVariableDefinitions = function(node) {
8177 var $0; 8165 var $0;
8178 for (var link = node.definitions.nodes; 8166 for (var link = node.definitions.nodes;
8179 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { 8167 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) {
8180 var definition = (($0 = link.get$head()) && $0.is$Node()); 8168 var definition = (($0 = link.get$head()) && $0.is$Node());
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
8680 return id; 8668 return id;
8681 } 8669 }
8682 HBasicBlock.prototype.accept = function(visitor) { 8670 HBasicBlock.prototype.accept = function(visitor) {
8683 return visitor.visitBasicBlock(this); 8671 return visitor.visitBasicBlock(this);
8684 } 8672 }
8685 HBasicBlock.prototype.add = function(instruction) { 8673 HBasicBlock.prototype.add = function(instruction) {
8686 $assert(!(instruction instanceof HControlFlow), "instruction is !HControlFlow" , "nodes.dart", 238, 12); 8674 $assert(!(instruction instanceof HControlFlow), "instruction is !HControlFlow" , "nodes.dart", 238, 12);
8687 this.addAfter(this.last, instruction); 8675 this.addAfter(this.last, instruction);
8688 } 8676 }
8689 HBasicBlock.prototype.addSuccessor = function(block) { 8677 HBasicBlock.prototype.addSuccessor = function(block) {
8690 $assert(this.isClosed() && (block.isNew() || block.id < this.id), "isClosed() && (block.isNew() || block.id < id)", "nodes.dart", 244, 12); 8678 $assert($notnull_bool(this.isClosed() && ($notnull_bool(block.isNew() || block .id < this.id))), "isClosed() && (block.isNew() || block.id < id)", "nodes.dart" , 244, 12);
8691 if ($notnull_bool(this.successors.isEmpty())) { 8679 if ($notnull_bool(this.successors.isEmpty())) {
8692 this.successors = [block]; 8680 this.successors = [block];
8693 } 8681 }
8694 else { 8682 else {
8695 this.successors.add(block); 8683 this.successors.add(block);
8696 } 8684 }
8697 block.predecessors.add(this); 8685 block.predecessors.add(this);
8698 } 8686 }
8699 HBasicBlock.prototype.addAfter = function(cursor, instruction) { 8687 HBasicBlock.prototype.addAfter = function(cursor, instruction) {
8700 $assert(this.isOpen() || this.isClosed(), "isOpen() || isClosed()", "nodes.dar t", 254, 12); 8688 $assert($notnull_bool(this.isOpen() || this.isClosed()), "isOpen() || isClosed ()", "nodes.dart", 254, 12);
8701 if ($notnull_bool(cursor == null)) { 8689 if ($notnull_bool(cursor == null)) {
8702 this.first = this.last = instruction; 8690 this.first = this.last = instruction;
8703 } 8691 }
8704 else if ($notnull_bool(cursor === this.last)) { 8692 else if ($notnull_bool(cursor === this.last)) {
8705 this.last.next = instruction; 8693 this.last.next = instruction;
8706 instruction.previous = this.last; 8694 instruction.previous = this.last;
8707 this.last = instruction; 8695 this.last = instruction;
8708 } 8696 }
8709 else { 8697 else {
8710 instruction.previous = cursor; 8698 instruction.previous = cursor;
8711 instruction.next = cursor.next; 8699 instruction.next = cursor.next;
8712 cursor.next.previous = instruction; 8700 cursor.next.previous = instruction;
8713 cursor.next = instruction; 8701 cursor.next = instruction;
8714 } 8702 }
8715 instruction.notifyAddedToBlock(); 8703 instruction.notifyAddedToBlock();
8716 } 8704 }
8717 HBasicBlock.prototype.remove = function(instruction) { 8705 HBasicBlock.prototype.remove = function(instruction) {
8718 $assert(this.isOpen() || this.isClosed(), "isOpen() || isClosed()", "nodes.dar t", 271, 12); 8706 $assert($notnull_bool(this.isOpen() || this.isClosed()), "isOpen() || isClosed ()", "nodes.dart", 271, 12);
8719 $assert(instruction.isInBasicBlock(), "instruction.isInBasicBlock()", "nodes.d art", 272, 12); 8707 $assert(instruction.isInBasicBlock(), "instruction.isInBasicBlock()", "nodes.d art", 272, 12);
8720 $assert(instruction.get$usedBy().isEmpty(), "instruction.usedBy.isEmpty()", "n odes.dart", 273, 12); 8708 $assert(instruction.get$usedBy().isEmpty(), "instruction.usedBy.isEmpty()", "n odes.dart", 273, 12);
8721 if ($notnull_bool(instruction.previous == null)) { 8709 if ($notnull_bool(instruction.previous == null)) {
8722 this.first = instruction.next; 8710 this.first = instruction.next;
8723 } 8711 }
8724 else { 8712 else {
8725 instruction.previous.next = instruction.next; 8713 instruction.previous.next = instruction.next;
8726 } 8714 }
8727 if ($notnull_bool(instruction.next == null)) { 8715 if ($notnull_bool(instruction.next == null)) {
8728 this.last = instruction.previous; 8716 this.last = instruction.previous;
(...skipping 13 matching lines...) Expand all
8742 from._usedBy = []; 8730 from._usedBy = [];
8743 } 8731 }
8744 HBasicBlock.rewriteInput = function(instruction, from, to) { 8732 HBasicBlock.rewriteInput = function(instruction, from, to) {
8745 var inputs = instruction.inputs; 8733 var inputs = instruction.inputs;
8746 for (var i = 0; 8734 for (var i = 0;
8747 $notnull_bool(i < inputs.length); i++) { 8735 $notnull_bool(i < inputs.length); i++) {
8748 if ($notnull_bool(inputs.$index(i) === from)) inputs.$setindex(i, to); 8736 if ($notnull_bool(inputs.$index(i) === from)) inputs.$setindex(i, to);
8749 } 8737 }
8750 } 8738 }
8751 HBasicBlock.prototype.isExitBlock = function() { 8739 HBasicBlock.prototype.isExitBlock = function() {
8752 return $assert_bool(this.first === this.last && (this.first instanceof HExit)) ; 8740 return $notnull_bool(this.first === this.last && (this.first instanceof HExit) );
8753 } 8741 }
8754 HBasicBlock.prototype.addDominatedBlock = function(block) { 8742 HBasicBlock.prototype.addDominatedBlock = function(block) {
8755 $assert(this.isClosed(), "isClosed()", "nodes.dart", 313, 12); 8743 $assert(this.isClosed(), "isClosed()", "nodes.dart", 313, 12);
8756 $assert(this.id != null && block.id != null, "id !== null && block.id !== null ", "nodes.dart", 314, 12); 8744 $assert($notnull_bool(this.id != null && block.id != null), "id !== null && bl ock.id !== null", "nodes.dart", 314, 12);
8757 $assert(this.dominatedBlocks.indexOf(block) < 0, "dominatedBlocks.indexOf(bloc k) < 0", "nodes.dart", 315, 12); 8745 $assert(this.dominatedBlocks.indexOf(block) < 0, "dominatedBlocks.indexOf(bloc k) < 0", "nodes.dart", 315, 12);
8758 var index = this.dominatedBlocks.length; 8746 var index = this.dominatedBlocks.length;
8759 while ($notnull_bool(index > 0 && this.dominatedBlocks.$index(index - 1).id > block.id)) { 8747 while ($notnull_bool(index > 0 && this.dominatedBlocks.$index(index - 1).id > block.id)) {
8760 index--; 8748 index--;
8761 } 8749 }
8762 if ($notnull_bool(index == this.dominatedBlocks.length)) { 8750 if ($notnull_bool(index == this.dominatedBlocks.length)) {
8763 this.dominatedBlocks.add(block); 8751 this.dominatedBlocks.add(block);
8764 } 8752 }
8765 else { 8753 else {
8766 this.dominatedBlocks.insertRange(index, 1, block); 8754 this.dominatedBlocks.insertRange(index, 1, block);
8767 } 8755 }
8768 $assert(block.dominator == null, "block.dominator === null", "nodes.dart", 328 , 12); 8756 $assert(block.dominator == null, "block.dominator === null", "nodes.dart", 328 , 12);
8769 block.dominator = this; 8757 block.dominator = this;
8770 } 8758 }
8771 HBasicBlock.prototype.removeDominatedBlock = function(block) { 8759 HBasicBlock.prototype.removeDominatedBlock = function(block) {
8772 $assert(this.isClosed(), "isClosed()", "nodes.dart", 333, 12); 8760 $assert(this.isClosed(), "isClosed()", "nodes.dart", 333, 12);
8773 $assert(this.id != null && block.id != null, "id !== null && block.id !== null ", "nodes.dart", 334, 12); 8761 $assert($notnull_bool(this.id != null && block.id != null), "id !== null && bl ock.id !== null", "nodes.dart", 334, 12);
8774 var index = this.dominatedBlocks.indexOf(block); 8762 var index = this.dominatedBlocks.indexOf(block);
8775 $assert(index >= 0, "index >= 0", "nodes.dart", 336, 12); 8763 $assert(index >= 0, "index >= 0", "nodes.dart", 336, 12);
8776 if ($notnull_bool(index == this.dominatedBlocks.length - 1)) { 8764 if ($notnull_bool(index == this.dominatedBlocks.length - 1)) {
8777 this.dominatedBlocks.removeLast(); 8765 this.dominatedBlocks.removeLast();
8778 } 8766 }
8779 else { 8767 else {
8780 this.dominatedBlocks.removeRange(index, 1); 8768 this.dominatedBlocks.removeRange(index, 1);
8781 } 8769 }
8782 $assert(block.dominator === this, "block.dominator === this", "nodes.dart", 34 2, 12); 8770 $assert(block.dominator === this, "block.dominator === this", "nodes.dart", 34 2, 12);
8783 block.dominator = null; 8771 block.dominator = null;
8784 } 8772 }
8785 HBasicBlock.prototype.assignCommonDominator = function(predecessor) { 8773 HBasicBlock.prototype.assignCommonDominator = function(predecessor) {
8786 $assert(this.isClosed(), "isClosed()", "nodes.dart", 347, 12); 8774 $assert(this.isClosed(), "isClosed()", "nodes.dart", 347, 12);
8787 if ($notnull_bool(this.dominator == null)) { 8775 if ($notnull_bool(this.dominator == null)) {
8788 predecessor.addDominatedBlock(this); 8776 predecessor.addDominatedBlock(this);
8789 } 8777 }
8790 else if ($notnull_bool(predecessor.dominator != null)) { 8778 else if ($notnull_bool(predecessor.dominator != null)) {
8791 var first = this.dominator; 8779 var first = this.dominator;
8792 var second = predecessor; 8780 var second = predecessor;
8793 while ($notnull_bool(first !== second)) { 8781 while ($notnull_bool(first !== second)) {
8794 if ($notnull_bool(first.id > second.id)) { 8782 if ($notnull_bool(first.id > second.id)) {
8795 first = first.dominator; 8783 first = first.dominator;
8796 } 8784 }
8797 else { 8785 else {
8798 second = second.dominator; 8786 second = second.dominator;
8799 } 8787 }
8800 $assert(first != null && second != null, "first !== null && second !== nul l", "nodes.dart", 364, 16); 8788 $assert($notnull_bool(first != null && second != null), "first !== null && second !== null", "nodes.dart", 364, 16);
8801 } 8789 }
8802 if ($notnull_bool(this.dominator !== first)) { 8790 if ($notnull_bool(this.dominator !== first)) {
8803 this.dominator.removeDominatedBlock(this); 8791 this.dominator.removeDominatedBlock(this);
8804 first.addDominatedBlock(this); 8792 first.addDominatedBlock(this);
8805 } 8793 }
8806 } 8794 }
8807 } 8795 }
8808 // ********** Code for HInstruction ************** 8796 // ********** Code for HInstruction **************
8809 function HInstruction(inputs) { 8797 function HInstruction(inputs) {
8810 this._usedBy = null 8798 this._usedBy = null
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
8844 this.setFlag(2/*HInstruction.FLAG_GENERATE_AT_USE_SITE*/); 8832 this.setFlag(2/*HInstruction.FLAG_GENERATE_AT_USE_SITE*/);
8845 } 8833 }
8846 HInstruction.prototype.setUseGvn = function() { 8834 HInstruction.prototype.setUseGvn = function() {
8847 this.setFlag(3/*HInstruction.FLAG_USE_GVN*/); 8835 this.setFlag(3/*HInstruction.FLAG_USE_GVN*/);
8848 } 8836 }
8849 HInstruction.prototype.get$usedBy = function() { 8837 HInstruction.prototype.get$usedBy = function() {
8850 if ($notnull_bool(this._usedBy == null)) return const$15/*const []*/; 8838 if ($notnull_bool(this._usedBy == null)) return const$15/*const []*/;
8851 return this._usedBy; 8839 return this._usedBy;
8852 } 8840 }
8853 HInstruction.prototype.isInBasicBlock = function() { 8841 HInstruction.prototype.isInBasicBlock = function() {
8854 return $assert_bool(this._usedBy != null); 8842 return this._usedBy != null;
8855 } 8843 }
8856 HInstruction.prototype.notifyAddedToBlock = function() { 8844 HInstruction.prototype.notifyAddedToBlock = function() {
8857 $assert(!$notnull_bool(this.isInBasicBlock()), "!isInBasicBlock()", "nodes.dar t", 472, 12); 8845 $assert(!$notnull_bool(this.isInBasicBlock()), "!isInBasicBlock()", "nodes.dar t", 472, 12);
8858 this._usedBy = []; 8846 this._usedBy = [];
8859 for (var i = 0; 8847 for (var i = 0;
8860 $notnull_bool(i < this.inputs.length); i++) { 8848 $notnull_bool(i < this.inputs.length); i++) {
8861 $assert(this.inputs.$index(i).isInBasicBlock(), "inputs[i].isInBasicBlock()" , "nodes.dart", 476, 14); 8849 $assert(this.inputs.$index(i).isInBasicBlock(), "inputs[i].isInBasicBlock()" , "nodes.dart", 476, 14);
8862 this.inputs.$index(i).get$usedBy().add(this); 8850 this.inputs.$index(i).get$usedBy().add(this);
8863 } 8851 }
8864 $assert(this.isValid(), "isValid()", "nodes.dart", 479, 12); 8852 $assert(this.isValid(), "isValid()", "nodes.dart", 479, 12);
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
9222 } 9210 }
9223 return this.visitArithmetic(node); 9211 return this.visitArithmetic(node);
9224 } 9212 }
9225 // ********** Code for SsaDeadCodeEliminator ************** 9213 // ********** Code for SsaDeadCodeEliminator **************
9226 function SsaDeadCodeEliminator() { 9214 function SsaDeadCodeEliminator() {
9227 HGraphVisitor.call(this); 9215 HGraphVisitor.call(this);
9228 // Initializers done 9216 // Initializers done
9229 } 9217 }
9230 $inherits(SsaDeadCodeEliminator, HGraphVisitor); 9218 $inherits(SsaDeadCodeEliminator, HGraphVisitor);
9231 SsaDeadCodeEliminator.isDeadCode = function(instruction) { 9219 SsaDeadCodeEliminator.isDeadCode = function(instruction) {
9232 return $assert_bool(!$notnull_bool(instruction.hasSideEffects()) && instructio n.get$usedBy().isEmpty()); 9220 return $notnull_bool(!$notnull_bool(instruction.hasSideEffects()) && instructi on.get$usedBy().isEmpty());
9233 } 9221 }
9234 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) { 9222 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) {
9235 this.visitPostDominatorTree(graph); 9223 this.visitPostDominatorTree(graph);
9236 } 9224 }
9237 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) { 9225 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) {
9238 var instruction = block.last; 9226 var instruction = block.last;
9239 while ($notnull_bool(instruction != null)) { 9227 while ($notnull_bool(instruction != null)) {
9240 var previous = instruction.previous; 9228 var previous = instruction.previous;
9241 if ($notnull_bool(SsaDeadCodeEliminator.isDeadCode(instruction))) block.remo ve(instruction); 9229 if ($notnull_bool(SsaDeadCodeEliminator.isDeadCode(instruction))) block.remo ve(instruction);
9242 instruction = (previous && previous.is$HInstruction()); 9230 instruction = (previous && previous.is$HInstruction());
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
9514 } 9502 }
9515 if ($notnull_bool((block.last instanceof HIf) && block.successors.length != 2) ) { 9503 if ($notnull_bool((block.last instanceof HIf) && block.successors.length != 2) ) {
9516 this.markInvalid("If node without two successors"); 9504 this.markInvalid("If node without two successors");
9517 } 9505 }
9518 if ($notnull_bool((block.last instanceof HConditionalBranch) && block.successo rs.length != 2)) { 9506 if ($notnull_bool((block.last instanceof HConditionalBranch) && block.successo rs.length != 2)) {
9519 this.markInvalid("Conditional node without two successors"); 9507 this.markInvalid("Conditional node without two successors");
9520 } 9508 }
9521 if ($notnull_bool((block.last instanceof HGoto) && block.successors.length != 1)) { 9509 if ($notnull_bool((block.last instanceof HGoto) && block.successors.length != 1)) {
9522 this.markInvalid("Goto node without one successor"); 9510 this.markInvalid("Goto node without one successor");
9523 } 9511 }
9524 if ($notnull_bool((block.last instanceof HReturn) && (block.successors.length != 1 || !$notnull_bool(block.successors.$index(0).isExitBlock())))) { 9512 if ($notnull_bool((block.last instanceof HReturn) && ($notnull_bool(block.succ essors.length != 1 || !$notnull_bool(block.successors.$index(0).isExitBlock()))) )) {
9525 this.markInvalid("Return node with > 1 succesor or not going to exit-block") ; 9513 this.markInvalid("Return node with > 1 succesor or not going to exit-block") ;
9526 } 9514 }
9527 if ($notnull_bool((block.last instanceof HExit) && !$notnull_bool(block.succes sors.isEmpty()))) { 9515 if ($notnull_bool((block.last instanceof HExit) && !$notnull_bool(block.succes sors.isEmpty()))) {
9528 this.markInvalid("Exit block with successor"); 9516 this.markInvalid("Exit block with successor");
9529 } 9517 }
9530 if ($notnull_bool((block.last instanceof HThrow) && !$notnull_bool(block.succe ssors.isEmpty()))) { 9518 if ($notnull_bool((block.last instanceof HThrow) && !$notnull_bool(block.succe ssors.isEmpty()))) {
9531 this.markInvalid("Throw block with successor"); 9519 this.markInvalid("Throw block with successor");
9532 } 9520 }
9533 if ($notnull_bool(block.successors.isEmpty() && !(block.last instanceof HThrow ) && !$notnull_bool(block.isExitBlock()))) { 9521 if ($notnull_bool(block.successors.isEmpty() && !(block.last instanceof HThrow )) && !$notnull_bool(block.isExitBlock())) {
9534 this.markInvalid("Non-exit or throw block without successor"); 9522 this.markInvalid("Non-exit or throw block without successor");
9535 } 9523 }
9536 if ($notnull_bool(block.id == null)) this.markInvalid("block without id"); 9524 if ($notnull_bool(block.id == null)) this.markInvalid("block without id");
9537 var $list = block.successors; 9525 var $list = block.successors;
9538 for (var $i = 0;$i < $list.length; $i++) { 9526 for (var $i = 0;$i < $list.length; $i++) {
9539 var successor = $list.$index($i); 9527 var successor = $list.$index($i);
9540 if ($notnull_bool(!$notnull_bool(this.isValid))) break; 9528 if ($notnull_bool(!$notnull_bool(this.isValid))) break;
9541 if ($notnull_bool(successor.id == null)) this.markInvalid("successor without id"); 9529 if ($notnull_bool(successor.id == null)) this.markInvalid("successor without id");
9542 if ($notnull_bool(successor.id <= block.id && !$notnull_bool(successor.isLoo pHeader))) { 9530 if ($notnull_bool(successor.id <= block.id && !$notnull_bool(successor.isLoo pHeader))) {
9543 this.markInvalid("successor with lower id, but not a loop-header"); 9531 this.markInvalid("successor with lower id, but not a loop-header");
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
9599 }) 9587 })
9600 ); 9588 );
9601 } 9589 }
9602 function hasCorrectUses(instruction) { 9590 function hasCorrectUses(instruction) {
9603 if ($notnull_bool(!$notnull_bool(instruction.isInBasicBlock()))) return true ; 9591 if ($notnull_bool(!$notnull_bool(instruction.isInBasicBlock()))) return true ;
9604 return HValidator.everyInstruction(instruction.get$usedBy(), (function (use, count) { 9592 return HValidator.everyInstruction(instruction.get$usedBy(), (function (use, count) {
9605 return HValidator.countInstruction(use.inputs, (instruction && instruction .is$HInstruction())) == count; 9593 return HValidator.countInstruction(use.inputs, (instruction && instruction .is$HInstruction())) == count;
9606 }) 9594 })
9607 ); 9595 );
9608 } 9596 }
9609 this.isValid = $assert_bool(this.isValid && hasCorrectInputs(instruction) && h asCorrectUses(instruction)); 9597 this.isValid = $notnull_bool(this.isValid && hasCorrectInputs(instruction)) && hasCorrectUses(instruction);
9610 } 9598 }
9611 // ********** Code for top level ************** 9599 // ********** Code for top level **************
9612 // ********** Library leg ************** 9600 // ********** Library leg **************
9613 // ********** Code for WorldCompiler ************** 9601 // ********** Code for WorldCompiler **************
9614 function WorldCompiler(world, script) { 9602 function WorldCompiler(world, script) {
9615 this.world = world; 9603 this.world = world;
9616 Compiler.call(this, script); 9604 Compiler.call(this, script);
9617 // Initializers done 9605 // Initializers done
9618 } 9606 }
9619 $inherits(WorldCompiler, Compiler); 9607 $inherits(WorldCompiler, Compiler);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
9853 this.visit(node.condition); 9841 this.visit(node.condition);
9854 this.visit(node.thenPart); 9842 this.visit(node.thenPart);
9855 this.visit(node.elsePart); 9843 this.visit(node.elsePart);
9856 } 9844 }
9857 ResolverVisitor.prototype.visitSend = function(node) { 9845 ResolverVisitor.prototype.visitSend = function(node) {
9858 var $0; 9846 var $0;
9859 var target = null; 9847 var target = null;
9860 this.visit(node.receiver); 9848 this.visit(node.receiver);
9861 var selector = (($0 = node.selector) && $0.is$Identifier()); 9849 var selector = (($0 = node.selector) && $0.is$Identifier());
9862 var name = selector.get$source(); 9850 var name = selector.get$source();
9863 if ($notnull_bool($eq(name, const$247/*const SourceString('+')*/) || $eq(name, const$248/*const SourceString('-')*/) || $eq(name, const$249/*const SourceStrin g('*')*/) || $eq(name, const$250/*const SourceString('/')*/) || $eq(name, const$ 251/*const SourceString('<')*/) || $eq(name, const$252/*const SourceString('~/') */) || $eq(name, const$253/*const SourceString('==')*/))) { 9851 if ($notnull_bool($eq(name, const$247/*const SourceString('+')*/) || $eq(name, const$248/*const SourceString('-')*/)) || $eq(name, const$249/*const SourceStri ng('*')*/) || $eq(name, const$250/*const SourceString('/')*/) || $eq(name, const $251/*const SourceString('<')*/) || $eq(name, const$252/*const SourceString('~/' )*/) || $eq(name, const$253/*const SourceString('==')*/)) {
9864 } 9852 }
9865 else { 9853 else {
9866 target = this.context.lookup(name); 9854 target = this.context.lookup(name);
9867 if ($notnull_bool(target == null)) this.fail(node, ErrorMessages.cannotResol ve(name)); 9855 if ($notnull_bool(target == null)) this.fail(node, ErrorMessages.cannotResol ve(name));
9868 } 9856 }
9869 this.visit(node.argumentsNode); 9857 this.visit(node.argumentsNode);
9870 return this.useElement(node, target); 9858 return this.useElement(node, target);
9871 } 9859 }
9872 ResolverVisitor.prototype.visitSendSet = function(node) { 9860 ResolverVisitor.prototype.visitSendSet = function(node) {
9873 var $0; 9861 var $0;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
9918 } 9906 }
9919 return this.useElement(node, element); 9907 return this.useElement(node, element);
9920 } 9908 }
9921 ResolverVisitor.prototype.visitVariableDefinitions = function(node) { 9909 ResolverVisitor.prototype.visitVariableDefinitions = function(node) {
9922 this.visit(node.type); 9910 this.visit(node.type);
9923 var visitor = new VariableDefinitionsVisitor(node, this); 9911 var visitor = new VariableDefinitionsVisitor(node, this);
9924 visitor.visit(node.definitions); 9912 visitor.visit(node.definitions);
9925 } 9913 }
9926 ResolverVisitor.prototype.defineElement = function(node, element) { 9914 ResolverVisitor.prototype.defineElement = function(node, element) {
9927 var $0; 9915 var $0;
9928 this.compiler.ensure($assert_bool(element != null)); 9916 this.compiler.ensure(element != null);
9929 this.mapping.$setindex(node, element); 9917 this.mapping.$setindex(node, element);
9930 return (($0 = this.context.add(element)) && $0.is$Element()); 9918 return (($0 = this.context.add(element)) && $0.is$Element());
9931 } 9919 }
9932 ResolverVisitor.prototype.useElement = function(node, element) { 9920 ResolverVisitor.prototype.useElement = function(node, element) {
9933 if ($notnull_bool(element == null)) return null; 9921 if ($notnull_bool(element == null)) return null;
9934 this.mapping.$setindex(node, element); 9922 this.mapping.$setindex(node, element);
9935 return element; 9923 return element;
9936 } 9924 }
9937 // ********** Code for VariableDefinitionsVisitor ************** 9925 // ********** Code for VariableDefinitionsVisitor **************
9938 function VariableDefinitionsVisitor(definitions, resolver) { 9926 function VariableDefinitionsVisitor(definitions, resolver) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
10110 } 10098 }
10111 else if ($notnull_bool($eq(const$10/*Types.DYNAMIC*/, s) || s.get$stringValue( ) === 'var')) { 10099 else if ($notnull_bool($eq(const$10/*Types.DYNAMIC*/, s) || s.get$stringValue( ) === 'var')) {
10112 return this.dynamicType; 10100 return this.dynamicType;
10113 } 10101 }
10114 else if ($notnull_bool($eq(const$12/*Types.STRING*/, s))) { 10102 else if ($notnull_bool($eq(const$12/*Types.STRING*/, s))) {
10115 return this.stringType; 10103 return this.stringType;
10116 } 10104 }
10117 return null; 10105 return null;
10118 } 10106 }
10119 Types.prototype.isSubtype = function(r, s) { 10107 Types.prototype.isSubtype = function(r, s) {
10120 return $assert_bool(r === s || r === this.dynamicType || s === this.dynamicTyp e); 10108 return $notnull_bool(r === s || r === this.dynamicType) || s === this.dynamicT ype;
10121 } 10109 }
10122 Types.prototype.isAssignable = function(r, s) { 10110 Types.prototype.isAssignable = function(r, s) {
10123 return $assert_bool(this.isSubtype(r, s) || this.isSubtype(s, r)); 10111 return $notnull_bool(this.isSubtype(r, s) || this.isSubtype(s, r));
10124 } 10112 }
10125 // ********** Code for CancelTypeCheckException ************** 10113 // ********** Code for CancelTypeCheckException **************
10126 function CancelTypeCheckException(node, reason) { 10114 function CancelTypeCheckException(node, reason) {
10127 this.node = node; 10115 this.node = node;
10128 this.reason = reason; 10116 this.reason = reason;
10129 // Initializers done 10117 // Initializers done
10130 } 10118 }
10131 // ********** Code for TypeCheckerVisitor ************** 10119 // ********** Code for TypeCheckerVisitor **************
10132 function TypeCheckerVisitor(compiler, elements, types) { 10120 function TypeCheckerVisitor(compiler, elements, types) {
10133 this.compiler = compiler; 10121 this.compiler = compiler;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
10229 } 10217 }
10230 if ($notnull_bool(!$notnull_bool(arguments.isEmpty()))) { 10218 if ($notnull_bool(!$notnull_bool(arguments.isEmpty()))) {
10231 this.compiler.reportWarning(arguments.get$head(), 'additional arguments' ); 10219 this.compiler.reportWarning(arguments.get$head(), 'additional arguments' );
10232 } 10220 }
10233 return funType.returnType; 10221 return funType.returnType;
10234 } 10222 }
10235 } 10223 }
10236 else { 10224 else {
10237 var selector = (($0 = node.selector) && $0.is$Identifier()); 10225 var selector = (($0 = node.selector) && $0.is$Identifier());
10238 var name = selector.get$source(); 10226 var name = selector.get$source();
10239 if ($notnull_bool($eq(name, const$247/*const SourceString('+')*/) || $eq(nam e, const$257/*const SourceString('=')*/) || $eq(name, const$248/*const SourceStr ing('-')*/) || $eq(name, const$249/*const SourceString('*')*/) || $eq(name, cons t$250/*const SourceString('/')*/) || $eq(name, const$251/*const SourceString('<' )*/) || $eq(name, const$252/*const SourceString('~/')*/))) { 10227 if ($notnull_bool($eq(name, const$247/*const SourceString('+')*/) || $eq(nam e, const$257/*const SourceString('=')*/)) || $eq(name, const$248/*const SourceSt ring('-')*/) || $eq(name, const$249/*const SourceString('*')*/) || $eq(name, con st$250/*const SourceString('/')*/) || $eq(name, const$251/*const SourceString('< ')*/) || $eq(name, const$252/*const SourceString('~/')*/)) {
10240 return this.types.dynamicType; 10228 return this.types.dynamicType;
10241 } 10229 }
10242 this.fail(node, ('unresolved send ' + name + '')); 10230 this.fail(node, ('unresolved send ' + name + ''));
10243 } 10231 }
10244 } 10232 }
10245 TypeCheckerVisitor.prototype.visitSendSet = function(node) { 10233 TypeCheckerVisitor.prototype.visitSendSet = function(node) {
10246 var $0; 10234 var $0;
10247 this.compiler.ensure($assert_bool(node.get$arguments() != null && !$notnull_bo ol(node.get$arguments().isEmpty()))); 10235 this.compiler.ensure($notnull_bool(node.get$arguments() != null && !$notnull_b ool(node.get$arguments().isEmpty())));
10248 var targetType = (($0 = this.elements.$index(node).computeType(this.compiler, this.types)) && $0.is$Type()); 10236 var targetType = (($0 = this.elements.$index(node).computeType(this.compiler, this.types)) && $0.is$Type());
10249 var value = (($0 = node.get$arguments().get$head()) && $0.is$Node()); 10237 var value = (($0 = node.get$arguments().get$head()) && $0.is$Node());
10250 this.checkAssignable(value, this.type(value), targetType); 10238 this.checkAssignable(value, this.type(value), targetType);
10251 return targetType; 10239 return targetType;
10252 } 10240 }
10253 TypeCheckerVisitor.prototype.visitLiteralInt = function(node) { 10241 TypeCheckerVisitor.prototype.visitLiteralInt = function(node) {
10254 return this.types.intType; 10242 return this.types.intType;
10255 } 10243 }
10256 TypeCheckerVisitor.prototype.visitLiteralDouble = function(node) { 10244 TypeCheckerVisitor.prototype.visitLiteralDouble = function(node) {
10257 return this.types.dynamicType; 10245 return this.types.dynamicType;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
10305 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) { 10293 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) {
10306 var $0; 10294 var $0;
10307 var type = this.typeWithDefault(node.type, this.types.dynamicType); 10295 var type = this.typeWithDefault(node.type, this.types.dynamicType);
10308 if ($notnull_bool($eq(type, this.types.voidType))) { 10296 if ($notnull_bool($eq(type, this.types.voidType))) {
10309 this.compiler.reportWarning(node.type, CompilerError.voidVariable()); 10297 this.compiler.reportWarning(node.type, CompilerError.voidVariable());
10310 type = this.types.dynamicType; 10298 type = this.types.dynamicType;
10311 } 10299 }
10312 for (var link = node.definitions.nodes; 10300 for (var link = node.definitions.nodes;
10313 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { 10301 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) {
10314 var initialization = (($0 = link.get$head()) && $0.is$Node()); 10302 var initialization = (($0 = link.get$head()) && $0.is$Node());
10315 this.compiler.ensure($assert_bool((initialization instanceof Identifier) || (initialization instanceof Send))); 10303 this.compiler.ensure($notnull_bool((initialization instanceof Identifier) || (initialization instanceof Send)));
10316 if ($notnull_bool((initialization instanceof Send))) { 10304 if ($notnull_bool((initialization instanceof Send))) {
10317 var initializer = this.nonVoidType((($0 = link.get$head()) && $0.is$Node() )); 10305 var initializer = this.nonVoidType((($0 = link.get$head()) && $0.is$Node() ));
10318 this.checkAssignable(node, type, initializer); 10306 this.checkAssignable(node, type, initializer);
10319 } 10307 }
10320 } 10308 }
10321 return null; 10309 return null;
10322 } 10310 }
10323 // ********** Code for Universe ************** 10311 // ********** Code for Universe **************
10324 function Universe() { 10312 function Universe() {
10325 this.elements = $map([]); 10313 this.elements = $map([]);
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
10603 if ($notnull_bool(type.get$isFunction() && type.varStubs != null)) { 10591 if ($notnull_bool(type.get$isFunction() && type.varStubs != null)) {
10604 this.writer.comment(('// ********** Code for ' + type.get$jsname() + ' *** ***********')); 10592 this.writer.comment(('// ********** Code for ' + type.get$jsname() + ' *** ***********'));
10605 this._writeDynamicStubs((type && type.is$lang_Type())); 10593 this._writeDynamicStubs((type && type.is$lang_Type()));
10606 } 10594 }
10607 if ($notnull_bool(type.typeCheckCode != null)) { 10595 if ($notnull_bool(type.typeCheckCode != null)) {
10608 this.writer.writeln(type.typeCheckCode); 10596 this.writer.writeln(type.typeCheckCode);
10609 } 10597 }
10610 } 10598 }
10611 } 10599 }
10612 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { 10600 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) {
10613 if ($notnull_bool(!$notnull_bool(meth.isGenerated) && !$notnull_bool(meth.get$ isAbstract()) && $ne(meth.get$definition(), null))) { 10601 if ($notnull_bool(!$notnull_bool(meth.isGenerated) && !$notnull_bool(meth.get$ isAbstract())) && $ne(meth.get$definition(), null)) {
10614 new MethodGenerator(meth, enclosingMethod).run(); 10602 new MethodGenerator(meth, enclosingMethod).run();
10615 } 10603 }
10616 } 10604 }
10617 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { 10605 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) {
10618 if ($notnull_bool(!$notnull_bool(checkType.isTested))) return; 10606 if ($notnull_bool(!$notnull_bool(checkType.isTested))) return;
10619 var value = 'false'; 10607 var value = 'false';
10620 if ($notnull_bool(onType.isSubtypeOf(checkType))) { 10608 if ($notnull_bool(onType.isSubtypeOf(checkType))) {
10621 value = 'function(){return this;}'; 10609 value = 'function(){return this;}';
10622 } 10610 }
10623 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType. get$jsname() + ' = ') + ('' + value + ';')); 10611 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType. get$jsname() + ' = ') + ('' + value + ';'));
10624 } 10612 }
10625 WorldGenerator.prototype.writeType = function(type) { 10613 WorldGenerator.prototype.writeType = function(type) {
10626 var $0; 10614 var $0;
10627 if ($notnull_bool(type.name != null && (type instanceof ConcreteType) && $eq(t ype.get$library(), world.get$coreimpl()) && type.name.startsWith('ListFactory')) ) { 10615 if ($notnull_bool(type.name != null && (type instanceof ConcreteType)) && $eq( type.get$library(), world.get$coreimpl()) && type.name.startsWith('ListFactory') ) {
10628 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType() .get$jsname() + ';')); 10616 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType() .get$jsname() + ';'));
10629 return; 10617 return;
10630 } 10618 }
10631 var typeName = $notnull_bool(type.get$jsname() != null) ? type.get$jsname() : 'top level'; 10619 var typeName = $notnull_bool(type.get$jsname() != null) ? type.get$jsname() : 'top level';
10632 this.writer.comment(('// ********** Code for ' + typeName + ' **************') ); 10620 this.writer.comment(('// ********** Code for ' + typeName + ' **************') );
10633 if ($notnull_bool(type.get$isNativeType() && !$notnull_bool(type.get$isTop())) ) { 10621 if ($notnull_bool(type.get$isNativeType() && !$notnull_bool(type.get$isTop())) ) {
10634 var nativeName = type.get$definition().get$nativeType(); 10622 var nativeName = type.get$definition().get$nativeType();
10635 if ($notnull_bool($eq(nativeName, ''))) { 10623 if ($notnull_bool($eq(nativeName, ''))) {
10636 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); 10624 this.writer.writeln(('function ' + type.get$jsname() + '() {}'));
10637 } 10625 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
10748 var value = this.globals.$index(fullname); 10736 var value = this.globals.$index(fullname);
10749 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.is Native))) { 10737 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.is Native))) {
10750 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code + ';')); 10738 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code + ';'));
10751 } 10739 }
10752 else { 10740 else {
10753 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g et$jsname() + ' = ' + value.exp.code + ';')); 10741 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g et$jsname() + ' = ' + value.exp.code + ';'));
10754 } 10742 }
10755 } 10743 }
10756 } 10744 }
10757 WorldGenerator.prototype._writeField = function(field) { 10745 WorldGenerator.prototype._writeField = function(field) {
10758 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.isNa tive) && field.value == null)) { 10746 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.isNa tive)) && field.value == null) {
10759 this.writer.writeln(('var ' + field.get$jsname() + ';')); 10747 this.writer.writeln(('var ' + field.get$jsname() + ';'));
10760 } 10748 }
10761 if ($notnull_bool(field._providePropertySyntax)) { 10749 if ($notnull_bool(field._providePropertySyntax)) {
10762 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get \$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn ame() + '; };')); 10750 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get \$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn ame() + '; };'));
10763 if ($notnull_bool(!$notnull_bool(field.isFinal))) { 10751 if ($notnull_bool(!$notnull_bool(field.isFinal))) {
10764 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.s et\$' + field.get$jsname() + ' = ') + ('function(value) { return this.' + field. get$jsname() + ' = value; };')); 10752 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.s et\$' + field.get$jsname() + ' = ') + ('function(value) { return this.' + field. get$jsname() + ' = value; };'));
10765 } 10753 }
10766 } 10754 }
10767 } 10755 }
10768 WorldGenerator.prototype._writeProperty = function(property) { 10756 WorldGenerator.prototype._writeProperty = function(property) {
(...skipping 13 matching lines...) Expand all
10782 } 10770 }
10783 WorldGenerator.prototype._writeMethod = function(method) { 10771 WorldGenerator.prototype._writeMethod = function(method) {
10784 if ($notnull_bool(method.generator != null)) { 10772 if ($notnull_bool(method.generator != null)) {
10785 method.generator.writeDefinition(this.writer, null); 10773 method.generator.writeDefinition(this.writer, null);
10786 } 10774 }
10787 } 10775 }
10788 WorldGenerator.prototype.get$_writeMethod = function() { 10776 WorldGenerator.prototype.get$_writeMethod = function() {
10789 return WorldGenerator.prototype._writeMethod.bind(this); 10777 return WorldGenerator.prototype._writeMethod.bind(this);
10790 } 10778 }
10791 WorldGenerator.prototype._writeGlobals = function() { 10779 WorldGenerator.prototype._writeGlobals = function() {
10792 var $0;
10793 if ($notnull_bool(this.globals.get$length() > 0)) { 10780 if ($notnull_bool(this.globals.get$length() > 0)) {
10794 this.writer.comment('// ********** Globals **************'); 10781 this.writer.comment('// ********** Globals **************');
10795 } 10782 }
10796 var list = this.globals.getValues(); 10783 var list = this.globals.getValues();
10797 list.sort((function (a, b) { 10784 list.sort((function (a, b) {
10798 return a.compareTo(b); 10785 return a.compareTo(b);
10799 }) 10786 })
10800 ); 10787 );
10801 for (var $i = list.iterator(); $i.hasNext(); ) { 10788 for (var $i = list.iterator(); $i.hasNext(); ) {
10802 var global = $i.next(); 10789 var global = $i.next();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
10840 function BlockScope(enclosingMethod, parent, reentrant) { 10827 function BlockScope(enclosingMethod, parent, reentrant) {
10841 this.enclosingMethod = enclosingMethod; 10828 this.enclosingMethod = enclosingMethod;
10842 this.parent = parent; 10829 this.parent = parent;
10843 this.reentrant = reentrant; 10830 this.reentrant = reentrant;
10844 this._vars = $map([]); 10831 this._vars = $map([]);
10845 // Initializers done 10832 // Initializers done
10846 if ($notnull_bool(this.get$isMethodScope())) { 10833 if ($notnull_bool(this.get$isMethodScope())) {
10847 this._closedOver = new HashSetImplementation$String(); 10834 this._closedOver = new HashSetImplementation$String();
10848 } 10835 }
10849 else { 10836 else {
10850 this.reentrant = $assert_bool(this.reentrant || this.parent.reentrant); 10837 this.reentrant = $notnull_bool(this.reentrant || this.parent.reentrant);
10851 } 10838 }
10852 } 10839 }
10853 BlockScope.prototype.is$BlockScope = function(){return this;}; 10840 BlockScope.prototype.is$BlockScope = function(){return this;};
10854 BlockScope.prototype.get$parent = function() { return this.parent; }; 10841 BlockScope.prototype.get$parent = function() { return this.parent; };
10855 BlockScope.prototype.set$parent = function(value) { return this.parent = value; }; 10842 BlockScope.prototype.set$parent = function(value) { return this.parent = value; };
10856 BlockScope.prototype.get$isMethodScope = function() { 10843 BlockScope.prototype.get$isMethodScope = function() {
10857 return $assert_bool(this.parent == null || $ne(this.parent.enclosingMethod, th is.enclosingMethod)); 10844 return $notnull_bool(this.parent == null || $ne(this.parent.enclosingMethod, t his.enclosingMethod));
10858 } 10845 }
10859 BlockScope.prototype.get$methodScope = function() { 10846 BlockScope.prototype.get$methodScope = function() {
10860 var s = this; 10847 var s = this;
10861 while ($notnull_bool(!$notnull_bool(s.get$isMethodScope()))) s = s.get$parent( ); 10848 while ($notnull_bool(!$notnull_bool(s.get$isMethodScope()))) s = s.get$parent( );
10862 return (s && s.is$BlockScope()); 10849 return (s && s.is$BlockScope());
10863 } 10850 }
10864 BlockScope.prototype.lookup = function(name) { 10851 BlockScope.prototype.lookup = function(name) {
10865 var ret = this._vars.$index(name); 10852 var ret = this._vars.$index(name);
10866 if ($notnull_bool($ne(ret, null))) return ret; 10853 if ($notnull_bool($ne(ret, null))) return ret;
10867 for (var s = this.parent; 10854 for (var s = this.parent;
(...skipping 14 matching lines...) Expand all
10882 if ($notnull_bool(this.get$isMethodScope() && this._closedOver.contains(name)) ) return true; 10869 if ($notnull_bool(this.get$isMethodScope() && this._closedOver.contains(name)) ) return true;
10883 for (var s = this.parent; 10870 for (var s = this.parent;
10884 $notnull_bool($ne(s, null)); s = s.get$parent()) { 10871 $notnull_bool($ne(s, null)); s = s.get$parent()) {
10885 if ($notnull_bool(s._vars.containsKey(name))) return true; 10872 if ($notnull_bool(s._vars.containsKey(name))) return true;
10886 if ($notnull_bool(s.get$isMethodScope() && s._closedOver.contains(name))) re turn true; 10873 if ($notnull_bool(s.get$isMethodScope() && s._closedOver.contains(name))) re turn true;
10887 } 10874 }
10888 var type = this.enclosingMethod.method.declaringType; 10875 var type = this.enclosingMethod.method.declaringType;
10889 if ($notnull_bool(type.get$library().lookup(name, null) != null)) return true; 10876 if ($notnull_bool(type.get$library().lookup(name, null) != null)) return true;
10890 return false; 10877 return false;
10891 } 10878 }
10892 BlockScope.prototype.create = function(name, type, location, isParameter) { 10879 BlockScope.prototype.create = function(name, type, span, isParameter) {
10893 var jsName = world.toJsIdentifier(name); 10880 var jsName = world.toJsIdentifier(name);
10894 if ($notnull_bool(this._vars.containsKey(name))) { 10881 if ($notnull_bool(this._vars.containsKey(name))) {
10895 if ($notnull_bool(location != null)) { 10882 world.error(('duplicate name "' + name + '"'), span);
10896 world.error(('duplicate name "' + name + '"'), location.span);
10897 }
10898 else {
10899 world.internalError(('conflict with temporary name "' + name + '"'));
10900 }
10901 } 10883 }
10902 if ($notnull_bool(!$notnull_bool(isParameter))) { 10884 if ($notnull_bool(!$notnull_bool(isParameter))) {
10903 var index = 0; 10885 var index = 0;
10904 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) { 10886 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) {
10905 jsName = ('' + name + '' + index++ + ''); 10887 jsName = ('' + name + '' + index++ + '');
10906 } 10888 }
10907 } 10889 }
10908 var ret = new Value(type, jsName, $notnull_bool(location != null) ? location.s pan : null, false, false, false); 10890 var ret = new Value(type, jsName, span, false);
10909 this._vars.$setindex(name, ret); 10891 this._vars.$setindex(name, ret);
10910 return (ret && ret.is$Value()); 10892 return (ret && ret.is$Value());
10911 } 10893 }
10912 BlockScope.prototype.declareParameter = function(p) { 10894 BlockScope.prototype.declareParameter = function(p) {
10913 return this.create(p.name, p.type, p.definition, true); 10895 return this.create(p.name, p.type, p.definition.span, true);
10914 } 10896 }
10915 BlockScope.prototype.declare = function(id) { 10897 BlockScope.prototype.declare = function(id) {
10916 var type = this.enclosingMethod.method.resolveType(id.type, false); 10898 var type = this.enclosingMethod.method.resolveType(id.type, false);
10917 return this.create(id.name.name, (type && type.is$lang_Type()), id, false); 10899 return this.create(id.name.name, (type && type.is$lang_Type()), id.span, false );
10918 } 10900 }
10919 BlockScope.prototype.getRethrow = function() { 10901 BlockScope.prototype.getRethrow = function() {
10920 var scope = this; 10902 var scope = this;
10921 while ($notnull_bool(scope.rethrow == null && $ne(scope.get$parent(), null))) { 10903 while ($notnull_bool(scope.rethrow == null && $ne(scope.get$parent(), null))) {
10922 scope = scope.get$parent(); 10904 scope = scope.get$parent();
10923 } 10905 }
10924 return scope.rethrow; 10906 return scope.rethrow;
10925 } 10907 }
10926 // ********** Code for MethodGenerator ************** 10908 // ********** Code for MethodGenerator **************
10927 function MethodGenerator(method, enclosingMethod) { 10909 function MethodGenerator(method, enclosingMethod) {
10928 var $0; 10910 var $0;
10929 this.method = method; 10911 this.method = method;
10930 this.enclosingMethod = enclosingMethod; 10912 this.enclosingMethod = enclosingMethod;
10931 this.writer = new CodeWriter(); 10913 this.writer = new CodeWriter();
10932 this.needsThis = false; 10914 this.needsThis = false;
10933 // Initializers done 10915 // Initializers done
10934 if ($notnull_bool(this.enclosingMethod != null)) { 10916 if ($notnull_bool(this.enclosingMethod != null)) {
10935 this._scope = new BlockScope(this, this.enclosingMethod._scope, false); 10917 this._scope = new BlockScope(this, this.enclosingMethod._scope, false);
10936 this.captures = new HashSetImplementation(); 10918 this.captures = new HashSetImplementation();
10937 } 10919 }
10938 else { 10920 else {
10939 this._scope = new BlockScope(this, null, false); 10921 this._scope = new BlockScope(this, null, false);
10940 } 10922 }
10941 if ($notnull_bool(this.enclosingMethod != null && this.method.name != '')) { 10923 if ($notnull_bool(this.enclosingMethod != null && this.method.name != '')) {
10942 var m = (($0 = this.method) && $0.is$MethodMember()); 10924 var m = (($0 = this.method) && $0.is$MethodMember());
10943 this._scope.create(m.name, m.get$functionType(), m.definition, false); 10925 this._scope.create(m.name, m.get$functionType(), m.definition.span, false);
10944 } 10926 }
10945 this._usedTemps = new HashSetImplementation(); 10927 this._usedTemps = new HashSetImplementation();
10946 this._freeTemps = []; 10928 this._freeTemps = [];
10947 } 10929 }
10948 MethodGenerator.prototype.is$MethodGenerator = function(){return this;}; 10930 MethodGenerator.prototype.is$MethodGenerator = function(){return this;};
10949 MethodGenerator.prototype.get$library = function() { 10931 MethodGenerator.prototype.get$library = function() {
10950 return this.method.get$library(); 10932 return this.method.get$library();
10951 } 10933 }
10952 MethodGenerator.prototype.findMembers = function(name) { 10934 MethodGenerator.prototype.findMembers = function(name) {
10953 return this.get$library()._findMembers(name); 10935 return this.get$library()._findMembers(name);
10954 } 10936 }
10955 MethodGenerator.prototype.get$isClosure = function() { 10937 MethodGenerator.prototype.get$isClosure = function() {
10956 return (this.enclosingMethod != null); 10938 return (this.enclosingMethod != null);
10957 } 10939 }
10958 MethodGenerator.prototype.get$isStatic = function() { 10940 MethodGenerator.prototype.get$isStatic = function() {
10959 return this.method.get$isStatic(); 10941 return this.method.get$isStatic();
10960 } 10942 }
10961 MethodGenerator.prototype.getTemp = function(value) { 10943 MethodGenerator.prototype.getTemp = function(value) {
10962 return $notnull_bool(value.needsTemp) ? this.forceTemp(value) : value; 10944 return $notnull_bool(value.needsTemp) ? this.forceTemp(value) : value;
10963 } 10945 }
10964 MethodGenerator.prototype.forceTemp = function(value) { 10946 MethodGenerator.prototype.forceTemp = function(value) {
10965 var name; 10947 var name;
10966 if ($notnull_bool(this._freeTemps.length > 0)) { 10948 if ($notnull_bool(this._freeTemps.length > 0)) {
10967 name = $assert_String(this._freeTemps.removeLast()); 10949 name = $assert_String(this._freeTemps.removeLast());
10968 } 10950 }
10969 else { 10951 else {
10970 name = '\$' + this._usedTemps.get$length(); 10952 name = '\$' + this._usedTemps.get$length();
10971 } 10953 }
10972 this._usedTemps.add(name); 10954 this._usedTemps.add(name);
10973 return new Value(value.type, name, value.span, false, false, false); 10955 return new Value(value.type, name, value.span, false);
10974 } 10956 }
10975 MethodGenerator.prototype.assignTemp = function(tmp, v) { 10957 MethodGenerator.prototype.assignTemp = function(tmp, v) {
10976 if ($notnull_bool($eq(tmp, v))) { 10958 if ($notnull_bool($eq(tmp, v))) {
10977 return v; 10959 return v;
10978 } 10960 }
10979 else { 10961 else {
10980 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), v.span, fa lse, true, false); 10962 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), v.span, tr ue);
10981 } 10963 }
10982 } 10964 }
10983 MethodGenerator.prototype.freeTemp = function(value) { 10965 MethodGenerator.prototype.freeTemp = function(value) {
10984 if ($notnull_bool(this._usedTemps.remove(value.code))) { 10966 if ($notnull_bool(this._usedTemps.remove(value.code))) {
10985 this._freeTemps.add(value.code); 10967 this._freeTemps.add(value.code);
10986 } 10968 }
10987 else { 10969 else {
10988 world.internalError(('tried to free unused value or non-temp "' + value.code + '"')); 10970 world.internalError(('tried to free unused value or non-temp "' + value.code + '"'));
10989 } 10971 }
10990 } 10972 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
11056 else if ($notnull_bool(this.method.get$isStatic())) { 11038 else if ($notnull_bool(this.method.get$isStatic())) {
11057 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th is.method.get$jsname() + ' = function' + _params + ' {')); 11039 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th is.method.get$jsname() + ' = function' + _params + ' {'));
11058 } 11040 }
11059 else { 11041 else {
11060 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {')); 11042 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {'));
11061 } 11043 }
11062 if ($notnull_bool(this.needsThis)) { 11044 if ($notnull_bool(this.needsThis)) {
11063 defWriter.writeln('var \$this = this; // closure support'); 11045 defWriter.writeln('var \$this = this; // closure support');
11064 } 11046 }
11065 if ($notnull_bool(this._usedTemps.get$length() > 0 || this._freeTemps.length > 0)) { 11047 if ($notnull_bool(this._usedTemps.get$length() > 0 || this._freeTemps.length > 0)) {
11066 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da rt", 701, 14); 11048 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da rt", 695, 14);
11067 this._freeTemps.addAll(this._usedTemps); 11049 this._freeTemps.addAll(this._usedTemps);
11068 this._freeTemps.sort((function (x, y) { 11050 this._freeTemps.sort((function (x, y) {
11069 return x.compareTo(y); 11051 return x.compareTo(y);
11070 }) 11052 })
11071 ); 11053 );
11072 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); 11054 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';'));
11073 } 11055 }
11074 defWriter.writeln(this.writer.get$text()); 11056 defWriter.writeln(this.writer.get$text());
11075 if ($notnull_bool($ne(names, null))) { 11057 if ($notnull_bool($ne(names, null))) {
11076 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List $String()), ", ") + ')')); 11058 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List $String()), ", ") + ')'));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
11154 for (var $i = 0;$i < $list.length; $i++) { 11136 for (var $i = 0;$i < $list.length; $i++) {
11155 var p = $list.$index($i); 11137 var p = $list.$index($i);
11156 if ($notnull_bool($ne(initializers, null) && p.isInitializer)) { 11138 if ($notnull_bool($ne(initializers, null) && p.isInitializer)) {
11157 var field = this.method.declaringType.getMember(p.get$name()); 11139 var field = this.method.declaringType.getMember(p.get$name());
11158 if ($notnull_bool(field == null)) { 11140 if ($notnull_bool(field == null)) {
11159 world.error('bad this parameter - no matching field', p.get$definition() .get$span()); 11141 world.error('bad this parameter - no matching field', p.get$definition() .get$span());
11160 } 11142 }
11161 if ($notnull_bool(!$notnull_bool(field.get$isField()))) { 11143 if ($notnull_bool(!$notnull_bool(field.get$isField()))) {
11162 world.error(('"this.' + p.get$name() + '" does not refer to a field'), p .get$definition().get$span()); 11144 world.error(('"this.' + p.get$name() + '" does not refer to a field'), p .get$definition().get$span());
11163 } 11145 }
11164 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def inition().get$span(), false, false, false); 11146 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def inition().get$span(), false);
11165 this._paramCode.add(paramValue.code); 11147 this._paramCode.add(paramValue.code);
11166 initializers.add(('this.' + field.get$jsname() + ' = ' + paramValue.code + ';')); 11148 initializers.add(('this.' + field.get$jsname() + ' = ' + paramValue.code + ';'));
11167 initializedFields.add(p.get$name()); 11149 initializedFields.add(p.get$name());
11168 } 11150 }
11169 else { 11151 else {
11170 var paramValue = this._scope.declareParameter((p && p.is$Parameter())); 11152 var paramValue = this._scope.declareParameter((p && p.is$Parameter()));
11171 this._paramCode.add(paramValue.code); 11153 this._paramCode.add(paramValue.code);
11172 } 11154 }
11173 } 11155 }
11174 var body = this.method.get$definition().body; 11156 var body = this.method.get$definition().body;
(...skipping 11 matching lines...) Expand all
11186 for (var $i = 0;$i < declaredInitializers.length; $i++) { 11168 for (var $i = 0;$i < declaredInitializers.length; $i++) {
11187 var init = declaredInitializers.$index($i); 11169 var init = declaredInitializers.$index($i);
11188 if ($notnull_bool((init instanceof CallExpression))) { 11170 if ($notnull_bool((init instanceof CallExpression))) {
11189 if ($notnull_bool($ne(initializerCall, null))) { 11171 if ($notnull_bool($ne(initializerCall, null))) {
11190 world.error('only one initializer redirecting call is allowed', init .get$span()); 11172 world.error('only one initializer redirecting call is allowed', init .get$span());
11191 } 11173 }
11192 initializerCall = init; 11174 initializerCall = init;
11193 } 11175 }
11194 else if ($notnull_bool((init instanceof BinaryExpression) && TokenKind.k indFromAssign(init.op.kind) == 0)) { 11176 else if ($notnull_bool((init instanceof BinaryExpression) && TokenKind.k indFromAssign(init.op.kind) == 0)) {
11195 var left = init.x; 11177 var left = init.x;
11196 if ($notnull_bool(!$notnull_bool(((left instanceof DotExpression) && ( left.self instanceof ThisExpression) || (left instanceof VarExpression))))) { 11178 if ($notnull_bool(!$notnull_bool(($notnull_bool((left instanceof DotEx pression) && (left.self instanceof ThisExpression)) || (left instanceof VarExpre ssion))))) {
11197 world.error('invalid left side of initializer', left.get$span()); 11179 world.error('invalid left side of initializer', left.get$span());
11198 continue; 11180 continue;
11199 } 11181 }
11200 initializedFields.add(left.get$name().get$name()); 11182 initializedFields.add(left.get$name().get$name());
11201 var assign = this._makeThisValue(null).set_(this, $assert_String(left. get$name().get$name()), (($0 = left.get$name()) && $0.is$lang_Node()), (($0 = th is.visitValue(init.y)) && $0.is$Value()), false); 11183 var assign = this._makeThisValue(null).set_(this, $assert_String(left. get$name().get$name()), (($0 = left.get$name()) && $0.is$lang_Node()), (($0 = th is.visitValue(init.y)) && $0.is$Value()), false);
11202 this.writer.writeln(('' + assign.code + ';')); 11184 this.writer.writeln(('' + assign.code + ';'));
11203 } 11185 }
11204 else { 11186 else {
11205 world.error('invalid initializer', init.get$span()); 11187 world.error('invalid initializer', init.get$span());
11206 } 11188 }
(...skipping 21 matching lines...) Expand all
11228 else { 11210 else {
11229 } 11211 }
11230 } 11212 }
11231 this.writer.comment('// Initializers done'); 11213 this.writer.comment('// Initializers done');
11232 } 11214 }
11233 if ($notnull_bool($ne(initializedFields, null))) { 11215 if ($notnull_bool($ne(initializedFields, null))) {
11234 var $list = this.method.declaringType.get$members().getKeys(); 11216 var $list = this.method.declaringType.get$members().getKeys();
11235 for (var $i = this.method.declaringType.get$members().getKeys().iterator(); $i.hasNext(); ) { 11217 for (var $i = this.method.declaringType.get$members().getKeys().iterator(); $i.hasNext(); ) {
11236 var name = $i.next(); 11218 var name = $i.next();
11237 var member = this.method.declaringType.get$members().$index(name); 11219 var member = this.method.declaringType.get$members().$index(name);
11238 if ($notnull_bool((member instanceof FieldMember) && member.isFinal && !$n otnull_bool(member.get$isStatic()) && !$notnull_bool(initializedFields.contains( name)))) { 11220 if ($notnull_bool((member instanceof FieldMember) && member.isFinal) && !$ notnull_bool(member.get$isStatic()) && !$notnull_bool(initializedFields.contains (name))) {
11239 world.error(('Field "' + name + '" is final and was not initialized'), t his.method.get$definition().get$span()); 11221 world.error(('Field "' + name + '" is final and was not initialized'), t his.method.get$definition().get$span());
11240 } 11222 }
11241 } 11223 }
11242 } 11224 }
11243 this.visitStatementsInBlock((body && body.is$lang_Statement())); 11225 this.visitStatementsInBlock((body && body.is$lang_Statement()));
11244 } 11226 }
11245 MethodGenerator.prototype._writeInitializerCall = function(node) { 11227 MethodGenerator.prototype._writeInitializerCall = function(node) {
11246 var contructorName = ''; 11228 var contructorName = '';
11247 var targetExp = node.target; 11229 var targetExp = node.target;
11248 if ($notnull_bool((targetExp instanceof DotExpression))) { 11230 if ($notnull_bool((targetExp instanceof DotExpression))) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
11365 var name = node.names.$index(i).get$name(); 11347 var name = node.names.$index(i).get$name();
11366 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr ession())); 11348 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr ession()));
11367 if ($notnull_bool(isFinal)) { 11349 if ($notnull_bool(isFinal)) {
11368 if ($notnull_bool(value == null)) { 11350 if ($notnull_bool(value == null)) {
11369 world.error('no value specified for final variable', node.span); 11351 world.error('no value specified for final variable', node.span);
11370 } 11352 }
11371 else { 11353 else {
11372 if ($notnull_bool(thisType.get$isVar())) thisType = value.type; 11354 if ($notnull_bool(thisType.get$isVar())) thisType = value.type;
11373 } 11355 }
11374 } 11356 }
11375 var val = this._scope.create($assert_String(name), (thisType && thisType.is$ lang_Type()), (($0 = node.names.$index(i)) && $0.is$lang_Node()), false); 11357 var val = this._scope.create($assert_String(name), (thisType && thisType.is$ lang_Type()), node.names.$index(i).get$span(), false);
11376 if ($notnull_bool(value == null)) { 11358 if ($notnull_bool(value == null)) {
11377 this.writer.write(('' + val.code + '')); 11359 this.writer.write(('' + val.code + ''));
11378 } 11360 }
11379 else { 11361 else {
11380 value = value.convertTo(this, (type && type.is$lang_Type()), (($0 = node.v alues.$index(i)) && $0.is$lang_Node()), false); 11362 value = value.convertTo(this, (type && type.is$lang_Type()), (($0 = node.v alues.$index(i)) && $0.is$lang_Node()), false);
11381 this.writer.write(('' + val.code + ' = ' + value.code + '')); 11363 this.writer.write(('' + val.code + ' = ' + value.code + ''));
11382 } 11364 }
11383 } 11365 }
11384 this.writer.writeln(';'); 11366 this.writer.writeln(';');
11385 return false; 11367 return false;
11386 } 11368 }
11387 MethodGenerator.prototype.visitFunctionDefinition = function(node) { 11369 MethodGenerator.prototype.visitFunctionDefinition = function(node) {
11388 var $0; 11370 var $0;
11389 var name = world.toJsIdentifier(node.name.name); 11371 var name = world.toJsIdentifier(node.name.name);
11390 var meth = this._makeLambdaMethod($assert_String(name), node); 11372 var meth = this._makeLambdaMethod($assert_String(name), node);
11391 var funcValue = this._scope.create($assert_String(name), (($0 = meth.get$funct ionType()) && $0.is$lang_Type()), (($0 = this.method.get$definition()) && $0.is$ lang_Node()), false); 11373 var funcValue = this._scope.create($assert_String(name), (($0 = meth.get$funct ionType()) && $0.is$lang_Type()), this.method.get$definition().get$span(), false );
11392 meth.generator.writeDefinition(this.writer, null); 11374 meth.generator.writeDefinition(this.writer, null);
11393 return false; 11375 return false;
11394 } 11376 }
11395 MethodGenerator.prototype.visitReturnStatement = function(node) { 11377 MethodGenerator.prototype.visitReturnStatement = function(node) {
11396 if ($notnull_bool(node.value == null)) { 11378 if ($notnull_bool(node.value == null)) {
11397 this.writer.writeln('return;'); 11379 this.writer.writeln('return;');
11398 } 11380 }
11399 else { 11381 else {
11400 if ($notnull_bool(this.method.get$isConstructor())) { 11382 if ($notnull_bool(this.method.get$isConstructor())) {
11401 world.error('return of value not allowed from constructor', node.span); 11383 world.error('return of value not allowed from constructor', node.span);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
11512 this._popBlock(); 11494 this._popBlock();
11513 this._popBlock(); 11495 this._popBlock();
11514 return false; 11496 return false;
11515 } 11497 }
11516 MethodGenerator.prototype.visitForInStatement = function(node) { 11498 MethodGenerator.prototype.visitForInStatement = function(node) {
11517 var $0; 11499 var $0;
11518 var itemType = this.method.resolveType(node.item.type, false); 11500 var itemType = this.method.resolveType(node.item.type, false);
11519 var itemName = node.item.name.name; 11501 var itemName = node.item.name.name;
11520 var list = node.list.visit(this); 11502 var list = node.list.visit(this);
11521 this._pushBlock(true); 11503 this._pushBlock(true);
11522 var item = this._scope.create($assert_String(itemName), (itemType && itemType. is$lang_Type()), node.item.name, false); 11504 var item = this._scope.create($assert_String(itemName), (itemType && itemType. is$lang_Type()), node.item.name.span, false);
11523 var listVar = (list && list.is$Value()); 11505 var listVar = (list && list.is$Value());
11524 if ($notnull_bool(list.needsTemp)) { 11506 if ($notnull_bool(list.needsTemp)) {
11525 listVar = this._scope.create('\$list', (($0 = list.type) && $0.is$lang_Type( )), null, false); 11507 listVar = this._scope.create('\$list', (($0 = list.type) && $0.is$lang_Type( )), null, false);
11526 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';')); 11508 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';'));
11527 } 11509 }
11528 if ($notnull_bool(list.type.get$isList())) { 11510 if ($notnull_bool(list.type.get$isList())) {
11529 var tmpi = this._scope.create('\$i', world.numType, null, false); 11511 var tmpi = this._scope.create('\$i', world.numType, null, false);
11530 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code + ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {')); 11512 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code + ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {'));
11531 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [ tmpi]), false); 11513 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [ tmpi]), false);
11532 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';')); 11514 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';'));
11533 } 11515 }
11534 else { 11516 else {
11535 this._pushBlock(false); 11517 this._pushBlock(false);
11536 var c = world.get$coreimpl().types.$index('ListIterator').getConstructor('') ;
11537 c.invoke$4(this, node, null, new Arguments(null, [new Value(null, 'l', node. list.span, false, true, false)]));
11538 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT Y()); 11518 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT Y());
11539 var tmpi = this._scope.create('\$i', (($0 = iterator.type) && $0.is$lang_Typ e()), null, false); 11519 var tmpi = this._scope.create('\$i', (($0 = iterator.type) && $0.is$lang_Typ e()), null, false);
11540 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY( )); 11520 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY( ));
11541 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY()); 11521 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY());
11542 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + '; ' + hasNext.code + '; ) {')); 11522 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + '; ' + hasNext.code + '; ) {'));
11543 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';')); 11523 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';'));
11544 } 11524 }
11545 this.visitStatementsInBlock(node.body); 11525 this.visitStatementsInBlock(node.body);
11546 this.writer.exitBlock('}'); 11526 this.writer.exitBlock('}');
11547 this._popBlock(); 11527 this._popBlock();
11548 return false; 11528 return false;
11549 } 11529 }
11550 MethodGenerator.prototype._genToDartException = function(ex, node) { 11530 MethodGenerator.prototype._genToDartException = function(ex, node) {
11551 var $0;
11552 var types = const$403/*const [ 11531 var types = const$403/*const [
11553 'NullPointerException', 'ObjectNotClosureException', 11532 'NullPointerException', 'ObjectNotClosureException',
11554 'NoSuchMethodException', 'StackOverflowException']*/; 11533 'NoSuchMethodException', 'StackOverflowException']*/;
11555 var target = new Value(null, 'this', node.span, false, true, false); 11534 var target = new Value(world.varType, 'this', node.span, true);
11556 for (var $i = types.iterator(); $i.hasNext(); ) { 11535 for (var $i = types.iterator(); $i.hasNext(); ) {
11557 var name = $i.next(); 11536 var name = $i.next();
11558 world.corelib.types.$index(name).markUsed(); 11537 world.corelib.types.$index(name).markUsed();
11559 world.corelib.types.$index(name).get$members().$index('toString').invoke$4(t his, node, target, Arguments.get$EMPTY()); 11538 world.corelib.types.$index(name).get$members().$index('toString').invoke$4(t his, node, target, Arguments.get$EMPTY());
11560 } 11539 }
11561 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');')); 11540 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');'));
11562 world.gen.corejs.useToDartException = true; 11541 world.gen.corejs.useToDartException = true;
11563 } 11542 }
11564 MethodGenerator.prototype.visitTryStatement = function(node) { 11543 MethodGenerator.prototype.visitTryStatement = function(node) {
11565 var $0; 11544 var $0;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
11730 if ($notnull_bool(this.get$isStatic())) { 11709 if ($notnull_bool(this.get$isStatic())) {
11731 world.warning('not allowed in static method', node.span); 11710 world.warning('not allowed in static method', node.span);
11732 } 11711 }
11733 } 11712 }
11734 MethodGenerator.prototype._makeSuperValue = function(node) { 11713 MethodGenerator.prototype._makeSuperValue = function(node) {
11735 var parentType = this.method.declaringType.get$parent(); 11714 var parentType = this.method.declaringType.get$parent();
11736 this._checkNonStatic(node); 11715 this._checkNonStatic(node);
11737 if ($notnull_bool(parentType == null)) { 11716 if ($notnull_bool(parentType == null)) {
11738 world.error('no super class', node.span); 11717 world.error('no super class', node.span);
11739 } 11718 }
11740 return new Value(parentType, 'this', node.span, true, false, false); 11719 var ret = new Value(parentType, 'this', node.span, false);
11720 ret.isSuper = true;
11721 return ret;
11741 } 11722 }
11742 MethodGenerator.prototype._getOutermostMethod = function() { 11723 MethodGenerator.prototype._getOutermostMethod = function() {
11743 var result = this; 11724 var result = this;
11744 while ($notnull_bool(result.enclosingMethod != null)) { 11725 while ($notnull_bool(result.enclosingMethod != null)) {
11745 result = result.enclosingMethod; 11726 result = result.enclosingMethod;
11746 } 11727 }
11747 return result; 11728 return result;
11748 } 11729 }
11749 MethodGenerator.prototype._makeThisCode = function() { 11730 MethodGenerator.prototype._makeThisCode = function() {
11750 if ($notnull_bool(this.enclosingMethod != null)) { 11731 if ($notnull_bool(this.enclosingMethod != null)) {
11751 this._getOutermostMethod().needsThis = true; 11732 this._getOutermostMethod().needsThis = true;
11752 return '\$this'; 11733 return '\$this';
11753 } 11734 }
11754 else { 11735 else {
11755 return 'this'; 11736 return 'this';
11756 } 11737 }
11757 } 11738 }
11758 MethodGenerator.prototype._makeThisValue = function(node) { 11739 MethodGenerator.prototype._makeThisValue = function(node) {
11759 if ($notnull_bool(this.enclosingMethod != null)) { 11740 if ($notnull_bool(this.enclosingMethod != null)) {
11760 var outermostMethod = this._getOutermostMethod(); 11741 var outermostMethod = this._getOutermostMethod();
11761 outermostMethod._checkNonStatic(node); 11742 outermostMethod._checkNonStatic(node);
11762 outermostMethod.needsThis = true; 11743 outermostMethod.needsThis = true;
11763 return new Value(outermostMethod.method.declaringType, '\$this', $notnull_bo ol(node != null) ? node.span : null, false, false, false); 11744 return new Value(outermostMethod.method.declaringType, '\$this', $notnull_bo ol(node != null) ? node.span : null, false);
11764 } 11745 }
11765 else { 11746 else {
11766 this._checkNonStatic(node); 11747 this._checkNonStatic(node);
11767 return new Value(this.method.declaringType, 'this', $notnull_bool(node != nu ll) ? node.span : null, false, false, false); 11748 return new Value(this.method.declaringType, 'this', $notnull_bool(node != nu ll) ? node.span : null, false);
11768 } 11749 }
11769 } 11750 }
11770 MethodGenerator.prototype.visitLambdaExpression = function(node) { 11751 MethodGenerator.prototype.visitLambdaExpression = function(node) {
11771 var name = ''; 11752 var name = '';
11772 if ($notnull_bool(node.func.name != null)) { 11753 if ($notnull_bool(node.func.name != null)) {
11773 name = world.toJsIdentifier(node.func.name.name); 11754 name = world.toJsIdentifier(node.func.name.name);
11774 } 11755 }
11775 var meth = this._makeLambdaMethod($assert_String(name), node.func); 11756 var meth = this._makeLambdaMethod($assert_String(name), node.func);
11776 var w = new CodeWriter(); 11757 var w = new CodeWriter();
11777 meth.generator.writeDefinition((w && w.is$CodeWriter()), node); 11758 meth.generator.writeDefinition((w && w.is$CodeWriter()), node);
11778 return new Value(meth.get$functionType(), w.get$text(), node.span, false, true , false); 11759 return new Value(meth.get$functionType(), w.get$text(), node.span, true);
11779 } 11760 }
11780 MethodGenerator.prototype.visitCallExpression = function(node) { 11761 MethodGenerator.prototype.visitCallExpression = function(node) {
11781 var $0; 11762 var $0;
11782 var target; 11763 var target;
11783 var position = node.target; 11764 var position = node.target;
11784 var name = '\$call'; 11765 var name = '\$call';
11785 if ($notnull_bool((node.target instanceof DotExpression))) { 11766 if ($notnull_bool((node.target instanceof DotExpression))) {
11786 var dot = (($0 = node.target) && $0.is$DotExpression()); 11767 var dot = (($0 = node.target) && $0.is$DotExpression());
11787 target = dot.self.visit(this); 11768 target = dot.self.visit(this);
11788 name = dot.name.name; 11769 name = dot.name.name;
(...skipping 20 matching lines...) Expand all
11809 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); 11790 return target.invoke$4(this, '\$index', node, new Arguments(null, [index]));
11810 } 11791 }
11811 MethodGenerator.prototype.visitBinaryExpression = function(node) { 11792 MethodGenerator.prototype.visitBinaryExpression = function(node) {
11812 var $0; 11793 var $0;
11813 var kind = node.op.kind; 11794 var kind = node.op.kind;
11814 if ($notnull_bool(kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/)) { 11795 if ($notnull_bool(kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/)) {
11815 var x = this.visitValue(node.x); 11796 var x = this.visitValue(node.x);
11816 var y = this.visitValue(node.y); 11797 var y = this.visitValue(node.y);
11817 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); 11798 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + '');
11818 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { 11799 if ($notnull_bool(x.get$isConst() && y.get$isConst())) {
11819 var value = $notnull_bool((kind == 35/*TokenKind.AND*/)) ? x.get$actualVal ue() && y.get$actualValue() : x.get$actualValue() || y.get$actualValue(); 11800 var value = $notnull_bool((kind == 35/*TokenKind.AND*/)) ? $notnull_bool(x .get$actualValue() && y.get$actualValue()) : $notnull_bool(x.get$actualValue() | | y.get$actualValue());
11820 return EvaluatedValue.EvaluatedValue$factory((($0 = x.type) && $0.is$lang_ Type()), value, ('' + value + ''), node.span); 11801 return EvaluatedValue.EvaluatedValue$factory((($0 = x.type) && $0.is$lang_ Type()), value, ('' + value + ''), node.span);
11821 } 11802 }
11822 return new Value(null, code, node.span, false, true, false); 11803 var ret = new Value(lang_Type.union((($0 = x.type) && $0.is$lang_Type()), (( $0 = y.type) && $0.is$lang_Type())), code, node.span, true);
11804 return ret.convertToNonNullBool(this, node);
11823 } 11805 }
11824 else if ($notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenK ind.NE_STRICT*/)) { 11806 else if ($notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenK ind.NE_STRICT*/)) {
11825 var x = this.visitValue(node.x); 11807 var x = this.visitValue(node.x);
11826 var y = this.visitValue(node.y); 11808 var y = this.visitValue(node.y);
11827 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { 11809 if ($notnull_bool(x.get$isConst() && y.get$isConst())) {
11828 var value = $notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/) ? $eq(x.get$a ctualValue(), y.get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue( )); 11810 var value = $notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/) ? $eq(x.get$a ctualValue(), y.get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue( ));
11829 return EvaluatedValue.EvaluatedValue$factory(world.boolType, value, ("" + value + ""), node.span); 11811 return EvaluatedValue.EvaluatedValue$factory(world.boolType, value, ("" + value + ""), node.span);
11830 } 11812 }
11831 if ($notnull_bool(x.code == 'null' || y.code == 'null')) { 11813 if ($notnull_bool(x.code == 'null' || y.code == 'null')) {
11832 var op = node.op.toString().substring(0, 2); 11814 var op = node.op.toString().substring(0, 2);
11833 return new Value(null, ('' + x.code + ' ' + op + ' ' + y.code + ''), node. span, false, true, false); 11815 return new Value(world.boolType, ('' + x.code + ' ' + op + ' ' + y.code + ''), node.span, true);
11834 } 11816 }
11835 else { 11817 else {
11836 return new Value(null, ('' + x.code + ' ' + node.op + ' ' + y.code + ''), node.span, false, true, false); 11818 return new Value(world.boolType, ('' + x.code + ' ' + node.op + ' ' + y.co de + ''), node.span, true);
11837 } 11819 }
11838 } 11820 }
11839 var assignKind = TokenKind.kindFromAssign(node.op.kind); 11821 var assignKind = TokenKind.kindFromAssign(node.op.kind);
11840 if ($notnull_bool(assignKind == -1)) { 11822 if ($notnull_bool(assignKind == -1)) {
11841 var x = this.visitValue(node.x); 11823 var x = this.visitValue(node.x);
11842 var y = this.visitValue(node.y); 11824 var y = this.visitValue(node.y);
11843 var name = TokenKind.binaryMethodName(node.op.kind); 11825 var name = TokenKind.binaryMethodName(node.op.kind);
11844 if ($notnull_bool(node.op.kind == 49/*TokenKind.NE*/)) { 11826 if ($notnull_bool(node.op.kind == 49/*TokenKind.NE*/)) {
11845 name = '\$ne'; 11827 name = '\$ne';
11846 } 11828 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
11912 return members._set$4(this, position, x, y); 11894 return members._set$4(this, position, x, y);
11913 } 11895 }
11914 else { 11896 else {
11915 x = members._get$3(this, position, x); 11897 x = members._get$3(this, position, x);
11916 } 11898 }
11917 } 11899 }
11918 } 11900 }
11919 y = y.convertTo(this, (($0 = x.type) && $0.is$lang_Type()), yn, false); 11901 y = y.convertTo(this, (($0 = x.type) && $0.is$lang_Type()), yn, false);
11920 if ($notnull_bool(kind == 0)) { 11902 if ($notnull_bool(kind == 0)) {
11921 x = captureOriginal((x && x.is$Value())); 11903 x = captureOriginal((x && x.is$Value()));
11922 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, false, true, false); 11904 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, true);
11923 } 11905 }
11924 else if ($notnull_bool(x.type.get$isNum() && y.type.get$isNum() && (kind != 46 /*TokenKind.TRUNCDIV*/))) { 11906 else if ($notnull_bool(x.type.get$isNum() && y.type.get$isNum()) && (kind != 4 6/*TokenKind.TRUNCDIV*/)) {
11925 x = captureOriginal((x && x.is$Value())); 11907 x = captureOriginal((x && x.is$Value()));
11926 var op = TokenKind.kindToString(kind); 11908 var op = TokenKind.kindToString(kind);
11927 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), posi tion.span, false, true, false); 11909 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), posi tion.span, true);
11928 } 11910 }
11929 else { 11911 else {
11930 var right = x; 11912 var right = x;
11931 right = captureOriginal((right && right.is$Value())); 11913 right = captureOriginal((right && right.is$Value()));
11932 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); 11914 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y]));
11933 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, false, true, false); 11915 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, true);
11934 } 11916 }
11935 } 11917 }
11936 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c aptureOriginal) { 11918 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c aptureOriginal) {
11937 var target = this.visitValue(xn.target); 11919 var target = this.visitValue(xn.target);
11938 var index = this.visitValue(xn.index); 11920 var index = this.visitValue(xn.index);
11939 var y = this.visitValue(yn); 11921 var y = this.visitValue(yn);
11940 var tmptarget = target; 11922 var tmptarget = target;
11941 var tmpindex = index; 11923 var tmpindex = index;
11942 if ($notnull_bool(kind != 0)) { 11924 if ($notnull_bool(kind != 0)) {
11943 tmptarget = this.getTemp((target && target.is$Value())); 11925 tmptarget = this.getTemp((target && target.is$Value()));
(...skipping 23 matching lines...) Expand all
11967 return ret; 11949 return ret;
11968 } 11950 }
11969 MethodGenerator.prototype.visitUnaryExpression = function(node) { 11951 MethodGenerator.prototype.visitUnaryExpression = function(node) {
11970 var $0; 11952 var $0;
11971 var value = this.visitValue(node.self); 11953 var value = this.visitValue(node.self);
11972 switch (node.op.kind) { 11954 switch (node.op.kind) {
11973 case 16/*TokenKind.INCR*/: 11955 case 16/*TokenKind.INCR*/:
11974 case 17/*TokenKind.DECR*/: 11956 case 17/*TokenKind.DECR*/:
11975 11957
11976 if ($notnull_bool(value.type.get$isNum())) { 11958 if ($notnull_bool(value.type.get$isNum())) {
11977 return new Value(value.type, ('' + node.op + '' + value.code + ''), node .span, false, true, false); 11959 return new Value(value.type, ('' + node.op + '' + value.code + ''), node .span, true);
11978 } 11960 }
11979 else { 11961 else {
11980 var kind = ($notnull_bool(16/*TokenKind.INCR*/ == node.op.kind) ? 42/*To kenKind.ADD*/ : 43/*TokenKind.SUB*/); 11962 var kind = ($notnull_bool(16/*TokenKind.INCR*/ == node.op.kind) ? 42/*To kenKind.ADD*/ : 43/*TokenKind.SUB*/);
11981 var operand = new LiteralExpression(1, new TypeReference(node.span, worl d.numType), '1', node.span); 11963 var operand = new LiteralExpression(1, new TypeReference(node.span, worl d.numType), '1', node.span);
11982 return this._visitAssign($assert_num(kind), node.self, (operand && opera nd.is$lang_Expression()), node, to$call$1(null)); 11964 return this._visitAssign($assert_num(kind), node.self, (operand && opera nd.is$lang_Expression()), node, to$call$1(null));
11983 } 11965 }
11984 11966
11985 case 19/*TokenKind.NOT*/: 11967 case 19/*TokenKind.NOT*/:
11986 11968
11987 if ($notnull_bool(value.type.get$isBool() && value.get$isConst())) { 11969 if ($notnull_bool(value.type.get$isBool() && value.get$isConst())) {
11988 var newVal = !$notnull_bool(value.get$actualValue()); 11970 var newVal = !$notnull_bool(value.get$actualValue());
11989 return EvaluatedValue.EvaluatedValue$factory((($0 = value.type) && $0.is $lang_Type()), newVal, ('' + newVal + ''), node.span); 11971 return EvaluatedValue.EvaluatedValue$factory((($0 = value.type) && $0.is $lang_Type()), newVal, ('' + newVal + ''), node.span);
11990 } 11972 }
11991 else { 11973 else {
11992 var newVal = value.convertToNonNullBool(this, node); 11974 var newVal = value.convertToNonNullBool(this, node);
11993 return new Value(world.boolType, ('!' + newVal.code + ''), node.span, fa lse, true, false); 11975 return new Value(world.boolType, ('!' + newVal.code + ''), node.span, tr ue);
11994 } 11976 }
11995 11977
11996 case 42/*TokenKind.ADD*/: 11978 case 42/*TokenKind.ADD*/:
11997 11979
11998 return value.convertTo(this, world.numType, node, false); 11980 return value.convertTo(this, world.numType, node, false);
11999 11981
12000 case 43/*TokenKind.SUB*/: 11982 case 43/*TokenKind.SUB*/:
12001 case 18/*TokenKind.BIT_NOT*/: 11983 case 18/*TokenKind.BIT_NOT*/:
12002 11984
12003 if ($notnull_bool(node.op.kind == 18/*TokenKind.BIT_NOT*/)) { 11985 if ($notnull_bool(node.op.kind == 18/*TokenKind.BIT_NOT*/)) {
(...skipping 10 matching lines...) Expand all
12014 default: 11996 default:
12015 11997
12016 world.internalError(('unimplemented: ' + node.op + ''), node.span); 11998 world.internalError(('unimplemented: ' + node.op + ''), node.span);
12017 11999
12018 } 12000 }
12019 } 12001 }
12020 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { 12002 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) {
12021 var $this = this; // closure support 12003 var $this = this; // closure support
12022 var value = this.visitValue(node.body); 12004 var value = this.visitValue(node.body);
12023 if ($notnull_bool(value.type.get$isNum())) { 12005 if ($notnull_bool(value.type.get$isNum())) {
12024 return new Value(value.type, ('' + value.code + '' + node.op + ''), node.spa n, false, true, false); 12006 return new Value(value.type, ('' + value.code + '' + node.op + ''), node.spa n, true);
12025 } 12007 }
12026 var kind = $notnull_bool((16/*TokenKind.INCR*/ == node.op.kind)) ? 42/*TokenKi nd.ADD*/ : 43/*TokenKind.SUB*/; 12008 var kind = $notnull_bool((16/*TokenKind.INCR*/ == node.op.kind)) ? 42/*TokenKi nd.ADD*/ : 43/*TokenKind.SUB*/;
12027 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT ype), '1', node.span); 12009 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT ype), '1', node.span);
12028 var tmpleft = null, left = null; 12010 var tmpleft = null, left = null;
12029 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand. is$lang_Expression()), node, (function (l) { 12011 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand. is$lang_Expression()), node, (function (l) {
12030 if ($notnull_bool(isVoid)) { 12012 if ($notnull_bool(isVoid)) {
12031 return l; 12013 return l;
12032 } 12014 }
12033 else { 12015 else {
12034 left = l; 12016 left = l;
12035 tmpleft = $this.forceTemp((l && l.is$Value())); 12017 tmpleft = $this.forceTemp((l && l.is$Value()));
12036 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$ Value())); 12018 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$ Value()));
12037 } 12019 }
12038 }) 12020 })
12039 ); 12021 );
12040 if ($notnull_bool($ne(tmpleft, null))) { 12022 if ($notnull_bool($ne(tmpleft, null))) {
12041 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), node .span, false, true, false); 12023 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), node .span, true);
12042 } 12024 }
12043 if ($notnull_bool($ne(tmpleft, left))) { 12025 if ($notnull_bool($ne(tmpleft, left))) {
12044 this.freeTemp((tmpleft && tmpleft.is$Value())); 12026 this.freeTemp((tmpleft && tmpleft.is$Value()));
12045 } 12027 }
12046 return ret; 12028 return ret;
12047 } 12029 }
12048 MethodGenerator.prototype.visitNewExpression = function(node) { 12030 MethodGenerator.prototype.visitNewExpression = function(node) {
12049 var $0; 12031 var $0;
12050 var typeRef = node.type; 12032 var typeRef = node.type;
12051 var constructorName = ''; 12033 var constructorName = '';
12052 if ($notnull_bool(node.name != null)) { 12034 if ($notnull_bool(node.name != null)) {
12053 constructorName = node.name.name; 12035 constructorName = node.name.name;
12054 } 12036 }
12055 if ($notnull_bool($eq(constructorName, '') && !(typeRef instanceof GenericType Reference) && typeRef.names != null)) { 12037 if ($notnull_bool($eq(constructorName, '') && !(typeRef instanceof GenericType Reference)) && typeRef.names != null) {
12056 var names = ListFactory.ListFactory$from$factory(typeRef.names); 12038 var names = ListFactory.ListFactory$from$factory(typeRef.names);
12057 constructorName = names.removeLast().get$name(); 12039 constructorName = names.removeLast().get$name();
12058 if ($notnull_bool(names.length == 0)) names = null; 12040 if ($notnull_bool(names.length == 0)) names = null;
12059 typeRef = new NameTypeReference(typeRef.isFinal, typeRef.get$name(), names, typeRef.get$span()); 12041 typeRef = new NameTypeReference(typeRef.isFinal, typeRef.get$name(), names, typeRef.get$span());
12060 } 12042 }
12061 var type = this.method.resolveType(typeRef, true); 12043 var type = this.method.resolveType(typeRef, true);
12062 if ($notnull_bool(type.get$isTop())) { 12044 if ($notnull_bool(type.get$isTop())) {
12063 type = type.get$library().findTypeByName($assert_String(constructorName)); 12045 type = type.get$library().findTypeByName($assert_String(constructorName));
12064 constructorName = ''; 12046 constructorName = '';
12065 } 12047 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
12102 else { 12084 else {
12103 argsCode.add(arg.get$canonicalCode()); 12085 argsCode.add(arg.get$canonicalCode());
12104 } 12086 }
12105 } 12087 }
12106 else { 12088 else {
12107 argsCode.add(arg.code); 12089 argsCode.add(arg.code);
12108 } 12090 }
12109 } 12091 }
12110 world.get$coreimpl().types.$index('ListFactory').markUsed(); 12092 world.get$coreimpl().types.$index('ListFactory').markUsed();
12111 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); 12093 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']');
12112 var value = new Value(world.listType, code, node.span, false, true, false); 12094 var value = new Value(world.listType, code, node.span, true);
12113 if ($notnull_bool(node.isConst)) { 12095 if ($notnull_bool(node.isConst)) {
12114 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); 12096 var immutableList = world.get$coreimpl().types.$index('ImmutableList');
12115 var immutableListCtor = immutableList.getConstructor('from'); 12097 var immutableListCtor = immutableList.getConstructor('from');
12116 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null , [value])); 12098 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null , [value]));
12117 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory((immu tableList && immutableList.is$lang_Type()), (argValues && argValues.is$List$Eval uatedValue()), ('const ' + code + ''), result.code, node.span), (argValues && ar gValues.is$List$Value())); 12099 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory((immu tableList && immutableList.is$lang_Type()), (argValues && argValues.is$List$Eval uatedValue()), ('const ' + code + ''), result.code, node.span), (argValues && ar gValues.is$List$Value()));
12118 } 12100 }
12119 return value; 12101 return value;
12120 } 12102 }
12121 MethodGenerator.prototype.visitMapExpression = function(node) { 12103 MethodGenerator.prototype.visitMapExpression = function(node) {
12122 var $0; 12104 var $0;
(...skipping 21 matching lines...) Expand all
12144 else { 12126 else {
12145 argsCode.add(key.code); 12127 argsCode.add(key.code);
12146 argsCode.add(value.code); 12128 argsCode.add(value.code);
12147 } 12129 }
12148 } 12130 }
12149 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); 12131 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']');
12150 var code = ('\$map(' + argList + ')'); 12132 var code = ('\$map(' + argList + ')');
12151 if ($notnull_bool(node.isConst)) { 12133 if ($notnull_bool(node.isConst)) {
12152 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap'); 12134 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap');
12153 var immutableMapCtor = immutableMap.getConstructor(''); 12135 var immutableMapCtor = immutableMap.getConstructor('');
12154 var argsValue = new Value(world.listType, argList, node.span, false, true, f alse); 12136 var argsValue = new Value(world.listType, argList, node.span, true);
12155 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null, [argsValue])); 12137 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null, [argsValue]));
12156 var value = ConstMapValue.ConstMapValue$factory((immutableMap && immutableMa p.is$lang_Type()), (argValues && argValues.is$List$EvaluatedValue()), code, resu lt.code, node.span); 12138 var value = ConstMapValue.ConstMapValue$factory((immutableMap && immutableMa p.is$lang_Type()), (argValues && argValues.is$List$EvaluatedValue()), code, resu lt.code, node.span);
12157 return world.gen.globalForConst(value, (argValues && argValues.is$List$Value ())); 12139 return world.gen.globalForConst(value, (argValues && argValues.is$List$Value ()));
12158 } 12140 }
12159 return new Value(mapImplType, code, node.span, false, true, false); 12141 return new Value(mapImplType, code, node.span, true);
12160 } 12142 }
12161 MethodGenerator.prototype.visitConditionalExpression = function(node) { 12143 MethodGenerator.prototype.visitConditionalExpression = function(node) {
12162 var $0; 12144 var $0;
12163 var test = this.visitBool(node.test); 12145 var test = this.visitBool(node.test);
12164 var trueBranch = this.visitValue(node.trueBranch); 12146 var trueBranch = this.visitValue(node.trueBranch);
12165 var falseBranch = this.visitValue(node.falseBranch); 12147 var falseBranch = this.visitValue(node.falseBranch);
12166 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod e + ''); 12148 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod e + '');
12167 return new Value(lang_Type.union((($0 = trueBranch.type) && $0.is$lang_Type()) , (($0 = falseBranch.type) && $0.is$lang_Type())), code, node.span, false, true, false); 12149 return new Value(lang_Type.union((($0 = trueBranch.type) && $0.is$lang_Type()) , (($0 = falseBranch.type) && $0.is$lang_Type())), code, node.span, true);
12168 } 12150 }
12169 MethodGenerator.prototype.visitIsExpression = function(node) { 12151 MethodGenerator.prototype.visitIsExpression = function(node) {
12170 var value = this.visitValue(node.x); 12152 var value = this.visitValue(node.x);
12171 var type = this.method.resolveType(node.type, false); 12153 var type = this.method.resolveType(node.type, false);
12172 return value.instanceOf(this, (type && type.is$lang_Type()), node.span, node.i sTrue, false); 12154 return value.instanceOf(this, (type && type.is$lang_Type()), node.span, node.i sTrue, false);
12173 } 12155 }
12174 MethodGenerator.prototype.visitParenExpression = function(node) { 12156 MethodGenerator.prototype.visitParenExpression = function(node) {
12175 var $0; 12157 var $0;
12176 var body = this.visitValue(node.body); 12158 var body = this.visitValue(node.body);
12177 if ($notnull_bool(body.get$isConst())) { 12159 if ($notnull_bool(body.get$isConst())) {
12178 return EvaluatedValue.EvaluatedValue$factory((($0 = body.type) && $0.is$lang _Type()), body.get$actualValue(), ('(' + body.get$canonicalCode() + ')'), node.s pan); 12160 return EvaluatedValue.EvaluatedValue$factory((($0 = body.type) && $0.is$lang _Type()), body.get$actualValue(), ('(' + body.get$canonicalCode() + ')'), node.s pan);
12179 } 12161 }
12180 return new Value(body.type, ('(' + body.code + ')'), node.span, false, true, f alse); 12162 return new Value(body.type, ('(' + body.code + ')'), node.span, true);
12181 } 12163 }
12182 MethodGenerator.prototype.visitDotExpression = function(node) { 12164 MethodGenerator.prototype.visitDotExpression = function(node) {
12183 var target = node.self.visit(this); 12165 var target = node.self.visit(this);
12184 return target.get_(this, node.name.name, node.name); 12166 return target.get_(this, node.name.name, node.name);
12185 } 12167 }
12186 MethodGenerator.prototype.visitVarExpression = function(node) { 12168 MethodGenerator.prototype.visitVarExpression = function(node) {
12187 var name = node.name.name; 12169 var name = node.name.name;
12188 var ret = this._scope.lookup(name); 12170 var ret = this._scope.lookup(name);
12189 if ($notnull_bool($ne(ret, null))) return ret; 12171 if ($notnull_bool($ne(ret, null))) return ret;
12190 return this._makeThisOrType(node.span).get_(this, name, node); 12172 return this._makeThisOrType(node.span).get_(this, name, node);
12191 } 12173 }
12192 MethodGenerator.prototype._makeMissingValue = function(name) { 12174 MethodGenerator.prototype._makeMissingValue = function(name) {
12193 return new Value(null, ('' + name + '()/*NotFound*/'), null, false, true, fals e); 12175 return new Value(world.varType, ('' + name + '()/*NotFound*/'), null, true);
12194 } 12176 }
12195 MethodGenerator.prototype._makeThisOrType = function(span) { 12177 MethodGenerator.prototype._makeThisOrType = function(span) {
12196 var $0; 12178 var $0;
12197 return new BareValue(this, (($0 = this._getOutermostMethod()) && $0.is$MethodG enerator()), span); 12179 return new BareValue(this, (($0 = this._getOutermostMethod()) && $0.is$MethodG enerator()), span);
12198 } 12180 }
12199 MethodGenerator.prototype.visitThisExpression = function(node) { 12181 MethodGenerator.prototype.visitThisExpression = function(node) {
12200 return this._makeThisValue(node); 12182 return this._makeThisValue(node);
12201 } 12183 }
12202 MethodGenerator.prototype.visitSuperExpression = function(node) { 12184 MethodGenerator.prototype.visitSuperExpression = function(node) {
12203 return this._makeSuperValue(node); 12185 return this._makeSuperValue(node);
12204 } 12186 }
12205 MethodGenerator.prototype.visitNullExpression = function(node) { 12187 MethodGenerator.prototype.visitNullExpression = function(node) {
12206 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null); 12188 return EvaluatedValue.EvaluatedValue$factory(world.varType, null, 'null', null );
12207 } 12189 }
12208 MethodGenerator.prototype.visitLiteralExpression = function(node) { 12190 MethodGenerator.prototype.visitLiteralExpression = function(node) {
12209 var $0; 12191 var $0;
12210 var type = node.type.type; 12192 var type = node.type.type;
12211 $assert($ne(type, null), "type != null", "gen.dart", 2078, 12); 12193 $assert($ne(type, null), "type != null", "gen.dart", 2073, 12);
12212 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { 12194 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) {
12213 var items = []; 12195 var items = [];
12214 var $list = node.value; 12196 var $list = node.value;
12215 for (var $i = node.value.iterator(); $i.hasNext(); ) { 12197 for (var $i = node.value.iterator(); $i.hasNext(); ) {
12216 var item = $i.next(); 12198 var item = $i.next();
12217 var val = this.visitValue((item && item.is$lang_Expression())); 12199 var val = this.visitValue((item && item.is$lang_Expression()));
12218 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); 12200 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY());
12219 var code = val.code; 12201 var code = val.code;
12220 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C onditionalExpression))) { 12202 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C onditionalExpression))) {
12221 code = ('(' + code + ')'); 12203 code = ('(' + code + ')');
12222 } 12204 }
12223 items.add(code); 12205 items.add(code);
12224 } 12206 }
12225 return new Value(type, ('(' + Strings.join((items && items.is$List$String()) , " + ") + ')'), node.span, false, true, false); 12207 return new Value(type, ('(' + Strings.join((items && items.is$List$String()) , " + ") + ')'), node.span, true);
12226 } 12208 }
12227 var text = node.text; 12209 var text = node.text;
12228 if ($notnull_bool(type.get$isString())) { 12210 if ($notnull_bool(type.get$isString())) {
12229 if ($notnull_bool(text.startsWith('@'))) { 12211 if ($notnull_bool(text.startsWith('@'))) {
12230 text = MethodGenerator._escapeString(parseStringLiteral($assert_String(tex t))); 12212 text = MethodGenerator._escapeString(parseStringLiteral($assert_String(tex t)));
12231 text = ('"' + text + '"'); 12213 text = ('"' + text + '"');
12232 } 12214 }
12233 else if ($notnull_bool(isMultilineString($assert_String(text)))) { 12215 else if ($notnull_bool(isMultilineString($assert_String(text)))) {
12234 text = parseStringLiteral($assert_String(text)); 12216 text = parseStringLiteral($assert_String(text));
12235 text = text.replaceAll('\n', '\\n'); 12217 text = text.replaceAll('\n', '\\n');
(...skipping 15 matching lines...) Expand all
12251 function Arguments(nodes, values) { 12233 function Arguments(nodes, values) {
12252 this.nodes = nodes; 12234 this.nodes = nodes;
12253 this.values = values; 12235 this.values = values;
12254 // Initializers done 12236 // Initializers done
12255 } 12237 }
12256 Arguments.prototype.is$Arguments = function(){return this;}; 12238 Arguments.prototype.is$Arguments = function(){return this;};
12257 Arguments.Arguments$bare$factory = function(arity) { 12239 Arguments.Arguments$bare$factory = function(arity) {
12258 var values = []; 12240 var values = [];
12259 for (var i = 0; 12241 for (var i = 0;
12260 $notnull_bool(i < arity); i++) { 12242 $notnull_bool(i < arity); i++) {
12261 values.add(new Value(world.varType, ('\$' + i + ''), null, false, false, fal se)); 12243 values.add(new Value(world.varType, ('\$' + i + ''), null, false));
12262 } 12244 }
12263 return new Arguments(null, values); 12245 return new Arguments(null, values);
12264 } 12246 }
12265 Arguments.get$EMPTY = function() { 12247 Arguments.get$EMPTY = function() {
12266 if ($notnull_bool(Arguments._empty == null)) { 12248 if ($notnull_bool(Arguments._empty == null)) {
12267 Arguments._empty = new Arguments(null, []); 12249 Arguments._empty = new Arguments(null, []);
12268 } 12250 }
12269 return Arguments._empty; 12251 return Arguments._empty;
12270 } 12252 }
12271 Arguments.prototype.get$nameCount = function() { 12253 Arguments.prototype.get$nameCount = function() {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
12331 for (var i = this.get$bareCount(); 12313 for (var i = this.get$bareCount();
12332 $notnull_bool(i < this.get$length()); i++) { 12314 $notnull_bool(i < this.get$length()); i++) {
12333 names.add(this.getName(i)); 12315 names.add(this.getName(i));
12334 } 12316 }
12335 return (names && names.is$List$String()); 12317 return (names && names.is$List$String());
12336 } 12318 }
12337 Arguments.prototype.toCallStubArgs = function() { 12319 Arguments.prototype.toCallStubArgs = function() {
12338 var result = []; 12320 var result = [];
12339 for (var i = 0; 12321 for (var i = 0;
12340 $notnull_bool(i < this.get$bareCount()); i++) { 12322 $notnull_bool(i < this.get$bareCount()); i++) {
12341 result.add(new Value(world.varType, ('\$' + i + ''), null, false, false, fal se)); 12323 result.add(new Value(world.varType, ('\$' + i + ''), null, false));
12342 } 12324 }
12343 for (var i = this.get$bareCount(); 12325 for (var i = this.get$bareCount();
12344 $notnull_bool(i < this.get$length()); i++) { 12326 $notnull_bool(i < this.get$length()); i++) {
12345 var name = this.getName(i); 12327 var name = this.getName(i);
12346 if ($notnull_bool(name == null)) name = ('\$' + i + ''); 12328 if ($notnull_bool(name == null)) name = ('\$' + i + '');
12347 result.add(new Value(world.varType, name, null, false, false, false)); 12329 result.add(new Value(world.varType, name, null, false));
12348 } 12330 }
12349 return new Arguments(this.nodes, result); 12331 return new Arguments(this.nodes, result);
12350 } 12332 }
12351 // ********** Code for LibraryImport ************** 12333 // ********** Code for LibraryImport **************
12352 function LibraryImport(library, prefix) { 12334 function LibraryImport(library, prefix) {
12353 this.library = library; 12335 this.library = library;
12354 this.prefix = prefix; 12336 this.prefix = prefix;
12355 // Initializers done 12337 // Initializers done
12356 } 12338 }
12357 LibraryImport.prototype.get$library = function() { return this.library; }; 12339 LibraryImport.prototype.get$library = function() { return this.library; };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
12405 Library.prototype._findMembers = function(name) { 12387 Library.prototype._findMembers = function(name) {
12406 var $0; 12388 var $0;
12407 if ($notnull_bool(name.startsWith('_'))) { 12389 if ($notnull_bool(name.startsWith('_'))) {
12408 return (($0 = this._privateMembers.$index(name)) && $0.is$MemberSet()); 12390 return (($0 = this._privateMembers.$index(name)) && $0.is$MemberSet());
12409 } 12391 }
12410 else { 12392 else {
12411 return (($0 = world._members.$index(name)) && $0.is$MemberSet()); 12393 return (($0 = world._members.$index(name)) && $0.is$MemberSet());
12412 } 12394 }
12413 } 12395 }
12414 Library.prototype._addMember = function(member) { 12396 Library.prototype._addMember = function(member) {
12415 var $0;
12416 if ($notnull_bool(member.get$isPrivate())) { 12397 if ($notnull_bool(member.get$isPrivate())) {
12417 if ($notnull_bool(member.get$isStatic())) { 12398 if ($notnull_bool(member.get$isStatic())) {
12418 if ($notnull_bool(member.declaringType.get$isTop())) { 12399 if ($notnull_bool(member.declaringType.get$isTop())) {
12419 world._addTopName(member); 12400 world._addTopName(member);
12420 } 12401 }
12421 return; 12402 return;
12422 } 12403 }
12423 var mset = this._privateMembers.$index(member.name); 12404 var mset = this._privateMembers.$index(member.name);
12424 if ($notnull_bool(mset == null)) { 12405 if ($notnull_bool(mset == null)) {
12425 var $list = world.libraries.getValues(); 12406 var $list = world.libraries.getValues();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
12528 } 12509 }
12529 else { 12510 else {
12530 ret = newRet; 12511 ret = newRet;
12531 } 12512 }
12532 } 12513 }
12533 } 12514 }
12534 } 12515 }
12535 return (ret && ret.is$Member()); 12516 return (ret && ret.is$Member());
12536 } 12517 }
12537 Library.prototype.resolve = function() { 12518 Library.prototype.resolve = function() {
12538 var $0;
12539 if ($notnull_bool(this.name == null)) { 12519 if ($notnull_bool(this.name == null)) {
12540 this.name = this.baseSource.filename; 12520 this.name = this.baseSource.filename;
12541 var index = this.name.lastIndexOf('/', this.name.length); 12521 var index = this.name.lastIndexOf('/', this.name.length);
12542 if ($notnull_bool(index >= 0)) { 12522 if ($notnull_bool(index >= 0)) {
12543 this.name = this.name.substring(index + 1); 12523 this.name = this.name.substring(index + 1);
12544 } 12524 }
12545 index = this.name.indexOf('.', 0); 12525 index = this.name.indexOf('.', 0);
12546 if ($notnull_bool(index > 0)) { 12526 if ($notnull_bool(index > 0)) {
12547 this.name = this.name.substring(0, index); 12527 this.name = this.name.substring(0, index);
12548 } 12528 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
12585 }) 12565 })
12586 ))) { 12566 ))) {
12587 world.error(('file "' + filename + '" has already been sourced'), span); 12567 world.error(('file "' + filename + '" has already been sourced'), span);
12588 return; 12568 return;
12589 } 12569 }
12590 var source = world.readFile(this.library.makeFullPath(name)); 12570 var source = world.readFile(this.library.makeFullPath(name));
12591 this.sources.add(source); 12571 this.sources.add(source);
12592 } 12572 }
12593 _LibraryVisitor.prototype.addSource = function(source) { 12573 _LibraryVisitor.prototype.addSource = function(source) {
12594 var $this = this; // closure support 12574 var $this = this; // closure support
12595 var $0;
12596 if ($notnull_bool(this.library.sources.some((function (s) { 12575 if ($notnull_bool(this.library.sources.some((function (s) {
12597 return s.filename == source.filename; 12576 return s.filename == source.filename;
12598 }) 12577 })
12599 ))) { 12578 ))) {
12600 world.error(('duplicate source file "' + source.filename + '"')); 12579 world.error(('duplicate source file "' + source.filename + '"'));
12601 return; 12580 return;
12602 } 12581 }
12603 this.library.sources.add(source); 12582 this.library.sources.add(source);
12604 var parser = new lang_Parser(source, options.dietParse, false, false, 0); 12583 var parser = new lang_Parser(source, options.dietParse, false, false, 0);
12605 var unit = parser.compilationUnit(); 12584 var unit = parser.compilationUnit();
12606 unit.forEach((function (def) { 12585 unit.forEach((function (def) {
12607 return def.visit($this); 12586 return def.visit($this);
12608 }) 12587 })
12609 ); 12588 );
12610 $assert(this.sources.length == 0 || this.isTop, "sources.length == 0 || isTop" , "library.dart", 293, 12); 12589 $assert($notnull_bool(this.sources.length == 0 || this.isTop), "sources.length == 0 || isTop", "library.dart", 293, 12);
12611 this.isTop = false; 12590 this.isTop = false;
12612 var newSources = this.sources; 12591 var newSources = this.sources;
12613 this.sources = []; 12592 this.sources = [];
12614 for (var $i = newSources.iterator(); $i.hasNext(); ) { 12593 for (var $i = newSources.iterator(); $i.hasNext(); ) {
12615 var source0 = $i.next(); 12594 var source0 = $i.next();
12616 this.addSource((source0 && source0.is$SourceFile())); 12595 this.addSource((source0 && source0.is$SourceFile()));
12617 } 12596 }
12618 } 12597 }
12619 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { 12598 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) {
12620 if ($notnull_bool(!$notnull_bool(this.isTop))) { 12599 if ($notnull_bool(!$notnull_bool(this.isTop))) {
12621 world.error('directives not allowed in sourced file', node.span); 12600 world.error('directives not allowed in sourced file', node.span);
12622 return; 12601 return;
12623 } 12602 }
12624 var name; 12603 var name;
12625 switch (node.name.name) { 12604 switch (node.name.name) {
12626 case "library": 12605 case "library":
12627 12606
12628 name = this.getSingleStringArg(node); 12607 name = this.getSingleStringArg(node);
12629 if ($notnull_bool(this.library.name == null)) { 12608 if ($notnull_bool(this.library.name == null)) {
12630 this.library.name = $assert_String(name); 12609 this.library.name = $assert_String(name);
12631 if ($notnull_bool($eq(name, 'node') || $eq(name, 'dom'))) { 12610 if ($notnull_bool($eq(name, 'node') || $eq(name, 'dom'))) {
12632 this.library.topType.isNativeType = true; 12611 this.library.topType.isNativeType = true;
12633 } 12612 }
12634 if ($notnull_bool(this.seenImport || this.seenSource || this.seenResourc e)) { 12613 if ($notnull_bool(this.seenImport || this.seenSource) || this.seenResour ce) {
12635 world.error('#library must be first directive in file', node.span); 12614 world.error('#library must be first directive in file', node.span);
12636 } 12615 }
12637 } 12616 }
12638 else { 12617 else {
12639 world.error('already specified library name', node.span); 12618 world.error('already specified library name', node.span);
12640 } 12619 }
12641 break; 12620 break;
12642 12621
12643 case "import": 12622 case "import":
12644 12623
12645 this.seenImport = true; 12624 this.seenImport = true;
12646 name = this.getFirstStringArg(node); 12625 name = this.getFirstStringArg(node);
12647 var prefix = this.tryGetNamedStringArg(node, 'prefix'); 12626 var prefix = this.tryGetNamedStringArg(node, 'prefix');
12648 if ($notnull_bool(node.arguments.length > 2 || node.arguments.length == 2 && prefix == null)) { 12627 if ($notnull_bool(node.arguments.length > 2 || $notnull_bool(node.argument s.length == 2 && prefix == null))) {
12649 world.error('expected at most one "name" argument and one optional "pref ix"' + (' but found ' + node.arguments.length + ''), node.span); 12628 world.error('expected at most one "name" argument and one optional "pref ix"' + (' but found ' + node.arguments.length + ''), node.span);
12650 } 12629 }
12651 else if ($notnull_bool($ne(prefix, null) && prefix.indexOf('.', 0) >= 0)) { 12630 else if ($notnull_bool($ne(prefix, null) && prefix.indexOf('.', 0) >= 0)) {
12652 world.error('library prefix canot contain "."', node.span); 12631 world.error('library prefix canot contain "."', node.span);
12653 } 12632 }
12654 else if ($notnull_bool(this.seenSource || this.seenResource)) { 12633 else if ($notnull_bool(this.seenSource || this.seenResource)) {
12655 world.error('#imports must come before any #source or #resource', node.s pan); 12634 world.error('#imports must come before any #source or #resource', node.s pan);
12656 } 12635 }
12657 if ($notnull_bool($eq(prefix, ''))) prefix = null; 12636 if ($notnull_bool($eq(prefix, ''))) prefix = null;
12658 var filename = this.library.makeFullPath($assert_String(name)); 12637 var filename = this.library.makeFullPath($assert_String(name));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
12704 if ($notnull_bool(node.arguments.length < 1)) { 12683 if ($notnull_bool(node.arguments.length < 1)) {
12705 world.error(('expected at least one argument but found ' + node.arguments.le ngth + ''), node.span); 12684 world.error(('expected at least one argument but found ' + node.arguments.le ngth + ''), node.span);
12706 } 12685 }
12707 var arg = node.arguments.$index(0); 12686 var arg = node.arguments.$index(0);
12708 if ($notnull_bool(arg.label != null)) { 12687 if ($notnull_bool(arg.label != null)) {
12709 world.error('label not allowed for directive', node.span); 12688 world.error('label not allowed for directive', node.span);
12710 } 12689 }
12711 return this._parseStringArgument((arg && arg.is$ArgumentNode())); 12690 return this._parseStringArgument((arg && arg.is$ArgumentNode()));
12712 } 12691 }
12713 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { 12692 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) {
12714 var $0;
12715 var args = node.arguments.filter((function (a) { 12693 var args = node.arguments.filter((function (a) {
12716 return a.label != null && a.label.name == argName; 12694 return $notnull_bool(a.label != null && a.label.name == argName);
12717 }) 12695 })
12718 ); 12696 );
12719 if ($notnull_bool(args.length == 0)) { 12697 if ($notnull_bool(args.length == 0)) {
12720 return null; 12698 return null;
12721 } 12699 }
12722 if ($notnull_bool(args.length > 1)) { 12700 if ($notnull_bool(args.length > 1)) {
12723 world.error(('expected at most one "' + argName + '" argument but found ') + node.arguments.length, node.span); 12701 world.error(('expected at most one "' + argName + '" argument but found ') + node.arguments.length, node.span);
12724 } 12702 }
12725 for (var $i = args.iterator(); $i.hasNext(); ) { 12703 for (var $i = args.iterator(); $i.hasNext(); ) {
12726 var arg = $i.next(); 12704 var arg = $i.next();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
12802 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse); 12780 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse);
12803 } 12781 }
12804 Parameter.prototype.copyWithNewType = function(newType) { 12782 Parameter.prototype.copyWithNewType = function(newType) {
12805 var ret = new Parameter(this.definition); 12783 var ret = new Parameter(this.definition);
12806 ret.type = newType; 12784 ret.type = newType;
12807 ret.name = this.name; 12785 ret.name = this.name;
12808 ret.isInitializer = this.isInitializer; 12786 ret.isInitializer = this.isInitializer;
12809 return (ret && ret.is$Parameter()); 12787 return (ret && ret.is$Parameter());
12810 } 12788 }
12811 Parameter.prototype.get$isOptional = function() { 12789 Parameter.prototype.get$isOptional = function() {
12812 return $assert_bool(this.definition != null && this.definition.value != null); 12790 return $notnull_bool(this.definition != null && this.definition.value != null) ;
12813 } 12791 }
12814 // ********** Code for Member ************** 12792 // ********** Code for Member **************
12815 function Member(name, declaringType) { 12793 function Member(name, declaringType) {
12816 this.name = name; 12794 this.name = name;
12817 this.declaringType = declaringType; 12795 this.declaringType = declaringType;
12818 this.isGenerated = false; 12796 this.isGenerated = false;
12819 // Initializers done 12797 // Initializers done
12820 } 12798 }
12821 Member.prototype.is$Member = function(){return this;}; 12799 Member.prototype.is$Member = function(){return this;};
12822 Member.prototype.is$Named = function(){return this;}; 12800 Member.prototype.is$Named = function(){return this;};
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
12878 Member.prototype.set$initDelegate = function(ctor) { 12856 Member.prototype.set$initDelegate = function(ctor) {
12879 world.internalError('cannot have initializers', this.get$span()); 12857 world.internalError('cannot have initializers', this.get$span());
12880 } 12858 }
12881 Member.prototype.get$definition = function() { 12859 Member.prototype.get$definition = function() {
12882 return null; 12860 return null;
12883 } 12861 }
12884 Member.prototype.get$parameters = function() { 12862 Member.prototype.get$parameters = function() {
12885 return []; 12863 return [];
12886 } 12864 }
12887 Member.prototype.canInvoke = function(context, args) { 12865 Member.prototype.canInvoke = function(context, args) {
12888 return $assert_bool(this.get$canGet() && new Value(this.get$returnType(), null , null, false, true, false).canInvoke(context, '\$call', args)); 12866 return $notnull_bool(this.get$canGet() && new Value(this.get$returnType(), nul l, null, true).canInvoke(context, '\$call', args));
12889 } 12867 }
12890 Member.prototype.invoke = function(context, node, target, args, isDynamic) { 12868 Member.prototype.invoke = function(context, node, target, args, isDynamic) {
12891 var newTarget = this._get(context, node, target, isDynamic); 12869 var newTarget = this._get(context, node, target, isDynamic);
12892 return newTarget.invoke(context, '\$call', node, args, isDynamic); 12870 return newTarget.invoke(context, '\$call', node, args, isDynamic);
12893 } 12871 }
12894 Member.prototype.override = function(other) { 12872 Member.prototype.override = function(other) {
12895 if ($notnull_bool(this.get$isStatic())) { 12873 if ($notnull_bool(this.get$isStatic())) {
12896 world.error('static members can not hide parent members', this.get$span(), o ther.get$span()); 12874 world.error('static members can not hide parent members', this.get$span(), o ther.get$span());
12897 return false; 12875 return false;
12898 } 12876 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
12954 TypeMember.prototype.get$canGet = function() { 12932 TypeMember.prototype.get$canGet = function() {
12955 return true; 12933 return true;
12956 } 12934 }
12957 TypeMember.prototype.get$canSet = function() { 12935 TypeMember.prototype.get$canSet = function() {
12958 return false; 12936 return false;
12959 } 12937 }
12960 TypeMember.prototype.resolve = function(inType) { 12938 TypeMember.prototype.resolve = function(inType) {
12961 12939
12962 } 12940 }
12963 TypeMember.prototype._get = function(context, node, target, isDynamic) { 12941 TypeMember.prototype._get = function(context, node, target, isDynamic) {
12964 return new Value(this.type, this.type.get$jsname(), node.span, false, false, t rue); 12942 var ret = new Value(this.type, this.type.get$jsname(), node.span, false);
12943 ret.isType = true;
12944 return (ret && ret.is$Value());
12965 } 12945 }
12966 TypeMember.prototype._set = function(context, node, target, value, isDynamic) { 12946 TypeMember.prototype._set = function(context, node, target, value, isDynamic) {
12967 world.error('can not set type', this.type.definition.span); 12947 world.error('can not set type', this.type.definition.span);
12968 } 12948 }
12969 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { 12949 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) {
12970 world.error('can not invoke type', this.type.definition.span); 12950 world.error('can not invoke type', this.type.definition.span);
12971 } 12951 }
12972 TypeMember.prototype._get$3 = function($0, $1, $2) { 12952 TypeMember.prototype._get$3 = function($0, $1, $2) {
12973 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); 12953 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
12974 } 12954 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
13058 } 13038 }
13059 else { 13039 else {
13060 world.error(('' + mod + ' modifier not allowed on field'), mod.get$span( )); 13040 world.error(('' + mod + ' modifier not allowed on field'), mod.get$span( ));
13061 } 13041 }
13062 } 13042 }
13063 } 13043 }
13064 this.type = inType.resolveType(this.definition.type, false); 13044 this.type = inType.resolveType(this.definition.type, false);
13065 if ($notnull_bool(this.isStatic && this.type.get$hasTypeParams())) { 13045 if ($notnull_bool(this.isStatic && this.type.get$hasTypeParams())) {
13066 world.error('using type parameter in static context', this.definition.type.s pan); 13046 world.error('using type parameter in static context', this.definition.type.s pan);
13067 } 13047 }
13068 if ($notnull_bool(this.isStatic && this.isFinal && this.value == null)) { 13048 if ($notnull_bool(this.isStatic && this.isFinal) && this.value == null) {
13069 world.error('static final field is missing initializer', this.get$span()); 13049 world.error('static final field is missing initializer', this.get$span());
13070 } 13050 }
13071 this.get$library()._addMember(this); 13051 this.get$library()._addMember(this);
13072 } 13052 }
13073 FieldMember.prototype.computeValue = function() { 13053 FieldMember.prototype.computeValue = function() {
13074 var $0; 13054 var $0;
13075 if ($notnull_bool(this.value == null)) return null; 13055 if ($notnull_bool(this.value == null)) return null;
13076 if ($notnull_bool(this._computedValue == null)) { 13056 if ($notnull_bool(this._computedValue == null)) {
13077 if ($notnull_bool(this._computing)) { 13057 if ($notnull_bool(this._computing)) {
13078 world.error('circular reference', this.value.span); 13058 world.error('circular reference', this.value.span);
(...skipping 23 matching lines...) Expand all
13102 var $0; 13082 var $0;
13103 if ($notnull_bool(!$notnull_bool(isDynamic))) { 13083 if ($notnull_bool(!$notnull_bool(isDynamic))) {
13104 this.declaringType.markUsed(); 13084 this.declaringType.markUsed();
13105 } 13085 }
13106 if ($notnull_bool(this.isStatic)) { 13086 if ($notnull_bool(this.isStatic)) {
13107 var cv = this.computeValue(); 13087 var cv = this.computeValue();
13108 if ($notnull_bool(this.isFinal)) { 13088 if ($notnull_bool(this.isFinal)) {
13109 return (cv && cv.is$Value()); 13089 return (cv && cv.is$Value());
13110 } 13090 }
13111 if ($notnull_bool(this.declaringType.get$isTop())) { 13091 if ($notnull_bool(this.declaringType.get$isTop())) {
13112 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, fals e, true, false); 13092 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, true );
13113 } 13093 }
13114 else { 13094 else {
13115 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, false, true, false); 13095 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, true);
13116 } 13096 }
13117 } 13097 }
13118 else if ($notnull_bool(target.get$isConst() && this.isFinal)) { 13098 else if ($notnull_bool(target.get$isConst() && this.isFinal)) {
13119 var constTarget = $notnull_bool((target instanceof GlobalValue)) ? target.ge t$dynamic().exp : target; 13099 var constTarget = $notnull_bool((target instanceof GlobalValue)) ? target.ge t$dynamic().exp : target;
13120 if ($notnull_bool((constTarget instanceof ConstObjectValue))) { 13100 if ($notnull_bool((constTarget instanceof ConstObjectValue))) {
13121 return (($0 = constTarget.fields.$index(this.name)) && $0.is$Value()); 13101 return (($0 = constTarget.fields.$index(this.name)) && $0.is$Value());
13122 } 13102 }
13123 else if ($notnull_bool($eq(constTarget.type, world.stringType) && this.name == 'length')) { 13103 else if ($notnull_bool($eq(constTarget.type, world.stringType) && this.name == 'length')) {
13124 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), node.span, false, true, false); 13104 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), node.span, true);
13125 } 13105 }
13126 } 13106 }
13127 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, false, true, false); 13107 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, true);
13128 } 13108 }
13129 FieldMember.prototype._set = function(context, node, target, value, isDynamic) { 13109 FieldMember.prototype._set = function(context, node, target, value, isDynamic) {
13130 var lhs = this._get(context, node, target, isDynamic); 13110 var lhs = this._get(context, node, target, isDynamic);
13131 value = value.convertTo(context, this.type, node, isDynamic); 13111 value = value.convertTo(context, this.type, node, isDynamic);
13132 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), node.sp an, false, true, false); 13112 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), node.sp an, true);
13133 } 13113 }
13134 FieldMember.prototype._get$3 = function($0, $1, $2) { 13114 FieldMember.prototype._get$3 = function($0, $1, $2) {
13135 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); 13115 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
13136 } 13116 }
13137 ; 13117 ;
13138 FieldMember.prototype._set$4 = function($0, $1, $2, $3) { 13118 FieldMember.prototype._set$4 = function($0, $1, $2, $3) {
13139 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); 13119 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false);
13140 } 13120 }
13141 ; 13121 ;
13142 // ********** Code for PropertyMember ************** 13122 // ********** Code for PropertyMember **************
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
13329 } 13309 }
13330 ConcreteMember.prototype.resolveType = function(node, isRequired) { 13310 ConcreteMember.prototype.resolveType = function(node, isRequired) {
13331 var type = this.baseMember.resolveType(node, isRequired); 13311 var type = this.baseMember.resolveType(node, isRequired);
13332 return type.resolveTypeParams(this.declaringType); 13312 return type.resolveTypeParams(this.declaringType);
13333 } 13313 }
13334 ConcreteMember.prototype.override = function(other) { 13314 ConcreteMember.prototype.override = function(other) {
13335 return this.baseMember.override(other); 13315 return this.baseMember.override(other);
13336 } 13316 }
13337 ConcreteMember.prototype._get = function(context, node, target, isDynamic) { 13317 ConcreteMember.prototype._get = function(context, node, target, isDynamic) {
13338 var ret = this.baseMember._get(context, node, target, isDynamic); 13318 var ret = this.baseMember._get(context, node, target, isDynamic);
13339 return new Value(this.returnType, ret.code, node.span, false, true, false); 13319 return new Value(this.returnType, ret.code, node.span, true);
13340 } 13320 }
13341 ConcreteMember.prototype._set = function(context, node, target, value, isDynamic ) { 13321 ConcreteMember.prototype._set = function(context, node, target, value, isDynamic ) {
13342 var ret = this.baseMember._set(context, node, target, value, isDynamic); 13322 var ret = this.baseMember._set(context, node, target, value, isDynamic);
13343 return new Value(this.returnType, ret.code, node.span, false, true, false); 13323 return new Value(this.returnType, ret.code, node.span, true);
13344 } 13324 }
13345 ConcreteMember.prototype.invoke = function(context, node, target, args, isDynami c) { 13325 ConcreteMember.prototype.invoke = function(context, node, target, args, isDynami c) {
13346 var ret = this.baseMember.invoke(context, node, target, args, isDynamic); 13326 var ret = this.baseMember.invoke(context, node, target, args, isDynamic);
13347 var code = ret.code; 13327 var code = ret.code;
13348 if ($notnull_bool(this.get$isConstructor())) { 13328 if ($notnull_bool(this.get$isConstructor())) {
13349 code = code.replaceFirst(this.declaringType.get$genericType().get$jsname(), this.declaringType.get$jsname()); 13329 code = code.replaceFirst(this.declaringType.get$genericType().get$jsname(), this.declaringType.get$jsname());
13350 } 13330 }
13351 this.declaringType.genMethod(this); 13331 this.declaringType.genMethod(this);
13352 return new Value(this.returnType, code, node.span, false, true, false); 13332 return new Value(this.returnType, code, node.span, true);
13353 } 13333 }
13354 ConcreteMember.prototype._get$3 = function($0, $1, $2) { 13334 ConcreteMember.prototype._get$3 = function($0, $1, $2) {
13355 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); 13335 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
13356 } 13336 }
13357 ; 13337 ;
13358 ConcreteMember.prototype._set$4 = function($0, $1, $2, $3) { 13338 ConcreteMember.prototype._set$4 = function($0, $1, $2, $3) {
13359 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); 13339 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false);
13360 } 13340 }
13361 ; 13341 ;
13362 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) { 13342 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
13485 this._providePropertySyntax = true; 13465 this._providePropertySyntax = true;
13486 } 13466 }
13487 MethodMember.prototype._set = function(context, Node, target, value, isDynamic) { 13467 MethodMember.prototype._set = function(context, Node, target, value, isDynamic) {
13488 world.error('can not set method', this.definition.span); 13468 world.error('can not set method', this.definition.span);
13489 } 13469 }
13490 MethodMember.prototype._get = function(context, node, target, isDynamic) { 13470 MethodMember.prototype._get = function(context, node, target, isDynamic) {
13491 this.declaringType.genMethod(this); 13471 this.declaringType.genMethod(this);
13492 this._provideOptionalParamInfo = true; 13472 this._provideOptionalParamInfo = true;
13493 if ($notnull_bool(this.isStatic)) { 13473 if ($notnull_bool(this.isStatic)) {
13494 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d eclaringType.get$jsname() + '.'); 13474 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d eclaringType.get$jsname() + '.');
13495 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname( ) + ''), node.span, false, true, false); 13475 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname( ) + ''), node.span, true);
13496 } 13476 }
13497 this._providePropertySyntax = true; 13477 this._providePropertySyntax = true;
13498 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), node.span, false, true, false); 13478 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), node.span, true);
13499 } 13479 }
13500 MethodMember.prototype.namesInOrder = function(args) { 13480 MethodMember.prototype.namesInOrder = function(args) {
13501 if ($notnull_bool(!$notnull_bool(args.get$hasNames()))) return true; 13481 if ($notnull_bool(!$notnull_bool(args.get$hasNames()))) return true;
13502 var lastParameter = null; 13482 var lastParameter = null;
13503 for (var i = args.get$bareCount(); 13483 for (var i = args.get$bareCount();
13504 $notnull_bool(i < this.parameters.length); i++) { 13484 $notnull_bool(i < this.parameters.length); i++) {
13505 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam e())); 13485 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam e()));
13506 if ($notnull_bool(p >= 0 && args.values.$index(p).needsTemp)) { 13486 if ($notnull_bool(p >= 0 && args.values.$index(p).needsTemp)) {
13507 if ($notnull_bool(lastParameter != null && lastParameter > $assert_num(p)) ) { 13487 if ($notnull_bool(lastParameter != null && lastParameter > $assert_num(p)) ) {
13508 return false; 13488 return false;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
13560 this.resolve(this.declaringType); 13540 this.resolve(this.declaringType);
13561 } 13541 }
13562 this.declaringType.genMethod(this); 13542 this.declaringType.genMethod(this);
13563 if ($notnull_bool(this.isStatic || this.isFactory)) { 13543 if ($notnull_bool(this.isStatic || this.isFactory)) {
13564 this.declaringType.markUsed(); 13544 this.declaringType.markUsed();
13565 } 13545 }
13566 if ($notnull_bool(!$notnull_bool(this.namesInOrder(args)))) { 13546 if ($notnull_bool(!$notnull_bool(this.namesInOrder(args)))) {
13567 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s); 13547 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s);
13568 } 13548 }
13569 var argsCode = []; 13549 var argsCode = [];
13570 if ($notnull_bool(target != null && (this.get$isConstructor() || target.isSupe r))) { 13550 if ($notnull_bool(target != null && ($notnull_bool(this.get$isConstructor() || target.isSuper)))) {
13571 argsCode.add('this'); 13551 argsCode.add('this');
13572 } 13552 }
13573 var bareCount = args.get$bareCount(); 13553 var bareCount = args.get$bareCount();
13574 for (var i = 0; 13554 for (var i = 0;
13575 $notnull_bool(i < bareCount); i++) { 13555 $notnull_bool(i < bareCount); i++) {
13576 var arg = args.values.$index(i); 13556 var arg = args.values.$index(i);
13577 if ($notnull_bool(i >= this.parameters.length)) { 13557 if ($notnull_bool(i >= this.parameters.length)) {
13578 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false); 13558 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false);
13579 return this._argError(context, node, target, args, $assert_String(msg)); 13559 return this._argError(context, node, target, args, $assert_String(msg));
13580 } 13560 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
13626 } 13606 }
13627 world.internalError(('wrong named arguments calling ' + this.name + ''), n ode.span); 13607 world.internalError(('wrong named arguments calling ' + this.name + ''), n ode.span);
13628 } 13608 }
13629 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); 13609 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value()));
13630 } 13610 }
13631 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); 13611 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', ');
13632 if ($notnull_bool(this.get$isConstructor())) { 13612 if ($notnull_bool(this.get$isConstructor())) {
13633 return this._invokeConstructor(context, node, target, args, argsString); 13613 return this._invokeConstructor(context, node, target, args, argsString);
13634 } 13614 }
13635 if ($notnull_bool(target != null && target.isSuper)) { 13615 if ($notnull_bool(target != null && target.isSuper)) {
13636 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '. prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.span, false , true, false); 13616 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '. prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.span, true) ;
13637 } 13617 }
13638 if ($notnull_bool(this.name.startsWith('\$'))) { 13618 if ($notnull_bool(this.name.startsWith('\$'))) {
13639 return this._invokeBuiltin(context, node, target, args, argsCode); 13619 return this._invokeBuiltin(context, node, target, args, argsCode);
13640 } 13620 }
13641 if ($notnull_bool(this.isFactory)) { 13621 if ($notnull_bool(this.isFactory)) {
13642 return new Value(this.returnType, ('' + this.get$generatedFactoryName() + '( ' + argsString + ')'), node.span, false, true, false); 13622 return new Value(this.returnType, ('' + this.get$generatedFactoryName() + '( ' + argsString + ')'), node.span, true);
13643 } 13623 }
13644 if ($notnull_bool(this.isStatic)) { 13624 if ($notnull_bool(this.isStatic)) {
13645 if ($notnull_bool(this.declaringType.get$isTop())) { 13625 if ($notnull_bool(this.declaringType.get$isTop())) {
13646 return new Value(this.returnType, ('' + this.get$jsname() + '(' + argsStri ng + ')'), $notnull_bool(node != null) ? node.span : node, false, true, false); 13626 return new Value(this.returnType, ('' + this.get$jsname() + '(' + argsStri ng + ')'), $notnull_bool(node != null) ? node.span : node, true);
13647 } 13627 }
13648 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '. ' + this.get$jsname() + '(' + argsString + ')'), node.span, false, true, false); 13628 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '. ' + this.get$jsname() + '(' + argsString + ')'), node.span, true);
13649 } 13629 }
13650 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ') '); 13630 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ') ');
13651 if ($notnull_bool(target.get$isConst())) { 13631 if ($notnull_bool(target.get$isConst())) {
13652 if ($notnull_bool((target instanceof GlobalValue))) { 13632 if ($notnull_bool((target instanceof GlobalValue))) {
13653 target = target.get$dynamic().exp; 13633 target = target.get$dynamic().exp;
13654 } 13634 }
13655 if ($notnull_bool(this.name == 'get\$length')) { 13635 if ($notnull_bool(this.name == 'get\$length')) {
13656 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof ConstMapValue))) { 13636 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof ConstMapValue))) {
13657 code = ('' + target.get$dynamic().values.length + ''); 13637 code = ('' + target.get$dynamic().values.length + '');
13658 } 13638 }
13659 } 13639 }
13660 else if ($notnull_bool(this.name == 'isEmpty')) { 13640 else if ($notnull_bool(this.name == 'isEmpty')) {
13661 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof ConstMapValue))) { 13641 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof ConstMapValue))) {
13662 code = ('' + target.get$dynamic().values.isEmpty() + ''); 13642 code = ('' + target.get$dynamic().values.isEmpty() + '');
13663 } 13643 }
13664 } 13644 }
13665 } 13645 }
13666 if ($notnull_bool(this.name == 'get\$typeName' && $eq(this.declaringType.get$l ibrary(), world.get$dom()))) { 13646 if ($notnull_bool(this.name == 'get\$typeName' && $eq(this.declaringType.get$l ibrary(), world.get$dom()))) {
13667 world.gen.corejs.useTypeNameOf = true; 13647 world.gen.corejs.useTypeNameOf = true;
13668 } 13648 }
13669 return new Value(this.returnType, code, node.span, false, true, false); 13649 return new Value(this.returnType, code, node.span, true);
13670 } 13650 }
13671 MethodMember.prototype._invokeConstructor = function(context, node, target, args , argsString) { 13651 MethodMember.prototype._invokeConstructor = function(context, node, target, args , argsString) {
13672 this.declaringType.markUsed(); 13652 this.declaringType.markUsed();
13673 if ($notnull_bool(target != null)) { 13653 if ($notnull_bool(target != null)) {
13674 var code = $notnull_bool((this.get$constructorName() != '')) ? ('' + this.de claringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + a rgsString + ')') : ('' + this.declaringType.get$jsname() + '.call(' + argsString + ')'); 13654 var code = $notnull_bool((this.get$constructorName() != '')) ? ('' + this.de claringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + a rgsString + ')') : ('' + this.declaringType.get$jsname() + '.call(' + argsString + ')');
13675 return new Value(this.declaringType, code, node.span, false, true, false); 13655 return new Value(this.declaringType, code, node.span, true);
13676 } 13656 }
13677 else { 13657 else {
13678 var code = $notnull_bool((this.get$constructorName() != '')) ? ('new ' + thi s.declaringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + ar gsString + ')') : ('new ' + this.declaringType.get$jsname() + '(' + argsString + ')'); 13658 var code = $notnull_bool((this.get$constructorName() != '')) ? ('new ' + thi s.declaringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + ar gsString + ')') : ('new ' + this.declaringType.get$jsname() + '(' + argsString + ')');
13679 if ($notnull_bool(this.isConst && (node instanceof lang_NewExpression) && no de.get$dynamic().get$isConst())) { 13659 if ($notnull_bool(this.isConst && (node instanceof lang_NewExpression)) && n ode.get$dynamic().get$isConst()) {
13680 return this._invokeConstConstructor(node, $assert_String(code), target, ar gs); 13660 return this._invokeConstConstructor(node, $assert_String(code), target, ar gs);
13681 } 13661 }
13682 else { 13662 else {
13683 return new Value(this.declaringType, code, node.span, false, true, false); 13663 return new Value(this.declaringType, code, node.span, true);
13684 } 13664 }
13685 } 13665 }
13686 } 13666 }
13687 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar gs) { 13667 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar gs) {
13688 var $0; 13668 var $0;
13689 var fields = new HashMapImplementation$String$EvaluatedValue(); 13669 var fields = new HashMapImplementation$String$EvaluatedValue();
13690 for (var i = 0; 13670 for (var i = 0;
13691 $notnull_bool(i < this.parameters.length); i++) { 13671 $notnull_bool(i < this.parameters.length); i++) {
13692 var param = this.parameters.$index(i); 13672 var param = this.parameters.$index(i);
13693 if ($notnull_bool(param.isInitializer)) { 13673 if ($notnull_bool(param.isInitializer)) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
13747 var fname = x.name.name; 13727 var fname = x.name.name;
13748 var val = this.generator.visitValue(assign.y); 13728 var val = this.generator.visitValue(assign.y);
13749 fields.$setindex(fname, val); 13729 fields.$setindex(fname, val);
13750 } 13730 }
13751 } 13731 }
13752 this.generator._popBlock(); 13732 this.generator._popBlock();
13753 } 13733 }
13754 var $list = this.declaringType.get$members().getValues(); 13734 var $list = this.declaringType.get$members().getValues();
13755 for (var $i = this.declaringType.get$members().getValues().iterator(); $i.hasN ext(); ) { 13735 for (var $i = this.declaringType.get$members().getValues().iterator(); $i.hasN ext(); ) {
13756 var f = $i.next(); 13736 var f = $i.next();
13757 if ($notnull_bool((f instanceof FieldMember) && !$notnull_bool(f.get$isStati c()) && $ne(f.get$value(), null) && !$notnull_bool(fields.containsKey(f.get$name ())))) { 13737 if ($notnull_bool((f instanceof FieldMember) && !$notnull_bool(f.get$isStati c())) && $ne(f.get$value(), null) && !$notnull_bool(fields.containsKey(f.get$nam e()))) {
13758 fields.$setindex(f.get$name(), f.computeValue()); 13738 fields.$setindex(f.get$name(), f.computeValue());
13759 } 13739 }
13760 } 13740 }
13761 return world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(this .declaringType, fields, code, node.span), args.values); 13741 return world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(this .declaringType, fields, code, node.span), args.values);
13762 } 13742 }
13763 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar gsCode) { 13743 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar gsCode) {
13764 var allConst = target.get$isConst() && args.values.every((function (arg) { 13744 var allConst = $notnull_bool(target.get$isConst() && args.values.every((functi on (arg) {
13765 return arg.get$isConst(); 13745 return arg.get$isConst();
13766 }) 13746 })
13767 ); 13747 ));
13768 if ($notnull_bool(this.declaringType.get$isNum())) { 13748 if ($notnull_bool(this.declaringType.get$isNum())) {
13769 if ($notnull_bool(!$notnull_bool(allConst))) { 13749 if ($notnull_bool(!$notnull_bool(allConst))) {
13770 var code; 13750 var code;
13771 if ($notnull_bool(this.name == '\$negate')) { 13751 if ($notnull_bool(this.name == '\$negate')) {
13772 code = ('-' + target.code + ''); 13752 code = ('-' + target.code + '');
13773 } 13753 }
13774 else if ($notnull_bool(this.name == '\$bit_not')) { 13754 else if ($notnull_bool(this.name == '\$bit_not')) {
13775 code = ('~' + target.code + ''); 13755 code = ('~' + target.code + '');
13776 } 13756 }
13777 else if ($notnull_bool(this.name == '\$truncdiv' || this.name == '\$mod')) { 13757 else if ($notnull_bool(this.name == '\$truncdiv' || this.name == '\$mod')) {
13778 world.gen.corejs.useOperator(this.name); 13758 world.gen.corejs.useOperator(this.name);
13779 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) + ')'); 13759 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) + ')');
13780 } 13760 }
13781 else { 13761 else {
13782 var op = TokenKind.rawOperatorFromMethod(this.name); 13762 var op = TokenKind.rawOperatorFromMethod(this.name);
13783 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''); 13763 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + '');
13784 } 13764 }
13785 return new Value(this.returnType, code, node.span, false, true, false); 13765 return new Value(this.returnType, code, node.span, true);
13786 } 13766 }
13787 else { 13767 else {
13788 var value; 13768 var value;
13789 var val0, val1, ival0, ival1; 13769 var val0, val1, ival0, ival1;
13790 val0 = $assert_num(target.get$dynamic().get$actualValue()); 13770 val0 = $assert_num(target.get$dynamic().get$actualValue());
13791 ival0 = val0.toInt(); 13771 ival0 = val0.toInt();
13792 if ($notnull_bool(args.values.length > 0)) { 13772 if ($notnull_bool(args.values.length > 0)) {
13793 val1 = $assert_num(args.values.$index(0).get$dynamic().get$actualValue() ); 13773 val1 = $assert_num(args.values.$index(0).get$dynamic().get$actualValue() );
13794 ival1 = val1.toInt(); 13774 ival1 = val1.toInt();
13795 } 13775 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
13893 13873
13894 value = (ival0 >>> ival1).toDouble(); 13874 value = (ival0 >>> ival1).toDouble();
13895 break; 13875 break;
13896 13876
13897 } 13877 }
13898 return EvaluatedValue.EvaluatedValue$factory(this.returnType, value, ("" + value + ""), node.span); 13878 return EvaluatedValue.EvaluatedValue$factory(this.returnType, value, ("" + value + ""), node.span);
13899 } 13879 }
13900 } 13880 }
13901 else if ($notnull_bool(this.declaringType.get$isString())) { 13881 else if ($notnull_bool(this.declaringType.get$isString())) {
13902 if ($notnull_bool(this.name == '\$index')) { 13882 if ($notnull_bool(this.name == '\$index')) {
13903 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i ndex(0) + ']'), node.span, false, true, false); 13883 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i ndex(0) + ']'), node.span, true);
13904 } 13884 }
13905 else if ($notnull_bool(this.name == '\$add')) { 13885 else if ($notnull_bool(this.name == '\$add')) {
13906 if ($notnull_bool(allConst)) { 13886 if ($notnull_bool(allConst)) {
13907 var val0 = target.get$dynamic().get$actualValue(); 13887 var val0 = target.get$dynamic().get$actualValue();
13908 val0 = val0.substring(1, val0.length - 1); 13888 val0 = val0.substring(1, val0.length - 1);
13909 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); 13889 var val1 = args.values.$index(0).get$dynamic().get$actualValue();
13910 if ($notnull_bool(args.values.$index(0).type.get$isString())) { 13890 if ($notnull_bool(args.values.$index(0).type.get$isString())) {
13911 val1 = val1.substring(1, val1.length - 1); 13891 val1 = val1.substring(1, val1.length - 1);
13912 } 13892 }
13913 var value = ('' + val0 + '' + val1 + ''); 13893 var value = ('' + val0 + '' + val1 + '');
13914 value = '"' + value.replaceAll('"', '\\"') + '"'; 13894 value = '"' + value.replaceAll('"', '\\"') + '"';
13915 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, $a ssert_String(value), node.span); 13895 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, $a ssert_String(value), node.span);
13916 } 13896 }
13917 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM PTY()); 13897 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM PTY());
13918 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode. $index(0) + ''), node.span, false, true, false); 13898 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode. $index(0) + ''), node.span, true);
13919 } 13899 }
13920 } 13900 }
13921 else if ($notnull_bool(this.declaringType.get$isNativeType())) { 13901 else if ($notnull_bool(this.declaringType.get$isNativeType())) {
13922 if ($notnull_bool(this.name == '\$index')) { 13902 if ($notnull_bool(this.name == '\$index')) {
13923 return new Value(null, ('' + target.code + '[' + argsCode.$index(0) + ']') , node.span, false, true, false); 13903 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde x(0) + ']'), node.span, true);
13924 } 13904 }
13925 else if ($notnull_bool(this.name == '\$setindex')) { 13905 else if ($notnull_bool(this.name == '\$setindex')) {
13926 return new Value(null, ('' + target.code + '[' + argsCode.$index(0) + '] = ' + argsCode.$index(1) + ''), node.span, false, true, false); 13906 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde x(0) + '] = ' + argsCode.$index(1) + ''), node.span, true);
13927 } 13907 }
13928 } 13908 }
13929 if ($notnull_bool(this.name == '\$eq' || this.name == '\$ne')) { 13909 if ($notnull_bool(this.name == '\$eq' || this.name == '\$ne')) {
13930 var op = $notnull_bool(this.name == '\$eq') ? '==' : '!='; 13910 var op = $notnull_bool(this.name == '\$eq') ? '==' : '!=';
13931 if ($notnull_bool(allConst)) { 13911 if ($notnull_bool(allConst)) {
13932 var val0 = target.get$dynamic().get$actualValue(); 13912 var val0 = target.get$dynamic().get$actualValue();
13933 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); 13913 var val1 = args.values.$index(0).get$dynamic().get$actualValue();
13934 var newVal = $notnull_bool(this.name == '\$eq') ? $eq(val0, val1) : $ne(va l0, val1); 13914 var newVal = $notnull_bool(this.name == '\$eq') ? $eq(val0, val1) : $ne(va l0, val1);
13935 return EvaluatedValue.EvaluatedValue$factory(world.boolType, newVal, ("" + newVal + ""), node.span); 13915 return EvaluatedValue.EvaluatedValue$factory(world.boolType, newVal, ("" + newVal + ""), node.span);
13936 } 13916 }
13937 if ($notnull_bool($eq(argsCode.$index(0), 'null'))) { 13917 if ($notnull_bool($eq(argsCode.$index(0), 'null'))) {
13938 return new Value(this.returnType, ('' + target.code + ' ' + op + ' null'), node.span, false, true, false); 13918 return new Value(this.returnType, ('' + target.code + ' ' + op + ' null'), node.span, true);
13939 } 13919 }
13940 else if ($notnull_bool(target.type.get$isNum() || target.type.get$isString() )) { 13920 else if ($notnull_bool(target.type.get$isNum() || target.type.get$isString() )) {
13941 return new Value(this.returnType, ('' + target.code + ' ' + op + ' ' + arg sCode.$index(0) + ''), node.span, false, true, false); 13921 return new Value(this.returnType, ('' + target.code + ' ' + op + ' ' + arg sCode.$index(0) + ''), node.span, true);
13942 } 13922 }
13943 world.gen.corejs.useOperator(this.name); 13923 world.gen.corejs.useOperator(this.name);
13944 return new Value(this.returnType, ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) + ')'), node.span, false, true, false); 13924 return new Value(this.returnType, ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) + ')'), node.span, true);
13945 } 13925 }
13946 if ($notnull_bool(this.name == '\$call')) { 13926 if ($notnull_bool(this.name == '\$call')) {
13947 this.declaringType.markUsed(); 13927 this.declaringType.markUsed();
13948 return new Value(this.returnType, ('' + target.code + '(' + Strings.join((ar gsCode && argsCode.is$List$String()), ", ") + ')'), node.span, false, true, fals e); 13928 return new Value(this.returnType, ('' + target.code + '(' + Strings.join((ar gsCode && argsCode.is$List$String()), ", ") + ')'), node.span, true);
13949 } 13929 }
13950 if ($notnull_bool(this.name == '\$index')) { 13930 if ($notnull_bool(this.name == '\$index')) {
13951 world.gen.corejs.useIndex = true; 13931 world.gen.corejs.useIndex = true;
13952 } 13932 }
13953 else if ($notnull_bool(this.name == '\$setindex')) { 13933 else if ($notnull_bool(this.name == '\$setindex')) {
13954 world.gen.corejs.useSetIndex = true; 13934 world.gen.corejs.useSetIndex = true;
13955 } 13935 }
13956 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); 13936 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', ');
13957 return new Value(this.returnType, ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, false, true, false); 13937 return new Value(this.returnType, ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true);
13958 } 13938 }
13959 MethodMember.prototype.resolve = function(inType) { 13939 MethodMember.prototype.resolve = function(inType) {
13960 this.isStatic = inType.get$isTop(); 13940 this.isStatic = inType.get$isTop();
13961 this.isConst = false; 13941 this.isConst = false;
13962 this.isFactory = false; 13942 this.isFactory = false;
13963 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass()); 13943 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass());
13964 if ($notnull_bool(this.definition.modifiers != null)) { 13944 if ($notnull_bool(this.definition.modifiers != null)) {
13965 var $list = this.definition.modifiers; 13945 var $list = this.definition.modifiers;
13966 for (var $i = 0;$i < $list.length; $i++) { 13946 for (var $i = 0;$i < $list.length; $i++) {
13967 var mod = $list.$index($i); 13947 var mod = $list.$index($i);
(...skipping 27 matching lines...) Expand all
13995 this.isAbstract = true; 13975 this.isAbstract = true;
13996 } 13976 }
13997 else { 13977 else {
13998 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span ()); 13978 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span ());
13999 } 13979 }
14000 } 13980 }
14001 } 13981 }
14002 if ($notnull_bool(this.isFactory)) { 13982 if ($notnull_bool(this.isFactory)) {
14003 this.isStatic = true; 13983 this.isStatic = true;
14004 } 13984 }
14005 if ($notnull_bool(this.name.startsWith('\$') && !$notnull_bool(this.name.start sWith('\$call')) && this.isStatic)) { 13985 if ($notnull_bool(this.name.startsWith('\$') && !$notnull_bool(this.name.start sWith('\$call'))) && this.isStatic) {
14006 world.error(('operator method may not be static "' + this.name + '"'), this. get$span()); 13986 world.error(('operator method may not be static "' + this.name + '"'), this. get$span());
14007 } 13987 }
14008 if ($notnull_bool(this.isAbstract)) { 13988 if ($notnull_bool(this.isAbstract)) {
14009 if ($notnull_bool(this.definition.body != null && !(this.declaringType.get$d efinition() instanceof FunctionTypeDefinition))) { 13989 if ($notnull_bool(this.definition.body != null && !(this.declaringType.get$d efinition() instanceof FunctionTypeDefinition))) {
14010 world.error('abstract method can not have a body', this.get$span()); 13990 world.error('abstract method can not have a body', this.get$span());
14011 } 13991 }
14012 if ($notnull_bool(this.isStatic && !(this.declaringType.get$definition() ins tanceof FunctionTypeDefinition))) { 13992 if ($notnull_bool(this.isStatic && !(this.declaringType.get$definition() ins tanceof FunctionTypeDefinition))) {
14013 world.error('static method can not be abstract', this.get$span()); 13993 world.error('static method can not be abstract', this.get$span());
14014 } 13994 }
14015 } 13995 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
14068 MemberSet.prototype.get$containsMethods = function() { 14048 MemberSet.prototype.get$containsMethods = function() {
14069 return this.members.some((function (m) { 14049 return this.members.some((function (m) {
14070 return (m instanceof MethodMember); 14050 return (m instanceof MethodMember);
14071 }) 14051 })
14072 ); 14052 );
14073 } 14053 }
14074 MemberSet.prototype.add = function(member) { 14054 MemberSet.prototype.add = function(member) {
14075 return this.members.add(member); 14055 return this.members.add(member);
14076 } 14056 }
14077 MemberSet.prototype.get$isStatic = function() { 14057 MemberSet.prototype.get$isStatic = function() {
14078 return $assert_bool(this.members.length == 1 && this.members.$index(0).get$isS tatic()); 14058 return $notnull_bool(this.members.length == 1 && this.members.$index(0).get$is Static());
14079 } 14059 }
14080 MemberSet.prototype.canInvoke = function(context, args) { 14060 MemberSet.prototype.canInvoke = function(context, args) {
14081 return this.members.some((function (m) { 14061 return this.members.some((function (m) {
14082 return m.canInvoke(context, args); 14062 return m.canInvoke(context, args);
14083 }) 14063 })
14084 ); 14064 );
14085 } 14065 }
14086 MemberSet.prototype._makeError = function(node, target, action) { 14066 MemberSet.prototype._makeError = function(node, target, action) {
14087 if ($notnull_bool(!$notnull_bool(target.type.get$isVar()))) { 14067 if ($notnull_bool(!$notnull_bool(target.type.get$isVar()))) {
14088 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span); 14068 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span);
14089 } 14069 }
14090 return new Value(null, ('' + target.code + '.' + this.jsname + '() /*no applic able ' + action + '*/'), node.span, false, true, false); 14070 return new Value(world.varType, ('' + target.code + '.' + this.jsname + '() /* no applicable ' + action + '*/'), node.span, true);
14091 } 14071 }
14092 MemberSet.prototype.get$treatAsField = function() { 14072 MemberSet.prototype.get$treatAsField = function() {
14093 if ($notnull_bool(this._treatAsField == null)) { 14073 if ($notnull_bool(this._treatAsField == null)) {
14094 this._treatAsField = true; 14074 this._treatAsField = true;
14095 var $list = this.members; 14075 var $list = this.members;
14096 for (var $i = 0;$i < $list.length; $i++) { 14076 for (var $i = 0;$i < $list.length; $i++) {
14097 var member = $list.$index($i); 14077 var member = $list.$index($i);
14098 if ($notnull_bool(member.get$requiresFieldSyntax())) { 14078 if ($notnull_bool(member.get$requiresFieldSyntax())) {
14099 this._treatAsField = true; 14079 this._treatAsField = true;
14100 break; 14080 break;
14101 } 14081 }
14102 if ($notnull_bool(member.get$prefersPropertySyntax())) { 14082 if ($notnull_bool(member.get$prefersPropertySyntax())) {
14103 this._treatAsField = false; 14083 this._treatAsField = false;
14104 } 14084 }
14105 } 14085 }
14106 var $list = this.members; 14086 var $list = this.members;
14107 for (var $i = 0;$i < $list.length; $i++) { 14087 for (var $i = 0;$i < $list.length; $i++) {
14108 var member = $list.$index($i); 14088 var member = $list.$index($i);
14109 if ($notnull_bool(this._treatAsField)) { 14089 if ($notnull_bool(this._treatAsField)) {
14110 member.provideFieldSyntax(); 14090 member.provideFieldSyntax();
14111 } 14091 }
14112 else { 14092 else {
14113 member.providePropertySyntax(); 14093 member.providePropertySyntax();
14114 } 14094 }
14115 } 14095 }
14116 } 14096 }
14117 return this._treatAsField; 14097 return this._treatAsField;
14118 } 14098 }
14119 MemberSet.prototype._get = function(context, node, target, isDynamic) { 14099 MemberSet.prototype._get = function(context, node, target, isDynamic) {
14120 var $0;
14121 if ($notnull_bool(this.members.length == 1)) { 14100 if ($notnull_bool(this.members.length == 1)) {
14122 return this.members.$index(0)._get(context, node, target, isDynamic); 14101 return this.members.$index(0)._get(context, node, target, isDynamic);
14123 } 14102 }
14124 var targets = this.members.filter((function (m) { 14103 var targets = this.members.filter((function (m) {
14125 return m.get$canGet(); 14104 return m.get$canGet();
14126 }) 14105 })
14127 ); 14106 );
14128 if ($notnull_bool(targets.length == 1)) { 14107 if ($notnull_bool(targets.length == 1)) {
14129 return targets.$index(0)._get(context, node, target, isDynamic); 14108 return targets.$index(0)._get(context, node, target, isDynamic);
14130 } 14109 }
14131 var returnValue = null; 14110 var returnValue = null;
14132 for (var $i = targets.iterator(); $i.hasNext(); ) { 14111 for (var $i = targets.iterator(); $i.hasNext(); ) {
14133 var member = $i.next(); 14112 var member = $i.next();
14134 var value = member._get(context, node, target, true); 14113 var value = member._get(context, node, target, true);
14135 returnValue = this._tryUnion(returnValue, value, node); 14114 returnValue = this._tryUnion(returnValue, value, node);
14136 } 14115 }
14137 if ($notnull_bool(returnValue == null)) { 14116 if ($notnull_bool(returnValue == null)) {
14138 return this._makeError(node, target, 'getter'); 14117 return this._makeError(node, target, 'getter');
14139 } 14118 }
14140 if ($notnull_bool(returnValue.code == null)) { 14119 if ($notnull_bool(returnValue.code == null)) {
14141 if ($notnull_bool(this.get$treatAsField())) { 14120 if ($notnull_bool(this.get$treatAsField())) {
14142 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ''), node.span, false, true, false); 14121 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ''), node.span, true);
14143 } 14122 }
14144 else { 14123 else {
14145 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn ame + '()'), node.span, false, true, false); 14124 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn ame + '()'), node.span, true);
14146 } 14125 }
14147 } 14126 }
14148 return returnValue; 14127 return returnValue;
14149 } 14128 }
14150 MemberSet.prototype._set = function(context, node, target, value, isDynamic) { 14129 MemberSet.prototype._set = function(context, node, target, value, isDynamic) {
14151 var $0;
14152 if ($notnull_bool(this.members.length == 1)) { 14130 if ($notnull_bool(this.members.length == 1)) {
14153 return this.members.$index(0)._set(context, node, target, value, isDynamic); 14131 return this.members.$index(0)._set(context, node, target, value, isDynamic);
14154 } 14132 }
14155 var targets = this.members.filter((function (m) { 14133 var targets = this.members.filter((function (m) {
14156 return m.get$canSet(); 14134 return m.get$canSet();
14157 }) 14135 })
14158 ); 14136 );
14159 if ($notnull_bool(targets.length == 1)) { 14137 if ($notnull_bool(targets.length == 1)) {
14160 return targets.$index(0)._set(context, node, target, value, isDynamic); 14138 return targets.$index(0)._set(context, node, target, value, isDynamic);
14161 } 14139 }
14162 var returnValue = null; 14140 var returnValue = null;
14163 for (var $i = targets.iterator(); $i.hasNext(); ) { 14141 for (var $i = targets.iterator(); $i.hasNext(); ) {
14164 var member = $i.next(); 14142 var member = $i.next();
14165 var res = member._set(context, node, target, value, true); 14143 var res = member._set(context, node, target, value, true);
14166 returnValue = this._tryUnion(returnValue, res, node); 14144 returnValue = this._tryUnion(returnValue, res, node);
14167 } 14145 }
14168 if ($notnull_bool(returnValue == null)) { 14146 if ($notnull_bool(returnValue == null)) {
14169 return this._makeError(node, target, 'setter'); 14147 return this._makeError(node, target, 'setter');
14170 } 14148 }
14171 if ($notnull_bool(returnValue.code == null)) { 14149 if ($notnull_bool(returnValue.code == null)) {
14172 if ($notnull_bool(this.get$treatAsField())) { 14150 if ($notnull_bool(this.get$treatAsField())) {
14173 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ' = ' + value.code + ''), node.span, false, true, false); 14151 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ' = ' + value.code + ''), node.span, true);
14174 } 14152 }
14175 else { 14153 else {
14176 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn ame + '(' + value.code + ')'), node.span, false, true, false); 14154 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn ame + '(' + value.code + ')'), node.span, true);
14177 } 14155 }
14178 } 14156 }
14179 return returnValue; 14157 return returnValue;
14180 } 14158 }
14181 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { 14159 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) {
14182 var $0;
14183 if ($notnull_bool(this.members.length == 1)) { 14160 if ($notnull_bool(this.members.length == 1)) {
14184 return this.members.$index(0).invoke(context, node, target, args, isDynamic) ; 14161 return this.members.$index(0).invoke(context, node, target, args, isDynamic) ;
14185 } 14162 }
14186 var targets = this.members.filter((function (m) { 14163 var targets = this.members.filter((function (m) {
14187 return m.canInvoke(context, args); 14164 return m.canInvoke(context, args);
14188 }) 14165 })
14189 ); 14166 );
14190 if ($notnull_bool(targets.length == 1)) { 14167 if ($notnull_bool(targets.length == 1)) {
14191 return targets.$index(0).invoke(context, node, target, args, isDynamic); 14168 return targets.$index(0).invoke(context, node, target, args, isDynamic);
14192 } 14169 }
(...skipping 23 matching lines...) Expand all
14216 if ($notnull_bool(x == null)) return y; 14193 if ($notnull_bool(x == null)) return y;
14217 var type = lang_Type.union(x.type, y.type); 14194 var type = lang_Type.union(x.type, y.type);
14218 if ($notnull_bool(x.code == y.code)) { 14195 if ($notnull_bool(x.code == y.code)) {
14219 if ($notnull_bool($eq(type, x.type))) { 14196 if ($notnull_bool($eq(type, x.type))) {
14220 return x; 14197 return x;
14221 } 14198 }
14222 else if ($notnull_bool(x.get$isConst() || y.get$isConst())) { 14199 else if ($notnull_bool(x.get$isConst() || y.get$isConst())) {
14223 world.internalError("unexpected: union of const values "); 14200 world.internalError("unexpected: union of const values ");
14224 } 14201 }
14225 else { 14202 else {
14226 return new Value(type, x.code, node.span, x.isSuper && y.isSuper, x.needsT emp || y.needsTemp, x.isType && y.isType); 14203 var ret = new Value(type, x.code, node.span, true);
14204 ret.isSuper = $notnull_bool(x.isSuper && y.isSuper);
14205 ret.needsTemp = $notnull_bool(x.needsTemp || y.needsTemp);
14206 ret.isType = $notnull_bool(x.isType && y.isType);
14207 return (ret && ret.is$Value());
14227 } 14208 }
14228 } 14209 }
14229 else { 14210 else {
14230 return new Value(type, null, node.span, false, true, false); 14211 return new Value(type, null, node.span, true);
14231 } 14212 }
14232 } 14213 }
14233 MemberSet.prototype.getVarMember = function(context, node, args) { 14214 MemberSet.prototype.getVarMember = function(context, node, args) {
14234 if ($notnull_bool(world.objectType.varStubs == null)) { 14215 if ($notnull_bool(world.objectType.varStubs == null)) {
14235 world.objectType.varStubs = $map([]); 14216 world.objectType.varStubs = $map([]);
14236 } 14217 }
14237 var stubName = _getCallStubName(this.name, args); 14218 var stubName = _getCallStubName(this.name, args);
14238 var stub = world.objectType.varStubs.$index(stubName); 14219 var stub = world.objectType.varStubs.$index(stubName);
14239 if ($notnull_bool(stub == null)) { 14220 if ($notnull_bool(stub == null)) {
14240 var mset = context.findMembers(this.name).members; 14221 var mset = context.findMembers(this.name).members;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
14485 else { 14466 else {
14486 return this._finishToken(63/*TokenKind.WHITESPACE*/); 14467 return this._finishToken(63/*TokenKind.WHITESPACE*/);
14487 } 14468 }
14488 } 14469 }
14489 } 14470 }
14490 return this._finishToken(1/*TokenKind.END_OF_FILE*/); 14471 return this._finishToken(1/*TokenKind.END_OF_FILE*/);
14491 } 14472 }
14492 TokenizerBase.prototype.finishHashBang = function() { 14473 TokenizerBase.prototype.finishHashBang = function() {
14493 while ($notnull_bool(true)) { 14474 while ($notnull_bool(true)) {
14494 var ch = this._nextChar(); 14475 var ch = this._nextChar();
14495 if ($notnull_bool(ch == 0 || ch == 10 || ch == 13)) { 14476 if ($notnull_bool(ch == 0 || ch == 10) || ch == 13) {
14496 return this._finishToken(13/*TokenKind.HASHBANG*/); 14477 return this._finishToken(13/*TokenKind.HASHBANG*/);
14497 } 14478 }
14498 } 14479 }
14499 } 14480 }
14500 TokenizerBase.prototype.finishSingleLineComment = function() { 14481 TokenizerBase.prototype.finishSingleLineComment = function() {
14501 while ($notnull_bool(true)) { 14482 while ($notnull_bool(true)) {
14502 var ch = this._nextChar(); 14483 var ch = this._nextChar();
14503 if ($notnull_bool(ch == 0 || ch == 10 || ch == 13)) { 14484 if ($notnull_bool(ch == 0 || ch == 10) || ch == 13) {
14504 if ($notnull_bool(this._skipWhitespace)) { 14485 if ($notnull_bool(this._skipWhitespace)) {
14505 return this.next(); 14486 return this.next();
14506 } 14487 }
14507 else { 14488 else {
14508 return this._finishToken(64/*TokenKind.COMMENT*/); 14489 return this._finishToken(64/*TokenKind.COMMENT*/);
14509 } 14490 }
14510 } 14491 }
14511 } 14492 }
14512 } 14493 }
14513 TokenizerBase.prototype.finishMultiLineComment = function() { 14494 TokenizerBase.prototype.finishMultiLineComment = function() {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
14663 } 14644 }
14664 } 14645 }
14665 } 14646 }
14666 TokenizerBase.prototype.finishMultilineRawString = function(quote) { 14647 TokenizerBase.prototype.finishMultilineRawString = function(quote) {
14667 while ($notnull_bool(true)) { 14648 while ($notnull_bool(true)) {
14668 var ch = this._nextChar(); 14649 var ch = this._nextChar();
14669 if ($notnull_bool(ch == 0)) { 14650 if ($notnull_bool(ch == 0)) {
14670 var kind = $notnull_bool(quote == 34) ? 68/*TokenKind.INCOMPLETE_MULTILINE _STRING_DQ*/ : 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/; 14651 var kind = $notnull_bool(quote == 34) ? 68/*TokenKind.INCOMPLETE_MULTILINE _STRING_DQ*/ : 69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/;
14671 return this._finishToken(kind); 14652 return this._finishToken(kind);
14672 } 14653 }
14673 else if ($notnull_bool(ch == quote && this._maybeEatChar(quote) && this._may beEatChar(quote))) { 14654 else if ($notnull_bool(ch == quote && this._maybeEatChar(quote)) && this._ma ybeEatChar(quote)) {
14674 return this._finishToken(58/*TokenKind.STRING*/); 14655 return this._finishToken(58/*TokenKind.STRING*/);
14675 } 14656 }
14676 } 14657 }
14677 } 14658 }
14678 TokenizerBase.prototype.finishStringBody = function(quote) { 14659 TokenizerBase.prototype.finishStringBody = function(quote) {
14679 while ($notnull_bool(true)) { 14660 while ($notnull_bool(true)) {
14680 var ch = this._nextChar(); 14661 var ch = this._nextChar();
14681 if ($notnull_bool(ch == quote)) { 14662 if ($notnull_bool(ch == quote)) {
14682 return this._finishToken(58/*TokenKind.STRING*/); 14663 return this._finishToken(58/*TokenKind.STRING*/);
14683 } 14664 }
14684 else if ($notnull_bool(ch == 36)) { 14665 else if ($notnull_bool(ch == 36)) {
14685 this._interpStack = InterpStack.push(this._interpStack, quote, false); 14666 this._interpStack = InterpStack.push(this._interpStack, quote, false);
14686 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); 14667 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/);
14687 } 14668 }
14688 else if ($notnull_bool(ch == 0)) { 14669 else if ($notnull_bool(ch == 0)) {
14689 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/); 14670 return this._finishToken(66/*TokenKind.INCOMPLETE_STRING*/);
14690 } 14671 }
14691 else if ($notnull_bool(ch == 92)) { 14672 else if ($notnull_bool(ch == 92)) {
14692 if ($notnull_bool(!$notnull_bool(this.eatEscapeSequence()))) { 14673 if ($notnull_bool(!$notnull_bool(this.eatEscapeSequence()))) {
14693 return this._errorToken(); 14674 return this._errorToken();
14694 } 14675 }
14695 } 14676 }
14696 } 14677 }
14697 } 14678 }
14698 TokenizerBase.prototype.eatEscapeSequence = function() { 14679 TokenizerBase.prototype.eatEscapeSequence = function() {
14699 var hex; 14680 var hex;
14700 switch (this._nextChar()) { 14681 switch (this._nextChar()) {
14701 case 120: 14682 case 120:
14702 14683
14703 return $assert_bool(this.maybeEatHexDigit() && this.maybeEatHexDigit()); 14684 return $notnull_bool(this.maybeEatHexDigit() && this.maybeEatHexDigit());
14704 14685
14705 case 117: 14686 case 117:
14706 14687
14707 if ($notnull_bool(this._maybeEatChar(123))) { 14688 if ($notnull_bool(this._maybeEatChar(123))) {
14708 var start = this._lang_index; 14689 var start = this._lang_index;
14709 this.eatHexDigits(); 14690 this.eatHexDigits();
14710 var chars = this._lang_index - start; 14691 var chars = this._lang_index - start;
14711 if ($notnull_bool(chars > 0 && chars <= 6 && this._maybeEatChar(125))) { 14692 if ($notnull_bool(chars > 0 && chars <= 6) && this._maybeEatChar(125)) {
14712 hex = this._text.substring(start, start + chars); 14693 hex = this._text.substring(start, start + chars);
14713 break; 14694 break;
14714 } 14695 }
14715 else { 14696 else {
14716 return false; 14697 return false;
14717 } 14698 }
14718 } 14699 }
14719 else { 14700 else {
14720 if ($notnull_bool(this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatHexDigit() && this.maybeEatHexDigit())) { 14701 if ($notnull_bool(this.maybeEatHexDigit() && this.maybeEatHexDigit()) && this.maybeEatHexDigit() && this.maybeEatHexDigit()) {
14721 hex = this._text.substring(this._lang_index - 4, this._lang_index); 14702 hex = this._text.substring(this._lang_index - 4, this._lang_index);
14722 break; 14703 break;
14723 } 14704 }
14724 else { 14705 else {
14725 return false; 14706 return false;
14726 } 14707 }
14727 } 14708 }
14728 14709
14729 default: 14710 default:
14730 14711
14731 return true; 14712 return true;
14732 14713
14733 } 14714 }
14734 var n = lang_Parser.parseHex(hex); 14715 var n = lang_Parser.parseHex(hex);
14735 return $assert_bool(n < 0xD800 || n > 0xDFFF && n <= 0x10FFFF); 14716 return $notnull_bool(n < 0xD800 || $notnull_bool(n > 0xDFFF && n <= 0x10FFFF)) ;
14736 } 14717 }
14737 TokenizerBase.prototype.finishDot = function() { 14718 TokenizerBase.prototype.finishDot = function() {
14738 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { 14719 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) {
14739 this.eatDigits(); 14720 this.eatDigits();
14740 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); 14721 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/);
14741 } 14722 }
14742 else { 14723 else {
14743 return this._finishToken(14/*TokenKind.DOT*/); 14724 return this._finishToken(14/*TokenKind.DOT*/);
14744 } 14725 }
14745 } 14726 }
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
15140 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114 && this._text.cha rCodeAt(i0 + 2) == 121)) return 111/*TokenKind.TRY*/; 15121 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114 && this._text.cha rCodeAt(i0 + 2) == 121)) return 111/*TokenKind.TRY*/;
15141 } 15122 }
15142 else if ($notnull_bool(this._text.charCodeAt(i0) == 118)) { 15123 else if ($notnull_bool(this._text.charCodeAt(i0) == 118)) {
15143 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97 && this._text.char CodeAt(i0 + 2) == 114)) return 112/*TokenKind.VAR*/; 15124 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97 && this._text.char CodeAt(i0 + 2) == 114)) return 112/*TokenKind.VAR*/;
15144 } 15125 }
15145 return 70/*TokenKind.IDENTIFIER*/; 15126 return 70/*TokenKind.IDENTIFIER*/;
15146 15127
15147 case 4: 15128 case 4:
15148 15129
15149 if ($notnull_bool(this._text.charCodeAt(i0) == 99)) { 15130 if ($notnull_bool(this._text.charCodeAt(i0) == 99)) {
15150 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97 && this._text.char CodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 101)) return 89/*Token Kind.CASE*/; 15131 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97 && this._text.char CodeAt(i0 + 2) == 115) && this._text.charCodeAt(i0 + 3) == 101) return 89/*Token Kind.CASE*/;
15151 } 15132 }
15152 else if ($notnull_bool(this._text.charCodeAt(i0) == 101)) { 15133 else if ($notnull_bool(this._text.charCodeAt(i0) == 101)) {
15153 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 108 && this._text.cha rCodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 101)) return 95/*Toke nKind.ELSE*/; 15134 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 108 && this._text.cha rCodeAt(i0 + 2) == 115) && this._text.charCodeAt(i0 + 3) == 101) return 95/*Toke nKind.ELSE*/;
15154 } 15135 }
15155 else if ($notnull_bool(this._text.charCodeAt(i0) == 110)) { 15136 else if ($notnull_bool(this._text.charCodeAt(i0) == 110)) {
15156 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 117 && this._text.cha rCodeAt(i0 + 2) == 108 && this._text.charCodeAt(i0 + 3) == 108)) return 104/*Tok enKind.NULL*/; 15137 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 117 && this._text.cha rCodeAt(i0 + 2) == 108) && this._text.charCodeAt(i0 + 3) == 108) return 104/*Tok enKind.NULL*/;
15157 } 15138 }
15158 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) { 15139 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) {
15159 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104)) { 15140 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104)) {
15160 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 105 && this._text.c harCodeAt(i0 + 3) == 115)) return 108/*TokenKind.THIS*/; 15141 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 105 && this._text.c harCodeAt(i0 + 3) == 115)) return 108/*TokenKind.THIS*/;
15161 } 15142 }
15162 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114)) { 15143 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114)) {
15163 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 117 && this._text.c harCodeAt(i0 + 3) == 101)) return 110/*TokenKind.TRUE*/; 15144 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 117 && this._text.c harCodeAt(i0 + 3) == 101)) return 110/*TokenKind.TRUE*/;
15164 } 15145 }
15165 } 15146 }
15166 else if ($notnull_bool(this._text.charCodeAt(i0) == 118)) { 15147 else if ($notnull_bool(this._text.charCodeAt(i0) == 118)) {
15167 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111 && this._text.cha rCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 + 3) == 100)) return 113/*Tok enKind.VOID*/; 15148 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111 && this._text.cha rCodeAt(i0 + 2) == 105) && this._text.charCodeAt(i0 + 3) == 100) return 113/*Tok enKind.VOID*/;
15168 } 15149 }
15169 return 70/*TokenKind.IDENTIFIER*/; 15150 return 70/*TokenKind.IDENTIFIER*/;
15170 15151
15171 case 5: 15152 case 5:
15172 15153
15173 if ($notnull_bool(this._text.charCodeAt(i0) == 98)) { 15154 if ($notnull_bool(this._text.charCodeAt(i0) == 98)) {
15174 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114 && this._text.cha rCodeAt(i0 + 2) == 101 && this._text.charCodeAt(i0 + 3) == 97 && this._text.char CodeAt(i0 + 4) == 107)) return 88/*TokenKind.BREAK*/; 15155 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 114 && this._text.cha rCodeAt(i0 + 2) == 101) && this._text.charCodeAt(i0 + 3) == 97 && this._text.cha rCodeAt(i0 + 4) == 107) return 88/*TokenKind.BREAK*/;
15175 } 15156 }
15176 else if ($notnull_bool(this._text.charCodeAt(i0) == 99)) { 15157 else if ($notnull_bool(this._text.charCodeAt(i0) == 99)) {
15177 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { 15158 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) {
15178 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 116 && this._text.c harCodeAt(i0 + 3) == 99 && this._text.charCodeAt(i0 + 4) == 104)) return 90/*Tok enKind.CATCH*/; 15159 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 116 && this._text.c harCodeAt(i0 + 3) == 99) && this._text.charCodeAt(i0 + 4) == 104) return 90/*Tok enKind.CATCH*/;
15179 } 15160 }
15180 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 108)) { 15161 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 108)) {
15181 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 97 && this._text.ch arCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 115)) return 73/*Tok enKind.CLASS*/; 15162 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 97 && this._text.ch arCodeAt(i0 + 3) == 115) && this._text.charCodeAt(i0 + 4) == 115) return 73/*Tok enKind.CLASS*/;
15182 } 15163 }
15183 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111)) { 15164 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111)) {
15184 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c harCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 116)) return 91/*To kenKind.CONST*/; 15165 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c harCodeAt(i0 + 3) == 115) && this._text.charCodeAt(i0 + 4) == 116) return 91/*To kenKind.CONST*/;
15185 } 15166 }
15186 } 15167 }
15187 else if ($notnull_bool(this._text.charCodeAt(i0) == 102)) { 15168 else if ($notnull_bool(this._text.charCodeAt(i0) == 102)) {
15188 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { 15169 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) {
15189 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 108 && this._text.c harCodeAt(i0 + 3) == 115 && this._text.charCodeAt(i0 + 4) == 101)) return 96/*To kenKind.FALSE*/; 15170 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 108 && this._text.c harCodeAt(i0 + 3) == 115) && this._text.charCodeAt(i0 + 4) == 101) return 96/*To kenKind.FALSE*/;
15190 } 15171 }
15191 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105)) { 15172 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105)) {
15192 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c harCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 108)) return 97/*Tok enKind.FINAL*/; 15173 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c harCodeAt(i0 + 3) == 97) && this._text.charCodeAt(i0 + 4) == 108) return 97/*Tok enKind.FINAL*/;
15193 } 15174 }
15194 } 15175 }
15195 else if ($notnull_bool(this._text.charCodeAt(i0) == 115)) { 15176 else if ($notnull_bool(this._text.charCodeAt(i0) == 115)) {
15196 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 117 && this._text.cha rCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 101 && this._text.cha rCodeAt(i0 + 4) == 114)) return 106/*TokenKind.SUPER*/; 15177 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 117 && this._text.cha rCodeAt(i0 + 2) == 112) && this._text.charCodeAt(i0 + 3) == 101 && this._text.ch arCodeAt(i0 + 4) == 114) return 106/*TokenKind.SUPER*/;
15197 } 15178 }
15198 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) { 15179 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) {
15199 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104 && this._text.cha rCodeAt(i0 + 2) == 114 && this._text.charCodeAt(i0 + 3) == 111 && this._text.cha rCodeAt(i0 + 4) == 119)) return 109/*TokenKind.THROW*/; 15180 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104 && this._text.cha rCodeAt(i0 + 2) == 114) && this._text.charCodeAt(i0 + 3) == 111 && this._text.ch arCodeAt(i0 + 4) == 119) return 109/*TokenKind.THROW*/;
15200 } 15181 }
15201 else if ($notnull_bool(this._text.charCodeAt(i0) == 119)) { 15182 else if ($notnull_bool(this._text.charCodeAt(i0) == 119)) {
15202 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104 && this._text.cha rCodeAt(i0 + 2) == 105 && this._text.charCodeAt(i0 + 3) == 108 && this._text.cha rCodeAt(i0 + 4) == 101)) return 114/*TokenKind.WHILE*/; 15183 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 104 && this._text.cha rCodeAt(i0 + 2) == 105) && this._text.charCodeAt(i0 + 3) == 108 && this._text.ch arCodeAt(i0 + 4) == 101) return 114/*TokenKind.WHILE*/;
15203 } 15184 }
15204 return 70/*TokenKind.IDENTIFIER*/; 15185 return 70/*TokenKind.IDENTIFIER*/;
15205 15186
15206 case 6: 15187 case 6:
15207 15188
15208 if ($notnull_bool(this._text.charCodeAt(i0) == 97)) { 15189 if ($notnull_bool(this._text.charCodeAt(i0) == 97)) {
15209 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 115 && this._text.cha rCodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 101 && this._text.cha rCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 116)) return 72/*Toke nKind.ASSERT*/; 15190 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 115 && this._text.cha rCodeAt(i0 + 2) == 115) && this._text.charCodeAt(i0 + 3) == 101 && this._text.ch arCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 116) return 72/*Toke nKind.ASSERT*/;
15210 } 15191 }
15211 else if ($notnull_bool(this._text.charCodeAt(i0) == 105)) { 15192 else if ($notnull_bool(this._text.charCodeAt(i0) == 105)) {
15212 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 109 && this._text.cha rCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 111 && this._text.cha rCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 116)) return 78/*Toke nKind.IMPORT*/; 15193 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 109 && this._text.cha rCodeAt(i0 + 2) == 112) && this._text.charCodeAt(i0 + 3) == 111 && this._text.ch arCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 116) return 78/*Toke nKind.IMPORT*/;
15213 } 15194 }
15214 else if ($notnull_bool(this._text.charCodeAt(i0) == 110)) { 15195 else if ($notnull_bool(this._text.charCodeAt(i0) == 110)) {
15215 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { 15196 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) {
15216 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 116 && this._text.c harCodeAt(i0 + 3) == 105 && this._text.charCodeAt(i0 + 4) == 118 && this._text.c harCodeAt(i0 + 5) == 101)) return 81/*TokenKind.NATIVE*/; 15197 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 116 && this._text.c harCodeAt(i0 + 3) == 105) && this._text.charCodeAt(i0 + 4) == 118 && this._text. charCodeAt(i0 + 5) == 101) return 81/*TokenKind.NATIVE*/;
15217 } 15198 }
15218 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101)) { 15199 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101)) {
15219 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 103 && this._text.c harCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 116 && this._text.ch arCodeAt(i0 + 5) == 101)) return 82/*TokenKind.NEGATE*/; 15200 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 103 && this._text.c harCodeAt(i0 + 3) == 97) && this._text.charCodeAt(i0 + 4) == 116 && this._text.c harCodeAt(i0 + 5) == 101) return 82/*TokenKind.NEGATE*/;
15220 } 15201 }
15221 } 15202 }
15222 else if ($notnull_bool(this._text.charCodeAt(i0) == 114)) { 15203 else if ($notnull_bool(this._text.charCodeAt(i0) == 114)) {
15223 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha rCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 117 && this._text.cha rCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 110)) return 105/*Tok enKind.RETURN*/; 15204 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha rCodeAt(i0 + 2) == 116) && this._text.charCodeAt(i0 + 3) == 117 && this._text.ch arCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 110) return 105/*Tok enKind.RETURN*/;
15224 } 15205 }
15225 else if ($notnull_bool(this._text.charCodeAt(i0) == 115)) { 15206 else if ($notnull_bool(this._text.charCodeAt(i0) == 115)) {
15226 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111)) { 15207 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111)) {
15227 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 117 && this._text.c harCodeAt(i0 + 3) == 114 && this._text.charCodeAt(i0 + 4) == 99 && this._text.ch arCodeAt(i0 + 5) == 101)) return 85/*TokenKind.SOURCE*/; 15208 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 117 && this._text.c harCodeAt(i0 + 3) == 114) && this._text.charCodeAt(i0 + 4) == 99 && this._text.c harCodeAt(i0 + 5) == 101) return 85/*TokenKind.SOURCE*/;
15228 } 15209 }
15229 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 116)) { 15210 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 116)) {
15230 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 97 && this._text.ch arCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 105 && this._text.ch arCodeAt(i0 + 5) == 99)) return 86/*TokenKind.STATIC*/; 15211 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 97 && this._text.ch arCodeAt(i0 + 3) == 116) && this._text.charCodeAt(i0 + 4) == 105 && this._text.c harCodeAt(i0 + 5) == 99) return 86/*TokenKind.STATIC*/;
15231 } 15212 }
15232 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 119)) { 15213 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 119)) {
15233 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 105 && this._text.c harCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 99 && this._text.ch arCodeAt(i0 + 5) == 104)) return 107/*TokenKind.SWITCH*/; 15214 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 105 && this._text.c harCodeAt(i0 + 3) == 116) && this._text.charCodeAt(i0 + 4) == 99 && this._text.c harCodeAt(i0 + 5) == 104) return 107/*TokenKind.SWITCH*/;
15234 } 15215 }
15235 } 15216 }
15236 return 70/*TokenKind.IDENTIFIER*/; 15217 return 70/*TokenKind.IDENTIFIER*/;
15237 15218
15238 case 7: 15219 case 7:
15239 15220
15240 if ($notnull_bool(this._text.charCodeAt(i0) == 100)) { 15221 if ($notnull_bool(this._text.charCodeAt(i0) == 100)) {
15241 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha rCodeAt(i0 + 2) == 102 && this._text.charCodeAt(i0 + 3) == 97 && this._text.char CodeAt(i0 + 4) == 117 && this._text.charCodeAt(i0 + 5) == 108 && this._text.char CodeAt(i0 + 6) == 116)) return 93/*TokenKind.DEFAULT*/; 15222 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 101 && this._text.cha rCodeAt(i0 + 2) == 102) && this._text.charCodeAt(i0 + 3) == 97 && this._text.cha rCodeAt(i0 + 4) == 117 && this._text.charCodeAt(i0 + 5) == 108 && this._text.cha rCodeAt(i0 + 6) == 116) return 93/*TokenKind.DEFAULT*/;
15242 } 15223 }
15243 else if ($notnull_bool(this._text.charCodeAt(i0) == 101)) { 15224 else if ($notnull_bool(this._text.charCodeAt(i0) == 101)) {
15244 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 120 && this._text.cha rCodeAt(i0 + 2) == 116 && this._text.charCodeAt(i0 + 3) == 101 && this._text.cha rCodeAt(i0 + 4) == 110 && this._text.charCodeAt(i0 + 5) == 100 && this._text.cha rCodeAt(i0 + 6) == 115)) return 74/*TokenKind.EXTENDS*/; 15225 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 120 && this._text.cha rCodeAt(i0 + 2) == 116) && this._text.charCodeAt(i0 + 3) == 101 && this._text.ch arCodeAt(i0 + 4) == 110 && this._text.charCodeAt(i0 + 5) == 100 && this._text.ch arCodeAt(i0 + 6) == 115) return 74/*TokenKind.EXTENDS*/;
15245 } 15226 }
15246 else if ($notnull_bool(this._text.charCodeAt(i0) == 102)) { 15227 else if ($notnull_bool(this._text.charCodeAt(i0) == 102)) {
15247 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) { 15228 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 97)) {
15248 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 99 && this._text.ch arCodeAt(i0 + 3) == 116 && this._text.charCodeAt(i0 + 4) == 111 && this._text.ch arCodeAt(i0 + 5) == 114 && this._text.charCodeAt(i0 + 6) == 121)) return 75/*Tok enKind.FACTORY*/; 15229 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 99 && this._text.ch arCodeAt(i0 + 3) == 116) && this._text.charCodeAt(i0 + 4) == 111 && this._text.c harCodeAt(i0 + 5) == 114 && this._text.charCodeAt(i0 + 6) == 121) return 75/*Tok enKind.FACTORY*/;
15249 } 15230 }
15250 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105)) { 15231 else if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105)) {
15251 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c harCodeAt(i0 + 3) == 97 && this._text.charCodeAt(i0 + 4) == 108 && this._text.ch arCodeAt(i0 + 5) == 108 && this._text.charCodeAt(i0 + 6) == 121)) return 98/*Tok enKind.FINALLY*/; 15232 if ($notnull_bool(this._text.charCodeAt(i0 + 2) == 110 && this._text.c harCodeAt(i0 + 3) == 97) && this._text.charCodeAt(i0 + 4) == 108 && this._text.c harCodeAt(i0 + 5) == 108 && this._text.charCodeAt(i0 + 6) == 121) return 98/*Tok enKind.FINALLY*/;
15252 } 15233 }
15253 } 15234 }
15254 else if ($notnull_bool(this._text.charCodeAt(i0) == 108)) { 15235 else if ($notnull_bool(this._text.charCodeAt(i0) == 108)) {
15255 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105 && this._text.cha rCodeAt(i0 + 2) == 98 && this._text.charCodeAt(i0 + 3) == 114 && this._text.char CodeAt(i0 + 4) == 97 && this._text.charCodeAt(i0 + 5) == 114 && this._text.charC odeAt(i0 + 6) == 121)) return 80/*TokenKind.LIBRARY*/; 15236 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 105 && this._text.cha rCodeAt(i0 + 2) == 98) && this._text.charCodeAt(i0 + 3) == 114 && this._text.cha rCodeAt(i0 + 4) == 97 && this._text.charCodeAt(i0 + 5) == 114 && this._text.char CodeAt(i0 + 6) == 121) return 80/*TokenKind.LIBRARY*/;
15256 } 15237 }
15257 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) { 15238 else if ($notnull_bool(this._text.charCodeAt(i0) == 116)) {
15258 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 121 && this._text.cha rCodeAt(i0 + 2) == 112 && this._text.charCodeAt(i0 + 3) == 101 && this._text.cha rCodeAt(i0 + 4) == 100 && this._text.charCodeAt(i0 + 5) == 101 && this._text.cha rCodeAt(i0 + 6) == 102)) return 87/*TokenKind.TYPEDEF*/; 15239 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 121 && this._text.cha rCodeAt(i0 + 2) == 112) && this._text.charCodeAt(i0 + 3) == 101 && this._text.ch arCodeAt(i0 + 4) == 100 && this._text.charCodeAt(i0 + 5) == 101 && this._text.ch arCodeAt(i0 + 6) == 102) return 87/*TokenKind.TYPEDEF*/;
15259 } 15240 }
15260 return 70/*TokenKind.IDENTIFIER*/; 15241 return 70/*TokenKind.IDENTIFIER*/;
15261 15242
15262 case 8: 15243 case 8:
15263 15244
15264 if ($notnull_bool(this._text.charCodeAt(i0) == 97)) { 15245 if ($notnull_bool(this._text.charCodeAt(i0) == 97)) {
15265 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 98 && this._text.char CodeAt(i0 + 2) == 115 && this._text.charCodeAt(i0 + 3) == 116 && this._text.char CodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 97 && this._text.charC odeAt(i0 + 6) == 99 && this._text.charCodeAt(i0 + 7) == 116)) return 71/*TokenKi nd.ABSTRACT*/; 15246 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 98 && this._text.char CodeAt(i0 + 2) == 115) && this._text.charCodeAt(i0 + 3) == 116 && this._text.cha rCodeAt(i0 + 4) == 114 && this._text.charCodeAt(i0 + 5) == 97 && this._text.char CodeAt(i0 + 6) == 99 && this._text.charCodeAt(i0 + 7) == 116) return 71/*TokenKi nd.ABSTRACT*/;
15266 } 15247 }
15267 else if ($notnull_bool(this._text.charCodeAt(i0) == 99)) { 15248 else if ($notnull_bool(this._text.charCodeAt(i0) == 99)) {
15268 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111 && this._text.cha rCodeAt(i0 + 2) == 110 && this._text.charCodeAt(i0 + 3) == 116 && this._text.cha rCodeAt(i0 + 4) == 105 && this._text.charCodeAt(i0 + 5) == 110 && this._text.cha rCodeAt(i0 + 6) == 117 && this._text.charCodeAt(i0 + 7) == 101)) return 92/*Toke nKind.CONTINUE*/; 15249 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 111 && this._text.cha rCodeAt(i0 + 2) == 110) && this._text.charCodeAt(i0 + 3) == 116 && this._text.ch arCodeAt(i0 + 4) == 105 && this._text.charCodeAt(i0 + 5) == 110 && this._text.ch arCodeAt(i0 + 6) == 117 && this._text.charCodeAt(i0 + 7) == 101) return 92/*Toke nKind.CONTINUE*/;
15269 } 15250 }
15270 else if ($notnull_bool(this._text.charCodeAt(i0) == 111)) { 15251 else if ($notnull_bool(this._text.charCodeAt(i0) == 111)) {
15271 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 112 && this._text.cha rCodeAt(i0 + 2) == 101 && this._text.charCodeAt(i0 + 3) == 114 && this._text.cha rCodeAt(i0 + 4) == 97 && this._text.charCodeAt(i0 + 5) == 116 && this._text.char CodeAt(i0 + 6) == 111 && this._text.charCodeAt(i0 + 7) == 114)) return 83/*Token Kind.OPERATOR*/; 15252 if ($notnull_bool(this._text.charCodeAt(i0 + 1) == 112 && this._text.cha rCodeAt(i0 + 2) == 101) && this._text.charCodeAt(i0 + 3) == 114 && this._text.ch arCodeAt(i0 + 4) == 97 && this._text.charCodeAt(i0 + 5) == 116 && this._text.cha rCodeAt(i0 + 6) == 111 && this._text.charCodeAt(i0 + 7) == 114) return 83/*Token Kind.OPERATOR*/;
15272 } 15253 }
15273 return 70/*TokenKind.IDENTIFIER*/; 15254 return 70/*TokenKind.IDENTIFIER*/;
15274 15255
15275 case 9: 15256 case 9:
15276 15257
15277 if ($notnull_bool(this._text.charCodeAt(i0) == 105 && this._text.charCodeA t(i0 + 1) == 110 && this._text.charCodeAt(i0 + 2) == 116 && this._text.charCodeA t(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCodeA t(i0 + 5) == 102 && this._text.charCodeAt(i0 + 6) == 97 && this._text.charCodeAt (i0 + 7) == 99 && this._text.charCodeAt(i0 + 8) == 101)) return 79/*TokenKind.IN TERFACE*/; 15258 if ($notnull_bool(this._text.charCodeAt(i0) == 105 && this._text.charCodeA t(i0 + 1) == 110) && this._text.charCodeAt(i0 + 2) == 116 && this._text.charCode At(i0 + 3) == 101 && this._text.charCodeAt(i0 + 4) == 114 && this._text.charCode At(i0 + 5) == 102 && this._text.charCodeAt(i0 + 6) == 97 && this._text.charCodeA t(i0 + 7) == 99 && this._text.charCodeAt(i0 + 8) == 101) return 79/*TokenKind.IN TERFACE*/;
15278 return 70/*TokenKind.IDENTIFIER*/; 15259 return 70/*TokenKind.IDENTIFIER*/;
15279 15260
15280 case 10: 15261 case 10:
15281 15262
15282 if ($notnull_bool(this._text.charCodeAt(i0) == 105 && this._text.charCodeA t(i0 + 1) == 109 && this._text.charCodeAt(i0 + 2) == 112 && this._text.charCodeA t(i0 + 3) == 108 && this._text.charCodeAt(i0 + 4) == 101 && this._text.charCodeA t(i0 + 5) == 109 && this._text.charCodeAt(i0 + 6) == 101 && this._text.charCodeA t(i0 + 7) == 110 && this._text.charCodeAt(i0 + 8) == 116 && this._text.charCodeA t(i0 + 9) == 115)) return 77/*TokenKind.IMPLEMENTS*/; 15263 if ($notnull_bool(this._text.charCodeAt(i0) == 105 && this._text.charCodeA t(i0 + 1) == 109) && this._text.charCodeAt(i0 + 2) == 112 && this._text.charCode At(i0 + 3) == 108 && this._text.charCodeAt(i0 + 4) == 101 && this._text.charCode At(i0 + 5) == 109 && this._text.charCodeAt(i0 + 6) == 101 && this._text.charCode At(i0 + 7) == 110 && this._text.charCodeAt(i0 + 8) == 116 && this._text.charCode At(i0 + 9) == 115) return 77/*TokenKind.IMPLEMENTS*/;
15283 return 70/*TokenKind.IDENTIFIER*/; 15264 return 70/*TokenKind.IDENTIFIER*/;
15284 15265
15285 default: 15266 default:
15286 15267
15287 return 70/*TokenKind.IDENTIFIER*/; 15268 return 70/*TokenKind.IDENTIFIER*/;
15288 15269
15289 } 15270 }
15290 } 15271 }
15291 // ********** Code for TokenizerHelpers ************** 15272 // ********** Code for TokenizerHelpers **************
15292 function TokenizerHelpers() {} 15273 function TokenizerHelpers() {}
15293 TokenizerHelpers.isIdentifierStart = function(c) { 15274 TokenizerHelpers.isIdentifierStart = function(c) {
15294 return $assert_bool(((c >= 97 && c <= 122) || (c >= 65 && c <= 90) || c == 95) ); 15275 return ($notnull_bool(($notnull_bool(c >= 97 && c <= 122)) || ($notnull_bool(c >= 65 && c <= 90))) || c == 95);
15295 } 15276 }
15296 TokenizerHelpers.isDigit = function(c) { 15277 TokenizerHelpers.isDigit = function(c) {
15297 return $assert_bool((c >= 48 && c <= 57)); 15278 return ($notnull_bool(c >= 48 && c <= 57));
15298 } 15279 }
15299 TokenizerHelpers.isHexDigit = function(c) { 15280 TokenizerHelpers.isHexDigit = function(c) {
15300 return $assert_bool((TokenizerHelpers.isDigit(c) || (c >= 97 && c <= 102) || ( c >= 65 && c <= 70))); 15281 return ($notnull_bool(TokenizerHelpers.isDigit(c) || ($notnull_bool(c >= 97 && c <= 102))) || ($notnull_bool(c >= 65 && c <= 70)));
15301 } 15282 }
15302 TokenizerHelpers.isWhitespace = function(c) { 15283 TokenizerHelpers.isWhitespace = function(c) {
15303 return $assert_bool((c == 32 || c == 9 || c == 10 || c == 13)); 15284 return ($notnull_bool(c == 32 || c == 9) || c == 10 || c == 13);
15304 } 15285 }
15305 TokenizerHelpers.isIdentifierPart = function(c) { 15286 TokenizerHelpers.isIdentifierPart = function(c) {
15306 return $assert_bool((TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers .isDigit(c))); 15287 return ($notnull_bool(TokenizerHelpers.isIdentifierStart(c) || TokenizerHelper s.isDigit(c)));
15307 } 15288 }
15308 // ********** Code for TokenKind ************** 15289 // ********** Code for TokenKind **************
15309 function TokenKind() {} 15290 function TokenKind() {}
15310 TokenKind.kindToString = function(kind) { 15291 TokenKind.kindToString = function(kind) {
15311 switch (kind) { 15292 switch (kind) {
15312 case 1/*TokenKind.END_OF_FILE*/: 15293 case 1/*TokenKind.END_OF_FILE*/:
15313 15294
15314 return "end of file"; 15295 return "end of file";
15315 15296
15316 case 2/*TokenKind.LPAREN*/: 15297 case 2/*TokenKind.LPAREN*/:
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
15765 15746
15766 return "keyword 'while'"; 15747 return "keyword 'while'";
15767 15748
15768 default: 15749 default:
15769 15750
15770 return "TokenKind(" + kind.toString() + ")"; 15751 return "TokenKind(" + kind.toString() + ")";
15771 15752
15772 } 15753 }
15773 } 15754 }
15774 TokenKind.isIdentifier = function(kind) { 15755 TokenKind.isIdentifier = function(kind) {
15775 return $assert_bool(kind >= 70/*TokenKind.IDENTIFIER*/ && kind < 88/*TokenKind .BREAK*/); 15756 return $notnull_bool(kind >= 70/*TokenKind.IDENTIFIER*/ && kind < 88/*TokenKin d.BREAK*/);
15776 } 15757 }
15777 TokenKind.infixPrecedence = function(kind) { 15758 TokenKind.infixPrecedence = function(kind) {
15778 switch (kind) { 15759 switch (kind) {
15779 case 20/*TokenKind.ASSIGN*/: 15760 case 20/*TokenKind.ASSIGN*/:
15780 15761
15781 return 2; 15762 return 2;
15782 15763
15783 case 21/*TokenKind.ASSIGN_OR*/: 15764 case 21/*TokenKind.ASSIGN_OR*/:
15784 15765
15785 return 2; 15766 return 2;
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
16115 this.diet = diet; 16096 this.diet = diet;
16116 this.throwOnIncomplete = throwOnIncomplete; 16097 this.throwOnIncomplete = throwOnIncomplete;
16117 this.optionalSemicolons = optionalSemicolons; 16098 this.optionalSemicolons = optionalSemicolons;
16118 // Initializers done 16099 // Initializers done
16119 this.tokenizer = new Tokenizer(this.source, true, startOffset); 16100 this.tokenizer = new Tokenizer(this.source, true, startOffset);
16120 this._peekToken = this.tokenizer.next(); 16101 this._peekToken = this.tokenizer.next();
16121 this._previousToken = null; 16102 this._previousToken = null;
16122 this._inInitializers = false; 16103 this._inInitializers = false;
16123 } 16104 }
16124 lang_Parser.prototype.isPrematureEndOfFile = function() { 16105 lang_Parser.prototype.isPrematureEndOfFile = function() {
16125 if ($notnull_bool(this.throwOnIncomplete && this._maybeEat(1/*TokenKind.END_OF _FILE*/) || this._maybeEat(68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/) || th is._maybeEat(69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/))) { 16106 if ($notnull_bool(this.throwOnIncomplete && this._maybeEat(1/*TokenKind.END_OF _FILE*/)) || this._maybeEat(68/*TokenKind.INCOMPLETE_MULTILINE_STRING_DQ*/) || t his._maybeEat(69/*TokenKind.INCOMPLETE_MULTILINE_STRING_SQ*/)) {
16126 $throw(new IncompleteSourceException(this._previousToken)); 16107 $throw(new IncompleteSourceException(this._previousToken));
16127 } 16108 }
16128 else if ($notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/))) { 16109 else if ($notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/))) {
16129 this._lang_error('unexpected end of file', this._peekToken.get$span()); 16110 this._lang_error('unexpected end of file', this._peekToken.get$span());
16130 return true; 16111 return true;
16131 } 16112 }
16132 else { 16113 else {
16133 return false; 16114 return false;
16134 } 16115 }
16135 } 16116 }
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
16666 var test = this.testCondition(); 16647 var test = this.testCondition();
16667 var cases = []; 16648 var cases = [];
16668 this._eat(6/*TokenKind.LBRACE*/); 16649 this._eat(6/*TokenKind.LBRACE*/);
16669 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/)))) { 16650 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/)))) {
16670 cases.add(this.caseNode()); 16651 cases.add(this.caseNode());
16671 } 16652 }
16672 return new SwitchStatement(test, cases, this._makeSpan(start)); 16653 return new SwitchStatement(test, cases, this._makeSpan(start));
16673 } 16654 }
16674 lang_Parser.prototype._peekCaseEnd = function() { 16655 lang_Parser.prototype._peekCaseEnd = function() {
16675 var kind = this._peek(); 16656 var kind = this._peek();
16676 return $eq(kind, 7/*TokenKind.RBRACE*/) || $eq(kind, 89/*TokenKind.CASE*/) || $eq(kind, 93/*TokenKind.DEFAULT*/); 16657 return $notnull_bool($eq(kind, 7/*TokenKind.RBRACE*/) || $eq(kind, 89/*TokenKi nd.CASE*/)) || $eq(kind, 93/*TokenKind.DEFAULT*/);
16677 } 16658 }
16678 lang_Parser.prototype.caseNode = function() { 16659 lang_Parser.prototype.caseNode = function() {
16679 var start = this._peekToken.start; 16660 var start = this._peekToken.start;
16680 var label = null; 16661 var label = null;
16681 if ($notnull_bool(this._peekIdentifier())) { 16662 if ($notnull_bool(this._peekIdentifier())) {
16682 label = this.identifier(); 16663 label = this.identifier();
16683 this._eat(8/*TokenKind.COLON*/); 16664 this._eat(8/*TokenKind.COLON*/);
16684 } 16665 }
16685 var cases = []; 16666 var cases = [];
16686 while ($notnull_bool(true)) { 16667 while ($notnull_bool(true)) {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
16945 if ($notnull_bool(this._peekIdentifier())) { 16926 if ($notnull_bool(this._peekIdentifier())) {
16946 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp e(expr), this.identifier(), this._makeSpan(expr.get$span().start))); 16927 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp e(expr), this.identifier(), this._makeSpan(expr.get$span().start)));
16947 } 16928 }
16948 else { 16929 else {
16949 return expr; 16930 return expr;
16950 } 16931 }
16951 16932
16952 } 16933 }
16953 } 16934 }
16954 lang_Parser.prototype._isBin = function(expr, kind) { 16935 lang_Parser.prototype._isBin = function(expr, kind) {
16955 return (expr instanceof BinaryExpression) && expr.op.kind == kind; 16936 return $notnull_bool((expr instanceof BinaryExpression) && expr.op.kind == kin d);
16956 } 16937 }
16957 lang_Parser.prototype._boolTypeRef = function(span) { 16938 lang_Parser.prototype._boolTypeRef = function(span) {
16958 return new TypeReference(span, world.boolType); 16939 return new TypeReference(span, world.boolType);
16959 } 16940 }
16960 lang_Parser.prototype._intTypeRef = function(span) { 16941 lang_Parser.prototype._intTypeRef = function(span) {
16961 return new TypeReference(span, world.intType); 16942 return new TypeReference(span, world.intType);
16962 } 16943 }
16963 lang_Parser.prototype._doubleTypeRef = function(span) { 16944 lang_Parser.prototype._doubleTypeRef = function(span) {
16964 return new TypeReference(span, world.doubleType); 16945 return new TypeReference(span, world.doubleType);
16965 } 16946 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
17127 } 17108 }
17128 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) { 17109 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) {
17129 this._lang_next(); 17110 this._lang_next();
17130 this._errorExpected('string literal, but found incomplete string'); 17111 this._errorExpected('string literal, but found incomplete string');
17131 } 17112 }
17132 return null; 17113 return null;
17133 } 17114 }
17134 lang_Parser.prototype._parenOrLambda = function() { 17115 lang_Parser.prototype._parenOrLambda = function() {
17135 var start = this._peekToken.start; 17116 var start = this._peekToken.start;
17136 var args = this.arguments(); 17117 var args = this.arguments();
17137 if ($notnull_bool(!$notnull_bool(this._inInitializers) && (this._peekKind(9/*T okenKind.ARROW*/) || this._peekKind(6/*TokenKind.LBRACE*/)))) { 17118 if ($notnull_bool(!$notnull_bool(this._inInitializers) && ($notnull_bool(this. _peekKind(9/*TokenKind.ARROW*/) || this._peekKind(6/*TokenKind.LBRACE*/))))) {
17138 var body = this.functionBody(true); 17119 var body = this.functionBody(true);
17139 var formals = this._makeFormals(args); 17120 var formals = this._makeFormals(args);
17140 var func = new FunctionDefinition(null, null, null, formals, null, body, thi s._makeSpan(start)); 17121 var func = new FunctionDefinition(null, null, null, formals, null, body, thi s._makeSpan(start));
17141 return new LambdaExpression(func, func.get$span()); 17122 return new LambdaExpression(func, func.get$span());
17142 } 17123 }
17143 else { 17124 else {
17144 if ($notnull_bool(args.length == 1)) { 17125 if ($notnull_bool(args.length == 1)) {
17145 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star t)); 17126 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star t));
17146 } 17127 }
17147 else { 17128 else {
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
18390 lang_Type.prototype.get$isList = function() { 18371 lang_Type.prototype.get$isList = function() {
18391 return false; 18372 return false;
18392 } 18373 }
18393 lang_Type.prototype.get$isNum = function() { 18374 lang_Type.prototype.get$isNum = function() {
18394 return false; 18375 return false;
18395 } 18376 }
18396 lang_Type.prototype.get$isVoid = function() { 18377 lang_Type.prototype.get$isVoid = function() {
18397 return false; 18378 return false;
18398 } 18379 }
18399 lang_Type.prototype.get$isVarOrFunction = function() { 18380 lang_Type.prototype.get$isVarOrFunction = function() {
18400 return $assert_bool(this.get$isVar() || this.get$isFunction()); 18381 return $notnull_bool(this.get$isVar() || this.get$isFunction());
18401 } 18382 }
18402 lang_Type.prototype.getCallMethod = function() { 18383 lang_Type.prototype.getCallMethod = function() {
18403 return null; 18384 return null;
18404 } 18385 }
18405 lang_Type.prototype.get$isClosed = function() { 18386 lang_Type.prototype.get$isClosed = function() {
18406 return $assert_bool(this.get$isString() || this.get$isBool() || this.get$isNum () || this.get$isFunction() || this.get$isVar()); 18387 return $notnull_bool(this.get$isString() || this.get$isBool()) || this.get$isN um() || this.get$isFunction() || this.get$isVar();
18407 } 18388 }
18408 lang_Type.prototype.get$isUsed = function() { 18389 lang_Type.prototype.get$isUsed = function() {
18409 return false; 18390 return false;
18410 } 18391 }
18411 lang_Type.prototype.get$isGeneric = function() { 18392 lang_Type.prototype.get$isGeneric = function() {
18412 return false; 18393 return false;
18413 } 18394 }
18414 lang_Type.prototype.get$isNativeType = function() { 18395 lang_Type.prototype.get$isNativeType = function() {
18415 return false; 18396 return false;
18416 } 18397 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
18479 } 18460 }
18480 return false; 18461 return false;
18481 } 18462 }
18482 lang_Type.union = function(x, y) { 18463 lang_Type.union = function(x, y) {
18483 if ($notnull_bool($eq(x, y))) return x; 18464 if ($notnull_bool($eq(x, y))) return x;
18484 if ($notnull_bool(x.get$isNum() && y.get$isNum())) return world.numType; 18465 if ($notnull_bool(x.get$isNum() && y.get$isNum())) return world.numType;
18485 if ($notnull_bool(x.get$isString() && y.get$isString())) return world.stringTy pe; 18466 if ($notnull_bool(x.get$isString() && y.get$isString())) return world.stringTy pe;
18486 return world.varType; 18467 return world.varType;
18487 } 18468 }
18488 lang_Type.prototype.isAssignable = function(other) { 18469 lang_Type.prototype.isAssignable = function(other) {
18489 return $assert_bool(this.isSubtypeOf(other) || other.isSubtypeOf(this)); 18470 return $notnull_bool(this.isSubtypeOf(other) || other.isSubtypeOf(this));
18490 } 18471 }
18491 lang_Type.prototype._isDirectSupertypeOf = function(other) { 18472 lang_Type.prototype._isDirectSupertypeOf = function(other) {
18492 var $this = this; // closure support 18473 var $this = this; // closure support
18493 if ($notnull_bool(other.get$isClass())) { 18474 if ($notnull_bool(other.get$isClass())) {
18494 return $assert_bool($eq(other.get$parent(), this) || this.get$isObject() && other.get$parent() == null); 18475 return $notnull_bool($eq(other.get$parent(), this) || $notnull_bool(this.get $isObject() && other.get$parent() == null));
18495 } 18476 }
18496 else { 18477 else {
18497 if ($notnull_bool(other.get$interfaces() == null || other.get$interfaces().i sEmpty())) { 18478 if ($notnull_bool(other.get$interfaces() == null || other.get$interfaces().i sEmpty())) {
18498 return this.get$isObject(); 18479 return this.get$isObject();
18499 } 18480 }
18500 else { 18481 else {
18501 return other.get$interfaces().some((function (i) { 18482 return other.get$interfaces().some((function (i) {
18502 return $eq(i, $this); 18483 return $eq(i, $this);
18503 }) 18484 })
18504 ); 18485 );
18505 } 18486 }
18506 } 18487 }
18507 } 18488 }
18508 lang_Type.prototype.isSubtypeOf = function(other) { 18489 lang_Type.prototype.isSubtypeOf = function(other) {
18509 if ($notnull_bool((other instanceof ParameterType))) { 18490 if ($notnull_bool((other instanceof ParameterType))) {
18510 return true; 18491 return true;
18511 } 18492 }
18512 if ($notnull_bool($eq(this, other))) return true; 18493 if ($notnull_bool($eq(this, other))) return true;
18513 if ($notnull_bool(this.get$isVar())) return true; 18494 if ($notnull_bool(this.get$isVar())) return true;
18514 if ($notnull_bool(other.get$isVar())) return true; 18495 if ($notnull_bool(other.get$isVar())) return true;
18515 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true; 18496 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true;
18516 var call = this.getCallMethod(); 18497 var call = this.getCallMethod();
18517 var otherCall = other.getCallMethod(); 18498 var otherCall = other.getCallMethod();
18518 if ($notnull_bool($ne(call, null) && $ne(otherCall, null))) { 18499 if ($notnull_bool($ne(call, null) && $ne(otherCall, null))) {
18519 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth erCall && otherCall.is$MethodMember())); 18500 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth erCall && otherCall.is$MethodMember()));
18520 } 18501 }
18521 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)) { 18502 if ($notnull_bool($eq(this.get$genericType(), other.get$genericType()) && $ne( this.get$typeArgsInOrder(), null)) && $ne(other.get$typeArgsInOrder(), null) && this.get$typeArgsInOrder().length == other.get$typeArgsInOrder().length) {
18522 var t = this.get$typeArgsInOrder().iterator(); 18503 var t = this.get$typeArgsInOrder().iterator();
18523 var s = other.get$typeArgsInOrder().iterator(); 18504 var s = other.get$typeArgsInOrder().iterator();
18524 while ($notnull_bool(t.hasNext())) { 18505 while ($notnull_bool(t.hasNext())) {
18525 if ($notnull_bool(!$notnull_bool(t.next().isSubtypeOf(s.next())))) return false; 18506 if ($notnull_bool(!$notnull_bool(t.next().isSubtypeOf(s.next())))) return false;
18526 } 18507 }
18527 return true; 18508 return true;
18528 } 18509 }
18529 if ($notnull_bool(this.get$parent() != null && this.get$parent().isSubtypeOf(o ther))) { 18510 if ($notnull_bool(this.get$parent() != null && this.get$parent().isSubtypeOf(o ther))) {
18530 return true; 18511 return true;
18531 } 18512 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
18673 var i = $list.$index($i); 18654 var i = $list.$index($i);
18674 this._interfaces.add(i.resolveTypeParams(this)); 18655 this._interfaces.add(i.resolveTypeParams(this));
18675 } 18656 }
18676 } 18657 }
18677 return this._interfaces; 18658 return this._interfaces;
18678 } 18659 }
18679 ConcreteType.prototype.getCallMethod = function() { 18660 ConcreteType.prototype.getCallMethod = function() {
18680 return this.genericType.getCallMethod(); 18661 return this.genericType.getCallMethod();
18681 } 18662 }
18682 ConcreteType.prototype.getAllMembers = function() { 18663 ConcreteType.prototype.getAllMembers = function() {
18683 var $0;
18684 var result = this.genericType.getAllMembers(); 18664 var result = this.genericType.getAllMembers();
18685 var $list = result.getKeys(); 18665 var $list = result.getKeys();
18686 for (var $i = result.getKeys().iterator(); $i.hasNext(); ) { 18666 for (var $i = result.getKeys().iterator(); $i.hasNext(); ) {
18687 var memberName = $i.next(); 18667 var memberName = $i.next();
18688 var myMember = this.members.$index(memberName); 18668 var myMember = this.members.$index(memberName);
18689 if ($notnull_bool($ne(myMember, null))) { 18669 if ($notnull_bool($ne(myMember, null))) {
18690 result.$setindex(memberName, myMember); 18670 result.$setindex(memberName, myMember);
18691 } 18671 }
18692 } 18672 }
18693 return (result && result.is$Map$String$Member()); 18673 return (result && result.is$Map$String$Member());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
18726 ConcreteType.prototype.getMember = function(memberName) { 18706 ConcreteType.prototype.getMember = function(memberName) {
18727 var ret = this.members.$index(memberName); 18707 var ret = this.members.$index(memberName);
18728 if ($notnull_bool($ne(ret, null))) return (ret && ret.is$Member()); 18708 if ($notnull_bool($ne(ret, null))) return (ret && ret.is$Member());
18729 var genericMember = this.genericType.getMember(memberName); 18709 var genericMember = this.genericType.getMember(memberName);
18730 if ($notnull_bool(genericMember == null)) return null; 18710 if ($notnull_bool(genericMember == null)) return null;
18731 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gener icMember); 18711 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gener icMember);
18732 this.members.$setindex(memberName, ret); 18712 this.members.$setindex(memberName, ret);
18733 return (ret && ret.is$Member()); 18713 return (ret && ret.is$Member());
18734 } 18714 }
18735 ConcreteType.prototype.resolveMember = function(memberName) { 18715 ConcreteType.prototype.resolveMember = function(memberName) {
18736 var $0;
18737 var mem = this.getMember(memberName); 18716 var mem = this.getMember(memberName);
18738 if ($notnull_bool(mem == null)) return null; 18717 if ($notnull_bool(mem == null)) return null;
18739 var ret = new MemberSet((mem && mem.is$Member())); 18718 var ret = new MemberSet((mem && mem.is$Member()));
18740 if ($notnull_bool(mem.get$isStatic())) return (ret && ret.is$MemberSet()); 18719 if ($notnull_bool(mem.get$isStatic())) return (ret && ret.is$MemberSet());
18741 var $list = this.genericType.get$subtypes(); 18720 var $list = this.genericType.get$subtypes();
18742 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext(); ) { 18721 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext(); ) {
18743 var t = $i.next(); 18722 var t = $i.next();
18744 var m = t.get$members().$index(memberName); 18723 var m = t.get$members().$index(memberName);
18745 if ($notnull_bool($ne(m, null))) ret.add(m); 18724 if ($notnull_bool($ne(m, null))) ret.add(m);
18746 } 18725 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
18821 DefinedType.prototype.get$isVar = function() { 18800 DefinedType.prototype.get$isVar = function() {
18822 return $eq(this, world.varType); 18801 return $eq(this, world.varType);
18823 } 18802 }
18824 DefinedType.prototype.get$isVoid = function() { 18803 DefinedType.prototype.get$isVoid = function() {
18825 return $eq(this, world.voidType); 18804 return $eq(this, world.voidType);
18826 } 18805 }
18827 DefinedType.prototype.get$isTop = function() { 18806 DefinedType.prototype.get$isTop = function() {
18828 return this.name == null; 18807 return this.name == null;
18829 } 18808 }
18830 DefinedType.prototype.get$isObject = function() { 18809 DefinedType.prototype.get$isObject = function() {
18831 return $assert_bool(this.library.get$isCore() && this.name == 'Object'); 18810 return $notnull_bool(this.library.get$isCore() && this.name == 'Object');
18832 } 18811 }
18833 DefinedType.prototype.get$isString = function() { 18812 DefinedType.prototype.get$isString = function() {
18834 return $assert_bool(this.library.get$isCore() && this.name == 'String' || this .library.get$isCoreImpl() && this.name == 'StringImplementation'); 18813 return $notnull_bool(this.library.get$isCore() && this.name == 'String') || $n otnull_bool(this.library.get$isCoreImpl() && this.name == 'StringImplementation' );
18835 } 18814 }
18836 DefinedType.prototype.get$isBool = function() { 18815 DefinedType.prototype.get$isBool = function() {
18837 return $assert_bool(this.library.get$isCore() && this.name == 'bool'); 18816 return $notnull_bool(this.library.get$isCore() && this.name == 'bool');
18838 } 18817 }
18839 DefinedType.prototype.get$isFunction = function() { 18818 DefinedType.prototype.get$isFunction = function() {
18840 return $assert_bool(this.library.get$isCore() && this.name == 'Function'); 18819 return $notnull_bool(this.library.get$isCore() && this.name == 'Function');
18841 } 18820 }
18842 DefinedType.prototype.get$isList = function() { 18821 DefinedType.prototype.get$isList = function() {
18843 return $assert_bool(this.library.get$isCore() && this.name == 'List'); 18822 return $notnull_bool(this.library.get$isCore() && this.name == 'List');
18844 } 18823 }
18845 DefinedType.prototype.get$isGeneric = function() { 18824 DefinedType.prototype.get$isGeneric = function() {
18846 return this.typeParameters != null; 18825 return this.typeParameters != null;
18847 } 18826 }
18848 DefinedType.prototype.get$span = function() { 18827 DefinedType.prototype.get$span = function() {
18849 var $0; 18828 var $0;
18850 return (($0 = $notnull_bool(this.definition == null) ? null : this.definition. span) && $0.is$SourceSpan()); 18829 return (($0 = $notnull_bool(this.definition == null) ? null : this.definition. span) && $0.is$SourceSpan());
18851 } 18830 }
18852 DefinedType.prototype.get$typeofName = function() { 18831 DefinedType.prototype.get$typeofName = function() {
18853 if ($notnull_bool(!$notnull_bool(this.library.get$isCore()))) return null; 18832 if ($notnull_bool(!$notnull_bool(this.library.get$isCore()))) return null;
18854 if ($notnull_bool(this.get$isBool())) return 'boolean'; 18833 if ($notnull_bool(this.get$isBool())) return 'boolean';
18855 else if ($notnull_bool(this.get$isNum())) return 'number'; 18834 else if ($notnull_bool(this.get$isNum())) return 'number';
18856 else if ($notnull_bool(this.get$isString())) return 'string'; 18835 else if ($notnull_bool(this.get$isString())) return 'string';
18857 else if ($notnull_bool(this.get$isFunction())) return 'function'; 18836 else if ($notnull_bool(this.get$isFunction())) return 'function';
18858 else return null; 18837 else return null;
18859 } 18838 }
18860 DefinedType.prototype.get$isNum = function() { 18839 DefinedType.prototype.get$isNum = function() {
18861 return $assert_bool(this.library != null && this.library.get$isCore() && (this .name == 'num' || this.name == 'int' || this.name == 'double')); 18840 return $notnull_bool(this.library != null && this.library.get$isCore()) && ($n otnull_bool(this.name == 'num' || this.name == 'int') || this.name == 'double');
18862 } 18841 }
18863 DefinedType.prototype.getCallMethod = function() { 18842 DefinedType.prototype.getCallMethod = function() {
18864 var $0; 18843 var $0;
18865 return (($0 = this.members.$index('\$call')) && $0.is$MethodMember()); 18844 return (($0 = this.members.$index('\$call')) && $0.is$MethodMember());
18866 } 18845 }
18867 DefinedType.prototype.getAllMembers = function() { 18846 DefinedType.prototype.getAllMembers = function() {
18868 return HashMapImplementation.HashMapImplementation$from$factory(this.members); 18847 return HashMapImplementation.HashMapImplementation$from$factory(this.members);
18869 } 18848 }
18870 DefinedType.prototype.markUsed = function() { 18849 DefinedType.prototype.markUsed = function() {
18871 if ($notnull_bool(this.isUsed)) return; 18850 if ($notnull_bool(this.isUsed)) return;
(...skipping 16 matching lines...) Expand all
18888 if ($notnull_bool(this._lazyGenMethods == null)) this._lazyGenMethods = $map ([]); 18867 if ($notnull_bool(this._lazyGenMethods == null)) this._lazyGenMethods = $map ([]);
18889 this._lazyGenMethods.$setindex(method.name, method); 18868 this._lazyGenMethods.$setindex(method.name, method);
18890 } 18869 }
18891 } 18870 }
18892 DefinedType.prototype._resolveInterfaces = function(types) { 18871 DefinedType.prototype._resolveInterfaces = function(types) {
18893 if ($notnull_bool(types == null)) return []; 18872 if ($notnull_bool(types == null)) return [];
18894 var interfaces = []; 18873 var interfaces = [];
18895 for (var $i = 0;$i < types.length; $i++) { 18874 for (var $i = 0;$i < types.length; $i++) {
18896 var type = types.$index($i); 18875 var type = types.$index($i);
18897 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true); 18876 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true);
18898 if ($notnull_bool(resolvedInterface.get$isClosed() && !$notnull_bool((this.l ibrary.get$isCore() || this.library.get$isCoreImpl())))) { 18877 if ($notnull_bool(resolvedInterface.get$isClosed() && !$notnull_bool(($notnu ll_bool(this.library.get$isCore() || this.library.get$isCoreImpl()))))) {
18899 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span()); 18878 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span());
18900 } 18879 }
18901 resolvedInterface.addDirectSubtype(this); 18880 resolvedInterface.addDirectSubtype(this);
18902 interfaces.add(resolvedInterface); 18881 interfaces.add(resolvedInterface);
18903 } 18882 }
18904 return (interfaces && interfaces.is$List$Type()); 18883 return (interfaces && interfaces.is$List$Type());
18905 } 18884 }
18906 DefinedType.prototype.addDirectSubtype = function(type) { 18885 DefinedType.prototype.addDirectSubtype = function(type) {
18907 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 680, 12); 18886 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 680, 12);
18908 this.directSubtypes.add(type); 18887 this.directSubtypes.add(type);
18909 } 18888 }
18910 DefinedType.prototype.get$subtypes = function() { 18889 DefinedType.prototype.get$subtypes = function() {
18911 var $0;
18912 if ($notnull_bool(this._subtypes == null)) { 18890 if ($notnull_bool(this._subtypes == null)) {
18913 this._subtypes = new HashSetImplementation$Type(); 18891 this._subtypes = new HashSetImplementation$Type();
18914 var $list = this.directSubtypes; 18892 var $list = this.directSubtypes;
18915 for (var $i = this.directSubtypes.iterator(); $i.hasNext(); ) { 18893 for (var $i = this.directSubtypes.iterator(); $i.hasNext(); ) {
18916 var st = $i.next(); 18894 var st = $i.next();
18917 this._subtypes.add(st); 18895 this._subtypes.add(st);
18918 this._subtypes.addAll(st.get$subtypes()); 18896 this._subtypes.addAll(st.get$subtypes());
18919 } 18897 }
18920 } 18898 }
18921 return this._subtypes; 18899 return this._subtypes;
(...skipping 12 matching lines...) Expand all
18934 seen.add(ancestor); 18912 seen.add(ancestor);
18935 ancestor = ancestor.get$parent(); 18913 ancestor = ancestor.get$parent();
18936 } 18914 }
18937 return false; 18915 return false;
18938 } 18916 }
18939 DefinedType.prototype._cycleInInterfaceExtends = function() { 18917 DefinedType.prototype._cycleInInterfaceExtends = function() {
18940 var $this = this; // closure support 18918 var $this = this; // closure support
18941 var seen = new HashSetImplementation(); 18919 var seen = new HashSetImplementation();
18942 seen.add(this); 18920 seen.add(this);
18943 function _helper(ancestor) { 18921 function _helper(ancestor) {
18944 var $0;
18945 if ($notnull_bool(ancestor == null)) return false; 18922 if ($notnull_bool(ancestor == null)) return false;
18946 if ($notnull_bool(ancestor === $this)) return true; 18923 if ($notnull_bool(ancestor === $this)) return true;
18947 if ($notnull_bool(seen.contains(ancestor))) { 18924 if ($notnull_bool(seen.contains(ancestor))) {
18948 return false; 18925 return false;
18949 } 18926 }
18950 seen.add(ancestor); 18927 seen.add(ancestor);
18951 if ($notnull_bool($ne(ancestor.get$interfaces(), null))) { 18928 if ($notnull_bool($ne(ancestor.get$interfaces(), null))) {
18952 var $list = ancestor.get$interfaces(); 18929 var $list = ancestor.get$interfaces();
18953 for (var $i = ancestor.get$interfaces().iterator(); $i.hasNext(); ) { 18930 for (var $i = ancestor.get$interfaces().iterator(); $i.hasNext(); ) {
18954 var parent = $i.next(); 18931 var parent = $i.next();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
19044 if ($notnull_bool(methodName == null)) methodName = definition.name.name; 19021 if ($notnull_bool(methodName == null)) methodName = definition.name.name;
19045 var method = new MethodMember(methodName, this, definition); 19022 var method = new MethodMember(methodName, this, definition);
19046 if ($notnull_bool(method.get$isConstructor())) { 19023 if ($notnull_bool(method.get$isConstructor())) {
19047 if ($notnull_bool(this.constructors.containsKey(method.get$constructorName() ))) { 19024 if ($notnull_bool(this.constructors.containsKey(method.get$constructorName() ))) {
19048 world.error(('duplicate constructor definition of ' + method.get$name() + ''), definition.span); 19025 world.error(('duplicate constructor definition of ' + method.get$name() + ''), definition.span);
19049 return; 19026 return;
19050 } 19027 }
19051 this.constructors.$setindex(method.get$constructorName(), method); 19028 this.constructors.$setindex(method.get$constructorName(), method);
19052 return; 19029 return;
19053 } 19030 }
19054 if ($notnull_bool(definition.modifiers != null && definition.modifiers.length == 1 && $eq(definition.modifiers.$index(0).kind, 75/*TokenKind.FACTORY*/))) { 19031 if ($notnull_bool(definition.modifiers != null && definition.modifiers.length == 1) && $eq(definition.modifiers.$index(0).kind, 75/*TokenKind.FACTORY*/)) {
19055 if ($notnull_bool(this.factories.getFactory(method.get$constructorName(), $a ssert_String(method.get$name())) != null)) { 19032 if ($notnull_bool(this.factories.getFactory(method.get$constructorName(), $a ssert_String(method.get$name())) != null)) {
19056 world.error(('duplicate factory definition of "' + method.get$name() + '"' ), definition.span); 19033 world.error(('duplicate factory definition of "' + method.get$name() + '"' ), definition.span);
19057 return; 19034 return;
19058 } 19035 }
19059 this.factories.addFactory(method.get$constructorName(), $assert_String(metho d.get$name()), (method && method.is$Member())); 19036 this.factories.addFactory(method.get$constructorName(), $assert_String(metho d.get$name()), (method && method.is$Member()));
19060 return; 19037 return;
19061 } 19038 }
19062 if ($notnull_bool(methodName.startsWith('get\$') || methodName.startsWith('set \$'))) { 19039 if ($notnull_bool(methodName.startsWith('get\$') || methodName.startsWith('set \$'))) {
19063 var propName = methodName.substring(4); 19040 var propName = methodName.substring(4);
19064 var prop = this.members.$index(propName); 19041 var prop = this.members.$index(propName);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
19125 return this.factory_.getFactory(this, constructorName); 19102 return this.factory_.getFactory(this, constructorName);
19126 } 19103 }
19127 return ret; 19104 return ret;
19128 } 19105 }
19129 ret = this.factories.getFactory(this.name, constructorName); 19106 ret = this.factories.getFactory(this.name, constructorName);
19130 if ($notnull_bool($ne(ret, null))) return ret; 19107 if ($notnull_bool($ne(ret, null))) return ret;
19131 return this._tryCreateDefaultConstructor(constructorName); 19108 return this._tryCreateDefaultConstructor(constructorName);
19132 } 19109 }
19133 DefinedType.prototype._tryCreateDefaultConstructor = function(name) { 19110 DefinedType.prototype._tryCreateDefaultConstructor = function(name) {
19134 var $0; 19111 var $0;
19135 if ($notnull_bool(name == '' && this.definition != null && this.isClass && thi s.constructors.get$length() == 0)) { 19112 if ($notnull_bool(name == '' && this.definition != null) && this.isClass && th is.constructors.get$length() == 0) {
19136 var span = this.definition.span; 19113 var span = this.definition.span;
19137 var inits = null, body = null; 19114 var inits = null, body = null;
19138 if ($notnull_bool(this.isNativeType)) { 19115 if ($notnull_bool(this.isNativeType)) {
19139 body = new NativeStatement(null, (span && span.is$SourceSpan())); 19116 body = new NativeStatement(null, (span && span.is$SourceSpan()));
19140 inits = null; 19117 inits = null;
19141 } 19118 }
19142 else { 19119 else {
19143 body = null; 19120 body = null;
19144 inits = [new CallExpression(new SuperExpression((span && span.is$SourceSpa n())), [], (span && span.is$SourceSpan()))]; 19121 inits = [new CallExpression(new SuperExpression((span && span.is$SourceSpa n())), [], (span && span.is$SourceSpan()))];
19145 } 19122 }
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
19410 // ********** Code for FixedIterator$E ************** 19387 // ********** Code for FixedIterator$E **************
19411 function FixedIterator$E(value, length) { 19388 function FixedIterator$E(value, length) {
19412 this._index = 0 19389 this._index = 0
19413 this.value = value; 19390 this.value = value;
19414 this.length = length; 19391 this.length = length;
19415 // Initializers done 19392 // Initializers done
19416 } 19393 }
19417 $inherits(FixedIterator$E, FixedIterator); 19394 $inherits(FixedIterator$E, FixedIterator);
19418 FixedIterator$E.prototype.is$Iterator$T = function(){return this;}; 19395 FixedIterator$E.prototype.is$Iterator$T = function(){return this;};
19419 // ********** Code for Value ************** 19396 // ********** Code for Value **************
19420 function Value(type, code, span, isSuper, needsTemp, isType) { 19397 function Value(type, code, span, needsTemp) {
19398 this.isSuper = false
19399 this.isType = false
19421 this.type = type; 19400 this.type = type;
19422 this.code = code; 19401 this.code = code;
19423 this.span = span; 19402 this.span = span;
19424 this.isSuper = isSuper;
19425 this.needsTemp = needsTemp; 19403 this.needsTemp = needsTemp;
19426 this.isType = isType;
19427 // Initializers done 19404 // Initializers done
19428 if ($notnull_bool(this.type == null)) this.type = world.varType; 19405 if ($notnull_bool(this.type == null)) world.internalError('type passed as null ', this.span);
19429 } 19406 }
19430 Value.prototype.is$Value = function(){return this;}; 19407 Value.prototype.is$Value = function(){return this;};
19431 Value.prototype.get$span = function() { return this.span; }; 19408 Value.prototype.get$span = function() { return this.span; };
19432 Value.prototype.set$span = function(value) { return this.span = value; }; 19409 Value.prototype.set$span = function(value) { return this.span = value; };
19433 Value.prototype.get$_typeIsVarOrParameterType = function() { 19410 Value.prototype.get$_typeIsVarOrParameterType = function() {
19434 return $assert_bool(this.type.get$isVar() || (this.type instanceof ParameterTy pe)); 19411 return $notnull_bool(this.type.get$isVar() || (this.type instanceof ParameterT ype));
19435 } 19412 }
19436 Value.prototype.get$isConst = function() { 19413 Value.prototype.get$isConst = function() {
19437 return false; 19414 return false;
19438 } 19415 }
19439 Value.prototype.get$canonicalCode = function() { 19416 Value.prototype.get$canonicalCode = function() {
19440 return null; 19417 return null;
19441 } 19418 }
19442 Value.prototype.get_ = function(context, name, node) { 19419 Value.prototype.get_ = function(context, name, node) {
19443 var member = this._resolveMember(context, name, node, false); 19420 var member = this._resolveMember(context, name, node, false);
19444 if ($notnull_bool($ne(member, null))) { 19421 if ($notnull_bool($ne(member, null))) {
(...skipping 11 matching lines...) Expand all
19456 else { 19433 else {
19457 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value])); 19434 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value]));
19458 } 19435 }
19459 } 19436 }
19460 Value.prototype.invoke = function(context, name, node, args, isDynamic) { 19437 Value.prototype.invoke = function(context, name, node, args, isDynamic) {
19461 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) { 19438 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) {
19462 if ($notnull_bool(args.values.length != 1)) { 19439 if ($notnull_bool(args.values.length != 1)) {
19463 world.warning('wrong number of arguments for !=', node.span); 19440 world.warning('wrong number of arguments for !=', node.span);
19464 } 19441 }
19465 world.gen.corejs.useOperator('\$ne'); 19442 world.gen.corejs.useOperator('\$ne');
19466 return new Value(null, ('\$ne(' + this.code + ', ' + args.values.$index(0).c ode + ')'), node.span, false, true, false); 19443 return new Value(world.varType, ('\$ne(' + this.code + ', ' + args.values.$i ndex(0).code + ')'), node.span, true);
19467 } 19444 }
19468 if ($notnull_bool(name == '\$call')) { 19445 if ($notnull_bool(name == '\$call')) {
19469 if ($notnull_bool(this.isType)) { 19446 if ($notnull_bool(this.isType)) {
19470 world.error('must use "new" or "const" to construct a new instance', node. span); 19447 world.error('must use "new" or "const" to construct a new instance', node. span);
19471 } 19448 }
19472 if ($notnull_bool(this.type.needsVarCall(args))) { 19449 if ($notnull_bool(this.type.needsVarCall(args))) {
19473 return this._varCall(context, args); 19450 return this._varCall(context, args);
19474 } 19451 }
19475 } 19452 }
19476 var member = this._resolveMember(context, name, node, isDynamic); 19453 var member = this._resolveMember(context, name, node, isDynamic);
19477 if ($notnull_bool(member == null)) { 19454 if ($notnull_bool(member == null)) {
19478 return this.invokeNoSuchMethod(context, name, node, args); 19455 return this.invokeNoSuchMethod(context, name, node, args);
19479 } 19456 }
19480 else { 19457 else {
19481 return member.invoke(context, node, this, args, isDynamic); 19458 return member.invoke(context, node, this, args, isDynamic);
19482 } 19459 }
19483 } 19460 }
19484 Value.prototype.canInvoke = function(context, name, args) { 19461 Value.prototype.canInvoke = function(context, name, args) {
19485 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) { 19462 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) {
19486 return true; 19463 return true;
19487 } 19464 }
19488 if ($notnull_bool(this.type.get$isVarOrFunction() && name == '\$call')) { 19465 if ($notnull_bool(this.type.get$isVarOrFunction() && name == '\$call')) {
19489 return true; 19466 return true;
19490 } 19467 }
19491 var member = this._resolveMember(context, name, null, true); 19468 var member = this._resolveMember(context, name, null, true);
19492 return $assert_bool($ne(member, null) && member.canInvoke(context, args)); 19469 return $notnull_bool($ne(member, null) && member.canInvoke(context, args));
19493 } 19470 }
19494 Value.prototype._hasOverriddenNoSuchMethod = function() { 19471 Value.prototype._hasOverriddenNoSuchMethod = function() {
19495 if ($notnull_bool(this.isSuper)) { 19472 if ($notnull_bool(this.isSuper)) {
19496 var m = this.type.getMember('noSuchMethod'); 19473 var m = this.type.getMember('noSuchMethod');
19497 return $assert_bool($ne(m, null) && !$notnull_bool(m.declaringType.get$isObj ect())); 19474 return $notnull_bool($ne(m, null) && !$notnull_bool(m.declaringType.get$isOb ject()));
19498 } 19475 }
19499 else { 19476 else {
19500 return this.type.resolveMember('noSuchMethod').members.length > 1; 19477 return this.type.resolveMember('noSuchMethod').members.length > 1;
19501 } 19478 }
19502 } 19479 }
19503 Value.prototype._tryResolveMember = function(context, name) { 19480 Value.prototype._tryResolveMember = function(context, name) {
19504 if ($notnull_bool(this.isSuper)) { 19481 if ($notnull_bool(this.isSuper)) {
19505 return this.type.getMember(name); 19482 return this.type.getMember(name);
19506 } 19483 }
19507 else { 19484 else {
19508 return this.type.resolveMember(name); 19485 return this.type.resolveMember(name);
19509 } 19486 }
19510 } 19487 }
19511 Value.prototype._resolveMember = function(context, name, node, isDynamic) { 19488 Value.prototype._resolveMember = function(context, name, node, isDynamic) {
19512 var member; 19489 var member;
19513 if ($notnull_bool(!$notnull_bool(this.get$_typeIsVarOrParameterType()))) { 19490 if ($notnull_bool(!$notnull_bool(this.get$_typeIsVarOrParameterType()))) {
19514 member = this._tryResolveMember(context, name); 19491 member = this._tryResolveMember(context, name);
19515 if ($notnull_bool($ne(member, null) && this.isType && !$notnull_bool(member. get$isStatic()))) { 19492 if ($notnull_bool($ne(member, null) && this.isType) && !$notnull_bool(member .get$isStatic())) {
19516 if ($notnull_bool(!$notnull_bool(isDynamic))) { 19493 if ($notnull_bool(!$notnull_bool(isDynamic))) {
19517 world.error('can not refer to instance member as static', node.span); 19494 world.error('can not refer to instance member as static', node.span);
19518 } 19495 }
19519 return null; 19496 return null;
19520 } 19497 }
19521 if ($notnull_bool(member == null && !$notnull_bool(isDynamic) && !$notnull_b ool(this._hasOverriddenNoSuchMethod()))) { 19498 if ($notnull_bool(member == null && !$notnull_bool(isDynamic)) && !$notnull_ bool(this._hasOverriddenNoSuchMethod())) {
19522 var typeName = $notnull_bool(this.type.name == null) ? this.type.get$libra ry().name : this.type.name; 19499 var typeName = $notnull_bool(this.type.name == null) ? this.type.get$libra ry().name : this.type.name;
19523 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); 19500 var message = ('can not resolve "' + name + '" on "' + typeName + '"');
19524 if ($notnull_bool(this.isType)) { 19501 if ($notnull_bool(this.isType)) {
19525 world.error($assert_String(message), node.span); 19502 world.error($assert_String(message), node.span);
19526 } 19503 }
19527 else { 19504 else {
19528 world.warning($assert_String(message), node.span); 19505 world.warning($assert_String(message), node.span);
19529 } 19506 }
19530 } 19507 }
19531 } 19508 }
19532 if ($notnull_bool(member == null && !$notnull_bool(this.isSuper) && !$notnull_ bool(this.isType))) { 19509 if ($notnull_bool(member == null && !$notnull_bool(this.isSuper)) && !$notnull _bool(this.isType)) {
19533 member = context.findMembers(name); 19510 member = context.findMembers(name);
19534 if ($notnull_bool(member == null && !$notnull_bool(isDynamic))) { 19511 if ($notnull_bool(member == null && !$notnull_bool(isDynamic))) {
19535 world.warning(('' + name + ' is not defined anywhere in the world.'), node .span); 19512 world.warning(('' + name + ' is not defined anywhere in the world.'), node .span);
19536 } 19513 }
19537 } 19514 }
19538 return member; 19515 return member;
19539 } 19516 }
19540 Value.prototype.checkFirstClass = function(span) { 19517 Value.prototype.checkFirstClass = function(span) {
19541 if ($notnull_bool(this.isType)) { 19518 if ($notnull_bool(this.isType)) {
19542 world.error('Types are not first class', span); 19519 world.error('Types are not first class', span);
19543 } 19520 }
19544 } 19521 }
19545 Value.prototype._varCall = function(context, args) { 19522 Value.prototype._varCall = function(context, args) {
19546 var stub = world.functionType.getCallStub(args); 19523 var stub = world.functionType.getCallStub(args);
19547 return new Value(null, ('' + this.code + '.' + stub.get$name() + '(' + args.ge tCode() + ')'), this.span, false, true, false); 19524 return new Value(world.varType, ('' + this.code + '.' + stub.get$name() + '(' + args.getCode() + ')'), this.span, true);
19548 } 19525 }
19549 Value.prototype.needsConversion = function(toType) { 19526 Value.prototype.needsConversion = function(toType) {
19550 var callMethod = toType.getCallMethod(); 19527 var callMethod = toType.getCallMethod();
19551 if ($notnull_bool($ne(callMethod, null))) { 19528 if ($notnull_bool($ne(callMethod, null))) {
19552 var arity = callMethod.get$parameters().length; 19529 var arity = callMethod.get$parameters().length;
19553 var myCall = this.type.getCallMethod(); 19530 var myCall = this.type.getCallMethod();
19554 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) { 19531 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) {
19555 return true; 19532 return true;
19556 } 19533 }
19557 } 19534 }
19558 if ($notnull_bool(options.enableTypeChecks)) { 19535 if ($notnull_bool(options.enableTypeChecks)) {
19559 var fromType = this.type; 19536 var fromType = this.type;
19560 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { 19537 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) {
19561 fromType = world.objectType; 19538 fromType = world.objectType;
19562 } 19539 }
19563 var bothNum = $assert_bool(this.type.get$isNum() && toType.get$isNum()); 19540 var bothNum = $notnull_bool(this.type.get$isNum() && toType.get$isNum());
19564 return $assert_bool(fromType.isSubtypeOf(toType) || bothNum); 19541 return $notnull_bool(fromType.isSubtypeOf(toType) || bothNum);
19565 } 19542 }
19566 return false; 19543 return false;
19567 } 19544 }
19568 Value.prototype.convertTo = function(context, toType, node, isDynamic) { 19545 Value.prototype.convertTo = function(context, toType, node, isDynamic) {
19569 var $0; 19546 var $0;
19570 var checked = !$notnull_bool(isDynamic); 19547 var checked = !$notnull_bool(isDynamic);
19571 var callMethod = toType.getCallMethod(); 19548 var callMethod = toType.getCallMethod();
19572 if ($notnull_bool($ne(callMethod, null))) { 19549 if ($notnull_bool($ne(callMethod, null))) {
19573 if ($notnull_bool(checked && !$notnull_bool(toType.isAssignable(this.type))) ) { 19550 if ($notnull_bool(checked && !$notnull_bool(toType.isAssignable(this.type))) ) {
19574 this.convertWarning(toType, node); 19551 this.convertWarning(toType, node);
19575 } 19552 }
19576 var arity = callMethod.get$parameters().length; 19553 var arity = callMethod.get$parameters().length;
19577 var myCall = this.type.getCallMethod(); 19554 var myCall = this.type.getCallMethod();
19578 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) { 19555 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) {
19579 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory (arity)); 19556 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory (arity));
19580 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), node.span, false, true, false); 19557 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), node.span, true);
19581 return (($0 = $notnull_bool(this._isDomCallback(toType) && !$notnull_bool( this._isDomCallback(this.type))) ? val._wrapDomCallback(toType, arity) : val) && $0.is$Value()); 19558 return (($0 = $notnull_bool(this._isDomCallback(toType) && !$notnull_bool( this._isDomCallback(this.type))) ? val._wrapDomCallback(toType, arity) : val) && $0.is$Value());
19582 } 19559 }
19583 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i sDomCallback(this.type)))) { 19560 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i sDomCallback(this.type)))) {
19584 return this._wrapDomCallback(toType, arity); 19561 return this._wrapDomCallback(toType, arity);
19585 } 19562 }
19586 } 19563 }
19587 var fromType = this.type; 19564 var fromType = this.type;
19588 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { 19565 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) {
19589 fromType = world.objectType; 19566 fromType = world.objectType;
19590 } 19567 }
19591 var bothNum = $assert_bool(this.type.get$isNum() && toType.get$isNum()); 19568 var bothNum = $notnull_bool(this.type.get$isNum() && toType.get$isNum());
19592 if ($notnull_bool(!$notnull_bool(checked) || fromType.isSubtypeOf(toType) || b othNum)) { 19569 if ($notnull_bool(!$notnull_bool(checked) || fromType.isSubtypeOf(toType)) || bothNum) {
19593 return this; 19570 return this;
19594 } 19571 }
19595 if ($notnull_bool(!$notnull_bool(toType.isSubtypeOf(this.type)))) { 19572 if ($notnull_bool(!$notnull_bool(toType.isSubtypeOf(this.type)))) {
19596 this.convertWarning(toType, node); 19573 this.convertWarning(toType, node);
19597 } 19574 }
19598 if ($notnull_bool(options.enableTypeChecks)) { 19575 if ($notnull_bool(options.enableTypeChecks)) {
19599 return this._typeAssert(context, toType, node); 19576 return this._typeAssert(context, toType, node);
19600 } 19577 }
19601 else { 19578 else {
19602 return this; 19579 return this;
19603 } 19580 }
19604 } 19581 }
19605 Value.prototype.convertToNonNullBool = function(context, node) { 19582 Value.prototype.convertToNonNullBool = function(context, node) {
19606 if ($notnull_bool(!$notnull_bool(this.type.isAssignable(world.boolType)))) { 19583 if ($notnull_bool(!$notnull_bool(this.type.isAssignable(world.boolType)))) {
19607 this.convertWarning(world.boolType, node); 19584 this.convertWarning(world.boolType, node);
19608 } 19585 }
19609 if ($notnull_bool(!$notnull_bool(options.enableTypeChecks))) { 19586 if ($notnull_bool(!$notnull_bool(options.enableTypeChecks))) {
19610 return this; 19587 return this;
19611 } 19588 }
19612 else { 19589 else {
19613 if ($notnull_bool(this.code.startsWith('\$notnull_bool'))) { 19590 if ($notnull_bool(this.code.startsWith('\$notnull_bool'))) {
19614 return this; 19591 return this;
19615 } 19592 }
19616 else { 19593 else {
19617 world.gen.corejs.useNotNullBool = true; 19594 world.gen.corejs.useNotNullBool = true;
19618 return new Value(world.boolType, ('\$notnull_bool(' + this.code + ')'), th is.span, false, true, false); 19595 return new Value(world.boolType, ('\$notnull_bool(' + this.code + ')'), th is.span, true);
19619 } 19596 }
19620 } 19597 }
19621 } 19598 }
19622 Value.prototype._isDomCallback = function(toType) { 19599 Value.prototype._isDomCallback = function(toType) {
19623 return $assert_bool(((toType.get$definition() instanceof FunctionTypeDefinitio n) && $eq(toType.get$library(), world.get$dom()))); 19600 return ($notnull_bool((toType.get$definition() instanceof FunctionTypeDefiniti on) && $eq(toType.get$library(), world.get$dom())));
19624 } 19601 }
19625 Value.prototype._wrapDomCallback = function(toType, arity) { 19602 Value.prototype._wrapDomCallback = function(toType, arity) {
19626 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, false, true, false); 19603 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, true);
19627 } 19604 }
19628 Value.prototype._typeAssert = function(context, toType, node) { 19605 Value.prototype._typeAssert = function(context, toType, node) {
19629 if ($notnull_bool((toType instanceof ParameterType))) { 19606 if ($notnull_bool((toType instanceof ParameterType))) {
19630 var p = (toType && toType.is$ParameterType()); 19607 var p = (toType && toType.is$ParameterType());
19631 toType = p.extendsType; 19608 toType = p.extendsType;
19632 } 19609 }
19633 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) { 19610 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) {
19634 world.internalError(('We thought ' + this.type.name + ' is not a subtype of ' + toType.name + '?')); 19611 world.internalError(('We thought ' + this.type.name + ' is not a subtype of ' + toType.name + '?'));
19635 } 19612 }
19636 if ($notnull_bool(toType.get$isNum())) toType = world.numType; 19613 if ($notnull_bool(toType.get$isNum())) toType = world.numType;
(...skipping 10 matching lines...) Expand all
19647 toType.typeCheckCode = ("function $assert_" + toType.name + "(x) {\n if ( x == null || typeof(x) == \"" + toType.get$typeofName() + "\") return x;\n thro w new TypeError(\"'\" + x + \"' is not a " + toType.name + ".\");\n}"); 19624 toType.typeCheckCode = ("function $assert_" + toType.name + "(x) {\n if ( x == null || typeof(x) == \"" + toType.get$typeofName() + "\") return x;\n thro w new TypeError(\"'\" + x + \"' is not a " + toType.name + ".\");\n}");
19648 } 19625 }
19649 } 19626 }
19650 else { 19627 else {
19651 toType.isTested = true; 19628 toType.isTested = true;
19652 var temp = context.getTemp(this); 19629 var temp = context.getTemp(this);
19653 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); 19630 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&');
19654 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); 19631 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())');
19655 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value( ))); 19632 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value( )));
19656 } 19633 }
19657 return new Value(toType, check, this.span, false, true, false); 19634 return new Value(toType, check, this.span, true);
19658 } 19635 }
19659 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) { 19636 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) {
19660 if ($notnull_bool(toType.get$isVar())) { 19637 if ($notnull_bool(toType.get$isVar())) {
19661 world.error('can not resolve type', span); 19638 world.error('can not resolve type', span);
19662 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n ull); 19639 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n ull);
19663 } 19640 }
19664 if ($notnull_bool((toType instanceof ParameterType))) { 19641 if ($notnull_bool((toType instanceof ParameterType))) {
19665 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n ull); 19642 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n ull);
19666 } 19643 }
19667 var testCode = null; 19644 var testCode = null;
(...skipping 16 matching lines...) Expand all
19684 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); 19661 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&');
19685 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')' ); 19662 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')' );
19686 if ($notnull_bool(isTrue)) { 19663 if ($notnull_bool(isTrue)) {
19687 testCode = '!!' + testCode; 19664 testCode = '!!' + testCode;
19688 } 19665 }
19689 else { 19666 else {
19690 testCode = '!' + testCode; 19667 testCode = '!' + testCode;
19691 } 19668 }
19692 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value( ))); 19669 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value( )));
19693 } 19670 }
19694 return new Value(world.boolType, testCode, span, false, true, false); 19671 return new Value(world.boolType, testCode, span, true);
19695 } 19672 }
19696 Value.prototype.convertWarning = function(toType, node) { 19673 Value.prototype.convertWarning = function(toType, node) {
19697 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType .name + '"'), node.span); 19674 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType .name + '"'), node.span);
19698 } 19675 }
19699 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { 19676 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) {
19700 var $0; 19677 var $0;
19701 var pos = ''; 19678 var pos = '';
19702 if ($notnull_bool(args != null)) { 19679 if ($notnull_bool(args != null)) {
19703 var argsCode = []; 19680 var argsCode = [];
19704 for (var i = 0; 19681 for (var i = 0;
19705 $notnull_bool(i < args.get$length()); i++) { 19682 $notnull_bool(i < args.get$length()); i++) {
19706 argsCode.add(args.values.$index(i).code); 19683 argsCode.add(args.values.$index(i).code);
19707 } 19684 }
19708 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); 19685 pos = Strings.join((argsCode && argsCode.is$List$String()), ", ");
19709 } 19686 }
19710 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, f alse, true, false), new Value(world.listType, ('[' + pos + ']'), node.span, fals e, true, false)]; 19687 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, t rue), new Value(world.listType, ('[' + pos + ']'), node.span, true)];
19711 return (($0 = this._resolveMember(context, 'noSuchMethod', node, false).invoke $4(context, node, this, new Arguments(null, noSuchArgs))) && $0.is$Value()); 19688 return (($0 = this._resolveMember(context, 'noSuchMethod', node, false).invoke $4(context, node, this, new Arguments(null, noSuchArgs))) && $0.is$Value());
19712 } 19689 }
19713 Value.prototype.invokeSpecial = function(name, args, returnType) { 19690 Value.prototype.invokeSpecial = function(name, args, returnType) {
19714 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 461, 12 ); 19691 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 464, 12 );
19715 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 62, 12); 19692 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 65, 12);
19716 var argsString = args.getCode(); 19693 var argsString = args.getCode();
19717 if ($notnull_bool(name == '\$index' || name == '\$setindex')) { 19694 if ($notnull_bool(name == '\$index' || name == '\$setindex')) {
19718 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, false, true, false); 19695 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, true);
19719 } 19696 }
19720 else { 19697 else {
19721 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString + ''); 19698 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString + '');
19722 world.gen.corejs.useOperator(name); 19699 world.gen.corejs.useOperator(name);
19723 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), this.span, false, true, false); 19700 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), this.span, true);
19724 } 19701 }
19725 } 19702 }
19726 Value.prototype.invoke$4 = function($0, $1, $2, $3) { 19703 Value.prototype.invoke$4 = function($0, $1, $2, $3) {
19727 return this.invoke(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 && $2.is$lang_Node()), ($3 && $3.is$Arguments()), false); 19704 return this.invoke(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 && $2.is$lang_Node()), ($3 && $3.is$Arguments()), false);
19728 } 19705 }
19729 ; 19706 ;
19730 // ********** Code for EvaluatedValue ************** 19707 // ********** Code for EvaluatedValue **************
19731 function EvaluatedValue() {} 19708 function EvaluatedValue() {}
19732 EvaluatedValue._internal$ctor = function(type, actualValue, canonicalCode, span, code) { 19709 EvaluatedValue._internal$ctor = function(type, actualValue, canonicalCode, span, code) {
19733 this.actualValue = actualValue; 19710 this.actualValue = actualValue;
19734 this.canonicalCode = canonicalCode; 19711 this.canonicalCode = canonicalCode;
19735 Value.call(this, type, code, span, false, false, false); 19712 Value.call(this, type, code, span, false);
19736 // Initializers done 19713 // Initializers done
19737 } 19714 }
19738 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype; 19715 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype;
19739 $inherits(EvaluatedValue, Value); 19716 $inherits(EvaluatedValue, Value);
19740 EvaluatedValue.EvaluatedValue$factory = function(type, actualValue, canonicalCod e, span) { 19717 EvaluatedValue.EvaluatedValue$factory = function(type, actualValue, canonicalCod e, span) {
19741 return new EvaluatedValue._internal$ctor(type, actualValue, canonicalCode, spa n, EvaluatedValue.codeWithComments(canonicalCode, span)); 19718 return new EvaluatedValue._internal$ctor(type, actualValue, canonicalCode, spa n, EvaluatedValue.codeWithComments(canonicalCode, span));
19742 } 19719 }
19743 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue; }; 19720 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue; };
19744 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV alue = value; }; 19721 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV alue = value; };
19745 EvaluatedValue.prototype.get$isConst = function() { 19722 EvaluatedValue.prototype.get$isConst = function() {
19746 return true; 19723 return true;
19747 } 19724 }
19748 EvaluatedValue.prototype.get$canonicalCode = function() { return this.canonicalC ode; }; 19725 EvaluatedValue.prototype.get$canonicalCode = function() { return this.canonicalC ode; };
19749 EvaluatedValue.prototype.set$canonicalCode = function(value) { return this.canon icalCode = value; }; 19726 EvaluatedValue.prototype.set$canonicalCode = function(value) { return this.canon icalCode = value; };
19750 EvaluatedValue.codeWithComments = function(canonicalCode, span) { 19727 EvaluatedValue.codeWithComments = function(canonicalCode, span) {
19751 return $notnull_bool((span != null && span.get$text() != canonicalCode)) ? ('' + canonicalCode + '/*' + span.get$text() + '*/') : canonicalCode; 19728 return $notnull_bool(($notnull_bool(span != null && span.get$text() != canonic alCode))) ? ('' + canonicalCode + '/*' + span.get$text() + '*/') : canonicalCode ;
19752 } 19729 }
19753 // ********** Code for ConstListValue ************** 19730 // ********** Code for ConstListValue **************
19754 function ConstListValue() {} 19731 function ConstListValue() {}
19755 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod e, span, code) { 19732 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod e, span, code) {
19756 this.values = values; 19733 this.values = values;
19757 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); 19734 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code));
19758 // Initializers done 19735 // Initializers done
19759 } 19736 }
19760 ConstListValue._internal$ctor.prototype = ConstListValue.prototype; 19737 ConstListValue._internal$ctor.prototype = ConstListValue.prototype;
19761 $inherits(ConstListValue, EvaluatedValue); 19738 $inherits(ConstListValue, EvaluatedValue);
(...skipping 20 matching lines...) Expand all
19782 // ********** Code for ConstObjectValue ************** 19759 // ********** Code for ConstObjectValue **************
19783 function ConstObjectValue() {} 19760 function ConstObjectValue() {}
19784 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC ode, span, code) { 19761 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC ode, span, code) {
19785 this.fields = fields; 19762 this.fields = fields;
19786 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); 19763 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code));
19787 // Initializers done 19764 // Initializers done
19788 } 19765 }
19789 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype; 19766 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype;
19790 $inherits(ConstObjectValue, EvaluatedValue); 19767 $inherits(ConstObjectValue, EvaluatedValue);
19791 ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode , span) { 19768 ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode , span) {
19792 var $0;
19793 var fieldValues = []; 19769 var fieldValues = [];
19794 var $list = fields.getKeys(); 19770 var $list = fields.getKeys();
19795 for (var $i = fields.getKeys().iterator(); $i.hasNext(); ) { 19771 for (var $i = fields.getKeys().iterator(); $i.hasNext(); ) {
19796 var f = $i.next(); 19772 var f = $i.next();
19797 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + '')); 19773 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + ''));
19798 } 19774 }
19799 fieldValues.sort((function (a, b) { 19775 fieldValues.sort((function (a, b) {
19800 return a.compareTo(b); 19776 return a.compareTo(b);
19801 }) 19777 })
19802 ); 19778 );
19803 var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldVa lues, ',') + ']'; 19779 var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldVa lues, ',') + ']';
19804 return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonica lCode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); 19780 return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonica lCode, span, EvaluatedValue.codeWithComments(canonicalCode, span));
19805 } 19781 }
19806 // ********** Code for GlobalValue ************** 19782 // ********** Code for GlobalValue **************
19807 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span, dependencies) { 19783 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span, dependencies) {
19808 this.field = field; 19784 this.field = field;
19809 this.name = name; 19785 this.name = name;
19810 this.exp = exp; 19786 this.exp = exp;
19811 this.canonicalCode = canonicalCode; 19787 this.canonicalCode = canonicalCode;
19812 this.dependencies = dependencies; 19788 this.dependencies = dependencies;
19813 Value.call(this, type, code, span, false, !$notnull_bool(isConst), false); 19789 Value.call(this, type, code, span, !$notnull_bool(isConst));
19814 // Initializers done 19790 // Initializers done
19815 } 19791 }
19816 $inherits(GlobalValue, Value); 19792 $inherits(GlobalValue, Value);
19817 GlobalValue.prototype.is$GlobalValue = function(){return this;}; 19793 GlobalValue.prototype.is$GlobalValue = function(){return this;};
19818 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) { 19794 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) {
19819 var code = ($notnull_bool(exp.get$isConst()) ? exp.get$canonicalCode() : exp.c ode); 19795 var code = ($notnull_bool(exp.get$isConst()) ? exp.get$canonicalCode() : exp.c ode);
19820 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie ld.get$name() + '*/'); 19796 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie ld.get$name() + '*/');
19821 return new GlobalValue(exp.type, $assert_String(codeWithComment), field.isFina l, field, null, exp, code, exp.span, dependencies.filter((function (d) { 19797 return new GlobalValue(exp.type, $assert_String(codeWithComment), field.isFina l, field, null, exp, code, exp.span, dependencies.filter((function (d) {
19822 return (d instanceof GlobalValue); 19798 return (d instanceof GlobalValue);
19823 }) 19799 })
19824 )); 19800 ));
19825 } 19801 }
19826 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies ) { 19802 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies ) {
19827 var name = ("const\$" + uniqueId + ""); 19803 var name = ("const\$" + uniqueId + "");
19828 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/"); 19804 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/");
19829 return new GlobalValue(exp.type, $assert_String(codeWithComment), true, null, name, exp, name, exp.span, dependencies.filter((function (d) { 19805 return new GlobalValue(exp.type, $assert_String(codeWithComment), true, null, name, exp, name, exp.span, dependencies.filter((function (d) {
19830 return (d instanceof GlobalValue); 19806 return (d instanceof GlobalValue);
19831 }) 19807 })
19832 )); 19808 ));
19833 } 19809 }
19834 GlobalValue.prototype.get$name = function() { return this.name; }; 19810 GlobalValue.prototype.get$name = function() { return this.name; };
19835 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; 19811 GlobalValue.prototype.set$name = function(value) { return this.name = value; };
19836 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode ; }; 19812 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode ; };
19837 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica lCode = value; }; 19813 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica lCode = value; };
19838 GlobalValue.prototype.get$isConst = function() { 19814 GlobalValue.prototype.get$isConst = function() {
19839 return $assert_bool(this.exp.get$isConst() && (this.field == null || this.fiel d.isFinal)); 19815 return $notnull_bool(this.exp.get$isConst() && ($notnull_bool(this.field == nu ll || this.field.isFinal)));
19840 } 19816 }
19841 GlobalValue.prototype.get$actualValue = function() { 19817 GlobalValue.prototype.get$actualValue = function() {
19842 return this.exp.get$dynamic().get$actualValue(); 19818 return this.exp.get$dynamic().get$actualValue();
19843 } 19819 }
19844 GlobalValue.prototype.compareTo = function(other) { 19820 GlobalValue.prototype.compareTo = function(other) {
19845 if ($notnull_bool($eq(other, this))) { 19821 if ($notnull_bool($eq(other, this))) {
19846 return 0; 19822 return 0;
19847 } 19823 }
19848 else if ($notnull_bool(this.dependencies.indexOf(other, 0) >= 0)) { 19824 else if ($notnull_bool(this.dependencies.indexOf(other, 0) >= 0)) {
19849 return 1; 19825 return 1;
(...skipping 16 matching lines...) Expand all
19866 else if ($notnull_bool(this.name != null)) { 19842 else if ($notnull_bool(this.name != null)) {
19867 return this.name.compareTo(other.name); 19843 return this.name.compareTo(other.name);
19868 } 19844 }
19869 else { 19845 else {
19870 return this.field.name.compareTo(other.field.name); 19846 return this.field.name.compareTo(other.field.name);
19871 } 19847 }
19872 } 19848 }
19873 // ********** Code for BareValue ************** 19849 // ********** Code for BareValue **************
19874 function BareValue(home, outermost, span) { 19850 function BareValue(home, outermost, span) {
19875 this.home = home; 19851 this.home = home;
19876 Value.call(this, outermost.method.declaringType, null, span, false, false, out ermost.get$isStatic()); 19852 Value.call(this, outermost.method.declaringType, null, span, false);
19877 // Initializers done 19853 // Initializers done
19854 this.isType = outermost.get$isStatic();
19878 } 19855 }
19879 $inherits(BareValue, Value); 19856 $inherits(BareValue, Value);
19880 BareValue.prototype._tryResolveMember = function(context, name) { 19857 BareValue.prototype._tryResolveMember = function(context, name) {
19881 $assert($eq(context, this.home), "context == home", "value.dart", 665, 12); 19858 $assert($eq(context, this.home), "context == home", "value.dart", 669, 12);
19882 var member = this.type.resolveMember(name); 19859 var member = this.type.resolveMember(name);
19883 if ($notnull_bool($ne(member, null))) { 19860 if ($notnull_bool($ne(member, null))) {
19884 $assert(this.code == null, "code == null", "value.dart", 670, 14); 19861 $assert(this.code == null, "code == null", "value.dart", 674, 14);
19885 if ($notnull_bool(this.isType)) { 19862 if ($notnull_bool(this.isType)) {
19886 this.code = this.type.get$jsname(); 19863 this.code = this.type.get$jsname();
19887 } 19864 }
19888 else { 19865 else {
19889 this.code = this.home._makeThisCode(); 19866 this.code = this.home._makeThisCode();
19890 } 19867 }
19891 return member; 19868 return member;
19892 } 19869 }
19893 member = this.home.get$library().lookup(name, this.span); 19870 member = this.home.get$library().lookup(name, this.span);
19894 if ($notnull_bool($ne(member, null))) { 19871 if ($notnull_bool($ne(member, null))) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
20063 var $this = this; // closure support 20040 var $this = this; // closure support
20064 var lib = this.withTiming('first pass', (function () { 20041 var lib = this.withTiming('first pass', (function () {
20065 return $this.processScript(options.dartScript); 20042 return $this.processScript(options.dartScript);
20066 }) 20043 })
20067 ); 20044 );
20068 this.withTiming('resolve top level', (function () { 20045 this.withTiming('resolve top level', (function () {
20069 $this.resolveAll(); 20046 $this.resolveAll();
20070 }) 20047 })
20071 ); 20048 );
20072 this.withTiming('generate code', (function () { 20049 this.withTiming('generate code', (function () {
20073 var $0;
20074 var mainMembers = lib.topType.resolveMember('main'); 20050 var mainMembers = lib.topType.resolveMember('main');
20075 var main = null; 20051 var main = null;
20076 if ($notnull_bool(mainMembers == null || mainMembers.get$members().length == 0)) { 20052 if ($notnull_bool(mainMembers == null || mainMembers.get$members().length == 0)) {
20077 $this.fatal('no main method specified'); 20053 $this.fatal('no main method specified');
20078 } 20054 }
20079 else if ($notnull_bool(mainMembers.get$members().length > 1)) { 20055 else if ($notnull_bool(mainMembers.get$members().length > 1)) {
20080 var $list = mainMembers.get$members(); 20056 var $list = mainMembers.get$members();
20081 for (var $i = mainMembers.get$members().iterator(); $i.hasNext(); ) { 20057 for (var $i = mainMembers.get$members().iterator(); $i.hasNext(); ) {
20082 var m = $i.next(); 20058 var m = $i.next();
20083 main = m; 20059 main = m;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
20140 lib.visitSources(); 20116 lib.visitSources();
20141 } 20117 }
20142 } 20118 }
20143 } 20119 }
20144 World.prototype.processScript = function(filename) { 20120 World.prototype.processScript = function(filename) {
20145 var library = this.getOrAddLibrary(filename); 20121 var library = this.getOrAddLibrary(filename);
20146 this.process(); 20122 this.process();
20147 return library; 20123 return library;
20148 } 20124 }
20149 World.prototype.resolveAll = function() { 20125 World.prototype.resolveAll = function() {
20150 var $0;
20151 var $list = this.libraries.getValues(); 20126 var $list = this.libraries.getValues();
20152 for (var $i = this.libraries.getValues().iterator(); $i.hasNext(); ) { 20127 for (var $i = this.libraries.getValues().iterator(); $i.hasNext(); ) {
20153 var lib = $i.next(); 20128 var lib = $i.next();
20154 lib.resolve(); 20129 lib.resolve();
20155 } 20130 }
20156 } 20131 }
20157 World.prototype._message = function(message, span, span1, span2, throwing) { 20132 World.prototype._message = function(message, span, span1, span2, throwing) {
20158 var text = message; 20133 var text = message;
20159 if ($notnull_bool(span != null)) { 20134 if ($notnull_bool(span != null)) {
20160 text = span.toMessageString(message); 20135 text = span.toMessageString(message);
(...skipping 15 matching lines...) Expand all
20176 } 20151 }
20177 World.prototype.warning = function(message, span, span1, span2) { 20152 World.prototype.warning = function(message, span, span1, span2) {
20178 this.warnings++; 20153 this.warnings++;
20179 if ($notnull_bool(options.showWarnings)) { 20154 if ($notnull_bool(options.showWarnings)) {
20180 this._message(('warning: ' + message + ''), span, span1, span2, options.thro wOnWarnings); 20155 this._message(('warning: ' + message + ''), span, span1, span2, options.thro wOnWarnings);
20181 } 20156 }
20182 } 20157 }
20183 World.prototype.fatal = function(message, span, span1, span2) { 20158 World.prototype.fatal = function(message, span, span1, span2) {
20184 this.errors++; 20159 this.errors++;
20185 this.seenFatal = true; 20160 this.seenFatal = true;
20186 this._message(('fatal: ' + message + ''), span, span1, span2, $assert_bool(opt ions.throwOnFatal || options.throwOnErrors)); 20161 this._message(('fatal: ' + message + ''), span, span1, span2, $notnull_bool(op tions.throwOnFatal || options.throwOnErrors));
20187 } 20162 }
20188 World.prototype.internalError = function(message, span, span1, span2) { 20163 World.prototype.internalError = function(message, span, span1, span2) {
20189 this._message(('We are sorry, but... ' + message + ''), span, span1, span2, tr ue); 20164 this._message(('We are sorry, but... ' + message + ''), span, span1, span2, tr ue);
20190 } 20165 }
20191 World.prototype.info = function(message, span, span1, span2) { 20166 World.prototype.info = function(message, span, span1, span2) {
20192 if ($notnull_bool(options.showInfo)) { 20167 if ($notnull_bool(options.showInfo)) {
20193 this._message(('info: ' + message + ''), span, span1, span2, false); 20168 this._message(('info: ' + message + ''), span, span1, span2, false);
20194 } 20169 }
20195 } 20170 }
20196 World.prototype.get$hasErrors = function() { 20171 World.prototype.get$hasErrors = function() {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
20365 function VarMember(name) { 20340 function VarMember(name) {
20366 this.name = name; 20341 this.name = name;
20367 // Initializers done 20342 // Initializers done
20368 } 20343 }
20369 VarMember.prototype.is$VarMember = function(){return this;}; 20344 VarMember.prototype.is$VarMember = function(){return this;};
20370 VarMember.prototype.get$name = function() { return this.name; }; 20345 VarMember.prototype.get$name = function() { return this.name; };
20371 VarMember.prototype.get$returnType = function() { 20346 VarMember.prototype.get$returnType = function() {
20372 return world.varType; 20347 return world.varType;
20373 } 20348 }
20374 VarMember.prototype.invoke = function(context, node, target, args) { 20349 VarMember.prototype.invoke = function(context, node, target, args) {
20375 return new Value(this.get$returnType(), ('' + target.code + '.' + this.name + '(' + args.getCode() + ')'), node.span, false, true, false); 20350 return new Value(this.get$returnType(), ('' + target.code + '.' + this.name + '(' + args.getCode() + ')'), node.span, true);
20376 } 20351 }
20377 VarMember.prototype.invoke$4 = function($0, $1, $2, $3) { 20352 VarMember.prototype.invoke$4 = function($0, $1, $2, $3) {
20378 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments())); 20353 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments()));
20379 } 20354 }
20380 ; 20355 ;
20381 // ********** Code for VarFunctionStub ************** 20356 // ********** Code for VarFunctionStub **************
20382 function VarFunctionStub(name, callArgs) { 20357 function VarFunctionStub(name, callArgs) {
20383 this.args = callArgs.toCallStubArgs(); 20358 this.args = callArgs.toCallStubArgs();
20384 VarMember.call(this, name); 20359 VarMember.call(this, name);
20385 // Initializers done 20360 // Initializers done
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
20482 VarMethodSet.prototype.invoke = function(context, node, target, args) { 20457 VarMethodSet.prototype.invoke = function(context, node, target, args) {
20483 this._invokeMembers(context, node); 20458 this._invokeMembers(context, node);
20484 return VarMember.prototype.invoke.call(this, context, node, target, args); 20459 return VarMember.prototype.invoke.call(this, context, node, target, args);
20485 } 20460 }
20486 VarMethodSet.prototype._invokeMembers = function(context, node) { 20461 VarMethodSet.prototype._invokeMembers = function(context, node) {
20487 if ($notnull_bool(this._fallbackStubs != null)) return; 20462 if ($notnull_bool(this._fallbackStubs != null)) return;
20488 this._fallbackStubs = []; 20463 this._fallbackStubs = [];
20489 var $list = this.members; 20464 var $list = this.members;
20490 for (var $i = 0;$i < $list.length; $i++) { 20465 for (var $i = 0;$i < $list.length; $i++) {
20491 var member = $list.$index($i); 20466 var member = $list.$index($i);
20492 var target = new Value(member.declaringType, 'this', node.span, false, true, false); 20467 var target = new Value(member.declaringType, 'this', node.span, true);
20493 var result = member.invoke$4(context, node, target, this.args); 20468 var result = member.invoke$4(context, node, target, this.args);
20494 var stub = new VarMethodStub(this.name, member, this.args, result); 20469 var stub = new VarMethodStub(this.name, member, this.args, result);
20495 var type = member.declaringType; 20470 var type = member.declaringType;
20496 if ($notnull_bool($ne(type.get$library(), world.get$dom()) && !$notnull_bool (type.get$isObject()))) { 20471 if ($notnull_bool($ne(type.get$library(), world.get$dom()) && !$notnull_bool (type.get$isObject()))) {
20497 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V arMember())); 20472 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V arMember()));
20498 } 20473 }
20499 else { 20474 else {
20500 this._fallbackStubs.add(stub); 20475 this._fallbackStubs.add(stub);
20501 } 20476 }
20502 } 20477 }
20503 var target = new Value(world.objectType, 'this', node.span, false, true, false ); 20478 var target = new Value(world.objectType, 'this', node.span, true);
20504 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, thi s.args); 20479 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, thi s.args);
20505 var stub = new VarMethodStub(this.name, null, this.args, result); 20480 var stub = new VarMethodStub(this.name, null, this.args, result);
20506 if ($notnull_bool(this._fallbackStubs.length == 0)) { 20481 if ($notnull_bool(this._fallbackStubs.length == 0)) {
20507 VarMethodSet._addVarStub(world.objectType, (stub && stub.is$VarMember())); 20482 VarMethodSet._addVarStub(world.objectType, (stub && stub.is$VarMember()));
20508 } 20483 }
20509 else { 20484 else {
20510 this._fallbackStubs.add(stub); 20485 this._fallbackStubs.add(stub);
20511 world.gen.corejs.useVarMethod = true; 20486 world.gen.corejs.useVarMethod = true;
20512 } 20487 }
20513 } 20488 }
(...skipping 13 matching lines...) Expand all
20527 code.writeln($notnull_bool($eq(stub, lastOne)) ? '' : ','); 20502 code.writeln($notnull_bool($eq(stub, lastOne)) ? '' : ',');
20528 } 20503 }
20529 code.exitBlock('});'); 20504 code.exitBlock('});');
20530 } 20505 }
20531 VarMethodSet.prototype.invoke$4 = function($0, $1, $2, $3) { 20506 VarMethodSet.prototype.invoke$4 = function($0, $1, $2, $3) {
20532 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments())); 20507 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments()));
20533 } 20508 }
20534 ; 20509 ;
20535 // ********** Code for top level ************** 20510 // ********** Code for top level **************
20536 function map(source, mapper) { 20511 function map(source, mapper) {
20537 var $0;
20538 var result = new ListFactory(); 20512 var result = new ListFactory();
20539 if ($notnull_bool(!!(source && source.is$List))) { 20513 if ($notnull_bool(!!(source && source.is$List))) {
20540 var list = (source && source.is$List()); 20514 var list = (source && source.is$List());
20541 result.length = list.length; 20515 result.length = list.length;
20542 for (var i = 0; 20516 for (var i = 0;
20543 $notnull_bool(i < list.length); i++) { 20517 $notnull_bool(i < list.length); i++) {
20544 result.$setindex(i, mapper(list.$index(i))); 20518 result.$setindex(i, mapper(list.$index(i)));
20545 } 20519 }
20546 } 20520 }
20547 else { 20521 else {
(...skipping 23 matching lines...) Expand all
20571 }) 20545 })
20572 ); 20546 );
20573 var values = []; 20547 var values = [];
20574 for (var $i = 0;$i < keys.length; $i++) { 20548 for (var $i = 0;$i < keys.length; $i++) {
20575 var k = keys.$index($i); 20549 var k = keys.$index($i);
20576 values.add(map.$index(k)); 20550 values.add(map.$index(k));
20577 } 20551 }
20578 return values; 20552 return values;
20579 } 20553 }
20580 function isMultilineString(text) { 20554 function isMultilineString(text) {
20581 return $assert_bool(text.startsWith('"""') || text.startsWith("'''")); 20555 return $notnull_bool(text.startsWith('"""') || text.startsWith("'''"));
20582 } 20556 }
20583 function isRawMultilineString(text) { 20557 function isRawMultilineString(text) {
20584 return $assert_bool(text.startsWith('@"""') || text.startsWith("@'''")); 20558 return $notnull_bool(text.startsWith('@"""') || text.startsWith("@'''"));
20585 } 20559 }
20586 function parseStringLiteral(lit) { 20560 function parseStringLiteral(lit) {
20587 if ($notnull_bool(lit.startsWith('@'))) { 20561 if ($notnull_bool(lit.startsWith('@'))) {
20588 if ($notnull_bool(isRawMultilineString(lit))) { 20562 if ($notnull_bool(isRawMultilineString(lit))) {
20589 return stripLeadingNewline(lit.substring(4, lit.length - 3)); 20563 return stripLeadingNewline(lit.substring(4, lit.length - 3));
20590 } 20564 }
20591 else { 20565 else {
20592 return lit.substring(2, lit.length - 1); 20566 return lit.substring(2, lit.length - 1);
20593 } 20567 }
20594 } 20568 }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
20798 INTERFACE, 20772 INTERFACE,
20799 LIBRARY, 20773 LIBRARY,
20800 NATIVE, 20774 NATIVE,
20801 NEGATE, 20775 NEGATE,
20802 OPERATOR, 20776 OPERATOR,
20803 SET, 20777 SET,
20804 SOURCE, 20778 SOURCE,
20805 STATIC, 20779 STATIC,
20806 TYPEDEF ]*/; 20780 TYPEDEF ]*/;
20807 RunEntry(function () {main();}, []); 20781 RunEntry(function () {main();}, []);
OLDNEW
« no previous file with comments | « no previous file | frog/gen.dart » ('j') | frog/gen.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698