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

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: 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') | frog/member.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env node 1 #!/usr/bin/env node
2 // ********** Library dart:core ************** 2 // ********** Library dart:core **************
3 // ********** Natives dart:core ************** 3 // ********** Natives dart:core **************
4 /** 4 /**
5 * Generates a dynamic call stub for a function. 5 * Generates a dynamic call stub for a function.
6 * Our goal is to create a stub method like this on-the-fly: 6 * Our goal is to create a stub method like this on-the-fly:
7 * function($0, $1, capture) { this($0, $1, true, capture); } 7 * function($0, $1, capture) { this($0, $1, true, capture); }
8 * 8 *
9 * This stub then replaces the dynamic one on Function, with one that is 9 * This stub then replaces the dynamic one on Function, with one that is
10 * specialized for that particular function, taking into account its default 10 * specialized for that particular function, taking into account its default
(...skipping 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;};
1343 ListFactory.prototype.is$List$String = function(){return this;}; 1356 ListFactory.prototype.is$List$String = function(){return this;};
1344 ListFactory.prototype.is$List$Type = function(){return this;}; 1357 ListFactory.prototype.is$List$Type = function(){return this;};
1345 ListFactory.prototype.is$List$Value = function(){return this;}; 1358 ListFactory.prototype.is$List$Value = function(){return this;};
1346 ListFactory.prototype.is$List$int = function(){return this;}; 1359 ListFactory.prototype.is$List$int = function(){return this;};
1347 ListFactory.prototype.is$Collection$E = function(){return this;}; 1360 ListFactory.prototype.is$Collection$E = function(){return this;};
1348 ListFactory.prototype.is$Collection$Object = function(){return this;}; 1361 ListFactory.prototype.is$Collection$Object = function(){return this;};
1349 ListFactory.prototype.is$Collection$Type = function(){return this;}; 1362 ListFactory.prototype.is$Collection$Type = function(){return this;};
1350 ListFactory.prototype.is$Iterable = function(){return this;}; 1363 ListFactory.prototype.is$Iterable = function(){return this;};
1351 ListFactory.ListFactory$from$factory = function(other) { 1364 ListFactory.ListFactory$from$factory = function(other) {
1352 var list = []; 1365 var list = [];
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 return this.length == 0; 1397 return this.length == 0;
1385 } 1398 }
1386 ListFactory.prototype.iterator = function() { 1399 ListFactory.prototype.iterator = function() {
1387 return new ListIterator(this); 1400 return new ListIterator(this);
1388 } 1401 }
1389 ListFactory.prototype.add$1 = ListFactory.prototype.add; 1402 ListFactory.prototype.add$1 = ListFactory.prototype.add;
1390 ListFactory.prototype.addAll$1 = function($0) { 1403 ListFactory.prototype.addAll$1 = function($0) {
1391 return this.addAll(($0 && $0.is$Collection$E())); 1404 return this.addAll(($0 && $0.is$Collection$E()));
1392 }; 1405 };
1393 ListFactory.prototype.filter$1 = ListFactory.prototype.filter; 1406 ListFactory.prototype.filter$1 = ListFactory.prototype.filter;
1407 ListFactory.prototype.forEach$1 = ListFactory.prototype.forEach;
1394 ListFactory.prototype.indexOf$2 = ListFactory.prototype.indexOf; 1408 ListFactory.prototype.indexOf$2 = ListFactory.prototype.indexOf;
1395 ListFactory.prototype.isEmpty$0 = function() { 1409 ListFactory.prototype.isEmpty$0 = function() {
1396 return this.isEmpty(); 1410 return this.isEmpty();
1397 }; 1411 };
1398 ListFactory.prototype.iterator$0 = function() { 1412 ListFactory.prototype.iterator$0 = function() {
1399 return this.iterator(); 1413 return this.iterator();
1400 }; 1414 };
1401 ListFactory.prototype.last$0 = function() { 1415 ListFactory.prototype.last$0 = function() {
1402 return this.last(); 1416 return this.last();
1403 }; 1417 };
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 } 1555 }
1542 ImmutableMap.prototype.getValues = function() { 1556 ImmutableMap.prototype.getValues = function() {
1543 return this._internal.getValues(); 1557 return this._internal.getValues();
1544 } 1558 }
1545 ImmutableMap.prototype.containsKey = function(key) { 1559 ImmutableMap.prototype.containsKey = function(key) {
1546 return this._internal.containsKey(key); 1560 return this._internal.containsKey(key);
1547 } 1561 }
1548 ImmutableMap.prototype.$setindex = function(key, value) { 1562 ImmutableMap.prototype.$setindex = function(key, value) {
1549 $throw(const$12/*const IllegalAccessException()*/); 1563 $throw(const$12/*const IllegalAccessException()*/);
1550 } 1564 }
1565 ImmutableMap.prototype.forEach$1 = ImmutableMap.prototype.forEach;
1551 ImmutableMap.prototype.getKeys$0 = function() { 1566 ImmutableMap.prototype.getKeys$0 = function() {
1552 return this.getKeys(); 1567 return this.getKeys();
1553 }; 1568 };
1554 ImmutableMap.prototype.isEmpty$0 = function() { 1569 ImmutableMap.prototype.isEmpty$0 = function() {
1555 return this.isEmpty(); 1570 return this.isEmpty();
1556 }; 1571 };
1557 // ********** Code for MatchImplementation ************** 1572 // ********** Code for MatchImplementation **************
1558 function MatchImplementation(pattern, str, _start, _end, _groups) { 1573 function MatchImplementation(pattern, str, _start, _end, _groups) {
1559 this.pattern = pattern; 1574 this.pattern = pattern;
1560 this.str = str; 1575 this.str = str;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1795 var i = 0; 1810 var i = 0;
1796 this.forEach(function _(key, value) { 1811 this.forEach(function _(key, value) {
1797 list.$setindex(i++, value); 1812 list.$setindex(i++, value);
1798 } 1813 }
1799 ); 1814 );
1800 return list; 1815 return list;
1801 } 1816 }
1802 HashMapImplementation.prototype.containsKey = function(key) { 1817 HashMapImplementation.prototype.containsKey = function(key) {
1803 return (this._probeForLookup(key) != -1); 1818 return (this._probeForLookup(key) != -1);
1804 } 1819 }
1820 HashMapImplementation.prototype.forEach$1 = HashMapImplementation.prototype.forE ach;
1805 HashMapImplementation.prototype.getKeys$0 = function() { 1821 HashMapImplementation.prototype.getKeys$0 = function() {
1806 return this.getKeys(); 1822 return this.getKeys();
1807 }; 1823 };
1808 HashMapImplementation.prototype.isEmpty$0 = function() { 1824 HashMapImplementation.prototype.isEmpty$0 = function() {
1809 return this.isEmpty(); 1825 return this.isEmpty();
1810 }; 1826 };
1811 // ********** Code for HashMapImplementation$E$E ************** 1827 // ********** Code for HashMapImplementation$E$E **************
1812 function HashMapImplementation$E$E() { 1828 function HashMapImplementation$E$E() {
1813 // Initializers done 1829 // Initializers done
1814 if (HashMapImplementation._deletedKey == null) { 1830 if (HashMapImplementation._deletedKey == null) {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 }); 2041 });
2026 HashSetImplementation.prototype.iterator = function() { 2042 HashSetImplementation.prototype.iterator = function() {
2027 return new HashSetIterator$E(this); 2043 return new HashSetIterator$E(this);
2028 } 2044 }
2029 HashSetImplementation.prototype.add$1 = HashSetImplementation.prototype.add; 2045 HashSetImplementation.prototype.add$1 = HashSetImplementation.prototype.add;
2030 HashSetImplementation.prototype.addAll$1 = function($0) { 2046 HashSetImplementation.prototype.addAll$1 = function($0) {
2031 return this.addAll(($0 && $0.is$Collection$E())); 2047 return this.addAll(($0 && $0.is$Collection$E()));
2032 }; 2048 };
2033 HashSetImplementation.prototype.contains$1 = HashSetImplementation.prototype.con tains; 2049 HashSetImplementation.prototype.contains$1 = HashSetImplementation.prototype.con tains;
2034 HashSetImplementation.prototype.filter$1 = HashSetImplementation.prototype.filte r; 2050 HashSetImplementation.prototype.filter$1 = HashSetImplementation.prototype.filte r;
2051 HashSetImplementation.prototype.forEach$1 = HashSetImplementation.prototype.forE ach;
2035 HashSetImplementation.prototype.isEmpty$0 = function() { 2052 HashSetImplementation.prototype.isEmpty$0 = function() {
2036 return this.isEmpty(); 2053 return this.isEmpty();
2037 }; 2054 };
2038 HashSetImplementation.prototype.iterator$0 = function() { 2055 HashSetImplementation.prototype.iterator$0 = function() {
2039 return this.iterator(); 2056 return this.iterator();
2040 }; 2057 };
2041 HashSetImplementation.prototype.some$1 = HashSetImplementation.prototype.some; 2058 HashSetImplementation.prototype.some$1 = HashSetImplementation.prototype.some;
2042 // ********** Code for HashSetImplementation$E ************** 2059 // ********** Code for HashSetImplementation$E **************
2043 function HashSetImplementation$E() {} 2060 function HashSetImplementation$E() {}
2044 $inherits(HashSetImplementation$E, HashSetImplementation); 2061 $inherits(HashSetImplementation$E, HashSetImplementation);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 // ********** Code for LinkedHashMapImplementation ************** 2153 // ********** Code for LinkedHashMapImplementation **************
2137 function LinkedHashMapImplementation() { 2154 function LinkedHashMapImplementation() {
2138 // Initializers done 2155 // Initializers done
2139 this._map = new HashMapImplementation(); 2156 this._map = new HashMapImplementation();
2140 this._list = new DoubleLinkedQueue$KeyValuePair$K$V(); 2157 this._list = new DoubleLinkedQueue$KeyValuePair$K$V();
2141 } 2158 }
2142 LinkedHashMapImplementation.prototype.is$Map$Node$Element = function(){return th is;}; 2159 LinkedHashMapImplementation.prototype.is$Map$Node$Element = function(){return th is;};
2143 LinkedHashMapImplementation.prototype.is$Map$String$Member = function(){return t his;}; 2160 LinkedHashMapImplementation.prototype.is$Map$String$Member = function(){return t his;};
2144 LinkedHashMapImplementation.prototype.$setindex = function(key, value) { 2161 LinkedHashMapImplementation.prototype.$setindex = function(key, value) {
2145 if (this._map.containsKey(key)) { 2162 if (this._map.containsKey(key)) {
2146 this._map.$index(key).get$element().value = value; 2163 this._map.$index(key).get$element().set$value(value);
2147 } 2164 }
2148 else { 2165 else {
2149 this._list.addLast(new KeyValuePair$K$V(key, value)); 2166 this._list.addLast(new KeyValuePair$K$V(key, value));
2150 this._map.$setindex(key, this._list.lastEntry()); 2167 this._map.$setindex(key, this._list.lastEntry());
2151 } 2168 }
2152 } 2169 }
2153 LinkedHashMapImplementation.prototype.$index = function(key) { 2170 LinkedHashMapImplementation.prototype.$index = function(key) {
2154 var $0; 2171 var $0;
2155 var entry = (($0 = this._map.$index(key)) && $0.is$DoubleLinkedQueueEntry$KeyV aluePair$K$V()); 2172 var entry = (($0 = this._map.$index(key)) && $0.is$DoubleLinkedQueueEntry$KeyV aluePair$K$V());
2156 if (entry == null) return null; 2173 if (entry == null) return null;
(...skipping 30 matching lines...) Expand all
2187 } 2204 }
2188 LinkedHashMapImplementation.prototype.get$length = function() { 2205 LinkedHashMapImplementation.prototype.get$length = function() {
2189 return this._map.get$length(); 2206 return this._map.get$length();
2190 } 2207 }
2191 Object.defineProperty(LinkedHashMapImplementation.prototype, "length", { 2208 Object.defineProperty(LinkedHashMapImplementation.prototype, "length", {
2192 get: LinkedHashMapImplementation.prototype.get$length 2209 get: LinkedHashMapImplementation.prototype.get$length
2193 }); 2210 });
2194 LinkedHashMapImplementation.prototype.isEmpty = function() { 2211 LinkedHashMapImplementation.prototype.isEmpty = function() {
2195 return this.get$length() == 0; 2212 return this.get$length() == 0;
2196 } 2213 }
2214 LinkedHashMapImplementation.prototype.forEach$1 = LinkedHashMapImplementation.pr ototype.forEach;
2197 LinkedHashMapImplementation.prototype.getKeys$0 = function() { 2215 LinkedHashMapImplementation.prototype.getKeys$0 = function() {
2198 return this.getKeys(); 2216 return this.getKeys();
2199 }; 2217 };
2200 LinkedHashMapImplementation.prototype.isEmpty$0 = function() { 2218 LinkedHashMapImplementation.prototype.isEmpty$0 = function() {
2201 return this.isEmpty(); 2219 return this.isEmpty();
2202 }; 2220 };
2203 // ********** Code for LinkedHashMapImplementation$Node$Element ************** 2221 // ********** Code for LinkedHashMapImplementation$Node$Element **************
2204 function LinkedHashMapImplementation$Node$Element() {} 2222 function LinkedHashMapImplementation$Node$Element() {}
2205 $inherits(LinkedHashMapImplementation$Node$Element, LinkedHashMapImplementation) ; 2223 $inherits(LinkedHashMapImplementation$Node$Element, LinkedHashMapImplementation) ;
2206 LinkedHashMapImplementation$Node$Element.prototype.is$Map$Node$Element = functio n(){return this;}; 2224 LinkedHashMapImplementation$Node$Element.prototype.is$Map$Node$Element = functio n(){return this;};
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2407 return other; 2425 return other;
2408 } 2426 }
2409 DoubleLinkedQueue.prototype.iterator = function() { 2427 DoubleLinkedQueue.prototype.iterator = function() {
2410 return new _DoubleLinkedQueueIterator$E(this._sentinel); 2428 return new _DoubleLinkedQueueIterator$E(this._sentinel);
2411 } 2429 }
2412 DoubleLinkedQueue.prototype.add$1 = DoubleLinkedQueue.prototype.add; 2430 DoubleLinkedQueue.prototype.add$1 = DoubleLinkedQueue.prototype.add;
2413 DoubleLinkedQueue.prototype.addAll$1 = function($0) { 2431 DoubleLinkedQueue.prototype.addAll$1 = function($0) {
2414 return this.addAll(($0 && $0.is$Collection$E())); 2432 return this.addAll(($0 && $0.is$Collection$E()));
2415 }; 2433 };
2416 DoubleLinkedQueue.prototype.filter$1 = DoubleLinkedQueue.prototype.filter; 2434 DoubleLinkedQueue.prototype.filter$1 = DoubleLinkedQueue.prototype.filter;
2435 DoubleLinkedQueue.prototype.forEach$1 = DoubleLinkedQueue.prototype.forEach;
2417 DoubleLinkedQueue.prototype.isEmpty$0 = function() { 2436 DoubleLinkedQueue.prototype.isEmpty$0 = function() {
2418 return this.isEmpty(); 2437 return this.isEmpty();
2419 }; 2438 };
2420 DoubleLinkedQueue.prototype.iterator$0 = function() { 2439 DoubleLinkedQueue.prototype.iterator$0 = function() {
2421 return this.iterator(); 2440 return this.iterator();
2422 }; 2441 };
2423 DoubleLinkedQueue.prototype.last$0 = function() { 2442 DoubleLinkedQueue.prototype.last$0 = function() {
2424 return this.last(); 2443 return this.last();
2425 }; 2444 };
2426 DoubleLinkedQueue.prototype.removeLast$0 = function() { 2445 DoubleLinkedQueue.prototype.removeLast$0 = function() {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2512 if (this._start == null) { 2531 if (this._start == null) {
2513 this._start = Clock.now(); 2532 this._start = Clock.now();
2514 } 2533 }
2515 else { 2534 else {
2516 if (this._stop == null) { 2535 if (this._stop == null) {
2517 return; 2536 return;
2518 } 2537 }
2519 this._start = Clock.now() - (this._stop - this._start); 2538 this._start = Clock.now() - (this._stop - this._start);
2520 } 2539 }
2521 } 2540 }
2541 StopwatchImplementation.prototype.get$start = function() {
2542 return StopwatchImplementation.prototype.start.bind(this);
2543 }
2522 StopwatchImplementation.prototype.stop = function() { 2544 StopwatchImplementation.prototype.stop = function() {
2523 if (this._start == null) { 2545 if (this._start == null) {
2524 return; 2546 return;
2525 } 2547 }
2526 this._stop = Clock.now(); 2548 this._stop = Clock.now();
2527 } 2549 }
2528 StopwatchImplementation.prototype.elapsed = function() { 2550 StopwatchImplementation.prototype.elapsed = function() {
2529 if (this._start == null) { 2551 if (this._start == null) {
2530 return 0; 2552 return 0;
2531 } 2553 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 DateImplementation.now$ctor = function() { 2746 DateImplementation.now$ctor = function() {
2725 this.timeZone = new TimeZoneImplementation.local$ctor(); 2747 this.timeZone = new TimeZoneImplementation.local$ctor();
2726 this.value = DateImplementation._now(); 2748 this.value = DateImplementation._now();
2727 // Initializers done 2749 // Initializers done
2728 this._asJs(); 2750 this._asJs();
2729 } 2751 }
2730 DateImplementation.now$ctor.prototype = DateImplementation.prototype; 2752 DateImplementation.now$ctor.prototype = DateImplementation.prototype;
2731 DateImplementation.prototype.is$Date = function(){return this;}; 2753 DateImplementation.prototype.is$Date = function(){return this;};
2732 DateImplementation.prototype.is$Comparable = function(){return this;}; 2754 DateImplementation.prototype.is$Comparable = function(){return this;};
2733 DateImplementation.prototype.get$value = function() { return this.value; }; 2755 DateImplementation.prototype.get$value = function() { return this.value; };
2756 DateImplementation.prototype.get$timeZone = function() { return this.timeZone; } ;
2734 DateImplementation.prototype.$eq = function(other) { 2757 DateImplementation.prototype.$eq = function(other) {
2735 if (!((other instanceof DateImplementation))) return false; 2758 if (!((other instanceof DateImplementation))) return false;
2736 return (this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone )); 2759 return (this.value == other.get$value()) && ($eq(this.timeZone, other.get$time Zone()));
2737 } 2760 }
2738 DateImplementation.prototype.compareTo = function(other) { 2761 DateImplementation.prototype.compareTo = function(other) {
2739 return this.value.compareTo(other.value); 2762 return this.value.compareTo(other.value);
2740 } 2763 }
2741 DateImplementation.prototype.get$year = function() { 2764 DateImplementation.prototype.get$year = function() {
2742 return this.isUtc ? this._asJs().getUTCFullYear() : 2765 return this.isUtc ? this._asJs().getUTCFullYear() :
2743 this._asJs().getFullYear(); 2766 this._asJs().getFullYear();
2744 } 2767 }
2745 DateImplementation.prototype.get$month = function() { 2768 DateImplementation.prototype.get$month = function() {
2746 return this.isUtc ? this._asJs().getMonth() + 1 : 2769 return this.isUtc ? this._asJs().getMonth() + 1 :
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 }; 2831 };
2809 // ********** Code for TimeZoneImplementation ************** 2832 // ********** Code for TimeZoneImplementation **************
2810 function TimeZoneImplementation() {} 2833 function TimeZoneImplementation() {}
2811 TimeZoneImplementation.local$ctor = function() { 2834 TimeZoneImplementation.local$ctor = function() {
2812 this.isUtc = false; 2835 this.isUtc = false;
2813 // Initializers done 2836 // Initializers done
2814 } 2837 }
2815 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype; 2838 TimeZoneImplementation.local$ctor.prototype = TimeZoneImplementation.prototype;
2816 TimeZoneImplementation.prototype.$eq = function(other) { 2839 TimeZoneImplementation.prototype.$eq = function(other) {
2817 if (!((other instanceof TimeZoneImplementation))) return false; 2840 if (!((other instanceof TimeZoneImplementation))) return false;
2818 return $eq(this.isUtc, other.isUtc); 2841 return $eq(this.isUtc, other.get$isUtc());
2819 } 2842 }
2820 TimeZoneImplementation.prototype.toString = function() { 2843 TimeZoneImplementation.prototype.toString = function() {
2821 if ($notnull_bool(this.isUtc)) return "TimeZone (UTC)"; 2844 if ($notnull_bool(this.isUtc)) return "TimeZone (UTC)";
2822 return "TimeZone (Local)"; 2845 return "TimeZone (Local)";
2823 } 2846 }
2847 TimeZoneImplementation.prototype.get$isUtc = function() { return this.isUtc; };
2824 TimeZoneImplementation.prototype.toString$0 = function() { 2848 TimeZoneImplementation.prototype.toString$0 = function() {
2825 return this.toString(); 2849 return this.toString();
2826 }; 2850 };
2827 // ********** Code for top level ************** 2851 // ********** Code for top level **************
2828 // ********** Library node ************** 2852 // ********** Library node **************
2829 // ********** Code for process ************** 2853 // ********** Code for process **************
2830 // ********** Code for vm ************** 2854 // ********** Code for vm **************
2831 vm = require('vm'); 2855 vm = require('vm');
2832 // ********** Code for fs ************** 2856 // ********** Code for fs **************
2833 fs = require('fs'); 2857 fs = require('fs');
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
3145 this.extraCharOffset += offset; 3169 this.extraCharOffset += offset;
3146 } 3170 }
3147 ArrayBasedScanner.prototype.appendWhiteSpace = function(next) { 3171 ArrayBasedScanner.prototype.appendWhiteSpace = function(next) {
3148 3172
3149 } 3173 }
3150 ArrayBasedScanner.prototype.appendBeginGroup = function(kind, value) { 3174 ArrayBasedScanner.prototype.appendBeginGroup = function(kind, value) {
3151 var $0; 3175 var $0;
3152 var token = new BeginGroupToken(kind, value, this.tokenStart); 3176 var token = new BeginGroupToken(kind, value, this.tokenStart);
3153 this.tail.next = token; 3177 this.tail.next = token;
3154 this.tail = this.tail.next; 3178 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*/) { 3179 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()); 3180 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3157 } 3181 }
3158 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken()); 3182 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken());
3159 } 3183 }
3160 ArrayBasedScanner.prototype.appendEndGroup = function(kind, value, openKind) { 3184 ArrayBasedScanner.prototype.appendEndGroup = function(kind, value, openKind) {
3161 var $0; 3185 var $0;
3162 var oldTail = this.tail; 3186 var oldTail = this.tail;
3163 this.appendStringToken(kind, value); 3187 this.appendStringToken(kind, value);
3164 if ($notnull_bool(this.groupingStack.isEmpty())) { 3188 if ($notnull_bool(this.groupingStack.isEmpty())) {
3165 if (openKind === 60/*null.LT_TOKEN*/) return; 3189 if (openKind === 60/*null.LT_TOKEN*/) return;
3166 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 3190 $throw(new MalformedInputException(('Unmatched ' + value + '')));
3167 } 3191 }
3168 while (openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.i sEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { 3192 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()); 3193 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3170 } 3194 }
3171 if (this.groupingStack.get$head().kind !== openKind) { 3195 if (this.groupingStack.get$head().get$kind() !== openKind) {
3172 if (openKind === 60/*null.LT_TOKEN*/) return; 3196 if (openKind === 60/*null.LT_TOKEN*/) return;
3173 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 3197 $throw(new MalformedInputException(('Unmatched ' + value + '')));
3174 } 3198 }
3175 this.groupingStack.get$head().endGroup = oldTail.next; 3199 this.groupingStack.get$head().set$endGroup(oldTail.next);
3176 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ()); 3200 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ());
3177 } 3201 }
3178 ArrayBasedScanner.prototype.appendGtGt = function(kind, value) { 3202 ArrayBasedScanner.prototype.appendGtGt = function(kind, value) {
3179 var $0; 3203 var $0;
3180 var oldTail = this.tail; 3204 var oldTail = this.tail;
3181 this.appendStringToken(kind, value); 3205 this.appendStringToken(kind, value);
3182 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3206 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3183 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3207 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()); 3208 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3185 } 3209 }
3186 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3210 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3187 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3211 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3188 this.groupingStack.get$head().endGroup = oldTail.next; 3212 this.groupingStack.get$head().set$endGroup(oldTail.next);
3189 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());
3190 } 3214 }
3191 } 3215 }
3192 ArrayBasedScanner.prototype.appendGtGtGt = function(kind, value) { 3216 ArrayBasedScanner.prototype.appendGtGtGt = function(kind, value) {
3193 var $0; 3217 var $0;
3194 var oldTail = this.tail; 3218 var oldTail = this.tail;
3195 this.appendStringToken(kind, value); 3219 this.appendStringToken(kind, value);
3196 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3220 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3197 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3221 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()); 3222 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3199 } 3223 }
3200 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3224 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3201 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3225 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()); 3226 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3203 } 3227 }
3204 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3228 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3205 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3229 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3206 this.groupingStack.get$head().endGroup = oldTail.next; 3230 this.groupingStack.get$head().set$endGroup(oldTail.next);
3207 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());
3208 } 3232 }
3209 } 3233 }
3210 // ********** Code for ArrayBasedScanner$SourceString ************** 3234 // ********** Code for ArrayBasedScanner$SourceString **************
3211 function ArrayBasedScanner$SourceString() { 3235 function ArrayBasedScanner$SourceString() {
3212 this.groupingStack = const$14/*const EmptyLink()*/ 3236 this.groupingStack = const$14/*const EmptyLink()*/
3213 this.extraCharOffset = 0; 3237 this.extraCharOffset = 0;
3214 this.tokenStart = -1; 3238 this.tokenStart = -1;
3215 this.byteOffset = -1; 3239 this.byteOffset = -1;
3216 this.tokens = new Token(0/*null.EOF_TOKEN*/, -1); 3240 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; 3279 this.extraCharOffset += offset;
3256 } 3280 }
3257 ArrayBasedScanner$SourceString.prototype.appendWhiteSpace = function(next) { 3281 ArrayBasedScanner$SourceString.prototype.appendWhiteSpace = function(next) {
3258 3282
3259 } 3283 }
3260 ArrayBasedScanner$SourceString.prototype.appendBeginGroup = function(kind, value ) { 3284 ArrayBasedScanner$SourceString.prototype.appendBeginGroup = function(kind, value ) {
3261 var $0; 3285 var $0;
3262 var token = new BeginGroupToken(kind, value, this.tokenStart); 3286 var token = new BeginGroupToken(kind, value, this.tokenStart);
3263 this.tail.next = token; 3287 this.tail.next = token;
3264 this.tail = this.tail.next; 3288 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*/) { 3289 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()); 3290 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3267 } 3291 }
3268 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken()); 3292 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken());
3269 } 3293 }
3270 ArrayBasedScanner$SourceString.prototype.appendEndGroup = function(kind, value, openKind) { 3294 ArrayBasedScanner$SourceString.prototype.appendEndGroup = function(kind, value, openKind) {
3271 var $0; 3295 var $0;
3272 var oldTail = this.tail; 3296 var oldTail = this.tail;
3273 this.appendStringToken(kind, value); 3297 this.appendStringToken(kind, value);
3274 if ($notnull_bool(this.groupingStack.isEmpty())) { 3298 if ($notnull_bool(this.groupingStack.isEmpty())) {
3275 if (openKind === 60/*null.LT_TOKEN*/) return; 3299 if (openKind === 60/*null.LT_TOKEN*/) return;
3276 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 3300 $throw(new MalformedInputException(('Unmatched ' + value + '')));
3277 } 3301 }
3278 while (openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.i sEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { 3302 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()); 3303 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3280 } 3304 }
3281 if (this.groupingStack.get$head().kind !== openKind) { 3305 if (this.groupingStack.get$head().get$kind() !== openKind) {
3282 if (openKind === 60/*null.LT_TOKEN*/) return; 3306 if (openKind === 60/*null.LT_TOKEN*/) return;
3283 $throw(new MalformedInputException(('Unmatched ' + value + ''))); 3307 $throw(new MalformedInputException(('Unmatched ' + value + '')));
3284 } 3308 }
3285 this.groupingStack.get$head().endGroup = oldTail.next; 3309 this.groupingStack.get$head().set$endGroup(oldTail.next);
3286 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ()); 3310 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ());
3287 } 3311 }
3288 ArrayBasedScanner$SourceString.prototype.appendGtGt = function(kind, value) { 3312 ArrayBasedScanner$SourceString.prototype.appendGtGt = function(kind, value) {
3289 var $0; 3313 var $0;
3290 var oldTail = this.tail; 3314 var oldTail = this.tail;
3291 this.appendStringToken(kind, value); 3315 this.appendStringToken(kind, value);
3292 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3316 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3293 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3317 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()); 3318 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3295 } 3319 }
3296 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3320 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3297 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3321 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3298 this.groupingStack.get$head().endGroup = oldTail.next; 3322 this.groupingStack.get$head().set$endGroup(oldTail.next);
3299 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());
3300 } 3324 }
3301 } 3325 }
3302 ArrayBasedScanner$SourceString.prototype.appendGtGtGt = function(kind, value) { 3326 ArrayBasedScanner$SourceString.prototype.appendGtGtGt = function(kind, value) {
3303 var $0; 3327 var $0;
3304 var oldTail = this.tail; 3328 var oldTail = this.tail;
3305 this.appendStringToken(kind, value); 3329 this.appendStringToken(kind, value);
3306 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3330 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3307 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3331 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()); 3332 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3309 } 3333 }
3310 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3334 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3311 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3335 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()); 3336 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
3313 } 3337 }
3314 if ($notnull_bool(this.groupingStack.isEmpty())) return; 3338 if ($notnull_bool(this.groupingStack.isEmpty())) return;
3315 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) { 3339 if ($notnull_bool($eq(this.groupingStack.get$head().get$kind(), 60/*null.LT_TO KEN*/))) {
3316 this.groupingStack.get$head().endGroup = oldTail.next; 3340 this.groupingStack.get$head().set$endGroup(oldTail.next);
3317 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());
3318 } 3342 }
3319 } 3343 }
3320 ArrayBasedScanner$SourceString.prototype.tokenize = function() { 3344 ArrayBasedScanner$SourceString.prototype.tokenize = function() {
3321 var next = this.advance(); 3345 var next = this.advance();
3322 while (next != -1) { 3346 while (next != -1) {
3323 next = this.bigSwitch(next); 3347 next = this.bigSwitch(next);
3324 } 3348 }
3325 this.appendEofToken(); 3349 this.appendEofToken();
3326 return this.firstToken(); 3350 return this.firstToken();
(...skipping 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after
5942 } 5966 }
5943 PartialParser.prototype.isIdentifier = function(token) { 5967 PartialParser.prototype.isIdentifier = function(token) {
5944 var kind = token.kind; 5968 var kind = token.kind;
5945 switch (true) { 5969 switch (true) {
5946 case kind === 97/*null.IDENTIFIER_TOKEN*/: 5970 case kind === 97/*null.IDENTIFIER_TOKEN*/:
5947 5971
5948 return true; 5972 return true;
5949 5973
5950 case kind === 107/*null.KEYWORD_TOKEN*/: 5974 case kind === 107/*null.KEYWORD_TOKEN*/:
5951 5975
5952 return token.get$value().isPseudo; 5976 return $assert_bool(token.get$value().get$isPseudo());
5953 5977
5954 default: 5978 default:
5955 5979
5956 return false; 5980 return false;
5957 5981
5958 } 5982 }
5959 } 5983 }
5960 PartialParser.prototype.parseSupertypesClauseOpt = function(token) { 5984 PartialParser.prototype.parseSupertypesClauseOpt = function(token) {
5961 if ($notnull_bool(this.optional('extends', token))) { 5985 if ($notnull_bool(this.optional('extends', token))) {
5962 do { 5986 do {
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after
7622 this.tail = this.tail.next; 7646 this.tail = this.tail.next;
7623 } 7647 }
7624 // ********** Code for SubstringWrapper ************** 7648 // ********** Code for SubstringWrapper **************
7625 function SubstringWrapper(internalString, begin, end) { 7649 function SubstringWrapper(internalString, begin, end) {
7626 this.internalString = internalString; 7650 this.internalString = internalString;
7627 this.begin = begin; 7651 this.begin = begin;
7628 this.end = end; 7652 this.end = end;
7629 // Initializers done 7653 // Initializers done
7630 } 7654 }
7631 SubstringWrapper.prototype.is$SourceString = function(){return this;}; 7655 SubstringWrapper.prototype.is$SourceString = function(){return this;};
7656 SubstringWrapper.prototype.get$end = function() { return this.end; };
7632 SubstringWrapper.prototype.hashCode = function() { 7657 SubstringWrapper.prototype.hashCode = function() {
7633 return this.toString().hashCode(); 7658 return this.toString().hashCode();
7634 } 7659 }
7635 SubstringWrapper.prototype.$eq = function(other) { 7660 SubstringWrapper.prototype.$eq = function(other) {
7636 return !!(other && other.is$SourceString) && this.toString() == other.toString $0(); 7661 return !!(other && other.is$SourceString) && this.toString() == other.toString $0();
7637 } 7662 }
7638 SubstringWrapper.prototype.printOn = function(sb) { 7663 SubstringWrapper.prototype.printOn = function(sb) {
7639 sb.add(this); 7664 sb.add(this);
7640 } 7665 }
7641 SubstringWrapper.prototype.toString = function() { 7666 SubstringWrapper.prototype.toString = function() {
(...skipping 11 matching lines...) Expand all
7653 SubstringWrapper.prototype.toString$0 = function() { 7678 SubstringWrapper.prototype.toString$0 = function() {
7654 return this.toString(); 7679 return this.toString();
7655 }; 7680 };
7656 // ********** Code for Token ************** 7681 // ********** Code for Token **************
7657 function Token(kind, charOffset) { 7682 function Token(kind, charOffset) {
7658 this.kind = kind; 7683 this.kind = kind;
7659 this.charOffset = charOffset; 7684 this.charOffset = charOffset;
7660 // Initializers done 7685 // Initializers done
7661 } 7686 }
7662 Token.prototype.is$Token = function(){return this;}; 7687 Token.prototype.is$Token = function(){return this;};
7688 Token.prototype.get$kind = function() { return this.kind; };
7663 Token.prototype.get$charOffset = function() { return this.charOffset; }; 7689 Token.prototype.get$charOffset = function() { return this.charOffset; };
7664 Token.prototype.get$value = function() { 7690 Token.prototype.get$value = function() {
7665 return const$234/*const SourceString('EOF')*/; 7691 return const$234/*const SourceString('EOF')*/;
7666 } 7692 }
7667 Token.prototype.get$stringValue = function() { 7693 Token.prototype.get$stringValue = function() {
7668 return 'EOF'; 7694 return 'EOF';
7669 } 7695 }
7670 Token.prototype.toString = function() { 7696 Token.prototype.toString = function() {
7671 return Strings.String$fromCharCodes$factory([this.kind]); 7697 return Strings.String$fromCharCodes$factory([this.kind]);
7672 } 7698 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
7745 StringWrapper.prototype.toString$0 = function() { 7771 StringWrapper.prototype.toString$0 = function() {
7746 return this.toString(); 7772 return this.toString();
7747 }; 7773 };
7748 // ********** Code for BeginGroupToken ************** 7774 // ********** Code for BeginGroupToken **************
7749 function BeginGroupToken(kind, value, charOffset) { 7775 function BeginGroupToken(kind, value, charOffset) {
7750 StringToken.call(this, kind, value, charOffset); 7776 StringToken.call(this, kind, value, charOffset);
7751 // Initializers done 7777 // Initializers done
7752 } 7778 }
7753 $inherits(BeginGroupToken, StringToken); 7779 $inherits(BeginGroupToken, StringToken);
7754 BeginGroupToken.prototype.is$BeginGroupToken = function(){return this;}; 7780 BeginGroupToken.prototype.is$BeginGroupToken = function(){return this;};
7781 BeginGroupToken.prototype.get$endGroup = function() { return this.endGroup; };
7782 BeginGroupToken.prototype.set$endGroup = function(value) { return this.endGroup = value; };
7755 // ********** Code for Keyword ************** 7783 // ********** Code for Keyword **************
7756 function Keyword(syntax, isPseudo) { 7784 function Keyword(syntax, isPseudo) {
7757 this.syntax = syntax; 7785 this.syntax = syntax;
7758 this.isPseudo = isPseudo; 7786 this.isPseudo = isPseudo;
7759 // Initializers done 7787 // Initializers done
7760 } 7788 }
7761 Keyword.prototype.is$SourceString = function(){return this;}; 7789 Keyword.prototype.is$SourceString = function(){return this;};
7790 Keyword.prototype.get$syntax = function() { return this.syntax; };
7791 Keyword.prototype.get$isPseudo = function() { return this.isPseudo; };
7762 Keyword.get$keywords = function() { 7792 Keyword.get$keywords = function() {
7763 if (Keyword._keywords == null) { 7793 if (Keyword._keywords == null) {
7764 Keyword._keywords = Keyword.computeKeywordMap(); 7794 Keyword._keywords = Keyword.computeKeywordMap();
7765 } 7795 }
7766 return Keyword._keywords; 7796 return Keyword._keywords;
7767 } 7797 }
7768 Keyword.computeKeywordMap = function() { 7798 Keyword.computeKeywordMap = function() {
7769 var result = new LinkedHashMapImplementation(); 7799 var result = new LinkedHashMapImplementation();
7770 for (var $i0 = const$232/*Keyword.values*/.iterator(); $i0.hasNext(); ) { 7800 for (var $i0 = const$232/*Keyword.values*/.iterator(); $i0.hasNext(); ) {
7771 var keyword = $i0.next(); 7801 var keyword = $i0.next();
(...skipping 26 matching lines...) Expand all
7798 return this.toString(); 7828 return this.toString();
7799 }; 7829 };
7800 // ********** Code for KeywordState ************** 7830 // ********** Code for KeywordState **************
7801 function KeywordState() {} 7831 function KeywordState() {}
7802 KeywordState.prototype.is$KeywordState = function(){return this;}; 7832 KeywordState.prototype.is$KeywordState = function(){return this;};
7803 KeywordState.get$KEYWORD_STATE = function() { 7833 KeywordState.get$KEYWORD_STATE = function() {
7804 if (KeywordState._KEYWORD_STATE == null) { 7834 if (KeywordState._KEYWORD_STATE == null) {
7805 var strings = new ListFactory(const$232/*Keyword.values*/.get$length()); 7835 var strings = new ListFactory(const$232/*Keyword.values*/.get$length());
7806 for (var i = 0; 7836 for (var i = 0;
7807 i < const$232/*Keyword.values*/.get$length(); i++) { 7837 i < const$232/*Keyword.values*/.get$length(); i++) {
7808 strings.$setindex(i, const$232/*Keyword.values*/[i].syntax); 7838 strings.$setindex(i, const$232/*Keyword.values*/[i].get$syntax());
7809 } 7839 }
7810 strings.sort((function (a, b) { 7840 strings.sort((function (a, b) {
7811 return a.compareTo$1(b); 7841 return a.compareTo$1(b);
7812 }) 7842 })
7813 ); 7843 );
7814 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin gs, 0, strings.length); 7844 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin gs, 0, strings.length);
7815 } 7845 }
7816 return KeywordState._KEYWORD_STATE; 7846 return KeywordState._KEYWORD_STATE;
7817 } 7847 }
7818 KeywordState.computeKeywordStateTable = function(start, strings, offset, length) { 7848 KeywordState.computeKeywordStateTable = function(start, strings, offset, length) {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
8098 }; 8128 };
8099 NodeList.prototype.getEndToken$0 = function() { 8129 NodeList.prototype.getEndToken$0 = function() {
8100 return this.getEndToken(); 8130 return this.getEndToken();
8101 }; 8131 };
8102 // ********** Code for Block ************** 8132 // ********** Code for Block **************
8103 function Block(statements) { 8133 function Block(statements) {
8104 this.statements = statements; 8134 this.statements = statements;
8105 // Initializers done 8135 // Initializers done
8106 } 8136 }
8107 $inherits(Block, Statement); 8137 $inherits(Block, Statement);
8138 Block.prototype.get$statements = function() { return this.statements; };
8108 Block.prototype.accept = function(visitor) { 8139 Block.prototype.accept = function(visitor) {
8109 return visitor.visitBlock(this); 8140 return visitor.visitBlock(this);
8110 } 8141 }
8111 Block.prototype.getBeginToken = function() { 8142 Block.prototype.getBeginToken = function() {
8112 return this.statements.getBeginToken(); 8143 return this.statements.getBeginToken();
8113 } 8144 }
8114 Block.prototype.getEndToken = function() { 8145 Block.prototype.getEndToken = function() {
8115 return this.statements.getEndToken(); 8146 return this.statements.getEndToken();
8116 } 8147 }
8117 Block.prototype.accept$1 = function($0) { 8148 Block.prototype.accept$1 = function($0) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
8158 // ********** Code for For ************** 8189 // ********** Code for For **************
8159 function For(initializer, condition, update, body, forToken) { 8190 function For(initializer, condition, update, body, forToken) {
8160 this.initializer = initializer; 8191 this.initializer = initializer;
8161 this.condition = condition; 8192 this.condition = condition;
8162 this.update = update; 8193 this.update = update;
8163 this.body = body; 8194 this.body = body;
8164 this.forToken = forToken; 8195 this.forToken = forToken;
8165 // Initializers done 8196 // Initializers done
8166 } 8197 }
8167 $inherits(For, Statement); 8198 $inherits(For, Statement);
8199 For.prototype.get$body = function() { return this.body; };
8168 For.prototype.accept = function(visitor) { 8200 For.prototype.accept = function(visitor) {
8169 return visitor.visitFor(this); 8201 return visitor.visitFor(this);
8170 } 8202 }
8171 For.prototype.getBeginToken = function() { 8203 For.prototype.getBeginToken = function() {
8172 return this.forToken; 8204 return this.forToken;
8173 } 8205 }
8174 For.prototype.getEndToken = function() { 8206 For.prototype.getEndToken = function() {
8175 return this.body.getEndToken(); 8207 return this.body.getEndToken();
8176 } 8208 }
8177 For.prototype.accept$1 = function($0) { 8209 For.prototype.accept$1 = function($0) {
(...skipping 10 matching lines...) Expand all
8188 this.name = name; 8220 this.name = name;
8189 this.parameters = parameters; 8221 this.parameters = parameters;
8190 this.body = body; 8222 this.body = body;
8191 this.returnType = returnType; 8223 this.returnType = returnType;
8192 // Initializers done 8224 // Initializers done
8193 } 8225 }
8194 $inherits(FunctionExpression, Expression); 8226 $inherits(FunctionExpression, Expression);
8195 FunctionExpression.prototype.is$FunctionExpression = function(){return this;}; 8227 FunctionExpression.prototype.is$FunctionExpression = function(){return this;};
8196 FunctionExpression.prototype.get$name = function() { return this.name; }; 8228 FunctionExpression.prototype.get$name = function() { return this.name; };
8197 FunctionExpression.prototype.get$parameters = function() { return this.parameter s; }; 8229 FunctionExpression.prototype.get$parameters = function() { return this.parameter s; };
8230 FunctionExpression.prototype.get$body = function() { return this.body; };
8198 FunctionExpression.prototype.get$returnType = function() { return this.returnTyp e; }; 8231 FunctionExpression.prototype.get$returnType = function() { return this.returnTyp e; };
8199 FunctionExpression.prototype.accept = function(visitor) { 8232 FunctionExpression.prototype.accept = function(visitor) {
8200 return visitor.visitFunctionExpression(this); 8233 return visitor.visitFunctionExpression(this);
8201 } 8234 }
8202 FunctionExpression.prototype.getBeginToken = function() { 8235 FunctionExpression.prototype.getBeginToken = function() {
8203 return firstBeginToken(this.returnType, this.name); 8236 return firstBeginToken(this.returnType, this.name);
8204 } 8237 }
8205 FunctionExpression.prototype.getEndToken = function() { 8238 FunctionExpression.prototype.getEndToken = function() {
8206 return this.body.getEndToken(); 8239 return this.body.getEndToken();
8207 } 8240 }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
8503 // ********** Code for VariableDefinitions ************** 8536 // ********** Code for VariableDefinitions **************
8504 function VariableDefinitions(type, modifiers, definitions, endToken) { 8537 function VariableDefinitions(type, modifiers, definitions, endToken) {
8505 this.type = type; 8538 this.type = type;
8506 this.modifiers = modifiers; 8539 this.modifiers = modifiers;
8507 this.definitions = definitions; 8540 this.definitions = definitions;
8508 this.endToken = endToken; 8541 this.endToken = endToken;
8509 // Initializers done 8542 // Initializers done
8510 } 8543 }
8511 $inherits(VariableDefinitions, Statement); 8544 $inherits(VariableDefinitions, Statement);
8512 VariableDefinitions.prototype.is$VariableDefinitions = function(){return this;}; 8545 VariableDefinitions.prototype.is$VariableDefinitions = function(){return this;};
8546 VariableDefinitions.prototype.get$type = function() { return this.type; };
8513 VariableDefinitions.prototype.accept = function(visitor) { 8547 VariableDefinitions.prototype.accept = function(visitor) {
8514 return visitor.visitVariableDefinitions(this); 8548 return visitor.visitVariableDefinitions(this);
8515 } 8549 }
8516 VariableDefinitions.prototype.getBeginToken = function() { 8550 VariableDefinitions.prototype.getBeginToken = function() {
8517 return firstBeginToken(this.type, this.definitions); 8551 return firstBeginToken(this.type, this.definitions);
8518 } 8552 }
8519 VariableDefinitions.prototype.getEndToken = function() { 8553 VariableDefinitions.prototype.getEndToken = function() {
8520 return this.endToken; 8554 return this.endToken;
8521 } 8555 }
8522 VariableDefinitions.prototype.accept$1 = function($0) { 8556 VariableDefinitions.prototype.accept$1 = function($0) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
8678 function firstBeginToken(first, second) { 8712 function firstBeginToken(first, second) {
8679 var $0; 8713 var $0;
8680 return (($0 = (first != null) ? first.getBeginToken() : second.getBeginToken() ) && $0.is$Token()); 8714 return (($0 = (first != null) ? first.getBeginToken() : second.getBeginToken() ) && $0.is$Token());
8681 } 8715 }
8682 // ********** Library elements ************** 8716 // ********** Library elements **************
8683 // ********** Code for ElementKind ************** 8717 // ********** Code for ElementKind **************
8684 function ElementKind(id) { 8718 function ElementKind(id) {
8685 this.id = id; 8719 this.id = id;
8686 // Initializers done 8720 // Initializers done
8687 } 8721 }
8722 ElementKind.prototype.get$id = function() { return this.id; };
8688 // ********** Code for Element ************** 8723 // ********** Code for Element **************
8689 function Element(name, kind, enclosingElement) { 8724 function Element(name, kind, enclosingElement) {
8690 this.name = name; 8725 this.name = name;
8691 this.kind = kind; 8726 this.kind = kind;
8692 this.enclosingElement = enclosingElement; 8727 this.enclosingElement = enclosingElement;
8693 // Initializers done 8728 // Initializers done
8694 } 8729 }
8695 Element.prototype.is$Element = function(){return this;}; 8730 Element.prototype.is$Element = function(){return this;};
8696 Element.prototype.get$name = function() { return this.name; }; 8731 Element.prototype.get$name = function() { return this.name; };
8732 Element.prototype.get$kind = function() { return this.kind; };
8697 Element.prototype.hashCode = function() { 8733 Element.prototype.hashCode = function() {
8698 return this.name.hashCode(); 8734 return this.name.hashCode();
8699 } 8735 }
8700 Element.prototype.computeType$2 = function($0, $1) { 8736 Element.prototype.computeType$2 = function($0, $1) {
8701 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); 8737 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types()));
8702 }; 8738 };
8703 Element.prototype.hashCode$0 = function() { 8739 Element.prototype.hashCode$0 = function() {
8704 return this.hashCode(); 8740 return this.hashCode();
8705 }; 8741 };
8706 // ********** Code for VariableElement ************** 8742 // ********** Code for VariableElement **************
8707 function VariableElement(node, typeAnnotation, name, enclosingElement) { 8743 function VariableElement(node, typeAnnotation, name, enclosingElement) {
8708 this.node = node; 8744 this.node = node;
8709 this.typeAnnotation = typeAnnotation; 8745 this.typeAnnotation = typeAnnotation;
8710 Element.call(this, name, const$260, enclosingElement); 8746 Element.call(this, name, const$260, enclosingElement);
8711 // Initializers done 8747 // Initializers done
8712 } 8748 }
8713 $inherits(VariableElement, Element); 8749 $inherits(VariableElement, Element);
8750 VariableElement.prototype.get$type = function() { return this.type; };
8751 VariableElement.prototype.set$type = function(value) { return this.type = value; };
8714 VariableElement.prototype.parseNode = function(canceler, logger) { 8752 VariableElement.prototype.parseNode = function(canceler, logger) {
8715 return this.node; 8753 return this.node;
8716 } 8754 }
8717 VariableElement.prototype.computeType = function(compiler, types) { 8755 VariableElement.prototype.computeType = function(compiler, types) {
8718 return getType(this.typeAnnotation, types); 8756 return getType(this.typeAnnotation, types);
8719 } 8757 }
8720 VariableElement.prototype.computeType$2 = function($0, $1) { 8758 VariableElement.prototype.computeType$2 = function($0, $1) {
8721 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); 8759 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types()));
8722 }; 8760 };
8723 // ********** Code for ForeignElement ************** 8761 // ********** Code for ForeignElement **************
8724 function ForeignElement(name) { 8762 function ForeignElement(name) {
8725 Element.call(this, name, const$242, null); 8763 Element.call(this, name, const$242, null);
8726 // Initializers done 8764 // Initializers done
8727 } 8765 }
8728 $inherits(ForeignElement, Element); 8766 $inherits(ForeignElement, Element);
8729 ForeignElement.prototype.computeType = function(compiler, types) { 8767 ForeignElement.prototype.computeType = function(compiler, types) {
8730 return types.dynamicType; 8768 return types.dynamicType;
8731 } 8769 }
8732 ForeignElement.prototype.computeType$2 = function($0, $1) { 8770 ForeignElement.prototype.computeType$2 = function($0, $1) {
8733 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); 8771 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types()));
8734 }; 8772 };
8735 // ********** Code for FunctionElement ************** 8773 // ********** Code for FunctionElement **************
8736 function FunctionElement(name) { 8774 function FunctionElement(name) {
8737 Element.call(this, name, const$239, null); 8775 Element.call(this, name, const$239, null);
8738 // Initializers done 8776 // Initializers done
8739 } 8777 }
8740 $inherits(FunctionElement, Element); 8778 $inherits(FunctionElement, Element);
8779 FunctionElement.prototype.get$type = function() { return this.type; };
8780 FunctionElement.prototype.set$type = function(value) { return this.type = value; };
8741 FunctionElement.prototype.computeType = function(compiler, types) { 8781 FunctionElement.prototype.computeType = function(compiler, types) {
8742 var $0; 8782 var $0;
8743 if (this.type != null) return (($0 = this.type) && $0.is$FunctionType()); 8783 if (this.type != null) return (($0 = this.type) && $0.is$FunctionType());
8744 var node = (($0 = this.parseNode(compiler, compiler)) && $0.is$FunctionExpress ion()); 8784 var node = (($0 = this.parseNode(compiler, compiler)) && $0.is$FunctionExpress ion());
8745 var returnType = getType(node.returnType, types); 8785 var returnType = getType(node.returnType, types);
8746 if (returnType == null) compiler.cancel(('unknown type ' + returnType + '')); 8786 if (returnType == null) compiler.cancel(('unknown type ' + returnType + ''));
8747 var parameterTypes = new LinkBuilderImplementation(); 8787 var parameterTypes = new LinkBuilderImplementation();
8748 for (var link = node.parameters.nodes; 8788 for (var link = node.parameters.nodes;
8749 !$notnull_bool(link.isEmpty$0()); link = link.get$tail()) { 8789 !$notnull_bool(link.isEmpty$0()); link = link.get$tail()) {
8750 var parameter = (($0 = link.get$head()) && $0.is$VariableDefinitions()); 8790 var parameter = (($0 = link.get$head()) && $0.is$VariableDefinitions());
8751 parameterTypes.addLast(getType(parameter.type, types)); 8791 parameterTypes.addLast(getType(parameter.type, types));
8752 } 8792 }
8753 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0 .is$Link$Type())); 8793 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0 .is$Link$Type()));
8754 return (($0 = this.type) && $0.is$FunctionType()); 8794 return (($0 = this.type) && $0.is$FunctionType());
8755 } 8795 }
8756 FunctionElement.prototype.computeType$2 = FunctionElement.prototype.computeType; 8796 FunctionElement.prototype.computeType$2 = FunctionElement.prototype.computeType;
8757 // ********** Code for ClassElement ************** 8797 // ********** Code for ClassElement **************
8758 function ClassElement(name) { 8798 function ClassElement(name) {
8759 this.interfaces = const$14/*const EmptyLink()*/ 8799 this.interfaces = const$14/*const EmptyLink()*/
8760 this.isResolved = false 8800 this.isResolved = false
8761 Element.call(this, name, const$237, null); 8801 Element.call(this, name, const$237, null);
8762 // Initializers done 8802 // Initializers done
8763 } 8803 }
8764 $inherits(ClassElement, Element); 8804 $inherits(ClassElement, Element);
8765 ClassElement.prototype.is$ClassElement = function(){return this;}; 8805 ClassElement.prototype.is$ClassElement = function(){return this;};
8806 ClassElement.prototype.get$type = function() { return this.type; };
8807 ClassElement.prototype.set$type = function(value) { return this.type = value; };
8766 ClassElement.prototype.get$interfaces = function() { return this.interfaces; }; 8808 ClassElement.prototype.get$interfaces = function() { return this.interfaces; };
8767 ClassElement.prototype.set$interfaces = function(value) { return this.interfaces = value; }; 8809 ClassElement.prototype.set$interfaces = function(value) { return this.interfaces = value; };
8768 ClassElement.prototype.computeType = function(compiler, types) { 8810 ClassElement.prototype.computeType = function(compiler, types) {
8769 if (this.type == null) { 8811 if (this.type == null) {
8770 this.type = new SimpleType(this.name, this); 8812 this.type = new SimpleType(this.name, this);
8771 } 8813 }
8772 return this.type; 8814 return this.type;
8773 } 8815 }
8774 ClassElement.prototype.resolve = function(compiler) { 8816 ClassElement.prototype.resolve = function(compiler) {
8775 if ($notnull_bool(this.isResolved)) return; 8817 if ($notnull_bool(this.isResolved)) return;
8776 compiler.resolveType(this); 8818 compiler.resolveType(this);
8777 this.isResolved = true; 8819 this.isResolved = true;
8778 } 8820 }
8779 ClassElement.prototype.computeType$2 = ClassElement.prototype.computeType; 8821 ClassElement.prototype.computeType$2 = ClassElement.prototype.computeType;
8780 ClassElement.prototype.resolve$1 = function($0) { 8822 ClassElement.prototype.resolve$1 = function($0) {
8781 return this.resolve(($0 && $0.is$Compiler())); 8823 return this.resolve(($0 && $0.is$Compiler()));
8782 }; 8824 };
8783 // ********** Code for top level ************** 8825 // ********** Code for top level **************
8784 function getType(annotation, types) { 8826 function getType(annotation, types) {
8785 var $0; 8827 var $0;
8786 if (annotation == null || annotation.typeName == null) { 8828 if (annotation == null || annotation.typeName == null) {
8787 return (($0 = types.dynamicType) && $0.is$Type()); 8829 return (($0 = types.get$dynamicType()) && $0.is$Type());
8788 } 8830 }
8789 return (($0 = types.lookup$1(annotation.typeName.get$source())) && $0.is$Type( )); 8831 return (($0 = types.lookup$1(annotation.typeName.get$source())) && $0.is$Type( ));
8790 } 8832 }
8791 // ********** Library ssa ************** 8833 // ********** Library ssa **************
8792 // ********** Code for SsaBuilderTask ************** 8834 // ********** Code for SsaBuilderTask **************
8793 function SsaBuilderTask(compiler) { 8835 function SsaBuilderTask(compiler) {
8794 CompilerTask.call(this, compiler); 8836 CompilerTask.call(this, compiler);
8795 // Initializers done 8837 // Initializers done
8796 } 8838 }
8797 $inherits(SsaBuilderTask, CompilerTask); 8839 $inherits(SsaBuilderTask, CompilerTask);
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
9702 this.dominator = null 9744 this.dominator = null
9703 this.id = id; 9745 this.id = id;
9704 this.predecessors = []; 9746 this.predecessors = [];
9705 this.successors = const$13/*const []*/; 9747 this.successors = const$13/*const []*/;
9706 this.dominatedBlocks = []; 9748 this.dominatedBlocks = [];
9707 // Initializers done 9749 // Initializers done
9708 } 9750 }
9709 HBasicBlock.withId$ctor.prototype = HBasicBlock.prototype; 9751 HBasicBlock.withId$ctor.prototype = HBasicBlock.prototype;
9710 $inherits(HBasicBlock, HInstructionList); 9752 $inherits(HBasicBlock, HInstructionList);
9711 HBasicBlock.prototype.is$HBasicBlock = function(){return this;}; 9753 HBasicBlock.prototype.is$HBasicBlock = function(){return this;};
9754 HBasicBlock.prototype.get$id = function() { return this.id; };
9755 HBasicBlock.prototype.set$id = function(value) { return this.id = value; };
9712 HBasicBlock.prototype.isNew = function() { 9756 HBasicBlock.prototype.isNew = function() {
9713 return this.status == 0/*HBasicBlock.STATUS_NEW*/; 9757 return this.status == 0/*HBasicBlock.STATUS_NEW*/;
9714 } 9758 }
9715 HBasicBlock.prototype.isOpen = function() { 9759 HBasicBlock.prototype.isOpen = function() {
9716 return this.status == 1/*HBasicBlock.STATUS_OPEN*/; 9760 return this.status == 1/*HBasicBlock.STATUS_OPEN*/;
9717 } 9761 }
9718 HBasicBlock.prototype.isClosed = function() { 9762 HBasicBlock.prototype.isClosed = function() {
9719 return this.status == 2/*HBasicBlock.STATUS_CLOSED*/; 9763 return this.status == 2/*HBasicBlock.STATUS_CLOSED*/;
9720 } 9764 }
9765 HBasicBlock.prototype.get$isClosed = function() {
9766 return HBasicBlock.prototype.isClosed.bind(this);
9767 }
9721 HBasicBlock.prototype.open = function() { 9768 HBasicBlock.prototype.open = function() {
9722 $assert(this.isNew(), "isNew()", "nodes.dart", 256, 12); 9769 $assert(this.isNew(), "isNew()", "nodes.dart", 256, 12);
9723 this.status = 1/*HBasicBlock.STATUS_OPEN*/; 9770 this.status = 1/*HBasicBlock.STATUS_OPEN*/;
9724 } 9771 }
9725 HBasicBlock.prototype.close = function(end) { 9772 HBasicBlock.prototype.close = function(end) {
9726 $assert(this.isOpen(), "isOpen()", "nodes.dart", 261, 12); 9773 $assert(this.isOpen(), "isOpen()", "nodes.dart", 261, 12);
9727 this.addAfter(this.last, end); 9774 this.addAfter(this.last, end);
9728 this.status = 2/*HBasicBlock.STATUS_CLOSED*/; 9775 this.status = 2/*HBasicBlock.STATUS_CLOSED*/;
9729 } 9776 }
9730 HBasicBlock.prototype.assignInstructionIds = function(id) { 9777 HBasicBlock.prototype.assignInstructionIds = function(id) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
9777 } 9824 }
9778 } 9825 }
9779 HBasicBlock.prototype.isExitBlock = function() { 9826 HBasicBlock.prototype.isExitBlock = function() {
9780 return this.first === this.last && (this.first instanceof HExit); 9827 return this.first === this.last && (this.first instanceof HExit);
9781 } 9828 }
9782 HBasicBlock.prototype.addDominatedBlock = function(block) { 9829 HBasicBlock.prototype.addDominatedBlock = function(block) {
9783 $assert(this.isClosed(), "isClosed()", "nodes.dart", 340, 12); 9830 $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); 9831 $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); 9832 $assert(this.dominatedBlocks.indexOf(block) < 0, "dominatedBlocks.indexOf(bloc k) < 0", "nodes.dart", 342, 12);
9786 var index = this.dominatedBlocks.length; 9833 var index = this.dominatedBlocks.length;
9787 while (index > 0 && this.dominatedBlocks.$index(index - 1).id > block.id) { 9834 while (index > 0 && this.dominatedBlocks.$index(index - 1).get$id() > block.id ) {
9788 index--; 9835 index--;
9789 } 9836 }
9790 if (index == this.dominatedBlocks.length) { 9837 if (index == this.dominatedBlocks.length) {
9791 this.dominatedBlocks.add(block); 9838 this.dominatedBlocks.add(block);
9792 } 9839 }
9793 else { 9840 else {
9794 this.dominatedBlocks.insertRange(index, 1, block); 9841 this.dominatedBlocks.insertRange(index, 1, block);
9795 } 9842 }
9796 $assert(block.dominator == null, "block.dominator === null", "nodes.dart", 355 , 12); 9843 $assert(block.dominator == null, "block.dominator === null", "nodes.dart", 355 , 12);
9797 block.dominator = this; 9844 block.dominator = this;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
9853 function HInstruction(inputs) { 9900 function HInstruction(inputs) {
9854 this._usedBy = null 9901 this._usedBy = null
9855 this.previous = null 9902 this.previous = null
9856 this.next = null 9903 this.next = null
9857 this.flags = 0 9904 this.flags = 0
9858 this.inputs = inputs; 9905 this.inputs = inputs;
9859 // Initializers done 9906 // Initializers done
9860 this.prepareGvn(); 9907 this.prepareGvn();
9861 } 9908 }
9862 HInstruction.prototype.is$HInstruction = function(){return this;}; 9909 HInstruction.prototype.is$HInstruction = function(){return this;};
9910 HInstruction.prototype.get$id = function() { return this.id; };
9911 HInstruction.prototype.set$id = function(value) { return this.id = value; };
9912 HInstruction.prototype.get$inputs = function() { return this.inputs; };
9913 HInstruction.prototype.get$previous = function() { return this.previous; };
9914 HInstruction.prototype.set$previous = function(value) { return this.previous = v alue; };
9863 HInstruction.prototype.getFlag = function(position) { 9915 HInstruction.prototype.getFlag = function(position) {
9864 return (this.flags & (1 << position)) != 0; 9916 return (this.flags & (1 << position)) != 0;
9865 } 9917 }
9866 HInstruction.prototype.setFlag = function(position) { 9918 HInstruction.prototype.setFlag = function(position) {
9867 this.flags |= (1 << position); 9919 this.flags |= (1 << position);
9868 } 9920 }
9869 HInstruction.prototype.getChangesFlags = function() { 9921 HInstruction.prototype.getChangesFlags = function() {
9870 return this.flags & (1)/*((1 << FLAG_CHANGES_COUNT) - 1)*/; 9922 return this.flags & (1)/*((1 << FLAG_CHANGES_COUNT) - 1)*/;
9871 } 9923 }
9872 HInstruction.prototype.hasSideEffects = function() { 9924 HInstruction.prototype.hasSideEffects = function() {
(...skipping 23 matching lines...) Expand all
9896 } 9948 }
9897 HInstruction.prototype.isInBasicBlock = function() { 9949 HInstruction.prototype.isInBasicBlock = function() {
9898 return this._usedBy != null; 9950 return this._usedBy != null;
9899 } 9951 }
9900 HInstruction.prototype.notifyAddedToBlock = function() { 9952 HInstruction.prototype.notifyAddedToBlock = function() {
9901 $assert(!$notnull_bool(this.isInBasicBlock()), "!isInBasicBlock()", "nodes.dar t", 507, 12); 9953 $assert(!$notnull_bool(this.isInBasicBlock()), "!isInBasicBlock()", "nodes.dar t", 507, 12);
9902 this._usedBy = []; 9954 this._usedBy = [];
9903 for (var i = 0; 9955 for (var i = 0;
9904 i < this.inputs.length; i++) { 9956 i < this.inputs.length; i++) {
9905 $assert(this.inputs.$index(i).isInBasicBlock$0(), "inputs[i].isInBasicBlock( )", "nodes.dart", 511, 14); 9957 $assert(this.inputs.$index(i).isInBasicBlock$0(), "inputs[i].isInBasicBlock( )", "nodes.dart", 511, 14);
9906 this.inputs.$index(i).get$usedBy().add(this); 9958 this.inputs.$index(i).get$usedBy().add$1(this);
9907 } 9959 }
9908 $assert(this.isValid(), "isValid()", "nodes.dart", 514, 12); 9960 $assert(this.isValid(), "isValid()", "nodes.dart", 514, 12);
9909 } 9961 }
9910 HInstruction.prototype.notifyRemovedFromBlock = function() { 9962 HInstruction.prototype.notifyRemovedFromBlock = function() {
9963 var $0;
9911 $assert(this.isInBasicBlock(), "isInBasicBlock()", "nodes.dart", 518, 12); 9964 $assert(this.isInBasicBlock(), "isInBasicBlock()", "nodes.dart", 518, 12);
9912 $assert(this.get$usedBy().isEmpty(), "usedBy.isEmpty()", "nodes.dart", 519, 12 ); 9965 $assert(this.get$usedBy().isEmpty(), "usedBy.isEmpty()", "nodes.dart", 519, 12 );
9913 for (var i = 0; 9966 for (var i = 0;
9914 i < this.inputs.length; i++) { 9967 i < this.inputs.length; i++) {
9915 var inputUsedBy = this.inputs.$index(i).get$usedBy(); 9968 var inputUsedBy = (($0 = this.inputs.$index(i).get$usedBy()) && $0.is$List() );
9916 for (var j = 0; 9969 for (var j = 0;
9917 j < inputUsedBy.length; j++) { 9970 j < inputUsedBy.length; j++) {
9918 if (inputUsedBy.$index(j) === this) { 9971 if (inputUsedBy.$index(j) === this) {
9919 inputUsedBy.$setindex(j, inputUsedBy.$index(inputUsedBy.length - 1)); 9972 inputUsedBy.$setindex(j, inputUsedBy.$index(inputUsedBy.length - 1));
9920 inputUsedBy.removeLast(); 9973 inputUsedBy.removeLast();
9921 break; 9974 break;
9922 } 9975 }
9923 } 9976 }
9924 } 9977 }
9925 this._usedBy = null; 9978 this._usedBy = null;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
9992 HInvoke.prototype.toString$0 = function() { 10045 HInvoke.prototype.toString$0 = function() {
9993 return this.toString(); 10046 return this.toString();
9994 }; 10047 };
9995 // ********** Code for HInvokeForeign ************** 10048 // ********** Code for HInvokeForeign **************
9996 function HInvokeForeign(element, inputs, code) { 10049 function HInvokeForeign(element, inputs, code) {
9997 this.code = code; 10050 this.code = code;
9998 HInvoke.call(this, element, inputs); 10051 HInvoke.call(this, element, inputs);
9999 // Initializers done 10052 // Initializers done
10000 } 10053 }
10001 $inherits(HInvokeForeign, HInvoke); 10054 $inherits(HInvokeForeign, HInvoke);
10055 HInvokeForeign.prototype.get$code = function() { return this.code; };
10002 HInvokeForeign.prototype.accept = function(visitor) { 10056 HInvokeForeign.prototype.accept = function(visitor) {
10003 return visitor.visitInvokeForeign(this); 10057 return visitor.visitInvokeForeign(this);
10004 } 10058 }
10005 HInvokeForeign.prototype.accept$1 = function($0) { 10059 HInvokeForeign.prototype.accept$1 = function($0) {
10006 return this.accept(($0 && $0.is$HVisitor())); 10060 return this.accept(($0 && $0.is$HVisitor()));
10007 }; 10061 };
10008 // ********** Code for HArithmetic ************** 10062 // ********** Code for HArithmetic **************
10009 function HArithmetic(element, inputs) { 10063 function HArithmetic(element, inputs) {
10010 HInvoke.call(this, element, inputs); 10064 HInvoke.call(this, element, inputs);
10011 // Initializers done 10065 // Initializers done
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
10423 SsaInstructionMerger.prototype.visitGraph = function(graph) { 10477 SsaInstructionMerger.prototype.visitGraph = function(graph) {
10424 this.visitDominatorTree(graph); 10478 this.visitDominatorTree(graph);
10425 } 10479 }
10426 SsaInstructionMerger.prototype.visitInstruction = function(node) { 10480 SsaInstructionMerger.prototype.visitInstruction = function(node) {
10427 var inputs = node.inputs; 10481 var inputs = node.inputs;
10428 var previousUnused = node.previous; 10482 var previousUnused = node.previous;
10429 for (var i = inputs.length - 1; 10483 for (var i = inputs.length - 1;
10430 i >= 0; i--) { 10484 i >= 0; i--) {
10431 if (previousUnused == null) return; 10485 if (previousUnused == null) return;
10432 if ((previousUnused instanceof HPhi)) return; 10486 if ((previousUnused instanceof HPhi)) return;
10433 if (inputs.$index(i).get$usedBy().length != 1) return; 10487 if ($notnull_bool($ne(inputs.$index(i).get$usedBy().length, 1))) return;
10434 if (inputs.$index(i) !== previousUnused) return; 10488 if (inputs.$index(i) !== previousUnused) return;
10435 inputs.$index(i).setGenerateAtUseSite$0(); 10489 inputs.$index(i).setGenerateAtUseSite$0();
10436 previousUnused = previousUnused.previous; 10490 previousUnused = previousUnused.previous;
10437 } 10491 }
10438 } 10492 }
10439 // ********** Code for HTracer ************** 10493 // ********** Code for HTracer **************
10440 function HTracer() {} 10494 function HTracer() {}
10441 HTracer._internal$ctor = function() { 10495 HTracer._internal$ctor = function() {
10442 this.indent = 0 10496 this.indent = 0
10443 this.output = new StringBufferImpl(""); 10497 this.output = new StringBufferImpl("");
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
10745 var result = 0; 10799 var result = 0;
10746 for (var i = 0; 10800 for (var i = 0;
10747 i < instructions.length; i++) { 10801 i < instructions.length; i++) {
10748 if (instructions.$index(i) === instruction) result++; 10802 if (instructions.$index(i) === instruction) result++;
10749 } 10803 }
10750 return result; 10804 return result;
10751 } 10805 }
10752 HValidator.everyInstruction = function(instructions, f) { 10806 HValidator.everyInstruction = function(instructions, f) {
10753 var copy = ListFactory.ListFactory$from$factory(instructions); 10807 var copy = ListFactory.ListFactory$from$factory(instructions);
10754 for (var i = 0; 10808 for (var i = 0;
10755 i < copy.length; i++) { 10809 i < $assert_num(copy.length); i++) {
10756 var current = copy.$index(i); 10810 var current = copy.$index(i);
10757 if (current == null) continue; 10811 if (current == null) continue;
10758 var count = 1; 10812 var count = 1;
10759 for (var j = i + 1; 10813 for (var j = i + 1;
10760 j < copy.length; j++) { 10814 j < $assert_num(copy.length); j++) {
10761 if (copy.$index(j) === current) { 10815 if (copy.$index(j) === current) {
10762 copy.$setindex(j); 10816 copy.$setindex(j);
10763 count++; 10817 count++;
10764 } 10818 }
10765 } 10819 }
10766 if (!$notnull_bool(f.call$2(current, count))) return false; 10820 if (!$notnull_bool(f.call$2(current, count))) return false;
10767 } 10821 }
10768 return true; 10822 return true;
10769 } 10823 }
10770 HValidator.prototype.visitInstruction = function(instruction) { 10824 HValidator.prototype.visitInstruction = function(instruction) {
10771 var $this = this; // closure support 10825 var $this = this; // closure support
10772 function hasCorrectInputs(instruction) { 10826 function hasCorrectInputs(instruction) {
10827 var $0;
10773 var inBasicBlock = $assert_bool(instruction.isInBasicBlock$0()); 10828 var inBasicBlock = $assert_bool(instruction.isInBasicBlock$0());
10774 return HValidator.everyInstruction(instruction.inputs, (function (input, cou nt) { 10829 return HValidator.everyInstruction((($0 = instruction.get$inputs()) && $0.is $List$HInstruction()), (function (input, count) {
10830 var $0;
10775 if ($notnull_bool(inBasicBlock)) { 10831 if ($notnull_bool(inBasicBlock)) {
10776 return HValidator.countInstruction(input.get$usedBy(), (instruction && i nstruction.is$HInstruction())) == count; 10832 return HValidator.countInstruction((($0 = input.get$usedBy()) && $0.is$L ist$HInstruction()), (instruction && instruction.is$HInstruction())) == count;
10777 } 10833 }
10778 else { 10834 else {
10779 return HValidator.countInstruction(input.get$usedBy(), (instruction && i nstruction.is$HInstruction())) == 0; 10835 return HValidator.countInstruction((($0 = input.get$usedBy()) && $0.is$L ist$HInstruction()), (instruction && instruction.is$HInstruction())) == 0;
10780 } 10836 }
10781 }) 10837 })
10782 ); 10838 );
10783 } 10839 }
10784 function hasCorrectUses(instruction) { 10840 function hasCorrectUses(instruction) {
10841 var $0;
10785 if (!$notnull_bool(instruction.isInBasicBlock$0())) return true; 10842 if (!$notnull_bool(instruction.isInBasicBlock$0())) return true;
10786 return HValidator.everyInstruction(instruction.get$usedBy(), (function (use, count) { 10843 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; 10844 var $0;
10845 return HValidator.countInstruction((($0 = use.get$inputs()) && $0.is$List$ HInstruction()), (instruction && instruction.is$HInstruction())) == count;
10788 }) 10846 })
10789 ); 10847 );
10790 } 10848 }
10791 this.isValid = $notnull_bool($notnull_bool(this.isValid && hasCorrectInputs(in struction)) && hasCorrectUses(instruction)); 10849 this.isValid = $notnull_bool($notnull_bool(this.isValid && hasCorrectInputs(in struction)) && hasCorrectUses(instruction));
10792 } 10850 }
10793 // ********** Code for ValueSetNode ************** 10851 // ********** Code for ValueSetNode **************
10794 function ValueSetNode() {} 10852 function ValueSetNode() {}
10795 ValueSetNode.prototype.get$value = function() { return this.value; }; 10853 ValueSetNode.prototype.get$value = function() { return this.value; };
10796 ValueSetNode.prototype.next$0 = function() { 10854 ValueSetNode.prototype.next$0 = function() {
10797 return this.next(); 10855 return this.next();
(...skipping 10 matching lines...) Expand all
10808 WorldCompiler.prototype.log = function(message) { 10866 WorldCompiler.prototype.log = function(message) {
10809 if ($notnull_bool(options.showInfo)) { 10867 if ($notnull_bool(options.showInfo)) {
10810 this.world.info(('[leg] ' + message + '')); 10868 this.world.info(('[leg] ' + message + ''));
10811 } 10869 }
10812 } 10870 }
10813 WorldCompiler.prototype.run = function() { 10871 WorldCompiler.prototype.run = function() {
10814 var success = Compiler.prototype.run.call(this); 10872 var success = Compiler.prototype.run.call(this);
10815 if ($notnull_bool(success)) { 10873 if ($notnull_bool(success)) {
10816 var code = this.getGeneratedCode(); 10874 var code = this.getGeneratedCode();
10817 this.world.legCode = $assert_String(code); 10875 this.world.legCode = $assert_String(code);
10818 this.world.jsBytesWritten = code.length; 10876 this.world.jsBytesWritten = $assert_num(code.length);
10819 var $list = this.tasks; 10877 var $list = this.tasks;
10820 for (var $i0 = 0;$i0 < $list.length; $i0++) { 10878 for (var $i0 = 0;$i0 < $list.length; $i0++) {
10821 var task = $list.$index($i0); 10879 var task = $list.$index($i0);
10822 this.log(('' + task.get$name() + ' took ' + task.get$timing() + 'msec')); 10880 this.log(('' + task.get$name() + ' took ' + task.get$timing() + 'msec'));
10823 } 10881 }
10824 } 10882 }
10825 return success; 10883 return success;
10826 } 10884 }
10827 WorldCompiler.prototype.spanFromNode = function(node) { 10885 WorldCompiler.prototype.spanFromNode = function(node) {
10828 var begin = node.getBeginToken(); 10886 var begin = node.getBeginToken();
(...skipping 18 matching lines...) Expand all
10847 this.scanner = new ScannerTask(this); 10905 this.scanner = new ScannerTask(this);
10848 this.parser = new ParserTask(this); 10906 this.parser = new ParserTask(this);
10849 this.resolver = new ResolverTask(this); 10907 this.resolver = new ResolverTask(this);
10850 this.checker = new TypeCheckerTask(this); 10908 this.checker = new TypeCheckerTask(this);
10851 this.builder = new SsaBuilderTask(this); 10909 this.builder = new SsaBuilderTask(this);
10852 this.optimizer = new SsaOptimizerTask(this); 10910 this.optimizer = new SsaOptimizerTask(this);
10853 this.generator = new SsaCodeGeneratorTask(this); 10911 this.generator = new SsaCodeGeneratorTask(this);
10854 this.tasks = [this.scanner, this.parser, this.resolver, this.checker, this.bui lder, this.optimizer, this.generator]; 10912 this.tasks = [this.scanner, this.parser, this.resolver, this.checker, this.bui lder, this.optimizer, this.generator];
10855 } 10913 }
10856 Compiler.prototype.is$Compiler = function(){return this;}; 10914 Compiler.prototype.is$Compiler = function(){return this;};
10915 Compiler.prototype.get$generator = function() { return this.generator; };
10916 Compiler.prototype.set$generator = function(value) { return this.generator = val ue; };
10857 Compiler.prototype.ensure = function(condition) { 10917 Compiler.prototype.ensure = function(condition) {
10858 if (!$notnull_bool(condition)) this.cancel('failed assertion in leg'); 10918 if (!$notnull_bool(condition)) this.cancel('failed assertion in leg');
10859 } 10919 }
10860 Compiler.prototype.unimplemented = function(methodName) { 10920 Compiler.prototype.unimplemented = function(methodName) {
10861 this.cancel(("" + methodName + " not implemented")); 10921 this.cancel(("" + methodName + " not implemented"));
10862 } 10922 }
10863 Compiler.prototype.cancel = function(reason) { 10923 Compiler.prototype.cancel = function(reason) {
10864 $throw(new CompilerCancelledException(reason)); 10924 $throw(new CompilerCancelledException(reason));
10865 } 10925 }
10866 Compiler.prototype.log = function(message) { 10926 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())); 11355 return this.add(($0 && $0.is$Element()));
11296 }; 11356 };
11297 TopScope.prototype.lookup$1 = function($0) { 11357 TopScope.prototype.lookup$1 = function($0) {
11298 return this.lookup(($0 && $0.is$SourceString())); 11358 return this.lookup(($0 && $0.is$SourceString()));
11299 }; 11359 };
11300 // ********** Code for leg_Script ************** 11360 // ********** Code for leg_Script **************
11301 function leg_Script(file) { 11361 function leg_Script(file) {
11302 this.file = file; 11362 this.file = file;
11303 // Initializers done 11363 // Initializers done
11304 } 11364 }
11365 leg_Script.prototype.get$file = function() { return this.file; };
11305 leg_Script.prototype.get$text = function() { 11366 leg_Script.prototype.get$text = function() {
11306 return this.file.get$text(); 11367 return this.file.get$text();
11307 } 11368 }
11308 // ********** Code for TypeCheckerTask ************** 11369 // ********** Code for TypeCheckerTask **************
11309 function TypeCheckerTask(compiler) { 11370 function TypeCheckerTask(compiler) {
11310 this.types = new Types(); 11371 this.types = new Types();
11311 CompilerTask.call(this, compiler); 11372 CompilerTask.call(this, compiler);
11312 // Initializers done 11373 // Initializers done
11313 } 11374 }
11314 $inherits(TypeCheckerTask, CompilerTask); 11375 $inherits(TypeCheckerTask, CompilerTask);
11315 TypeCheckerTask.prototype.get$name = function() { 11376 TypeCheckerTask.prototype.get$name = function() {
11316 return "Type checker"; 11377 return "Type checker";
11317 } 11378 }
11379 TypeCheckerTask.prototype.get$types = function() { return this.types; };
11380 TypeCheckerTask.prototype.set$types = function(value) { return this.types = valu e; };
11318 TypeCheckerTask.prototype.check = function(tree, elements) { 11381 TypeCheckerTask.prototype.check = function(tree, elements) {
11319 var $this = this; // closure support 11382 var $this = this; // closure support
11320 this.measure((function () { 11383 this.measure((function () {
11321 var visitor = new TypeCheckerVisitor($this.compiler, elements, $this.types); 11384 var visitor = new TypeCheckerVisitor($this.compiler, elements, $this.types);
11322 try { 11385 try {
11323 tree.accept(visitor); 11386 tree.accept(visitor);
11324 } catch (e) { 11387 } catch (e) {
11325 e = $toDartException(e); 11388 e = $toDartException(e);
11326 if (!(e instanceof CancelTypeCheckException)) throw e; 11389 if (!(e instanceof CancelTypeCheckException)) throw e;
11327 $this.compiler.reportWarning(e.node, e.reason); 11390 $this.compiler.reportWarning(e.node, e.reason);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
11389 }; 11452 };
11390 // ********** Code for Types ************** 11453 // ********** Code for Types **************
11391 function Types() { 11454 function Types() {
11392 this.voidType = new SimpleType.named$ctor(const$4/*Types.VOID*/); 11455 this.voidType = new SimpleType.named$ctor(const$4/*Types.VOID*/);
11393 this.intType = new SimpleType.named$ctor(const$6/*Types.INT*/); 11456 this.intType = new SimpleType.named$ctor(const$6/*Types.INT*/);
11394 this.dynamicType = new SimpleType.named$ctor(const$8/*Types.DYNAMIC*/); 11457 this.dynamicType = new SimpleType.named$ctor(const$8/*Types.DYNAMIC*/);
11395 this.stringType = new SimpleType.named$ctor(const$10/*Types.STRING*/); 11458 this.stringType = new SimpleType.named$ctor(const$10/*Types.STRING*/);
11396 // Initializers done 11459 // Initializers done
11397 } 11460 }
11398 Types.prototype.is$Types = function(){return this;}; 11461 Types.prototype.is$Types = function(){return this;};
11462 Types.prototype.get$dynamicType = function() { return this.dynamicType; };
11399 Types.prototype.lookup = function(s) { 11463 Types.prototype.lookup = function(s) {
11400 if ($notnull_bool($eq(const$4/*Types.VOID*/, s))) { 11464 if ($notnull_bool($eq(const$4/*Types.VOID*/, s))) {
11401 return this.voidType; 11465 return this.voidType;
11402 } 11466 }
11403 else if ($notnull_bool($eq(const$6/*Types.INT*/, s))) { 11467 else if ($notnull_bool($eq(const$6/*Types.INT*/, s))) {
11404 return this.intType; 11468 return this.intType;
11405 } 11469 }
11406 else if ($notnull_bool($eq(const$8/*Types.DYNAMIC*/, s) || s.get$stringValue() === 'var')) { 11470 else if ($notnull_bool($eq(const$8/*Types.DYNAMIC*/, s) || s.get$stringValue() === 'var')) {
11407 return this.dynamicType; 11471 return this.dynamicType;
11408 } 11472 }
(...skipping 18 matching lines...) Expand all
11427 // Initializers done 11491 // Initializers done
11428 } 11492 }
11429 // ********** Code for TypeCheckerVisitor ************** 11493 // ********** Code for TypeCheckerVisitor **************
11430 function TypeCheckerVisitor(compiler, elements, types) { 11494 function TypeCheckerVisitor(compiler, elements, types) {
11431 this.compiler = compiler; 11495 this.compiler = compiler;
11432 this.elements = elements; 11496 this.elements = elements;
11433 this.types = types; 11497 this.types = types;
11434 // Initializers done 11498 // Initializers done
11435 } 11499 }
11436 TypeCheckerVisitor.prototype.is$Visitor = function(){return this;}; 11500 TypeCheckerVisitor.prototype.is$Visitor = function(){return this;};
11501 TypeCheckerVisitor.prototype.get$types = function() { return this.types; };
11502 TypeCheckerVisitor.prototype.set$types = function(value) { return this.types = v alue; };
11437 TypeCheckerVisitor.prototype.fail = function(node, reason) { 11503 TypeCheckerVisitor.prototype.fail = function(node, reason) {
11438 var message = 'cannot type-check'; 11504 var message = 'cannot type-check';
11439 if (reason != null) { 11505 if (reason != null) {
11440 message = ('' + message + ': ' + reason + ''); 11506 message = ('' + message + ': ' + reason + '');
11441 } 11507 }
11442 $throw(new CancelTypeCheckException(node, message)); 11508 $throw(new CancelTypeCheckException(node, message));
11443 } 11509 }
11444 TypeCheckerVisitor.prototype.nonVoidType = function(node) { 11510 TypeCheckerVisitor.prototype.nonVoidType = function(node) {
11445 var type = this.type(node); 11511 var type = this.type(node);
11446 if ($eq(type, this.types.voidType)) { 11512 if ($eq(type, this.types.voidType)) {
11447 this.compiler.reportWarning(node, CompilerError.voidExpression()); 11513 this.compiler.reportWarning(node, CompilerError.voidExpression());
11448 } 11514 }
11449 return type; 11515 return type;
11450 } 11516 }
11451 TypeCheckerVisitor.prototype.typeWithDefault = function(node, defaultValue) { 11517 TypeCheckerVisitor.prototype.typeWithDefault = function(node, defaultValue) {
11452 return node != null ? this.type(node) : defaultValue; 11518 return node != null ? this.type(node) : defaultValue;
11453 } 11519 }
11454 TypeCheckerVisitor.prototype.type = function(node) { 11520 TypeCheckerVisitor.prototype.type = function(node) {
11455 var $0; 11521 var $0;
11456 if (node == null) this.fail(null, 'unexpected node: null'); 11522 if (node == null) this.fail(null, 'unexpected node: null');
11457 var result = (($0 = node.accept(this)) && $0.is$Type()); 11523 var result = (($0 = node.accept(this)) && $0.is$Type());
11458 return result; 11524 return result;
11459 } 11525 }
11526 TypeCheckerVisitor.prototype.get$type = function() {
11527 return TypeCheckerVisitor.prototype.type.bind(this);
11528 }
11460 TypeCheckerVisitor.prototype.checkAssignable = function(node, s, t) { 11529 TypeCheckerVisitor.prototype.checkAssignable = function(node, s, t) {
11461 if (!$notnull_bool(this.types.isAssignable(s, t))) { 11530 if (!$notnull_bool(this.types.isAssignable(s, t))) {
11462 var error = CompilerError.notAssignable(s, t); 11531 var error = CompilerError.notAssignable(s, t);
11463 this.compiler.reportWarning(node, error); 11532 this.compiler.reportWarning(node, error);
11464 } 11533 }
11465 } 11534 }
11466 TypeCheckerVisitor.prototype.visitBlock = function(node) { 11535 TypeCheckerVisitor.prototype.visitBlock = function(node) {
11467 this.type(node.statements); 11536 this.type(node.statements);
11468 return this.types.voidType; 11537 return this.types.voidType;
11469 } 11538 }
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
11839 this.main.declaringType.markUsed(); 11908 this.main.declaringType.markUsed();
11840 world.corelib.types.$index('BadNumberFormatException').markUsed$0(); 11909 world.corelib.types.$index('BadNumberFormatException').markUsed$0();
11841 world.get$coreimpl().types.$index('NumImplementation').markUsed$0(); 11910 world.get$coreimpl().types.$index('NumImplementation').markUsed$0();
11842 world.get$coreimpl().types.$index('StringImplementation').markUsed$0(); 11911 world.get$coreimpl().types.$index('StringImplementation').markUsed$0();
11843 world.get$coreimpl().types.$index('MatchImplementation').markUsed$0(); 11912 world.get$coreimpl().types.$index('MatchImplementation').markUsed$0();
11844 this.genMethod((($0 = world.get$coreimpl().types.$index('MatchImplementation') .getConstructor$1('')) && $0.is$Member())); 11913 this.genMethod((($0 = world.get$coreimpl().types.$index('MatchImplementation') .getConstructor$1('')) && $0.is$Member()));
11845 this.writeTypes(world.get$coreimpl()); 11914 this.writeTypes(world.get$coreimpl());
11846 this.writeTypes(world.corelib); 11915 this.writeTypes(world.corelib);
11847 this.writeTypes(this.main.declaringType.get$library()); 11916 this.writeTypes(this.main.declaringType.get$library());
11848 this._writeGlobals(); 11917 this._writeGlobals();
11849 this.writer.writeln(('RunEntry(function () {' + mainCall.code + ';}, []);')); 11918 this.writer.writeln(('RunEntry(function () {' + mainCall.get$code() + ';}, []) ;'));
11850 } 11919 }
11851 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe ndencies) { 11920 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe ndencies) {
11852 var $0; 11921 var $0;
11853 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + ""); 11922 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + "");
11854 if (!this.globals.containsKey(fullname)) { 11923 if (!this.globals.containsKey(fullname)) {
11855 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory( field, fieldValue, dependencies)); 11924 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory( field, fieldValue, dependencies));
11856 } 11925 }
11857 return (($0 = this.globals.$index(fullname)) && $0.is$GlobalValue()); 11926 return (($0 = this.globals.$index(fullname)) && $0.is$GlobalValue());
11858 } 11927 }
11859 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { 11928 WorldGenerator.prototype.globalForConst = function(exp, dependencies) {
11860 var $0; 11929 var $0;
11861 var code = exp.canonicalCode; 11930 var code = exp.canonicalCode;
11862 if (!this.globals.containsKey(code)) { 11931 if (!this.globals.containsKey(code)) {
11863 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this. globals.get$length(), exp, dependencies)); 11932 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this. globals.get$length(), exp, dependencies));
11864 } 11933 }
11865 return (($0 = this.globals.$index(code)) && $0.is$GlobalValue()); 11934 return (($0 = this.globals.$index(code)) && $0.is$GlobalValue());
11866 } 11935 }
11867 WorldGenerator.prototype.writeTypes = function(lib) { 11936 WorldGenerator.prototype.writeTypes = function(lib) {
11937 var $0;
11868 if ($notnull_bool(lib.isWritten)) return; 11938 if ($notnull_bool(lib.isWritten)) return;
11869 lib.isWritten = true; 11939 lib.isWritten = true;
11870 var $list = lib.imports; 11940 var $list = lib.imports;
11871 for (var $i = 0;$i < $list.length; $i++) { 11941 for (var $i = 0;$i < $list.length; $i++) {
11872 var import_ = $list.$index($i); 11942 var import_ = $list.$index($i);
11873 this.writeTypes(import_.get$library()); 11943 this.writeTypes((($0 = import_.get$library()) && $0.is$Library()));
11874 } 11944 }
11875 for (var i = 0; 11945 for (var i = 0;
11876 i < lib.sources.length; i++) { 11946 i < lib.sources.length; i++) {
11877 lib.sources.$index(i).orderInLibrary = i; 11947 lib.sources.$index(i).set$orderInLibrary(i);
11878 } 11948 }
11879 this.writer.comment(('// ********** Library ' + lib.name + ' **************') ); 11949 this.writer.comment(('// ********** Library ' + lib.name + ' **************') );
11880 if ($notnull_bool(lib.get$isCore())) { 11950 if ($notnull_bool(lib.get$isCore())) {
11881 this.writer.comment('// ********** Natives dart:core **************'); 11951 this.writer.comment('// ********** Natives dart:core **************');
11882 this.corejs.generate(this.writer); 11952 this.corejs.generate(this.writer);
11883 } 11953 }
11884 var $list = lib.natives; 11954 var $list = lib.natives;
11885 for (var $i = 0;$i < $list.length; $i++) { 11955 for (var $i = 0;$i < $list.length; $i++) {
11886 var file = $list.$index($i); 11956 var file = $list.$index($i);
11887 var filename = basename(file.filename); 11957 var filename = basename($assert_String(file.get$filename()));
11888 this.writer.comment(('// ********** Natives ' + filename + ' ************** ')); 11958 this.writer.comment(('// ********** Natives ' + filename + ' ************** '));
11889 this.writer.writeln(file.get$text()); 11959 this.writer.writeln($assert_String(file.get$text()));
11890 } 11960 }
11891 lib.topType.markUsed(); 11961 lib.topType.markUsed();
11892 var $list = this._orderValues(lib.types); 11962 var $list = this._orderValues(lib.types);
11893 for (var $i = 0;$i < $list.length; $i++) { 11963 for (var $i = 0;$i < $list.length; $i++) {
11894 var type = $list.$index($i); 11964 var type = $list.$index($i);
11895 if ($notnull_bool(type.get$isUsed() && type.get$isClass())) { 11965 if ($notnull_bool(type.get$isUsed() && type.get$isClass())) {
11896 this.writeType((type && type.is$lang_Type())); 11966 this.writeType((type && type.is$lang_Type()));
11897 if ($notnull_bool(type.get$isGeneric())) { 11967 if ($notnull_bool(type.get$isGeneric())) {
11898 var $list0 = this._orderValues(type._concreteTypes); 11968 var $list0 = this._orderValues(type._concreteTypes);
11899 for (var $i0 = 0;$i0 < $list0.length; $i0++) { 11969 for (var $i0 = 0;$i0 < $list0.length; $i0++) {
11900 var ct = $list0.$index($i0); 11970 var ct = $list0.$index($i0);
11901 this.writeType((ct && ct.is$lang_Type())); 11971 this.writeType((ct && ct.is$lang_Type()));
11902 } 11972 }
11903 } 11973 }
11904 } 11974 }
11905 if ($notnull_bool(type.get$isFunction() && type.varStubs != null)) { 11975 if ($notnull_bool(type.get$isFunction() && $ne(type.get$varStubs(), null))) {
11906 this.writer.comment(('// ********** Code for ' + type.get$jsname() + ' *** ***********')); 11976 this.writer.comment(('// ********** Code for ' + type.get$jsname() + ' *** ***********'));
11907 this._writeDynamicStubs((type && type.is$lang_Type())); 11977 this._writeDynamicStubs((type && type.is$lang_Type()));
11908 } 11978 }
11909 if (type.typeCheckCode != null) { 11979 if ($notnull_bool($ne(type.get$typeCheckCode(), null))) {
11910 this.writer.writeln(type.typeCheckCode); 11980 this.writer.writeln($assert_String(type.get$typeCheckCode()));
11911 } 11981 }
11912 } 11982 }
11913 } 11983 }
11914 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { 11984 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) {
11915 if ($notnull_bool(!$notnull_bool(meth.isGenerated) && !$notnull_bool(meth.get$ isAbstract()) && $ne(meth.get$definition(), null))) { 11985 if ($notnull_bool(!$notnull_bool(meth.isGenerated) && !$notnull_bool(meth.get$ isAbstract()) && $ne(meth.get$definition(), null))) {
11916 new MethodGenerator(meth, enclosingMethod).run(); 11986 new MethodGenerator(meth, enclosingMethod).run();
11917 } 11987 }
11918 } 11988 }
11919 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { 11989 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) {
11920 if (!$notnull_bool(checkType.isTested)) return; 11990 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())) { 12024 if (!$notnull_bool(type.get$isNativeType())) {
11955 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); 12025 this.writer.writeln(('function ' + type.get$jsname() + '() {}'));
11956 } 12026 }
11957 } 12027 }
11958 else { 12028 else {
11959 standardConstructor.generator.writeDefinition(this.writer, null); 12029 standardConstructor.generator.writeDefinition(this.writer, null);
11960 } 12030 }
11961 var $list = type.get$constructors().getValues(); 12031 var $list = type.get$constructors().getValues();
11962 for (var $i = type.get$constructors().getValues().iterator$0(); $i.hasNext$0 (); ) { 12032 for (var $i = type.get$constructors().getValues().iterator$0(); $i.hasNext$0 (); ) {
11963 var c = $i.next$0(); 12033 var c = $i.next$0();
11964 if ($notnull_bool($ne(c.generator, null) && $ne(c, standardConstructor))) { 12034 if ($notnull_bool($ne(c.get$generator(), null) && $ne(c, standardConstruct or))) {
11965 c.generator.writeDefinition$2(this.writer); 12035 c.get$generator().writeDefinition$2(this.writer);
11966 } 12036 }
11967 } 12037 }
11968 } 12038 }
11969 if (!$notnull_bool(type.get$isTop())) { 12039 if (!$notnull_bool(type.get$isTop())) {
11970 if ((type instanceof ConcreteType)) { 12040 if ((type instanceof ConcreteType)) {
11971 this._ensureInheritsHelper(); 12041 this._ensureInheritsHelper();
11972 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g enericType().get$jsname() + ');')); 12042 this.writer.writeln(('\$inherits(' + type.get$jsname() + ', ' + type.get$g enericType().get$jsname() + ');'));
11973 } 12043 }
11974 else if (!$notnull_bool(type.get$isNativeType())) { 12044 else if (!$notnull_bool(type.get$isNativeType())) {
11975 if (type.get$parent() != null && !$notnull_bool(type.get$parent().get$isOb ject())) { 12045 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())); 12058 this._maybeIsTest(type, (ct && ct.is$lang_Type()));
11989 } 12059 }
11990 } 12060 }
11991 if (type.get$interfaces() != null) { 12061 if (type.get$interfaces() != null) {
11992 var seen = new HashSetImplementation(); 12062 var seen = new HashSetImplementation();
11993 var worklist = []; 12063 var worklist = [];
11994 worklist.addAll(type.get$interfaces()); 12064 worklist.addAll(type.get$interfaces());
11995 seen.addAll(type.get$interfaces()); 12065 seen.addAll(type.get$interfaces());
11996 while (!worklist.isEmpty()) { 12066 while (!worklist.isEmpty()) {
11997 var interface_ = worklist.removeLast(); 12067 var interface_ = worklist.removeLast();
11998 this._maybeIsTest(type, interface_.get$genericType()); 12068 this._maybeIsTest(type, (($0 = interface_.get$genericType()) && $0.is$lang _Type()));
11999 if (interface_.get$genericType()._concreteTypes != null) { 12069 if (interface_.get$genericType()._concreteTypes != null) {
12000 var $list = this._orderValues(interface_.get$genericType()._concreteType s); 12070 var $list = this._orderValues(interface_.get$genericType()._concreteType s);
12001 for (var $i = 0;$i < $list.length; $i++) { 12071 for (var $i = 0;$i < $list.length; $i++) {
12002 var ct = $list.$index($i); 12072 var ct = $list.$index($i);
12003 this._maybeIsTest(type, (ct && ct.is$lang_Type())); 12073 this._maybeIsTest(type, (ct && ct.is$lang_Type()));
12004 } 12074 }
12005 } 12075 }
12006 var $list = interface_.get$interfaces(); 12076 var $list = interface_.get$interfaces();
12007 for (var $i = interface_.get$interfaces().iterator$0(); $i.hasNext$0(); ) { 12077 for (var $i = interface_.get$interfaces().iterator$0(); $i.hasNext$0(); ) {
12008 var other = $i.next$0(); 12078 var other = $i.next$0();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
12042 stub.generate$1(this.writer); 12112 stub.generate$1(this.writer);
12043 } 12113 }
12044 } 12114 }
12045 } 12115 }
12046 WorldGenerator.prototype._writeStaticField = function(field) { 12116 WorldGenerator.prototype._writeStaticField = function(field) {
12047 if ($notnull_bool(field.isFinal)) return; 12117 if ($notnull_bool(field.isFinal)) return;
12048 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + ""); 12118 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + "");
12049 if (this.globals.containsKey(fullname)) { 12119 if (this.globals.containsKey(fullname)) {
12050 var value = this.globals.$index(fullname); 12120 var value = this.globals.$index(fullname);
12051 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.is Native))) { 12121 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.is Native))) {
12052 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code + ';')); 12122 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.get$exp() .get$code() + ';'));
12053 } 12123 }
12054 else { 12124 else {
12055 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g et$jsname() + ' = ' + value.exp.code + ';')); 12125 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g et$jsname() + ' = ' + value.get$exp().get$code() + ';'));
12056 } 12126 }
12057 } 12127 }
12058 } 12128 }
12059 WorldGenerator.prototype._writeField = function(field) { 12129 WorldGenerator.prototype._writeField = function(field) {
12060 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.isNa tive)) && field.value == null) { 12130 if ($notnull_bool(field.declaringType.get$isTop() && !$notnull_bool(field.isNa tive)) && field.value == null) {
12061 this.writer.writeln(('var ' + field.get$jsname() + ';')); 12131 this.writer.writeln(('var ' + field.get$jsname() + ';'));
12062 } 12132 }
12063 if ($notnull_bool(field._providePropertySyntax)) { 12133 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() + '; };')); 12134 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)) { 12135 if (!$notnull_bool(field.isFinal)) {
(...skipping 18 matching lines...) Expand all
12084 } 12154 }
12085 WorldGenerator.prototype._writeMethod = function(method) { 12155 WorldGenerator.prototype._writeMethod = function(method) {
12086 if (method.generator != null) { 12156 if (method.generator != null) {
12087 method.generator.writeDefinition(this.writer, null); 12157 method.generator.writeDefinition(this.writer, null);
12088 } 12158 }
12089 } 12159 }
12090 WorldGenerator.prototype.get$_writeMethod = function() { 12160 WorldGenerator.prototype.get$_writeMethod = function() {
12091 return WorldGenerator.prototype._writeMethod.bind(this); 12161 return WorldGenerator.prototype._writeMethod.bind(this);
12092 } 12162 }
12093 WorldGenerator.prototype._writeGlobals = function() { 12163 WorldGenerator.prototype._writeGlobals = function() {
12164 var $0;
12094 if (this.globals.get$length() > 0) { 12165 if (this.globals.get$length() > 0) {
12095 this.writer.comment('// ********** Globals **************'); 12166 this.writer.comment('// ********** Globals **************');
12096 } 12167 }
12097 var list = this.globals.getValues(); 12168 var list = this.globals.getValues();
12098 list.sort$1((function (a, b) { 12169 list.sort$1((function (a, b) {
12099 return a.compareTo$1(b); 12170 return a.compareTo$1(b);
12100 }) 12171 })
12101 ); 12172 );
12102 for (var $i = list.iterator$0(); $i.hasNext$0(); ) { 12173 for (var $i = list.iterator$0(); $i.hasNext$0(); ) {
12103 var global = $i.next$0(); 12174 var global = $i.next$0();
12104 if (global.field != null) { 12175 if ($notnull_bool($ne(global.get$field(), null))) {
12105 this._writeStaticField(global.field); 12176 this._writeStaticField((($0 = global.get$field()) && $0.is$FieldMember())) ;
12106 } 12177 }
12107 else { 12178 else {
12108 this.writer.writeln(('var ' + global.get$name() + ' = ' + global.exp.code + ';')); 12179 this.writer.writeln(('var ' + global.get$name() + ' = ' + global.get$exp() .get$code() + ';'));
12109 } 12180 }
12110 } 12181 }
12111 } 12182 }
12112 WorldGenerator.prototype._orderValues = function(map) { 12183 WorldGenerator.prototype._orderValues = function(map) {
12113 var $0; 12184 var $0;
12114 var values = (($0 = map.getValues()) && $0.is$List()); 12185 var values = (($0 = map.getValues()) && $0.is$List());
12115 values.sort(this.get$_compareMembers()); 12186 values.sort(this.get$_compareMembers());
12116 return values; 12187 return values;
12117 } 12188 }
12118 WorldGenerator.prototype._compareMembers = function(x, y) { 12189 WorldGenerator.prototype._compareMembers = function(x, y) {
12119 if (x.get$span() != null && y.get$span() != null) { 12190 if ($notnull_bool($ne(x.get$span(), null) && $ne(y.get$span(), null))) {
12120 var spans = x.get$span().compareTo(y.get$span()); 12191 var spans = $assert_num(x.get$span().compareTo$1(y.get$span()));
12121 if (spans != 0) return spans; 12192 if (spans != 0) return spans;
12122 } 12193 }
12123 if (x.get$span() == null) return 1; 12194 if ($notnull_bool(x.get$span() == null)) return 1;
12124 if (y.get$span() == null) return -1; 12195 if ($notnull_bool(y.get$span() == null)) return -1;
12125 return $assert_num(x.get$name().compareTo$1(y.get$name())); 12196 return $assert_num(x.get$name().compareTo$1(y.get$name()));
12126 } 12197 }
12127 WorldGenerator.prototype.get$_compareMembers = function() { 12198 WorldGenerator.prototype.get$_compareMembers = function() {
12128 return WorldGenerator.prototype._compareMembers.bind(this); 12199 return WorldGenerator.prototype._compareMembers.bind(this);
12129 } 12200 }
12130 WorldGenerator.prototype.useMapFactory = function() { 12201 WorldGenerator.prototype.useMapFactory = function() {
12131 var $0; 12202 var $0;
12132 this.corejs.useMap = true; 12203 this.corejs.useMap = true;
12133 var factType = world.get$coreimpl().types.$index('HashMapImplementation'); 12204 var factType = world.get$coreimpl().types.$index('HashMapImplementation');
12134 var m = factType.resolveMember$1('\$setindex'); 12205 var m = factType.resolveMember$1('\$setindex');
(...skipping 10 matching lines...) Expand all
12145 this._vars = $map([]); 12216 this._vars = $map([]);
12146 // Initializers done 12217 // Initializers done
12147 if ($notnull_bool(this.get$isMethodScope())) { 12218 if ($notnull_bool(this.get$isMethodScope())) {
12148 this._closedOver = new HashSetImplementation(); 12219 this._closedOver = new HashSetImplementation();
12149 } 12220 }
12150 else { 12221 else {
12151 this.reentrant = $notnull_bool(this.reentrant || this.parent.reentrant); 12222 this.reentrant = $notnull_bool(this.reentrant || this.parent.reentrant);
12152 } 12223 }
12153 } 12224 }
12154 BlockScope.prototype.is$BlockScope = function(){return this;}; 12225 BlockScope.prototype.is$BlockScope = function(){return this;};
12226 BlockScope.prototype.get$enclosingMethod = function() { return this.enclosingMet hod; };
12227 BlockScope.prototype.set$enclosingMethod = function(value) { return this.enclosi ngMethod = value; };
12155 BlockScope.prototype.get$parent = function() { return this.parent; }; 12228 BlockScope.prototype.get$parent = function() { return this.parent; };
12156 BlockScope.prototype.set$parent = function(value) { return this.parent = value; }; 12229 BlockScope.prototype.set$parent = function(value) { return this.parent = value; };
12230 BlockScope.prototype.get$rethrow = function() { return this.rethrow; };
12231 BlockScope.prototype.set$rethrow = function(value) { return this.rethrow = value ; };
12232 BlockScope.prototype.get$reentrant = function() { return this.reentrant; };
12233 BlockScope.prototype.set$reentrant = function(value) { return this.reentrant = v alue; };
12157 BlockScope.prototype.get$isMethodScope = function() { 12234 BlockScope.prototype.get$isMethodScope = function() {
12158 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM ethod); 12235 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM ethod);
12159 } 12236 }
12160 BlockScope.prototype.get$methodScope = function() { 12237 BlockScope.prototype.get$methodScope = function() {
12161 var s = this; 12238 var s = this;
12162 while (!$notnull_bool(s.get$isMethodScope())) s = s.get$parent(); 12239 while (!$notnull_bool(s.get$isMethodScope())) s = s.get$parent();
12163 return (s && s.is$BlockScope()); 12240 return (s && s.is$BlockScope());
12164 } 12241 }
12165 BlockScope.prototype.lookup = function(name) { 12242 BlockScope.prototype.lookup = function(name) {
12166 var ret = this._vars.$index(name); 12243 var ret = this._vars.$index(name);
12167 if ($notnull_bool($ne(ret, null))) return ret; 12244 if ($notnull_bool($ne(ret, null))) return ret;
12168 for (var s = this.parent; 12245 for (var s = this.parent;
12169 $notnull_bool($ne(s, null)); s = s.get$parent()) { 12246 $notnull_bool($ne(s, null)); s = s.get$parent()) {
12170 ret = s._vars.$index(name); 12247 ret = s._vars.$index(name);
12171 if ($notnull_bool($ne(ret, null))) { 12248 if ($notnull_bool($ne(ret, null))) {
12172 if ($ne(s.enclosingMethod, this.enclosingMethod)) { 12249 if ($notnull_bool($ne(s.get$enclosingMethod(), this.enclosingMethod))) {
12173 s.get$methodScope()._closedOver.add(ret.code); 12250 s.get$methodScope()._closedOver.add(ret.get$code());
12174 if ($notnull_bool(this.enclosingMethod.captures != null && s.reentrant)) { 12251 if ($notnull_bool(this.enclosingMethod.captures != null && s.get$reentra nt())) {
12175 this.enclosingMethod.captures.add(ret.code); 12252 this.enclosingMethod.captures.add(ret.get$code());
12176 } 12253 }
12177 } 12254 }
12178 return ret; 12255 return ret;
12179 } 12256 }
12180 } 12257 }
12181 } 12258 }
12182 BlockScope.prototype._isDefinedInParent = function(name) { 12259 BlockScope.prototype._isDefinedInParent = function(name) {
12183 if ($notnull_bool(this.get$isMethodScope() && this._closedOver.contains(name)) ) return true; 12260 if ($notnull_bool(this.get$isMethodScope() && this._closedOver.contains(name)) ) return true;
12184 for (var s = this.parent; 12261 for (var s = this.parent;
12185 $notnull_bool($ne(s, null)); s = s.get$parent()) { 12262 $notnull_bool($ne(s, null)); s = s.get$parent()) {
(...skipping 20 matching lines...) Expand all
12206 return (ret && ret.is$Value()); 12283 return (ret && ret.is$Value());
12207 } 12284 }
12208 BlockScope.prototype.declareParameter = function(p) { 12285 BlockScope.prototype.declareParameter = function(p) {
12209 return this.create(p.name, p.type, p.definition.span, true); 12286 return this.create(p.name, p.type, p.definition.span, true);
12210 } 12287 }
12211 BlockScope.prototype.declare = function(id) { 12288 BlockScope.prototype.declare = function(id) {
12212 var type = this.enclosingMethod.method.resolveType(id.type, false); 12289 var type = this.enclosingMethod.method.resolveType(id.type, false);
12213 return this.create(id.name.name, (type && type.is$lang_Type()), id.span, false ); 12290 return this.create(id.name.name, (type && type.is$lang_Type()), id.span, false );
12214 } 12291 }
12215 BlockScope.prototype.getRethrow = function() { 12292 BlockScope.prototype.getRethrow = function() {
12293 var $0;
12216 var scope = this; 12294 var scope = this;
12217 while ($notnull_bool(scope.rethrow == null && $ne(scope.get$parent(), null))) { 12295 while ($notnull_bool(scope.get$rethrow() == null && $ne(scope.get$parent(), nu ll))) {
12218 scope = scope.get$parent(); 12296 scope = scope.get$parent();
12219 } 12297 }
12220 return scope.rethrow; 12298 return (($0 = scope.get$rethrow()) && $0.is$Value());
12221 } 12299 }
12222 BlockScope.prototype.lookup$1 = function($0) { 12300 BlockScope.prototype.lookup$1 = function($0) {
12223 return this.lookup($assert_String($0)); 12301 return this.lookup($assert_String($0));
12224 }; 12302 };
12225 // ********** Code for MethodGenerator ************** 12303 // ********** Code for MethodGenerator **************
12226 function MethodGenerator(method, enclosingMethod) { 12304 function MethodGenerator(method, enclosingMethod) {
12227 var $0; 12305 var $0;
12228 this.method = method; 12306 this.method = method;
12229 this.enclosingMethod = enclosingMethod; 12307 this.enclosingMethod = enclosingMethod;
12230 this.writer = new CodeWriter(); 12308 this.writer = new CodeWriter();
12231 this.needsThis = false; 12309 this.needsThis = false;
12232 // Initializers done 12310 // Initializers done
12233 if (this.enclosingMethod != null) { 12311 if (this.enclosingMethod != null) {
12234 this._scope = new BlockScope(this, this.enclosingMethod._scope, false); 12312 this._scope = new BlockScope(this, this.enclosingMethod._scope, false);
12235 this.captures = new HashSetImplementation(); 12313 this.captures = new HashSetImplementation();
12236 } 12314 }
12237 else { 12315 else {
12238 this._scope = new BlockScope(this, null, false); 12316 this._scope = new BlockScope(this, null, false);
12239 } 12317 }
12240 if (this.enclosingMethod != null && this.method.name != '') { 12318 if (this.enclosingMethod != null && this.method.name != '') {
12241 var m = (($0 = this.method) && $0.is$MethodMember()); 12319 var m = (($0 = this.method) && $0.is$MethodMember());
12242 this._scope.create(m.name, m.get$functionType(), m.definition.span, false); 12320 this._scope.create(m.name, m.get$functionType(), m.definition.span, false);
12243 } 12321 }
12244 this._usedTemps = new HashSetImplementation(); 12322 this._usedTemps = new HashSetImplementation();
12245 this._freeTemps = []; 12323 this._freeTemps = [];
12246 } 12324 }
12247 MethodGenerator.prototype.is$MethodGenerator = function(){return this;}; 12325 MethodGenerator.prototype.is$MethodGenerator = function(){return this;};
12248 MethodGenerator.prototype.is$TreeVisitor = function(){return this;}; 12326 MethodGenerator.prototype.is$TreeVisitor = function(){return this;};
12327 MethodGenerator.prototype.get$enclosingMethod = function() { return this.enclosi ngMethod; };
12328 MethodGenerator.prototype.set$enclosingMethod = function(value) { return this.en closingMethod = value; };
12329 MethodGenerator.prototype.get$needsThis = function() { return this.needsThis; };
12330 MethodGenerator.prototype.set$needsThis = function(value) { return this.needsThi s = value; };
12249 MethodGenerator.prototype.get$library = function() { 12331 MethodGenerator.prototype.get$library = function() {
12250 return this.method.get$library(); 12332 return this.method.get$library();
12251 } 12333 }
12252 MethodGenerator.prototype.findMembers = function(name) { 12334 MethodGenerator.prototype.findMembers = function(name) {
12253 return this.get$library()._findMembers(name); 12335 return this.get$library()._findMembers(name);
12254 } 12336 }
12255 MethodGenerator.prototype.get$isClosure = function() { 12337 MethodGenerator.prototype.get$isClosure = function() {
12256 return (this.enclosingMethod != null); 12338 return (this.enclosingMethod != null);
12257 } 12339 }
12258 MethodGenerator.prototype.get$isStatic = function() { 12340 MethodGenerator.prototype.get$isStatic = function() {
(...skipping 26 matching lines...) Expand all
12285 this._freeTemps.add(value.code); 12367 this._freeTemps.add(value.code);
12286 } 12368 }
12287 else { 12369 else {
12288 world.internalError(('tried to free unused value or non-temp "' + value.code + '"')); 12370 world.internalError(('tried to free unused value or non-temp "' + value.code + '"'));
12289 } 12371 }
12290 } 12372 }
12291 MethodGenerator.prototype.run = function() { 12373 MethodGenerator.prototype.run = function() {
12292 if ($notnull_bool(this.method.isGenerated)) return; 12374 if ($notnull_bool(this.method.isGenerated)) return;
12293 this.method.isGenerated = true; 12375 this.method.isGenerated = true;
12294 this.method.generator = this; 12376 this.method.generator = this;
12295 if ((this.method.get$definition().body instanceof NativeStatement)) { 12377 if ((this.method.get$definition().get$body() instanceof NativeStatement)) {
12296 if ($notnull_bool(this.method.get$definition().body.body == null)) { 12378 if ($notnull_bool(this.method.get$definition().get$body().get$body() == null )) {
12297 this.method.generator = null; 12379 this.method.generator = null;
12298 } 12380 }
12299 else { 12381 else {
12300 this._paramCode = map(this.method.get$parameters(), (function (p) { 12382 this._paramCode = map(this.method.get$parameters(), (function (p) {
12301 return p.get$name(); 12383 return p.get$name();
12302 }) 12384 })
12303 ); 12385 );
12304 this.writer.write($assert_String(this.method.get$definition().body.body)); 12386 this.writer.write($assert_String(this.method.get$definition().get$body().g et$body()));
12305 } 12387 }
12306 } 12388 }
12307 else { 12389 else {
12308 this.writeBody(); 12390 this.writeBody();
12309 } 12391 }
12310 } 12392 }
12311 MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) { 12393 MethodGenerator.prototype.writeDefinition = function(defWriter, lambda) {
12312 var $0; 12394 var $0;
12313 var paramCode = this._paramCode; 12395 var paramCode = this._paramCode;
12314 var names = null; 12396 var names = null;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
12403 var meth = (($0 = this.method) && $0.is$MethodMember()); 12485 var meth = (($0 = this.method) && $0.is$MethodMember());
12404 if ($notnull_bool(meth._provideOptionalParamInfo)) { 12486 if ($notnull_bool(meth._provideOptionalParamInfo)) {
12405 var optNames = []; 12487 var optNames = [];
12406 var optValues = []; 12488 var optValues = [];
12407 meth.genParameterValues(); 12489 meth.genParameterValues();
12408 var $list = meth.parameters; 12490 var $list = meth.parameters;
12409 for (var $i = 0;$i < $list.length; $i++) { 12491 for (var $i = 0;$i < $list.length; $i++) {
12410 var param = $list.$index($i); 12492 var param = $list.$index($i);
12411 if ($notnull_bool(param.get$isOptional())) { 12493 if ($notnull_bool(param.get$isOptional())) {
12412 optNames.add$1(param.get$name()); 12494 optNames.add$1(param.get$name());
12413 optValues.add$1(MethodGenerator._escapeString($assert_String(param.get $value().code))); 12495 optValues.add$1(MethodGenerator._escapeString($assert_String(param.get $value().get$code())));
12414 } 12496 }
12415 } 12497 }
12416 if (optNames.length > 0) { 12498 if (optNames.length > 0) {
12417 var start = ''; 12499 var start = '';
12418 if ($notnull_bool(meth.isStatic)) { 12500 if ($notnull_bool(meth.isStatic)) {
12419 if (!$notnull_bool(meth.declaringType.get$isTop())) { 12501 if (!$notnull_bool(meth.declaringType.get$isTop())) {
12420 start = meth.declaringType.get$jsname() + '.'; 12502 start = meth.declaringType.get$jsname() + '.';
12421 } 12503 }
12422 } 12504 }
12423 else { 12505 else {
12424 start = meth.declaringType.get$jsname() + '.prototype.'; 12506 start = meth.declaringType.get$jsname() + '.prototype.';
12425 } 12507 }
12426 optNames.addAll$1(optValues); 12508 optNames.addAll$1(optValues);
12427 var optional = "['" + Strings.join((optNames && optNames.is$List$String( )), "', '") + "']"; 12509 var optional = "['" + Strings.join((optNames && optNames.is$List$String( )), "', '") + "']";
12428 defWriter.writeln(('' + start + '' + meth.get$jsname() + '.\$optional = ' + optional + '')); 12510 defWriter.writeln(('' + start + '' + meth.get$jsname() + '.\$optional = ' + optional + ''));
12429 } 12511 }
12430 } 12512 }
12431 } 12513 }
12432 } 12514 }
12433 MethodGenerator.prototype.writeBody = function() { 12515 MethodGenerator.prototype.writeBody = function() {
12516 var $0;
12434 var initializers = null; 12517 var initializers = null;
12435 var initializedFields = null; 12518 var initializedFields = null;
12436 if ($notnull_bool(this.method.get$isConstructor())) { 12519 if ($notnull_bool(this.method.get$isConstructor())) {
12437 initializers = []; 12520 initializers = [];
12438 initializedFields = new HashSetImplementation(); 12521 initializedFields = new HashSetImplementation();
12439 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers() ); 12522 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers() );
12440 for (var $i = 0;$i < $list.length; $i++) { 12523 for (var $i = 0;$i < $list.length; $i++) {
12441 var f = $list.$index($i); 12524 var f = $list.$index($i);
12442 if ((f instanceof FieldMember) && !$notnull_bool(f.get$isStatic())) { 12525 if ((f instanceof FieldMember) && !$notnull_bool(f.get$isStatic())) {
12443 var cv = f.computeValue$0(); 12526 var cv = f.computeValue$0();
12444 if ($notnull_bool($ne(cv, null))) { 12527 if ($notnull_bool($ne(cv, null))) {
12445 initializers.add$1(('this.' + f.get$jsname() + ' = ' + cv.code + '')); 12528 initializers.add$1(('this.' + f.get$jsname() + ' = ' + cv.get$code() + ''));
12446 initializedFields.add$1(f.get$name()); 12529 initializedFields.add$1(f.get$name());
12447 } 12530 }
12448 } 12531 }
12449 } 12532 }
12450 } 12533 }
12451 this._paramCode = []; 12534 this._paramCode = [];
12452 var $list = this.method.get$parameters(); 12535 var $list = this.method.get$parameters();
12453 for (var $i = 0;$i < $list.length; $i++) { 12536 for (var $i = 0;$i < $list.length; $i++) {
12454 var p = $list.$index($i); 12537 var p = $list.$index($i);
12455 if ($notnull_bool($ne(initializers, null) && p.isInitializer)) { 12538 if ($notnull_bool($ne(initializers, null) && p.get$isInitializer())) {
12456 var field = this.method.declaringType.getMember(p.get$name()); 12539 var field = this.method.declaringType.getMember(p.get$name());
12457 if ($notnull_bool(field == null)) { 12540 if ($notnull_bool(field == null)) {
12458 world.error('bad this parameter - no matching field', p.get$definition() .get$span()); 12541 world.error('bad this parameter - no matching field', (($0 = p.get$defin ition().get$span()) && $0.is$SourceSpan()));
12459 } 12542 }
12460 if (!$notnull_bool(field.get$isField())) { 12543 if (!$notnull_bool(field.get$isField())) {
12461 world.error(('"this.' + p.get$name() + '" does not refer to a field'), p .get$definition().get$span()); 12544 world.error(('"this.' + p.get$name() + '" does not refer to a field'), ( ($0 = p.get$definition().get$span()) && $0.is$SourceSpan()));
12462 } 12545 }
12463 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def inition().get$span(), false); 12546 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def inition().get$span(), false);
12464 this._paramCode.add(paramValue.code); 12547 this._paramCode.add(paramValue.get$code());
12465 initializers.add$1(('this.' + field.get$jsname() + ' = ' + paramValue.code + ';')); 12548 initializers.add$1(('this.' + field.get$jsname() + ' = ' + paramValue.get$ code() + ';'));
12466 initializedFields.add$1(p.get$name()); 12549 initializedFields.add$1(p.get$name());
12467 } 12550 }
12468 else { 12551 else {
12469 var paramValue = this._scope.declareParameter((p && p.is$Parameter())); 12552 var paramValue = this._scope.declareParameter((p && p.is$Parameter()));
12470 this._paramCode.add(paramValue.code); 12553 this._paramCode.add(paramValue.get$code());
12471 } 12554 }
12472 } 12555 }
12473 var body = this.method.get$definition().body; 12556 var body = this.method.get$definition().get$body();
12474 if ($notnull_bool(body == null && !$notnull_bool(this.method.get$isConstructor ()))) { 12557 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()); 12558 world.error(('unexpected empty body for ' + this.method.name + ''), (($0 = t his.method.get$definition().get$span()) && $0.is$SourceSpan()));
12476 } 12559 }
12477 if ($notnull_bool($ne(initializers, null))) { 12560 if ($notnull_bool($ne(initializers, null))) {
12478 for (var $i = initializers.iterator$0(); $i.hasNext$0(); ) { 12561 for (var $i = initializers.iterator$0(); $i.hasNext$0(); ) {
12479 var i = $i.next$0(); 12562 var i = $i.next$0();
12480 this.writer.writeln($assert_String(i)); 12563 this.writer.writeln($assert_String(i));
12481 } 12564 }
12482 var declaredInitializers = this.method.get$definition().initializers; 12565 var declaredInitializers = this.method.get$definition().get$initializers();
12483 if (declaredInitializers != null) { 12566 if ($notnull_bool($ne(declaredInitializers, null))) {
12484 var initializerCall = null; 12567 var initializerCall = null;
12485 for (var $i = 0;$i < declaredInitializers.length; $i++) { 12568 for (var $i = declaredInitializers.iterator$0(); $i.hasNext$0(); ) {
12486 var init = declaredInitializers.$index($i); 12569 var init = $i.next$0();
12487 if ((init instanceof CallExpression)) { 12570 if ((init instanceof CallExpression)) {
12488 if ($notnull_bool($ne(initializerCall, null))) { 12571 if ($notnull_bool($ne(initializerCall, null))) {
12489 world.error('only one initializer redirecting call is allowed', init .get$span()); 12572 world.error('only one initializer redirecting call is allowed', (($0 = init.get$span()) && $0.is$SourceSpan()));
12490 } 12573 }
12491 initializerCall = init; 12574 initializerCall = init;
12492 } 12575 }
12493 else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign( init.op.kind) == 0) { 12576 else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign( $assert_num(init.get$op().get$kind())) == 0) {
12494 var left = init.x; 12577 var left = init.get$x();
12495 if (!((left instanceof DotExpression) && (left.self instanceof ThisExp ression) || (left instanceof VarExpression))) { 12578 if (!((left instanceof DotExpression) && (left.get$self() instanceof T hisExpression) || (left instanceof VarExpression))) {
12496 world.error('invalid left side of initializer', left.get$span()); 12579 world.error('invalid left side of initializer', (($0 = left.get$span ()) && $0.is$SourceSpan()));
12497 continue; 12580 continue;
12498 } 12581 }
12499 var f = this.method.declaringType.getMember(left.get$name().get$name() ); 12582 var f = this.method.declaringType.getMember(left.get$name().get$name() );
12500 if ($notnull_bool(f == null)) { 12583 if ($notnull_bool(f == null)) {
12501 world.error('bad initializer - no matching field', left.get$span()); 12584 world.error('bad initializer - no matching field', (($0 = left.get$s pan()) && $0.is$SourceSpan()));
12502 continue; 12585 continue;
12503 } 12586 }
12504 else if (!$notnull_bool(f.get$isField())) { 12587 else if (!$notnull_bool(f.get$isField())) {
12505 world.error(('"' + left.get$name().get$name() + '" does not refer to a field'), left.get$span()); 12588 world.error(('"' + left.get$name().get$name() + '" does not refer to a field'), (($0 = left.get$span()) && $0.is$SourceSpan()));
12506 continue; 12589 continue;
12507 } 12590 }
12508 initializedFields.add$1(f.get$name()); 12591 initializedFields.add$1(f.get$name());
12509 this.writer.writeln(('this.' + f.get$jsname() + ' = ' + this.visitValu e(init.y).code + ';')); 12592 this.writer.writeln(('this.' + f.get$jsname() + ' = ' + this.visitValu e((($0 = init.get$y()) && $0.is$lang_Expression())).get$code() + ';'));
12510 } 12593 }
12511 else { 12594 else {
12512 world.error('invalid initializer', init.get$span()); 12595 world.error('invalid initializer', (($0 = init.get$span()) && $0.is$So urceSpan()));
12513 } 12596 }
12514 } 12597 }
12515 if ($notnull_bool($ne(initializerCall, null))) { 12598 if ($notnull_bool($ne(initializerCall, null))) {
12516 var target = this._writeInitializerCall((initializerCall && initializerC all.is$CallExpression())); 12599 var target = this._writeInitializerCall((initializerCall && initializerC all.is$CallExpression()));
12517 if (!$notnull_bool(target.isSuper)) { 12600 if (!$notnull_bool(target.get$isSuper())) {
12518 if (initializers.length > 0) { 12601 if (initializers.length > 0) {
12519 var $list = this.method.get$parameters(); 12602 var $list = this.method.get$parameters();
12520 for (var $i = 0;$i < $list.length; $i++) { 12603 for (var $i = 0;$i < $list.length; $i++) {
12521 var p = $list.$index($i); 12604 var p = $list.$index($i);
12522 if ($notnull_bool(p.isInitializer)) { 12605 if ($notnull_bool(p.get$isInitializer())) {
12523 world.error('no initialization allowed on redirecting constructo rs', p.get$definition().get$span()); 12606 world.error('no initialization allowed on redirecting constructo rs', (($0 = p.get$definition().get$span()) && $0.is$SourceSpan()));
12524 break; 12607 break;
12525 } 12608 }
12526 } 12609 }
12527 } 12610 }
12528 if (declaredInitializers.length > 1) { 12611 if (declaredInitializers.length > 1) {
12529 var init = $notnull_bool($eq(declaredInitializers.$index(0), initial izerCall)) ? declaredInitializers.$index(1) : declaredInitializers.$index(0); 12612 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()); 12613 world.error('no initialization allowed on redirecting constructors', (($0 = init0.get$span()) && $0.is$SourceSpan()));
12531 } 12614 }
12532 initializedFields = null; 12615 initializedFields = null;
12533 } 12616 }
12534 } 12617 }
12535 else { 12618 else {
12536 } 12619 }
12537 } 12620 }
12538 this.writer.comment('// Initializers done'); 12621 this.writer.comment('// Initializers done');
12539 } 12622 }
12540 if ($notnull_bool($ne(initializedFields, null))) { 12623 if ($notnull_bool($ne(initializedFields, null))) {
12541 var $list = this.method.declaringType.get$members().getKeys(); 12624 var $list = this.method.declaringType.get$members().getKeys();
12542 for (var $i = this.method.declaringType.get$members().getKeys().iterator$0() ; $i.hasNext$0(); ) { 12625 for (var $i = this.method.declaringType.get$members().getKeys().iterator$0() ; $i.hasNext$0(); ) {
12543 var name = $i.next$0(); 12626 var name = $i.next$0();
12544 var member = this.method.declaringType.get$members().$index(name); 12627 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))) { 12628 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()); 12629 world.error(('Field "' + name + '" is final and was not initialized'), ( ($0 = this.method.get$definition().get$span()) && $0.is$SourceSpan()));
12547 } 12630 }
12548 } 12631 }
12549 } 12632 }
12550 this.visitStatementsInBlock((body && body.is$lang_Statement())); 12633 this.visitStatementsInBlock((body && body.is$lang_Statement()));
12551 } 12634 }
12552 MethodGenerator.prototype._writeInitializerCall = function(node) { 12635 MethodGenerator.prototype._writeInitializerCall = function(node) {
12553 var contructorName = ''; 12636 var contructorName = '';
12554 var targetExp = node.target; 12637 var targetExp = node.target;
12555 if ((targetExp instanceof DotExpression)) { 12638 if ((targetExp instanceof DotExpression)) {
12556 var dot = (targetExp && targetExp.is$DotExpression()); 12639 var dot = (targetExp && targetExp.is$DotExpression());
12557 targetExp = dot.self; 12640 targetExp = dot.self;
12558 contructorName = dot.name.name; 12641 contructorName = dot.name.name;
12559 } 12642 }
12560 var target = null; 12643 var target = null;
12561 if ((targetExp instanceof SuperExpression)) { 12644 if ((targetExp instanceof SuperExpression)) {
12562 target = this._makeSuperValue((targetExp && targetExp.is$lang_Node())); 12645 target = this._makeSuperValue((targetExp && targetExp.is$lang_Node()));
12563 } 12646 }
12564 else if ((targetExp instanceof ThisExpression)) { 12647 else if ((targetExp instanceof ThisExpression)) {
12565 target = this._makeThisValue((targetExp && targetExp.is$lang_Node())); 12648 target = this._makeThisValue((targetExp && targetExp.is$lang_Node()));
12566 } 12649 }
12567 else { 12650 else {
12568 world.error('bad call in initializers', node.span); 12651 world.error('bad call in initializers', node.span);
12569 } 12652 }
12570 var m = target.type.getConstructor$1(contructorName); 12653 var m = target.get$type().getConstructor$1(contructorName);
12571 this.method.set$initDelegate(m); 12654 this.method.set$initDelegate(m);
12572 var other = m; 12655 var other = m;
12573 while ($notnull_bool($ne(other, null))) { 12656 while ($notnull_bool($ne(other, null))) {
12574 if ($notnull_bool($eq(other, this.method))) { 12657 if ($notnull_bool($eq(other, this.method))) {
12575 world.error('initialization cycle', node.span); 12658 world.error('initialization cycle', node.span);
12576 break; 12659 break;
12577 } 12660 }
12578 other = other.get$initDelegate(); 12661 other = other.get$initDelegate();
12579 } 12662 }
12580 world.gen.genMethod((m && m.is$Member())); 12663 world.gen.genMethod((m && m.is$Member()));
12581 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments)); 12664 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments));
12582 if ($notnull_bool($ne(target.type, world.objectType))) { 12665 if ($notnull_bool($ne(target.get$type(), world.objectType))) {
12583 this.writer.writeln(('' + value.code + ';')); 12666 this.writer.writeln(('' + value.get$code() + ';'));
12584 } 12667 }
12585 return (target && target.is$Value()); 12668 return (target && target.is$Value());
12586 } 12669 }
12587 MethodGenerator.prototype._makeArgs = function(arguments) { 12670 MethodGenerator.prototype._makeArgs = function(arguments) {
12588 var $0; 12671 var $0;
12589 var args = []; 12672 var args = [];
12590 var seenLabel = false; 12673 var seenLabel = false;
12591 for (var $i = 0;$i < arguments.length; $i++) { 12674 for (var $i = 0;$i < arguments.length; $i++) {
12592 var arg = arguments.$index($i); 12675 var arg = arguments.$index($i);
12593 if (arg.label != null) { 12676 if ($notnull_bool($ne(arg.get$label(), null))) {
12594 seenLabel = true; 12677 seenLabel = true;
12595 } 12678 }
12596 else if ($notnull_bool(seenLabel)) { 12679 else if ($notnull_bool(seenLabel)) {
12597 world.error('bare argument can not follow named arguments', arg.get$span() ); 12680 world.error('bare argument can not follow named arguments', (($0 = arg.get $span()) && $0.is$SourceSpan()));
12598 } 12681 }
12599 args.add$1(this.visitValue((($0 = arg.get$value()) && $0.is$lang_Expression( )))); 12682 args.add$1(this.visitValue((($0 = arg.get$value()) && $0.is$lang_Expression( ))));
12600 } 12683 }
12601 return new Arguments(arguments, args); 12684 return new Arguments(arguments, args);
12602 } 12685 }
12603 MethodGenerator._escapeString = function(text) { 12686 MethodGenerator._escapeString = function(text) {
12604 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', ' \\n').replaceAll('\r', '\\r'); 12687 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', ' \\n').replaceAll('\r', '\\r');
12605 } 12688 }
12606 MethodGenerator.prototype.visitStatementsInBlock = function(body) { 12689 MethodGenerator.prototype.visitStatementsInBlock = function(body) {
12607 if ((body instanceof BlockStatement)) { 12690 if ((body instanceof BlockStatement)) {
(...skipping 10 matching lines...) Expand all
12618 return false; 12701 return false;
12619 } 12702 }
12620 MethodGenerator.prototype._pushBlock = function(reentrant) { 12703 MethodGenerator.prototype._pushBlock = function(reentrant) {
12621 this._scope = new BlockScope(this, this._scope, reentrant); 12704 this._scope = new BlockScope(this, this._scope, reentrant);
12622 } 12705 }
12623 MethodGenerator.prototype._popBlock = function() { 12706 MethodGenerator.prototype._popBlock = function() {
12624 this._scope = this._scope.parent; 12707 this._scope = this._scope.parent;
12625 } 12708 }
12626 MethodGenerator.prototype._makeLambdaMethod = function(name, func) { 12709 MethodGenerator.prototype._makeLambdaMethod = function(name, func) {
12627 var meth = new MethodMember(name, this.method.declaringType, func); 12710 var meth = new MethodMember(name, this.method.declaringType, func);
12628 meth.isLambda = true; 12711 meth.set$isLambda(true);
12629 meth.resolve$1(this.method.declaringType); 12712 meth.resolve$1(this.method.declaringType);
12630 world.gen.genMethod((meth && meth.is$Member()), this); 12713 world.gen.genMethod((meth && meth.is$Member()), this);
12631 return (meth && meth.is$MethodMember()); 12714 return (meth && meth.is$MethodMember());
12632 } 12715 }
12633 MethodGenerator.prototype.visitBool = function(node) { 12716 MethodGenerator.prototype.visitBool = function(node) {
12634 return this.visitValue(node).convertTo$3(this, world.nonNullBool, node); 12717 return this.visitValue(node).convertTo$3(this, world.nonNullBool, node);
12635 } 12718 }
12636 MethodGenerator.prototype.visitValue = function(node) { 12719 MethodGenerator.prototype.visitValue = function(node) {
12637 if (node == null) return null; 12720 if (node == null) return null;
12638 var value = node.visit(this); 12721 var value = node.visit(this);
(...skipping 12 matching lines...) Expand all
12651 return this.visitValue(node); 12734 return this.visitValue(node);
12652 } 12735 }
12653 MethodGenerator.prototype.visitDietStatement = function(node) { 12736 MethodGenerator.prototype.visitDietStatement = function(node) {
12654 var parser = new lang_Parser(node.span.file, false, false, false, node.span.st art); 12737 var parser = new lang_Parser(node.span.file, false, false, false, node.span.st art);
12655 this.visitStatementsInBlock(parser.block$0()); 12738 this.visitStatementsInBlock(parser.block$0());
12656 return false; 12739 return false;
12657 } 12740 }
12658 MethodGenerator.prototype.visitVariableDefinition = function(node) { 12741 MethodGenerator.prototype.visitVariableDefinition = function(node) {
12659 var $0; 12742 var $0;
12660 var isFinal = false; 12743 var isFinal = false;
12661 if ($notnull_bool(node.modifiers != null && $eq(node.modifiers.$index(0).kind, 97/*TokenKind.FINAL*/))) { 12744 if ($notnull_bool(node.modifiers != null && $eq(node.modifiers.$index(0).get$k ind(), 97/*TokenKind.FINAL*/))) {
12662 isFinal = true; 12745 isFinal = true;
12663 } 12746 }
12664 this.writer.write('var '); 12747 this.writer.write('var ');
12665 var type = this.method.resolveType(node.type, false); 12748 var type = this.method.resolveType(node.type, false);
12666 for (var i = 0; 12749 for (var i = 0;
12667 i < node.names.length; i++) { 12750 i < node.names.length; i++) {
12668 var thisType = type; 12751 var thisType = type;
12669 if (i > 0) { 12752 if (i > 0) {
12670 this.writer.write(', '); 12753 this.writer.write(', ');
12671 } 12754 }
12672 var name = node.names.$index(i).get$name(); 12755 var name = node.names.$index(i).get$name();
12673 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr ession())); 12756 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr ession()));
12674 if ($notnull_bool(isFinal)) { 12757 if ($notnull_bool(isFinal)) {
12675 if ($notnull_bool(value == null)) { 12758 if ($notnull_bool(value == null)) {
12676 world.error('no value specified for final variable', node.span); 12759 world.error('no value specified for final variable', node.span);
12677 } 12760 }
12678 else { 12761 else {
12679 if ($notnull_bool(thisType.get$isVar())) thisType = value.type; 12762 if ($notnull_bool(thisType.get$isVar())) thisType = value.get$type();
12680 } 12763 }
12681 } 12764 }
12682 var val = this._scope.create($assert_String(name), (thisType && thisType.is$ lang_Type()), node.names.$index(i).get$span(), false); 12765 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)) { 12766 if ($notnull_bool(value == null)) {
12684 this.writer.write(('' + val.code + '')); 12767 this.writer.write(('' + val.get$code() + ''));
12685 } 12768 }
12686 else { 12769 else {
12687 value = value.convertTo$3(this, type, node.values.$index(i)); 12770 value = value.convertTo$3(this, type, node.values.$index(i));
12688 this.writer.write(('' + val.code + ' = ' + value.code + '')); 12771 this.writer.write(('' + val.get$code() + ' = ' + value.get$code() + ''));
12689 } 12772 }
12690 } 12773 }
12691 this.writer.writeln(';'); 12774 this.writer.writeln(';');
12692 return false; 12775 return false;
12693 } 12776 }
12694 MethodGenerator.prototype.visitFunctionDefinition = function(node) { 12777 MethodGenerator.prototype.visitFunctionDefinition = function(node) {
12695 var $0; 12778 var $0;
12696 var name = world.toJsIdentifier(node.name.name); 12779 var name = world.toJsIdentifier(node.name.name);
12697 var meth = this._makeLambdaMethod($assert_String(name), node); 12780 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 ); 12781 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); 12782 meth.get$generator().writeDefinition$2(this.writer);
12700 return false; 12783 return false;
12701 } 12784 }
12702 MethodGenerator.prototype.visitReturnStatement = function(node) { 12785 MethodGenerator.prototype.visitReturnStatement = function(node) {
12703 if (node.value == null) { 12786 if (node.value == null) {
12704 this.writer.writeln('return;'); 12787 this.writer.writeln('return;');
12705 } 12788 }
12706 else { 12789 else {
12707 if ($notnull_bool(this.method.get$isConstructor())) { 12790 if ($notnull_bool(this.method.get$isConstructor())) {
12708 world.error('return of value not allowed from constructor', node.span); 12791 world.error('return of value not allowed from constructor', node.span);
12709 } 12792 }
12710 var value = this.visitTypedValue(node.value, this.method.get$returnType()); 12793 var value = this.visitTypedValue(node.value, this.method.get$returnType());
12711 this.writer.writeln(('return ' + value.code + ';')); 12794 this.writer.writeln(('return ' + value.get$code() + ';'));
12712 } 12795 }
12713 return true; 12796 return true;
12714 } 12797 }
12715 MethodGenerator.prototype.visitThrowStatement = function(node) { 12798 MethodGenerator.prototype.visitThrowStatement = function(node) {
12716 if (node.value != null) { 12799 if (node.value != null) {
12717 var value = this.visitValue(node.value); 12800 var value = this.visitValue(node.value);
12718 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY()); 12801 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY());
12719 this.writer.writeln(('\$throw(' + value.code + ');')); 12802 this.writer.writeln(('\$throw(' + value.get$code() + ');'));
12720 world.gen.corejs.useThrow = true; 12803 world.gen.corejs.useThrow = true;
12721 } 12804 }
12722 else { 12805 else {
12723 var rethrow = this._scope.getRethrow(); 12806 var rethrow = this._scope.getRethrow();
12724 if ($notnull_bool(rethrow == null)) { 12807 if ($notnull_bool(rethrow == null)) {
12725 world.error('rethrow outside of catch', node.span); 12808 world.error('rethrow outside of catch', node.span);
12726 } 12809 }
12727 else { 12810 else {
12728 this.writer.writeln(('throw ' + rethrow.code + ';')); 12811 this.writer.writeln(('throw ' + rethrow.get$code() + ';'));
12729 } 12812 }
12730 } 12813 }
12731 return true; 12814 return true;
12732 } 12815 }
12733 MethodGenerator.prototype.visitAssertStatement = function(node) { 12816 MethodGenerator.prototype.visitAssertStatement = function(node) {
12734 var $0; 12817 var $0;
12735 var test = this.visitValue(node.test); 12818 var test = this.visitValue(node.test);
12736 if ($notnull_bool(options.enableAsserts)) { 12819 if ($notnull_bool(options.enableAsserts)) {
12737 var err = world.corelib.types.$index('AssertError'); 12820 var err = world.corelib.types.$index('AssertError');
12738 world.gen.genMethod((($0 = err.getConstructor$1('')) && $0.is$Member())); 12821 world.gen.genMethod((($0 = err.getConstructor$1('')) && $0.is$Member()));
12739 world.gen.genMethod((($0 = err.get$members().$index('toString')) && $0.is$Me mber())); 12822 world.gen.genMethod((($0 = err.get$members().$index('toString')) && $0.is$Me mber()));
12740 var span = node.test.span; 12823 var span = node.test.span;
12741 var line = span.file.getLine(span.start); 12824 var line = span.get$file().getLine$1(span.get$start());
12742 var column = span.file.getColumn($assert_num(line), span.start); 12825 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) + ');')); 12826 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; 12827 world.gen.corejs.useAssert = true;
12745 } 12828 }
12746 return false; 12829 return false;
12747 } 12830 }
12748 MethodGenerator.prototype.visitBreakStatement = function(node) { 12831 MethodGenerator.prototype.visitBreakStatement = function(node) {
12749 if (node.label == null) { 12832 if (node.label == null) {
12750 this.writer.writeln('break;'); 12833 this.writer.writeln('break;');
12751 } 12834 }
12752 else { 12835 else {
12753 this.writer.writeln(('break ' + node.label.name + ';')); 12836 this.writer.writeln(('break ' + node.label.name + ';'));
12754 } 12837 }
12755 return true; 12838 return true;
12756 } 12839 }
12757 MethodGenerator.prototype.visitContinueStatement = function(node) { 12840 MethodGenerator.prototype.visitContinueStatement = function(node) {
12758 if (node.label == null) { 12841 if (node.label == null) {
12759 this.writer.writeln('continue;'); 12842 this.writer.writeln('continue;');
12760 } 12843 }
12761 else { 12844 else {
12762 this.writer.writeln(('continue ' + node.label.name + ';')); 12845 this.writer.writeln(('continue ' + node.label.name + ';'));
12763 } 12846 }
12764 return true; 12847 return true;
12765 } 12848 }
12766 MethodGenerator.prototype.visitIfStatement = function(node) { 12849 MethodGenerator.prototype.visitIfStatement = function(node) {
12767 var test = this.visitBool(node.test); 12850 var test = this.visitBool(node.test);
12768 this.writer.write(('if (' + test.code + ') ')); 12851 this.writer.write(('if (' + test.get$code() + ') '));
12769 var exit1 = node.trueBranch.visit(this); 12852 var exit1 = node.trueBranch.visit(this);
12770 if (node.falseBranch != null) { 12853 if (node.falseBranch != null) {
12771 this.writer.write('else '); 12854 this.writer.write('else ');
12772 if ($notnull_bool(node.falseBranch.visit(this) && exit1)) { 12855 if ($notnull_bool(node.falseBranch.visit(this) && exit1)) {
12773 return true; 12856 return true;
12774 } 12857 }
12775 } 12858 }
12776 return false; 12859 return false;
12777 } 12860 }
12778 MethodGenerator.prototype.visitWhileStatement = function(node) { 12861 MethodGenerator.prototype.visitWhileStatement = function(node) {
12779 var test = this.visitBool(node.test); 12862 var test = this.visitBool(node.test);
12780 this.writer.write(('while (' + test.code + ') ')); 12863 this.writer.write(('while (' + test.get$code() + ') '));
12781 this._pushBlock(true); 12864 this._pushBlock(true);
12782 node.body.visit(this); 12865 node.body.visit(this);
12783 this._popBlock(); 12866 this._popBlock();
12784 return false; 12867 return false;
12785 } 12868 }
12786 MethodGenerator.prototype.visitDoStatement = function(node) { 12869 MethodGenerator.prototype.visitDoStatement = function(node) {
12787 this.writer.write('do '); 12870 this.writer.write('do ');
12788 this._pushBlock(true); 12871 this._pushBlock(true);
12789 node.body.visit(this); 12872 node.body.visit(this);
12790 this._popBlock(); 12873 this._popBlock();
12791 var test = this.visitBool(node.test); 12874 var test = this.visitBool(node.test);
12792 this.writer.writeln(('while (' + test.code + ')')); 12875 this.writer.writeln(('while (' + test.get$code() + ')'));
12793 return false; 12876 return false;
12794 } 12877 }
12795 MethodGenerator.prototype.visitForStatement = function(node) { 12878 MethodGenerator.prototype.visitForStatement = function(node) {
12796 this._pushBlock(false); 12879 this._pushBlock(false);
12797 this.writer.write('for ('); 12880 this.writer.write('for (');
12798 if (node.init != null) node.init.visit(this); 12881 if (node.init != null) node.init.visit(this);
12799 else this.writer.write(';'); 12882 else this.writer.write(';');
12800 if (node.test != null) { 12883 if (node.test != null) {
12801 var test = this.visitBool(node.test); 12884 var test = this.visitBool(node.test);
12802 this.writer.write((' ' + test.code + '; ')); 12885 this.writer.write((' ' + test.get$code() + '; '));
12803 } 12886 }
12804 else { 12887 else {
12805 this.writer.write('; '); 12888 this.writer.write('; ');
12806 } 12889 }
12807 var needsComma = false; 12890 var needsComma = false;
12808 var $list = node.step; 12891 var $list = node.step;
12809 for (var $i = 0;$i < $list.length; $i++) { 12892 for (var $i = 0;$i < $list.length; $i++) {
12810 var s = $list.$index($i); 12893 var s = $list.$index($i);
12811 if ($notnull_bool(needsComma)) this.writer.write(', '); 12894 if ($notnull_bool(needsComma)) this.writer.write(', ');
12812 var sv = this.visitVoid((s && s.is$lang_Expression())); 12895 var sv = this.visitVoid((s && s.is$lang_Expression()));
12813 this.writer.write($assert_String(sv.code)); 12896 this.writer.write($assert_String(sv.get$code()));
12814 needsComma = true; 12897 needsComma = true;
12815 } 12898 }
12816 this.writer.write(') '); 12899 this.writer.write(') ');
12817 this._pushBlock(true); 12900 this._pushBlock(true);
12818 node.body.visit(this); 12901 node.body.visit(this);
12819 this._popBlock(); 12902 this._popBlock();
12820 this._popBlock(); 12903 this._popBlock();
12821 return false; 12904 return false;
12822 } 12905 }
12823 MethodGenerator.prototype.visitForInStatement = function(node) { 12906 MethodGenerator.prototype.visitForInStatement = function(node) {
12824 var $0; 12907 var $0;
12825 var itemType = this.method.resolveType(node.item.type, false); 12908 var itemType = this.method.resolveType(node.item.type, false);
12826 var itemName = node.item.name.name; 12909 var itemName = node.item.name.name;
12827 var list = node.list.visit(this); 12910 var list = node.list.visit(this);
12828 this._pushBlock(true); 12911 this._pushBlock(true);
12829 var item = this._scope.create($assert_String(itemName), (itemType && itemType. is$lang_Type()), node.item.name.span, false); 12912 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()); 12913 var listVar = (list && list.is$Value());
12831 if ($notnull_bool(list.needsTemp)) { 12914 if ($notnull_bool(list.get$needsTemp())) {
12832 listVar = this._scope.create('\$list', (($0 = list.type) && $0.is$lang_Type( )), null, false); 12915 listVar = this._scope.create('\$list', (($0 = list.get$type()) && $0.is$lang _Type()), null, false);
12833 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';')); 12916 this.writer.writeln(('var ' + listVar.code + ' = ' + list.get$code() + ';')) ;
12834 } 12917 }
12835 if ($notnull_bool(list.type.get$isList())) { 12918 if ($notnull_bool(list.get$type().get$isList())) {
12836 var tmpi = this._scope.create('\$i', world.numType, null, false); 12919 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 + '++) {')); 12920 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); 12921 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [ tmpi]), false);
12839 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';')); 12922 this.writer.writeln(('var ' + item.get$code() + ' = ' + value.get$code() + ' ;'));
12840 } 12923 }
12841 else { 12924 else {
12842 this._pushBlock(false); 12925 this._pushBlock(false);
12843 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT Y()); 12926 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); 12927 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( )); 12928 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()); 12929 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY());
12847 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + '; ' + hasNext.code + '; ) {')); 12930 this.writer.enterBlock(('for (var ' + tmpi.get$code() + ' = ' + iterator.get $code() + '; ' + hasNext.get$code() + '; ) {'));
12848 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';')); 12931 this.writer.writeln(('var ' + item.get$code() + ' = ' + next.get$code() + '; '));
12849 } 12932 }
12850 this.visitStatementsInBlock(node.body); 12933 this.visitStatementsInBlock(node.body);
12851 this.writer.exitBlock('}'); 12934 this.writer.exitBlock('}');
12852 this._popBlock(); 12935 this._popBlock();
12853 return false; 12936 return false;
12854 } 12937 }
12855 MethodGenerator.prototype._genToDartException = function(ex, node) { 12938 MethodGenerator.prototype._genToDartException = function(ex, node) {
12856 var types = const$397/*const [ 12939 var types = const$397/*const [
12857 'NullPointerException', 'ObjectNotClosureException', 12940 'NullPointerException', 'ObjectNotClosureException',
12858 'NoSuchMethodException', 'StackOverflowException']*/; 12941 'NoSuchMethodException', 'StackOverflowException']*/;
(...skipping 10 matching lines...) Expand all
12869 var $0; 12952 var $0;
12870 this.writer.enterBlock('try {'); 12953 this.writer.enterBlock('try {');
12871 this._pushBlock(false); 12954 this._pushBlock(false);
12872 this.visitStatementsInBlock(node.body); 12955 this.visitStatementsInBlock(node.body);
12873 this._popBlock(); 12956 this._popBlock();
12874 if (node.catches.length == 1) { 12957 if (node.catches.length == 1) {
12875 var catch_ = node.catches.$index(0); 12958 var catch_ = node.catches.$index(0);
12876 this._pushBlock(false); 12959 this._pushBlock(false);
12877 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare dIdentifier())); 12960 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare dIdentifier()));
12878 this._scope.rethrow = (ex && ex.is$Value()); 12961 this._scope.rethrow = (ex && ex.is$Value());
12879 this.writer.nextBlock(('} catch (' + ex.code + ') {')); 12962 this.writer.nextBlock(('} catch (' + ex.get$code() + ') {'));
12880 if (catch_.trace != null) { 12963 if ($notnull_bool($ne(catch_.get$trace(), null))) {
12881 var trace = this._scope.declare(catch_.trace); 12964 var trace = this._scope.declare((($0 = catch_.get$trace()) && $0.is$Declar edIdentifier()));
12882 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); 12965 this.writer.writeln(('var ' + trace.get$code() + ' = \$stackTraceOf(' + ex .get$code() + ');'));
12883 world.gen.corejs.useStackTraceOf = true; 12966 world.gen.corejs.useStackTraceOf = true;
12884 } 12967 }
12885 this._genToDartException($assert_String(ex.code), node); 12968 this._genToDartException($assert_String(ex.get$code()), node);
12886 if (!$notnull_bool(ex.type.get$isVar())) { 12969 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); 12970 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 + ';')); 12971 this.writer.writeln(('if (' + test.get$code() + ') throw ' + ex.get$code() + ';'));
12889 } 12972 }
12890 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan g_Statement())); 12973 this.visitStatementsInBlock((($0 = node.catches.$index(0).get$body()) && $0. is$lang_Statement()));
12891 this._popBlock(); 12974 this._popBlock();
12892 } 12975 }
12893 else if (node.catches.length > 0) { 12976 else if (node.catches.length > 0) {
12894 this._pushBlock(false); 12977 this._pushBlock(false);
12895 var ex = this._scope.create('\$ex', world.varType, null, false); 12978 var ex = this._scope.create('\$ex', world.varType, null, false);
12896 this._scope.rethrow = (ex && ex.is$Value()); 12979 this._scope.rethrow = (ex && ex.is$Value());
12897 this.writer.nextBlock(('} catch (' + ex.code + ') {')); 12980 this.writer.nextBlock(('} catch (' + ex.get$code() + ') {'));
12898 var trace = null; 12981 var trace = null;
12899 if (node.catches.some((function (c) { 12982 if (node.catches.some((function (c) {
12900 return c.trace != null; 12983 return $ne(c.get$trace(), null);
12901 }) 12984 })
12902 )) { 12985 )) {
12903 trace = this._scope.create('\$trace', world.varType, null, false); 12986 trace = this._scope.create('\$trace', world.varType, null, false);
12904 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); 12987 this.writer.writeln(('var ' + trace.get$code() + ' = \$stackTraceOf(' + ex .get$code() + ');'));
12905 world.gen.corejs.useStackTraceOf = true; 12988 world.gen.corejs.useStackTraceOf = true;
12906 } 12989 }
12907 this._genToDartException($assert_String(ex.code), node); 12990 this._genToDartException($assert_String(ex.get$code()), node);
12908 var needsRethrow = true; 12991 var needsRethrow = true;
12909 for (var i = 0; 12992 for (var i = 0;
12910 i < node.catches.length; i++) { 12993 i < node.catches.length; i++) {
12911 var catch_ = node.catches.$index(i); 12994 var catch_ = node.catches.$index(i);
12912 this._pushBlock(false); 12995 this._pushBlock(false);
12913 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl aredIdentifier())); 12996 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl aredIdentifier()));
12914 if (!$notnull_bool(tmp.type.get$isVar())) { 12997 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); 12998 var test = ex.instanceOf$3$isTrue$forceCheck(this, tmp.get$type(), catch _.get$exception().get$span(), true, true);
12916 if (i == 0) { 12999 if (i == 0) {
12917 this.writer.enterBlock(('if (' + test.code + ') {')); 13000 this.writer.enterBlock(('if (' + test.get$code() + ') {'));
12918 } 13001 }
12919 else { 13002 else {
12920 this.writer.nextBlock(('} else if (' + test.code + ') {')); 13003 this.writer.nextBlock(('} else if (' + test.get$code() + ') {'));
12921 } 13004 }
12922 } 13005 }
12923 else if (i > 0) { 13006 else if (i > 0) {
12924 this.writer.nextBlock('} else {'); 13007 this.writer.nextBlock('} else {');
12925 } 13008 }
12926 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';')); 13009 this.writer.writeln(('var ' + tmp.get$code() + ' = ' + ex.get$code() + ';' ));
12927 if (catch_.trace != null) { 13010 if ($notnull_bool($ne(catch_.get$trace(), null))) {
12928 var tmptrace = this._scope.declare(catch_.trace); 13011 var tmptrace = this._scope.declare((($0 = catch_.get$trace()) && $0.is$D eclaredIdentifier()));
12929 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';')) ; 13012 this.writer.writeln(('var ' + tmptrace.get$code() + ' = ' + trace.get$co de() + ';'));
12930 } 13013 }
12931 this.visitStatementsInBlock((($0 = catch_.body) && $0.is$lang_Statement()) ); 13014 this.visitStatementsInBlock((($0 = catch_.get$body()) && $0.is$lang_Statem ent()));
12932 this._popBlock(); 13015 this._popBlock();
12933 if ($notnull_bool(tmp.type.get$isVar())) { 13016 if ($notnull_bool(tmp.get$type().get$isVar())) {
12934 if (i + 1 < node.catches.length) { 13017 if (i + 1 < node.catches.length) {
12935 world.warning('Unreachable catch clause', (($0 = node.catches.$index(i + 1)) && $0.is$SourceSpan())); 13018 world.warning('Unreachable catch clause', (($0 = node.catches.$index(i + 1)) && $0.is$SourceSpan()));
12936 } 13019 }
12937 if (i > 0) { 13020 if (i > 0) {
12938 this.writer.exitBlock('}'); 13021 this.writer.exitBlock('}');
12939 } 13022 }
12940 needsRethrow = false; 13023 needsRethrow = false;
12941 break; 13024 break;
12942 } 13025 }
12943 } 13026 }
12944 if ($notnull_bool(needsRethrow)) { 13027 if ($notnull_bool(needsRethrow)) {
12945 this.writer.nextBlock('} else {'); 13028 this.writer.nextBlock('} else {');
12946 this.writer.writeln(('throw ' + ex.code + ';')); 13029 this.writer.writeln(('throw ' + ex.get$code() + ';'));
12947 this.writer.exitBlock('}'); 13030 this.writer.exitBlock('}');
12948 } 13031 }
12949 this._popBlock(); 13032 this._popBlock();
12950 } 13033 }
12951 if (node.finallyBlock != null) { 13034 if (node.finallyBlock != null) {
12952 this.writer.nextBlock('} finally {'); 13035 this.writer.nextBlock('} finally {');
12953 this._pushBlock(false); 13036 this._pushBlock(false);
12954 this.visitStatementsInBlock(node.finallyBlock); 13037 this.visitStatementsInBlock(node.finallyBlock);
12955 this._popBlock(); 13038 this._popBlock();
12956 } 13039 }
12957 this.writer.exitBlock('}'); 13040 this.writer.exitBlock('}');
12958 return false; 13041 return false;
12959 } 13042 }
12960 MethodGenerator.prototype.visitSwitchStatement = function(node) { 13043 MethodGenerator.prototype.visitSwitchStatement = function(node) {
13044 var $0;
12961 var test = this.visitValue(node.test); 13045 var test = this.visitValue(node.test);
12962 this.writer.enterBlock(('switch (' + test.code + ') {')); 13046 this.writer.enterBlock(('switch (' + test.get$code() + ') {'));
12963 var $list = node.cases; 13047 var $list = node.cases;
12964 for (var $i = 0;$i < $list.length; $i++) { 13048 for (var $i = 0;$i < $list.length; $i++) {
12965 var case_ = $list.$index($i); 13049 var case_ = $list.$index($i);
12966 if (case_.label != null) { 13050 if ($notnull_bool($ne(case_.get$label(), null))) {
12967 world.error('unimplemented: labeled case statement', case_.get$span()); 13051 world.error('unimplemented: labeled case statement', (($0 = case_.get$span ()) && $0.is$SourceSpan()));
12968 } 13052 }
12969 this._pushBlock(false); 13053 this._pushBlock(false);
12970 for (var i = 0; 13054 for (var i = 0;
12971 i < case_.cases.length; i++) { 13055 i < $assert_num(case_.get$cases().length); i++) {
12972 var expr = case_.cases.$index(i); 13056 var expr = case_.get$cases().$index(i);
12973 if ($notnull_bool(expr == null)) { 13057 if ($notnull_bool(expr == null)) {
12974 if (i < case_.cases.length - 1) { 13058 if (i < case_.get$cases().length - 1) {
12975 world.error('default clause must be the last case', case_.get$span()); 13059 world.error('default clause must be the last case', (($0 = case_.get$s pan()) && $0.is$SourceSpan()));
12976 } 13060 }
12977 this.writer.writeln('default:'); 13061 this.writer.writeln('default:');
12978 } 13062 }
12979 else { 13063 else {
12980 var value = this.visitValue((expr && expr.is$lang_Expression())); 13064 var value = this.visitValue((expr && expr.is$lang_Expression()));
12981 this.writer.writeln(('case ' + value.code + ':')); 13065 this.writer.writeln(('case ' + value.get$code() + ':'));
12982 } 13066 }
12983 } 13067 }
12984 this.writer.enterBlock(''); 13068 this.writer.enterBlock('');
12985 var caseExits = this._visitAllStatements(case_.statements, false); 13069 var caseExits = this._visitAllStatements(case_.get$statements(), false);
12986 if ($notnull_bool($ne(case_, node.cases.$index(node.cases.length - 1)) && !$ notnull_bool(caseExits))) { 13070 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() ; 13071 var span = case_.get$statements().$index(case_.get$statements().length - 1 ).get$span();
12988 this.writer.writeln('\$throw(new FallThroughError());'); 13072 this.writer.writeln('\$throw(new FallThroughError());');
12989 world.gen.corejs.useThrow = true; 13073 world.gen.corejs.useThrow = true;
12990 } 13074 }
12991 this.writer.exitBlock(''); 13075 this.writer.exitBlock('');
12992 this._popBlock(); 13076 this._popBlock();
12993 } 13077 }
12994 this.writer.exitBlock('}'); 13078 this.writer.exitBlock('}');
12995 return false; 13079 return false;
12996 } 13080 }
12997 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { 13081 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) {
13082 var $0;
12998 for (var i = 0; 13083 for (var i = 0;
12999 i < statementList.length; i++) { 13084 i < $assert_num(statementList.length); i++) {
13000 var stmt = statementList.$index(i); 13085 var stmt = statementList.$index(i);
13001 exits = stmt.visit$1(this); 13086 exits = stmt.visit$1(this);
13002 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1)) && exits)) { 13087 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1)) && exits)) {
13003 world.warning('unreachable code', statementList.$index(i + 1).get$span()); 13088 world.warning('unreachable code', (($0 = statementList.$index(i + 1).get$s pan()) && $0.is$SourceSpan()));
13004 } 13089 }
13005 } 13090 }
13006 return $assert_bool(exits); 13091 return $assert_bool(exits);
13007 } 13092 }
13008 MethodGenerator.prototype.visitBlockStatement = function(node) { 13093 MethodGenerator.prototype.visitBlockStatement = function(node) {
13009 this._pushBlock(false); 13094 this._pushBlock(false);
13010 this.writer.enterBlock('{'); 13095 this.writer.enterBlock('{');
13011 var exits = this._visitAllStatements(node.body, false); 13096 var exits = this._visitAllStatements(node.body, false);
13012 this.writer.exitBlock('}'); 13097 this.writer.exitBlock('}');
13013 this._popBlock(); 13098 this._popBlock();
13014 return $assert_bool(exits); 13099 return $assert_bool(exits);
13015 } 13100 }
13016 MethodGenerator.prototype.visitLabeledStatement = function(node) { 13101 MethodGenerator.prototype.visitLabeledStatement = function(node) {
13017 this.writer.writeln(('' + node.name.name + ':')); 13102 this.writer.writeln(('' + node.name.name + ':'));
13018 node.body.visit(this); 13103 node.body.visit(this);
13019 return false; 13104 return false;
13020 } 13105 }
13021 MethodGenerator.prototype.visitExpressionStatement = function(node) { 13106 MethodGenerator.prototype.visitExpressionStatement = function(node) {
13022 if ((node.body instanceof VarExpression) || (node.body instanceof ThisExpressi on)) { 13107 if ((node.body instanceof VarExpression) || (node.body instanceof ThisExpressi on)) {
13023 world.warning('variable used as statement', node.span); 13108 world.warning('variable used as statement', node.span);
13024 } 13109 }
13025 var value = this.visitVoid(node.body); 13110 var value = this.visitVoid(node.body);
13026 this.writer.writeln(('' + value.code + ';')); 13111 this.writer.writeln(('' + value.get$code() + ';'));
13027 return false; 13112 return false;
13028 } 13113 }
13029 MethodGenerator.prototype.visitEmptyStatement = function(node) { 13114 MethodGenerator.prototype.visitEmptyStatement = function(node) {
13030 this.writer.writeln(';'); 13115 this.writer.writeln(';');
13031 return false; 13116 return false;
13032 } 13117 }
13033 MethodGenerator.prototype._checkNonStatic = function(node) { 13118 MethodGenerator.prototype._checkNonStatic = function(node) {
13034 if ($notnull_bool(this.get$isStatic())) { 13119 if ($notnull_bool(this.get$isStatic())) {
13035 world.warning('not allowed in static method', node.span); 13120 world.warning('not allowed in static method', node.span);
13036 } 13121 }
13037 } 13122 }
13038 MethodGenerator.prototype._makeSuperValue = function(node) { 13123 MethodGenerator.prototype._makeSuperValue = function(node) {
13039 var parentType = this.method.declaringType.get$parent(); 13124 var parentType = this.method.declaringType.get$parent();
13040 this._checkNonStatic(node); 13125 this._checkNonStatic(node);
13041 if ($notnull_bool(parentType == null)) { 13126 if ($notnull_bool(parentType == null)) {
13042 world.error('no super class', node.span); 13127 world.error('no super class', node.span);
13043 } 13128 }
13044 var ret = new Value(parentType, 'this', node.span, false); 13129 var ret = new Value(parentType, 'this', node.span, false);
13045 ret.isSuper = true; 13130 ret.set$isSuper(true);
13046 return ret; 13131 return ret;
13047 } 13132 }
13048 MethodGenerator.prototype._getOutermostMethod = function() { 13133 MethodGenerator.prototype._getOutermostMethod = function() {
13049 var result = this; 13134 var result = this;
13050 while (result.enclosingMethod != null) { 13135 while ($notnull_bool($ne(result.get$enclosingMethod(), null))) {
13051 result = result.enclosingMethod; 13136 result = result.get$enclosingMethod();
13052 } 13137 }
13053 return result; 13138 return result;
13054 } 13139 }
13055 MethodGenerator.prototype._makeThisCode = function() { 13140 MethodGenerator.prototype._makeThisCode = function() {
13056 if (this.enclosingMethod != null) { 13141 if (this.enclosingMethod != null) {
13057 this._getOutermostMethod().needsThis = true; 13142 this._getOutermostMethod().set$needsThis(true);
13058 return '\$this'; 13143 return '\$this';
13059 } 13144 }
13060 else { 13145 else {
13061 return 'this'; 13146 return 'this';
13062 } 13147 }
13063 } 13148 }
13064 MethodGenerator.prototype._makeThisValue = function(node) { 13149 MethodGenerator.prototype._makeThisValue = function(node) {
13065 if (this.enclosingMethod != null) { 13150 if (this.enclosingMethod != null) {
13066 var outermostMethod = this._getOutermostMethod(); 13151 var outermostMethod = this._getOutermostMethod();
13067 outermostMethod._checkNonStatic(node); 13152 outermostMethod._checkNonStatic(node);
13068 outermostMethod.needsThis = true; 13153 outermostMethod.set$needsThis(true);
13069 return new Value(outermostMethod.method.declaringType, '\$this', node != nul l ? node.span : null, false); 13154 return new Value(outermostMethod.method.get$declaringType(), '\$this', node != null ? node.span : null, false);
13070 } 13155 }
13071 else { 13156 else {
13072 this._checkNonStatic(node); 13157 this._checkNonStatic(node);
13073 return new Value(this.method.declaringType, 'this', node != null ? node.span : null, false); 13158 return new Value(this.method.declaringType, 'this', node != null ? node.span : null, false);
13074 } 13159 }
13075 } 13160 }
13076 MethodGenerator.prototype.visitLambdaExpression = function(node) { 13161 MethodGenerator.prototype.visitLambdaExpression = function(node) {
13077 var name = ''; 13162 var name = '';
13078 if (node.func.name != null) { 13163 if (node.func.name != null) {
13079 name = world.toJsIdentifier(node.func.name.name); 13164 name = world.toJsIdentifier(node.func.name.name);
13080 } 13165 }
13081 var meth = this._makeLambdaMethod($assert_String(name), node.func); 13166 var meth = this._makeLambdaMethod($assert_String(name), node.func);
13082 var w = new CodeWriter(); 13167 var w = new CodeWriter();
13083 meth.generator.writeDefinition$2(w, node); 13168 meth.get$generator().writeDefinition$2(w, node);
13084 return new Value(meth.get$functionType(), w.get$text(), node.span, true); 13169 return new Value(meth.get$functionType(), w.get$text(), node.span, true);
13085 } 13170 }
13086 MethodGenerator.prototype.visitCallExpression = function(node) { 13171 MethodGenerator.prototype.visitCallExpression = function(node) {
13087 var $0; 13172 var $0;
13088 var target; 13173 var target;
13089 var position = node.target; 13174 var position = node.target;
13090 var name = '\$call'; 13175 var name = '\$call';
13091 if ((node.target instanceof DotExpression)) { 13176 if ((node.target instanceof DotExpression)) {
13092 var dot = (($0 = node.target) && $0.is$DotExpression()); 13177 var dot = (($0 = node.target) && $0.is$DotExpression());
13093 target = dot.self.visit(this); 13178 target = dot.self.visit(this);
(...skipping 19 matching lines...) Expand all
13113 var target = this.visitValue(node.target); 13198 var target = this.visitValue(node.target);
13114 var index = this.visitValue(node.index); 13199 var index = this.visitValue(node.index);
13115 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); 13200 return target.invoke$4(this, '\$index', node, new Arguments(null, [index]));
13116 } 13201 }
13117 MethodGenerator.prototype.visitBinaryExpression = function(node) { 13202 MethodGenerator.prototype.visitBinaryExpression = function(node) {
13118 var $0; 13203 var $0;
13119 var kind = node.op.kind; 13204 var kind = node.op.kind;
13120 if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) { 13205 if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) {
13121 var x = this.visitValue(node.x); 13206 var x = this.visitValue(node.x);
13122 var y = this.visitValue(node.y); 13207 var y = this.visitValue(node.y);
13123 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); 13208 var code = ('' + x.get$code() + ' ' + node.op + ' ' + y.get$code() + '');
13124 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { 13209 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()); 13210 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); 13211 return EvaluatedValue.EvaluatedValue$factory((($0 = x.get$type()) && $0.is $lang_Type()), value, ('' + value + ''), node.span);
13127 } 13212 }
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); 13213 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); 13214 return ret.convertTo$3(this, world.nonNullBool, node);
13130 } 13215 }
13131 else if (kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenKind.NE_STRICT* /) { 13216 else if (kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenKind.NE_STRICT* /) {
13132 var x = this.visitValue(node.x); 13217 var x = this.visitValue(node.x);
13133 var y = this.visitValue(node.y); 13218 var y = this.visitValue(node.y);
13134 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { 13219 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()); 13220 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); 13221 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, value, ("" + value + ""), node.span);
13137 } 13222 }
13138 if ($notnull_bool($eq(x.code, 'null') || $eq(y.code, 'null'))) { 13223 if ($notnull_bool($eq(x.get$code(), 'null') || $eq(y.get$code(), 'null'))) {
13139 var op = node.op.toString().substring(0, 2); 13224 var op = node.op.toString().substring(0, 2);
13140 return new Value(world.nonNullBool, ('' + x.code + ' ' + op + ' ' + y.code + ''), node.span, true); 13225 return new Value(world.nonNullBool, ('' + x.get$code() + ' ' + op + ' ' + y.get$code() + ''), node.span, true);
13141 } 13226 }
13142 else { 13227 else {
13143 return new Value(world.nonNullBool, ('' + x.code + ' ' + node.op + ' ' + y .code + ''), node.span, true); 13228 return new Value(world.nonNullBool, ('' + x.get$code() + ' ' + node.op + ' ' + y.get$code() + ''), node.span, true);
13144 } 13229 }
13145 } 13230 }
13146 var assignKind = TokenKind.kindFromAssign(node.op.kind); 13231 var assignKind = TokenKind.kindFromAssign(node.op.kind);
13147 if (assignKind == -1) { 13232 if (assignKind == -1) {
13148 var x = this.visitValue(node.x); 13233 var x = this.visitValue(node.x);
13149 var y = this.visitValue(node.y); 13234 var y = this.visitValue(node.y);
13150 var name = TokenKind.binaryMethodName(node.op.kind); 13235 var name = TokenKind.binaryMethodName(node.op.kind);
13151 if (node.op.kind == 49/*TokenKind.NE*/) { 13236 if (node.op.kind == 49/*TokenKind.NE*/) {
13152 name = '\$ne'; 13237 name = '\$ne';
13153 } 13238 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
13215 right = captureOriginal((right && right.is$Value())); 13300 right = captureOriginal((right && right.is$Value()));
13216 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, n ew Arguments(null, [y])); 13301 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, n ew Arguments(null, [y]));
13217 } 13302 }
13218 return members._set$4(this, position, x, y); 13303 return members._set$4(this, position, x, y);
13219 } 13304 }
13220 else { 13305 else {
13221 x = members._get$3(this, position, x); 13306 x = members._get$3(this, position, x);
13222 } 13307 }
13223 } 13308 }
13224 } 13309 }
13225 y = y.convertTo$3(this, x.type, yn); 13310 y = y.convertTo$3(this, x.get$type(), yn);
13226 if (kind == 0) { 13311 if (kind == 0) {
13227 x = captureOriginal((x && x.is$Value())); 13312 x = captureOriginal((x && x.is$Value()));
13228 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, true); 13313 return new Value(y.get$type(), ('' + x.get$code() + ' = ' + y.get$code() + ' '), position.span, true);
13229 } 13314 }
13230 else if ($notnull_bool(x.type.get$isNum() && y.type.get$isNum()) && (kind != 4 6/*TokenKind.TRUNCDIV*/)) { 13315 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())); 13316 x = captureOriginal((x && x.is$Value()));
13232 var op = TokenKind.kindToString(kind); 13317 var op = TokenKind.kindToString(kind);
13233 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), posi tion.span, true); 13318 return new Value(y.get$type(), ('' + x.get$code() + ' ' + op + '= ' + y.get$ code() + ''), position.span, true);
13234 } 13319 }
13235 else { 13320 else {
13236 var right = x; 13321 var right = x;
13237 right = captureOriginal((right && right.is$Value())); 13322 right = captureOriginal((right && right.is$Value()));
13238 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg uments(null, [y])); 13323 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); 13324 return new Value(y.get$type(), ('' + x.get$code() + ' = ' + y.get$code() + ' '), position.span, true);
13240 } 13325 }
13241 } 13326 }
13242 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c aptureOriginal) { 13327 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c aptureOriginal) {
13243 var target = this.visitValue(xn.target); 13328 var target = this.visitValue(xn.target);
13244 var index = this.visitValue(xn.index); 13329 var index = this.visitValue(xn.index);
13245 var y = this.visitValue(yn); 13330 var y = this.visitValue(yn);
13246 var tmptarget = target; 13331 var tmptarget = target;
13247 var tmpindex = index; 13332 var tmpindex = index;
13248 if (kind != 0) { 13333 if (kind != 0) {
13249 tmptarget = this.getTemp((target && target.is$Value())); 13334 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())); 13357 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg et.is$Value()));
13273 return ret; 13358 return ret;
13274 } 13359 }
13275 MethodGenerator.prototype.visitUnaryExpression = function(node) { 13360 MethodGenerator.prototype.visitUnaryExpression = function(node) {
13276 var $0; 13361 var $0;
13277 var value = this.visitValue(node.self); 13362 var value = this.visitValue(node.self);
13278 switch (node.op.kind) { 13363 switch (node.op.kind) {
13279 case 16/*TokenKind.INCR*/: 13364 case 16/*TokenKind.INCR*/:
13280 case 17/*TokenKind.DECR*/: 13365 case 17/*TokenKind.DECR*/:
13281 13366
13282 if ($notnull_bool(value.type.get$isNum())) { 13367 if ($notnull_bool(value.get$type().get$isNum())) {
13283 return new Value(value.type, ('' + node.op + '' + value.code + ''), node .span, true); 13368 return new Value(value.get$type(), ('' + node.op + '' + value.get$code() + ''), node.span, true);
13284 } 13369 }
13285 else { 13370 else {
13286 var kind = (16/*TokenKind.INCR*/ == node.op.kind ? 42/*TokenKind.ADD*/ : 43/*TokenKind.SUB*/); 13371 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); 13372 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)); 13373 return this._visitAssign($assert_num(kind), node.self, (operand && opera nd.is$lang_Expression()), node, to$call$1(null));
13289 } 13374 }
13290 13375
13291 case 19/*TokenKind.NOT*/: 13376 case 19/*TokenKind.NOT*/:
13292 13377
13293 if ($notnull_bool(value.type.get$isBool() && value.get$isConst())) { 13378 if ($notnull_bool(value.get$type().get$isBool() && value.get$isConst())) {
13294 var newVal = !$notnull_bool(value.get$actualValue()); 13379 var newVal = !$notnull_bool(value.get$actualValue());
13295 return EvaluatedValue.EvaluatedValue$factory((($0 = value.type) && $0.is $lang_Type()), newVal, ('' + newVal + ''), node.span); 13380 return EvaluatedValue.EvaluatedValue$factory((($0 = value.get$type()) && $0.is$lang_Type()), newVal, ('' + newVal + ''), node.span);
13296 } 13381 }
13297 else { 13382 else {
13298 var newVal = value.convertTo$3(this, world.nonNullBool, node); 13383 var newVal = value.convertTo$3(this, world.nonNullBool, node);
13299 return new Value(newVal.type, ('!' + newVal.code + ''), node.span, true) ; 13384 return new Value(newVal.get$type(), ('!' + newVal.get$code() + ''), node .span, true);
13300 } 13385 }
13301 13386
13302 case 42/*TokenKind.ADD*/: 13387 case 42/*TokenKind.ADD*/:
13303 13388
13304 return value.convertTo$3(this, world.numType, node); 13389 return value.convertTo$3(this, world.numType, node);
13305 13390
13306 case 43/*TokenKind.SUB*/: 13391 case 43/*TokenKind.SUB*/:
13307 case 18/*TokenKind.BIT_NOT*/: 13392 case 18/*TokenKind.BIT_NOT*/:
13308 13393
13309 if (node.op.kind == 18/*TokenKind.BIT_NOT*/) { 13394 if (node.op.kind == 18/*TokenKind.BIT_NOT*/) {
13310 return value.invoke$4(this, '\$bit_not', node, Arguments.get$EMPTY()); 13395 return value.invoke$4(this, '\$bit_not', node, Arguments.get$EMPTY());
13311 } 13396 }
13312 else if (node.op.kind == 43/*TokenKind.SUB*/) { 13397 else if (node.op.kind == 43/*TokenKind.SUB*/) {
13313 return value.invoke$4(this, '\$negate', node, Arguments.get$EMPTY()); 13398 return value.invoke$4(this, '\$negate', node, Arguments.get$EMPTY());
13314 } 13399 }
13315 else { 13400 else {
13316 world.internalError(('unimplemented: unary ' + node.op + ''), node.span) ; 13401 world.internalError(('unimplemented: unary ' + node.op + ''), node.span) ;
13317 } 13402 }
13318 $throw(new FallThroughError()); 13403 $throw(new FallThroughError());
13319 13404
13320 default: 13405 default:
13321 13406
13322 world.internalError(('unimplemented: ' + node.op + ''), node.span); 13407 world.internalError(('unimplemented: ' + node.op + ''), node.span);
13323 13408
13324 } 13409 }
13325 } 13410 }
13326 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { 13411 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) {
13327 var $this = this; // closure support 13412 var $this = this; // closure support
13328 var value = this.visitValue(node.body); 13413 var value = this.visitValue(node.body);
13329 if ($notnull_bool(value.type.get$isNum())) { 13414 if ($notnull_bool(value.get$type().get$isNum())) {
13330 return new Value(value.type, ('' + value.code + '' + node.op + ''), node.spa n, true); 13415 return new Value(value.get$type(), ('' + value.get$code() + '' + node.op + ' '), node.span, true);
13331 } 13416 }
13332 var kind = (16/*TokenKind.INCR*/ == node.op.kind) ? 42/*TokenKind.ADD*/ : 43/* TokenKind.SUB*/; 13417 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); 13418 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT ype), '1', node.span);
13334 var tmpleft = null, left = null; 13419 var tmpleft = null, left = null;
13335 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand. is$lang_Expression()), node, (function (l) { 13420 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand. is$lang_Expression()), node, (function (l) {
13336 if ($notnull_bool(isVoid)) { 13421 if ($notnull_bool(isVoid)) {
13337 return l; 13422 return l;
13338 } 13423 }
13339 else { 13424 else {
13340 left = l; 13425 left = l;
13341 tmpleft = $this.forceTemp((l && l.is$Value())); 13426 tmpleft = $this.forceTemp((l && l.is$Value()));
13342 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$ Value())); 13427 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$ Value()));
13343 } 13428 }
13344 }) 13429 })
13345 ); 13430 );
13346 if ($notnull_bool($ne(tmpleft, null))) { 13431 if ($notnull_bool($ne(tmpleft, null))) {
13347 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), node .span, true); 13432 ret = new Value(ret.get$type(), ("(" + ret.get$code() + ", " + tmpleft.get$c ode() + ")"), node.span, true);
13348 } 13433 }
13349 if ($notnull_bool($ne(tmpleft, left))) { 13434 if ($notnull_bool($ne(tmpleft, left))) {
13350 this.freeTemp((tmpleft && tmpleft.is$Value())); 13435 this.freeTemp((tmpleft && tmpleft.is$Value()));
13351 } 13436 }
13352 return ret; 13437 return ret;
13353 } 13438 }
13354 MethodGenerator.prototype.visitNewExpression = function(node) { 13439 MethodGenerator.prototype.visitNewExpression = function(node) {
13355 var $0; 13440 var $0;
13356 var typeRef = node.type; 13441 var typeRef = node.type;
13357 var constructorName = ''; 13442 var constructorName = '';
13358 if (node.name != null) { 13443 if (node.name != null) {
13359 constructorName = node.name.name; 13444 constructorName = node.name.name;
13360 } 13445 }
13361 if ($notnull_bool($eq(constructorName, '') && !(typeRef instanceof GenericType Reference)) && typeRef.names != null) { 13446 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); 13447 var names = ListFactory.ListFactory$from$factory((($0 = typeRef.get$names()) && $0.is$Iterable()));
13363 constructorName = names.removeLast$0().get$name(); 13448 constructorName = names.removeLast$0().get$name();
13364 if (names.length == 0) names = null; 13449 if ($notnull_bool($eq(names.length, 0))) names = null;
13365 typeRef = new NameTypeReference(typeRef.isFinal, typeRef.get$name(), names, typeRef.get$span()); 13450 typeRef = new NameTypeReference(typeRef.get$isFinal(), typeRef.get$name(), n ames, (($0 = typeRef.get$span()) && $0.is$SourceSpan()));
13366 } 13451 }
13367 var type = this.method.resolveType(typeRef, true); 13452 var type = this.method.resolveType(typeRef, true);
13368 if ($notnull_bool(type.get$isTop())) { 13453 if ($notnull_bool(type.get$isTop())) {
13369 type = type.get$library().findTypeByName($assert_String(constructorName)); 13454 type = type.get$library().findTypeByName$1(constructorName);
13370 constructorName = ''; 13455 constructorName = '';
13371 } 13456 }
13372 var m = type.getConstructor$1(constructorName); 13457 var m = type.getConstructor$1(constructorName);
13373 if ($notnull_bool(m == null)) { 13458 if ($notnull_bool(m == null)) {
13374 var name = type.get$jsname(); 13459 var name = type.get$jsname();
13375 if ($notnull_bool(type.get$isVar())) { 13460 if ($notnull_bool(type.get$isVar())) {
13376 name = typeRef.get$name().get$name(); 13461 name = typeRef.get$name().get$name();
13377 } 13462 }
13378 world.error(('no matching constructor for ' + name + ''), node.span); 13463 world.error(('no matching constructor for ' + name + ''), node.span);
13379 return this._makeMissingValue($assert_String(name)); 13464 return this._makeMissingValue($assert_String(name));
13380 } 13465 }
13381 if ($notnull_bool(node.isConst)) { 13466 if ($notnull_bool(node.isConst)) {
13382 if (!$notnull_bool(m.get$isConst())) { 13467 if (!$notnull_bool(m.get$isConst())) {
13383 world.error('can\'t use const on a non-const constructor', node.span); 13468 world.error('can\'t use const on a non-const constructor', node.span);
13384 } 13469 }
13385 var $list = node.arguments; 13470 var $list = node.arguments;
13386 for (var $i = 0;$i < $list.length; $i++) { 13471 for (var $i = 0;$i < $list.length; $i++) {
13387 var arg = $list.$index($i); 13472 var arg = $list.$index($i);
13388 if (!$notnull_bool(this.visitValue((($0 = arg.get$value()) && $0.is$lang_E xpression())).get$isConst())) { 13473 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()) ; 13474 world.error('const constructor expects const arguments', (($0 = arg.get$ span()) && $0.is$SourceSpan()));
13390 } 13475 }
13391 } 13476 }
13392 } 13477 }
13393 return m.invoke$4(this, node, null, this._makeArgs(node.arguments)); 13478 return m.invoke$4(this, node, null, this._makeArgs(node.arguments));
13394 } 13479 }
13395 MethodGenerator.prototype.visitListExpression = function(node) { 13480 MethodGenerator.prototype.visitListExpression = function(node) {
13481 var $0;
13396 var argsCode = []; 13482 var argsCode = [];
13397 var argValues = []; 13483 var argValues = [];
13398 var $list = node.values; 13484 var $list = node.values;
13399 for (var $i = 0;$i < $list.length; $i++) { 13485 for (var $i = 0;$i < $list.length; $i++) {
13400 var item = $list.$index($i); 13486 var item = $list.$index($i);
13401 var arg = this.visitValue((item && item.is$lang_Expression())); 13487 var arg = this.visitValue((item && item.is$lang_Expression()));
13402 argValues.add$1(arg); 13488 argValues.add$1(arg);
13403 if ($notnull_bool(node.isConst)) { 13489 if ($notnull_bool(node.isConst)) {
13404 if (!$notnull_bool(arg.get$isConst())) { 13490 if (!$notnull_bool(arg.get$isConst())) {
13405 world.error('const list can only contain const values', item.get$span()) ; 13491 world.error('const list can only contain const values', (($0 = item.get$ span()) && $0.is$SourceSpan()));
13406 argsCode.add$1(arg.code); 13492 argsCode.add$1(arg.get$code());
13407 } 13493 }
13408 else { 13494 else {
13409 argsCode.add$1(arg.get$canonicalCode()); 13495 argsCode.add$1(arg.get$canonicalCode());
13410 } 13496 }
13411 } 13497 }
13412 else { 13498 else {
13413 argsCode.add$1(arg.code); 13499 argsCode.add$1(arg.get$code());
13414 } 13500 }
13415 } 13501 }
13416 world.get$coreimpl().types.$index('ListFactory').markUsed$0(); 13502 world.get$coreimpl().types.$index('ListFactory').markUsed$0();
13417 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); 13503 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']');
13418 var value = new Value(world.listType, code, node.span, true); 13504 var value = new Value(world.listType, code, node.span, true);
13419 if ($notnull_bool(node.isConst)) { 13505 if ($notnull_bool(node.isConst)) {
13420 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); 13506 var immutableList = world.get$coreimpl().types.$index('ImmutableList');
13421 var immutableListCtor = immutableList.getConstructor$1('from'); 13507 var immutableListCtor = immutableList.getConstructor$1('from');
13422 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null , [value])); 13508 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())); 13509 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 } 13510 }
13425 return value; 13511 return value;
13426 } 13512 }
13427 MethodGenerator.prototype.visitMapExpression = function(node) { 13513 MethodGenerator.prototype.visitMapExpression = function(node) {
13428 var $0; 13514 var $0;
13429 var mapImplType = world.gen.useMapFactory(); 13515 var mapImplType = world.gen.useMapFactory();
13430 var argValues = []; 13516 var argValues = [];
13431 var argsCode = []; 13517 var argsCode = [];
13432 for (var i = 0; 13518 for (var i = 0;
13433 i < node.items.length; i += 2) { 13519 i < node.items.length; i += 2) {
13434 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex pression()), world.stringType); 13520 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex pression()), world.stringType);
13435 var valueItem = node.items.$index(i + 1); 13521 var valueItem = node.items.$index(i + 1);
13436 var value = this.visitValue((valueItem && valueItem.is$lang_Expression())); 13522 var value = this.visitValue((valueItem && valueItem.is$lang_Expression()));
13437 argValues.add$1(key); 13523 argValues.add$1(key);
13438 argValues.add$1(value); 13524 argValues.add$1(value);
13439 if ($notnull_bool(node.isConst)) { 13525 if ($notnull_bool(node.isConst)) {
13440 if (!$notnull_bool(key.get$isConst()) || !$notnull_bool(value.get$isConst( ))) { 13526 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()); 13527 world.error('const map can only contain const values', (($0 = valueItem. get$span()) && $0.is$SourceSpan()));
13442 argsCode.add$1(key.code); 13528 argsCode.add$1(key.get$code());
13443 argsCode.add$1(value.code); 13529 argsCode.add$1(value.get$code());
13444 } 13530 }
13445 else { 13531 else {
13446 argsCode.add$1(key.get$canonicalCode()); 13532 argsCode.add$1(key.get$canonicalCode());
13447 argsCode.add$1(value.get$canonicalCode()); 13533 argsCode.add$1(value.get$canonicalCode());
13448 } 13534 }
13449 } 13535 }
13450 else { 13536 else {
13451 argsCode.add$1(key.code); 13537 argsCode.add$1(key.get$code());
13452 argsCode.add$1(value.code); 13538 argsCode.add$1(value.get$code());
13453 } 13539 }
13454 } 13540 }
13455 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); 13541 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']');
13456 var code = ('\$map(' + argList + ')'); 13542 var code = ('\$map(' + argList + ')');
13457 if ($notnull_bool(node.isConst)) { 13543 if ($notnull_bool(node.isConst)) {
13458 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap'); 13544 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap');
13459 var immutableMapCtor = immutableMap.getConstructor$1(''); 13545 var immutableMapCtor = immutableMap.getConstructor$1('');
13460 var argsValue = new Value(world.listType, argList, node.span, true); 13546 var argsValue = new Value(world.listType, argList, node.span, true);
13461 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null, [argsValue])); 13547 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); 13548 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 ())); 13549 return world.gen.globalForConst(value, (argValues && argValues.is$List$Value ()));
13464 } 13550 }
13465 return new Value(mapImplType, code, node.span, true); 13551 return new Value(mapImplType, code, node.span, true);
13466 } 13552 }
13467 MethodGenerator.prototype.visitConditionalExpression = function(node) { 13553 MethodGenerator.prototype.visitConditionalExpression = function(node) {
13468 var $0; 13554 var $0;
13469 var test = this.visitBool(node.test); 13555 var test = this.visitBool(node.test);
13470 var trueBranch = this.visitValue(node.trueBranch); 13556 var trueBranch = this.visitValue(node.trueBranch);
13471 var falseBranch = this.visitValue(node.falseBranch); 13557 var falseBranch = this.visitValue(node.falseBranch);
13472 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod e + ''); 13558 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); 13559 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 } 13560 }
13475 MethodGenerator.prototype.visitIsExpression = function(node) { 13561 MethodGenerator.prototype.visitIsExpression = function(node) {
13476 var value = this.visitValue(node.x); 13562 var value = this.visitValue(node.x);
13477 var type = this.method.resolveType(node.type, false); 13563 var type = this.method.resolveType(node.type, false);
13478 return value.instanceOf$4(this, type, node.span, node.isTrue); 13564 return value.instanceOf$4(this, type, node.span, node.isTrue);
13479 } 13565 }
13480 MethodGenerator.prototype.visitParenExpression = function(node) { 13566 MethodGenerator.prototype.visitParenExpression = function(node) {
13481 var $0; 13567 var $0;
13482 var body = this.visitValue(node.body); 13568 var body = this.visitValue(node.body);
13483 if ($notnull_bool(body.get$isConst())) { 13569 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); 13570 return EvaluatedValue.EvaluatedValue$factory((($0 = body.get$type()) && $0.i s$lang_Type()), body.get$actualValue(), ('(' + body.get$canonicalCode() + ')'), node.span);
13485 } 13571 }
13486 return new Value(body.type, ('(' + body.code + ')'), node.span, true); 13572 return new Value(body.get$type(), ('(' + body.get$code() + ')'), node.span, tr ue);
13487 } 13573 }
13488 MethodGenerator.prototype.visitDotExpression = function(node) { 13574 MethodGenerator.prototype.visitDotExpression = function(node) {
13489 var target = node.self.visit(this); 13575 var target = node.self.visit(this);
13490 return target.get_$3(this, node.name.name, node.name); 13576 return target.get_$3(this, node.name.name, node.name);
13491 } 13577 }
13492 MethodGenerator.prototype.visitVarExpression = function(node) { 13578 MethodGenerator.prototype.visitVarExpression = function(node) {
13493 var name = node.name.name; 13579 var name = node.name.name;
13494 var ret = this._scope.lookup(name); 13580 var ret = this._scope.lookup(name);
13495 if ($notnull_bool($ne(ret, null))) return ret; 13581 if ($notnull_bool($ne(ret, null))) return ret;
13496 return this._makeThisOrType(node.span).get_$3(this, name, node); 13582 return this._makeThisOrType(node.span).get_$3(this, name, node);
(...skipping 18 matching lines...) Expand all
13515 var $0; 13601 var $0;
13516 var type = node.type.type; 13602 var type = node.type.type;
13517 $assert($ne(type, null), "type != null", "gen.dart", 2083, 12); 13603 $assert($ne(type, null), "type != null", "gen.dart", 2083, 12);
13518 if (!!(($0 = node.value) && $0.is$List)) { 13604 if (!!(($0 = node.value) && $0.is$List)) {
13519 var items = []; 13605 var items = [];
13520 var $list = node.value; 13606 var $list = node.value;
13521 for (var $i = node.value.iterator$0(); $i.hasNext$0(); ) { 13607 for (var $i = node.value.iterator$0(); $i.hasNext$0(); ) {
13522 var item = $i.next$0(); 13608 var item = $i.next$0();
13523 var val = this.visitValue((item && item.is$lang_Expression())); 13609 var val = this.visitValue((item && item.is$lang_Expression()));
13524 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); 13610 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY());
13525 var code = val.code; 13611 var code = val.get$code();
13526 if ((item instanceof BinaryExpression) || (item instanceof ConditionalExpr ession)) { 13612 if ((item instanceof BinaryExpression) || (item instanceof ConditionalExpr ession)) {
13527 code = ('(' + code + ')'); 13613 code = ('(' + code + ')');
13528 } 13614 }
13529 items.add$1(code); 13615 items.add$1(code);
13530 } 13616 }
13531 return new Value(type, ('(' + Strings.join((items && items.is$List$String()) , " + ") + ')'), node.span, true); 13617 return new Value(type, ('(' + Strings.join((items && items.is$List$String()) , " + ") + ')'), node.span, true);
13532 } 13618 }
13533 var text = node.text; 13619 var text = node.text;
13534 if ($notnull_bool(type.get$isString())) { 13620 if ($notnull_bool(type.get$isString())) {
13535 if ($notnull_bool(text.startsWith$1('@'))) { 13621 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)); 13655 values.add$1(new Value(world.varType, ('\$' + i + ''), null, false));
13570 } 13656 }
13571 return new Arguments(null, values); 13657 return new Arguments(null, values);
13572 } 13658 }
13573 Arguments.get$EMPTY = function() { 13659 Arguments.get$EMPTY = function() {
13574 if (Arguments._empty == null) { 13660 if (Arguments._empty == null) {
13575 Arguments._empty = new Arguments(null, []); 13661 Arguments._empty = new Arguments(null, []);
13576 } 13662 }
13577 return Arguments._empty; 13663 return Arguments._empty;
13578 } 13664 }
13665 Arguments.prototype.get$values = function() { return this.values; };
13666 Arguments.prototype.set$values = function(value) { return this.values = value; } ;
13579 Arguments.prototype.get$nameCount = function() { 13667 Arguments.prototype.get$nameCount = function() {
13580 return this.get$length() - this.get$bareCount(); 13668 return this.get$length() - this.get$bareCount();
13581 } 13669 }
13582 Arguments.prototype.get$hasNames = function() { 13670 Arguments.prototype.get$hasNames = function() {
13583 return this.get$bareCount() < this.get$length(); 13671 return this.get$bareCount() < this.get$length();
13584 } 13672 }
13585 Arguments.prototype.get$length = function() { 13673 Arguments.prototype.get$length = function() {
13586 return this.values.length; 13674 return this.values.length;
13587 } 13675 }
13588 Object.defineProperty(Arguments.prototype, "length", { 13676 Object.defineProperty(Arguments.prototype, "length", {
13589 get: Arguments.prototype.get$length 13677 get: Arguments.prototype.get$length
13590 }); 13678 });
13591 Arguments.prototype.getName = function(i) { 13679 Arguments.prototype.getName = function(i) {
13592 return this.nodes.$index(i).label.name; 13680 return $assert_String(this.nodes.$index(i).get$label().get$name());
13593 } 13681 }
13594 Arguments.prototype.getIndexOfName = function(name) { 13682 Arguments.prototype.getIndexOfName = function(name) {
13595 for (var i = this.get$bareCount(); 13683 for (var i = this.get$bareCount();
13596 i < this.get$length(); i++) { 13684 i < this.get$length(); i++) {
13597 if (this.getName(i) == name) { 13685 if (this.getName(i) == name) {
13598 return i; 13686 return i;
13599 } 13687 }
13600 } 13688 }
13601 return -1; 13689 return -1;
13602 } 13690 }
13603 Arguments.prototype.getValue = function(name) { 13691 Arguments.prototype.getValue = function(name) {
13604 var $0; 13692 var $0;
13605 var i = this.getIndexOfName(name); 13693 var i = this.getIndexOfName(name);
13606 return (($0 = i >= 0 ? this.values.$index(i) : null) && $0.is$Value()); 13694 return (($0 = i >= 0 ? this.values.$index(i) : null) && $0.is$Value());
13607 } 13695 }
13608 Arguments.prototype.get$bareCount = function() { 13696 Arguments.prototype.get$bareCount = function() {
13609 if (this._bareCount == null) { 13697 if (this._bareCount == null) {
13610 this._bareCount = this.get$length(); 13698 this._bareCount = this.get$length();
13611 if (this.nodes != null) { 13699 if (this.nodes != null) {
13612 for (var i = 0; 13700 for (var i = 0;
13613 i < this.nodes.length; i++) { 13701 i < this.nodes.length; i++) {
13614 if (this.nodes.$index(i).label != null) { 13702 if ($notnull_bool($ne(this.nodes.$index(i).get$label(), null))) {
13615 this._bareCount = i; 13703 this._bareCount = i;
13616 break; 13704 break;
13617 } 13705 }
13618 } 13706 }
13619 } 13707 }
13620 } 13708 }
13621 return this._bareCount; 13709 return this._bareCount;
13622 } 13710 }
13623 Arguments.prototype.getCode = function() { 13711 Arguments.prototype.getCode = function() {
13624 var argsCode = []; 13712 var argsCode = [];
13625 for (var i = 0; 13713 for (var i = 0;
13626 i < this.get$length(); i++) { 13714 i < this.get$length(); i++) {
13627 argsCode.add$1(this.values.$index(i).code); 13715 argsCode.add$1(this.values.$index(i).get$code());
13628 } 13716 }
13629 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); 13717 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value()));
13630 return Strings.join((argsCode && argsCode.is$List$String()), ", "); 13718 return Strings.join((argsCode && argsCode.is$List$String()), ", ");
13631 } 13719 }
13632 Arguments.removeTrailingNulls = function(argsCode) { 13720 Arguments.removeTrailingNulls = function(argsCode) {
13633 while ($notnull_bool(argsCode.length > 0 && $eq(argsCode.last(), 'null'))) { 13721 while ($notnull_bool(argsCode.length > 0 && $eq(argsCode.last(), 'null'))) {
13634 argsCode.removeLast(); 13722 argsCode.removeLast();
13635 } 13723 }
13636 } 13724 }
13637 Arguments.prototype.getNames = function() { 13725 Arguments.prototype.getNames = function() {
(...skipping 17 matching lines...) Expand all
13655 result.add$1(new Value(world.varType, name, null, false)); 13743 result.add$1(new Value(world.varType, name, null, false));
13656 } 13744 }
13657 return new Arguments(this.nodes, result); 13745 return new Arguments(this.nodes, result);
13658 } 13746 }
13659 // ********** Code for LibraryImport ************** 13747 // ********** Code for LibraryImport **************
13660 function LibraryImport(library, prefix) { 13748 function LibraryImport(library, prefix) {
13661 this.library = library; 13749 this.library = library;
13662 this.prefix = prefix; 13750 this.prefix = prefix;
13663 // Initializers done 13751 // Initializers done
13664 } 13752 }
13753 LibraryImport.prototype.get$prefix = function() { return this.prefix; };
13754 LibraryImport.prototype.set$prefix = function(value) { return this.prefix = valu e; };
13665 LibraryImport.prototype.get$library = function() { return this.library; }; 13755 LibraryImport.prototype.get$library = function() { return this.library; };
13666 LibraryImport.prototype.set$library = function(value) { return this.library = va lue; }; 13756 LibraryImport.prototype.set$library = function(value) { return this.library = va lue; };
13667 // ********** Code for Library ************** 13757 // ********** Code for Library **************
13668 function Library(baseSource) { 13758 function Library(baseSource) {
13669 this.isWritten = false 13759 this.isWritten = false
13670 this.baseSource = baseSource; 13760 this.baseSource = baseSource;
13671 // Initializers done 13761 // Initializers done
13672 this.sourceDir = dirname(this.baseSource.filename); 13762 this.sourceDir = dirname(this.baseSource.filename);
13673 this.topType = new DefinedType(null, this, null, true); 13763 this.topType = new DefinedType(null, this, null, true);
13674 this.types = $map(['', this.topType]); 13764 this.types = $map(['', this.topType]);
13675 this.imports = []; 13765 this.imports = [];
13676 this.natives = []; 13766 this.natives = [];
13677 this.sources = []; 13767 this.sources = [];
13678 this._privateMembers = $map([]); 13768 this._privateMembers = $map([]);
13679 } 13769 }
13680 Library.prototype.is$Library = function(){return this;}; 13770 Library.prototype.is$Library = function(){return this;};
13771 Library.prototype.get$baseSource = function() { return this.baseSource; };
13772 Library.prototype.get$types = function() { return this.types; };
13773 Library.prototype.set$types = function(value) { return this.types = value; };
13681 Library.prototype.get$name = function() { return this.name; }; 13774 Library.prototype.get$name = function() { return this.name; };
13682 Library.prototype.set$name = function(value) { return this.name = value; }; 13775 Library.prototype.set$name = function(value) { return this.name = value; };
13776 Library.prototype.get$topType = function() { return this.topType; };
13777 Library.prototype.set$topType = function(value) { return this.topType = value; } ;
13683 Library.prototype.get$isCore = function() { 13778 Library.prototype.get$isCore = function() {
13684 return $eq(this, world.corelib); 13779 return $eq(this, world.corelib);
13685 } 13780 }
13686 Library.prototype.get$isCoreImpl = function() { 13781 Library.prototype.get$isCoreImpl = function() {
13687 return $eq(this, world.get$coreimpl()); 13782 return $eq(this, world.get$coreimpl());
13688 } 13783 }
13689 Library.prototype.get$jsname = function() { 13784 Library.prototype.get$jsname = function() {
13690 if (this._jsname == null) { 13785 if (this._jsname == null) {
13691 this._jsname = this.name.replaceAll('.', '_').replaceAll(':', '_').replaceAl l(' ', '_'); 13786 this._jsname = this.name.replaceAll('.', '_').replaceAll(':', '_').replaceAl l(' ', '_');
13692 } 13787 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
13780 return null; 13875 return null;
13781 } 13876 }
13782 if (!$notnull_bool(result.get$isTop())) { 13877 if (!$notnull_bool(result.get$isTop())) {
13783 return null; 13878 return null;
13784 } 13879 }
13785 return result.get$library().findTypeByName($assert_String(type.names.$index( 0).get$name())); 13880 return result.get$library().findTypeByName($assert_String(type.names.$index( 0).get$name()));
13786 } 13881 }
13787 return result; 13882 return result;
13788 } 13883 }
13789 Library.prototype.findTypeByName = function(name) { 13884 Library.prototype.findTypeByName = function(name) {
13885 var $0;
13790 var ret = this.types.$index(name); 13886 var ret = this.types.$index(name);
13791 var $list = this.imports; 13887 var $list = this.imports;
13792 for (var $i = 0;$i < $list.length; $i++) { 13888 for (var $i = 0;$i < $list.length; $i++) {
13793 var imported = $list.$index($i); 13889 var imported = $list.$index($i);
13794 var newRet = null; 13890 var newRet = null;
13795 if (imported.prefix == null) { 13891 if ($notnull_bool(imported.get$prefix() == null)) {
13796 newRet = imported.get$library().types.$index(name); 13892 newRet = imported.get$library().get$types().$index(name);
13797 } 13893 }
13798 else if (imported.prefix == name) { 13894 else if ($notnull_bool($eq(imported.get$prefix(), name))) {
13799 newRet = imported.get$library().topType; 13895 newRet = imported.get$library().get$topType();
13800 } 13896 }
13801 if ($notnull_bool($ne(newRet, null))) { 13897 if ($notnull_bool($ne(newRet, null))) {
13802 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 13898 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
13803 world.error(('conflicting types for "' + name + '"'), ret.get$span(), ne wRet.get$span()); 13899 world.error(('conflicting types for "' + name + '"'), (($0 = ret.get$spa n()) && $0.is$SourceSpan()), (($0 = newRet.get$span()) && $0.is$SourceSpan()));
13804 } 13900 }
13805 else { 13901 else {
13806 ret = newRet; 13902 ret = newRet;
13807 } 13903 }
13808 } 13904 }
13809 } 13905 }
13810 return (ret && ret.is$lang_Type()); 13906 return (ret && ret.is$lang_Type());
13811 } 13907 }
13812 Library.prototype.lookup = function(name, span) { 13908 Library.prototype.lookup = function(name, span) {
13909 var $0;
13813 var retType = this.findTypeByName(name); 13910 var retType = this.findTypeByName(name);
13814 var ret = null; 13911 var ret = null;
13815 if ($notnull_bool($ne(retType, null))) { 13912 if ($notnull_bool($ne(retType, null))) {
13816 ret = retType.get$typeMember(); 13913 ret = retType.get$typeMember();
13817 } 13914 }
13818 var newRet = this.topType.getMember(name); 13915 var newRet = this.topType.getMember(name);
13819 if ($notnull_bool($ne(newRet, null))) { 13916 if ($notnull_bool($ne(newRet, null))) {
13820 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 13917 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
13821 world.error(('conflicting members for "' + name + '"'), span, ret.get$span (), newRet.get$span()); 13918 world.error(('conflicting members for "' + name + '"'), span, (($0 = ret.g et$span()) && $0.is$SourceSpan()), (($0 = newRet.get$span()) && $0.is$SourceSpan ()));
13822 } 13919 }
13823 else { 13920 else {
13824 ret = newRet; 13921 ret = newRet;
13825 } 13922 }
13826 } 13923 }
13827 var $list = this.imports; 13924 var $list = this.imports;
13828 for (var $i = 0;$i < $list.length; $i++) { 13925 for (var $i = 0;$i < $list.length; $i++) {
13829 var imported = $list.$index($i); 13926 var imported = $list.$index($i);
13830 if (imported.prefix == null) { 13927 if ($notnull_bool(imported.get$prefix() == null)) {
13831 newRet = imported.get$library().topType.getMember(name); 13928 newRet = imported.get$library().get$topType().getMember$1(name);
13832 if ($notnull_bool($ne(newRet, null))) { 13929 if ($notnull_bool($ne(newRet, null))) {
13833 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 13930 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
13834 world.error(('conflicting members for "' + name + '"'), span, ret.get$ span(), newRet.get$span()); 13931 world.error(('conflicting members for "' + name + '"'), span, (($0 = r et.get$span()) && $0.is$SourceSpan()), (($0 = newRet.get$span()) && $0.is$Source Span()));
13835 } 13932 }
13836 else { 13933 else {
13837 ret = newRet; 13934 ret = newRet;
13838 } 13935 }
13839 } 13936 }
13840 } 13937 }
13841 } 13938 }
13842 return (ret && ret.is$Member()); 13939 return (ret && ret.is$Member());
13843 } 13940 }
13844 Library.prototype.resolve = function() { 13941 Library.prototype.resolve = function() {
(...skipping 14 matching lines...) Expand all
13859 type.resolve$0(); 13956 type.resolve$0();
13860 } 13957 }
13861 } 13958 }
13862 Library.prototype.visitSources = function() { 13959 Library.prototype.visitSources = function() {
13863 var visitor = new _LibraryVisitor(this); 13960 var visitor = new _LibraryVisitor(this);
13864 visitor.addSource$1(this.baseSource); 13961 visitor.addSource$1(this.baseSource);
13865 } 13962 }
13866 Library.prototype.toString = function() { 13963 Library.prototype.toString = function() {
13867 return this.baseSource.filename; 13964 return this.baseSource.filename;
13868 } 13965 }
13966 Library.prototype.findTypeByName$1 = function($0) {
13967 return this.findTypeByName($assert_String($0));
13968 };
13869 Library.prototype.resolve$0 = function() { 13969 Library.prototype.resolve$0 = function() {
13870 return this.resolve(); 13970 return this.resolve();
13871 }; 13971 };
13872 Library.prototype.toString$0 = function() { 13972 Library.prototype.toString$0 = function() {
13873 return this.toString(); 13973 return this.toString();
13874 }; 13974 };
13875 Library.prototype.visitSources$0 = function() { 13975 Library.prototype.visitSources$0 = function() {
13876 return this.visitSources(); 13976 return this.visitSources();
13877 }; 13977 };
13878 // ********** Code for _LibraryVisitor ************** 13978 // ********** Code for _LibraryVisitor **************
(...skipping 11 matching lines...) Expand all
13890 _LibraryVisitor.prototype.get$library = function() { return this.library; }; 13990 _LibraryVisitor.prototype.get$library = function() { return this.library; };
13891 _LibraryVisitor.prototype.get$isTop = function() { return this.isTop; }; 13991 _LibraryVisitor.prototype.get$isTop = function() { return this.isTop; };
13892 _LibraryVisitor.prototype.set$isTop = function(value) { return this.isTop = valu e; }; 13992 _LibraryVisitor.prototype.set$isTop = function(value) { return this.isTop = valu e; };
13893 _LibraryVisitor.prototype.addSourceFromName = function(name, span) { 13993 _LibraryVisitor.prototype.addSourceFromName = function(name, span) {
13894 var filename = this.library.makeFullPath(name); 13994 var filename = this.library.makeFullPath(name);
13895 if ($notnull_bool($eq(filename, this.library.baseSource.filename))) { 13995 if ($notnull_bool($eq(filename, this.library.baseSource.filename))) {
13896 world.error('library can not source itself', span); 13996 world.error('library can not source itself', span);
13897 return; 13997 return;
13898 } 13998 }
13899 else if (this.sources.some((function (s) { 13999 else if (this.sources.some((function (s) {
13900 return s.filename == filename; 14000 return $eq(s.get$filename(), filename);
13901 }) 14001 })
13902 )) { 14002 )) {
13903 world.error(('file "' + filename + '" has already been sourced'), span); 14003 world.error(('file "' + filename + '" has already been sourced'), span);
13904 return; 14004 return;
13905 } 14005 }
13906 var source = world.readFile(this.library.makeFullPath(name)); 14006 var source = world.readFile(this.library.makeFullPath(name));
13907 this.sources.add(source); 14007 this.sources.add(source);
13908 } 14008 }
13909 _LibraryVisitor.prototype.addSource = function(source) { 14009 _LibraryVisitor.prototype.addSource = function(source) {
13910 var $this = this; // closure support 14010 var $this = this; // closure support
13911 if (this.library.sources.some((function (s) { 14011 if (this.library.sources.some((function (s) {
13912 return s.filename == source.filename; 14012 return $eq(s.get$filename(), source.filename);
13913 }) 14013 })
13914 )) { 14014 )) {
13915 world.error(('duplicate source file "' + source.filename + '"')); 14015 world.error(('duplicate source file "' + source.filename + '"'));
13916 return; 14016 return;
13917 } 14017 }
13918 this.library.sources.add(source); 14018 this.library.sources.add(source);
13919 var parser = new lang_Parser(source, options.dietParse, false, false, 0); 14019 var parser = new lang_Parser(source, options.dietParse, false, false, 0);
13920 var unit = parser.compilationUnit(); 14020 var unit = parser.compilationUnit();
13921 unit.forEach((function (def) { 14021 unit.forEach((function (def) {
13922 return def.visit$1($this); 14022 return def.visit$1($this);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
13965 } 14065 }
13966 else if ($notnull_bool($ne(prefix, null) && prefix.indexOf$2('.', 0) >= 0) ) { 14066 else if ($notnull_bool($ne(prefix, null) && prefix.indexOf$2('.', 0) >= 0) ) {
13967 world.error('library prefix canot contain "."', node.span); 14067 world.error('library prefix canot contain "."', node.span);
13968 } 14068 }
13969 else if ($notnull_bool(this.seenSource || this.seenResource)) { 14069 else if ($notnull_bool(this.seenSource || this.seenResource)) {
13970 world.error('#imports must come before any #source or #resource', node.s pan); 14070 world.error('#imports must come before any #source or #resource', node.s pan);
13971 } 14071 }
13972 if ($notnull_bool($eq(prefix, ''))) prefix = null; 14072 if ($notnull_bool($eq(prefix, ''))) prefix = null;
13973 var filename = this.library.makeFullPath($assert_String(name)); 14073 var filename = this.library.makeFullPath($assert_String(name));
13974 if (this.library.imports.some((function (li) { 14074 if (this.library.imports.some((function (li) {
13975 return $eq(li.get$library().baseSource, filename); 14075 return $eq(li.get$library().get$baseSource(), filename);
13976 }) 14076 })
13977 )) { 14077 )) {
13978 world.error(('duplicate import of "' + name + '"'), node.span); 14078 world.error(('duplicate import of "' + name + '"'), node.span);
13979 return; 14079 return;
13980 } 14080 }
13981 var newLib = this.library.addImport($assert_String(filename), $assert_Stri ng(prefix)); 14081 var newLib = this.library.addImport($assert_String(filename), $assert_Stri ng(prefix));
13982 break; 14082 break;
13983 14083
13984 case "source": 14084 case "source":
13985 14085
(...skipping 27 matching lines...) Expand all
14013 if (node.arguments.length != 1) { 14113 if (node.arguments.length != 1) {
14014 world.error(('expected exactly one argument but found ' + node.arguments.len gth + ''), node.span); 14114 world.error(('expected exactly one argument but found ' + node.arguments.len gth + ''), node.span);
14015 } 14115 }
14016 return this.getFirstStringArg(node); 14116 return this.getFirstStringArg(node);
14017 } 14117 }
14018 _LibraryVisitor.prototype.getFirstStringArg = function(node) { 14118 _LibraryVisitor.prototype.getFirstStringArg = function(node) {
14019 if (node.arguments.length < 1) { 14119 if (node.arguments.length < 1) {
14020 world.error(('expected at least one argument but found ' + node.arguments.le ngth + ''), node.span); 14120 world.error(('expected at least one argument but found ' + node.arguments.le ngth + ''), node.span);
14021 } 14121 }
14022 var arg = node.arguments.$index(0); 14122 var arg = node.arguments.$index(0);
14023 if (arg.label != null) { 14123 if ($notnull_bool($ne(arg.get$label(), null))) {
14024 world.error('label not allowed for directive', node.span); 14124 world.error('label not allowed for directive', node.span);
14025 } 14125 }
14026 return this._parseStringArgument((arg && arg.is$ArgumentNode())); 14126 return this._parseStringArgument((arg && arg.is$ArgumentNode()));
14027 } 14127 }
14028 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { 14128 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) {
14029 var args = node.arguments.filter((function (a) { 14129 var args = node.arguments.filter((function (a) {
14030 return a.label != null && a.label.name == argName; 14130 return $notnull_bool($ne(a.get$label(), null) && $eq(a.get$label().get$name( ), argName));
14031 }) 14131 })
14032 ); 14132 );
14033 if (args.length == 0) { 14133 if ($notnull_bool($eq(args.length, 0))) {
14034 return null; 14134 return null;
14035 } 14135 }
14036 if (args.length > 1) { 14136 if (args.length > 1) {
14037 world.error(('expected at most one "' + argName + '" argument but found ') + node.arguments.length, node.span); 14137 world.error(('expected at most one "' + argName + '" argument but found ') + node.arguments.length, node.span);
14038 } 14138 }
14039 for (var $i = args.iterator$0(); $i.hasNext$0(); ) { 14139 for (var $i = args.iterator$0(); $i.hasNext$0(); ) {
14040 var arg = $i.next$0(); 14140 var arg = $i.next$0();
14041 return this._parseStringArgument((arg && arg.is$ArgumentNode())); 14141 return this._parseStringArgument((arg && arg.is$ArgumentNode()));
14042 } 14142 }
14043 } 14143 }
14044 _LibraryVisitor.prototype._parseStringArgument = function(arg) { 14144 _LibraryVisitor.prototype._parseStringArgument = function(arg) {
14145 var $0;
14045 var expr = arg.value; 14146 var expr = arg.value;
14046 if (!(expr instanceof LiteralExpression) || !$notnull_bool(expr.type.type.get$ isString())) { 14147 if (!(expr instanceof LiteralExpression) || !$notnull_bool(expr.get$type().get $type().get$isString())) {
14047 world.error('expected string', expr.get$span()); 14148 world.error('expected string', (($0 = expr.get$span()) && $0.is$SourceSpan() ));
14048 } 14149 }
14049 return parseStringLiteral($assert_String(expr.get$value())); 14150 return parseStringLiteral($assert_String(expr.get$value()));
14050 } 14151 }
14051 _LibraryVisitor.prototype.visitTypeDefinition = function(node) { 14152 _LibraryVisitor.prototype.visitTypeDefinition = function(node) {
14052 var oldType = this.currentType; 14153 var oldType = this.currentType;
14053 this.currentType = this.library.addType(node.name.name, node, node.isClass); 14154 this.currentType = this.library.addType(node.name.name, node, node.isClass);
14054 var $list = node.body; 14155 var $list = node.body;
14055 for (var $i = 0;$i < $list.length; $i++) { 14156 for (var $i = 0;$i < $list.length; $i++) {
14056 var member = $list.$index($i); 14157 var member = $list.$index($i);
14057 member.visit$1(this); 14158 member.visit$1(this);
(...skipping 17 matching lines...) Expand all
14075 function Parameter(definition) { 14176 function Parameter(definition) {
14076 this.isInitializer = false 14177 this.isInitializer = false
14077 this.definition = definition; 14178 this.definition = definition;
14078 // Initializers done 14179 // Initializers done
14079 } 14180 }
14080 Parameter.prototype.is$Parameter = function(){return this;}; 14181 Parameter.prototype.is$Parameter = function(){return this;};
14081 Parameter.prototype.get$definition = function() { return this.definition; }; 14182 Parameter.prototype.get$definition = function() { return this.definition; };
14082 Parameter.prototype.set$definition = function(value) { return this.definition = value; }; 14183 Parameter.prototype.set$definition = function(value) { return this.definition = value; };
14083 Parameter.prototype.get$name = function() { return this.name; }; 14184 Parameter.prototype.get$name = function() { return this.name; };
14084 Parameter.prototype.set$name = function(value) { return this.name = value; }; 14185 Parameter.prototype.set$name = function(value) { return this.name = value; };
14186 Parameter.prototype.get$type = function() { return this.type; };
14187 Parameter.prototype.set$type = function(value) { return this.type = value; };
14188 Parameter.prototype.get$isInitializer = function() { return this.isInitializer; };
14189 Parameter.prototype.set$isInitializer = function(value) { return this.isInitiali zer = value; };
14085 Parameter.prototype.get$value = function() { return this.value; }; 14190 Parameter.prototype.get$value = function() { return this.value; };
14086 Parameter.prototype.set$value = function(value) { return this.value = value; }; 14191 Parameter.prototype.set$value = function(value) { return this.value = value; };
14087 Parameter.prototype.resolve = function(method, inType) { 14192 Parameter.prototype.resolve = function(method, inType) {
14088 this.name = this.definition.name.name; 14193 this.name = this.definition.name.name;
14089 if (this.name.startsWith('this.')) { 14194 if (this.name.startsWith('this.')) {
14090 this.name = this.name.substring(5); 14195 this.name = this.name.substring(5);
14091 this.isInitializer = true; 14196 this.isInitializer = true;
14092 } 14197 }
14093 this.type = inType.resolveType(this.definition.type, false); 14198 this.type = inType.resolveType(this.definition.type, false);
14094 if ($notnull_bool(method.get$isStatic() && this.type.get$hasTypeParams())) { 14199 if ($notnull_bool(method.get$isStatic() && this.type.get$hasTypeParams())) {
14095 world.error('using type parameter in static context', this.definition.span); 14200 world.error('using type parameter in static context', this.definition.span);
14096 } 14201 }
14097 if (this.definition.value != null) { 14202 if (this.definition.value != null) {
14098 if ((this.definition.value instanceof NullExpression) && this.definition.val ue.span.start == this.definition.span.start) { 14203 if ((this.definition.value instanceof NullExpression) && this.definition.val ue.span.start == this.definition.span.start) {
14099 return; 14204 return;
14100 } 14205 }
14101 if ($notnull_bool(method.get$isAbstract())) { 14206 if ($notnull_bool(method.get$isAbstract())) {
14102 world.error('default value not allowed on abstract methods', this.definiti on.span); 14207 world.error('default value not allowed on abstract methods', this.definiti on.span);
14103 } 14208 }
14104 else if ($notnull_bool(method.name == '\$call' && method.get$definition().bo dy == null)) { 14209 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); 14210 world.error('default value not allowed on function type', this.definition. span);
14106 } 14211 }
14107 } 14212 }
14108 else if ($notnull_bool(this.isInitializer && !$notnull_bool(method.get$isConst ructor()))) { 14213 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); 14214 world.error('initializer parameters only allowed on constructors', this.defi nition.span);
14110 } 14215 }
14111 } 14216 }
14112 Parameter.prototype.genValue = function(method, context) { 14217 Parameter.prototype.genValue = function(method, context) {
14113 var $0; 14218 var $0;
14114 if (this.definition.value == null || this.value != null) return; 14219 if (this.definition.value == null || this.value != null) return;
14115 if (context == null) { 14220 if (context == null) {
14116 context = new MethodGenerator(method, null); 14221 context = new MethodGenerator(method, null);
14117 } 14222 }
14118 this.value = (($0 = this.definition.value.visit(context)) && $0.is$Value()); 14223 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); 14224 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse);
14120 } 14225 }
14121 Parameter.prototype.copyWithNewType = function(newType) { 14226 Parameter.prototype.copyWithNewType = function(newType) {
14122 var ret = new Parameter(this.definition); 14227 var ret = new Parameter(this.definition);
14123 ret.type = newType; 14228 ret.set$type(newType);
14124 ret.name = this.name; 14229 ret.set$name(this.name);
14125 ret.isInitializer = this.isInitializer; 14230 ret.set$isInitializer(this.isInitializer);
14126 return (ret && ret.is$Parameter()); 14231 return (ret && ret.is$Parameter());
14127 } 14232 }
14128 Parameter.prototype.get$isOptional = function() { 14233 Parameter.prototype.get$isOptional = function() {
14129 return this.definition != null && this.definition.value != null; 14234 return this.definition != null && this.definition.value != null;
14130 } 14235 }
14131 Parameter.prototype.copyWithNewType$1 = function($0) { 14236 Parameter.prototype.copyWithNewType$1 = function($0) {
14132 return this.copyWithNewType(($0 && $0.is$lang_Type())); 14237 return this.copyWithNewType(($0 && $0.is$lang_Type()));
14133 }; 14238 };
14134 Parameter.prototype.genValue$2 = function($0, $1) { 14239 Parameter.prototype.genValue$2 = function($0, $1) {
14135 return this.genValue(($0 && $0.is$MethodMember()), ($1 && $1.is$MethodGenerato r())); 14240 return this.genValue(($0 && $0.is$MethodMember()), ($1 && $1.is$MethodGenerato r()));
14136 }; 14241 };
14137 Parameter.prototype.resolve$2 = function($0, $1) { 14242 Parameter.prototype.resolve$2 = function($0, $1) {
14138 return this.resolve(($0 && $0.is$Member()), ($1 && $1.is$lang_Type())); 14243 return this.resolve(($0 && $0.is$Member()), ($1 && $1.is$lang_Type()));
14139 }; 14244 };
14140 // ********** Code for Member ************** 14245 // ********** Code for Member **************
14141 function Member(name, declaringType) { 14246 function Member(name, declaringType) {
14142 this.name = name; 14247 this.name = name;
14143 this.declaringType = declaringType; 14248 this.declaringType = declaringType;
14144 this.isGenerated = false; 14249 this.isGenerated = false;
14145 // Initializers done 14250 // Initializers done
14146 } 14251 }
14147 Member.prototype.is$Member = function(){return this;}; 14252 Member.prototype.is$Member = function(){return this;};
14148 Member.prototype.is$Named = function(){return this;}; 14253 Member.prototype.is$Named = function(){return this;};
14149 Member.prototype.get$name = function() { return this.name; }; 14254 Member.prototype.get$name = function() { return this.name; };
14255 Member.prototype.get$declaringType = function() { return this.declaringType; };
14256 Member.prototype.get$generator = function() { return this.generator; };
14257 Member.prototype.set$generator = function(value) { return this.generator = value ; };
14150 Member.prototype.get$jsname = function() { 14258 Member.prototype.get$jsname = function() {
14151 return this._jsname == null ? this.name : this._jsname; 14259 return this._jsname == null ? this.name : this._jsname;
14152 } 14260 }
14153 Member.prototype.set$jsname = function(name) { 14261 Member.prototype.set$jsname = function(name) {
14154 return this._jsname = name; 14262 return this._jsname = name;
14155 } 14263 }
14156 Member.prototype.get$library = function() { 14264 Member.prototype.get$library = function() {
14157 return this.declaringType.get$library(); 14265 return this.declaringType.get$library();
14158 } 14266 }
14159 Member.prototype.get$isPrivate = function() { 14267 Member.prototype.get$isPrivate = function() {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
14220 Member.prototype.get$definition = function() { 14328 Member.prototype.get$definition = function() {
14221 return null; 14329 return null;
14222 } 14330 }
14223 Member.prototype.get$parameters = function() { 14331 Member.prototype.get$parameters = function() {
14224 return []; 14332 return [];
14225 } 14333 }
14226 Member.prototype.canInvoke = function(context, args) { 14334 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)); 14335 return $notnull_bool(this.get$canGet() && new Value(this.get$returnType(), nul l, null, true).canInvoke(context, '\$call', args));
14228 } 14336 }
14229 Member.prototype.invoke = function(context, node, target, args, isDynamic) { 14337 Member.prototype.invoke = function(context, node, target, args, isDynamic) {
14338 var $0;
14230 var newTarget = this._get(context, node, target, isDynamic); 14339 var newTarget = this._get(context, node, target, isDynamic);
14231 return newTarget.invoke$5(context, '\$call', node, args, isDynamic); 14340 return (($0 = newTarget.invoke$5(context, '\$call', node, args, isDynamic)) && $0.is$Value());
14232 } 14341 }
14233 Member.prototype.override = function(other) { 14342 Member.prototype.override = function(other) {
14234 if ($notnull_bool(this.get$isStatic())) { 14343 if ($notnull_bool(this.get$isStatic())) {
14235 world.error('static members can not hide parent members', this.get$span(), o ther.get$span()); 14344 world.error('static members can not hide parent members', this.get$span(), o ther.get$span());
14236 return false; 14345 return false;
14237 } 14346 }
14238 else if ($notnull_bool(other.get$isStatic())) { 14347 else if ($notnull_bool(other.get$isStatic())) {
14239 world.error('can not override static member', this.get$span(), other.get$spa n()); 14348 world.error('can not override static member', this.get$span(), other.get$spa n());
14240 return false; 14349 return false;
14241 } 14350 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
14286 return this.resolve(($0 && $0.is$lang_Type())); 14395 return this.resolve(($0 && $0.is$lang_Type()));
14287 }; 14396 };
14288 // ********** Code for TypeMember ************** 14397 // ********** Code for TypeMember **************
14289 function TypeMember(type) { 14398 function TypeMember(type) {
14290 this.type = type; 14399 this.type = type;
14291 Member.call(this, type.name, type.library.topType); 14400 Member.call(this, type.name, type.library.topType);
14292 // Initializers done 14401 // Initializers done
14293 } 14402 }
14294 $inherits(TypeMember, Member); 14403 $inherits(TypeMember, Member);
14295 TypeMember.prototype.is$TypeMember = function(){return this;}; 14404 TypeMember.prototype.is$TypeMember = function(){return this;};
14405 TypeMember.prototype.get$type = function() { return this.type; };
14296 TypeMember.prototype.get$span = function() { 14406 TypeMember.prototype.get$span = function() {
14297 return this.type.definition.span; 14407 return this.type.definition.span;
14298 } 14408 }
14299 TypeMember.prototype.get$isStatic = function() { 14409 TypeMember.prototype.get$isStatic = function() {
14300 return true; 14410 return true;
14301 } 14411 }
14302 TypeMember.prototype.get$returnType = function() { 14412 TypeMember.prototype.get$returnType = function() {
14303 return world.varType; 14413 return world.varType;
14304 } 14414 }
14305 TypeMember.prototype.canInvoke = function(context, args) { 14415 TypeMember.prototype.canInvoke = function(context, args) {
14306 return false; 14416 return false;
14307 } 14417 }
14308 TypeMember.prototype.get$canGet = function() { 14418 TypeMember.prototype.get$canGet = function() {
14309 return true; 14419 return true;
14310 } 14420 }
14311 TypeMember.prototype.get$canSet = function() { 14421 TypeMember.prototype.get$canSet = function() {
14312 return false; 14422 return false;
14313 } 14423 }
14314 TypeMember.prototype.resolve = function(inType) { 14424 TypeMember.prototype.resolve = function(inType) {
14315 14425
14316 } 14426 }
14317 TypeMember.prototype._get = function(context, node, target, isDynamic) { 14427 TypeMember.prototype._get = function(context, node, target, isDynamic) {
14318 var ret = new Value(this.type, this.type.get$jsname(), node.span, false); 14428 var ret = new Value(this.type, this.type.get$jsname(), node.span, false);
14319 ret.isType = true; 14429 ret.set$isType(true);
14320 return (ret && ret.is$Value()); 14430 return (ret && ret.is$Value());
14321 } 14431 }
14322 TypeMember.prototype._set = function(context, node, target, value, isDynamic) { 14432 TypeMember.prototype._set = function(context, node, target, value, isDynamic) {
14323 world.error('can not set type', this.type.definition.span); 14433 world.error('can not set type', this.type.definition.span);
14324 } 14434 }
14325 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { 14435 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) {
14326 world.error('can not invoke type', this.type.definition.span); 14436 world.error('can not invoke type', this.type.definition.span);
14327 } 14437 }
14328 TypeMember.prototype._get$3 = function($0, $1, $2) { 14438 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); 14439 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; 14463 this.definition = definition;
14354 this.value = value; 14464 this.value = value;
14355 this.isNative = false; 14465 this.isNative = false;
14356 Member.call(this, name, declaringType); 14466 Member.call(this, name, declaringType);
14357 // Initializers done 14467 // Initializers done
14358 } 14468 }
14359 $inherits(FieldMember, Member); 14469 $inherits(FieldMember, Member);
14360 FieldMember.prototype.is$FieldMember = function(){return this;}; 14470 FieldMember.prototype.is$FieldMember = function(){return this;};
14361 FieldMember.prototype.get$definition = function() { return this.definition; }; 14471 FieldMember.prototype.get$definition = function() { return this.definition; };
14362 FieldMember.prototype.get$value = function() { return this.value; }; 14472 FieldMember.prototype.get$value = function() { return this.value; };
14473 FieldMember.prototype.get$type = function() { return this.type; };
14474 FieldMember.prototype.set$type = function(value) { return this.type = value; };
14363 FieldMember.prototype.get$isStatic = function() { return this.isStatic; }; 14475 FieldMember.prototype.get$isStatic = function() { return this.isStatic; };
14364 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va lue; }; 14476 FieldMember.prototype.set$isStatic = function(value) { return this.isStatic = va lue; };
14477 FieldMember.prototype.get$isFinal = function() { return this.isFinal; };
14478 FieldMember.prototype.set$isFinal = function(value) { return this.isFinal = valu e; };
14365 FieldMember.prototype.get$isNative = function() { return this.isNative; }; 14479 FieldMember.prototype.get$isNative = function() { return this.isNative; };
14366 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va lue; }; 14480 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va lue; };
14367 FieldMember.prototype.override = function(other) { 14481 FieldMember.prototype.override = function(other) {
14368 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false; 14482 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false;
14369 if ($notnull_bool(other.get$isProperty())) { 14483 if ($notnull_bool(other.get$isProperty())) {
14370 return true; 14484 return true;
14371 } 14485 }
14372 else { 14486 else {
14373 world.error('field can not override anything but property', this.get$span(), other.get$span()); 14487 world.error('field can not override anything but property', this.get$span(), other.get$span());
14374 return false; 14488 return false;
(...skipping 21 matching lines...) Expand all
14396 FieldMember.prototype.get$canGet = function() { 14510 FieldMember.prototype.get$canGet = function() {
14397 return true; 14511 return true;
14398 } 14512 }
14399 FieldMember.prototype.get$canSet = function() { 14513 FieldMember.prototype.get$canSet = function() {
14400 return !$notnull_bool(this.isFinal); 14514 return !$notnull_bool(this.isFinal);
14401 } 14515 }
14402 FieldMember.prototype.get$isField = function() { 14516 FieldMember.prototype.get$isField = function() {
14403 return true; 14517 return true;
14404 } 14518 }
14405 FieldMember.prototype.resolve = function(inType) { 14519 FieldMember.prototype.resolve = function(inType) {
14520 var $0;
14406 this.isStatic = this.declaringType.get$isTop(); 14521 this.isStatic = this.declaringType.get$isTop();
14407 this.isFinal = false; 14522 this.isFinal = false;
14408 if (this.definition.modifiers != null) { 14523 if (this.definition.modifiers != null) {
14409 var $list = this.definition.modifiers; 14524 var $list = this.definition.modifiers;
14410 for (var $i = 0;$i < $list.length; $i++) { 14525 for (var $i = 0;$i < $list.length; $i++) {
14411 var mod = $list.$index($i); 14526 var mod = $list.$index($i);
14412 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { 14527 if ($notnull_bool($eq(mod.get$kind(), 86/*TokenKind.STATIC*/))) {
14413 if ($notnull_bool(this.isStatic)) { 14528 if ($notnull_bool(this.isStatic)) {
14414 world.error('duplicate static modifier', mod.get$span()); 14529 world.error('duplicate static modifier', (($0 = mod.get$span()) && $0. is$SourceSpan()));
14415 } 14530 }
14416 this.isStatic = true; 14531 this.isStatic = true;
14417 } 14532 }
14418 else if ($notnull_bool($eq(mod.kind, 97/*TokenKind.FINAL*/))) { 14533 else if ($notnull_bool($eq(mod.get$kind(), 97/*TokenKind.FINAL*/))) {
14419 if ($notnull_bool(this.isFinal)) { 14534 if ($notnull_bool(this.isFinal)) {
14420 world.error('duplicate final modifier', mod.get$span()); 14535 world.error('duplicate final modifier', (($0 = mod.get$span()) && $0.i s$SourceSpan()));
14421 } 14536 }
14422 this.isFinal = true; 14537 this.isFinal = true;
14423 } 14538 }
14424 else { 14539 else {
14425 world.error(('' + mod + ' modifier not allowed on field'), mod.get$span( )); 14540 world.error(('' + mod + ' modifier not allowed on field'), (($0 = mod.ge t$span()) && $0.is$SourceSpan()));
14426 } 14541 }
14427 } 14542 }
14428 } 14543 }
14429 this.type = inType.resolveType(this.definition.type, false); 14544 this.type = inType.resolveType(this.definition.type, false);
14430 if ($notnull_bool(this.isStatic && this.type.get$hasTypeParams())) { 14545 if ($notnull_bool(this.isStatic && this.type.get$hasTypeParams())) {
14431 world.error('using type parameter in static context', this.definition.type.s pan); 14546 world.error('using type parameter in static context', this.definition.type.s pan);
14432 } 14547 }
14433 if ($notnull_bool(this.isStatic && this.isFinal) && this.value == null) { 14548 if ($notnull_bool(this.isStatic && this.isFinal) && this.value == null) {
14434 world.error('static final field is missing initializer', this.get$span()); 14549 world.error('static final field is missing initializer', this.get$span());
14435 } 14550 }
14436 this.get$library()._addMember(this); 14551 this.get$library()._addMember(this);
14437 } 14552 }
14438 FieldMember.prototype.computeValue = function() { 14553 FieldMember.prototype.computeValue = function() {
14439 var $0; 14554 var $0;
14440 if (this.value == null) return null; 14555 if (this.value == null) return null;
14441 if (this._computedValue == null) { 14556 if (this._computedValue == null) {
14442 if ($notnull_bool(this._computing)) { 14557 if ($notnull_bool(this._computing)) {
14443 world.error('circular reference', this.value.span); 14558 world.error('circular reference', this.value.span);
14444 return null; 14559 return null;
14445 } 14560 }
14446 this._computing = true; 14561 this._computing = true;
14447 var finalMethod = new MethodMember('final_context', this.declaringType, null ); 14562 var finalMethod = new MethodMember('final_context', this.declaringType, null );
14448 finalMethod.isStatic = true; 14563 finalMethod.set$isStatic(true);
14449 var finalGen = new MethodGenerator(finalMethod, null); 14564 var finalGen = new MethodGenerator(finalMethod, null);
14450 this._computedValue = (($0 = this.value.visit(finalGen)) && $0.is$Value()); 14565 this._computedValue = (($0 = this.value.visit(finalGen)) && $0.is$Value());
14451 if (!$notnull_bool(this._computedValue.get$isConst())) { 14566 if (!$notnull_bool(this._computedValue.get$isConst())) {
14452 if ($notnull_bool(this.isStatic)) { 14567 if ($notnull_bool(this.isStatic)) {
14453 world.error('non constant static field must be initialized in functions' , this.value.span); 14568 world.error('non constant static field must be initialized in functions' , this.value.span);
14454 } 14569 }
14455 else { 14570 else {
14456 world.error('non constant field must be initialized in constructor', thi s.value.span); 14571 world.error('non constant field must be initialized in constructor', thi s.value.span);
14457 } 14572 }
14458 } 14573 }
(...skipping 15 matching lines...) Expand all
14474 return (cv && cv.is$Value()); 14589 return (cv && cv.is$Value());
14475 } 14590 }
14476 if ($notnull_bool(this.declaringType.get$isTop())) { 14591 if ($notnull_bool(this.declaringType.get$isTop())) {
14477 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, true ); 14592 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, true );
14478 } 14593 }
14479 else { 14594 else {
14480 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, true); 14595 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, true);
14481 } 14596 }
14482 } 14597 }
14483 else if ($notnull_bool(target.get$isConst() && this.isFinal)) { 14598 else if ($notnull_bool(target.get$isConst() && this.isFinal)) {
14484 var constTarget = (target instanceof GlobalValue) ? target.get$dynamic().exp : target; 14599 var constTarget = (target instanceof GlobalValue) ? target.get$dynamic().get $exp() : target;
14485 if ((constTarget instanceof ConstObjectValue)) { 14600 if ((constTarget instanceof ConstObjectValue)) {
14486 return (($0 = constTarget.fields.$index(this.name)) && $0.is$Value()); 14601 return (($0 = constTarget.get$fields().$index(this.name)) && $0.is$Value() );
14487 } 14602 }
14488 else if ($notnull_bool($eq(constTarget.type, world.stringType) && this.name == 'length')) { 14603 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); 14604 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), node.span, true);
14490 } 14605 }
14491 } 14606 }
14492 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, true); 14607 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, true);
14493 } 14608 }
14494 FieldMember.prototype._set = function(context, node, target, value, isDynamic) { 14609 FieldMember.prototype._set = function(context, node, target, value, isDynamic) {
14495 var lhs = this._get(context, node, target, isDynamic); 14610 var lhs = this._get(context, node, target, isDynamic);
14496 value = value.convertTo(context, this.type, node, isDynamic); 14611 value = value.convertTo(context, this.type, node, isDynamic);
14497 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), node.sp an, true); 14612 return new Value(this.type, ('' + lhs.get$code() + ' = ' + value.code + ''), n ode.span, true);
14498 } 14613 }
14499 FieldMember.prototype._get$3 = function($0, $1, $2) { 14614 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); 14615 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
14501 }; 14616 };
14502 FieldMember.prototype._set$4 = function($0, $1, $2, $3) { 14617 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); 14618 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false);
14504 }; 14619 };
14505 FieldMember.prototype.computeValue$0 = function() { 14620 FieldMember.prototype.computeValue$0 = function() {
14506 return this.computeValue(); 14621 return this.computeValue();
14507 }; 14622 };
14508 FieldMember.prototype.provideFieldSyntax$0 = function() { 14623 FieldMember.prototype.provideFieldSyntax$0 = function() {
14509 return this.provideFieldSyntax(); 14624 return this.provideFieldSyntax();
14510 }; 14625 };
14511 FieldMember.prototype.providePropertySyntax$0 = function() { 14626 FieldMember.prototype.providePropertySyntax$0 = function() {
14512 return this.providePropertySyntax(); 14627 return this.providePropertySyntax();
14513 }; 14628 };
14514 FieldMember.prototype.resolve$1 = function($0) { 14629 FieldMember.prototype.resolve$1 = function($0) {
14515 return this.resolve(($0 && $0.is$lang_Type())); 14630 return this.resolve(($0 && $0.is$lang_Type()));
14516 }; 14631 };
14517 // ********** Code for PropertyMember ************** 14632 // ********** Code for PropertyMember **************
14518 function PropertyMember(name, declaringType) { 14633 function PropertyMember(name, declaringType) {
14519 this._provideFieldSyntax = false 14634 this._provideFieldSyntax = false
14520 Member.call(this, name, declaringType); 14635 Member.call(this, name, declaringType);
14521 // Initializers done 14636 // Initializers done
14522 } 14637 }
14523 $inherits(PropertyMember, Member); 14638 $inherits(PropertyMember, Member);
14524 PropertyMember.prototype.is$PropertyMember = function(){return this;}; 14639 PropertyMember.prototype.is$PropertyMember = function(){return this;};
14640 PropertyMember.prototype.get$getter = function() { return this.getter; };
14641 PropertyMember.prototype.set$getter = function(value) { return this.getter = val ue; };
14642 PropertyMember.prototype.get$setter = function() { return this.setter; };
14643 PropertyMember.prototype.set$setter = function(value) { return this.setter = val ue; };
14525 PropertyMember.prototype.get$span = function() { 14644 PropertyMember.prototype.get$span = function() {
14526 var $0; 14645 var $0;
14527 return (($0 = this.getter != null ? this.getter.get$span() : null) && $0.is$So urceSpan()); 14646 return (($0 = this.getter != null ? this.getter.get$span() : null) && $0.is$So urceSpan());
14528 } 14647 }
14529 PropertyMember.prototype.get$canGet = function() { 14648 PropertyMember.prototype.get$canGet = function() {
14530 return this.getter != null; 14649 return this.getter != null;
14531 } 14650 }
14532 PropertyMember.prototype.get$canSet = function() { 14651 PropertyMember.prototype.get$canSet = function() {
14533 return this.setter != null; 14652 return this.setter != null;
14534 } 14653 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
14619 // ********** Code for ConcreteMember ************** 14738 // ********** Code for ConcreteMember **************
14620 function ConcreteMember(name, declaringType, baseMember) { 14739 function ConcreteMember(name, declaringType, baseMember) {
14621 this.baseMember = baseMember; 14740 this.baseMember = baseMember;
14622 Member.call(this, name, declaringType); 14741 Member.call(this, name, declaringType);
14623 // Initializers done 14742 // Initializers done
14624 this.parameters = []; 14743 this.parameters = [];
14625 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring Type); 14744 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring Type);
14626 var $list = this.baseMember.get$parameters(); 14745 var $list = this.baseMember.get$parameters();
14627 for (var $i = 0;$i < $list.length; $i++) { 14746 for (var $i = 0;$i < $list.length; $i++) {
14628 var p = $list.$index($i); 14747 var p = $list.$index($i);
14629 var newType = p.type.resolveTypeParams$1(declaringType); 14748 var newType = p.get$type().resolveTypeParams$1(declaringType);
14630 if ($notnull_bool($ne(newType, p.type))) { 14749 if ($notnull_bool($ne(newType, p.get$type()))) {
14631 this.parameters.add(p.copyWithNewType$1(newType)); 14750 this.parameters.add(p.copyWithNewType$1(newType));
14632 } 14751 }
14633 else { 14752 else {
14634 this.parameters.add(p); 14753 this.parameters.add(p);
14635 } 14754 }
14636 } 14755 }
14637 } 14756 }
14638 $inherits(ConcreteMember, Member); 14757 $inherits(ConcreteMember, Member);
14639 ConcreteMember.prototype.is$ConcreteMember = function(){return this;}; 14758 ConcreteMember.prototype.is$ConcreteMember = function(){return this;};
14640 ConcreteMember.prototype.get$returnType = function() { return this.returnType; } ; 14759 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; }; 14900 MethodMember.prototype.get$parameters = function() { return this.parameters; };
14782 MethodMember.prototype.set$parameters = function(value) { return this.parameters = value; }; 14901 MethodMember.prototype.set$parameters = function(value) { return this.parameters = value; };
14783 MethodMember.prototype.get$isStatic = function() { return this.isStatic; }; 14902 MethodMember.prototype.get$isStatic = function() { return this.isStatic; };
14784 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v alue; }; 14903 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v alue; };
14785 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; }; 14904 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; };
14786 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract = value; }; 14905 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract = value; };
14787 MethodMember.prototype.get$isConst = function() { return this.isConst; }; 14906 MethodMember.prototype.get$isConst = function() { return this.isConst; };
14788 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val ue; }; 14907 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val ue; };
14789 MethodMember.prototype.get$isFactory = function() { return this.isFactory; }; 14908 MethodMember.prototype.get$isFactory = function() { return this.isFactory; };
14790 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory = value; }; 14909 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory = value; };
14910 MethodMember.prototype.get$isLambda = function() { return this.isLambda; };
14911 MethodMember.prototype.set$isLambda = function(value) { return this.isLambda = v alue; };
14791 MethodMember.prototype.get$initDelegate = function() { return this.initDelegate; }; 14912 MethodMember.prototype.get$initDelegate = function() { return this.initDelegate; };
14792 MethodMember.prototype.set$initDelegate = function(value) { return this.initDele gate = value; }; 14913 MethodMember.prototype.set$initDelegate = function(value) { return this.initDele gate = value; };
14793 MethodMember.prototype.get$isConstructor = function() { 14914 MethodMember.prototype.get$isConstructor = function() {
14794 return this.name == this.declaringType.name; 14915 return this.name == this.declaringType.name;
14795 } 14916 }
14796 MethodMember.prototype.get$isMethod = function() { 14917 MethodMember.prototype.get$isMethod = function() {
14797 return !$notnull_bool(this.get$isConstructor()); 14918 return !$notnull_bool(this.get$isConstructor());
14798 } 14919 }
14799 MethodMember.prototype.get$isNative = function() { 14920 MethodMember.prototype.get$isNative = function() {
14800 return (this.definition.body instanceof NativeStatement); 14921 return (this.definition.body instanceof NativeStatement);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
14891 } 15012 }
14892 this._providePropertySyntax = true; 15013 this._providePropertySyntax = true;
14893 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), node.span, true); 15014 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), node.span, true);
14894 } 15015 }
14895 MethodMember.prototype.namesInOrder = function(args) { 15016 MethodMember.prototype.namesInOrder = function(args) {
14896 if (!$notnull_bool(args.get$hasNames())) return true; 15017 if (!$notnull_bool(args.get$hasNames())) return true;
14897 var lastParameter = null; 15018 var lastParameter = null;
14898 for (var i = args.get$bareCount(); 15019 for (var i = args.get$bareCount();
14899 i < this.parameters.length; i++) { 15020 i < this.parameters.length; i++) {
14900 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam e())); 15021 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam e()));
14901 if ($notnull_bool(p >= 0 && args.values.$index(p).needsTemp)) { 15022 if ($notnull_bool(p >= 0 && args.values.$index(p).get$needsTemp())) {
14902 if (lastParameter != null && lastParameter > $assert_num(p)) { 15023 if (lastParameter != null && lastParameter > $assert_num(p)) {
14903 return false; 15024 return false;
14904 } 15025 }
14905 lastParameter = $assert_num(p); 15026 lastParameter = $assert_num(p);
14906 } 15027 }
14907 } 15028 }
14908 return true; 15029 return true;
14909 } 15030 }
14910 MethodMember.prototype.needsArgumentConversion = function(args) { 15031 MethodMember.prototype.needsArgumentConversion = function(args) {
14911 var bareCount = args.get$bareCount(); 15032 var bareCount = args.get$bareCount();
14912 for (var i = 0; 15033 for (var i = 0;
14913 i < bareCount; i++) { 15034 i < bareCount; i++) {
14914 var arg = args.values.$index(i); 15035 var arg = args.values.$index(i);
14915 if ($notnull_bool(arg.needsConversion$1(this.parameters.$index(i).type))) { 15036 if ($notnull_bool(arg.needsConversion$1(this.parameters.$index(i).get$type() ))) {
14916 return false; 15037 return false;
14917 } 15038 }
14918 } 15039 }
14919 if (bareCount < this.parameters.length) { 15040 if (bareCount < this.parameters.length) {
14920 this.genParameterValues(); 15041 this.genParameterValues();
14921 for (var i = bareCount; 15042 for (var i = bareCount;
14922 i < this.parameters.length; i++) { 15043 i < this.parameters.length; i++) {
14923 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( ))); 15044 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))) { 15045 if ($notnull_bool($ne(arg, null) && arg.needsConversion$1(this.parameters. $index(i).get$type()))) {
14925 return false; 15046 return false;
14926 } 15047 }
14927 } 15048 }
14928 } 15049 }
14929 return true; 15050 return true;
14930 } 15051 }
14931 MethodMember._argCountMsg = function(actual, expected, atLeast) { 15052 MethodMember._argCountMsg = function(actual, expected, atLeast) {
14932 return 'wrong number of arguments, expected ' + ('' + ($notnull_bool(atLeast) ? "at least " : "") + '' + expected + ' but found ' + actual + ''); 15053 return 'wrong number of arguments, expected ' + ('' + ($notnull_bool(atLeast) ? "at least " : "") + '' + expected + ' but found ' + actual + '');
14933 } 15054 }
14934 MethodMember.prototype._argError = function(context, node, target, args, msg) { 15055 MethodMember.prototype._argError = function(context, node, target, args, msg) {
14935 if ($notnull_bool(this.isStatic || this.get$isConstructor())) { 15056 if ($notnull_bool(this.isStatic || this.get$isConstructor())) {
14936 world.error(msg, node.span); 15057 world.error(msg, node.span);
14937 } 15058 }
14938 else { 15059 else {
14939 world.warning(msg, node.span); 15060 world.warning(msg, node.span);
14940 } 15061 }
14941 return target.invokeNoSuchMethod(context, this.name, node, args); 15062 return target.invokeNoSuchMethod(context, this.name, node, args);
14942 } 15063 }
14943 MethodMember.prototype.genParameterValues = function() { 15064 MethodMember.prototype.genParameterValues = function() {
14944 var $list = this.parameters; 15065 var $list = this.parameters;
14945 for (var $i = 0;$i < $list.length; $i++) { 15066 for (var $i = 0;$i < $list.length; $i++) {
14946 var p = $list.$index($i); 15067 var p = $list.$index($i);
14947 p.genValue$2(this, this.generator); 15068 p.genValue$2(this, this.generator);
14948 } 15069 }
14949 } 15070 }
14950 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) { 15071 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) {
15072 var $0;
14951 if (this.parameters == null) { 15073 if (this.parameters == null) {
14952 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.' + this.name + '')); 15074 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.' + this.name + ''));
14953 this.resolve(this.declaringType); 15075 this.resolve(this.declaringType);
14954 } 15076 }
14955 this.declaringType.genMethod(this); 15077 this.declaringType.genMethod(this);
14956 if ($notnull_bool(this.isStatic || this.isFactory)) { 15078 if ($notnull_bool(this.isStatic || this.isFactory)) {
14957 this.declaringType.markUsed(); 15079 this.declaringType.markUsed();
14958 } 15080 }
14959 if ($notnull_bool(this.get$isNative() && this.returnType != null)) this.return Type.markUsed(); 15081 if ($notnull_bool(this.get$isNative() && this.returnType != null)) this.return Type.markUsed();
14960 if (!$notnull_bool(this.namesInOrder(args))) { 15082 if (!$notnull_bool(this.namesInOrder(args))) {
14961 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s); 15083 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s);
14962 } 15084 }
14963 var argsCode = []; 15085 var argsCode = [];
14964 if (target != null && ($notnull_bool(this.get$isConstructor() || target.isSupe r))) { 15086 if (target != null && ($notnull_bool(this.get$isConstructor() || target.isSupe r))) {
14965 argsCode.add$1('this'); 15087 argsCode.add$1('this');
14966 } 15088 }
14967 var bareCount = args.get$bareCount(); 15089 var bareCount = args.get$bareCount();
14968 for (var i = 0; 15090 for (var i = 0;
14969 i < bareCount; i++) { 15091 i < bareCount; i++) {
14970 var arg = args.values.$index(i); 15092 var arg = args.values.$index(i);
14971 if (i >= this.parameters.length) { 15093 if (i >= this.parameters.length) {
14972 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false); 15094 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false);
14973 return this._argError(context, node, target, args, $assert_String(msg)); 15095 return this._argError(context, node, target, args, $assert_String(msg));
14974 } 15096 }
14975 arg = arg.convertTo$4(context, this.parameters.$index(i).type, node, isDynam ic); 15097 arg = arg.convertTo$4(context, this.parameters.$index(i).get$type(), node, i sDynamic);
14976 if ($notnull_bool(this.isConst && arg.get$isConst())) { 15098 if ($notnull_bool(this.isConst && arg.get$isConst())) {
14977 argsCode.add$1(arg.get$canonicalCode()); 15099 argsCode.add$1(arg.get$canonicalCode());
14978 } 15100 }
14979 else { 15101 else {
14980 argsCode.add$1(arg.code); 15102 argsCode.add$1(arg.get$code());
14981 } 15103 }
14982 } 15104 }
14983 if (bareCount < this.parameters.length) { 15105 if (bareCount < this.parameters.length) {
14984 this.genParameterValues(); 15106 this.genParameterValues();
14985 var namedArgsUsed = 0; 15107 var namedArgsUsed = 0;
14986 for (var i = bareCount; 15108 for (var i = bareCount;
14987 i < this.parameters.length; i++) { 15109 i < this.parameters.length; i++) {
14988 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( ))); 15110 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( )));
14989 if ($notnull_bool(arg == null)) { 15111 if ($notnull_bool(arg == null)) {
14990 arg = this.parameters.$index(i).get$value(); 15112 arg = this.parameters.$index(i).get$value();
14991 } 15113 }
14992 else { 15114 else {
14993 arg = arg.convertTo$4(context, this.parameters.$index(i).type, node, isD ynamic); 15115 arg = arg.convertTo$4(context, this.parameters.$index(i).get$type(), nod e, isDynamic);
14994 namedArgsUsed++; 15116 namedArgsUsed++;
14995 } 15117 }
14996 if ($notnull_bool(arg == null || !$notnull_bool(this.parameters.$index(i). get$isOptional()))) { 15118 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); 15119 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + 1, true);
14998 return this._argError(context, node, target, args, $assert_String(msg)); 15120 return this._argError(context, node, target, args, $assert_String(msg));
14999 } 15121 }
15000 else { 15122 else {
15001 argsCode.add$1($notnull_bool(this.isConst && arg.get$isConst()) ? arg.ge t$canonicalCode() : arg.code); 15123 argsCode.add$1($notnull_bool(this.isConst && arg.get$isConst()) ? arg.ge t$canonicalCode() : arg.get$code());
15002 } 15124 }
15003 } 15125 }
15004 if (namedArgsUsed < args.get$nameCount()) { 15126 if (namedArgsUsed < args.get$nameCount()) {
15005 var seen = new HashSetImplementation(); 15127 var seen = new HashSetImplementation();
15006 for (var i = bareCount; 15128 for (var i = bareCount;
15007 i < args.get$length(); i++) { 15129 i < args.get$length(); i++) {
15008 var name = args.getName(i); 15130 var name = args.getName(i);
15009 if ($notnull_bool(seen.contains$1(name))) { 15131 if ($notnull_bool(seen.contains$1(name))) {
15010 return this._argError(context, node, target, args, ('duplicate argumen t "' + name + '"')); 15132 return this._argError(context, node, target, args, ('duplicate argumen t "' + name + '"'));
15011 } 15133 }
(...skipping 25 matching lines...) Expand all
15037 } 15159 }
15038 if ($notnull_bool(this.isStatic)) { 15160 if ($notnull_bool(this.isStatic)) {
15039 if ($notnull_bool(this.declaringType.get$isTop())) { 15161 if ($notnull_bool(this.declaringType.get$isTop())) {
15040 return new Value(this.get$inferredResult(), ('' + this.get$jsname() + '(' + argsString + ')'), node != null ? node.span : node, true); 15162 return new Value(this.get$inferredResult(), ('' + this.get$jsname() + '(' + argsString + ')'), node != null ? node.span : node, true);
15041 } 15163 }
15042 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn ame() + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true); 15164 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn ame() + '.' + this.get$jsname() + '(' + argsString + ')'), node.span, true);
15043 } 15165 }
15044 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ') '); 15166 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ') ');
15045 if ($notnull_bool(target.get$isConst())) { 15167 if ($notnull_bool(target.get$isConst())) {
15046 if ((target instanceof GlobalValue)) { 15168 if ((target instanceof GlobalValue)) {
15047 target = target.get$dynamic().exp; 15169 target = (($0 = target.get$dynamic().get$exp()) && $0.is$Value());
15048 } 15170 }
15049 if (this.name == 'get\$length') { 15171 if (this.name == 'get\$length') {
15050 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) { 15172 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) {
15051 code = ('' + target.get$dynamic().values.length + ''); 15173 code = ('' + target.get$dynamic().get$values().length + '');
15052 } 15174 }
15053 } 15175 }
15054 else if (this.name == 'isEmpty') { 15176 else if (this.name == 'isEmpty') {
15055 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) { 15177 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) {
15056 code = ('' + target.get$dynamic().values.isEmpty$0() + ''); 15178 code = ('' + target.get$dynamic().get$values().isEmpty$0() + '');
15057 } 15179 }
15058 } 15180 }
15059 } 15181 }
15060 if (this.name == 'get\$typeName' && $eq(this.declaringType.get$library(), worl d.get$dom())) { 15182 if (this.name == 'get\$typeName' && $eq(this.declaringType.get$library(), worl d.get$dom())) {
15061 world.gen.corejs.useTypeNameOf = true; 15183 world.gen.corejs.useTypeNameOf = true;
15062 } 15184 }
15063 return new Value(this.get$inferredResult(), code, node.span, true); 15185 return new Value(this.get$inferredResult(), code, node.span, true);
15064 } 15186 }
15065 MethodMember.prototype._invokeConstructor = function(context, node, target, args , argsString) { 15187 MethodMember.prototype._invokeConstructor = function(context, node, target, args , argsString) {
15066 this.declaringType.markUsed(); 15188 this.declaringType.markUsed();
(...skipping 10 matching lines...) Expand all
15077 return new Value(this.declaringType, code, node.span, true); 15199 return new Value(this.declaringType, code, node.span, true);
15078 } 15200 }
15079 } 15201 }
15080 } 15202 }
15081 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar gs) { 15203 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar gs) {
15082 var $0; 15204 var $0;
15083 var fields = new HashMapImplementation(); 15205 var fields = new HashMapImplementation();
15084 for (var i = 0; 15206 for (var i = 0;
15085 i < this.parameters.length; i++) { 15207 i < this.parameters.length; i++) {
15086 var param = this.parameters.$index(i); 15208 var param = this.parameters.$index(i);
15087 if ($notnull_bool(param.isInitializer)) { 15209 if ($notnull_bool(param.get$isInitializer())) {
15088 var value = null; 15210 var value = null;
15089 if (i < args.get$length()) { 15211 if (i < args.get$length()) {
15090 value = args.values.$index(i); 15212 value = args.values.$index(i);
15091 } 15213 }
15092 else { 15214 else {
15093 value = args.getValue($assert_String(param.get$name())); 15215 value = args.getValue($assert_String(param.get$name()));
15094 if ($notnull_bool(value == null)) { 15216 if ($notnull_bool(value == null)) {
15095 value = param.get$value(); 15217 value = param.get$value();
15096 } 15218 }
15097 } 15219 }
(...skipping 16 matching lines...) Expand all
15114 } 15236 }
15115 } 15237 }
15116 this.generator._scope._vars.$setindex(name, value); 15238 this.generator._scope._vars.$setindex(name, value);
15117 } 15239 }
15118 var $list = this.definition.initializers; 15240 var $list = this.definition.initializers;
15119 for (var $i = 0;$i < $list.length; $i++) { 15241 for (var $i = 0;$i < $list.length; $i++) {
15120 var init = $list.$index($i); 15242 var init = $list.$index($i);
15121 if ((init instanceof CallExpression)) { 15243 if ((init instanceof CallExpression)) {
15122 var delegateArgs = this.generator._makeArgs((($0 = init.get$arguments()) && $0.is$List$ArgumentNode())); 15244 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); 15245 var value = this.initDelegate.invoke(this.generator, node, target, deleg ateArgs, false);
15124 if ((init.target instanceof ThisExpression)) { 15246 if ((init.get$target() instanceof ThisExpression)) {
15125 return (value && value.is$Value()); 15247 return (value && value.is$Value());
15126 } 15248 }
15127 else { 15249 else {
15128 if ((value instanceof GlobalValue)) { 15250 if ((value instanceof GlobalValue)) {
15129 value = value.exp; 15251 value = value.get$exp();
15130 } 15252 }
15131 var $list0 = value.fields.getKeys(); 15253 var $list0 = value.get$fields().getKeys$0();
15132 for (var $i0 = value.fields.getKeys().iterator$0(); $i0.hasNext$0(); ) { 15254 for (var $i0 = value.get$fields().getKeys$0().iterator$0(); $i0.hasNex t$0(); ) {
15133 var fname = $i0.next$0(); 15255 var fname = $i0.next$0();
15134 fields.$setindex(fname, value.fields.$index(fname)); 15256 fields.$setindex(fname, value.get$fields().$index(fname));
15135 } 15257 }
15136 } 15258 }
15137 } 15259 }
15138 else { 15260 else {
15139 var assign = (init && init.is$BinaryExpression()); 15261 var assign = (init && init.is$BinaryExpression());
15140 var x = (($0 = assign.x) && $0.is$VarExpression()); 15262 var x = (($0 = assign.x) && $0.is$VarExpression());
15141 var fname = x.name.name; 15263 var fname = x.name.name;
15142 var val = this.generator.visitValue(assign.y); 15264 var val = this.generator.visitValue(assign.y);
15143 fields.$setindex(fname, val); 15265 fields.$setindex(fname, val);
15144 } 15266 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
15294 } 15416 }
15295 else if ($notnull_bool(this.declaringType.get$isString())) { 15417 else if ($notnull_bool(this.declaringType.get$isString())) {
15296 if (this.name == '\$index') { 15418 if (this.name == '\$index') {
15297 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i ndex(0) + ']'), node.span, true); 15419 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i ndex(0) + ']'), node.span, true);
15298 } 15420 }
15299 else if (this.name == '\$add') { 15421 else if (this.name == '\$add') {
15300 if ($notnull_bool(allConst)) { 15422 if ($notnull_bool(allConst)) {
15301 var val0 = target.get$dynamic().get$actualValue(); 15423 var val0 = target.get$dynamic().get$actualValue();
15302 val0 = val0.substring$2(1, val0.length - 1); 15424 val0 = val0.substring$2(1, val0.length - 1);
15303 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); 15425 var val1 = args.values.$index(0).get$dynamic().get$actualValue();
15304 if ($notnull_bool(args.values.$index(0).type.get$isString())) { 15426 if ($notnull_bool(args.values.$index(0).get$type().get$isString())) {
15305 val1 = val1.substring$2(1, val1.length - 1); 15427 val1 = val1.substring$2(1, val1.length - 1);
15306 } 15428 }
15307 var value = ('' + val0 + '' + val1 + ''); 15429 var value = ('' + val0 + '' + val1 + '');
15308 value = '"' + value.replaceAll$2('"', '\\"') + '"'; 15430 value = '"' + value.replaceAll$2('"', '\\"') + '"';
15309 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, $a ssert_String(value), node.span); 15431 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, $a ssert_String(value), node.span);
15310 } 15432 }
15311 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM PTY()); 15433 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); 15434 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode. $index(0) + ''), node.span, true);
15313 } 15435 }
15314 } 15436 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
15347 if (this.name == '\$index') { 15469 if (this.name == '\$index') {
15348 world.gen.corejs.useIndex = true; 15470 world.gen.corejs.useIndex = true;
15349 } 15471 }
15350 else if (this.name == '\$setindex') { 15472 else if (this.name == '\$setindex') {
15351 world.gen.corejs.useSetIndex = true; 15473 world.gen.corejs.useSetIndex = true;
15352 } 15474 }
15353 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); 15475 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); 15476 return new Value(this.get$inferredResult(), ('' + target.code + '.' + this.get $jsname() + '(' + argsString + ')'), node.span, true);
15355 } 15477 }
15356 MethodMember.prototype.resolve = function(inType) { 15478 MethodMember.prototype.resolve = function(inType) {
15479 var $0;
15357 this.isStatic = inType.get$isTop(); 15480 this.isStatic = inType.get$isTop();
15358 this.isConst = false; 15481 this.isConst = false;
15359 this.isFactory = false; 15482 this.isFactory = false;
15360 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass()); 15483 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass());
15361 if (this.definition.modifiers != null) { 15484 if (this.definition.modifiers != null) {
15362 var $list = this.definition.modifiers; 15485 var $list = this.definition.modifiers;
15363 for (var $i = 0;$i < $list.length; $i++) { 15486 for (var $i = 0;$i < $list.length; $i++) {
15364 var mod = $list.$index($i); 15487 var mod = $list.$index($i);
15365 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { 15488 if ($notnull_bool($eq(mod.get$kind(), 86/*TokenKind.STATIC*/))) {
15366 if ($notnull_bool(this.isStatic)) { 15489 if ($notnull_bool(this.isStatic)) {
15367 world.error('duplicate static modifier', mod.get$span()); 15490 world.error('duplicate static modifier', (($0 = mod.get$span()) && $0. is$SourceSpan()));
15368 } 15491 }
15369 this.isStatic = true; 15492 this.isStatic = true;
15370 } 15493 }
15371 else if ($notnull_bool(this.get$isConstructor() && $eq(mod.kind, 91/*Token Kind.CONST*/))) { 15494 else if ($notnull_bool(this.get$isConstructor() && $eq(mod.get$kind(), 91/ *TokenKind.CONST*/))) {
15372 if ($notnull_bool(this.isConst)) { 15495 if ($notnull_bool(this.isConst)) {
15373 world.error('duplicate const modifier', mod.get$span()); 15496 world.error('duplicate const modifier', (($0 = mod.get$span()) && $0.i s$SourceSpan()));
15374 } 15497 }
15375 this.isConst = true; 15498 this.isConst = true;
15376 } 15499 }
15377 else if ($notnull_bool($eq(mod.kind, 75/*TokenKind.FACTORY*/))) { 15500 else if ($notnull_bool($eq(mod.get$kind(), 75/*TokenKind.FACTORY*/))) {
15378 if ($notnull_bool(this.isFactory)) { 15501 if ($notnull_bool(this.isFactory)) {
15379 world.error('duplicate factory modifier', mod.get$span()); 15502 world.error('duplicate factory modifier', (($0 = mod.get$span()) && $0 .is$SourceSpan()));
15380 } 15503 }
15381 this.isFactory = true; 15504 this.isFactory = true;
15382 } 15505 }
15383 else if ($notnull_bool($eq(mod.kind, 71/*TokenKind.ABSTRACT*/))) { 15506 else if ($notnull_bool($eq(mod.get$kind(), 71/*TokenKind.ABSTRACT*/))) {
15384 if ($notnull_bool(this.isAbstract)) { 15507 if ($notnull_bool(this.isAbstract)) {
15385 if ($notnull_bool(this.declaringType.get$isClass())) { 15508 if ($notnull_bool(this.declaringType.get$isClass())) {
15386 world.error('duplicate abstract modifier', mod.get$span()); 15509 world.error('duplicate abstract modifier', (($0 = mod.get$span()) && $0.is$SourceSpan()));
15387 } 15510 }
15388 else { 15511 else {
15389 world.error('abstract modifier not allowed on interface members', mo d.get$span()); 15512 world.error('abstract modifier not allowed on interface members', (( $0 = mod.get$span()) && $0.is$SourceSpan()));
15390 } 15513 }
15391 } 15514 }
15392 this.isAbstract = true; 15515 this.isAbstract = true;
15393 } 15516 }
15394 else { 15517 else {
15395 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span ()); 15518 world.error(('' + mod + ' modifier not allowed on method'), (($0 = mod.g et$span()) && $0.is$SourceSpan()));
15396 } 15519 }
15397 } 15520 }
15398 } 15521 }
15399 if ($notnull_bool(this.isFactory)) { 15522 if ($notnull_bool(this.isFactory)) {
15400 this.isStatic = true; 15523 this.isStatic = true;
15401 } 15524 }
15402 if ($notnull_bool(this.get$isOperator() && this.isStatic) && !$notnull_bool(th is.get$isCallMethod())) { 15525 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()); 15526 world.error(('operator method may not be static "' + this.name + '"'), this. get$span());
15404 } 15527 }
15405 if ($notnull_bool(this.isAbstract)) { 15528 if ($notnull_bool(this.isAbstract)) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
15488 }) 15611 })
15489 ); 15612 );
15490 } 15613 }
15491 MemberSet.prototype.add = function(member) { 15614 MemberSet.prototype.add = function(member) {
15492 return this.members.add(member); 15615 return this.members.add(member);
15493 } 15616 }
15494 MemberSet.prototype.get$isStatic = function() { 15617 MemberSet.prototype.get$isStatic = function() {
15495 return $notnull_bool(this.members.length == 1 && this.members.$index(0).get$is Static()); 15618 return $notnull_bool(this.members.length == 1 && this.members.$index(0).get$is Static());
15496 } 15619 }
15497 MemberSet.prototype.get$isOperator = function() { 15620 MemberSet.prototype.get$isOperator = function() {
15498 return this.members.$index(0).get$isOperator(); 15621 return $assert_bool(this.members.$index(0).get$isOperator());
15499 } 15622 }
15500 MemberSet.prototype.canInvoke = function(context, args) { 15623 MemberSet.prototype.canInvoke = function(context, args) {
15501 return this.members.some((function (m) { 15624 return this.members.some((function (m) {
15502 return m.canInvoke$2(context, args); 15625 return m.canInvoke$2(context, args);
15503 }) 15626 })
15504 ); 15627 );
15505 } 15628 }
15506 MemberSet.prototype._makeError = function(node, target, action) { 15629 MemberSet.prototype._makeError = function(node, target, action) {
15507 if (!$notnull_bool(target.type.get$isVar())) { 15630 if (!$notnull_bool(target.type.get$isVar())) {
15508 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span); 15631 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span);
15509 } 15632 }
15510 return new Value(world.varType, ('' + target.code + '.' + this.jsname + '() /* no applicable ' + action + '*/'), node.span, true); 15633 return new Value(world.varType, ('' + target.code + '.' + this.jsname + '() /* no applicable ' + action + '*/'), node.span, true);
15511 } 15634 }
15512 MemberSet.prototype.get$treatAsField = function() { 15635 MemberSet.prototype.get$treatAsField = function() {
15513 if (this._treatAsField == null) { 15636 if (this._treatAsField == null) {
15514 this._treatAsField = true; 15637 this._treatAsField = !$notnull_bool(this.isVar);
15515 var $list = this.members; 15638 var $list = this.members;
15516 for (var $i = 0;$i < $list.length; $i++) { 15639 for (var $i = 0;$i < $list.length; $i++) {
15517 var member = $list.$index($i); 15640 var member = $list.$index($i);
15518 if ($notnull_bool(member.get$requiresFieldSyntax())) { 15641 if ($notnull_bool(member.get$requiresFieldSyntax())) {
15519 this._treatAsField = true; 15642 this._treatAsField = true;
15520 break; 15643 break;
15521 } 15644 }
15522 if ($notnull_bool(member.get$prefersPropertySyntax())) { 15645 if ($notnull_bool(member.get$prefersPropertySyntax())) {
15523 this._treatAsField = false; 15646 this._treatAsField = false;
15524 } 15647 }
15525 } 15648 }
15526 var $list = this.members; 15649 var $list = this.members;
15527 for (var $i = 0;$i < $list.length; $i++) { 15650 for (var $i = 0;$i < $list.length; $i++) {
15528 var member = $list.$index($i); 15651 var member = $list.$index($i);
15529 if ($notnull_bool(this._treatAsField)) { 15652 if ($notnull_bool(this._treatAsField)) {
15530 member.provideFieldSyntax$0(); 15653 member.provideFieldSyntax$0();
15531 } 15654 }
15532 else { 15655 else {
15533 member.providePropertySyntax$0(); 15656 member.providePropertySyntax$0();
15534 } 15657 }
15535 } 15658 }
15536 } 15659 }
15537 return this._treatAsField; 15660 return this._treatAsField;
15538 } 15661 }
15539 MemberSet.prototype._get = function(context, node, target, isDynamic) { 15662 MemberSet.prototype._get = function(context, node, target, isDynamic) {
15540 if (this.members.length == 1) { 15663 var returnValue;
15541 return this.members.$index(0)._get(context, node, target, isDynamic);
15542 }
15543 var targets = this.members.filter((function (m) { 15664 var targets = this.members.filter((function (m) {
15544 return m.get$canGet(); 15665 return m.get$canGet();
15545 }) 15666 })
15546 ); 15667 );
15547 if (targets.length == 1) { 15668 if ($notnull_bool(this.isVar)) {
15548 return targets.$index(0)._get(context, node, target, isDynamic); 15669 targets.forEach$1((function (m) {
15670 return m._get(context, node, target, true);
15671 })
15672 );
15673 returnValue = new Value(world.varType, null, node.span, true);
15549 } 15674 }
15550 var returnValue = null; 15675 else {
15551 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { 15676 if (this.members.length == 1) {
15552 var member = $i.next$0(); 15677 return this.members.$index(0)._get(context, node, target, isDynamic);
15553 var value = member._get(context, node, target, true); 15678 }
15554 returnValue = this._tryUnion(returnValue, value, node); 15679 else if ($notnull_bool($eq(targets.length, 1))) {
15555 } 15680 return targets.$index(0)._get(context, node, target, isDynamic);
15556 if (returnValue == null) { 15681 }
15557 return this._makeError(node, target, 'getter'); 15682 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) {
15683 var member = $i.next$0();
15684 var value = member._get(context, node, target, true);
15685 returnValue = this._tryUnion(returnValue, value, node);
15686 }
15687 if (returnValue == null) {
15688 return this._makeError(node, target, 'getter');
15689 }
15558 } 15690 }
15559 if (returnValue.code == null) { 15691 if (returnValue.code == null) {
15560 if ($notnull_bool(this.get$treatAsField())) { 15692 if ($notnull_bool(this.get$treatAsField())) {
15561 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ''), node.span, true); 15693 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ''), node.span, true);
15562 } 15694 }
15563 else { 15695 else {
15564 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn ame + '()'), node.span, true); 15696 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn ame + '()'), node.span, true);
15565 } 15697 }
15566 } 15698 }
15567 return returnValue; 15699 return returnValue;
15568 } 15700 }
15569 MemberSet.prototype._set = function(context, node, target, value, isDynamic) { 15701 MemberSet.prototype._set = function(context, node, target, value, isDynamic) {
15570 if (this.members.length == 1) { 15702 var returnValue;
15571 return this.members.$index(0)._set(context, node, target, value, isDynamic);
15572 }
15573 var targets = this.members.filter((function (m) { 15703 var targets = this.members.filter((function (m) {
15574 return m.get$canSet(); 15704 return m.get$canSet();
15575 }) 15705 })
15576 ); 15706 );
15577 if (targets.length == 1) { 15707 if ($notnull_bool(this.isVar)) {
15578 return targets.$index(0)._set(context, node, target, value, isDynamic); 15708 targets.forEach$1((function (m) {
15709 return m._set(context, node, target, value, true);
15710 })
15711 );
15712 returnValue = new Value(world.varType, null, node.span, true);
15579 } 15713 }
15580 var returnValue = null; 15714 else {
15581 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { 15715 if (this.members.length == 1) {
15582 var member = $i.next$0(); 15716 return this.members.$index(0)._set(context, node, target, value, isDynamic );
15583 var res = member._set(context, node, target, value, true); 15717 }
15584 returnValue = this._tryUnion(returnValue, res, node); 15718 else if ($notnull_bool($eq(targets.length, 1))) {
15585 } 15719 return targets.$index(0)._set(context, node, target, value, isDynamic);
15586 if (returnValue == null) { 15720 }
15587 return this._makeError(node, target, 'setter'); 15721 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) {
15722 var member = $i.next$0();
15723 var res = member._set(context, node, target, value, true);
15724 returnValue = this._tryUnion(returnValue, res, node);
15725 }
15726 if (returnValue == null) {
15727 return this._makeError(node, target, 'setter');
15728 }
15588 } 15729 }
15589 if (returnValue.code == null) { 15730 if (returnValue.code == null) {
15590 if ($notnull_bool(this.get$treatAsField())) { 15731 if ($notnull_bool(this.get$treatAsField())) {
15591 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ' = ' + value.code + ''), node.span, true); 15732 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname + ' = ' + value.code + ''), node.span, true);
15592 } 15733 }
15593 else { 15734 else {
15594 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn ame + '(' + value.code + ')'), node.span, true); 15735 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn ame + '(' + value.code + ')'), node.span, true);
15595 } 15736 }
15596 } 15737 }
15597 return returnValue; 15738 return returnValue;
15598 } 15739 }
15599 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { 15740 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) {
15600 var $0; 15741 var $0;
15601 if ($notnull_bool(this.isVar && !$notnull_bool(this.get$isOperator()))) { 15742 if ($notnull_bool(this.isVar && !$notnull_bool(this.get$isOperator()))) {
15743 this.members.filter((function (m) {
15744 return m.canInvoke$2(context, args);
15745 })
15746 ).forEach$1((function (m) {
15747 return m.invoke$4$isDynamic(context, node, target, args, true);
15748 })
15749 );
15602 return this.invokeOnVar(context, node, target, args); 15750 return this.invokeOnVar(context, node, target, args);
15603 } 15751 }
15604 if (this.members.length == 1) { 15752 if (this.members.length == 1) {
15605 return this.members.$index(0).invoke$5(context, node, target, args, isDynami c); 15753 return (($0 = this.members.$index(0).invoke$5(context, node, target, args, i sDynamic)) && $0.is$Value());
15606 } 15754 }
15607 var targets = this.members.filter((function (m) { 15755 var targets = this.members.filter((function (m) {
15608 return m.canInvoke$2(context, args); 15756 return m.canInvoke$2(context, args);
15609 }) 15757 })
15610 ); 15758 );
15611 if (targets.length == 1) { 15759 if ($notnull_bool($eq(targets.length, 1))) {
15612 return (($0 = targets.$index(0).invoke$5(context, node, target, args, isDyna mic)) && $0.is$Value()); 15760 return (($0 = targets.$index(0).invoke$5(context, node, target, args, isDyna mic)) && $0.is$Value());
15613 } 15761 }
15614 var returnValue = null; 15762 var returnValue = null;
15615 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) { 15763 for (var $i = targets.iterator$0(); $i.hasNext$0(); ) {
15616 var member = $i.next$0(); 15764 var member = $i.next$0();
15617 var res = member.invoke$4$isDynamic(context, node, target, args, true); 15765 var res = member.invoke$4$isDynamic(context, node, target, args, true);
15618 returnValue = this._tryUnion(returnValue, res, node); 15766 returnValue = this._tryUnion(returnValue, (res && res.is$Value()), node);
15619 } 15767 }
15620 if (returnValue == null) { 15768 if (returnValue == null) {
15621 return this._makeError(node, target, 'method'); 15769 return this._makeError(node, target, 'method');
15622 } 15770 }
15623 if (returnValue.code == null) { 15771 if (returnValue.code == null) {
15624 if ($notnull_bool(this.get$isOperator())) { 15772 if ($notnull_bool(this.get$isOperator())) {
15625 return target.invokeSpecial(this.name, args, returnValue.type); 15773 return target.invokeSpecial(this.name, args, returnValue.type);
15626 } 15774 }
15627 else { 15775 else {
15628 return this.invokeOnVar(context, node, target, args); 15776 return this.invokeOnVar(context, node, target, args);
15629 } 15777 }
15630 } 15778 }
15631 return returnValue; 15779 return returnValue;
15632 } 15780 }
15633 MemberSet.prototype.invokeOnVar = function(context, node, target, args) { 15781 MemberSet.prototype.invokeOnVar = function(context, node, target, args) {
15782 var $0;
15634 var member = this.getVarMember(context, node, args); 15783 var member = this.getVarMember(context, node, args);
15635 return member.invoke$4(context, node, target, args); 15784 return (($0 = member.invoke$4(context, node, target, args)) && $0.is$Value());
15636 } 15785 }
15637 MemberSet.prototype._tryUnion = function(x, y, node) { 15786 MemberSet.prototype._tryUnion = function(x, y, node) {
15638 if (x == null) return y; 15787 if (x == null) return y;
15639 var type = lang_Type.union(x.type, y.type); 15788 var type = lang_Type.union(x.type, y.type);
15640 if (x.code == y.code) { 15789 if (x.code == y.code) {
15641 if ($notnull_bool($eq(type, x.type))) { 15790 if ($notnull_bool($eq(type, x.type))) {
15642 return x; 15791 return x;
15643 } 15792 }
15644 else if ($notnull_bool(x.get$isConst() || y.get$isConst())) { 15793 else if ($notnull_bool(x.get$isConst() || y.get$isConst())) {
15645 world.internalError("unexpected: union of const values "); 15794 world.internalError("unexpected: union of const values ");
15646 } 15795 }
15647 else { 15796 else {
15648 var ret = new Value(type, x.code, node.span, true); 15797 var ret = new Value(type, x.code, node.span, true);
15649 ret.isSuper = $notnull_bool(x.isSuper && y.isSuper); 15798 ret.set$isSuper($notnull_bool(x.isSuper && y.isSuper));
15650 ret.needsTemp = $notnull_bool(x.needsTemp || y.needsTemp); 15799 ret.set$needsTemp($notnull_bool(x.needsTemp || y.needsTemp));
15651 ret.isType = $notnull_bool(x.isType && y.isType); 15800 ret.set$isType($notnull_bool(x.isType && y.isType));
15652 return (ret && ret.is$Value()); 15801 return (ret && ret.is$Value());
15653 } 15802 }
15654 } 15803 }
15655 else { 15804 else {
15656 return new Value(type, null, node.span, true); 15805 return new Value(type, null, node.span, true);
15657 } 15806 }
15658 } 15807 }
15659 MemberSet.prototype.getVarMember = function(context, node, args) { 15808 MemberSet.prototype.getVarMember = function(context, node, args) {
15660 if (world.objectType.varStubs == null) { 15809 if (world.objectType.varStubs == null) {
15661 world.objectType.varStubs = $map([]); 15810 world.objectType.varStubs = $map([]);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
15723 } 15872 }
15724 FactoryMap.prototype.forEach = function(f) { 15873 FactoryMap.prototype.forEach = function(f) {
15725 this.factories.forEach((function (_, constructors) { 15874 this.factories.forEach((function (_, constructors) {
15726 constructors.forEach((function (_, member) { 15875 constructors.forEach((function (_, member) {
15727 f(member); 15876 f(member);
15728 }) 15877 })
15729 ); 15878 );
15730 }) 15879 })
15731 ); 15880 );
15732 } 15881 }
15882 FactoryMap.prototype.forEach$1 = FactoryMap.prototype.forEach;
15733 FactoryMap.prototype.getFactory$2 = function($0, $1) { 15883 FactoryMap.prototype.getFactory$2 = function($0, $1) {
15734 return this.getFactory($assert_String($0), $assert_String($1)); 15884 return this.getFactory($assert_String($0), $assert_String($1));
15735 }; 15885 };
15736 // ********** Code for lang_Token ************** 15886 // ********** Code for lang_Token **************
15737 function lang_Token(kind, source, start, end) { 15887 function lang_Token(kind, source, start, end) {
15738 this.kind = kind; 15888 this.kind = kind;
15739 this.source = source; 15889 this.source = source;
15740 this.start = start; 15890 this.start = start;
15741 this.end = end; 15891 this.end = end;
15742 // Initializers done 15892 // Initializers done
15743 } 15893 }
15894 lang_Token.prototype.get$kind = function() { return this.kind; };
15895 lang_Token.prototype.get$end = function() { return this.end; };
15896 lang_Token.prototype.get$start = function() { return this.start; };
15744 lang_Token.prototype.get$text = function() { 15897 lang_Token.prototype.get$text = function() {
15745 return this.source.get$text().substring(this.start, this.end); 15898 return this.source.get$text().substring(this.start, this.end);
15746 } 15899 }
15747 lang_Token.prototype.toString = function() { 15900 lang_Token.prototype.toString = function() {
15748 var kindText = TokenKind.kindToString(this.kind); 15901 var kindText = TokenKind.kindToString(this.kind);
15749 var actualText = this.get$text(); 15902 var actualText = this.get$text();
15750 if ($notnull_bool($ne(kindText, actualText))) { 15903 if ($notnull_bool($ne(kindText, actualText))) {
15751 if (actualText.length > 10) { 15904 if (actualText.length > 10) {
15752 actualText = actualText.substring$2(0, 8) + '...'; 15905 actualText = actualText.substring$2(0, 8) + '...';
15753 } 15906 }
(...skipping 10 matching lines...) Expand all
15764 return this.toString(); 15917 return this.toString();
15765 }; 15918 };
15766 // ********** Code for SourceFile ************** 15919 // ********** Code for SourceFile **************
15767 function SourceFile(filename, _text) { 15920 function SourceFile(filename, _text) {
15768 this.filename = filename; 15921 this.filename = filename;
15769 this._text = _text; 15922 this._text = _text;
15770 // Initializers done 15923 // Initializers done
15771 } 15924 }
15772 SourceFile.prototype.is$SourceFile = function(){return this;}; 15925 SourceFile.prototype.is$SourceFile = function(){return this;};
15773 SourceFile.prototype.is$Comparable = function(){return this;}; 15926 SourceFile.prototype.is$Comparable = function(){return this;};
15927 SourceFile.prototype.get$filename = function() { return this.filename; };
15928 SourceFile.prototype.get$orderInLibrary = function() { return this.orderInLibrar y; };
15929 SourceFile.prototype.set$orderInLibrary = function(value) { return this.orderInL ibrary = value; };
15774 SourceFile.prototype.get$text = function() { 15930 SourceFile.prototype.get$text = function() {
15775 return this._text; 15931 return this._text;
15776 } 15932 }
15777 SourceFile.prototype.get$lineStarts = function() { 15933 SourceFile.prototype.get$lineStarts = function() {
15778 if (this._lineStarts == null) { 15934 if (this._lineStarts == null) {
15779 var starts = [0]; 15935 var starts = [0];
15780 var index = 0; 15936 var index = 0;
15781 while (index < this.get$text().length) { 15937 while (index < this.get$text().length) {
15782 index = this.get$text().indexOf('\n', index) + 1; 15938 index = this.get$text().indexOf('\n', index) + 1;
15783 if (index <= 0) break; 15939 if (index <= 0) break;
15784 starts.add$1(index); 15940 starts.add$1(index);
15785 } 15941 }
15786 starts.add$1(this.get$text().length + 1); 15942 starts.add$1(this.get$text().length + 1);
15787 this._lineStarts = (starts && starts.is$List$int()); 15943 this._lineStarts = (starts && starts.is$List$int());
15788 } 15944 }
15789 return this._lineStarts; 15945 return this._lineStarts;
15790 } 15946 }
15791 SourceFile.prototype.getLine = function(position) { 15947 SourceFile.prototype.getLine = function(position) {
15792 var starts = this.get$lineStarts(); 15948 var starts = this.get$lineStarts();
15793 for (var i = 0; 15949 for (var i = 0;
15794 i < starts.length; i++) { 15950 i < $assert_num(starts.length); i++) {
15795 if (starts.$index(i) > position) return i - 1; 15951 if (starts.$index(i) > position) return i - 1;
15796 } 15952 }
15797 world.internalError('bad position'); 15953 world.internalError('bad position');
15798 } 15954 }
15799 SourceFile.prototype.getColumn = function(line, position) { 15955 SourceFile.prototype.getColumn = function(line, position) {
15800 return position - $assert_num(this.get$lineStarts().$index(line)); 15956 return position - $assert_num(this.get$lineStarts().$index(line));
15801 } 15957 }
15802 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT ext) { 15958 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT ext) {
15803 var line = this.getLine(start); 15959 var line = this.getLine(start);
15804 var column = this.getColumn($assert_num(line), start); 15960 var column = this.getColumn($assert_num(line), start);
15805 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' + (column + 1) + ': ' + message + '')); 15961 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' + (column + 1) + ': ' + message + ''));
15806 if ($notnull_bool(includeText)) { 15962 if ($notnull_bool(includeText)) {
15807 buf.add$1('\n'); 15963 buf.add$1('\n');
15808 var textLine; 15964 var textLine;
15809 if ((line + 2) < this._lineStarts.length) { 15965 if ((line + 2) < this._lineStarts.length) {
15810 textLine = this.get$text().substring(this._lineStarts.$index(line), this._ lineStarts.$index(line + 1)); 15966 textLine = this.get$text().substring(this._lineStarts.$index(line), this._ lineStarts.$index(line + 1));
15811 } 15967 }
15812 else { 15968 else {
15813 textLine = this.get$text().substring(this._lineStarts.$index(line)) + '\n' ; 15969 textLine = this.get$text().substring(this._lineStarts.$index(line)) + '\n' ;
15814 } 15970 }
15815 buf.add$1(textLine); 15971 buf.add$1(textLine);
15816 var i = 0; 15972 var i = 0;
15817 for (; i < $assert_num(column); i++) { 15973 for (; i < $assert_num(column); i++) {
15818 buf.add$1(' '); 15974 buf.add$1(' ');
15819 } 15975 }
15820 var toColumn = Math.min($assert_num(column + (end - start)), textLine.length ); 15976 var toColumn = Math.min($assert_num(column + (end - start)), $assert_num(tex tLine.length));
15821 for (; i < toColumn; i++) { 15977 for (; i < toColumn; i++) {
15822 buf.add$1('^'); 15978 buf.add$1('^');
15823 } 15979 }
15824 } 15980 }
15825 return buf.toString$0(); 15981 return buf.toString$0();
15826 } 15982 }
15827 SourceFile.prototype.compareTo = function(other) { 15983 SourceFile.prototype.compareTo = function(other) {
15828 if (this.orderInLibrary != null && other.orderInLibrary != null) { 15984 if (this.orderInLibrary != null && other.orderInLibrary != null) {
15829 return this.orderInLibrary - other.orderInLibrary; 15985 return this.orderInLibrary - other.orderInLibrary;
15830 } 15986 }
15831 else { 15987 else {
15832 return this.filename.compareTo(other.filename); 15988 return this.filename.compareTo(other.filename);
15833 } 15989 }
15834 } 15990 }
15835 SourceFile.prototype.compareTo$1 = function($0) { 15991 SourceFile.prototype.compareTo$1 = function($0) {
15836 return this.compareTo(($0 && $0.is$SourceFile())); 15992 return this.compareTo(($0 && $0.is$SourceFile()));
15837 }; 15993 };
15994 SourceFile.prototype.getColumn$2 = function($0, $1) {
15995 return this.getColumn($assert_num($0), $assert_num($1));
15996 };
15997 SourceFile.prototype.getLine$1 = function($0) {
15998 return this.getLine($assert_num($0));
15999 };
15838 // ********** Code for SourceSpan ************** 16000 // ********** Code for SourceSpan **************
15839 function SourceSpan(file, start, end) { 16001 function SourceSpan(file, start, end) {
15840 this.file = file; 16002 this.file = file;
15841 this.start = start; 16003 this.start = start;
15842 this.end = end; 16004 this.end = end;
15843 // Initializers done 16005 // Initializers done
15844 } 16006 }
15845 SourceSpan.prototype.is$SourceSpan = function(){return this;}; 16007 SourceSpan.prototype.is$SourceSpan = function(){return this;};
15846 SourceSpan.prototype.is$Comparable = function(){return this;}; 16008 SourceSpan.prototype.is$Comparable = function(){return this;};
16009 SourceSpan.prototype.get$file = function() { return this.file; };
16010 SourceSpan.prototype.get$start = function() { return this.start; };
16011 SourceSpan.prototype.get$end = function() { return this.end; };
15847 SourceSpan.prototype.get$text = function() { 16012 SourceSpan.prototype.get$text = function() {
15848 return this.file.get$text().substring(this.start, this.end); 16013 return this.file.get$text().substring(this.start, this.end);
15849 } 16014 }
15850 SourceSpan.prototype.toMessageString = function(message) { 16015 SourceSpan.prototype.toMessageString = function(message) {
15851 return this.file.getLocationMessage(message, this.start, this.end, true); 16016 return this.file.getLocationMessage(message, this.start, this.end, true);
15852 } 16017 }
15853 SourceSpan.prototype.get$locationText = function() { 16018 SourceSpan.prototype.get$locationText = function() {
15854 var line = this.file.getLine(this.start); 16019 var line = this.file.getLine(this.start);
15855 var column = this.file.getColumn($assert_num(line), this.start); 16020 var column = this.file.getColumn($assert_num(line), this.start);
15856 return ('' + this.file.filename + ':' + (line + 1) + ':' + (column + 1) + ''); 16021 return ('' + this.file.filename + ':' + (line + 1) + ':' + (column + 1) + '');
(...skipping 10 matching lines...) Expand all
15867 }; 16032 };
15868 // ********** Code for InterpStack ************** 16033 // ********** Code for InterpStack **************
15869 function InterpStack(previous, quote, isMultiline) { 16034 function InterpStack(previous, quote, isMultiline) {
15870 this.previous = previous; 16035 this.previous = previous;
15871 this.quote = quote; 16036 this.quote = quote;
15872 this.isMultiline = isMultiline; 16037 this.isMultiline = isMultiline;
15873 this.depth = -1; 16038 this.depth = -1;
15874 // Initializers done 16039 // Initializers done
15875 } 16040 }
15876 InterpStack.prototype.is$InterpStack = function(){return this;}; 16041 InterpStack.prototype.is$InterpStack = function(){return this;};
16042 InterpStack.prototype.get$previous = function() { return this.previous; };
16043 InterpStack.prototype.set$previous = function(value) { return this.previous = va lue; };
16044 InterpStack.prototype.get$quote = function() { return this.quote; };
16045 InterpStack.prototype.get$isMultiline = function() { return this.isMultiline; };
16046 InterpStack.prototype.get$depth = function() { return this.depth; };
16047 InterpStack.prototype.set$depth = function(value) { return this.depth = value; } ;
15877 InterpStack.prototype.pop = function() { 16048 InterpStack.prototype.pop = function() {
15878 return this.previous; 16049 return this.previous;
15879 } 16050 }
15880 InterpStack.push = function(stack, quote, isMultiline) { 16051 InterpStack.push = function(stack, quote, isMultiline) {
15881 var newStack = new InterpStack(stack, quote, isMultiline); 16052 var newStack = new InterpStack(stack, quote, isMultiline);
15882 if (stack != null) newStack.previous = stack; 16053 if (stack != null) newStack.set$previous(stack);
15883 return (newStack && newStack.is$InterpStack()); 16054 return (newStack && newStack.is$InterpStack());
15884 } 16055 }
15885 InterpStack.prototype.next$0 = function() { 16056 InterpStack.prototype.next$0 = function() {
15886 return this.next(); 16057 return this.next();
15887 }; 16058 };
15888 // ********** Code for TokenizerBase ************** 16059 // ********** Code for TokenizerBase **************
15889 function TokenizerBase(_source, _skipWhitespace, _index) { 16060 function TokenizerBase(_source, _skipWhitespace, _index) {
15890 this._source = _source; 16061 this._source = _source;
15891 this._skipWhitespace = _skipWhitespace; 16062 this._skipWhitespace = _skipWhitespace;
15892 this._lang_index = _index; 16063 this._lang_index = _index;
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
16223 function Tokenizer(source, skipWhitespace, index) { 16394 function Tokenizer(source, skipWhitespace, index) {
16224 TokenizerBase.call(this, source, skipWhitespace, index); 16395 TokenizerBase.call(this, source, skipWhitespace, index);
16225 // Initializers done 16396 // Initializers done
16226 } 16397 }
16227 $inherits(Tokenizer, TokenizerBase); 16398 $inherits(Tokenizer, TokenizerBase);
16228 Tokenizer.prototype.next = function() { 16399 Tokenizer.prototype.next = function() {
16229 this._startIndex = this._lang_index; 16400 this._startIndex = this._lang_index;
16230 if (this._interpStack != null && this._interpStack.depth == 0) { 16401 if (this._interpStack != null && this._interpStack.depth == 0) {
16231 var istack = this._interpStack; 16402 var istack = this._interpStack;
16232 this._interpStack = this._interpStack.pop(); 16403 this._interpStack = this._interpStack.pop();
16233 if ($notnull_bool(istack.isMultiline)) { 16404 if ($notnull_bool(istack.get$isMultiline())) {
16234 return this.finishMultilineString(istack.quote); 16405 return this.finishMultilineString($assert_num(istack.get$quote()));
16235 } 16406 }
16236 else { 16407 else {
16237 return this.finishStringBody(istack.quote); 16408 return this.finishStringBody($assert_num(istack.get$quote()));
16238 } 16409 }
16239 } 16410 }
16240 var ch; 16411 var ch;
16241 ch = this._nextChar(); 16412 ch = this._nextChar();
16242 switch (ch) { 16413 switch (ch) {
16243 case 0: 16414 case 0:
16244 16415
16245 return this._finishToken(1/*TokenKind.END_OF_FILE*/); 16416 return this._finishToken(1/*TokenKind.END_OF_FILE*/);
16246 16417
16247 case 32: 16418 case 32:
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
17621 lang_Parser.prototype._eat = function(kind) { 17792 lang_Parser.prototype._eat = function(kind) {
17622 if (!$notnull_bool(this._maybeEat(kind))) { 17793 if (!$notnull_bool(this._maybeEat(kind))) {
17623 this._errorExpected(TokenKind.kindToString(kind)); 17794 this._errorExpected(TokenKind.kindToString(kind));
17624 } 17795 }
17625 } 17796 }
17626 lang_Parser.prototype._eatSemicolon = function() { 17797 lang_Parser.prototype._eatSemicolon = function() {
17627 if ($notnull_bool(this.optionalSemicolons && this._peekKind(1/*TokenKind.END_O F_FILE*/))) return; 17798 if ($notnull_bool(this.optionalSemicolons && this._peekKind(1/*TokenKind.END_O F_FILE*/))) return;
17628 this._eat(10/*TokenKind.SEMICOLON*/); 17799 this._eat(10/*TokenKind.SEMICOLON*/);
17629 } 17800 }
17630 lang_Parser.prototype._errorExpected = function(expected) { 17801 lang_Parser.prototype._errorExpected = function(expected) {
17802 var $0;
17631 if ($notnull_bool(this.throwOnIncomplete)) this.isPrematureEndOfFile(); 17803 if ($notnull_bool(this.throwOnIncomplete)) this.isPrematureEndOfFile();
17632 var tok = this._lang_next(); 17804 var tok = this._lang_next();
17633 var message = ('expected ' + expected + ', but found ' + tok + ''); 17805 var message = ('expected ' + expected + ', but found ' + tok + '');
17634 this._lang_error($assert_String(message), tok.get$span()); 17806 this._lang_error($assert_String(message), (($0 = tok.get$span()) && $0.is$Sour ceSpan()));
17635 } 17807 }
17636 lang_Parser.prototype._lang_error = function(message, location) { 17808 lang_Parser.prototype._lang_error = function(message, location) {
17637 if (location == null) { 17809 if (location == null) {
17638 location = this._peekToken.get$span(); 17810 location = this._peekToken.get$span();
17639 } 17811 }
17640 world.fatal(message, location); 17812 world.fatal(message, location);
17641 } 17813 }
17642 lang_Parser.prototype._skipBlock = function() { 17814 lang_Parser.prototype._skipBlock = function() {
17815 var $0;
17643 var depth = 1; 17816 var depth = 1;
17644 this._eat(6/*TokenKind.LBRACE*/); 17817 this._eat(6/*TokenKind.LBRACE*/);
17645 while (true) { 17818 while (true) {
17646 var tok = this._lang_next(); 17819 var tok = this._lang_next();
17647 if ($notnull_bool($eq(tok.kind, 6/*TokenKind.LBRACE*/))) { 17820 if ($notnull_bool($eq(tok.get$kind(), 6/*TokenKind.LBRACE*/))) {
17648 depth += 1; 17821 depth += 1;
17649 } 17822 }
17650 else if ($notnull_bool($eq(tok.kind, 7/*TokenKind.RBRACE*/))) { 17823 else if ($notnull_bool($eq(tok.get$kind(), 7/*TokenKind.RBRACE*/))) {
17651 depth -= 1; 17824 depth -= 1;
17652 if (depth == 0) return; 17825 if (depth == 0) return;
17653 } 17826 }
17654 else if ($notnull_bool($eq(tok.kind, 1/*TokenKind.END_OF_FILE*/))) { 17827 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( )); 17828 this._lang_error('unexpected end of file during diet parse', (($0 = tok.ge t$span()) && $0.is$SourceSpan()));
17656 return; 17829 return;
17657 } 17830 }
17658 } 17831 }
17659 } 17832 }
17660 lang_Parser.prototype._makeSpan = function(start) { 17833 lang_Parser.prototype._makeSpan = function(start) {
17661 return new SourceSpan(this.source, start, this._previousToken.end); 17834 return new SourceSpan(this.source, start, this._previousToken.end);
17662 } 17835 }
17663 lang_Parser.prototype.compilationUnit = function() { 17836 lang_Parser.prototype.compilationUnit = function() {
17664 var ret = []; 17837 var ret = [];
17665 this._maybeEat(13/*TokenKind.HASHBANG*/); 17838 this._maybeEat(13/*TokenKind.HASHBANG*/);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
17738 lang_Parser.prototype.functionTypeAlias = function() { 17911 lang_Parser.prototype.functionTypeAlias = function() {
17739 var start = this._peekToken.start; 17912 var start = this._peekToken.start;
17740 this._eat(87/*TokenKind.TYPEDEF*/); 17913 this._eat(87/*TokenKind.TYPEDEF*/);
17741 var di = this.declaredIdentifier(false); 17914 var di = this.declaredIdentifier(false);
17742 var typeParams = null; 17915 var typeParams = null;
17743 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { 17916 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) {
17744 typeParams = this.typeParameters(); 17917 typeParams = this.typeParameters();
17745 } 17918 }
17746 var formals = this.formalParameterList(); 17919 var formals = this.formalParameterList();
17747 this._eatSemicolon(); 17920 this._eatSemicolon();
17748 var func = new FunctionDefinition(null, di.type, di.get$name(), formals, null, null, this._makeSpan(start)); 17921 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)); 17922 return new FunctionTypeDefinition(func, typeParams, this._makeSpan(start));
17750 } 17923 }
17751 lang_Parser.prototype.initializers = function() { 17924 lang_Parser.prototype.initializers = function() {
17752 this._inInitializers = true; 17925 this._inInitializers = true;
17753 var ret = []; 17926 var ret = [];
17754 do { 17927 do {
17755 ret.add$1(this.expression()); 17928 ret.add$1(this.expression());
17756 } 17929 }
17757 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) 17930 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/)))
17758 this._inInitializers = false; 17931 this._inInitializers = false;
17759 return ret; 17932 return ret;
17760 } 17933 }
17934 lang_Parser.prototype.get$initializers = function() {
17935 return lang_Parser.prototype.initializers.bind(this);
17936 }
17761 lang_Parser.prototype.functionBody = function(inExpression) { 17937 lang_Parser.prototype.functionBody = function(inExpression) {
17762 var start = this._peekToken.start; 17938 var start = this._peekToken.start;
17763 if ($notnull_bool(this._maybeEat(9/*TokenKind.ARROW*/))) { 17939 if ($notnull_bool(this._maybeEat(9/*TokenKind.ARROW*/))) {
17764 var expr = this.expression(); 17940 var expr = this.expression();
17765 if (!$notnull_bool(inExpression)) { 17941 if (!$notnull_bool(inExpression)) {
17766 this._eatSemicolon(); 17942 this._eatSemicolon();
17767 } 17943 }
17768 return new ReturnStatement(expr, this._makeSpan(start)); 17944 return new ReturnStatement(expr, this._makeSpan(start));
17769 } 17945 }
17770 else if ($notnull_bool(this._peekKind(6/*TokenKind.LBRACE*/))) { 17946 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()) { 17988 switch (this._peek()) {
17813 case 2/*TokenKind.LPAREN*/: 17989 case 2/*TokenKind.LPAREN*/:
17814 17990
17815 var formals = this.formalParameterList(); 17991 var formals = this.formalParameterList();
17816 var inits = null; 17992 var inits = null;
17817 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { 17993 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) {
17818 inits = this.initializers(); 17994 inits = this.initializers();
17819 } 17995 }
17820 var body = this.functionBody(false); 17996 var body = this.functionBody(false);
17821 if ($notnull_bool(di.get$name() == null)) { 17997 if ($notnull_bool(di.get$name() == null)) {
17822 di.name = di.type.get$name(); 17998 di.set$name(di.get$type().get$name());
17823 } 17999 }
17824 return new FunctionDefinition(modifiers, di.type, di.get$name(), formals, inits, body, this._makeSpan($assert_num(start))); 18000 return new FunctionDefinition(modifiers, di.get$type(), di.get$name(), for mals, inits, body, this._makeSpan($assert_num(start)));
17825 18001
17826 case 20/*TokenKind.ASSIGN*/: 18002 case 20/*TokenKind.ASSIGN*/:
17827 18003
17828 this._eat(20/*TokenKind.ASSIGN*/); 18004 this._eat(20/*TokenKind.ASSIGN*/);
17829 var value = this.expression(); 18005 var value = this.expression();
17830 return this.finishField(start, modifiers, di.type, di.get$name(), value); 18006 return this.finishField(start, modifiers, di.get$type(), di.get$name(), va lue);
17831 18007
17832 case 11/*TokenKind.COMMA*/: 18008 case 11/*TokenKind.COMMA*/:
17833 case 10/*TokenKind.SEMICOLON*/: 18009 case 10/*TokenKind.SEMICOLON*/:
17834 18010
17835 return this.finishField(start, modifiers, di.type, di.get$name(), null); 18011 return this.finishField(start, modifiers, di.get$type(), di.get$name(), nu ll);
17836 18012
17837 default: 18013 default:
17838 18014
17839 this._errorExpected('declaration'); 18015 this._errorExpected('declaration');
17840 return null; 18016 return null;
17841 18017
17842 } 18018 }
17843 } 18019 }
17844 lang_Parser.prototype.declaration = function(includeOperators) { 18020 lang_Parser.prototype.declaration = function(includeOperators) {
17845 var start = this._peekToken.start; 18021 var start = this._peekToken.start;
17846 if ($notnull_bool(this._peekKind(75/*TokenKind.FACTORY*/))) { 18022 if ($notnull_bool(this._peekKind(75/*TokenKind.FACTORY*/))) {
17847 return this.factoryConstructorDeclaration(); 18023 return this.factoryConstructorDeclaration();
17848 } 18024 }
17849 var modifiers = this._readModifiers(); 18025 var modifiers = this._readModifiers();
17850 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include Operators)); 18026 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include Operators));
17851 } 18027 }
17852 lang_Parser.prototype.factoryConstructorDeclaration = function() { 18028 lang_Parser.prototype.factoryConstructorDeclaration = function() {
18029 var $0;
17853 var start = this._peekToken.start; 18030 var start = this._peekToken.start;
17854 var factoryToken = this._lang_next(); 18031 var factoryToken = this._lang_next();
17855 var names = [this.identifier()]; 18032 var names = [this.identifier()];
17856 while ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { 18033 while ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) {
17857 names.add$1(this.identifier()); 18034 names.add$1(this.identifier());
17858 } 18035 }
17859 var typeParams = null; 18036 var typeParams = null;
17860 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { 18037 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) {
17861 typeParams = this.typeParameters(); 18038 typeParams = this.typeParameters();
17862 } 18039 }
17863 var name = null; 18040 var name = null;
17864 var type = null; 18041 var type = null;
17865 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { 18042 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) {
17866 name = this.identifier(); 18043 name = this.identifier();
17867 } 18044 }
17868 else if ($notnull_bool(typeParams == null)) { 18045 else if ($notnull_bool(typeParams == null)) {
17869 if (names.length > 1) { 18046 if (names.length > 1) {
17870 name = names.removeLast$0(); 18047 name = names.removeLast$0();
17871 } 18048 }
17872 else { 18049 else {
17873 name = new lang_Identifier('', names.$index(0).get$span()); 18050 name = new lang_Identifier('', (($0 = names.$index(0).get$span()) && $0.is $SourceSpan()));
17874 } 18051 }
17875 } 18052 }
17876 else { 18053 else {
17877 name = new lang_Identifier('', names.$index(0).get$span()); 18054 name = new lang_Identifier('', (($0 = names.$index(0).get$span()) && $0.is$S ourceSpan()));
17878 } 18055 }
17879 if (names.length > 1) { 18056 if (names.length > 1) {
17880 this._lang_error('unsupported qualified name for factory', names.$index(0).g et$span()); 18057 this._lang_error('unsupported qualified name for factory', (($0 = names.$ind ex(0).get$span()) && $0.is$SourceSpan()));
17881 } 18058 }
17882 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get $span()); 18059 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)); 18060 var di = new DeclaredIdentifier(type, name, this._makeSpan(start));
17884 return this.finishDefinition(start, [factoryToken], di); 18061 return this.finishDefinition(start, [factoryToken], di);
17885 } 18062 }
17886 lang_Parser.prototype.statement = function() { 18063 lang_Parser.prototype.statement = function() {
17887 var $0; 18064 var $0;
17888 switch (this._peek()) { 18065 switch (this._peek()) {
17889 case 88/*TokenKind.BREAK*/: 18066 case 88/*TokenKind.BREAK*/:
17890 18067
17891 return (($0 = this.breakStatement()) && $0.is$lang_Statement()); 18068 return (($0 = this.breakStatement()) && $0.is$lang_Statement());
17892 18069
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
17947 return (($0 = this.declaration(false)) && $0.is$lang_Statement()); 18124 return (($0 = this.declaration(false)) && $0.is$lang_Statement());
17948 18125
17949 default: 18126 default:
17950 18127
17951 return (($0 = this.finishExpressionAsStatement(this.expression())) && $0.i s$lang_Statement()); 18128 return (($0 = this.finishExpressionAsStatement(this.expression())) && $0.i s$lang_Statement());
17952 18129
17953 } 18130 }
17954 } 18131 }
17955 lang_Parser.prototype.finishExpressionAsStatement = function(expr) { 18132 lang_Parser.prototype.finishExpressionAsStatement = function(expr) {
17956 var $0; 18133 var $0;
17957 var start = expr.get$span().start; 18134 var start = $assert_num(expr.get$span().get$start());
17958 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { 18135 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) {
17959 var label = this._makeLabel(expr); 18136 var label = this._makeLabel(expr);
17960 return new LabeledStatement(label, this.statement(), this._makeSpan(start)); 18137 return new LabeledStatement(label, this.statement(), this._makeSpan(start));
17961 } 18138 }
17962 if ((expr instanceof LambdaExpression)) { 18139 if ((expr instanceof LambdaExpression)) {
17963 if (!(expr.func.body instanceof BlockStatement)) { 18140 if (!(expr.get$func().get$body() instanceof BlockStatement)) {
17964 this._eatSemicolon(); 18141 this._eatSemicolon();
17965 expr.func.span = this._makeSpan(start); 18142 expr.get$func().set$span(this._makeSpan(start));
17966 } 18143 }
17967 return expr.func; 18144 return expr.get$func();
17968 } 18145 }
17969 else if ((expr instanceof DeclaredIdentifier)) { 18146 else if ((expr instanceof DeclaredIdentifier)) {
17970 var value = null; 18147 var value = null;
17971 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { 18148 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) {
17972 value = this.expression(); 18149 value = this.expression();
17973 } 18150 }
17974 return this.finishField(start, null, expr.type, expr.get$name(), value); 18151 return this.finishField(start, null, expr.get$type(), expr.get$name(), value );
17975 } 18152 }
17976 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x i nstanceof DeclaredIdentifier)))) { 18153 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.get $x() instanceof DeclaredIdentifier)))) {
17977 var di = (($0 = expr.x) && $0.is$DeclaredIdentifier()); 18154 var di = (($0 = expr.get$x()) && $0.is$DeclaredIdentifier());
17978 return this.finishField(start, null, di.type, di.name, expr.y); 18155 return this.finishField(start, null, di.type, di.name, expr.get$y());
17979 } 18156 }
17980 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat (11/*TokenKind.COMMA*/))) { 18157 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat (11/*TokenKind.COMMA*/))) {
17981 var baseType = this._makeType(expr.x); 18158 var baseType = this._makeType(expr.get$x());
17982 var typeArgs = [this._makeType(expr.y)]; 18159 var typeArgs = [this._makeType(expr.get$y())];
17983 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference()) , 0, typeArgs); 18160 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference()) , 0, typeArgs);
17984 var name = this.identifier(); 18161 var name = this.identifier();
17985 var value = null; 18162 var value = null;
17986 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { 18163 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) {
17987 value = this.expression(); 18164 value = this.expression();
17988 } 18165 }
17989 return this.finishField(expr.get$span().start, null, gt, name, value); 18166 return this.finishField(expr.get$span().get$start(), null, gt, name, value);
17990 } 18167 }
17991 else { 18168 else {
17992 this._eatSemicolon(); 18169 this._eatSemicolon();
17993 return new lang_ExpressionStatement(expr, this._makeSpan(expr.get$span().sta rt)); 18170 return new lang_ExpressionStatement(expr, this._makeSpan($assert_num(expr.ge t$span().get$start())));
17994 } 18171 }
17995 } 18172 }
17996 lang_Parser.prototype.testCondition = function() { 18173 lang_Parser.prototype.testCondition = function() {
17997 this._eat(2/*TokenKind.LPAREN*/); 18174 this._eat(2/*TokenKind.LPAREN*/);
17998 var ret = this.expression(); 18175 var ret = this.expression();
17999 this._eat(3/*TokenKind.RPAREN*/); 18176 this._eat(3/*TokenKind.RPAREN*/);
18000 return (ret && ret.is$lang_Expression()); 18177 return (ret && ret.is$lang_Expression());
18001 } 18178 }
18002 lang_Parser.prototype.block = function() { 18179 lang_Parser.prototype.block = function() {
18003 var start = this._peekToken.start; 18180 var start = this._peekToken.start;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
18067 } 18244 }
18068 lang_Parser.prototype.forInitializerStatement = function(start) { 18245 lang_Parser.prototype.forInitializerStatement = function(start) {
18069 var $0; 18246 var $0;
18070 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) { 18247 if ($notnull_bool(this._maybeEat(10/*TokenKind.SEMICOLON*/))) {
18071 return null; 18248 return null;
18072 } 18249 }
18073 else { 18250 else {
18074 var init = this.expression(); 18251 var init = this.expression();
18075 if ($notnull_bool(this._peekKind(11/*TokenKind.COMMA*/) && this._isBin(init, 52/*TokenKind.LT*/))) { 18252 if ($notnull_bool(this._peekKind(11/*TokenKind.COMMA*/) && this._isBin(init, 52/*TokenKind.LT*/))) {
18076 this._eat(11/*TokenKind.COMMA*/); 18253 this._eat(11/*TokenKind.COMMA*/);
18077 var baseType = this._makeType(init.x); 18254 var baseType = this._makeType(init.get$x());
18078 var typeArgs = [this._makeType(init.y)]; 18255 var typeArgs = [this._makeType(init.get$y())];
18079 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference( )), 0, typeArgs); 18256 var gt = this._finishTypeArguments((baseType && baseType.is$TypeReference( )), 0, typeArgs);
18080 var name = this.identifier(); 18257 var name = this.identifier();
18081 init = new DeclaredIdentifier(gt, name, this._makeSpan(init.get$span().sta rt)); 18258 init = new DeclaredIdentifier(gt, name, this._makeSpan($assert_num(init.ge t$span().get$start())));
18082 } 18259 }
18083 if ($notnull_bool(this._maybeEat(101/*TokenKind.IN*/))) { 18260 if ($notnull_bool(this._maybeEat(101/*TokenKind.IN*/))) {
18084 return this._finishForIn(start, (($0 = this._makeDeclaredIdentifier(init)) && $0.is$DeclaredIdentifier())); 18261 return this._finishForIn(start, (($0 = this._makeDeclaredIdentifier(init)) && $0.is$DeclaredIdentifier()));
18085 } 18262 }
18086 else { 18263 else {
18087 return this.finishExpressionAsStatement(init); 18264 return this.finishExpressionAsStatement(init);
18088 } 18265 }
18089 } 18266 }
18090 } 18267 }
18091 lang_Parser.prototype._finishForIn = function(start, di) { 18268 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*/); 18327 this._eat(8/*TokenKind.COLON*/);
18151 } 18328 }
18152 else if ($notnull_bool(this._maybeEat(93/*TokenKind.DEFAULT*/))) { 18329 else if ($notnull_bool(this._maybeEat(93/*TokenKind.DEFAULT*/))) {
18153 cases.add$1(); 18330 cases.add$1();
18154 this._eat(8/*TokenKind.COLON*/); 18331 this._eat(8/*TokenKind.COLON*/);
18155 } 18332 }
18156 else { 18333 else {
18157 break; 18334 break;
18158 } 18335 }
18159 } 18336 }
18160 if (cases.length == 0) { 18337 if ($notnull_bool($eq(cases.length, 0))) {
18161 this._lang_error('case or default'); 18338 this._lang_error('case or default');
18162 } 18339 }
18163 var stmts = []; 18340 var stmts = [];
18164 while (!$notnull_bool(this._peekCaseEnd())) { 18341 while (!$notnull_bool(this._peekCaseEnd())) {
18165 if ($notnull_bool(this.isPrematureEndOfFile())) break; 18342 if ($notnull_bool(this.isPrematureEndOfFile())) break;
18166 stmts.add$1(this.statement()); 18343 stmts.add$1(this.statement());
18167 } 18344 }
18168 return new CaseNode(label, cases, stmts, this._makeSpan(start)); 18345 return new CaseNode(label, cases, stmts, this._makeSpan(start));
18169 } 18346 }
18170 lang_Parser.prototype.returnStatement = function() { 18347 lang_Parser.prototype.returnStatement = function() {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
18219 if ($notnull_bool(this._peekIdentifier())) { 18396 if ($notnull_bool(this._peekIdentifier())) {
18220 name = this.identifier(); 18397 name = this.identifier();
18221 } 18398 }
18222 this._eatSemicolon(); 18399 this._eatSemicolon();
18223 return new ContinueStatement(name, this._makeSpan(start)); 18400 return new ContinueStatement(name, this._makeSpan(start));
18224 } 18401 }
18225 lang_Parser.prototype.expression = function() { 18402 lang_Parser.prototype.expression = function() {
18226 return this.infixExpression(0); 18403 return this.infixExpression(0);
18227 } 18404 }
18228 lang_Parser.prototype._makeType = function(expr) { 18405 lang_Parser.prototype._makeType = function(expr) {
18406 var $0;
18229 if ((expr instanceof VarExpression)) { 18407 if ((expr instanceof VarExpression)) {
18230 return new NameTypeReference(false, expr.get$name(), null, expr.get$span()); 18408 return new NameTypeReference(false, expr.get$name(), null, (($0 = expr.get$s pan()) && $0.is$SourceSpan()));
18231 } 18409 }
18232 else if ((expr instanceof DotExpression)) { 18410 else if ((expr instanceof DotExpression)) {
18233 var type = this._makeType(expr.self); 18411 var type = this._makeType(expr.get$self());
18234 if (type.names == null) { 18412 if (type.get$names() == null) {
18235 type.names = [expr.get$name()]; 18413 type.set$names([expr.get$name()]);
18236 } 18414 }
18237 else { 18415 else {
18238 type.names.add(expr.get$name()); 18416 type.get$names().add$1(expr.get$name());
18239 } 18417 }
18240 type.span = expr.get$span(); 18418 type.set$span(expr.get$span());
18241 return type; 18419 return type;
18242 } 18420 }
18243 else { 18421 else {
18244 this._lang_error('expected type reference'); 18422 this._lang_error('expected type reference');
18245 return null; 18423 return null;
18246 } 18424 }
18247 } 18425 }
18248 lang_Parser.prototype.infixExpression = function(precedence) { 18426 lang_Parser.prototype.infixExpression = function(precedence) {
18249 var $0; 18427 var $0;
18250 return this.finishInfixExpression((($0 = this.unaryExpression()) && $0.is$lang _Expression()), precedence); 18428 return this.finishInfixExpression((($0 = this.unaryExpression()) && $0.is$lang _Expression()), precedence);
18251 } 18429 }
18252 lang_Parser.prototype._finishDeclaredId = function(type) { 18430 lang_Parser.prototype._finishDeclaredId = function(type) {
18253 var name = this.identifier(); 18431 var name = this.identifier();
18254 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m akeSpan(type.get$span().start))); 18432 return this.finishPostfixExpression(new DeclaredIdentifier(type, name, this._m akeSpan($assert_num(type.get$span().get$start()))));
18255 } 18433 }
18256 lang_Parser.prototype._fixAsType = function(x) { 18434 lang_Parser.prototype._fixAsType = function(x) {
18257 $assert(this._isBin(x, 52/*TokenKind.LT*/), "_isBin(x, TokenKind.LT)", "parser .dart", 790, 12); 18435 $assert(this._isBin(x, 52/*TokenKind.LT*/), "_isBin(x, TokenKind.LT)", "parser .dart", 790, 12);
18258 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) { 18436 if ($notnull_bool(this._maybeEat(53/*TokenKind.GT*/))) {
18259 var base = this._makeType(x.x); 18437 var base = this._makeType(x.x);
18260 var typeParam = this._makeType(x.y); 18438 var typeParam = this._makeType(x.y);
18261 var type = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.s pan.start)); 18439 var type = new GenericTypeReference(base, [typeParam], 0, this._makeSpan(x.s pan.start));
18262 return this._finishDeclaredId(type); 18440 return this._finishDeclaredId(type);
18263 } 18441 }
18264 else { 18442 else {
18265 $assert(this._peekKind(52/*TokenKind.LT*/), "_peekKind(TokenKind.LT)", "pars er.dart", 801, 14); 18443 $assert(this._peekKind(52/*TokenKind.LT*/), "_peekKind(TokenKind.LT)", "pars er.dart", 801, 14);
18266 var base = this._makeType(x.x); 18444 var base = this._makeType(x.x);
18267 var paramBase = this._makeType(x.y); 18445 var paramBase = this._makeType(x.y);
18268 var firstParam = this.addTypeArguments((paramBase && paramBase.is$TypeRefere nce()), 1); 18446 var firstParam = this.addTypeArguments((paramBase && paramBase.is$TypeRefere nce()), 1);
18269 var type; 18447 var type;
18270 if (firstParam.depth <= 0) { 18448 if (firstParam.get$depth() <= 0) {
18271 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start)); 18449 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start));
18272 } 18450 }
18273 else if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) { 18451 else if ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) {
18274 type = this._finishTypeArguments((base && base.is$TypeReference()), 0, [fi rstParam]); 18452 type = this._finishTypeArguments((base && base.is$TypeReference()), 0, [fi rstParam]);
18275 } 18453 }
18276 else { 18454 else {
18277 this._eat(53/*TokenKind.GT*/); 18455 this._eat(53/*TokenKind.GT*/);
18278 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start)); 18456 type = new GenericTypeReference(base, [firstParam], 0, this._makeSpan(x.sp an.start));
18279 } 18457 }
18280 return this._finishDeclaredId(type); 18458 return this._finishDeclaredId(type);
18281 } 18459 }
18282 } 18460 }
18283 lang_Parser.prototype.finishInfixExpression = function(x, precedence) { 18461 lang_Parser.prototype.finishInfixExpression = function(x, precedence) {
18284 while (true) { 18462 while (true) {
18285 var kind = this._peek(); 18463 var kind = this._peek();
18286 var prec = TokenKind.infixPrecedence(this._peek()); 18464 var prec = TokenKind.infixPrecedence(this._peek());
18287 if (prec >= precedence) { 18465 if (prec >= precedence) {
18288 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) { 18466 if (kind == 52/*TokenKind.LT*/ || kind == 53/*TokenKind.GT*/) {
18289 if ($notnull_bool(this._isBin(x, 52/*TokenKind.LT*/))) { 18467 if ($notnull_bool(this._isBin(x, 52/*TokenKind.LT*/))) {
18290 return this._fixAsType((x && x.is$BinaryExpression())); 18468 return this._fixAsType((x && x.is$BinaryExpression()));
18291 } 18469 }
18292 } 18470 }
18293 var op = this._lang_next(); 18471 var op = this._lang_next();
18294 if ($notnull_bool($eq(op.kind, 102/*TokenKind.IS*/))) { 18472 if ($notnull_bool($eq(op.get$kind(), 102/*TokenKind.IS*/))) {
18295 var isTrue = !$notnull_bool(this._maybeEat(19/*TokenKind.NOT*/)); 18473 var isTrue = !$notnull_bool(this._maybeEat(19/*TokenKind.NOT*/));
18296 var typeRef = this.type(0); 18474 var typeRef = this.type(0);
18297 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start)); 18475 x = new IsExpression(isTrue, x, typeRef, this._makeSpan(x.span.start));
18298 continue; 18476 continue;
18299 } 18477 }
18300 var y = this.infixExpression($assert_num($notnull_bool($eq(prec, 2)) ? pre c : prec + 1)); 18478 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*/))) { 18479 if ($notnull_bool($eq(op.get$kind(), 33/*TokenKind.CONDITIONAL*/))) {
18302 this._eat(8/*TokenKind.COLON*/); 18480 this._eat(8/*TokenKind.COLON*/);
18303 var z = this.infixExpression($assert_num(prec)); 18481 var z = this.infixExpression($assert_num(prec));
18304 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start)); 18482 x = new ConditionalExpression(x, y, z, this._makeSpan(x.span.start));
18305 } 18483 }
18306 else { 18484 else {
18307 x = new BinaryExpression(op, x, y, this._makeSpan(x.span.start)); 18485 x = new BinaryExpression(op, x, y, this._makeSpan(x.span.start));
18308 } 18486 }
18309 } 18487 }
18310 else { 18488 else {
18311 break; 18489 break;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
18365 } 18543 }
18366 return args; 18544 return args;
18367 } 18545 }
18368 lang_Parser.prototype.get$arguments = function() { 18546 lang_Parser.prototype.get$arguments = function() {
18369 return lang_Parser.prototype.arguments.bind(this); 18547 return lang_Parser.prototype.arguments.bind(this);
18370 } 18548 }
18371 lang_Parser.prototype.finishPostfixExpression = function(expr) { 18549 lang_Parser.prototype.finishPostfixExpression = function(expr) {
18372 switch (this._peek()) { 18550 switch (this._peek()) {
18373 case 2/*TokenKind.LPAREN*/: 18551 case 2/*TokenKind.LPAREN*/:
18374 18552
18375 return this.finishPostfixExpression(new CallExpression(expr, this.argument s(), this._makeSpan(expr.get$span().start))); 18553 return this.finishPostfixExpression(new CallExpression(expr, this.argument s(), this._makeSpan($assert_num(expr.get$span().get$start()))));
18376 18554
18377 case 4/*TokenKind.LBRACK*/: 18555 case 4/*TokenKind.LBRACK*/:
18378 18556
18379 this._eat(4/*TokenKind.LBRACK*/); 18557 this._eat(4/*TokenKind.LBRACK*/);
18380 var index = this.expression(); 18558 var index = this.expression();
18381 this._eat(5/*TokenKind.RBRACK*/); 18559 this._eat(5/*TokenKind.RBRACK*/);
18382 return this.finishPostfixExpression(new IndexExpression(expr, index, this. _makeSpan(expr.get$span().start))); 18560 return this.finishPostfixExpression(new IndexExpression(expr, index, this. _makeSpan($assert_num(expr.get$span().get$start()))));
18383 18561
18384 case 14/*TokenKind.DOT*/: 18562 case 14/*TokenKind.DOT*/:
18385 18563
18386 this._eat(14/*TokenKind.DOT*/); 18564 this._eat(14/*TokenKind.DOT*/);
18387 var name = this.identifier(); 18565 var name = this.identifier();
18388 var ret = new DotExpression(expr, name, this._makeSpan(expr.get$span().sta rt)); 18566 var ret = new DotExpression(expr, name, this._makeSpan($assert_num(expr.ge t$span().get$start())));
18389 return this.finishPostfixExpression(ret); 18567 return this.finishPostfixExpression(ret);
18390 18568
18391 case 16/*TokenKind.INCR*/: 18569 case 16/*TokenKind.INCR*/:
18392 case 17/*TokenKind.DECR*/: 18570 case 17/*TokenKind.DECR*/:
18393 18571
18394 var tok = this._lang_next(); 18572 var tok = this._lang_next();
18395 return new PostfixExpression(expr, tok, this._makeSpan(expr.get$span().sta rt)); 18573 return new PostfixExpression(expr, tok, this._makeSpan($assert_num(expr.ge t$span().get$start())));
18396 18574
18397 case 9/*TokenKind.ARROW*/: 18575 case 9/*TokenKind.ARROW*/:
18398 case 6/*TokenKind.LBRACE*/: 18576 case 6/*TokenKind.LBRACE*/:
18399 18577
18400 if ($notnull_bool(this._inInitializers)) return expr; 18578 if ($notnull_bool(this._inInitializers)) return expr;
18401 var body = this.functionBody(true); 18579 var body = this.functionBody(true);
18402 return this._makeFunction(expr, body); 18580 return this._makeFunction(expr, body);
18403 18581
18404 default: 18582 default:
18405 18583
18406 if ($notnull_bool(this._peekIdentifier())) { 18584 if ($notnull_bool(this._peekIdentifier())) {
18407 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp e(expr), this.identifier(), this._makeSpan(expr.get$span().start))); 18585 return this.finishPostfixExpression(new DeclaredIdentifier(this._makeTyp e(expr), this.identifier(), this._makeSpan($assert_num(expr.get$span().get$start ()))));
18408 } 18586 }
18409 else { 18587 else {
18410 return expr; 18588 return expr;
18411 } 18589 }
18412 18590
18413 } 18591 }
18414 } 18592 }
18415 lang_Parser.prototype._isBin = function(expr, kind) { 18593 lang_Parser.prototype._isBin = function(expr, kind) {
18416 return (expr instanceof BinaryExpression) && expr.op.kind == kind; 18594 return $notnull_bool((expr instanceof BinaryExpression) && $eq(expr.get$op().g et$kind(), kind));
18417 } 18595 }
18418 lang_Parser.prototype._boolTypeRef = function(span) { 18596 lang_Parser.prototype._boolTypeRef = function(span) {
18419 return new TypeReference(span, world.nonNullBool); 18597 return new TypeReference(span, world.nonNullBool);
18420 } 18598 }
18421 lang_Parser.prototype._intTypeRef = function(span) { 18599 lang_Parser.prototype._intTypeRef = function(span) {
18422 return new TypeReference(span, world.intType); 18600 return new TypeReference(span, world.intType);
18423 } 18601 }
18424 lang_Parser.prototype._doubleTypeRef = function(span) { 18602 lang_Parser.prototype._doubleTypeRef = function(span) {
18425 return new TypeReference(span, world.doubleType); 18603 return new TypeReference(span, world.doubleType);
18426 } 18604 }
(...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)); 18663 return new LiteralExpression(true, this._boolTypeRef(this._makeSpan(start) ), 'true', this._makeSpan(start));
18486 18664
18487 case 96/*TokenKind.FALSE*/: 18665 case 96/*TokenKind.FALSE*/:
18488 18666
18489 this._eat(96/*TokenKind.FALSE*/); 18667 this._eat(96/*TokenKind.FALSE*/);
18490 return new LiteralExpression(false, this._boolTypeRef(this._makeSpan(start )), 'false', this._makeSpan(start)); 18668 return new LiteralExpression(false, this._boolTypeRef(this._makeSpan(start )), 'false', this._makeSpan(start));
18491 18669
18492 case 61/*TokenKind.HEX_INTEGER*/: 18670 case 61/*TokenKind.HEX_INTEGER*/:
18493 18671
18494 var t = this._lang_next(); 18672 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) ); 18673 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 18674
18497 case 60/*TokenKind.INTEGER*/: 18675 case 60/*TokenKind.INTEGER*/:
18498 18676
18499 var t = this._lang_next(); 18677 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)); 18678 return new LiteralExpression(Math.parseInt($assert_String(t.get$text())), this._intTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(start));
18501 18679
18502 case 62/*TokenKind.DOUBLE*/: 18680 case 62/*TokenKind.DOUBLE*/:
18503 18681
18504 var t = this._lang_next(); 18682 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)); 18683 return new LiteralExpression(Math.parseDouble($assert_String(t.get$text()) ), this._doubleTypeRef(this._makeSpan(start)), t.get$text(), this._makeSpan(star t));
18506 18684
18507 case 58/*TokenKind.STRING*/: 18685 case 58/*TokenKind.STRING*/:
18508 18686
18509 return this.stringLiteralExpr(); 18687 return this.stringLiteralExpr();
18510 18688
18511 case 66/*TokenKind.INCOMPLETE_STRING*/: 18689 case 66/*TokenKind.INCOMPLETE_STRING*/:
18512 18690
18513 return this.stringInterpolation(); 18691 return this.stringInterpolation();
18514 18692
18515 case 52/*TokenKind.LT*/: 18693 case 52/*TokenKind.LT*/:
18516 18694
18517 return this.finishTypedLiteral(start, false); 18695 return this.finishTypedLiteral(start, false);
18518 18696
18519 case 113/*TokenKind.VOID*/: 18697 case 113/*TokenKind.VOID*/:
18520 case 112/*TokenKind.VAR*/: 18698 case 112/*TokenKind.VAR*/:
18521 case 97/*TokenKind.FINAL*/: 18699 case 97/*TokenKind.FINAL*/:
18522 18700
18523 return this.declaredIdentifier(false); 18701 return this.declaredIdentifier(false);
18524 18702
18525 default: 18703 default:
18526 18704
18527 if (!$notnull_bool(this._peekIdentifier())) { 18705 if (!$notnull_bool(this._peekIdentifier())) {
18528 this._errorExpected('expression'); 18706 this._errorExpected('expression');
18529 } 18707 }
18530 return new VarExpression(this.identifier(), this._makeSpan(start)); 18708 return new VarExpression(this.identifier(), this._makeSpan(start));
18531 18709
18532 } 18710 }
18533 } 18711 }
18534 lang_Parser.prototype.stringInterpolation = function() { 18712 lang_Parser.prototype.stringInterpolation = function() {
18713 var $0;
18535 var start = this._peekToken.start; 18714 var start = this._peekToken.start;
18536 var lits = []; 18715 var lits = [];
18537 var startQuote = null, endQuote = null; 18716 var startQuote = null, endQuote = null;
18538 while ($notnull_bool(this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/))) { 18717 while ($notnull_bool(this._peekKind(66/*TokenKind.INCOMPLETE_STRING*/))) {
18539 var token = this._lang_next(); 18718 var token = this._lang_next();
18540 var text = token.get$text(); 18719 var text = token.get$text();
18541 if ($notnull_bool(startQuote == null)) { 18720 if ($notnull_bool(startQuote == null)) {
18542 if ($notnull_bool(isMultilineString($assert_String(text)))) { 18721 if ($notnull_bool(isMultilineString($assert_String(text)))) {
18543 endQuote = text.substring$2(0, 3); 18722 endQuote = text.substring$2(0, 3);
18544 startQuote = endQuote + '\n'; 18723 startQuote = endQuote + '\n';
18545 } 18724 }
18546 else { 18725 else {
18547 startQuote = endQuote = text.$index(0); 18726 startQuote = endQuote = text.$index(0);
18548 } 18727 }
18549 text = text.substring$2(0, text.length - 1) + endQuote; 18728 text = text.substring$2(0, text.length - 1) + endQuote;
18550 } 18729 }
18551 else { 18730 else {
18552 text = startQuote + text.substring$2(0, text.length - 1) + endQuote; 18731 text = startQuote + text.substring$2(0, text.length - 1) + endQuote;
18553 } 18732 }
18554 lits.add$1(this.makeStringLiteral($assert_String(text), token.get$span())); 18733 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*/))) { 18734 if ($notnull_bool(this._maybeEat(6/*TokenKind.LBRACE*/))) {
18556 lits.add$1(this.expression()); 18735 lits.add$1(this.expression());
18557 this._eat(7/*TokenKind.RBRACE*/); 18736 this._eat(7/*TokenKind.RBRACE*/);
18558 } 18737 }
18559 else { 18738 else {
18560 var id = this.identifier(); 18739 var id = this.identifier();
18561 lits.add$1(new VarExpression(id, id.get$span())); 18740 lits.add$1(new VarExpression(id, (($0 = id.get$span()) && $0.is$SourceSpan ())));
18562 } 18741 }
18563 } 18742 }
18564 var tok = this._lang_next(); 18743 var tok = this._lang_next();
18565 if ($notnull_bool($ne(tok.kind, 58/*TokenKind.STRING*/))) { 18744 if ($notnull_bool($ne(tok.get$kind(), 58/*TokenKind.STRING*/))) {
18566 this._errorExpected('interpolated string'); 18745 this._errorExpected('interpolated string');
18567 } 18746 }
18568 var text = startQuote + tok.get$text(); 18747 var text = startQuote + tok.get$text();
18569 lits.add$1(this.makeStringLiteral($assert_String(text), tok.get$span())); 18748 lits.add$1(this.makeStringLiteral($assert_String(text), (($0 = tok.get$span()) && $0.is$SourceSpan())));
18570 var span = this._makeSpan(start); 18749 var span = this._makeSpan(start);
18571 return new LiteralExpression(lits, this._stringTypeRef((span && span.is$Source Span())), '\$\$\$', (span && span.is$SourceSpan())); 18750 return new LiteralExpression(lits, this._stringTypeRef((span && span.is$Source Span())), '\$\$\$', (span && span.is$SourceSpan()));
18572 } 18751 }
18573 lang_Parser.prototype.makeStringLiteral = function(text, span) { 18752 lang_Parser.prototype.makeStringLiteral = function(text, span) {
18574 return new LiteralExpression(text, this._stringTypeRef(span), text, span); 18753 return new LiteralExpression(text, this._stringTypeRef(span), text, span);
18575 } 18754 }
18576 lang_Parser.prototype.stringLiteralExpr = function() { 18755 lang_Parser.prototype.stringLiteralExpr = function() {
18756 var $0;
18577 var token = this._lang_next(); 18757 var token = this._lang_next();
18578 return this.makeStringLiteral(token.get$text(), token.get$span()); 18758 return this.makeStringLiteral($assert_String(token.get$text()), (($0 = token.g et$span()) && $0.is$SourceSpan()));
18579 } 18759 }
18580 lang_Parser.prototype.maybeStringLiteral = function() { 18760 lang_Parser.prototype.maybeStringLiteral = function() {
18581 var kind = this._peek(); 18761 var kind = this._peek();
18582 if ($notnull_bool($eq(kind, 58/*TokenKind.STRING*/))) { 18762 if ($notnull_bool($eq(kind, 58/*TokenKind.STRING*/))) {
18583 return parseStringLiteral(this._lang_next().get$text()); 18763 return parseStringLiteral(this._lang_next().get$text());
18584 } 18764 }
18585 else if ($notnull_bool($eq(kind, 59/*TokenKind.STRING_PART*/))) { 18765 else if ($notnull_bool($eq(kind, 59/*TokenKind.STRING_PART*/))) {
18586 this._lang_next(); 18766 this._lang_next();
18587 this._errorExpected('string literal, but found interpolated string start'); 18767 this._errorExpected('string literal, but found interpolated string start');
18588 } 18768 }
18589 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) { 18769 else if ($notnull_bool($eq(kind, 66/*TokenKind.INCOMPLETE_STRING*/))) {
18590 this._lang_next(); 18770 this._lang_next();
18591 this._errorExpected('string literal, but found incomplete string'); 18771 this._errorExpected('string literal, but found incomplete string');
18592 } 18772 }
18593 return null; 18773 return null;
18594 } 18774 }
18595 lang_Parser.prototype._parenOrLambda = function() { 18775 lang_Parser.prototype._parenOrLambda = function() {
18776 var $0;
18596 var start = this._peekToken.start; 18777 var start = this._peekToken.start;
18597 var args = this.arguments(); 18778 var args = this.arguments();
18598 if (!$notnull_bool(this._inInitializers) && ($notnull_bool(this._peekKind(9/*T okenKind.ARROW*/) || this._peekKind(6/*TokenKind.LBRACE*/)))) { 18779 if (!$notnull_bool(this._inInitializers) && ($notnull_bool(this._peekKind(9/*T okenKind.ARROW*/) || this._peekKind(6/*TokenKind.LBRACE*/)))) {
18599 var body = this.functionBody(true); 18780 var body = this.functionBody(true);
18600 var formals = this._makeFormals(args); 18781 var formals = this._makeFormals(args);
18601 var func = new FunctionDefinition(null, null, null, formals, null, body, thi s._makeSpan(start)); 18782 var func = new FunctionDefinition(null, null, null, formals, null, body, thi s._makeSpan(start));
18602 return new LambdaExpression(func, func.get$span()); 18783 return new LambdaExpression(func, (($0 = func.get$span()) && $0.is$SourceSpa n()));
18603 } 18784 }
18604 else { 18785 else {
18605 if (args.length == 1) { 18786 if ($notnull_bool($eq(args.length, 1))) {
18606 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star t)); 18787 return new ParenExpression(args.$index(0).get$value(), this._makeSpan(star t));
18607 } 18788 }
18608 else { 18789 else {
18609 this._lang_error('unexpected comma expression'); 18790 this._lang_error('unexpected comma expression');
18610 return args.$index(0).get$value(); 18791 return args.$index(0).get$value();
18611 } 18792 }
18612 } 18793 }
18613 } 18794 }
18614 lang_Parser.prototype._typeAsIdentifier = function(type) { 18795 lang_Parser.prototype._typeAsIdentifier = function(type) {
18615 return type.get$name(); 18796 return type.get$name();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
18687 var start = this._peekToken.start; 18868 var start = this._peekToken.start;
18688 var myType = null; 18869 var myType = null;
18689 var name = this._specialIdentifier(includeOperators); 18870 var name = this._specialIdentifier(includeOperators);
18690 if (name == null) { 18871 if (name == null) {
18691 myType = this.type(0); 18872 myType = this.type(0);
18692 name = this._specialIdentifier(includeOperators); 18873 name = this._specialIdentifier(includeOperators);
18693 if (name == null) { 18874 if (name == null) {
18694 if ($notnull_bool(this._peekIdentifier())) { 18875 if ($notnull_bool(this._peekIdentifier())) {
18695 name = this.identifier(); 18876 name = this.identifier();
18696 } 18877 }
18697 else if ((myType instanceof NameTypeReference) && myType.names == null) { 18878 else if ($notnull_bool((myType instanceof NameTypeReference) && myType.get $names() == null)) {
18698 name = this._typeAsIdentifier(myType); 18879 name = this._typeAsIdentifier(myType);
18699 myType = null; 18880 myType = null;
18700 } 18881 }
18701 else { 18882 else {
18702 } 18883 }
18703 } 18884 }
18704 } 18885 }
18705 return new DeclaredIdentifier(myType, name, this._makeSpan(start)); 18886 return new DeclaredIdentifier(myType, name, this._makeSpan(start));
18706 } 18887 }
18707 lang_Parser._hexDigit = function(c) { 18888 lang_Parser._hexDigit = function(c) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
18813 } 18994 }
18814 return new TypeParameter(name, myType, this._makeSpan(start)); 18995 return new TypeParameter(name, myType, this._makeSpan(start));
18815 } 18996 }
18816 lang_Parser.prototype.typeParameters = function() { 18997 lang_Parser.prototype.typeParameters = function() {
18817 this._eat(52/*TokenKind.LT*/); 18998 this._eat(52/*TokenKind.LT*/);
18818 var closed = false; 18999 var closed = false;
18819 var ret = []; 19000 var ret = [];
18820 do { 19001 do {
18821 var tp = this.typeParameter(); 19002 var tp = this.typeParameter();
18822 ret.add$1(tp); 19003 ret.add$1(tp);
18823 if ((tp.extendsType instanceof GenericTypeReference) && tp.extendsType.depth == 0) { 19004 if ($notnull_bool((tp.get$extendsType() instanceof GenericTypeReference) && $eq(tp.get$extendsType().get$depth(), 0))) {
18824 closed = true; 19005 closed = true;
18825 break; 19006 break;
18826 } 19007 }
18827 } 19008 }
18828 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) 19009 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/)))
18829 if (!$notnull_bool(closed)) { 19010 if (!$notnull_bool(closed)) {
18830 this._eat(53/*TokenKind.GT*/); 19011 this._eat(53/*TokenKind.GT*/);
18831 } 19012 }
18832 return ret; 19013 return ret;
18833 } 19014 }
(...skipping 17 matching lines...) Expand all
18851 } 19032 }
18852 lang_Parser.prototype.addTypeArguments = function(baseType, depth) { 19033 lang_Parser.prototype.addTypeArguments = function(baseType, depth) {
18853 this._eat(52/*TokenKind.LT*/); 19034 this._eat(52/*TokenKind.LT*/);
18854 return this._finishTypeArguments(baseType, depth, []); 19035 return this._finishTypeArguments(baseType, depth, []);
18855 } 19036 }
18856 lang_Parser.prototype._finishTypeArguments = function(baseType, depth, types) { 19037 lang_Parser.prototype._finishTypeArguments = function(baseType, depth, types) {
18857 var delta = -1; 19038 var delta = -1;
18858 do { 19039 do {
18859 var myType = this.type(depth + 1); 19040 var myType = this.type(depth + 1);
18860 types.add$1(myType); 19041 types.add$1(myType);
18861 if ((myType instanceof GenericTypeReference) && myType.depth <= depth) { 19042 if ((myType instanceof GenericTypeReference) && myType.get$depth() <= depth) {
18862 delta = depth - myType.depth; 19043 delta = depth - $assert_num(myType.get$depth());
18863 break; 19044 break;
18864 } 19045 }
18865 } 19046 }
18866 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/))) 19047 while ($notnull_bool(this._maybeEat(11/*TokenKind.COMMA*/)))
18867 if (delta >= 0) { 19048 if (delta >= 0) {
18868 depth -= $assert_num(delta); 19049 depth -= $assert_num(delta);
18869 } 19050 }
18870 else { 19051 else {
18871 depth = this._eatClosingAngle(depth); 19052 depth = this._eatClosingAngle(depth);
18872 } 19053 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
18914 names.add$1(this.identifier()); 19095 names.add$1(this.identifier());
18915 } 19096 }
18916 var typeRef = new NameTypeReference(isFinal, name, names, this._makeSpan(start )); 19097 var typeRef = new NameTypeReference(isFinal, name, names, this._makeSpan(start ));
18917 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) { 19098 if ($notnull_bool(this._peekKind(52/*TokenKind.LT*/))) {
18918 return this.addTypeArguments((typeRef && typeRef.is$TypeReference()), depth) ; 19099 return this.addTypeArguments((typeRef && typeRef.is$TypeReference()), depth) ;
18919 } 19100 }
18920 else { 19101 else {
18921 return typeRef; 19102 return typeRef;
18922 } 19103 }
18923 } 19104 }
19105 lang_Parser.prototype.get$type = function() {
19106 return lang_Parser.prototype.type.bind(this);
19107 }
18924 lang_Parser.prototype.formalParameter = function(inOptionalBlock) { 19108 lang_Parser.prototype.formalParameter = function(inOptionalBlock) {
19109 var $0;
18925 var start = this._peekToken.start; 19110 var start = this._peekToken.start;
18926 var isThis = false; 19111 var isThis = false;
18927 var isRest = false; 19112 var isRest = false;
18928 var di = this.declaredIdentifier(false); 19113 var di = this.declaredIdentifier(false);
18929 var type = di.type; 19114 var type = di.get$type();
18930 var name = di.get$name(); 19115 var name = di.get$name();
18931 var value = null; 19116 var value = null;
18932 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) { 19117 if ($notnull_bool(this._maybeEat(20/*TokenKind.ASSIGN*/))) {
18933 if (!$notnull_bool(inOptionalBlock)) { 19118 if (!$notnull_bool(inOptionalBlock)) {
18934 this._lang_error('default values only allowed inside [optional] section'); 19119 this._lang_error('default values only allowed inside [optional] section');
18935 } 19120 }
18936 value = this.expression(); 19121 value = this.expression();
18937 } 19122 }
18938 else if ($notnull_bool(this._peekKind(2/*TokenKind.LPAREN*/))) { 19123 else if ($notnull_bool(this._peekKind(2/*TokenKind.LPAREN*/))) {
18939 var formals = this.formalParameterList(); 19124 var formals = this.formalParameterList();
18940 var func = new FunctionDefinition(null, type, name, formals, null, null, thi s._makeSpan(start)); 19125 var func = new FunctionDefinition(null, type, name, formals, null, null, thi s._makeSpan(start));
18941 type = new FunctionTypeReference(false, func, func.get$span()); 19126 type = new FunctionTypeReference(false, func, (($0 = func.get$span()) && $0. is$SourceSpan()));
18942 } 19127 }
18943 if ($notnull_bool(inOptionalBlock && value == null)) { 19128 if ($notnull_bool(inOptionalBlock && value == null)) {
18944 value = new NullExpression(this._makeSpan(start)); 19129 value = new NullExpression(this._makeSpan(start));
18945 } 19130 }
18946 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start) ); 19131 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start) );
18947 } 19132 }
18948 lang_Parser.prototype.formalParameterList = function() { 19133 lang_Parser.prototype.formalParameterList = function() {
18949 this._eat(2/*TokenKind.LPAREN*/); 19134 this._eat(2/*TokenKind.LPAREN*/);
18950 var formals = []; 19135 var formals = [];
18951 var inOptionalBlock = false; 19136 var inOptionalBlock = false;
(...skipping 12 matching lines...) Expand all
18964 formals.add$1(this.formalParameter($assert_bool(inOptionalBlock))); 19149 formals.add$1(this.formalParameter($assert_bool(inOptionalBlock)));
18965 } 19150 }
18966 if ($notnull_bool(inOptionalBlock)) { 19151 if ($notnull_bool(inOptionalBlock)) {
18967 this._eat(5/*TokenKind.RBRACK*/); 19152 this._eat(5/*TokenKind.RBRACK*/);
18968 } 19153 }
18969 this._eat(3/*TokenKind.RPAREN*/); 19154 this._eat(3/*TokenKind.RPAREN*/);
18970 } 19155 }
18971 return formals; 19156 return formals;
18972 } 19157 }
18973 lang_Parser.prototype.identifier = function() { 19158 lang_Parser.prototype.identifier = function() {
19159 var $0;
18974 var tok = this._lang_next(); 19160 var tok = this._lang_next();
18975 if (!$notnull_bool(TokenKind.isIdentifier($assert_num(tok.kind)))) { 19161 if (!$notnull_bool(TokenKind.isIdentifier($assert_num(tok.get$kind())))) {
18976 this._lang_error(('expected identifier, but found ' + tok + ''), tok.get$spa n()); 19162 this._lang_error(('expected identifier, but found ' + tok + ''), (($0 = tok. get$span()) && $0.is$SourceSpan()));
18977 } 19163 }
18978 return new lang_Identifier(tok.get$text(), this._makeSpan(tok.start)); 19164 return new lang_Identifier(tok.get$text(), this._makeSpan($assert_num(tok.get$ start())));
18979 } 19165 }
18980 lang_Parser.prototype._makeFunction = function(expr, body) { 19166 lang_Parser.prototype._makeFunction = function(expr, body) {
19167 var $0;
18981 var name, type; 19168 var name, type;
18982 if ((expr instanceof CallExpression)) { 19169 if ((expr instanceof CallExpression)) {
18983 if ((expr.target instanceof VarExpression)) { 19170 if ((expr.get$target() instanceof VarExpression)) {
18984 name = expr.target.get$name(); 19171 name = expr.get$target().get$name();
18985 type = null; 19172 type = null;
18986 } 19173 }
18987 else if ((expr.target instanceof DeclaredIdentifier)) { 19174 else if ((expr.get$target() instanceof DeclaredIdentifier)) {
18988 name = expr.target.get$name(); 19175 name = expr.get$target().get$name();
18989 type = expr.target.type; 19176 type = expr.get$target().get$type();
18990 } 19177 }
18991 else { 19178 else {
18992 this._lang_error('bad function'); 19179 this._lang_error('bad function');
18993 } 19180 }
18994 var formals = this._makeFormals(expr.get$arguments()); 19181 var formals = this._makeFormals(expr.get$arguments());
18995 var span = new SourceSpan(expr.get$span().file, expr.get$span().start, body. get$span().end); 19182 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())); 19183 var func = new FunctionDefinition(null, type, name, formals, null, body, (sp an && span.is$SourceSpan()));
18997 return new LambdaExpression(func, func.get$span()); 19184 return new LambdaExpression(func, (($0 = func.get$span()) && $0.is$SourceSpa n()));
18998 } 19185 }
18999 else { 19186 else {
19000 this._lang_error('expected function'); 19187 this._lang_error('expected function');
19001 } 19188 }
19002 } 19189 }
19003 lang_Parser.prototype._makeFormal = function(expr) { 19190 lang_Parser.prototype._makeFormal = function(expr) {
19004 var $0; 19191 var $0;
19005 if ((expr instanceof VarExpression)) { 19192 if ((expr instanceof VarExpression)) {
19006 return new FormalNode(false, false, null, expr.get$name(), null, expr.get$sp an()); 19193 return new FormalNode(false, false, null, expr.get$name(), null, (($0 = expr .get$span()) && $0.is$SourceSpan()));
19007 } 19194 }
19008 else if ((expr instanceof DeclaredIdentifier)) { 19195 else if ((expr instanceof DeclaredIdentifier)) {
19009 return new FormalNode(false, false, expr.type, expr.get$name(), null, expr.g et$span()); 19196 return new FormalNode(false, false, expr.get$type(), expr.get$name(), null, (($0 = expr.get$span()) && $0.is$SourceSpan()));
19010 } 19197 }
19011 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.x i nstanceof DeclaredIdentifier)))) { 19198 else if ($notnull_bool(this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.get $x() instanceof DeclaredIdentifier)))) {
19012 var di = (($0 = expr.x) && $0.is$DeclaredIdentifier()); 19199 var di = (($0 = expr.get$x()) && $0.is$DeclaredIdentifier());
19013 return new FormalNode(false, false, di.type, di.name, expr.y, expr.get$span( )); 19200 return new FormalNode(false, false, di.type, di.name, expr.get$y(), (($0 = e xpr.get$span()) && $0.is$SourceSpan()));
19014 } 19201 }
19015 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/))) { 19202 else if ($notnull_bool(this._isBin(expr, 52/*TokenKind.LT*/))) {
19016 return null; 19203 return null;
19017 } 19204 }
19018 else if ((expr instanceof ListExpression)) { 19205 else if ((expr instanceof ListExpression)) {
19019 return this._makeFormalsFromList(expr); 19206 return this._makeFormalsFromList(expr);
19020 } 19207 }
19021 else { 19208 else {
19022 this._lang_error('expected formal', expr.get$span()); 19209 this._lang_error('expected formal', (($0 = expr.get$span()) && $0.is$SourceS pan()));
19023 } 19210 }
19024 } 19211 }
19025 lang_Parser.prototype._makeFormalsFromList = function(expr) { 19212 lang_Parser.prototype._makeFormalsFromList = function(expr) {
19213 var $0;
19026 if ($notnull_bool(expr.get$isConst())) { 19214 if ($notnull_bool(expr.get$isConst())) {
19027 this._lang_error('expected formal, but found "const"', expr.get$span()); 19215 this._lang_error('expected formal, but found "const"', (($0 = expr.get$span( )) && $0.is$SourceSpan()));
19028 } 19216 }
19029 else if ($notnull_bool($ne(expr.type, null))) { 19217 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()); 19218 this._lang_error('expected formal, but found generic type arguments', (($0 = expr.get$type().get$span()) && $0.is$SourceSpan()));
19031 } 19219 }
19032 return this._makeFormalsFromExpressions(expr.values, false); 19220 return this._makeFormalsFromExpressions(expr.get$values(), false);
19033 } 19221 }
19034 lang_Parser.prototype._makeFormals = function(arguments) { 19222 lang_Parser.prototype._makeFormals = function(arguments) {
19035 var expressions = []; 19223 var expressions = [];
19036 for (var i = 0; 19224 for (var i = 0;
19037 i < arguments.length; i++) { 19225 i < $assert_num(arguments.length); i++) {
19038 var arg = arguments.$index(i); 19226 var arg = arguments.$index(i);
19039 if (arg.label != null) { 19227 if ($notnull_bool($ne(arg.get$label(), null))) {
19040 this._lang_error('expected formal, but found ":"'); 19228 this._lang_error('expected formal, but found ":"');
19041 } 19229 }
19042 expressions.add$1(arg.get$value()); 19230 expressions.add$1(arg.get$value());
19043 } 19231 }
19044 return this._makeFormalsFromExpressions(expressions, true); 19232 return this._makeFormalsFromExpressions(expressions, true);
19045 } 19233 }
19046 lang_Parser.prototype._makeFormalsFromExpressions = function(expressions, allowO ptional) { 19234 lang_Parser.prototype._makeFormalsFromExpressions = function(expressions, allowO ptional) {
19047 var $0; 19235 var $0;
19048 var formals = []; 19236 var formals = [];
19049 for (var i = 0; 19237 for (var i = 0;
19050 i < expressions.length; i++) { 19238 i < $assert_num(expressions.length); i++) {
19051 var formal = this._makeFormal(expressions.$index(i)); 19239 var formal = this._makeFormal(expressions.$index(i));
19052 if ($notnull_bool(formal == null)) { 19240 if ($notnull_bool(formal == null)) {
19053 var baseType = this._makeType(expressions.$index(i).x); 19241 var baseType = this._makeType(expressions.$index(i).get$x());
19054 var typeParams = [this._makeType(expressions.$index(i).y)]; 19242 var typeParams = [this._makeType(expressions.$index(i).get$y())];
19055 i++; 19243 i++;
19056 while (i < expressions.length) { 19244 while (i < $assert_num(expressions.length)) {
19057 var expr = expressions.$index(i++); 19245 var expr = expressions.$index(i++);
19058 if ($notnull_bool(this._isBin(expr, 53/*TokenKind.GT*/))) { 19246 if ($notnull_bool(this._isBin(expr, 53/*TokenKind.GT*/))) {
19059 typeParams.add$1(this._makeType(expr.x)); 19247 typeParams.add$1(this._makeType(expr.get$x()));
19060 var type = new GenericTypeReference(baseType, typeParams, 0, this._mak eSpan(baseType.get$span().start)); 19248 var type = new GenericTypeReference(baseType, typeParams, 0, this._mak eSpan($assert_num(baseType.get$span().get$start())));
19061 var name = null; 19249 var name = null;
19062 if ((expr.y instanceof VarExpression)) { 19250 if ((expr.get$y() instanceof VarExpression)) {
19063 var ve = (($0 = expr.y) && $0.is$VarExpression()); 19251 var ve = (($0 = expr.get$y()) && $0.is$VarExpression());
19064 name = ve.name; 19252 name = ve.name;
19065 } 19253 }
19066 else { 19254 else {
19067 this._lang_error('expected formal', expr.get$span()); 19255 this._lang_error('expected formal', (($0 = expr.get$span()) && $0.is $SourceSpan()));
19068 } 19256 }
19069 formal = new FormalNode(false, false, type, name, null, this._makeSpan (expressions.$index(0).get$span().start)); 19257 formal = new FormalNode(false, false, type, name, null, this._makeSpan ($assert_num(expressions.$index(0).get$span().get$start())));
19070 break; 19258 break;
19071 } 19259 }
19072 else { 19260 else {
19073 typeParams.add$1(this._makeType(expr)); 19261 typeParams.add$1(this._makeType(expr));
19074 } 19262 }
19075 } 19263 }
19076 formals.add$1(formal); 19264 formals.add$1(formal);
19077 } 19265 }
19078 else if (!!(formal && formal.is$List)) { 19266 else if (!!(formal && formal.is$List)) {
19079 formals.addAll$1(formal); 19267 formals.addAll$1(formal);
19080 if (!$notnull_bool(allowOptional)) { 19268 if (!$notnull_bool(allowOptional)) {
19081 this._lang_error('unexpected nested optional formal', expressions.$index (i).get$span()); 19269 this._lang_error('unexpected nested optional formal', (($0 = expressions .$index(i).get$span()) && $0.is$SourceSpan()));
19082 } 19270 }
19083 } 19271 }
19084 else { 19272 else {
19085 formals.add$1(formal); 19273 formals.add$1(formal);
19086 } 19274 }
19087 } 19275 }
19088 return formals; 19276 return formals;
19089 } 19277 }
19090 lang_Parser.prototype._makeDeclaredIdentifier = function(e) { 19278 lang_Parser.prototype._makeDeclaredIdentifier = function(e) {
19279 var $0;
19091 if ((e instanceof VarExpression)) { 19280 if ((e instanceof VarExpression)) {
19092 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); 19281 return new DeclaredIdentifier(null, e.get$name(), (($0 = e.get$span()) && $0 .is$SourceSpan()));
19093 } 19282 }
19094 else if ((e instanceof DeclaredIdentifier)) { 19283 else if ((e instanceof DeclaredIdentifier)) {
19095 return e; 19284 return e;
19096 } 19285 }
19097 else { 19286 else {
19098 this._lang_error('expected declared identifier'); 19287 this._lang_error('expected declared identifier');
19099 return new DeclaredIdentifier(null, null, e.get$span()); 19288 return new DeclaredIdentifier(null, null, (($0 = e.get$span()) && $0.is$Sour ceSpan()));
19100 } 19289 }
19101 } 19290 }
19102 lang_Parser.prototype._makeLabel = function(expr) { 19291 lang_Parser.prototype._makeLabel = function(expr) {
19103 if ((expr instanceof VarExpression)) { 19292 if ((expr instanceof VarExpression)) {
19104 return expr.get$name(); 19293 return expr.get$name();
19105 } 19294 }
19106 else { 19295 else {
19107 this._errorExpected('label'); 19296 this._errorExpected('label');
19108 return null; 19297 return null;
19109 } 19298 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
19162 $inherits(lang_Expression, lang_Node); 19351 $inherits(lang_Expression, lang_Node);
19163 lang_Expression.prototype.is$lang_Expression = function(){return this;}; 19352 lang_Expression.prototype.is$lang_Expression = function(){return this;};
19164 // ********** Code for TypeReference ************** 19353 // ********** Code for TypeReference **************
19165 function TypeReference(span, type) { 19354 function TypeReference(span, type) {
19166 this.type = type; 19355 this.type = type;
19167 lang_Node.call(this, span); 19356 lang_Node.call(this, span);
19168 // Initializers done 19357 // Initializers done
19169 } 19358 }
19170 $inherits(TypeReference, lang_Node); 19359 $inherits(TypeReference, lang_Node);
19171 TypeReference.prototype.is$TypeReference = function(){return this;}; 19360 TypeReference.prototype.is$TypeReference = function(){return this;};
19361 TypeReference.prototype.get$type = function() { return this.type; };
19362 TypeReference.prototype.set$type = function(value) { return this.type = value; } ;
19172 TypeReference.prototype.visit = function(visitor) { 19363 TypeReference.prototype.visit = function(visitor) {
19173 return visitor.visitTypeReference(this); 19364 return visitor.visitTypeReference(this);
19174 } 19365 }
19175 TypeReference.prototype.visit$1 = function($0) { 19366 TypeReference.prototype.visit$1 = function($0) {
19176 return this.visit(($0 && $0.is$TreeVisitor())); 19367 return this.visit(($0 && $0.is$TreeVisitor()));
19177 }; 19368 };
19178 // ********** Code for DirectiveDefinition ************** 19369 // ********** Code for DirectiveDefinition **************
19179 function DirectiveDefinition(name, arguments, span) { 19370 function DirectiveDefinition(name, arguments, span) {
19180 this.name = name; 19371 this.name = name;
19181 this.arguments = arguments; 19372 this.arguments = arguments;
(...skipping 27 matching lines...) Expand all
19209 $inherits(TypeDefinition, Definition); 19400 $inherits(TypeDefinition, Definition);
19210 TypeDefinition.prototype.is$TypeDefinition = function(){return this;}; 19401 TypeDefinition.prototype.is$TypeDefinition = function(){return this;};
19211 TypeDefinition.prototype.get$isClass = function() { return this.isClass; }; 19402 TypeDefinition.prototype.get$isClass = function() { return this.isClass; };
19212 TypeDefinition.prototype.set$isClass = function(value) { return this.isClass = v alue; }; 19403 TypeDefinition.prototype.set$isClass = function(value) { return this.isClass = v alue; };
19213 TypeDefinition.prototype.get$name = function() { return this.name; }; 19404 TypeDefinition.prototype.get$name = function() { return this.name; };
19214 TypeDefinition.prototype.set$name = function(value) { return this.name = value; }; 19405 TypeDefinition.prototype.set$name = function(value) { return this.name = value; };
19215 TypeDefinition.prototype.get$typeParameters = function() { return this.typeParam eters; }; 19406 TypeDefinition.prototype.get$typeParameters = function() { return this.typeParam eters; };
19216 TypeDefinition.prototype.set$typeParameters = function(value) { return this.type Parameters = value; }; 19407 TypeDefinition.prototype.set$typeParameters = function(value) { return this.type Parameters = value; };
19217 TypeDefinition.prototype.get$nativeType = function() { return this.nativeType; } ; 19408 TypeDefinition.prototype.get$nativeType = function() { return this.nativeType; } ;
19218 TypeDefinition.prototype.set$nativeType = function(value) { return this.nativeTy pe = value; }; 19409 TypeDefinition.prototype.set$nativeType = function(value) { return this.nativeTy pe = value; };
19410 TypeDefinition.prototype.get$body = function() { return this.body; };
19411 TypeDefinition.prototype.set$body = function(value) { return this.body = value; };
19219 TypeDefinition.prototype.visit = function(visitor) { 19412 TypeDefinition.prototype.visit = function(visitor) {
19220 return visitor.visitTypeDefinition(this); 19413 return visitor.visitTypeDefinition(this);
19221 } 19414 }
19222 TypeDefinition.prototype.visit$1 = function($0) { 19415 TypeDefinition.prototype.visit$1 = function($0) {
19223 return this.visit(($0 && $0.is$TreeVisitor())); 19416 return this.visit(($0 && $0.is$TreeVisitor()));
19224 }; 19417 };
19225 // ********** Code for FunctionTypeDefinition ************** 19418 // ********** Code for FunctionTypeDefinition **************
19226 function FunctionTypeDefinition(func, typeParameters, span) { 19419 function FunctionTypeDefinition(func, typeParameters, span) {
19227 this.func = func; 19420 this.func = func;
19228 this.typeParameters = typeParameters; 19421 this.typeParameters = typeParameters;
19229 Definition.call(this, span); 19422 Definition.call(this, span);
19230 // Initializers done 19423 // Initializers done
19231 } 19424 }
19232 $inherits(FunctionTypeDefinition, Definition); 19425 $inherits(FunctionTypeDefinition, Definition);
19426 FunctionTypeDefinition.prototype.get$func = function() { return this.func; };
19427 FunctionTypeDefinition.prototype.set$func = function(value) { return this.func = value; };
19233 FunctionTypeDefinition.prototype.get$typeParameters = function() { return this.t ypeParameters; }; 19428 FunctionTypeDefinition.prototype.get$typeParameters = function() { return this.t ypeParameters; };
19234 FunctionTypeDefinition.prototype.set$typeParameters = function(value) { return t his.typeParameters = value; }; 19429 FunctionTypeDefinition.prototype.set$typeParameters = function(value) { return t his.typeParameters = value; };
19235 FunctionTypeDefinition.prototype.visit = function(visitor) { 19430 FunctionTypeDefinition.prototype.visit = function(visitor) {
19236 return visitor.visitFunctionTypeDefinition(this); 19431 return visitor.visitFunctionTypeDefinition(this);
19237 } 19432 }
19238 FunctionTypeDefinition.prototype.visit$1 = function($0) { 19433 FunctionTypeDefinition.prototype.visit$1 = function($0) {
19239 return this.visit(($0 && $0.is$TreeVisitor())); 19434 return this.visit(($0 && $0.is$TreeVisitor()));
19240 }; 19435 };
19241 // ********** Code for VariableDefinition ************** 19436 // ********** Code for VariableDefinition **************
19242 function VariableDefinition(modifiers, type, names, values, span) { 19437 function VariableDefinition(modifiers, type, names, values, span) {
19243 this.modifiers = modifiers; 19438 this.modifiers = modifiers;
19244 this.type = type; 19439 this.type = type;
19245 this.names = names; 19440 this.names = names;
19246 this.values = values; 19441 this.values = values;
19247 Definition.call(this, span); 19442 Definition.call(this, span);
19248 // Initializers done 19443 // Initializers done
19249 } 19444 }
19250 $inherits(VariableDefinition, Definition); 19445 $inherits(VariableDefinition, Definition);
19446 VariableDefinition.prototype.get$type = function() { return this.type; };
19447 VariableDefinition.prototype.set$type = function(value) { return this.type = val ue; };
19448 VariableDefinition.prototype.get$names = function() { return this.names; };
19449 VariableDefinition.prototype.set$names = function(value) { return this.names = v alue; };
19450 VariableDefinition.prototype.get$values = function() { return this.values; };
19451 VariableDefinition.prototype.set$values = function(value) { return this.values = value; };
19251 VariableDefinition.prototype.visit = function(visitor) { 19452 VariableDefinition.prototype.visit = function(visitor) {
19252 return visitor.visitVariableDefinition(this); 19453 return visitor.visitVariableDefinition(this);
19253 } 19454 }
19254 VariableDefinition.prototype.visit$1 = function($0) { 19455 VariableDefinition.prototype.visit$1 = function($0) {
19255 return this.visit(($0 && $0.is$TreeVisitor())); 19456 return this.visit(($0 && $0.is$TreeVisitor()));
19256 }; 19457 };
19257 // ********** Code for FunctionDefinition ************** 19458 // ********** Code for FunctionDefinition **************
19258 function FunctionDefinition(modifiers, returnType, name, formals, initializers, body, span) { 19459 function FunctionDefinition(modifiers, returnType, name, formals, initializers, body, span) {
19259 this.modifiers = modifiers; 19460 this.modifiers = modifiers;
19260 this.returnType = returnType; 19461 this.returnType = returnType;
19261 this.name = name; 19462 this.name = name;
19262 this.formals = formals; 19463 this.formals = formals;
19263 this.initializers = initializers; 19464 this.initializers = initializers;
19264 this.body = body; 19465 this.body = body;
19265 Definition.call(this, span); 19466 Definition.call(this, span);
19266 // Initializers done 19467 // Initializers done
19267 } 19468 }
19268 $inherits(FunctionDefinition, Definition); 19469 $inherits(FunctionDefinition, Definition);
19269 FunctionDefinition.prototype.is$FunctionDefinition = function(){return this;}; 19470 FunctionDefinition.prototype.is$FunctionDefinition = function(){return this;};
19270 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp e; }; 19471 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp e; };
19271 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu rnType = value; }; 19472 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu rnType = value; };
19272 FunctionDefinition.prototype.get$name = function() { return this.name; }; 19473 FunctionDefinition.prototype.get$name = function() { return this.name; };
19273 FunctionDefinition.prototype.set$name = function(value) { return this.name = val ue; }; 19474 FunctionDefinition.prototype.set$name = function(value) { return this.name = val ue; };
19475 FunctionDefinition.prototype.get$initializers = function() { return this.initial izers; };
19476 FunctionDefinition.prototype.set$initializers = function(value) { return this.in itializers = value; };
19477 FunctionDefinition.prototype.get$body = function() { return this.body; };
19478 FunctionDefinition.prototype.set$body = function(value) { return this.body = val ue; };
19274 FunctionDefinition.prototype.visit = function(visitor) { 19479 FunctionDefinition.prototype.visit = function(visitor) {
19275 return visitor.visitFunctionDefinition(this); 19480 return visitor.visitFunctionDefinition(this);
19276 } 19481 }
19277 FunctionDefinition.prototype.visit$1 = function($0) { 19482 FunctionDefinition.prototype.visit$1 = function($0) {
19278 return this.visit(($0 && $0.is$TreeVisitor())); 19483 return this.visit(($0 && $0.is$TreeVisitor()));
19279 }; 19484 };
19280 // ********** Code for ReturnStatement ************** 19485 // ********** Code for ReturnStatement **************
19281 function ReturnStatement(value, span) { 19486 function ReturnStatement(value, span) {
19282 this.value = value; 19487 this.value = value;
19283 lang_Statement.call(this, span); 19488 lang_Statement.call(this, span);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
19320 AssertStatement.prototype.visit$1 = function($0) { 19525 AssertStatement.prototype.visit$1 = function($0) {
19321 return this.visit(($0 && $0.is$TreeVisitor())); 19526 return this.visit(($0 && $0.is$TreeVisitor()));
19322 }; 19527 };
19323 // ********** Code for BreakStatement ************** 19528 // ********** Code for BreakStatement **************
19324 function BreakStatement(label, span) { 19529 function BreakStatement(label, span) {
19325 this.label = label; 19530 this.label = label;
19326 lang_Statement.call(this, span); 19531 lang_Statement.call(this, span);
19327 // Initializers done 19532 // Initializers done
19328 } 19533 }
19329 $inherits(BreakStatement, lang_Statement); 19534 $inherits(BreakStatement, lang_Statement);
19535 BreakStatement.prototype.get$label = function() { return this.label; };
19536 BreakStatement.prototype.set$label = function(value) { return this.label = value ; };
19330 BreakStatement.prototype.visit = function(visitor) { 19537 BreakStatement.prototype.visit = function(visitor) {
19331 return visitor.visitBreakStatement(this); 19538 return visitor.visitBreakStatement(this);
19332 } 19539 }
19333 BreakStatement.prototype.visit$1 = function($0) { 19540 BreakStatement.prototype.visit$1 = function($0) {
19334 return this.visit(($0 && $0.is$TreeVisitor())); 19541 return this.visit(($0 && $0.is$TreeVisitor()));
19335 }; 19542 };
19336 // ********** Code for ContinueStatement ************** 19543 // ********** Code for ContinueStatement **************
19337 function ContinueStatement(label, span) { 19544 function ContinueStatement(label, span) {
19338 this.label = label; 19545 this.label = label;
19339 lang_Statement.call(this, span); 19546 lang_Statement.call(this, span);
19340 // Initializers done 19547 // Initializers done
19341 } 19548 }
19342 $inherits(ContinueStatement, lang_Statement); 19549 $inherits(ContinueStatement, lang_Statement);
19550 ContinueStatement.prototype.get$label = function() { return this.label; };
19551 ContinueStatement.prototype.set$label = function(value) { return this.label = va lue; };
19343 ContinueStatement.prototype.visit = function(visitor) { 19552 ContinueStatement.prototype.visit = function(visitor) {
19344 return visitor.visitContinueStatement(this); 19553 return visitor.visitContinueStatement(this);
19345 } 19554 }
19346 ContinueStatement.prototype.visit$1 = function($0) { 19555 ContinueStatement.prototype.visit$1 = function($0) {
19347 return this.visit(($0 && $0.is$TreeVisitor())); 19556 return this.visit(($0 && $0.is$TreeVisitor()));
19348 }; 19557 };
19349 // ********** Code for IfStatement ************** 19558 // ********** Code for IfStatement **************
19350 function IfStatement(test, trueBranch, falseBranch, span) { 19559 function IfStatement(test, trueBranch, falseBranch, span) {
19351 this.test = test; 19560 this.test = test;
19352 this.trueBranch = trueBranch; 19561 this.trueBranch = trueBranch;
19353 this.falseBranch = falseBranch; 19562 this.falseBranch = falseBranch;
19354 lang_Statement.call(this, span); 19563 lang_Statement.call(this, span);
19355 // Initializers done 19564 // Initializers done
19356 } 19565 }
19357 $inherits(IfStatement, lang_Statement); 19566 $inherits(IfStatement, lang_Statement);
19358 IfStatement.prototype.visit = function(visitor) { 19567 IfStatement.prototype.visit = function(visitor) {
19359 return visitor.visitIfStatement(this); 19568 return visitor.visitIfStatement(this);
19360 } 19569 }
19361 IfStatement.prototype.visit$1 = function($0) { 19570 IfStatement.prototype.visit$1 = function($0) {
19362 return this.visit(($0 && $0.is$TreeVisitor())); 19571 return this.visit(($0 && $0.is$TreeVisitor()));
19363 }; 19572 };
19364 // ********** Code for WhileStatement ************** 19573 // ********** Code for WhileStatement **************
19365 function WhileStatement(test, body, span) { 19574 function WhileStatement(test, body, span) {
19366 this.test = test; 19575 this.test = test;
19367 this.body = body; 19576 this.body = body;
19368 lang_Statement.call(this, span); 19577 lang_Statement.call(this, span);
19369 // Initializers done 19578 // Initializers done
19370 } 19579 }
19371 $inherits(WhileStatement, lang_Statement); 19580 $inherits(WhileStatement, lang_Statement);
19581 WhileStatement.prototype.get$body = function() { return this.body; };
19582 WhileStatement.prototype.set$body = function(value) { return this.body = value; };
19372 WhileStatement.prototype.visit = function(visitor) { 19583 WhileStatement.prototype.visit = function(visitor) {
19373 return visitor.visitWhileStatement(this); 19584 return visitor.visitWhileStatement(this);
19374 } 19585 }
19375 WhileStatement.prototype.visit$1 = function($0) { 19586 WhileStatement.prototype.visit$1 = function($0) {
19376 return this.visit(($0 && $0.is$TreeVisitor())); 19587 return this.visit(($0 && $0.is$TreeVisitor()));
19377 }; 19588 };
19378 // ********** Code for DoStatement ************** 19589 // ********** Code for DoStatement **************
19379 function DoStatement(body, test, span) { 19590 function DoStatement(body, test, span) {
19380 this.body = body; 19591 this.body = body;
19381 this.test = test; 19592 this.test = test;
19382 lang_Statement.call(this, span); 19593 lang_Statement.call(this, span);
19383 // Initializers done 19594 // Initializers done
19384 } 19595 }
19385 $inherits(DoStatement, lang_Statement); 19596 $inherits(DoStatement, lang_Statement);
19597 DoStatement.prototype.get$body = function() { return this.body; };
19598 DoStatement.prototype.set$body = function(value) { return this.body = value; };
19386 DoStatement.prototype.visit = function(visitor) { 19599 DoStatement.prototype.visit = function(visitor) {
19387 return visitor.visitDoStatement(this); 19600 return visitor.visitDoStatement(this);
19388 } 19601 }
19389 DoStatement.prototype.visit$1 = function($0) { 19602 DoStatement.prototype.visit$1 = function($0) {
19390 return this.visit(($0 && $0.is$TreeVisitor())); 19603 return this.visit(($0 && $0.is$TreeVisitor()));
19391 }; 19604 };
19392 // ********** Code for ForStatement ************** 19605 // ********** Code for ForStatement **************
19393 function ForStatement(init, test, step, body, span) { 19606 function ForStatement(init, test, step, body, span) {
19394 this.init = init; 19607 this.init = init;
19395 this.test = test; 19608 this.test = test;
19396 this.step = step; 19609 this.step = step;
19397 this.body = body; 19610 this.body = body;
19398 lang_Statement.call(this, span); 19611 lang_Statement.call(this, span);
19399 // Initializers done 19612 // Initializers done
19400 } 19613 }
19401 $inherits(ForStatement, lang_Statement); 19614 $inherits(ForStatement, lang_Statement);
19615 ForStatement.prototype.get$body = function() { return this.body; };
19616 ForStatement.prototype.set$body = function(value) { return this.body = value; };
19402 ForStatement.prototype.visit = function(visitor) { 19617 ForStatement.prototype.visit = function(visitor) {
19403 return visitor.visitForStatement(this); 19618 return visitor.visitForStatement(this);
19404 } 19619 }
19405 ForStatement.prototype.visit$1 = function($0) { 19620 ForStatement.prototype.visit$1 = function($0) {
19406 return this.visit(($0 && $0.is$TreeVisitor())); 19621 return this.visit(($0 && $0.is$TreeVisitor()));
19407 }; 19622 };
19408 // ********** Code for ForInStatement ************** 19623 // ********** Code for ForInStatement **************
19409 function ForInStatement(item, list, body, span) { 19624 function ForInStatement(item, list, body, span) {
19410 this.item = item; 19625 this.item = item;
19411 this.list = list; 19626 this.list = list;
19412 this.body = body; 19627 this.body = body;
19413 lang_Statement.call(this, span); 19628 lang_Statement.call(this, span);
19414 // Initializers done 19629 // Initializers done
19415 } 19630 }
19416 $inherits(ForInStatement, lang_Statement); 19631 $inherits(ForInStatement, lang_Statement);
19632 ForInStatement.prototype.get$body = function() { return this.body; };
19633 ForInStatement.prototype.set$body = function(value) { return this.body = value; };
19417 ForInStatement.prototype.visit = function(visitor) { 19634 ForInStatement.prototype.visit = function(visitor) {
19418 return visitor.visitForInStatement(this); 19635 return visitor.visitForInStatement(this);
19419 } 19636 }
19420 ForInStatement.prototype.visit$1 = function($0) { 19637 ForInStatement.prototype.visit$1 = function($0) {
19421 return this.visit(($0 && $0.is$TreeVisitor())); 19638 return this.visit(($0 && $0.is$TreeVisitor()));
19422 }; 19639 };
19423 // ********** Code for TryStatement ************** 19640 // ********** Code for TryStatement **************
19424 function TryStatement(body, catches, finallyBlock, span) { 19641 function TryStatement(body, catches, finallyBlock, span) {
19425 this.body = body; 19642 this.body = body;
19426 this.catches = catches; 19643 this.catches = catches;
19427 this.finallyBlock = finallyBlock; 19644 this.finallyBlock = finallyBlock;
19428 lang_Statement.call(this, span); 19645 lang_Statement.call(this, span);
19429 // Initializers done 19646 // Initializers done
19430 } 19647 }
19431 $inherits(TryStatement, lang_Statement); 19648 $inherits(TryStatement, lang_Statement);
19649 TryStatement.prototype.get$body = function() { return this.body; };
19650 TryStatement.prototype.set$body = function(value) { return this.body = value; };
19432 TryStatement.prototype.visit = function(visitor) { 19651 TryStatement.prototype.visit = function(visitor) {
19433 return visitor.visitTryStatement(this); 19652 return visitor.visitTryStatement(this);
19434 } 19653 }
19435 TryStatement.prototype.visit$1 = function($0) { 19654 TryStatement.prototype.visit$1 = function($0) {
19436 return this.visit(($0 && $0.is$TreeVisitor())); 19655 return this.visit(($0 && $0.is$TreeVisitor()));
19437 }; 19656 };
19438 // ********** Code for SwitchStatement ************** 19657 // ********** Code for SwitchStatement **************
19439 function SwitchStatement(test, cases, span) { 19658 function SwitchStatement(test, cases, span) {
19440 this.test = test; 19659 this.test = test;
19441 this.cases = cases; 19660 this.cases = cases;
19442 lang_Statement.call(this, span); 19661 lang_Statement.call(this, span);
19443 // Initializers done 19662 // Initializers done
19444 } 19663 }
19445 $inherits(SwitchStatement, lang_Statement); 19664 $inherits(SwitchStatement, lang_Statement);
19665 SwitchStatement.prototype.get$cases = function() { return this.cases; };
19666 SwitchStatement.prototype.set$cases = function(value) { return this.cases = valu e; };
19446 SwitchStatement.prototype.visit = function(visitor) { 19667 SwitchStatement.prototype.visit = function(visitor) {
19447 return visitor.visitSwitchStatement(this); 19668 return visitor.visitSwitchStatement(this);
19448 } 19669 }
19449 SwitchStatement.prototype.visit$1 = function($0) { 19670 SwitchStatement.prototype.visit$1 = function($0) {
19450 return this.visit(($0 && $0.is$TreeVisitor())); 19671 return this.visit(($0 && $0.is$TreeVisitor()));
19451 }; 19672 };
19452 // ********** Code for BlockStatement ************** 19673 // ********** Code for BlockStatement **************
19453 function BlockStatement(body, span) { 19674 function BlockStatement(body, span) {
19454 this.body = body; 19675 this.body = body;
19455 lang_Statement.call(this, span); 19676 lang_Statement.call(this, span);
19456 // Initializers done 19677 // Initializers done
19457 } 19678 }
19458 $inherits(BlockStatement, lang_Statement); 19679 $inherits(BlockStatement, lang_Statement);
19459 BlockStatement.prototype.is$BlockStatement = function(){return this;}; 19680 BlockStatement.prototype.is$BlockStatement = function(){return this;};
19681 BlockStatement.prototype.get$body = function() { return this.body; };
19682 BlockStatement.prototype.set$body = function(value) { return this.body = value; };
19460 BlockStatement.prototype.visit = function(visitor) { 19683 BlockStatement.prototype.visit = function(visitor) {
19461 return visitor.visitBlockStatement(this); 19684 return visitor.visitBlockStatement(this);
19462 } 19685 }
19463 BlockStatement.prototype.visit$1 = function($0) { 19686 BlockStatement.prototype.visit$1 = function($0) {
19464 return this.visit(($0 && $0.is$TreeVisitor())); 19687 return this.visit(($0 && $0.is$TreeVisitor()));
19465 }; 19688 };
19466 // ********** Code for LabeledStatement ************** 19689 // ********** Code for LabeledStatement **************
19467 function LabeledStatement(name, body, span) { 19690 function LabeledStatement(name, body, span) {
19468 this.name = name; 19691 this.name = name;
19469 this.body = body; 19692 this.body = body;
19470 lang_Statement.call(this, span); 19693 lang_Statement.call(this, span);
19471 // Initializers done 19694 // Initializers done
19472 } 19695 }
19473 $inherits(LabeledStatement, lang_Statement); 19696 $inherits(LabeledStatement, lang_Statement);
19474 LabeledStatement.prototype.get$name = function() { return this.name; }; 19697 LabeledStatement.prototype.get$name = function() { return this.name; };
19475 LabeledStatement.prototype.set$name = function(value) { return this.name = value ; }; 19698 LabeledStatement.prototype.set$name = function(value) { return this.name = value ; };
19699 LabeledStatement.prototype.get$body = function() { return this.body; };
19700 LabeledStatement.prototype.set$body = function(value) { return this.body = value ; };
19476 LabeledStatement.prototype.visit = function(visitor) { 19701 LabeledStatement.prototype.visit = function(visitor) {
19477 return visitor.visitLabeledStatement(this); 19702 return visitor.visitLabeledStatement(this);
19478 } 19703 }
19479 LabeledStatement.prototype.visit$1 = function($0) { 19704 LabeledStatement.prototype.visit$1 = function($0) {
19480 return this.visit(($0 && $0.is$TreeVisitor())); 19705 return this.visit(($0 && $0.is$TreeVisitor()));
19481 }; 19706 };
19482 // ********** Code for lang_ExpressionStatement ************** 19707 // ********** Code for lang_ExpressionStatement **************
19483 function lang_ExpressionStatement(body, span) { 19708 function lang_ExpressionStatement(body, span) {
19484 this.body = body; 19709 this.body = body;
19485 lang_Statement.call(this, span); 19710 lang_Statement.call(this, span);
19486 // Initializers done 19711 // Initializers done
19487 } 19712 }
19488 $inherits(lang_ExpressionStatement, lang_Statement); 19713 $inherits(lang_ExpressionStatement, lang_Statement);
19714 lang_ExpressionStatement.prototype.get$body = function() { return this.body; };
19715 lang_ExpressionStatement.prototype.set$body = function(value) { return this.body = value; };
19489 lang_ExpressionStatement.prototype.visit = function(visitor) { 19716 lang_ExpressionStatement.prototype.visit = function(visitor) {
19490 return visitor.visitExpressionStatement(this); 19717 return visitor.visitExpressionStatement(this);
19491 } 19718 }
19492 lang_ExpressionStatement.prototype.visit$1 = function($0) { 19719 lang_ExpressionStatement.prototype.visit$1 = function($0) {
19493 return this.visit(($0 && $0.is$TreeVisitor())); 19720 return this.visit(($0 && $0.is$TreeVisitor()));
19494 }; 19721 };
19495 // ********** Code for EmptyStatement ************** 19722 // ********** Code for EmptyStatement **************
19496 function EmptyStatement(span) { 19723 function EmptyStatement(span) {
19497 lang_Statement.call(this, span); 19724 lang_Statement.call(this, span);
19498 // Initializers done 19725 // Initializers done
(...skipping 17 matching lines...) Expand all
19516 DietStatement.prototype.visit$1 = function($0) { 19743 DietStatement.prototype.visit$1 = function($0) {
19517 return this.visit(($0 && $0.is$TreeVisitor())); 19744 return this.visit(($0 && $0.is$TreeVisitor()));
19518 }; 19745 };
19519 // ********** Code for NativeStatement ************** 19746 // ********** Code for NativeStatement **************
19520 function NativeStatement(body, span) { 19747 function NativeStatement(body, span) {
19521 this.body = body; 19748 this.body = body;
19522 lang_Statement.call(this, span); 19749 lang_Statement.call(this, span);
19523 // Initializers done 19750 // Initializers done
19524 } 19751 }
19525 $inherits(NativeStatement, lang_Statement); 19752 $inherits(NativeStatement, lang_Statement);
19753 NativeStatement.prototype.get$body = function() { return this.body; };
19754 NativeStatement.prototype.set$body = function(value) { return this.body = value; };
19526 NativeStatement.prototype.visit = function(visitor) { 19755 NativeStatement.prototype.visit = function(visitor) {
19527 return visitor.visitNativeStatement(this); 19756 return visitor.visitNativeStatement(this);
19528 } 19757 }
19529 NativeStatement.prototype.visit$1 = function($0) { 19758 NativeStatement.prototype.visit$1 = function($0) {
19530 return this.visit(($0 && $0.is$TreeVisitor())); 19759 return this.visit(($0 && $0.is$TreeVisitor()));
19531 }; 19760 };
19532 // ********** Code for LambdaExpression ************** 19761 // ********** Code for LambdaExpression **************
19533 function LambdaExpression(func, span) { 19762 function LambdaExpression(func, span) {
19534 this.func = func; 19763 this.func = func;
19535 lang_Expression.call(this, span); 19764 lang_Expression.call(this, span);
19536 // Initializers done 19765 // Initializers done
19537 } 19766 }
19538 $inherits(LambdaExpression, lang_Expression); 19767 $inherits(LambdaExpression, lang_Expression);
19539 LambdaExpression.prototype.is$LambdaExpression = function(){return this;}; 19768 LambdaExpression.prototype.is$LambdaExpression = function(){return this;};
19769 LambdaExpression.prototype.get$func = function() { return this.func; };
19770 LambdaExpression.prototype.set$func = function(value) { return this.func = value ; };
19540 LambdaExpression.prototype.visit = function(visitor) { 19771 LambdaExpression.prototype.visit = function(visitor) {
19541 return visitor.visitLambdaExpression(this); 19772 return visitor.visitLambdaExpression(this);
19542 } 19773 }
19543 LambdaExpression.prototype.visit$1 = function($0) { 19774 LambdaExpression.prototype.visit$1 = function($0) {
19544 return this.visit(($0 && $0.is$TreeVisitor())); 19775 return this.visit(($0 && $0.is$TreeVisitor()));
19545 }; 19776 };
19546 // ********** Code for CallExpression ************** 19777 // ********** Code for CallExpression **************
19547 function CallExpression(target, arguments, span) { 19778 function CallExpression(target, arguments, span) {
19548 this.target = target; 19779 this.target = target;
19549 this.arguments = arguments; 19780 this.arguments = arguments;
19550 lang_Expression.call(this, span); 19781 lang_Expression.call(this, span);
19551 // Initializers done 19782 // Initializers done
19552 } 19783 }
19553 $inherits(CallExpression, lang_Expression); 19784 $inherits(CallExpression, lang_Expression);
19554 CallExpression.prototype.is$CallExpression = function(){return this;}; 19785 CallExpression.prototype.is$CallExpression = function(){return this;};
19786 CallExpression.prototype.get$target = function() { return this.target; };
19787 CallExpression.prototype.set$target = function(value) { return this.target = val ue; };
19555 CallExpression.prototype.get$arguments = function() { return this.arguments; }; 19788 CallExpression.prototype.get$arguments = function() { return this.arguments; };
19556 CallExpression.prototype.set$arguments = function(value) { return this.arguments = value; }; 19789 CallExpression.prototype.set$arguments = function(value) { return this.arguments = value; };
19557 CallExpression.prototype.visit = function(visitor) { 19790 CallExpression.prototype.visit = function(visitor) {
19558 return visitor.visitCallExpression(this); 19791 return visitor.visitCallExpression(this);
19559 } 19792 }
19560 CallExpression.prototype.visit$1 = function($0) { 19793 CallExpression.prototype.visit$1 = function($0) {
19561 return this.visit(($0 && $0.is$TreeVisitor())); 19794 return this.visit(($0 && $0.is$TreeVisitor()));
19562 }; 19795 };
19563 // ********** Code for IndexExpression ************** 19796 // ********** Code for IndexExpression **************
19564 function IndexExpression(target, index, span) { 19797 function IndexExpression(target, index, span) {
19565 this.target = target; 19798 this.target = target;
19566 this.index = index; 19799 this.index = index;
19567 lang_Expression.call(this, span); 19800 lang_Expression.call(this, span);
19568 // Initializers done 19801 // Initializers done
19569 } 19802 }
19570 $inherits(IndexExpression, lang_Expression); 19803 $inherits(IndexExpression, lang_Expression);
19571 IndexExpression.prototype.is$IndexExpression = function(){return this;}; 19804 IndexExpression.prototype.is$IndexExpression = function(){return this;};
19805 IndexExpression.prototype.get$target = function() { return this.target; };
19806 IndexExpression.prototype.set$target = function(value) { return this.target = va lue; };
19572 IndexExpression.prototype.visit = function(visitor) { 19807 IndexExpression.prototype.visit = function(visitor) {
19573 return visitor.visitIndexExpression(this); 19808 return visitor.visitIndexExpression(this);
19574 } 19809 }
19575 IndexExpression.prototype.visit$1 = function($0) { 19810 IndexExpression.prototype.visit$1 = function($0) {
19576 return this.visit(($0 && $0.is$TreeVisitor())); 19811 return this.visit(($0 && $0.is$TreeVisitor()));
19577 }; 19812 };
19578 // ********** Code for BinaryExpression ************** 19813 // ********** Code for BinaryExpression **************
19579 function BinaryExpression(op, x, y, span) { 19814 function BinaryExpression(op, x, y, span) {
19580 this.op = op; 19815 this.op = op;
19581 this.x = x; 19816 this.x = x;
19582 this.y = y; 19817 this.y = y;
19583 lang_Expression.call(this, span); 19818 lang_Expression.call(this, span);
19584 // Initializers done 19819 // Initializers done
19585 } 19820 }
19586 $inherits(BinaryExpression, lang_Expression); 19821 $inherits(BinaryExpression, lang_Expression);
19587 BinaryExpression.prototype.is$BinaryExpression = function(){return this;}; 19822 BinaryExpression.prototype.is$BinaryExpression = function(){return this;};
19823 BinaryExpression.prototype.get$op = function() { return this.op; };
19824 BinaryExpression.prototype.set$op = function(value) { return this.op = value; };
19825 BinaryExpression.prototype.get$x = function() { return this.x; };
19826 BinaryExpression.prototype.set$x = function(value) { return this.x = value; };
19827 BinaryExpression.prototype.get$y = function() { return this.y; };
19828 BinaryExpression.prototype.set$y = function(value) { return this.y = value; };
19588 BinaryExpression.prototype.visit = function(visitor) { 19829 BinaryExpression.prototype.visit = function(visitor) {
19589 return visitor.visitBinaryExpression(this); 19830 return visitor.visitBinaryExpression(this);
19590 } 19831 }
19591 BinaryExpression.prototype.visit$1 = function($0) { 19832 BinaryExpression.prototype.visit$1 = function($0) {
19592 return this.visit(($0 && $0.is$TreeVisitor())); 19833 return this.visit(($0 && $0.is$TreeVisitor()));
19593 }; 19834 };
19594 // ********** Code for UnaryExpression ************** 19835 // ********** Code for UnaryExpression **************
19595 function UnaryExpression(op, self, span) { 19836 function UnaryExpression(op, self, span) {
19596 this.op = op; 19837 this.op = op;
19597 this.self = self; 19838 this.self = self;
19598 lang_Expression.call(this, span); 19839 lang_Expression.call(this, span);
19599 // Initializers done 19840 // Initializers done
19600 } 19841 }
19601 $inherits(UnaryExpression, lang_Expression); 19842 $inherits(UnaryExpression, lang_Expression);
19843 UnaryExpression.prototype.get$op = function() { return this.op; };
19844 UnaryExpression.prototype.set$op = function(value) { return this.op = value; };
19845 UnaryExpression.prototype.get$self = function() { return this.self; };
19846 UnaryExpression.prototype.set$self = function(value) { return this.self = value; };
19602 UnaryExpression.prototype.visit = function(visitor) { 19847 UnaryExpression.prototype.visit = function(visitor) {
19603 return visitor.visitUnaryExpression(this); 19848 return visitor.visitUnaryExpression(this);
19604 } 19849 }
19605 UnaryExpression.prototype.visit$1 = function($0) { 19850 UnaryExpression.prototype.visit$1 = function($0) {
19606 return this.visit(($0 && $0.is$TreeVisitor())); 19851 return this.visit(($0 && $0.is$TreeVisitor()));
19607 }; 19852 };
19608 // ********** Code for PostfixExpression ************** 19853 // ********** Code for PostfixExpression **************
19609 function PostfixExpression(body, op, span) { 19854 function PostfixExpression(body, op, span) {
19610 this.body = body; 19855 this.body = body;
19611 this.op = op; 19856 this.op = op;
19612 lang_Expression.call(this, span); 19857 lang_Expression.call(this, span);
19613 // Initializers done 19858 // Initializers done
19614 } 19859 }
19615 $inherits(PostfixExpression, lang_Expression); 19860 $inherits(PostfixExpression, lang_Expression);
19616 PostfixExpression.prototype.is$PostfixExpression = function(){return this;}; 19861 PostfixExpression.prototype.is$PostfixExpression = function(){return this;};
19862 PostfixExpression.prototype.get$body = function() { return this.body; };
19863 PostfixExpression.prototype.set$body = function(value) { return this.body = valu e; };
19864 PostfixExpression.prototype.get$op = function() { return this.op; };
19865 PostfixExpression.prototype.set$op = function(value) { return this.op = value; } ;
19617 PostfixExpression.prototype.visit = function(visitor) { 19866 PostfixExpression.prototype.visit = function(visitor) {
19618 return visitor.visitPostfixExpression$1(this); 19867 return visitor.visitPostfixExpression$1(this);
19619 } 19868 }
19620 PostfixExpression.prototype.visit$1 = function($0) { 19869 PostfixExpression.prototype.visit$1 = function($0) {
19621 return this.visit(($0 && $0.is$TreeVisitor())); 19870 return this.visit(($0 && $0.is$TreeVisitor()));
19622 }; 19871 };
19623 // ********** Code for lang_NewExpression ************** 19872 // ********** Code for lang_NewExpression **************
19624 function lang_NewExpression(isConst, type, name, arguments, span) { 19873 function lang_NewExpression(isConst, type, name, arguments, span) {
19625 this.isConst = isConst; 19874 this.isConst = isConst;
19626 this.type = type; 19875 this.type = type;
19627 this.name = name; 19876 this.name = name;
19628 this.arguments = arguments; 19877 this.arguments = arguments;
19629 lang_Expression.call(this, span); 19878 lang_Expression.call(this, span);
19630 // Initializers done 19879 // Initializers done
19631 } 19880 }
19632 $inherits(lang_NewExpression, lang_Expression); 19881 $inherits(lang_NewExpression, lang_Expression);
19633 lang_NewExpression.prototype.get$isConst = function() { return this.isConst; }; 19882 lang_NewExpression.prototype.get$isConst = function() { return this.isConst; };
19634 lang_NewExpression.prototype.set$isConst = function(value) { return this.isConst = value; }; 19883 lang_NewExpression.prototype.set$isConst = function(value) { return this.isConst = value; };
19884 lang_NewExpression.prototype.get$type = function() { return this.type; };
19885 lang_NewExpression.prototype.set$type = function(value) { return this.type = val ue; };
19635 lang_NewExpression.prototype.get$name = function() { return this.name; }; 19886 lang_NewExpression.prototype.get$name = function() { return this.name; };
19636 lang_NewExpression.prototype.set$name = function(value) { return this.name = val ue; }; 19887 lang_NewExpression.prototype.set$name = function(value) { return this.name = val ue; };
19637 lang_NewExpression.prototype.get$arguments = function() { return this.arguments; }; 19888 lang_NewExpression.prototype.get$arguments = function() { return this.arguments; };
19638 lang_NewExpression.prototype.set$arguments = function(value) { return this.argum ents = value; }; 19889 lang_NewExpression.prototype.set$arguments = function(value) { return this.argum ents = value; };
19639 lang_NewExpression.prototype.visit = function(visitor) { 19890 lang_NewExpression.prototype.visit = function(visitor) {
19640 return visitor.visitNewExpression(this); 19891 return visitor.visitNewExpression(this);
19641 } 19892 }
19642 lang_NewExpression.prototype.visit$1 = function($0) { 19893 lang_NewExpression.prototype.visit$1 = function($0) {
19643 return this.visit(($0 && $0.is$TreeVisitor())); 19894 return this.visit(($0 && $0.is$TreeVisitor()));
19644 }; 19895 };
19645 // ********** Code for ListExpression ************** 19896 // ********** Code for ListExpression **************
19646 function ListExpression(isConst, type, values, span) { 19897 function ListExpression(isConst, type, values, span) {
19647 this.isConst = isConst; 19898 this.isConst = isConst;
19648 this.type = type; 19899 this.type = type;
19649 this.values = values; 19900 this.values = values;
19650 lang_Expression.call(this, span); 19901 lang_Expression.call(this, span);
19651 // Initializers done 19902 // Initializers done
19652 } 19903 }
19653 $inherits(ListExpression, lang_Expression); 19904 $inherits(ListExpression, lang_Expression);
19654 ListExpression.prototype.get$isConst = function() { return this.isConst; }; 19905 ListExpression.prototype.get$isConst = function() { return this.isConst; };
19655 ListExpression.prototype.set$isConst = function(value) { return this.isConst = v alue; }; 19906 ListExpression.prototype.set$isConst = function(value) { return this.isConst = v alue; };
19907 ListExpression.prototype.get$type = function() { return this.type; };
19908 ListExpression.prototype.set$type = function(value) { return this.type = value; };
19909 ListExpression.prototype.get$values = function() { return this.values; };
19910 ListExpression.prototype.set$values = function(value) { return this.values = val ue; };
19656 ListExpression.prototype.visit = function(visitor) { 19911 ListExpression.prototype.visit = function(visitor) {
19657 return visitor.visitListExpression(this); 19912 return visitor.visitListExpression(this);
19658 } 19913 }
19659 ListExpression.prototype.visit$1 = function($0) { 19914 ListExpression.prototype.visit$1 = function($0) {
19660 return this.visit(($0 && $0.is$TreeVisitor())); 19915 return this.visit(($0 && $0.is$TreeVisitor()));
19661 }; 19916 };
19662 // ********** Code for MapExpression ************** 19917 // ********** Code for MapExpression **************
19663 function MapExpression(isConst, type, items, span) { 19918 function MapExpression(isConst, type, items, span) {
19664 this.isConst = isConst; 19919 this.isConst = isConst;
19665 this.type = type; 19920 this.type = type;
19666 this.items = items; 19921 this.items = items;
19667 lang_Expression.call(this, span); 19922 lang_Expression.call(this, span);
19668 // Initializers done 19923 // Initializers done
19669 } 19924 }
19670 $inherits(MapExpression, lang_Expression); 19925 $inherits(MapExpression, lang_Expression);
19671 MapExpression.prototype.get$isConst = function() { return this.isConst; }; 19926 MapExpression.prototype.get$isConst = function() { return this.isConst; };
19672 MapExpression.prototype.set$isConst = function(value) { return this.isConst = va lue; }; 19927 MapExpression.prototype.set$isConst = function(value) { return this.isConst = va lue; };
19928 MapExpression.prototype.get$type = function() { return this.type; };
19929 MapExpression.prototype.set$type = function(value) { return this.type = value; } ;
19673 MapExpression.prototype.visit = function(visitor) { 19930 MapExpression.prototype.visit = function(visitor) {
19674 return visitor.visitMapExpression(this); 19931 return visitor.visitMapExpression(this);
19675 } 19932 }
19676 MapExpression.prototype.visit$1 = function($0) { 19933 MapExpression.prototype.visit$1 = function($0) {
19677 return this.visit(($0 && $0.is$TreeVisitor())); 19934 return this.visit(($0 && $0.is$TreeVisitor()));
19678 }; 19935 };
19679 // ********** Code for ConditionalExpression ************** 19936 // ********** Code for ConditionalExpression **************
19680 function ConditionalExpression(test, trueBranch, falseBranch, span) { 19937 function ConditionalExpression(test, trueBranch, falseBranch, span) {
19681 this.test = test; 19938 this.test = test;
19682 this.trueBranch = trueBranch; 19939 this.trueBranch = trueBranch;
(...skipping 10 matching lines...) Expand all
19693 }; 19950 };
19694 // ********** Code for IsExpression ************** 19951 // ********** Code for IsExpression **************
19695 function IsExpression(isTrue, x, type, span) { 19952 function IsExpression(isTrue, x, type, span) {
19696 this.isTrue = isTrue; 19953 this.isTrue = isTrue;
19697 this.x = x; 19954 this.x = x;
19698 this.type = type; 19955 this.type = type;
19699 lang_Expression.call(this, span); 19956 lang_Expression.call(this, span);
19700 // Initializers done 19957 // Initializers done
19701 } 19958 }
19702 $inherits(IsExpression, lang_Expression); 19959 $inherits(IsExpression, lang_Expression);
19960 IsExpression.prototype.get$x = function() { return this.x; };
19961 IsExpression.prototype.set$x = function(value) { return this.x = value; };
19962 IsExpression.prototype.get$type = function() { return this.type; };
19963 IsExpression.prototype.set$type = function(value) { return this.type = value; };
19703 IsExpression.prototype.visit = function(visitor) { 19964 IsExpression.prototype.visit = function(visitor) {
19704 return visitor.visitIsExpression(this); 19965 return visitor.visitIsExpression(this);
19705 } 19966 }
19706 IsExpression.prototype.visit$1 = function($0) { 19967 IsExpression.prototype.visit$1 = function($0) {
19707 return this.visit(($0 && $0.is$TreeVisitor())); 19968 return this.visit(($0 && $0.is$TreeVisitor()));
19708 }; 19969 };
19709 // ********** Code for ParenExpression ************** 19970 // ********** Code for ParenExpression **************
19710 function ParenExpression(body, span) { 19971 function ParenExpression(body, span) {
19711 this.body = body; 19972 this.body = body;
19712 lang_Expression.call(this, span); 19973 lang_Expression.call(this, span);
19713 // Initializers done 19974 // Initializers done
19714 } 19975 }
19715 $inherits(ParenExpression, lang_Expression); 19976 $inherits(ParenExpression, lang_Expression);
19977 ParenExpression.prototype.get$body = function() { return this.body; };
19978 ParenExpression.prototype.set$body = function(value) { return this.body = value; };
19716 ParenExpression.prototype.visit = function(visitor) { 19979 ParenExpression.prototype.visit = function(visitor) {
19717 return visitor.visitParenExpression(this); 19980 return visitor.visitParenExpression(this);
19718 } 19981 }
19719 ParenExpression.prototype.visit$1 = function($0) { 19982 ParenExpression.prototype.visit$1 = function($0) {
19720 return this.visit(($0 && $0.is$TreeVisitor())); 19983 return this.visit(($0 && $0.is$TreeVisitor()));
19721 }; 19984 };
19722 // ********** Code for DotExpression ************** 19985 // ********** Code for DotExpression **************
19723 function DotExpression(self, name, span) { 19986 function DotExpression(self, name, span) {
19724 this.self = self; 19987 this.self = self;
19725 this.name = name; 19988 this.name = name;
19726 lang_Expression.call(this, span); 19989 lang_Expression.call(this, span);
19727 // Initializers done 19990 // Initializers done
19728 } 19991 }
19729 $inherits(DotExpression, lang_Expression); 19992 $inherits(DotExpression, lang_Expression);
19730 DotExpression.prototype.is$DotExpression = function(){return this;}; 19993 DotExpression.prototype.is$DotExpression = function(){return this;};
19994 DotExpression.prototype.get$self = function() { return this.self; };
19995 DotExpression.prototype.set$self = function(value) { return this.self = value; } ;
19731 DotExpression.prototype.get$name = function() { return this.name; }; 19996 DotExpression.prototype.get$name = function() { return this.name; };
19732 DotExpression.prototype.set$name = function(value) { return this.name = value; } ; 19997 DotExpression.prototype.set$name = function(value) { return this.name = value; } ;
19733 DotExpression.prototype.visit = function(visitor) { 19998 DotExpression.prototype.visit = function(visitor) {
19734 return visitor.visitDotExpression(this); 19999 return visitor.visitDotExpression(this);
19735 } 20000 }
19736 DotExpression.prototype.visit$1 = function($0) { 20001 DotExpression.prototype.visit$1 = function($0) {
19737 return this.visit(($0 && $0.is$TreeVisitor())); 20002 return this.visit(($0 && $0.is$TreeVisitor()));
19738 }; 20003 };
19739 // ********** Code for VarExpression ************** 20004 // ********** Code for VarExpression **************
19740 function VarExpression(name, span) { 20005 function VarExpression(name, span) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
19792 function LiteralExpression(value, type, text, span) { 20057 function LiteralExpression(value, type, text, span) {
19793 this.value = value; 20058 this.value = value;
19794 this.type = type; 20059 this.type = type;
19795 this.text = text; 20060 this.text = text;
19796 lang_Expression.call(this, span); 20061 lang_Expression.call(this, span);
19797 // Initializers done 20062 // Initializers done
19798 } 20063 }
19799 $inherits(LiteralExpression, lang_Expression); 20064 $inherits(LiteralExpression, lang_Expression);
19800 LiteralExpression.prototype.get$value = function() { return this.value; }; 20065 LiteralExpression.prototype.get$value = function() { return this.value; };
19801 LiteralExpression.prototype.set$value = function(value) { return this.value = va lue; }; 20066 LiteralExpression.prototype.set$value = function(value) { return this.value = va lue; };
20067 LiteralExpression.prototype.get$type = function() { return this.type; };
20068 LiteralExpression.prototype.set$type = function(value) { return this.type = valu e; };
19802 LiteralExpression.prototype.get$text = function() { return this.text; }; 20069 LiteralExpression.prototype.get$text = function() { return this.text; };
19803 LiteralExpression.prototype.set$text = function(value) { return this.text = valu e; }; 20070 LiteralExpression.prototype.set$text = function(value) { return this.text = valu e; };
19804 LiteralExpression.prototype.visit = function(visitor) { 20071 LiteralExpression.prototype.visit = function(visitor) {
19805 return visitor.visitLiteralExpression(this); 20072 return visitor.visitLiteralExpression(this);
19806 } 20073 }
19807 LiteralExpression.prototype.visit$1 = function($0) { 20074 LiteralExpression.prototype.visit$1 = function($0) {
19808 return this.visit(($0 && $0.is$TreeVisitor())); 20075 return this.visit(($0 && $0.is$TreeVisitor()));
19809 }; 20076 };
19810 // ********** Code for NameTypeReference ************** 20077 // ********** Code for NameTypeReference **************
19811 function NameTypeReference(isFinal, name, names, span) { 20078 function NameTypeReference(isFinal, name, names, span) {
19812 this.isFinal = isFinal; 20079 this.isFinal = isFinal;
19813 this.name = name; 20080 this.name = name;
19814 this.names = names; 20081 this.names = names;
19815 TypeReference.call(this, span); 20082 TypeReference.call(this, span);
19816 // Initializers done 20083 // Initializers done
19817 } 20084 }
19818 $inherits(NameTypeReference, TypeReference); 20085 $inherits(NameTypeReference, TypeReference);
19819 NameTypeReference.prototype.is$NameTypeReference = function(){return this;}; 20086 NameTypeReference.prototype.is$NameTypeReference = function(){return this;};
20087 NameTypeReference.prototype.get$isFinal = function() { return this.isFinal; };
20088 NameTypeReference.prototype.set$isFinal = function(value) { return this.isFinal = value; };
19820 NameTypeReference.prototype.get$name = function() { return this.name; }; 20089 NameTypeReference.prototype.get$name = function() { return this.name; };
19821 NameTypeReference.prototype.set$name = function(value) { return this.name = valu e; }; 20090 NameTypeReference.prototype.set$name = function(value) { return this.name = valu e; };
20091 NameTypeReference.prototype.get$names = function() { return this.names; };
20092 NameTypeReference.prototype.set$names = function(value) { return this.names = va lue; };
19822 NameTypeReference.prototype.visit = function(visitor) { 20093 NameTypeReference.prototype.visit = function(visitor) {
19823 return visitor.visitNameTypeReference(this); 20094 return visitor.visitNameTypeReference(this);
19824 } 20095 }
19825 NameTypeReference.prototype.visit$1 = function($0) { 20096 NameTypeReference.prototype.visit$1 = function($0) {
19826 return this.visit(($0 && $0.is$TreeVisitor())); 20097 return this.visit(($0 && $0.is$TreeVisitor()));
19827 }; 20098 };
19828 // ********** Code for GenericTypeReference ************** 20099 // ********** Code for GenericTypeReference **************
19829 function GenericTypeReference(baseType, typeArguments, depth, span) { 20100 function GenericTypeReference(baseType, typeArguments, depth, span) {
19830 this.baseType = baseType; 20101 this.baseType = baseType;
19831 this.typeArguments = typeArguments; 20102 this.typeArguments = typeArguments;
19832 this.depth = depth; 20103 this.depth = depth;
19833 TypeReference.call(this, span); 20104 TypeReference.call(this, span);
19834 // Initializers done 20105 // Initializers done
19835 } 20106 }
19836 $inherits(GenericTypeReference, TypeReference); 20107 $inherits(GenericTypeReference, TypeReference);
19837 GenericTypeReference.prototype.is$GenericTypeReference = function(){return this; }; 20108 GenericTypeReference.prototype.is$GenericTypeReference = function(){return this; };
20109 GenericTypeReference.prototype.get$depth = function() { return this.depth; };
20110 GenericTypeReference.prototype.set$depth = function(value) { return this.depth = value; };
19838 GenericTypeReference.prototype.visit = function(visitor) { 20111 GenericTypeReference.prototype.visit = function(visitor) {
19839 return visitor.visitGenericTypeReference(this); 20112 return visitor.visitGenericTypeReference(this);
19840 } 20113 }
19841 GenericTypeReference.prototype.visit$1 = function($0) { 20114 GenericTypeReference.prototype.visit$1 = function($0) {
19842 return this.visit(($0 && $0.is$TreeVisitor())); 20115 return this.visit(($0 && $0.is$TreeVisitor()));
19843 }; 20116 };
19844 // ********** Code for FunctionTypeReference ************** 20117 // ********** Code for FunctionTypeReference **************
19845 function FunctionTypeReference(isFinal, func, span) { 20118 function FunctionTypeReference(isFinal, func, span) {
19846 this.isFinal = isFinal; 20119 this.isFinal = isFinal;
19847 this.func = func; 20120 this.func = func;
19848 TypeReference.call(this, span); 20121 TypeReference.call(this, span);
19849 // Initializers done 20122 // Initializers done
19850 } 20123 }
19851 $inherits(FunctionTypeReference, TypeReference); 20124 $inherits(FunctionTypeReference, TypeReference);
19852 FunctionTypeReference.prototype.is$FunctionTypeReference = function(){return thi s;}; 20125 FunctionTypeReference.prototype.is$FunctionTypeReference = function(){return thi s;};
20126 FunctionTypeReference.prototype.get$isFinal = function() { return this.isFinal; };
20127 FunctionTypeReference.prototype.set$isFinal = function(value) { return this.isFi nal = value; };
20128 FunctionTypeReference.prototype.get$func = function() { return this.func; };
20129 FunctionTypeReference.prototype.set$func = function(value) { return this.func = value; };
19853 FunctionTypeReference.prototype.visit = function(visitor) { 20130 FunctionTypeReference.prototype.visit = function(visitor) {
19854 return visitor.visitFunctionTypeReference(this); 20131 return visitor.visitFunctionTypeReference(this);
19855 } 20132 }
19856 FunctionTypeReference.prototype.visit$1 = function($0) { 20133 FunctionTypeReference.prototype.visit$1 = function($0) {
19857 return this.visit(($0 && $0.is$TreeVisitor())); 20134 return this.visit(($0 && $0.is$TreeVisitor()));
19858 }; 20135 };
19859 // ********** Code for ArgumentNode ************** 20136 // ********** Code for ArgumentNode **************
19860 function ArgumentNode(label, value, span) { 20137 function ArgumentNode(label, value, span) {
19861 this.label = label; 20138 this.label = label;
19862 this.value = value; 20139 this.value = value;
19863 lang_Node.call(this, span); 20140 lang_Node.call(this, span);
19864 // Initializers done 20141 // Initializers done
19865 } 20142 }
19866 $inherits(ArgumentNode, lang_Node); 20143 $inherits(ArgumentNode, lang_Node);
19867 ArgumentNode.prototype.is$ArgumentNode = function(){return this;}; 20144 ArgumentNode.prototype.is$ArgumentNode = function(){return this;};
20145 ArgumentNode.prototype.get$label = function() { return this.label; };
20146 ArgumentNode.prototype.set$label = function(value) { return this.label = value; };
19868 ArgumentNode.prototype.get$value = function() { return this.value; }; 20147 ArgumentNode.prototype.get$value = function() { return this.value; };
19869 ArgumentNode.prototype.set$value = function(value) { return this.value = value; }; 20148 ArgumentNode.prototype.set$value = function(value) { return this.value = value; };
19870 ArgumentNode.prototype.visit = function(visitor) { 20149 ArgumentNode.prototype.visit = function(visitor) {
19871 return visitor.visitArgumentNode(this); 20150 return visitor.visitArgumentNode(this);
19872 } 20151 }
19873 ArgumentNode.prototype.visit$1 = function($0) { 20152 ArgumentNode.prototype.visit$1 = function($0) {
19874 return this.visit(($0 && $0.is$TreeVisitor())); 20153 return this.visit(($0 && $0.is$TreeVisitor()));
19875 }; 20154 };
19876 // ********** Code for FormalNode ************** 20155 // ********** Code for FormalNode **************
19877 function FormalNode(isThis, isRest, type, name, value, span) { 20156 function FormalNode(isThis, isRest, type, name, value, span) {
19878 this.isThis = isThis; 20157 this.isThis = isThis;
19879 this.isRest = isRest; 20158 this.isRest = isRest;
19880 this.type = type; 20159 this.type = type;
19881 this.name = name; 20160 this.name = name;
19882 this.value = value; 20161 this.value = value;
19883 lang_Node.call(this, span); 20162 lang_Node.call(this, span);
19884 // Initializers done 20163 // Initializers done
19885 } 20164 }
19886 $inherits(FormalNode, lang_Node); 20165 $inherits(FormalNode, lang_Node);
20166 FormalNode.prototype.get$type = function() { return this.type; };
20167 FormalNode.prototype.set$type = function(value) { return this.type = value; };
19887 FormalNode.prototype.get$name = function() { return this.name; }; 20168 FormalNode.prototype.get$name = function() { return this.name; };
19888 FormalNode.prototype.set$name = function(value) { return this.name = value; }; 20169 FormalNode.prototype.set$name = function(value) { return this.name = value; };
19889 FormalNode.prototype.get$value = function() { return this.value; }; 20170 FormalNode.prototype.get$value = function() { return this.value; };
19890 FormalNode.prototype.set$value = function(value) { return this.value = value; }; 20171 FormalNode.prototype.set$value = function(value) { return this.value = value; };
19891 FormalNode.prototype.visit = function(visitor) { 20172 FormalNode.prototype.visit = function(visitor) {
19892 return visitor.visitFormalNode(this); 20173 return visitor.visitFormalNode(this);
19893 } 20174 }
19894 FormalNode.prototype.visit$1 = function($0) { 20175 FormalNode.prototype.visit$1 = function($0) {
19895 return this.visit(($0 && $0.is$TreeVisitor())); 20176 return this.visit(($0 && $0.is$TreeVisitor()));
19896 }; 20177 };
19897 // ********** Code for CatchNode ************** 20178 // ********** Code for CatchNode **************
19898 function CatchNode(exception, trace, body, span) { 20179 function CatchNode(exception, trace, body, span) {
19899 this.exception = exception; 20180 this.exception = exception;
19900 this.trace = trace; 20181 this.trace = trace;
19901 this.body = body; 20182 this.body = body;
19902 lang_Node.call(this, span); 20183 lang_Node.call(this, span);
19903 // Initializers done 20184 // Initializers done
19904 } 20185 }
19905 $inherits(CatchNode, lang_Node); 20186 $inherits(CatchNode, lang_Node);
19906 CatchNode.prototype.get$exception = function() { return this.exception; }; 20187 CatchNode.prototype.get$exception = function() { return this.exception; };
19907 CatchNode.prototype.set$exception = function(value) { return this.exception = va lue; }; 20188 CatchNode.prototype.set$exception = function(value) { return this.exception = va lue; };
20189 CatchNode.prototype.get$trace = function() { return this.trace; };
20190 CatchNode.prototype.set$trace = function(value) { return this.trace = value; };
20191 CatchNode.prototype.get$body = function() { return this.body; };
20192 CatchNode.prototype.set$body = function(value) { return this.body = value; };
19908 CatchNode.prototype.visit = function(visitor) { 20193 CatchNode.prototype.visit = function(visitor) {
19909 return visitor.visitCatchNode(this); 20194 return visitor.visitCatchNode(this);
19910 } 20195 }
19911 CatchNode.prototype.visit$1 = function($0) { 20196 CatchNode.prototype.visit$1 = function($0) {
19912 return this.visit(($0 && $0.is$TreeVisitor())); 20197 return this.visit(($0 && $0.is$TreeVisitor()));
19913 }; 20198 };
19914 // ********** Code for CaseNode ************** 20199 // ********** Code for CaseNode **************
19915 function CaseNode(label, cases, statements, span) { 20200 function CaseNode(label, cases, statements, span) {
19916 this.label = label; 20201 this.label = label;
19917 this.cases = cases; 20202 this.cases = cases;
19918 this.statements = statements; 20203 this.statements = statements;
19919 lang_Node.call(this, span); 20204 lang_Node.call(this, span);
19920 // Initializers done 20205 // Initializers done
19921 } 20206 }
19922 $inherits(CaseNode, lang_Node); 20207 $inherits(CaseNode, lang_Node);
20208 CaseNode.prototype.get$label = function() { return this.label; };
20209 CaseNode.prototype.set$label = function(value) { return this.label = value; };
20210 CaseNode.prototype.get$cases = function() { return this.cases; };
20211 CaseNode.prototype.set$cases = function(value) { return this.cases = value; };
20212 CaseNode.prototype.get$statements = function() { return this.statements; };
20213 CaseNode.prototype.set$statements = function(value) { return this.statements = v alue; };
19923 CaseNode.prototype.visit = function(visitor) { 20214 CaseNode.prototype.visit = function(visitor) {
19924 return visitor.visitCaseNode(this); 20215 return visitor.visitCaseNode(this);
19925 } 20216 }
19926 CaseNode.prototype.visit$1 = function($0) { 20217 CaseNode.prototype.visit$1 = function($0) {
19927 return this.visit(($0 && $0.is$TreeVisitor())); 20218 return this.visit(($0 && $0.is$TreeVisitor()));
19928 }; 20219 };
19929 // ********** Code for TypeParameter ************** 20220 // ********** Code for TypeParameter **************
19930 function TypeParameter(name, extendsType, span) { 20221 function TypeParameter(name, extendsType, span) {
19931 this.name = name; 20222 this.name = name;
19932 this.extendsType = extendsType; 20223 this.extendsType = extendsType;
19933 lang_Node.call(this, span); 20224 lang_Node.call(this, span);
19934 // Initializers done 20225 // Initializers done
19935 } 20226 }
19936 $inherits(TypeParameter, lang_Node); 20227 $inherits(TypeParameter, lang_Node);
19937 TypeParameter.prototype.get$name = function() { return this.name; }; 20228 TypeParameter.prototype.get$name = function() { return this.name; };
19938 TypeParameter.prototype.set$name = function(value) { return this.name = value; } ; 20229 TypeParameter.prototype.set$name = function(value) { return this.name = value; } ;
20230 TypeParameter.prototype.get$extendsType = function() { return this.extendsType; };
20231 TypeParameter.prototype.set$extendsType = function(value) { return this.extendsT ype = value; };
19939 TypeParameter.prototype.visit = function(visitor) { 20232 TypeParameter.prototype.visit = function(visitor) {
19940 return visitor.visitTypeParameter(this); 20233 return visitor.visitTypeParameter(this);
19941 } 20234 }
19942 TypeParameter.prototype.visit$1 = function($0) { 20235 TypeParameter.prototype.visit$1 = function($0) {
19943 return this.visit(($0 && $0.is$TreeVisitor())); 20236 return this.visit(($0 && $0.is$TreeVisitor()));
19944 }; 20237 };
19945 // ********** Code for lang_Identifier ************** 20238 // ********** Code for lang_Identifier **************
19946 function lang_Identifier(name, span) { 20239 function lang_Identifier(name, span) {
19947 this.name = name; 20240 this.name = name;
19948 lang_Node.call(this, span); 20241 lang_Node.call(this, span);
(...skipping 10 matching lines...) Expand all
19959 }; 20252 };
19960 // ********** Code for DeclaredIdentifier ************** 20253 // ********** Code for DeclaredIdentifier **************
19961 function DeclaredIdentifier(type, name, span) { 20254 function DeclaredIdentifier(type, name, span) {
19962 this.type = type; 20255 this.type = type;
19963 this.name = name; 20256 this.name = name;
19964 lang_Expression.call(this, span); 20257 lang_Expression.call(this, span);
19965 // Initializers done 20258 // Initializers done
19966 } 20259 }
19967 $inherits(DeclaredIdentifier, lang_Expression); 20260 $inherits(DeclaredIdentifier, lang_Expression);
19968 DeclaredIdentifier.prototype.is$DeclaredIdentifier = function(){return this;}; 20261 DeclaredIdentifier.prototype.is$DeclaredIdentifier = function(){return this;};
20262 DeclaredIdentifier.prototype.get$type = function() { return this.type; };
20263 DeclaredIdentifier.prototype.set$type = function(value) { return this.type = val ue; };
19969 DeclaredIdentifier.prototype.get$name = function() { return this.name; }; 20264 DeclaredIdentifier.prototype.get$name = function() { return this.name; };
19970 DeclaredIdentifier.prototype.set$name = function(value) { return this.name = val ue; }; 20265 DeclaredIdentifier.prototype.set$name = function(value) { return this.name = val ue; };
19971 DeclaredIdentifier.prototype.visit = function(visitor) { 20266 DeclaredIdentifier.prototype.visit = function(visitor) {
19972 return visitor.visitDeclaredIdentifier(this); 20267 return visitor.visitDeclaredIdentifier(this);
19973 } 20268 }
19974 DeclaredIdentifier.prototype.visit$1 = function($0) { 20269 DeclaredIdentifier.prototype.visit$1 = function($0) {
19975 return this.visit(($0 && $0.is$TreeVisitor())); 20270 return this.visit(($0 && $0.is$TreeVisitor()));
19976 }; 20271 };
19977 // ********** Code for lang_Type ************** 20272 // ********** Code for lang_Type **************
19978 function lang_Type(name) { 20273 function lang_Type(name) {
19979 this.name = name; 20274 this.name = name;
19980 this.isTested = false; 20275 this.isTested = false;
19981 // Initializers done 20276 // Initializers done
19982 } 20277 }
19983 lang_Type.prototype.is$lang_Type = function(){return this;}; 20278 lang_Type.prototype.is$lang_Type = function(){return this;};
19984 lang_Type.prototype.is$Named = function(){return this;}; 20279 lang_Type.prototype.is$Named = function(){return this;};
19985 lang_Type.prototype.get$name = function() { return this.name; }; 20280 lang_Type.prototype.get$name = function() { return this.name; };
20281 lang_Type.prototype.get$typeCheckCode = function() { return this.typeCheckCode; };
20282 lang_Type.prototype.set$typeCheckCode = function(value) { return this.typeCheckC ode = value; };
20283 lang_Type.prototype.get$varStubs = function() { return this.varStubs; };
20284 lang_Type.prototype.set$varStubs = function(value) { return this.varStubs = valu e; };
19986 lang_Type.prototype.markUsed = function() { 20285 lang_Type.prototype.markUsed = function() {
19987 20286
19988 } 20287 }
19989 lang_Type.prototype.get$typeMember = function() { 20288 lang_Type.prototype.get$typeMember = function() {
19990 var $0; 20289 var $0;
19991 if (this._typeMember == null) { 20290 if (this._typeMember == null) {
19992 this._typeMember = new TypeMember((this && this.is$DefinedType())); 20291 this._typeMember = new TypeMember((this && this.is$DefinedType()));
19993 } 20292 }
19994 return (($0 = this._typeMember) && $0.is$TypeMember()); 20293 return (($0 = this._typeMember) && $0.is$TypeMember());
19995 } 20294 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
20141 } 20440 }
20142 if ($eq(this, other)) return true; 20441 if ($eq(this, other)) return true;
20143 if ($notnull_bool(this.get$isVar())) return true; 20442 if ($notnull_bool(this.get$isVar())) return true;
20144 if ($notnull_bool(other.get$isVar())) return true; 20443 if ($notnull_bool(other.get$isVar())) return true;
20145 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true; 20444 if ($notnull_bool(other._isDirectSupertypeOf(this))) return true;
20146 var call = this.getCallMethod(); 20445 var call = this.getCallMethod();
20147 var otherCall = other.getCallMethod(); 20446 var otherCall = other.getCallMethod();
20148 if ($notnull_bool($ne(call, null) && $ne(otherCall, null))) { 20447 if ($notnull_bool($ne(call, null) && $ne(otherCall, null))) {
20149 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth erCall && otherCall.is$MethodMember())); 20448 return lang_Type._isFunctionSubtypeOf((call && call.is$MethodMember()), (oth erCall && otherCall.is$MethodMember()));
20150 } 20449 }
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) { 20450 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(); 20451 var t = this.get$typeArgsInOrder().iterator$0();
20153 var s = other.get$typeArgsInOrder().iterator$0(); 20452 var s = other.get$typeArgsInOrder().iterator$0();
20154 while ($notnull_bool(t.hasNext$0())) { 20453 while ($notnull_bool(t.hasNext$0())) {
20155 if (!$notnull_bool(t.next$0().isSubtypeOf$1(s.next$0()))) return false; 20454 if (!$notnull_bool(t.next$0().isSubtypeOf$1(s.next$0()))) return false;
20156 } 20455 }
20157 return true; 20456 return true;
20158 } 20457 }
20159 if ($notnull_bool(this.get$parent() != null && this.get$parent().isSubtypeOf(o ther))) { 20458 if ($notnull_bool(this.get$parent() != null && this.get$parent().isSubtypeOf(o ther))) {
20160 return true; 20459 return true;
20161 } 20460 }
20162 if (this.get$interfaces() != null && this.get$interfaces().some((function (i) { 20461 if (this.get$interfaces() != null && this.get$interfaces().some((function (i) {
20163 return i.isSubtypeOf$1(other); 20462 return i.isSubtypeOf$1(other);
20164 }) 20463 })
20165 )) { 20464 )) {
20166 return true; 20465 return true;
20167 } 20466 }
20168 return false; 20467 return false;
20169 } 20468 }
20170 lang_Type._isFunctionSubtypeOf = function(t, s) { 20469 lang_Type._isFunctionSubtypeOf = function(t, s) {
20171 if (!$notnull_bool(s.returnType.get$isVoid()) && !$notnull_bool(s.returnType.i sAssignable(t.returnType))) { 20470 if (!$notnull_bool(s.returnType.get$isVoid()) && !$notnull_bool(s.returnType.i sAssignable(t.returnType))) {
20172 return false; 20471 return false;
20173 } 20472 }
20174 var tp = t.parameters; 20473 var tp = t.parameters;
20175 var sp = s.parameters; 20474 var sp = s.parameters;
20176 if (tp.length < sp.length) return false; 20475 if (tp.length < $assert_num(sp.length)) return false;
20177 for (var i = 0; 20476 for (var i = 0;
20178 i < sp.length; i++) { 20477 i < $assert_num(sp.length); i++) {
20179 if ($ne(tp.$index(i).get$isOptional(), sp.$index(i).get$isOptional())) retur n false; 20478 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; 20479 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; 20480 if (!$notnull_bool(tp.$index(i).get$type().isAssignable$1(sp.$index(i).get$t ype()))) return false;
20182 } 20481 }
20183 if (tp.length > sp.length && !$notnull_bool(tp.$index(sp.length).get$isOptiona l())) return false; 20482 if (tp.length > $assert_num(sp.length) && !$notnull_bool(tp.$index(sp.length). get$isOptional())) return false;
20184 return true; 20483 return true;
20185 } 20484 }
20186 lang_Type.prototype.addDirectSubtype$1 = function($0) { 20485 lang_Type.prototype.addDirectSubtype$1 = function($0) {
20187 return this.addDirectSubtype(($0 && $0.is$lang_Type())); 20486 return this.addDirectSubtype(($0 && $0.is$lang_Type()));
20188 }; 20487 };
20189 lang_Type.prototype.ensureSubtypeOf$3 = function($0, $1, $2) { 20488 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)); 20489 return this.ensureSubtypeOf(($0 && $0.is$lang_Type()), ($1 && $1.is$SourceSpan ()), $assert_bool($2));
20191 }; 20490 };
20192 lang_Type.prototype.getConstructor$1 = function($0) { 20491 lang_Type.prototype.getConstructor$1 = function($0) {
20193 return this.getConstructor($assert_String($0)); 20492 return this.getConstructor($assert_String($0));
(...skipping 26 matching lines...) Expand all
20220 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); 20519 return this.resolveTypeParams(($0 && $0.is$ConcreteType()));
20221 }; 20520 };
20222 // ********** Code for ParameterType ************** 20521 // ********** Code for ParameterType **************
20223 function ParameterType(name, typeParameter) { 20522 function ParameterType(name, typeParameter) {
20224 this.typeParameter = typeParameter; 20523 this.typeParameter = typeParameter;
20225 lang_Type.call(this, name); 20524 lang_Type.call(this, name);
20226 // Initializers done 20525 // Initializers done
20227 } 20526 }
20228 $inherits(ParameterType, lang_Type); 20527 $inherits(ParameterType, lang_Type);
20229 ParameterType.prototype.is$ParameterType = function(){return this;}; 20528 ParameterType.prototype.is$ParameterType = function(){return this;};
20529 ParameterType.prototype.get$extendsType = function() { return this.extendsType; };
20530 ParameterType.prototype.set$extendsType = function(value) { return this.extendsT ype = value; };
20230 ParameterType.prototype.get$isClass = function() { 20531 ParameterType.prototype.get$isClass = function() {
20231 return false; 20532 return false;
20232 } 20533 }
20233 ParameterType.prototype.get$library = function() { 20534 ParameterType.prototype.get$library = function() {
20234 return null; 20535 return null;
20235 } 20536 }
20236 ParameterType.prototype.get$span = function() { 20537 ParameterType.prototype.get$span = function() {
20237 return this.typeParameter.span; 20538 return this.typeParameter.span;
20238 } 20539 }
20239 ParameterType.prototype.get$constructors = function() { 20540 ParameterType.prototype.get$constructors = function() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
20293 ParameterType.prototype.resolveTypeParams$1 = function($0) { 20594 ParameterType.prototype.resolveTypeParams$1 = function($0) {
20294 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); 20595 return this.resolveTypeParams(($0 && $0.is$ConcreteType()));
20295 }; 20596 };
20296 // ********** Code for NonNullableType ************** 20597 // ********** Code for NonNullableType **************
20297 function NonNullableType(type) { 20598 function NonNullableType(type) {
20298 this.type = type; 20599 this.type = type;
20299 lang_Type.call(this, type.name); 20600 lang_Type.call(this, type.name);
20300 // Initializers done 20601 // Initializers done
20301 } 20602 }
20302 $inherits(NonNullableType, lang_Type); 20603 $inherits(NonNullableType, lang_Type);
20604 NonNullableType.prototype.get$type = function() { return this.type; };
20303 NonNullableType.prototype.get$isNullable = function() { 20605 NonNullableType.prototype.get$isNullable = function() {
20304 return false; 20606 return false;
20305 } 20607 }
20306 NonNullableType.prototype.get$isBool = function() { 20608 NonNullableType.prototype.get$isBool = function() {
20307 return this.type.get$isBool(); 20609 return this.type.get$isBool();
20308 } 20610 }
20309 NonNullableType.prototype.get$isUsed = function() { 20611 NonNullableType.prototype.get$isUsed = function() {
20310 return false; 20612 return false;
20311 } 20613 }
20312 NonNullableType.prototype.isSubtypeOf = function(other) { 20614 NonNullableType.prototype.isSubtypeOf = function(other) {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
20523 ConcreteType.prototype.getFactory = function(type, constructorName) { 20825 ConcreteType.prototype.getFactory = function(type, constructorName) {
20524 return this.genericType.getFactory(type, constructorName); 20826 return this.genericType.getFactory(type, constructorName);
20525 } 20827 }
20526 ConcreteType.prototype.getConstructor = function(constructorName) { 20828 ConcreteType.prototype.getConstructor = function(constructorName) {
20527 var ret = this.constructors.$index(constructorName); 20829 var ret = this.constructors.$index(constructorName);
20528 if ($notnull_bool($ne(ret, null))) return ret; 20830 if ($notnull_bool($ne(ret, null))) return ret;
20529 ret = this.factories.getFactory(this.name, constructorName); 20831 ret = this.factories.getFactory(this.name, constructorName);
20530 if ($notnull_bool($ne(ret, null))) return ret; 20832 if ($notnull_bool($ne(ret, null))) return ret;
20531 var genericMember = this.genericType.getConstructor(constructorName); 20833 var genericMember = this.genericType.getConstructor(constructorName);
20532 if ($notnull_bool(genericMember == null)) return null; 20834 if ($notnull_bool(genericMember == null)) return null;
20533 if ($ne(genericMember.declaringType, this.genericType)) { 20835 if ($notnull_bool($ne(genericMember.get$declaringType(), this.genericType))) {
20534 if (!$notnull_bool(genericMember.declaringType.get$isGeneric())) return gene ricMember; 20836 if (!$notnull_bool(genericMember.get$declaringType().get$isGeneric())) retur n genericMember;
20535 var newDeclaringType = genericMember.declaringType.getOrMakeConcreteType(thi s.typeArgsInOrder); 20837 var newDeclaringType = genericMember.get$declaringType().getOrMakeConcreteTy pe$1(this.typeArgsInOrder);
20536 var factory = newDeclaringType.getFactory$2(this.genericType, constructorNam e); 20838 var factory = newDeclaringType.getFactory$2(this.genericType, constructorNam e);
20537 if (factory != null) return factory; 20839 if (factory != null) return factory;
20538 return newDeclaringType.getConstructor$1(constructorName); 20840 return newDeclaringType.getConstructor$1(constructorName);
20539 } 20841 }
20540 if ($notnull_bool(genericMember.get$isFactory())) { 20842 if ($notnull_bool(genericMember.get$isFactory())) {
20541 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gen ericMember); 20843 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gen ericMember);
20542 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member( ))); 20844 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member( )));
20543 } 20845 }
20544 else { 20846 else {
20545 ret = new ConcreteMember(this.name, this, genericMember); 20847 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) { 21032 DefinedType.prototype.genMethod = function(method) {
20731 if ($notnull_bool(this.isUsed)) { 21033 if ($notnull_bool(this.isUsed)) {
20732 world.gen.genMethod(method); 21034 world.gen.genMethod(method);
20733 } 21035 }
20734 else if ($notnull_bool(this.isClass)) { 21036 else if ($notnull_bool(this.isClass)) {
20735 if (this._lazyGenMethods == null) this._lazyGenMethods = $map([]); 21037 if (this._lazyGenMethods == null) this._lazyGenMethods = $map([]);
20736 this._lazyGenMethods.$setindex(method.name, method); 21038 this._lazyGenMethods.$setindex(method.name, method);
20737 } 21039 }
20738 } 21040 }
20739 DefinedType.prototype._resolveInterfaces = function(types) { 21041 DefinedType.prototype._resolveInterfaces = function(types) {
21042 var $0;
20740 if (types == null) return []; 21043 if (types == null) return [];
20741 var interfaces = []; 21044 var interfaces = [];
20742 for (var $i = 0;$i < types.length; $i++) { 21045 for (var $i = 0;$i < types.length; $i++) {
20743 var type = types.$index($i); 21046 var type = types.$index($i);
20744 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true); 21047 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())))) { 21048 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()); 21049 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', (($0 = type.get$span()) && $0.is$Source Span()));
20747 } 21050 }
20748 resolvedInterface.addDirectSubtype$1(this); 21051 resolvedInterface.addDirectSubtype$1(this);
20749 interfaces.add$1(resolvedInterface); 21052 interfaces.add$1(resolvedInterface);
20750 } 21053 }
20751 return (interfaces && interfaces.is$List$Type()); 21054 return (interfaces && interfaces.is$List$Type());
20752 } 21055 }
20753 DefinedType.prototype.addDirectSubtype = function(type) { 21056 DefinedType.prototype.addDirectSubtype = function(type) {
20754 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 746, 12); 21057 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 746, 12);
20755 this.directSubtypes.add(type); 21058 this.directSubtypes.add(type);
20756 } 21059 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
20809 return -1; 21112 return -1;
20810 } 21113 }
20811 DefinedType.prototype.resolve = function() { 21114 DefinedType.prototype.resolve = function() {
20812 var $this = this; // closure support 21115 var $this = this; // closure support
20813 var $0; 21116 var $0;
20814 if ((this.definition instanceof TypeDefinition)) { 21117 if ((this.definition instanceof TypeDefinition)) {
20815 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition()); 21118 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition());
20816 if ($notnull_bool(this.isClass)) { 21119 if ($notnull_bool(this.isClass)) {
20817 if (typeDef.extendsTypes != null && typeDef.extendsTypes.length > 0) { 21120 if (typeDef.extendsTypes != null && typeDef.extendsTypes.length > 0) {
20818 if (typeDef.extendsTypes.length > 1) { 21121 if (typeDef.extendsTypes.length > 1) {
20819 world.error('more than one base class', typeDef.extendsTypes.$index(1) .get$span()); 21122 world.error('more than one base class', (($0 = typeDef.extendsTypes.$i ndex(1).get$span()) && $0.is$SourceSpan()));
20820 } 21123 }
20821 var extendsTypeRef = typeDef.extendsTypes.$index(0); 21124 var extendsTypeRef = typeDef.extendsTypes.$index(0);
20822 if ((extendsTypeRef instanceof GenericTypeReference)) { 21125 if ((extendsTypeRef instanceof GenericTypeReference)) {
20823 var g = (extendsTypeRef && extendsTypeRef.is$GenericTypeReference()); 21126 var g = (extendsTypeRef && extendsTypeRef.is$GenericTypeReference());
20824 this.set$parent(this.resolveType(g.baseType, true)); 21127 this.set$parent(this.resolveType(g.baseType, true));
20825 } 21128 }
20826 this.set$parent(this.resolveType((extendsTypeRef && extendsTypeRef.is$Ty peReference()), true)); 21129 this.set$parent(this.resolveType((extendsTypeRef && extendsTypeRef.is$Ty peReference()), true));
20827 if (!$notnull_bool(this.get$parent().get$isClass())) { 21130 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()); 21131 world.error('class may not extend an interface - use implements', (($0 = typeDef.extendsTypes.$index(0).get$span()) && $0.is$SourceSpan()));
20829 } 21132 }
20830 this.get$parent().addDirectSubtype(this); 21133 this.get$parent().addDirectSubtype(this);
20831 if ($notnull_bool(this._cycleInClassExtends())) { 21134 if ($notnull_bool(this._cycleInClassExtends())) {
20832 world.error(('class "' + this.name + '" has a cycle in its inheritance chain'), extendsTypeRef.get$span()); 21135 world.error(('class "' + this.name + '" has a cycle in its inheritance chain'), (($0 = extendsTypeRef.get$span()) && $0.is$SourceSpan()));
20833 } 21136 }
20834 } 21137 }
20835 else { 21138 else {
20836 if (!$notnull_bool(this.get$isObject())) { 21139 if (!$notnull_bool(this.get$isObject())) {
20837 this.set$parent(world.objectType); 21140 this.set$parent(world.objectType);
20838 this.get$parent().addDirectSubtype(this); 21141 this.get$parent().addDirectSubtype(this);
20839 } 21142 }
20840 } 21143 }
20841 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); 21144 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes);
20842 if (typeDef.factoryType != null) { 21145 if (typeDef.factoryType != null) {
20843 world.error('factory not allowed on classes', typeDef.factoryType.span); 21146 world.error('factory not allowed on classes', typeDef.factoryType.span);
20844 } 21147 }
20845 } 21148 }
20846 else { 21149 else {
20847 if (typeDef.implementsTypes != null && typeDef.implementsTypes.length > 0) { 21150 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()); 21151 world.error('implements not allowed on interfaces (use extends)', (($0 = typeDef.implementsTypes.$index(0).get$span()) && $0.is$SourceSpan()));
20849 } 21152 }
20850 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes); 21153 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes);
20851 var res = this._cycleInInterfaceExtends(); 21154 var res = this._cycleInInterfaceExtends();
20852 if (res >= 0) { 21155 if (res >= 0) {
20853 world.error(('interface "' + this.name + '" has a cycle in its inheritan ce chain'), typeDef.extendsTypes.$index(res).get$span()); 21156 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 } 21157 }
20855 if (typeDef.factoryType != null) { 21158 if (typeDef.factoryType != null) {
20856 this.factory_ = this.resolveType(typeDef.factoryType, true); 21159 this.factory_ = this.resolveType(typeDef.factoryType, true);
20857 if (this.factory_ == null) { 21160 if (this.factory_ == null) {
20858 world.warning('unresolved factory', typeDef.factoryType.span); 21161 world.warning('unresolved factory', typeDef.factoryType.span);
20859 } 21162 }
20860 } 21163 }
20861 } 21164 }
20862 } 21165 }
20863 else if ((this.definition instanceof FunctionTypeDefinition)) { 21166 else if ((this.definition instanceof FunctionTypeDefinition)) {
(...skipping 26 matching lines...) Expand all
20890 if (methodName == null) methodName = definition.name.name; 21193 if (methodName == null) methodName = definition.name.name;
20891 var method = new MethodMember(methodName, this, definition); 21194 var method = new MethodMember(methodName, this, definition);
20892 if ($notnull_bool(method.get$isConstructor())) { 21195 if ($notnull_bool(method.get$isConstructor())) {
20893 if (this.constructors.containsKey(method.get$constructorName())) { 21196 if (this.constructors.containsKey(method.get$constructorName())) {
20894 world.error(('duplicate constructor definition of ' + method.get$name() + ''), definition.span); 21197 world.error(('duplicate constructor definition of ' + method.get$name() + ''), definition.span);
20895 return; 21198 return;
20896 } 21199 }
20897 this.constructors.$setindex(method.get$constructorName(), method); 21200 this.constructors.$setindex(method.get$constructorName(), method);
20898 return; 21201 return;
20899 } 21202 }
20900 if ($notnull_bool(definition.modifiers != null && definition.modifiers.length == 1 && $eq(definition.modifiers.$index(0).kind, 75/*TokenKind.FACTORY*/))) { 21203 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) { 21204 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); 21205 world.error(('duplicate factory definition of "' + method.get$name() + '"' ), definition.span);
20903 return; 21206 return;
20904 } 21207 }
20905 this.factories.addFactory(method.get$constructorName(), $assert_String(metho d.get$name()), (method && method.is$Member())); 21208 this.factories.addFactory($assert_String(method.get$constructorName()), $ass ert_String(method.get$name()), (method && method.is$Member()));
20906 return; 21209 return;
20907 } 21210 }
20908 if (methodName.startsWith('get\$') || methodName.startsWith('set\$')) { 21211 if (methodName.startsWith('get\$') || methodName.startsWith('set\$')) {
20909 var propName = methodName.substring(4); 21212 var propName = methodName.substring(4);
20910 var prop = this.members.$index(propName); 21213 var prop = this.members.$index(propName);
20911 if ($notnull_bool(prop == null)) { 21214 if ($notnull_bool(prop == null)) {
20912 prop = new PropertyMember($assert_String(propName), this); 21215 prop = new PropertyMember($assert_String(propName), this);
20913 this.members.$setindex(propName, prop); 21216 this.members.$setindex(propName, prop);
20914 } 21217 }
20915 if (!(prop instanceof PropertyMember)) { 21218 if (!(prop instanceof PropertyMember)) {
20916 world.error(('property conflicts with field "' + propName + '"'), definiti on.span); 21219 world.error(('property conflicts with field "' + propName + '"'), definiti on.span);
20917 return; 21220 return;
20918 } 21221 }
20919 if (methodName[0] == 'g') { 21222 if (methodName[0] == 'g') {
20920 if (prop.getter != null) { 21223 if ($notnull_bool($ne(prop.get$getter(), null))) {
20921 world.error(('duplicate getter definition for "' + propName + '"'), defi nition.span); 21224 world.error(('duplicate getter definition for "' + propName + '"'), defi nition.span);
20922 } 21225 }
20923 prop.getter = (method && method.is$MethodMember()); 21226 prop.set$getter(method);
20924 } 21227 }
20925 else { 21228 else {
20926 if (prop.setter != null) { 21229 if ($notnull_bool($ne(prop.get$setter(), null))) {
20927 world.error(('duplicate setter definition for "' + propName + '"'), defi nition.span); 21230 world.error(('duplicate setter definition for "' + propName + '"'), defi nition.span);
20928 } 21231 }
20929 prop.setter = (method && method.is$MethodMember()); 21232 prop.set$setter(method);
20930 } 21233 }
20931 return; 21234 return;
20932 } 21235 }
20933 if (this.members.containsKey(methodName)) { 21236 if (this.members.containsKey(methodName)) {
20934 world.error(('duplicate method definition of "' + method.get$name() + '"'), definition.span); 21237 world.error(('duplicate method definition of "' + method.get$name() + '"'), definition.span);
20935 return; 21238 return;
20936 } 21239 }
20937 this.members.$setindex(methodName, method); 21240 this.members.$setindex(methodName, method);
20938 } 21241 }
20939 DefinedType.prototype.addField = function(definition) { 21242 DefinedType.prototype.addField = function(definition) {
20940 for (var i = 0; 21243 for (var i = 0;
20941 i < definition.names.length; i++) { 21244 i < definition.names.length; i++) {
20942 var name = definition.names.$index(i).get$name(); 21245 var name = definition.names.$index(i).get$name();
20943 if (this.members.containsKey(name)) { 21246 if (this.members.containsKey(name)) {
20944 world.error(('duplicate field definition of "' + name + '"'), definition.s pan); 21247 world.error(('duplicate field definition of "' + name + '"'), definition.s pan);
20945 return; 21248 return;
20946 } 21249 }
20947 var value = null; 21250 var value = null;
20948 if (definition.values != null) { 21251 if (definition.values != null) {
20949 value = definition.values.$index(i); 21252 value = definition.values.$index(i);
20950 } 21253 }
20951 var field = new FieldMember($assert_String(name), this, definition, value); 21254 var field = new FieldMember($assert_String(name), this, definition, value);
20952 this.members.$setindex(name, field); 21255 this.members.$setindex(name, field);
20953 if ($notnull_bool(this.isNativeType)) { 21256 if ($notnull_bool(this.isNativeType)) {
20954 field.isNative = true; 21257 field.set$isNative(true);
20955 } 21258 }
20956 } 21259 }
20957 } 21260 }
20958 DefinedType.prototype.getFactory = function(type, constructorName) { 21261 DefinedType.prototype.getFactory = function(type, constructorName) {
20959 var ret = this.factories.getFactory(type.name, constructorName); 21262 var ret = this.factories.getFactory(type.name, constructorName);
20960 if ($notnull_bool($ne(ret, null))) return ret; 21263 if ($notnull_bool($ne(ret, null))) return ret;
20961 ret = this.factories.getFactory(this.name, constructorName); 21264 ret = this.factories.getFactory(this.name, constructorName);
20962 if ($notnull_bool($ne(ret, null))) return ret; 21265 if ($notnull_bool($ne(ret, null))) return ret;
20963 ret = this.constructors.$index(constructorName); 21266 ret = this.constructors.$index(constructorName);
20964 if ($notnull_bool($ne(ret, null))) return ret; 21267 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))) { 21308 if ($notnull_bool($ne(parentMember, null))) {
21006 if (!$notnull_bool(member.get$isPrivate()) || $eq(member.get$library(), pa rentMember.get$library())) { 21309 if (!$notnull_bool(member.get$isPrivate()) || $eq(member.get$library(), pa rentMember.get$library())) {
21007 member.override(parentMember); 21310 member.override(parentMember);
21008 } 21311 }
21009 } 21312 }
21010 return member; 21313 return member;
21011 } 21314 }
21012 if ($notnull_bool(this.get$isTop())) { 21315 if ($notnull_bool(this.get$isTop())) {
21013 var libType = this.library.findTypeByName(memberName); 21316 var libType = this.library.findTypeByName(memberName);
21014 if ($notnull_bool($ne(libType, null))) { 21317 if ($notnull_bool($ne(libType, null))) {
21015 return libType.get$typeMember(); 21318 return (($0 = libType.get$typeMember()) && $0.is$Member());
21016 } 21319 }
21017 } 21320 }
21018 return this.getMemberInParents(memberName); 21321 return this.getMemberInParents(memberName);
21019 } 21322 }
21020 DefinedType.prototype.getMemberInParents = function(memberName) { 21323 DefinedType.prototype.getMemberInParents = function(memberName) {
21021 if ($notnull_bool(this.isClass)) { 21324 if ($notnull_bool(this.isClass)) {
21022 if (this.get$parent() != null) { 21325 if (this.get$parent() != null) {
21023 return this.get$parent().getMember(memberName); 21326 return this.get$parent().getMember(memberName);
21024 } 21327 }
21025 else if ($notnull_bool(this.get$isObject())) { 21328 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); 21450 world.error(('' + baseType.get$name() + ' is not generic'), typeRef.span);
21148 return null; 21451 return null;
21149 } 21452 }
21150 if (typeRef.typeArguments.length != baseType.get$typeParameters().length) { 21453 if (typeRef.typeArguments.length != baseType.get$typeParameters().length) {
21151 world.error('wrong number of type arguments', typeRef.span); 21454 world.error('wrong number of type arguments', typeRef.span);
21152 return null; 21455 return null;
21153 } 21456 }
21154 var typeArgs = []; 21457 var typeArgs = [];
21155 for (var i = 0; 21458 for (var i = 0;
21156 i < typeRef.typeArguments.length; i++) { 21459 i < typeRef.typeArguments.length; i++) {
21157 var extendsType = baseType.get$typeParameters().$index(i).extendsType; 21460 var extendsType = baseType.get$typeParameters().$index(i).get$extendsType( );
21158 var typeArg = this.resolveType((($0 = typeRef.typeArguments.$index(i)) && $0.is$TypeReference()), typeErrors); 21461 var typeArg = this.resolveType((($0 = typeRef.typeArguments.$index(i)) && $0.is$TypeReference()), typeErrors);
21159 typeArgs.add$1(typeArg); 21462 typeArgs.add$1(typeArg);
21160 if ($notnull_bool($ne(extendsType, null) && !(typeArg instanceof Parameter Type))) { 21463 if ($notnull_bool($ne(extendsType, null) && !(typeArg instanceof Parameter Type))) {
21161 typeArg.ensureSubtypeOf$3(extendsType, typeRef.typeArguments.$index(i).g et$span(), typeErrors); 21464 typeArg.ensureSubtypeOf$3(extendsType, typeRef.typeArguments.$index(i).g et$span(), typeErrors);
21162 } 21465 }
21163 } 21466 }
21164 typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs); 21467 typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs);
21165 } 21468 }
21166 else if ((node instanceof FunctionTypeReference)) { 21469 else if ((node instanceof FunctionTypeReference)) {
21167 var typeRef = (node && node.is$FunctionTypeReference()); 21470 var typeRef = (node && node.is$FunctionTypeReference());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
21259 FixedCollection.prototype.filter = function(f) { 21562 FixedCollection.prototype.filter = function(f) {
21260 return Collections.filter(this, new ListFactory(), f); 21563 return Collections.filter(this, new ListFactory(), f);
21261 } 21564 }
21262 FixedCollection.prototype.some = function(f) { 21565 FixedCollection.prototype.some = function(f) {
21263 return Collections.some(this, f); 21566 return Collections.some(this, f);
21264 } 21567 }
21265 FixedCollection.prototype.isEmpty = function() { 21568 FixedCollection.prototype.isEmpty = function() {
21266 return this.length == 0; 21569 return this.length == 0;
21267 } 21570 }
21268 FixedCollection.prototype.filter$1 = FixedCollection.prototype.filter; 21571 FixedCollection.prototype.filter$1 = FixedCollection.prototype.filter;
21572 FixedCollection.prototype.forEach$1 = FixedCollection.prototype.forEach;
21269 FixedCollection.prototype.isEmpty$0 = function() { 21573 FixedCollection.prototype.isEmpty$0 = function() {
21270 return this.isEmpty(); 21574 return this.isEmpty();
21271 }; 21575 };
21272 FixedCollection.prototype.iterator$0 = function() { 21576 FixedCollection.prototype.iterator$0 = function() {
21273 return this.iterator(); 21577 return this.iterator();
21274 }; 21578 };
21275 FixedCollection.prototype.some$1 = FixedCollection.prototype.some; 21579 FixedCollection.prototype.some$1 = FixedCollection.prototype.some;
21276 // ********** Code for FixedCollection$Type ************** 21580 // ********** Code for FixedCollection$Type **************
21277 function FixedCollection$Type(value, length) { 21581 function FixedCollection$Type(value, length) {
21278 this.value = value; 21582 this.value = value;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
21320 this.isSuper = false 21624 this.isSuper = false
21321 this.isType = false 21625 this.isType = false
21322 this.type = type; 21626 this.type = type;
21323 this.code = code; 21627 this.code = code;
21324 this.span = span; 21628 this.span = span;
21325 this.needsTemp = needsTemp; 21629 this.needsTemp = needsTemp;
21326 // Initializers done 21630 // Initializers done
21327 if (this.type == null) world.internalError('type passed as null', this.span); 21631 if (this.type == null) world.internalError('type passed as null', this.span);
21328 } 21632 }
21329 Value.prototype.is$Value = function(){return this;}; 21633 Value.prototype.is$Value = function(){return this;};
21634 Value.prototype.get$type = function() { return this.type; };
21635 Value.prototype.set$type = function(value) { return this.type = value; };
21636 Value.prototype.get$code = function() { return this.code; };
21637 Value.prototype.set$code = function(value) { return this.code = value; };
21330 Value.prototype.get$span = function() { return this.span; }; 21638 Value.prototype.get$span = function() { return this.span; };
21331 Value.prototype.set$span = function(value) { return this.span = value; }; 21639 Value.prototype.set$span = function(value) { return this.span = value; };
21640 Value.prototype.get$isSuper = function() { return this.isSuper; };
21641 Value.prototype.set$isSuper = function(value) { return this.isSuper = value; };
21642 Value.prototype.get$isType = function() { return this.isType; };
21643 Value.prototype.set$isType = function(value) { return this.isType = value; };
21644 Value.prototype.get$needsTemp = function() { return this.needsTemp; };
21645 Value.prototype.set$needsTemp = function(value) { return this.needsTemp = value; };
21332 Value.prototype.get$_typeIsVarOrParameterType = function() { 21646 Value.prototype.get$_typeIsVarOrParameterType = function() {
21333 return $notnull_bool(this.type.get$isVar() || (this.type instanceof ParameterT ype)); 21647 return $notnull_bool(this.type.get$isVar() || (this.type instanceof ParameterT ype));
21334 } 21648 }
21335 Value.prototype.get$isConst = function() { 21649 Value.prototype.get$isConst = function() {
21336 return false; 21650 return false;
21337 } 21651 }
21338 Value.prototype.get$canonicalCode = function() { 21652 Value.prototype.get$canonicalCode = function() {
21339 return null; 21653 return null;
21340 } 21654 }
21341 Value.prototype.get_ = function(context, name, node) { 21655 Value.prototype.get_ = function(context, name, node) {
(...skipping 14 matching lines...) Expand all
21356 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value])); 21670 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value]));
21357 } 21671 }
21358 } 21672 }
21359 Value.prototype.invoke = function(context, name, node, args, isDynamic) { 21673 Value.prototype.invoke = function(context, name, node, args, isDynamic) {
21360 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) { 21674 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) {
21361 if (args.values.length != 1) { 21675 if (args.values.length != 1) {
21362 world.warning('wrong number of arguments for !=', node.span); 21676 world.warning('wrong number of arguments for !=', node.span);
21363 } 21677 }
21364 var eq = this.invoke(context, '\$eq', node, args, isDynamic); 21678 var eq = this.invoke(context, '\$eq', node, args, isDynamic);
21365 world.gen.corejs.useOperator('\$ne'); 21679 world.gen.corejs.useOperator('\$ne');
21366 return new Value(eq.type, ('\$ne(' + this.code + ', ' + args.values.$index(0 ).code + ')'), node.span, true); 21680 return new Value(eq.get$type(), ('\$ne(' + this.code + ', ' + args.values.$i ndex(0).get$code() + ')'), node.span, true);
21367 } 21681 }
21368 if (name == '\$call') { 21682 if (name == '\$call') {
21369 if ($notnull_bool(this.isType)) { 21683 if ($notnull_bool(this.isType)) {
21370 world.error('must use "new" or "const" to construct a new instance', node. span); 21684 world.error('must use "new" or "const" to construct a new instance', node. span);
21371 } 21685 }
21372 if ($notnull_bool(this.type.needsVarCall(args))) { 21686 if ($notnull_bool(this.type.needsVarCall(args))) {
21373 return this._varCall(context, args); 21687 return this._varCall(context, args);
21374 } 21688 }
21375 } 21689 }
21376 var member = this._resolveMember(context, name, node, isDynamic); 21690 var member = this._resolveMember(context, name, node, isDynamic);
(...skipping 10 matching lines...) Expand all
21387 } 21701 }
21388 if ($notnull_bool(this.type.get$isVarOrFunction() && name == '\$call')) { 21702 if ($notnull_bool(this.type.get$isVarOrFunction() && name == '\$call')) {
21389 return true; 21703 return true;
21390 } 21704 }
21391 var member = this._resolveMember(context, name, null, true); 21705 var member = this._resolveMember(context, name, null, true);
21392 return $notnull_bool($ne(member, null) && member.canInvoke$2(context, args)); 21706 return $notnull_bool($ne(member, null) && member.canInvoke$2(context, args));
21393 } 21707 }
21394 Value.prototype._hasOverriddenNoSuchMethod = function() { 21708 Value.prototype._hasOverriddenNoSuchMethod = function() {
21395 if ($notnull_bool(this.isSuper)) { 21709 if ($notnull_bool(this.isSuper)) {
21396 var m = this.type.getMember('noSuchMethod'); 21710 var m = this.type.getMember('noSuchMethod');
21397 return $notnull_bool($ne(m, null) && !$notnull_bool(m.declaringType.get$isOb ject())); 21711 return $notnull_bool($ne(m, null) && !$notnull_bool(m.get$declaringType().ge t$isObject()));
21398 } 21712 }
21399 else { 21713 else {
21400 return this.type.resolveMember('noSuchMethod').members.length > 1; 21714 return this.type.resolveMember('noSuchMethod').members.length > 1;
21401 } 21715 }
21402 } 21716 }
21403 Value.prototype._tryResolveMember = function(context, name) { 21717 Value.prototype._tryResolveMember = function(context, name) {
21404 if ($notnull_bool(this.isSuper)) { 21718 if ($notnull_bool(this.isSuper)) {
21405 return this.type.getMember(name); 21719 return this.type.getMember(name);
21406 } 21720 }
21407 else { 21721 else {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
21442 world.error('Types are not first class', span); 21756 world.error('Types are not first class', span);
21443 } 21757 }
21444 } 21758 }
21445 Value.prototype._varCall = function(context, args) { 21759 Value.prototype._varCall = function(context, args) {
21446 var stub = world.functionType.getCallStub(args); 21760 var stub = world.functionType.getCallStub(args);
21447 return new Value(world.varType, ('' + this.code + '.' + stub.get$name() + '(' + args.getCode() + ')'), this.span, true); 21761 return new Value(world.varType, ('' + this.code + '.' + stub.get$name() + '(' + args.getCode() + ')'), this.span, true);
21448 } 21762 }
21449 Value.prototype.needsConversion = function(toType) { 21763 Value.prototype.needsConversion = function(toType) {
21450 var callMethod = toType.getCallMethod(); 21764 var callMethod = toType.getCallMethod();
21451 if ($notnull_bool($ne(callMethod, null))) { 21765 if ($notnull_bool($ne(callMethod, null))) {
21452 var arity = callMethod.get$parameters().length; 21766 var arity = $assert_num(callMethod.get$parameters().length);
21453 var myCall = this.type.getCallMethod(); 21767 var myCall = this.type.getCallMethod();
21454 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) { 21768 if ($notnull_bool(myCall == null || $ne(myCall.get$parameters().length, arit y))) {
21455 return true; 21769 return true;
21456 } 21770 }
21457 } 21771 }
21458 if ($notnull_bool(options.enableTypeChecks)) { 21772 if ($notnull_bool(options.enableTypeChecks)) {
21459 var fromType = this.type; 21773 var fromType = this.type;
21460 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { 21774 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) {
21461 fromType = world.objectType; 21775 fromType = world.objectType;
21462 } 21776 }
21463 var bothNum = $notnull_bool(this.type.get$isNum() && toType.get$isNum()); 21777 var bothNum = $notnull_bool(this.type.get$isNum() && toType.get$isNum());
21464 return $notnull_bool(fromType.isSubtypeOf(toType) || bothNum); 21778 return $notnull_bool(fromType.isSubtypeOf(toType) || bothNum);
21465 } 21779 }
21466 return false; 21780 return false;
21467 } 21781 }
21468 Value.prototype.convertTo = function(context, toType, node, isDynamic) { 21782 Value.prototype.convertTo = function(context, toType, node, isDynamic) {
21469 var $0; 21783 var $0;
21470 var checked = !$notnull_bool(isDynamic); 21784 var checked = !$notnull_bool(isDynamic);
21471 var callMethod = toType.getCallMethod(); 21785 var callMethod = toType.getCallMethod();
21472 if ($notnull_bool($ne(callMethod, null))) { 21786 if ($notnull_bool($ne(callMethod, null))) {
21473 if ($notnull_bool(checked && !$notnull_bool(toType.isAssignable(this.type))) ) { 21787 if ($notnull_bool(checked && !$notnull_bool(toType.isAssignable(this.type))) ) {
21474 this.convertWarning(toType, node); 21788 this.convertWarning(toType, node);
21475 } 21789 }
21476 var arity = callMethod.get$parameters().length; 21790 var arity = $assert_num(callMethod.get$parameters().length);
21477 var myCall = this.type.getCallMethod(); 21791 var myCall = this.type.getCallMethod();
21478 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) { 21792 if ($notnull_bool(myCall == null || $ne(myCall.get$parameters().length, arit y))) {
21479 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory (arity)); 21793 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory (arity));
21480 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), node.span, true); 21794 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()); 21795 return (($0 = $notnull_bool(this._isDomCallback(toType) && !$notnull_bool( this._isDomCallback(this.type))) ? val._wrapDomCallback(toType, arity) : val) && $0.is$Value());
21482 } 21796 }
21483 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i sDomCallback(this.type)))) { 21797 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i sDomCallback(this.type)))) {
21484 return this._wrapDomCallback(toType, arity); 21798 return this._wrapDomCallback(toType, arity);
21485 } 21799 }
21486 } 21800 }
21487 var fromType = this.type; 21801 var fromType = this.type;
21488 if ($notnull_bool(this.type.get$isVar() && (this.code != 'null' || !$notnull_b ool(toType.get$isNullable())))) { 21802 if ($notnull_bool(this.type.get$isVar() && (this.code != 'null' || !$notnull_b ool(toType.get$isNullable())))) {
21489 fromType = world.objectType; 21803 fromType = world.objectType;
21490 } 21804 }
21491 var bothNum = $notnull_bool(this.type.get$isNum() && toType.get$isNum()); 21805 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)) { 21806 if ($notnull_bool($notnull_bool(!$notnull_bool(checked) || fromType.isSubtypeO f(toType)) || bothNum)) {
21493 return this; 21807 return this;
21494 } 21808 }
21495 if ($notnull_bool(checked && !$notnull_bool(toType.isSubtypeOf(this.type)))) { 21809 if ($notnull_bool(checked && !$notnull_bool(toType.isSubtypeOf(this.type)))) {
21496 this.convertWarning(toType, node); 21810 this.convertWarning(toType, node);
21497 } 21811 }
21498 if ($notnull_bool(options.enableTypeChecks)) { 21812 if ($notnull_bool(options.enableTypeChecks)) {
21499 return this._typeAssert(context, toType, node); 21813 return this._typeAssert(context, toType, node);
21500 } 21814 }
21501 else { 21815 else {
21502 return this; 21816 return this;
21503 } 21817 }
21504 } 21818 }
21505 Value.prototype._isDomCallback = function(toType) { 21819 Value.prototype._isDomCallback = function(toType) {
21506 return ((toType.get$definition() instanceof FunctionTypeDefinition) && $eq(toT ype.get$library(), world.get$dom())); 21820 return ($notnull_bool((toType.get$definition() instanceof FunctionTypeDefiniti on) && $eq(toType.get$library(), world.get$dom())));
21507 } 21821 }
21508 Value.prototype._wrapDomCallback = function(toType, arity) { 21822 Value.prototype._wrapDomCallback = function(toType, arity) {
21509 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, true); 21823 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, true);
21510 } 21824 }
21511 Value.prototype._typeAssert = function(context, toType, node) { 21825 Value.prototype._typeAssert = function(context, toType, node) {
21512 if ((toType instanceof ParameterType)) { 21826 if ((toType instanceof ParameterType)) {
21513 var p = (toType && toType.is$ParameterType()); 21827 var p = (toType && toType.is$ParameterType());
21514 toType = p.extendsType; 21828 toType = p.extendsType;
21515 } 21829 }
21516 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) { 21830 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)) { 21845 else if ($notnull_bool(toType.get$library().get$isCore() && toType.get$typeofN ame() != null)) {
21532 check = ('\$assert_' + toType.name + '(' + this.code + ')'); 21846 check = ('\$assert_' + toType.name + '(' + this.code + ')');
21533 if (toType.typeCheckCode == null) { 21847 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}"); 21848 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 } 21849 }
21536 } 21850 }
21537 else { 21851 else {
21538 toType.isTested = true; 21852 toType.isTested = true;
21539 var temp = context.getTemp(this); 21853 var temp = context.getTemp(this);
21540 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); 21854 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&');
21541 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); 21855 check = check + (' ' + temp.get$code() + '.is\$' + toType.get$jsname() + '() )');
21542 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value())); 21856 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value()));
21543 } 21857 }
21544 return new Value(toType, check, this.span, true); 21858 return new Value(toType, check, this.span, true);
21545 } 21859 }
21546 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) { 21860 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) {
21547 if ($notnull_bool(toType.get$isVar())) { 21861 if ($notnull_bool(toType.get$isVar())) {
21548 world.error('can not resolve type', span); 21862 world.error('can not resolve type', span);
21549 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true' , null); 21863 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true' , null);
21550 } 21864 }
21551 if ((toType instanceof ParameterType)) { 21865 if ((toType instanceof ParameterType)) {
(...skipping 10 matching lines...) Expand all
21562 toType.markUsed(); 21876 toType.markUsed();
21563 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); 21877 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')');
21564 if (!$notnull_bool(isTrue)) { 21878 if (!$notnull_bool(isTrue)) {
21565 testCode = '!' + testCode; 21879 testCode = '!' + testCode;
21566 } 21880 }
21567 } 21881 }
21568 if (testCode == null) { 21882 if (testCode == null) {
21569 toType.isTested = true; 21883 toType.isTested = true;
21570 var temp = context.getTemp(this); 21884 var temp = context.getTemp(this);
21571 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); 21885 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&');
21572 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')' ); 21886 testCode = testCode + (' ' + temp.get$code() + '.is\$' + toType.get$jsname() + ')');
21573 if ($notnull_bool(isTrue)) { 21887 if ($notnull_bool(isTrue)) {
21574 testCode = '!!' + testCode; 21888 testCode = '!!' + testCode;
21575 } 21889 }
21576 else { 21890 else {
21577 testCode = '!' + testCode; 21891 testCode = '!' + testCode;
21578 } 21892 }
21579 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value())); 21893 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value()));
21580 } 21894 }
21581 return new Value(world.nonNullBool, testCode, span, true); 21895 return new Value(world.nonNullBool, testCode, span, true);
21582 } 21896 }
21583 Value.prototype.convertWarning = function(toType, node) { 21897 Value.prototype.convertWarning = function(toType, node) {
21584 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType .name + '"'), node.span); 21898 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType .name + '"'), node.span);
21585 } 21899 }
21586 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { 21900 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) {
21901 var $0;
21587 var pos = ''; 21902 var pos = '';
21588 if (args != null) { 21903 if (args != null) {
21589 var argsCode = []; 21904 var argsCode = [];
21590 for (var i = 0; 21905 for (var i = 0;
21591 i < args.get$length(); i++) { 21906 i < args.get$length(); i++) {
21592 argsCode.add$1(args.values.$index(i).code); 21907 argsCode.add$1(args.values.$index(i).get$code());
21593 } 21908 }
21594 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); 21909 pos = Strings.join((argsCode && argsCode.is$List$String()), ", ");
21595 } 21910 }
21596 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, t rue), new Value(world.listType, ('[' + pos + ']'), node.span, true)]; 21911 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)); 21912 return (($0 = this._resolveMember(context, 'noSuchMethod', node, false).invoke $4(context, node, this, new Arguments(null, noSuchArgs))) && $0.is$Value());
21598 } 21913 }
21599 Value.prototype.invokeSpecial = function(name, args, returnType) { 21914 Value.prototype.invokeSpecial = function(name, args, returnType) {
21600 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 449, 12 ); 21915 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 449, 12 );
21601 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 50, 12); 21916 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 50, 12);
21602 var argsString = args.getCode(); 21917 var argsString = args.getCode();
21603 if (name == '\$index' || name == '\$setindex') { 21918 if (name == '\$index' || name == '\$setindex') {
21604 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, true); 21919 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, true);
21605 } 21920 }
21606 else { 21921 else {
21607 if (argsString.length > 0) argsString = (', ' + argsString + ''); 21922 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) { 21985 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod e, span, code) {
21671 this.values = values; 21986 this.values = values;
21672 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); 21987 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code));
21673 // Initializers done 21988 // Initializers done
21674 } 21989 }
21675 ConstListValue._internal$ctor.prototype = ConstListValue.prototype; 21990 ConstListValue._internal$ctor.prototype = ConstListValue.prototype;
21676 $inherits(ConstListValue, EvaluatedValue); 21991 $inherits(ConstListValue, EvaluatedValue);
21677 ConstListValue.ConstListValue$factory = function(type, values, actualValue, cano nicalCode, span) { 21992 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)); 21993 return new ConstListValue._internal$ctor(type, values, actualValue, canonicalC ode, span, EvaluatedValue.codeWithComments(canonicalCode, span));
21679 } 21994 }
21995 ConstListValue.prototype.get$values = function() { return this.values; };
21996 ConstListValue.prototype.set$values = function(value) { return this.values = val ue; };
21680 // ********** Code for ConstMapValue ************** 21997 // ********** Code for ConstMapValue **************
21681 function ConstMapValue() {} 21998 function ConstMapValue() {}
21682 ConstMapValue._internal$ctor = function(type, values, actualValue, canonicalCode , span, code) { 21999 ConstMapValue._internal$ctor = function(type, values, actualValue, canonicalCode , span, code) {
21683 this.values = values; 22000 this.values = values;
21684 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); 22001 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code));
21685 // Initializers done 22002 // Initializers done
21686 } 22003 }
21687 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype; 22004 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype;
21688 $inherits(ConstMapValue, EvaluatedValue); 22005 $inherits(ConstMapValue, EvaluatedValue);
21689 ConstMapValue.ConstMapValue$factory = function(type, keyValuePairs, actualValue, canonicalCode, span) { 22006 ConstMapValue.ConstMapValue$factory = function(type, keyValuePairs, actualValue, canonicalCode, span) {
21690 var values = new HashMapImplementation(); 22007 var values = new HashMapImplementation();
21691 for (var i = 0; 22008 for (var i = 0;
21692 i < keyValuePairs.length; i += 2) { 22009 i < keyValuePairs.length; i += 2) {
21693 values.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$i ndex(i + 1)); 22010 values.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$i ndex(i + 1));
21694 } 22011 }
21695 return new ConstMapValue._internal$ctor(type, values, actualValue, canonicalCo de, span, EvaluatedValue.codeWithComments(canonicalCode, span)); 22012 return new ConstMapValue._internal$ctor(type, values, actualValue, canonicalCo de, span, EvaluatedValue.codeWithComments(canonicalCode, span));
21696 } 22013 }
22014 ConstMapValue.prototype.get$values = function() { return this.values; };
22015 ConstMapValue.prototype.set$values = function(value) { return this.values = valu e; };
21697 // ********** Code for ConstObjectValue ************** 22016 // ********** Code for ConstObjectValue **************
21698 function ConstObjectValue() {} 22017 function ConstObjectValue() {}
21699 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC ode, span, code) { 22018 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC ode, span, code) {
21700 this.fields = fields; 22019 this.fields = fields;
21701 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); 22020 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code));
21702 // Initializers done 22021 // Initializers done
21703 } 22022 }
21704 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype; 22023 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype;
21705 $inherits(ConstObjectValue, EvaluatedValue); 22024 $inherits(ConstObjectValue, EvaluatedValue);
21706 ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode , span) { 22025 ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode , span) {
21707 var fieldValues = []; 22026 var fieldValues = [];
21708 var $list = fields.getKeys(); 22027 var $list = fields.getKeys();
21709 for (var $i = fields.getKeys().iterator$0(); $i.hasNext$0(); ) { 22028 for (var $i = fields.getKeys().iterator$0(); $i.hasNext$0(); ) {
21710 var f = $i.next$0(); 22029 var f = $i.next$0();
21711 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + '')); 22030 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + ''));
21712 } 22031 }
21713 fieldValues.sort((function (a, b) { 22032 fieldValues.sort((function (a, b) {
21714 return a.compareTo$1(b); 22033 return a.compareTo$1(b);
21715 }) 22034 })
21716 ); 22035 );
21717 var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldVa lues, ',') + ']'; 22036 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)); 22037 return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonica lCode, span, EvaluatedValue.codeWithComments(canonicalCode, span));
21719 } 22038 }
22039 ConstObjectValue.prototype.get$fields = function() { return this.fields; };
22040 ConstObjectValue.prototype.set$fields = function(value) { return this.fields = v alue; };
21720 // ********** Code for GlobalValue ************** 22041 // ********** Code for GlobalValue **************
21721 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span, dependencies) { 22042 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span, dependencies) {
21722 this.field = field; 22043 this.field = field;
21723 this.name = name; 22044 this.name = name;
21724 this.exp = exp; 22045 this.exp = exp;
21725 this.canonicalCode = canonicalCode; 22046 this.canonicalCode = canonicalCode;
21726 this.dependencies = dependencies; 22047 this.dependencies = dependencies;
21727 Value.call(this, type, code, span, !$notnull_bool(isConst)); 22048 Value.call(this, type, code, span, !$notnull_bool(isConst));
21728 // Initializers done 22049 // Initializers done
21729 } 22050 }
21730 $inherits(GlobalValue, Value); 22051 $inherits(GlobalValue, Value);
21731 GlobalValue.prototype.is$GlobalValue = function(){return this;}; 22052 GlobalValue.prototype.is$GlobalValue = function(){return this;};
21732 GlobalValue.prototype.is$Comparable = function(){return this;}; 22053 GlobalValue.prototype.is$Comparable = function(){return this;};
21733 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) { 22054 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) {
21734 var code = ($notnull_bool(exp.get$isConst()) ? exp.get$canonicalCode() : exp.c ode); 22055 var code = ($notnull_bool(exp.get$isConst()) ? exp.get$canonicalCode() : exp.c ode);
21735 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie ld.get$name() + '*/'); 22056 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) { 22057 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); 22058 return (d instanceof GlobalValue);
21738 }) 22059 })
21739 )); 22060 ));
21740 } 22061 }
21741 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies ) { 22062 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies ) {
21742 var name = ("const\$" + uniqueId + ""); 22063 var name = ("const\$" + uniqueId + "");
21743 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/"); 22064 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) { 22065 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); 22066 return (d instanceof GlobalValue);
21746 }) 22067 })
21747 )); 22068 ));
21748 } 22069 }
22070 GlobalValue.prototype.get$field = function() { return this.field; };
22071 GlobalValue.prototype.set$field = function(value) { return this.field = value; } ;
21749 GlobalValue.prototype.get$name = function() { return this.name; }; 22072 GlobalValue.prototype.get$name = function() { return this.name; };
21750 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; 22073 GlobalValue.prototype.set$name = function(value) { return this.name = value; };
22074 GlobalValue.prototype.get$exp = function() { return this.exp; };
22075 GlobalValue.prototype.set$exp = function(value) { return this.exp = value; };
21751 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode ; }; 22076 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode ; };
21752 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica lCode = value; }; 22077 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica lCode = value; };
21753 GlobalValue.prototype.get$isConst = function() { 22078 GlobalValue.prototype.get$isConst = function() {
21754 return $notnull_bool(this.exp.get$isConst() && ($notnull_bool(this.field == nu ll || this.field.isFinal))); 22079 return $notnull_bool(this.exp.get$isConst() && ($notnull_bool(this.field == nu ll || this.field.isFinal)));
21755 } 22080 }
21756 GlobalValue.prototype.get$actualValue = function() { 22081 GlobalValue.prototype.get$actualValue = function() {
21757 return this.exp.get$dynamic().get$actualValue(); 22082 return this.exp.get$dynamic().get$actualValue();
21758 } 22083 }
21759 GlobalValue.prototype.compareTo = function(other) { 22084 GlobalValue.prototype.compareTo = function(other) {
21760 if ($eq(other, this)) { 22085 if ($eq(other, this)) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
21848 // Initializers done 22173 // Initializers done
21849 } 22174 }
21850 World.prototype.get$coreimpl = function() { 22175 World.prototype.get$coreimpl = function() {
21851 var $0; 22176 var $0;
21852 return (($0 = this.libraries.$index('dart:coreimpl')) && $0.is$Library()); 22177 return (($0 = this.libraries.$index('dart:coreimpl')) && $0.is$Library());
21853 } 22178 }
21854 World.prototype.get$dom = function() { 22179 World.prototype.get$dom = function() {
21855 var $0; 22180 var $0;
21856 return (($0 = this.libraries.$index('dart:dom')) && $0.is$Library()); 22181 return (($0 = this.libraries.$index('dart:dom')) && $0.is$Library());
21857 } 22182 }
22183 World.prototype.get$dynamicType = function() { return this.dynamicType; };
22184 World.prototype.set$dynamicType = function(value) { return this.dynamicType = va lue; };
21858 World.prototype.get$functionType = function() { return this.functionType; }; 22185 World.prototype.get$functionType = function() { return this.functionType; };
21859 World.prototype.set$functionType = function(value) { return this.functionType = value; }; 22186 World.prototype.set$functionType = function(value) { return this.functionType = value; };
21860 World.prototype.init = function() { 22187 World.prototype.init = function() {
21861 var $0; 22188 var $0;
21862 this.corelib = new Library(this.readFile('dart:core')); 22189 this.corelib = new Library(this.readFile('dart:core'));
21863 this.libraries.$setindex('dart:core', this.corelib); 22190 this.libraries.$setindex('dart:core', this.corelib);
21864 this._todo.add(this.corelib); 22191 this._todo.add(this.corelib);
21865 this.voidType = (($0 = this._addToCoreLib('void', false)) && $0.is$DefinedType ()); 22192 this.voidType = (($0 = this._addToCoreLib('void', false)) && $0.is$DefinedType ());
21866 this.dynamicType = (($0 = this._addToCoreLib('Dynamic', false)) && $0.is$Defin edType()); 22193 this.dynamicType = (($0 = this._addToCoreLib('Dynamic', false)) && $0.is$Defin edType());
21867 this.varType = this.dynamicType; 22194 this.varType = this.dynamicType;
(...skipping 19 matching lines...) Expand all
21887 var mset = this._members.$index(member.name); 22214 var mset = this._members.$index(member.name);
21888 if ($notnull_bool(mset == null)) { 22215 if ($notnull_bool(mset == null)) {
21889 mset = new MemberSet(member, true); 22216 mset = new MemberSet(member, true);
21890 this._members.$setindex(mset.get$name(), mset); 22217 this._members.$setindex(mset.get$name(), mset);
21891 } 22218 }
21892 else { 22219 else {
21893 mset.get$members().add$1(member); 22220 mset.get$members().add$1(member);
21894 } 22221 }
21895 } 22222 }
21896 World.prototype._addTopName = function(named) { 22223 World.prototype._addTopName = function(named) {
22224 var $0;
21897 var existing = this._topNames.$index(named.get$name()); 22225 var existing = this._topNames.$index(named.get$name());
21898 if ($notnull_bool($ne(existing, null))) { 22226 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 + '"')); 22227 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())) { 22228 if ($notnull_bool(named.get$isNative())) {
21901 if ($notnull_bool(existing.get$isNative())) { 22229 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()); 22230 world.internalError(('conflicting native names "' + named.get$name() + ' " ') + ('(already defined in ' + existing.get$span().get$locationText() + ')'), (($0 = named.get$span()) && $0.is$SourceSpan()));
21903 } 22231 }
21904 else { 22232 else {
21905 this._topNames.$setindex(named.get$name(), named); 22233 this._topNames.$setindex(named.get$name(), named);
21906 this._addJavascriptTopName((existing && existing.is$Named())); 22234 this._addJavascriptTopName((existing && existing.is$Named()));
21907 } 22235 }
21908 } 22236 }
21909 else if ($notnull_bool(named.get$library().get$isCore())) { 22237 else if ($notnull_bool(named.get$library().get$isCore())) {
21910 if ($notnull_bool(existing.get$library().get$isCore())) { 22238 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()); 22239 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 } 22240 }
21913 else { 22241 else {
21914 this._topNames.$setindex(named.get$name(), named); 22242 this._topNames.$setindex(named.get$name(), named);
21915 this._addJavascriptTopName((existing && existing.is$Named())); 22243 this._addJavascriptTopName((existing && existing.is$Named()));
21916 } 22244 }
21917 } 22245 }
21918 else { 22246 else {
21919 this._addJavascriptTopName(named); 22247 this._addJavascriptTopName(named);
21920 } 22248 }
21921 } 22249 }
21922 else { 22250 else {
21923 this._topNames.$setindex(named.get$name(), named); 22251 this._topNames.$setindex(named.get$name(), named);
21924 } 22252 }
21925 } 22253 }
21926 World.prototype._addJavascriptTopName = function(named) { 22254 World.prototype._addJavascriptTopName = function(named) {
22255 var $0;
21927 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name () + '')); 22256 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name () + ''));
21928 var existing = this._topNames.$index(named.get$jsname()); 22257 var existing = this._topNames.$index(named.get$jsname());
21929 if ($notnull_bool($ne(existing, null) && $ne(existing, named))) { 22258 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()); 22259 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 } 22260 }
21932 this._topNames.$setindex(named.get$jsname(), named); 22261 this._topNames.$setindex(named.get$jsname(), named);
21933 } 22262 }
21934 World.prototype._addType = function(type) { 22263 World.prototype._addType = function(type) {
21935 if (!$notnull_bool(type.get$isTop())) this._addTopName(type); 22264 if (!$notnull_bool(type.get$isTop())) this._addTopName(type);
21936 } 22265 }
21937 World.prototype._addToCoreLib = function(name, isClass) { 22266 World.prototype._addToCoreLib = function(name, isClass) {
21938 var ret = new DefinedType(name, this.corelib, null, isClass); 22267 var ret = new DefinedType(name, this.corelib, null, isClass);
21939 this.corelib.types.$setindex(name, ret); 22268 this.corelib.types.$setindex(name, ret);
21940 return ret; 22269 return ret;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
21986 var $this = this; // closure support 22315 var $this = this; // closure support
21987 var lib = this.withTiming('first pass', (function () { 22316 var lib = this.withTiming('first pass', (function () {
21988 return $this.processScript(options.dartScript); 22317 return $this.processScript(options.dartScript);
21989 }) 22318 })
21990 ); 22319 );
21991 this.withTiming('resolve top level', (function () { 22320 this.withTiming('resolve top level', (function () {
21992 $this.resolveAll(); 22321 $this.resolveAll();
21993 }) 22322 })
21994 ); 22323 );
21995 this.withTiming('generate code', (function () { 22324 this.withTiming('generate code', (function () {
21996 var mainMembers = lib.topType.resolveMember('main'); 22325 var $0;
22326 var mainMembers = lib.get$topType().resolveMember$1('main');
21997 var main = null; 22327 var main = null;
21998 if ($notnull_bool(mainMembers == null || mainMembers.get$members().length == 0)) { 22328 if ($notnull_bool(mainMembers == null || $eq(mainMembers.get$members().lengt h, 0))) {
21999 $this.fatal('no main method specified'); 22329 $this.fatal('no main method specified');
22000 } 22330 }
22001 else if (mainMembers.get$members().length > 1) { 22331 else if (mainMembers.get$members().length > 1) {
22002 var $list = mainMembers.get$members(); 22332 var $list = mainMembers.get$members();
22003 for (var $i = mainMembers.get$members().iterator$0(); $i.hasNext$0(); ) { 22333 for (var $i = mainMembers.get$members().iterator$0(); $i.hasNext$0(); ) {
22004 var m = $i.next$0(); 22334 var m = $i.next$0();
22005 main = m; 22335 main = m;
22006 $this.error('more than one main member (using last?)', main.get$span()); 22336 $this.error('more than one main member (using last?)', (($0 = main.get$s pan()) && $0.is$SourceSpan()));
22007 } 22337 }
22008 } 22338 }
22009 else { 22339 else {
22010 main = mainMembers.get$members().$index(0); 22340 main = mainMembers.get$members().$index(0);
22011 } 22341 }
22012 var codeWriter = new CodeWriter(); 22342 var codeWriter = new CodeWriter();
22013 $this.gen = new WorldGenerator(main, codeWriter); 22343 $this.gen = new WorldGenerator(main, codeWriter);
22014 $this.gen.run(); 22344 $this.gen.run();
22015 $this.jsBytesWritten = codeWriter.get$text().length; 22345 $this.jsBytesWritten = $assert_num(codeWriter.get$text().length);
22016 }) 22346 })
22017 ); 22347 );
22018 } 22348 }
22019 World.prototype.getGeneratedCode = function() { 22349 World.prototype.getGeneratedCode = function() {
22020 if (this.legCode != null) { 22350 if (this.legCode != null) {
22021 $assert(options.enableLeg, "options.enableLeg", "world.dart", 310, 14); 22351 $assert(options.enableLeg, "options.enableLeg", "world.dart", 310, 14);
22022 return this.legCode; 22352 return this.legCode;
22023 } 22353 }
22024 else { 22354 else {
22025 return this.gen.writer.get$text(); 22355 return this.gen.writer.get$text();
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
22344 }; 22674 };
22345 // ********** Code for VarMethodStub ************** 22675 // ********** Code for VarMethodStub **************
22346 function VarMethodStub(name, member, args, body) { 22676 function VarMethodStub(name, member, args, body) {
22347 this.member = member; 22677 this.member = member;
22348 this.args = args; 22678 this.args = args;
22349 this.body = body; 22679 this.body = body;
22350 VarMember.call(this, name); 22680 VarMember.call(this, name);
22351 // Initializers done 22681 // Initializers done
22352 } 22682 }
22353 $inherits(VarMethodStub, VarMember); 22683 $inherits(VarMethodStub, VarMember);
22684 VarMethodStub.prototype.get$body = function() { return this.body; };
22354 VarMethodStub.prototype.get$returnType = function() { 22685 VarMethodStub.prototype.get$returnType = function() {
22355 var $0; 22686 var $0;
22356 return (($0 = this.member != null ? this.member.get$returnType() : world.varTy pe) && $0.is$lang_Type()); 22687 return (($0 = this.member != null ? this.member.get$returnType() : world.varTy pe) && $0.is$lang_Type());
22357 } 22688 }
22358 VarMethodStub.prototype.get$typeName = function() { 22689 VarMethodStub.prototype.get$typeName = function() {
22359 return this.member != null ? this.member.declaringType.get$jsname() : 'Object' ; 22690 return this.member != null ? this.member.declaringType.get$jsname() : 'Object' ;
22360 } 22691 }
22361 VarMethodStub.prototype.generate = function(code) { 22692 VarMethodStub.prototype.generate = function(code) {
22362 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = ')); 22693 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = '));
22363 this.generateBody(code, ';'); 22694 this.generateBody(code, ';');
22364 } 22695 }
22365 VarMethodStub.prototype.generateBody = function(code, end) { 22696 VarMethodStub.prototype.generateBody = function(code, end) {
22366 if ($notnull_bool(this._useDirectCall(this.member, this.args))) { 22697 if ($notnull_bool(this._useDirectCall(this.member, this.args))) {
22367 code.writeln(('' + this.get$typeName() + '.prototype.' + this.member.get$jsn ame() + '' + end + '')); 22698 code.writeln(('' + this.get$typeName() + '.prototype.' + this.member.get$jsn ame() + '' + end + ''));
22368 } 22699 }
22369 else { 22700 else {
22370 code.enterBlock(('function(' + this.args.getCode() + ') {')); 22701 code.enterBlock(('function(' + this.args.getCode() + ') {'));
22371 code.writeln(('return ' + this.body.code + ';')); 22702 code.writeln(('return ' + this.body.code + ';'));
22372 code.exitBlock(('}' + end + '')); 22703 code.exitBlock(('}' + end + ''));
22373 } 22704 }
22374 } 22705 }
22375 VarMethodStub.prototype._useDirectCall = function(member, args) { 22706 VarMethodStub.prototype._useDirectCall = function(member, args) {
22376 if ((member instanceof MethodMember) && $ne(member.declaringType.get$library() , world.get$dom())) { 22707 if ((member instanceof MethodMember) && $ne(member.declaringType.get$library() , world.get$dom())) {
22377 var method = (member && member.is$MethodMember()); 22708 var method = (member && member.is$MethodMember());
22378 if ($notnull_bool(method.needsArgumentConversion(args))) { 22709 if ($notnull_bool(method.needsArgumentConversion(args))) {
22379 return false; 22710 return false;
22380 } 22711 }
22381 for (var i = args.get$length(); 22712 for (var i = args.get$length();
22382 i < method.parameters.length; i++) { 22713 i < method.parameters.length; i++) {
22383 if ($notnull_bool($ne(method.parameters.$index(i).get$value().code, 'null' ))) { 22714 if ($notnull_bool($ne(method.parameters.$index(i).get$value().get$code(), 'null'))) {
22384 return false; 22715 return false;
22385 } 22716 }
22386 } 22717 }
22387 return method.namesInOrder(args); 22718 return method.namesInOrder(args);
22388 } 22719 }
22389 else { 22720 else {
22390 return false; 22721 return false;
22391 } 22722 }
22392 } 22723 }
22393 VarMethodStub.prototype.generate$1 = function($0) { 22724 VarMethodStub.prototype.generate$1 = function($0) {
(...skipping 20 matching lines...) Expand all
22414 this._invokeMembers(context, node); 22745 this._invokeMembers(context, node);
22415 return VarMember.prototype.invoke.call(this, context, node, target, args); 22746 return VarMember.prototype.invoke.call(this, context, node, target, args);
22416 } 22747 }
22417 VarMethodSet.prototype._invokeMembers = function(context, node) { 22748 VarMethodSet.prototype._invokeMembers = function(context, node) {
22418 if (this._fallbackStubs != null) return; 22749 if (this._fallbackStubs != null) return;
22419 var objectStub = null; 22750 var objectStub = null;
22420 this._fallbackStubs = []; 22751 this._fallbackStubs = [];
22421 var $list = this.members; 22752 var $list = this.members;
22422 for (var $i = 0;$i < $list.length; $i++) { 22753 for (var $i = 0;$i < $list.length; $i++) {
22423 var member = $list.$index($i); 22754 var member = $list.$index($i);
22424 var target = new Value(member.declaringType, 'this', node.span, true); 22755 var target = new Value(member.get$declaringType(), 'this', node.span, true);
22425 var result = member.invoke$4(context, node, target, this.args); 22756 var result = member.invoke$4(context, node, target, this.args);
22426 var stub = new VarMethodStub(this.name, member, this.args, result); 22757 var stub = new VarMethodStub(this.name, member, this.args, result);
22427 var type = member.declaringType; 22758 var type = member.get$declaringType();
22428 if ($notnull_bool(type.get$isObject())) { 22759 if ($notnull_bool(type.get$isObject())) {
22429 objectStub = stub; 22760 objectStub = stub;
22430 } 22761 }
22431 else if ($ne(type.get$library(), world.get$dom())) { 22762 else if ($notnull_bool($ne(type.get$library(), world.get$dom()))) {
22432 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V arMember())); 22763 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V arMember()));
22433 } 22764 }
22434 else { 22765 else {
22435 this._fallbackStubs.add(stub); 22766 this._fallbackStubs.add(stub);
22436 } 22767 }
22437 } 22768 }
22438 if ($notnull_bool(objectStub == null)) { 22769 if ($notnull_bool(objectStub == null)) {
22439 var target = new Value(world.objectType, 'this', node.span, true); 22770 var target = new Value(world.objectType, 'this', node.span, true);
22440 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, t his.args); 22771 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, t his.args);
22441 objectStub = new VarMethodStub(this.name, null, this.args, result); 22772 objectStub = new VarMethodStub(this.name, null, this.args, result);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
22735 INTERFACE, 23066 INTERFACE,
22736 LIBRARY, 23067 LIBRARY,
22737 NATIVE, 23068 NATIVE,
22738 NEGATE, 23069 NEGATE,
22739 OPERATOR, 23070 OPERATOR,
22740 SET, 23071 SET,
22741 SOURCE, 23072 SOURCE,
22742 STATIC, 23073 STATIC,
22743 TYPEDEF ]*/; 23074 TYPEDEF ]*/;
22744 RunEntry(function () {main();}, []); 23075 RunEntry(function () {main();}, []);
OLDNEW
« no previous file with comments | « no previous file | frog/member.dart » ('j') | frog/member.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698