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

Side by Side Diff: frog/frogsh

Issue 8567010: Dynamically dispatch getters and setters on dynamically-typed variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes, frogsh 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/member.dart » ('j') | no next file with comments »
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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 }; 425 };
426 Object.prototype.expectedIdentifier$1 = function($0) { 426 Object.prototype.expectedIdentifier$1 = function($0) {
427 return this.noSuchMethod("expectedIdentifier", [$0]); 427 return this.noSuchMethod("expectedIdentifier", [$0]);
428 }; 428 };
429 Object.prototype.expectedType$1 = function($0) { 429 Object.prototype.expectedType$1 = function($0) {
430 return this.noSuchMethod("expectedType", [$0]); 430 return this.noSuchMethod("expectedType", [$0]);
431 }; 431 };
432 Object.prototype.filter$1 = function($0) { 432 Object.prototype.filter$1 = function($0) {
433 return this.noSuchMethod("filter", [$0]); 433 return this.noSuchMethod("filter", [$0]);
434 }; 434 };
435 Object.prototype.findTypeByName$1 = function($0) {
436 return this.noSuchMethod("findTypeByName", [$0]);
437 };
438 Object.prototype.forEach$1 = function($0) {
439 return this.noSuchMethod("forEach", [$0]);
440 };
435 Object.prototype.genValue$2 = function($0, $1) { 441 Object.prototype.genValue$2 = function($0, $1) {
436 return this.noSuchMethod("genValue", [$0, $1]); 442 return this.noSuchMethod("genValue", [$0, $1]);
437 }; 443 };
438 Object.prototype.generate$1 = function($0) { 444 Object.prototype.generate$1 = function($0) {
439 return this.noSuchMethod("generate", [$0]); 445 return this.noSuchMethod("generate", [$0]);
440 }; 446 };
441 Object.prototype.generateBody$2 = function($0, $1) { 447 Object.prototype.generateBody$2 = function($0, $1) {
442 return this.noSuchMethod("generateBody", [$0, $1]); 448 return this.noSuchMethod("generateBody", [$0, $1]);
443 }; 449 };
444 Object.prototype.getBeginToken$0 = function() { 450 Object.prototype.getBeginToken$0 = function() {
445 return this.noSuchMethod("getBeginToken", []); 451 return this.noSuchMethod("getBeginToken", []);
446 }; 452 };
453 Object.prototype.getColumn$2 = function($0, $1) {
454 return this.noSuchMethod("getColumn", [$0, $1]);
455 };
447 Object.prototype.getConstructor$1 = function($0) { 456 Object.prototype.getConstructor$1 = function($0) {
448 return this.noSuchMethod("getConstructor", [$0]); 457 return this.noSuchMethod("getConstructor", [$0]);
449 }; 458 };
450 Object.prototype.getEndToken$0 = function() { 459 Object.prototype.getEndToken$0 = function() {
451 return this.noSuchMethod("getEndToken", []); 460 return this.noSuchMethod("getEndToken", []);
452 }; 461 };
453 Object.prototype.getFactory$2 = function($0, $1) { 462 Object.prototype.getFactory$2 = function($0, $1) {
454 return this.noSuchMethod("getFactory", [$0, $1]); 463 return this.noSuchMethod("getFactory", [$0, $1]);
455 }; 464 };
456 Object.prototype.getKeys$0 = function() { 465 Object.prototype.getKeys$0 = function() {
457 return this.noSuchMethod("getKeys", []); 466 return this.noSuchMethod("getKeys", []);
458 }; 467 };
468 Object.prototype.getLine$1 = function($0) {
469 return this.noSuchMethod("getLine", [$0]);
470 };
459 Object.prototype.getMember$1 = function($0) { 471 Object.prototype.getMember$1 = function($0) {
460 return this.noSuchMethod("getMember", [$0]); 472 return this.noSuchMethod("getMember", [$0]);
461 }; 473 };
462 Object.prototype.getOrMakeConcreteType$1 = function($0) { 474 Object.prototype.getOrMakeConcreteType$1 = function($0) {
463 return this.noSuchMethod("getOrMakeConcreteType", [$0]); 475 return this.noSuchMethod("getOrMakeConcreteType", [$0]);
464 }; 476 };
465 Object.prototype.get_$3 = function($0, $1, $2) { 477 Object.prototype.get_$3 = function($0, $1, $2) {
466 return this.noSuchMethod("get_", [$0, $1, $2]); 478 return this.noSuchMethod("get_", [$0, $1, $2]);
467 }; 479 };
468 Object.prototype.handleAssignmentExpression$1 = function($0) { 480 Object.prototype.handleAssignmentExpression$1 = function($0) {
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 } 1345 }
1334 1346
1335 function _IsolateJsUtil() {} 1347 function _IsolateJsUtil() {}
1336 // ********** Code for ListFactory ************** 1348 // ********** Code for ListFactory **************
1337 ListFactory = Array; 1349 ListFactory = Array;
1338 ListFactory.prototype.is$ListFactory = function(){return this;}; 1350 ListFactory.prototype.is$ListFactory = function(){return this;};
1339 ListFactory.prototype.is$List = function(){return this;}; 1351 ListFactory.prototype.is$List = function(){return this;};
1340 ListFactory.prototype.is$List$ArgumentNode = function(){return this;}; 1352 ListFactory.prototype.is$List$ArgumentNode = function(){return this;};
1341 ListFactory.prototype.is$List$Definition = function(){return this;}; 1353 ListFactory.prototype.is$List$Definition = function(){return this;};
1342 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;}; 1354 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;};
1355 ListFactory.prototype.is$List$HInstruction = function(){return this;};
1356 ListFactory.prototype.is$List$Member = function(){return this;};
1343 ListFactory.prototype.is$List$String = function(){return this;}; 1357 ListFactory.prototype.is$List$String = function(){return this;};
1344 ListFactory.prototype.is$List$Type = function(){return this;}; 1358 ListFactory.prototype.is$List$Type = function(){return this;};
1345 ListFactory.prototype.is$List$Value = function(){return this;}; 1359 ListFactory.prototype.is$List$Value = function(){return this;};
1346 ListFactory.prototype.is$List$int = function(){return this;}; 1360 ListFactory.prototype.is$List$int = function(){return this;};
1347 ListFactory.prototype.is$Collection$E = function(){return this;}; 1361 ListFactory.prototype.is$Collection$E = function(){return this;};
1348 ListFactory.prototype.is$Collection$Object = function(){return this;}; 1362 ListFactory.prototype.is$Collection$Object = function(){return this;};
1349 ListFactory.prototype.is$Collection$Type = function(){return this;}; 1363 ListFactory.prototype.is$Collection$Type = function(){return this;};
1350 ListFactory.prototype.is$Iterable = function(){return this;}; 1364 ListFactory.prototype.is$Iterable = function(){return this;};
1351 ListFactory.ListFactory$from$factory = function(other) { 1365 ListFactory.ListFactory$from$factory = function(other) {
1352 var list = []; 1366 var list = [];
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 return this.length == 0; 1398 return this.length == 0;
1385 } 1399 }
1386 ListFactory.prototype.iterator = function() { 1400 ListFactory.prototype.iterator = function() {
1387 return new ListIterator(this); 1401 return new ListIterator(this);
1388 } 1402 }
1389 ListFactory.prototype.add$1 = ListFactory.prototype.add; 1403 ListFactory.prototype.add$1 = ListFactory.prototype.add;
1390 ListFactory.prototype.addAll$1 = function($0) { 1404 ListFactory.prototype.addAll$1 = function($0) {
1391 return this.addAll(($0 && $0.is$Collection$E())); 1405 return this.addAll(($0 && $0.is$Collection$E()));
1392 }; 1406 };
1393 ListFactory.prototype.filter$1 = ListFactory.prototype.filter; 1407 ListFactory.prototype.filter$1 = ListFactory.prototype.filter;
1408 ListFactory.prototype.forEach$1 = ListFactory.prototype.forEach;
1394 ListFactory.prototype.indexOf$2 = ListFactory.prototype.indexOf; 1409 ListFactory.prototype.indexOf$2 = ListFactory.prototype.indexOf;
1395 ListFactory.prototype.isEmpty$0 = function() { 1410 ListFactory.prototype.isEmpty$0 = function() {
1396 return this.isEmpty(); 1411 return this.isEmpty();
1397 }; 1412 };
1398 ListFactory.prototype.iterator$0 = function() { 1413 ListFactory.prototype.iterator$0 = function() {
1399 return this.iterator(); 1414 return this.iterator();
1400 }; 1415 };
1401 ListFactory.prototype.last$0 = function() { 1416 ListFactory.prototype.last$0 = function() {
1402 return this.last(); 1417 return this.last();
1403 }; 1418 };
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 } 1556 }
1542 ImmutableMap.prototype.getValues = function() { 1557 ImmutableMap.prototype.getValues = function() {
1543 return this._internal.getValues(); 1558 return this._internal.getValues();
1544 } 1559 }
1545 ImmutableMap.prototype.containsKey = function(key) { 1560 ImmutableMap.prototype.containsKey = function(key) {
1546 return this._internal.containsKey(key); 1561 return this._internal.containsKey(key);
1547 } 1562 }
1548 ImmutableMap.prototype.$setindex = function(key, value) { 1563 ImmutableMap.prototype.$setindex = function(key, value) {
1549 $throw(const$12/*const IllegalAccessException()*/); 1564 $throw(const$12/*const IllegalAccessException()*/);
1550 } 1565 }
1566 ImmutableMap.prototype.forEach$1 = ImmutableMap.prototype.forEach;
1551 ImmutableMap.prototype.getKeys$0 = function() { 1567 ImmutableMap.prototype.getKeys$0 = function() {
1552 return this.getKeys(); 1568 return this.getKeys();
1553 }; 1569 };
1554 ImmutableMap.prototype.isEmpty$0 = function() { 1570 ImmutableMap.prototype.isEmpty$0 = function() {
1555 return this.isEmpty(); 1571 return this.isEmpty();
1556 }; 1572 };
1557 // ********** Code for MatchImplementation ************** 1573 // ********** Code for MatchImplementation **************
1558 function MatchImplementation(pattern, str, _start, _end, _groups) { 1574 function MatchImplementation(pattern, str, _start, _end, _groups) {
1559 this.pattern = pattern; 1575 this.pattern = pattern;
1560 this.str = str; 1576 this.str = str;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1795 var i = 0; 1811 var i = 0;
1796 this.forEach(function _(key, value) { 1812 this.forEach(function _(key, value) {
1797 list.$setindex(i++, value); 1813 list.$setindex(i++, value);
1798 } 1814 }
1799 ); 1815 );
1800 return list; 1816 return list;
1801 } 1817 }
1802 HashMapImplementation.prototype.containsKey = function(key) { 1818 HashMapImplementation.prototype.containsKey = function(key) {
1803 return (this._probeForLookup(key) != -1); 1819 return (this._probeForLookup(key) != -1);
1804 } 1820 }
1821 HashMapImplementation.prototype.forEach$1 = HashMapImplementation.prototype.forE ach;
1805 HashMapImplementation.prototype.getKeys$0 = function() { 1822 HashMapImplementation.prototype.getKeys$0 = function() {
1806 return this.getKeys(); 1823 return this.getKeys();
1807 }; 1824 };
1808 HashMapImplementation.prototype.isEmpty$0 = function() { 1825 HashMapImplementation.prototype.isEmpty$0 = function() {
1809 return this.isEmpty(); 1826 return this.isEmpty();
1810 }; 1827 };
1811 // ********** Code for HashMapImplementation$E$E ************** 1828 // ********** Code for HashMapImplementation$E$E **************
1812 function HashMapImplementation$E$E() { 1829 function HashMapImplementation$E$E() {
1813 // Initializers done 1830 // Initializers done
1814 if (HashMapImplementation._deletedKey == null) { 1831 if (HashMapImplementation._deletedKey == null) {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 }); 2042 });
2026 HashSetImplementation.prototype.iterator = function() { 2043 HashSetImplementation.prototype.iterator = function() {
2027 return new HashSetIterator$E(this); 2044 return new HashSetIterator$E(this);
2028 } 2045 }
2029 HashSetImplementation.prototype.add$1 = HashSetImplementation.prototype.add; 2046 HashSetImplementation.prototype.add$1 = HashSetImplementation.prototype.add;
2030 HashSetImplementation.prototype.addAll$1 = function($0) { 2047 HashSetImplementation.prototype.addAll$1 = function($0) {
2031 return this.addAll(($0 && $0.is$Collection$E())); 2048 return this.addAll(($0 && $0.is$Collection$E()));
2032 }; 2049 };
2033 HashSetImplementation.prototype.contains$1 = HashSetImplementation.prototype.con tains; 2050 HashSetImplementation.prototype.contains$1 = HashSetImplementation.prototype.con tains;
2034 HashSetImplementation.prototype.filter$1 = HashSetImplementation.prototype.filte r; 2051 HashSetImplementation.prototype.filter$1 = HashSetImplementation.prototype.filte r;
2052 HashSetImplementation.prototype.forEach$1 = HashSetImplementation.prototype.forE ach;
2035 HashSetImplementation.prototype.isEmpty$0 = function() { 2053 HashSetImplementation.prototype.isEmpty$0 = function() {
2036 return this.isEmpty(); 2054 return this.isEmpty();
2037 }; 2055 };
2038 HashSetImplementation.prototype.iterator$0 = function() { 2056 HashSetImplementation.prototype.iterator$0 = function() {
2039 return this.iterator(); 2057 return this.iterator();
2040 }; 2058 };
2041 HashSetImplementation.prototype.some$1 = HashSetImplementation.prototype.some; 2059 HashSetImplementation.prototype.some$1 = HashSetImplementation.prototype.some;
2042 // ********** Code for HashSetImplementation$E ************** 2060 // ********** Code for HashSetImplementation$E **************
2043 function HashSetImplementation$E() {} 2061 function HashSetImplementation$E() {}
2044 $inherits(HashSetImplementation$E, HashSetImplementation); 2062 $inherits(HashSetImplementation$E, HashSetImplementation);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 // ********** Code for LinkedHashMapImplementation ************** 2154 // ********** Code for LinkedHashMapImplementation **************
2137 function LinkedHashMapImplementation() { 2155 function LinkedHashMapImplementation() {
2138 // Initializers done 2156 // Initializers done
2139 this._map = new HashMapImplementation(); 2157 this._map = new HashMapImplementation();
2140 this._list = new DoubleLinkedQueue$KeyValuePair$K$V(); 2158 this._list = new DoubleLinkedQueue$KeyValuePair$K$V();
2141 } 2159 }
2142 LinkedHashMapImplementation.prototype.is$Map$Node$Element = function(){return th is;}; 2160 LinkedHashMapImplementation.prototype.is$Map$Node$Element = function(){return th is;};
2143 LinkedHashMapImplementation.prototype.is$Map$String$Member = function(){return t his;}; 2161 LinkedHashMapImplementation.prototype.is$Map$String$Member = function(){return t his;};
2144 LinkedHashMapImplementation.prototype.$setindex = function(key, value) { 2162 LinkedHashMapImplementation.prototype.$setindex = function(key, value) {
2145 if (this._map.containsKey(key)) { 2163 if (this._map.containsKey(key)) {
2146 this._map.$index(key).get$element().value = value; 2164 this._map.$index(key).get$element().set$value(value);
2147 } 2165 }
2148 else { 2166 else {
2149 this._list.addLast(new KeyValuePair$K$V(key, value)); 2167 this._list.addLast(new KeyValuePair$K$V(key, value));
2150 this._map.$setindex(key, this._list.lastEntry()); 2168 this._map.$setindex(key, this._list.lastEntry());
2151 } 2169 }
2152 } 2170 }
2153 LinkedHashMapImplementation.prototype.$index = function(key) { 2171 LinkedHashMapImplementation.prototype.$index = function(key) {
2154 var $0; 2172 var $0;
2155 var entry = (($0 = this._map.$index(key)) && $0.is$DoubleLinkedQueueEntry$KeyV aluePair$K$V()); 2173 var entry = (($0 = this._map.$index(key)) && $0.is$DoubleLinkedQueueEntry$KeyV aluePair$K$V());
2156 if (entry == null) return null; 2174 if (entry == null) return null;
(...skipping 30 matching lines...) Expand all
2187 } 2205 }
2188 LinkedHashMapImplementation.prototype.get$length = function() { 2206 LinkedHashMapImplementation.prototype.get$length = function() {
2189 return this._map.get$length(); 2207 return this._map.get$length();
2190 } 2208 }
2191 Object.defineProperty(LinkedHashMapImplementation.prototype, "length", { 2209 Object.defineProperty(LinkedHashMapImplementation.prototype, "length", {
2192 get: LinkedHashMapImplementation.prototype.get$length 2210 get: LinkedHashMapImplementation.prototype.get$length
2193 }); 2211 });
2194 LinkedHashMapImplementation.prototype.isEmpty = function() { 2212 LinkedHashMapImplementation.prototype.isEmpty = function() {
2195 return this.get$length() == 0; 2213 return this.get$length() == 0;
2196 } 2214 }
2215 LinkedHashMapImplementation.prototype.forEach$1 = LinkedHashMapImplementation.pr ototype.forEach;
2197 LinkedHashMapImplementation.prototype.getKeys$0 = function() { 2216 LinkedHashMapImplementation.prototype.getKeys$0 = function() {
2198 return this.getKeys(); 2217 return this.getKeys();
2199 }; 2218 };
2200 LinkedHashMapImplementation.prototype.isEmpty$0 = function() { 2219 LinkedHashMapImplementation.prototype.isEmpty$0 = function() {
2201 return this.isEmpty(); 2220 return this.isEmpty();
2202 }; 2221 };
2203 // ********** Code for LinkedHashMapImplementation$Node$Element ************** 2222 // ********** Code for LinkedHashMapImplementation$Node$Element **************
2204 function LinkedHashMapImplementation$Node$Element() {} 2223 function LinkedHashMapImplementation$Node$Element() {}
2205 $inherits(LinkedHashMapImplementation$Node$Element, LinkedHashMapImplementation) ; 2224 $inherits(LinkedHashMapImplementation$Node$Element, LinkedHashMapImplementation) ;
2206 LinkedHashMapImplementation$Node$Element.prototype.is$Map$Node$Element = functio n(){return this;}; 2225 LinkedHashMapImplementation$Node$Element.prototype.is$Map$Node$Element = functio n(){return this;};
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 } 2397 }
2379 Object.defineProperty(DoubleLinkedQueue.prototype, "length", { 2398 Object.defineProperty(DoubleLinkedQueue.prototype, "length", {
2380 get: DoubleLinkedQueue.prototype.get$length 2399 get: DoubleLinkedQueue.prototype.get$length
2381 }); 2400 });
2382 DoubleLinkedQueue.prototype.isEmpty = function() { 2401 DoubleLinkedQueue.prototype.isEmpty = function() {
2383 return (this._sentinel._next === this._sentinel); 2402 return (this._sentinel._next === this._sentinel);
2384 } 2403 }
2385 DoubleLinkedQueue.prototype.forEach = function(f) { 2404 DoubleLinkedQueue.prototype.forEach = function(f) {
2386 var entry = this._sentinel._next; 2405 var entry = this._sentinel._next;
2387 while (entry !== this._sentinel) { 2406 while (entry !== this._sentinel) {
2407 var nextEntry = entry._next;
2388 f(entry._element); 2408 f(entry._element);
2389 entry = entry._next; 2409 entry = nextEntry;
2390 } 2410 }
2391 } 2411 }
2392 DoubleLinkedQueue.prototype.some = function(f) { 2412 DoubleLinkedQueue.prototype.some = function(f) {
2393 var entry = this._sentinel._next; 2413 var entry = this._sentinel._next;
2394 while (entry !== this._sentinel) { 2414 while (entry !== this._sentinel) {
2415 var nextEntry = entry._next;
2395 if (f(entry._element)) return true; 2416 if (f(entry._element)) return true;
2396 entry = entry._next; 2417 entry = nextEntry;
2397 } 2418 }
2398 return false; 2419 return false;
2399 } 2420 }
2400 DoubleLinkedQueue.prototype.filter = function(f) { 2421 DoubleLinkedQueue.prototype.filter = function(f) {
2401 var other = new DoubleLinkedQueue(); 2422 var other = new DoubleLinkedQueue();
2402 var entry = this._sentinel._next; 2423 var entry = this._sentinel._next;
2403 while (entry !== this._sentinel) { 2424 while (entry !== this._sentinel) {
2425 var nextEntry = entry._next;
2404 if (f(entry._element)) other.addLast(entry._element); 2426 if (f(entry._element)) other.addLast(entry._element);
2405 entry = entry._next; 2427 entry = nextEntry;
2406 } 2428 }
2407 return other; 2429 return other;
2408 } 2430 }
2409 DoubleLinkedQueue.prototype.iterator = function() { 2431 DoubleLinkedQueue.prototype.iterator = function() {
2410 return new _DoubleLinkedQueueIterator$E(this._sentinel); 2432 return new _DoubleLinkedQueueIterator$E(this._sentinel);
2411 } 2433 }
2412 DoubleLinkedQueue.prototype.add$1 = DoubleLinkedQueue.prototype.add; 2434 DoubleLinkedQueue.prototype.add$1 = DoubleLinkedQueue.prototype.add;
2413 DoubleLinkedQueue.prototype.addAll$1 = function($0) { 2435 DoubleLinkedQueue.prototype.addAll$1 = function($0) {
2414 return this.addAll(($0 && $0.is$Collection$E())); 2436 return this.addAll(($0 && $0.is$Collection$E()));
2415 }; 2437 };
2416 DoubleLinkedQueue.prototype.filter$1 = DoubleLinkedQueue.prototype.filter; 2438 DoubleLinkedQueue.prototype.filter$1 = DoubleLinkedQueue.prototype.filter;
2439 DoubleLinkedQueue.prototype.forEach$1 = DoubleLinkedQueue.prototype.forEach;
2417 DoubleLinkedQueue.prototype.isEmpty$0 = function() { 2440 DoubleLinkedQueue.prototype.isEmpty$0 = function() {
2418 return this.isEmpty(); 2441 return this.isEmpty();
2419 }; 2442 };
2420 DoubleLinkedQueue.prototype.iterator$0 = function() { 2443 DoubleLinkedQueue.prototype.iterator$0 = function() {
2421 return this.iterator(); 2444 return this.iterator();
2422 }; 2445 };
2423 DoubleLinkedQueue.prototype.last$0 = function() { 2446 DoubleLinkedQueue.prototype.last$0 = function() {
2424 return this.last(); 2447 return this.last();
2425 }; 2448 };
2426 DoubleLinkedQueue.prototype.removeLast$0 = function() { 2449 DoubleLinkedQueue.prototype.removeLast$0 = function() {
(...skipping 26 matching lines...) Expand all
2453 DoubleLinkedQueue$KeyValuePair$K$V.prototype.is$Iterable = function(){return thi s;}; 2476 DoubleLinkedQueue$KeyValuePair$K$V.prototype.is$Iterable = function(){return thi s;};
2454 DoubleLinkedQueue$KeyValuePair$K$V.prototype.addLast = function(value) { 2477 DoubleLinkedQueue$KeyValuePair$K$V.prototype.addLast = function(value) {
2455 this._sentinel.prepend(value); 2478 this._sentinel.prepend(value);
2456 } 2479 }
2457 DoubleLinkedQueue$KeyValuePair$K$V.prototype.lastEntry = function() { 2480 DoubleLinkedQueue$KeyValuePair$K$V.prototype.lastEntry = function() {
2458 return this._sentinel.previousEntry(); 2481 return this._sentinel.previousEntry();
2459 } 2482 }
2460 DoubleLinkedQueue$KeyValuePair$K$V.prototype.forEach = function(f) { 2483 DoubleLinkedQueue$KeyValuePair$K$V.prototype.forEach = function(f) {
2461 var entry = this._sentinel._next; 2484 var entry = this._sentinel._next;
2462 while (entry !== this._sentinel) { 2485 while (entry !== this._sentinel) {
2486 var nextEntry = entry._next;
2463 f(entry._element); 2487 f(entry._element);
2464 entry = entry._next; 2488 entry = nextEntry;
2465 } 2489 }
2466 } 2490 }
2467 // ********** Code for DoubleLinkedQueue$SourceString ************** 2491 // ********** Code for DoubleLinkedQueue$SourceString **************
2468 function DoubleLinkedQueue$SourceString() {} 2492 function DoubleLinkedQueue$SourceString() {}
2469 $inherits(DoubleLinkedQueue$SourceString, DoubleLinkedQueue); 2493 $inherits(DoubleLinkedQueue$SourceString, DoubleLinkedQueue);
2470 DoubleLinkedQueue$SourceString.prototype.is$Collection$E = function(){return thi s;}; 2494 DoubleLinkedQueue$SourceString.prototype.is$Collection$E = function(){return thi s;};
2471 DoubleLinkedQueue$SourceString.prototype.is$Collection$Object = function(){retur n this;}; 2495 DoubleLinkedQueue$SourceString.prototype.is$Collection$Object = function(){retur n this;};
2472 DoubleLinkedQueue$SourceString.prototype.is$Collection$Type = false; 2496 DoubleLinkedQueue$SourceString.prototype.is$Collection$Type = false;
2473 DoubleLinkedQueue$SourceString.prototype.is$Iterable = function(){return this;}; 2497 DoubleLinkedQueue$SourceString.prototype.is$Iterable = function(){return this;};
2474 // ********** Code for _DoubleLinkedQueueIterator ************** 2498 // ********** Code for _DoubleLinkedQueueIterator **************
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2512 if (this._start == null) { 2536 if (this._start == null) {
2513 this._start = Clock.now(); 2537 this._start = Clock.now();
2514 } 2538 }
2515 else { 2539 else {
2516 if (this._stop == null) { 2540 if (this._stop == null) {
2517 return; 2541 return;
2518 } 2542 }
2519 this._start = Clock.now() - (this._stop - this._start); 2543 this._start = Clock.now() - (this._stop - this._start);
2520 } 2544 }
2521 } 2545 }
2546 StopwatchImplementation.prototype.get$start = function() {
2547 return StopwatchImplementation.prototype.start.bind(this);
2548 }
2522 StopwatchImplementation.prototype.stop = function() { 2549 StopwatchImplementation.prototype.stop = function() {
2523 if (this._start == null) { 2550 if (this._start == null) {
2524 return; 2551 return;
2525 } 2552 }
2526 this._stop = Clock.now(); 2553 this._stop = Clock.now();
2527 } 2554 }
2528 StopwatchImplementation.prototype.elapsed = function() { 2555 StopwatchImplementation.prototype.elapsed = function() {
2529 if (this._start == null) { 2556 if (this._start == null) {
2530 return 0; 2557 return 0;
2531 } 2558 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 DateImplementation.now$ctor = function() { 2751 DateImplementation.now$ctor = function() {
2725 this.timeZone = new TimeZoneImplementation.local$ctor(); 2752 this.timeZone = new TimeZoneImplementation.local$ctor();
2726 this.value = DateImplementation._now(); 2753 this.value = DateImplementation._now();
2727 // Initializers done 2754 // Initializers done
2728 this._asJs(); 2755 this._asJs();
2729 } 2756 }
2730 DateImplementation.now$ctor.prototype = DateImplementation.prototype; 2757 DateImplementation.now$ctor.prototype = DateImplementation.prototype;
2731 DateImplementation.prototype.is$Date = function(){return this;}; 2758 DateImplementation.prototype.is$Date = function(){return this;};
2732 DateImplementation.prototype.is$Comparable = function(){return this;}; 2759 DateImplementation.prototype.is$Comparable = function(){return this;};
2733 DateImplementation.prototype.get$value = function() { return this.value; }; 2760 DateImplementation.prototype.get$value = function() { return this.value; };
2761 DateImplementation.prototype.get$timeZone = function() { return this.timeZone; } ;
2734 DateImplementation.prototype.$eq = function(other) { 2762 DateImplementation.prototype.$eq = function(other) {
2735 if (!((other instanceof DateImplementation))) return false; 2763 if (!((other instanceof DateImplementation))) return false;
2736 return (this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone )); 2764 return (this.value == other.get$value()) && ($eq(this.timeZone, other.get$time Zone()));
2737 } 2765 }
2738 DateImplementation.prototype.compareTo = function(other) { 2766 DateImplementation.prototype.compareTo = function(other) {
2739 return this.value.compareTo(other.value); 2767 return this.value.compareTo(other.value);
2740 } 2768 }
2741 DateImplementation.prototype.get$year = function() { 2769 DateImplementation.prototype.get$year = function() {
2742 return this.isUtc ? this._asJs().getUTCFullYear() : 2770 return this.isUtc ? this._asJs().getUTCFullYear() :
2743 this._asJs().getFullYear(); 2771 this._asJs().getFullYear();
2744 } 2772 }
2745 DateImplementation.prototype.get$month = function() { 2773 DateImplementation.prototype.get$month = function() {
2746 return this.isUtc ? this._asJs().getMonth() + 1 : 2774 return this.isUtc ? this._asJs().getMonth() + 1 :
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 }; 2836 };
2809 // ********** Code for TimeZoneImplementation ************** 2837 // ********** Code for TimeZoneImplementation **************
2810 function TimeZoneImplementation() {} 2838 function TimeZoneImplementation() {}
2811 TimeZoneImplementation.local$ctor = function() { 2839 TimeZoneImplementation.local$ctor = function() {
2812 this.isUtc = false; 2840 this.isUtc = false;
2813 // Initializers done 2841 // Initializers done
2814 } 2842 }
2815 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype; 2843 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype;
2816 TimeZoneImplementation.prototype.$eq = function(other) { 2844 TimeZoneImplementation.prototype.$eq = function(other) {
2817 if (!((other instanceof TimeZoneImplementation))) return false; 2845 if (!((other instanceof TimeZoneImplementation))) return false;
2818 return $eq(this.isUtc, other.isUtc); 2846 return $eq(this.isUtc, other.get$isUtc());
2819 } 2847 }
2820 TimeZoneImplementation.prototype.toString = function() { 2848 TimeZoneImplementation.prototype.toString = function() {
2821 if ($notnull_bool(this.isUtc)) return "TimeZone (UTC)"; 2849 if ($notnull_bool(this.isUtc)) return "TimeZone (UTC)";
2822 return "TimeZone (Local)"; 2850 return "TimeZone (Local)";
2823 } 2851 }
2852 TimeZoneImplementation.prototype.get$isUtc = function() { return this.isUtc; };
2824 TimeZoneImplementation.prototype.toString$0 = function() { 2853 TimeZoneImplementation.prototype.toString$0 = function() {
2825 return this.toString(); 2854 return this.toString();
2826 }; 2855 };
2827 // ********** Code for top level ************** 2856 // ********** Code for top level **************
2828 // ********** Library node ************** 2857 // ********** Library node **************
2829 // ********** Code for process ************** 2858 // ********** Code for process **************
2830 // ********** Code for vm ************** 2859 // ********** Code for vm **************
2831 vm = require('vm'); 2860 vm = require('vm');
2832 // ********** Code for fs ************** 2861 // ********** Code for fs **************
2833 fs = require('fs'); 2862 fs = require('fs');
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
3145 this.extraCharOffset += offset; 3174 this.extraCharOffset += offset;
3146 } 3175 }
3147 ArrayBasedScanner.prototype.appendWhiteSpace = function(next) { 3176 ArrayBasedScanner.prototype.appendWhiteSpace = function(next) {
3148 3177
3149 } 3178 }
3150 ArrayBasedScanner.prototype.appendBeginGroup = function(kind, value) { 3179 ArrayBasedScanner.prototype.appendBeginGroup = function(kind, value) {
3151 var $0; 3180 var $0;
3152 var token = new BeginGroupToken(kind, value, this.tokenStart); 3181 var token = new BeginGroupToken(kind, value, this.tokenStart);
3153 this.tail.next = token; 3182 this.tail.next = token;
3154 this.tail = this.tail.next; 3183 this.tail = this.tail.next;
3155 while (kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.isEmp ty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { 3184 while (kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.isEmp ty()) && this.groupingStack.get$head().get$kind() === 60/*null.LT_TOKEN*/) {
3156 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3185 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3157 } 3186 }
3158 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken()); 3187 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken());
3159 } 3188 }
3160 ArrayBasedScanner.prototype.appendEndGroup = function(kind, value, openKind) { 3189 ArrayBasedScanner.prototype.appendEndGroup = function(kind, value, openKind) {
3161 var $0; 3190 var $0;
3162 var oldTail = this.tail; 3191 var oldTail = this.tail;
3163 this.appendStringToken(kind, value); 3192 this.appendStringToken(kind, value);
3164 if ($notnull_bool(this.groupingStack.isEmpty())) { 3193 if ($notnull_bool(this.groupingStack.isEmpty())) {
3165 if (openKind === 60/*null.LT_TOKEN*/) return; 3194 if (openKind === 60/*null.LT_TOKEN*/) return;
3166 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 3195 $throw(new MalformedInputException(('Unmatched ' + value + '')));
3167 } 3196 }
3168 while (openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.i sEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { 3197 while (openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.i sEmpty()) && this.groupingStack.get$head().get$kind() === 60/*null.LT_TOKEN*/) {
3169 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3198 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3170 } 3199 }
3171 if (this.groupingStack.get$head().kind !== openKind) { 3200 if (this.groupingStack.get$head().get$kind() !== openKind) {
3172 if (openKind === 60/*null.LT_TOKEN*/) return; 3201 if (openKind === 60/*null.LT_TOKEN*/) return;
3173 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 3202 $throw(new MalformedInputException(('Unmatched ' + value + '')));
3174 } 3203 }
3175 this.groupingStack.get$head().endGroup = oldTail.next; 3204 this.groupingStack.get$head().set$endGroup(oldTail.next);
3176 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ()); 3205 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ());
3177 } 3206 }
3178 ArrayBasedScanner.prototype.appendGtGt = function(kind, value) { 3207 ArrayBasedScanner.prototype.appendGtGt = function(kind, value) {
3179 var $0; 3208 var $0;
3180 var oldTail = this.tail; 3209 var oldTail = this.tail;
3181 this.appendStringToken(kind, value); 3210 this.appendStringToken(kind, value);
3182 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3211 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3183 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3212 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3184 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3213 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3185 } 3214 }
3186 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3215 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3187 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3216 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3188 this.groupingStack.get$head().endGroup = oldTail.next; 3217 this.groupingStack.get$head().set$endGroup(oldTail.next);
3189 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3218 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3190 } 3219 }
3191 } 3220 }
3192 ArrayBasedScanner.prototype.appendGtGtGt = function(kind, value) { 3221 ArrayBasedScanner.prototype.appendGtGtGt = function(kind, value) {
3193 var $0; 3222 var $0;
3194 var oldTail = this.tail; 3223 var oldTail = this.tail;
3195 this.appendStringToken(kind, value); 3224 this.appendStringToken(kind, value);
3196 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3225 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3197 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3226 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3198 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3227 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3199 } 3228 }
3200 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3229 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3201 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3230 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3202 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3231 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3203 } 3232 }
3204 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3233 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3205 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3234 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3206 this.groupingStack.get$head().endGroup = oldTail.next; 3235 this.groupingStack.get$head().set$endGroup(oldTail.next);
3207 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3236 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3208 } 3237 }
3209 } 3238 }
3210 // ********** Code for ArrayBasedScanner$SourceString ************** 3239 // ********** Code for ArrayBasedScanner$SourceString **************
3211 function ArrayBasedScanner$SourceString() { 3240 function ArrayBasedScanner$SourceString() {
3212 this.groupingStack = const$14/*const EmptyLink()*/ 3241 this.groupingStack = const$14/*const EmptyLink()*/
3213 this.extraCharOffset = 0; 3242 this.extraCharOffset = 0;
3214 this.tokenStart = -1; 3243 this.tokenStart = -1;
3215 this.byteOffset = -1; 3244 this.byteOffset = -1;
3216 this.tokens = new Token(0/*null.EOF_TOKEN*/, -1); 3245 this.tokens = new Token(0/*null.EOF_TOKEN*/, -1);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3255 this.extraCharOffset += offset; 3284 this.extraCharOffset += offset;
3256 } 3285 }
3257 ArrayBasedScanner$SourceString.prototype.appendWhiteSpace = function(next) { 3286 ArrayBasedScanner$SourceString.prototype.appendWhiteSpace = function(next) {
3258 3287
3259 } 3288 }
3260 ArrayBasedScanner$SourceString.prototype.appendBeginGroup = function(kind, value ) { 3289 ArrayBasedScanner$SourceString.prototype.appendBeginGroup = function(kind, value ) {
3261 var $0; 3290 var $0;
3262 var token = new BeginGroupToken(kind, value, this.tokenStart); 3291 var token = new BeginGroupToken(kind, value, this.tokenStart);
3263 this.tail.next = token; 3292 this.tail.next = token;
3264 this.tail = this.tail.next; 3293 this.tail = this.tail.next;
3265 while (kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.isEmp ty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { 3294 while (kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.isEmp ty()) && this.groupingStack.get$head().get$kind() === 60/*null.LT_TOKEN*/) {
3266 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3295 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3267 } 3296 }
3268 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken()); 3297 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken());
3269 } 3298 }
3270 ArrayBasedScanner$SourceString.prototype.appendEndGroup = function(kind, value, openKind) { 3299 ArrayBasedScanner$SourceString.prototype.appendEndGroup = function(kind, value, openKind) {
3271 var $0; 3300 var $0;
3272 var oldTail = this.tail; 3301 var oldTail = this.tail;
3273 this.appendStringToken(kind, value); 3302 this.appendStringToken(kind, value);
3274 if ($notnull_bool(this.groupingStack.isEmpty())) { 3303 if ($notnull_bool(this.groupingStack.isEmpty())) {
3275 if (openKind === 60/*null.LT_TOKEN*/) return; 3304 if (openKind === 60/*null.LT_TOKEN*/) return;
3276 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 3305 $throw(new MalformedInputException(('Unmatched ' + value + '')));
3277 } 3306 }
3278 while (openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.i sEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { 3307 while (openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.i sEmpty()) && this.groupingStack.get$head().get$kind() === 60/*null.LT_TOKEN*/) {
3279 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3308 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3280 } 3309 }
3281 if (this.groupingStack.get$head().kind !== openKind) { 3310 if (this.groupingStack.get$head().get$kind() !== openKind) {
3282 if (openKind === 60/*null.LT_TOKEN*/) return; 3311 if (openKind === 60/*null.LT_TOKEN*/) return;
3283 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 3312 $throw(new MalformedInputException(('Unmatched ' + value + '')));
3284 } 3313 }
3285 this.groupingStack.get$head().endGroup = oldTail.next; 3314 this.groupingStack.get$head().set$endGroup(oldTail.next);
3286 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ()); 3315 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ());
3287 } 3316 }
3288 ArrayBasedScanner$SourceString.prototype.appendGtGt = function(kind, value) { 3317 ArrayBasedScanner$SourceString.prototype.appendGtGt = function(kind, value) {
3289 var $0; 3318 var $0;
3290 var oldTail = this.tail; 3319 var oldTail = this.tail;
3291 this.appendStringToken(kind, value); 3320 this.appendStringToken(kind, value);
3292 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3321 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3293 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3322 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3294 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3323 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3295 } 3324 }
3296 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3325 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3297 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3326 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3298 this.groupingStack.get$head().endGroup = oldTail.next; 3327 this.groupingStack.get$head().set$endGroup(oldTail.next);
3299 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3328 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3300 } 3329 }
3301 } 3330 }
3302 ArrayBasedScanner$SourceString.prototype.appendGtGtGt = function(kind, value) { 3331 ArrayBasedScanner$SourceString.prototype.appendGtGtGt = function(kind, value) {
3303 var $0; 3332 var $0;
3304 var oldTail = this.tail; 3333 var oldTail = this.tail;
3305 this.appendStringToken(kind, value); 3334 this.appendStringToken(kind, value);
3306 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3335 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3307 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3336 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3308 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3337 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3309 } 3338 }
3310 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3339 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3311 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3340 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3312 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3341 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3313 } 3342 }
3314 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3343 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3315 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3344 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3316 this.groupingStack.get$head().endGroup = oldTail.next; 3345 this.groupingStack.get$head().set$endGroup(oldTail.next);
3317 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 3346 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3318 } 3347 }
3319 } 3348 }
3320 ArrayBasedScanner$SourceString.prototype.tokenize = function() { 3349 ArrayBasedScanner$SourceString.prototype.tokenize = function() {
3321 var next = this.advance(); 3350 var next = this.advance();
3322 while (next != -1) { 3351 while (next != -1) {
3323 next = this.bigSwitch(next); 3352 next = this.bigSwitch(next);
3324 } 3353 }
3325 this.appendEofToken(); 3354 this.appendEofToken();
3326 return this.firstToken(); 3355 return this.firstToken();
(...skipping 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after
5942 } 5971 }
5943 PartialParser.prototype.isIdentifier = function(token) { 5972 PartialParser.prototype.isIdentifier = function(token) {
5944 var kind = token.kind; 5973 var kind = token.kind;
5945 switch (true) { 5974 switch (true) {
5946 case kind === 97/*null.IDENTIFIER_TOKEN*/: 5975 case kind === 97/*null.IDENTIFIER_TOKEN*/:
5947 5976
5948 return true; 5977 return true;
5949 5978
5950 case kind === 107/*null.KEYWORD_TOKEN*/: 5979 case kind === 107/*null.KEYWORD_TOKEN*/:
5951 5980
5952 return token.get$value().isPseudo; 5981 return $assert_bool(token.get$value().get$isPseudo());
5953 5982
5954 default: 5983 default:
5955 5984
5956 return false; 5985 return false;
5957 5986
5958 } 5987 }
5959 } 5988 }
5960 PartialParser.prototype.parseSupertypesClauseOpt = function(token) { 5989 PartialParser.prototype.parseSupertypesClauseOpt = function(token) {
5961 if ($notnull_bool(this.optional('extends', token))) { 5990 if ($notnull_bool(this.optional('extends', token))) {
5962 do { 5991 do {
5963 token = this.parseType(this.next(token)); 5992 token = this.parseType(this.next(token));
5964 } 5993 }
5965 while ($notnull_bool(this.optional(',', token))) 5994 while ($notnull_bool(this.optional(',', token)))
5966 } 5995 }
5967 return token; 5996 return token;
5968 } 5997 }
5969 PartialParser.prototype.parseFactoryClauseOpt = function(token) { 5998 PartialParser.prototype.parseFactoryClauseOpt = function(token) {
5970 if ($notnull_bool(this.optional('factory', token))) { 5999 if ($notnull_bool(this.optional('factory', token))) {
5971 return this.parseType(this.next(token)); 6000 return this.parseType(this.next(token));
5972 } 6001 }
5973 return token; 6002 return token;
5974 } 6003 }
5975 PartialParser.prototype.skipBlock = function(token) { 6004 PartialParser.prototype.skipBlock = function(token) {
6005 var $0;
5976 if (!$notnull_bool(this.optional('{', token))) { 6006 if (!$notnull_bool(this.optional('{', token))) {
5977 return this.listener.expectedBlock$1(token); 6007 return (($0 = this.listener.expectedBlock$1(token)) && $0.is$Token());
5978 } 6008 }
5979 var beginGroupToken = (token && token.is$BeginGroupToken()); 6009 var beginGroupToken = (token && token.is$BeginGroupToken());
5980 $assert(beginGroupToken.endGroup == null || beginGroupToken.endGroup.kind === 125/*null.$RBRACE*/, "beginGroupToken.endGroup === null ||\n beginGrou pToken.endGroup.kind === $RBRACE", "parser.dart", 171, 12); 6010 $assert(beginGroupToken.endGroup == null || beginGroupToken.endGroup.kind === 125/*null.$RBRACE*/, "beginGroupToken.endGroup === null ||\n beginGrou pToken.endGroup.kind === $RBRACE", "parser.dart", 171, 12);
5981 return beginGroupToken.endGroup; 6011 return beginGroupToken.endGroup;
5982 } 6012 }
5983 PartialParser.prototype.skipArguments = function(token) { 6013 PartialParser.prototype.skipArguments = function(token) {
5984 return token.endGroup; 6014 return token.endGroup;
5985 } 6015 }
5986 PartialParser.prototype.parseClass = function(token) { 6016 PartialParser.prototype.parseClass = function(token) {
5987 var begin = token; 6017 var begin = token;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
6029 PartialParser.prototype.parseIdentifier = function(token) { 6059 PartialParser.prototype.parseIdentifier = function(token) {
6030 if ($notnull_bool(this.isIdentifier(token))) { 6060 if ($notnull_bool(this.isIdentifier(token))) {
6031 this.listener.handleIdentifier$1(token); 6061 this.listener.handleIdentifier$1(token);
6032 } 6062 }
6033 else { 6063 else {
6034 this.listener.expectedIdentifier$1(token); 6064 this.listener.expectedIdentifier$1(token);
6035 } 6065 }
6036 return this.next(token); 6066 return this.next(token);
6037 } 6067 }
6038 PartialParser.prototype.expect = function(string, token) { 6068 PartialParser.prototype.expect = function(string, token) {
6069 var $0;
6039 if (string !== token.get$stringValue()) { 6070 if (string !== token.get$stringValue()) {
6040 if (string === '>') { 6071 if (string === '>') {
6041 if (token.get$stringValue() === '>>') { 6072 if (token.get$stringValue() === '>>') {
6042 var gt = new StringToken(62/*null.GT_TOKEN*/, '>', token.charOffset + 1) ; 6073 var gt = new StringToken(62/*null.GT_TOKEN*/, '>', token.charOffset + 1) ;
6043 gt.next = token.next; 6074 gt.next = token.next;
6044 return gt; 6075 return gt;
6045 } 6076 }
6046 else if (token.get$stringValue() === '>>>') { 6077 else if (token.get$stringValue() === '>>>') {
6047 var gtgt = new StringToken(1024/*null.UNKNOWN_TOKEN*/, '>>', token.charO ffset + 1); 6078 var gtgt = new StringToken(1024/*null.UNKNOWN_TOKEN*/, '>>', token.charO ffset + 1);
6048 gtgt.next = token.next; 6079 gtgt.next = token.next;
6049 return gtgt; 6080 return gtgt;
6050 } 6081 }
6051 } 6082 }
6052 return this.listener.expected$2(string, token); 6083 return (($0 = this.listener.expected$2(string, token)) && $0.is$Token());
6053 } 6084 }
6054 return token.next; 6085 return token.next;
6055 } 6086 }
6056 PartialParser.prototype.parseTypeVariable = function(token) { 6087 PartialParser.prototype.parseTypeVariable = function(token) {
6057 this.listener.beginTypeVariable$1(token); 6088 this.listener.beginTypeVariable$1(token);
6058 token = this.parseIdentifier(token); 6089 token = this.parseIdentifier(token);
6059 if ($notnull_bool(this.optional('extends', token))) { 6090 if ($notnull_bool(this.optional('extends', token))) {
6060 token = this.parseType(this.next(token)); 6091 token = this.parseType(this.next(token));
6061 } 6092 }
6062 else { 6093 else {
6063 this.listener.handleNoType$1(token); 6094 this.listener.handleNoType$1(token);
6064 } 6095 }
6065 this.listener.endTypeVariable$1(token); 6096 this.listener.endTypeVariable$1(token);
6066 return token; 6097 return token;
6067 } 6098 }
6068 PartialParser.prototype.optional = function(value, token) { 6099 PartialParser.prototype.optional = function(value, token) {
6069 return value === token.get$stringValue(); 6100 return value === token.get$stringValue();
6070 } 6101 }
6071 PartialParser.prototype.parseType = function(token) { 6102 PartialParser.prototype.parseType = function(token) {
6103 var $0;
6072 var begin = token; 6104 var begin = token;
6073 var identifierCount = 1; 6105 var identifierCount = 1;
6074 if ($notnull_bool(this.isIdentifier(token))) { 6106 if ($notnull_bool(this.isIdentifier(token))) {
6075 token = this.parseIdentifier(token); 6107 token = this.parseIdentifier(token);
6076 while ($notnull_bool(this.optional('.', token))) { 6108 while ($notnull_bool(this.optional('.', token))) {
6077 token = this.parseIdentifier(this.next(token)); 6109 token = this.parseIdentifier(this.next(token));
6078 ++identifierCount; 6110 ++identifierCount;
6079 } 6111 }
6080 } 6112 }
6081 else if ($notnull_bool(this.optional('var', token))) { 6113 else if ($notnull_bool(this.optional('var', token))) {
6082 this.listener.handleVarKeyword$1(token); 6114 this.listener.handleVarKeyword$1(token);
6083 this.listener.endType$3(identifierCount, begin, token); 6115 this.listener.endType$3(identifierCount, begin, token);
6084 return this.next(token); 6116 return this.next(token);
6085 } 6117 }
6086 else { 6118 else {
6087 token = this.listener.expectedType$1(token); 6119 token = (($0 = this.listener.expectedType$1(token)) && $0.is$Token());
6088 } 6120 }
6089 token = this.parseTypeArgumentsOpt(token); 6121 token = this.parseTypeArgumentsOpt(token);
6090 this.listener.endType$3(identifierCount, begin, token); 6122 this.listener.endType$3(identifierCount, begin, token);
6091 return token; 6123 return token;
6092 } 6124 }
6093 PartialParser.prototype.parseTypeArgumentsOpt = function(token) { 6125 PartialParser.prototype.parseTypeArgumentsOpt = function(token) {
6094 return this.parseStuff(token, this.beginTypeArguments, this.parseTypeFunction, this.endTypeArguments, this.handleNoTypeArguments); 6126 return this.parseStuff(token, this.beginTypeArguments, this.parseTypeFunction, this.endTypeArguments, this.handleNoTypeArguments);
6095 } 6127 }
6096 PartialParser.prototype.parseTypeVariablesOpt = function(token) { 6128 PartialParser.prototype.parseTypeVariablesOpt = function(token) {
6097 if ($notnull_bool(this.optional('<', token))) { 6129 if ($notnull_bool(this.optional('<', token))) {
(...skipping 17 matching lines...) Expand all
6115 endStuff.call$3(count, begin, token); 6147 endStuff.call$3(count, begin, token);
6116 return this.expect('>', token); 6148 return this.expect('>', token);
6117 } 6149 }
6118 handleNoStuff.call$1(token); 6150 handleNoStuff.call$1(token);
6119 return token; 6151 return token;
6120 } 6152 }
6121 PartialParser.prototype.parseClassBody = function(token) { 6153 PartialParser.prototype.parseClassBody = function(token) {
6122 return this.skipBlock(token); 6154 return this.skipBlock(token);
6123 } 6155 }
6124 PartialParser.prototype.parseTopLevelMember = function(token) { 6156 PartialParser.prototype.parseTopLevelMember = function(token) {
6157 var $0;
6125 var start = token; 6158 var start = token;
6126 this.listener.beginTopLevelMember$1(token); 6159 this.listener.beginTopLevelMember$1(token);
6127 var previous = token; 6160 var previous = token;
6128 LOOP: 6161 LOOP:
6129 while (token != null) { 6162 while (token != null) {
6130 var kind = token.kind; 6163 var kind = token.kind;
6131 switch (true) { 6164 switch (true) {
6132 case kind === 123/*null.LBRACE_TOKEN*/: 6165 case kind === 123/*null.LBRACE_TOKEN*/:
6133 case kind === 59/*null.SEMICOLON_TOKEN*/: 6166 case kind === 59/*null.SEMICOLON_TOKEN*/:
6134 case kind === 40/*null.LPAREN_TOKEN*/: 6167 case kind === 40/*null.LPAREN_TOKEN*/:
(...skipping 14 matching lines...) Expand all
6149 while (true) { 6182 while (true) {
6150 if ($notnull_bool(this.optional('(', token))) { 6183 if ($notnull_bool(this.optional('(', token))) {
6151 isField = false; 6184 isField = false;
6152 break; 6185 break;
6153 } 6186 }
6154 else if ($notnull_bool(this.optional('=', token) || this.optional(';', token ))) { 6187 else if ($notnull_bool(this.optional('=', token) || this.optional(';', token ))) {
6155 isField = true; 6188 isField = true;
6156 break; 6189 break;
6157 } 6190 }
6158 else { 6191 else {
6159 token = this.listener.unexpected$1(token); 6192 token = (($0 = this.listener.unexpected$1(token)) && $0.is$Token());
6160 } 6193 }
6161 } 6194 }
6162 if (!$notnull_bool(isField)) { 6195 if (!$notnull_bool(isField)) {
6163 token = this.next(this.skipArguments((token && token.is$BeginGroupToken()))) ; 6196 token = this.next(this.skipArguments((token && token.is$BeginGroupToken()))) ;
6164 } 6197 }
6165 while (token != null && token.kind !== 123/*null.LBRACE_TOKEN*/ && token.kind !== 59/*null.SEMICOLON_TOKEN*/) { 6198 while (token != null && token.kind !== 123/*null.LBRACE_TOKEN*/ && token.kind !== 59/*null.SEMICOLON_TOKEN*/) {
6166 token = this.next(token); 6199 token = this.next(token);
6167 } 6200 }
6168 if (!$notnull_bool(this.optional(';', token))) { 6201 if (!$notnull_bool(this.optional(';', token))) {
6169 token = this.skipBlock(token); 6202 token = this.skipBlock(token);
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
7622 this.tail = this.tail.next; 7655 this.tail = this.tail.next;
7623 } 7656 }
7624 // ********** Code for SubstringWrapper ************** 7657 // ********** Code for SubstringWrapper **************
7625 function SubstringWrapper(internalString, begin, end) { 7658 function SubstringWrapper(internalString, begin, end) {
7626 this.internalString = internalString; 7659 this.internalString = internalString;
7627 this.begin = begin; 7660 this.begin = begin;
7628 this.end = end; 7661 this.end = end;
7629 // Initializers done 7662 // Initializers done
7630 } 7663 }
7631 SubstringWrapper.prototype.is$SourceString = function(){return this;}; 7664 SubstringWrapper.prototype.is$SourceString = function(){return this;};
7665 SubstringWrapper.prototype.get$end = function() { return this.end; };
7632 SubstringWrapper.prototype.hashCode = function() { 7666 SubstringWrapper.prototype.hashCode = function() {
7633 return this.toString().hashCode(); 7667 return this.toString().hashCode();
7634 } 7668 }
7635 SubstringWrapper.prototype.$eq = function(other) { 7669 SubstringWrapper.prototype.$eq = function(other) {
7636 return !!(other && other.is$SourceString) && this.toString() == other.toString $0(); 7670 return !!(other && other.is$SourceString) && this.toString() == other.toString $0();
7637 } 7671 }
7638 SubstringWrapper.prototype.printOn = function(sb) { 7672 SubstringWrapper.prototype.printOn = function(sb) {
7639 sb.add(this); 7673 sb.add(this);
7640 } 7674 }
7641 SubstringWrapper.prototype.toString = function() { 7675 SubstringWrapper.prototype.toString = function() {
(...skipping 11 matching lines...) Expand all
7653 SubstringWrapper.prototype.toString$0 = function() { 7687 SubstringWrapper.prototype.toString$0 = function() {
7654 return this.toString(); 7688 return this.toString();
7655 }; 7689 };
7656 // ********** Code for Token ************** 7690 // ********** Code for Token **************
7657 function Token(kind, charOffset) { 7691 function Token(kind, charOffset) {
7658 this.kind = kind; 7692 this.kind = kind;
7659 this.charOffset = charOffset; 7693 this.charOffset = charOffset;
7660 // Initializers done 7694 // Initializers done
7661 } 7695 }
7662 Token.prototype.is$Token = function(){return this;}; 7696 Token.prototype.is$Token = function(){return this;};
7697 Token.prototype.get$kind = function() { return this.kind; };
7663 Token.prototype.get$charOffset = function() { return this.charOffset; }; 7698 Token.prototype.get$charOffset = function() { return this.charOffset; };
7664 Token.prototype.get$value = function() { 7699 Token.prototype.get$value = function() {
7665 return const$234/*const SourceString('EOF')*/; 7700 return const$234/*const SourceString('EOF')*/;
7666 } 7701 }
7667 Token.prototype.get$stringValue = function() { 7702 Token.prototype.get$stringValue = function() {
7668 return 'EOF'; 7703 return 'EOF';
7669 } 7704 }
7670 Token.prototype.toString = function() { 7705 Token.prototype.toString = function() {
7671 return Strings.String$fromCharCodes$factory([this.kind]); 7706 return Strings.String$fromCharCodes$factory([this.kind]);
7672 } 7707 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
7745 StringWrapper.prototype.toString$0 = function() { 7780 StringWrapper.prototype.toString$0 = function() {
7746 return this.toString(); 7781 return this.toString();
7747 }; 7782 };
7748 // ********** Code for BeginGroupToken ************** 7783 // ********** Code for BeginGroupToken **************
7749 function BeginGroupToken(kind, value, charOffset) { 7784 function BeginGroupToken(kind, value, charOffset) {
7750 StringToken.call(this, kind, value, charOffset); 7785 StringToken.call(this, kind, value, charOffset);
7751 // Initializers done 7786 // Initializers done
7752 } 7787 }
7753 $inherits(BeginGroupToken, StringToken); 7788 $inherits(BeginGroupToken, StringToken);
7754 BeginGroupToken.prototype.is$BeginGroupToken = function(){return this;}; 7789 BeginGroupToken.prototype.is$BeginGroupToken = function(){return this;};
7790 BeginGroupToken.prototype.get$endGroup = function() { return this.endGroup; };
7791 BeginGroupToken.prototype.set$endGroup = function(value) { return this.endGroup = value; };
7755 // ********** Code for Keyword ************** 7792 // ********** Code for Keyword **************
7756 function Keyword(syntax, isPseudo) { 7793 function Keyword(syntax, isPseudo) {
7757 this.syntax = syntax; 7794 this.syntax = syntax;
7758 this.isPseudo = isPseudo; 7795 this.isPseudo = isPseudo;
7759 // Initializers done 7796 // Initializers done
7760 } 7797 }
7761 Keyword.prototype.is$SourceString = function(){return this;}; 7798 Keyword.prototype.is$SourceString = function(){return this;};
7799 Keyword.prototype.get$syntax = function() { return this.syntax; };
7800 Keyword.prototype.get$isPseudo = function() { return this.isPseudo; };
7762 Keyword.get$keywords = function() { 7801 Keyword.get$keywords = function() {
7763 if (Keyword._keywords == null) { 7802 if (Keyword._keywords == null) {
7764 Keyword._keywords = Keyword.computeKeywordMap(); 7803 Keyword._keywords = Keyword.computeKeywordMap();
7765 } 7804 }
7766 return Keyword._keywords; 7805 return Keyword._keywords;
7767 } 7806 }
7768 Keyword.computeKeywordMap = function() { 7807 Keyword.computeKeywordMap = function() {
7769 var result = new LinkedHashMapImplementation(); 7808 var result = new LinkedHashMapImplementation();
7770 for (var $i0 = const$232/*Keyword.values*/.iterator(); $i0.hasNext(); ) { 7809 for (var $i0 = const$232/*Keyword.values*/.iterator(); $i0.hasNext(); ) {
7771 var keyword = $i0.next(); 7810 var keyword = $i0.next();
(...skipping 26 matching lines...) Expand all
7798 return this.toString(); 7837 return this.toString();
7799 }; 7838 };
7800 // ********** Code for KeywordState ************** 7839 // ********** Code for KeywordState **************
7801 function KeywordState() {} 7840 function KeywordState() {}
7802 KeywordState.prototype.is$KeywordState = function(){return this;}; 7841 KeywordState.prototype.is$KeywordState = function(){return this;};
7803 KeywordState.get$KEYWORD_STATE = function() { 7842 KeywordState.get$KEYWORD_STATE = function() {
7804 if (KeywordState._KEYWORD_STATE == null) { 7843 if (KeywordState._KEYWORD_STATE == null) {
7805 var strings = new ListFactory(const$232/*Keyword.values*/.get$length()); 7844 var strings = new ListFactory(const$232/*Keyword.values*/.get$length());
7806 for (var i = 0; 7845 for (var i = 0;
7807 i < const$232/*Keyword.values*/.get$length(); i++) { 7846 i < const$232/*Keyword.values*/.get$length(); i++) {
7808 strings.$setindex(i, const$232/*Keyword.values*/[i].syntax); 7847 strings.$setindex(i, const$232/*Keyword.values*/[i].get$syntax());
7809 } 7848 }
7810 strings.sort((function (a, b) { 7849 strings.sort((function (a, b) {
7811 return a.compareTo$1(b); 7850 return a.compareTo$1(b);
7812 }) 7851 })
7813 ); 7852 );
7814 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin gs, 0, strings.length); 7853 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin gs, 0, strings.length);
7815 } 7854 }
7816 return KeywordState._KEYWORD_STATE; 7855 return KeywordState._KEYWORD_STATE;
7817 } 7856 }
7818 KeywordState.computeKeywordStateTable = function(start, strings, offset, length) { 7857 KeywordState.computeKeywordStateTable = function(start, strings, offset, length) {
7819 var result = new ListFactory(26); 7858 var result = new ListFactory(26);
7820 $assert(length != 0, "length != 0", "keyword.dart", 161, 12); 7859 $assert(length != 0, "length != 0", "keyword.dart", 161, 12);
7821 var chunk = 0; 7860 var chunk = 0;
7822 var chunkStart = -1; 7861 var chunkStart = -1;
7823 for (var i = offset; 7862 for (var i = offset;
7824 i < offset + length; i++) { 7863 i < offset + length; i++) {
7825 if (strings.$index(i).length > start) { 7864 if (strings.$index(i).length > start) {
7826 var c = strings.$index(i).charCodeAt$1(start); 7865 var c = $assert_num(strings.$index(i).charCodeAt$1(start));
7827 if (chunk != c) { 7866 if (chunk != c) {
7828 if (chunkStart != -1) { 7867 if (chunkStart != -1) {
7829 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordSta teTable(start + 1, strings, chunkStart, i - chunkStart)); 7868 result.$setindex(chunk - 97/*null.$a*/, KeywordState.computeKeywordSta teTable(start + 1, strings, chunkStart, i - chunkStart));
7830 } 7869 }
7831 chunkStart = i; 7870 chunkStart = i;
7832 chunk = c; 7871 chunk = c;
7833 } 7872 }
7834 } 7873 }
7835 } 7874 }
7836 if (chunkStart != -1) { 7875 if (chunkStart != -1) {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
8098 }; 8137 };
8099 NodeList.prototype.getEndToken$0 = function() { 8138 NodeList.prototype.getEndToken$0 = function() {
8100 return this.getEndToken(); 8139 return this.getEndToken();
8101 }; 8140 };
8102 // ********** Code for Block ************** 8141 // ********** Code for Block **************
8103 function Block(statements) { 8142 function Block(statements) {
8104 this.statements = statements; 8143 this.statements = statements;
8105 // Initializers done 8144 // Initializers done
8106 } 8145 }
8107 $inherits(Block, Statement); 8146 $inherits(Block, Statement);
8147 Block.prototype.get$statements = function() { return this.statements; };
8108 Block.prototype.accept = function(visitor) { 8148 Block.prototype.accept = function(visitor) {
8109 return visitor.visitBlock(this); 8149 return visitor.visitBlock(this);
8110 } 8150 }
8111 Block.prototype.getBeginToken = function() { 8151 Block.prototype.getBeginToken = function() {
8112 return this.statements.getBeginToken(); 8152 return this.statements.getBeginToken();
8113 } 8153 }
8114 Block.prototype.getEndToken = function() { 8154 Block.prototype.getEndToken = function() {
8115 return this.statements.getEndToken(); 8155 return this.statements.getEndToken();
8116 } 8156 }
8117 Block.prototype.accept$1 = function($0) { 8157 Block.prototype.accept$1 = function($0) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
8158 // ********** Code for For ************** 8198 // ********** Code for For **************
8159 function For(initializer, condition, update, body, forToken) { 8199 function For(initializer, condition, update, body, forToken) {
8160 this.initializer = initializer; 8200 this.initializer = initializer;
8161 this.condition = condition; 8201 this.condition = condition;
8162 this.update = update; 8202 this.update = update;
8163 this.body = body; 8203 this.body = body;
8164 this.forToken = forToken; 8204 this.forToken = forToken;
8165 // Initializers done 8205 // Initializers done
8166 } 8206 }
8167 $inherits(For, Statement); 8207 $inherits(For, Statement);
8208 For.prototype.get$body = function() { return this.body; };
8168 For.prototype.accept = function(visitor) { 8209 For.prototype.accept = function(visitor) {
8169 return visitor.visitFor(this); 8210 return visitor.visitFor(this);
8170 } 8211 }
8171 For.prototype.getBeginToken = function() { 8212 For.prototype.getBeginToken = function() {
8172 return this.forToken; 8213 return this.forToken;
8173 } 8214 }
8174 For.prototype.getEndToken = function() { 8215 For.prototype.getEndToken = function() {
8175 return this.body.getEndToken(); 8216 return this.body.getEndToken();
8176 } 8217 }
8177 For.prototype.accept$1 = function($0) { 8218 For.prototype.accept$1 = function($0) {
(...skipping 10 matching lines...) Expand all
8188 this.name = name; 8229 this.name = name;
8189 this.parameters = parameters; 8230 this.parameters = parameters;
8190 this.body = body; 8231 this.body = body;
8191 this.returnType = returnType; 8232 this.returnType = returnType;
8192 // Initializers done 8233 // Initializers done
8193 } 8234 }
8194 $inherits(FunctionExpression, Expression); 8235 $inherits(FunctionExpression, Expression);
8195 FunctionExpression.prototype.is$FunctionExpression = function(){return this;}; 8236 FunctionExpression.prototype.is$FunctionExpression = function(){return this;};
8196 FunctionExpression.prototype.get$name = function() { return this.name; }; 8237 FunctionExpression.prototype.get$name = function() { return this.name; };
8197 FunctionExpression.prototype.get$parameters = function() { return this.parameter s; }; 8238 FunctionExpression.prototype.get$parameters = function() { return this.parameter s; };
8239 FunctionExpression.prototype.get$body = function() { return this.body; };
8198 FunctionExpression.prototype.get$returnType = function() { return this.returnTyp e; }; 8240 FunctionExpression.prototype.get$returnType = function() { return this.returnTyp e; };
8199 FunctionExpression.prototype.accept = function(visitor) { 8241 FunctionExpression.prototype.accept = function(visitor) {
8200 return visitor.visitFunctionExpression(this); 8242 return visitor.visitFunctionExpression(this);
8201 } 8243 }
8202 FunctionExpression.prototype.getBeginToken = function() { 8244 FunctionExpression.prototype.getBeginToken = function() {
8203 return firstBeginToken(this.returnType, this.name); 8245 return firstBeginToken(this.returnType, this.name);
8204 } 8246 }
8205 FunctionExpression.prototype.getEndToken = function() { 8247 FunctionExpression.prototype.getEndToken = function() {
8206 return this.body.getEndToken(); 8248 return this.body.getEndToken();
8207 } 8249 }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
8503 // ********** Code for VariableDefinitions ************** 8545 // ********** Code for VariableDefinitions **************
8504 function VariableDefinitions(type, modifiers, definitions, endToken) { 8546 function VariableDefinitions(type, modifiers, definitions, endToken) {
8505 this.type = type; 8547 this.type = type;
8506 this.modifiers = modifiers; 8548 this.modifiers = modifiers;
8507 this.definitions = definitions; 8549 this.definitions = definitions;
8508 this.endToken = endToken; 8550 this.endToken = endToken;
8509 // Initializers done 8551 // Initializers done
8510 } 8552 }
8511 $inherits(VariableDefinitions, Statement); 8553 $inherits(VariableDefinitions, Statement);
8512 VariableDefinitions.prototype.is$VariableDefinitions = function(){return this;}; 8554 VariableDefinitions.prototype.is$VariableDefinitions = function(){return this;};
8555 VariableDefinitions.prototype.get$type = function() { return this.type; };
8513 VariableDefinitions.prototype.accept = function(visitor) { 8556 VariableDefinitions.prototype.accept = function(visitor) {
8514 return visitor.visitVariableDefinitions(this); 8557 return visitor.visitVariableDefinitions(this);
8515 } 8558 }
8516 VariableDefinitions.prototype.getBeginToken = function() { 8559 VariableDefinitions.prototype.getBeginToken = function() {
8517 return firstBeginToken(this.type, this.definitions); 8560 return firstBeginToken(this.type, this.definitions);
8518 } 8561 }
8519 VariableDefinitions.prototype.getEndToken = function() { 8562 VariableDefinitions.prototype.getEndToken = function() {
8520 return this.endToken; 8563 return this.endToken;
8521 } 8564 }
8522 VariableDefinitions.prototype.accept$1 = function($0) { 8565 VariableDefinitions.prototype.accept$1 = function($0) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
8678 function firstBeginToken(first, second) { 8721 function firstBeginToken(first, second) {
8679 var $0; 8722 var $0;
8680 return (($0 = (first != null) ? first.getBeginToken() : second.getBeginToken() ) && $0.is$Token()); 8723 return (($0 = (first != null) ? first.getBeginToken() : second.getBeginToken() ) && $0.is$Token());
8681 } 8724 }
8682 // ********** Library elements ************** 8725 // ********** Library elements **************
8683 // ********** Code for ElementKind ************** 8726 // ********** Code for ElementKind **************
8684 function ElementKind(id) { 8727 function ElementKind(id) {
8685 this.id = id; 8728 this.id = id;
8686 // Initializers done 8729 // Initializers done
8687 } 8730 }
8731 ElementKind.prototype.get$id = function() { return this.id; };
8688 // ********** Code for Element ************** 8732 // ********** Code for Element **************
8689 function Element(name, kind, enclosingElement) { 8733 function Element(name, kind, enclosingElement) {
8690 this.name = name; 8734 this.name = name;
8691 this.kind = kind; 8735 this.kind = kind;
8692 this.enclosingElement = enclosingElement; 8736 this.enclosingElement = enclosingElement;
8693 // Initializers done 8737 // Initializers done
8694 } 8738 }
8695 Element.prototype.is$Element = function(){return this;}; 8739 Element.prototype.is$Element = function(){return this;};
8696 Element.prototype.get$name = function() { return this.name; }; 8740 Element.prototype.get$name = function() { return this.name; };
8741 Element.prototype.get$kind = function() { return this.kind; };
8697 Element.prototype.hashCode = function() { 8742 Element.prototype.hashCode = function() {
8698 return this.name.hashCode(); 8743 return this.name.hashCode();
8699 } 8744 }
8700 Element.prototype.computeType$2 = function($0, $1) { 8745 Element.prototype.computeType$2 = function($0, $1) {
8701 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); 8746 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types()));
8702 }; 8747 };
8703 Element.prototype.hashCode$0 = function() { 8748 Element.prototype.hashCode$0 = function() {
8704 return this.hashCode(); 8749 return this.hashCode();
8705 }; 8750 };
8706 // ********** Code for VariableElement ************** 8751 // ********** Code for VariableElement **************
8707 function VariableElement(node, typeAnnotation, name, enclosingElement) { 8752 function VariableElement(node, typeAnnotation, name, enclosingElement) {
8708 this.node = node; 8753 this.node = node;
8709 this.typeAnnotation = typeAnnotation; 8754 this.typeAnnotation = typeAnnotation;
8710 Element.call(this, name, const$260, enclosingElement); 8755 Element.call(this, name, const$260, enclosingElement);
8711 // Initializers done 8756 // Initializers done
8712 } 8757 }
8713 $inherits(VariableElement, Element); 8758 $inherits(VariableElement, Element);
8759 VariableElement.prototype.get$type = function() { return this.type; };
8760 VariableElement.prototype.set$type = function(value) { return this.type = value; };
8714 VariableElement.prototype.parseNode = function(canceler, logger) { 8761 VariableElement.prototype.parseNode = function(canceler, logger) {
8715 return this.node; 8762 return this.node;
8716 } 8763 }
8717 VariableElement.prototype.computeType = function(compiler, types) { 8764 VariableElement.prototype.computeType = function(compiler, types) {
8718 return getType(this.typeAnnotation, types); 8765 return getType(this.typeAnnotation, types);
8719 } 8766 }
8720 VariableElement.prototype.computeType$2 = function($0, $1) { 8767 VariableElement.prototype.computeType$2 = function($0, $1) {
8721 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); 8768 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types()));
8722 }; 8769 };
8723 // ********** Code for ForeignElement ************** 8770 // ********** Code for ForeignElement **************
8724 function ForeignElement(name) { 8771 function ForeignElement(name) {
8725 Element.call(this, name, const$242, null); 8772 Element.call(this, name, const$242, null);
8726 // Initializers done 8773 // Initializers done
8727 } 8774 }
8728 $inherits(ForeignElement, Element); 8775 $inherits(ForeignElement, Element);
8729 ForeignElement.prototype.computeType = function(compiler, types) { 8776 ForeignElement.prototype.computeType = function(compiler, types) {
8730 return types.dynamicType; 8777 return types.dynamicType;
8731 } 8778 }
8732 ForeignElement.prototype.computeType$2 = function($0, $1) { 8779 ForeignElement.prototype.computeType$2 = function($0, $1) {
8733 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); 8780 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types()));
8734 }; 8781 };
8735 // ********** Code for FunctionElement ************** 8782 // ********** Code for FunctionElement **************
8736 function FunctionElement(name) { 8783 function FunctionElement(name) {
8737 Element.call(this, name, const$239, null); 8784 Element.call(this, name, const$239, null);
8738 // Initializers done 8785 // Initializers done
8739 } 8786 }
8740 $inherits(FunctionElement, Element); 8787 $inherits(FunctionElement, Element);
8788 FunctionElement.prototype.get$type = function() { return this.type; };
8789 FunctionElement.prototype.set$type = function(value) { return this.type = value; };
8741 FunctionElement.prototype.computeType = function(compiler, types) { 8790 FunctionElement.prototype.computeType = function(compiler, types) {
8742 var $0; 8791 var $0;
8743 if (this.type != null) return (($0 = this.type) && $0.is$FunctionType()); 8792 if (this.type != null) return (($0 = this.type) && $0.is$FunctionType());
8744 var node = (($0 = this.parseNode(compiler, compiler)) && $0.is$FunctionExpress ion()); 8793 var node = (($0 = this.parseNode(compiler, compiler)) && $0.is$FunctionExpress ion());
8745 var returnType = getType(node.returnType, types); 8794 var returnType = getType(node.returnType, types);
8746 if (returnType == null) compiler.cancel(('unknown type ' + returnType + '')); 8795 if (returnType == null) compiler.cancel(('unknown type ' + returnType + ''));
8747 var parameterTypes = new LinkBuilderImplementation(); 8796 var parameterTypes = new LinkBuilderImplementation();
8748 for (var link = node.parameters.nodes; 8797 for (var link = node.parameters.nodes;
8749 !$notnull_bool(link.isEmpty$0()); link = link.get$tail()) { 8798 !$notnull_bool(link.isEmpty$0()); link = link.get$tail()) {
8750 var parameter = (($0 = link.get$head()) && $0.is$VariableDefinitions()); 8799 var parameter = (($0 = link.get$head()) && $0.is$VariableDefinitions());
8751 parameterTypes.addLast(getType(parameter.type, types)); 8800 parameterTypes.addLast(getType(parameter.type, types));
8752 } 8801 }
8753 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0 .is$Link$Type())); 8802 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0 .is$Link$Type()));
8754 return (($0 = this.type) && $0.is$FunctionType()); 8803 return (($0 = this.type) && $0.is$FunctionType());
8755 } 8804 }
8756 FunctionElement.prototype.computeType$2 = FunctionElement.prototype.computeType; 8805 FunctionElement.prototype.computeType$2 = FunctionElement.prototype.computeType;
8757 // ********** Code for ClassElement ************** 8806 // ********** Code for ClassElement **************
8758 function ClassElement(name) { 8807 function ClassElement(name) {
8759 this.interfaces = const$14/*const EmptyLink()*/ 8808 this.interfaces = const$14/*const EmptyLink()*/
8760 this.isResolved = false 8809 this.isResolved = false
8761 Element.call(this, name, const$237, null); 8810 Element.call(this, name, const$237, null);
8762 // Initializers done 8811 // Initializers done
8763 } 8812 }
8764 $inherits(ClassElement, Element); 8813 $inherits(ClassElement, Element);
8765 ClassElement.prototype.is$ClassElement = function(){return this;}; 8814 ClassElement.prototype.is$ClassElement = function(){return this;};
8815 ClassElement.prototype.get$type = function() { return this.type; };
8816 ClassElement.prototype.set$type = function(value) { return this.type = value; };
8766 ClassElement.prototype.get$interfaces = function() { return this.interfaces; }; 8817 ClassElement.prototype.get$interfaces = function() { return this.interfaces; };
8767 ClassElement.prototype.set$interfaces = function(value) { return this.interfaces = value; }; 8818 ClassElement.prototype.set$interfaces = function(value) { return this.interfaces = value; };
8768 ClassElement.prototype.computeType = function(compiler, types) { 8819 ClassElement.prototype.computeType = function(compiler, types) {
8769 if (this.type == null) { 8820 if (this.type == null) {
8770 this.type = new SimpleType(this.name, this); 8821 this.type = new SimpleType(this.name, this);
8771 } 8822 }
8772 return this.type; 8823 return this.type;
8773 } 8824 }
8774 ClassElement.prototype.resolve = function(compiler) { 8825 ClassElement.prototype.resolve = function(compiler) {
8775 if ($notnull_bool(this.isResolved)) return; 8826 if ($notnull_bool(this.isResolved)) return;
8776 compiler.resolveType(this); 8827 compiler.resolveType(this);
8777 this.isResolved = true; 8828 this.isResolved = true;
8778 } 8829 }
8779 ClassElement.prototype.computeType$2 = ClassElement.prototype.computeType; 8830 ClassElement.prototype.computeType$2 = ClassElement.prototype.computeType;
8780 ClassElement.prototype.resolve$1 = function($0) { 8831 ClassElement.prototype.resolve$1 = function($0) {
8781 return this.resolve(($0 && $0.is$Compiler())); 8832 return this.resolve(($0 && $0.is$Compiler()));
8782 }; 8833 };
8783 // ********** Code for top level ************** 8834 // ********** Code for top level **************
8784 function getType(annotation, types) { 8835 function getType(annotation, types) {
8785 var $0; 8836 var $0;
8786 if (annotation == null || annotation.typeName == null) { 8837 if (annotation == null || annotation.typeName == null) {
8787 return (($0 = types.dynamicType) && $0.is$Type()); 8838 return (($0 = types.get$dynamicType()) && $0.is$Type());
8788 } 8839 }
8789 return (($0 = types.lookup$1(annotation.typeName.get$source())) && $0.is$Type( )); 8840 return (($0 = types.lookup$1(annotation.typeName.get$source())) && $0.is$Type( ));
8790 } 8841 }
8791 // ********** Library ssa ************** 8842 // ********** Library ssa **************
8792 // ********** Code for SsaBuilderTask ************** 8843 // ********** Code for SsaBuilderTask **************
8793 function SsaBuilderTask(compiler) { 8844 function SsaBuilderTask(compiler) {
8794 CompilerTask.call(this, compiler); 8845 CompilerTask.call(this, compiler);
8795 // Initializers done 8846 // Initializers done
8796 } 8847 }
8797 $inherits(SsaBuilderTask, CompilerTask); 8848 $inherits(SsaBuilderTask, CompilerTask);
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
9702 this.dominator = null 9753 this.dominator = null
9703 this.id = id; 9754 this.id = id;
9704 this.predecessors = []; 9755 this.predecessors = [];
9705 this.successors = const$13/*const []*/; 9756 this.successors = const$13/*const []*/;
9706 this.dominatedBlocks = []; 9757 this.dominatedBlocks = [];
9707 // Initializers done 9758 // Initializers done
9708 } 9759 }
9709 HBasicBlock.withId$ctor.prototype = HBasicBlock.prototype; 9760 HBasicBlock.withId$ctor.prototype = HBasicBlock.prototype;
9710 $inherits(HBasicBlock, HInstructionList); 9761 $inherits(HBasicBlock, HInstructionList);
9711 HBasicBlock.prototype.is$HBasicBlock = function(){return this;}; 9762 HBasicBlock.prototype.is$HBasicBlock = function(){return this;};
9763 HBasicBlock.prototype.get$id = function() { return this.id; };
9764 HBasicBlock.prototype.set$id = function(value) { return this.id = value; };
9712 HBasicBlock.prototype.isNew = function() { 9765 HBasicBlock.prototype.isNew = function() {
9713 return this.status == 0/*HBasicBlock.STATUS_NEW*/; 9766 return this.status == 0/*HBasicBlock.STATUS_NEW*/;
9714 } 9767 }
9715 HBasicBlock.prototype.isOpen = function() { 9768 HBasicBlock.prototype.isOpen = function() {
9716 return this.status == 1/*HBasicBlock.STATUS_OPEN*/; 9769 return this.status == 1/*HBasicBlock.STATUS_OPEN*/;
9717 } 9770 }
9718 HBasicBlock.prototype.isClosed = function() { 9771 HBasicBlock.prototype.isClosed = function() {
9719 return this.status == 2/*HBasicBlock.STATUS_CLOSED*/; 9772 return this.status == 2/*HBasicBlock.STATUS_CLOSED*/;
9720 } 9773 }
9774 HBasicBlock.prototype.get$isClosed = function() {
9775 return HBasicBlock.prototype.isClosed.bind(this);
9776 }
9721 HBasicBlock.prototype.open = function() { 9777 HBasicBlock.prototype.open = function() {
9722 $assert(this.isNew(), "isNew()", "nodes.dart", 256, 12); 9778 $assert(this.isNew(), "isNew()", "nodes.dart", 256, 12);
9723 this.status = 1/*HBasicBlock.STATUS_OPEN*/; 9779 this.status = 1/*HBasicBlock.STATUS_OPEN*/;
9724 } 9780 }
9725 HBasicBlock.prototype.close = function(end) { 9781 HBasicBlock.prototype.close = function(end) {
9726 $assert(this.isOpen(), "isOpen()", "nodes.dart", 261, 12); 9782 $assert(this.isOpen(), "isOpen()", "nodes.dart", 261, 12);
9727 this.addAfter(this.last, end); 9783 this.addAfter(this.last, end);
9728 this.status = 2/*HBasicBlock.STATUS_CLOSED*/; 9784 this.status = 2/*HBasicBlock.STATUS_CLOSED*/;
9729 } 9785 }
9730 HBasicBlock.prototype.assignInstructionIds = function(id) { 9786 HBasicBlock.prototype.assignInstructionIds = function(id) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
9777 } 9833 }
9778 } 9834 }
9779 HBasicBlock.prototype.isExitBlock = function() { 9835 HBasicBlock.prototype.isExitBlock = function() {
9780 return this.first === this.last && (this.first instanceof HExit); 9836 return this.first === this.last && (this.first instanceof HExit);
9781 } 9837 }
9782 HBasicBlock.prototype.addDominatedBlock = function(block) { 9838 HBasicBlock.prototype.addDominatedBlock = function(block) {
9783 $assert(this.isClosed(), "isClosed()", "nodes.dart", 340, 12); 9839 $assert(this.isClosed(), "isClosed()", "nodes.dart", 340, 12);
9784 $assert(this.id != null && block.id != null, "id !== null && block.id !== null ", "nodes.dart", 341, 12); 9840 $assert(this.id != null && block.id != null, "id !== null && block.id !== null ", "nodes.dart", 341, 12);
9785 $assert(this.dominatedBlocks.indexOf(block) < 0, "dominatedBlocks.indexOf(bloc k) < 0", "nodes.dart", 342, 12); 9841 $assert(this.dominatedBlocks.indexOf(block) < 0, "dominatedBlocks.indexOf(bloc k) < 0", "nodes.dart", 342, 12);
9786 var index = this.dominatedBlocks.length; 9842 var index = this.dominatedBlocks.length;
9787 while (index > 0 && this.dominatedBlocks.$index(index - 1).id > block.id) { 9843 while (index > 0 && this.dominatedBlocks.$index(index - 1).get$id() > block.id ) {
9788 index--; 9844 index--;
9789 } 9845 }
9790 if (index == this.dominatedBlocks.length) { 9846 if (index == this.dominatedBlocks.length) {
9791 this.dominatedBlocks.add(block); 9847 this.dominatedBlocks.add(block);
9792 } 9848 }
9793 else { 9849 else {
9794 this.dominatedBlocks.insertRange(index, 1, block); 9850 this.dominatedBlocks.insertRange(index, 1, block);
9795 } 9851 }
9796 $assert(block.dominator == null, "block.dominator === null", "nodes.dart", 355 , 12); 9852 $assert(block.dominator == null, "block.dominator === null", "nodes.dart", 355 , 12);
9797 block.dominator = this; 9853 block.dominator = this;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
9853 function HInstruction(inputs) { 9909 function HInstruction(inputs) {
9854 this._usedBy = null 9910 this._usedBy = null
9855 this.previous = null 9911 this.previous = null
9856 this.next = null 9912 this.next = null
9857 this.flags = 0 9913 this.flags = 0
9858 this.inputs = inputs; 9914 this.inputs = inputs;
9859 // Initializers done 9915 // Initializers done
9860 this.prepareGvn(); 9916 this.prepareGvn();
9861 } 9917 }
9862 HInstruction.prototype.is$HInstruction = function(){return this;}; 9918 HInstruction.prototype.is$HInstruction = function(){return this;};
9919 HInstruction.prototype.get$id = function() { return this.id; };
9920 HInstruction.prototype.set$id = function(value) { return this.id = value; };
9921 HInstruction.prototype.get$inputs = function() { return this.inputs; };
9922 HInstruction.prototype.get$previous = function() { return this.previous; };
9923 HInstruction.prototype.set$previous = function(value) { return this.previous = v alue; };
9863 HInstruction.prototype.getFlag = function(position) { 9924 HInstruction.prototype.getFlag = function(position) {
9864 return (this.flags & (1 << position)) != 0; 9925 return (this.flags & (1 << position)) != 0;
9865 } 9926 }
9866 HInstruction.prototype.setFlag = function(position) { 9927 HInstruction.prototype.setFlag = function(position) {
9867 this.flags |= (1 << position); 9928 this.flags |= (1 << position);
9868 } 9929 }
9869 HInstruction.prototype.getChangesFlags = function() { 9930 HInstruction.prototype.getChangesFlags = function() {
9870 return this.flags & (1)/*((1 << FLAG_CHANGES_COUNT) - 1)*/; 9931 return this.flags & (1)/*((1 << FLAG_CHANGES_COUNT) - 1)*/;
9871 } 9932 }
9872 HInstruction.prototype.hasSideEffects = function() { 9933 HInstruction.prototype.hasSideEffects = function() {
(...skipping 23 matching lines...) Expand all
9896 } 9957 }
9897 HInstruction.prototype.isInBasicBlock = function() { 9958 HInstruction.prototype.isInBasicBlock = function() {
9898 return this._usedBy != null; 9959 return this._usedBy != null;
9899 } 9960 }
9900 HInstruction.prototype.notifyAddedToBlock = function() { 9961 HInstruction.prototype.notifyAddedToBlock = function() {
9901 $assert(!$notnull_bool(this.isInBasicBlock()), "!isInBasicBlock()", "nodes.dar t", 507, 12); 9962 $assert(!$notnull_bool(this.isInBasicBlock()), "!isInBasicBlock()", "nodes.dar t", 507, 12);
9902 this._usedBy = []; 9963 this._usedBy = [];
9903 for (var i = 0; 9964 for (var i = 0;
9904 i < this.inputs.length; i++) { 9965 i < this.inputs.length; i++) {
9905 $assert(this.inputs.$index(i).isInBasicBlock$0(), "inputs[i].isInBasicBlock( )", "nodes.dart", 511, 14); 9966 $assert(this.inputs.$index(i).isInBasicBlock$0(), "inputs[i].isInBasicBlock( )", "nodes.dart", 511, 14);
9906 this.inputs.$index(i).get$usedBy().add(this); 9967 this.inputs.$index(i).get$usedBy().add$1(this);
9907 } 9968 }
9908 $assert(this.isValid(), "isValid()", "nodes.dart", 514, 12); 9969 $assert(this.isValid(), "isValid()", "nodes.dart", 514, 12);
9909 } 9970 }
9910 HInstruction.prototype.notifyRemovedFromBlock = function() { 9971 HInstruction.prototype.notifyRemovedFromBlock = function() {
9972 var $0;
9911 $assert(this.isInBasicBlock(), "isInBasicBlock()", "nodes.dart", 518, 12); 9973 $assert(this.isInBasicBlock(), "isInBasicBlock()", "nodes.dart", 518, 12);
9912 $assert(this.get$usedBy().isEmpty(), "usedBy.isEmpty()", "nodes.dart", 519, 12 ); 9974 $assert(this.get$usedBy().isEmpty(), "usedBy.isEmpty()", "nodes.dart", 519, 12 );
9913 for (var i = 0; 9975 for (var i = 0;
9914 i < this.inputs.length; i++) { 9976 i < this.inputs.length; i++) {
9915 var inputUsedBy = this.inputs.$index(i).get$usedBy(); 9977 var inputUsedBy = (($0 = this.inputs.$index(i).get$usedBy()) && $0.is$List() );
9916 for (var j = 0; 9978 for (var j = 0;
9917 j < inputUsedBy.length; j++) { 9979 j < inputUsedBy.length; j++) {
9918 if (inputUsedBy.$index(j) === this) { 9980 if (inputUsedBy.$index(j) === this) {
9919 inputUsedBy.$setindex(j, inputUsedBy.$index(inputUsedBy.length - 1)); 9981 inputUsedBy.$setindex(j, inputUsedBy.$index(inputUsedBy.length - 1));
9920 inputUsedBy.removeLast(); 9982 inputUsedBy.removeLast();
9921 break; 9983 break;
9922 } 9984 }
9923 } 9985 }
9924 } 9986 }
9925 this._usedBy = null; 9987 this._usedBy = null;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
9992 HInvoke.prototype.toString$0 = function() { 10054 HInvoke.prototype.toString$0 = function() {
9993 return this.toString(); 10055 return this.toString();
9994 }; 10056 };
9995 // ********** Code for HInvokeForeign ************** 10057 // ********** Code for HInvokeForeign **************
9996 function HInvokeForeign(element, inputs, code) { 10058 function HInvokeForeign(element, inputs, code) {
9997 this.code = code; 10059 this.code = code;
9998 HInvoke.call(this, element, inputs); 10060 HInvoke.call(this, element, inputs);
9999 // Initializers done 10061 // Initializers done
10000 } 10062 }
10001 $inherits(HInvokeForeign, HInvoke); 10063 $inherits(HInvokeForeign, HInvoke);
10064 HInvokeForeign.prototype.get$code = function() { return this.code; };
10002 HInvokeForeign.prototype.accept = function(visitor) { 10065 HInvokeForeign.prototype.accept = function(visitor) {
10003 return visitor.visitInvokeForeign(this); 10066 return visitor.visitInvokeForeign(this);
10004 } 10067 }
10005 HInvokeForeign.prototype.accept$1 = function($0) { 10068 HInvokeForeign.prototype.accept$1 = function($0) {
10006 return this.accept(($0 && $0.is$HVisitor())); 10069 return this.accept(($0 && $0.is$HVisitor()));
10007 }; 10070 };
10008 // ********** Code for HArithmetic ************** 10071 // ********** Code for HArithmetic **************
10009 function HArithmetic(element, inputs) { 10072 function HArithmetic(element, inputs) {
10010 HInvoke.call(this, element, inputs); 10073 HInvoke.call(this, element, inputs);
10011 // Initializers done 10074 // Initializers done
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
10423 SsaInstructionMerger.prototype.visitGraph = function(graph) { 10486 SsaInstructionMerger.prototype.visitGraph = function(graph) {
10424 this.visitDominatorTree(graph); 10487 this.visitDominatorTree(graph);
10425 } 10488 }
10426 SsaInstructionMerger.prototype.visitInstruction = function(node) { 10489 SsaInstructionMerger.prototype.visitInstruction = function(node) {
10427 var inputs = node.inputs; 10490 var inputs = node.inputs;
10428 var previousUnused = node.previous; 10491 var previousUnused = node.previous;
10429 for (var i = inputs.length - 1; 10492 for (var i = inputs.length - 1;
10430 i >= 0; i--) { 10493 i >= 0; i--) {
10431 if (previousUnused == null) return; 10494 if (previousUnused == null) return;
10432 if ((previousUnused instanceof HPhi)) return; 10495 if ((previousUnused instanceof HPhi)) return;
10433 if (inputs.$index(i).get$usedBy().length != 1) return; 10496 if ($notnull_bool($ne(inputs.$index(i).get$usedBy().length, 1))) return;
10434 if (inputs.$index(i) !== previousUnused) return; 10497 if (inputs.$index(i) !== previousUnused) return;
10435 inputs.$index(i).setGenerateAtUseSite$0(); 10498 inputs.$index(i).setGenerateAtUseSite$0();
10436 previousUnused = previousUnused.previous; 10499 previousUnused = previousUnused.previous;
10437 } 10500 }
10438 } 10501 }
10439 // ********** Code for HTracer ************** 10502 // ********** Code for HTracer **************
10440 function HTracer() {} 10503 function HTracer() {}
10441 HTracer._internal$ctor = function() { 10504 HTracer._internal$ctor = function() {
10442 this.indent = 0 10505 this.indent = 0
10443 this.output = new StringBufferImpl(""); 10506 this.output = new StringBufferImpl("");
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
10745 var result = 0; 10808 var result = 0;
10746 for (var i = 0; 10809 for (var i = 0;
10747 i < instructions.length; i++) { 10810 i < instructions.length; i++) {
10748 if (instructions.$index(i) === instruction) result++; 10811 if (instructions.$index(i) === instruction) result++;
10749 } 10812 }
10750 return result; 10813 return result;
10751 } 10814 }
10752 HValidator.everyInstruction = function(instructions, f) { 10815 HValidator.everyInstruction = function(instructions, f) {
10753 var copy = ListFactory.ListFactory$from$factory(instructions); 10816 var copy = ListFactory.ListFactory$from$factory(instructions);
10754 for (var i = 0; 10817 for (var i = 0;
10755 i < copy.length; i++) { 10818 i < $assert_num(copy.length); i++) {
10756 var current = copy.$index(i); 10819 var current = copy.$index(i);
10757 if (current == null) continue; 10820 if (current == null) continue;
10758 var count = 1; 10821 var count = 1;
10759 for (var j = i + 1; 10822 for (var j = i + 1;
10760 j < copy.length; j++) { 10823 j < $assert_num(copy.length); j++) {
10761 if (copy.$index(j) === current) { 10824 if (copy.$index(j) === current) {
10762 copy.$setindex(j); 10825 copy.$setindex(j);
10763 count++; 10826 count++;
10764 } 10827 }
10765 } 10828 }
10766 if (!$notnull_bool(f.call$2(current, count))) return false; 10829 if (!$notnull_bool(f.call$2(current, count))) return false;
10767 } 10830 }
10768 return true; 10831 return true;
10769 } 10832 }
10770 HValidator.prototype.visitInstruction = function(instruction) { 10833 HValidator.prototype.visitInstruction = function(instruction) {
10771 var $this = this; // closure support 10834 var $this = this; // closure support
10772 function hasCorrectInputs(instruction) { 10835 function hasCorrectInputs(instruction) {
10836 var $0;
10773 var inBasicBlock = $assert_bool(instruction.isInBasicBlock$0()); 10837 var inBasicBlock = $assert_bool(instruction.isInBasicBlock$0());
10774 return HValidator.everyInstruction(instruction.inputs, (function (input, cou nt) { 10838 return HValidator.everyInstruction((($0 = instruction.get$inputs()) && $0.is $List$HInstruction()), (function (input, count) {
10839 var $0;
10775 if ($notnull_bool(inBasicBlock)) { 10840 if ($notnull_bool(inBasicBlock)) {
10776 return HValidator.countInstruction(input.get$usedBy(), (instruction && i nstruction.is$HInstruction())) == count; 10841 return HValidator.countInstruction((($0 = input.get$usedBy()) && $0.is$L ist$HInstruction()), (instruction && instruction.is$HInstruction())) == count;
10777 } 10842 }
10778 else { 10843 else {
10779 return HValidator.countInstruction(input.get$usedBy(), (instruction && i nstruction.is$HInstruction())) == 0; 10844 return HValidator.countInstruction((($0 = input.get$usedBy()) && $0.is$L ist$HInstruction()), (instruction && instruction.is$HInstruction())) == 0;
10780 } 10845 }
10781 }) 10846 })
10782 ); 10847 );
10783 } 10848 }
10784 function hasCorrectUses(instruction) { 10849 function hasCorrectUses(instruction) {
10850 var $0;
10785 if (!$notnull_bool(instruction.isInBasicBlock$0())) return true; 10851 if (!$notnull_bool(instruction.isInBasicBlock$0())) return true;
10786 return HValidator.everyInstruction(instruction.get$usedBy(), (function (use, count) { 10852 return HValidator.everyInstruction((($0 = instruction.get$usedBy()) && $0.is $List$HInstruction()), (function (use, count) {
10787 return HValidator.countInstruction(use.inputs, (instruction && instruction .is$HInstruction())) == count; 10853 var $0;
10854 return HValidator.countInstruction((($0 = use.get$inputs()) && $0.is$List$ HInstruction()), (instruction && instruction.is$HInstruction())) == count;
10788 }) 10855 })
10789 ); 10856 );
10790 } 10857 }
10791 this.isValid = $notnull_bool($notnull_bool(this.isValid && hasCorrectInputs(in struction)) && hasCorrectUses(instruction)); 10858 this.isValid = $notnull_bool($notnull_bool(this.isValid && hasCorrectInputs(in struction)) && hasCorrectUses(instruction));
10792 } 10859 }
10793 // ********** Code for ValueSetNode ************** 10860 // ********** Code for ValueSetNode **************
10794 function ValueSetNode() {} 10861 function ValueSetNode() {}
10795 ValueSetNode.prototype.get$value = function() { return this.value; }; 10862 ValueSetNode.prototype.get$value = function() { return this.value; };
10796 ValueSetNode.prototype.next$0 = function() { 10863 ValueSetNode.prototype.next$0 = function() {
10797 return this.next(); 10864 return this.next();
(...skipping 10 matching lines...) Expand all
10808 WorldCompiler.prototype.log = function(message) { 10875 WorldCompiler.prototype.log = function(message) {
10809 if ($notnull_bool(options.showInfo)) { 10876 if ($notnull_bool(options.showInfo)) {
10810 this.world.info(('[leg] ' + message + '')); 10877 this.world.info(('[leg] ' + message + ''));
10811 } 10878 }
10812 } 10879 }
10813 WorldCompiler.prototype.run = function() { 10880 WorldCompiler.prototype.run = function() {
10814 var success = Compiler.prototype.run.call(this); 10881 var success = Compiler.prototype.run.call(this);
10815 if ($notnull_bool(success)) { 10882 if ($notnull_bool(success)) {
10816 var code = this.getGeneratedCode(); 10883 var code = this.getGeneratedCode();
10817 this.world.legCode = $assert_String(code); 10884 this.world.legCode = $assert_String(code);
10818 this.world.jsBytesWritten = code.length; 10885 this.world.jsBytesWritten = $assert_num(code.length);
10819 var $list = this.tasks; 10886 var $list = this.tasks;
10820 for (var $i0 = 0;$i0 < $list.length; $i0++) { 10887 for (var $i0 = 0;$i0 < $list.length; $i0++) {
10821 var task = $list.$index($i0); 10888 var task = $list.$index($i0);
10822 this.log(('' + task.get$name() + ' took ' + task.get$timing() + 'msec')); 10889 this.log(('' + task.get$name() + ' took ' + task.get$timing() + 'msec'));
10823 } 10890 }
10824 } 10891 }
10825 return success; 10892 return success;
10826 } 10893 }
10827 WorldCompiler.prototype.spanFromNode = function(node) { 10894 WorldCompiler.prototype.spanFromNode = function(node) {
10828 var begin = node.getBeginToken(); 10895 var begin = node.getBeginToken();
(...skipping 18 matching lines...) Expand all
10847 this.scanner = new ScannerTask(this); 10914 this.scanner = new ScannerTask(this);
10848 this.parser = new ParserTask(this); 10915 this.parser = new ParserTask(this);
10849 this.resolver = new ResolverTask(this); 10916 this.resolver = new ResolverTask(this);
10850 this.checker = new TypeCheckerTask(this); 10917 this.checker = new TypeCheckerTask(this);
10851 this.builder = new SsaBuilderTask(this); 10918 this.builder = new SsaBuilderTask(this);
10852 this.optimizer = new SsaOptimizerTask(this); 10919 this.optimizer = new SsaOptimizerTask(this);
10853 this.generator = new SsaCodeGeneratorTask(this); 10920 this.generator = new SsaCodeGeneratorTask(this);
10854 this.tasks = [this.scanner, this.parser, this.resolver, this.checker, this.bui lder, this.optimizer, this.generator]; 10921 this.tasks = [this.scanner, this.parser, this.resolver, this.checker, this.bui lder, this.optimizer, this.generator];
10855 } 10922 }
10856 Compiler.prototype.is$Compiler = function(){return this;}; 10923 Compiler.prototype.is$Compiler = function(){return this;};
10924 Compiler.prototype.get$generator = function() { return this.generator; };
10925 Compiler.prototype.set$generator = function(value) { return this.generator = val ue; };
10857 Compiler.prototype.ensure = function(condition) { 10926 Compiler.prototype.ensure = function(condition) {
10858 if (!$notnull_bool(condition)) this.cancel('failed assertion in leg'); 10927 if (!$notnull_bool(condition)) this.cancel('failed assertion in leg');
10859 } 10928 }
10860 Compiler.prototype.unimplemented = function(methodName) { 10929 Compiler.prototype.unimplemented = function(methodName) {
10861 this.cancel(("" + methodName + " not implemented")); 10930 this.cancel(("" + methodName + " not implemented"));
10862 } 10931 }
10863 Compiler.prototype.cancel = function(reason) { 10932 Compiler.prototype.cancel = function(reason) {
10864 $throw(new CompilerCancelledException(reason)); 10933 $throw(new CompilerCancelledException(reason));
10865 } 10934 }
10866 Compiler.prototype.log = function(message) { 10935 Compiler.prototype.log = function(message) {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
11295 return this.add(($0 && $0.is$Element())); 11364 return this.add(($0 && $0.is$Element()));
11296 }; 11365 };
11297 TopScope.prototype.lookup$1 = function($0) { 11366 TopScope.prototype.lookup$1 = function($0) {
11298 return this.lookup(($0 && $0.is$SourceString())); 11367 return this.lookup(($0 && $0.is$SourceString()));
11299 }; 11368 };
11300 // ********** Code for leg_Script ************** 11369 // ********** Code for leg_Script **************
11301 function leg_Script(file) { 11370 function leg_Script(file) {
11302 this.file = file; 11371 this.file = file;
11303 // Initializers done 11372 // Initializers done
11304 } 11373 }
11374 leg_Script.prototype.get$file = function() { return this.file; };
11305 leg_Script.prototype.get$text = function() { 11375 leg_Script.prototype.get$text = function() {
11306 return this.file.get$text(); 11376 return this.file.get$text();
11307 } 11377 }
11308 // ********** Code for TypeCheckerTask ************** 11378 // ********** Code for TypeCheckerTask **************
11309 function TypeCheckerTask(compiler) { 11379 function TypeCheckerTask(compiler) {
11310 this.types = new Types(); 11380 this.types = new Types();
11311 CompilerTask.call(this, compiler); 11381 CompilerTask.call(this, compiler);
11312 // Initializers done 11382 // Initializers done
11313 } 11383 }
11314 $inherits(TypeCheckerTask, CompilerTask); 11384 $inherits(TypeCheckerTask, CompilerTask);
11315 TypeCheckerTask.prototype.get$name = function() { 11385 TypeCheckerTask.prototype.get$name = function() {
11316 return "Type checker"; 11386 return "Type checker";
11317 } 11387 }
11388 TypeCheckerTask.prototype.get$types = function() { return this.types; };
11389 TypeCheckerTask.prototype.set$types = function(value) { return this.types = valu e; };
11318 TypeCheckerTask.prototype.check = function(tree, elements) { 11390 TypeCheckerTask.prototype.check = function(tree, elements) {
11319 var $this = this; // closure support 11391 var $this = this; // closure support
11320 this.measure((function () { 11392 this.measure((function () {
11321 var visitor = new TypeCheckerVisitor($this.compiler, elements, $this.types); 11393 var visitor = new TypeCheckerVisitor($this.compiler, elements, $this.types);
11322 try { 11394 try {
11323 tree.accept(visitor); 11395 tree.accept(visitor);
11324 } catch (e) { 11396 } catch (e) {
11325 e = $toDartException(e); 11397 e = $toDartException(e);
11326 if (!(e instanceof CancelTypeCheckException)) throw e; 11398 if (!(e instanceof CancelTypeCheckException)) throw e;
11327 $this.compiler.reportWarning(e.node, e.reason); 11399 $this.compiler.reportWarning(e.node, e.reason);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
11389 }; 11461 };
11390 // ********** Code for Types ************** 11462 // ********** Code for Types **************
11391 function Types() { 11463 function Types() {
11392 this.voidType = new SimpleType.named$ctor(const$4/*Types.VOID*/); 11464 this.voidType = new SimpleType.named$ctor(const$4/*Types.VOID*/);
11393 this.intType = new SimpleType.named$ctor(const$6/*Types.INT*/); 11465 this.intType = new SimpleType.named$ctor(const$6/*Types.INT*/);
11394 this.dynamicType = new SimpleType.named$ctor(const$8/*Types.DYNAMIC*/); 11466 this.dynamicType = new SimpleType.named$ctor(const$8/*Types.DYNAMIC*/);
11395 this.stringType = new SimpleType.named$ctor(const$10/*Types.STRING*/); 11467 this.stringType = new SimpleType.named$ctor(const$10/*Types.STRING*/);
11396 // Initializers done 11468 // Initializers done
11397 } 11469 }
11398 Types.prototype.is$Types = function(){return this;}; 11470 Types.prototype.is$Types = function(){return this;};
11471 Types.prototype.get$dynamicType = function() { return this.dynamicType; };
11399 Types.prototype.lookup = function(s) { 11472 Types.prototype.lookup = function(s) {
11400 if ($notnull_bool($eq(const$4/*Types.VOID*/, s))) { 11473 if ($notnull_bool($eq(const$4/*Types.VOID*/, s))) {
11401 return this.voidType; 11474 return this.voidType;
11402 } 11475 }
11403 else if ($notnull_bool($eq(const$6/*Types.INT*/, s))) { 11476 else if ($notnull_bool($eq(const$6/*Types.INT*/, s))) {
11404 return this.intType; 11477 return this.intType;
11405 } 11478 }
11406 else if ($notnull_bool($eq(const$8/*Types.DYNAMIC*/, s) || s.get$stringValue() === 'var')) { 11479 else if ($notnull_bool($eq(const$8/*Types.DYNAMIC*/, s) || s.get$stringValue() === 'var')) {
11407 return this.dynamicType; 11480 return this.dynamicType;
11408 } 11481 }
(...skipping 18 matching lines...) Expand all
11427 // Initializers done 11500 // Initializers done
11428 } 11501 }
11429 // ********** Code for TypeCheckerVisitor ************** 11502 // ********** Code for TypeCheckerVisitor **************
11430 function TypeCheckerVisitor(compiler, elements, types) { 11503 function TypeCheckerVisitor(compiler, elements, types) {
11431 this.compiler = compiler; 11504 this.compiler = compiler;
11432 this.elements = elements; 11505 this.elements = elements;
11433 this.types = types; 11506 this.types = types;
11434 // Initializers done 11507 // Initializers done
11435 } 11508 }
11436 TypeCheckerVisitor.prototype.is$Visitor = function(){return this;}; 11509 TypeCheckerVisitor.prototype.is$Visitor = function(){return this;};
11510 TypeCheckerVisitor.prototype.get$types = function() { return this.types; };
11511 TypeCheckerVisitor.prototype.set$types = function(value) { return this.types = v alue; };
11437 TypeCheckerVisitor.prototype.fail = function(node, reason) { 11512 TypeCheckerVisitor.prototype.fail = function(node, reason) {
11438 var message = 'cannot type-check'; 11513 var message = 'cannot type-check';
11439 if (reason != null) { 11514 if (reason != null) {
11440 message = ('' + message + ': ' + reason + ''); 11515 message = ('' + message + ': ' + reason + '');
11441 } 11516 }
11442 $throw(new CancelTypeCheckException(node, message)); 11517 $throw(new CancelTypeCheckException(node, message));
11443 } 11518 }
11444 TypeCheckerVisitor.prototype.nonVoidType = function(node) { 11519 TypeCheckerVisitor.prototype.nonVoidType = function(node) {
11445 var type = this.type(node); 11520 var type = this.type(node);
11446 if ($eq(type, this.types.voidType)) { 11521 if ($eq(type, this.types.voidType)) {
11447 this.compiler.reportWarning(node, CompilerError.voidExpression()); 11522 this.compiler.reportWarning(node, CompilerError.voidExpression());
11448 } 11523 }
11449 return type; 11524 return type;
11450 } 11525 }
11451 TypeCheckerVisitor.prototype.typeWithDefault = function(node, defaultValue) { 11526 TypeCheckerVisitor.prototype.typeWithDefault = function(node, defaultValue) {
11452 return node != null ? this.type(node) : defaultValue; 11527 return node != null ? this.type(node) : defaultValue;
11453 } 11528 }
11454 TypeCheckerVisitor.prototype.type = function(node) { 11529 TypeCheckerVisitor.prototype.type = function(node) {
11455 var $0; 11530 var $0;
11456 if (node == null) this.fail(null, 'unexpected node: null'); 11531 if (node == null) this.fail(null, 'unexpected node: null');
11457 var result = (($0 = node.accept(this)) && $0.is$Type()); 11532 var result = (($0 = node.accept(this)) && $0.is$Type());
11458 return result; 11533 return result;
11459 } 11534 }
11535 TypeCheckerVisitor.prototype.get$type = function() {
11536 return TypeCheckerVisitor.prototype.type.bind(this);
11537 }
11460 TypeCheckerVisitor.prototype.checkAssignable = function(node, s, t) { 11538 TypeCheckerVisitor.prototype.checkAssignable = function(node, s, t) {
11461 if (!$notnull_bool(this.types.isAssignable(s, t))) { 11539 if (!$notnull_bool(this.types.isAssignable(s, t))) {
11462 var error = CompilerError.notAssignable(s, t); 11540 var error = CompilerError.notAssignable(s, t);
11463 this.compiler.reportWarning(node, error); 11541 this.compiler.reportWarning(node, error);
11464 } 11542 }
11465 } 11543 }
11466 TypeCheckerVisitor.prototype.visitBlock = function(node) { 11544 TypeCheckerVisitor.prototype.visitBlock = function(node) {
11467 this.type(node.statements); 11545 this.type(node.statements);
11468 return this.types.voidType; 11546 return this.types.voidType;
11469 } 11547 }
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
11839 this.main.declaringType.markUsed(); 11917 this.main.declaringType.markUsed();
11840 world.corelib.types.$index('BadNumberFormatException').markUsed$0(); 11918 world.corelib.types.$index('BadNumberFormatException').markUsed$0();
11841 world.get$coreimpl().types.$index('NumImplementation').markUsed$0(); 11919 world.get$coreimpl().types.$index('NumImplementation').markUsed$0();
11842 world.get$coreimpl().types.$index('StringImplementation').markUsed$0(); 11920 world.get$coreimpl().types.$index('StringImplementation').markUsed$0();
11843 world.get$coreimpl().types.$index('MatchImplementation').markUsed$0(); 11921 world.get$coreimpl().types.$index('MatchImplementation').markUsed$0();
11844 this.genMethod((($0 = world.get$coreimpl().types.$index('MatchImplementation') .getConstructor$1('')) && $0.is$Member())); 11922 this.genMethod((($0 = world.get$coreimpl().types.$index('MatchImplementation') .getConstructor$1('')) && $0.is$Member()));
11845 this.writeTypes(world.get$coreimpl()); 11923 this.writeTypes(world.get$coreimpl());
11846 this.writeTypes(world.corelib); 11924 this.writeTypes(world.corelib);
11847 this.writeTypes(this.main.declaringType.get$library()); 11925 this.writeTypes(this.main.declaringType.get$library());
11848 this._writeGlobals(); 11926 this._writeGlobals();
11849 this.writer.writeln(('RunEntry(function () {' + mainCall.code + ';}, []);')); 11927 this.writer.writeln(('RunEntry(function () {' + mainCall.get$code() + ';}, []) ;'));
11850 } 11928 }
11851 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe ndencies) { 11929 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe ndencies) {
11852 var $0; 11930 var $0;
11853 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + ""); 11931 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + "");
11854 if (!this.globals.containsKey(fullname)) { 11932 if (!this.globals.containsKey(fullname)) {
11855 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory( field, fieldValue, dependencies)); 11933 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory( field, fieldValue, dependencies));
11856 } 11934 }
11857 return (($0 = this.globals.$index(fullname)) && $0.is$GlobalValue()); 11935 return (($0 = this.globals.$index(fullname)) && $0.is$GlobalValue());
11858 } 11936 }
11859 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { 11937 WorldGenerator.prototype.globalForConst = function(exp, dependencies) {
11860 var $0; 11938 var $0;
11861 var code = exp.canonicalCode; 11939 var code = exp.canonicalCode;
11862 if (!this.globals.containsKey(code)) { 11940 if (!this.globals.containsKey(code)) {
11863 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this. globals.get$length(), exp, dependencies)); 11941 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this. globals.get$length(), exp, dependencies));
11864 } 11942 }
11865 return (($0 = this.globals.$index(code)) && $0.is$GlobalValue()); 11943 return (($0 = this.globals.$index(code)) && $0.is$GlobalValue());
11866 } 11944 }
11867 WorldGenerator.prototype.writeTypes = function(lib) { 11945 WorldGenerator.prototype.writeTypes = function(lib) {
11946 var $0;
11868 if ($notnull_bool(lib.isWritten)) return; 11947 if ($notnull_bool(lib.isWritten)) return;
11869 lib.isWritten = true; 11948 lib.isWritten = true;
11870 var $list = lib.imports; 11949 var $list = lib.imports;
11871 for (var $i = 0;$i < $list.length; $i++) { 11950 for (var $i = 0;$i < $list.length; $i++) {
11872 var import_ = $list.$index($i); 11951 var import_ = $list.$index($i);
11873 this.writeTypes(import_.get$library()); 11952 this.writeTypes((($0 = import_.get$library()) && $0.is$Library()));
11874 } 11953 }
11875 for (var i = 0; 11954 for (var i = 0;
11876 i < lib.sources.length; i++) { 11955 i < lib.sources.length; i++) {
11877 lib.sources.$index(i).orderInLibrary = i; 11956 lib.sources.$index(i).set$orderInLibrary(i);
11878 } 11957 }
11879 this.writer.comment(('// ********** Library ' + lib.name + ' **************') ); 11958 this.writer.comment(('// ********** Library ' + lib.name + ' **************') );
11880 if ($notnull_bool(lib.get$isCore())) { 11959 if ($notnull_bool(lib.get$isCore())) {
11881 this.writer.comment('// ********** Natives dart:core **************'); 11960 this.writer.comment('// ********** Natives dart:core **************');
11882 this.corejs.generate(this.writer); 11961 this.corejs.generate(this.writer);
11883 } 11962 }
11884 var $list = lib.natives; 11963 var $list = lib.natives;
11885 for (var $i = 0;$i < $list.length; $i++) { 11964 for (var $i = 0;$i < $list.length; $i++) {
11886 var file = $list.$index($i); 11965 var file = $list.$index($i);
11887 var filename = basename(file.filename); 11966 var filename = basename($assert_String(file.get$filename()));
11888 this.writer.comment(('// ********** Natives ' + filename + ' ************** ')); 11967 this.writer.comment(('// ********** Natives ' + filename + ' ************** '));
11889 this.writer.writeln(file.get$text()); 11968 this.writer.writeln($assert_String(file.get$text()));
11890 } 11969 }
11891 lib.topType.markUsed(); 11970 lib.topType.markUsed();
11892 var $list = this._orderValues(lib.types); 11971 var $list = this._orderValues(lib.types);
11893 for (var $i = 0;$i < $list.length; $i++) { 11972 for (var $i = 0;$i < $list.length; $i++) {
11894 var type = $list.$index($i); 11973 var type = $list.$index($i);
11895 if ($notnull_bool(type.get$isUsed() && type.get$isClass())) { 11974 if ($notnull_bool(type.get$isUsed() && type.get$isClass())) {
11896 this.writeType((type && type.is$lang_Type())); 11975 this.writeType((type && type.is$lang_Type()));
11897 if ($notnull_bool(type.get$isGeneric())) { 11976 if ($notnull_bool(type.get$isGeneric())) {
11898 var $list0 = this._orderValues(type._concreteTypes); 11977 var $list0 = this._orderValues(type._concreteTypes);
11899 for (var $i0 = 0;$i0 < $list0.length; $i0++) { 11978 for (var $i0 = 0;$i0 < $list0.length; $i0++) {
11900 var ct = $list0.$index($i0); 11979 var ct = $list0.$index($i0);
11901 this.writeType((ct && ct.is$lang_Type())); 11980 this.writeType((ct && ct.is$lang_Type()));
11902 } 11981 }
11903 } 11982 }
11904 } 11983 }
11905 if ($notnull_bool(type.get$isFunction() && type.varStubs != null)) { 11984 if ($notnull_bool(type.get$isFunction() && $ne(type.get$varStubs(), null))) {
11906 this.writer.comment(('// ********** Code for ' + type.get$jsname() + ' *** ***********')); 11985 this.writer.comment(('// ********** Code for ' + type.get$jsname() + ' *** ***********'));
11907 this._writeDynamicStubs((type && type.is$lang_Type())); 11986 this._writeDynamicStubs((type && type.is$lang_Type()));
11908 } 11987 }
11909 if (type.typeCheckCode != null) { 11988 if ($notnull_bool($ne(type.get$typeCheckCode(), null))) {
11910 this.writer.writeln(type.typeCheckCode); 11989 this.writer.writeln($assert_String(type.get$typeCheckCode()));
11911 } 11990 }
11912 } 11991 }
11913 } 11992 }
11914 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { 11993 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) {
11915 if ($notnull_bool(!$notnull_bool(meth.isGenerated) && !$notnull_bool(meth.get$ isAbstract()) && $ne(meth.get$definition(), null))) { 11994 if ($notnull_bool(!$notnull_bool(meth.isGenerated) && !$notnull_bool(meth.get$ isAbstract()) && $ne(meth.get$definition(), null))) {
11916 new MethodGenerator(meth, enclosingMethod).run(); 11995 new MethodGenerator(meth, enclosingMethod).run();
11917 } 11996 }
11918 } 11997 }
11919 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { 11998 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) {
11920 if (!$notnull_bool(checkType.isTested)) return; 11999 if (!$notnull_bool(checkType.isTested)) return;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
11954 if (!$notnull_bool(type.get$isNativeType())) { 12033 if (!$notnull_bool(type.get$isNativeType())) {
11955 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); 12034 this.writer.writeln(('function ' + type.get$jsname() + '() {}'));
11956 } 12035 }
11957 } 12036 }
11958 else { 12037 else {
11959 standardConstructor.generator.writeDefinition(this.writer, null); 12038 standardConstructor.generator.writeDefinition(this.writer, null);
11960 } 12039 }
11961 var $list = type.get$constructors().getValues(); 12040 var $list = type.get$constructors().getValues();
11962 for (var $i = type.get$constructors().getValues().iterator$0(); $i.hasNext$0 (); ) { 12041 for (var $i = type.get$constructors().getValues().iterator$0(); $i.hasNext$0 (); ) {
11963 var c = $i.next$0(); 12042 var c = $i.next$0();
11964 if ($notnull_bool($ne(c.generator, null) && $ne(c, standardConstructor))) { 12043 if ($notnull_bool($ne(c.get$generator(), null) && $ne(c, standardConstruct or))) {
11965 c.generator.writeDefinition$2(this.writer); 12044 c.get$generator().writeDefinition$2(this.writer);
11966 } 12045 }
11967 } 12046 }
11968 } 12047 }
11969 if (!$notnull_bool(type.get$isTop())) { 12048 if (!$notnull_bool(type.get$isTop())) {
11970 if ((type instanceof ConcreteType)) { 12049 if ((type instanceof ConcreteType)) {
11971 this._ensureInheritsHelper(); 12050 this._ensureInheritsHelper();
11972 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g enericType().get$jsname() + ');')); 12051 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g enericType().get$jsname() + ');'));
11973 } 12052 }
11974 else if (!$notnull_bool(type.get$isNativeType())) { 12053 else if (!$notnull_bool(type.get$isNativeType())) {
11975 if (type.get$parent() != null && !$notnull_bool(type.get$parent().get$isOb ject())) { 12054 if (type.get$parent() != null && !$notnull_bool(type.get$parent().get$isOb ject())) {
(...skipping 12 matching lines...) Expand all
11988 this._maybeIsTest(type, (ct && ct.is$lang_Type())); 12067 this._maybeIsTest(type, (ct && ct.is$lang_Type()));
11989 } 12068 }
11990 } 12069 }
11991 if (type.get$interfaces() != null) { 12070 if (type.get$interfaces() != null) {
11992 var seen = new HashSetImplementation(); 12071 var seen = new HashSetImplementation();
11993 var worklist = []; 12072 var worklist = [];
11994 worklist.addAll(type.get$interfaces()); 12073 worklist.addAll(type.get$interfaces());
11995 seen.addAll(type.get$interfaces()); 12074 seen.addAll(type.get$interfaces());
11996 while (!worklist.isEmpty()) { 12075 while (!worklist.isEmpty()) {
11997 var interface_ = worklist.removeLast(); 12076 var interface_ = worklist.removeLast();
11998 this._maybeIsTest(type, interface_.get$genericType()); 12077 this._maybeIsTest(type, (($0 = interface_.get$genericType()) && $0.is$lang _Type()));
11999 if (interface_.get$genericType()._concreteTypes != null) { 12078 if (interface_.get$genericType()._concreteTypes != null) {
12000 var $list = this._orderValues(interface_.get$genericType()._concreteType s); 12079 var $list = this._orderValues(interface_.get$genericType()._concreteType s);
12001 for (var $i = 0;$i < $list.length; $i++) { 12080 for (var $i = 0;$i < $list.length; $i++) {
12002 var ct = $list.$index($i); 12081 var ct = $list.$index($i);
12003 this._maybeIsTest(type, (ct && ct.is$lang_Type())); 12082 this._maybeIsTest(type, (ct && ct.is$lang_Type()));
12004 } 12083 }
12005 } 12084 }
12006 var $list = interface_.get$interfaces(); 12085 var $list = interface_.get$interfaces();
12007 for (var $i = interface_.get$interfaces().iterator$0(); $i.hasNext$0(); ) { 12086 for (var $i = interface_.get$interfaces().iterator$0(); $i.hasNext$0(); ) {
12008 var other = $i.next$0(); 12087 var other = $i.next$0();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
12042 stub.generate$1(this.writer); 12121 stub.generate$1(this.writer);
12043 } 12122 }
12044 } 12123 }
12045 } 12124 }
12046 WorldGenerator.prototype._writeStaticField = function(field) { 12125 WorldGenerator.prototype._writeStaticField = function(field) {
12047 if ($notnull_bool(field.isFinal)) return; 12126 if ($notnull_bool(field.isFinal)) return;
12048 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + ""); 12127 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + "");
12049 if (this.globals.containsKey(fullname)) { 12128 if (this.globals.containsKey(fullname)) {
12050 var value = this.globals.$index(fullname); 12129 var value = this.globals.$index(fullname);
12051 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.is Native))) { 12130 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.is Native))) {
12052 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code + ';')); 12131 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.get$exp() .get$code() + ';'));
12053 } 12132 }
12054 else { 12133 else {
12055 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g et$jsname() + ' = ' + value.exp.code + ';')); 12134 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g et$jsname() + ' = ' + value.get$exp().get$code() + ';'));
12056 } 12135 }
12057 } 12136 }
12058 } 12137 }
12059 WorldGenerator.prototype._writeField = function(field) { 12138 WorldGenerator.prototype._writeField = function(field) {
12060 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.isNa tive)) && field.value == null) { 12139 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.isNa tive)) && field.value == null) {
12061 this.writer.writeln(('var ' + field.get$jsname() + ';')); 12140 this.writer.writeln(('var ' + field.get$jsname() + ';'));
12062 } 12141 }
12063 if ($notnull_bool(field._providePropertySyntax)) { 12142 if ($notnull_bool(field._providePropertySyntax)) {
12064 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get \$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn ame() + '; };')); 12143 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get \$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn ame() + '; };'));
12065 if (!$notnull_bool(field.isFinal)) { 12144 if (!$notnull_bool(field.isFinal)) {
(...skipping 18 matching lines...) Expand all
12084 } 12163 }
12085 WorldGenerator.prototype._writeMethod = function(method) { 12164 WorldGenerator.prototype._writeMethod = function(method) {
12086 if (method.generator != null) { 12165 if (method.generator != null) {
12087 method.generator.writeDefinition(this.writer, null); 12166 method.generator.writeDefinition(this.writer, null);
12088 } 12167 }
12089 } 12168 }
12090 WorldGenerator.prototype.get$_writeMethod = function() { 12169 WorldGenerator.prototype.get$_writeMethod = function() {
12091 return WorldGenerator.prototype._writeMethod.bind(this); 12170 return WorldGenerator.prototype._writeMethod.bind(this);
12092 } 12171 }
12093 WorldGenerator.prototype._writeGlobals = function() { 12172 WorldGenerator.prototype._writeGlobals = function() {
12173 var $0;
12094 if (this.globals.get$length() > 0) { 12174 if (this.globals.get$length() > 0) {
12095 this.writer.comment('// ********** Globals **************'); 12175 this.writer.comment('// ********** Globals **************');
12096 } 12176 }
12097 var list = this.globals.getValues(); 12177 var list = this.globals.getValues();
12098 list.sort$1((function (a, b) { 12178 list.sort$1((function (a, b) {
12099 return a.compareTo$1(b); 12179 return a.compareTo$1(b);
12100 }) 12180 })
12101 ); 12181 );
12102 for (var $i = list.iterator$0(); $i.hasNext$0(); ) { 12182 for (var $i = list.iterator$0(); $i.hasNext$0(); ) {
12103 var global = $i.next$0(); 12183 var global = $i.next$0();
12104 if (global.field != null) { 12184 if ($notnull_bool($ne(global.get$field(), null))) {
12105 this._writeStaticField(global.field); 12185 this._writeStaticField((($0 = global.get$field()) && $0.is$FieldMember())) ;
12106 } 12186 }
12107 else { 12187 else {
12108 this.writer.writeln(('var ' + global.get$name() + ' = ' + global.exp.code + ';')); 12188 this.writer.writeln(('var ' + global.get$name() + ' = ' + global.get$exp() .get$code() + ';'));
12109 } 12189 }
12110 } 12190 }
12111 } 12191 }
12112 WorldGenerator.prototype._orderValues = function(map) { 12192 WorldGenerator.prototype._orderValues = function(map) {
12113 var $0; 12193 var $0;
12114 var values = (($0 = map.getValues()) && $0.is$List()); 12194 var values = (($0 = map.getValues()) && $0.is$List());
12115 values.sort(this.get$_compareMembers()); 12195 values.sort(this.get$_compareMembers());
12116 return values; 12196 return values;
12117 } 12197 }
12118 WorldGenerator.prototype._compareMembers = function(x, y) { 12198 WorldGenerator.prototype._compareMembers = function(x, y) {
12119 if (x.get$span() != null && y.get$span() != null) { 12199 if ($notnull_bool($ne(x.get$span(), null) && $ne(y.get$span(), null))) {
12120 var spans = x.get$span().compareTo(y.get$span()); 12200 var spans = $assert_num(x.get$span().compareTo$1(y.get$span()));
12121 if (spans != 0) return spans; 12201 if (spans != 0) return spans;
12122 } 12202 }
12123 if (x.get$span() == null) return 1; 12203 if ($notnull_bool(x.get$span() == null)) return 1;
12124 if (y.get$span() == null) return -1; 12204 if ($notnull_bool(y.get$span() == null)) return -1;
12125 return $assert_num(x.get$name().compareTo$1(y.get$name())); 12205 return $assert_num(x.get$name().compareTo$1(y.get$name()));
12126 } 12206 }
12127 WorldGenerator.prototype.get$_compareMembers = function() { 12207 WorldGenerator.prototype.get$_compareMembers = function() {
12128 return WorldGenerator.prototype._compareMembers.bind(this); 12208 return WorldGenerator.prototype._compareMembers.bind(this);
12129 } 12209 }
12130 WorldGenerator.prototype.useMapFactory = function() { 12210 WorldGenerator.prototype.useMapFactory = function() {
12131 var $0; 12211 var $0;
12132 this.corejs.useMap = true; 12212 this.corejs.useMap = true;
12133 var factType = world.get$coreimpl().types.$index('HashMapImplementation'); 12213 var factType = world.get$coreimpl().types.$index('HashMapImplementation');
12134 var m = factType.resolveMember$1('\$setindex'); 12214 var m = factType.resolveMember$1('\$setindex');
(...skipping 10 matching lines...) Expand all
12145 this._vars = $map([]); 12225 this._vars = $map([]);
12146 // Initializers done 12226 // Initializers done
12147 if ($notnull_bool(this.get$isMethodScope())) { 12227 if ($notnull_bool(this.get$isMethodScope())) {
12148 this._closedOver = new HashSetImplementation(); 12228 this._closedOver = new HashSetImplementation();
12149 } 12229 }
12150 else { 12230 else {
12151 this.reentrant = $notnull_bool(this.reentrant || this.parent.reentrant); 12231 this.reentrant = $notnull_bool(this.reentrant || this.parent.reentrant);
12152 } 12232 }
12153 } 12233 }
12154 BlockScope.prototype.is$BlockScope = function(){return this;}; 12234 BlockScope.prototype.is$BlockScope = function(){return this;};
12235 BlockScope.prototype.get$enclosingMethod = function() { return this.enclosingMet hod; };
12236 BlockScope.prototype.set$enclosingMethod = function(value) { return this.enclosi ngMethod = value; };
12155 BlockScope.prototype.get$parent = function() { return this.parent; }; 12237 BlockScope.prototype.get$parent = function() { return this.parent; };
12156 BlockScope.prototype.set$parent = function(value) { return this.parent = value; }; 12238 BlockScope.prototype.set$parent = function(value) { return this.parent = value; };
12239 BlockScope.prototype.get$rethrow = function() { return this.rethrow; };
12240 BlockScope.prototype.set$rethrow = function(value) { return this.rethrow = value ; };
12241 BlockScope.prototype.get$reentrant = function() { return this.reentrant; };
12242 BlockScope.prototype.set$reentrant = function(value) { return this.reentrant = v alue; };
12157 BlockScope.prototype.get$isMethodScope = function() { 12243 BlockScope.prototype.get$isMethodScope = function() {
12158 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM ethod); 12244 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM ethod);
12159 } 12245 }
12160 BlockScope.prototype.get$methodScope = function() { 12246 BlockScope.prototype.get$methodScope = function() {
12161 var s = this; 12247 var s = this;
12162 while (!$notnull_bool(s.get$isMethodScope())) s = s.get$parent(); 12248 while (!$notnull_bool(s.get$isMethodScope())) s = s.get$parent();
12163 return (s && s.is$BlockScope()); 12249 return (s && s.is$BlockScope());
12164 } 12250 }
12165 BlockScope.prototype.lookup = function(name) { 12251 BlockScope.prototype.lookup = function(name) {
12166 var ret = this._vars.$index(name); 12252 var ret = this._vars.$index(name);
12167 if ($notnull_bool($ne(ret, null))) return ret; 12253 if ($notnull_bool($ne(ret, null))) return ret;
12168 for (var s = this.parent; 12254 for (var s = this.parent;
12169 $notnull_bool($ne(s, null)); s = s.get$parent()) { 12255 $notnull_bool($ne(s, null)); s = s.get$parent()) {
12170 ret = s._vars.$index(name); 12256 ret = s._vars.$index(name);
12171 if ($notnull_bool($ne(ret, null))) { 12257 if ($notnull_bool($ne(ret, null))) {
12172 if ($ne(s.enclosingMethod, this.enclosingMethod)) { 12258 if ($notnull_bool($ne(s.get$enclosingMethod(), this.enclosingMethod))) {
12173 s.get$methodScope()._closedOver.add(ret.code); 12259 s.get$methodScope()._closedOver.add(ret.get$code());
12174 if ($notnull_bool(this.enclosingMethod.captures != null && s.reentrant)) { 12260 if ($notnull_bool(this.enclosingMethod.captures != null && s.get$reentra nt())) {
12175 this.enclosingMethod.captures.add(ret.code); 12261 this.enclosingMethod.captures.add(ret.get$code());
12176 } 12262 }
12177 } 12263 }
12178 return ret; 12264 return ret;
12179 } 12265 }
12180 } 12266 }
12181 } 12267 }
12182 BlockScope.prototype._isDefinedInParent = function(name) { 12268 BlockScope.prototype._isDefinedInParent = function(name) {
12183 if ($notnull_bool(this.get$isMethodScope() && this._closedOver.contains(name)) ) return true; 12269 if ($notnull_bool(this.get$isMethodScope() && this._closedOver.contains(name)) ) return true;
12184 for (var s = this.parent; 12270 for (var s = this.parent;
12185 $notnull_bool($ne(s, null)); s = s.get$parent()) { 12271 $notnull_bool($ne(s, null)); s = s.get$parent()) {
(...skipping 20 matching lines...) Expand all
12206 return (ret && ret.is$Value()); 12292 return (ret && ret.is$Value());
12207 } 12293 }
12208 BlockScope.prototype.declareParameter = function(p) { 12294 BlockScope.prototype.declareParameter = function(p) {
12209 return this.create(p.name, p.type, p.definition.span, true); 12295 return this.create(p.name, p.type, p.definition.span, true);
12210 } 12296 }
12211 BlockScope.prototype.declare = function(id) { 12297 BlockScope.prototype.declare = function(id) {
12212 var type = this.enclosingMethod.method.resolveType(id.type, false); 12298 var type = this.enclosingMethod.method.resolveType(id.type, false);
12213 return this.create(id.name.name, (type && type.is$lang_Type()), id.span, false ); 12299 return this.create(id.name.name, (type && type.is$lang_Type()), id.span, false );
12214 } 12300 }
12215 BlockScope.prototype.getRethrow = function() { 12301 BlockScope.prototype.getRethrow = function() {
12302 var $0;
12216 var scope = this; 12303 var scope = this;
12217 while ($notnull_bool(scope.rethrow == null && $ne(scope.get$parent(), null))) { 12304 while ($notnull_bool(scope.get$rethrow() == null && $ne(scope.get$parent(), nu ll))) {
12218 scope = scope.get$parent(); 12305 scope = scope.get$parent();
12219 } 12306 }
12220 return scope.rethrow; 12307 return (($0 = scope.get$rethrow()) && $0.is$Value());
12221 } 12308 }
12222 BlockScope.prototype.lookup$1 = function($0) { 12309 BlockScope.prototype.lookup$1 = function($0) {
12223 return this.lookup($assert_String($0)); 12310 return this.lookup($assert_String($0));
12224 }; 12311 };
12225 // ********** Code for MethodGenerator ************** 12312 // ********** Code for MethodGenerator **************
12226 function MethodGenerator(method, enclosingMethod) { 12313 function MethodGenerator(method, enclosingMethod) {
12227 var $0; 12314 var $0;
12228 this.method = method; 12315 this.method = method;
12229 this.enclosingMethod = enclosingMethod; 12316 this.enclosingMethod = enclosingMethod;
12230 this.writer = new CodeWriter(); 12317 this.writer = new CodeWriter();
12231 this.needsThis = false; 12318 this.needsThis = false;
12232 // Initializers done 12319 // Initializers done
12233 if (this.enclosingMethod != null) { 12320 if (this.enclosingMethod != null) {
12234 this._scope = new BlockScope(this, this.enclosingMethod._scope, false); 12321 this._scope = new BlockScope(this, this.enclosingMethod._scope, false);
12235 this.captures = new HashSetImplementation(); 12322 this.captures = new HashSetImplementation();
12236 } 12323 }
12237 else { 12324 else {
12238 this._scope = new BlockScope(this, null, false); 12325 this._scope = new BlockScope(this, null, false);
12239 } 12326 }
12240 if (this.enclosingMethod != null && this.method.name != '') { 12327 if (this.enclosingMethod != null && this.method.name != '') {
12241 var m = (($0 = this.method) && $0.is$MethodMember()); 12328 var m = (($0 = this.method) && $0.is$MethodMember());
12242 this._scope.create(m.name, m.get$functionType(), m.definition.span, false); 12329 this._scope.create(m.name, m.get$functionType(), m.definition.span, false);
12243 } 12330 }
12244 this._usedTemps = new HashSetImplementation(); 12331 this._usedTemps = new HashSetImplementation();
12245 this._freeTemps = []; 12332 this._freeTemps = [];
12246 } 12333 }
12247 MethodGenerator.prototype.is$MethodGenerator = function(){return this;}; 12334 MethodGenerator.prototype.is$MethodGenerator = function(){return this;};
12248 MethodGenerator.prototype.is$TreeVisitor = function(){return this;}; 12335 MethodGenerator.prototype.is$TreeVisitor = function(){return this;};
12336 MethodGenerator.prototype.get$enclosingMethod = function() { return this.enclosi ngMethod; };
12337 MethodGenerator.prototype.set$enclosingMethod = function(value) { return this.en closingMethod = value; };
12338 MethodGenerator.prototype.get$needsThis = function() { return this.needsThis; };
12339 MethodGenerator.prototype.set$needsThis = function(value) { return this.needsThi s = value; };
12249 MethodGenerator.prototype.get$library = function() { 12340 MethodGenerator.prototype.get$library = function() {
12250 return this.method.get$library(); 12341 return this.method.get$library();
12251 } 12342 }
12252 MethodGenerator.prototype.findMembers = function(name) { 12343 MethodGenerator.prototype.findMembers = function(name) {
12253 return this.get$library()._findMembers(name); 12344 return this.get$library()._findMembers(name);
12254 } 12345 }
12255 MethodGenerator.prototype.get$isClosure = function() { 12346 MethodGenerator.prototype.get$isClosure = function() {
12256 return (this.enclosingMethod != null); 12347 return (this.enclosingMethod != null);
12257 } 12348 }
12258 MethodGenerator.prototype.get$isStatic = function() { 12349 MethodGenerator.prototype.get$isStatic = function() {
(...skipping 26 matching lines...) Expand all
12285 this._freeTemps.add(value.code); 12376 this._freeTemps.add(value.code);
12286 } 12377 }
12287 else { 12378 else {
12288 world.internalError(('tried to free unused value or non-temp "' + value.code + '"')); 12379 world.internalError(('tried to free unused value or non-temp "' + value.code + '"'));
12289 } 12380 }
12290 } 12381 }
12291 MethodGenerator.prototype.run = function() { 12382 MethodGenerator.prototype.run = function() {
12292 if ($notnull_bool(this.method.isGenerated)) return; 12383 if ($notnull_bool(this.method.isGenerated)) return;
12293 this.method.isGenerated = true; 12384 this.method.isGenerated = true;
12294 this.method.generator = this; 12385 this.method.generator = this;
12295 if ((this.method.get$definition().body instanceof NativeStatement)) { 12386 if ((this.method.get$definition().get$body() instanceof NativeStatement)) {
12296 if ($notnull_bool(this.method.get$definition().body.body == null)) { 12387 if ($notnull_bool(this.method.get$definition().get$body().get$body() == null )) {
12297 this.method.generator = null; 12388 this.method.generator = null;
12298 } 12389 }
12299 else { 12390 else {
12300 this._paramCode = map(this.method.get$parameters(), (function (p) { 12391 this._paramCode = map(this.method.get$parameters(), (function (p) {
12301 return p.get$name(); 12392 return p.get$name();
12302 }) 12393 })
12303 ); 12394 );
12304 this.writer.write($assert_String(this.method.get$definition().body.body)); 12395 this.writer.write($assert_String(this.method.get$definition().get$body().g et$body()));
12305 } 12396 }
12306 } 12397 }
12307 else { 12398 else {
12308 this.writeBody(); 12399 this.writeBody();
12309 } 12400 }
12310 } 12401 }
12311 MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { 12402 MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) {
12312 var $0; 12403 var $0;
12313 var paramCode = this._paramCode; 12404 var paramCode = this._paramCode;
12314 var names = null; 12405 var names = null;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
12403 var meth = (($0 = this.method) && $0.is$MethodMember()); 12494 var meth = (($0 = this.method) && $0.is$MethodMember());
12404 if ($notnull_bool(meth._provideOptionalParamInfo)) { 12495 if ($notnull_bool(meth._provideOptionalParamInfo)) {
12405 var optNames = []; 12496 var optNames = [];
12406 var optValues = []; 12497 var optValues = [];
12407 meth.genParameterValues(); 12498 meth.genParameterValues();
12408 var $list = meth.parameters; 12499 var $list = meth.parameters;
12409 for (var $i = 0;$i < $list.length; $i++) { 12500 for (var $i = 0;$i < $list.length; $i++) {
12410 var param = $list.$index($i); 12501 var param = $list.$index($i);
12411 if ($notnull_bool(param.get$isOptional())) { 12502 if ($notnull_bool(param.get$isOptional())) {
12412 optNames.add$1(param.get$name()); 12503 optNames.add$1(param.get$name());
12413 optValues.add$1(MethodGenerator._escapeString($assert_String(param.get $value().code))); 12504 optValues.add$1(MethodGenerator._escapeString($assert_String(param.get $value().get$code())));
12414 } 12505 }
12415 } 12506 }
12416 if (optNames.length > 0) { 12507 if (optNames.length > 0) {
12417 var start = ''; 12508 var start = '';
12418 if ($notnull_bool(meth.isStatic)) { 12509 if ($notnull_bool(meth.isStatic)) {
12419 if (!$notnull_bool(meth.declaringType.get$isTop())) { 12510 if (!$notnull_bool(meth.declaringType.get$isTop())) {
12420 start = meth.declaringType.get$jsname() + '.'; 12511 start = meth.declaringType.get$jsname() + '.';
12421 } 12512 }
12422 } 12513 }
12423 else { 12514 else {
12424 start = meth.declaringType.get$jsname() + '.prototype.'; 12515 start = meth.declaringType.get$jsname() + '.prototype.';
12425 } 12516 }
12426 optNames.addAll$1(optValues); 12517 optNames.addAll$1(optValues);
12427 var optional = "['" + Strings.join((optNames && optNames.is$List$String( )), "', '") + "']"; 12518 var optional = "['" + Strings.join((optNames && optNames.is$List$String( )), "', '") + "']";
12428 defWriter.writeln(('' + start + '' + meth.get$jsname() + '.\$optional = ' + optional + '')); 12519 defWriter.writeln(('' + start + '' + meth.get$jsname() + '.\$optional = ' + optional + ''));
12429 } 12520 }
12430 } 12521 }
12431 } 12522 }
12432 } 12523 }
12433 MethodGenerator.prototype.writeBody = function() { 12524 MethodGenerator.prototype.writeBody = function() {
12525 var $0;
12434 var initializers = null; 12526 var initializers = null;
12435 var initializedFields = null; 12527 var initializedFields = null;
12436 if ($notnull_bool(this.method.get$isConstructor())) { 12528 if ($notnull_bool(this.method.get$isConstructor())) {
12437 initializers = []; 12529 initializers = [];
12438 initializedFields = new HashSetImplementation(); 12530 initializedFields = new HashSetImplementation();
12439 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers() ); 12531 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers() );
12440 for (var $i = 0;$i < $list.length; $i++) { 12532 for (var $i = 0;$i < $list.length; $i++) {
12441 var f = $list.$index($i); 12533 var f = $list.$index($i);
12442 if ((f instanceof FieldMember) && !$notnull_bool(f.get$isStatic())) { 12534 if ((f instanceof FieldMember) && !$notnull_bool(f.get$isStatic())) {
12443 var cv = f.computeValue$0(); 12535 var cv = f.computeValue$0();
12444 if ($notnull_bool($ne(cv, null))) { 12536 if ($notnull_bool($ne(cv, null))) {
12445 initializers.add$1(('this.' + f.get$jsname() + ' = ' + cv.code + '')); 12537 initializers.add$1(('this.' + f.get$jsname() + ' = ' + cv.get$code() + ''));
12446 initializedFields.add$1(f.get$name()); 12538 initializedFields.add$1(f.get$name());
12447 } 12539 }
12448 } 12540 }
12449 } 12541 }
12450 } 12542 }
12451 this._paramCode = []; 12543 this._paramCode = [];
12452 var $list = this.method.get$parameters(); 12544 var $list = this.method.get$parameters();
12453 for (var $i = 0;$i < $list.length; $i++) { 12545 for (var $i = 0;$i < $list.length; $i++) {
12454 var p = $list.$index($i); 12546 var p = $list.$index($i);
12455 if ($notnull_bool($ne(initializers, null) && p.isInitializer)) { 12547 if ($notnull_bool($ne(initializers, null) && p.get$isInitializer())) {
12456 var field = this.method.declaringType.getMember(p.get$name()); 12548 var field = this.method.declaringType.getMember(p.get$name());
12457 if ($notnull_bool(field == null)) { 12549 if ($notnull_bool(field == null)) {
12458 world.error('bad this parameter - no matching field', p.get$definition() .get$span()); 12550 world.error('bad this parameter - no matching field', (($0 = p.get$defin ition().get$span()) && $0.is$SourceSpan()));
12459 } 12551 }
12460 if (!$notnull_bool(field.get$isField())) { 12552 if (!$notnull_bool(field.get$isField())) {
12461 world.error(('"this.' + p.get$name() + '" does not refer to a field'), p .get$definition().get$span()); 12553 world.error(('"this.' + p.get$name() + '" does not refer to a field'), ( ($0 = p.get$definition().get$span()) && $0.is$SourceSpan()));
12462 } 12554 }
12463 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def inition().get$span(), false); 12555 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def inition().get$span(), false);
12464 this._paramCode.add(paramValue.code); 12556 this._paramCode.add(paramValue.get$code());
12465 initializers.add$1(('this.' + field.get$jsname() + ' = ' + paramValue.code + ';')); 12557 initializers.add$1(('this.' + field.get$jsname() + ' = ' + paramValue.get$ code() + ';'));
12466 initializedFields.add$1(p.get$name()); 12558 initializedFields.add$1(p.get$name());
12467 } 12559 }
12468 else { 12560 else {
12469 var paramValue = this._scope.declareParameter((p && p.is$Parameter())); 12561 var paramValue = this._scope.declareParameter((p && p.is$Parameter()));
12470 this._paramCode.add(paramValue.code); 12562 this._paramCode.add(paramValue.get$code());
12471 } 12563 }
12472 } 12564 }
12473 var body = this.method.get$definition().body; 12565 var body = this.method.get$definition().get$body();
12474 if ($notnull_bool(body == null && !$notnull_bool(this.method.get$isConstructor ()))) { 12566 if ($notnull_bool(body == null && !$notnull_bool(this.method.get$isConstructor ()))) {
12475 world.error(('unexpected empty body for ' + this.method.name + ''), this.met hod.get$definition().get$span()); 12567 world.error(('unexpected empty body for ' + this.method.name + ''), (($0 = t his.method.get$definition().get$span()) && $0.is$SourceSpan()));
12476 } 12568 }
12477 if ($notnull_bool($ne(initializers, null))) { 12569 if ($notnull_bool($ne(initializers, null))) {
12478 for (var $i = initializers.iterator$0(); $i.hasNext$0(); ) { 12570 for (var $i = initializers.iterator$0(); $i.hasNext$0(); ) {
12479 var i = $i.next$0(); 12571 var i = $i.next$0();
12480 this.writer.writeln($assert_String(i)); 12572 this.writer.writeln($assert_String(i));
12481 } 12573 }
12482 var declaredInitializers = this.method.get$definition().initializers; 12574 var declaredInitializers = this.method.get$definition().get$initializers();
12483 if (declaredInitializers != null) { 12575 if ($notnull_bool($ne(declaredInitializers, null))) {
12484 var initializerCall = null; 12576 var initializerCall = null;
12485 for (var $i = 0;$i < declaredInitializers.length; $i++) { 12577 for (var $i = declaredInitializers.iterator$0(); $i.hasNext$0(); ) {
12486 var init = declaredInitializers.$index($i); 12578 var init = $i.next$0();
12487 if ((init instanceof CallExpression)) { 12579 if ((init instanceof CallExpression)) {
12488 if ($notnull_bool($ne(initializerCall, null))) { 12580 if ($notnull_bool($ne(initializerCall, null))) {
12489 world.error('only one initializer redirecting call is allowed', init .get$span()); 12581 world.error('only one initializer redirecting call is allowed', (($0 = init.get$span()) && $0.is$SourceSpan()));
12490 } 12582 }
12491 initializerCall = init; 12583 initializerCall = init;
12492 } 12584 }
12493 else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign( init.op.kind) == 0) { 12585 else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign( $assert_num(init.get$op().get$kind())) == 0) {
12494 var left = init.x; 12586 var left = init.get$x();
12495 if (!((left instanceof DotExpression) && (left.self instanceof ThisExp ression) || (left instanceof VarExpression))) { 12587 if (!((left instanceof DotExpression) && (left.get$self() instanceof T hisExpression) || (left instanceof VarExpression))) {
12496 world.error('invalid left side of initializer', left.get$span()); 12588 world.error('invalid left side of initializer', (($0 = left.get$span ()) && $0.is$SourceSpan()));
12497 continue; 12589 continue;
12498 } 12590 }
12499 var f = this.method.declaringType.getMember(left.get$name().get$name() ); 12591 var f = this.method.declaringType.getMember(left.get$name().get$name() );
12500 if ($notnull_bool(f == null)) { 12592 if ($notnull_bool(f == null)) {
12501 world.error('bad initializer - no matching field', left.get$span()); 12593 world.error('bad initializer - no matching field', (($0 = left.get$s pan()) && $0.is$SourceSpan()));
12502 continue; 12594 continue;
12503 } 12595 }
12504 else if (!$notnull_bool(f.get$isField())) { 12596 else if (!$notnull_bool(f.get$isField())) {
12505 world.error(('"' + left.get$name().get$name() + '" does not refer to a field'), left.get$span()); 12597 world.error(('"' + left.get$name().get$name() + '" does not refer to a field'), (($0 = left.get$span()) && $0.is$SourceSpan()));
12506 continue; 12598 continue;
12507 } 12599 }
12508 initializedFields.add$1(f.get$name()); 12600 initializedFields.add$1(f.get$name());
12509 this.writer.writeln(('this.' + f.get$jsname() + ' = ' + this.visitValu e(init.y).code + ';')); 12601 this.writer.writeln(('this.' + f.get$jsname() + ' = ' + this.visitValu e((($0 = init.get$y()) && $0.is$lang_Expression())).get$code() + ';'));
12510 } 12602 }
12511 else { 12603 else {
12512 world.error('invalid initializer', init.get$span()); 12604 world.error('invalid initializer', (($0 = init.get$span()) && $0.is$So urceSpan()));
12513 } 12605 }
12514 } 12606 }
12515 if ($notnull_bool($ne(initializerCall, null))) { 12607 if ($notnull_bool($ne(initializerCall, null))) {
12516 var target = this._writeInitializerCall((initializerCall && initializerC all.is$CallExpression())); 12608 var target = this._writeInitializerCall((initializerCall && initializerC all.is$CallExpression()));
12517 if (!$notnull_bool(target.isSuper)) { 12609 if (!$notnull_bool(target.get$isSuper())) {
12518 if (initializers.length > 0) { 12610 if (initializers.length > 0) {
12519 var $list = this.method.get$parameters(); 12611 var $list = this.method.get$parameters();
12520 for (var $i = 0;$i < $list.length; $i++) { 12612 for (var $i = 0;$i < $list.length; $i++) {
12521 var p = $list.$index($i); 12613 var p = $list.$index($i);
12522 if ($notnull_bool(p.isInitializer)) { 12614 if ($notnull_bool(p.get$isInitializer())) {
12523 world.error('no initialization allowed on redirecting constructo rs', p.get$definition().get$span()); 12615 world.error('no initialization allowed on redirecting constructo rs', (($0 = p.get$definition().get$span()) && $0.is$SourceSpan()));
12524 break; 12616 break;
12525 } 12617 }
12526 } 12618 }
12527 } 12619 }
12528 if (declaredInitializers.length > 1) { 12620 if (declaredInitializers.length > 1) {
12529 var init = $notnull_bool($eq(declaredInitializers.$index(0), initial izerCall)) ? declaredInitializers.$index(1) : declaredInitializers.$index(0); 12621 var init0 = $notnull_bool($eq(declaredInitializers.$index(0), initia lizerCall)) ? declaredInitializers.$index(1) : declaredInitializers.$index(0);
12530 world.error('no initialization allowed on redirecting constructors', init.get$span()); 12622 world.error('no initialization allowed on redirecting constructors', (($0 = init0.get$span()) && $0.is$SourceSpan()));
12531 } 12623 }
12532 initializedFields = null; 12624 initializedFields = null;
12533 } 12625 }
12534 } 12626 }
12535 else { 12627 else {
12536 } 12628 }
12537 } 12629 }
12538 this.writer.comment('// Initializers done'); 12630 this.writer.comment('// Initializers done');
12539 } 12631 }
12540 if ($notnull_bool($ne(initializedFields, null))) { 12632 if ($notnull_bool($ne(initializedFields, null))) {
12541 var $list = this.method.declaringType.get$members().getKeys(); 12633 var $list = this.method.declaringType.get$members().getKeys();
12542 for (var $i = this.method.declaringType.get$members().getKeys().iterator$0() ; $i.hasNext$0(); ) { 12634 for (var $i = this.method.declaringType.get$members().getKeys().iterator$0() ; $i.hasNext$0(); ) {
12543 var name = $i.next$0(); 12635 var name = $i.next$0();
12544 var member = this.method.declaringType.get$members().$index(name); 12636 var member = this.method.declaringType.get$members().$index(name);
12545 if ($notnull_bool((member instanceof FieldMember) && member.isFinal) && !$ notnull_bool(member.get$isStatic()) && !$notnull_bool(initializedFields.contains $1(name))) { 12637 if ($notnull_bool((member instanceof FieldMember) && member.get$isFinal()) && !$notnull_bool(member.get$isStatic()) && !$notnull_bool(initializedFields.co ntains$1(name))) {
12546 world.error(('Field "' + name + '" is final and was not initialized'), t his.method.get$definition().get$span()); 12638 world.error(('Field "' + name + '" is final and was not initialized'), ( ($0 = this.method.get$definition().get$span()) && $0.is$SourceSpan()));
12547 } 12639 }
12548 } 12640 }
12549 } 12641 }
12550 this.visitStatementsInBlock((body && body.is$lang_Statement())); 12642 this.visitStatementsInBlock((body && body.is$lang_Statement()));
12551 } 12643 }
12552 MethodGenerator.prototype._writeInitializerCall = function(node) { 12644 MethodGenerator.prototype._writeInitializerCall = function(node) {
12553 var contructorName = ''; 12645 var contructorName = '';
12554 var targetExp = node.target; 12646 var targetExp = node.target;
12555 if ((targetExp instanceof DotExpression)) { 12647 if ((targetExp instanceof DotExpression)) {
12556 var dot = (targetExp && targetExp.is$DotExpression()); 12648 var dot = (targetExp && targetExp.is$DotExpression());
12557 targetExp = dot.self; 12649 targetExp = dot.self;
12558 contructorName = dot.name.name; 12650 contructorName = dot.name.name;
12559 } 12651 }
12560 var target = null; 12652 var target = null;
12561 if ((targetExp instanceof SuperExpression)) { 12653 if ((targetExp instanceof SuperExpression)) {
12562 target = this._makeSuperValue((targetExp && targetExp.is$lang_Node())); 12654 target = this._makeSuperValue((targetExp && targetExp.is$lang_Node()));
12563 } 12655 }
12564 else if ((targetExp instanceof ThisExpression)) { 12656 else if ((targetExp instanceof ThisExpression)) {
12565 target = this._makeThisValue((targetExp && targetExp.is$lang_Node())); 12657 target = this._makeThisValue((targetExp && targetExp.is$lang_Node()));
12566 } 12658 }
12567 else { 12659 else {
12568 world.error('bad call in initializers', node.span); 12660 world.error('bad call in initializers', node.span);
12569 } 12661 }
12570 var m = target.type.getConstructor$1(contructorName); 12662 var m = target.get$type().getConstructor$1(contructorName);
12571 this.method.set$initDelegate(m); 12663 this.method.set$initDelegate(m);
12572 var other = m; 12664 var other = m;
12573 while ($notnull_bool($ne(other, null))) { 12665 while ($notnull_bool($ne(other, null))) {
12574 if ($notnull_bool($eq(other, this.method))) { 12666 if ($notnull_bool($eq(other, this.method))) {
12575 world.error('initialization cycle', node.span); 12667 world.error('initialization cycle', node.span);
12576 break; 12668 break;
12577 } 12669 }
12578 other = other.get$initDelegate(); 12670 other = other.get$initDelegate();
12579 } 12671 }
12580 world.gen.genMethod((m && m.is$Member())); 12672 world.gen.genMethod((m && m.is$Member()));
12581 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments)); 12673 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments));
12582 if ($notnull_bool($ne(target.type, world.objectType))) { 12674 if ($notnull_bool($ne(target.get$type(), world.objectType))) {
12583 this.writer.writeln(('' + value.code + ';')); 12675 this.writer.writeln(('' + value.get$code() + ';'));
12584 } 12676 }
12585 return (target && target.is$Value()); 12677 return (target && target.is$Value());
12586 } 12678 }
12587 MethodGenerator.prototype._makeArgs = function(arguments) { 12679 MethodGenerator.prototype._makeArgs = function(arguments) {
12588 var $0; 12680 var $0;
12589 var args = []; 12681 var args = [];
12590 var seenLabel = false; 12682 var seenLabel = false;
12591 for (var $i = 0;$i < arguments.length; $i++) { 12683 for (var $i = 0;$i < arguments.length; $i++) {
12592 var arg = arguments.$index($i); 12684 var arg = arguments.$index($i);
12593 if (arg.label != null) { 12685 if ($notnull_bool($ne(arg.get$label(), null))) {
12594 seenLabel = true; 12686 seenLabel = true;
12595 } 12687 }
12596 else if ($notnull_bool(seenLabel)) { 12688 else if ($notnull_bool(seenLabel)) {
12597 world.error('bare argument can not follow named arguments', arg.get$span() ); 12689 world.error('bare argument can not follow named arguments', (($0 = arg.get $span()) && $0.is$SourceSpan()));
12598 } 12690 }
12599 args.add$1(this.visitValue((($0 = arg.get$value()) && $0.is$lang_Expression( )))); 12691 args.add$1(this.visitValue((($0 = arg.get$value()) && $0.is$lang_Expression( ))));
12600 } 12692 }
12601 return new Arguments(arguments, args); 12693 return new Arguments(arguments, args);
12602 } 12694 }
12603 MethodGenerator._escapeString = function(text) { 12695 MethodGenerator._escapeString = function(text) {
12604 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', ' \\n').replaceAll('\r', '\\r'); 12696 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', ' \\n').replaceAll('\r', '\\r');
12605 } 12697 }
12606 MethodGenerator.prototype.visitStatementsInBlock = function(body) { 12698 MethodGenerator.prototype.visitStatementsInBlock = function(body) {
12607 if ((body instanceof BlockStatement)) { 12699 if ((body instanceof BlockStatement)) {
(...skipping 10 matching lines...) Expand all
12618 return false; 12710 return false;
12619 } 12711 }
12620 MethodGenerator.prototype._pushBlock = function(reentrant) { 12712 MethodGenerator.prototype._pushBlock = function(reentrant) {
12621 this._scope = new BlockScope(this, this._scope, reentrant); 12713 this._scope = new BlockScope(this, this._scope, reentrant);
12622 } 12714 }
12623 MethodGenerator.prototype._popBlock = function() { 12715 MethodGenerator.prototype._popBlock = function() {
12624 this._scope = this._scope.parent; 12716 this._scope = this._scope.parent;
12625 } 12717 }
12626 MethodGenerator.prototype._makeLambdaMethod = function(name, func) { 12718 MethodGenerator.prototype._makeLambdaMethod = function(name, func) {
12627 var meth = new MethodMember(name, this.method.declaringType, func); 12719 var meth = new MethodMember(name, this.method.declaringType, func);
12628 meth.isLambda = true; 12720 meth.set$isLambda(true);
12629 meth.resolve$1(this.method.declaringType); 12721 meth.resolve$1(this.method.declaringType);
12630 world.gen.genMethod((meth && meth.is$Member()), this); 12722 world.gen.genMethod((meth && meth.is$Member()), this);
12631 return (meth && meth.is$MethodMember()); 12723 return (meth && meth.is$MethodMember());
12632 } 12724 }
12633 MethodGenerator.prototype.visitBool = function(node) { 12725 MethodGenerator.prototype.visitBool = function(node) {
12634 return this.visitValue(node).convertTo$3(this, world.nonNullBool, node); 12726 return this.visitValue(node).convertTo$3(this, world.nonNullBool, node);
12635 } 12727 }
12636 MethodGenerator.prototype.visitValue = function(node) { 12728 MethodGenerator.prototype.visitValue = function(node) {
12637 if (node == null) return null; 12729 if (node == null) return null;
12638 var value = node.visit(this); 12730 var value = node.visit(this);
12639 value.checkFirstClass$1(node.span); 12731 value.checkFirstClass$1(node.span);
12640 return value; 12732 return value;
12641 } 12733 }
12642 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) { 12734 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) {
12643 return this.visitValue(node).convertTo$3(this, expectedType, node); 12735 return this.visitValue(node).convertTo$3(this, expectedType, node);
12644 } 12736 }
12645 MethodGenerator.prototype.visitVoid = function(node) { 12737 MethodGenerator.prototype.visitVoid = function(node) {
12646 if ((node instanceof PostfixExpression)) { 12738 if ((node instanceof PostfixExpression)) {
12647 var value = this.visitPostfixExpression((node && node.is$PostfixExpression() ), true); 12739 var value = this.visitPostfixExpression((node && node.is$PostfixExpression() ), true);
12648 value.checkFirstClass$1(node.span); 12740 value.checkFirstClass$1(node.span);
12649 return value; 12741 return value;
12650 } 12742 }
12651 return this.visitValue(node); 12743 return this.visitValue(node);
12652 } 12744 }
12653 MethodGenerator.prototype.visitDietStatement = function(node) { 12745 MethodGenerator.prototype.visitDietStatement = function(node) {
12746 var $0;
12654 var parser = new lang_Parser(node.span.file, false, false, false, node.span.st art); 12747 var parser = new lang_Parser(node.span.file, false, false, false, node.span.st art);
12655 this.visitStatementsInBlock(parser.block$0()); 12748 this.visitStatementsInBlock((($0 = parser.block$0()) && $0.is$lang_Statement() ));
12656 return false; 12749 return false;
12657 } 12750 }
12658 MethodGenerator.prototype.visitVariableDefinition = function(node) { 12751 MethodGenerator.prototype.visitVariableDefinition = function(node) {
12659 var $0; 12752 var $0;
12660 var isFinal = false; 12753 var isFinal = false;
12661 if ($notnull_bool(node.modifiers != null && $eq(node.modifiers.$index(0).kind, 97/*TokenKind.FINAL*/))) { 12754 if ($notnull_bool(node.modifiers != null && $eq(node.modifiers.$index(0).get$k ind(), 97/*TokenKind.FINAL*/))) {
12662 isFinal = true; 12755 isFinal = true;
12663 } 12756 }
12664 this.writer.write('var '); 12757 this.writer.write('var ');
12665 var type = this.method.resolveType(node.type, false); 12758 var type = this.method.resolveType(node.type, false);
12666 for (var i = 0; 12759 for (var i = 0;
12667 i < node.names.length; i++) { 12760 i < node.names.length; i++) {
12668 var thisType = type; 12761 var thisType = type;
12669 if (i > 0) { 12762 if (i > 0) {
12670 this.writer.write(', '); 12763 this.writer.write(', ');
12671 } 12764 }
12672 var name = node.names.$index(i).get$name(); 12765 var name = node.names.$index(i).get$name();
12673 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr ession())); 12766 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr ession()));
12674 if ($notnull_bool(isFinal)) { 12767 if ($notnull_bool(isFinal)) {
12675 if ($notnull_bool(value == null)) { 12768 if ($notnull_bool(value == null)) {
12676 world.error('no value specified for final variable', node.span); 12769 world.error('no value specified for final variable', node.span);
12677 } 12770 }
12678 else { 12771 else {
12679 if ($notnull_bool(thisType.get$isVar())) thisType = value.type; 12772 if ($notnull_bool(thisType.get$isVar())) thisType = value.get$type();
12680 } 12773 }
12681 } 12774 }
12682 var val = this._scope.create($assert_String(name), (thisType && thisType.is$ lang_Type()), node.names.$index(i).get$span(), false); 12775 var val = this._scope.create($assert_String(name), (thisType && thisType.is$ lang_Type()), (($0 = node.names.$index(i).get$span()) && $0.is$SourceSpan()), fa lse);
12683 if ($notnull_bool(value == null)) { 12776 if ($notnull_bool(value == null)) {
12684 this.writer.write(('' + val.code + '')); 12777 this.writer.write(('' + val.get$code() + ''));
12685 } 12778 }
12686 else { 12779 else {
12687 value = value.convertTo$3(this, type, node.values.$index(i)); 12780 value = value.convertTo$3(this, type, node.values.$index(i));
12688 this.writer.write(('' + val.code + ' = ' + value.code + '')); 12781 this.writer.write(('' + val.get$code() + ' = ' + value.get$code() + ''));
12689 } 12782 }
12690 } 12783 }
12691 this.writer.writeln(';'); 12784 this.writer.writeln(';');
12692 return false; 12785 return false;
12693 } 12786 }
12694 MethodGenerator.prototype.visitFunctionDefinition = function(node) { 12787 MethodGenerator.prototype.visitFunctionDefinition = function(node) {
12695 var $0; 12788 var $0;
12696 var name = world.toJsIdentifier(node.name.name); 12789 var name = world.toJsIdentifier(node.name.name);
12697 var meth = this._makeLambdaMethod($assert_String(name), node); 12790 var meth = this._makeLambdaMethod($assert_String(name), node);
12698 var funcValue = this._scope.create($assert_String(name), (($0 = meth.get$funct ionType()) && $0.is$lang_Type()), this.method.get$definition().get$span(), false ); 12791 var funcValue = this._scope.create($assert_String(name), (($0 = meth.get$funct ionType()) && $0.is$lang_Type()), (($0 = this.method.get$definition().get$span() ) && $0.is$SourceSpan()), false);
12699 meth.generator.writeDefinition$2(this.writer); 12792 meth.get$generator().writeDefinition$2(this.writer);
12700 return false; 12793 return false;
12701 } 12794 }
12702 MethodGenerator.prototype.visitReturnStatement = function(node) { 12795 MethodGenerator.prototype.visitReturnStatement = function(node) {
12703 if (node.value == null) { 12796 if (node.value == null) {
12704 this.writer.writeln('return;'); 12797 this.writer.writeln('return;');
12705 } 12798 }
12706 else { 12799 else {
12707 if ($notnull_bool(this.method.get$isConstructor())) { 12800 if ($notnull_bool(this.method.get$isConstructor())) {
12708 world.error('return of value not allowed from constructor', node.span); 12801 world.error('return of value not allowed from constructor', node.span);
12709 } 12802 }
12710 var value = this.visitTypedValue(node.value, this.method.get$returnType()); 12803 var value = this.visitTypedValue(node.value, this.method.get$returnType());
12711 this.writer.writeln(('return ' + value.code + ';')); 12804 this.writer.writeln(('return ' + value.get$code() + ';'));
12712 } 12805 }
12713 return true; 12806 return true;
12714 } 12807 }
12715 MethodGenerator.prototype.visitThrowStatement = function(node) { 12808 MethodGenerator.prototype.visitThrowStatement = function(node) {
12716 if (node.value != null) { 12809 if (node.value != null) {
12717 var value = this.visitValue(node.value); 12810 var value = this.visitValue(node.value);
12718 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY()); 12811 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY());
12719 this.writer.writeln(('\$throw(' + value.code + ');')); 12812 this.writer.writeln(('\$throw(' + value.get$code() + ');'));
12720 world.gen.corejs.useThrow = true; 12813 world.gen.corejs.useThrow = true;
12721 } 12814 }
12722 else { 12815 else {
12723 var rethrow = this._scope.getRethrow(); 12816 var rethrow = this._scope.getRethrow();
12724 if ($notnull_bool(rethrow == null)) { 12817 if ($notnull_bool(rethrow == null)) {
12725 world.error('rethrow outside of catch', node.span); 12818 world.error('rethrow outside of catch', node.span);
12726 } 12819 }
12727 else { 12820 else {
12728 this.writer.writeln(('throw ' + rethrow.code + ';')); 12821 this.writer.writeln(('throw ' + rethrow.get$code() + ';'));
12729 } 12822 }
12730 } 12823 }
12731 return true; 12824 return true;
12732 } 12825 }
12733 MethodGenerator.prototype.visitAssertStatement = function(node) { 12826 MethodGenerator.prototype.visitAssertStatement = function(node) {
12734 var $0; 12827 var $0;
12735 var test = this.visitValue(node.test); 12828 var test = this.visitValue(node.test);
12736 if ($notnull_bool(options.enableAsserts)) { 12829 if ($notnull_bool(options.enableAsserts)) {
12737 var err = world.corelib.types.$index('AssertError'); 12830 var err = world.corelib.types.$index('AssertError');
12738 world.gen.genMethod((($0 = err.getConstructor$1('')) && $0.is$Member())); 12831 world.gen.genMethod((($0 = err.getConstructor$1('')) && $0.is$Member()));
12739 world.gen.genMethod((($0 = err.get$members().$index('toString')) && $0.is$Me mber())); 12832 world.gen.genMethod((($0 = err.get$members().$index('toString')) && $0.is$Me mber()));
12740 var span = node.test.span; 12833 var span = node.test.span;
12741 var line = span.file.getLine(span.start); 12834 var line = span.get$file().getLine$1(span.get$start());
12742 var column = span.file.getColumn($assert_num(line), span.start); 12835 var column = span.get$file().getColumn$2(line, span.get$start());
12743 this.writer.writeln(('\$assert(' + test.code + ', "' + MethodGenerator._esca peString(span.get$text()) + '",') + (' "' + basename(span.file.filename) + '", ' + (line + 1) + ', ' + (column + 1) + ');')); 12836 this.writer.writeln(('\$assert(' + test.get$code() + ', "' + MethodGenerator ._escapeString($assert_String(span.get$text())) + '",') + (' "' + basename($asse rt_String(span.get$file().get$filename())) + '", ' + (line + 1) + ', ' + (column + 1) + ');'));
12744 world.gen.corejs.useAssert = true; 12837 world.gen.corejs.useAssert = true;
12745 } 12838 }
12746 return false; 12839 return false;
12747 } 12840 }
12748 MethodGenerator.prototype.visitBreakStatement = function(node) { 12841 MethodGenerator.prototype.visitBreakStatement = function(node) {
12749 if (node.label == null) { 12842 if (node.label == null) {
12750 this.writer.writeln('break;'); 12843 this.writer.writeln('break;');
12751 } 12844 }
12752 else { 12845 else {
12753 this.writer.writeln(('break ' + node.label.name + ';')); 12846 this.writer.writeln(('break ' + node.label.name + ';'));
12754 } 12847 }
12755 return true; 12848 return true;
12756 } 12849 }
12757 MethodGenerator.prototype.visitContinueStatement = function(node) { 12850 MethodGenerator.prototype.visitContinueStatement = function(node) {
12758 if (node.label == null) { 12851 if (node.label == null) {
12759 this.writer.writeln('continue;'); 12852 this.writer.writeln('continue;');
12760 } 12853 }
12761 else { 12854 else {
12762 this.writer.writeln(('continue ' + node.label.name + ';')); 12855 this.writer.writeln(('continue ' + node.label.name + ';'));
12763 } 12856 }
12764 return true; 12857 return true;
12765 } 12858 }
12766 MethodGenerator.prototype.visitIfStatement = function(node) { 12859 MethodGenerator.prototype.visitIfStatement = function(node) {
12767 var test = this.visitBool(node.test); 12860 var test = this.visitBool(node.test);
12768 this.writer.write(('if (' + test.code + ') ')); 12861 this.writer.write(('if (' + test.get$code() + ') '));
12769 var exit1 = node.trueBranch.visit(this); 12862 var exit1 = node.trueBranch.visit(this);
12770 if (node.falseBranch != null) { 12863 if (node.falseBranch != null) {
12771 this.writer.write('else '); 12864 this.writer.write('else ');
12772 if ($notnull_bool(node.falseBranch.visit(this) && exit1)) { 12865 if ($notnull_bool(node.falseBranch.visit(this) && exit1)) {
12773 return true; 12866 return true;
12774 } 12867 }
12775 } 12868 }
12776 return false; 12869 return false;
12777 } 12870 }
12778 MethodGenerator.prototype.visitWhileStatement = function(node) { 12871 MethodGenerator.prototype.visitWhileStatement = function(node) {
12779 var test = this.visitBool(node.test); 12872 var test = this.visitBool(node.test);
12780 this.writer.write(('while (' + test.code + ') ')); 12873 this.writer.write(('while (' + test.get$code() + ') '));
12781 this._pushBlock(true); 12874 this._pushBlock(true);
12782 node.body.visit(this); 12875 node.body.visit(this);
12783 this._popBlock(); 12876 this._popBlock();
12784 return false; 12877 return false;
12785 } 12878 }
12786 MethodGenerator.prototype.visitDoStatement = function(node) { 12879 MethodGenerator.prototype.visitDoStatement = function(node) {
12787 this.writer.write('do '); 12880 this.writer.write('do ');
12788 this._pushBlock(true); 12881 this._pushBlock(true);
12789 node.body.visit(this); 12882 node.body.visit(this);
12790 this._popBlock(); 12883 this._popBlock();
12791 var test = this.visitBool(node.test); 12884 var test = this.visitBool(node.test);
12792 this.writer.writeln(('while (' + test.code + ')')); 12885 this.writer.writeln(('while (' + test.get$code() + ')'));
12793 return false; 12886 return false;
12794 } 12887 }
12795 MethodGenerator.prototype.visitForStatement = function(node) { 12888 MethodGenerator.prototype.visitForStatement = function(node) {
12796 this._pushBlock(false); 12889 this._pushBlock(false);
12797 this.writer.write('for ('); 12890 this.writer.write('for (');
12798 if (node.init != null) node.init.visit(this); 12891 if (node.init != null) node.init.visit(this);
12799 else this.writer.write(';'); 12892 else this.writer.write(';');
12800 if (node.test != null) { 12893 if (node.test != null) {
12801 var test = this.visitBool(node.test); 12894 var test = this.visitBool(node.test);
12802 this.writer.write((' ' + test.code + '; ')); 12895 this.writer.write((' ' + test.get$code() + '; '));
12803 } 12896 }
12804 else { 12897 else {
12805 this.writer.write('; '); 12898 this.writer.write('; ');
12806 } 12899 }
12807 var needsComma = false; 12900 var needsComma = false;
12808 var $list = node.step; 12901 var $list = node.step;
12809 for (var $i = 0;$i < $list.length; $i++) { 12902 for (var $i = 0;$i < $list.length; $i++) {
12810 var s = $list.$index($i); 12903 var s = $list.$index($i);
12811 if ($notnull_bool(needsComma)) this.writer.write(', '); 12904 if ($notnull_bool(needsComma)) this.writer.write(', ');
12812 var sv = this.visitVoid((s && s.is$lang_Expression())); 12905 var sv = this.visitVoid((s && s.is$lang_Expression()));
12813 this.writer.write($assert_String(sv.code)); 12906 this.writer.write($assert_String(sv.get$code()));
12814 needsComma = true; 12907 needsComma = true;
12815 } 12908 }
12816 this.writer.write(') '); 12909 this.writer.write(') ');
12817 this._pushBlock(true); 12910 this._pushBlock(true);
12818 node.body.visit(this); 12911 node.body.visit(this);
12819 this._popBlock(); 12912 this._popBlock();
12820 this._popBlock(); 12913 this._popBlock();
12821 return false; 12914 return false;
12822 } 12915 }
12823 MethodGenerator.prototype.visitForInStatement = function(node) { 12916 MethodGenerator.prototype.visitForInStatement = function(node) {
12824 var $0; 12917 var $0;
12825 var itemType = this.method.resolveType(node.item.type, false); 12918 var itemType = this.method.resolveType(node.item.type, false);
12826 var itemName = node.item.name.name; 12919 var itemName = node.item.name.name;
12827 var list = node.list.visit(this); 12920 var list = node.list.visit(this);
12828 this._pushBlock(true); 12921 this._pushBlock(true);
12829 var item = this._scope.create($assert_String(itemName), (itemType && itemType. is$lang_Type()), node.item.name.span, false); 12922 var item = this._scope.create($assert_String(itemName), (itemType && itemType. is$lang_Type()), node.item.name.span, false);
12830 var listVar = (list && list.is$Value()); 12923 var listVar = (list && list.is$Value());
12831 if ($notnull_bool(list.needsTemp)) { 12924 if ($notnull_bool(list.get$needsTemp())) {
12832 listVar = this._scope.create('\$list', (($0 = list.type) && $0.is$lang_Type( )), null, false); 12925 listVar = this._scope.create('\$list', (($0 = list.get$type()) && $0.is$lang _Type()), null, false);
12833 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';')); 12926 this.writer.writeln(('var ' + listVar.code + ' = ' + list.get$code() + ';')) ;
12834 } 12927 }
12835 if ($notnull_bool(list.type.get$isList())) { 12928 if ($notnull_bool(list.get$type().get$isList())) {
12836 var tmpi = this._scope.create('\$i', world.numType, null, false); 12929 var tmpi = this._scope.create('\$i', world.numType, null, false);
12837 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code + ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {')); 12930 this.writer.enterBlock(('for (var ' + tmpi.get$code() + ' = 0;') + ('' + tmp i.get$code() + ' < ' + listVar.code + '.length; ' + tmpi.get$code() + '++) {'));
12838 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [ tmpi]), false); 12931 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [ tmpi]), false);
12839 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';')); 12932 this.writer.writeln(('var ' + item.get$code() + ' = ' + value.get$code() + ' ;'));
12840 } 12933 }
12841 else { 12934 else {
12842 this._pushBlock(false); 12935 this._pushBlock(false);
12843 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT Y()); 12936 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT Y());
12844 var tmpi = this._scope.create('\$i', (($0 = iterator.type) && $0.is$lang_Typ e()), null, false); 12937 var tmpi = this._scope.create('\$i', (($0 = iterator.get$type()) && $0.is$la ng_Type()), null, false);
12845 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY( )); 12938 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY( ));
12846 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY()); 12939 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY());
12847 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + '; ' + hasNext.code + '; ) {')); 12940 this.writer.enterBlock(('for (var ' + tmpi.get$code() + ' = ' + iterator.get $code() + '; ' + hasNext.get$code() + '; ) {'));
12848 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';')); 12941 this.writer.writeln(('var ' + item.get$code() + ' = ' + next.get$code() + '; '));
12849 } 12942 }
12850 this.visitStatementsInBlock(node.body); 12943 this.visitStatementsInBlock(node.body);
12851 this.writer.exitBlock('}'); 12944 this.writer.exitBlock('}');
12852 this._popBlock(); 12945 this._popBlock();
12853 return false; 12946 return false;
12854 } 12947 }
12855 MethodGenerator.prototype._genToDartException = function(ex, node) { 12948 MethodGenerator.prototype._genToDartException = function(ex, node) {
12856 var types = const$397/*const [ 12949 var types = const$397/*const [
12857 'NullPointerException', 'ObjectNotClosureException', 12950 'NullPointerException', 'ObjectNotClosureException',
12858 'NoSuchMethodException', 'StackOverflowException']*/; 12951 'NoSuchMethodException', 'StackOverflowException']*/;
(...skipping 10 matching lines...) Expand all
12869 var $0; 12962 var $0;
12870 this.writer.enterBlock('try {'); 12963 this.writer.enterBlock('try {');
12871 this._pushBlock(false); 12964 this._pushBlock(false);
12872 this.visitStatementsInBlock(node.body); 12965 this.visitStatementsInBlock(node.body);
12873 this._popBlock(); 12966 this._popBlock();
12874 if (node.catches.length == 1) { 12967 if (node.catches.length == 1) {
12875 var catch_ = node.catches.$index(0); 12968 var catch_ = node.catches.$index(0);
12876 this._pushBlock(false); 12969 this._pushBlock(false);
12877 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare dIdentifier())); 12970 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare dIdentifier()));
12878 this._scope.rethrow = (ex && ex.is$Value()); 12971 this._scope.rethrow = (ex && ex.is$Value());
12879 this.writer.nextBlock(('} catch (' + ex.code + ') {')); 12972 this.writer.nextBlock(('} catch (' + ex.get$code() + ') {'));
12880 if (catch_.trace != null) { 12973 if ($notnull_bool($ne(catch_.get$trace(), null))) {
12881 var trace = this._scope.declare(catch_.trace); 12974 var trace = this._scope.declare((($0 = catch_.get$trace()) && $0.is$Declar edIdentifier()));
12882 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); 12975 this.writer.writeln(('var ' + trace.get$code() + ' = \$stackTraceOf(' + ex .get$code() + ');'));
12883 world.gen.corejs.useStackTraceOf = true; 12976 world.gen.corejs.useStackTraceOf = true;
12884 } 12977 }
12885 this._genToDartException($assert_String(ex.code), node); 12978 this._genToDartException($assert_String(ex.get$code()), node);
12886 if (!$notnull_bool(ex.type.get$isVar())) { 12979 if (!$notnull_bool(ex.get$type().get$isVar())) {
12887 var test = ex.instanceOf$3$isTrue$forceCheck(this, ex.type, catch_.get$exc eption().get$span(), false, true); 12980 var test = ex.instanceOf$3$isTrue$forceCheck(this, ex.get$type(), catch_.g et$exception().get$span(), false, true);
12888 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';')); 12981 this.writer.writeln(('if (' + test.get$code() + ') throw ' + ex.get$code() + ';'));
12889 } 12982 }
12890 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan g_Statement())); 12983 this.visitStatementsInBlock((($0 = node.catches.$index(0).get$body()) && $0. is$lang_Statement()));
12891 this._popBlock(); 12984 this._popBlock();
12892 } 12985 }
12893 else if (node.catches.length > 0) { 12986 else if (node.catches.length > 0) {
12894 this._pushBlock(false); 12987 this._pushBlock(false);
12895 var ex = this._scope.create('\$ex', world.varType, null, false); 12988 var ex = this._scope.create('\$ex', world.varType, null, false);
12896 this._scope.rethrow = (ex && ex.is$Value()); 12989 this._scope.rethrow = (ex && ex.is$Value());
12897 this.writer.nextBlock(('} catch (' + ex.code + ') {')); 12990 this.writer.nextBlock(('} catch (' + ex.get$code() + ') {'));
12898 var trace = null; 12991 var trace = null;
12899 if (node.catches.some((function (c) { 12992 if (node.catches.some((function (c) {
12900 return c.trace != null; 12993 return $ne(c.get$trace(), null);
12901 }) 12994 })
12902 )) { 12995 )) {
12903 trace = this._scope.create('\$trace', world.varType, null, false); 12996 trace = this._scope.create('\$trace', world.varType, null, false);
12904 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); 12997 this.writer.writeln(('var ' + trace.get$code() + ' = \$stackTraceOf(' + ex .get$code() + ');'));
12905 world.gen.corejs.useStackTraceOf = true; 12998 world.gen.corejs.useStackTraceOf = true;
12906 } 12999 }
12907 this._genToDartException($assert_String(ex.code), node); 13000 this._genToDartException($assert_String(ex.get$code()), node);
12908 var needsRethrow = true; 13001 var needsRethrow = true;
12909 for (var i = 0; 13002 for (var i = 0;
12910 i < node.catches.length; i++) { 13003 i < node.catches.length; i++) {
12911 var catch_ = node.catches.$index(i); 13004 var catch_ = node.catches.$index(i);
12912 this._pushBlock(false); 13005 this._pushBlock(false);
12913 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl aredIdentifier())); 13006 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl aredIdentifier()));
12914 if (!$notnull_bool(tmp.type.get$isVar())) { 13007 if (!$notnull_bool(tmp.get$type().get$isVar())) {
12915 var test = ex.instanceOf$3$isTrue$forceCheck(this, tmp.type, catch_.get$ exception().get$span(), true, true); 13008 var test = ex.instanceOf$3$isTrue$forceCheck(this, tmp.get$type(), catch _.get$exception().get$span(), true, true);
12916 if (i == 0) { 13009 if (i == 0) {
12917 this.writer.enterBlock(('if (' + test.code + ') {')); 13010 this.writer.enterBlock(('if (' + test.get$code() + ') {'));
12918 } 13011 }
12919 else { 13012 else {
12920 this.writer.nextBlock(('} else if (' + test.code + ') {')); 13013 this.writer.nextBlock(('} else if (' + test.get$code() + ') {'));
12921 } 13014 }
12922 } 13015 }
12923 else if (i > 0) { 13016 else if (i > 0) {
12924 this.writer.nextBlock('} else {'); 13017 this.writer.nextBlock('} else {');
12925 } 13018 }
12926 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';')); 13019 this.writer.writeln(('var ' + tmp.get$code() + ' = ' + ex.get$code() + ';' ));
12927 if (catch_.trace != null) { 13020 if ($notnull_bool($ne(catch_.get$trace(), null))) {
12928 var tmptrace = this._scope.declare(catch_.trace); 13021 var tmptrace = this._scope.declare((($0 = catch_.get$trace()) && $0.is$D eclaredIdentifier()));
12929 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';')) ; 13022 this.writer.writeln(('var ' + tmptrace.get$code() + ' = ' + trace.get$co de() + ';'));
12930 } 13023 }
12931 this.visitStatementsInBlock((($0 = catch_.body) && $0.is$lang_Statement()) ); 13024 this.visitStatementsInBlock((($0 = catch_.get$body()) && $0.is$lang_Statem ent()));
12932 this._popBlock(); 13025 this._popBlock();
12933 if ($notnull_bool(tmp.type.get$isVar())) { 13026 if ($notnull_bool(tmp.get$type().get$isVar())) {
12934 if (i + 1 < node.catches.length) { 13027 if (i + 1 < node.catches.length) {
12935 world.warning('Unreachable catch clause', (($0 = node.catches.$index(i + 1)) && $0.is$SourceSpan())); 13028 world.warning('Unreachable catch clause', (($0 = node.catches.$index(i + 1)) && $0.is$SourceSpan()));
12936 } 13029 }
12937 if (i > 0) { 13030 if (i > 0) {
12938 this.writer.exitBlock('}'); 13031 this.writer.exitBlock('}');
12939 } 13032 }
12940 needsRethrow = false; 13033 needsRethrow = false;
12941 break; 13034 break;
12942 } 13035 }
12943 } 13036 }
12944 if ($notnull_bool(needsRethrow)) { 13037 if ($notnull_bool(needsRethrow)) {
12945 this.writer.nextBlock('} else {'); 13038 this.writer.nextBlock('} else {');
12946 this.writer.writeln(('throw ' + ex.code + ';')); 13039 this.writer.writeln(('throw ' + ex.get$code() + ';'));
12947 this.writer.exitBlock('}'); 13040 this.writer.exitBlock('}');
12948 } 13041 }
12949 this._popBlock(); 13042 this._popBlock();
12950 } 13043 }
12951 if (node.finallyBlock != null) { 13044 if (node.finallyBlock != null) {
12952 this.writer.nextBlock('} finally {'); 13045 this.writer.nextBlock('} finally {');
12953 this._pushBlock(false); 13046 this._pushBlock(false);
12954 this.visitStatementsInBlock(node.finallyBlock); 13047 this.visitStatementsInBlock(node.finallyBlock);
12955 this._popBlock(); 13048 this._popBlock();
12956 } 13049 }
12957 this.writer.exitBlock('}'); 13050 this.writer.exitBlock('}');
12958 return false; 13051 return false;
12959 } 13052 }
12960 MethodGenerator.prototype.visitSwitchStatement = function(node) { 13053 MethodGenerator.prototype.visitSwitchStatement = function(node) {
13054 var $0;
12961 var test = this.visitValue(node.test); 13055 var test = this.visitValue(node.test);
12962 this.writer.enterBlock(('switch (' + test.code + ') {')); 13056 this.writer.enterBlock(('switch (' + test.get$code() + ') {'));
12963 var $list = node.cases; 13057 var $list = node.cases;
12964 for (var $i = 0;$i < $list.length; $i++) { 13058 for (var $i = 0;$i < $list.length; $i++) {
12965 var case_ = $list.$index($i); 13059 var case_ = $list.$index($i);
12966 if (case_.label != null) { 13060 if ($notnull_bool($ne(case_.get$label(), null))) {
12967 world.error('unimplemented: labeled case statement', case_.get$span()); 13061 world.error('unimplemented: labeled case statement', (($0 = case_.get$span ()) && $0.is$SourceSpan()));
12968 } 13062 }
12969 this._pushBlock(false); 13063 this._pushBlock(false);
12970 for (var i = 0; 13064 for (var i = 0;
12971 i < case_.cases.length; i++) { 13065 i < $assert_num(case_.get$cases().length); i++) {
12972 var expr = case_.cases.$index(i); 13066 var expr = case_.get$cases().$index(i);
12973 if ($notnull_bool(expr == null)) { 13067 if ($notnull_bool(expr == null)) {
12974 if (i < case_.cases.length - 1) { 13068 if (i < case_.get$cases().length - 1) {
12975 world.error('default clause must be the last case', case_.get$span()); 13069 world.error('default clause must be the last case', (($0 = case_.get$s pan()) && $0.is$SourceSpan()));
12976 } 13070 }
12977 this.writer.writeln('default:'); 13071 this.writer.writeln('default:');
12978 } 13072 }
12979 else { 13073 else {
12980 var value = this.visitValue((expr && expr.is$lang_Expression())); 13074 var value = this.visitValue((expr && expr.is$lang_Expression()));
12981 this.writer.writeln(('case ' + value.code + ':')); 13075 this.writer.writeln(('case ' + value.get$code() + ':'));
12982 } 13076 }
12983 } 13077 }
12984 this.writer.enterBlock(''); 13078 this.writer.enterBlock('');
12985 var caseExits = this._visitAllStatements(case_.statements, false); 13079 var caseExits = this._visitAllStatements(case_.get$statements(), false);
12986 if ($notnull_bool($ne(case_, node.cases.$index(node.cases.length - 1)) && !$ notnull_bool(caseExits))) { 13080 if ($notnull_bool($ne(case_, node.cases.$index(node.cases.length - 1)) && !$ notnull_bool(caseExits))) {
12987 var span = case_.statements.$index(case_.statements.length - 1).get$span() ; 13081 var span = case_.get$statements().$index(case_.get$statements().length - 1 ).get$span();
12988 this.writer.writeln('\$throw(new FallThroughError());'); 13082 this.writer.writeln('\$throw(new FallThroughError());');
12989 world.gen.corejs.useThrow = true; 13083 world.gen.corejs.useThrow = true;
12990 } 13084 }
12991 this.writer.exitBlock(''); 13085 this.writer.exitBlock('');
12992 this._popBlock(); 13086 this._popBlock();
12993 } 13087 }
12994 this.writer.exitBlock('}'); 13088 this.writer.exitBlock('}');
12995 return false; 13089 return false;
12996 } 13090 }
12997 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { 13091 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) {
13092 var $0;
12998 for (var i = 0; 13093 for (var i = 0;
12999 i < statementList.length; i++) { 13094 i < $assert_num(statementList.length); i++) {
13000 var stmt = statementList.$index(i); 13095 var stmt = statementList.$index(i);
13001 exits = stmt.visit$1(this); 13096 exits = stmt.visit$1(this);
13002 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1)) && exits)) { 13097 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1)) && exits)) {
13003 world.warning('unreachable code', statementList.$index(i + 1).get$span()); 13098 world.warning('unreachable code', (($0 = statementList.$index(i + 1).get$s pan()) && $0.is$SourceSpan()));
13004 } 13099 }
13005 } 13100 }
13006 return $assert_bool(exits); 13101 return $assert_bool(exits);
13007 } 13102 }
13008 MethodGenerator.prototype.visitBlockStatement = function(node) { 13103 MethodGenerator.prototype.visitBlockStatement = function(node) {
13009 this._pushBlock(false); 13104 this._pushBlock(false);
13010 this.writer.enterBlock('{'); 13105 this.writer.enterBlock('{');
13011 var exits = this._visitAllStatements(node.body, false); 13106 var exits = this._visitAllStatements(node.body, false);
13012 this.writer.exitBlock('}'); 13107 this.writer.exitBlock('}');
13013 this._popBlock(); 13108 this._popBlock();
13014 return $assert_bool(exits); 13109 return $assert_bool(exits);
13015 } 13110 }
13016 MethodGenerator.prototype.visitLabeledStatement = function(node) { 13111 MethodGenerator.prototype.visitLabeledStatement = function(node) {
13017 this.writer.writeln(('' + node.name.name + ':')); 13112 this.writer.writeln(('' + node.name.name + ':'));
13018 node.body.visit(this); 13113 node.body.visit(this);
13019 return false; 13114 return false;
13020 } 13115 }
13021 MethodGenerator.prototype.visitExpressionStatement = function(node) { 13116 MethodGenerator.prototype.visitExpressionStatement = function(node) {
13022 if ((node.body instanceof VarExpression) || (node.body instanceof ThisExpressi on)) { 13117 if ((node.body instanceof VarExpression) || (node.body instanceof ThisExpressi on)) {
13023 world.warning('variable used as statement', node.span); 13118 world.warning('variable used as statement', node.span);
13024 } 13119 }
13025 var value = this.visitVoid(node.body); 13120 var value = this.visitVoid(node.body);
13026 this.writer.writeln(('' + value.code + ';')); 13121 this.writer.writeln(('' + value.get$code() + ';'));
13027 return false; 13122 return false;
13028 } 13123 }
13029 MethodGenerator.prototype.visitEmptyStatement = function(node) { 13124 MethodGenerator.prototype.visitEmptyStatement = function(node) {
13030 this.writer.writeln(';'); 13125 this.writer.writeln(';');
13031 return false; 13126 return false;
13032 } 13127 }
13033 MethodGenerator.prototype._checkNonStatic = function(node) { 13128 MethodGenerator.prototype._checkNonStatic = function(node) {
13034 if ($notnull_bool(this.get$isStatic())) { 13129 if ($notnull_bool(this.get$isStatic())) {
13035 world.warning('not allowed in static method', node.span); 13130 world.warning('not allowed in static method', node.span);
13036 } 13131 }
13037 } 13132 }
13038 MethodGenerator.prototype._makeSuperValue = function(node) { 13133 MethodGenerator.prototype._makeSuperValue = function(node) {
13039 var parentType = this.method.declaringType.get$parent(); 13134 var parentType = this.method.declaringType.get$parent();
13040 this._checkNonStatic(node); 13135 this._checkNonStatic(node);
13041 if ($notnull_bool(parentType == null)) { 13136 if ($notnull_bool(parentType == null)) {
13042 world.error('no super class', node.span); 13137 world.error('no super class', node.span);
13043 } 13138 }
13044 var ret = new Value(parentType, 'this', node.span, false); 13139 var ret = new Value(parentType, 'this', node.span, false);
13045 ret.isSuper = true; 13140 ret.set$isSuper(true);
13046 return ret; 13141 return ret;
13047 } 13142 }
13048 MethodGenerator.prototype._getOutermostMethod = function() { 13143 MethodGenerator.prototype._getOutermostMethod = function() {
13049 var result = this; 13144 var result = this;
13050 while (result.enclosingMethod != null) { 13145 while ($notnull_bool($ne(result.get$enclosingMethod(), null))) {
13051 result = result.enclosingMethod; 13146 result = result.get$enclosingMethod();
13052 } 13147 }
13053 return result; 13148 return result;
13054 } 13149 }
13055 MethodGenerator.prototype._makeThisCode = function() { 13150 MethodGenerator.prototype._makeThisCode = function() {
13056 if (this.enclosingMethod != null) { 13151 if (this.enclosingMethod != null) {
13057 this._getOutermostMethod().needsThis = true; 13152 this._getOutermostMethod().set$needsThis(true);
13058 return '\$this'; 13153 return '\$this';
13059 } 13154 }
13060 else { 13155 else {
13061 return 'this'; 13156 return 'this';
13062 } 13157 }
13063 } 13158 }
13064 MethodGenerator.prototype._makeThisValue = function(node) { 13159 MethodGenerator.prototype._makeThisValue = function(node) {
13065 if (this.enclosingMethod != null) { 13160 if (this.enclosingMethod != null) {
13066 var outermostMethod = this._getOutermostMethod(); 13161 var outermostMethod = this._getOutermostMethod();
13067 outermostMethod._checkNonStatic(node); 13162 outermostMethod._checkNonStatic(node);
13068 outermostMethod.needsThis = true; 13163 outermostMethod.set$needsThis(true);
13069 return new Value(outermostMethod.method.declaringType, '\$this', node != nul l ? node.span : null, false); 13164 return new Value(outermostMethod.method.get$declaringType(), '\$this', node != null ? node.span : null, false);
13070 } 13165 }
13071 else { 13166 else {
13072 this._checkNonStatic(node); 13167 this._checkNonStatic(node);
13073 return new Value(this.method.declaringType, 'this', node != null ? node.span : null, false); 13168 return new Value(this.method.declaringType, 'this', node != null ? node.span : null, false);
13074 } 13169 }
13075 } 13170 }
13076 MethodGenerator.prototype.visitLambdaExpression = function(node) { 13171 MethodGenerator.prototype.visitLambdaExpression = function(node) {
13077 var name = ''; 13172 var name = '';
13078 if (node.func.name != null) { 13173 if (node.func.name != null) {
13079 name = world.toJsIdentifier(node.func.name.name); 13174 name = world.toJsIdentifier(node.func.name.name);
13080 } 13175 }
13081 var meth = this._makeLambdaMethod($assert_String(name), node.func); 13176 var meth = this._makeLambdaMethod($assert_String(name), node.func);
13082 var w = new CodeWriter(); 13177 var w = new CodeWriter();
13083 meth.generator.writeDefinition$2(w, node); 13178 meth.get$generator().writeDefinition$2(w, node);
13084 return new Value(meth.get$functionType(), w.get$text(), node.span, true); 13179 return new Value(meth.get$functionType(), w.get$text(), node.span, true);
13085 } 13180 }
13086 MethodGenerator.prototype.visitCallExpression = function(node) { 13181 MethodGenerator.prototype.visitCallExpression = function(node) {
13087 var $0; 13182 var $0;
13088 var target; 13183 var target;
13089 var position = node.target; 13184 var position = node.target;
13090 var name = '\$call'; 13185 var name = '\$call';
13091 if ((node.target instanceof DotExpression)) { 13186 if ((node.target instanceof DotExpression)) {
13092 var dot = (($0 = node.target) && $0.is$DotExpression()); 13187 var dot = (($0 = node.target) && $0.is$DotExpression());
13093 target = dot.self.visit(this); 13188 target = dot.self.visit(this);
(...skipping 19 matching lines...) Expand all
13113 var target = this.visitValue(node.target); 13208 var target = this.visitValue(node.target);
13114 var index = this.visitValue(node.index); 13209 var index = this.visitValue(node.index);
13115 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); 13210 return target.invoke$4(this, '\$index', node, new Arguments(null, [index]));
13116 } 13211 }
13117 MethodGenerator.prototype.visitBinaryExpression = function(node) { 13212 MethodGenerator.prototype.visitBinaryExpression = function(node) {
13118 var $0; 13213 var $0;
13119 var kind = node.op.kind; 13214 var kind = node.op.kind;
13120 if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) { 13215 if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) {
13121 var x = this.visitValue(node.x); 13216 var x = this.visitValue(node.x);
13122 var y = this.visitValue(node.y); 13217 var y = this.visitValue(node.y);
13123 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); 13218 var code = ('' + x.get$code() + ' ' + node.op + ' ' + y.get$code() + '');
13124 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { 13219 if ($notnull_bool(x.get$isConst() && y.get$isConst())) {
13125 var value = (kind == 35/*TokenKind.AND*/) ? $notnull_bool(x.get$actualValu e() && y.get$actualValue()) : $notnull_bool(x.get$actualValue() || y.get$actualV alue()); 13220 var value = (kind == 35/*TokenKind.AND*/) ? $notnull_bool(x.get$actualValu e() && y.get$actualValue()) : $notnull_bool(x.get$actualValue() || y.get$actualV alue());
13126 return EvaluatedValue.EvaluatedValue$factory((($0 = x.type) && $0.is$lang_ Type()), value, ('' + value + ''), node.span); 13221 return EvaluatedValue.EvaluatedValue$factory((($0 = x.get$type()) && $0.is $lang_Type()), value, ('' + value + ''), node.span);
13127 } 13222 }
13128 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); 13223 var ret = new Value(lang_Type.union((($0 = x.get$type()) && $0.is$lang_Type( )), (($0 = y.get$type()) && $0.is$lang_Type())), code, node.span, true);
13129 return ret.convertTo$3(this, world.nonNullBool, node); 13224 return ret.convertTo$3(this, world.nonNullBool, node);
13130 } 13225 }
13131 else if (kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenKind.NE_STRICT* /) { 13226 else if (kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenKind.NE_STRICT* /) {
13132 var x = this.visitValue(node.x); 13227 var x = this.visitValue(node.x);
13133 var y = this.visitValue(node.y); 13228 var y = this.visitValue(node.y);
13134 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { 13229 if ($notnull_bool(x.get$isConst() && y.get$isConst())) {
13135 var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(x.get$actualValue(), y .get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue()); 13230 var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(x.get$actualValue(), y .get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue());
13136 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, value, ("" + value + ""), node.span); 13231 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, value, ("" + value + ""), node.span);
13137 } 13232 }
13138 if ($notnull_bool($eq(x.code, 'null') || $eq(y.code, 'null'))) { 13233 if ($notnull_bool($eq(x.get$code(), 'null') || $eq(y.get$code(), 'null'))) {
13139 var op = node.op.toString().substring(0, 2); 13234 var op = node.op.toString().substring(0, 2);
13140 return new Value(world.nonNullBool, ('' + x.code + ' ' + op + ' ' + y.code + ''), node.span, true); 13235 return new Value(world.nonNullBool, ('' + x.get$code() + ' ' + op + ' ' + y.get$code() + ''), node.span, true);
13141 } 13236 }
13142 else { 13237 else {
13143 return new Value(world.nonNullBool, ('' + x.code + ' ' + node.op + ' ' + y .code + ''), node.span, true); 13238 return new Value(world.nonNullBool, ('' + x.get$code() + ' ' + node.op + ' ' + y.get$code() + ''), node.span, true);
13144 } 13239 }
13145 } 13240 }
13146 var assignKind = TokenKind.kindFromAssign(node.op.kind); 13241 var assignKind = TokenKind.kindFromAssign(node.op.kind);
13147 if (assignKind == -1) { 13242 if (assignKind == -1) {
13148 var x = this.visitValue(node.x); 13243 var x = this.visitValue(node.x);
13149 var y = this.visitValue(node.y); 13244 var y = this.visitValue(node.y);
13150 var name = TokenKind.binaryMethodName(node.op.kind); 13245 var name = TokenKind.binaryMethodName(node.op.kind);
13151 if (node.op.kind == 49/*TokenKind.NE*/) { 13246 if (node.op.kind == 49/*TokenKind.NE*/) {
13152 name = '\$ne'; 13247 name = '\$ne';
13153 } 13248 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
13215 right = captureOriginal((right && right.is$Value())); 13310 right = captureOriginal((right && right.is$Value()));
13216 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, n ew Arguments(null, [y])); 13311 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, n ew Arguments(null, [y]));
13217 } 13312 }
13218 return members._set$4(this, position, x, y); 13313 return members._set$4(this, position, x, y);
13219 } 13314 }
13220 else { 13315 else {
13221 x = members._get$3(this, position, x); 13316 x = members._get$3(this, position, x);
13222 } 13317 }
13223 } 13318 }
13224 } 13319 }
13225 y = y.convertTo$3(this, x.type, yn); 13320 y = y.convertTo$3(this, x.get$type(), yn);
13226 if (kind == 0) { 13321 if (kind == 0) {
13227 x = captureOriginal((x && x.is$Value())); 13322 x = captureOriginal((x && x.is$Value()));
13228 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, true); 13323 return new Value(y.get$type(), ('' + x.get$code() + ' = ' + y.get$code() + ' '), position.span, true);
13229 } 13324 }
13230 else if ($notnull_bool(x.type.get$isNum() && y.type.get$isNum()) && (kind != 4 6/*TokenKind.TRUNCDIV*/)) { 13325 else if ($notnull_bool(x.get$type().get$isNum() && y.get$type().get$isNum()) & & (kind != 46/*TokenKind.TRUNCDIV*/)) {
13231 x = captureOriginal((x && x.is$Value())); 13326 x = captureOriginal((x && x.is$Value()));
13232 var op = TokenKind.kindToString(kind); 13327 var op = TokenKind.kindToString(kind);
13233 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), posi tion.span, true); 13328 return new Value(y.get$type(), ('' + x.get$code() + ' ' + op + '= ' + y.get$ code() + ''), position.span, true);
13234 } 13329 }
13235 else { 13330 else {
13236 var right = x; 13331 var right = x;
13237 right = captureOriginal((right && right.is$Value())); 13332 right = captureOriginal((right && right.is$Value()));
13238 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); 13333 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y]));
13239 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, true); 13334 return new Value(y.get$type(), ('' + x.get$code() + ' = ' + y.get$code() + ' '), position.span, true);
13240 } 13335 }
13241 } 13336 }
13242 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c aptureOriginal) { 13337 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c aptureOriginal) {
13243 var target = this.visitValue(xn.target); 13338 var target = this.visitValue(xn.target);
13244 var index = this.visitValue(xn.index); 13339 var index = this.visitValue(xn.index);
13245 var y = this.visitValue(yn); 13340 var y = this.visitValue(yn);
13246 var tmptarget = target; 13341 var tmptarget = target;
13247 var tmpindex = index; 13342 var tmpindex = index;
13248 if (kind != 0) { 13343 if (kind != 0) {
13249 tmptarget = this.getTemp((target && target.is$Value())); 13344 tmptarget = this.getTemp((target && target.is$Value()));
(...skipping 22 matching lines...) Expand all
13272 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg et.is$Value())); 13367 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg et.is$Value()));
13273 return ret; 13368 return ret;
13274 } 13369 }
13275 MethodGenerator.prototype.visitUnaryExpression = function(node) { 13370 MethodGenerator.prototype.visitUnaryExpression = function(node) {
13276 var $0; 13371 var $0;
13277 var value = this.visitValue(node.self); 13372 var value = this.visitValue(node.self);
13278 switch (node.op.kind) { 13373 switch (node.op.kind) {
13279 case 16/*TokenKind.INCR*/: 13374 case 16/*TokenKind.INCR*/:
13280 case 17/*TokenKind.DECR*/: 13375 case 17/*TokenKind.DECR*/:
13281 13376
13282 if ($notnull_bool(value.type.get$isNum())) { 13377 if ($notnull_bool(value.get$type().get$isNum())) {
13283 return new Value(value.type, ('' + node.op + '' + value.code + ''), node .span, true); 13378 return new Value(value.get$type(), ('' + node.op + '' + value.get$code() + ''), node.span, true);
13284 } 13379 }
13285 else { 13380 else {
13286 var kind = (16/*TokenKind.INCR*/ == node.op.kind ? 42/*TokenKind.ADD*/ : 43/*TokenKind.SUB*/); 13381 var kind = (16/*TokenKind.INCR*/ == node.op.kind ? 42/*TokenKind.ADD*/ : 43/*TokenKind.SUB*/);
13287 var operand = new LiteralExpression(1, new TypeReference(node.span, worl d.numType), '1', node.span); 13382 var operand = new LiteralExpression(1, new TypeReference(node.span, worl d.numType), '1', node.span);
13288 return this._visitAssign($assert_num(kind), node.self, (operand && opera nd.is$lang_Expression()), node, to$call$1(null)); 13383 return this._visitAssign($assert_num(kind), node.self, (operand && opera nd.is$lang_Expression()), node, to$call$1(null));
13289 } 13384 }
13290 13385
13291 case 19/*TokenKind.NOT*/: 13386 case 19/*TokenKind.NOT*/:
13292 13387
13293 if ($notnull_bool(value.type.get$isBool() && value.get$isConst())) { 13388 if ($notnull_bool(value.get$type().get$isBool() && value.get$isConst())) {
13294 var newVal = !$notnull_bool(value.get$actualValue()); 13389 var newVal = !$notnull_bool(value.get$actualValue());
13295 return EvaluatedValue.EvaluatedValue$factory((($0 = value.type) && $0.is $lang_Type()), newVal, ('' + newVal + ''), node.span); 13390 return EvaluatedValue.EvaluatedValue$factory((($0 = value.get$type()) && $0.is$lang_Type()), newVal, ('' + newVal + ''), node.span);
13296 } 13391 }
13297 else { 13392 else {
13298 var newVal = value.convertTo$3(this, world.nonNullBool, node); 13393 var newVal = value.convertTo$3(this, world.nonNullBool, node);
13299 return new Value(newVal.type, ('!' + newVal.code + ''), node.span, true) ; 13394 return new Value(newVal.get$type(), ('!' + newVal.get$code() + ''), node .span, true);
13300 } 13395 }
13301 13396
13302 case 42/*TokenKind.ADD*/: 13397 case 42/*TokenKind.ADD*/:
13303 13398
13304 return value.convertTo$3(this, world.numType, node); 13399 return value.convertTo$3(this, world.numType, node);
13305 13400
13306 case 43/*TokenKind.SUB*/: 13401 case 43/*TokenKind.SUB*/:
13307 case 18/*TokenKind.BIT_NOT*/: 13402 case 18/*TokenKind.BIT_NOT*/:
13308 13403
13309 if (node.op.kind == 18/*TokenKind.BIT_NOT*/) { 13404 if (node.op.kind == 18/*TokenKind.BIT_NOT*/) {
13310 return value.invoke$4(this, '\$bit_not', node, Arguments.get$EMPTY()); 13405 return value.invoke$4(this, '\$bit_not', node, Arguments.get$EMPTY());
13311 } 13406 }
13312 else if (node.op.kind == 43/*TokenKind.SUB*/) { 13407 else if (node.op.kind == 43/*TokenKind.SUB*/) {
13313 return value.invoke$4(this, '\$negate', node, Arguments.get$EMPTY()); 13408 return value.invoke$4(this, '\$negate', node, Arguments.get$EMPTY());
13314 } 13409 }
13315 else { 13410 else {
13316 world.internalError(('unimplemented: unary ' + node.op + ''), node.span) ; 13411 world.internalError(('unimplemented: unary ' + node.op + ''), node.span) ;
13317 } 13412 }
13318 $throw(new FallThroughError()); 13413 $throw(new FallThroughError());
13319 13414
13320 default: 13415 default:
13321 13416
13322 world.internalError(('unimplemented: ' + node.op + ''), node.span); 13417 world.internalError(('unimplemented: ' + node.op + ''), node.span);
13323 13418
13324 } 13419 }
13325 } 13420 }
13326 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { 13421 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) {
13327 var $this = this; // closure support 13422 var $this = this; // closure support
13328 var value = this.visitValue(node.body); 13423 var value = this.visitValue(node.body);
13329 if ($notnull_bool(value.type.get$isNum())) { 13424 if ($notnull_bool(value.get$type().get$isNum())) {
13330 return new Value(value.type, ('' + value.code + '' + node.op + ''), node.spa n, true); 13425 return new Value(value.get$type(), ('' + value.get$code() + '' + node.op + ' '), node.span, true);
13331 } 13426 }
13332 var kind = (16/*TokenKind.INCR*/ == node.op.kind) ? 42/*TokenKind.ADD*/ : 43/* TokenKind.SUB*/; 13427 var kind = (16/*TokenKind.INCR*/ == node.op.kind) ? 42/*TokenKind.ADD*/ : 43/* TokenKind.SUB*/;
13333 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT ype), '1', node.span); 13428 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT ype), '1', node.span);
13334 var tmpleft = null, left = null; 13429 var tmpleft = null, left = null;
13335 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand. is$lang_Expression()), node, (function (l) { 13430 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand. is$lang_Expression()), node, (function (l) {
13336 if ($notnull_bool(isVoid)) { 13431 if ($notnull_bool(isVoid)) {
13337 return l; 13432 return l;
13338 } 13433 }
13339 else { 13434 else {
13340 left = l; 13435 left = l;
13341 tmpleft = $this.forceTemp((l && l.is$Value())); 13436 tmpleft = $this.forceTemp((l && l.is$Value()));
13342 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$ Value())); 13437 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$ Value()));
13343 } 13438 }
13344 }) 13439 })
13345 ); 13440 );
13346 if ($notnull_bool($ne(tmpleft, null))) { 13441 if ($notnull_bool($ne(tmpleft, null))) {
13347 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), node .span, true); 13442 ret = new Value(ret.get$type(), ("(" + ret.get$code() + ", " + tmpleft.get$c ode() + ")"), node.span, true);
13348 } 13443 }
13349 if ($notnull_bool($ne(tmpleft, left))) { 13444 if ($notnull_bool($ne(tmpleft, left))) {
13350 this.freeTemp((tmpleft && tmpleft.is$Value())); 13445 this.freeTemp((tmpleft && tmpleft.is$Value()));
13351 } 13446 }
13352 return ret; 13447 return ret;
13353 } 13448 }
13354 MethodGenerator.prototype.visitNewExpression = function(node) { 13449 MethodGenerator.prototype.visitNewExpression = function(node) {
13355 var $0; 13450 var $0;
13356 var typeRef = node.type; 13451 var typeRef = node.type;
13357 var constructorName = ''; 13452 var constructorName = '';
13358 if (node.name != null) { 13453 if (node.name != null) {
13359 constructorName = node.name.name; 13454 constructorName = node.name.name;
13360 } 13455 }
13361 if ($notnull_bool($eq(constructorName, '') && !(typeRef instanceof GenericType Reference)) && typeRef.names != null) { 13456 if ($notnull_bool($notnull_bool($eq(constructorName, '') && !(typeRef instance of GenericTypeReference)) && $ne(typeRef.get$names(), null))) {
13362 var names = ListFactory.ListFactory$from$factory(typeRef.names); 13457 var names = ListFactory.ListFactory$from$factory((($0 = typeRef.get$names()) && $0.is$Iterable()));
13363 constructorName = names.removeLast$0().get$name(); 13458 constructorName = names.removeLast$0().get$name();
13364 if (names.length == 0) names = null; 13459 if ($notnull_bool($eq(names.length, 0))) names = null;
13365 typeRef = new NameTypeReference(typeRef.isFinal, typeRef.get$name(), names, typeRef.get$span()); 13460 typeRef = new NameTypeReference(typeRef.get$isFinal(), typeRef.get$name(), n ames, (($0 = typeRef.get$span()) && $0.is$SourceSpan()));
13366 } 13461 }
13367 var type = this.method.resolveType(typeRef, true); 13462 var type = this.method.resolveType(typeRef, true);
13368 if ($notnull_bool(type.get$isTop())) { 13463 if ($notnull_bool(type.get$isTop())) {
13369 type = type.get$library().findTypeByName($assert_String(constructorName)); 13464 type = type.get$library().findTypeByName$1(constructorName);
13370 constructorName = ''; 13465 constructorName = '';
13371 } 13466 }
13372 var m = type.getConstructor$1(constructorName); 13467 var m = type.getConstructor$1(constructorName);
13373 if ($notnull_bool(m == null)) { 13468 if ($notnull_bool(m == null)) {
13374 var name = type.get$jsname(); 13469 var name = type.get$jsname();
13375 if ($notnull_bool(type.get$isVar())) { 13470 if ($notnull_bool(type.get$isVar())) {
13376 name = typeRef.get$name().get$name(); 13471 name = typeRef.get$name().get$name();
13377 } 13472 }
13378 world.error(('no matching constructor for ' + name + ''), node.span); 13473 world.error(('no matching constructor for ' + name + ''), node.span);
13379 return this._makeMissingValue($assert_String(name)); 13474 return this._makeMissingValue($assert_String(name));
13380 } 13475 }
13381 if ($notnull_bool(node.isConst)) { 13476 if ($notnull_bool(node.isConst)) {
13382 if (!$notnull_bool(m.get$isConst())) { 13477 if (!$notnull_bool(m.get$isConst())) {
13383 world.error('can\'t use const on a non-const constructor', node.span); 13478 world.error('can\'t use const on a non-const constructor', node.span);
13384 } 13479 }
13385 var $list = node.arguments; 13480 var $list = node.arguments;
13386 for (var $i = 0;$i < $list.length; $i++) { 13481 for (var $i = 0;$i < $list.length; $i++) {
13387 var arg = $list.$index($i); 13482 var arg = $list.$index($i);
13388 if (!$notnull_bool(this.visitValue((($0 = arg.get$value()) && $0.is$lang_E xpression())).get$isConst())) { 13483 if (!$notnull_bool(this.visitValue((($0 = arg.get$value()) && $0.is$lang_E xpression())).get$isConst())) {
13389 world.error('const constructor expects const arguments', arg.get$span()) ; 13484 world.error('const constructor expects const arguments', (($0 = arg.get$ span()) && $0.is$SourceSpan()));
13390 } 13485 }
13391 } 13486 }
13392 } 13487 }
13393 return m.invoke$4(this, node, null, this._makeArgs(node.arguments)); 13488 return m.invoke$4(this, node, null, this._makeArgs(node.arguments));
13394 } 13489 }
13395 MethodGenerator.prototype.visitListExpression = function(node) { 13490 MethodGenerator.prototype.visitListExpression = function(node) {
13491 var $0;
13396 var argsCode = []; 13492 var argsCode = [];
13397 var argValues = []; 13493 var argValues = [];
13398 var $list = node.values; 13494 var $list = node.values;
13399 for (var $i = 0;$i < $list.length; $i++) { 13495 for (var $i = 0;$i < $list.length; $i++) {
13400 var item = $list.$index($i); 13496 var item = $list.$index($i);
13401 var arg = this.visitValue((item && item.is$lang_Expression())); 13497 var arg = this.visitValue((item && item.is$lang_Expression()));
13402 argValues.add$1(arg); 13498 argValues.add$1(arg);
13403 if ($notnull_bool(node.isConst)) { 13499 if ($notnull_bool(node.isConst)) {
13404 if (!$notnull_bool(arg.get$isConst())) { 13500 if (!$notnull_bool(arg.get$isConst())) {
13405 world.error('const list can only contain const values', item.get$span()) ; 13501 world.error('const list can only contain const values', (($0 = item.get$ span()) && $0.is$SourceSpan()));
13406 argsCode.add$1(arg.code); 13502 argsCode.add$1(arg.get$code());
13407 } 13503 }
13408 else { 13504 else {
13409 argsCode.add$1(arg.get$canonicalCode()); 13505 argsCode.add$1(arg.get$canonicalCode());
13410 } 13506 }
13411 } 13507 }
13412 else { 13508 else {
13413 argsCode.add$1(arg.code); 13509 argsCode.add$1(arg.get$code());
13414 } 13510 }
13415 } 13511 }
13416 world.get$coreimpl().types.$index('ListFactory').markUsed$0(); 13512 world.get$coreimpl().types.$index('ListFactory').markUsed$0();
13417 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); 13513 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']');
13418 var value = new Value(world.listType, code, node.span, true); 13514 var value = new Value(world.listType, code, node.span, true);
13419 if ($notnull_bool(node.isConst)) { 13515 if ($notnull_bool(node.isConst)) {
13420 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); 13516 var immutableList = world.get$coreimpl().types.$index('ImmutableList');
13421 var immutableListCtor = immutableList.getConstructor$1('from'); 13517 var immutableListCtor = immutableList.getConstructor$1('from');
13422 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null , [value])); 13518 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null , [value]));
13423 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory((immu tableList && immutableList.is$lang_Type()), (argValues && argValues.is$List$Eval uatedValue()), ('const ' + code + ''), $assert_String(result.code), node.span), (argValues && argValues.is$List$Value())); 13519 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory((immu tableList && immutableList.is$lang_Type()), (argValues && argValues.is$List$Eval uatedValue()), ('const ' + code + ''), $assert_String(result.get$code()), node.s pan), (argValues && argValues.is$List$Value()));
13424 } 13520 }
13425 return value; 13521 return value;
13426 } 13522 }
13427 MethodGenerator.prototype.visitMapExpression = function(node) { 13523 MethodGenerator.prototype.visitMapExpression = function(node) {
13428 var $0; 13524 var $0;
13429 var mapImplType = world.gen.useMapFactory(); 13525 var mapImplType = world.gen.useMapFactory();
13430 var argValues = []; 13526 var argValues = [];
13431 var argsCode = []; 13527 var argsCode = [];
13432 for (var i = 0; 13528 for (var i = 0;
13433 i < node.items.length; i += 2) { 13529 i < node.items.length; i += 2) {
13434 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex pression()), world.stringType); 13530 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex pression()), world.stringType);
13435 var valueItem = node.items.$index(i + 1); 13531 var valueItem = node.items.$index(i + 1);
13436 var value = this.visitValue((valueItem && valueItem.is$lang_Expression())); 13532 var value = this.visitValue((valueItem && valueItem.is$lang_Expression()));
13437 argValues.add$1(key); 13533 argValues.add$1(key);
13438 argValues.add$1(value); 13534 argValues.add$1(value);
13439 if ($notnull_bool(node.isConst)) { 13535 if ($notnull_bool(node.isConst)) {
13440 if (!$notnull_bool(key.get$isConst()) || !$notnull_bool(value.get$isConst( ))) { 13536 if (!$notnull_bool(key.get$isConst()) || !$notnull_bool(value.get$isConst( ))) {
13441 world.error('const map can only contain const values', valueItem.get$spa n()); 13537 world.error('const map can only contain const values', (($0 = valueItem. get$span()) && $0.is$SourceSpan()));
13442 argsCode.add$1(key.code); 13538 argsCode.add$1(key.get$code());
13443 argsCode.add$1(value.code); 13539 argsCode.add$1(value.get$code());
13444 } 13540 }
13445 else { 13541 else {
13446 argsCode.add$1(key.get$canonicalCode()); 13542 argsCode.add$1(key.get$canonicalCode());
13447 argsCode.add$1(value.get$canonicalCode()); 13543 argsCode.add$1(value.get$canonicalCode());
13448 } 13544 }
13449 } 13545 }
13450 else { 13546 else {
13451 argsCode.add$1(key.code); 13547 argsCode.add$1(key.get$code());
13452 argsCode.add$1(value.code); 13548 argsCode.add$1(value.get$code());
13453 } 13549 }
13454 } 13550 }
13455 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); 13551 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']');
13456 var code = ('\$map(' + argList + ')'); 13552 var code = ('\$map(' + argList + ')');
13457 if ($notnull_bool(node.isConst)) { 13553 if ($notnull_bool(node.isConst)) {
13458 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap'); 13554 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap');
13459 var immutableMapCtor = immutableMap.getConstructor$1(''); 13555 var immutableMapCtor = immutableMap.getConstructor$1('');
13460 var argsValue = new Value(world.listType, argList, node.span, true); 13556 var argsValue = new Value(world.listType, argList, node.span, true);
13461 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null, [argsValue])); 13557 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null, [argsValue]));
13462 var value = ConstMapValue.ConstMapValue$factory((immutableMap && immutableMa p.is$lang_Type()), (argValues && argValues.is$List$EvaluatedValue()), code, $ass ert_String(result.code), node.span); 13558 var value = ConstMapValue.ConstMapValue$factory((immutableMap && immutableMa p.is$lang_Type()), (argValues && argValues.is$List$EvaluatedValue()), code, $ass ert_String(result.get$code()), node.span);
13463 return world.gen.globalForConst(value, (argValues && argValues.is$List$Value ())); 13559 return world.gen.globalForConst(value, (argValues && argValues.is$List$Value ()));
13464 } 13560 }
13465 return new Value(mapImplType, code, node.span, true); 13561 return new Value(mapImplType, code, node.span, true);
13466 } 13562 }
13467 MethodGenerator.prototype.visitConditionalExpression = function(node) { 13563 MethodGenerator.prototype.visitConditionalExpression = function(node) {
13468 var $0; 13564 var $0;
13469 var test = this.visitBool(node.test); 13565 var test = this.visitBool(node.test);
13470 var trueBranch = this.visitValue(node.trueBranch); 13566 var trueBranch = this.visitValue(node.trueBranch);
13471 var falseBranch = this.visitValue(node.falseBranch); 13567 var falseBranch = this.visitValue(node.falseBranch);
13472 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod e + ''); 13568 var code = ('' + test.get$code() + ' ? ' + trueBranch.get$code() + ' : ' + fal seBranch.get$code() + '');
13473 return new Value(lang_Type.union((($0 = trueBranch.type) && $0.is$lang_Type()) , (($0 = falseBranch.type) && $0.is$lang_Type())), code, node.span, true); 13569 return new Value(lang_Type.union((($0 = trueBranch.get$type()) && $0.is$lang_T ype()), (($0 = falseBranch.get$type()) && $0.is$lang_Type())), code, node.span, true);
13474 } 13570 }
13475 MethodGenerator.prototype.visitIsExpression = function(node) { 13571 MethodGenerator.prototype.visitIsExpression = function(node) {
13476 var value = this.visitValue(node.x); 13572 var value = this.visitValue(node.x);
13477 var type = this.method.resolveType(node.type, false); 13573 var type = this.method.resolveType(node.type, false);
13478 return value.instanceOf$4(this, type, node.span, node.isTrue); 13574 return value.instanceOf$4(this, type, node.span, node.isTrue);
13479 } 13575 }
13480 MethodGenerator.prototype.visitParenExpression = function(node) { 13576 MethodGenerator.prototype.visitParenExpression = function(node) {
13481 var $0; 13577 var $0;
13482 var body = this.visitValue(node.body); 13578 var body = this.visitValue(node.body);
13483 if ($notnull_bool(body.get$isConst())) { 13579 if ($notnull_bool(body.get$isConst())) {
13484 return EvaluatedValue.EvaluatedValue$factory((($0 = body.type) && $0.is$lang _Type()), body.get$actualValue(), ('(' + body.get$canonicalCode() + ')'), node.s pan); 13580 return EvaluatedValue.EvaluatedValue$factory((($0 = body.get$type()) && $0.i s$lang_Type()), body.get$actualValue(), ('(' + body.get$canonicalCode() + ')'), node.span);
13485 } 13581 }
13486 return new Value(body.type, ('(' + body.code + ')'), node.span, true); 13582 return new Value(body.get$type(), ('(' + body.get$code() + ')'), node.span, tr ue);
13487 } 13583 }
13488 MethodGenerator.prototype.visitDotExpression = function(node) { 13584 MethodGenerator.prototype.visitDotExpression = function(node) {
13489 var target = node.self.visit(this); 13585 var target = node.self.visit(this);
13490 return target.get_$3(this, node.name.name, node.name); 13586 return target.get_$3(this, node.name.name, node.name);
13491 } 13587 }
13492 MethodGenerator.prototype.visitVarExpression = function(node) { 13588 MethodGenerator.prototype.visitVarExpression = function(node) {
13493 var name = node.name.name; 13589 var name = node.name.name;
13494 var ret = this._scope.lookup(name); 13590 var ret = this._scope.lookup(name);
13495 if ($notnull_bool($ne(ret, null))) return ret; 13591 if ($notnull_bool($ne(ret, null))) return ret;
13496 return this._makeThisOrType(node.span).get_$3(this, name, node); 13592 return this._makeThisOrType(node.span).get_$3(this, name, node);
(...skipping 18 matching lines...) Expand all
13515 var $0; 13611 var $0;
13516 var type = node.type.type; 13612 var type = node.type.type;
13517 $assert($ne(type, null), "type != null", "gen.dart", 2083, 12); 13613 $assert($ne(type, null), "type != null", "gen.dart", 2083, 12);
13518 if (!!(($0 = node.value) && $0.is$List)) { 13614 if (!!(($0 = node.value) && $0.is$List)) {
13519 var items = []; 13615 var items = [];
13520 var $list = node.value; 13616 var $list = node.value;
13521 for (var $i = node.value.iterator$0(); $i.hasNext$0(); ) { 13617 for (var $i = node.value.iterator$0(); $i.hasNext$0(); ) {
13522 var item = $i.next$0(); 13618 var item = $i.next$0();
13523 var val = this.visitValue((item && item.is$lang_Expression())); 13619 var val = this.visitValue((item && item.is$lang_Expression()));
13524 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); 13620 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY());
13525 var code = val.code; 13621 var code = val.get$code();
13526 if ((item instanceof BinaryExpression) || (item instanceof ConditionalExpr ession)) { 13622 if ((item instanceof BinaryExpression) || (item instanceof ConditionalExpr ession)) {
13527 code = ('(' + code + ')'); 13623 code = ('(' + code + ')');
13528 } 13624 }
13529 items.add$1(code); 13625 items.add$1(code);
13530 } 13626 }
13531 return new Value(type, ('(' + Strings.join((items && items.is$List$String()) , " + ") + ')'), node.span, true); 13627 return new Value(type, ('(' + Strings.join((items && items.is$List$String()) , " + ") + ')'), node.span, true);
13532 } 13628 }
13533 var text = node.text; 13629 var text = node.text;
13534 if ($notnull_bool(type.get$isString())) { 13630 if ($notnull_bool(type.get$isString())) {
13535 if ($notnull_bool(text.startsWith$1('@'))) { 13631 if ($notnull_bool(text.startsWith$1('@'))) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
13569 values.add$1(new Value(world.varType, ('\$' + i + ''), null, false)); 13665 values.add$1(new Value(world.varType, ('\$' + i + ''), null, false));
13570 } 13666 }
13571 return new Arguments(null, values); 13667 return new Arguments(null, values);
13572 } 13668 }
13573 Arguments.get$EMPTY = function() { 13669 Arguments.get$EMPTY = function() {
13574 if (Arguments._empty == null) { 13670 if (Arguments._empty == null) {
13575 Arguments._empty = new Arguments(null, []); 13671 Arguments._empty = new Arguments(null, []);
13576 } 13672 }
13577 return Arguments._empty; 13673 return Arguments._empty;
13578 } 13674 }
13675 Arguments.prototype.get$values = function() { return this.values; };
13676 Arguments.prototype.set$values = function(value) { return this.values = value; } ;
13579 Arguments.prototype.get$nameCount = function() { 13677 Arguments.prototype.get$nameCount = function() {
13580 return this.get$length() - this.get$bareCount(); 13678 return this.get$length() - this.get$bareCount();
13581 } 13679 }
13582 Arguments.prototype.get$hasNames = function() { 13680 Arguments.prototype.get$hasNames = function() {
13583 return this.get$bareCount() < this.get$length(); 13681 return this.get$bareCount() < this.get$length();
13584 } 13682 }
13585 Arguments.prototype.get$length = function() { 13683 Arguments.prototype.get$length = function() {
13586 return this.values.length; 13684 return this.values.length;
13587 } 13685 }
13588 Object.defineProperty(Arguments.prototype, "length", { 13686 Object.defineProperty(Arguments.prototype, "length", {
13589 get: Arguments.prototype.get$length 13687 get: Arguments.prototype.get$length
13590 }); 13688 });
13591 Arguments.prototype.getName = function(i) { 13689 Arguments.prototype.getName = function(i) {
13592 return this.nodes.$index(i).label.name; 13690 return $assert_String(this.nodes.$index(i).get$label().get$name());
13593 } 13691 }
13594 Arguments.prototype.getIndexOfName = function(name) { 13692 Arguments.prototype.getIndexOfName = function(name) {
13595 for (var i = this.get$bareCount(); 13693 for (var i = this.get$bareCount();
13596 i < this.get$length(); i++) { 13694 i < this.get$length(); i++) {
13597 if (this.getName(i) == name) { 13695 if (this.getName(i) == name) {
13598 return i; 13696 return i;
13599 } 13697 }
13600 } 13698 }
13601 return -1; 13699 return -1;
13602 } 13700 }
13603 Arguments.prototype.getValue = function(name) { 13701 Arguments.prototype.getValue = function(name) {
13604 var $0; 13702 var $0;
13605 var i = this.getIndexOfName(name); 13703 var i = this.getIndexOfName(name);
13606 return (($0 = i >= 0 ? this.values.$index(i) : null) && $0.is$Value()); 13704 return (($0 = i >= 0 ? this.values.$index(i) : null) && $0.is$Value());
13607 } 13705 }
13608 Arguments.prototype.get$bareCount = function() { 13706 Arguments.prototype.get$bareCount = function() {
13609 if (this._bareCount == null) { 13707 if (this._bareCount == null) {
13610 this._bareCount = this.get$length(); 13708 this._bareCount = this.get$length();
13611 if (this.nodes != null) { 13709 if (this.nodes != null) {
13612 for (var i = 0; 13710 for (var i = 0;
13613 i < this.nodes.length; i++) { 13711 i < this.nodes.length; i++) {
13614 if (this.nodes.$index(i).label != null) { 13712 if ($notnull_bool($ne(this.nodes.$index(i).get$label(), null))) {
13615 this._bareCount = i; 13713 this._bareCount = i;
13616 break; 13714 break;
13617 } 13715 }
13618 } 13716 }
13619 } 13717 }
13620 } 13718 }
13621 return this._bareCount; 13719 return this._bareCount;
13622 } 13720 }
13623 Arguments.prototype.getCode = function() { 13721 Arguments.prototype.getCode = function() {
13624 var argsCode = []; 13722 var argsCode = [];
13625 for (var i = 0; 13723 for (var i = 0;
13626 i < this.get$length(); i++) { 13724 i < this.get$length(); i++) {
13627 argsCode.add$1(this.values.$index(i).code); 13725 argsCode.add$1(this.values.$index(i).get$code());
13628 } 13726 }
13629 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); 13727 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value()));
13630 return Strings.join((argsCode && argsCode.is$List$String()), ", "); 13728 return Strings.join((argsCode && argsCode.is$List$String()), ", ");
13631 } 13729 }
13632 Arguments.removeTrailingNulls = function(argsCode) { 13730 Arguments.removeTrailingNulls = function(argsCode) {
13633 while ($notnull_bool(argsCode.length > 0 && $eq(argsCode.last(), 'null'))) { 13731 while ($notnull_bool(argsCode.length > 0 && $eq(argsCode.last(), 'null'))) {
13634 argsCode.removeLast(); 13732 argsCode.removeLast();
13635 } 13733 }
13636 } 13734 }
13637 Arguments.prototype.getNames = function() { 13735 Arguments.prototype.getNames = function() {
(...skipping 17 matching lines...) Expand all
13655 result.add$1(new Value(world.varType, name, null, false)); 13753 result.add$1(new Value(world.varType, name, null, false));
13656 } 13754 }
13657 return new Arguments(this.nodes, result); 13755 return new Arguments(this.nodes, result);
13658 } 13756 }
13659 // ********** Code for LibraryImport ************** 13757 // ********** Code for LibraryImport **************
13660 function LibraryImport(library, prefix) { 13758 function LibraryImport(library, prefix) {
13661 this.library = library; 13759 this.library = library;
13662 this.prefix = prefix; 13760 this.prefix = prefix;
13663 // Initializers done 13761 // Initializers done
13664 } 13762 }
13763 LibraryImport.prototype.get$prefix = function() { return this.prefix; };
13764 LibraryImport.prototype.set$prefix = function(value) { return this.prefix = valu e; };
13665 LibraryImport.prototype.get$library = function() { return this.library; }; 13765 LibraryImport.prototype.get$library = function() { return this.library; };
13666 LibraryImport.prototype.set$library = function(value) { return this.library = va lue; }; 13766 LibraryImport.prototype.set$library = function(value) { return this.library = va lue; };
13667 // ********** Code for Library ************** 13767 // ********** Code for Library **************
13668 function Library(baseSource) { 13768 function Library(baseSource) {
13669 this.isWritten = false 13769 this.isWritten = false
13670 this.baseSource = baseSource; 13770 this.baseSource = baseSource;
13671 // Initializers done 13771 // Initializers done
13672 this.sourceDir = dirname(this.baseSource.filename); 13772 this.sourceDir = dirname(this.baseSource.filename);
13673 this.topType = new DefinedType(null, this, null, true); 13773 this.topType = new DefinedType(null, this, null, true);
13674 this.types = $map(['', this.topType]); 13774 this.types = $map(['', this.topType]);
13675 this.imports = []; 13775 this.imports = [];
13676 this.natives = []; 13776 this.natives = [];
13677 this.sources = []; 13777 this.sources = [];
13678 this._privateMembers = $map([]); 13778 this._privateMembers = $map([]);
13679 } 13779 }
13680 Library.prototype.is$Library = function(){return this;}; 13780 Library.prototype.is$Library = function(){return this;};
13781 Library.prototype.get$baseSource = function() { return this.baseSource; };
13782 Library.prototype.get$types = function() { return this.types; };
13783 Library.prototype.set$types = function(value) { return this.types = value; };
13681 Library.prototype.get$name = function() { return this.name; }; 13784 Library.prototype.get$name = function() { return this.name; };
13682 Library.prototype.set$name = function(value) { return this.name = value; }; 13785 Library.prototype.set$name = function(value) { return this.name = value; };
13786 Library.prototype.get$topType = function() { return this.topType; };
13787 Library.prototype.set$topType = function(value) { return this.topType = value; } ;
13683 Library.prototype.get$isCore = function() { 13788 Library.prototype.get$isCore = function() {
13684 return $eq(this, world.corelib); 13789 return $eq(this, world.corelib);
13685 } 13790 }
13686 Library.prototype.get$isCoreImpl = function() { 13791 Library.prototype.get$isCoreImpl = function() {
13687 return $eq(this, world.get$coreimpl()); 13792 return $eq(this, world.get$coreimpl());
13688 } 13793 }
13689 Library.prototype.get$jsname = function() { 13794 Library.prototype.get$jsname = function() {
13690 if (this._jsname == null) { 13795 if (this._jsname == null) {
13691 this._jsname = this.name.replaceAll('.', '_').replaceAll(':', '_').replaceAl l(' ', '_'); 13796 this._jsname = this.name.replaceAll('.', '_').replaceAll(':', '_').replaceAl l(' ', '_');
13692 } 13797 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
13780 return null; 13885 return null;
13781 } 13886 }
13782 if (!$notnull_bool(result.get$isTop())) { 13887 if (!$notnull_bool(result.get$isTop())) {
13783 return null; 13888 return null;
13784 } 13889 }
13785 return result.get$library().findTypeByName($assert_String(type.names.$index( 0).get$name())); 13890 return result.get$library().findTypeByName($assert_String(type.names.$index( 0).get$name()));
13786 } 13891 }
13787 return result; 13892 return result;
13788 } 13893 }
13789 Library.prototype.findTypeByName = function(name) { 13894 Library.prototype.findTypeByName = function(name) {
13895 var $0;
13790 var ret = this.types.$index(name); 13896 var ret = this.types.$index(name);
13791 var $list = this.imports; 13897 var $list = this.imports;
13792 for (var $i = 0;$i < $list.length; $i++) { 13898 for (var $i = 0;$i < $list.length; $i++) {
13793 var imported = $list.$index($i); 13899 var imported = $list.$index($i);
13794 var newRet = null; 13900 var newRet = null;
13795 if (imported.prefix == null) { 13901 if ($notnull_bool(imported.get$prefix() == null)) {
13796 newRet = imported.get$library().types.$index(name); 13902 newRet = imported.get$library().get$types().$index(name);
13797 } 13903 }
13798 else if (imported.prefix == name) { 13904 else if ($notnull_bool($eq(imported.get$prefix(), name))) {
13799 newRet = imported.get$library().topType; 13905 newRet = imported.get$library().get$topType();
13800 } 13906 }
13801 if ($notnull_bool($ne(newRet, null))) { 13907 if ($notnull_bool($ne(newRet, null))) {
13802 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 13908 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
13803 world.error(('conflicting types for "' + name + '"'), ret.get$span(), ne wRet.get$span()); 13909 world.error(('conflicting types for "' + name + '"'), (($0 = ret.get$spa n()) && $0.is$SourceSpan()), (($0 = newRet.get$span()) && $0.is$SourceSpan()));
13804 } 13910 }
13805 else { 13911 else {
13806 ret = newRet; 13912 ret = newRet;
13807 } 13913 }
13808 } 13914 }
13809 } 13915 }
13810 return (ret && ret.is$lang_Type()); 13916 return (ret && ret.is$lang_Type());
13811 } 13917 }
13812 Library.prototype.lookup = function(name, span) { 13918 Library.prototype.lookup = function(name, span) {
13919 var $0;
13813 var retType = this.findTypeByName(name); 13920 var retType = this.findTypeByName(name);
13814 var ret = null; 13921 var ret = null;
13815 if ($notnull_bool($ne(retType, null))) { 13922 if ($notnull_bool($ne(retType, null))) {
13816 ret = retType.get$typeMember(); 13923 ret = retType.get$typeMember();
13817 } 13924 }
13818 var newRet = this.topType.getMember(name); 13925 var newRet = this.topType.getMember(name);
13819 if ($notnull_bool($ne(newRet, null))) { 13926 if ($notnull_bool($ne(newRet, null))) {
13820 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 13927 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
13821 world.error(('conflicting members for "' + name + '"'), span, ret.get$span (), newRet.get$span()); 13928 world.error(('conflicting members for "' + name + '"'), span, (($0 = ret.g et$span()) && $0.is$SourceSpan()), (($0 = newRet.get$span()) && $0.is$SourceSpan ()));
13822 } 13929 }
13823 else { 13930 else {
13824 ret = newRet; 13931 ret = newRet;
13825 } 13932 }
13826 } 13933 }
13827 var $list = this.imports; 13934 var $list = this.imports;
13828 for (var $i = 0;$i < $list.length; $i++) { 13935 for (var $i = 0;$i < $list.length; $i++) {
13829 var imported = $list.$index($i); 13936 var imported = $list.$index($i);
13830 if (imported.prefix == null) { 13937 if ($notnull_bool(imported.get$prefix() == null)) {
13831 newRet = imported.get$library().topType.getMember(name); 13938 newRet = imported.get$library().get$topType().getMember$1(name);
13832 if ($notnull_bool($ne(newRet, null))) { 13939 if ($notnull_bool($ne(newRet, null))) {
13833 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 13940 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
13834 world.error(('conflicting members for "' + name + '"'), span, ret.get$ span(), newRet.get$span()); 13941 world.error(('conflicting members for "' + name + '"'), span, (($0 = r et.get$span()) && $0.is$SourceSpan()), (($0 = newRet.get$span()) && $0.is$Source Span()));
13835 } 13942 }
13836 else { 13943 else {
13837 ret = newRet; 13944 ret = newRet;
13838 } 13945 }
13839 } 13946 }
13840 } 13947 }
13841 } 13948 }
13842 return (ret && ret.is$Member()); 13949 return (ret && ret.is$Member());
13843 } 13950 }
13844 Library.prototype.resolve = function() { 13951 Library.prototype.resolve = function() {
(...skipping 14 matching lines...) Expand all
13859 type.resolve$0(); 13966 type.resolve$0();
13860 } 13967 }
13861 } 13968 }
13862 Library.prototype.visitSources = function() { 13969 Library.prototype.visitSources = function() {
13863 var visitor = new _LibraryVisitor(this); 13970 var visitor = new _LibraryVisitor(this);
13864 visitor.addSource$1(this.baseSource); 13971 visitor.addSource$1(this.baseSource);
13865 } 13972 }
13866 Library.prototype.toString = function() { 13973 Library.prototype.toString = function() {
13867 return this.baseSource.filename; 13974 return this.baseSource.filename;
13868 } 13975 }
13976 Library.prototype.findTypeByName$1 = function($0) {
13977 return this.findTypeByName($assert_String($0));
13978 };
13869 Library.prototype.resolve$0 = function() { 13979 Library.prototype.resolve$0 = function() {
13870 return this.resolve(); 13980 return this.resolve();
13871 }; 13981 };
13872 Library.prototype.toString$0 = function() { 13982 Library.prototype.toString$0 = function() {
13873 return this.toString(); 13983 return this.toString();
13874 }; 13984 };
13875 Library.prototype.visitSources$0 = function() { 13985 Library.prototype.visitSources$0 = function() {
13876 return this.visitSources(); 13986 return this.visitSources();
13877 }; 13987 };
13878 // ********** Code for _LibraryVisitor ************** 13988 // ********** Code for _LibraryVisitor **************
(...skipping 11 matching lines...) Expand all
13890 _LibraryVisitor.prototype.get$library = function() { return this.library; }; 14000 _LibraryVisitor.prototype.get$library = function() { return this.library; };
13891 _LibraryVisitor.prototype.get$isTop = function() { return this.isTop; }; 14001 _LibraryVisitor.prototype.get$isTop = function() { return this.isTop; };
13892 _LibraryVisitor.prototype.set$isTop = function(value) { return this.isTop = valu e; }; 14002 _LibraryVisitor.prototype.set$isTop = function(value) { return this.isTop = valu e; };
13893 _LibraryVisitor.prototype.addSourceFromName = function(name, span) { 14003 _LibraryVisitor.prototype.addSourceFromName = function(name, span) {
13894 var filename = this.library.makeFullPath(name); 14004 var filename = this.library.makeFullPath(name);
13895 if ($notnull_bool($eq(filename, this.library.baseSource.filename))) { 14005 if ($notnull_bool($eq(filename, this.library.baseSource.filename))) {
13896 world.error('library can not source itself', span); 14006 world.error('library can not source itself', span);
13897 return; 14007 return;
13898 } 14008 }
13899 else if (this.sources.some((function (s) { 14009 else if (this.sources.some((function (s) {
13900 return s.filename == filename; 14010 return $eq(s.get$filename(), filename);
13901 }) 14011 })
13902 )) { 14012 )) {
13903 world.error(('file "' + filename + '" has already been sourced'), span); 14013 world.error(('file "' + filename + '" has already been sourced'), span);
13904 return; 14014 return;
13905 } 14015 }
13906 var source = world.readFile(this.library.makeFullPath(name)); 14016 var source = world.readFile(this.library.makeFullPath(name));
13907 this.sources.add(source); 14017 this.sources.add(source);
13908 } 14018 }
13909 _LibraryVisitor.prototype.addSource = function(source) { 14019 _LibraryVisitor.prototype.addSource = function(source) {
13910 var $this = this; // closure support 14020 var $this = this; // closure support
13911 if (this.library.sources.some((function (s) { 14021 if (this.library.sources.some((function (s) {
13912 return s.filename == source.filename; 14022 return $eq(s.get$filename(), source.filename);
13913 }) 14023 })
13914 )) { 14024 )) {
13915 world.error(('duplicate source file "' + source.filename + '"')); 14025 world.error(('duplicate source file "' + source.filename + '"'));
13916 return; 14026 return;
13917 } 14027 }
13918 this.library.sources.add(source); 14028 this.library.sources.add(source);
13919 var parser = new lang_Parser(source, options.dietParse, false, false, 0); 14029 var parser = new lang_Parser(source, options.dietParse, false, false, 0);
13920 var unit = parser.compilationUnit(); 14030 var unit = parser.compilationUnit();
13921 unit.forEach((function (def) { 14031 unit.forEach((function (def) {
13922 return def.visit$1($this); 14032 return def.visit$1($this);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
13965 } 14075 }
13966 else if ($notnull_bool($ne(prefix, null) && prefix.indexOf$2('.', 0) >= 0) ) { 14076 else if ($notnull_bool($ne(prefix, null) && prefix.indexOf$2('.', 0) >= 0) ) {
13967 world.error('library prefix canot contain "."', node.span); 14077 world.error('library prefix canot contain "."', node.span);
13968 } 14078 }
13969 else if ($notnull_bool(this.seenSource || this.seenResource)) { 14079 else if ($notnull_bool(this.seenSource || this.seenResource)) {
13970 world.error('#imports must come before any #source or #resource', node.s pan); 14080 world.error('#imports must come before any #source or #resource', node.s pan);
13971 } 14081 }
13972 if ($notnull_bool($eq(prefix, ''))) prefix = null; 14082 if ($notnull_bool($eq(prefix, ''))) prefix = null;
13973 var filename = this.library.makeFullPath($assert_String(name)); 14083 var filename = this.library.makeFullPath($assert_String(name));
13974 if (this.library.imports.some((function (li) { 14084 if (this.library.imports.some((function (li) {
13975 return $eq(li.get$library().baseSource, filename); 14085 return $eq(li.get$library().get$baseSource(), filename);
13976 }) 14086 })
13977 )) { 14087 )) {
13978 world.error(('duplicate import of "' + name + '"'), node.span); 14088 world.error(('duplicate import of "' + name + '"'), node.span);
13979 return; 14089 return;
13980 } 14090 }
13981 var newLib = this.library.addImport($assert_String(filename), $assert_Stri ng(prefix)); 14091 var newLib = this.library.addImport($assert_String(filename), $assert_Stri ng(prefix));
13982 break; 14092 break;
13983 14093
13984 case "source": 14094 case "source":
13985 14095
(...skipping 27 matching lines...) Expand all
14013 if (node.arguments.length != 1) { 14123 if (node.arguments.length != 1) {
14014 world.error(('expected exactly one argument but found ' + node.arguments.len gth + ''), node.span); 14124 world.error(('expected exactly one argument but found ' + node.arguments.len gth + ''), node.span);
14015 } 14125 }
14016 return this.getFirstStringArg(node); 14126 return this.getFirstStringArg(node);
14017 } 14127 }
14018 _LibraryVisitor.prototype.getFirstStringArg = function(node) { 14128 _LibraryVisitor.prototype.getFirstStringArg = function(node) {
14019 if (node.arguments.length < 1) { 14129 if (node.arguments.length < 1) {
14020 world.error(('expected at least one argument but found ' + node.arguments.le ngth + ''), node.span); 14130 world.error(('expected at least one argument but found ' + node.arguments.le ngth + ''), node.span);
14021 } 14131 }
14022 var arg = node.arguments.$index(0); 14132 var arg = node.arguments.$index(0);
14023 if (arg.label != null) { 14133 if ($notnull_bool($ne(arg.get$label(), null))) {
14024 world.error('label not allowed for directive', node.span); 14134 world.error('label not allowed for directive', node.span);
14025 } 14135 }
14026 return this._parseStringArgument((arg && arg.is$ArgumentNode())); 14136 return this._parseStringArgument((arg && arg.is$ArgumentNode()));
14027 } 14137 }
14028 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { 14138 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) {
14029 var args = node.arguments.filter((function (a) { 14139 var args = node.arguments.filter((function (a) {
14030 return a.label != null && a.label.name == argName; 14140 return $notnull_bool($ne(a.get$label(), null) && $eq(a.get$label().get$name( ), argName));
14031 }) 14141 })
14032 ); 14142 );
14033 if (args.length == 0) { 14143 if ($notnull_bool($eq(args.length, 0))) {
14034 return null; 14144 return null;
14035 } 14145 }
14036 if (args.length > 1) { 14146 if (args.length > 1) {
14037 world.error(('expected at most one "' + argName + '" argument but found ') + node.arguments.length, node.span); 14147 world.error(('expected at most one "' + argName + '" argument but found ') + node.arguments.length, node.span);
14038 } 14148 }
14039 for (var $i = args.iterator$0(); $i.hasNext$0(); ) { 14149 for (var $i = args.iterator$0(); $i.hasNext$0(); ) {
14040 var arg = $i.next$0(); 14150 var arg = $i.next$0();
14041 return this._parseStringArgument((arg && arg.is$ArgumentNode())); 14151 return this._parseStringArgument((arg && arg.is$ArgumentNode()));
14042 } 14152 }
14043 } 14153 }
14044 _LibraryVisitor.prototype._parseStringArgument = function(arg) { 14154 _LibraryVisitor.prototype._parseStringArgument = function(arg) {
14155 var $0;
14045 var expr = arg.value; 14156 var expr = arg.value;
14046 if (!(expr instanceof LiteralExpression) || !$notnull_bool(expr.type.type.get$ isString())) { 14157 if (!(expr instanceof LiteralExpression) || !$notnull_bool(expr.get$type().get $type().get$isString())) {
14047 world.error('expected string', expr.get$span()); 14158 world.error('expected string', (($0 = expr.get$span()) && $0.is$SourceSpan() ));
14048 } 14159 }
14049 return parseStringLiteral($assert_String(expr.get$value())); 14160 return parseStringLiteral($assert_String(expr.get$value()));
14050 } 14161 }
14051 _LibraryVisitor.prototype.visitTypeDefinition = function(node) { 14162 _LibraryVisitor.prototype.visitTypeDefinition = function(node) {
14052 var oldType = this.currentType; 14163 var oldType = this.currentType;
14053 this.currentType = this.library.addType(node.name.name, node, node.isClass); 14164 this.currentType = this.library.addType(node.name.name, node, node.isClass);
14054 var $list = node.body; 14165 var $list = node.body;
14055 for (var $i = 0;$i < $list.length; $i++) { 14166 for (var $i = 0;$i < $list.length; $i++) {
14056 var member = $list.$index($i); 14167 var member = $list.$index($i);
14057 member.visit$1(this); 14168 member.visit$1(this);
(...skipping 17 matching lines...) Expand all
14075 function Parameter(definition) { 14186 function Parameter(definition) {
14076 this.isInitializer = false 14187 this.isInitializer = false
14077 this.definition = definition; 14188 this.definition = definition;
14078 // Initializers done 14189 // Initializers done
14079 } 14190 }
14080 Parameter.prototype.is$Parameter = function(){return this;}; 14191 Parameter.prototype.is$Parameter = function(){return this;};
14081 Parameter.prototype.get$definition = function() { return this.definition; }; 14192 Parameter.prototype.get$definition = function() { return this.definition; };
14082 Parameter.prototype.set$definition = function(value) { return this.definition = value; }; 14193 Parameter.prototype.set$definition = function(value) { return this.definition = value; };
14083 Parameter.prototype.get$name = function() { return this.name; }; 14194 Parameter.prototype.get$name = function() { return this.name; };
14084 Parameter.prototype.set$name = function(value) { return this.name = value; }; 14195 Parameter.prototype.set$name = function(value) { return this.name = value; };
14196 Parameter.prototype.get$type = function() { return this.type; };
14197 Parameter.prototype.set$type = function(value) { return this.type = value; };
14198 Parameter.prototype.get$isInitializer = function() { return this.isInitializer; };
14199 Parameter.prototype.set$isInitializer = function(value) { return this.isInitiali zer = value; };
14085 Parameter.prototype.get$value = function() { return this.value; }; 14200 Parameter.prototype.get$value = function() { return this.value; };
14086 Parameter.prototype.set$value = function(value) { return this.value = value; }; 14201 Parameter.prototype.set$value = function(value) { return this.value = value; };
14087 Parameter.prototype.resolve = function(method, inType) { 14202 Parameter.prototype.resolve = function(method, inType) {
14088 this.name = this.definition.name.name; 14203 this.name = this.definition.name.name;
14089 if (this.name.startsWith('this.')) { 14204 if (this.name.startsWith('this.')) {
14090 this.name = this.name.substring(5); 14205 this.name = this.name.substring(5);
14091 this.isInitializer = true; 14206 this.isInitializer = true;
14092 } 14207 }
14093 this.type = inType.resolveType(this.definition.type, false); 14208 this.type = inType.resolveType(this.definition.type, false);
14094 if ($notnull_bool(method.get$isStatic() && this.type.get$hasTypeParams())) { 14209 if ($notnull_bool(method.get$isStatic() && this.type.get$hasTypeParams())) {
14095 world.error('using type parameter in static context', this.definition.span); 14210 world.error('using type parameter in static context', this.definition.span);
14096 } 14211 }
14097 if (this.definition.value != null) { 14212 if (this.definition.value != null) {
14098 if ((this.definition.value instanceof NullExpression) && this.definition.val ue.span.start == this.definition.span.start) { 14213 if ((this.definition.value instanceof NullExpression) && this.definition.val ue.span.start == this.definition.span.start) {
14099 return; 14214 return;
14100 } 14215 }
14101 if ($notnull_bool(method.get$isAbstract())) { 14216 if ($notnull_bool(method.get$isAbstract())) {
14102 world.error('default value not allowed on abstract methods', this.definiti on.span); 14217 world.error('default value not allowed on abstract methods', this.definiti on.span);
14103 } 14218 }
14104 else if ($notnull_bool(method.name == '\$call' && method.get$definition().bo dy == null)) { 14219 else if ($notnull_bool(method.name == '\$call' && method.get$definition().ge t$body() == null)) {
14105 world.error('default value not allowed on function type', this.definition. span); 14220 world.error('default value not allowed on function type', this.definition. span);
14106 } 14221 }
14107 } 14222 }
14108 else if ($notnull_bool(this.isInitializer && !$notnull_bool(method.get$isConst ructor()))) { 14223 else if ($notnull_bool(this.isInitializer && !$notnull_bool(method.get$isConst ructor()))) {
14109 world.error('initializer parameters only allowed on constructors', this.defi nition.span); 14224 world.error('initializer parameters only allowed on constructors', this.defi nition.span);
14110 } 14225 }
14111 } 14226 }
14112 Parameter.prototype.genValue = function(method, context) { 14227 Parameter.prototype.genValue = function(method, context) {
14113 var $0; 14228 var $0;
14114 if (this.definition.value == null || this.value != null) return; 14229 if (this.definition.value == null || this.value != null) return;
14115 if (context == null) { 14230 if (context == null) {
14116 context = new MethodGenerator(method, null); 14231 context = new MethodGenerator(method, null);
14117 } 14232 }
14118 this.value = (($0 = this.definition.value.visit(context)) && $0.is$Value()); 14233 this.value = (($0 = this.definition.value.visit(context)) && $0.is$Value());
14119 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse); 14234 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse);
14120 } 14235 }
14121 Parameter.prototype.copyWithNewType = function(newType) { 14236 Parameter.prototype.copyWithNewType = function(newType) {
14122 var ret = new Parameter(this.definition); 14237 var ret = new Parameter(this.definition);
14123 ret.type = newType; 14238 ret.set$type(newType);
14124 ret.name = this.name; 14239 ret.set$name(this.name);
14125 ret.isInitializer = this.isInitializer; 14240 ret.set$isInitializer(this.isInitializer);
14126 return (ret && ret.is$Parameter()); 14241 return (ret && ret.is$Parameter());
14127 } 14242 }
14128 Parameter.prototype.get$isOptional = function() { 14243 Parameter.prototype.get$isOptional = function() {
14129 return this.definition != null && this.definition.value != null; 14244 return this.definition != null && this.definition.value != null;
14130 } 14245 }
14131 Parameter.prototype.copyWithNewType$1 = function($0) { 14246 Parameter.prototype.copyWithNewType$1 = function($0) {
14132 return this.copyWithNewType(($0 && $0.is$lang_Type())); 14247 return this.copyWithNewType(($0 && $0.is$lang_Type()));
14133 }; 14248 };
14134 Parameter.prototype.genValue$2 = function($0, $1) { 14249 Parameter.prototype.genValue$2 = function($0, $1) {
14135 return this.genValue(($0 && $0.is$MethodMember()), ($1 && $1.is$MethodGenerato r())); 14250 return this.genValue(($0 && $0.is$MethodMember()), ($1 && $1.is$MethodGenerato r()));
14136 }; 14251 };
14137 Parameter.prototype.resolve$2 = function($0, $1) { 14252 Parameter.prototype.resolve$2 = function($0, $1) {
14138 return this.resolve(($0 && $0.is$Member()), ($1 && $1.is$lang_Type())); 14253 return this.resolve(($0 && $0.is$Member()), ($1 && $1.is$lang_Type()));
14139 }; 14254 };
14140 // ********** Code for Member ************** 14255 // ********** Code for Member **************
14141 function Member(name, declaringType) { 14256 function Member(name, declaringType) {
14142 this.name = name; 14257 this.name = name;
14143 this.declaringType = declaringType; 14258 this.declaringType = declaringType;
14144 this.isGenerated = false; 14259 this.isGenerated = false;
14145 // Initializers done 14260 // Initializers done
14146 } 14261 }
14147 Member.prototype.is$Member = function(){return this;}; 14262 Member.prototype.is$Member = function(){return this;};
14148 Member.prototype.is$Named = function(){return this;}; 14263 Member.prototype.is$Named = function(){return this;};
14149 Member.prototype.get$name = function() { return this.name; }; 14264 Member.prototype.get$name = function() { return this.name; };
14265 Member.prototype.get$declaringType = function() { return this.declaringType; };
14266 Member.prototype.get$generator = function() { return this.generator; };
14267 Member.prototype.set$generator = function(value) { return this.generator = value ; };
14150 Member.prototype.get$jsname = function() { 14268 Member.prototype.get$jsname = function() {
14151 return this._jsname == null ? this.name : this._jsname; 14269 return this._jsname == null ? this.name : this._jsname;
14152 } 14270 }
14153 Member.prototype.set$jsname = function(name) { 14271 Member.prototype.set$jsname = function(name) {
14154 return this._jsname = name; 14272 return this._jsname = name;
14155 } 14273 }
14156 Member.prototype.get$library = function() { 14274 Member.prototype.get$library = function() {
14157 return this.declaringType.get$library(); 14275 return this.declaringType.get$library();
14158 } 14276 }
14159 Member.prototype.get$isPrivate = function() { 14277 Member.prototype.get$isPrivate = function() {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
14220 Member.prototype.get$definition = function() { 14338 Member.prototype.get$definition = function() {
14221 return null; 14339 return null;
14222 } 14340 }
14223 Member.prototype.get$parameters = function() { 14341 Member.prototype.get$parameters = function() {
14224 return []; 14342 return [];
14225 } 14343 }
14226 Member.prototype.canInvoke = function(context, args) { 14344 Member.prototype.canInvoke = function(context, args) {
14227 return $notnull_bool(this.get$canGet() && new Value(this.get$returnType(), nul l, null, true).canInvoke(context, '\$call', args)); 14345 return $notnull_bool(this.get$canGet() && new Value(this.get$returnType(), nul l, null, true).canInvoke(context, '\$call', args));
14228 } 14346 }
14229 Member.prototype.invoke = function(context, node, target, args, isDynamic) { 14347 Member.prototype.invoke = function(context, node, target, args, isDynamic) {
14348 var $0;
14230 var newTarget = this._get(context, node, target, isDynamic); 14349 var newTarget = this._get(context, node, target, isDynamic);
14231 return newTarget.invoke$5(context, '\$call', node, args, isDynamic); 14350 return (($0 = newTarget.invoke$5(context, '\$call', node, args, isDynamic)) && $0.is$Value());
14232 } 14351 }
14233 Member.prototype.override = function(other) { 14352 Member.prototype.override = function(other) {
14234 if ($notnull_bool(this.get$isStatic())) { 14353 if ($notnull_bool(this.get$isStatic())) {
14235 world.error('static members can not hide parent members', this.get$span(), o ther.get$span()); 14354 world.error('static members can not hide parent members', this.get$span(), o ther.get$span());
14236 return false; 14355 return false;
14237 } 14356 }
14238 else if ($notnull_bool(other.get$isStatic())) { 14357 else if ($notnull_bool(other.get$isStatic())) {
14239 world.error('can not override static member', this.get$span(), other.get$spa n()); 14358 world.error('can not override static member', this.get$span(), other.get$spa n());
14240 return false; 14359 return false;
14241 } 14360 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
14286 return this.resolve(($0 && $0.is$lang_Type())); 14405 return this.resolve(($0 && $0.is$lang_Type()));
14287 }; 14406 };
14288 // ********** Code for TypeMember ************** 14407 // ********** Code for TypeMember **************
14289 function TypeMember(type) { 14408 function TypeMember(type) {
14290 this.type = type; 14409 this.type = type;
14291 Member.call(this, type.name, type.library.topType); 14410 Member.call(this, type.name, type.library.topType);
14292 // Initializers done 14411 // Initializers done
14293 } 14412 }
14294 $inherits(TypeMember, Member); 14413 $inherits(TypeMember, Member);
14295 TypeMember.prototype.is$TypeMember = function(){return this;}; 14414 TypeMember.prototype.is$TypeMember = function(){return this;};
14415 TypeMember.prototype.get$type = function() { return this.type; };
14296 TypeMember.prototype.get$span = function() { 14416 TypeMember.prototype.get$span = function() {
14297 return this.type.definition.span; 14417 return this.type.definition.span;
14298 } 14418 }
14299 TypeMember.prototype.get$isStatic = function() { 14419 TypeMember.prototype.get$isStatic = function() {
14300 return true; 14420 return true;
14301 } 14421 }
14302 TypeMember.prototype.get$returnType = function() { 14422 TypeMember.prototype.get$returnType = function() {
14303 return world.varType; 14423 return world.varType;
14304 } 14424 }
14305 TypeMember.prototype.canInvoke = function(context, args) { 14425 TypeMember.prototype.canInvoke = function(context, args) {
14306 return false; 14426 return false;
14307 } 14427 }
14308 TypeMember.prototype.get$canGet = function() { 14428 TypeMember.prototype.get$canGet = function() {
14309 return true; 14429 return true;
14310 } 14430 }
14311 TypeMember.prototype.get$canSet = function() { 14431 TypeMember.prototype.get$canSet = function() {
14312 return false; 14432 return false;
14313 } 14433 }
14314 TypeMember.prototype.resolve = function(inType) { 14434 TypeMember.prototype.resolve = function(inType) {
14315 14435
14316 } 14436 }
14317 TypeMember.prototype._get = function(context, node, target, isDynamic) { 14437 TypeMember.prototype._get = function(context, node, target, isDynamic) {
14318 var ret = new Value(this.type, this.type.get$jsname(), node.span, false); 14438 var ret = new Value(this.type, this.type.get$jsname(), node.span, false);
14319 ret.isType = true; 14439 ret.set$isType(true);
14320 return (ret && ret.is$Value()); 14440 return (ret && ret.is$Value());
14321 } 14441 }
14322 TypeMember.prototype._set = function(context, node, target, value, isDynamic) { 14442 TypeMember.prototype._set = function(context, node, target, value, isDynamic) {
14323 world.error('can not set type', this.type.definition.span); 14443 world.error('can not set type', this.type.definition.span);
14324 } 14444 }
14325 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { 14445 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) {
14326 world.error('can not invoke type', this.type.definition.span); 14446 world.error('can not invoke type', this.type.definition.span);
14327 } 14447 }
14328 TypeMember.prototype._get$3 = function($0, $1, $2) { 14448 TypeMember.prototype._get$3 = function($0, $1, $2) {
14329 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); 14449 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
(...skipping 23 matching lines...) Expand all
14353 this.definition = definition; 14473 this.definition = definition;
14354 this.value = value; 14474 this.value = value;
14355 this.isNative = false; 14475 this.isNative = false;
14356 Member.call(this, name, declaringType); 14476 Member.call(this, name, declaringType);
14357 // Initializers done 14477 // Initializers done
14358 } 14478 }
14359 $inherits(FieldMember, Member); 14479 $inherits(FieldMember, Member);
14360 FieldMember.prototype.is$FieldMember = function(){return this;}; 14480 FieldMember.prototype.is$FieldMember = function(){return this;};
14361 FieldMember.prototype.get$definition = function() { return this.definition; }; 14481 FieldMember.prototype.get$definition = function() { return this.definition; };
14362 FieldMember.prototype.get$value = function() { return this.value; }; 14482 FieldMember.prototype.get$value = function() { return this.value; };
14483 FieldMember.prototype.get$type = function() { return this.type; };
14484 FieldMember.prototype.set$type = function(value) { return this.type = value; };
14363 FieldMember.prototype.get$isStatic = function() { return this.isStatic; }; 14485 FieldMember.prototype.get$isStatic = function() { return this.isStatic; };
14364 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va lue; }; 14486 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va lue; };
14487 FieldMember.prototype.get$isFinal = function() { return this.isFinal; };
14488 FieldMember.prototype.set$isFinal = function(value) { return this.isFinal = valu e; };
14365 FieldMember.prototype.get$isNative = function() { return this.isNative; }; 14489 FieldMember.prototype.get$isNative = function() { return this.isNative; };
14366 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va lue; }; 14490 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va lue; };
14367 FieldMember.prototype.override = function(other) { 14491 FieldMember.prototype.override = function(other) {
14368 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false; 14492 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false;
14369 if ($notnull_bool(other.get$isProperty())) { 14493 if ($notnull_bool(other.get$isProperty())) {
14370 return true; 14494 return true;
14371 } 14495 }
14372 else { 14496 else {
14373 world.error('field can not override anything but property', this.get$span(), other.get$span()); 14497 world.error('field can not override anything but property', this.get$span(), other.get$span());
14374 return false; 14498 return false;
(...skipping 21 matching lines...) Expand all
14396 FieldMember.prototype.get$canGet = function() { 14520 FieldMember.prototype.get$canGet = function() {
14397 return true; 14521 return true;
14398 } 14522 }
14399 FieldMember.prototype.get$canSet = function() { 14523 FieldMember.prototype.get$canSet = function() {
14400 return !$notnull_bool(this.isFinal); 14524 return !$notnull_bool(this.isFinal);
14401 } 14525 }
14402 FieldMember.prototype.get$isField = function() { 14526 FieldMember.prototype.get$isField = function() {
14403 return true; 14527 return true;
14404 } 14528 }
14405 FieldMember.prototype.resolve = function(inType) { 14529 FieldMember.prototype.resolve = function(inType) {
14530 var $0;
14406 this.isStatic = this.declaringType.get$isTop(); 14531 this.isStatic = this.declaringType.get$isTop();
14407 this.isFinal = false; 14532 this.isFinal = false;
14408 if (this.definition.modifiers != null) { 14533 if (this.definition.modifiers != null) {
14409 var $list = this.definition.modifiers; 14534 var $list = this.definition.modifiers;
14410 for (var $i = 0;$i < $list.length; $i++) { 14535 for (var $i = 0;$i < $list.length; $i++) {
14411 var mod = $list.$index($i); 14536 var mod = $list.$index($i);
14412 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { 14537 if ($notnull_bool($eq(mod.get$kind(), 86/*TokenKind.STATIC*/))) {
14413 if ($notnull_bool(this.isStatic)) { 14538 if ($notnull_bool(this.isStatic)) {
14414 world.error('duplicate static modifier', mod.get$span()); 14539 world.error('duplicate static modifier', (($0 = mod.get$span()) && $0. is$SourceSpan()));
14415 } 14540 }
14416 this.isStatic = true; 14541 this.isStatic = true;
14417 } 14542 }
14418 else if ($notnull_bool($eq(mod.kind, 97/*TokenKind.FINAL*/))) { 14543 else if ($notnull_bool($eq(mod.get$kind(), 97/*TokenKind.FINAL*/))) {
14419 if ($notnull_bool(this.isFinal)) { 14544 if ($notnull_bool(this.isFinal)) {
14420 world.error('duplicate final modifier', mod.get$span()); 14545 world.error('duplicate final modifier', (($0 = mod.get$span()) && $0.i s$SourceSpan()));
14421 } 14546 }
14422 this.isFinal = true; 14547 this.isFinal = true;
14423 } 14548 }
14424 else { 14549 else {
14425 world.error(('' + mod + ' modifier not allowed on field'), mod.get$span( )); 14550 world.error(('' + mod + ' modifier not allowed on field'), (($0 = mod.ge t$span()) && $0.is$SourceSpan()));
14426 } 14551 }
14427 } 14552 }
14428 } 14553 }
14429 this.type = inType.resolveType(this.definition.type, false); 14554 this.type = inType.resolveType(this.definition.type, false);
14430 if ($notnull_bool(this.isStatic && this.type.get$hasTypeParams())) { 14555 if ($notnull_bool(this.isStatic && this.type.get$hasTypeParams())) {
14431 world.error('using type parameter in static context', this.definition.type.s pan); 14556 world.error('using type parameter in static context', this.definition.type.s pan);
14432 } 14557 }
14433 if ($notnull_bool(this.isStatic && this.isFinal) && this.value == null) { 14558 if ($notnull_bool(this.isStatic && this.isFinal) && this.value == null) {
14434 world.error('static final field is missing initializer', this.get$span()); 14559 world.error('static final field is missing initializer', this.get$span());
14435 } 14560 }
14436 this.get$library()._addMember(this); 14561 this.get$library()._addMember(this);
14437 } 14562 }
14438 FieldMember.prototype.computeValue = function() { 14563 FieldMember.prototype.computeValue = function() {
14439 var $0; 14564 var $0;
14440 if (this.value == null) return null; 14565 if (this.value == null) return null;
14441 if (this._computedValue == null) { 14566 if (this._computedValue == null) {
14442 if ($notnull_bool(this._computing)) { 14567 if ($notnull_bool(this._computing)) {
14443 world.error('circular reference', this.value.span); 14568 world.error('circular reference', this.value.span);
14444 return null; 14569 return null;
14445 } 14570 }
14446 this._computing = true; 14571 this._computing = true;
14447 var finalMethod = new MethodMember('final_context', this.declaringType, null ); 14572 var finalMethod = new MethodMember('final_context', this.declaringType, null );
14448 finalMethod.isStatic = true; 14573 finalMethod.set$isStatic(true);
14449 var finalGen = new MethodGenerator(finalMethod, null); 14574 var finalGen = new MethodGenerator(finalMethod, null);
14450 this._computedValue = (($0 = this.value.visit(finalGen)) && $0.is$Value()); 14575 this._computedValue = (($0 = this.value.visit(finalGen)) && $0.is$Value());
14451 if (!$notnull_bool(this._computedValue.get$isConst())) { 14576 if (!$notnull_bool(this._computedValue.get$isConst())) {
14452 if ($notnull_bool(this.isStatic)) { 14577 if ($notnull_bool(this.isStatic)) {
14453 world.error('non constant static field must be initialized in functions' , this.value.span); 14578 world.error('non constant static field must be initialized in functions' , this.value.span);
14454 } 14579 }
14455 else { 14580 else {
14456 world.error('non constant field must be initialized in constructor', thi s.value.span); 14581 world.error('non constant field must be initialized in constructor', thi s.value.span);
14457 } 14582 }
14458 } 14583 }
(...skipping 15 matching lines...) Expand all
14474 return (cv && cv.is$Value()); 14599 return (cv && cv.is$Value());
14475 } 14600 }
14476 if ($notnull_bool(this.declaringType.get$isTop())) { 14601 if ($notnull_bool(this.declaringType.get$isTop())) {
14477 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, true ); 14602 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, true );
14478 } 14603 }
14479 else { 14604 else {
14480 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, true); 14605 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, true);
14481 } 14606 }
14482 } 14607 }
14483 else if ($notnull_bool(target.get$isConst() && this.isFinal)) { 14608 else if ($notnull_bool(target.get$isConst() && this.isFinal)) {
14484 var constTarget = (target instanceof GlobalValue) ? target.get$dynamic().exp : target; 14609 var constTarget = (target instanceof GlobalValue) ? target.get$dynamic().get $exp() : target;
14485 if ((constTarget instanceof ConstObjectValue)) { 14610 if ((constTarget instanceof ConstObjectValue)) {
14486 return (($0 = constTarget.fields.$index(this.name)) && $0.is$Value()); 14611 return (($0 = constTarget.get$fields().$index(this.name)) && $0.is$Value() );
14487 } 14612 }
14488 else if ($notnull_bool($eq(constTarget.type, world.stringType) && this.name == 'length')) { 14613 else if ($notnull_bool($eq(constTarget.get$type(), world.stringType) && this .name == 'length')) {
14489 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), node.span, true); 14614 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), node.span, true);
14490 } 14615 }
14491 } 14616 }
14492 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, true); 14617 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, true);
14493 } 14618 }
14494 FieldMember.prototype._set = function(context, node, target, value, isDynamic) { 14619 FieldMember.prototype._set = function(context, node, target, value, isDynamic) {
14495 var lhs = this._get(context, node, target, isDynamic); 14620 var lhs = this._get(context, node, target, isDynamic);
14496 value = value.convertTo(context, this.type, node, isDynamic); 14621 value = value.convertTo(context, this.type, node, isDynamic);
14497 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), node.sp an, true); 14622 return new Value(this.type, ('' + lhs.get$code() + ' = ' + value.code + ''), n ode.span, true);
14498 } 14623 }
14499 FieldMember.prototype._get$3 = function($0, $1, $2) { 14624 FieldMember.prototype._get$3 = function($0, $1, $2) {
14500 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); 14625 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
14501 }; 14626 };
14502 FieldMember.prototype._set$4 = function($0, $1, $2, $3) { 14627 FieldMember.prototype._set$4 = function($0, $1, $2, $3) {
14503 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); 14628 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false);
14504 }; 14629 };
14505 FieldMember.prototype.computeValue$0 = function() { 14630 FieldMember.prototype.computeValue$0 = function() {
14506 return this.computeValue(); 14631 return this.computeValue();
14507 }; 14632 };
14508 FieldMember.prototype.provideFieldSyntax$0 = function() { 14633 FieldMember.prototype.provideFieldSyntax$0 = function() {
14509 return this.provideFieldSyntax(); 14634 return this.provideFieldSyntax();
14510 }; 14635 };
14511 FieldMember.prototype.providePropertySyntax$0 = function() { 14636 FieldMember.prototype.providePropertySyntax$0 = function() {
14512 return this.providePropertySyntax(); 14637 return this.providePropertySyntax();
14513 }; 14638 };
14514 FieldMember.prototype.resolve$1 = function($0) { 14639 FieldMember.prototype.resolve$1 = function($0) {
14515 return this.resolve(($0 && $0.is$lang_Type())); 14640 return this.resolve(($0 && $0.is$lang_Type()));
14516 }; 14641 };
14517 // ********** Code for PropertyMember ************** 14642 // ********** Code for PropertyMember **************
14518 function PropertyMember(name, declaringType) { 14643 function PropertyMember(name, declaringType) {
14519 this._provideFieldSyntax = false 14644 this._provideFieldSyntax = false
14520 Member.call(this, name, declaringType); 14645 Member.call(this, name, declaringType);
14521 // Initializers done 14646 // Initializers done
14522 } 14647 }
14523 $inherits(PropertyMember, Member); 14648 $inherits(PropertyMember, Member);
14524 PropertyMember.prototype.is$PropertyMember = function(){return this;}; 14649 PropertyMember.prototype.is$PropertyMember = function(){return this;};
14650 PropertyMember.prototype.get$getter = function() { return this.getter; };
14651 PropertyMember.prototype.set$getter = function(value) { return this.getter = val ue; };
14652 PropertyMember.prototype.get$setter = function() { return this.setter; };
14653 PropertyMember.prototype.set$setter = function(value) { return this.setter = val ue; };
14525 PropertyMember.prototype.get$span = function() { 14654 PropertyMember.prototype.get$span = function() {
14526 var $0; 14655 var $0;
14527 return (($0 = this.getter != null ? this.getter.get$span() : null) && $0.is$So urceSpan()); 14656 return (($0 = this.getter != null ? this.getter.get$span() : null) && $0.is$So urceSpan());
14528 } 14657 }
14529 PropertyMember.prototype.get$canGet = function() { 14658 PropertyMember.prototype.get$canGet = function() {
14530 return this.getter != null; 14659 return this.getter != null;
14531 } 14660 }
14532 PropertyMember.prototype.get$canSet = function() { 14661 PropertyMember.prototype.get$canSet = function() {
14533 return this.setter != null; 14662 return this.setter != null;
14534 } 14663 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
14619 // ********** Code for ConcreteMember ************** 14748 // ********** Code for ConcreteMember **************
14620 function ConcreteMember(name, declaringType, baseMember) { 14749 function ConcreteMember(name, declaringType, baseMember) {
14621 this.baseMember = baseMember; 14750 this.baseMember = baseMember;
14622 Member.call(this, name, declaringType); 14751 Member.call(this, name, declaringType);
14623 // Initializers done 14752 // Initializers done
14624 this.parameters = []; 14753 this.parameters = [];
14625 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring Type); 14754 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring Type);
14626 var $list = this.baseMember.get$parameters(); 14755 var $list = this.baseMember.get$parameters();
14627 for (var $i = 0;$i < $list.length; $i++) { 14756 for (var $i = 0;$i < $list.length; $i++) {
14628 var p = $list.$index($i); 14757 var p = $list.$index($i);
14629 var newType = p.type.resolveTypeParams$1(declaringType); 14758 var newType = p.get$type().resolveTypeParams$1(declaringType);
14630 if ($notnull_bool($ne(newType, p.type))) { 14759 if ($notnull_bool($ne(newType, p.get$type()))) {
14631 this.parameters.add(p.copyWithNewType$1(newType)); 14760 this.parameters.add(p.copyWithNewType$1(newType));
14632 } 14761 }
14633 else { 14762 else {
14634 this.parameters.add(p); 14763 this.parameters.add(p);
14635 } 14764 }
14636 } 14765 }
14637 } 14766 }
14638 $inherits(ConcreteMember, Member); 14767 $inherits(ConcreteMember, Member);
14639 ConcreteMember.prototype.is$ConcreteMember = function(){return this;}; 14768 ConcreteMember.prototype.is$ConcreteMember = function(){return this;};
14640 ConcreteMember.prototype.get$returnType = function() { return this.returnType; } ; 14769 ConcreteMember.prototype.get$returnType = function() { return this.returnType; } ;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
14781 MethodMember.prototype.get$parameters = function() { return this.parameters; }; 14910 MethodMember.prototype.get$parameters = function() { return this.parameters; };
14782 MethodMember.prototype.set$parameters = function(value) { return this.parameters = value; }; 14911 MethodMember.prototype.set$parameters = function(value) { return this.parameters = value; };
14783 MethodMember.prototype.get$isStatic = function() { return this.isStatic; }; 14912 MethodMember.prototype.get$isStatic = function() { return this.isStatic; };
14784 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v alue; }; 14913 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v alue; };
14785 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; }; 14914 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; };
14786 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract = value; }; 14915 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract = value; };
14787 MethodMember.prototype.get$isConst = function() { return this.isConst; }; 14916 MethodMember.prototype.get$isConst = function() { return this.isConst; };
14788 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val ue; }; 14917 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val ue; };
14789 MethodMember.prototype.get$isFactory = function() { return this.isFactory; }; 14918 MethodMember.prototype.get$isFactory = function() { return this.isFactory; };
14790 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory = value; }; 14919 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory = value; };
14920 MethodMember.prototype.get$isLambda = function() { return this.isLambda; };
14921 MethodMember.prototype.set$isLambda = function(value) { return this.isLambda = v alue; };
14791 MethodMember.prototype.get$initDelegate = function() { return this.initDelegate; }; 14922 MethodMember.prototype.get$initDelegate = function() { return this.initDelegate; };
14792 MethodMember.prototype.set$initDelegate = function(value) { return this.initDele gate = value; }; 14923 MethodMember.prototype.set$initDelegate = function(value) { return this.initDele gate = value; };
14793 MethodMember.prototype.get$isConstructor = function() { 14924 MethodMember.prototype.get$isConstructor = function() {
14794 return this.name == this.declaringType.name; 14925 return this.name == this.declaringType.name;
14795 } 14926 }
14796 MethodMember.prototype.get$isMethod = function() { 14927 MethodMember.prototype.get$isMethod = function() {
14797 return !$notnull_bool(this.get$isConstructor()); 14928 return !$notnull_bool(this.get$isConstructor());
14798 } 14929 }
14799 MethodMember.prototype.get$isNative = function() { 14930 MethodMember.prototype.get$isNative = function() {
14800 return (this.definition.body instanceof NativeStatement); 14931 return (this.definition.body instanceof NativeStatement);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
14891 } 15022 }
14892 this._providePropertySyntax = true; 15023 this._providePropertySyntax = true;
14893 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), node.span, true); 15024 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), node.span, true);
14894 } 15025 }
14895 MethodMember.prototype.namesInOrder = function(args) { 15026 MethodMember.prototype.namesInOrder = function(args) {
14896 if (!$notnull_bool(args.get$hasNames())) return true; 15027 if (!$notnull_bool(args.get$hasNames())) return true;
14897 var lastParameter = null; 15028 var lastParameter = null;
14898 for (var i = args.get$bareCount(); 15029 for (var i = args.get$bareCount();
14899 i < this.parameters.length; i++) { 15030 i < this.parameters.length; i++) {
14900 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam e())); 15031 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam e()));
14901 if ($notnull_bool(p >= 0 && args.values.$index(p).needsTemp)) { 15032 if ($notnull_bool(p >= 0 && args.values.$index(p).get$needsTemp())) {
14902 if (lastParameter != null && lastParameter > $assert_num(p)) { 15033 if (lastParameter != null && lastParameter > $assert_num(p)) {
14903 return false; 15034 return false;
14904 } 15035 }
14905 lastParameter = $assert_num(p); 15036 lastParameter = $assert_num(p);
14906 } 15037 }
14907 } 15038 }
14908 return true; 15039 return true;
14909 } 15040 }
14910 MethodMember.prototype.needsArgumentConversion = function(args) { 15041 MethodMember.prototype.needsArgumentConversion = function(args) {
14911 var bareCount = args.get$bareCount(); 15042 var bareCount = args.get$bareCount();
14912 for (var i = 0; 15043 for (var i = 0;
14913 i < bareCount; i++) { 15044 i < bareCount; i++) {
14914 var arg = args.values.$index(i); 15045 var arg = args.values.$index(i);
14915 if ($notnull_bool(arg.needsConversion$1(this.parameters.$index(i).type))) { 15046 if ($notnull_bool(arg.needsConversion$1(this.parameters.$index(i).get$type() ))) {
14916 return false; 15047 return false;
14917 } 15048 }
14918 } 15049 }
14919 if (bareCount < this.parameters.length) { 15050 if (bareCount < this.parameters.length) {
14920 this.genParameterValues(); 15051 this.genParameterValues();
14921 for (var i = bareCount; 15052 for (var i = bareCount;
14922 i < this.parameters.length; i++) { 15053 i < this.parameters.length; i++) {
14923 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( ))); 15054 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( )));
14924 if ($notnull_bool($ne(arg, null) && arg.needsConversion$1(this.parameters. $index(i).type))) { 15055 if ($notnull_bool($ne(arg, null) && arg.needsConversion$1(this.parameters. $index(i).get$type()))) {
14925 return false; 15056 return false;
14926 } 15057 }
14927 } 15058 }
14928 } 15059 }
14929 return true; 15060 return true;
14930 } 15061 }
14931 MethodMember._argCountMsg = function(actual, expected, atLeast) { 15062 MethodMember._argCountMsg = function(actual, expected, atLeast) {
14932 return 'wrong number of arguments, expected ' + ('' + ($notnull_bool(atLeast) ? "at least " : "") + '' + expected + ' but found ' + actual + ''); 15063 return 'wrong number of arguments, expected ' + ('' + ($notnull_bool(atLeast) ? "at least " : "") + '' + expected + ' but found ' + actual + '');
14933 } 15064 }
14934 MethodMember.prototype._argError = function(context, node, target, args, msg) { 15065 MethodMember.prototype._argError = function(context, node, target, args, msg) {
14935 if ($notnull_bool(this.isStatic || this.get$isConstructor())) { 15066 if ($notnull_bool(this.isStatic || this.get$isConstructor())) {
14936 world.error(msg, node.span); 15067 world.error(msg, node.span);
14937 } 15068 }
14938 else { 15069 else {
14939 world.warning(msg, node.span); 15070 world.warning(msg, node.span);
14940 } 15071 }
14941 return target.invokeNoSuchMethod(context, this.name, node, args); 15072 return target.invokeNoSuchMethod(context, this.name, node, args);
14942 } 15073 }
14943 MethodMember.prototype.genParameterValues = function() { 15074 MethodMember.prototype.genParameterValues = function() {
14944 var $list = this.parameters; 15075 var $list = this.parameters;
14945 for (var $i = 0;$i < $list.length; $i++) { 15076 for (var $i = 0;$i < $list.length; $i++) {
14946 var p = $list.$index($i); 15077 var p = $list.$index($i);
14947 p.genValue$2(this, this.generator); 15078 p.genValue$2(this, this.generator);
14948 } 15079 }
14949 } 15080 }
14950 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) { 15081 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) {
15082 var $0;
14951 if (this.parameters == null) { 15083 if (this.parameters == null) {
14952 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.' + this.name + '')); 15084 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.' + this.name + ''));
14953 this.resolve(this.declaringType); 15085 this.resolve(this.declaringType);
14954 } 15086 }
14955 this.declaringType.genMethod(this); 15087 this.declaringType.genMethod(this);
14956 if ($notnull_bool(this.isStatic || this.isFactory)) { 15088 if ($notnull_bool(this.isStatic || this.isFactory)) {
14957 this.declaringType.markUsed(); 15089 this.declaringType.markUsed();
14958 } 15090 }
14959 if ($notnull_bool(this.get$isNative() && this.returnType != null)) this.return Type.markUsed(); 15091 if ($notnull_bool(this.get$isNative() && this.returnType != null)) this.return Type.markUsed();
14960 if (!$notnull_bool(this.namesInOrder(args))) { 15092 if (!$notnull_bool(this.namesInOrder(args))) {
14961 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s); 15093 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s);
14962 } 15094 }
14963 var argsCode = []; 15095 var argsCode = [];
14964 if (target != null && ($notnull_bool(this.get$isConstructor() || target.isSupe r))) { 15096 if (target != null && ($notnull_bool(this.get$isConstructor() || target.isSupe r))) {
14965 argsCode.add$1('this'); 15097 argsCode.add$1('this');
14966 } 15098 }
14967 var bareCount = args.get$bareCount(); 15099 var bareCount = args.get$bareCount();
14968 for (var i = 0; 15100 for (var i = 0;
14969 i < bareCount; i++) { 15101 i < bareCount; i++) {
14970 var arg = args.values.$index(i); 15102 var arg = args.values.$index(i);
14971 if (i >= this.parameters.length) { 15103 if (i >= this.parameters.length) {
14972 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false); 15104 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false);
14973 return this._argError(context, node, target, args, $assert_String(msg)); 15105 return this._argError(context, node, target, args, $assert_String(msg));
14974 } 15106 }
14975 arg = arg.convertTo$4(context, this.parameters.$index(i).type, node, isDynam ic); 15107 arg = arg.convertTo$4(context, this.parameters.$index(i).get$type(), node, i sDynamic);
14976 if ($notnull_bool(this.isConst && arg.get$isConst())) { 15108 if ($notnull_bool(this.isConst && arg.get$isConst())) {
14977 argsCode.add$1(arg.get$canonicalCode()); 15109 argsCode.add$1(arg.get$canonicalCode());
14978 } 15110 }
14979 else { 15111 else {
14980 argsCode.add$1(arg.code); 15112 argsCode.add$1(arg.get$code());
14981 } 15113 }
14982 } 15114 }
14983 if (bareCount < this.parameters.length) { 15115 if (bareCount < this.parameters.length) {
14984 this.genParameterValues(); 15116 this.genParameterValues();
14985 var namedArgsUsed = 0; 15117 var namedArgsUsed = 0;
14986 for (var i = bareCount; 15118 for (var i = bareCount;
14987 i < this.parameters.length; i++) { 15119 i < this.parameters.length; i++) {
14988 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( ))); 15120 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( )));
14989 if ($notnull_bool(arg == null)) { 15121 if ($notnull_bool(arg == null)) {
14990 arg = this.parameters.$index(i).get$value(); 15122 arg = this.parameters.$index(i).get$value();
14991 } 15123 }
14992 else { 15124 else {
14993 arg = arg.convertTo$4(context, this.parameters.$index(i).type, node, isD ynamic); 15125 arg = arg.convertTo$4(context, this.parameters.$index(i).get$type(), nod e, isDynamic);
14994 namedArgsUsed++; 15126 namedArgsUsed++;
14995 } 15127 }
14996 if ($notnull_bool(arg == null || !$notnull_bool(this.parameters.$index(i). get$isOptional()))) { 15128 if ($notnull_bool(arg == null || !$notnull_bool(this.parameters.$index(i). get$isOptional()))) {
14997 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + 1, true); 15129 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + 1, true);
14998 return this._argError(context, node, target, args, $assert_String(msg)); 15130 return this._argError(context, node, target, args, $assert_String(msg));
14999 } 15131 }
15000 else { 15132 else {
15001 argsCode.add$1($notnull_bool(this.isConst && arg.get$isConst()) ? arg.ge t$canonicalCode() : arg.code); 15133 argsCode.add$1($notnull_bool(this.isConst && arg.get$isConst()) ? arg.ge t$canonicalCode() : arg.get$code());
15002 } 15134 }
15003 } 15135 }
15004 if (namedArgsUsed < args.get$nameCount()) { 15136 if (namedArgsUsed < args.get$nameCount()) {
15005 var seen = new HashSetImplementation(); 15137 var seen = new HashSetImplementation();
15006 for (var i = bareCount; 15138 for (var i = bareCount;
15007 i < args.get$length(); i++) { 15139 i < args.get$length(); i++) {
15008 var name = args.getName(i); 15140 var name = args.getName(i);
15009 if ($notnull_bool(seen.contains$1(name))) { 15141 if ($notnull_bool(seen.contains$1(name))) {
15010 return this._argError(context, node, target, args, ('duplicate argumen t "' + name + '"')); 15142 return this._argError(context, node, target, args, ('duplicate argumen t "' + name + '"'));
15011 } 15143 }
(...skipping 25 matching lines...) Expand all
15037 } 15169 }
15038 if ($notnull_bool(this.isStatic)) { 15170 if ($notnull_bool(this.isStatic)) {
15039 if ($notnull_bool(this.declaringType.get$isTop())) { 15171 if ($notnull_bool(this.declaringType.get$isTop())) {
15040 return new Value(this.get$inferredResult(), ('' + this.get$jsname() + '(' + argsString + ')'), node != null ? node.span : node, true); 15172 return new Value(this.get$inferredResult(), ('' + this.get$jsname() + '(' + argsString + ')'), node != null ? node.span : node, true);
15041 } 15173 }
15042 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn ame() + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true); 15174 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn ame() + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true);
15043 } 15175 }
15044 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ') '); 15176 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ') ');
15045 if ($notnull_bool(target.get$isConst())) { 15177 if ($notnull_bool(target.get$isConst())) {
15046 if ((target instanceof GlobalValue)) { 15178 if ((target instanceof GlobalValue)) {
15047 target = target.get$dynamic().exp; 15179 target = (($0 = target.get$dynamic().get$exp()) && $0.is$Value());
15048 } 15180 }
15049 if (this.name == 'get\$length') { 15181 if (this.name == 'get\$length') {
15050 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) { 15182 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) {
15051 code = ('' + target.get$dynamic().values.length + ''); 15183 code = ('' + target.get$dynamic().get$values().length + '');
15052 } 15184 }
15053 } 15185 }
15054 else if (this.name == 'isEmpty') { 15186 else if (this.name == 'isEmpty') {
15055 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) { 15187 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) {
15056 code = ('' + target.get$dynamic().values.isEmpty$0() + ''); 15188 code = ('' + target.get$dynamic().get$values().isEmpty$0() + '');
15057 } 15189 }
15058 } 15190 }
15059 } 15191 }
15060 if (this.name == 'get\$typeName' && $eq(this.declaringType.get$library(), worl d.get$dom())) { 15192 if (this.name == 'get\$typeName' && $eq(this.declaringType.get$library(), worl d.get$dom())) {
15061 world.gen.corejs.useTypeNameOf = true; 15193 world.gen.corejs.useTypeNameOf = true;
15062 } 15194 }
15063 return new Value(this.get$inferredResult(), code, node.span, true); 15195 return new Value(this.get$inferredResult(), code, node.span, true);
15064 } 15196 }
15065 MethodMember.prototype._invokeConstructor = function(context, node, target, args , argsString) { 15197 MethodMember.prototype._invokeConstructor = function(context, node, target, args , argsString) {
15066 this.declaringType.markUsed(); 15198 this.declaringType.markUsed();
(...skipping 10 matching lines...) Expand all
15077 return new Value(this.declaringType, code, node.span, true); 15209 return new Value(this.declaringType, code, node.span, true);
15078 } 15210 }
15079 } 15211 }
15080 } 15212 }
15081 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar gs) { 15213 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar gs) {
15082 var $0; 15214 var $0;
15083 var fields = new HashMapImplementation(); 15215 var fields = new HashMapImplementation();
15084 for (var i = 0; 15216 for (var i = 0;
15085 i < this.parameters.length; i++) { 15217 i < this.parameters.length; i++) {
15086 var param = this.parameters.$index(i); 15218 var param = this.parameters.$index(i);
15087 if ($notnull_bool(param.isInitializer)) { 15219 if ($notnull_bool(param.get$isInitializer())) {
15088 var value = null; 15220 var value = null;
15089 if (i < args.get$length()) { 15221 if (i < args.get$length()) {
15090 value = args.values.$index(i); 15222 value = args.values.$index(i);
15091 } 15223 }
15092 else { 15224 else {
15093 value = args.getValue($assert_String(param.get$name())); 15225 value = args.getValue($assert_String(param.get$name()));
15094 if ($notnull_bool(value == null)) { 15226 if ($notnull_bool(value == null)) {
15095 value = param.get$value(); 15227 value = param.get$value();
15096 } 15228 }
15097 } 15229 }
(...skipping 16 matching lines...) Expand all
15114 } 15246 }
15115 } 15247 }
15116 this.generator._scope._vars.$setindex(name, value); 15248 this.generator._scope._vars.$setindex(name, value);
15117 } 15249 }
15118 var $list = this.definition.initializers; 15250 var $list = this.definition.initializers;
15119 for (var $i = 0;$i < $list.length; $i++) { 15251 for (var $i = 0;$i < $list.length; $i++) {
15120 var init = $list.$index($i); 15252 var init = $list.$index($i);
15121 if ((init instanceof CallExpression)) { 15253 if ((init instanceof CallExpression)) {
15122 var delegateArgs = this.generator._makeArgs((($0 = init.get$arguments()) && $0.is$List$ArgumentNode())); 15254 var delegateArgs = this.generator._makeArgs((($0 = init.get$arguments()) && $0.is$List$ArgumentNode()));
15123 var value = this.initDelegate.invoke(this.generator, node, target, deleg ateArgs, false); 15255 var value = this.initDelegate.invoke(this.generator, node, target, deleg ateArgs, false);
15124 if ((init.target instanceof ThisExpression)) { 15256 if ((init.get$target() instanceof ThisExpression)) {
15125 return (value && value.is$Value()); 15257 return (value && value.is$Value());
15126 } 15258 }
15127 else { 15259 else {
15128 if ((value instanceof GlobalValue)) { 15260 if ((value instanceof GlobalValue)) {
15129 value = value.exp; 15261 value = value.get$exp();
15130 } 15262 }
15131 var $list0 = value.fields.getKeys(); 15263 var $list0 = value.get$fields().getKeys$0();
15132 for (var $i0 = value.fields.getKeys().iterator$0(); $i0.hasNext$0(); ) { 15264 for (var $i0 = value.get$fields().getKeys$0().iterator$0(); $i0.hasNex t$0(); ) {
15133 var fname = $i0.next$0(); 15265 var fname = $i0.next$0();
15134 fields.$setindex(fname, value.fields.$index(fname)); 15266 fields.$setindex(fname, value.get$fields().$index(fname));
15135 } 15267 }
15136 } 15268 }
15137 } 15269 }
15138 else { 15270 else {
15139 var assign = (init && init.is$BinaryExpression()); 15271 var assign = (init && init.is$BinaryExpression());
15140 var x = (($0 = assign.x) && $0.is$VarExpression()); 15272 var x = (($0 = assign.x) && $0.is$VarExpression());
15141 var fname = x.name.name; 15273 var fname = x.name.name;
15142 var val = this.generator.visitValue(assign.y); 15274 var val = this.generator.visitValue(assign.y);
15143 fields.$setindex(fname, val); 15275 fields.$setindex(fname, val);
15144 } 15276 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
15294 } 15426 }
15295 else if ($notnull_bool(this.declaringType.get$isString())) { 15427 else if ($notnull_bool(this.declaringType.get$isString())) {
15296 if (this.name == '\$index') { 15428 if (this.name == '\$index') {
15297 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i ndex(0) + ']'), node.span, true); 15429 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i ndex(0) + ']'), node.span, true);
15298 } 15430 }
15299 else if (this.name == '\$add') { 15431 else if (this.name == '\$add') {
15300 if ($notnull_bool(allConst)) { 15432 if ($notnull_bool(allConst)) {
15301 var val0 = target.get$dynamic().get$actualValue(); 15433 var val0 = target.get$dynamic().get$actualValue();
15302 val0 = val0.substring$2(1, val0.length - 1); 15434 val0 = val0.substring$2(1, val0.length - 1);
15303 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); 15435 var val1 = args.values.$index(0).get$dynamic().get$actualValue();
15304 if ($notnull_bool(args.values.$index(0).type.get$isString())) { 15436 if ($notnull_bool(args.values.$index(0).get$type().get$isString())) {
15305 val1 = val1.substring$2(1, val1.length - 1); 15437 val1 = val1.substring$2(1, val1.length - 1);
15306 } 15438 }
15307 var value = ('' + val0 + '' + val1 + ''); 15439 var value = ('' + val0 + '' + val1 + '');
15308 value = '"' + value.replaceAll$2('"', '\\"') + '"'; 15440 value = '"' + value.replaceAll$2('"', '\\"') + '"';
15309 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, $a ssert_String(value), node.span); 15441 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, $a ssert_String(value), node.span);
15310 } 15442 }
15311 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM PTY()); 15443 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM PTY());
15312 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode. $index(0) + ''), node.span, true); 15444 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode. $index(0) + ''), node.span, true);
15313 } 15445 }
15314 } 15446 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
15347 if (this.name == '\$index') { 15479 if (this.name == '\$index') {
15348 world.gen.corejs.useIndex = true; 15480 world.gen.corejs.useIndex = true;
15349 } 15481 }
15350 else if (this.name == '\$setindex') { 15482 else if (this.name == '\$setindex') {
15351 world.gen.corejs.useSetIndex = true; 15483 world.gen.corejs.useSetIndex = true;
15352 } 15484 }
15353 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); 15485 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', ');
15354 return new Value(this.get$inferredResult(), ('' + target.code + '.' + this.get $jsname() + '(' + argsString + ')'), node.span, true); 15486 return new Value(this.get$inferredResult(), ('' + target.code + '.' + this.get $jsname() + '(' + argsString + ')'), node.span, true);
15355 } 15487 }
15356 MethodMember.prototype.resolve = function(inType) { 15488 MethodMember.prototype.resolve = function(inType) {
15489 var $0;
15357 this.isStatic = inType.get$isTop(); 15490 this.isStatic = inType.get$isTop();
15358 this.isConst = false; 15491 this.isConst = false;
15359 this.isFactory = false; 15492 this.isFactory = false;
15360 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass()); 15493 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass());
15361 if (this.definition.modifiers != null) { 15494 if (this.definition.modifiers != null) {
15362 var $list = this.definition.modifiers; 15495 var $list = this.definition.modifiers;
15363 for (var $i = 0;$i < $list.length; $i++) { 15496 for (var $i = 0;$i < $list.length; $i++) {
15364 var mod = $list.$index($i); 15497 var mod = $list.$index($i);
15365 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { 15498 if ($notnull_bool($eq(mod.get$kind(), 86/*TokenKind.STATIC*/))) {
15366 if ($notnull_bool(this.isStatic)) { 15499 if ($notnull_bool(this.isStatic)) {
15367 world.error('duplicate static modifier', mod.get$span()); 15500 world.error('duplicate static modifier', (($0 = mod.get$span()) && $0. is$SourceSpan()));
15368 } 15501 }
15369 this.isStatic = true; 15502 this.isStatic = true;
15370 } 15503 }
15371 else if ($notnull_bool(this.get$isConstructor() && $eq(mod.kind, 91/*Token Kind.CONST*/))) { 15504 else if ($notnull_bool(this.get$isConstructor() && $eq(mod.get$kind(), 91/ *TokenKind.CONST*/))) {
15372 if ($notnull_bool(this.isConst)) { 15505 if ($notnull_bool(this.isConst)) {
15373 world.error('duplicate const modifier', mod.get$span()); 15506 world.error('duplicate const modifier', (($0 = mod.get$span()) && $0.i s$SourceSpan()));
15374 } 15507 }
15375 this.isConst = true; 15508 this.isConst = true;
15376 } 15509 }
15377 else if ($notnull_bool($eq(mod.kind, 75/*TokenKind.FACTORY*/))) { 15510 else if ($notnull_bool($eq(mod.get$kind(), 75/*TokenKind.FACTORY*/))) {
15378 if ($notnull_bool(this.isFactory)) { 15511 if ($notnull_bool(this.isFactory)) {
15379 world.error('duplicate factory modifier', mod.get$span()); 15512 world.error('duplicate factory modifier', (($0 = mod.get$span()) && $0 .is$SourceSpan()));
15380 } 15513 }
15381 this.isFactory = true; 15514 this.isFactory = true;
15382 } 15515 }
15383 else if ($notnull_bool($eq(mod.kind, 71/*TokenKind.ABSTRACT*/))) { 15516 else if ($notnull_bool($eq(mod.get$kind(), 71/*TokenKind.ABSTRACT*/))) {
15384 if ($notnull_bool(this.isAbstract)) { 15517 if ($notnull_bool(this.isAbstract)) {
15385 if ($notnull_bool(this.declaringType.get$isClass())) { 15518 if ($notnull_bool(this.declaringType.get$isClass())) {
15386 world.error('duplicate abstract modifier', mod.get$span()); 15519 world.error('duplicate abstract modifier', (($0 = mod.get$span()) && $0.is$SourceSpan()));
15387 } 15520 }
15388 else { 15521 else {
15389 world.error('abstract modifier not allowed on interface members', mo d.get$span()); 15522 world.error('abstract modifier not allowed on interface members', (( $0 = mod.get$span()) && $0.is$SourceSpan()));
15390 } 15523 }
15391 } 15524 }
15392 this.isAbstract = true; 15525 this.isAbstract = true;
15393 } 15526 }
15394 else { 15527 else {
15395 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span ()); 15528 world.error(('' + mod + ' modifier not allowed on method'), (($0 = mod.g et$span()) && $0.is$SourceSpan()));
15396 } 15529 }
15397 } 15530 }
15398 } 15531 }
15399 if ($notnull_bool(this.isFactory)) { 15532 if ($notnull_bool(this.isFactory)) {
15400 this.isStatic = true; 15533 this.isStatic = true;
15401 } 15534 }
15402 if ($notnull_bool(this.get$isOperator() && this.isStatic) && !$notnull_bool(th is.get$isCallMethod())) { 15535 if ($notnull_bool(this.get$isOperator() && this.isStatic) && !$notnull_bool(th is.get$isCallMethod())) {
15403 world.error(('operator method may not be static "' + this.name + '"'), this. get$span()); 15536 world.error(('operator method may not be static "' + this.name + '"'), this. get$span());
15404 } 15537 }
15405 if ($notnull_bool(this.isAbstract)) { 15538 if ($notnull_bool(this.isAbstract)) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
15488 }) 15621 })
15489 ); 15622 );
15490 } 15623 }
15491 MemberSet.prototype.add = function(member) { 15624 MemberSet.prototype.add = function(member) {
15492 return this.members.add(member); 15625 return this.members.add(member);
15493 } 15626 }
15494 MemberSet.prototype.get$isStatic = function() { 15627 MemberSet.prototype.get$isStatic = function() {
15495 return $notnull_bool(this.members.length == 1 && this.members.$index(0).get$is Static()); 15628 return $notnull_bool(this.members.length == 1 && this.members.$index(0).get$is Static());
15496 } 15629 }
15497 MemberSet.prototype.get$isOperator = function() { 15630 MemberSet.prototype.get$isOperator = function() {
15498 return this.members.$index(0).get$isOperator(); 15631 return $assert_bool(this.members.$index(0).get$isOperator());
15499 } 15632 }
15500 MemberSet.prototype.canInvoke = function(context, args) { 15633 MemberSet.prototype.canInvoke = function(context, args) {
15501 return this.members.some((function (m) { 15634 return this.members.some((function (m) {
15502 return m.canInvoke$2(context, args); 15635 return m.canInvoke$2(context, args);
15503 }) 15636 })
15504 ); 15637 );
15505 } 15638 }
15506 MemberSet.prototype._makeError = function(node, target, action) { 15639 MemberSet.prototype._makeError = function(node, target, action) {
15507 if (!$notnull_bool(target.type.get$isVar())) { 15640 if (!$notnull_bool(target.type.get$isVar())) {
15508 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span); 15641 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span);
15509 } 15642 }
15510 return new Value(world.varType, ('' + target.code + '.' + this.jsname + '() /* no applicable ' + action + '*/'), node.span, true); 15643 return new Value(world.varType, ('' + target.code + '.' + this.jsname + '() /* no applicable ' + action + '*/'), node.span, true);
15511 } 15644 }
15512 MemberSet.prototype.get$treatAsField = function() { 15645 MemberSet.prototype.get$treatAsField = function() {
15513 if (this._treatAsField == null) { 15646 if (this._treatAsField == null) {
15514 this._treatAsField = true; 15647 this._treatAsField = !$notnull_bool(this.isVar);
15515 var $list = this.members; 15648 var $list = this.members;
15516 for (var $i = 0;$i < $list.length; $i++) { 15649 for (var $i = 0;$i < $list.length; $i++) {
15517 var member = $list.$index($i); 15650 var member = $list.$index($i);
15518 if ($notnull_bool(member.get$requiresFieldSyntax())) { 15651 if ($notnull_bool(member.get$requiresFieldSyntax())) {
15519 this._treatAsField = true; 15652 this._treatAsField = true;
15520 break; 15653 break;
15521 } 15654 }
15522 if ($notnull_bool(member.get$prefersPropertySyntax())) { 15655 if ($notnull_bool(member.get$prefersPropertySyntax())) {
15523 this._treatAsField = false; 15656 this._treatAsField = false;
15524 } 15657 }
15525 } 15658 }
15526 var $list = this.members; 15659 var $list = this.members;
15527 for (var $i = 0;$i < $list.length; $i++) { 15660 for (var $i = 0;$i < $list.length; $i++) {
15528 var member = $list.$index($i); 15661 var member = $list.$index($i);
15529 if ($notnull_bool(this._treatAsField)) { 15662 if ($notnull_bool(this._treatAsField)) {
15530 member.provideFieldSyntax$0(); 15663 member.provideFieldSyntax$0();
15531 } 15664 }
15532 else { 15665 else {
15533 member.providePropertySyntax$0(); 15666 member.providePropertySyntax$0();
15534 } 15667 }
15535 } 15668 }
15536 } 15669 }
15537 return this._treatAsField; 15670 return this._treatAsField;
15538 } 15671 }
15539 MemberSet.prototype._get = function(context, node, target, isDynamic) { 15672 MemberSet.prototype._get = function(context, node, target, isDynamic) {
15540 if (this.members.length == 1) { 15673 var returnValue;
15541 return this.members.$index(0)._get(context, node, target, isDynamic);
15542 }
15543 var targets = this.members.filter((function (m) { 15674 var targets = this.members.filter((function (m) {
15544 return m.get$canGet(); 15675 return m.get$canGet();
15545 }) 15676 })
15546 ); 15677 );
15547 if (targets.length == 1) { 15678 if ($notnull_bool(this.isVar)) {
15548 return targets.$index(0)._get(context, node, target, isDynamic); 15679 targets.forEach$1((function (m) {
15680 return m._get(context, node, target, true);
15681 })
15682 );
15683 returnValue = new Value(this._foldTypes((targets && targets.is$List$Member() )), null, node.span, true);
15549 } 15684 }
15550 var returnValue = null; 15685 else {
15551 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { 15686 if (this.members.length == 1) {
15552 var member = $i.next$0(); 15687 return this.members.$index(0)._get(context, node, target, isDynamic);
15553 var value = member._get(context, node, target, true); 15688 }
15554 returnValue = this._tryUnion(returnValue, value, node); 15689 else if ($notnull_bool($eq(targets.length, 1))) {
15555 } 15690 return targets.$index(0)._get(context, node, target, isDynamic);
15556 if (returnValue == null) { 15691 }
15557 return this._makeError(node, target, 'getter'); 15692 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) {
15693 var member = $i.next$0();
15694 var value = member._get(context, node, target, true);
15695 returnValue = this._tryUnion(returnValue, value, node);
15696 }
15697 if (returnValue == null) {
15698 return this._makeError(node, target, 'getter');
15699 }
15558 } 15700 }
15559 if (returnValue.code == null) { 15701 if (returnValue.code == null) {
15560 if ($notnull_bool(this.get$treatAsField())) { 15702 if ($notnull_bool(this.get$treatAsField())) {
15561 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ''), node.span, true); 15703 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ''), node.span, true);
15562 } 15704 }
15563 else { 15705 else {
15564 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn ame + '()'), node.span, true); 15706 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn ame + '()'), node.span, true);
15565 } 15707 }
15566 } 15708 }
15567 return returnValue; 15709 return returnValue;
15568 } 15710 }
15569 MemberSet.prototype._set = function(context, node, target, value, isDynamic) { 15711 MemberSet.prototype._set = function(context, node, target, value, isDynamic) {
15570 if (this.members.length == 1) { 15712 var returnValue;
15571 return this.members.$index(0)._set(context, node, target, value, isDynamic);
15572 }
15573 var targets = this.members.filter((function (m) { 15713 var targets = this.members.filter((function (m) {
15574 return m.get$canSet(); 15714 return m.get$canSet();
15575 }) 15715 })
15576 ); 15716 );
15577 if (targets.length == 1) { 15717 if ($notnull_bool(this.isVar)) {
15578 return targets.$index(0)._set(context, node, target, value, isDynamic); 15718 targets.forEach$1((function (m) {
15719 return m._set(context, node, target, value, true);
15720 })
15721 );
15722 returnValue = new Value(this._foldTypes((targets && targets.is$List$Member() )), null, node.span, true);
15579 } 15723 }
15580 var returnValue = null; 15724 else {
15581 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { 15725 if (this.members.length == 1) {
15582 var member = $i.next$0(); 15726 return this.members.$index(0)._set(context, node, target, value, isDynamic );
15583 var res = member._set(context, node, target, value, true); 15727 }
15584 returnValue = this._tryUnion(returnValue, res, node); 15728 else if ($notnull_bool($eq(targets.length, 1))) {
15585 } 15729 return targets.$index(0)._set(context, node, target, value, isDynamic);
15586 if (returnValue == null) { 15730 }
15587 return this._makeError(node, target, 'setter'); 15731 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) {
15732 var member = $i.next$0();
15733 var res = member._set(context, node, target, value, true);
15734 returnValue = this._tryUnion(returnValue, res, node);
15735 }
15736 if (returnValue == null) {
15737 return this._makeError(node, target, 'setter');
15738 }
15588 } 15739 }
15589 if (returnValue.code == null) { 15740 if (returnValue.code == null) {
15590 if ($notnull_bool(this.get$treatAsField())) { 15741 if ($notnull_bool(this.get$treatAsField())) {
15591 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ' = ' + value.code + ''), node.span, true); 15742 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ' = ' + value.code + ''), node.span, true);
15592 } 15743 }
15593 else { 15744 else {
15594 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn ame + '(' + value.code + ')'), node.span, true); 15745 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn ame + '(' + value.code + ')'), node.span, true);
15595 } 15746 }
15596 } 15747 }
15597 return returnValue; 15748 return returnValue;
15598 } 15749 }
15599 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { 15750 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) {
15600 var $0; 15751 var $0;
15601 if ($notnull_bool(this.isVar && !$notnull_bool(this.get$isOperator()))) { 15752 if ($notnull_bool(this.isVar && !$notnull_bool(this.get$isOperator()))) {
15602 return this.invokeOnVar(context, node, target, args); 15753 return this.invokeOnVar(context, node, target, args);
15603 } 15754 }
15604 if (this.members.length == 1) { 15755 if (this.members.length == 1) {
15605 return this.members.$index(0).invoke$5(context, node, target, args, isDynami c); 15756 return (($0 = this.members.$index(0).invoke$5(context, node, target, args, i sDynamic)) && $0.is$Value());
15606 } 15757 }
15607 var targets = this.members.filter((function (m) { 15758 var targets = this.members.filter((function (m) {
15608 return m.canInvoke$2(context, args); 15759 return m.canInvoke$2(context, args);
15609 }) 15760 })
15610 ); 15761 );
15611 if (targets.length == 1) { 15762 if ($notnull_bool($eq(targets.length, 1))) {
15612 return (($0 = targets.$index(0).invoke$5(context, node, target, args, isDyna mic)) && $0.is$Value()); 15763 return (($0 = targets.$index(0).invoke$5(context, node, target, args, isDyna mic)) && $0.is$Value());
15613 } 15764 }
15614 var returnValue = null; 15765 var returnValue = null;
15615 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { 15766 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) {
15616 var member = $i.next$0(); 15767 var member = $i.next$0();
15617 var res = member.invoke$4$isDynamic(context, node, target, args, true); 15768 var res = member.invoke$4$isDynamic(context, node, target, args, true);
15618 returnValue = this._tryUnion(returnValue, res, node); 15769 returnValue = this._tryUnion(returnValue, (res && res.is$Value()), node);
15619 } 15770 }
15620 if (returnValue == null) { 15771 if (returnValue == null) {
15621 return this._makeError(node, target, 'method'); 15772 return this._makeError(node, target, 'method');
15622 } 15773 }
15623 if (returnValue.code == null) { 15774 if (returnValue.code == null) {
15624 if ($notnull_bool(this.get$isOperator())) { 15775 if ($notnull_bool(this.get$isOperator())) {
15625 return target.invokeSpecial(this.name, args, returnValue.type); 15776 return target.invokeSpecial(this.name, args, returnValue.type);
15626 } 15777 }
15627 else { 15778 else {
15628 return this.invokeOnVar(context, node, target, args); 15779 return this.invokeOnVar(context, node, target, args);
15629 } 15780 }
15630 } 15781 }
15631 return returnValue; 15782 return returnValue;
15632 } 15783 }
15633 MemberSet.prototype.invokeOnVar = function(context, node, target, args) { 15784 MemberSet.prototype.invokeOnVar = function(context, node, target, args) {
15785 var $0;
15634 var member = this.getVarMember(context, node, args); 15786 var member = this.getVarMember(context, node, args);
15635 return member.invoke$4(context, node, target, args); 15787 return (($0 = member.invoke$4(context, node, target, args)) && $0.is$Value());
15636 } 15788 }
15637 MemberSet.prototype._tryUnion = function(x, y, node) { 15789 MemberSet.prototype._tryUnion = function(x, y, node) {
15638 if (x == null) return y; 15790 if (x == null) return y;
15639 var type = lang_Type.union(x.type, y.type); 15791 var type = lang_Type.union(x.type, y.type);
15640 if (x.code == y.code) { 15792 if (x.code == y.code) {
15641 if ($notnull_bool($eq(type, x.type))) { 15793 if ($notnull_bool($eq(type, x.type))) {
15642 return x; 15794 return x;
15643 } 15795 }
15644 else if ($notnull_bool(x.get$isConst() || y.get$isConst())) { 15796 else if ($notnull_bool(x.get$isConst() || y.get$isConst())) {
15645 world.internalError("unexpected: union of const values "); 15797 world.internalError("unexpected: union of const values ");
15646 } 15798 }
15647 else { 15799 else {
15648 var ret = new Value(type, x.code, node.span, true); 15800 var ret = new Value(type, x.code, node.span, true);
15649 ret.isSuper = $notnull_bool(x.isSuper && y.isSuper); 15801 ret.set$isSuper($notnull_bool(x.isSuper && y.isSuper));
15650 ret.needsTemp = $notnull_bool(x.needsTemp || y.needsTemp); 15802 ret.set$needsTemp($notnull_bool(x.needsTemp || y.needsTemp));
15651 ret.isType = $notnull_bool(x.isType && y.isType); 15803 ret.set$isType($notnull_bool(x.isType && y.isType));
15652 return (ret && ret.is$Value()); 15804 return (ret && ret.is$Value());
15653 } 15805 }
15654 } 15806 }
15655 else { 15807 else {
15656 return new Value(type, null, node.span, true); 15808 return new Value(type, null, node.span, true);
15657 } 15809 }
15658 } 15810 }
15659 MemberSet.prototype.getVarMember = function(context, node, args) { 15811 MemberSet.prototype.getVarMember = function(context, node, args) {
15660 if (world.objectType.varStubs == null) { 15812 if (world.objectType.varStubs == null) {
15661 world.objectType.varStubs = $map([]); 15813 world.objectType.varStubs = $map([]);
15662 } 15814 }
15663 var stubName = _getCallStubName(this.name, args); 15815 var stubName = _getCallStubName(this.name, args);
15664 var stub = world.objectType.varStubs.$index(stubName); 15816 var stub = world.objectType.varStubs.$index(stubName);
15665 if ($notnull_bool(stub == null)) { 15817 if ($notnull_bool(stub == null)) {
15666 var mset = context.findMembers(this.name).members; 15818 var mset = context.findMembers(this.name).members;
15667 var targets = mset.filter((function (m) { 15819 var targets = mset.filter((function (m) {
15668 return m.canInvoke$2(context, args); 15820 return m.canInvoke$2(context, args);
15669 }) 15821 })
15670 ); 15822 );
15671 var returnType = reduce(map((targets && targets.is$Iterable()), (function (t ) { 15823 stub = new VarMethodSet($assert_String(stubName), targets, args, this._foldT ypes((targets && targets.is$List$Member())));
15672 return t.get$returnType();
15673 })
15674 ), lang_Type.union);
15675 stub = new VarMethodSet($assert_String(stubName), targets, args, returnType) ;
15676 world.objectType.varStubs.$setindex(stubName, stub); 15824 world.objectType.varStubs.$setindex(stubName, stub);
15677 } 15825 }
15678 return (stub && stub.is$VarMember()); 15826 return (stub && stub.is$VarMember());
15679 } 15827 }
15828 MemberSet.prototype._foldTypes = function(targets) {
15829 var $0;
15830 return (($0 = reduce(map(targets, (function (t) {
15831 return t.get$returnType();
15832 })
15833 ), lang_Type.union, world.varType)) && $0.is$lang_Type());
15834 }
15680 MemberSet.prototype._get$3 = function($0, $1, $2) { 15835 MemberSet.prototype._get$3 = function($0, $1, $2) {
15681 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); 15836 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
15682 }; 15837 };
15683 MemberSet.prototype._set$4 = function($0, $1, $2, $3) { 15838 MemberSet.prototype._set$4 = function($0, $1, $2, $3) {
15684 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); 15839 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false);
15685 }; 15840 };
15686 MemberSet.prototype.add$1 = function($0) { 15841 MemberSet.prototype.add$1 = function($0) {
15687 return this.add(($0 && $0.is$Member())); 15842 return this.add(($0 && $0.is$Member()));
15688 }; 15843 };
15689 MemberSet.prototype.canInvoke$2 = function($0, $1) { 15844 MemberSet.prototype.canInvoke$2 = function($0, $1) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
15723 } 15878 }
15724 FactoryMap.prototype.forEach = function(f) { 15879 FactoryMap.prototype.forEach = function(f) {
15725 this.factories.forEach((function (_, constructors) { 15880 this.factories.forEach((function (_, constructors) {
15726 constructors.forEach((function (_, member) { 15881 constructors.forEach((function (_, member) {
15727 f(member); 15882 f(member);
15728 }) 15883 })
15729 ); 15884 );
15730 }) 15885 })
15731 ); 15886 );
15732 } 15887 }
15888 FactoryMap.prototype.forEach$1 = FactoryMap.prototype.forEach;
15733 FactoryMap.prototype.getFactory$2 = function($0, $1) { 15889 FactoryMap.prototype.getFactory$2 = function($0, $1) {
15734 return this.getFactory($assert_String($0), $assert_String($1)); 15890 return this.getFactory($assert_String($0), $assert_String($1));
15735 }; 15891 };
15736 // ********** Code for lang_Token ************** 15892 // ********** Code for lang_Token **************
15737 function lang_Token(kind, source, start, end) { 15893 function lang_Token(kind, source, start, end) {
15738 this.kind = kind; 15894 this.kind = kind;
15739 this.source = source; 15895 this.source = source;
15740 this.start = start; 15896 this.start = start;
15741 this.end = end; 15897 this.end = end;
15742 // Initializers done 15898 // Initializers done
15743 } 15899 }
15900 lang_Token.prototype.get$kind = function() { return this.kind; };
15901 lang_Token.prototype.get$end = function() { return this.end; };
15902 lang_Token.prototype.get$start = function() { return this.start; };
15744 lang_Token.prototype.get$text = function() { 15903 lang_Token.prototype.get$text = function() {
15745 return this.source.get$text().substring(this.start, this.end); 15904 return this.source.get$text().substring(this.start, this.end);
15746 } 15905 }
15747 lang_Token.prototype.toString = function() { 15906 lang_Token.prototype.toString = function() {
15748 var kindText = TokenKind.kindToString(this.kind); 15907 var kindText = TokenKind.kindToString(this.kind);
15749 var actualText = this.get$text(); 15908 var actualText = this.get$text();
15750 if ($notnull_bool($ne(kindText, actualText))) { 15909 if ($notnull_bool($ne(kindText, actualText))) {
15751 if (actualText.length > 10) { 15910 if (actualText.length > 10) {
15752 actualText = actualText.substring$2(0, 8) + '...'; 15911 actualText = actualText.substring$2(0, 8) + '...';
15753 } 15912 }
(...skipping 10 matching lines...) Expand all
15764 return this.toString(); 15923 return this.toString();
15765 }; 15924 };
15766 // ********** Code for SourceFile ************** 15925 // ********** Code for SourceFile **************
15767 function SourceFile(filename, _text) { 15926 function SourceFile(filename, _text) {
15768 this.filename = filename; 15927 this.filename = filename;
15769 this._text = _text; 15928 this._text = _text;
15770 // Initializers done 15929 // Initializers done
15771 } 15930 }
15772 SourceFile.prototype.is$SourceFile = function(){return this;}; 15931 SourceFile.prototype.is$SourceFile = function(){return this;};
15773 SourceFile.prototype.is$Comparable = function(){return this;}; 15932 SourceFile.prototype.is$Comparable = function(){return this;};
15933 SourceFile.prototype.get$filename = function() { return this.filename; };
15934 SourceFile.prototype.get$orderInLibrary = function() { return this.orderInLibrar y; };
15935 SourceFile.prototype.set$orderInLibrary = function(value) { return this.orderInL ibrary = value; };
15774 SourceFile.prototype.get$text = function() { 15936 SourceFile.prototype.get$text = function() {
15775 return this._text; 15937 return this._text;
15776 } 15938 }
15777 SourceFile.prototype.get$lineStarts = function() { 15939 SourceFile.prototype.get$lineStarts = function() {
15778 if (this._lineStarts == null) { 15940 if (this._lineStarts == null) {
15779 var starts = [0]; 15941 var starts = [0];
15780 var index = 0; 15942 var index = 0;
15781 while (index < this.get$text().length) { 15943 while (index < this.get$text().length) {
15782 index = this.get$text().indexOf('\n', index) + 1; 15944 index = this.get$text().indexOf('\n', index) + 1;
15783 if (index <= 0) break; 15945 if (index <= 0) break;
15784 starts.add$1(index); 15946 starts.add$1(index);
15785 } 15947 }
15786 starts.add$1(this.get$text().length + 1); 15948 starts.add$1(this.get$text().length + 1);
15787 this._lineStarts = (starts && starts.is$List$int()); 15949 this._lineStarts = (starts && starts.is$List$int());
15788 } 15950 }
15789 return this._lineStarts; 15951 return this._lineStarts;
15790 } 15952 }
15791 SourceFile.prototype.getLine = function(position) { 15953 SourceFile.prototype.getLine = function(position) {
15792 var starts = this.get$lineStarts(); 15954 var starts = this.get$lineStarts();
15793 for (var i = 0; 15955 for (var i = 0;
15794 i < starts.length; i++) { 15956 i < $assert_num(starts.length); i++) {
15795 if (starts.$index(i) > position) return i - 1; 15957 if (starts.$index(i) > position) return i - 1;
15796 } 15958 }
15797 world.internalError('bad position'); 15959 world.internalError('bad position');
15798 } 15960 }
15799 SourceFile.prototype.getColumn = function(line, position) { 15961 SourceFile.prototype.getColumn = function(line, position) {
15800 return position - $assert_num(this.get$lineStarts().$index(line)); 15962 return position - $assert_num(this.get$lineStarts().$index(line));
15801 } 15963 }
15802 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT ext) { 15964 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT ext) {
15803 var line = this.getLine(start); 15965 var line = this.getLine(start);
15804 var column = this.getColumn($assert_num(line), start); 15966 var column = this.getColumn($assert_num(line), start);
15805 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' + (column + 1) + ': ' + message + '')); 15967 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' + (column + 1) + ': ' + message + ''));
15806 if ($notnull_bool(includeText)) { 15968 if ($notnull_bool(includeText)) {
15807 buf.add$1('\n'); 15969 buf.add$1('\n');
15808 var textLine; 15970 var textLine;
15809 if ((line + 2) < this._lineStarts.length) { 15971 if ((line + 2) < this._lineStarts.length) {
15810 textLine = this.get$text().substring(this._lineStarts.$index(line), this._ lineStarts.$index(line + 1)); 15972 textLine = this.get$text().substring(this._lineStarts.$index(line), this._ lineStarts.$index(line + 1));
15811 } 15973 }
15812 else { 15974 else {
15813 textLine = this.get$text().substring(this._lineStarts.$index(line)) + '\n' ; 15975 textLine = this.get$text().substring(this._lineStarts.$index(line)) + '\n' ;
15814 } 15976 }
15815 buf.add$1(textLine); 15977 buf.add$1(textLine);
15816 var i = 0; 15978 var i = 0;
15817 for (; i < $assert_num(column); i++) { 15979 for (; i < $assert_num(column); i++) {
15818 buf.add$1(' '); 15980 buf.add$1(' ');
15819 } 15981 }
15820 var toColumn = Math.min($assert_num(column + (end - start)), textLine.length ); 15982 var toColumn = Math.min($assert_num(column + (end - start)), $assert_num(tex tLine.length));
15821 for (; i < toColumn; i++) { 15983 for (; i < toColumn; i++) {
15822 buf.add$1('^'); 15984 buf.add$1('^');
15823 } 15985 }
15824 } 15986 }
15825 return buf.toString$0(); 15987 return buf.toString$0();
15826 } 15988 }
15827 SourceFile.prototype.compareTo = function(other) { 15989 SourceFile.prototype.compareTo = function(other) {
15828 if (this.orderInLibrary != null && other.orderInLibrary != null) { 15990 if (this.orderInLibrary != null && other.orderInLibrary != null) {
15829 return this.orderInLibrary - other.orderInLibrary; 15991 return this.orderInLibrary - other.orderInLibrary;
15830 } 15992 }
15831 else { 15993 else {
15832 return this.filename.compareTo(other.filename); 15994 return this.filename.compareTo(other.filename);
15833 } 15995 }
15834 } 15996 }
15835 SourceFile.prototype.compareTo$1 = function($0) { 15997 SourceFile.prototype.compareTo$1 = function($0) {
15836 return this.compareTo(($0 && $0.is$SourceFile())); 15998 return this.compareTo(($0 && $0.is$SourceFile()));
15837 }; 15999 };
16000 SourceFile.prototype.getColumn$2 = function($0, $1) {
16001 return this.getColumn($assert_num($0), $assert_num($1));
16002 };
16003 SourceFile.prototype.getLine$1 = function($0) {
16004 return this.getLine($assert_num($0));
16005 };
15838 // ********** Code for SourceSpan ************** 16006 // ********** Code for SourceSpan **************
15839 function SourceSpan(file, start, end) { 16007 function SourceSpan(file, start, end) {
15840 this.file = file; 16008 this.file = file;
15841 this.start = start; 16009 this.start = start;
15842 this.end = end; 16010 this.end = end;
15843 // Initializers done 16011 // Initializers done
15844 } 16012 }
15845 SourceSpan.prototype.is$SourceSpan = function(){return this;}; 16013 SourceSpan.prototype.is$SourceSpan = function(){return this;};
15846 SourceSpan.prototype.is$Comparable = function(){return this;}; 16014 SourceSpan.prototype.is$Comparable = function(){return this;};
16015 SourceSpan.prototype.get$file = function() { return this.file; };
16016 SourceSpan.prototype.get$start = function() { return this.start; };
16017 SourceSpan.prototype.get$end = function() { return this.end; };
15847 SourceSpan.prototype.get$text = function() { 16018 SourceSpan.prototype.get$text = function() {
15848 return this.file.get$text().substring(this.start, this.end); 16019 return this.file.get$text().substring(this.start, this.end);
15849 } 16020 }
15850 SourceSpan.prototype.toMessageString = function(message) { 16021 SourceSpan.prototype.toMessageString = function(message) {
15851 return this.file.getLocationMessage(message, this.start, this.end, true); 16022 return this.file.getLocationMessage(message, this.start, this.end, true);
15852 } 16023 }
15853 SourceSpan.prototype.get$locationText = function() { 16024 SourceSpan.prototype.get$locationText = function() {
15854 var line = this.file.getLine(this.start); 16025 var line = this.file.getLine(this.start);
15855 var column = this.file.getColumn($assert_num(line), this.start); 16026 var column = this.file.getColumn($assert_num(line), this.start);
15856 return ('' + this.file.filename + ':' + (line + 1) + ':' + (column + 1) + ''); 16027 return ('' + this.file.filename + ':' + (line + 1) + ':' + (column + 1) + '');
(...skipping 10 matching lines...) Expand all
15867 }; 16038 };
15868 // ********** Code for InterpStack ************** 16039 // ********** Code for InterpStack **************
15869 function InterpStack(previous, quote, isMultiline) { 16040 function InterpStack(previous, quote, isMultiline) {
15870 this.previous = previous; 16041 this.previous = previous;
15871 this.quote = quote; 16042 this.quote = quote;
15872 this.isMultiline = isMultiline; 16043 this.isMultiline = isMultiline;
15873 this.depth = -1; 16044 this.depth = -1;
15874 // Initializers done 16045 // Initializers done
15875 } 16046 }
15876 InterpStack.prototype.is$InterpStack = function(){return this;}; 16047 InterpStack.prototype.is$InterpStack = function(){return this;};
16048 InterpStack.prototype.get$previous = function() { return this.previous; };
16049 InterpStack.prototype.set$previous = function(value) { return this.previous = va lue; };
16050 InterpStack.prototype.get$quote = function() { return this.quote; };
16051 InterpStack.prototype.get$isMultiline = function() { return this.isMultiline; };
16052 InterpStack.prototype.get$depth = function() { return this.depth; };
16053 InterpStack.prototype.set$depth = function(value) { return this.depth = value; } ;
15877 InterpStack.prototype.pop = function() { 16054 InterpStack.prototype.pop = function() {
15878 return this.previous; 16055 return this.previous;
15879 } 16056 }
15880 InterpStack.push = function(stack, quote, isMultiline) { 16057 InterpStack.push = function(stack, quote, isMultiline) {
15881 var newStack = new InterpStack(stack, quote, isMultiline); 16058 var newStack = new InterpStack(stack, quote, isMultiline);
15882 if (stack != null) newStack.previous = stack; 16059 if (stack != null) newStack.set$previous(stack);
15883 return (newStack && newStack.is$InterpStack()); 16060 return (newStack && newStack.is$InterpStack());
15884 } 16061 }
15885 InterpStack.prototype.next$0 = function() { 16062 InterpStack.prototype.next$0 = function() {
15886 return this.next(); 16063 return this.next();
15887 }; 16064 };
15888 // ********** Code for TokenizerBase ************** 16065 // ********** Code for TokenizerBase **************
15889 function TokenizerBase(_source, _skipWhitespace, _index) { 16066 function TokenizerBase(_source, _skipWhitespace, _index) {
15890 this._source = _source; 16067 this._source = _source;
15891 this._skipWhitespace = _skipWhitespace; 16068 this._skipWhitespace = _skipWhitespace;
15892 this._lang_index = _index; 16069 this._lang_index = _index;
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
16223 function Tokenizer(source, skipWhitespace, index) { 16400 function Tokenizer(source, skipWhitespace, index) {
16224 TokenizerBase.call(this, source, skipWhitespace, index); 16401 TokenizerBase.call(this, source, skipWhitespace, index);
16225 // Initializers done 16402 // Initializers done
16226 } 16403 }
16227 $inherits(Tokenizer, TokenizerBase); 16404 $inherits(Tokenizer, TokenizerBase);
16228 Tokenizer.prototype.next = function() { 16405 Tokenizer.prototype.next = function() {
16229 this._startIndex = this._lang_index; 16406 this._startIndex = this._lang_index;
16230 if (this._interpStack != null && this._interpStack.depth == 0) { 16407 if (this._interpStack != null && this._interpStack.depth == 0) {
16231 var istack = this._interpStack; 16408 var istack = this._interpStack;
16232 this._interpStack = this._interpStack.pop(); 16409 this._interpStack = this._interpStack.pop();
16233 if ($notnull_bool(istack.isMultiline)) { 16410 if ($notnull_bool(istack.get$isMultiline())) {
16234 return this.finishMultilineString(istack.quote); 16411 return this.finishMultilineString($assert_num(istack.get$quote()));
16235 } 16412 }
16236 else { 16413 else {
16237 return this.finishStringBody(istack.quote); 16414 return this.finishStringBody($assert_num(istack.get$quote()));
16238 } 16415 }
16239 } 16416 }
16240 var ch; 16417 var ch;
16241 ch = this._nextChar(); 16418 ch = this._nextChar();
16242 switch (ch) { 16419 switch (ch) {
16243 case 0: 16420 case 0:
16244 16421
16245 return this._finishToken(1/*TokenKind.END_OF_FILE*/); 16422 return this._finishToken(1/*TokenKind.END_OF_FILE*/);
16246 16423
16247 case 32: 16424 case 32:
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
17621 lang_Parser.prototype._eat = function(kind) { 17798 lang_Parser.prototype._eat = function(kind) {
17622 if (!$notnull_bool(this._maybeEat(kind))) { 17799 if (!$notnull_bool(this._maybeEat(kind))) {
17623 this._errorExpected(TokenKind.kindToString(kind)); 17800 this._errorExpected(TokenKind.kindToString(kind));
17624 } 17801 }
17625 } 17802 }
17626 lang_Parser.prototype._eatSemicolon = function() { 17803 lang_Parser.prototype._eatSemicolon = function() {
17627 if ($notnull_bool(this.optionalSemicolons && this._peekKind(1/*TokenKind.END_O F_FILE*/))) return; 17804 if ($notnull_bool(this.optionalSemicolons && this._peekKind(1/*TokenKind.END_O F_FILE*/))) return;
17628 this._eat(10/*TokenKind.SEMICOLON*/); 17805 this._eat(10/*TokenKind.SEMICOLON*/);
17629 } 17806 }
17630 lang_Parser.prototype._errorExpected = function(expected) { 17807 lang_Parser.prototype._errorExpected = function(expected) {
17808 var $0;
17631 if ($notnull_bool(this.throwOnIncomplete)) this.isPrematureEndOfFile(); 17809 if ($notnull_bool(this.throwOnIncomplete)) this.isPrematureEndOfFile();
17632 var tok = this._lang_next(); 17810 var tok = this._lang_next();
17633 var message = ('expected ' + expected + ', but found ' + tok + ''); 17811 var message = ('expected ' + expected + ', but found ' + tok + '');
17634 this._lang_error($assert_String(message), tok.get$span()); 17812 this._lang_error($assert_String(message), (($0 = tok.get$span()) && $0.is$Sour ceSpan()));
17635 } 17813 }
17636 lang_Parser.prototype._lang_error = function(message, location) { 17814 lang_Parser.prototype._lang_error = function(message, location) {
17637 if (location == null) { 17815 if (location == null) {
17638 location = this._peekToken.get$span(); 17816 location = this._peekToken.get$span();
17639 } 17817 }
17640 world.fatal(message, location); 17818 world.fatal(message, location);
17641 } 17819 }
17642 lang_Parser.prototype._skipBlock = function() { 17820 lang_Parser.prototype._skipBlock = function() {
17821 var $0;
17643 var depth = 1; 17822 var depth = 1;
17644 this._eat(6/*TokenKind.LBRACE*/); 17823 this._eat(6/*TokenKind.LBRACE*/);
17645 while (true) { 17824 while (true) {
17646 var tok = this._lang_next(); 17825 var tok = this._lang_next();
17647 if ($notnull_bool($eq(tok.kind, 6/*TokenKind.LBRACE*/))) { 17826 if ($notnull_bool($eq(tok.get$kind(), 6/*TokenKind.LBRACE*/))) {
17648 depth += 1; 17827 depth += 1;
17649 } 17828 }
17650 else if ($notnull_bool($eq(tok.kind, 7/*TokenKind.RBRACE*/))) { 17829 else if ($notnull_bool($eq(tok.get$kind(), 7/*TokenKind.RBRACE*/))) {
17651 depth -= 1; 17830 depth -= 1;
17652 if (depth == 0) return; 17831 if (depth == 0) return;
17653 } 17832 }
17654 else if ($notnull_bool($eq(tok.kind, 1/*TokenKind.END_OF_FILE*/))) { 17833 else if ($notnull_bool($eq(tok.get$kind(), 1/*TokenKind.END_OF_FILE*/))) {
17655 this._lang_error('unexpected end of file during diet parse', tok.get$span( )); 17834 this._lang_error('unexpected end of file during diet parse', (($0 = tok.ge t$span()) && $0.is$SourceSpan()));
17656 return; 17835 return;
17657 } 17836 }
17658 } 17837 }
17659 } 17838 }
17660 lang_Parser.prototype._makeSpan = function(start) { 17839 lang_Parser.prototype._makeSpan = function(start) {
17661 return new SourceSpan(this.source, start, this._previousToken.end); 17840 return new SourceSpan(this.source, start, this._previousToken.end);
17662 } 17841 }
17663 lang_Parser.prototype.compilationUnit = function() { 17842 lang_Parser.prototype.compilationUnit = function() {
17664 var ret = []; 17843 var ret = [];
17665 this._maybeEat(13/*TokenKind.HASHBANG*/); 17844 this._maybeEat(13/*TokenKind.HASHBANG*/);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
17738 lang_Parser.prototype.functionTypeAlias = function() { 17917 lang_Parser.prototype.functionTypeAlias = function() {
17739 var start = this._peekToken.start; 17918 var start = this._peekToken.start;
17740 this._eat(87/*TokenKind.TYPEDEF*/); 17919 this._eat(87/*TokenKind.TYPEDEF*/);
17741 var di = this.declaredIdentifier(false); 17920 var di = this.declaredIdentifier(false);
17742 var typeParams = null; 17921 var typeParams = null;
17743 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { 17922 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) {
17744 typeParams = this.typeParameters(); 17923 typeParams = this.typeParameters();
17745 } 17924 }
17746 var formals = this.formalParameterList(); 17925 var formals = this.formalParameterList();
17747 this._eatSemicolon(); 17926 this._eatSemicolon();
17748 var func = new FunctionDefinition(null, di.type, di.get$name(), formals, null, null, this._makeSpan(start)); 17927 var func = new FunctionDefinition(null, di.get$type(), di.get$name(), formals, null, null, this._makeSpan(start));
17749 return new FunctionTypeDefinition(func, typeParams, this._makeSpan(start)); 17928 return new FunctionTypeDefinition(func, typeParams, this._makeSpan(start));
17750 } 17929 }
17751 lang_Parser.prototype.initializers = function() { 17930 lang_Parser.prototype.initializers = function() {
17752 this._inInitializers = true; 17931 this._inInitializers = true;
17753 var ret = []; 17932 var ret = [];
17754 do { 17933 do {
17755 ret.add$1(this.expression()); 17934 ret.add$1(this.expression());
17756 } 17935 }
17757 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) 17936 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/)))
17758 this._inInitializers = false; 17937 this._inInitializers = false;
17759 return ret; 17938 return ret;
17760 } 17939 }
17940 lang_Parser.prototype.get$initializers = function() {
17941 return lang_Parser.prototype.initializers.bind(this);
17942 }
17761 lang_Parser.prototype.functionBody = function(inExpression) { 17943 lang_Parser.prototype.functionBody = function(inExpression) {
17762 var start = this._peekToken.start; 17944 var start = this._peekToken.start;
17763 if ($notnull_bool(this._maybeEat(9/*TokenKind.ARROW*/))) { 17945 if ($notnull_bool(this._maybeEat(9/*TokenKind.ARROW*/))) {
17764 var expr = this.expression(); 17946 var expr = this.expression();
17765 if (!$notnull_bool(inExpression)) { 17947 if (!$notnull_bool(inExpression)) {
17766 this._eatSemicolon(); 17948 this._eatSemicolon();
17767 } 17949 }
17768 return new ReturnStatement(expr, this._makeSpan(start)); 17950 return new ReturnStatement(expr, this._makeSpan(start));
17769 } 17951 }
17770 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { 17952 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
17812 switch (this._peek()) { 17994 switch (this._peek()) {
17813 case 2/*TokenKind.LPAREN*/: 17995 case 2/*TokenKind.LPAREN*/:
17814 17996
17815 var formals = this.formalParameterList(); 17997 var formals = this.formalParameterList();
17816 var inits = null; 17998 var inits = null;
17817 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { 17999 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) {
17818 inits = this.initializers(); 18000 inits = this.initializers();
17819 } 18001 }
17820 var body = this.functionBody(false); 18002 var body = this.functionBody(false);
17821 if ($notnull_bool(di.get$name() == null)) { 18003 if ($notnull_bool(di.get$name() == null)) {
17822 di.name = di.type.get$name(); 18004 di.set$name(di.get$type().get$name());
17823 } 18005 }
17824 return new FunctionDefinition(modifiers, di.type, di.get$name(), formals, inits, body, this._makeSpan($assert_num(start))); 18006 return new FunctionDefinition(modifiers, di.get$type(), di.get$name(), for mals, inits, body, this._makeSpan($assert_num(start)));
17825 18007
17826 case 20/*TokenKind.ASSIGN*/: 18008 case 20/*TokenKind.ASSIGN*/:
17827 18009
17828 this._eat(20/*TokenKind.ASSIGN*/); 18010 this._eat(20/*TokenKind.ASSIGN*/);
17829 var value = this.expression(); 18011 var value = this.expression();
17830 return this.finishField(start, modifiers, di.type, di.get$name(), value); 18012 return this.finishField(start, modifiers, di.get$type(), di.get$name(), va lue);
17831 18013
17832 case 11/*TokenKind.COMMA*/: 18014 case 11/*TokenKind.COMMA*/:
17833 case 10/*TokenKind.SEMICOLON*/: 18015 case 10/*TokenKind.SEMICOLON*/:
17834 18016
17835 return this.finishField(start, modifiers, di.type, di.get$name(), null); 18017 return this.finishField(start, modifiers, di.get$type(), di.get$name(), nu ll);
17836 18018
17837 default: 18019 default:
17838 18020
17839 this._errorExpected('declaration'); 18021 this._errorExpected('declaration');
17840 return null; 18022 return null;
17841 18023
17842 } 18024 }
17843 } 18025 }
17844 lang_Parser.prototype.declaration = function(includeOperators) { 18026 lang_Parser.prototype.declaration = function(includeOperators) {
17845 var start = this._peekToken.start; 18027 var start = this._peekToken.start;
17846 if ($notnull_bool(this._peekKind(75/*TokenKind.FACTORY*/))) { 18028 if ($notnull_bool(this._peekKind(75/*TokenKind.FACTORY*/))) {
17847 return this.factoryConstructorDeclaration(); 18029 return this.factoryConstructorDeclaration();
17848 } 18030 }
17849 var modifiers = this._readModifiers(); 18031 var modifiers = this._readModifiers();
17850 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include Operators)); 18032 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include Operators));
17851 } 18033 }
17852 lang_Parser.prototype.factoryConstructorDeclaration = function() { 18034 lang_Parser.prototype.factoryConstructorDeclaration = function() {
18035 var $0;
17853 var start = this._peekToken.start; 18036 var start = this._peekToken.start;
17854 var factoryToken = this._lang_next(); 18037 var factoryToken = this._lang_next();
17855 var names = [this.identifier()]; 18038 var names = [this.identifier()];
17856 while ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { 18039 while ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) {
17857 names.add$1(this.identifier()); 18040 names.add$1(this.identifier());
17858 } 18041 }
17859 var typeParams = null; 18042 var typeParams = null;
17860 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { 18043 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) {
17861 typeParams = this.typeParameters(); 18044 typeParams = this.typeParameters();
17862 } 18045 }
17863 var name = null; 18046 var name = null;
17864 var type = null; 18047 var type = null;
17865 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { 18048 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) {
17866 name = this.identifier(); 18049 name = this.identifier();
17867 } 18050 }
17868 else if ($notnull_bool(typeParams == null)) { 18051 else if ($notnull_bool(typeParams == null)) {
17869 if (names.length > 1) { 18052 if (names.length > 1) {
17870 name = names.removeLast$0(); 18053 name = names.removeLast$0();
17871 } 18054 }
17872 else { 18055 else {
17873 name = new lang_Identifier('', names.$index(0).get$span()); 18056 name = new lang_Identifier('', (($0 = names.$index(0).get$span()) && $0.is $SourceSpan()));
17874 } 18057 }
17875 } 18058 }
17876 else { 18059 else {
17877 name = new lang_Identifier('', names.$index(0).get$span()); 18060 name = new lang_Identifier('', (($0 = names.$index(0).get$span()) && $0.is$S ourceSpan()));
17878 } 18061 }
17879 if (names.length > 1) { 18062 if (names.length > 1) {
17880 this._lang_error('unsupported qualified name for factory', names.$index(0).g et$span()); 18063 this._lang_error('unsupported qualified name for factory', (($0 = names.$ind ex(0).get$span()) && $0.is$SourceSpan()));
17881 } 18064 }
17882 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get $span()); 18065 type = new NameTypeReference(false, names.$index(0), null, (($0 = names.$index (0).get$span()) && $0.is$SourceSpan()));
17883 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); 18066 var di = new DeclaredIdentifier(type, name, this._makeSpan(start));
17884 return this.finishDefinition(start, [factoryToken], di); 18067 return this.finishDefinition(start, [factoryToken], di);
17885 } 18068 }
17886 lang_Parser.prototype.statement = function() { 18069 lang_Parser.prototype.statement = function() {
17887 var $0; 18070 var $0;
17888 switch (this._peek()) { 18071 switch (this._peek()) {
17889 case 88/*TokenKind.BREAK*/: 18072 case 88/*TokenKind.BREAK*/:
17890 18073
17891 return (($0 = this.breakStatement()) && $0.is$lang_Statement()); 18074 return (($0 = this.breakStatement()) && $0.is$lang_Statement());
17892 18075
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
17947 return (($0 = this.declaration(false)) && $0.is$lang_Statement()); 18130 return (($0 = this.declaration(false)) && $0.is$lang_Statement());
17948 18131
17949 default: 18132 default:
17950 18133
17951 return (($0 = this.finishExpressionAsStatement(this.expression())) && $0.i s$lang_Statement()); 18134 return (($0 = this.finishExpressionAsStatement(this.expression())) && $0.i s$lang_Statement());
17952 18135
17953 } 18136 }
17954 } 18137 }
17955 lang_Parser.prototype.finishExpressionAsStatement = function(expr) { 18138 lang_Parser.prototype.finishExpressionAsStatement = function(expr) {
17956 var $0; 18139 var $0;
17957 var start = expr.get$span().start; 18140 var start = $assert_num(expr.get$span().get$start());
17958 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { 18141 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) {
17959 var label = this._makeLabel(expr); 18142 var label = this._makeLabel(expr);
17960 return new LabeledStatement(label, this.statement(), this._makeSpan(start)); 18143 return new LabeledStatement(label, this.statement(), this._makeSpan(start));
17961 } 18144 }
17962 if ((expr instanceof LambdaExpression)) { 18145 if ((expr instanceof LambdaExpression)) {
17963 if (!(expr.func.body instanceof BlockStatement)) { 18146 if (!(expr.get$func().get$body() instanceof BlockStatement)) {
17964 this._eatSemicolon(); 18147 this._eatSemicolon();
17965 expr.func.span = this._makeSpan(start); 18148 expr.get$func().set$span(this._makeSpan(start));
17966 } 18149 }
17967 return expr.func; 18150 return expr.get$func();
17968 } 18151 }
17969 else if ((expr instanceof DeclaredIdentifier)) { 18152 else if ((expr instanceof DeclaredIdentifier)) {
17970 var value = null; 18153 var value = null;
17971 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { 18154 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) {
17972 value = this.expression(); 18155 value = this.expression();
17973 } 18156 }
17974 return this.finishField(start, null, expr.type, expr.get$name(), value); 18157 return this.finishField(start, null, expr.get$type(), expr.get$name(), value );
17975 } 18158 }
17976 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x i nstanceof DeclaredIdentifier)))) { 18159 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.get $x() instanceof DeclaredIdentifier)))) {
17977 var di = (($0 = expr.x) && $0.is$DeclaredIdentifier()); 18160 var di = (($0 = expr.get$x()) && $0.is$DeclaredIdentifier());
17978 return this.finishField(start, null, di.type, di.name, expr.y); 18161 return this.finishField(start, null, di.type, di.name, expr.get$y());
17979 } 18162 }
17980 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat (11/*TokenKind.COMMA*/))) { 18163 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat (11/*TokenKind.COMMA*/))) {
17981 var baseType = this._makeType(expr.x); 18164 var baseType = this._makeType(expr.get$x());
17982 var typeArgs = [this._makeType(expr.y)]; 18165 var typeArgs = [this._makeType(expr.get$y())];
17983 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference()) , 0, typeArgs); 18166 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference()) , 0, typeArgs);
17984 var name = this.identifier(); 18167 var name = this.identifier();
17985 var value = null; 18168 var value = null;
17986 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { 18169 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) {
17987 value = this.expression(); 18170 value = this.expression();
17988 } 18171 }
17989 return this.finishField(expr.get$span().start, null, gt, name, value); 18172 return this.finishField(expr.get$span().get$start(), null, gt, name, value);
17990 } 18173 }
17991 else { 18174 else {
17992 this._eatSemicolon(); 18175 this._eatSemicolon();
17993 return new lang_ExpressionStatement(expr, this._makeSpan(expr.get$span().sta rt)); 18176 return new lang_ExpressionStatement(expr, this._makeSpan($assert_num(expr.ge t$span().get$start())));
17994 } 18177 }
17995 } 18178 }
17996 lang_Parser.prototype.testCondition = function() { 18179 lang_Parser.prototype.testCondition = function() {
17997 this._eat(2/*TokenKind.LPAREN*/); 18180 this._eat(2/*TokenKind.LPAREN*/);
17998 var ret = this.expression(); 18181 var ret = this.expression();
17999 this._eat(3/*TokenKind.RPAREN*/); 18182 this._eat(3/*TokenKind.RPAREN*/);
18000 return (ret && ret.is$lang_Expression()); 18183 return (ret && ret.is$lang_Expression());
18001 } 18184 }
18002 lang_Parser.prototype.block = function() { 18185 lang_Parser.prototype.block = function() {
18003 var start = this._peekToken.start; 18186 var start = this._peekToken.start;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
18067 } 18250 }
18068 lang_Parser.prototype.forInitializerStatement = function(start) { 18251 lang_Parser.prototype.forInitializerStatement = function(start) {
18069 var $0; 18252 var $0;
18070 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { 18253 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) {
18071 return null; 18254 return null;
18072 } 18255 }
18073 else { 18256 else {
18074 var init = this.expression(); 18257 var init = this.expression();
18075 if ($notnull_bool(this._peekKind(11/*TokenKind.COMMA*/) && this._isBin(init, 52/*TokenKind.LT*/))) { 18258 if ($notnull_bool(this._peekKind(11/*TokenKind.COMMA*/) && this._isBin(init, 52/*TokenKind.LT*/))) {
18076 this._eat(11/*TokenKind.COMMA*/); 18259 this._eat(11/*TokenKind.COMMA*/);
18077 var baseType = this._makeType(init.x); 18260 var baseType = this._makeType(init.get$x());
18078 var typeArgs = [this._makeType(init.y)]; 18261 var typeArgs = [this._makeType(init.get$y())];
18079 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference( )), 0, typeArgs); 18262 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference( )), 0, typeArgs);
18080 var name = this.identifier(); 18263 var name = this.identifier();
18081 init = new DeclaredIdentifier(gt, name, this._makeSpan(init.get$span().sta rt)); 18264 init = new DeclaredIdentifier(gt, name, this._makeSpan($assert_num(init.ge t$span().get$start())));
18082 } 18265 }
18083 if ($notnull_bool(this._maybeEat(101/*TokenKind.IN*/))) { 18266 if ($notnull_bool(this._maybeEat(101/*TokenKind.IN*/))) {
18084 return this._finishForIn(start, (($0 = this._makeDeclaredIdentifier(init)) && $0.is$DeclaredIdentifier())); 18267 return this._finishForIn(start, (($0 = this._makeDeclaredIdentifier(init)) && $0.is$DeclaredIdentifier()));
18085 } 18268 }
18086 else { 18269 else {
18087 return this.finishExpressionAsStatement(init); 18270 return this.finishExpressionAsStatement(init);
18088 } 18271 }
18089 } 18272 }
18090 } 18273 }
18091 lang_Parser.prototype._finishForIn = function(start, di) { 18274 lang_Parser.prototype._finishForIn = function(start, di) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
18150 this._eat(8/*TokenKind.COLON*/); 18333 this._eat(8/*TokenKind.COLON*/);
18151 } 18334 }
18152 else if ($notnull_bool(this._maybeEat(93/*TokenKind.DEFAULT*/))) { 18335 else if ($notnull_bool(this._maybeEat(93/*TokenKind.DEFAULT*/))) {
18153 cases.add$1(); 18336 cases.add$1();
18154 this._eat(8/*TokenKind.COLON*/); 18337 this._eat(8/*TokenKind.COLON*/);
18155 } 18338 }
18156 else { 18339 else {
18157 break; 18340 break;
18158 } 18341 }
18159 } 18342 }
18160 if (cases.length == 0) { 18343 if ($notnull_bool($eq(cases.length, 0))) {
18161 this._lang_error('case or default'); 18344 this._lang_error('case or default');
18162 } 18345 }
18163 var stmts = []; 18346 var stmts = [];
18164 while (!$notnull_bool(this._peekCaseEnd())) { 18347 while (!$notnull_bool(this._peekCaseEnd())) {
18165 if ($notnull_bool(this.isPrematureEndOfFile())) break; 18348 if ($notnull_bool(this.isPrematureEndOfFile())) break;
18166 stmts.add$1(this.statement()); 18349 stmts.add$1(this.statement());
18167 } 18350 }
18168 return new CaseNode(label, cases, stmts, this._makeSpan(start)); 18351 return new CaseNode(label, cases, stmts, this._makeSpan(start));
18169 } 18352 }
18170 lang_Parser.prototype.returnStatement = function() { 18353 lang_Parser.prototype.returnStatement = function() {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
18219 if ($notnull_bool(this._peekIdentifier())) { 18402 if ($notnull_bool(this._peekIdentifier())) {
18220 name = this.identifier(); 18403 name = this.identifier();
18221 } 18404 }
18222 this._eatSemicolon(); 18405 this._eatSemicolon();
18223 return new ContinueStatement(name, this._makeSpan(start)); 18406 return new ContinueStatement(name, this._makeSpan(start));
18224 } 18407 }
18225 lang_Parser.prototype.expression = function() { 18408 lang_Parser.prototype.expression = function() {
18226 return this.infixExpression(0); 18409 return this.infixExpression(0);
18227 } 18410 }
18228 lang_Parser.prototype._makeType = function(expr) { 18411 lang_Parser.prototype._makeType = function(expr) {
18412 var $0;
18229 if ((expr instanceof VarExpression)) { 18413 if ((expr instanceof VarExpression)) {
18230 return new NameTypeReference(false, expr.get$name(), null, expr.get$span()); 18414 return new NameTypeReference(false, expr.get$name(), null, (($0 = expr.get$s pan()) && $0.is$SourceSpan()));
18231 } 18415 }
18232 else if ((expr instanceof DotExpression)) { 18416 else if ((expr instanceof DotExpression)) {
18233 var type = this._makeType(expr.self); 18417 var type = this._makeType(expr.get$self());
18234 if (type.names == null) { 18418 if (type.get$names() == null) {
18235 type.names = [expr.get$name()]; 18419 type.set$names([expr.get$name()]);
18236 } 18420 }
18237 else { 18421 else {
18238 type.names.add(expr.get$name()); 18422 type.get$names().add$1(expr.get$name());
18239 } 18423 }
18240 type.span = expr.get$span(); 18424 type.set$span(expr.get$span());
18241 return type; 18425 return type;
18242 } 18426 }
18243 else { 18427 else {
18244 this._lang_error('expected type reference'); 18428 this._lang_error('expected type reference');
18245 return null; 18429 return null;
18246 } 18430 }
18247 } 18431 }
18248 lang_Parser.prototype.infixExpression = function(precedence) { 18432 lang_Parser.prototype.infixExpression = function(precedence) {
18249 var $0; 18433 var $0;
18250 return this.finishInfixExpression((($0 = this.unaryExpression()) && $0.is$lang _Expression()), precedence); 18434 return this.finishInfixExpression((($0 = this.unaryExpression()) && $0.is$lang _Expression()), precedence);
18251 } 18435 }
18252 lang_Parser.prototype._finishDeclaredId = function(type) { 18436 lang_Parser.prototype._finishDeclaredId = function(type) {
18253 var name = this.identifier(); 18437 var name = this.identifier();
18254 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m akeSpan(type.get$span().start))); 18438 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m akeSpan($assert_num(type.get$span().get$start()))));
18255 } 18439 }
18256 lang_Parser.prototype._fixAsType = function(x) { 18440 lang_Parser.prototype._fixAsType = function(x) {
18257 $assert(this._isBin(x, 52/*TokenKind.LT*/), "_isBin(x, TokenKind.LT)", "parser .dart", 790, 12); 18441 $assert(this._isBin(x, 52/*TokenKind.LT*/), "_isBin(x, TokenKind.LT)", "parser .dart", 790, 12);
18258 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { 18442 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) {
18259 var base = this._makeType(x.x); 18443 var base = this._makeType(x.x);
18260 var typeParam = this._makeType(x.y); 18444 var typeParam = this._makeType(x.y);
18261 var type = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.s pan.start)); 18445 var type = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.s pan.start));
18262 return this._finishDeclaredId(type); 18446 return this._finishDeclaredId(type);
18263 } 18447 }
18264 else { 18448 else {
18265 $assert(this._peekKind(52/*TokenKind.LT*/), "_peekKind(TokenKind.LT)", "pars er.dart", 801, 14); 18449 $assert(this._peekKind(52/*TokenKind.LT*/), "_peekKind(TokenKind.LT)", "pars er.dart", 801, 14);
18266 var base = this._makeType(x.x); 18450 var base = this._makeType(x.x);
18267 var paramBase = this._makeType(x.y); 18451 var paramBase = this._makeType(x.y);
18268 var firstParam = this.addTypeArguments((paramBase && paramBase.is$TypeRefere nce()), 1); 18452 var firstParam = this.addTypeArguments((paramBase && paramBase.is$TypeRefere nce()), 1);
18269 var type; 18453 var type;
18270 if (firstParam.depth <= 0) { 18454 if (firstParam.get$depth() <= 0) {
18271 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start)); 18455 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start));
18272 } 18456 }
18273 else if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { 18457 else if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) {
18274 type = this._finishTypeArguments((base && base.is$TypeReference()), 0, [fi rstParam]); 18458 type = this._finishTypeArguments((base && base.is$TypeReference()), 0, [fi rstParam]);
18275 } 18459 }
18276 else { 18460 else {
18277 this._eat(53/*TokenKind.GT*/); 18461 this._eat(53/*TokenKind.GT*/);
18278 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start)); 18462 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start));
18279 } 18463 }
18280 return this._finishDeclaredId(type); 18464 return this._finishDeclaredId(type);
18281 } 18465 }
18282 } 18466 }
18283 lang_Parser.prototype.finishInfixExpression = function(x, precedence) { 18467 lang_Parser.prototype.finishInfixExpression = function(x, precedence) {
18284 while (true) { 18468 while (true) {
18285 var kind = this._peek(); 18469 var kind = this._peek();
18286 var prec = TokenKind.infixPrecedence(this._peek()); 18470 var prec = TokenKind.infixPrecedence(this._peek());
18287 if (prec >= precedence) { 18471 if (prec >= precedence) {
18288 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) { 18472 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) {
18289 if ($notnull_bool(this._isBin(x, 52/*TokenKind.LT*/))) { 18473 if ($notnull_bool(this._isBin(x, 52/*TokenKind.LT*/))) {
18290 return this._fixAsType((x && x.is$BinaryExpression())); 18474 return this._fixAsType((x && x.is$BinaryExpression()));
18291 } 18475 }
18292 } 18476 }
18293 var op = this._lang_next(); 18477 var op = this._lang_next();
18294 if ($notnull_bool($eq(op.kind, 102/*TokenKind.IS*/))) { 18478 if ($notnull_bool($eq(op.get$kind(), 102/*TokenKind.IS*/))) {
18295 var isTrue = !$notnull_bool(this._maybeEat(19/*TokenKind.NOT*/)); 18479 var isTrue = !$notnull_bool(this._maybeEat(19/*TokenKind.NOT*/));
18296 var typeRef = this.type(0); 18480 var typeRef = this.type(0);
18297 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); 18481 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start));
18298 continue; 18482 continue;
18299 } 18483 }
18300 var y = this.infixExpression($assert_num($notnull_bool($eq(prec, 2)) ? pre c : prec + 1)); 18484 var y = this.infixExpression($assert_num($notnull_bool($eq(prec, 2)) ? pre c : prec + 1));
18301 if ($notnull_bool($eq(op.kind, 33/*TokenKind.CONDITIONAL*/))) { 18485 if ($notnull_bool($eq(op.get$kind(), 33/*TokenKind.CONDITIONAL*/))) {
18302 this._eat(8/*TokenKind.COLON*/); 18486 this._eat(8/*TokenKind.COLON*/);
18303 var z = this.infixExpression($assert_num(prec)); 18487 var z = this.infixExpression($assert_num(prec));
18304 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start)); 18488 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start));
18305 } 18489 }
18306 else { 18490 else {
18307 x = new BinaryExpression(op, x, y, this._makeSpan(x.span.start)); 18491 x = new BinaryExpression(op, x, y, this._makeSpan(x.span.start));
18308 } 18492 }
18309 } 18493 }
18310 else { 18494 else {
18311 break; 18495 break;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
18365 } 18549 }
18366 return args; 18550 return args;
18367 } 18551 }
18368 lang_Parser.prototype.get$arguments = function() { 18552 lang_Parser.prototype.get$arguments = function() {
18369 return lang_Parser.prototype.arguments.bind(this); 18553 return lang_Parser.prototype.arguments.bind(this);
18370 } 18554 }
18371 lang_Parser.prototype.finishPostfixExpression = function(expr) { 18555 lang_Parser.prototype.finishPostfixExpression = function(expr) {
18372 switch (this._peek()) { 18556 switch (this._peek()) {
18373 case 2/*TokenKind.LPAREN*/: 18557 case 2/*TokenKind.LPAREN*/:
18374 18558
18375 return this.finishPostfixExpression(new CallExpression(expr, this.argument s(), this._makeSpan(expr.get$span().start))); 18559 return this.finishPostfixExpression(new CallExpression(expr, this.argument s(), this._makeSpan($assert_num(expr.get$span().get$start()))));
18376 18560
18377 case 4/*TokenKind.LBRACK*/: 18561 case 4/*TokenKind.LBRACK*/:
18378 18562
18379 this._eat(4/*TokenKind.LBRACK*/); 18563 this._eat(4/*TokenKind.LBRACK*/);
18380 var index = this.expression(); 18564 var index = this.expression();
18381 this._eat(5/*TokenKind.RBRACK*/); 18565 this._eat(5/*TokenKind.RBRACK*/);
18382 return this.finishPostfixExpression(new IndexExpression(expr, index, this. _makeSpan(expr.get$span().start))); 18566 return this.finishPostfixExpression(new IndexExpression(expr, index, this. _makeSpan($assert_num(expr.get$span().get$start()))));
18383 18567
18384 case 14/*TokenKind.DOT*/: 18568 case 14/*TokenKind.DOT*/:
18385 18569
18386 this._eat(14/*TokenKind.DOT*/); 18570 this._eat(14/*TokenKind.DOT*/);
18387 var name = this.identifier(); 18571 var name = this.identifier();
18388 var ret = new DotExpression(expr, name, this._makeSpan(expr.get$span().sta rt)); 18572 var ret = new DotExpression(expr, name, this._makeSpan($assert_num(expr.ge t$span().get$start())));
18389 return this.finishPostfixExpression(ret); 18573 return this.finishPostfixExpression(ret);
18390 18574
18391 case 16/*TokenKind.INCR*/: 18575 case 16/*TokenKind.INCR*/:
18392 case 17/*TokenKind.DECR*/: 18576 case 17/*TokenKind.DECR*/:
18393 18577
18394 var tok = this._lang_next(); 18578 var tok = this._lang_next();
18395 return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().sta rt)); 18579 return new PostfixExpression(expr, tok, this._makeSpan($assert_num(expr.ge t$span().get$start())));
18396 18580
18397 case 9/*TokenKind.ARROW*/: 18581 case 9/*TokenKind.ARROW*/:
18398 case 6/*TokenKind.LBRACE*/: 18582 case 6/*TokenKind.LBRACE*/:
18399 18583
18400 if ($notnull_bool(this._inInitializers)) return expr; 18584 if ($notnull_bool(this._inInitializers)) return expr;
18401 var body = this.functionBody(true); 18585 var body = this.functionBody(true);
18402 return this._makeFunction(expr, body); 18586 return this._makeFunction(expr, body);
18403 18587
18404 default: 18588 default:
18405 18589
18406 if ($notnull_bool(this._peekIdentifier())) { 18590 if ($notnull_bool(this._peekIdentifier())) {
18407 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp e(expr), this.identifier(), this._makeSpan(expr.get$span().start))); 18591 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp e(expr), this.identifier(), this._makeSpan($assert_num(expr.get$span().get$start ()))));
18408 } 18592 }
18409 else { 18593 else {
18410 return expr; 18594 return expr;
18411 } 18595 }
18412 18596
18413 } 18597 }
18414 } 18598 }
18415 lang_Parser.prototype._isBin = function(expr, kind) { 18599 lang_Parser.prototype._isBin = function(expr, kind) {
18416 return (expr instanceof BinaryExpression) && expr.op.kind == kind; 18600 return $notnull_bool((expr instanceof BinaryExpression) && $eq(expr.get$op().g et$kind(), kind));
18417 } 18601 }
18418 lang_Parser.prototype._boolTypeRef = function(span) { 18602 lang_Parser.prototype._boolTypeRef = function(span) {
18419 return new TypeReference(span, world.nonNullBool); 18603 return new TypeReference(span, world.nonNullBool);
18420 } 18604 }
18421 lang_Parser.prototype._intTypeRef = function(span) { 18605 lang_Parser.prototype._intTypeRef = function(span) {
18422 return new TypeReference(span, world.intType); 18606 return new TypeReference(span, world.intType);
18423 } 18607 }
18424 lang_Parser.prototype._doubleTypeRef = function(span) { 18608 lang_Parser.prototype._doubleTypeRef = function(span) {
18425 return new TypeReference(span, world.doubleType); 18609 return new TypeReference(span, world.doubleType);
18426 } 18610 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
18485 return new LiteralExpression(true, this._boolTypeRef(this._makeSpan(start) ), 'true', this._makeSpan(start)); 18669 return new LiteralExpression(true, this._boolTypeRef(this._makeSpan(start) ), 'true', this._makeSpan(start));
18486 18670
18487 case 96/*TokenKind.FALSE*/: 18671 case 96/*TokenKind.FALSE*/:
18488 18672
18489 this._eat(96/*TokenKind.FALSE*/); 18673 this._eat(96/*TokenKind.FALSE*/);
18490 return new LiteralExpression(false, this._boolTypeRef(this._makeSpan(start )), 'false', this._makeSpan(start)); 18674 return new LiteralExpression(false, this._boolTypeRef(this._makeSpan(start )), 'false', this._makeSpan(start));
18491 18675
18492 case 61/*TokenKind.HEX_INTEGER*/: 18676 case 61/*TokenKind.HEX_INTEGER*/:
18493 18677
18494 var t = this._lang_next(); 18678 var t = this._lang_next();
18495 return new LiteralExpression(lang_Parser.parseHex(t.get$text().substring(2 )), this._intTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start) ); 18679 return new LiteralExpression(lang_Parser.parseHex($assert_String(t.get$tex t().substring$1(2))), this._intTypeRef(this._makeSpan(start)), t.get$text(), thi s._makeSpan(start));
18496 18680
18497 case 60/*TokenKind.INTEGER*/: 18681 case 60/*TokenKind.INTEGER*/:
18498 18682
18499 var t = this._lang_next(); 18683 var t = this._lang_next();
18500 return new LiteralExpression(Math.parseInt(t.get$text()), this._intTypeRef (this._makeSpan(start)), t.get$text(), this._makeSpan(start)); 18684 return new LiteralExpression(Math.parseInt($assert_String(t.get$text())), this._intTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start));
18501 18685
18502 case 62/*TokenKind.DOUBLE*/: 18686 case 62/*TokenKind.DOUBLE*/:
18503 18687
18504 var t = this._lang_next(); 18688 var t = this._lang_next();
18505 return new LiteralExpression(Math.parseDouble(t.get$text()), this._doubleT ypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start)); 18689 return new LiteralExpression(Math.parseDouble($assert_String(t.get$text()) ), this._doubleTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(star t));
18506 18690
18507 case 58/*TokenKind.STRING*/: 18691 case 58/*TokenKind.STRING*/:
18508 18692
18509 return this.stringLiteralExpr(); 18693 return this.stringLiteralExpr();
18510 18694
18511 case 66/*TokenKind.INCOMPLETE_STRING*/: 18695 case 66/*TokenKind.INCOMPLETE_STRING*/:
18512 18696
18513 return this.stringInterpolation(); 18697 return this.stringInterpolation();
18514 18698
18515 case 52/*TokenKind.LT*/: 18699 case 52/*TokenKind.LT*/:
18516 18700
18517 return this.finishTypedLiteral(start, false); 18701 return this.finishTypedLiteral(start, false);
18518 18702
18519 case 113/*TokenKind.VOID*/: 18703 case 113/*TokenKind.VOID*/:
18520 case 112/*TokenKind.VAR*/: 18704 case 112/*TokenKind.VAR*/:
18521 case 97/*TokenKind.FINAL*/: 18705 case 97/*TokenKind.FINAL*/:
18522 18706
18523 return this.declaredIdentifier(false); 18707 return this.declaredIdentifier(false);
18524 18708
18525 default: 18709 default:
18526 18710
18527 if (!$notnull_bool(this._peekIdentifier())) { 18711 if (!$notnull_bool(this._peekIdentifier())) {
18528 this._errorExpected('expression'); 18712 this._errorExpected('expression');
18529 } 18713 }
18530 return new VarExpression(this.identifier(), this._makeSpan(start)); 18714 return new VarExpression(this.identifier(), this._makeSpan(start));
18531 18715
18532 } 18716 }
18533 } 18717 }
18534 lang_Parser.prototype.stringInterpolation = function() { 18718 lang_Parser.prototype.stringInterpolation = function() {
18719 var $0;
18535 var start = this._peekToken.start; 18720 var start = this._peekToken.start;
18536 var lits = []; 18721 var lits = [];
18537 var startQuote = null, endQuote = null; 18722 var startQuote = null, endQuote = null;
18538 while ($notnull_bool(this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/))) { 18723 while ($notnull_bool(this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/))) {
18539 var token = this._lang_next(); 18724 var token = this._lang_next();
18540 var text = token.get$text(); 18725 var text = token.get$text();
18541 if ($notnull_bool(startQuote == null)) { 18726 if ($notnull_bool(startQuote == null)) {
18542 if ($notnull_bool(isMultilineString($assert_String(text)))) { 18727 if ($notnull_bool(isMultilineString($assert_String(text)))) {
18543 endQuote = text.substring$2(0, 3); 18728 endQuote = text.substring$2(0, 3);
18544 startQuote = endQuote + '\n'; 18729 startQuote = endQuote + '\n';
18545 } 18730 }
18546 else { 18731 else {
18547 startQuote = endQuote = text.$index(0); 18732 startQuote = endQuote = text.$index(0);
18548 } 18733 }
18549 text = text.substring$2(0, text.length - 1) + endQuote; 18734 text = text.substring$2(0, text.length - 1) + endQuote;
18550 } 18735 }
18551 else { 18736 else {
18552 text = startQuote + text.substring$2(0, text.length - 1) + endQuote; 18737 text = startQuote + text.substring$2(0, text.length - 1) + endQuote;
18553 } 18738 }
18554 lits.add$1(this.makeStringLiteral($assert_String(text), token.get$span())); 18739 lits.add$1(this.makeStringLiteral($assert_String(text), (($0 = token.get$spa n()) && $0.is$SourceSpan())));
18555 if ($notnull_bool(this._maybeEat(6/*TokenKind.LBRACE*/))) { 18740 if ($notnull_bool(this._maybeEat(6/*TokenKind.LBRACE*/))) {
18556 lits.add$1(this.expression()); 18741 lits.add$1(this.expression());
18557 this._eat(7/*TokenKind.RBRACE*/); 18742 this._eat(7/*TokenKind.RBRACE*/);
18558 } 18743 }
18559 else { 18744 else {
18560 var id = this.identifier(); 18745 var id = this.identifier();
18561 lits.add$1(new VarExpression(id, id.get$span())); 18746 lits.add$1(new VarExpression(id, (($0 = id.get$span()) && $0.is$SourceSpan ())));
18562 } 18747 }
18563 } 18748 }
18564 var tok = this._lang_next(); 18749 var tok = this._lang_next();
18565 if ($notnull_bool($ne(tok.kind, 58/*TokenKind.STRING*/))) { 18750 if ($notnull_bool($ne(tok.get$kind(), 58/*TokenKind.STRING*/))) {
18566 this._errorExpected('interpolated string'); 18751 this._errorExpected('interpolated string');
18567 } 18752 }
18568 var text = startQuote + tok.get$text(); 18753 var text = startQuote + tok.get$text();
18569 lits.add$1(this.makeStringLiteral($assert_String(text), tok.get$span())); 18754 lits.add$1(this.makeStringLiteral($assert_String(text), (($0 = tok.get$span()) && $0.is$SourceSpan())));
18570 var span = this._makeSpan(start); 18755 var span = this._makeSpan(start);
18571 return new LiteralExpression(lits, this._stringTypeRef((span && span.is$Source Span())), '\$\$\$', (span && span.is$SourceSpan())); 18756 return new LiteralExpression(lits, this._stringTypeRef((span && span.is$Source Span())), '\$\$\$', (span && span.is$SourceSpan()));
18572 } 18757 }
18573 lang_Parser.prototype.makeStringLiteral = function(text, span) { 18758 lang_Parser.prototype.makeStringLiteral = function(text, span) {
18574 return new LiteralExpression(text, this._stringTypeRef(span), text, span); 18759 return new LiteralExpression(text, this._stringTypeRef(span), text, span);
18575 } 18760 }
18576 lang_Parser.prototype.stringLiteralExpr = function() { 18761 lang_Parser.prototype.stringLiteralExpr = function() {
18762 var $0;
18577 var token = this._lang_next(); 18763 var token = this._lang_next();
18578 return this.makeStringLiteral(token.get$text(), token.get$span()); 18764 return this.makeStringLiteral($assert_String(token.get$text()), (($0 = token.g et$span()) && $0.is$SourceSpan()));
18579 } 18765 }
18580 lang_Parser.prototype.maybeStringLiteral = function() { 18766 lang_Parser.prototype.maybeStringLiteral = function() {
18581 var kind = this._peek(); 18767 var kind = this._peek();
18582 if ($notnull_bool($eq(kind, 58/*TokenKind.STRING*/))) { 18768 if ($notnull_bool($eq(kind, 58/*TokenKind.STRING*/))) {
18583 return parseStringLiteral(this._lang_next().get$text()); 18769 return parseStringLiteral(this._lang_next().get$text());
18584 } 18770 }
18585 else if ($notnull_bool($eq(kind, 59/*TokenKind.STRING_PART*/))) { 18771 else if ($notnull_bool($eq(kind, 59/*TokenKind.STRING_PART*/))) {
18586 this._lang_next(); 18772 this._lang_next();
18587 this._errorExpected('string literal, but found interpolated string start'); 18773 this._errorExpected('string literal, but found interpolated string start');
18588 } 18774 }
18589 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) { 18775 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) {
18590 this._lang_next(); 18776 this._lang_next();
18591 this._errorExpected('string literal, but found incomplete string'); 18777 this._errorExpected('string literal, but found incomplete string');
18592 } 18778 }
18593 return null; 18779 return null;
18594 } 18780 }
18595 lang_Parser.prototype._parenOrLambda = function() { 18781 lang_Parser.prototype._parenOrLambda = function() {
18782 var $0;
18596 var start = this._peekToken.start; 18783 var start = this._peekToken.start;
18597 var args = this.arguments(); 18784 var args = this.arguments();
18598 if (!$notnull_bool(this._inInitializers) && ($notnull_bool(this._peekKind(9/*T okenKind.ARROW*/) || this._peekKind(6/*TokenKind.LBRACE*/)))) { 18785 if (!$notnull_bool(this._inInitializers) && ($notnull_bool(this._peekKind(9/*T okenKind.ARROW*/) || this._peekKind(6/*TokenKind.LBRACE*/)))) {
18599 var body = this.functionBody(true); 18786 var body = this.functionBody(true);
18600 var formals = this._makeFormals(args); 18787 var formals = this._makeFormals(args);
18601 var func = new FunctionDefinition(null, null, null, formals, null, body, thi s._makeSpan(start)); 18788 var func = new FunctionDefinition(null, null, null, formals, null, body, thi s._makeSpan(start));
18602 return new LambdaExpression(func, func.get$span()); 18789 return new LambdaExpression(func, (($0 = func.get$span()) && $0.is$SourceSpa n()));
18603 } 18790 }
18604 else { 18791 else {
18605 if (args.length == 1) { 18792 if ($notnull_bool($eq(args.length, 1))) {
18606 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star t)); 18793 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star t));
18607 } 18794 }
18608 else { 18795 else {
18609 this._lang_error('unexpected comma expression'); 18796 this._lang_error('unexpected comma expression');
18610 return args.$index(0).get$value(); 18797 return args.$index(0).get$value();
18611 } 18798 }
18612 } 18799 }
18613 } 18800 }
18614 lang_Parser.prototype._typeAsIdentifier = function(type) { 18801 lang_Parser.prototype._typeAsIdentifier = function(type) {
18615 return type.get$name(); 18802 return type.get$name();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
18687 var start = this._peekToken.start; 18874 var start = this._peekToken.start;
18688 var myType = null; 18875 var myType = null;
18689 var name = this._specialIdentifier(includeOperators); 18876 var name = this._specialIdentifier(includeOperators);
18690 if (name == null) { 18877 if (name == null) {
18691 myType = this.type(0); 18878 myType = this.type(0);
18692 name = this._specialIdentifier(includeOperators); 18879 name = this._specialIdentifier(includeOperators);
18693 if (name == null) { 18880 if (name == null) {
18694 if ($notnull_bool(this._peekIdentifier())) { 18881 if ($notnull_bool(this._peekIdentifier())) {
18695 name = this.identifier(); 18882 name = this.identifier();
18696 } 18883 }
18697 else if ((myType instanceof NameTypeReference) && myType.names == null) { 18884 else if ($notnull_bool((myType instanceof NameTypeReference) && myType.get $names() == null)) {
18698 name = this._typeAsIdentifier(myType); 18885 name = this._typeAsIdentifier(myType);
18699 myType = null; 18886 myType = null;
18700 } 18887 }
18701 else { 18888 else {
18702 } 18889 }
18703 } 18890 }
18704 } 18891 }
18705 return new DeclaredIdentifier(myType, name, this._makeSpan(start)); 18892 return new DeclaredIdentifier(myType, name, this._makeSpan(start));
18706 } 18893 }
18707 lang_Parser._hexDigit = function(c) { 18894 lang_Parser._hexDigit = function(c) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
18813 } 19000 }
18814 return new TypeParameter(name, myType, this._makeSpan(start)); 19001 return new TypeParameter(name, myType, this._makeSpan(start));
18815 } 19002 }
18816 lang_Parser.prototype.typeParameters = function() { 19003 lang_Parser.prototype.typeParameters = function() {
18817 this._eat(52/*TokenKind.LT*/); 19004 this._eat(52/*TokenKind.LT*/);
18818 var closed = false; 19005 var closed = false;
18819 var ret = []; 19006 var ret = [];
18820 do { 19007 do {
18821 var tp = this.typeParameter(); 19008 var tp = this.typeParameter();
18822 ret.add$1(tp); 19009 ret.add$1(tp);
18823 if ((tp.extendsType instanceof GenericTypeReference) && tp.extendsType.depth == 0) { 19010 if ($notnull_bool((tp.get$extendsType() instanceof GenericTypeReference) && $eq(tp.get$extendsType().get$depth(), 0))) {
18824 closed = true; 19011 closed = true;
18825 break; 19012 break;
18826 } 19013 }
18827 } 19014 }
18828 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) 19015 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/)))
18829 if (!$notnull_bool(closed)) { 19016 if (!$notnull_bool(closed)) {
18830 this._eat(53/*TokenKind.GT*/); 19017 this._eat(53/*TokenKind.GT*/);
18831 } 19018 }
18832 return ret; 19019 return ret;
18833 } 19020 }
(...skipping 17 matching lines...) Expand all
18851 } 19038 }
18852 lang_Parser.prototype.addTypeArguments = function(baseType, depth) { 19039 lang_Parser.prototype.addTypeArguments = function(baseType, depth) {
18853 this._eat(52/*TokenKind.LT*/); 19040 this._eat(52/*TokenKind.LT*/);
18854 return this._finishTypeArguments(baseType, depth, []); 19041 return this._finishTypeArguments(baseType, depth, []);
18855 } 19042 }
18856 lang_Parser.prototype._finishTypeArguments = function(baseType, depth, types) { 19043 lang_Parser.prototype._finishTypeArguments = function(baseType, depth, types) {
18857 var delta = -1; 19044 var delta = -1;
18858 do { 19045 do {
18859 var myType = this.type(depth + 1); 19046 var myType = this.type(depth + 1);
18860 types.add$1(myType); 19047 types.add$1(myType);
18861 if ((myType instanceof GenericTypeReference) && myType.depth <= depth) { 19048 if ((myType instanceof GenericTypeReference) && myType.get$depth() <= depth) {
18862 delta = depth - myType.depth; 19049 delta = depth - $assert_num(myType.get$depth());
18863 break; 19050 break;
18864 } 19051 }
18865 } 19052 }
18866 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) 19053 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/)))
18867 if (delta >= 0) { 19054 if (delta >= 0) {
18868 depth -= $assert_num(delta); 19055 depth -= $assert_num(delta);
18869 } 19056 }
18870 else { 19057 else {
18871 depth = this._eatClosingAngle(depth); 19058 depth = this._eatClosingAngle(depth);
18872 } 19059 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
18914 names.add$1(this.identifier()); 19101 names.add$1(this.identifier());
18915 } 19102 }
18916 var typeRef = new NameTypeReference(isFinal, name, names, this._makeSpan(start )); 19103 var typeRef = new NameTypeReference(isFinal, name, names, this._makeSpan(start ));
18917 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { 19104 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) {
18918 return this.addTypeArguments((typeRef && typeRef.is$TypeReference()), depth) ; 19105 return this.addTypeArguments((typeRef && typeRef.is$TypeReference()), depth) ;
18919 } 19106 }
18920 else { 19107 else {
18921 return typeRef; 19108 return typeRef;
18922 } 19109 }
18923 } 19110 }
19111 lang_Parser.prototype.get$type = function() {
19112 return lang_Parser.prototype.type.bind(this);
19113 }
18924 lang_Parser.prototype.formalParameter = function(inOptionalBlock) { 19114 lang_Parser.prototype.formalParameter = function(inOptionalBlock) {
19115 var $0;
18925 var start = this._peekToken.start; 19116 var start = this._peekToken.start;
18926 var isThis = false; 19117 var isThis = false;
18927 var isRest = false; 19118 var isRest = false;
18928 var di = this.declaredIdentifier(false); 19119 var di = this.declaredIdentifier(false);
18929 var type = di.type; 19120 var type = di.get$type();
18930 var name = di.get$name(); 19121 var name = di.get$name();
18931 var value = null; 19122 var value = null;
18932 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { 19123 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) {
18933 if (!$notnull_bool(inOptionalBlock)) { 19124 if (!$notnull_bool(inOptionalBlock)) {
18934 this._lang_error('default values only allowed inside [optional] section'); 19125 this._lang_error('default values only allowed inside [optional] section');
18935 } 19126 }
18936 value = this.expression(); 19127 value = this.expression();
18937 } 19128 }
18938 else if ($notnull_bool(this._peekKind(2/*TokenKind.LPAREN*/))) { 19129 else if ($notnull_bool(this._peekKind(2/*TokenKind.LPAREN*/))) {
18939 var formals = this.formalParameterList(); 19130 var formals = this.formalParameterList();
18940 var func = new FunctionDefinition(null, type, name, formals, null, null, thi s._makeSpan(start)); 19131 var func = new FunctionDefinition(null, type, name, formals, null, null, thi s._makeSpan(start));
18941 type = new FunctionTypeReference(false, func, func.get$span()); 19132 type = new FunctionTypeReference(false, func, (($0 = func.get$span()) && $0. is$SourceSpan()));
18942 } 19133 }
18943 if ($notnull_bool(inOptionalBlock && value == null)) { 19134 if ($notnull_bool(inOptionalBlock && value == null)) {
18944 value = new NullExpression(this._makeSpan(start)); 19135 value = new NullExpression(this._makeSpan(start));
18945 } 19136 }
18946 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start) ); 19137 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start) );
18947 } 19138 }
18948 lang_Parser.prototype.formalParameterList = function() { 19139 lang_Parser.prototype.formalParameterList = function() {
18949 this._eat(2/*TokenKind.LPAREN*/); 19140 this._eat(2/*TokenKind.LPAREN*/);
18950 var formals = []; 19141 var formals = [];
18951 var inOptionalBlock = false; 19142 var inOptionalBlock = false;
(...skipping 12 matching lines...) Expand all
18964 formals.add$1(this.formalParameter($assert_bool(inOptionalBlock))); 19155 formals.add$1(this.formalParameter($assert_bool(inOptionalBlock)));
18965 } 19156 }
18966 if ($notnull_bool(inOptionalBlock)) { 19157 if ($notnull_bool(inOptionalBlock)) {
18967 this._eat(5/*TokenKind.RBRACK*/); 19158 this._eat(5/*TokenKind.RBRACK*/);
18968 } 19159 }
18969 this._eat(3/*TokenKind.RPAREN*/); 19160 this._eat(3/*TokenKind.RPAREN*/);
18970 } 19161 }
18971 return formals; 19162 return formals;
18972 } 19163 }
18973 lang_Parser.prototype.identifier = function() { 19164 lang_Parser.prototype.identifier = function() {
19165 var $0;
18974 var tok = this._lang_next(); 19166 var tok = this._lang_next();
18975 if (!$notnull_bool(TokenKind.isIdentifier($assert_num(tok.kind)))) { 19167 if (!$notnull_bool(TokenKind.isIdentifier($assert_num(tok.get$kind())))) {
18976 this._lang_error(('expected identifier, but found ' + tok + ''), tok.get$spa n()); 19168 this._lang_error(('expected identifier, but found ' + tok + ''), (($0 = tok. get$span()) && $0.is$SourceSpan()));
18977 } 19169 }
18978 return new lang_Identifier(tok.get$text(), this._makeSpan(tok.start)); 19170 return new lang_Identifier(tok.get$text(), this._makeSpan($assert_num(tok.get$ start())));
18979 } 19171 }
18980 lang_Parser.prototype._makeFunction = function(expr, body) { 19172 lang_Parser.prototype._makeFunction = function(expr, body) {
19173 var $0;
18981 var name, type; 19174 var name, type;
18982 if ((expr instanceof CallExpression)) { 19175 if ((expr instanceof CallExpression)) {
18983 if ((expr.target instanceof VarExpression)) { 19176 if ((expr.get$target() instanceof VarExpression)) {
18984 name = expr.target.get$name(); 19177 name = expr.get$target().get$name();
18985 type = null; 19178 type = null;
18986 } 19179 }
18987 else if ((expr.target instanceof DeclaredIdentifier)) { 19180 else if ((expr.get$target() instanceof DeclaredIdentifier)) {
18988 name = expr.target.get$name(); 19181 name = expr.get$target().get$name();
18989 type = expr.target.type; 19182 type = expr.get$target().get$type();
18990 } 19183 }
18991 else { 19184 else {
18992 this._lang_error('bad function'); 19185 this._lang_error('bad function');
18993 } 19186 }
18994 var formals = this._makeFormals(expr.get$arguments()); 19187 var formals = this._makeFormals(expr.get$arguments());
18995 var span = new SourceSpan(expr.get$span().file, expr.get$span().start, body. get$span().end); 19188 var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$st art(), body.get$span().get$end());
18996 var func = new FunctionDefinition(null, type, name, formals, null, body, (sp an && span.is$SourceSpan())); 19189 var func = new FunctionDefinition(null, type, name, formals, null, body, (sp an && span.is$SourceSpan()));
18997 return new LambdaExpression(func, func.get$span()); 19190 return new LambdaExpression(func, (($0 = func.get$span()) && $0.is$SourceSpa n()));
18998 } 19191 }
18999 else { 19192 else {
19000 this._lang_error('expected function'); 19193 this._lang_error('expected function');
19001 } 19194 }
19002 } 19195 }
19003 lang_Parser.prototype._makeFormal = function(expr) { 19196 lang_Parser.prototype._makeFormal = function(expr) {
19004 var $0; 19197 var $0;
19005 if ((expr instanceof VarExpression)) { 19198 if ((expr instanceof VarExpression)) {
19006 return new FormalNode(false, false, null, expr.get$name(), null, expr.get$sp an()); 19199 return new FormalNode(false, false, null, expr.get$name(), null, (($0 = expr .get$span()) && $0.is$SourceSpan()));
19007 } 19200 }
19008 else if ((expr instanceof DeclaredIdentifier)) { 19201 else if ((expr instanceof DeclaredIdentifier)) {
19009 return new FormalNode(false, false, expr.type, expr.get$name(), null, expr.g et$span()); 19202 return new FormalNode(false, false, expr.get$type(), expr.get$name(), null, (($0 = expr.get$span()) && $0.is$SourceSpan()));
19010 } 19203 }
19011 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x i nstanceof DeclaredIdentifier)))) { 19204 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.get $x() instanceof DeclaredIdentifier)))) {
19012 var di = (($0 = expr.x) && $0.is$DeclaredIdentifier()); 19205 var di = (($0 = expr.get$x()) && $0.is$DeclaredIdentifier());
19013 return new FormalNode(false, false, di.type, di.name, expr.y, expr.get$span( )); 19206 return new FormalNode(false, false, di.type, di.name, expr.get$y(), (($0 = e xpr.get$span()) && $0.is$SourceSpan()));
19014 } 19207 }
19015 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/))) { 19208 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/))) {
19016 return null; 19209 return null;
19017 } 19210 }
19018 else if ((expr instanceof ListExpression)) { 19211 else if ((expr instanceof ListExpression)) {
19019 return this._makeFormalsFromList(expr); 19212 return this._makeFormalsFromList(expr);
19020 } 19213 }
19021 else { 19214 else {
19022 this._lang_error('expected formal', expr.get$span()); 19215 this._lang_error('expected formal', (($0 = expr.get$span()) && $0.is$SourceS pan()));
19023 } 19216 }
19024 } 19217 }
19025 lang_Parser.prototype._makeFormalsFromList = function(expr) { 19218 lang_Parser.prototype._makeFormalsFromList = function(expr) {
19219 var $0;
19026 if ($notnull_bool(expr.get$isConst())) { 19220 if ($notnull_bool(expr.get$isConst())) {
19027 this._lang_error('expected formal, but found "const"', expr.get$span()); 19221 this._lang_error('expected formal, but found "const"', (($0 = expr.get$span( )) && $0.is$SourceSpan()));
19028 } 19222 }
19029 else if ($notnull_bool($ne(expr.type, null))) { 19223 else if ($notnull_bool($ne(expr.get$type(), null))) {
19030 this._lang_error('expected formal, but found generic type arguments', expr.t ype.get$span()); 19224 this._lang_error('expected formal, but found generic type arguments', (($0 = expr.get$type().get$span()) && $0.is$SourceSpan()));
19031 } 19225 }
19032 return this._makeFormalsFromExpressions(expr.values, false); 19226 return this._makeFormalsFromExpressions(expr.get$values(), false);
19033 } 19227 }
19034 lang_Parser.prototype._makeFormals = function(arguments) { 19228 lang_Parser.prototype._makeFormals = function(arguments) {
19035 var expressions = []; 19229 var expressions = [];
19036 for (var i = 0; 19230 for (var i = 0;
19037 i < arguments.length; i++) { 19231 i < $assert_num(arguments.length); i++) {
19038 var arg = arguments.$index(i); 19232 var arg = arguments.$index(i);
19039 if (arg.label != null) { 19233 if ($notnull_bool($ne(arg.get$label(), null))) {
19040 this._lang_error('expected formal, but found ":"'); 19234 this._lang_error('expected formal, but found ":"');
19041 } 19235 }
19042 expressions.add$1(arg.get$value()); 19236 expressions.add$1(arg.get$value());
19043 } 19237 }
19044 return this._makeFormalsFromExpressions(expressions, true); 19238 return this._makeFormalsFromExpressions(expressions, true);
19045 } 19239 }
19046 lang_Parser.prototype._makeFormalsFromExpressions = function(expressions, allowO ptional) { 19240 lang_Parser.prototype._makeFormalsFromExpressions = function(expressions, allowO ptional) {
19047 var $0; 19241 var $0;
19048 var formals = []; 19242 var formals = [];
19049 for (var i = 0; 19243 for (var i = 0;
19050 i < expressions.length; i++) { 19244 i < $assert_num(expressions.length); i++) {
19051 var formal = this._makeFormal(expressions.$index(i)); 19245 var formal = this._makeFormal(expressions.$index(i));
19052 if ($notnull_bool(formal == null)) { 19246 if ($notnull_bool(formal == null)) {
19053 var baseType = this._makeType(expressions.$index(i).x); 19247 var baseType = this._makeType(expressions.$index(i).get$x());
19054 var typeParams = [this._makeType(expressions.$index(i).y)]; 19248 var typeParams = [this._makeType(expressions.$index(i).get$y())];
19055 i++; 19249 i++;
19056 while (i < expressions.length) { 19250 while (i < $assert_num(expressions.length)) {
19057 var expr = expressions.$index(i++); 19251 var expr = expressions.$index(i++);
19058 if ($notnull_bool(this._isBin(expr, 53/*TokenKind.GT*/))) { 19252 if ($notnull_bool(this._isBin(expr, 53/*TokenKind.GT*/))) {
19059 typeParams.add$1(this._makeType(expr.x)); 19253 typeParams.add$1(this._makeType(expr.get$x()));
19060 var type = new GenericTypeReference(baseType, typeParams, 0, this._mak eSpan(baseType.get$span().start)); 19254 var type = new GenericTypeReference(baseType, typeParams, 0, this._mak eSpan($assert_num(baseType.get$span().get$start())));
19061 var name = null; 19255 var name = null;
19062 if ((expr.y instanceof VarExpression)) { 19256 if ((expr.get$y() instanceof VarExpression)) {
19063 var ve = (($0 = expr.y) && $0.is$VarExpression()); 19257 var ve = (($0 = expr.get$y()) && $0.is$VarExpression());
19064 name = ve.name; 19258 name = ve.name;
19065 } 19259 }
19066 else { 19260 else {
19067 this._lang_error('expected formal', expr.get$span()); 19261 this._lang_error('expected formal', (($0 = expr.get$span()) && $0.is $SourceSpan()));
19068 } 19262 }
19069 formal = new FormalNode(false, false, type, name, null, this._makeSpan (expressions.$index(0).get$span().start)); 19263 formal = new FormalNode(false, false, type, name, null, this._makeSpan ($assert_num(expressions.$index(0).get$span().get$start())));
19070 break; 19264 break;
19071 } 19265 }
19072 else { 19266 else {
19073 typeParams.add$1(this._makeType(expr)); 19267 typeParams.add$1(this._makeType(expr));
19074 } 19268 }
19075 } 19269 }
19076 formals.add$1(formal); 19270 formals.add$1(formal);
19077 } 19271 }
19078 else if (!!(formal && formal.is$List)) { 19272 else if (!!(formal && formal.is$List)) {
19079 formals.addAll$1(formal); 19273 formals.addAll$1(formal);
19080 if (!$notnull_bool(allowOptional)) { 19274 if (!$notnull_bool(allowOptional)) {
19081 this._lang_error('unexpected nested optional formal', expressions.$index (i).get$span()); 19275 this._lang_error('unexpected nested optional formal', (($0 = expressions .$index(i).get$span()) && $0.is$SourceSpan()));
19082 } 19276 }
19083 } 19277 }
19084 else { 19278 else {
19085 formals.add$1(formal); 19279 formals.add$1(formal);
19086 } 19280 }
19087 } 19281 }
19088 return formals; 19282 return formals;
19089 } 19283 }
19090 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { 19284 lang_Parser.prototype._makeDeclaredIdentifier = function(e) {
19285 var $0;
19091 if ((e instanceof VarExpression)) { 19286 if ((e instanceof VarExpression)) {
19092 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); 19287 return new DeclaredIdentifier(null, e.get$name(), (($0 = e.get$span()) && $0 .is$SourceSpan()));
19093 } 19288 }
19094 else if ((e instanceof DeclaredIdentifier)) { 19289 else if ((e instanceof DeclaredIdentifier)) {
19095 return e; 19290 return e;
19096 } 19291 }
19097 else { 19292 else {
19098 this._lang_error('expected declared identifier'); 19293 this._lang_error('expected declared identifier');
19099 return new DeclaredIdentifier(null, null, e.get$span()); 19294 return new DeclaredIdentifier(null, null, (($0 = e.get$span()) && $0.is$Sour ceSpan()));
19100 } 19295 }
19101 } 19296 }
19102 lang_Parser.prototype._makeLabel = function(expr) { 19297 lang_Parser.prototype._makeLabel = function(expr) {
19103 if ((expr instanceof VarExpression)) { 19298 if ((expr instanceof VarExpression)) {
19104 return expr.get$name(); 19299 return expr.get$name();
19105 } 19300 }
19106 else { 19301 else {
19107 this._errorExpected('label'); 19302 this._errorExpected('label');
19108 return null; 19303 return null;
19109 } 19304 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
19162 $inherits(lang_Expression, lang_Node); 19357 $inherits(lang_Expression, lang_Node);
19163 lang_Expression.prototype.is$lang_Expression = function(){return this;}; 19358 lang_Expression.prototype.is$lang_Expression = function(){return this;};
19164 // ********** Code for TypeReference ************** 19359 // ********** Code for TypeReference **************
19165 function TypeReference(span, type) { 19360 function TypeReference(span, type) {
19166 this.type = type; 19361 this.type = type;
19167 lang_Node.call(this, span); 19362 lang_Node.call(this, span);
19168 // Initializers done 19363 // Initializers done
19169 } 19364 }
19170 $inherits(TypeReference, lang_Node); 19365 $inherits(TypeReference, lang_Node);
19171 TypeReference.prototype.is$TypeReference = function(){return this;}; 19366 TypeReference.prototype.is$TypeReference = function(){return this;};
19367 TypeReference.prototype.get$type = function() { return this.type; };
19368 TypeReference.prototype.set$type = function(value) { return this.type = value; } ;
19172 TypeReference.prototype.visit = function(visitor) { 19369 TypeReference.prototype.visit = function(visitor) {
19173 return visitor.visitTypeReference(this); 19370 return visitor.visitTypeReference(this);
19174 } 19371 }
19175 TypeReference.prototype.visit$1 = function($0) { 19372 TypeReference.prototype.visit$1 = function($0) {
19176 return this.visit(($0 && $0.is$TreeVisitor())); 19373 return this.visit(($0 && $0.is$TreeVisitor()));
19177 }; 19374 };
19178 // ********** Code for DirectiveDefinition ************** 19375 // ********** Code for DirectiveDefinition **************
19179 function DirectiveDefinition(name, arguments, span) { 19376 function DirectiveDefinition(name, arguments, span) {
19180 this.name = name; 19377 this.name = name;
19181 this.arguments = arguments; 19378 this.arguments = arguments;
(...skipping 27 matching lines...) Expand all
19209 $inherits(TypeDefinition, Definition); 19406 $inherits(TypeDefinition, Definition);
19210 TypeDefinition.prototype.is$TypeDefinition = function(){return this;}; 19407 TypeDefinition.prototype.is$TypeDefinition = function(){return this;};
19211 TypeDefinition.prototype.get$isClass = function() { return this.isClass; }; 19408 TypeDefinition.prototype.get$isClass = function() { return this.isClass; };
19212 TypeDefinition.prototype.set$isClass = function(value) { return this.isClass = v alue; }; 19409 TypeDefinition.prototype.set$isClass = function(value) { return this.isClass = v alue; };
19213 TypeDefinition.prototype.get$name = function() { return this.name; }; 19410 TypeDefinition.prototype.get$name = function() { return this.name; };
19214 TypeDefinition.prototype.set$name = function(value) { return this.name = value; }; 19411 TypeDefinition.prototype.set$name = function(value) { return this.name = value; };
19215 TypeDefinition.prototype.get$typeParameters = function() { return this.typeParam eters; }; 19412 TypeDefinition.prototype.get$typeParameters = function() { return this.typeParam eters; };
19216 TypeDefinition.prototype.set$typeParameters = function(value) { return this.type Parameters = value; }; 19413 TypeDefinition.prototype.set$typeParameters = function(value) { return this.type Parameters = value; };
19217 TypeDefinition.prototype.get$nativeType = function() { return this.nativeType; } ; 19414 TypeDefinition.prototype.get$nativeType = function() { return this.nativeType; } ;
19218 TypeDefinition.prototype.set$nativeType = function(value) { return this.nativeTy pe = value; }; 19415 TypeDefinition.prototype.set$nativeType = function(value) { return this.nativeTy pe = value; };
19416 TypeDefinition.prototype.get$body = function() { return this.body; };
19417 TypeDefinition.prototype.set$body = function(value) { return this.body = value; };
19219 TypeDefinition.prototype.visit = function(visitor) { 19418 TypeDefinition.prototype.visit = function(visitor) {
19220 return visitor.visitTypeDefinition(this); 19419 return visitor.visitTypeDefinition(this);
19221 } 19420 }
19222 TypeDefinition.prototype.visit$1 = function($0) { 19421 TypeDefinition.prototype.visit$1 = function($0) {
19223 return this.visit(($0 && $0.is$TreeVisitor())); 19422 return this.visit(($0 && $0.is$TreeVisitor()));
19224 }; 19423 };
19225 // ********** Code for FunctionTypeDefinition ************** 19424 // ********** Code for FunctionTypeDefinition **************
19226 function FunctionTypeDefinition(func, typeParameters, span) { 19425 function FunctionTypeDefinition(func, typeParameters, span) {
19227 this.func = func; 19426 this.func = func;
19228 this.typeParameters = typeParameters; 19427 this.typeParameters = typeParameters;
19229 Definition.call(this, span); 19428 Definition.call(this, span);
19230 // Initializers done 19429 // Initializers done
19231 } 19430 }
19232 $inherits(FunctionTypeDefinition, Definition); 19431 $inherits(FunctionTypeDefinition, Definition);
19432 FunctionTypeDefinition.prototype.get$func = function() { return this.func; };
19433 FunctionTypeDefinition.prototype.set$func = function(value) { return this.func = value; };
19233 FunctionTypeDefinition.prototype.get$typeParameters = function() { return this.t ypeParameters; }; 19434 FunctionTypeDefinition.prototype.get$typeParameters = function() { return this.t ypeParameters; };
19234 FunctionTypeDefinition.prototype.set$typeParameters = function(value) { return t his.typeParameters = value; }; 19435 FunctionTypeDefinition.prototype.set$typeParameters = function(value) { return t his.typeParameters = value; };
19235 FunctionTypeDefinition.prototype.visit = function(visitor) { 19436 FunctionTypeDefinition.prototype.visit = function(visitor) {
19236 return visitor.visitFunctionTypeDefinition(this); 19437 return visitor.visitFunctionTypeDefinition(this);
19237 } 19438 }
19238 FunctionTypeDefinition.prototype.visit$1 = function($0) { 19439 FunctionTypeDefinition.prototype.visit$1 = function($0) {
19239 return this.visit(($0 && $0.is$TreeVisitor())); 19440 return this.visit(($0 && $0.is$TreeVisitor()));
19240 }; 19441 };
19241 // ********** Code for VariableDefinition ************** 19442 // ********** Code for VariableDefinition **************
19242 function VariableDefinition(modifiers, type, names, values, span) { 19443 function VariableDefinition(modifiers, type, names, values, span) {
19243 this.modifiers = modifiers; 19444 this.modifiers = modifiers;
19244 this.type = type; 19445 this.type = type;
19245 this.names = names; 19446 this.names = names;
19246 this.values = values; 19447 this.values = values;
19247 Definition.call(this, span); 19448 Definition.call(this, span);
19248 // Initializers done 19449 // Initializers done
19249 } 19450 }
19250 $inherits(VariableDefinition, Definition); 19451 $inherits(VariableDefinition, Definition);
19452 VariableDefinition.prototype.get$type = function() { return this.type; };
19453 VariableDefinition.prototype.set$type = function(value) { return this.type = val ue; };
19454 VariableDefinition.prototype.get$names = function() { return this.names; };
19455 VariableDefinition.prototype.set$names = function(value) { return this.names = v alue; };
19456 VariableDefinition.prototype.get$values = function() { return this.values; };
19457 VariableDefinition.prototype.set$values = function(value) { return this.values = value; };
19251 VariableDefinition.prototype.visit = function(visitor) { 19458 VariableDefinition.prototype.visit = function(visitor) {
19252 return visitor.visitVariableDefinition(this); 19459 return visitor.visitVariableDefinition(this);
19253 } 19460 }
19254 VariableDefinition.prototype.visit$1 = function($0) { 19461 VariableDefinition.prototype.visit$1 = function($0) {
19255 return this.visit(($0 && $0.is$TreeVisitor())); 19462 return this.visit(($0 && $0.is$TreeVisitor()));
19256 }; 19463 };
19257 // ********** Code for FunctionDefinition ************** 19464 // ********** Code for FunctionDefinition **************
19258 function FunctionDefinition(modifiers, returnType, name, formals, initializers, body, span) { 19465 function FunctionDefinition(modifiers, returnType, name, formals, initializers, body, span) {
19259 this.modifiers = modifiers; 19466 this.modifiers = modifiers;
19260 this.returnType = returnType; 19467 this.returnType = returnType;
19261 this.name = name; 19468 this.name = name;
19262 this.formals = formals; 19469 this.formals = formals;
19263 this.initializers = initializers; 19470 this.initializers = initializers;
19264 this.body = body; 19471 this.body = body;
19265 Definition.call(this, span); 19472 Definition.call(this, span);
19266 // Initializers done 19473 // Initializers done
19267 } 19474 }
19268 $inherits(FunctionDefinition, Definition); 19475 $inherits(FunctionDefinition, Definition);
19269 FunctionDefinition.prototype.is$FunctionDefinition = function(){return this;}; 19476 FunctionDefinition.prototype.is$FunctionDefinition = function(){return this;};
19270 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp e; }; 19477 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp e; };
19271 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu rnType = value; }; 19478 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu rnType = value; };
19272 FunctionDefinition.prototype.get$name = function() { return this.name; }; 19479 FunctionDefinition.prototype.get$name = function() { return this.name; };
19273 FunctionDefinition.prototype.set$name = function(value) { return this.name = val ue; }; 19480 FunctionDefinition.prototype.set$name = function(value) { return this.name = val ue; };
19481 FunctionDefinition.prototype.get$initializers = function() { return this.initial izers; };
19482 FunctionDefinition.prototype.set$initializers = function(value) { return this.in itializers = value; };
19483 FunctionDefinition.prototype.get$body = function() { return this.body; };
19484 FunctionDefinition.prototype.set$body = function(value) { return this.body = val ue; };
19274 FunctionDefinition.prototype.visit = function(visitor) { 19485 FunctionDefinition.prototype.visit = function(visitor) {
19275 return visitor.visitFunctionDefinition(this); 19486 return visitor.visitFunctionDefinition(this);
19276 } 19487 }
19277 FunctionDefinition.prototype.visit$1 = function($0) { 19488 FunctionDefinition.prototype.visit$1 = function($0) {
19278 return this.visit(($0 && $0.is$TreeVisitor())); 19489 return this.visit(($0 && $0.is$TreeVisitor()));
19279 }; 19490 };
19280 // ********** Code for ReturnStatement ************** 19491 // ********** Code for ReturnStatement **************
19281 function ReturnStatement(value, span) { 19492 function ReturnStatement(value, span) {
19282 this.value = value; 19493 this.value = value;
19283 lang_Statement.call(this, span); 19494 lang_Statement.call(this, span);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
19320 AssertStatement.prototype.visit$1 = function($0) { 19531 AssertStatement.prototype.visit$1 = function($0) {
19321 return this.visit(($0 && $0.is$TreeVisitor())); 19532 return this.visit(($0 && $0.is$TreeVisitor()));
19322 }; 19533 };
19323 // ********** Code for BreakStatement ************** 19534 // ********** Code for BreakStatement **************
19324 function BreakStatement(label, span) { 19535 function BreakStatement(label, span) {
19325 this.label = label; 19536 this.label = label;
19326 lang_Statement.call(this, span); 19537 lang_Statement.call(this, span);
19327 // Initializers done 19538 // Initializers done
19328 } 19539 }
19329 $inherits(BreakStatement, lang_Statement); 19540 $inherits(BreakStatement, lang_Statement);
19541 BreakStatement.prototype.get$label = function() { return this.label; };
19542 BreakStatement.prototype.set$label = function(value) { return this.label = value ; };
19330 BreakStatement.prototype.visit = function(visitor) { 19543 BreakStatement.prototype.visit = function(visitor) {
19331 return visitor.visitBreakStatement(this); 19544 return visitor.visitBreakStatement(this);
19332 } 19545 }
19333 BreakStatement.prototype.visit$1 = function($0) { 19546 BreakStatement.prototype.visit$1 = function($0) {
19334 return this.visit(($0 && $0.is$TreeVisitor())); 19547 return this.visit(($0 && $0.is$TreeVisitor()));
19335 }; 19548 };
19336 // ********** Code for ContinueStatement ************** 19549 // ********** Code for ContinueStatement **************
19337 function ContinueStatement(label, span) { 19550 function ContinueStatement(label, span) {
19338 this.label = label; 19551 this.label = label;
19339 lang_Statement.call(this, span); 19552 lang_Statement.call(this, span);
19340 // Initializers done 19553 // Initializers done
19341 } 19554 }
19342 $inherits(ContinueStatement, lang_Statement); 19555 $inherits(ContinueStatement, lang_Statement);
19556 ContinueStatement.prototype.get$label = function() { return this.label; };
19557 ContinueStatement.prototype.set$label = function(value) { return this.label = va lue; };
19343 ContinueStatement.prototype.visit = function(visitor) { 19558 ContinueStatement.prototype.visit = function(visitor) {
19344 return visitor.visitContinueStatement(this); 19559 return visitor.visitContinueStatement(this);
19345 } 19560 }
19346 ContinueStatement.prototype.visit$1 = function($0) { 19561 ContinueStatement.prototype.visit$1 = function($0) {
19347 return this.visit(($0 && $0.is$TreeVisitor())); 19562 return this.visit(($0 && $0.is$TreeVisitor()));
19348 }; 19563 };
19349 // ********** Code for IfStatement ************** 19564 // ********** Code for IfStatement **************
19350 function IfStatement(test, trueBranch, falseBranch, span) { 19565 function IfStatement(test, trueBranch, falseBranch, span) {
19351 this.test = test; 19566 this.test = test;
19352 this.trueBranch = trueBranch; 19567 this.trueBranch = trueBranch;
19353 this.falseBranch = falseBranch; 19568 this.falseBranch = falseBranch;
19354 lang_Statement.call(this, span); 19569 lang_Statement.call(this, span);
19355 // Initializers done 19570 // Initializers done
19356 } 19571 }
19357 $inherits(IfStatement, lang_Statement); 19572 $inherits(IfStatement, lang_Statement);
19358 IfStatement.prototype.visit = function(visitor) { 19573 IfStatement.prototype.visit = function(visitor) {
19359 return visitor.visitIfStatement(this); 19574 return visitor.visitIfStatement(this);
19360 } 19575 }
19361 IfStatement.prototype.visit$1 = function($0) { 19576 IfStatement.prototype.visit$1 = function($0) {
19362 return this.visit(($0 && $0.is$TreeVisitor())); 19577 return this.visit(($0 && $0.is$TreeVisitor()));
19363 }; 19578 };
19364 // ********** Code for WhileStatement ************** 19579 // ********** Code for WhileStatement **************
19365 function WhileStatement(test, body, span) { 19580 function WhileStatement(test, body, span) {
19366 this.test = test; 19581 this.test = test;
19367 this.body = body; 19582 this.body = body;
19368 lang_Statement.call(this, span); 19583 lang_Statement.call(this, span);
19369 // Initializers done 19584 // Initializers done
19370 } 19585 }
19371 $inherits(WhileStatement, lang_Statement); 19586 $inherits(WhileStatement, lang_Statement);
19587 WhileStatement.prototype.get$body = function() { return this.body; };
19588 WhileStatement.prototype.set$body = function(value) { return this.body = value; };
19372 WhileStatement.prototype.visit = function(visitor) { 19589 WhileStatement.prototype.visit = function(visitor) {
19373 return visitor.visitWhileStatement(this); 19590 return visitor.visitWhileStatement(this);
19374 } 19591 }
19375 WhileStatement.prototype.visit$1 = function($0) { 19592 WhileStatement.prototype.visit$1 = function($0) {
19376 return this.visit(($0 && $0.is$TreeVisitor())); 19593 return this.visit(($0 && $0.is$TreeVisitor()));
19377 }; 19594 };
19378 // ********** Code for DoStatement ************** 19595 // ********** Code for DoStatement **************
19379 function DoStatement(body, test, span) { 19596 function DoStatement(body, test, span) {
19380 this.body = body; 19597 this.body = body;
19381 this.test = test; 19598 this.test = test;
19382 lang_Statement.call(this, span); 19599 lang_Statement.call(this, span);
19383 // Initializers done 19600 // Initializers done
19384 } 19601 }
19385 $inherits(DoStatement, lang_Statement); 19602 $inherits(DoStatement, lang_Statement);
19603 DoStatement.prototype.get$body = function() { return this.body; };
19604 DoStatement.prototype.set$body = function(value) { return this.body = value; };
19386 DoStatement.prototype.visit = function(visitor) { 19605 DoStatement.prototype.visit = function(visitor) {
19387 return visitor.visitDoStatement(this); 19606 return visitor.visitDoStatement(this);
19388 } 19607 }
19389 DoStatement.prototype.visit$1 = function($0) { 19608 DoStatement.prototype.visit$1 = function($0) {
19390 return this.visit(($0 && $0.is$TreeVisitor())); 19609 return this.visit(($0 && $0.is$TreeVisitor()));
19391 }; 19610 };
19392 // ********** Code for ForStatement ************** 19611 // ********** Code for ForStatement **************
19393 function ForStatement(init, test, step, body, span) { 19612 function ForStatement(init, test, step, body, span) {
19394 this.init = init; 19613 this.init = init;
19395 this.test = test; 19614 this.test = test;
19396 this.step = step; 19615 this.step = step;
19397 this.body = body; 19616 this.body = body;
19398 lang_Statement.call(this, span); 19617 lang_Statement.call(this, span);
19399 // Initializers done 19618 // Initializers done
19400 } 19619 }
19401 $inherits(ForStatement, lang_Statement); 19620 $inherits(ForStatement, lang_Statement);
19621 ForStatement.prototype.get$body = function() { return this.body; };
19622 ForStatement.prototype.set$body = function(value) { return this.body = value; };
19402 ForStatement.prototype.visit = function(visitor) { 19623 ForStatement.prototype.visit = function(visitor) {
19403 return visitor.visitForStatement(this); 19624 return visitor.visitForStatement(this);
19404 } 19625 }
19405 ForStatement.prototype.visit$1 = function($0) { 19626 ForStatement.prototype.visit$1 = function($0) {
19406 return this.visit(($0 && $0.is$TreeVisitor())); 19627 return this.visit(($0 && $0.is$TreeVisitor()));
19407 }; 19628 };
19408 // ********** Code for ForInStatement ************** 19629 // ********** Code for ForInStatement **************
19409 function ForInStatement(item, list, body, span) { 19630 function ForInStatement(item, list, body, span) {
19410 this.item = item; 19631 this.item = item;
19411 this.list = list; 19632 this.list = list;
19412 this.body = body; 19633 this.body = body;
19413 lang_Statement.call(this, span); 19634 lang_Statement.call(this, span);
19414 // Initializers done 19635 // Initializers done
19415 } 19636 }
19416 $inherits(ForInStatement, lang_Statement); 19637 $inherits(ForInStatement, lang_Statement);
19638 ForInStatement.prototype.get$body = function() { return this.body; };
19639 ForInStatement.prototype.set$body = function(value) { return this.body = value; };
19417 ForInStatement.prototype.visit = function(visitor) { 19640 ForInStatement.prototype.visit = function(visitor) {
19418 return visitor.visitForInStatement(this); 19641 return visitor.visitForInStatement(this);
19419 } 19642 }
19420 ForInStatement.prototype.visit$1 = function($0) { 19643 ForInStatement.prototype.visit$1 = function($0) {
19421 return this.visit(($0 && $0.is$TreeVisitor())); 19644 return this.visit(($0 && $0.is$TreeVisitor()));
19422 }; 19645 };
19423 // ********** Code for TryStatement ************** 19646 // ********** Code for TryStatement **************
19424 function TryStatement(body, catches, finallyBlock, span) { 19647 function TryStatement(body, catches, finallyBlock, span) {
19425 this.body = body; 19648 this.body = body;
19426 this.catches = catches; 19649 this.catches = catches;
19427 this.finallyBlock = finallyBlock; 19650 this.finallyBlock = finallyBlock;
19428 lang_Statement.call(this, span); 19651 lang_Statement.call(this, span);
19429 // Initializers done 19652 // Initializers done
19430 } 19653 }
19431 $inherits(TryStatement, lang_Statement); 19654 $inherits(TryStatement, lang_Statement);
19655 TryStatement.prototype.get$body = function() { return this.body; };
19656 TryStatement.prototype.set$body = function(value) { return this.body = value; };
19432 TryStatement.prototype.visit = function(visitor) { 19657 TryStatement.prototype.visit = function(visitor) {
19433 return visitor.visitTryStatement(this); 19658 return visitor.visitTryStatement(this);
19434 } 19659 }
19435 TryStatement.prototype.visit$1 = function($0) { 19660 TryStatement.prototype.visit$1 = function($0) {
19436 return this.visit(($0 && $0.is$TreeVisitor())); 19661 return this.visit(($0 && $0.is$TreeVisitor()));
19437 }; 19662 };
19438 // ********** Code for SwitchStatement ************** 19663 // ********** Code for SwitchStatement **************
19439 function SwitchStatement(test, cases, span) { 19664 function SwitchStatement(test, cases, span) {
19440 this.test = test; 19665 this.test = test;
19441 this.cases = cases; 19666 this.cases = cases;
19442 lang_Statement.call(this, span); 19667 lang_Statement.call(this, span);
19443 // Initializers done 19668 // Initializers done
19444 } 19669 }
19445 $inherits(SwitchStatement, lang_Statement); 19670 $inherits(SwitchStatement, lang_Statement);
19671 SwitchStatement.prototype.get$cases = function() { return this.cases; };
19672 SwitchStatement.prototype.set$cases = function(value) { return this.cases = valu e; };
19446 SwitchStatement.prototype.visit = function(visitor) { 19673 SwitchStatement.prototype.visit = function(visitor) {
19447 return visitor.visitSwitchStatement(this); 19674 return visitor.visitSwitchStatement(this);
19448 } 19675 }
19449 SwitchStatement.prototype.visit$1 = function($0) { 19676 SwitchStatement.prototype.visit$1 = function($0) {
19450 return this.visit(($0 && $0.is$TreeVisitor())); 19677 return this.visit(($0 && $0.is$TreeVisitor()));
19451 }; 19678 };
19452 // ********** Code for BlockStatement ************** 19679 // ********** Code for BlockStatement **************
19453 function BlockStatement(body, span) { 19680 function BlockStatement(body, span) {
19454 this.body = body; 19681 this.body = body;
19455 lang_Statement.call(this, span); 19682 lang_Statement.call(this, span);
19456 // Initializers done 19683 // Initializers done
19457 } 19684 }
19458 $inherits(BlockStatement, lang_Statement); 19685 $inherits(BlockStatement, lang_Statement);
19459 BlockStatement.prototype.is$BlockStatement = function(){return this;}; 19686 BlockStatement.prototype.is$BlockStatement = function(){return this;};
19687 BlockStatement.prototype.get$body = function() { return this.body; };
19688 BlockStatement.prototype.set$body = function(value) { return this.body = value; };
19460 BlockStatement.prototype.visit = function(visitor) { 19689 BlockStatement.prototype.visit = function(visitor) {
19461 return visitor.visitBlockStatement(this); 19690 return visitor.visitBlockStatement(this);
19462 } 19691 }
19463 BlockStatement.prototype.visit$1 = function($0) { 19692 BlockStatement.prototype.visit$1 = function($0) {
19464 return this.visit(($0 && $0.is$TreeVisitor())); 19693 return this.visit(($0 && $0.is$TreeVisitor()));
19465 }; 19694 };
19466 // ********** Code for LabeledStatement ************** 19695 // ********** Code for LabeledStatement **************
19467 function LabeledStatement(name, body, span) { 19696 function LabeledStatement(name, body, span) {
19468 this.name = name; 19697 this.name = name;
19469 this.body = body; 19698 this.body = body;
19470 lang_Statement.call(this, span); 19699 lang_Statement.call(this, span);
19471 // Initializers done 19700 // Initializers done
19472 } 19701 }
19473 $inherits(LabeledStatement, lang_Statement); 19702 $inherits(LabeledStatement, lang_Statement);
19474 LabeledStatement.prototype.get$name = function() { return this.name; }; 19703 LabeledStatement.prototype.get$name = function() { return this.name; };
19475 LabeledStatement.prototype.set$name = function(value) { return this.name = value ; }; 19704 LabeledStatement.prototype.set$name = function(value) { return this.name = value ; };
19705 LabeledStatement.prototype.get$body = function() { return this.body; };
19706 LabeledStatement.prototype.set$body = function(value) { return this.body = value ; };
19476 LabeledStatement.prototype.visit = function(visitor) { 19707 LabeledStatement.prototype.visit = function(visitor) {
19477 return visitor.visitLabeledStatement(this); 19708 return visitor.visitLabeledStatement(this);
19478 } 19709 }
19479 LabeledStatement.prototype.visit$1 = function($0) { 19710 LabeledStatement.prototype.visit$1 = function($0) {
19480 return this.visit(($0 && $0.is$TreeVisitor())); 19711 return this.visit(($0 && $0.is$TreeVisitor()));
19481 }; 19712 };
19482 // ********** Code for lang_ExpressionStatement ************** 19713 // ********** Code for lang_ExpressionStatement **************
19483 function lang_ExpressionStatement(body, span) { 19714 function lang_ExpressionStatement(body, span) {
19484 this.body = body; 19715 this.body = body;
19485 lang_Statement.call(this, span); 19716 lang_Statement.call(this, span);
19486 // Initializers done 19717 // Initializers done
19487 } 19718 }
19488 $inherits(lang_ExpressionStatement, lang_Statement); 19719 $inherits(lang_ExpressionStatement, lang_Statement);
19720 lang_ExpressionStatement.prototype.get$body = function() { return this.body; };
19721 lang_ExpressionStatement.prototype.set$body = function(value) { return this.body = value; };
19489 lang_ExpressionStatement.prototype.visit = function(visitor) { 19722 lang_ExpressionStatement.prototype.visit = function(visitor) {
19490 return visitor.visitExpressionStatement(this); 19723 return visitor.visitExpressionStatement(this);
19491 } 19724 }
19492 lang_ExpressionStatement.prototype.visit$1 = function($0) { 19725 lang_ExpressionStatement.prototype.visit$1 = function($0) {
19493 return this.visit(($0 && $0.is$TreeVisitor())); 19726 return this.visit(($0 && $0.is$TreeVisitor()));
19494 }; 19727 };
19495 // ********** Code for EmptyStatement ************** 19728 // ********** Code for EmptyStatement **************
19496 function EmptyStatement(span) { 19729 function EmptyStatement(span) {
19497 lang_Statement.call(this, span); 19730 lang_Statement.call(this, span);
19498 // Initializers done 19731 // Initializers done
(...skipping 17 matching lines...) Expand all
19516 DietStatement.prototype.visit$1 = function($0) { 19749 DietStatement.prototype.visit$1 = function($0) {
19517 return this.visit(($0 && $0.is$TreeVisitor())); 19750 return this.visit(($0 && $0.is$TreeVisitor()));
19518 }; 19751 };
19519 // ********** Code for NativeStatement ************** 19752 // ********** Code for NativeStatement **************
19520 function NativeStatement(body, span) { 19753 function NativeStatement(body, span) {
19521 this.body = body; 19754 this.body = body;
19522 lang_Statement.call(this, span); 19755 lang_Statement.call(this, span);
19523 // Initializers done 19756 // Initializers done
19524 } 19757 }
19525 $inherits(NativeStatement, lang_Statement); 19758 $inherits(NativeStatement, lang_Statement);
19759 NativeStatement.prototype.get$body = function() { return this.body; };
19760 NativeStatement.prototype.set$body = function(value) { return this.body = value; };
19526 NativeStatement.prototype.visit = function(visitor) { 19761 NativeStatement.prototype.visit = function(visitor) {
19527 return visitor.visitNativeStatement(this); 19762 return visitor.visitNativeStatement(this);
19528 } 19763 }
19529 NativeStatement.prototype.visit$1 = function($0) { 19764 NativeStatement.prototype.visit$1 = function($0) {
19530 return this.visit(($0 && $0.is$TreeVisitor())); 19765 return this.visit(($0 && $0.is$TreeVisitor()));
19531 }; 19766 };
19532 // ********** Code for LambdaExpression ************** 19767 // ********** Code for LambdaExpression **************
19533 function LambdaExpression(func, span) { 19768 function LambdaExpression(func, span) {
19534 this.func = func; 19769 this.func = func;
19535 lang_Expression.call(this, span); 19770 lang_Expression.call(this, span);
19536 // Initializers done 19771 // Initializers done
19537 } 19772 }
19538 $inherits(LambdaExpression, lang_Expression); 19773 $inherits(LambdaExpression, lang_Expression);
19539 LambdaExpression.prototype.is$LambdaExpression = function(){return this;}; 19774 LambdaExpression.prototype.is$LambdaExpression = function(){return this;};
19775 LambdaExpression.prototype.get$func = function() { return this.func; };
19776 LambdaExpression.prototype.set$func = function(value) { return this.func = value ; };
19540 LambdaExpression.prototype.visit = function(visitor) { 19777 LambdaExpression.prototype.visit = function(visitor) {
19541 return visitor.visitLambdaExpression(this); 19778 return visitor.visitLambdaExpression(this);
19542 } 19779 }
19543 LambdaExpression.prototype.visit$1 = function($0) { 19780 LambdaExpression.prototype.visit$1 = function($0) {
19544 return this.visit(($0 && $0.is$TreeVisitor())); 19781 return this.visit(($0 && $0.is$TreeVisitor()));
19545 }; 19782 };
19546 // ********** Code for CallExpression ************** 19783 // ********** Code for CallExpression **************
19547 function CallExpression(target, arguments, span) { 19784 function CallExpression(target, arguments, span) {
19548 this.target = target; 19785 this.target = target;
19549 this.arguments = arguments; 19786 this.arguments = arguments;
19550 lang_Expression.call(this, span); 19787 lang_Expression.call(this, span);
19551 // Initializers done 19788 // Initializers done
19552 } 19789 }
19553 $inherits(CallExpression, lang_Expression); 19790 $inherits(CallExpression, lang_Expression);
19554 CallExpression.prototype.is$CallExpression = function(){return this;}; 19791 CallExpression.prototype.is$CallExpression = function(){return this;};
19792 CallExpression.prototype.get$target = function() { return this.target; };
19793 CallExpression.prototype.set$target = function(value) { return this.target = val ue; };
19555 CallExpression.prototype.get$arguments = function() { return this.arguments; }; 19794 CallExpression.prototype.get$arguments = function() { return this.arguments; };
19556 CallExpression.prototype.set$arguments = function(value) { return this.arguments = value; }; 19795 CallExpression.prototype.set$arguments = function(value) { return this.arguments = value; };
19557 CallExpression.prototype.visit = function(visitor) { 19796 CallExpression.prototype.visit = function(visitor) {
19558 return visitor.visitCallExpression(this); 19797 return visitor.visitCallExpression(this);
19559 } 19798 }
19560 CallExpression.prototype.visit$1 = function($0) { 19799 CallExpression.prototype.visit$1 = function($0) {
19561 return this.visit(($0 && $0.is$TreeVisitor())); 19800 return this.visit(($0 && $0.is$TreeVisitor()));
19562 }; 19801 };
19563 // ********** Code for IndexExpression ************** 19802 // ********** Code for IndexExpression **************
19564 function IndexExpression(target, index, span) { 19803 function IndexExpression(target, index, span) {
19565 this.target = target; 19804 this.target = target;
19566 this.index = index; 19805 this.index = index;
19567 lang_Expression.call(this, span); 19806 lang_Expression.call(this, span);
19568 // Initializers done 19807 // Initializers done
19569 } 19808 }
19570 $inherits(IndexExpression, lang_Expression); 19809 $inherits(IndexExpression, lang_Expression);
19571 IndexExpression.prototype.is$IndexExpression = function(){return this;}; 19810 IndexExpression.prototype.is$IndexExpression = function(){return this;};
19811 IndexExpression.prototype.get$target = function() { return this.target; };
19812 IndexExpression.prototype.set$target = function(value) { return this.target = va lue; };
19572 IndexExpression.prototype.visit = function(visitor) { 19813 IndexExpression.prototype.visit = function(visitor) {
19573 return visitor.visitIndexExpression(this); 19814 return visitor.visitIndexExpression(this);
19574 } 19815 }
19575 IndexExpression.prototype.visit$1 = function($0) { 19816 IndexExpression.prototype.visit$1 = function($0) {
19576 return this.visit(($0 && $0.is$TreeVisitor())); 19817 return this.visit(($0 && $0.is$TreeVisitor()));
19577 }; 19818 };
19578 // ********** Code for BinaryExpression ************** 19819 // ********** Code for BinaryExpression **************
19579 function BinaryExpression(op, x, y, span) { 19820 function BinaryExpression(op, x, y, span) {
19580 this.op = op; 19821 this.op = op;
19581 this.x = x; 19822 this.x = x;
19582 this.y = y; 19823 this.y = y;
19583 lang_Expression.call(this, span); 19824 lang_Expression.call(this, span);
19584 // Initializers done 19825 // Initializers done
19585 } 19826 }
19586 $inherits(BinaryExpression, lang_Expression); 19827 $inherits(BinaryExpression, lang_Expression);
19587 BinaryExpression.prototype.is$BinaryExpression = function(){return this;}; 19828 BinaryExpression.prototype.is$BinaryExpression = function(){return this;};
19829 BinaryExpression.prototype.get$op = function() { return this.op; };
19830 BinaryExpression.prototype.set$op = function(value) { return this.op = value; };
19831 BinaryExpression.prototype.get$x = function() { return this.x; };
19832 BinaryExpression.prototype.set$x = function(value) { return this.x = value; };
19833 BinaryExpression.prototype.get$y = function() { return this.y; };
19834 BinaryExpression.prototype.set$y = function(value) { return this.y = value; };
19588 BinaryExpression.prototype.visit = function(visitor) { 19835 BinaryExpression.prototype.visit = function(visitor) {
19589 return visitor.visitBinaryExpression(this); 19836 return visitor.visitBinaryExpression(this);
19590 } 19837 }
19591 BinaryExpression.prototype.visit$1 = function($0) { 19838 BinaryExpression.prototype.visit$1 = function($0) {
19592 return this.visit(($0 && $0.is$TreeVisitor())); 19839 return this.visit(($0 && $0.is$TreeVisitor()));
19593 }; 19840 };
19594 // ********** Code for UnaryExpression ************** 19841 // ********** Code for UnaryExpression **************
19595 function UnaryExpression(op, self, span) { 19842 function UnaryExpression(op, self, span) {
19596 this.op = op; 19843 this.op = op;
19597 this.self = self; 19844 this.self = self;
19598 lang_Expression.call(this, span); 19845 lang_Expression.call(this, span);
19599 // Initializers done 19846 // Initializers done
19600 } 19847 }
19601 $inherits(UnaryExpression, lang_Expression); 19848 $inherits(UnaryExpression, lang_Expression);
19849 UnaryExpression.prototype.get$op = function() { return this.op; };
19850 UnaryExpression.prototype.set$op = function(value) { return this.op = value; };
19851 UnaryExpression.prototype.get$self = function() { return this.self; };
19852 UnaryExpression.prototype.set$self = function(value) { return this.self = value; };
19602 UnaryExpression.prototype.visit = function(visitor) { 19853 UnaryExpression.prototype.visit = function(visitor) {
19603 return visitor.visitUnaryExpression(this); 19854 return visitor.visitUnaryExpression(this);
19604 } 19855 }
19605 UnaryExpression.prototype.visit$1 = function($0) { 19856 UnaryExpression.prototype.visit$1 = function($0) {
19606 return this.visit(($0 && $0.is$TreeVisitor())); 19857 return this.visit(($0 && $0.is$TreeVisitor()));
19607 }; 19858 };
19608 // ********** Code for PostfixExpression ************** 19859 // ********** Code for PostfixExpression **************
19609 function PostfixExpression(body, op, span) { 19860 function PostfixExpression(body, op, span) {
19610 this.body = body; 19861 this.body = body;
19611 this.op = op; 19862 this.op = op;
19612 lang_Expression.call(this, span); 19863 lang_Expression.call(this, span);
19613 // Initializers done 19864 // Initializers done
19614 } 19865 }
19615 $inherits(PostfixExpression, lang_Expression); 19866 $inherits(PostfixExpression, lang_Expression);
19616 PostfixExpression.prototype.is$PostfixExpression = function(){return this;}; 19867 PostfixExpression.prototype.is$PostfixExpression = function(){return this;};
19868 PostfixExpression.prototype.get$body = function() { return this.body; };
19869 PostfixExpression.prototype.set$body = function(value) { return this.body = valu e; };
19870 PostfixExpression.prototype.get$op = function() { return this.op; };
19871 PostfixExpression.prototype.set$op = function(value) { return this.op = value; } ;
19617 PostfixExpression.prototype.visit = function(visitor) { 19872 PostfixExpression.prototype.visit = function(visitor) {
19618 return visitor.visitPostfixExpression$1(this); 19873 return visitor.visitPostfixExpression$1(this);
19619 } 19874 }
19620 PostfixExpression.prototype.visit$1 = function($0) { 19875 PostfixExpression.prototype.visit$1 = function($0) {
19621 return this.visit(($0 && $0.is$TreeVisitor())); 19876 return this.visit(($0 && $0.is$TreeVisitor()));
19622 }; 19877 };
19623 // ********** Code for lang_NewExpression ************** 19878 // ********** Code for lang_NewExpression **************
19624 function lang_NewExpression(isConst, type, name, arguments, span) { 19879 function lang_NewExpression(isConst, type, name, arguments, span) {
19625 this.isConst = isConst; 19880 this.isConst = isConst;
19626 this.type = type; 19881 this.type = type;
19627 this.name = name; 19882 this.name = name;
19628 this.arguments = arguments; 19883 this.arguments = arguments;
19629 lang_Expression.call(this, span); 19884 lang_Expression.call(this, span);
19630 // Initializers done 19885 // Initializers done
19631 } 19886 }
19632 $inherits(lang_NewExpression, lang_Expression); 19887 $inherits(lang_NewExpression, lang_Expression);
19633 lang_NewExpression.prototype.get$isConst = function() { return this.isConst; }; 19888 lang_NewExpression.prototype.get$isConst = function() { return this.isConst; };
19634 lang_NewExpression.prototype.set$isConst = function(value) { return this.isConst = value; }; 19889 lang_NewExpression.prototype.set$isConst = function(value) { return this.isConst = value; };
19890 lang_NewExpression.prototype.get$type = function() { return this.type; };
19891 lang_NewExpression.prototype.set$type = function(value) { return this.type = val ue; };
19635 lang_NewExpression.prototype.get$name = function() { return this.name; }; 19892 lang_NewExpression.prototype.get$name = function() { return this.name; };
19636 lang_NewExpression.prototype.set$name = function(value) { return this.name = val ue; }; 19893 lang_NewExpression.prototype.set$name = function(value) { return this.name = val ue; };
19637 lang_NewExpression.prototype.get$arguments = function() { return this.arguments; }; 19894 lang_NewExpression.prototype.get$arguments = function() { return this.arguments; };
19638 lang_NewExpression.prototype.set$arguments = function(value) { return this.argum ents = value; }; 19895 lang_NewExpression.prototype.set$arguments = function(value) { return this.argum ents = value; };
19639 lang_NewExpression.prototype.visit = function(visitor) { 19896 lang_NewExpression.prototype.visit = function(visitor) {
19640 return visitor.visitNewExpression(this); 19897 return visitor.visitNewExpression(this);
19641 } 19898 }
19642 lang_NewExpression.prototype.visit$1 = function($0) { 19899 lang_NewExpression.prototype.visit$1 = function($0) {
19643 return this.visit(($0 && $0.is$TreeVisitor())); 19900 return this.visit(($0 && $0.is$TreeVisitor()));
19644 }; 19901 };
19645 // ********** Code for ListExpression ************** 19902 // ********** Code for ListExpression **************
19646 function ListExpression(isConst, type, values, span) { 19903 function ListExpression(isConst, type, values, span) {
19647 this.isConst = isConst; 19904 this.isConst = isConst;
19648 this.type = type; 19905 this.type = type;
19649 this.values = values; 19906 this.values = values;
19650 lang_Expression.call(this, span); 19907 lang_Expression.call(this, span);
19651 // Initializers done 19908 // Initializers done
19652 } 19909 }
19653 $inherits(ListExpression, lang_Expression); 19910 $inherits(ListExpression, lang_Expression);
19654 ListExpression.prototype.get$isConst = function() { return this.isConst; }; 19911 ListExpression.prototype.get$isConst = function() { return this.isConst; };
19655 ListExpression.prototype.set$isConst = function(value) { return this.isConst = v alue; }; 19912 ListExpression.prototype.set$isConst = function(value) { return this.isConst = v alue; };
19913 ListExpression.prototype.get$type = function() { return this.type; };
19914 ListExpression.prototype.set$type = function(value) { return this.type = value; };
19915 ListExpression.prototype.get$values = function() { return this.values; };
19916 ListExpression.prototype.set$values = function(value) { return this.values = val ue; };
19656 ListExpression.prototype.visit = function(visitor) { 19917 ListExpression.prototype.visit = function(visitor) {
19657 return visitor.visitListExpression(this); 19918 return visitor.visitListExpression(this);
19658 } 19919 }
19659 ListExpression.prototype.visit$1 = function($0) { 19920 ListExpression.prototype.visit$1 = function($0) {
19660 return this.visit(($0 && $0.is$TreeVisitor())); 19921 return this.visit(($0 && $0.is$TreeVisitor()));
19661 }; 19922 };
19662 // ********** Code for MapExpression ************** 19923 // ********** Code for MapExpression **************
19663 function MapExpression(isConst, type, items, span) { 19924 function MapExpression(isConst, type, items, span) {
19664 this.isConst = isConst; 19925 this.isConst = isConst;
19665 this.type = type; 19926 this.type = type;
19666 this.items = items; 19927 this.items = items;
19667 lang_Expression.call(this, span); 19928 lang_Expression.call(this, span);
19668 // Initializers done 19929 // Initializers done
19669 } 19930 }
19670 $inherits(MapExpression, lang_Expression); 19931 $inherits(MapExpression, lang_Expression);
19671 MapExpression.prototype.get$isConst = function() { return this.isConst; }; 19932 MapExpression.prototype.get$isConst = function() { return this.isConst; };
19672 MapExpression.prototype.set$isConst = function(value) { return this.isConst = va lue; }; 19933 MapExpression.prototype.set$isConst = function(value) { return this.isConst = va lue; };
19934 MapExpression.prototype.get$type = function() { return this.type; };
19935 MapExpression.prototype.set$type = function(value) { return this.type = value; } ;
19673 MapExpression.prototype.visit = function(visitor) { 19936 MapExpression.prototype.visit = function(visitor) {
19674 return visitor.visitMapExpression(this); 19937 return visitor.visitMapExpression(this);
19675 } 19938 }
19676 MapExpression.prototype.visit$1 = function($0) { 19939 MapExpression.prototype.visit$1 = function($0) {
19677 return this.visit(($0 && $0.is$TreeVisitor())); 19940 return this.visit(($0 && $0.is$TreeVisitor()));
19678 }; 19941 };
19679 // ********** Code for ConditionalExpression ************** 19942 // ********** Code for ConditionalExpression **************
19680 function ConditionalExpression(test, trueBranch, falseBranch, span) { 19943 function ConditionalExpression(test, trueBranch, falseBranch, span) {
19681 this.test = test; 19944 this.test = test;
19682 this.trueBranch = trueBranch; 19945 this.trueBranch = trueBranch;
(...skipping 10 matching lines...) Expand all
19693 }; 19956 };
19694 // ********** Code for IsExpression ************** 19957 // ********** Code for IsExpression **************
19695 function IsExpression(isTrue, x, type, span) { 19958 function IsExpression(isTrue, x, type, span) {
19696 this.isTrue = isTrue; 19959 this.isTrue = isTrue;
19697 this.x = x; 19960 this.x = x;
19698 this.type = type; 19961 this.type = type;
19699 lang_Expression.call(this, span); 19962 lang_Expression.call(this, span);
19700 // Initializers done 19963 // Initializers done
19701 } 19964 }
19702 $inherits(IsExpression, lang_Expression); 19965 $inherits(IsExpression, lang_Expression);
19966 IsExpression.prototype.get$x = function() { return this.x; };
19967 IsExpression.prototype.set$x = function(value) { return this.x = value; };
19968 IsExpression.prototype.get$type = function() { return this.type; };
19969 IsExpression.prototype.set$type = function(value) { return this.type = value; };
19703 IsExpression.prototype.visit = function(visitor) { 19970 IsExpression.prototype.visit = function(visitor) {
19704 return visitor.visitIsExpression(this); 19971 return visitor.visitIsExpression(this);
19705 } 19972 }
19706 IsExpression.prototype.visit$1 = function($0) { 19973 IsExpression.prototype.visit$1 = function($0) {
19707 return this.visit(($0 && $0.is$TreeVisitor())); 19974 return this.visit(($0 && $0.is$TreeVisitor()));
19708 }; 19975 };
19709 // ********** Code for ParenExpression ************** 19976 // ********** Code for ParenExpression **************
19710 function ParenExpression(body, span) { 19977 function ParenExpression(body, span) {
19711 this.body = body; 19978 this.body = body;
19712 lang_Expression.call(this, span); 19979 lang_Expression.call(this, span);
19713 // Initializers done 19980 // Initializers done
19714 } 19981 }
19715 $inherits(ParenExpression, lang_Expression); 19982 $inherits(ParenExpression, lang_Expression);
19983 ParenExpression.prototype.get$body = function() { return this.body; };
19984 ParenExpression.prototype.set$body = function(value) { return this.body = value; };
19716 ParenExpression.prototype.visit = function(visitor) { 19985 ParenExpression.prototype.visit = function(visitor) {
19717 return visitor.visitParenExpression(this); 19986 return visitor.visitParenExpression(this);
19718 } 19987 }
19719 ParenExpression.prototype.visit$1 = function($0) { 19988 ParenExpression.prototype.visit$1 = function($0) {
19720 return this.visit(($0 && $0.is$TreeVisitor())); 19989 return this.visit(($0 && $0.is$TreeVisitor()));
19721 }; 19990 };
19722 // ********** Code for DotExpression ************** 19991 // ********** Code for DotExpression **************
19723 function DotExpression(self, name, span) { 19992 function DotExpression(self, name, span) {
19724 this.self = self; 19993 this.self = self;
19725 this.name = name; 19994 this.name = name;
19726 lang_Expression.call(this, span); 19995 lang_Expression.call(this, span);
19727 // Initializers done 19996 // Initializers done
19728 } 19997 }
19729 $inherits(DotExpression, lang_Expression); 19998 $inherits(DotExpression, lang_Expression);
19730 DotExpression.prototype.is$DotExpression = function(){return this;}; 19999 DotExpression.prototype.is$DotExpression = function(){return this;};
20000 DotExpression.prototype.get$self = function() { return this.self; };
20001 DotExpression.prototype.set$self = function(value) { return this.self = value; } ;
19731 DotExpression.prototype.get$name = function() { return this.name; }; 20002 DotExpression.prototype.get$name = function() { return this.name; };
19732 DotExpression.prototype.set$name = function(value) { return this.name = value; } ; 20003 DotExpression.prototype.set$name = function(value) { return this.name = value; } ;
19733 DotExpression.prototype.visit = function(visitor) { 20004 DotExpression.prototype.visit = function(visitor) {
19734 return visitor.visitDotExpression(this); 20005 return visitor.visitDotExpression(this);
19735 } 20006 }
19736 DotExpression.prototype.visit$1 = function($0) { 20007 DotExpression.prototype.visit$1 = function($0) {
19737 return this.visit(($0 && $0.is$TreeVisitor())); 20008 return this.visit(($0 && $0.is$TreeVisitor()));
19738 }; 20009 };
19739 // ********** Code for VarExpression ************** 20010 // ********** Code for VarExpression **************
19740 function VarExpression(name, span) { 20011 function VarExpression(name, span) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
19792 function LiteralExpression(value, type, text, span) { 20063 function LiteralExpression(value, type, text, span) {
19793 this.value = value; 20064 this.value = value;
19794 this.type = type; 20065 this.type = type;
19795 this.text = text; 20066 this.text = text;
19796 lang_Expression.call(this, span); 20067 lang_Expression.call(this, span);
19797 // Initializers done 20068 // Initializers done
19798 } 20069 }
19799 $inherits(LiteralExpression, lang_Expression); 20070 $inherits(LiteralExpression, lang_Expression);
19800 LiteralExpression.prototype.get$value = function() { return this.value; }; 20071 LiteralExpression.prototype.get$value = function() { return this.value; };
19801 LiteralExpression.prototype.set$value = function(value) { return this.value = va lue; }; 20072 LiteralExpression.prototype.set$value = function(value) { return this.value = va lue; };
20073 LiteralExpression.prototype.get$type = function() { return this.type; };
20074 LiteralExpression.prototype.set$type = function(value) { return this.type = valu e; };
19802 LiteralExpression.prototype.get$text = function() { return this.text; }; 20075 LiteralExpression.prototype.get$text = function() { return this.text; };
19803 LiteralExpression.prototype.set$text = function(value) { return this.text = valu e; }; 20076 LiteralExpression.prototype.set$text = function(value) { return this.text = valu e; };
19804 LiteralExpression.prototype.visit = function(visitor) { 20077 LiteralExpression.prototype.visit = function(visitor) {
19805 return visitor.visitLiteralExpression(this); 20078 return visitor.visitLiteralExpression(this);
19806 } 20079 }
19807 LiteralExpression.prototype.visit$1 = function($0) { 20080 LiteralExpression.prototype.visit$1 = function($0) {
19808 return this.visit(($0 && $0.is$TreeVisitor())); 20081 return this.visit(($0 && $0.is$TreeVisitor()));
19809 }; 20082 };
19810 // ********** Code for NameTypeReference ************** 20083 // ********** Code for NameTypeReference **************
19811 function NameTypeReference(isFinal, name, names, span) { 20084 function NameTypeReference(isFinal, name, names, span) {
19812 this.isFinal = isFinal; 20085 this.isFinal = isFinal;
19813 this.name = name; 20086 this.name = name;
19814 this.names = names; 20087 this.names = names;
19815 TypeReference.call(this, span); 20088 TypeReference.call(this, span);
19816 // Initializers done 20089 // Initializers done
19817 } 20090 }
19818 $inherits(NameTypeReference, TypeReference); 20091 $inherits(NameTypeReference, TypeReference);
19819 NameTypeReference.prototype.is$NameTypeReference = function(){return this;}; 20092 NameTypeReference.prototype.is$NameTypeReference = function(){return this;};
20093 NameTypeReference.prototype.get$isFinal = function() { return this.isFinal; };
20094 NameTypeReference.prototype.set$isFinal = function(value) { return this.isFinal = value; };
19820 NameTypeReference.prototype.get$name = function() { return this.name; }; 20095 NameTypeReference.prototype.get$name = function() { return this.name; };
19821 NameTypeReference.prototype.set$name = function(value) { return this.name = valu e; }; 20096 NameTypeReference.prototype.set$name = function(value) { return this.name = valu e; };
20097 NameTypeReference.prototype.get$names = function() { return this.names; };
20098 NameTypeReference.prototype.set$names = function(value) { return this.names = va lue; };
19822 NameTypeReference.prototype.visit = function(visitor) { 20099 NameTypeReference.prototype.visit = function(visitor) {
19823 return visitor.visitNameTypeReference(this); 20100 return visitor.visitNameTypeReference(this);
19824 } 20101 }
19825 NameTypeReference.prototype.visit$1 = function($0) { 20102 NameTypeReference.prototype.visit$1 = function($0) {
19826 return this.visit(($0 && $0.is$TreeVisitor())); 20103 return this.visit(($0 && $0.is$TreeVisitor()));
19827 }; 20104 };
19828 // ********** Code for GenericTypeReference ************** 20105 // ********** Code for GenericTypeReference **************
19829 function GenericTypeReference(baseType, typeArguments, depth, span) { 20106 function GenericTypeReference(baseType, typeArguments, depth, span) {
19830 this.baseType = baseType; 20107 this.baseType = baseType;
19831 this.typeArguments = typeArguments; 20108 this.typeArguments = typeArguments;
19832 this.depth = depth; 20109 this.depth = depth;
19833 TypeReference.call(this, span); 20110 TypeReference.call(this, span);
19834 // Initializers done 20111 // Initializers done
19835 } 20112 }
19836 $inherits(GenericTypeReference, TypeReference); 20113 $inherits(GenericTypeReference, TypeReference);
19837 GenericTypeReference.prototype.is$GenericTypeReference = function(){return this; }; 20114 GenericTypeReference.prototype.is$GenericTypeReference = function(){return this; };
20115 GenericTypeReference.prototype.get$depth = function() { return this.depth; };
20116 GenericTypeReference.prototype.set$depth = function(value) { return this.depth = value; };
19838 GenericTypeReference.prototype.visit = function(visitor) { 20117 GenericTypeReference.prototype.visit = function(visitor) {
19839 return visitor.visitGenericTypeReference(this); 20118 return visitor.visitGenericTypeReference(this);
19840 } 20119 }
19841 GenericTypeReference.prototype.visit$1 = function($0) { 20120 GenericTypeReference.prototype.visit$1 = function($0) {
19842 return this.visit(($0 && $0.is$TreeVisitor())); 20121 return this.visit(($0 && $0.is$TreeVisitor()));
19843 }; 20122 };
19844 // ********** Code for FunctionTypeReference ************** 20123 // ********** Code for FunctionTypeReference **************
19845 function FunctionTypeReference(isFinal, func, span) { 20124 function FunctionTypeReference(isFinal, func, span) {
19846 this.isFinal = isFinal; 20125 this.isFinal = isFinal;
19847 this.func = func; 20126 this.func = func;
19848 TypeReference.call(this, span); 20127 TypeReference.call(this, span);
19849 // Initializers done 20128 // Initializers done
19850 } 20129 }
19851 $inherits(FunctionTypeReference, TypeReference); 20130 $inherits(FunctionTypeReference, TypeReference);
19852 FunctionTypeReference.prototype.is$FunctionTypeReference = function(){return thi s;}; 20131 FunctionTypeReference.prototype.is$FunctionTypeReference = function(){return thi s;};
20132 FunctionTypeReference.prototype.get$isFinal = function() { return this.isFinal; };
20133 FunctionTypeReference.prototype.set$isFinal = function(value) { return this.isFi nal = value; };
20134 FunctionTypeReference.prototype.get$func = function() { return this.func; };
20135 FunctionTypeReference.prototype.set$func = function(value) { return this.func = value; };
19853 FunctionTypeReference.prototype.visit = function(visitor) { 20136 FunctionTypeReference.prototype.visit = function(visitor) {
19854 return visitor.visitFunctionTypeReference(this); 20137 return visitor.visitFunctionTypeReference(this);
19855 } 20138 }
19856 FunctionTypeReference.prototype.visit$1 = function($0) { 20139 FunctionTypeReference.prototype.visit$1 = function($0) {
19857 return this.visit(($0 && $0.is$TreeVisitor())); 20140 return this.visit(($0 && $0.is$TreeVisitor()));
19858 }; 20141 };
19859 // ********** Code for ArgumentNode ************** 20142 // ********** Code for ArgumentNode **************
19860 function ArgumentNode(label, value, span) { 20143 function ArgumentNode(label, value, span) {
19861 this.label = label; 20144 this.label = label;
19862 this.value = value; 20145 this.value = value;
19863 lang_Node.call(this, span); 20146 lang_Node.call(this, span);
19864 // Initializers done 20147 // Initializers done
19865 } 20148 }
19866 $inherits(ArgumentNode, lang_Node); 20149 $inherits(ArgumentNode, lang_Node);
19867 ArgumentNode.prototype.is$ArgumentNode = function(){return this;}; 20150 ArgumentNode.prototype.is$ArgumentNode = function(){return this;};
20151 ArgumentNode.prototype.get$label = function() { return this.label; };
20152 ArgumentNode.prototype.set$label = function(value) { return this.label = value; };
19868 ArgumentNode.prototype.get$value = function() { return this.value; }; 20153 ArgumentNode.prototype.get$value = function() { return this.value; };
19869 ArgumentNode.prototype.set$value = function(value) { return this.value = value; }; 20154 ArgumentNode.prototype.set$value = function(value) { return this.value = value; };
19870 ArgumentNode.prototype.visit = function(visitor) { 20155 ArgumentNode.prototype.visit = function(visitor) {
19871 return visitor.visitArgumentNode(this); 20156 return visitor.visitArgumentNode(this);
19872 } 20157 }
19873 ArgumentNode.prototype.visit$1 = function($0) { 20158 ArgumentNode.prototype.visit$1 = function($0) {
19874 return this.visit(($0 && $0.is$TreeVisitor())); 20159 return this.visit(($0 && $0.is$TreeVisitor()));
19875 }; 20160 };
19876 // ********** Code for FormalNode ************** 20161 // ********** Code for FormalNode **************
19877 function FormalNode(isThis, isRest, type, name, value, span) { 20162 function FormalNode(isThis, isRest, type, name, value, span) {
19878 this.isThis = isThis; 20163 this.isThis = isThis;
19879 this.isRest = isRest; 20164 this.isRest = isRest;
19880 this.type = type; 20165 this.type = type;
19881 this.name = name; 20166 this.name = name;
19882 this.value = value; 20167 this.value = value;
19883 lang_Node.call(this, span); 20168 lang_Node.call(this, span);
19884 // Initializers done 20169 // Initializers done
19885 } 20170 }
19886 $inherits(FormalNode, lang_Node); 20171 $inherits(FormalNode, lang_Node);
20172 FormalNode.prototype.get$type = function() { return this.type; };
20173 FormalNode.prototype.set$type = function(value) { return this.type = value; };
19887 FormalNode.prototype.get$name = function() { return this.name; }; 20174 FormalNode.prototype.get$name = function() { return this.name; };
19888 FormalNode.prototype.set$name = function(value) { return this.name = value; }; 20175 FormalNode.prototype.set$name = function(value) { return this.name = value; };
19889 FormalNode.prototype.get$value = function() { return this.value; }; 20176 FormalNode.prototype.get$value = function() { return this.value; };
19890 FormalNode.prototype.set$value = function(value) { return this.value = value; }; 20177 FormalNode.prototype.set$value = function(value) { return this.value = value; };
19891 FormalNode.prototype.visit = function(visitor) { 20178 FormalNode.prototype.visit = function(visitor) {
19892 return visitor.visitFormalNode(this); 20179 return visitor.visitFormalNode(this);
19893 } 20180 }
19894 FormalNode.prototype.visit$1 = function($0) { 20181 FormalNode.prototype.visit$1 = function($0) {
19895 return this.visit(($0 && $0.is$TreeVisitor())); 20182 return this.visit(($0 && $0.is$TreeVisitor()));
19896 }; 20183 };
19897 // ********** Code for CatchNode ************** 20184 // ********** Code for CatchNode **************
19898 function CatchNode(exception, trace, body, span) { 20185 function CatchNode(exception, trace, body, span) {
19899 this.exception = exception; 20186 this.exception = exception;
19900 this.trace = trace; 20187 this.trace = trace;
19901 this.body = body; 20188 this.body = body;
19902 lang_Node.call(this, span); 20189 lang_Node.call(this, span);
19903 // Initializers done 20190 // Initializers done
19904 } 20191 }
19905 $inherits(CatchNode, lang_Node); 20192 $inherits(CatchNode, lang_Node);
19906 CatchNode.prototype.get$exception = function() { return this.exception; }; 20193 CatchNode.prototype.get$exception = function() { return this.exception; };
19907 CatchNode.prototype.set$exception = function(value) { return this.exception = va lue; }; 20194 CatchNode.prototype.set$exception = function(value) { return this.exception = va lue; };
20195 CatchNode.prototype.get$trace = function() { return this.trace; };
20196 CatchNode.prototype.set$trace = function(value) { return this.trace = value; };
20197 CatchNode.prototype.get$body = function() { return this.body; };
20198 CatchNode.prototype.set$body = function(value) { return this.body = value; };
19908 CatchNode.prototype.visit = function(visitor) { 20199 CatchNode.prototype.visit = function(visitor) {
19909 return visitor.visitCatchNode(this); 20200 return visitor.visitCatchNode(this);
19910 } 20201 }
19911 CatchNode.prototype.visit$1 = function($0) { 20202 CatchNode.prototype.visit$1 = function($0) {
19912 return this.visit(($0 && $0.is$TreeVisitor())); 20203 return this.visit(($0 && $0.is$TreeVisitor()));
19913 }; 20204 };
19914 // ********** Code for CaseNode ************** 20205 // ********** Code for CaseNode **************
19915 function CaseNode(label, cases, statements, span) { 20206 function CaseNode(label, cases, statements, span) {
19916 this.label = label; 20207 this.label = label;
19917 this.cases = cases; 20208 this.cases = cases;
19918 this.statements = statements; 20209 this.statements = statements;
19919 lang_Node.call(this, span); 20210 lang_Node.call(this, span);
19920 // Initializers done 20211 // Initializers done
19921 } 20212 }
19922 $inherits(CaseNode, lang_Node); 20213 $inherits(CaseNode, lang_Node);
20214 CaseNode.prototype.get$label = function() { return this.label; };
20215 CaseNode.prototype.set$label = function(value) { return this.label = value; };
20216 CaseNode.prototype.get$cases = function() { return this.cases; };
20217 CaseNode.prototype.set$cases = function(value) { return this.cases = value; };
20218 CaseNode.prototype.get$statements = function() { return this.statements; };
20219 CaseNode.prototype.set$statements = function(value) { return this.statements = v alue; };
19923 CaseNode.prototype.visit = function(visitor) { 20220 CaseNode.prototype.visit = function(visitor) {
19924 return visitor.visitCaseNode(this); 20221 return visitor.visitCaseNode(this);
19925 } 20222 }
19926 CaseNode.prototype.visit$1 = function($0) { 20223 CaseNode.prototype.visit$1 = function($0) {
19927 return this.visit(($0 && $0.is$TreeVisitor())); 20224 return this.visit(($0 && $0.is$TreeVisitor()));
19928 }; 20225 };
19929 // ********** Code for TypeParameter ************** 20226 // ********** Code for TypeParameter **************
19930 function TypeParameter(name, extendsType, span) { 20227 function TypeParameter(name, extendsType, span) {
19931 this.name = name; 20228 this.name = name;
19932 this.extendsType = extendsType; 20229 this.extendsType = extendsType;
19933 lang_Node.call(this, span); 20230 lang_Node.call(this, span);
19934 // Initializers done 20231 // Initializers done
19935 } 20232 }
19936 $inherits(TypeParameter, lang_Node); 20233 $inherits(TypeParameter, lang_Node);
19937 TypeParameter.prototype.get$name = function() { return this.name; }; 20234 TypeParameter.prototype.get$name = function() { return this.name; };
19938 TypeParameter.prototype.set$name = function(value) { return this.name = value; } ; 20235 TypeParameter.prototype.set$name = function(value) { return this.name = value; } ;
20236 TypeParameter.prototype.get$extendsType = function() { return this.extendsType; };
20237 TypeParameter.prototype.set$extendsType = function(value) { return this.extendsT ype = value; };
19939 TypeParameter.prototype.visit = function(visitor) { 20238 TypeParameter.prototype.visit = function(visitor) {
19940 return visitor.visitTypeParameter(this); 20239 return visitor.visitTypeParameter(this);
19941 } 20240 }
19942 TypeParameter.prototype.visit$1 = function($0) { 20241 TypeParameter.prototype.visit$1 = function($0) {
19943 return this.visit(($0 && $0.is$TreeVisitor())); 20242 return this.visit(($0 && $0.is$TreeVisitor()));
19944 }; 20243 };
19945 // ********** Code for lang_Identifier ************** 20244 // ********** Code for lang_Identifier **************
19946 function lang_Identifier(name, span) { 20245 function lang_Identifier(name, span) {
19947 this.name = name; 20246 this.name = name;
19948 lang_Node.call(this, span); 20247 lang_Node.call(this, span);
(...skipping 10 matching lines...) Expand all
19959 }; 20258 };
19960 // ********** Code for DeclaredIdentifier ************** 20259 // ********** Code for DeclaredIdentifier **************
19961 function DeclaredIdentifier(type, name, span) { 20260 function DeclaredIdentifier(type, name, span) {
19962 this.type = type; 20261 this.type = type;
19963 this.name = name; 20262 this.name = name;
19964 lang_Expression.call(this, span); 20263 lang_Expression.call(this, span);
19965 // Initializers done 20264 // Initializers done
19966 } 20265 }
19967 $inherits(DeclaredIdentifier, lang_Expression); 20266 $inherits(DeclaredIdentifier, lang_Expression);
19968 DeclaredIdentifier.prototype.is$DeclaredIdentifier = function(){return this;}; 20267 DeclaredIdentifier.prototype.is$DeclaredIdentifier = function(){return this;};
20268 DeclaredIdentifier.prototype.get$type = function() { return this.type; };
20269 DeclaredIdentifier.prototype.set$type = function(value) { return this.type = val ue; };
19969 DeclaredIdentifier.prototype.get$name = function() { return this.name; }; 20270 DeclaredIdentifier.prototype.get$name = function() { return this.name; };
19970 DeclaredIdentifier.prototype.set$name = function(value) { return this.name = val ue; }; 20271 DeclaredIdentifier.prototype.set$name = function(value) { return this.name = val ue; };
19971 DeclaredIdentifier.prototype.visit = function(visitor) { 20272 DeclaredIdentifier.prototype.visit = function(visitor) {
19972 return visitor.visitDeclaredIdentifier(this); 20273 return visitor.visitDeclaredIdentifier(this);
19973 } 20274 }
19974 DeclaredIdentifier.prototype.visit$1 = function($0) { 20275 DeclaredIdentifier.prototype.visit$1 = function($0) {
19975 return this.visit(($0 && $0.is$TreeVisitor())); 20276 return this.visit(($0 && $0.is$TreeVisitor()));
19976 }; 20277 };
19977 // ********** Code for lang_Type ************** 20278 // ********** Code for lang_Type **************
19978 function lang_Type(name) { 20279 function lang_Type(name) {
19979 this.name = name; 20280 this.name = name;
19980 this.isTested = false; 20281 this.isTested = false;
19981 // Initializers done 20282 // Initializers done
19982 } 20283 }
19983 lang_Type.prototype.is$lang_Type = function(){return this;}; 20284 lang_Type.prototype.is$lang_Type = function(){return this;};
19984 lang_Type.prototype.is$Named = function(){return this;}; 20285 lang_Type.prototype.is$Named = function(){return this;};
19985 lang_Type.prototype.get$name = function() { return this.name; }; 20286 lang_Type.prototype.get$name = function() { return this.name; };
20287 lang_Type.prototype.get$typeCheckCode = function() { return this.typeCheckCode; };
20288 lang_Type.prototype.set$typeCheckCode = function(value) { return this.typeCheckC ode = value; };
20289 lang_Type.prototype.get$varStubs = function() { return this.varStubs; };
20290 lang_Type.prototype.set$varStubs = function(value) { return this.varStubs = valu e; };
19986 lang_Type.prototype.markUsed = function() { 20291 lang_Type.prototype.markUsed = function() {
19987 20292
19988 } 20293 }
19989 lang_Type.prototype.get$typeMember = function() { 20294 lang_Type.prototype.get$typeMember = function() {
19990 var $0; 20295 var $0;
19991 if (this._typeMember == null) { 20296 if (this._typeMember == null) {
19992 this._typeMember = new TypeMember((this && this.is$DefinedType())); 20297 this._typeMember = new TypeMember((this && this.is$DefinedType()));
19993 } 20298 }
19994 return (($0 = this._typeMember) && $0.is$TypeMember()); 20299 return (($0 = this._typeMember) && $0.is$TypeMember());
19995 } 20300 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
20141 } 20446 }
20142 if ($eq(this, other)) return true; 20447 if ($eq(this, other)) return true;
20143 if ($notnull_bool(this.get$isVar())) return true; 20448 if ($notnull_bool(this.get$isVar())) return true;
20144 if ($notnull_bool(other.get$isVar())) return true; 20449 if ($notnull_bool(other.get$isVar())) return true;
20145 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true; 20450 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true;
20146 var call = this.getCallMethod(); 20451 var call = this.getCallMethod();
20147 var otherCall = other.getCallMethod(); 20452 var otherCall = other.getCallMethod();
20148 if ($notnull_bool($ne(call, null) && $ne(otherCall, null))) { 20453 if ($notnull_bool($ne(call, null) && $ne(otherCall, null))) {
20149 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth erCall && otherCall.is$MethodMember())); 20454 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth erCall && otherCall.is$MethodMember()));
20150 } 20455 }
20151 if ($notnull_bool($notnull_bool($eq(this.get$genericType(), other.get$genericT ype()) && $ne(this.get$typeArgsInOrder(), null)) && $ne(other.get$typeArgsInOrde r(), null)) && this.get$typeArgsInOrder().length == other.get$typeArgsInOrder(). length) { 20456 if ($notnull_bool($notnull_bool($notnull_bool($eq(this.get$genericType(), othe r.get$genericType()) && $ne(this.get$typeArgsInOrder(), null)) && $ne(other.get$ typeArgsInOrder(), null)) && $eq(this.get$typeArgsInOrder().length, other.get$ty peArgsInOrder().length))) {
20152 var t = this.get$typeArgsInOrder().iterator$0(); 20457 var t = this.get$typeArgsInOrder().iterator$0();
20153 var s = other.get$typeArgsInOrder().iterator$0(); 20458 var s = other.get$typeArgsInOrder().iterator$0();
20154 while ($notnull_bool(t.hasNext$0())) { 20459 while ($notnull_bool(t.hasNext$0())) {
20155 if (!$notnull_bool(t.next$0().isSubtypeOf$1(s.next$0()))) return false; 20460 if (!$notnull_bool(t.next$0().isSubtypeOf$1(s.next$0()))) return false;
20156 } 20461 }
20157 return true; 20462 return true;
20158 } 20463 }
20159 if ($notnull_bool(this.get$parent() != null && this.get$parent().isSubtypeOf(o ther))) { 20464 if ($notnull_bool(this.get$parent() != null && this.get$parent().isSubtypeOf(o ther))) {
20160 return true; 20465 return true;
20161 } 20466 }
20162 if (this.get$interfaces() != null && this.get$interfaces().some((function (i) { 20467 if (this.get$interfaces() != null && this.get$interfaces().some((function (i) {
20163 return i.isSubtypeOf$1(other); 20468 return i.isSubtypeOf$1(other);
20164 }) 20469 })
20165 )) { 20470 )) {
20166 return true; 20471 return true;
20167 } 20472 }
20168 return false; 20473 return false;
20169 } 20474 }
20170 lang_Type._isFunctionSubtypeOf = function(t, s) { 20475 lang_Type._isFunctionSubtypeOf = function(t, s) {
20171 if (!$notnull_bool(s.returnType.get$isVoid()) && !$notnull_bool(s.returnType.i sAssignable(t.returnType))) { 20476 if (!$notnull_bool(s.returnType.get$isVoid()) && !$notnull_bool(s.returnType.i sAssignable(t.returnType))) {
20172 return false; 20477 return false;
20173 } 20478 }
20174 var tp = t.parameters; 20479 var tp = t.parameters;
20175 var sp = s.parameters; 20480 var sp = s.parameters;
20176 if (tp.length < sp.length) return false; 20481 if (tp.length < $assert_num(sp.length)) return false;
20177 for (var i = 0; 20482 for (var i = 0;
20178 i < sp.length; i++) { 20483 i < $assert_num(sp.length); i++) {
20179 if ($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOptional())) retur n false; 20484 if ($notnull_bool($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOpti onal()))) return false;
20180 if ($notnull_bool(tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name (), sp.$index(i).get$name()))) return false; 20485 if ($notnull_bool(tp.$index(i).get$isOptional() && $ne(tp.$index(i).get$name (), sp.$index(i).get$name()))) return false;
20181 if (!$notnull_bool(tp.$index(i).type.isAssignable$1(sp.$index(i).type))) ret urn false; 20486 if (!$notnull_bool(tp.$index(i).get$type().isAssignable$1(sp.$index(i).get$t ype()))) return false;
20182 } 20487 }
20183 if (tp.length > sp.length && !$notnull_bool(tp.$index(sp.length).get$isOptiona l())) return false; 20488 if (tp.length > $assert_num(sp.length) && !$notnull_bool(tp.$index(sp.length). get$isOptional())) return false;
20184 return true; 20489 return true;
20185 } 20490 }
20186 lang_Type.prototype.addDirectSubtype$1 = function($0) { 20491 lang_Type.prototype.addDirectSubtype$1 = function($0) {
20187 return this.addDirectSubtype(($0 && $0.is$lang_Type())); 20492 return this.addDirectSubtype(($0 && $0.is$lang_Type()));
20188 }; 20493 };
20189 lang_Type.prototype.ensureSubtypeOf$3 = function($0, $1, $2) { 20494 lang_Type.prototype.ensureSubtypeOf$3 = function($0, $1, $2) {
20190 return this.ensureSubtypeOf(($0 && $0.is$lang_Type()), ($1 && $1.is$SourceSpan ()), $assert_bool($2)); 20495 return this.ensureSubtypeOf(($0 && $0.is$lang_Type()), ($1 && $1.is$SourceSpan ()), $assert_bool($2));
20191 }; 20496 };
20192 lang_Type.prototype.getConstructor$1 = function($0) { 20497 lang_Type.prototype.getConstructor$1 = function($0) {
20193 return this.getConstructor($assert_String($0)); 20498 return this.getConstructor($assert_String($0));
(...skipping 26 matching lines...) Expand all
20220 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); 20525 return this.resolveTypeParams(($0 && $0.is$ConcreteType()));
20221 }; 20526 };
20222 // ********** Code for ParameterType ************** 20527 // ********** Code for ParameterType **************
20223 function ParameterType(name, typeParameter) { 20528 function ParameterType(name, typeParameter) {
20224 this.typeParameter = typeParameter; 20529 this.typeParameter = typeParameter;
20225 lang_Type.call(this, name); 20530 lang_Type.call(this, name);
20226 // Initializers done 20531 // Initializers done
20227 } 20532 }
20228 $inherits(ParameterType, lang_Type); 20533 $inherits(ParameterType, lang_Type);
20229 ParameterType.prototype.is$ParameterType = function(){return this;}; 20534 ParameterType.prototype.is$ParameterType = function(){return this;};
20535 ParameterType.prototype.get$extendsType = function() { return this.extendsType; };
20536 ParameterType.prototype.set$extendsType = function(value) { return this.extendsT ype = value; };
20230 ParameterType.prototype.get$isClass = function() { 20537 ParameterType.prototype.get$isClass = function() {
20231 return false; 20538 return false;
20232 } 20539 }
20233 ParameterType.prototype.get$library = function() { 20540 ParameterType.prototype.get$library = function() {
20234 return null; 20541 return null;
20235 } 20542 }
20236 ParameterType.prototype.get$span = function() { 20543 ParameterType.prototype.get$span = function() {
20237 return this.typeParameter.span; 20544 return this.typeParameter.span;
20238 } 20545 }
20239 ParameterType.prototype.get$constructors = function() { 20546 ParameterType.prototype.get$constructors = function() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
20293 ParameterType.prototype.resolveTypeParams$1 = function($0) { 20600 ParameterType.prototype.resolveTypeParams$1 = function($0) {
20294 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); 20601 return this.resolveTypeParams(($0 && $0.is$ConcreteType()));
20295 }; 20602 };
20296 // ********** Code for NonNullableType ************** 20603 // ********** Code for NonNullableType **************
20297 function NonNullableType(type) { 20604 function NonNullableType(type) {
20298 this.type = type; 20605 this.type = type;
20299 lang_Type.call(this, type.name); 20606 lang_Type.call(this, type.name);
20300 // Initializers done 20607 // Initializers done
20301 } 20608 }
20302 $inherits(NonNullableType, lang_Type); 20609 $inherits(NonNullableType, lang_Type);
20610 NonNullableType.prototype.get$type = function() { return this.type; };
20303 NonNullableType.prototype.get$isNullable = function() { 20611 NonNullableType.prototype.get$isNullable = function() {
20304 return false; 20612 return false;
20305 } 20613 }
20306 NonNullableType.prototype.get$isBool = function() { 20614 NonNullableType.prototype.get$isBool = function() {
20307 return this.type.get$isBool(); 20615 return this.type.get$isBool();
20308 } 20616 }
20309 NonNullableType.prototype.get$isUsed = function() { 20617 NonNullableType.prototype.get$isUsed = function() {
20310 return false; 20618 return false;
20311 } 20619 }
20312 NonNullableType.prototype.isSubtypeOf = function(other) { 20620 NonNullableType.prototype.isSubtypeOf = function(other) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
20451 ConcreteType.prototype.get$isClass = function() { 20759 ConcreteType.prototype.get$isClass = function() {
20452 return this.genericType.isClass; 20760 return this.genericType.isClass;
20453 } 20761 }
20454 ConcreteType.prototype.get$library = function() { 20762 ConcreteType.prototype.get$library = function() {
20455 return this.genericType.library; 20763 return this.genericType.library;
20456 } 20764 }
20457 ConcreteType.prototype.get$span = function() { 20765 ConcreteType.prototype.get$span = function() {
20458 return this.genericType.get$span(); 20766 return this.genericType.get$span();
20459 } 20767 }
20460 ConcreteType.prototype.get$hasTypeParams = function() { 20768 ConcreteType.prototype.get$hasTypeParams = function() {
20461 return this.typeArguments.getValues().some$1((function (e) { 20769 return $assert_bool(this.typeArguments.getValues().some$1((function (e) {
20462 return (e instanceof ParameterType); 20770 return (e instanceof ParameterType);
20463 }) 20771 })
20464 ); 20772 ));
20465 } 20773 }
20466 ConcreteType.prototype.get$members = function() { return this.members; }; 20774 ConcreteType.prototype.get$members = function() { return this.members; };
20467 ConcreteType.prototype.set$members = function(value) { return this.members = val ue; }; 20775 ConcreteType.prototype.set$members = function(value) { return this.members = val ue; };
20468 ConcreteType.prototype.get$constructors = function() { return this.constructors; }; 20776 ConcreteType.prototype.get$constructors = function() { return this.constructors; };
20469 ConcreteType.prototype.set$constructors = function(value) { return this.construc tors = value; }; 20777 ConcreteType.prototype.set$constructors = function(value) { return this.construc tors = value; };
20470 ConcreteType.prototype.get$factories = function() { return this.factories; }; 20778 ConcreteType.prototype.get$factories = function() { return this.factories; };
20471 ConcreteType.prototype.set$factories = function(value) { return this.factories = value; }; 20779 ConcreteType.prototype.set$factories = function(value) { return this.factories = value; };
20472 ConcreteType.prototype.resolveTypeParams = function(inType) { 20780 ConcreteType.prototype.resolveTypeParams = function(inType) {
20473 var newTypeArgs = []; 20781 var newTypeArgs = [];
20474 var needsNewType = false; 20782 var needsNewType = false;
(...skipping 23 matching lines...) Expand all
20498 } 20806 }
20499 } 20807 }
20500 return this._interfaces; 20808 return this._interfaces;
20501 } 20809 }
20502 ConcreteType.prototype.getCallMethod = function() { 20810 ConcreteType.prototype.getCallMethod = function() {
20503 return this.genericType.getCallMethod(); 20811 return this.genericType.getCallMethod();
20504 } 20812 }
20505 ConcreteType.prototype.getAllMembers = function() { 20813 ConcreteType.prototype.getAllMembers = function() {
20506 var result = this.genericType.getAllMembers(); 20814 var result = this.genericType.getAllMembers();
20507 var $list = result.getKeys$0(); 20815 var $list = result.getKeys$0();
20508 for (var $i = result.getKeys$0().iterator(); $i.hasNext$0(); ) { 20816 for (var $i = result.getKeys$0().iterator$0(); $i.hasNext$0(); ) {
20509 var memberName = $i.next$0(); 20817 var memberName = $i.next$0();
20510 var myMember = this.members.$index(memberName); 20818 var myMember = this.members.$index(memberName);
20511 if ($notnull_bool($ne(myMember, null))) { 20819 if ($notnull_bool($ne(myMember, null))) {
20512 result.$setindex(memberName, myMember); 20820 result.$setindex(memberName, myMember);
20513 } 20821 }
20514 } 20822 }
20515 return (result && result.is$Map$String$Member()); 20823 return (result && result.is$Map$String$Member());
20516 } 20824 }
20517 ConcreteType.prototype.markUsed = function() { 20825 ConcreteType.prototype.markUsed = function() {
20518 this.genericType.markUsed(); 20826 this.genericType.markUsed();
20519 } 20827 }
20520 ConcreteType.prototype.genMethod = function(method) { 20828 ConcreteType.prototype.genMethod = function(method) {
20521 this.genericType.genMethod(method); 20829 this.genericType.genMethod(method);
20522 } 20830 }
20523 ConcreteType.prototype.getFactory = function(type, constructorName) { 20831 ConcreteType.prototype.getFactory = function(type, constructorName) {
20524 return this.genericType.getFactory(type, constructorName); 20832 return this.genericType.getFactory(type, constructorName);
20525 } 20833 }
20526 ConcreteType.prototype.getConstructor = function(constructorName) { 20834 ConcreteType.prototype.getConstructor = function(constructorName) {
20527 var ret = this.constructors.$index(constructorName); 20835 var ret = this.constructors.$index(constructorName);
20528 if ($notnull_bool($ne(ret, null))) return ret; 20836 if ($notnull_bool($ne(ret, null))) return ret;
20529 ret = this.factories.getFactory(this.name, constructorName); 20837 ret = this.factories.getFactory(this.name, constructorName);
20530 if ($notnull_bool($ne(ret, null))) return ret; 20838 if ($notnull_bool($ne(ret, null))) return ret;
20531 var genericMember = this.genericType.getConstructor(constructorName); 20839 var genericMember = this.genericType.getConstructor(constructorName);
20532 if ($notnull_bool(genericMember == null)) return null; 20840 if ($notnull_bool(genericMember == null)) return null;
20533 if ($ne(genericMember.declaringType, this.genericType)) { 20841 if ($notnull_bool($ne(genericMember.get$declaringType(), this.genericType))) {
20534 if (!$notnull_bool(genericMember.declaringType.get$isGeneric())) return gene ricMember; 20842 if (!$notnull_bool(genericMember.get$declaringType().get$isGeneric())) retur n genericMember;
20535 var newDeclaringType = genericMember.declaringType.getOrMakeConcreteType(thi s.typeArgsInOrder); 20843 var newDeclaringType = genericMember.get$declaringType().getOrMakeConcreteTy pe$1(this.typeArgsInOrder);
20536 var factory = newDeclaringType.getFactory$2(this.genericType, constructorNam e); 20844 var factory = newDeclaringType.getFactory$2(this.genericType, constructorNam e);
20537 if (factory != null) return factory; 20845 if (factory != null) return factory;
20538 return newDeclaringType.getConstructor$1(constructorName); 20846 return newDeclaringType.getConstructor$1(constructorName);
20539 } 20847 }
20540 if ($notnull_bool(genericMember.get$isFactory())) { 20848 if ($notnull_bool(genericMember.get$isFactory())) {
20541 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gen ericMember); 20849 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gen ericMember);
20542 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member( ))); 20850 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member( )));
20543 } 20851 }
20544 else { 20852 else {
20545 ret = new ConcreteMember(this.name, this, genericMember); 20853 ret = new ConcreteMember(this.name, this, genericMember);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
20730 DefinedType.prototype.genMethod = function(method) { 21038 DefinedType.prototype.genMethod = function(method) {
20731 if ($notnull_bool(this.isUsed)) { 21039 if ($notnull_bool(this.isUsed)) {
20732 world.gen.genMethod(method); 21040 world.gen.genMethod(method);
20733 } 21041 }
20734 else if ($notnull_bool(this.isClass)) { 21042 else if ($notnull_bool(this.isClass)) {
20735 if (this._lazyGenMethods == null) this._lazyGenMethods = $map([]); 21043 if (this._lazyGenMethods == null) this._lazyGenMethods = $map([]);
20736 this._lazyGenMethods.$setindex(method.name, method); 21044 this._lazyGenMethods.$setindex(method.name, method);
20737 } 21045 }
20738 } 21046 }
20739 DefinedType.prototype._resolveInterfaces = function(types) { 21047 DefinedType.prototype._resolveInterfaces = function(types) {
21048 var $0;
20740 if (types == null) return []; 21049 if (types == null) return [];
20741 var interfaces = []; 21050 var interfaces = [];
20742 for (var $i = 0;$i < types.length; $i++) { 21051 for (var $i = 0;$i < types.length; $i++) {
20743 var type = types.$index($i); 21052 var type = types.$index($i);
20744 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true); 21053 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true);
20745 if ($notnull_bool(resolvedInterface.get$isClosed() && !($notnull_bool(this.l ibrary.get$isCore() || this.library.get$isCoreImpl())))) { 21054 if ($notnull_bool(resolvedInterface.get$isClosed() && !($notnull_bool(this.l ibrary.get$isCore() || this.library.get$isCoreImpl())))) {
20746 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span()); 21055 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', (($0 = type.get$span()) && $0.is$Source Span()));
20747 } 21056 }
20748 resolvedInterface.addDirectSubtype$1(this); 21057 resolvedInterface.addDirectSubtype$1(this);
20749 interfaces.add$1(resolvedInterface); 21058 interfaces.add$1(resolvedInterface);
20750 } 21059 }
20751 return (interfaces && interfaces.is$List$Type()); 21060 return (interfaces && interfaces.is$List$Type());
20752 } 21061 }
20753 DefinedType.prototype.addDirectSubtype = function(type) { 21062 DefinedType.prototype.addDirectSubtype = function(type) {
20754 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 746, 12); 21063 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 746, 12);
20755 this.directSubtypes.add(type); 21064 this.directSubtypes.add(type);
20756 } 21065 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
20809 return -1; 21118 return -1;
20810 } 21119 }
20811 DefinedType.prototype.resolve = function() { 21120 DefinedType.prototype.resolve = function() {
20812 var $this = this; // closure support 21121 var $this = this; // closure support
20813 var $0; 21122 var $0;
20814 if ((this.definition instanceof TypeDefinition)) { 21123 if ((this.definition instanceof TypeDefinition)) {
20815 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition()); 21124 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition());
20816 if ($notnull_bool(this.isClass)) { 21125 if ($notnull_bool(this.isClass)) {
20817 if (typeDef.extendsTypes != null && typeDef.extendsTypes.length > 0) { 21126 if (typeDef.extendsTypes != null && typeDef.extendsTypes.length > 0) {
20818 if (typeDef.extendsTypes.length > 1) { 21127 if (typeDef.extendsTypes.length > 1) {
20819 world.error('more than one base class', typeDef.extendsTypes.$index(1) .get$span()); 21128 world.error('more than one base class', (($0 = typeDef.extendsTypes.$i ndex(1).get$span()) && $0.is$SourceSpan()));
20820 } 21129 }
20821 var extendsTypeRef = typeDef.extendsTypes.$index(0); 21130 var extendsTypeRef = typeDef.extendsTypes.$index(0);
20822 if ((extendsTypeRef instanceof GenericTypeReference)) { 21131 if ((extendsTypeRef instanceof GenericTypeReference)) {
20823 var g = (extendsTypeRef && extendsTypeRef.is$GenericTypeReference()); 21132 var g = (extendsTypeRef && extendsTypeRef.is$GenericTypeReference());
20824 this.set$parent(this.resolveType(g.baseType, true)); 21133 this.set$parent(this.resolveType(g.baseType, true));
20825 } 21134 }
20826 this.set$parent(this.resolveType((extendsTypeRef && extendsTypeRef.is$Ty peReference()), true)); 21135 this.set$parent(this.resolveType((extendsTypeRef && extendsTypeRef.is$Ty peReference()), true));
20827 if (!$notnull_bool(this.get$parent().get$isClass())) { 21136 if (!$notnull_bool(this.get$parent().get$isClass())) {
20828 world.error('class may not extend an interface - use implements', type Def.extendsTypes.$index(0).get$span()); 21137 world.error('class may not extend an interface - use implements', (($0 = typeDef.extendsTypes.$index(0).get$span()) && $0.is$SourceSpan()));
20829 } 21138 }
20830 this.get$parent().addDirectSubtype(this); 21139 this.get$parent().addDirectSubtype(this);
20831 if ($notnull_bool(this._cycleInClassExtends())) { 21140 if ($notnull_bool(this._cycleInClassExtends())) {
20832 world.error(('class "' + this.name + '" has a cycle in its inheritance chain'), extendsTypeRef.get$span()); 21141 world.error(('class "' + this.name + '" has a cycle in its inheritance chain'), (($0 = extendsTypeRef.get$span()) && $0.is$SourceSpan()));
20833 } 21142 }
20834 } 21143 }
20835 else { 21144 else {
20836 if (!$notnull_bool(this.get$isObject())) { 21145 if (!$notnull_bool(this.get$isObject())) {
20837 this.set$parent(world.objectType); 21146 this.set$parent(world.objectType);
20838 this.get$parent().addDirectSubtype(this); 21147 this.get$parent().addDirectSubtype(this);
20839 } 21148 }
20840 } 21149 }
20841 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); 21150 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes);
20842 if (typeDef.factoryType != null) { 21151 if (typeDef.factoryType != null) {
20843 world.error('factory not allowed on classes', typeDef.factoryType.span); 21152 world.error('factory not allowed on classes', typeDef.factoryType.span);
20844 } 21153 }
20845 } 21154 }
20846 else { 21155 else {
20847 if (typeDef.implementsTypes != null && typeDef.implementsTypes.length > 0) { 21156 if (typeDef.implementsTypes != null && typeDef.implementsTypes.length > 0) {
20848 world.error('implements not allowed on interfaces (use extends)', typeDe f.implementsTypes.$index(0).get$span()); 21157 world.error('implements not allowed on interfaces (use extends)', (($0 = typeDef.implementsTypes.$index(0).get$span()) && $0.is$SourceSpan()));
20849 } 21158 }
20850 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes); 21159 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes);
20851 var res = this._cycleInInterfaceExtends(); 21160 var res = this._cycleInInterfaceExtends();
20852 if (res >= 0) { 21161 if (res >= 0) {
20853 world.error(('interface "' + this.name + '" has a cycle in its inheritan ce chain'), typeDef.extendsTypes.$index(res).get$span()); 21162 world.error(('interface "' + this.name + '" has a cycle in its inheritan ce chain'), (($0 = typeDef.extendsTypes.$index(res).get$span()) && $0.is$SourceS pan()));
20854 } 21163 }
20855 if (typeDef.factoryType != null) { 21164 if (typeDef.factoryType != null) {
20856 this.factory_ = this.resolveType(typeDef.factoryType, true); 21165 this.factory_ = this.resolveType(typeDef.factoryType, true);
20857 if (this.factory_ == null) { 21166 if (this.factory_ == null) {
20858 world.warning('unresolved factory', typeDef.factoryType.span); 21167 world.warning('unresolved factory', typeDef.factoryType.span);
20859 } 21168 }
20860 } 21169 }
20861 } 21170 }
20862 } 21171 }
20863 else if ((this.definition instanceof FunctionTypeDefinition)) { 21172 else if ((this.definition instanceof FunctionTypeDefinition)) {
(...skipping 26 matching lines...) Expand all
20890 if (methodName == null) methodName = definition.name.name; 21199 if (methodName == null) methodName = definition.name.name;
20891 var method = new MethodMember(methodName, this, definition); 21200 var method = new MethodMember(methodName, this, definition);
20892 if ($notnull_bool(method.get$isConstructor())) { 21201 if ($notnull_bool(method.get$isConstructor())) {
20893 if (this.constructors.containsKey(method.get$constructorName())) { 21202 if (this.constructors.containsKey(method.get$constructorName())) {
20894 world.error(('duplicate constructor definition of ' + method.get$name() + ''), definition.span); 21203 world.error(('duplicate constructor definition of ' + method.get$name() + ''), definition.span);
20895 return; 21204 return;
20896 } 21205 }
20897 this.constructors.$setindex(method.get$constructorName(), method); 21206 this.constructors.$setindex(method.get$constructorName(), method);
20898 return; 21207 return;
20899 } 21208 }
20900 if ($notnull_bool(definition.modifiers != null && definition.modifiers.length == 1 && $eq(definition.modifiers.$index(0).kind, 75/*TokenKind.FACTORY*/))) { 21209 if ($notnull_bool(definition.modifiers != null && definition.modifiers.length == 1 && $eq(definition.modifiers.$index(0).get$kind(), 75/*TokenKind.FACTORY*/)) ) {
20901 if (this.factories.getFactory(method.get$constructorName(), $assert_String(m ethod.get$name())) != null) { 21210 if (this.factories.getFactory($assert_String(method.get$constructorName()), $assert_String(method.get$name())) != null) {
20902 world.error(('duplicate factory definition of "' + method.get$name() + '"' ), definition.span); 21211 world.error(('duplicate factory definition of "' + method.get$name() + '"' ), definition.span);
20903 return; 21212 return;
20904 } 21213 }
20905 this.factories.addFactory(method.get$constructorName(), $assert_String(metho d.get$name()), (method && method.is$Member())); 21214 this.factories.addFactory($assert_String(method.get$constructorName()), $ass ert_String(method.get$name()), (method && method.is$Member()));
20906 return; 21215 return;
20907 } 21216 }
20908 if (methodName.startsWith('get\$') || methodName.startsWith('set\$')) { 21217 if (methodName.startsWith('get\$') || methodName.startsWith('set\$')) {
20909 var propName = methodName.substring(4); 21218 var propName = methodName.substring(4);
20910 var prop = this.members.$index(propName); 21219 var prop = this.members.$index(propName);
20911 if ($notnull_bool(prop == null)) { 21220 if ($notnull_bool(prop == null)) {
20912 prop = new PropertyMember($assert_String(propName), this); 21221 prop = new PropertyMember($assert_String(propName), this);
20913 this.members.$setindex(propName, prop); 21222 this.members.$setindex(propName, prop);
20914 } 21223 }
20915 if (!(prop instanceof PropertyMember)) { 21224 if (!(prop instanceof PropertyMember)) {
20916 world.error(('property conflicts with field "' + propName + '"'), definiti on.span); 21225 world.error(('property conflicts with field "' + propName + '"'), definiti on.span);
20917 return; 21226 return;
20918 } 21227 }
20919 if (methodName[0] == 'g') { 21228 if (methodName[0] == 'g') {
20920 if (prop.getter != null) { 21229 if ($notnull_bool($ne(prop.get$getter(), null))) {
20921 world.error(('duplicate getter definition for "' + propName + '"'), defi nition.span); 21230 world.error(('duplicate getter definition for "' + propName + '"'), defi nition.span);
20922 } 21231 }
20923 prop.getter = (method && method.is$MethodMember()); 21232 prop.set$getter(method);
20924 } 21233 }
20925 else { 21234 else {
20926 if (prop.setter != null) { 21235 if ($notnull_bool($ne(prop.get$setter(), null))) {
20927 world.error(('duplicate setter definition for "' + propName + '"'), defi nition.span); 21236 world.error(('duplicate setter definition for "' + propName + '"'), defi nition.span);
20928 } 21237 }
20929 prop.setter = (method && method.is$MethodMember()); 21238 prop.set$setter(method);
20930 } 21239 }
20931 return; 21240 return;
20932 } 21241 }
20933 if (this.members.containsKey(methodName)) { 21242 if (this.members.containsKey(methodName)) {
20934 world.error(('duplicate method definition of "' + method.get$name() + '"'), definition.span); 21243 world.error(('duplicate method definition of "' + method.get$name() + '"'), definition.span);
20935 return; 21244 return;
20936 } 21245 }
20937 this.members.$setindex(methodName, method); 21246 this.members.$setindex(methodName, method);
20938 } 21247 }
20939 DefinedType.prototype.addField = function(definition) { 21248 DefinedType.prototype.addField = function(definition) {
20940 for (var i = 0; 21249 for (var i = 0;
20941 i < definition.names.length; i++) { 21250 i < definition.names.length; i++) {
20942 var name = definition.names.$index(i).get$name(); 21251 var name = definition.names.$index(i).get$name();
20943 if (this.members.containsKey(name)) { 21252 if (this.members.containsKey(name)) {
20944 world.error(('duplicate field definition of "' + name + '"'), definition.s pan); 21253 world.error(('duplicate field definition of "' + name + '"'), definition.s pan);
20945 return; 21254 return;
20946 } 21255 }
20947 var value = null; 21256 var value = null;
20948 if (definition.values != null) { 21257 if (definition.values != null) {
20949 value = definition.values.$index(i); 21258 value = definition.values.$index(i);
20950 } 21259 }
20951 var field = new FieldMember($assert_String(name), this, definition, value); 21260 var field = new FieldMember($assert_String(name), this, definition, value);
20952 this.members.$setindex(name, field); 21261 this.members.$setindex(name, field);
20953 if ($notnull_bool(this.isNativeType)) { 21262 if ($notnull_bool(this.isNativeType)) {
20954 field.isNative = true; 21263 field.set$isNative(true);
20955 } 21264 }
20956 } 21265 }
20957 } 21266 }
20958 DefinedType.prototype.getFactory = function(type, constructorName) { 21267 DefinedType.prototype.getFactory = function(type, constructorName) {
20959 var ret = this.factories.getFactory(type.name, constructorName); 21268 var ret = this.factories.getFactory(type.name, constructorName);
20960 if ($notnull_bool($ne(ret, null))) return ret; 21269 if ($notnull_bool($ne(ret, null))) return ret;
20961 ret = this.factories.getFactory(this.name, constructorName); 21270 ret = this.factories.getFactory(this.name, constructorName);
20962 if ($notnull_bool($ne(ret, null))) return ret; 21271 if ($notnull_bool($ne(ret, null))) return ret;
20963 ret = this.constructors.$index(constructorName); 21272 ret = this.constructors.$index(constructorName);
20964 if ($notnull_bool($ne(ret, null))) return ret; 21273 if ($notnull_bool($ne(ret, null))) return ret;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
21005 if ($notnull_bool($ne(parentMember, null))) { 21314 if ($notnull_bool($ne(parentMember, null))) {
21006 if (!$notnull_bool(member.get$isPrivate()) || $eq(member.get$library(), pa rentMember.get$library())) { 21315 if (!$notnull_bool(member.get$isPrivate()) || $eq(member.get$library(), pa rentMember.get$library())) {
21007 member.override(parentMember); 21316 member.override(parentMember);
21008 } 21317 }
21009 } 21318 }
21010 return member; 21319 return member;
21011 } 21320 }
21012 if ($notnull_bool(this.get$isTop())) { 21321 if ($notnull_bool(this.get$isTop())) {
21013 var libType = this.library.findTypeByName(memberName); 21322 var libType = this.library.findTypeByName(memberName);
21014 if ($notnull_bool($ne(libType, null))) { 21323 if ($notnull_bool($ne(libType, null))) {
21015 return libType.get$typeMember(); 21324 return (($0 = libType.get$typeMember()) && $0.is$Member());
21016 } 21325 }
21017 } 21326 }
21018 return this.getMemberInParents(memberName); 21327 return this.getMemberInParents(memberName);
21019 } 21328 }
21020 DefinedType.prototype.getMemberInParents = function(memberName) { 21329 DefinedType.prototype.getMemberInParents = function(memberName) {
21021 if ($notnull_bool(this.isClass)) { 21330 if ($notnull_bool(this.isClass)) {
21022 if (this.get$parent() != null) { 21331 if (this.get$parent() != null) {
21023 return this.get$parent().getMember(memberName); 21332 return this.get$parent().getMember(memberName);
21024 } 21333 }
21025 else if ($notnull_bool(this.get$isObject())) { 21334 else if ($notnull_bool(this.get$isObject())) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
21147 world.error(('' + baseType.get$name() + ' is not generic'), typeRef.span); 21456 world.error(('' + baseType.get$name() + ' is not generic'), typeRef.span);
21148 return null; 21457 return null;
21149 } 21458 }
21150 if (typeRef.typeArguments.length != baseType.get$typeParameters().length) { 21459 if (typeRef.typeArguments.length != baseType.get$typeParameters().length) {
21151 world.error('wrong number of type arguments', typeRef.span); 21460 world.error('wrong number of type arguments', typeRef.span);
21152 return null; 21461 return null;
21153 } 21462 }
21154 var typeArgs = []; 21463 var typeArgs = [];
21155 for (var i = 0; 21464 for (var i = 0;
21156 i < typeRef.typeArguments.length; i++) { 21465 i < typeRef.typeArguments.length; i++) {
21157 var extendsType = baseType.get$typeParameters().$index(i).extendsType; 21466 var extendsType = baseType.get$typeParameters().$index(i).get$extendsType( );
21158 var typeArg = this.resolveType((($0 = typeRef.typeArguments.$index(i)) && $0.is$TypeReference()), typeErrors); 21467 var typeArg = this.resolveType((($0 = typeRef.typeArguments.$index(i)) && $0.is$TypeReference()), typeErrors);
21159 typeArgs.add$1(typeArg); 21468 typeArgs.add$1(typeArg);
21160 if ($notnull_bool($ne(extendsType, null) && !(typeArg instanceof Parameter Type))) { 21469 if ($notnull_bool($ne(extendsType, null) && !(typeArg instanceof Parameter Type))) {
21161 typeArg.ensureSubtypeOf$3(extendsType, typeRef.typeArguments.$index(i).g et$span(), typeErrors); 21470 typeArg.ensureSubtypeOf$3(extendsType, typeRef.typeArguments.$index(i).g et$span(), typeErrors);
21162 } 21471 }
21163 } 21472 }
21164 typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs); 21473 typeRef.type = (($0 = baseType.getOrMakeConcreteType$1(typeArgs)) && $0.is$l ang_Type());
21165 } 21474 }
21166 else if ((node instanceof FunctionTypeReference)) { 21475 else if ((node instanceof FunctionTypeReference)) {
21167 var typeRef = (node && node.is$FunctionTypeReference()); 21476 var typeRef = (node && node.is$FunctionTypeReference());
21168 var name = ''; 21477 var name = '';
21169 if (typeRef.func.name != null) name = typeRef.func.name.name; 21478 if (typeRef.func.name != null) name = typeRef.func.name.name;
21170 typeRef.type = this.library.getOrAddFunctionType($assert_String(name), typeR ef.func, this); 21479 typeRef.type = this.library.getOrAddFunctionType($assert_String(name), typeR ef.func, this);
21171 } 21480 }
21172 else { 21481 else {
21173 world.internalError('unknown type reference', node.span); 21482 world.internalError('unknown type reference', node.span);
21174 } 21483 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
21259 FixedCollection.prototype.filter = function(f) { 21568 FixedCollection.prototype.filter = function(f) {
21260 return Collections.filter(this, new ListFactory(), f); 21569 return Collections.filter(this, new ListFactory(), f);
21261 } 21570 }
21262 FixedCollection.prototype.some = function(f) { 21571 FixedCollection.prototype.some = function(f) {
21263 return Collections.some(this, f); 21572 return Collections.some(this, f);
21264 } 21573 }
21265 FixedCollection.prototype.isEmpty = function() { 21574 FixedCollection.prototype.isEmpty = function() {
21266 return this.length == 0; 21575 return this.length == 0;
21267 } 21576 }
21268 FixedCollection.prototype.filter$1 = FixedCollection.prototype.filter; 21577 FixedCollection.prototype.filter$1 = FixedCollection.prototype.filter;
21578 FixedCollection.prototype.forEach$1 = FixedCollection.prototype.forEach;
21269 FixedCollection.prototype.isEmpty$0 = function() { 21579 FixedCollection.prototype.isEmpty$0 = function() {
21270 return this.isEmpty(); 21580 return this.isEmpty();
21271 }; 21581 };
21272 FixedCollection.prototype.iterator$0 = function() { 21582 FixedCollection.prototype.iterator$0 = function() {
21273 return this.iterator(); 21583 return this.iterator();
21274 }; 21584 };
21275 FixedCollection.prototype.some$1 = FixedCollection.prototype.some; 21585 FixedCollection.prototype.some$1 = FixedCollection.prototype.some;
21276 // ********** Code for FixedCollection$Type ************** 21586 // ********** Code for FixedCollection$Type **************
21277 function FixedCollection$Type(value, length) { 21587 function FixedCollection$Type(value, length) {
21278 this.value = value; 21588 this.value = value;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
21320 this.isSuper = false 21630 this.isSuper = false
21321 this.isType = false 21631 this.isType = false
21322 this.type = type; 21632 this.type = type;
21323 this.code = code; 21633 this.code = code;
21324 this.span = span; 21634 this.span = span;
21325 this.needsTemp = needsTemp; 21635 this.needsTemp = needsTemp;
21326 // Initializers done 21636 // Initializers done
21327 if (this.type == null) world.internalError('type passed as null', this.span); 21637 if (this.type == null) world.internalError('type passed as null', this.span);
21328 } 21638 }
21329 Value.prototype.is$Value = function(){return this;}; 21639 Value.prototype.is$Value = function(){return this;};
21640 Value.prototype.get$type = function() { return this.type; };
21641 Value.prototype.set$type = function(value) { return this.type = value; };
21642 Value.prototype.get$code = function() { return this.code; };
21643 Value.prototype.set$code = function(value) { return this.code = value; };
21330 Value.prototype.get$span = function() { return this.span; }; 21644 Value.prototype.get$span = function() { return this.span; };
21331 Value.prototype.set$span = function(value) { return this.span = value; }; 21645 Value.prototype.set$span = function(value) { return this.span = value; };
21646 Value.prototype.get$isSuper = function() { return this.isSuper; };
21647 Value.prototype.set$isSuper = function(value) { return this.isSuper = value; };
21648 Value.prototype.get$isType = function() { return this.isType; };
21649 Value.prototype.set$isType = function(value) { return this.isType = value; };
21650 Value.prototype.get$needsTemp = function() { return this.needsTemp; };
21651 Value.prototype.set$needsTemp = function(value) { return this.needsTemp = value; };
21332 Value.prototype.get$_typeIsVarOrParameterType = function() { 21652 Value.prototype.get$_typeIsVarOrParameterType = function() {
21333 return $notnull_bool(this.type.get$isVar() || (this.type instanceof ParameterT ype)); 21653 return $notnull_bool(this.type.get$isVar() || (this.type instanceof ParameterT ype));
21334 } 21654 }
21335 Value.prototype.get$isConst = function() { 21655 Value.prototype.get$isConst = function() {
21336 return false; 21656 return false;
21337 } 21657 }
21338 Value.prototype.get$canonicalCode = function() { 21658 Value.prototype.get$canonicalCode = function() {
21339 return null; 21659 return null;
21340 } 21660 }
21341 Value.prototype.get_ = function(context, name, node) { 21661 Value.prototype.get_ = function(context, name, node) {
21662 var $0;
21342 var member = this._resolveMember(context, name, node, false); 21663 var member = this._resolveMember(context, name, node, false);
21343 if ($notnull_bool($ne(member, null))) { 21664 if ($notnull_bool($ne(member, null))) {
21344 return member._get$3(context, node, this); 21665 return (($0 = member._get$3(context, node, this)) && $0.is$Value());
21345 } 21666 }
21346 else { 21667 else {
21347 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node); 21668 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node);
21348 } 21669 }
21349 } 21670 }
21350 Value.prototype.set_ = function(context, name, node, value, isDynamic) { 21671 Value.prototype.set_ = function(context, name, node, value, isDynamic) {
21351 var member = this._resolveMember(context, name, node, isDynamic); 21672 var member = this._resolveMember(context, name, node, isDynamic);
21352 if ($notnull_bool($ne(member, null))) { 21673 if ($notnull_bool($ne(member, null))) {
21353 return member._set(context, node, this, value, isDynamic); 21674 return member._set(context, node, this, value, isDynamic);
21354 } 21675 }
21355 else { 21676 else {
21356 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value])); 21677 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value]));
21357 } 21678 }
21358 } 21679 }
21359 Value.prototype.invoke = function(context, name, node, args, isDynamic) { 21680 Value.prototype.invoke = function(context, name, node, args, isDynamic) {
21681 var $0;
21360 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) { 21682 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) {
21361 if (args.values.length != 1) { 21683 if (args.values.length != 1) {
21362 world.warning('wrong number of arguments for !=', node.span); 21684 world.warning('wrong number of arguments for !=', node.span);
21363 } 21685 }
21364 var eq = this.invoke(context, '\$eq', node, args, isDynamic); 21686 var eq = this.invoke(context, '\$eq', node, args, isDynamic);
21365 world.gen.corejs.useOperator('\$ne'); 21687 world.gen.corejs.useOperator('\$ne');
21366 return new Value(eq.type, ('\$ne(' + this.code + ', ' + args.values.$index(0 ).code + ')'), node.span, true); 21688 return new Value(eq.get$type(), ('\$ne(' + this.code + ', ' + args.values.$i ndex(0).get$code() + ')'), node.span, true);
21367 } 21689 }
21368 if (name == '\$call') { 21690 if (name == '\$call') {
21369 if ($notnull_bool(this.isType)) { 21691 if ($notnull_bool(this.isType)) {
21370 world.error('must use "new" or "const" to construct a new instance', node. span); 21692 world.error('must use "new" or "const" to construct a new instance', node. span);
21371 } 21693 }
21372 if ($notnull_bool(this.type.needsVarCall(args))) { 21694 if ($notnull_bool(this.type.needsVarCall(args))) {
21373 return this._varCall(context, args); 21695 return this._varCall(context, args);
21374 } 21696 }
21375 } 21697 }
21376 var member = this._resolveMember(context, name, node, isDynamic); 21698 var member = this._resolveMember(context, name, node, isDynamic);
21377 if ($notnull_bool(member == null)) { 21699 if ($notnull_bool(member == null)) {
21378 return this.invokeNoSuchMethod(context, name, node, args); 21700 return this.invokeNoSuchMethod(context, name, node, args);
21379 } 21701 }
21380 else { 21702 else {
21381 return member.invoke$5(context, node, this, args, isDynamic); 21703 return (($0 = member.invoke$5(context, node, this, args, isDynamic)) && $0.i s$Value());
21382 } 21704 }
21383 } 21705 }
21384 Value.prototype.canInvoke = function(context, name, args) { 21706 Value.prototype.canInvoke = function(context, name, args) {
21385 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) { 21707 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) {
21386 return true; 21708 return true;
21387 } 21709 }
21388 if ($notnull_bool(this.type.get$isVarOrFunction() && name == '\$call')) { 21710 if ($notnull_bool(this.type.get$isVarOrFunction() && name == '\$call')) {
21389 return true; 21711 return true;
21390 } 21712 }
21391 var member = this._resolveMember(context, name, null, true); 21713 var member = this._resolveMember(context, name, null, true);
21392 return $notnull_bool($ne(member, null) && member.canInvoke$2(context, args)); 21714 return $notnull_bool($ne(member, null) && member.canInvoke$2(context, args));
21393 } 21715 }
21394 Value.prototype._hasOverriddenNoSuchMethod = function() { 21716 Value.prototype._hasOverriddenNoSuchMethod = function() {
21395 if ($notnull_bool(this.isSuper)) { 21717 if ($notnull_bool(this.isSuper)) {
21396 var m = this.type.getMember('noSuchMethod'); 21718 var m = this.type.getMember('noSuchMethod');
21397 return $notnull_bool($ne(m, null) && !$notnull_bool(m.declaringType.get$isOb ject())); 21719 return $notnull_bool($ne(m, null) && !$notnull_bool(m.get$declaringType().ge t$isObject()));
21398 } 21720 }
21399 else { 21721 else {
21400 return this.type.resolveMember('noSuchMethod').members.length > 1; 21722 return this.type.resolveMember('noSuchMethod').members.length > 1;
21401 } 21723 }
21402 } 21724 }
21403 Value.prototype._tryResolveMember = function(context, name) { 21725 Value.prototype._tryResolveMember = function(context, name) {
21404 if ($notnull_bool(this.isSuper)) { 21726 if ($notnull_bool(this.isSuper)) {
21405 return this.type.getMember(name); 21727 return this.type.getMember(name);
21406 } 21728 }
21407 else { 21729 else {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
21442 world.error('Types are not first class', span); 21764 world.error('Types are not first class', span);
21443 } 21765 }
21444 } 21766 }
21445 Value.prototype._varCall = function(context, args) { 21767 Value.prototype._varCall = function(context, args) {
21446 var stub = world.functionType.getCallStub(args); 21768 var stub = world.functionType.getCallStub(args);
21447 return new Value(world.varType, ('' + this.code + '.' + stub.get$name() + '(' + args.getCode() + ')'), this.span, true); 21769 return new Value(world.varType, ('' + this.code + '.' + stub.get$name() + '(' + args.getCode() + ')'), this.span, true);
21448 } 21770 }
21449 Value.prototype.needsConversion = function(toType) { 21771 Value.prototype.needsConversion = function(toType) {
21450 var callMethod = toType.getCallMethod(); 21772 var callMethod = toType.getCallMethod();
21451 if ($notnull_bool($ne(callMethod, null))) { 21773 if ($notnull_bool($ne(callMethod, null))) {
21452 var arity = callMethod.get$parameters().length; 21774 var arity = $assert_num(callMethod.get$parameters().length);
21453 var myCall = this.type.getCallMethod(); 21775 var myCall = this.type.getCallMethod();
21454 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) { 21776 if ($notnull_bool(myCall == null || $ne(myCall.get$parameters().length, arit y))) {
21455 return true; 21777 return true;
21456 } 21778 }
21457 } 21779 }
21458 if ($notnull_bool(options.enableTypeChecks)) { 21780 if ($notnull_bool(options.enableTypeChecks)) {
21459 var fromType = this.type; 21781 var fromType = this.type;
21460 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { 21782 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) {
21461 fromType = world.objectType; 21783 fromType = world.objectType;
21462 } 21784 }
21463 var bothNum = $notnull_bool(this.type.get$isNum() && toType.get$isNum()); 21785 var bothNum = $notnull_bool(this.type.get$isNum() && toType.get$isNum());
21464 return $notnull_bool(fromType.isSubtypeOf(toType) || bothNum); 21786 return $notnull_bool(fromType.isSubtypeOf(toType) || bothNum);
21465 } 21787 }
21466 return false; 21788 return false;
21467 } 21789 }
21468 Value.prototype.convertTo = function(context, toType, node, isDynamic) { 21790 Value.prototype.convertTo = function(context, toType, node, isDynamic) {
21469 var $0; 21791 var $0;
21470 var checked = !$notnull_bool(isDynamic); 21792 var checked = !$notnull_bool(isDynamic);
21471 var callMethod = toType.getCallMethod(); 21793 var callMethod = toType.getCallMethod();
21472 if ($notnull_bool($ne(callMethod, null))) { 21794 if ($notnull_bool($ne(callMethod, null))) {
21473 if ($notnull_bool(checked && !$notnull_bool(toType.isAssignable(this.type))) ) { 21795 if ($notnull_bool(checked && !$notnull_bool(toType.isAssignable(this.type))) ) {
21474 this.convertWarning(toType, node); 21796 this.convertWarning(toType, node);
21475 } 21797 }
21476 var arity = callMethod.get$parameters().length; 21798 var arity = $assert_num(callMethod.get$parameters().length);
21477 var myCall = this.type.getCallMethod(); 21799 var myCall = this.type.getCallMethod();
21478 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) { 21800 if ($notnull_bool(myCall == null || $ne(myCall.get$parameters().length, arit y))) {
21479 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory (arity)); 21801 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory (arity));
21480 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), node.span, true); 21802 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), node.span, true);
21481 return (($0 = $notnull_bool(this._isDomCallback(toType) && !$notnull_bool( this._isDomCallback(this.type))) ? val._wrapDomCallback(toType, arity) : val) && $0.is$Value()); 21803 return (($0 = $notnull_bool(this._isDomCallback(toType) && !$notnull_bool( this._isDomCallback(this.type))) ? val._wrapDomCallback(toType, arity) : val) && $0.is$Value());
21482 } 21804 }
21483 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i sDomCallback(this.type)))) { 21805 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i sDomCallback(this.type)))) {
21484 return this._wrapDomCallback(toType, arity); 21806 return this._wrapDomCallback(toType, arity);
21485 } 21807 }
21486 } 21808 }
21487 var fromType = this.type; 21809 var fromType = this.type;
21488 if ($notnull_bool(this.type.get$isVar() && (this.code != 'null' || !$notnull_b ool(toType.get$isNullable())))) { 21810 if ($notnull_bool(this.type.get$isVar() && (this.code != 'null' || !$notnull_b ool(toType.get$isNullable())))) {
21489 fromType = world.objectType; 21811 fromType = world.objectType;
21490 } 21812 }
21491 var bothNum = $notnull_bool(this.type.get$isNum() && toType.get$isNum()); 21813 var bothNum = $notnull_bool(this.type.get$isNum() && toType.get$isNum());
21492 if ($notnull_bool($notnull_bool(!$notnull_bool(checked) || fromType.isSubtypeO f(toType)) || bothNum)) { 21814 if ($notnull_bool($notnull_bool(!$notnull_bool(checked) || fromType.isSubtypeO f(toType)) || bothNum)) {
21493 return this; 21815 return this;
21494 } 21816 }
21495 if ($notnull_bool(checked && !$notnull_bool(toType.isSubtypeOf(this.type)))) { 21817 if ($notnull_bool(checked && !$notnull_bool(toType.isSubtypeOf(this.type)))) {
21496 this.convertWarning(toType, node); 21818 this.convertWarning(toType, node);
21497 } 21819 }
21498 if ($notnull_bool(options.enableTypeChecks)) { 21820 if ($notnull_bool(options.enableTypeChecks)) {
21499 return this._typeAssert(context, toType, node); 21821 return this._typeAssert(context, toType, node);
21500 } 21822 }
21501 else { 21823 else {
21502 return this; 21824 return this;
21503 } 21825 }
21504 } 21826 }
21505 Value.prototype._isDomCallback = function(toType) { 21827 Value.prototype._isDomCallback = function(toType) {
21506 return ((toType.get$definition() instanceof FunctionTypeDefinition) && $eq(toT ype.get$library(), world.get$dom())); 21828 return ($notnull_bool((toType.get$definition() instanceof FunctionTypeDefiniti on) && $eq(toType.get$library(), world.get$dom())));
21507 } 21829 }
21508 Value.prototype._wrapDomCallback = function(toType, arity) { 21830 Value.prototype._wrapDomCallback = function(toType, arity) {
21509 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, true); 21831 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, true);
21510 } 21832 }
21511 Value.prototype._typeAssert = function(context, toType, node) { 21833 Value.prototype._typeAssert = function(context, toType, node) {
21512 if ((toType instanceof ParameterType)) { 21834 if ((toType instanceof ParameterType)) {
21513 var p = (toType && toType.is$ParameterType()); 21835 var p = (toType && toType.is$ParameterType());
21514 toType = p.extendsType; 21836 toType = p.extendsType;
21515 } 21837 }
21516 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) { 21838 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) {
(...skipping 14 matching lines...) Expand all
21531 else if ($notnull_bool(toType.get$library().get$isCore() && toType.get$typeofN ame() != null)) { 21853 else if ($notnull_bool(toType.get$library().get$isCore() && toType.get$typeofN ame() != null)) {
21532 check = ('\$assert_' + toType.name + '(' + this.code + ')'); 21854 check = ('\$assert_' + toType.name + '(' + this.code + ')');
21533 if (toType.typeCheckCode == null) { 21855 if (toType.typeCheckCode == null) {
21534 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}"); 21856 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}");
21535 } 21857 }
21536 } 21858 }
21537 else { 21859 else {
21538 toType.isTested = true; 21860 toType.isTested = true;
21539 var temp = context.getTemp(this); 21861 var temp = context.getTemp(this);
21540 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); 21862 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&');
21541 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); 21863 check = check + (' ' + temp.get$code() + '.is\$' + toType.get$jsname() + '() )');
21542 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value())); 21864 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value()));
21543 } 21865 }
21544 return new Value(toType, check, this.span, true); 21866 return new Value(toType, check, this.span, true);
21545 } 21867 }
21546 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) { 21868 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) {
21547 if ($notnull_bool(toType.get$isVar())) { 21869 if ($notnull_bool(toType.get$isVar())) {
21548 world.error('can not resolve type', span); 21870 world.error('can not resolve type', span);
21549 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true' , null); 21871 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true' , null);
21550 } 21872 }
21551 if ((toType instanceof ParameterType)) { 21873 if ((toType instanceof ParameterType)) {
(...skipping 10 matching lines...) Expand all
21562 toType.markUsed(); 21884 toType.markUsed();
21563 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); 21885 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')');
21564 if (!$notnull_bool(isTrue)) { 21886 if (!$notnull_bool(isTrue)) {
21565 testCode = '!' + testCode; 21887 testCode = '!' + testCode;
21566 } 21888 }
21567 } 21889 }
21568 if (testCode == null) { 21890 if (testCode == null) {
21569 toType.isTested = true; 21891 toType.isTested = true;
21570 var temp = context.getTemp(this); 21892 var temp = context.getTemp(this);
21571 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); 21893 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&');
21572 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')' ); 21894 testCode = testCode + (' ' + temp.get$code() + '.is\$' + toType.get$jsname() + ')');
21573 if ($notnull_bool(isTrue)) { 21895 if ($notnull_bool(isTrue)) {
21574 testCode = '!!' + testCode; 21896 testCode = '!!' + testCode;
21575 } 21897 }
21576 else { 21898 else {
21577 testCode = '!' + testCode; 21899 testCode = '!' + testCode;
21578 } 21900 }
21579 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value())); 21901 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value()));
21580 } 21902 }
21581 return new Value(world.nonNullBool, testCode, span, true); 21903 return new Value(world.nonNullBool, testCode, span, true);
21582 } 21904 }
21583 Value.prototype.convertWarning = function(toType, node) { 21905 Value.prototype.convertWarning = function(toType, node) {
21584 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType .name + '"'), node.span); 21906 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType .name + '"'), node.span);
21585 } 21907 }
21586 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { 21908 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) {
21909 var $0;
21587 var pos = ''; 21910 var pos = '';
21588 if (args != null) { 21911 if (args != null) {
21589 var argsCode = []; 21912 var argsCode = [];
21590 for (var i = 0; 21913 for (var i = 0;
21591 i < args.get$length(); i++) { 21914 i < args.get$length(); i++) {
21592 argsCode.add$1(args.values.$index(i).code); 21915 argsCode.add$1(args.values.$index(i).get$code());
21593 } 21916 }
21594 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); 21917 pos = Strings.join((argsCode && argsCode.is$List$String()), ", ");
21595 } 21918 }
21596 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, t rue), new Value(world.listType, ('[' + pos + ']'), node.span, true)]; 21919 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, t rue), new Value(world.listType, ('[' + pos + ']'), node.span, true)];
21597 return this._resolveMember(context, 'noSuchMethod', node, false).invoke$4(cont ext, node, this, new Arguments(null, noSuchArgs)); 21920 return (($0 = this._resolveMember(context, 'noSuchMethod', node, false).invoke $4(context, node, this, new Arguments(null, noSuchArgs))) && $0.is$Value());
21598 } 21921 }
21599 Value.prototype.invokeSpecial = function(name, args, returnType) { 21922 Value.prototype.invokeSpecial = function(name, args, returnType) {
21600 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 449, 12 ); 21923 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 449, 12 );
21601 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 50, 12); 21924 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 50, 12);
21602 var argsString = args.getCode(); 21925 var argsString = args.getCode();
21603 if (name == '\$index' || name == '\$setindex') { 21926 if (name == '\$index' || name == '\$setindex') {
21604 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, true); 21927 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, true);
21605 } 21928 }
21606 else { 21929 else {
21607 if (argsString.length > 0) argsString = (', ' + argsString + ''); 21930 if (argsString.length > 0) argsString = (', ' + argsString + '');
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
21670 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod e, span, code) { 21993 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod e, span, code) {
21671 this.values = values; 21994 this.values = values;
21672 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); 21995 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code));
21673 // Initializers done 21996 // Initializers done
21674 } 21997 }
21675 ConstListValue._internal$ctor.prototype = ConstListValue.prototype; 21998 ConstListValue._internal$ctor.prototype = ConstListValue.prototype;
21676 $inherits(ConstListValue, EvaluatedValue); 21999 $inherits(ConstListValue, EvaluatedValue);
21677 ConstListValue.ConstListValue$factory = function(type, values, actualValue, cano nicalCode, span) { 22000 ConstListValue.ConstListValue$factory = function(type, values, actualValue, cano nicalCode, span) {
21678 return new ConstListValue._internal$ctor(type, values, actualValue, canonicalC ode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); 22001 return new ConstListValue._internal$ctor(type, values, actualValue, canonicalC ode, span, EvaluatedValue.codeWithComments(canonicalCode, span));
21679 } 22002 }
22003 ConstListValue.prototype.get$values = function() { return this.values; };
22004 ConstListValue.prototype.set$values = function(value) { return this.values = val ue; };
21680 // ********** Code for ConstMapValue ************** 22005 // ********** Code for ConstMapValue **************
21681 function ConstMapValue() {} 22006 function ConstMapValue() {}
21682 ConstMapValue._internal$ctor = function(type, values, actualValue, canonicalCode , span, code) { 22007 ConstMapValue._internal$ctor = function(type, values, actualValue, canonicalCode , span, code) {
21683 this.values = values; 22008 this.values = values;
21684 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); 22009 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code));
21685 // Initializers done 22010 // Initializers done
21686 } 22011 }
21687 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype; 22012 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype;
21688 $inherits(ConstMapValue, EvaluatedValue); 22013 $inherits(ConstMapValue, EvaluatedValue);
21689 ConstMapValue.ConstMapValue$factory = function(type, keyValuePairs, actualValue, canonicalCode, span) { 22014 ConstMapValue.ConstMapValue$factory = function(type, keyValuePairs, actualValue, canonicalCode, span) {
21690 var values = new HashMapImplementation(); 22015 var values = new HashMapImplementation();
21691 for (var i = 0; 22016 for (var i = 0;
21692 i < keyValuePairs.length; i += 2) { 22017 i < keyValuePairs.length; i += 2) {
21693 values.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$i ndex(i + 1)); 22018 values.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$i ndex(i + 1));
21694 } 22019 }
21695 return new ConstMapValue._internal$ctor(type, values, actualValue, canonicalCo de, span, EvaluatedValue.codeWithComments(canonicalCode, span)); 22020 return new ConstMapValue._internal$ctor(type, values, actualValue, canonicalCo de, span, EvaluatedValue.codeWithComments(canonicalCode, span));
21696 } 22021 }
22022 ConstMapValue.prototype.get$values = function() { return this.values; };
22023 ConstMapValue.prototype.set$values = function(value) { return this.values = valu e; };
21697 // ********** Code for ConstObjectValue ************** 22024 // ********** Code for ConstObjectValue **************
21698 function ConstObjectValue() {} 22025 function ConstObjectValue() {}
21699 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC ode, span, code) { 22026 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC ode, span, code) {
21700 this.fields = fields; 22027 this.fields = fields;
21701 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); 22028 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code));
21702 // Initializers done 22029 // Initializers done
21703 } 22030 }
21704 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype; 22031 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype;
21705 $inherits(ConstObjectValue, EvaluatedValue); 22032 $inherits(ConstObjectValue, EvaluatedValue);
21706 ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode , span) { 22033 ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode , span) {
21707 var fieldValues = []; 22034 var fieldValues = [];
21708 var $list = fields.getKeys(); 22035 var $list = fields.getKeys();
21709 for (var $i = fields.getKeys().iterator$0(); $i.hasNext$0(); ) { 22036 for (var $i = fields.getKeys().iterator$0(); $i.hasNext$0(); ) {
21710 var f = $i.next$0(); 22037 var f = $i.next$0();
21711 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + '')); 22038 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + ''));
21712 } 22039 }
21713 fieldValues.sort((function (a, b) { 22040 fieldValues.sort((function (a, b) {
21714 return a.compareTo$1(b); 22041 return a.compareTo$1(b);
21715 }) 22042 })
21716 ); 22043 );
21717 var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldVa lues, ',') + ']'; 22044 var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldVa lues, ',') + ']';
21718 return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonica lCode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); 22045 return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonica lCode, span, EvaluatedValue.codeWithComments(canonicalCode, span));
21719 } 22046 }
22047 ConstObjectValue.prototype.get$fields = function() { return this.fields; };
22048 ConstObjectValue.prototype.set$fields = function(value) { return this.fields = v alue; };
21720 // ********** Code for GlobalValue ************** 22049 // ********** Code for GlobalValue **************
21721 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span, dependencies) { 22050 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span, dependencies) {
21722 this.field = field; 22051 this.field = field;
21723 this.name = name; 22052 this.name = name;
21724 this.exp = exp; 22053 this.exp = exp;
21725 this.canonicalCode = canonicalCode; 22054 this.canonicalCode = canonicalCode;
21726 this.dependencies = dependencies; 22055 this.dependencies = dependencies;
21727 Value.call(this, type, code, span, !$notnull_bool(isConst)); 22056 Value.call(this, type, code, span, !$notnull_bool(isConst));
21728 // Initializers done 22057 // Initializers done
21729 } 22058 }
21730 $inherits(GlobalValue, Value); 22059 $inherits(GlobalValue, Value);
21731 GlobalValue.prototype.is$GlobalValue = function(){return this;}; 22060 GlobalValue.prototype.is$GlobalValue = function(){return this;};
21732 GlobalValue.prototype.is$Comparable = function(){return this;}; 22061 GlobalValue.prototype.is$Comparable = function(){return this;};
21733 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) { 22062 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) {
21734 var code = ($notnull_bool(exp.get$isConst()) ? exp.get$canonicalCode() : exp.c ode); 22063 var code = ($notnull_bool(exp.get$isConst()) ? exp.get$canonicalCode() : exp.c ode);
21735 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie ld.get$name() + '*/'); 22064 var codeWithComment = ('' + code + '/*' + field.get$declaringType().get$name() + '.' + field.get$name() + '*/');
21736 return new GlobalValue(exp.type, $assert_String(codeWithComment), field.isFina l, field, null, exp, code, exp.span, dependencies.filter$1((function (d) { 22065 return new GlobalValue(exp.type, $assert_String(codeWithComment), $assert_bool (field.get$isFinal()), field, null, exp, code, exp.span, dependencies.filter$1(( function (d) {
21737 return (d instanceof GlobalValue); 22066 return (d instanceof GlobalValue);
21738 }) 22067 })
21739 )); 22068 ));
21740 } 22069 }
21741 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies ) { 22070 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies ) {
21742 var name = ("const\$" + uniqueId + ""); 22071 var name = ("const\$" + uniqueId + "");
21743 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/"); 22072 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/");
21744 return new GlobalValue(exp.type, $assert_String(codeWithComment), true, null, name, exp, name, exp.span, dependencies.filter$1((function (d) { 22073 return new GlobalValue(exp.type, $assert_String(codeWithComment), true, null, name, exp, name, exp.span, dependencies.filter$1((function (d) {
21745 return (d instanceof GlobalValue); 22074 return (d instanceof GlobalValue);
21746 }) 22075 })
21747 )); 22076 ));
21748 } 22077 }
22078 GlobalValue.prototype.get$field = function() { return this.field; };
22079 GlobalValue.prototype.set$field = function(value) { return this.field = value; } ;
21749 GlobalValue.prototype.get$name = function() { return this.name; }; 22080 GlobalValue.prototype.get$name = function() { return this.name; };
21750 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; 22081 GlobalValue.prototype.set$name = function(value) { return this.name = value; };
22082 GlobalValue.prototype.get$exp = function() { return this.exp; };
22083 GlobalValue.prototype.set$exp = function(value) { return this.exp = value; };
21751 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode ; }; 22084 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode ; };
21752 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica lCode = value; }; 22085 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica lCode = value; };
21753 GlobalValue.prototype.get$isConst = function() { 22086 GlobalValue.prototype.get$isConst = function() {
21754 return $notnull_bool(this.exp.get$isConst() && ($notnull_bool(this.field == nu ll || this.field.isFinal))); 22087 return $notnull_bool(this.exp.get$isConst() && ($notnull_bool(this.field == nu ll || this.field.isFinal)));
21755 } 22088 }
21756 GlobalValue.prototype.get$actualValue = function() { 22089 GlobalValue.prototype.get$actualValue = function() {
21757 return this.exp.get$dynamic().get$actualValue(); 22090 return this.exp.get$dynamic().get$actualValue();
21758 } 22091 }
21759 GlobalValue.prototype.compareTo = function(other) { 22092 GlobalValue.prototype.compareTo = function(other) {
21760 if ($eq(other, this)) { 22093 if ($eq(other, this)) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
21848 // Initializers done 22181 // Initializers done
21849 } 22182 }
21850 World.prototype.get$coreimpl = function() { 22183 World.prototype.get$coreimpl = function() {
21851 var $0; 22184 var $0;
21852 return (($0 = this.libraries.$index('dart:coreimpl')) && $0.is$Library()); 22185 return (($0 = this.libraries.$index('dart:coreimpl')) && $0.is$Library());
21853 } 22186 }
21854 World.prototype.get$dom = function() { 22187 World.prototype.get$dom = function() {
21855 var $0; 22188 var $0;
21856 return (($0 = this.libraries.$index('dart:dom')) && $0.is$Library()); 22189 return (($0 = this.libraries.$index('dart:dom')) && $0.is$Library());
21857 } 22190 }
22191 World.prototype.get$dynamicType = function() { return this.dynamicType; };
22192 World.prototype.set$dynamicType = function(value) { return this.dynamicType = va lue; };
21858 World.prototype.get$functionType = function() { return this.functionType; }; 22193 World.prototype.get$functionType = function() { return this.functionType; };
21859 World.prototype.set$functionType = function(value) { return this.functionType = value; }; 22194 World.prototype.set$functionType = function(value) { return this.functionType = value; };
21860 World.prototype.init = function() { 22195 World.prototype.init = function() {
21861 var $0; 22196 var $0;
21862 this.corelib = new Library(this.readFile('dart:core')); 22197 this.corelib = new Library(this.readFile('dart:core'));
21863 this.libraries.$setindex('dart:core', this.corelib); 22198 this.libraries.$setindex('dart:core', this.corelib);
21864 this._todo.add(this.corelib); 22199 this._todo.add(this.corelib);
21865 this.voidType = (($0 = this._addToCoreLib('void', false)) && $0.is$DefinedType ()); 22200 this.voidType = (($0 = this._addToCoreLib('void', false)) && $0.is$DefinedType ());
21866 this.dynamicType = (($0 = this._addToCoreLib('Dynamic', false)) && $0.is$Defin edType()); 22201 this.dynamicType = (($0 = this._addToCoreLib('Dynamic', false)) && $0.is$Defin edType());
21867 this.varType = this.dynamicType; 22202 this.varType = this.dynamicType;
(...skipping 19 matching lines...) Expand all
21887 var mset = this._members.$index(member.name); 22222 var mset = this._members.$index(member.name);
21888 if ($notnull_bool(mset == null)) { 22223 if ($notnull_bool(mset == null)) {
21889 mset = new MemberSet(member, true); 22224 mset = new MemberSet(member, true);
21890 this._members.$setindex(mset.get$name(), mset); 22225 this._members.$setindex(mset.get$name(), mset);
21891 } 22226 }
21892 else { 22227 else {
21893 mset.get$members().add$1(member); 22228 mset.get$members().add$1(member);
21894 } 22229 }
21895 } 22230 }
21896 World.prototype._addTopName = function(named) { 22231 World.prototype._addTopName = function(named) {
22232 var $0;
21897 var existing = this._topNames.$index(named.get$name()); 22233 var existing = this._topNames.$index(named.get$name());
21898 if ($notnull_bool($ne(existing, null))) { 22234 if ($notnull_bool($ne(existing, null))) {
21899 this.info(('mangling matching top level name "' + named.get$name() + '" in ' ) + ('both "' + named.get$library().name + '" and "' + existing.get$library().na me + '"')); 22235 this.info(('mangling matching top level name "' + named.get$name() + '" in ' ) + ('both "' + named.get$library().name + '" and "' + existing.get$library().ge t$name() + '"'));
21900 if ($notnull_bool(named.get$isNative())) { 22236 if ($notnull_bool(named.get$isNative())) {
21901 if ($notnull_bool(existing.get$isNative())) { 22237 if ($notnull_bool(existing.get$isNative())) {
21902 world.internalError(('conflicting native names "' + named.get$name() + ' " ') + ('(already defined in ' + existing.get$span().get$locationText() + ')'), named.get$span()); 22238 world.internalError(('conflicting native names "' + named.get$name() + ' " ') + ('(already defined in ' + existing.get$span().get$locationText() + ')'), (($0 = named.get$span()) && $0.is$SourceSpan()));
21903 } 22239 }
21904 else { 22240 else {
21905 this._topNames.$setindex(named.get$name(), named); 22241 this._topNames.$setindex(named.get$name(), named);
21906 this._addJavascriptTopName((existing && existing.is$Named())); 22242 this._addJavascriptTopName((existing && existing.is$Named()));
21907 } 22243 }
21908 } 22244 }
21909 else if ($notnull_bool(named.get$library().get$isCore())) { 22245 else if ($notnull_bool(named.get$library().get$isCore())) {
21910 if ($notnull_bool(existing.get$library().get$isCore())) { 22246 if ($notnull_bool(existing.get$library().get$isCore())) {
21911 world.internalError(('conflicting top-level names in core "' + named.get $name() + '" ') + ('(previously defined in ' + existing.get$span().get$locationT ext() + ')'), named.get$span()); 22247 world.internalError(('conflicting top-level names in core "' + named.get $name() + '" ') + ('(previously defined in ' + existing.get$span().get$locationT ext() + ')'), (($0 = named.get$span()) && $0.is$SourceSpan()));
21912 } 22248 }
21913 else { 22249 else {
21914 this._topNames.$setindex(named.get$name(), named); 22250 this._topNames.$setindex(named.get$name(), named);
21915 this._addJavascriptTopName((existing && existing.is$Named())); 22251 this._addJavascriptTopName((existing && existing.is$Named()));
21916 } 22252 }
21917 } 22253 }
21918 else { 22254 else {
21919 this._addJavascriptTopName(named); 22255 this._addJavascriptTopName(named);
21920 } 22256 }
21921 } 22257 }
21922 else { 22258 else {
21923 this._topNames.$setindex(named.get$name(), named); 22259 this._topNames.$setindex(named.get$name(), named);
21924 } 22260 }
21925 } 22261 }
21926 World.prototype._addJavascriptTopName = function(named) { 22262 World.prototype._addJavascriptTopName = function(named) {
22263 var $0;
21927 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name () + '')); 22264 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name () + ''));
21928 var existing = this._topNames.$index(named.get$jsname()); 22265 var existing = this._topNames.$index(named.get$jsname());
21929 if ($notnull_bool($ne(existing, null) && $ne(existing, named))) { 22266 if ($notnull_bool($ne(existing, null) && $ne(existing, named))) {
21930 world.internalError(('name mangling failed for "' + named.get$jsname() + '" ') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$span().get $locationText() + ')'), named.get$span()); 22267 world.internalError(('name mangling failed for "' + named.get$jsname() + '" ') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$span().get $locationText() + ')'), (($0 = named.get$span()) && $0.is$SourceSpan()));
21931 } 22268 }
21932 this._topNames.$setindex(named.get$jsname(), named); 22269 this._topNames.$setindex(named.get$jsname(), named);
21933 } 22270 }
21934 World.prototype._addType = function(type) { 22271 World.prototype._addType = function(type) {
21935 if (!$notnull_bool(type.get$isTop())) this._addTopName(type); 22272 if (!$notnull_bool(type.get$isTop())) this._addTopName(type);
21936 } 22273 }
21937 World.prototype._addToCoreLib = function(name, isClass) { 22274 World.prototype._addToCoreLib = function(name, isClass) {
21938 var ret = new DefinedType(name, this.corelib, null, isClass); 22275 var ret = new DefinedType(name, this.corelib, null, isClass);
21939 this.corelib.types.$setindex(name, ret); 22276 this.corelib.types.$setindex(name, ret);
21940 return ret; 22277 return ret;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
21986 var $this = this; // closure support 22323 var $this = this; // closure support
21987 var lib = this.withTiming('first pass', (function () { 22324 var lib = this.withTiming('first pass', (function () {
21988 return $this.processScript(options.dartScript); 22325 return $this.processScript(options.dartScript);
21989 }) 22326 })
21990 ); 22327 );
21991 this.withTiming('resolve top level', (function () { 22328 this.withTiming('resolve top level', (function () {
21992 $this.resolveAll(); 22329 $this.resolveAll();
21993 }) 22330 })
21994 ); 22331 );
21995 this.withTiming('generate code', (function () { 22332 this.withTiming('generate code', (function () {
21996 var mainMembers = lib.topType.resolveMember('main'); 22333 var $0;
22334 var mainMembers = lib.get$topType().resolveMember$1('main');
21997 var main = null; 22335 var main = null;
21998 if ($notnull_bool(mainMembers == null || mainMembers.get$members().length == 0)) { 22336 if ($notnull_bool(mainMembers == null || $eq(mainMembers.get$members().lengt h, 0))) {
21999 $this.fatal('no main method specified'); 22337 $this.fatal('no main method specified');
22000 } 22338 }
22001 else if (mainMembers.get$members().length > 1) { 22339 else if (mainMembers.get$members().length > 1) {
22002 var $list = mainMembers.get$members(); 22340 var $list = mainMembers.get$members();
22003 for (var $i = mainMembers.get$members().iterator$0(); $i.hasNext$0(); ) { 22341 for (var $i = mainMembers.get$members().iterator$0(); $i.hasNext$0(); ) {
22004 var m = $i.next$0(); 22342 var m = $i.next$0();
22005 main = m; 22343 main = m;
22006 $this.error('more than one main member (using last?)', main.get$span()); 22344 $this.error('more than one main member (using last?)', (($0 = main.get$s pan()) && $0.is$SourceSpan()));
22007 } 22345 }
22008 } 22346 }
22009 else { 22347 else {
22010 main = mainMembers.get$members().$index(0); 22348 main = mainMembers.get$members().$index(0);
22011 } 22349 }
22012 var codeWriter = new CodeWriter(); 22350 var codeWriter = new CodeWriter();
22013 $this.gen = new WorldGenerator(main, codeWriter); 22351 $this.gen = new WorldGenerator(main, codeWriter);
22014 $this.gen.run(); 22352 $this.gen.run();
22015 $this.jsBytesWritten = codeWriter.get$text().length; 22353 $this.jsBytesWritten = $assert_num(codeWriter.get$text().length);
22016 }) 22354 })
22017 ); 22355 );
22018 } 22356 }
22019 World.prototype.getGeneratedCode = function() { 22357 World.prototype.getGeneratedCode = function() {
22020 if (this.legCode != null) { 22358 if (this.legCode != null) {
22021 $assert(options.enableLeg, "options.enableLeg", "world.dart", 310, 14); 22359 $assert(options.enableLeg, "options.enableLeg", "world.dart", 310, 14);
22022 return this.legCode; 22360 return this.legCode;
22023 } 22361 }
22024 else { 22362 else {
22025 return this.gen.writer.get$text(); 22363 return this.gen.writer.get$text();
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
22233 continue loop; 22571 continue loop;
22234 22572
22235 default: 22573 default:
22236 22574
22237 if ($notnull_bool(arg.endsWith$1('.dart'))) { 22575 if ($notnull_bool(arg.endsWith$1('.dart'))) {
22238 this.dartScript = $assert_String(arg); 22576 this.dartScript = $assert_String(arg);
22239 this.childArgs = (($0 = args.getRange(i + 1, args.length - i - 1)) && $0.is$List$String()); 22577 this.childArgs = (($0 = args.getRange(i + 1, args.length - i - 1)) && $0.is$List$String());
22240 break loop; 22578 break loop;
22241 } 22579 }
22242 else if ($notnull_bool(arg.startsWith$1('--out='))) { 22580 else if ($notnull_bool(arg.startsWith$1('--out='))) {
22243 this.outfile = arg.substring$1('--out='.length); 22581 this.outfile = $assert_String(arg.substring$1('--out='.length));
22244 } 22582 }
22245 else if ($notnull_bool(arg.startsWith$1('--libdir='))) { 22583 else if ($notnull_bool(arg.startsWith$1('--libdir='))) {
22246 this.libDir = $assert_String(arg.substring$1('--libdir='.length)); 22584 this.libDir = $assert_String(arg.substring$1('--libdir='.length));
22247 passedLibDir = true; 22585 passedLibDir = true;
22248 } 22586 }
22249 else { 22587 else {
22250 if (!$notnull_bool(ignoreUnrecognizedFlags)) { 22588 if (!$notnull_bool(ignoreUnrecognizedFlags)) {
22251 print(('unrecognized flag: "' + arg + '"')); 22589 print(('unrecognized flag: "' + arg + '"'));
22252 } 22590 }
22253 } 22591 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
22344 }; 22682 };
22345 // ********** Code for VarMethodStub ************** 22683 // ********** Code for VarMethodStub **************
22346 function VarMethodStub(name, member, args, body) { 22684 function VarMethodStub(name, member, args, body) {
22347 this.member = member; 22685 this.member = member;
22348 this.args = args; 22686 this.args = args;
22349 this.body = body; 22687 this.body = body;
22350 VarMember.call(this, name); 22688 VarMember.call(this, name);
22351 // Initializers done 22689 // Initializers done
22352 } 22690 }
22353 $inherits(VarMethodStub, VarMember); 22691 $inherits(VarMethodStub, VarMember);
22692 VarMethodStub.prototype.get$body = function() { return this.body; };
22354 VarMethodStub.prototype.get$returnType = function() { 22693 VarMethodStub.prototype.get$returnType = function() {
22355 var $0; 22694 var $0;
22356 return (($0 = this.member != null ? this.member.get$returnType() : world.varTy pe) && $0.is$lang_Type()); 22695 return (($0 = this.member != null ? this.member.get$returnType() : world.varTy pe) && $0.is$lang_Type());
22357 } 22696 }
22358 VarMethodStub.prototype.get$typeName = function() { 22697 VarMethodStub.prototype.get$typeName = function() {
22359 return this.member != null ? this.member.declaringType.get$jsname() : 'Object' ; 22698 return this.member != null ? this.member.declaringType.get$jsname() : 'Object' ;
22360 } 22699 }
22361 VarMethodStub.prototype.generate = function(code) { 22700 VarMethodStub.prototype.generate = function(code) {
22362 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = ')); 22701 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = '));
22363 this.generateBody(code, ';'); 22702 this.generateBody(code, ';');
22364 } 22703 }
22365 VarMethodStub.prototype.generateBody = function(code, end) { 22704 VarMethodStub.prototype.generateBody = function(code, end) {
22366 if ($notnull_bool(this._useDirectCall(this.member, this.args))) { 22705 if ($notnull_bool(this._useDirectCall(this.member, this.args))) {
22367 code.writeln(('' + this.get$typeName() + '.prototype.' + this.member.get$jsn ame() + '' + end + '')); 22706 code.writeln(('' + this.get$typeName() + '.prototype.' + this.member.get$jsn ame() + '' + end + ''));
22368 } 22707 }
22369 else { 22708 else {
22370 code.enterBlock(('function(' + this.args.getCode() + ') {')); 22709 code.enterBlock(('function(' + this.args.getCode() + ') {'));
22371 code.writeln(('return ' + this.body.code + ';')); 22710 code.writeln(('return ' + this.body.code + ';'));
22372 code.exitBlock(('}' + end + '')); 22711 code.exitBlock(('}' + end + ''));
22373 } 22712 }
22374 } 22713 }
22375 VarMethodStub.prototype._useDirectCall = function(member, args) { 22714 VarMethodStub.prototype._useDirectCall = function(member, args) {
22376 if ((member instanceof MethodMember) && $ne(member.declaringType.get$library() , world.get$dom())) { 22715 if ((member instanceof MethodMember) && $ne(member.declaringType.get$library() , world.get$dom())) {
22377 var method = (member && member.is$MethodMember()); 22716 var method = (member && member.is$MethodMember());
22378 if ($notnull_bool(method.needsArgumentConversion(args))) { 22717 if ($notnull_bool(method.needsArgumentConversion(args))) {
22379 return false; 22718 return false;
22380 } 22719 }
22381 for (var i = args.get$length(); 22720 for (var i = args.get$length();
22382 i < method.parameters.length; i++) { 22721 i < method.parameters.length; i++) {
22383 if ($notnull_bool($ne(method.parameters.$index(i).get$value().code, 'null' ))) { 22722 if ($notnull_bool($ne(method.parameters.$index(i).get$value().get$code(), 'null'))) {
22384 return false; 22723 return false;
22385 } 22724 }
22386 } 22725 }
22387 return method.namesInOrder(args); 22726 return method.namesInOrder(args);
22388 } 22727 }
22389 else { 22728 else {
22390 return false; 22729 return false;
22391 } 22730 }
22392 } 22731 }
22393 VarMethodStub.prototype.generate$1 = function($0) { 22732 VarMethodStub.prototype.generate$1 = function($0) {
(...skipping 20 matching lines...) Expand all
22414 this._invokeMembers(context, node); 22753 this._invokeMembers(context, node);
22415 return VarMember.prototype.invoke.call(this, context, node, target, args); 22754 return VarMember.prototype.invoke.call(this, context, node, target, args);
22416 } 22755 }
22417 VarMethodSet.prototype._invokeMembers = function(context, node) { 22756 VarMethodSet.prototype._invokeMembers = function(context, node) {
22418 if (this._fallbackStubs != null) return; 22757 if (this._fallbackStubs != null) return;
22419 var objectStub = null; 22758 var objectStub = null;
22420 this._fallbackStubs = []; 22759 this._fallbackStubs = [];
22421 var $list = this.members; 22760 var $list = this.members;
22422 for (var $i = 0;$i < $list.length; $i++) { 22761 for (var $i = 0;$i < $list.length; $i++) {
22423 var member = $list.$index($i); 22762 var member = $list.$index($i);
22424 var target = new Value(member.declaringType, 'this', node.span, true); 22763 var target = new Value(member.get$declaringType(), 'this', node.span, true);
22425 var result = member.invoke$4(context, node, target, this.args); 22764 var result = member.invoke$4(context, node, target, this.args);
22426 var stub = new VarMethodStub(this.name, member, this.args, result); 22765 var stub = new VarMethodStub(this.name, member, this.args, result);
22427 var type = member.declaringType; 22766 var type = member.get$declaringType();
22428 if ($notnull_bool(type.get$isObject())) { 22767 if ($notnull_bool(type.get$isObject())) {
22429 objectStub = stub; 22768 objectStub = stub;
22430 } 22769 }
22431 else if ($ne(type.get$library(), world.get$dom())) { 22770 else if ($notnull_bool($ne(type.get$library(), world.get$dom()))) {
22432 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V arMember())); 22771 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V arMember()));
22433 } 22772 }
22434 else { 22773 else {
22435 this._fallbackStubs.add(stub); 22774 this._fallbackStubs.add(stub);
22436 } 22775 }
22437 } 22776 }
22438 if ($notnull_bool(objectStub == null)) { 22777 if ($notnull_bool(objectStub == null)) {
22439 var target = new Value(world.objectType, 'this', node.span, true); 22778 var target = new Value(world.objectType, 'this', node.span, true);
22440 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, t his.args); 22779 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, t his.args);
22441 objectStub = new VarMethodStub(this.name, null, this.args, result); 22780 objectStub = new VarMethodStub(this.name, null, this.args, result);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
22735 INTERFACE, 23074 INTERFACE,
22736 LIBRARY, 23075 LIBRARY,
22737 NATIVE, 23076 NATIVE,
22738 NEGATE, 23077 NEGATE,
22739 OPERATOR, 23078 OPERATOR,
22740 SET, 23079 SET,
22741 SOURCE, 23080 SOURCE,
22742 STATIC, 23081 STATIC,
22743 TYPEDEF ]*/; 23082 TYPEDEF ]*/;
22744 RunEntry(function () {main();}, []); 23083 RunEntry(function () {main();}, []);
OLDNEW
« no previous file with comments | « no previous file | frog/member.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698