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

Side by Side Diff: frog/frogsh

Issue 8534001: Adds typechecking of return values (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged 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
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 res = new StackOverflowException(); 102 res = new StackOverflowException();
103 } 103 }
104 } 104 }
105 // TODO(jmesserly): setting the stack property is not a long term solution. 105 // TODO(jmesserly): setting the stack property is not a long term solution.
106 // Also it causes the exception to print as if it were a TypeError or 106 // Also it causes the exception to print as if it were a TypeError or
107 // RangeError, instead of using the proper toString. 107 // RangeError, instead of using the proper toString.
108 res.stack = e.stack; 108 res.stack = e.stack;
109 return res; 109 return res;
110 } 110 }
111 function $notnull_bool(test) { 111 function $notnull_bool(test) {
112 if (test == null || typeof(test) != 'boolean') { 112 return typeof(test) == 'boolean' ? test : test.is$bool();
Siggi Cherem (dart-lang) 2011/11/11 08:23:53 I couldn't find, where is 'is$bool()' generated?
113 $throw(new TypeError('must be "true" or "false"'));
114 }
115 return test === true;
116 } 113 }
117 function $assert(test, text, url, line, column) { 114 function $assert(test, text, url, line, column) {
118 if (typeof test == 'function') test = test(); 115 if (typeof test == 'function') test = test();
119 if (!test) $throw(new AssertError(text, url, line, column)); 116 if (!test) $throw(new AssertError(text, url, line, column));
120 } 117 }
121 function $throw(e) { 118 function $throw(e) {
122 // If e is not a value, we can use V8's captureStackTrace utility method. 119 // If e is not a value, we can use V8's captureStackTrace utility method.
123 // TODO(jmesserly): capture the stack trace on other JS engines. 120 // TODO(jmesserly): capture the stack trace on other JS engines.
124 if (e && (typeof e == 'object') && Error.captureStackTrace) { 121 if (e && (typeof e == 'object') && Error.captureStackTrace) {
125 // TODO(jmesserly): this will clobber the e.stack property 122 // TODO(jmesserly): this will clobber the e.stack property
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 return _IsolateJsUtil._deserializeMessage(message_); 885 return _IsolateJsUtil._deserializeMessage(message_);
889 } else { 886 } else {
890 // Nothing more to do. 887 // Nothing more to do.
891 return message_; 888 return message_;
892 } 889 }
893 } 890 }
894 891
895 function _IsolateJsUtil() {} 892 function _IsolateJsUtil() {}
896 // ********** Code for ListFactory ************** 893 // ********** Code for ListFactory **************
897 ListFactory = Array; 894 ListFactory = Array;
895 ListFactory.prototype.is$ListFactory = function(){return this;};
898 ListFactory.prototype.is$List = function(){return this;}; 896 ListFactory.prototype.is$List = function(){return this;};
899 ListFactory.prototype.is$List$ArgumentNode = function(){return this;}; 897 ListFactory.prototype.is$List$ArgumentNode = function(){return this;};
898 ListFactory.prototype.is$List$Definition = function(){return this;};
900 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;}; 899 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;};
901 ListFactory.prototype.is$List$String = function(){return this;}; 900 ListFactory.prototype.is$List$String = function(){return this;};
902 ListFactory.prototype.is$List$T = function(){return this;}; 901 ListFactory.prototype.is$List$T = function(){return this;};
903 ListFactory.prototype.is$List$Type = function(){return this;}; 902 ListFactory.prototype.is$List$Type = function(){return this;};
904 ListFactory.prototype.is$List$Value = function(){return this;}; 903 ListFactory.prototype.is$List$Value = function(){return this;};
905 ListFactory.prototype.is$List$int = function(){return this;}; 904 ListFactory.prototype.is$List$int = function(){return this;};
906 ListFactory.prototype.is$Iterable = function(){return this;}; 905 ListFactory.prototype.is$Iterable = function(){return this;};
907 ListFactory.ListFactory$from$factory = function(other) { 906 ListFactory.ListFactory$from$factory = function(other) {
908 var $0; 907 var $0;
909 var list = []; 908 var list = [];
910 for (var $i = other.iterator(); $i.hasNext(); ) { 909 for (var $i = other.iterator(); $i.hasNext(); ) {
911 var e = $i.next(); 910 var e = $i.next();
912 list.add(e); 911 list.add(e);
913 } 912 }
914 return list; 913 return (list && list.is$ListFactory());
915 } 914 }
916 ListFactory.prototype.add = function(value) { 915 ListFactory.prototype.add = function(value) {
917 this.push(value); 916 this.push(value);
918 } 917 }
919 ListFactory.prototype.addLast = function(value) { 918 ListFactory.prototype.addLast = function(value) {
920 this.push(value); 919 this.push(value);
921 } 920 }
922 ListFactory.prototype.addAll = function(collection) { 921 ListFactory.prototype.addAll = function(collection) {
923 var $0; 922 var $0;
924 for (var $i = collection.iterator(); $i.hasNext(); ) { 923 for (var $i = collection.iterator(); $i.hasNext(); ) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 ListFactory$Type = ListFactory; 957 ListFactory$Type = ListFactory;
959 ListFactory$V = ListFactory; 958 ListFactory$V = ListFactory;
960 ListFactory$ValueSetNode = ListFactory; 959 ListFactory$ValueSetNode = ListFactory;
961 ListFactory$int = ListFactory; 960 ListFactory$int = ListFactory;
962 // ********** Code for ListIterator ************** 961 // ********** Code for ListIterator **************
963 function ListIterator(array) { 962 function ListIterator(array) {
964 this._array = array; 963 this._array = array;
965 this._pos = 0; 964 this._pos = 0;
966 // Initializers done 965 // Initializers done
967 } 966 }
967 ListIterator.prototype.is$Iterator$T = function(){return this;};
968 ListIterator.prototype.hasNext = function() { 968 ListIterator.prototype.hasNext = function() {
969 return this._array.length > this._pos; 969 return this._array.length > this._pos;
970 } 970 }
971 ListIterator.prototype.next = function() { 971 ListIterator.prototype.next = function() {
972 if ($notnull_bool(!$notnull_bool(this.hasNext()))) { 972 if ($notnull_bool(!$notnull_bool(this.hasNext()))) {
973 $throw(const$0/*const NoMoreElementsException()*/); 973 $throw(const$0/*const NoMoreElementsException()*/);
974 } 974 }
975 return this._array.$index(this._pos++); 975 return this._array.$index(this._pos++);
976 } 976 }
977 // ********** Code for ImmutableList ************** 977 // ********** Code for ImmutableList **************
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 } 1042 }
1043 // ********** Code for ImmutableMap ************** 1043 // ********** Code for ImmutableMap **************
1044 function ImmutableMap(keyValuePairs) { 1044 function ImmutableMap(keyValuePairs) {
1045 this._internal = $map([]); 1045 this._internal = $map([]);
1046 // Initializers done 1046 // Initializers done
1047 for (var i = 0; 1047 for (var i = 0;
1048 $notnull_bool(i < keyValuePairs.length); i += 2) { 1048 $notnull_bool(i < keyValuePairs.length); i += 2) {
1049 this._internal.$setindex(keyValuePairs.$index(i), keyValuePairs.$index(i + 1 )); 1049 this._internal.$setindex(keyValuePairs.$index(i), keyValuePairs.$index(i + 1 ));
1050 } 1050 }
1051 } 1051 }
1052 ImmutableMap.prototype.is$Map$Node$Element = function(){return this;};
1053 ImmutableMap.prototype.is$Map$String$Member = function(){return this;};
1052 ImmutableMap.prototype.$index = function(key) { 1054 ImmutableMap.prototype.$index = function(key) {
1053 return this._internal.$index(key); 1055 return this._internal.$index(key);
1054 } 1056 }
1055 ImmutableMap.prototype.isEmpty = function() { 1057 ImmutableMap.prototype.isEmpty = function() {
1056 return this._internal.isEmpty(); 1058 return this._internal.isEmpty();
1057 } 1059 }
1058 ImmutableMap.prototype.get$length = function() { 1060 ImmutableMap.prototype.get$length = function() {
1059 return this._internal.get$length(); 1061 return this._internal.get$length();
1060 } 1062 }
1061 Object.defineProperty(ImmutableMap.prototype, "length", { 1063 Object.defineProperty(ImmutableMap.prototype, "length", {
(...skipping 17 matching lines...) Expand all
1079 // ********** Code for MatchImplementation ************** 1081 // ********** Code for MatchImplementation **************
1080 function MatchImplementation(pattern, str, _start, _end, _groups) { 1082 function MatchImplementation(pattern, str, _start, _end, _groups) {
1081 this.pattern = pattern; 1083 this.pattern = pattern;
1082 this.str = str; 1084 this.str = str;
1083 this._start = _start; 1085 this._start = _start;
1084 this._end = _end; 1086 this._end = _end;
1085 this._groups = _groups; 1087 this._groups = _groups;
1086 // Initializers done 1088 // Initializers done
1087 } 1089 }
1088 MatchImplementation.prototype.$index = function(group) { 1090 MatchImplementation.prototype.$index = function(group) {
1089 return this._groups.$index(group); 1091 return $assert_String(this._groups.$index(group));
1090 } 1092 }
1091 // ********** Code for NumImplementation ************** 1093 // ********** Code for NumImplementation **************
1092 NumImplementation = Number; 1094 NumImplementation = Number;
1093 NumImplementation.prototype.isNaN = function() { 1095 NumImplementation.prototype.isNaN = function() {
1094 return isNaN(this); 1096 return isNaN(this);
1095 } 1097 }
1096 NumImplementation.prototype.isNegative = function() { 1098 NumImplementation.prototype.isNegative = function() {
1097 return this == 0 ? (1 / this) < 0 : this < 0; 1099 return this == 0 ? (1 / this) < 0 : this < 0;
1098 } 1100 }
1099 NumImplementation.prototype.hashCode = function() { 1101 NumImplementation.prototype.hashCode = function() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 // Initializers done 1155 // Initializers done
1154 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { 1156 if ($notnull_bool(HashMapImplementation._deletedKey == null)) {
1155 HashMapImplementation._deletedKey = new Object(); 1157 HashMapImplementation._deletedKey = new Object();
1156 } 1158 }
1157 this._numberOfEntries = 0; 1159 this._numberOfEntries = 0;
1158 this._numberOfDeleted = 0; 1160 this._numberOfDeleted = 0;
1159 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1161 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1160 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1162 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1161 this._values = new ListFactory$V(8/*HashMapImplementation._INITIAL_CAPACITY*/) ; 1163 this._values = new ListFactory$V(8/*HashMapImplementation._INITIAL_CAPACITY*/) ;
1162 } 1164 }
1165 HashMapImplementation.prototype.is$HashMapImplementation = function(){return thi s;};
1166 HashMapImplementation.prototype.is$Map$Node$Element = function(){return this;};
1167 HashMapImplementation.prototype.is$Map$String$Member = function(){return this;};
1163 HashMapImplementation.HashMapImplementation$from$factory = function(other) { 1168 HashMapImplementation.HashMapImplementation$from$factory = function(other) {
1164 var result = new HashMapImplementation(); 1169 var result = new HashMapImplementation();
1165 other.forEach((function (key, value) { 1170 other.forEach((function (key, value) {
1166 result.$setindex(key, value); 1171 result.$setindex(key, value);
1167 }) 1172 })
1168 ); 1173 );
1169 return result; 1174 return (result && result.is$HashMapImplementation());
1170 } 1175 }
1171 HashMapImplementation._computeLoadLimit = function(capacity) { 1176 HashMapImplementation._computeLoadLimit = function(capacity) {
1172 return $truncdiv((capacity * 3), 4); 1177 return $truncdiv((capacity * 3), 4);
1173 } 1178 }
1174 HashMapImplementation._firstProbe = function(hashCode, length) { 1179 HashMapImplementation._firstProbe = function(hashCode, length) {
1175 return hashCode & (length - 1); 1180 return hashCode & (length - 1);
1176 } 1181 }
1177 HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length ) { 1182 HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length ) {
1178 return (currentProbe + numberOfProbes) & (length - 1); 1183 return (currentProbe + numberOfProbes) & (length - 1);
1179 } 1184 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { 1331 if ($notnull_bool(HashMapImplementation._deletedKey == null)) {
1327 HashMapImplementation._deletedKey = new Object(); 1332 HashMapImplementation._deletedKey = new Object();
1328 } 1333 }
1329 this._numberOfEntries = 0; 1334 this._numberOfEntries = 0;
1330 this._numberOfDeleted = 0; 1335 this._numberOfDeleted = 0;
1331 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1336 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1332 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1337 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1333 this._values = new ListFactory$E(8/*HashMapImplementation._INITIAL_CAPACITY*/) ; 1338 this._values = new ListFactory$E(8/*HashMapImplementation._INITIAL_CAPACITY*/) ;
1334 } 1339 }
1335 $inherits(HashMapImplementation$E$E, HashMapImplementation); 1340 $inherits(HashMapImplementation$E$E, HashMapImplementation);
1341 HashMapImplementation$E$E.prototype.is$Map$Node$Element = function(){return this ;};
1342 HashMapImplementation$E$E.prototype.is$Map$String$Member = function(){return thi s;};
1336 HashMapImplementation$E$E._computeLoadLimit = function(capacity) { 1343 HashMapImplementation$E$E._computeLoadLimit = function(capacity) {
1337 return $truncdiv((capacity * 3), 4); 1344 return $truncdiv((capacity * 3), 4);
1338 } 1345 }
1339 HashMapImplementation$E$E._firstProbe = function(hashCode, length) { 1346 HashMapImplementation$E$E._firstProbe = function(hashCode, length) {
1340 return hashCode & (length - 1); 1347 return hashCode & (length - 1);
1341 } 1348 }
1342 HashMapImplementation$E$E._nextProbe = function(currentProbe, numberOfProbes, le ngth) { 1349 HashMapImplementation$E$E._nextProbe = function(currentProbe, numberOfProbes, le ngth) {
1343 return (currentProbe + numberOfProbes) & (length - 1); 1350 return (currentProbe + numberOfProbes) & (length - 1);
1344 } 1351 }
1345 HashMapImplementation$E$E.prototype._probeForAdding = function(key) { 1352 HashMapImplementation$E$E.prototype._probeForAdding = function(key) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { 1478 if ($notnull_bool(HashMapImplementation._deletedKey == null)) {
1472 HashMapImplementation._deletedKey = new Object(); 1479 HashMapImplementation._deletedKey = new Object();
1473 } 1480 }
1474 this._numberOfEntries = 0; 1481 this._numberOfEntries = 0;
1475 this._numberOfDeleted = 0; 1482 this._numberOfDeleted = 0;
1476 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1483 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1477 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1484 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1478 this._values = new ListFactory$HInstruction(8/*HashMapImplementation._INITIAL_ CAPACITY*/); 1485 this._values = new ListFactory$HInstruction(8/*HashMapImplementation._INITIAL_ CAPACITY*/);
1479 } 1486 }
1480 $inherits(HashMapImplementation$Element$HInstruction, HashMapImplementation); 1487 $inherits(HashMapImplementation$Element$HInstruction, HashMapImplementation);
1488 HashMapImplementation$Element$HInstruction.prototype.is$Map$Node$Element = false ;
1489 HashMapImplementation$Element$HInstruction.prototype.is$Map$String$Member = fals e;
1481 HashMapImplementation$Element$HInstruction.HashMapImplementation$from$factory = function(other) { 1490 HashMapImplementation$Element$HInstruction.HashMapImplementation$from$factory = function(other) {
1482 var result = new HashMapImplementation(); 1491 var result = new HashMapImplementation();
1483 other.forEach((function (key, value) { 1492 other.forEach((function (key, value) {
1484 result.$setindex(key, value); 1493 result.$setindex(key, value);
1485 }) 1494 })
1486 ); 1495 );
1487 return result; 1496 return (result && result.is$HashMapImplementation());
1488 } 1497 }
1489 HashMapImplementation$Element$HInstruction._computeLoadLimit = function(capacity ) { 1498 HashMapImplementation$Element$HInstruction._computeLoadLimit = function(capacity ) {
1490 return $truncdiv((capacity * 3), 4); 1499 return $truncdiv((capacity * 3), 4);
1491 } 1500 }
1492 // ********** Code for HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePa ir$K$V ************** 1501 // ********** Code for HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePa ir$K$V **************
1493 function HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V() { 1502 function HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V() {
1494 // Initializers done 1503 // Initializers done
1495 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { 1504 if ($notnull_bool(HashMapImplementation._deletedKey == null)) {
1496 HashMapImplementation._deletedKey = new Object(); 1505 HashMapImplementation._deletedKey = new Object();
1497 } 1506 }
1498 this._numberOfEntries = 0; 1507 this._numberOfEntries = 0;
1499 this._numberOfDeleted = 0; 1508 this._numberOfDeleted = 0;
1500 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1509 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1501 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1510 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1502 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$K$V(8/*Hash MapImplementation._INITIAL_CAPACITY*/); 1511 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$K$V(8/*Hash MapImplementation._INITIAL_CAPACITY*/);
1503 } 1512 }
1504 $inherits(HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V, HashM apImplementation); 1513 $inherits(HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V, HashM apImplementation);
1514 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$Map $Node$Element = false;
1515 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$Map $String$Member = false;
1505 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V._computeLoadLimi t = function(capacity) { 1516 HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$V._computeLoadLimi t = function(capacity) {
1506 return $truncdiv((capacity * 3), 4); 1517 return $truncdiv((capacity * 3), 4);
1507 } 1518 }
1508 // ********** Code for HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValu ePair$Node$Element ************** 1519 // ********** Code for HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValu ePair$Node$Element **************
1509 function HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Ele ment() { 1520 function HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Ele ment() {
1510 // Initializers done 1521 // Initializers done
1511 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { 1522 if ($notnull_bool(HashMapImplementation._deletedKey == null)) {
1512 HashMapImplementation._deletedKey = new Object(); 1523 HashMapImplementation._deletedKey = new Object();
1513 } 1524 }
1514 this._numberOfEntries = 0; 1525 this._numberOfEntries = 0;
1515 this._numberOfDeleted = 0; 1526 this._numberOfDeleted = 0;
1516 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1527 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1517 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1528 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1518 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$Node$Elemen t(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1529 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$Node$Elemen t(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1519 } 1530 }
1520 $inherits(HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$El ement, HashMapImplementation); 1531 $inherits(HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$El ement, HashMapImplementation);
1532 HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Element.prot otype.is$Map$Node$Element = false;
1533 HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Element.prot otype.is$Map$String$Member = false;
1521 HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Element._com puteLoadLimit = function(capacity) { 1534 HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair$Node$Element._com puteLoadLimit = function(capacity) {
1522 return $truncdiv((capacity * 3), 4); 1535 return $truncdiv((capacity * 3), 4);
1523 } 1536 }
1524 // ********** Code for HashMapImplementation$String$DoubleLinkedQueueEntry$KeyVa luePair$String$Keyword ************** 1537 // ********** Code for HashMapImplementation$String$DoubleLinkedQueueEntry$KeyVa luePair$String$Keyword **************
1525 function HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String $Keyword() { 1538 function HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String $Keyword() {
1526 // Initializers done 1539 // Initializers done
1527 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { 1540 if ($notnull_bool(HashMapImplementation._deletedKey == null)) {
1528 HashMapImplementation._deletedKey = new Object(); 1541 HashMapImplementation._deletedKey = new Object();
1529 } 1542 }
1530 this._numberOfEntries = 0; 1543 this._numberOfEntries = 0;
1531 this._numberOfDeleted = 0; 1544 this._numberOfDeleted = 0;
1532 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1545 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1533 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1546 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1534 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$String$Keyw ord(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1547 this._values = new ListFactory$DoubleLinkedQueueEntry$KeyValuePair$String$Keyw ord(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1535 } 1548 }
1536 $inherits(HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$Strin g$Keyword, HashMapImplementation); 1549 $inherits(HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$Strin g$Keyword, HashMapImplementation);
1550 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword. prototype.is$Map$Node$Element = false;
1551 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword. prototype.is$Map$String$Member = false;
1537 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword. _computeLoadLimit = function(capacity) { 1552 HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePair$String$Keyword. _computeLoadLimit = function(capacity) {
1538 return $truncdiv((capacity * 3), 4); 1553 return $truncdiv((capacity * 3), 4);
1539 } 1554 }
1540 // ********** Code for HashMapImplementation$String$EvaluatedValue ************* * 1555 // ********** Code for HashMapImplementation$String$EvaluatedValue ************* *
1541 function HashMapImplementation$String$EvaluatedValue() { 1556 function HashMapImplementation$String$EvaluatedValue() {
1542 // Initializers done 1557 // Initializers done
1543 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { 1558 if ($notnull_bool(HashMapImplementation._deletedKey == null)) {
1544 HashMapImplementation._deletedKey = new Object(); 1559 HashMapImplementation._deletedKey = new Object();
1545 } 1560 }
1546 this._numberOfEntries = 0; 1561 this._numberOfEntries = 0;
1547 this._numberOfDeleted = 0; 1562 this._numberOfDeleted = 0;
1548 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1563 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1549 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1564 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1550 this._values = new ListFactory$EvaluatedValue(8/*HashMapImplementation._INITIA L_CAPACITY*/); 1565 this._values = new ListFactory$EvaluatedValue(8/*HashMapImplementation._INITIA L_CAPACITY*/);
1551 } 1566 }
1552 $inherits(HashMapImplementation$String$EvaluatedValue, HashMapImplementation); 1567 $inherits(HashMapImplementation$String$EvaluatedValue, HashMapImplementation);
1568 HashMapImplementation$String$EvaluatedValue.prototype.is$Map$Node$Element = fals e;
1569 HashMapImplementation$String$EvaluatedValue.prototype.is$Map$String$Member = fal se;
1553 HashMapImplementation$String$EvaluatedValue._computeLoadLimit = function(capacit y) { 1570 HashMapImplementation$String$EvaluatedValue._computeLoadLimit = function(capacit y) {
1554 return $truncdiv((capacity * 3), 4); 1571 return $truncdiv((capacity * 3), 4);
1555 } 1572 }
1556 // ********** Code for HashMapImplementation$String$String ************** 1573 // ********** Code for HashMapImplementation$String$String **************
1557 function HashMapImplementation$String$String() { 1574 function HashMapImplementation$String$String() {
1558 // Initializers done 1575 // Initializers done
1559 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { 1576 if ($notnull_bool(HashMapImplementation._deletedKey == null)) {
1560 HashMapImplementation._deletedKey = new Object(); 1577 HashMapImplementation._deletedKey = new Object();
1561 } 1578 }
1562 this._numberOfEntries = 0; 1579 this._numberOfEntries = 0;
1563 this._numberOfDeleted = 0; 1580 this._numberOfDeleted = 0;
1564 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1581 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1565 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1582 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1566 this._values = new ListFactory$String(8/*HashMapImplementation._INITIAL_CAPACI TY*/); 1583 this._values = new ListFactory$String(8/*HashMapImplementation._INITIAL_CAPACI TY*/);
1567 } 1584 }
1568 $inherits(HashMapImplementation$String$String, HashMapImplementation); 1585 $inherits(HashMapImplementation$String$String, HashMapImplementation);
1586 HashMapImplementation$String$String.prototype.is$Map$Node$Element = false;
1587 HashMapImplementation$String$String.prototype.is$Map$String$Member = false;
1569 HashMapImplementation$String$String._computeLoadLimit = function(capacity) { 1588 HashMapImplementation$String$String._computeLoadLimit = function(capacity) {
1570 return $truncdiv((capacity * 3), 4); 1589 return $truncdiv((capacity * 3), 4);
1571 } 1590 }
1572 // ********** Code for HashMapImplementation$Type$Type ************** 1591 // ********** Code for HashMapImplementation$Type$Type **************
1573 function HashMapImplementation$Type$Type() { 1592 function HashMapImplementation$Type$Type() {
1574 // Initializers done 1593 // Initializers done
1575 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { 1594 if ($notnull_bool(HashMapImplementation._deletedKey == null)) {
1576 HashMapImplementation._deletedKey = new Object(); 1595 HashMapImplementation._deletedKey = new Object();
1577 } 1596 }
1578 this._numberOfEntries = 0; 1597 this._numberOfEntries = 0;
1579 this._numberOfDeleted = 0; 1598 this._numberOfDeleted = 0;
1580 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1599 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1581 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1600 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1582 this._values = new ListFactory$Type(8/*HashMapImplementation._INITIAL_CAPACITY */); 1601 this._values = new ListFactory$Type(8/*HashMapImplementation._INITIAL_CAPACITY */);
1583 } 1602 }
1584 $inherits(HashMapImplementation$Type$Type, HashMapImplementation); 1603 $inherits(HashMapImplementation$Type$Type, HashMapImplementation);
1604 HashMapImplementation$Type$Type.prototype.is$Map$Node$Element = false;
1605 HashMapImplementation$Type$Type.prototype.is$Map$String$Member = false;
1585 HashMapImplementation$Type$Type._computeLoadLimit = function(capacity) { 1606 HashMapImplementation$Type$Type._computeLoadLimit = function(capacity) {
1586 return $truncdiv((capacity * 3), 4); 1607 return $truncdiv((capacity * 3), 4);
1587 } 1608 }
1588 // ********** Code for HashMapImplementation$int$int ************** 1609 // ********** Code for HashMapImplementation$int$int **************
1589 function HashMapImplementation$int$int() { 1610 function HashMapImplementation$int$int() {
1590 // Initializers done 1611 // Initializers done
1591 if ($notnull_bool(HashMapImplementation._deletedKey == null)) { 1612 if ($notnull_bool(HashMapImplementation._deletedKey == null)) {
1592 HashMapImplementation._deletedKey = new Object(); 1613 HashMapImplementation._deletedKey = new Object();
1593 } 1614 }
1594 this._numberOfEntries = 0; 1615 this._numberOfEntries = 0;
1595 this._numberOfDeleted = 0; 1616 this._numberOfDeleted = 0;
1596 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1617 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1597 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1618 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1598 this._values = new ListFactory$int(8/*HashMapImplementation._INITIAL_CAPACITY* /); 1619 this._values = new ListFactory$int(8/*HashMapImplementation._INITIAL_CAPACITY* /);
1599 } 1620 }
1600 $inherits(HashMapImplementation$int$int, HashMapImplementation); 1621 $inherits(HashMapImplementation$int$int, HashMapImplementation);
1622 HashMapImplementation$int$int.prototype.is$Map$Node$Element = false;
1623 HashMapImplementation$int$int.prototype.is$Map$String$Member = false;
1601 HashMapImplementation$int$int._computeLoadLimit = function(capacity) { 1624 HashMapImplementation$int$int._computeLoadLimit = function(capacity) {
1602 return $truncdiv((capacity * 3), 4); 1625 return $truncdiv((capacity * 3), 4);
1603 } 1626 }
1604 // ********** Code for HashSetImplementation ************** 1627 // ********** Code for HashSetImplementation **************
1605 function HashSetImplementation() { 1628 function HashSetImplementation() {
1606 // Initializers done 1629 // Initializers done
1607 this._backingMap = new HashMapImplementation$E$E(); 1630 this._backingMap = new HashMapImplementation$E$E();
1608 } 1631 }
1632 HashSetImplementation.prototype.is$HashSetImplementation = function(){return thi s;};
1609 HashSetImplementation.prototype.is$Iterable = function(){return this;}; 1633 HashSetImplementation.prototype.is$Iterable = function(){return this;};
1610 HashSetImplementation.HashSetImplementation$from$factory = function(other) { 1634 HashSetImplementation.HashSetImplementation$from$factory = function(other) {
1611 var $0; 1635 var $0;
1612 var set = new HashSetImplementation(); 1636 var set = new HashSetImplementation();
1613 for (var $i = other.iterator(); $i.hasNext(); ) { 1637 for (var $i = other.iterator(); $i.hasNext(); ) {
1614 var e = $i.next(); 1638 var e = $i.next();
1615 set.add(e); 1639 set.add(e);
1616 } 1640 }
1617 return set; 1641 return (set && set.is$HashSetImplementation());
1618 } 1642 }
1619 HashSetImplementation.prototype.clear = function() { 1643 HashSetImplementation.prototype.clear = function() {
1620 this._backingMap.clear(); 1644 this._backingMap.clear();
1621 } 1645 }
1622 HashSetImplementation.prototype.add = function(value) { 1646 HashSetImplementation.prototype.add = function(value) {
1623 this._backingMap.$setindex(value, value); 1647 this._backingMap.$setindex(value, value);
1624 } 1648 }
1625 HashSetImplementation.prototype.contains = function(value) { 1649 HashSetImplementation.prototype.contains = function(value) {
1626 return this._backingMap.containsKey(value); 1650 return this._backingMap.containsKey(value);
1627 } 1651 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 } 1719 }
1696 $inherits(HashSetImplementation$int, HashSetImplementation); 1720 $inherits(HashSetImplementation$int, HashSetImplementation);
1697 HashSetImplementation$int.prototype.is$Iterable = function(){return this;}; 1721 HashSetImplementation$int.prototype.is$Iterable = function(){return this;};
1698 // ********** Code for HashSetIterator ************** 1722 // ********** Code for HashSetIterator **************
1699 function HashSetIterator(set_) { 1723 function HashSetIterator(set_) {
1700 this._nextValidIndex = -1; 1724 this._nextValidIndex = -1;
1701 this._entries = set_._backingMap._keys; 1725 this._entries = set_._backingMap._keys;
1702 // Initializers done 1726 // Initializers done
1703 this._advance(); 1727 this._advance();
1704 } 1728 }
1729 HashSetIterator.prototype.is$Iterator$T = function(){return this;};
1705 HashSetIterator.prototype.hasNext = function() { 1730 HashSetIterator.prototype.hasNext = function() {
1706 if ($notnull_bool(this._nextValidIndex >= this._entries.length)) return false; 1731 if ($notnull_bool(this._nextValidIndex >= this._entries.length)) return false;
1707 if ($notnull_bool(this._entries.$index(this._nextValidIndex) === HashMapImplem entation._deletedKey)) { 1732 if ($notnull_bool(this._entries.$index(this._nextValidIndex) === HashMapImplem entation._deletedKey)) {
1708 this._advance(); 1733 this._advance();
1709 } 1734 }
1710 return this._nextValidIndex < this._entries.length; 1735 return this._nextValidIndex < this._entries.length;
1711 } 1736 }
1712 HashSetIterator.prototype.next = function() { 1737 HashSetIterator.prototype.next = function() {
1713 if ($notnull_bool(!$notnull_bool(this.hasNext()))) { 1738 if ($notnull_bool(!$notnull_bool(this.hasNext()))) {
1714 $throw(const$0/*const NoMoreElementsException()*/); 1739 $throw(const$0/*const NoMoreElementsException()*/);
(...skipping 13 matching lines...) Expand all
1728 while ($notnull_bool((entry == null) || (entry === deletedKey))) 1753 while ($notnull_bool((entry == null) || (entry === deletedKey)))
1729 } 1754 }
1730 // ********** Code for HashSetIterator$E ************** 1755 // ********** Code for HashSetIterator$E **************
1731 function HashSetIterator$E(set_) { 1756 function HashSetIterator$E(set_) {
1732 this._nextValidIndex = -1; 1757 this._nextValidIndex = -1;
1733 this._entries = set_._backingMap._keys; 1758 this._entries = set_._backingMap._keys;
1734 // Initializers done 1759 // Initializers done
1735 this._advance(); 1760 this._advance();
1736 } 1761 }
1737 $inherits(HashSetIterator$E, HashSetIterator); 1762 $inherits(HashSetIterator$E, HashSetIterator);
1763 HashSetIterator$E.prototype.is$Iterator$T = function(){return this;};
1738 HashSetIterator$E.prototype._advance = function() { 1764 HashSetIterator$E.prototype._advance = function() {
1739 var length = this._entries.length; 1765 var length = this._entries.length;
1740 var entry; 1766 var entry;
1741 var deletedKey = HashMapImplementation._deletedKey; 1767 var deletedKey = HashMapImplementation._deletedKey;
1742 do { 1768 do {
1743 if ($notnull_bool(++this._nextValidIndex >= length)) break; 1769 if ($notnull_bool(++this._nextValidIndex >= length)) break;
1744 entry = this._entries.$index(this._nextValidIndex); 1770 entry = this._entries.$index(this._nextValidIndex);
1745 } 1771 }
1746 while ($notnull_bool((entry == null) || (entry === deletedKey))) 1772 while ($notnull_bool((entry == null) || (entry === deletedKey)))
1747 } 1773 }
(...skipping 17 matching lines...) Expand all
1765 $inherits(KeyValuePair$Node$Element, KeyValuePair); 1791 $inherits(KeyValuePair$Node$Element, KeyValuePair);
1766 // ********** Code for KeyValuePair$String$Keyword ************** 1792 // ********** Code for KeyValuePair$String$Keyword **************
1767 function KeyValuePair$String$Keyword() {} 1793 function KeyValuePair$String$Keyword() {}
1768 $inherits(KeyValuePair$String$Keyword, KeyValuePair); 1794 $inherits(KeyValuePair$String$Keyword, KeyValuePair);
1769 // ********** Code for LinkedHashMapImplementation ************** 1795 // ********** Code for LinkedHashMapImplementation **************
1770 function LinkedHashMapImplementation() { 1796 function LinkedHashMapImplementation() {
1771 // Initializers done 1797 // Initializers done
1772 this._map = new HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$ V(); 1798 this._map = new HashMapImplementation$K$DoubleLinkedQueueEntry$KeyValuePair$K$ V();
1773 this._list = new DoubleLinkedQueue$KeyValuePair$K$V(); 1799 this._list = new DoubleLinkedQueue$KeyValuePair$K$V();
1774 } 1800 }
1801 LinkedHashMapImplementation.prototype.is$Map$Node$Element = function(){return th is;};
1802 LinkedHashMapImplementation.prototype.is$Map$String$Member = function(){return t his;};
1775 LinkedHashMapImplementation.prototype.$setindex = function(key, value) { 1803 LinkedHashMapImplementation.prototype.$setindex = function(key, value) {
1776 if ($notnull_bool(this._map.containsKey(key))) { 1804 if ($notnull_bool(this._map.containsKey(key))) {
1777 this._map.$index(key).get$element().value = value; 1805 this._map.$index(key).get$element().value = value;
1778 } 1806 }
1779 else { 1807 else {
1780 this._list.addLast(new KeyValuePair$K$V(key, value)); 1808 this._list.addLast(new KeyValuePair$K$V(key, value));
1781 this._map.$setindex(key, this._list.lastEntry()); 1809 this._map.$setindex(key, this._list.lastEntry());
1782 } 1810 }
1783 } 1811 }
1784 LinkedHashMapImplementation.prototype.$index = function(key) { 1812 LinkedHashMapImplementation.prototype.$index = function(key) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 LinkedHashMapImplementation.prototype.isEmpty = function() { 1853 LinkedHashMapImplementation.prototype.isEmpty = function() {
1826 return this.get$length() == 0; 1854 return this.get$length() == 0;
1827 } 1855 }
1828 // ********** Code for LinkedHashMapImplementation$Node$Element ************** 1856 // ********** Code for LinkedHashMapImplementation$Node$Element **************
1829 function LinkedHashMapImplementation$Node$Element() { 1857 function LinkedHashMapImplementation$Node$Element() {
1830 // Initializers done 1858 // Initializers done
1831 this._map = new HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair $Node$Element(); 1859 this._map = new HashMapImplementation$Node$DoubleLinkedQueueEntry$KeyValuePair $Node$Element();
1832 this._list = new DoubleLinkedQueue$KeyValuePair$Node$Element(); 1860 this._list = new DoubleLinkedQueue$KeyValuePair$Node$Element();
1833 } 1861 }
1834 $inherits(LinkedHashMapImplementation$Node$Element, LinkedHashMapImplementation) ; 1862 $inherits(LinkedHashMapImplementation$Node$Element, LinkedHashMapImplementation) ;
1863 LinkedHashMapImplementation$Node$Element.prototype.is$Map$Node$Element = functio n(){return this;};
1864 LinkedHashMapImplementation$Node$Element.prototype.is$Map$String$Member = false;
1835 // ********** Code for LinkedHashMapImplementation$String$Keyword ************** 1865 // ********** Code for LinkedHashMapImplementation$String$Keyword **************
1836 function LinkedHashMapImplementation$String$Keyword() { 1866 function LinkedHashMapImplementation$String$Keyword() {
1837 // Initializers done 1867 // Initializers done
1838 this._map = new HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePa ir$String$Keyword(); 1868 this._map = new HashMapImplementation$String$DoubleLinkedQueueEntry$KeyValuePa ir$String$Keyword();
1839 this._list = new DoubleLinkedQueue$KeyValuePair$String$Keyword(); 1869 this._list = new DoubleLinkedQueue$KeyValuePair$String$Keyword();
1840 } 1870 }
1841 $inherits(LinkedHashMapImplementation$String$Keyword, LinkedHashMapImplementatio n); 1871 $inherits(LinkedHashMapImplementation$String$Keyword, LinkedHashMapImplementatio n);
1872 LinkedHashMapImplementation$String$Keyword.prototype.is$Map$Node$Element = false ;
1873 LinkedHashMapImplementation$String$Keyword.prototype.is$Map$String$Member = fals e;
1842 // ********** Code for DoubleLinkedQueueEntry ************** 1874 // ********** Code for DoubleLinkedQueueEntry **************
1843 function DoubleLinkedQueueEntry(e) { 1875 function DoubleLinkedQueueEntry(e) {
1844 // Initializers done 1876 // Initializers done
1845 this._element = e; 1877 this._element = e;
1846 } 1878 }
1847 DoubleLinkedQueueEntry.prototype.is$DoubleLinkedQueueEntry$KeyValuePair$K$V = fu nction(){return this;}; 1879 DoubleLinkedQueueEntry.prototype.is$DoubleLinkedQueueEntry$KeyValuePair$K$V = fu nction(){return this;};
1848 DoubleLinkedQueueEntry.prototype._link = function(p, n) { 1880 DoubleLinkedQueueEntry.prototype._link = function(p, n) {
1849 this._next = n; 1881 this._next = n;
1850 this._previous = p; 1882 this._previous = p;
1851 p._next = this; 1883 p._next = this;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype._link = function(p, n ) { 1994 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype._link = function(p, n ) {
1963 this._next = n; 1995 this._next = n;
1964 this._previous = p; 1996 this._previous = p;
1965 p._next = this; 1997 p._next = this;
1966 n._previous = this; 1998 n._previous = this;
1967 } 1999 }
1968 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype.prepend = function(e) { 2000 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype.prepend = function(e) {
1969 new DoubleLinkedQueueEntry$KeyValuePair$K$V(e)._link(this._previous, this); 2001 new DoubleLinkedQueueEntry$KeyValuePair$K$V(e)._link(this._previous, this);
1970 } 2002 }
1971 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype.previousEntry = funct ion() { 2003 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype.previousEntry = funct ion() {
1972 return this._previous._asNonSentinelEntry(); 2004 var $0;
2005 return (($0 = this._previous._asNonSentinelEntry()) && $0.is$DoubleLinkedQueue Entry$KeyValuePair$K$V());
1973 } 2006 }
1974 // ********** Code for _DoubleLinkedQueueEntrySentinel$KeyValuePair$Node$Element ************** 2007 // ********** Code for _DoubleLinkedQueueEntrySentinel$KeyValuePair$Node$Element **************
1975 function _DoubleLinkedQueueEntrySentinel$KeyValuePair$Node$Element() { 2008 function _DoubleLinkedQueueEntrySentinel$KeyValuePair$Node$Element() {
1976 DoubleLinkedQueueEntry$E.call(this, null); 2009 DoubleLinkedQueueEntry$E.call(this, null);
1977 // Initializers done 2010 // Initializers done
1978 this._link(this, this); 2011 this._link(this, this);
1979 } 2012 }
1980 $inherits(_DoubleLinkedQueueEntrySentinel$KeyValuePair$Node$Element, _DoubleLink edQueueEntrySentinel); 2013 $inherits(_DoubleLinkedQueueEntrySentinel$KeyValuePair$Node$Element, _DoubleLink edQueueEntrySentinel);
1981 _DoubleLinkedQueueEntrySentinel$KeyValuePair$Node$Element.prototype._link = func tion(p, n) { 2014 _DoubleLinkedQueueEntrySentinel$KeyValuePair$Node$Element.prototype._link = func tion(p, n) {
1982 this._next = n; 2015 this._next = n;
(...skipping 12 matching lines...) Expand all
1995 this._next = n; 2028 this._next = n;
1996 this._previous = p; 2029 this._previous = p;
1997 p._next = this; 2030 p._next = this;
1998 n._previous = this; 2031 n._previous = this;
1999 } 2032 }
2000 // ********** Code for DoubleLinkedQueue ************** 2033 // ********** Code for DoubleLinkedQueue **************
2001 function DoubleLinkedQueue() { 2034 function DoubleLinkedQueue() {
2002 // Initializers done 2035 // Initializers done
2003 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); 2036 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E();
2004 } 2037 }
2038 DoubleLinkedQueue.prototype.is$DoubleLinkedQueue = function(){return this;};
2005 DoubleLinkedQueue.prototype.is$Iterable = function(){return this;}; 2039 DoubleLinkedQueue.prototype.is$Iterable = function(){return this;};
2006 DoubleLinkedQueue.DoubleLinkedQueue$from$factory = function(other) { 2040 DoubleLinkedQueue.DoubleLinkedQueue$from$factory = function(other) {
2007 var $0; 2041 var $0;
2008 var list = new DoubleLinkedQueue(); 2042 var list = new DoubleLinkedQueue();
2009 for (var $i = other.iterator(); $i.hasNext(); ) { 2043 for (var $i = other.iterator(); $i.hasNext(); ) {
2010 var e = $i.next(); 2044 var e = $i.next();
2011 list.addLast(e); 2045 list.addLast(e);
2012 } 2046 }
2013 return list; 2047 return (list && list.is$DoubleLinkedQueue());
2014 } 2048 }
2015 DoubleLinkedQueue.prototype.addLast = function(value) { 2049 DoubleLinkedQueue.prototype.addLast = function(value) {
2016 this._sentinel.prepend(value); 2050 this._sentinel.prepend(value);
2017 } 2051 }
2018 DoubleLinkedQueue.prototype.add = function(value) { 2052 DoubleLinkedQueue.prototype.add = function(value) {
2019 this.addLast(value); 2053 this.addLast(value);
2020 } 2054 }
2021 DoubleLinkedQueue.prototype.addAll = function(collection) { 2055 DoubleLinkedQueue.prototype.addAll = function(collection) {
2022 var $0; 2056 var $0;
2023 for (var $i = collection.iterator(); $i.hasNext(); ) { 2057 for (var $i = collection.iterator(); $i.hasNext(); ) {
(...skipping 15 matching lines...) Expand all
2039 this.forEach(function _(element) { 2073 this.forEach(function _(element) {
2040 counter++; 2074 counter++;
2041 } 2075 }
2042 ); 2076 );
2043 return counter; 2077 return counter;
2044 } 2078 }
2045 Object.defineProperty(DoubleLinkedQueue.prototype, "length", { 2079 Object.defineProperty(DoubleLinkedQueue.prototype, "length", {
2046 get: DoubleLinkedQueue.prototype.get$length 2080 get: DoubleLinkedQueue.prototype.get$length
2047 }); 2081 });
2048 DoubleLinkedQueue.prototype.isEmpty = function() { 2082 DoubleLinkedQueue.prototype.isEmpty = function() {
2049 return (this._sentinel._next === this._sentinel); 2083 return $assert_bool((this._sentinel._next === this._sentinel));
2050 } 2084 }
2051 DoubleLinkedQueue.prototype.forEach = function(f) { 2085 DoubleLinkedQueue.prototype.forEach = function(f) {
2052 var entry = this._sentinel._next; 2086 var entry = this._sentinel._next;
2053 while ($notnull_bool(entry !== this._sentinel)) { 2087 while ($notnull_bool(entry !== this._sentinel)) {
2054 f(entry._element); 2088 f(entry._element);
2055 entry = entry._next; 2089 entry = entry._next;
2056 } 2090 }
2057 } 2091 }
2058 DoubleLinkedQueue.prototype.some = function(f) { 2092 DoubleLinkedQueue.prototype.some = function(f) {
2059 var entry = this._sentinel._next; 2093 var entry = this._sentinel._next;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2120 function DoubleLinkedQueue$SourceString() {} 2154 function DoubleLinkedQueue$SourceString() {}
2121 $inherits(DoubleLinkedQueue$SourceString, DoubleLinkedQueue); 2155 $inherits(DoubleLinkedQueue$SourceString, DoubleLinkedQueue);
2122 DoubleLinkedQueue$SourceString.prototype.is$Iterable = function(){return this;}; 2156 DoubleLinkedQueue$SourceString.prototype.is$Iterable = function(){return this;};
2123 DoubleLinkedQueue$SourceString.DoubleLinkedQueue$from$factory = function(other) { 2157 DoubleLinkedQueue$SourceString.DoubleLinkedQueue$from$factory = function(other) {
2124 var $0; 2158 var $0;
2125 var list = new DoubleLinkedQueue(); 2159 var list = new DoubleLinkedQueue();
2126 for (var $i = other.iterator(); $i.hasNext(); ) { 2160 for (var $i = other.iterator(); $i.hasNext(); ) {
2127 var e = $i.next(); 2161 var e = $i.next();
2128 list.addLast(e); 2162 list.addLast(e);
2129 } 2163 }
2130 return list; 2164 return (list && list.is$DoubleLinkedQueue());
2131 } 2165 }
2132 // ********** Code for _DoubleLinkedQueueIterator ************** 2166 // ********** Code for _DoubleLinkedQueueIterator **************
2133 function _DoubleLinkedQueueIterator(_sentinel) { 2167 function _DoubleLinkedQueueIterator(_sentinel) {
2134 this._sentinel = _sentinel; 2168 this._sentinel = _sentinel;
2135 // Initializers done 2169 // Initializers done
2136 this._currentEntry = this._sentinel; 2170 this._currentEntry = this._sentinel;
2137 } 2171 }
2172 _DoubleLinkedQueueIterator.prototype.is$Iterator$T = function(){return this;};
2138 _DoubleLinkedQueueIterator.prototype.hasNext = function() { 2173 _DoubleLinkedQueueIterator.prototype.hasNext = function() {
2139 return this._currentEntry._next !== this._sentinel; 2174 return $assert_bool(this._currentEntry._next !== this._sentinel);
2140 } 2175 }
2141 _DoubleLinkedQueueIterator.prototype.next = function() { 2176 _DoubleLinkedQueueIterator.prototype.next = function() {
2142 if ($notnull_bool(!$notnull_bool(this.hasNext()))) { 2177 if ($notnull_bool(!$notnull_bool(this.hasNext()))) {
2143 $throw(const$0/*const NoMoreElementsException()*/); 2178 $throw(const$0/*const NoMoreElementsException()*/);
2144 } 2179 }
2145 this._currentEntry = this._currentEntry._next; 2180 this._currentEntry = this._currentEntry._next;
2146 return this._currentEntry.get$element(); 2181 return this._currentEntry.get$element();
2147 } 2182 }
2148 // ********** Code for _DoubleLinkedQueueIterator$E ************** 2183 // ********** Code for _DoubleLinkedQueueIterator$E **************
2149 function _DoubleLinkedQueueIterator$E(_sentinel) { 2184 function _DoubleLinkedQueueIterator$E(_sentinel) {
2150 this._sentinel = _sentinel; 2185 this._sentinel = _sentinel;
2151 // Initializers done 2186 // Initializers done
2152 this._currentEntry = this._sentinel; 2187 this._currentEntry = this._sentinel;
2153 } 2188 }
2154 $inherits(_DoubleLinkedQueueIterator$E, _DoubleLinkedQueueIterator); 2189 $inherits(_DoubleLinkedQueueIterator$E, _DoubleLinkedQueueIterator);
2190 _DoubleLinkedQueueIterator$E.prototype.is$Iterator$T = function(){return this;};
2155 // ********** Code for StopWatchImplementation ************** 2191 // ********** Code for StopWatchImplementation **************
2156 function StopWatchImplementation() { 2192 function StopWatchImplementation() {
2157 this._start = null; 2193 this._start = null;
2158 this._stop = null; 2194 this._stop = null;
2159 // Initializers done 2195 // Initializers done
2160 } 2196 }
2161 StopWatchImplementation.prototype.start = function() { 2197 StopWatchImplementation.prototype.start = function() {
2162 if ($notnull_bool(this._start == null)) { 2198 if ($notnull_bool(this._start == null)) {
2163 this._start = Clock.now(); 2199 this._start = Clock.now();
2164 } 2200 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 } 2253 }
2218 return this; 2254 return this;
2219 } 2255 }
2220 StringBufferImpl.prototype.clear = function() { 2256 StringBufferImpl.prototype.clear = function() {
2221 this._buffer = new ListFactory$String(); 2257 this._buffer = new ListFactory$String();
2222 this._length = 0; 2258 this._length = 0;
2223 return this; 2259 return this;
2224 } 2260 }
2225 StringBufferImpl.prototype.toString = function() { 2261 StringBufferImpl.prototype.toString = function() {
2226 if ($notnull_bool(this._buffer.length == 0)) return ""; 2262 if ($notnull_bool(this._buffer.length == 0)) return "";
2227 if ($notnull_bool(this._buffer.length == 1)) return this._buffer.$index(0); 2263 if ($notnull_bool(this._buffer.length == 1)) return $assert_String(this._buffe r.$index(0));
2228 var result = StringBase.concatAll(this._buffer); 2264 var result = StringBase.concatAll(this._buffer);
2229 this._buffer.clear(); 2265 this._buffer.clear();
2230 this._buffer.add(result); 2266 this._buffer.add(result);
2231 return result; 2267 return result;
2232 } 2268 }
2233 // ********** Code for StringBase ************** 2269 // ********** Code for StringBase **************
2234 function StringBase() {} 2270 function StringBase() {}
2235 StringBase.createFromCharCodes = function(charCodes) { 2271 StringBase.createFromCharCodes = function(charCodes) {
2236 if (Object.getPrototypeOf(charCodes) !== Array.prototype) { 2272 if (Object.getPrototypeOf(charCodes) !== Array.prototype) {
2237 var length = charCodes.length; 2273 var length = charCodes.length;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 DateImplementation.now$ctor = function() { 2368 DateImplementation.now$ctor = function() {
2333 this.timeZone = new TimeZoneImplementation.local$ctor(); 2369 this.timeZone = new TimeZoneImplementation.local$ctor();
2334 this.value = DateImplementation._now(); 2370 this.value = DateImplementation._now();
2335 // Initializers done 2371 // Initializers done
2336 this._asJs(); 2372 this._asJs();
2337 } 2373 }
2338 DateImplementation.now$ctor.prototype = DateImplementation.prototype; 2374 DateImplementation.now$ctor.prototype = DateImplementation.prototype;
2339 DateImplementation.prototype.get$value = function() { return this.value; }; 2375 DateImplementation.prototype.get$value = function() { return this.value; };
2340 DateImplementation.prototype.$eq = function(other) { 2376 DateImplementation.prototype.$eq = function(other) {
2341 if ($notnull_bool(!$notnull_bool(((other instanceof DateImplementation))))) re turn false; 2377 if ($notnull_bool(!$notnull_bool(((other instanceof DateImplementation))))) re turn false;
2342 return (this.value == other.get$value()) && ($eq(this.timeZone, other.timeZone )); 2378 return $assert_bool((this.value == other.get$value()) && ($eq(this.timeZone, o ther.timeZone)));
2343 } 2379 }
2344 DateImplementation.prototype.compareTo = function(other) { 2380 DateImplementation.prototype.compareTo = function(other) {
2345 return this.value.compareTo(other.value); 2381 return this.value.compareTo(other.value);
2346 } 2382 }
2347 DateImplementation.prototype.get$year = function() { 2383 DateImplementation.prototype.get$year = function() {
2348 return this.isUtc ? this._asJs().getUTCFullYear() : 2384 return this.isUtc ? this._asJs().getUTCFullYear() :
2349 this._asJs().getFullYear(); 2385 this._asJs().getFullYear();
2350 } 2386 }
2351 DateImplementation.prototype.get$month = function() { 2387 DateImplementation.prototype.get$month = function() {
2352 return this.isUtc ? this._asJs().getMonth() + 1 : 2388 return this.isUtc ? this._asJs().getMonth() + 1 :
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
3436 AbstractLink.prototype.get$head = function() { 3472 AbstractLink.prototype.get$head = function() {
3437 $throw("bug"); 3473 $throw("bug");
3438 } 3474 }
3439 AbstractLink.prototype.get$tail = function() { 3475 AbstractLink.prototype.get$tail = function() {
3440 $throw("bug"); 3476 $throw("bug");
3441 } 3477 }
3442 AbstractLink.prototype.prepend = function(element) { 3478 AbstractLink.prototype.prepend = function(element) {
3443 return LinkFactory.Link$factory(element, this); 3479 return LinkFactory.Link$factory(element, this);
3444 } 3480 }
3445 AbstractLink.prototype.iterator = function() { 3481 AbstractLink.prototype.iterator = function() {
3446 return this.toList().iterator(); 3482 var $0;
3483 return (($0 = this.toList().iterator()) && $0.is$Iterator$T());
3447 } 3484 }
3448 AbstractLink.prototype.printOn = function(buffer, separatedBy) { 3485 AbstractLink.prototype.printOn = function(buffer, separatedBy) {
3449 var $0; 3486 var $0;
3450 if ($notnull_bool(this.isEmpty())) return; 3487 if ($notnull_bool(this.isEmpty())) return;
3451 buffer.add($notnull_bool(this.get$head() == null) ? 'null' : this.get$head()); 3488 buffer.add($notnull_bool(this.get$head() == null) ? 'null' : this.get$head());
3452 if ($notnull_bool(separatedBy == null)) separatedBy = ''; 3489 if ($notnull_bool(separatedBy == null)) separatedBy = '';
3453 for (var link = (($0 = this.get$tail()) && $0.is$Link()); 3490 for (var link = (($0 = this.get$tail()) && $0.is$Link());
3454 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link())) { 3491 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link())) {
3455 buffer.add(separatedBy); 3492 buffer.add(separatedBy);
3456 buffer.add($notnull_bool(link.get$head() == null) ? 'null' : link.get$head() ); 3493 buffer.add($notnull_bool(link.get$head() == null) ? 'null' : link.get$head() );
3457 } 3494 }
3458 } 3495 }
3459 AbstractLink.prototype.toString = function() { 3496 AbstractLink.prototype.toString = function() {
3460 var buffer = new StringBufferImpl(""); 3497 var buffer = new StringBufferImpl("");
3461 buffer.add('[ '); 3498 buffer.add('[ ');
3462 this.printOn(buffer, ', '); 3499 this.printOn(buffer, ', ');
3463 buffer.add(' ]'); 3500 buffer.add(' ]');
3464 return buffer.toString(); 3501 return buffer.toString();
3465 } 3502 }
3466 // ********** Code for AbstractLink$T ************** 3503 // ********** Code for AbstractLink$T **************
3467 function AbstractLink$T() {} 3504 function AbstractLink$T() {}
3468 $inherits(AbstractLink$T, AbstractLink); 3505 $inherits(AbstractLink$T, AbstractLink);
3469 AbstractLink$T.prototype.is$Link = function(){return this;}; 3506 AbstractLink$T.prototype.is$Link = function(){return this;};
3470 AbstractLink$T.prototype.is$Link$Element = function(){return this;}; 3507 AbstractLink$T.prototype.is$Link$Element = function(){return this;};
3471 AbstractLink$T.prototype.is$Link$Node = function(){return this;}; 3508 AbstractLink$T.prototype.is$Link$Node = function(){return this;};
3472 AbstractLink$T.prototype.is$Link$T = function(){return this;}; 3509 AbstractLink$T.prototype.is$Link$T = function(){return this;};
3473 AbstractLink$T.prototype.is$Link$Type = function(){return this;}; 3510 AbstractLink$T.prototype.is$Link$Type = function(){return this;};
3474 AbstractLink$T.prototype.is$Iterable = function(){return this;}; 3511 AbstractLink$T.prototype.is$Iterable = function(){return this;};
3475 AbstractLink$T.prototype.iterator = function() { 3512 AbstractLink$T.prototype.iterator = function() {
3476 return this.toList().iterator(); 3513 var $0;
3514 return (($0 = this.toList().iterator()) && $0.is$Iterator$T());
3477 } 3515 }
3478 // ********** Code for LinkTail ************** 3516 // ********** Code for LinkTail **************
3479 function LinkTail() { 3517 function LinkTail() {
3480 // Initializers done 3518 // Initializers done
3481 } 3519 }
3482 $inherits(LinkTail, AbstractLink$T); 3520 $inherits(LinkTail, AbstractLink$T);
3483 LinkTail.prototype.is$Link = function(){return this;}; 3521 LinkTail.prototype.is$Link = function(){return this;};
3484 LinkTail.prototype.is$Link$Element = function(){return this;}; 3522 LinkTail.prototype.is$Link$Element = function(){return this;};
3485 LinkTail.prototype.is$Link$Node = function(){return this;}; 3523 LinkTail.prototype.is$Link$Node = function(){return this;};
3486 LinkTail.prototype.is$Link$T = function(){return this;}; 3524 LinkTail.prototype.is$Link$T = function(){return this;};
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
5470 else { 5508 else {
5471 this.listener.handleNoType(token); 5509 this.listener.handleNoType(token);
5472 } 5510 }
5473 this.listener.endTypeVariable(token); 5511 this.listener.endTypeVariable(token);
5474 return token; 5512 return token;
5475 } 5513 }
5476 PartialParser.prototype.get$parseTypeVariable = function() { 5514 PartialParser.prototype.get$parseTypeVariable = function() {
5477 return PartialParser.prototype.parseTypeVariable.bind(this); 5515 return PartialParser.prototype.parseTypeVariable.bind(this);
5478 } 5516 }
5479 PartialParser.prototype.optional = function(value, token) { 5517 PartialParser.prototype.optional = function(value, token) {
5480 return value === token.get$stringValue(); 5518 return $assert_bool(value === token.get$stringValue());
5481 } 5519 }
5482 PartialParser.prototype.parseType = function(token) { 5520 PartialParser.prototype.parseType = function(token) {
5483 if ($notnull_bool(this.isIdentifier(token))) { 5521 if ($notnull_bool(this.isIdentifier(token))) {
5484 token = this.parseIdentifier(token); 5522 token = this.parseIdentifier(token);
5485 while ($notnull_bool(this.optional('.', token))) { 5523 while ($notnull_bool(this.optional('.', token))) {
5486 token = this.parseIdentifier(this.next(token)); 5524 token = this.parseIdentifier(this.next(token));
5487 } 5525 }
5488 } 5526 }
5489 else if ($notnull_bool(this.optional('var', token))) { 5527 else if ($notnull_bool(this.optional('var', token))) {
5490 this.listener.handleVarKeyword(token); 5528 this.listener.handleVarKeyword(token);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
5727 Parser.prototype.parseExpression = function(token) { 5765 Parser.prototype.parseExpression = function(token) {
5728 token = this.parseConditionalExpression(token); 5766 token = this.parseConditionalExpression(token);
5729 if ($notnull_bool(this.isAssignmentOperator(token))) { 5767 if ($notnull_bool(this.isAssignmentOperator(token))) {
5730 var operator = token; 5768 var operator = token;
5731 token = this.parseExpression(this.next(token)); 5769 token = this.parseExpression(this.next(token));
5732 this.listener.handleAssignmentExpression(operator); 5770 this.listener.handleAssignmentExpression(operator);
5733 } 5771 }
5734 return token; 5772 return token;
5735 } 5773 }
5736 Parser.prototype.isAssignmentOperator = function(token) { 5774 Parser.prototype.isAssignmentOperator = function(token) {
5737 return 2 === this.getPrecedence(token); 5775 return $assert_bool(2 === this.getPrecedence(token));
5738 } 5776 }
5739 Parser.prototype.parseConditionalExpression = function(token) { 5777 Parser.prototype.parseConditionalExpression = function(token) {
5740 token = this.parseBinaryExpression(token, 4); 5778 token = this.parseBinaryExpression(token, 4);
5741 if ($notnull_bool(this.optional('?', token))) { 5779 if ($notnull_bool(this.optional('?', token))) {
5742 var question = token; 5780 var question = token;
5743 token = this.parseExpression(this.next(token)); 5781 token = this.parseExpression(this.next(token));
5744 var colon = token; 5782 var colon = token;
5745 token = this.expect(':', token); 5783 token = this.expect(':', token);
5746 token = this.parseExpression(token); 5784 token = this.parseExpression(token);
5747 this.listener.handleConditionalExpression(question, colon); 5785 this.listener.handleConditionalExpression(question, colon);
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
6124 function ParserTask(compiler) { 6162 function ParserTask(compiler) {
6125 CompilerTask.call(this, compiler); 6163 CompilerTask.call(this, compiler);
6126 // Initializers done 6164 // Initializers done
6127 } 6165 }
6128 $inherits(ParserTask, CompilerTask); 6166 $inherits(ParserTask, CompilerTask);
6129 ParserTask.prototype.get$name = function() { 6167 ParserTask.prototype.get$name = function() {
6130 return 'Parser'; 6168 return 'Parser';
6131 } 6169 }
6132 ParserTask.prototype.parse = function(element) { 6170 ParserTask.prototype.parse = function(element) {
6133 var $this = this; // closure support 6171 var $this = this; // closure support
6134 return this.measure((function () { 6172 var $0;
6173 return (($0 = this.measure((function () {
6135 return element.parseNode($this.compiler, $this.compiler); 6174 return element.parseNode($this.compiler, $this.compiler);
6136 }) 6175 })
6137 ); 6176 )) && $0.is$Node());
6138 } 6177 }
6139 // ********** Code for Listener ************** 6178 // ********** Code for Listener **************
6140 function Listener() {} 6179 function Listener() {}
6141 Listener.prototype.beginArguments = function(token) { 6180 Listener.prototype.beginArguments = function(token) {
6142 6181
6143 } 6182 }
6144 Listener.prototype.endArguments = function(count, beginToken, endToken) { 6183 Listener.prototype.endArguments = function(count, beginToken, endToken) {
6145 6184
6146 } 6185 }
6147 Listener.prototype.beginBlock = function(token) { 6186 Listener.prototype.beginBlock = function(token) {
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
6678 this.internalString = internalString; 6717 this.internalString = internalString;
6679 this.begin = begin; 6718 this.begin = begin;
6680 this.end = end; 6719 this.end = end;
6681 // Initializers done 6720 // Initializers done
6682 } 6721 }
6683 SubstringWrapper.prototype.is$SourceString = function(){return this;}; 6722 SubstringWrapper.prototype.is$SourceString = function(){return this;};
6684 SubstringWrapper.prototype.hashCode = function() { 6723 SubstringWrapper.prototype.hashCode = function() {
6685 return this.toString().hashCode(); 6724 return this.toString().hashCode();
6686 } 6725 }
6687 SubstringWrapper.prototype.$eq = function(other) { 6726 SubstringWrapper.prototype.$eq = function(other) {
6688 return !!(other && other.is$SourceString) && this.toString() == other.toString (); 6727 return $assert_bool(!!(other && other.is$SourceString) && this.toString() == o ther.toString());
6689 } 6728 }
6690 SubstringWrapper.prototype.printOn = function(sb) { 6729 SubstringWrapper.prototype.printOn = function(sb) {
6691 sb.add(this); 6730 sb.add(this);
6692 } 6731 }
6693 SubstringWrapper.prototype.toString = function() { 6732 SubstringWrapper.prototype.toString = function() {
6694 return this.internalString.substring(this.begin, this.end); 6733 return this.internalString.substring(this.begin, this.end);
6695 } 6734 }
6696 SubstringWrapper.prototype.get$stringValue = function() { 6735 SubstringWrapper.prototype.get$stringValue = function() {
6697 return null; 6736 return null;
6698 } 6737 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
6749 // ********** Code for StringWrapper ************** 6788 // ********** Code for StringWrapper **************
6750 function StringWrapper(internalString) { 6789 function StringWrapper(internalString) {
6751 this.internalString = internalString; 6790 this.internalString = internalString;
6752 // Initializers done 6791 // Initializers done
6753 } 6792 }
6754 StringWrapper.prototype.is$SourceString = function(){return this;}; 6793 StringWrapper.prototype.is$SourceString = function(){return this;};
6755 StringWrapper.prototype.hashCode = function() { 6794 StringWrapper.prototype.hashCode = function() {
6756 return this.toString().hashCode(); 6795 return this.toString().hashCode();
6757 } 6796 }
6758 StringWrapper.prototype.$eq = function(other) { 6797 StringWrapper.prototype.$eq = function(other) {
6759 return !!(other && other.is$SourceString) && this.toString() == other.toString (); 6798 return $assert_bool(!!(other && other.is$SourceString) && this.toString() == o ther.toString());
6760 } 6799 }
6761 StringWrapper.prototype.printOn = function(sb) { 6800 StringWrapper.prototype.printOn = function(sb) {
6762 sb.add(this.internalString); 6801 sb.add(this.internalString);
6763 } 6802 }
6764 StringWrapper.prototype.toString = function() { 6803 StringWrapper.prototype.toString = function() {
6765 return this.internalString; 6804 return this.internalString;
6766 } 6805 }
6767 StringWrapper.prototype.get$stringValue = function() { 6806 StringWrapper.prototype.get$stringValue = function() {
6768 return this.internalString; 6807 return this.internalString;
6769 } 6808 }
(...skipping 17 matching lines...) Expand all
6787 for (var $i0 = const$230/*Keyword.values*/.iterator(); $i0.hasNext(); ) { 6826 for (var $i0 = const$230/*Keyword.values*/.iterator(); $i0.hasNext(); ) {
6788 var keyword = $i0.next(); 6827 var keyword = $i0.next();
6789 result.$setindex(keyword.syntax, keyword); 6828 result.$setindex(keyword.syntax, keyword);
6790 } 6829 }
6791 return result; 6830 return result;
6792 } 6831 }
6793 Keyword.prototype.hashCode = function() { 6832 Keyword.prototype.hashCode = function() {
6794 return this.syntax.hashCode(); 6833 return this.syntax.hashCode();
6795 } 6834 }
6796 Keyword.prototype.$eq = function(other) { 6835 Keyword.prototype.$eq = function(other) {
6797 return !!(other && other.is$SourceString) && this.toString() == other.toString (); 6836 return $assert_bool(!!(other && other.is$SourceString) && this.toString() == o ther.toString());
6798 } 6837 }
6799 Keyword.prototype.printOn = function(sb) { 6838 Keyword.prototype.printOn = function(sb) {
6800 sb.add(this.syntax); 6839 sb.add(this.syntax);
6801 } 6840 }
6802 Keyword.prototype.toString = function() { 6841 Keyword.prototype.toString = function() {
6803 return this.syntax; 6842 return this.syntax;
6804 } 6843 }
6805 Keyword.prototype.get$stringValue = function() { 6844 Keyword.prototype.get$stringValue = function() {
6806 return this.syntax; 6845 return this.syntax;
6807 } 6846 }
6808 // ********** Code for KeywordState ************** 6847 // ********** Code for KeywordState **************
6809 function KeywordState() {} 6848 function KeywordState() {}
6849 KeywordState.prototype.is$KeywordState = function(){return this;};
6810 KeywordState.get$KEYWORD_STATE = function() { 6850 KeywordState.get$KEYWORD_STATE = function() {
6811 if ($notnull_bool(KeywordState._KEYWORD_STATE == null)) { 6851 if ($notnull_bool(KeywordState._KEYWORD_STATE == null)) {
6812 var strings = new ListFactory$String(const$230/*Keyword.values*/.get$length( )); 6852 var strings = new ListFactory$String(const$230/*Keyword.values*/.get$length( ));
6813 for (var i = 0; 6853 for (var i = 0;
6814 $notnull_bool(i < const$230/*Keyword.values*/.get$length()); i++) { 6854 $notnull_bool(i < const$230/*Keyword.values*/.get$length()); i++) {
6815 strings.$setindex(i, const$230/*Keyword.values*/[i].syntax); 6855 strings.$setindex(i, const$230/*Keyword.values*/[i].syntax);
6816 } 6856 }
6817 strings.sort((function (a, b) { 6857 strings.sort((function (a, b) {
6818 return a.compareTo(b); 6858 return a.compareTo(b);
6819 }) 6859 })
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
6852 // ********** Code for ArrayKeywordState ************** 6892 // ********** Code for ArrayKeywordState **************
6853 function ArrayKeywordState(table) { 6893 function ArrayKeywordState(table) {
6854 this.table = table; 6894 this.table = table;
6855 // Initializers done 6895 // Initializers done
6856 } 6896 }
6857 $inherits(ArrayKeywordState, KeywordState); 6897 $inherits(ArrayKeywordState, KeywordState);
6858 ArrayKeywordState.prototype.isLeaf = function() { 6898 ArrayKeywordState.prototype.isLeaf = function() {
6859 return false; 6899 return false;
6860 } 6900 }
6861 ArrayKeywordState.prototype.next = function(c) { 6901 ArrayKeywordState.prototype.next = function(c) {
6862 return this.table.$index(c - 97/*null.$a*/); 6902 var $0;
6903 return (($0 = this.table.$index(c - 97/*null.$a*/)) && $0.is$KeywordState());
6863 } 6904 }
6864 ArrayKeywordState.prototype.get$keyword = function() { 6905 ArrayKeywordState.prototype.get$keyword = function() {
6865 $throw("should not be called"); 6906 $throw("should not be called");
6866 } 6907 }
6867 ArrayKeywordState.prototype.toString = function() { 6908 ArrayKeywordState.prototype.toString = function() {
6868 var sb = new StringBufferImpl(""); 6909 var sb = new StringBufferImpl("");
6869 sb.add("["); 6910 sb.add("[");
6870 var foo = this.table; 6911 var foo = this.table;
6871 for (var i = 0; 6912 for (var i = 0;
6872 $notnull_bool(i < foo.length); i++) { 6913 $notnull_bool(i < foo.length); i++) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
6936 // Initializers done 6977 // Initializers done
6937 } 6978 }
6938 $inherits(ClassNode, Node); 6979 $inherits(ClassNode, Node);
6939 ClassNode.prototype.is$ClassNode = function(){return this;}; 6980 ClassNode.prototype.is$ClassNode = function(){return this;};
6940 ClassNode.prototype.get$name = function() { return this.name; }; 6981 ClassNode.prototype.get$name = function() { return this.name; };
6941 ClassNode.prototype.get$interfaces = function() { return this.interfaces; }; 6982 ClassNode.prototype.get$interfaces = function() { return this.interfaces; };
6942 ClassNode.prototype.accept = function(visitor) { 6983 ClassNode.prototype.accept = function(visitor) {
6943 return visitor.visitClassNode(this); 6984 return visitor.visitClassNode(this);
6944 } 6985 }
6945 ClassNode.prototype.get$isInterface = function() { 6986 ClassNode.prototype.get$isInterface = function() {
6946 return this.beginToken.get$stringValue() === 'interface'; 6987 return $assert_bool(this.beginToken.get$stringValue() === 'interface');
6947 } 6988 }
6948 ClassNode.prototype.get$isClass = function() { 6989 ClassNode.prototype.get$isClass = function() {
6949 return !$notnull_bool(this.get$isInterface()); 6990 return !$notnull_bool(this.get$isInterface());
6950 } 6991 }
6951 ClassNode.prototype.getBeginToken = function() { 6992 ClassNode.prototype.getBeginToken = function() {
6952 return this.beginToken; 6993 return this.beginToken;
6953 } 6994 }
6954 ClassNode.prototype.getEndToken = function() { 6995 ClassNode.prototype.getEndToken = function() {
6955 return this.endToken; 6996 return this.endToken;
6956 } 6997 }
(...skipping 14 matching lines...) Expand all
6971 } 7012 }
6972 $inherits(Send, Expression); 7013 $inherits(Send, Expression);
6973 Send.prototype.is$Send = function(){return this;}; 7014 Send.prototype.is$Send = function(){return this;};
6974 Send.prototype.get$arguments = function() { 7015 Send.prototype.get$arguments = function() {
6975 return this.argumentsNode.nodes; 7016 return this.argumentsNode.nodes;
6976 } 7017 }
6977 Send.prototype.accept = function(visitor) { 7018 Send.prototype.accept = function(visitor) {
6978 return visitor.visitSend(this); 7019 return visitor.visitSend(this);
6979 } 7020 }
6980 Send.prototype.get$isPropertyAccess = function() { 7021 Send.prototype.get$isPropertyAccess = function() {
6981 return this.argumentsNode == null; 7022 return $assert_bool(this.argumentsNode == null);
6982 } 7023 }
6983 Send.prototype.get$isFunctionObjectInvocation = function() { 7024 Send.prototype.get$isFunctionObjectInvocation = function() {
6984 return this.selector == null; 7025 return $assert_bool(this.selector == null);
6985 } 7026 }
6986 Send.prototype.getBeginToken = function() { 7027 Send.prototype.getBeginToken = function() {
6987 return firstBeginToken(this.receiver, this.selector); 7028 return firstBeginToken(this.receiver, this.selector);
6988 } 7029 }
6989 Send.prototype.getEndToken = function() { 7030 Send.prototype.getEndToken = function() {
7031 var $0;
6990 var token; 7032 var token;
6991 if ($notnull_bool(this.argumentsNode != null)) token = this.argumentsNode.getE ndToken(); 7033 if ($notnull_bool(this.argumentsNode != null)) token = this.argumentsNode.getE ndToken();
6992 if ($notnull_bool(token != null)) return token; 7034 if ($notnull_bool(token != null)) return token;
6993 if ($notnull_bool(this.selector != null)) { 7035 if ($notnull_bool(this.selector != null)) {
6994 return this.selector.getEndToken(); 7036 return (($0 = this.selector.getEndToken()) && $0.is$Token());
6995 } 7037 }
6996 return this.receiver.getBeginToken(); 7038 return (($0 = this.receiver.getBeginToken()) && $0.is$Token());
6997 } 7039 }
6998 // ********** Code for SendSet ************** 7040 // ********** Code for SendSet **************
6999 function SendSet(receiver, selector, assignmentOperator, argumentsNode) { 7041 function SendSet(receiver, selector, assignmentOperator, argumentsNode) {
7000 this.assignmentOperator = assignmentOperator; 7042 this.assignmentOperator = assignmentOperator;
7001 Send.call(this, receiver, selector, argumentsNode); 7043 Send.call(this, receiver, selector, argumentsNode);
7002 // Initializers done 7044 // Initializers done
7003 } 7045 }
7004 $inherits(SendSet, Send); 7046 $inherits(SendSet, Send);
7005 SendSet.prototype.is$SendSet = function(){return this;}; 7047 SendSet.prototype.is$SendSet = function(){return this;};
7006 SendSet.prototype.accept = function(visitor) { 7048 SendSet.prototype.accept = function(visitor) {
(...skipping 17 matching lines...) Expand all
7024 NodeList.prototype.accept = function(visitor) { 7066 NodeList.prototype.accept = function(visitor) {
7025 return visitor.visitNodeList(this); 7067 return visitor.visitNodeList(this);
7026 } 7068 }
7027 NodeList.prototype.getBeginToken = function() { 7069 NodeList.prototype.getBeginToken = function() {
7028 var $0; 7070 var $0;
7029 if ($notnull_bool(this.beginToken != null)) return this.beginToken; 7071 if ($notnull_bool(this.beginToken != null)) return this.beginToken;
7030 if ($notnull_bool(this.nodes != null)) { 7072 if ($notnull_bool(this.nodes != null)) {
7031 for (var link = this.nodes; 7073 for (var link = this.nodes;
7032 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail( )) && $0.is$Link$Node())) { 7074 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail( )) && $0.is$Link$Node())) {
7033 if ($notnull_bool(link.get$head().getBeginToken() != null)) { 7075 if ($notnull_bool(link.get$head().getBeginToken() != null)) {
7034 return link.get$head().getBeginToken(); 7076 return (($0 = link.get$head().getBeginToken()) && $0.is$Token());
7035 } 7077 }
7036 if ($notnull_bool(link.get$head().getEndToken() != null)) { 7078 if ($notnull_bool(link.get$head().getEndToken() != null)) {
7037 return link.get$head().getEndToken(); 7079 return (($0 = link.get$head().getEndToken()) && $0.is$Token());
7038 } 7080 }
7039 } 7081 }
7040 } 7082 }
7041 return this.endToken; 7083 return this.endToken;
7042 } 7084 }
7043 NodeList.prototype.getEndToken = function() { 7085 NodeList.prototype.getEndToken = function() {
7044 var $0; 7086 var $0;
7045 if ($notnull_bool(this.endToken != null)) return this.endToken; 7087 if ($notnull_bool(this.endToken != null)) return this.endToken;
7046 if ($notnull_bool(this.nodes != null)) { 7088 if ($notnull_bool(this.nodes != null)) {
7047 var link = this.nodes; 7089 var link = this.nodes;
7048 while ($notnull_bool(!$notnull_bool(link.get$tail().isEmpty()))) link = (($0 = link.get$tail()) && $0.is$Link$Node()); 7090 while ($notnull_bool(!$notnull_bool(link.get$tail().isEmpty()))) link = (($0 = link.get$tail()) && $0.is$Link$Node());
7049 if ($notnull_bool(link.get$head().getEndToken() != null)) return link.get$he ad().getEndToken(); 7091 if ($notnull_bool(link.get$head().getEndToken() != null)) return (($0 = link .get$head().getEndToken()) && $0.is$Token());
7050 if ($notnull_bool(link.get$head().getBeginToken() != null)) return link.get$ head().getBeginToken(); 7092 if ($notnull_bool(link.get$head().getBeginToken() != null)) return (($0 = li nk.get$head().getBeginToken()) && $0.is$Token());
7051 } 7093 }
7052 return this.beginToken; 7094 return this.beginToken;
7053 } 7095 }
7054 // ********** Code for Block ************** 7096 // ********** Code for Block **************
7055 function Block(statements) { 7097 function Block(statements) {
7056 this.statements = statements; 7098 this.statements = statements;
7057 // Initializers done 7099 // Initializers done
7058 } 7100 }
7059 $inherits(Block, Statement); 7101 $inherits(Block, Statement);
7060 Block.prototype.accept = function(visitor) { 7102 Block.prototype.accept = function(visitor) {
7061 return visitor.visitBlock(this); 7103 return visitor.visitBlock(this);
7062 } 7104 }
7063 Block.prototype.getBeginToken = function() { 7105 Block.prototype.getBeginToken = function() {
7064 return this.statements.getBeginToken(); 7106 return this.statements.getBeginToken();
7065 } 7107 }
7066 Block.prototype.getEndToken = function() { 7108 Block.prototype.getEndToken = function() {
7067 return this.statements.getEndToken(); 7109 return this.statements.getEndToken();
7068 } 7110 }
7069 // ********** Code for If ************** 7111 // ********** Code for If **************
7070 function If(condition, thenPart, elsePart, ifToken, elseToken) { 7112 function If(condition, thenPart, elsePart, ifToken, elseToken) {
7071 this.condition = condition; 7113 this.condition = condition;
7072 this.thenPart = thenPart; 7114 this.thenPart = thenPart;
7073 this.elsePart = elsePart; 7115 this.elsePart = elsePart;
7074 this.ifToken = ifToken; 7116 this.ifToken = ifToken;
7075 this.elseToken = elseToken; 7117 this.elseToken = elseToken;
7076 // Initializers done 7118 // Initializers done
7077 } 7119 }
7078 $inherits(If, Statement); 7120 $inherits(If, Statement);
7079 If.prototype.get$hasElsePart = function() { 7121 If.prototype.get$hasElsePart = function() {
7080 return this.elsePart != null; 7122 return $assert_bool(this.elsePart != null);
7081 } 7123 }
7082 If.prototype.accept = function(visitor) { 7124 If.prototype.accept = function(visitor) {
7083 return visitor.visitIf(this); 7125 return visitor.visitIf(this);
7084 } 7126 }
7085 If.prototype.getBeginToken = function() { 7127 If.prototype.getBeginToken = function() {
7086 return this.ifToken; 7128 return this.ifToken;
7087 } 7129 }
7088 If.prototype.getEndToken = function() { 7130 If.prototype.getEndToken = function() {
7089 if ($notnull_bool(this.elsePart == null)) return this.thenPart.getEndToken(); 7131 if ($notnull_bool(this.elsePart == null)) return this.thenPart.getEndToken();
7090 return this.elsePart.getEndToken(); 7132 return this.elsePart.getEndToken();
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
7233 return visitor.visitLiteralBool(this); 7275 return visitor.visitLiteralBool(this);
7234 } 7276 }
7235 // ********** Code for LiteralString ************** 7277 // ********** Code for LiteralString **************
7236 function LiteralString(token) { 7278 function LiteralString(token) {
7237 Literal$SourceString.call(this, token, to$call$2(null)); 7279 Literal$SourceString.call(this, token, to$call$2(null));
7238 // Initializers done 7280 // Initializers done
7239 } 7281 }
7240 $inherits(LiteralString, Literal$SourceString); 7282 $inherits(LiteralString, Literal$SourceString);
7241 LiteralString.prototype.is$LiteralString = function(){return this;}; 7283 LiteralString.prototype.is$LiteralString = function(){return this;};
7242 LiteralString.prototype.get$value = function() { 7284 LiteralString.prototype.get$value = function() {
7243 return this.token.get$value(); 7285 var $0;
7286 return (($0 = this.token.get$value()) && $0.is$SourceString());
7244 } 7287 }
7245 LiteralString.prototype.accept = function(visitor) { 7288 LiteralString.prototype.accept = function(visitor) {
7246 return visitor.visitLiteralString(this); 7289 return visitor.visitLiteralString(this);
7247 } 7290 }
7248 // ********** Code for Identifier ************** 7291 // ********** Code for Identifier **************
7249 function Identifier(token) { 7292 function Identifier(token) {
7250 this.token = token; 7293 this.token = token;
7251 // Initializers done 7294 // Initializers done
7252 } 7295 }
7253 $inherits(Identifier, Expression); 7296 $inherits(Identifier, Expression);
7254 Identifier.prototype.is$Identifier = function(){return this;}; 7297 Identifier.prototype.is$Identifier = function(){return this;};
7255 Identifier.prototype.get$source = function() { 7298 Identifier.prototype.get$source = function() {
7256 return this.token.get$value(); 7299 var $0;
7300 return (($0 = this.token.get$value()) && $0.is$SourceString());
7257 } 7301 }
7258 Identifier.prototype.accept = function(visitor) { 7302 Identifier.prototype.accept = function(visitor) {
7259 return visitor.visitIdentifier(this); 7303 return visitor.visitIdentifier(this);
7260 } 7304 }
7261 Identifier.prototype.getBeginToken = function() { 7305 Identifier.prototype.getBeginToken = function() {
7262 return this.token; 7306 return this.token;
7263 } 7307 }
7264 Identifier.prototype.getEndToken = function() { 7308 Identifier.prototype.getEndToken = function() {
7265 return this.token; 7309 return this.token;
7266 } 7310 }
7267 // ********** Code for Operator ************** 7311 // ********** Code for Operator **************
7268 function Operator(token) { 7312 function Operator(token) {
7269 Identifier.call(this, token); 7313 Identifier.call(this, token);
7270 // Initializers done 7314 // Initializers done
7271 } 7315 }
7272 $inherits(Operator, Identifier); 7316 $inherits(Operator, Identifier);
7273 Operator.prototype.is$Operator = function(){return this;}; 7317 Operator.prototype.is$Operator = function(){return this;};
7274 Operator.prototype.accept = function(visitor) { 7318 Operator.prototype.accept = function(visitor) {
7275 return visitor.visitOperator(this); 7319 return visitor.visitOperator(this);
7276 } 7320 }
7277 // ********** Code for Return ************** 7321 // ********** Code for Return **************
7278 function Return(beginToken, endToken, expression) { 7322 function Return(beginToken, endToken, expression) {
7279 this.beginToken = beginToken; 7323 this.beginToken = beginToken;
7280 this.endToken = endToken; 7324 this.endToken = endToken;
7281 this.expression = expression; 7325 this.expression = expression;
7282 // Initializers done 7326 // Initializers done
7283 } 7327 }
7284 $inherits(Return, Statement); 7328 $inherits(Return, Statement);
7285 Return.prototype.get$hasExpression = function() { 7329 Return.prototype.get$hasExpression = function() {
7286 return this.expression != null; 7330 return $assert_bool(this.expression != null);
7287 } 7331 }
7288 Return.prototype.accept = function(visitor) { 7332 Return.prototype.accept = function(visitor) {
7289 return visitor.visitReturn(this); 7333 return visitor.visitReturn(this);
7290 } 7334 }
7291 Return.prototype.getBeginToken = function() { 7335 Return.prototype.getBeginToken = function() {
7292 return this.beginToken; 7336 return this.beginToken;
7293 } 7337 }
7294 Return.prototype.getEndToken = function() { 7338 Return.prototype.getEndToken = function() {
7295 return this.endToken; 7339 return this.endToken;
7296 } 7340 }
7297 // ********** Code for ExpressionStatement ************** 7341 // ********** Code for ExpressionStatement **************
7298 function ExpressionStatement(expression, endToken) { 7342 function ExpressionStatement(expression, endToken) {
7299 this.expression = expression; 7343 this.expression = expression;
7300 this.endToken = endToken; 7344 this.endToken = endToken;
7301 // Initializers done 7345 // Initializers done
7302 } 7346 }
7303 $inherits(ExpressionStatement, Statement); 7347 $inherits(ExpressionStatement, Statement);
7304 ExpressionStatement.prototype.is$ExpressionStatement = function(){return this;}; 7348 ExpressionStatement.prototype.is$ExpressionStatement = function(){return this;};
7305 ExpressionStatement.prototype.accept = function(visitor) { 7349 ExpressionStatement.prototype.accept = function(visitor) {
7306 return visitor.visitExpressionStatement(this); 7350 return visitor.visitExpressionStatement(this);
7307 } 7351 }
7308 ExpressionStatement.prototype.getBeginToken = function() { 7352 ExpressionStatement.prototype.getBeginToken = function() {
7309 return this.expression.getBeginToken(); 7353 var $0;
7354 return (($0 = this.expression.getBeginToken()) && $0.is$Token());
7310 } 7355 }
7311 ExpressionStatement.prototype.getEndToken = function() { 7356 ExpressionStatement.prototype.getEndToken = function() {
7312 return this.endToken; 7357 return this.endToken;
7313 } 7358 }
7314 // ********** Code for Throw ************** 7359 // ********** Code for Throw **************
7315 function Throw(expression, throwToken, endToken) { 7360 function Throw(expression, throwToken, endToken) {
7316 this.expression = expression; 7361 this.expression = expression;
7317 this.throwToken = throwToken; 7362 this.throwToken = throwToken;
7318 this.endToken = endToken; 7363 this.endToken = endToken;
7319 // Initializers done 7364 // Initializers done
(...skipping 13 matching lines...) Expand all
7333 this.typeName = typeName; 7378 this.typeName = typeName;
7334 // Initializers done 7379 // Initializers done
7335 } 7380 }
7336 $inherits(TypeAnnotation, Node); 7381 $inherits(TypeAnnotation, Node);
7337 TypeAnnotation.prototype.is$TypeAnnotation = function(){return this;}; 7382 TypeAnnotation.prototype.is$TypeAnnotation = function(){return this;};
7338 TypeAnnotation.prototype.get$typeName = function() { return this.typeName; }; 7383 TypeAnnotation.prototype.get$typeName = function() { return this.typeName; };
7339 TypeAnnotation.prototype.accept = function(visitor) { 7384 TypeAnnotation.prototype.accept = function(visitor) {
7340 return visitor.visitTypeAnnotation(this); 7385 return visitor.visitTypeAnnotation(this);
7341 } 7386 }
7342 TypeAnnotation.prototype.getBeginToken = function() { 7387 TypeAnnotation.prototype.getBeginToken = function() {
7343 return this.typeName.getBeginToken(); 7388 var $0;
7389 return (($0 = this.typeName.getBeginToken()) && $0.is$Token());
7344 } 7390 }
7345 TypeAnnotation.prototype.getEndToken = function() { 7391 TypeAnnotation.prototype.getEndToken = function() {
7346 return this.typeName.getEndToken(); 7392 var $0;
7393 return (($0 = this.typeName.getEndToken()) && $0.is$Token());
7347 } 7394 }
7348 // ********** Code for VariableDefinitions ************** 7395 // ********** Code for VariableDefinitions **************
7349 function VariableDefinitions(type, modifiers, definitions, endToken) { 7396 function VariableDefinitions(type, modifiers, definitions, endToken) {
7350 this.type = type; 7397 this.type = type;
7351 this.modifiers = modifiers; 7398 this.modifiers = modifiers;
7352 this.definitions = definitions; 7399 this.definitions = definitions;
7353 this.endToken = endToken; 7400 this.endToken = endToken;
7354 // Initializers done 7401 // Initializers done
7355 } 7402 }
7356 $inherits(VariableDefinitions, Statement); 7403 $inherits(VariableDefinitions, Statement);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
7498 } 7545 }
7499 else { 7546 else {
7500 this.sb.add('var'); 7547 this.sb.add('var');
7501 } 7548 }
7502 this.sb.add(' '); 7549 this.sb.add(' ');
7503 this.visit(node.definitions); 7550 this.visit(node.definitions);
7504 if ($notnull_bool(node.endToken != null)) this.add((($0 = node.endToken.get$va lue()) && $0.is$SourceString())); 7551 if ($notnull_bool(node.endToken != null)) this.add((($0 = node.endToken.get$va lue()) && $0.is$SourceString()));
7505 } 7552 }
7506 // ********** Code for top level ************** 7553 // ********** Code for top level **************
7507 function firstBeginToken(first, second) { 7554 function firstBeginToken(first, second) {
7508 return $notnull_bool((first != null)) ? first.getBeginToken() : second.getBegi nToken(); 7555 var $0;
7556 return (($0 = $notnull_bool((first != null)) ? first.getBeginToken() : second. getBeginToken()) && $0.is$Token());
7509 } 7557 }
7510 // ********** Library elements ************** 7558 // ********** Library elements **************
7511 // ********** Code for ElementKind ************** 7559 // ********** Code for ElementKind **************
7512 function ElementKind(id) { 7560 function ElementKind(id) {
7513 this.id = id; 7561 this.id = id;
7514 // Initializers done 7562 // Initializers done
7515 } 7563 }
7516 // ********** Code for Element ************** 7564 // ********** Code for Element **************
7517 function Element(name, kind, enclosingElement) { 7565 function Element(name, kind, enclosingElement) {
7518 this.name = name; 7566 this.name = name;
(...skipping 30 matching lines...) Expand all
7549 return types.dynamicType; 7597 return types.dynamicType;
7550 } 7598 }
7551 // ********** Code for FunctionElement ************** 7599 // ********** Code for FunctionElement **************
7552 function FunctionElement(name) { 7600 function FunctionElement(name) {
7553 Element.call(this, name, const$239, null); 7601 Element.call(this, name, const$239, null);
7554 // Initializers done 7602 // Initializers done
7555 } 7603 }
7556 $inherits(FunctionElement, Element); 7604 $inherits(FunctionElement, Element);
7557 FunctionElement.prototype.computeType = function(compiler, types) { 7605 FunctionElement.prototype.computeType = function(compiler, types) {
7558 var $0; 7606 var $0;
7559 if ($notnull_bool(this.type != null)) return this.type; 7607 if ($notnull_bool(this.type != null)) return (($0 = this.type) && $0.is$Functi onType());
7560 var node = (($0 = this.parseNode(compiler, compiler)) && $0.is$FunctionExpress ion()); 7608 var node = (($0 = this.parseNode(compiler, compiler)) && $0.is$FunctionExpress ion());
7561 var returnType = getType(node.returnType, types); 7609 var returnType = getType(node.returnType, types);
7562 if ($notnull_bool(returnType == null)) compiler.cancel(('unknown type ' + retu rnType + '')); 7610 if ($notnull_bool(returnType == null)) compiler.cancel(('unknown type ' + retu rnType + ''));
7563 var parameterTypes = new LinkBuilderImplementation$Type(); 7611 var parameterTypes = new LinkBuilderImplementation$Type();
7564 for (var link = node.parameters.nodes; 7612 for (var link = node.parameters.nodes;
7565 $notnull_bool(!$notnull_bool(link.isEmpty())); link = link.get$tail()) { 7613 $notnull_bool(!$notnull_bool(link.isEmpty())); link = link.get$tail()) {
7566 var parameter = (($0 = link.get$head()) && $0.is$VariableDefinitions()); 7614 var parameter = (($0 = link.get$head()) && $0.is$VariableDefinitions());
7567 parameterTypes.addLast(getType(parameter.type, types)); 7615 parameterTypes.addLast(getType(parameter.type, types));
7568 } 7616 }
7569 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0 .is$Link$Type())); 7617 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0 .is$Link$Type()));
7570 return this.type; 7618 return (($0 = this.type) && $0.is$FunctionType());
7571 } 7619 }
7572 // ********** Code for ClassElement ************** 7620 // ********** Code for ClassElement **************
7573 function ClassElement(name) { 7621 function ClassElement(name) {
7574 Element.call(this, name, const$237, null); 7622 Element.call(this, name, const$237, null);
7575 // Initializers done 7623 // Initializers done
7576 } 7624 }
7577 $inherits(ClassElement, Element); 7625 $inherits(ClassElement, Element);
7578 ClassElement.prototype.computeType = function(compiler, types) { 7626 ClassElement.prototype.computeType = function(compiler, types) {
7579 compiler.unimplemented('ClassElement.computeType'); 7627 compiler.unimplemented('ClassElement.computeType');
7580 } 7628 }
7581 // ********** Code for top level ************** 7629 // ********** Code for top level **************
7582 function getType(annotation, types) { 7630 function getType(annotation, types) {
7631 var $0;
7583 if ($notnull_bool(annotation == null || annotation.typeName == null)) { 7632 if ($notnull_bool(annotation == null || annotation.typeName == null)) {
7584 return types.dynamicType; 7633 return (($0 = types.dynamicType) && $0.is$Type());
7585 } 7634 }
7586 return types.lookup(annotation.typeName.get$source()); 7635 return (($0 = types.lookup(annotation.typeName.get$source())) && $0.is$Type()) ;
7587 } 7636 }
7588 // ********** Library ssa ************** 7637 // ********** Library ssa **************
7589 // ********** Code for SsaBuilderTask ************** 7638 // ********** Code for SsaBuilderTask **************
7590 function SsaBuilderTask(compiler) { 7639 function SsaBuilderTask(compiler) {
7591 CompilerTask.call(this, compiler); 7640 CompilerTask.call(this, compiler);
7592 // Initializers done 7641 // Initializers done
7593 } 7642 }
7594 $inherits(SsaBuilderTask, CompilerTask); 7643 $inherits(SsaBuilderTask, CompilerTask);
7595 SsaBuilderTask.prototype.get$name = function() { 7644 SsaBuilderTask.prototype.get$name = function() {
7596 return 'SSA builder'; 7645 return 'SSA builder';
7597 } 7646 }
7598 SsaBuilderTask.prototype.build = function(tree, elements) { 7647 SsaBuilderTask.prototype.build = function(tree, elements) {
7599 var $this = this; // closure support 7648 var $this = this; // closure support
7600 return this.measure((function () { 7649 var $0;
7650 return (($0 = this.measure((function () {
7601 var $0; 7651 var $0;
7602 var function_ = (tree && tree.is$FunctionExpression()); 7652 var function_ = (tree && tree.is$FunctionExpression());
7603 var graph = $this.compileMethod(function_.parameters, function_.body, elemen ts); 7653 var graph = $this.compileMethod(function_.parameters, function_.body, elemen ts);
7604 $assert(graph.isValid(), "graph.isValid()", "builder.dart", 14, 14); 7654 $assert(graph.isValid(), "graph.isValid()", "builder.dart", 14, 14);
7605 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) { 7655 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) {
7606 var name = (($0 = function_.name) && $0.is$Identifier()); 7656 var name = (($0 = function_.name) && $0.is$Identifier());
7607 HTracer.HTracer$singleton$factory().traceCompilation(name.get$source().toS tring()); 7657 HTracer.HTracer$singleton$factory().traceCompilation(name.get$source().toS tring());
7608 HTracer.HTracer$singleton$factory().traceGraph('builder', graph); 7658 HTracer.HTracer$singleton$factory().traceGraph('builder', graph);
7609 } 7659 }
7610 return graph; 7660 return graph;
7611 }) 7661 })
7612 ); 7662 )) && $0.is$HGraph());
7613 } 7663 }
7614 SsaBuilderTask.prototype.compileMethod = function(parameters, body, elements) { 7664 SsaBuilderTask.prototype.compileMethod = function(parameters, body, elements) {
7615 var builder = new SsaBuilder(this.compiler, elements); 7665 var builder = new SsaBuilder(this.compiler, elements);
7616 var graph = builder.build(parameters, body); 7666 var graph = builder.build(parameters, body);
7617 return graph; 7667 return graph;
7618 } 7668 }
7619 // ********** Code for SsaBuilder ************** 7669 // ********** Code for SsaBuilder **************
7620 function SsaBuilder(compiler, elements) { 7670 function SsaBuilder(compiler, elements) {
7621 this.compiler = compiler; 7671 this.compiler = compiler;
7622 this.elements = elements; 7672 this.elements = elements;
(...skipping 21 matching lines...) Expand all
7644 var result = this.current; 7694 var result = this.current;
7645 this.current.close(end); 7695 this.current.close(end);
7646 this.current = null; 7696 this.current = null;
7647 return result; 7697 return result;
7648 } 7698 }
7649 SsaBuilder.prototype.goto = function(from, to) { 7699 SsaBuilder.prototype.goto = function(from, to) {
7650 from.close(new HGoto()); 7700 from.close(new HGoto());
7651 from.addSuccessor(to); 7701 from.addSuccessor(to);
7652 } 7702 }
7653 SsaBuilder.prototype.isAborted = function() { 7703 SsaBuilder.prototype.isAborted = function() {
7654 return this.current == null; 7704 return $assert_bool(this.current == null);
7655 } 7705 }
7656 SsaBuilder.prototype.add = function(instruction) { 7706 SsaBuilder.prototype.add = function(instruction) {
7657 this.current.add(instruction); 7707 this.current.add(instruction);
7658 } 7708 }
7659 SsaBuilder.prototype.push = function(instruction) { 7709 SsaBuilder.prototype.push = function(instruction) {
7660 this.add(instruction); 7710 this.add(instruction);
7661 this.stack.add(instruction); 7711 this.stack.add(instruction);
7662 } 7712 }
7663 SsaBuilder.prototype.pop = function() { 7713 SsaBuilder.prototype.pop = function() {
7664 return this.stack.removeLast(); 7714 var $0;
7715 return (($0 = this.stack.removeLast()) && $0.is$HInstruction());
7665 } 7716 }
7666 SsaBuilder.prototype.visit = function(node) { 7717 SsaBuilder.prototype.visit = function(node) {
7667 if ($notnull_bool(node != null)) node.accept(this); 7718 if ($notnull_bool(node != null)) node.accept(this);
7668 } 7719 }
7669 SsaBuilder.prototype.visitParameters = function(parameters) { 7720 SsaBuilder.prototype.visitParameters = function(parameters) {
7670 var $0; 7721 var $0;
7671 var parameterIndex = 0; 7722 var parameterIndex = 0;
7672 for (var link = parameters.nodes; 7723 for (var link = parameters.nodes;
7673 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { 7724 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) {
7674 var container = (($0 = link.get$head()) && $0.is$VariableDefinitions()); 7725 var container = (($0 = link.get$head()) && $0.is$VariableDefinitions());
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
7879 } 7930 }
7880 SsaBuilder.prototype.updateDefinition = function(node) { 7931 SsaBuilder.prototype.updateDefinition = function(node) {
7881 var $0; 7932 var $0;
7882 if ($notnull_bool(node.receiver != null)) { 7933 if ($notnull_bool(node.receiver != null)) {
7883 this.compiler.unimplemented("SsaBuilder: property access"); 7934 this.compiler.unimplemented("SsaBuilder: property access");
7884 } 7935 }
7885 var link = node.get$arguments(); 7936 var link = node.get$arguments();
7886 $assert(!$notnull_bool(link.isEmpty()) && link.get$tail().isEmpty(), "!link.is Empty() && link.tail.isEmpty()", "builder.dart", 362, 12); 7937 $assert(!$notnull_bool(link.isEmpty()) && link.get$tail().isEmpty(), "!link.is Empty() && link.tail.isEmpty()", "builder.dart", 362, 12);
7887 this.visit((($0 = link.get$head()) && $0.is$Node())); 7938 this.visit((($0 = link.get$head()) && $0.is$Node()));
7888 var value = this.pop(); 7939 var value = this.pop();
7889 return this.definitions.$setindex(this.elements.$index(node), value); 7940 return (($0 = this.definitions.$setindex(this.elements.$index(node), value)) & & $0.is$HInstruction());
7890 } 7941 }
7891 SsaBuilder.prototype.visitVariableDefinitions = function(node) { 7942 SsaBuilder.prototype.visitVariableDefinitions = function(node) {
7892 var $0; 7943 var $0;
7893 for (var link = node.definitions.nodes; 7944 for (var link = node.definitions.nodes;
7894 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { 7945 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) {
7895 var definition = (($0 = link.get$head()) && $0.is$Node()); 7946 var definition = (($0 = link.get$head()) && $0.is$Node());
7896 if ($notnull_bool((definition instanceof Identifier))) { 7947 if ($notnull_bool((definition instanceof Identifier))) {
7897 this.compiler.unimplemented("SsaBuilder.visitVariableDefinitions without i nitial value"); 7948 this.compiler.unimplemented("SsaBuilder.visitVariableDefinitions without i nitial value");
7898 } 7949 }
7899 else { 7950 else {
7900 $assert((definition instanceof SendSet), "definition is SendSet", "builder .dart", 377, 16); 7951 $assert((definition instanceof SendSet), "definition is SendSet", "builder .dart", 377, 16);
7901 this.updateDefinition((definition && definition.is$SendSet())); 7952 this.updateDefinition((definition && definition.is$SendSet()));
7902 } 7953 }
7903 } 7954 }
7904 } 7955 }
7905 // ********** Code for SsaCodeGeneratorTask ************** 7956 // ********** Code for SsaCodeGeneratorTask **************
7906 function SsaCodeGeneratorTask(compiler) { 7957 function SsaCodeGeneratorTask(compiler) {
7907 CompilerTask.call(this, compiler); 7958 CompilerTask.call(this, compiler);
7908 // Initializers done 7959 // Initializers done
7909 } 7960 }
7910 $inherits(SsaCodeGeneratorTask, CompilerTask); 7961 $inherits(SsaCodeGeneratorTask, CompilerTask);
7911 SsaCodeGeneratorTask.prototype.get$name = function() { 7962 SsaCodeGeneratorTask.prototype.get$name = function() {
7912 return 'SSA code generator'; 7963 return 'SSA code generator';
7913 } 7964 }
7914 SsaCodeGeneratorTask.prototype.generate = function(tree, graph) { 7965 SsaCodeGeneratorTask.prototype.generate = function(tree, graph) {
7915 var $this = this; // closure support 7966 var $this = this; // closure support
7916 return this.measure((function () { 7967 return $assert_String(this.measure((function () {
7917 var $0; 7968 var $0;
7918 var function_ = (tree && tree.is$FunctionExpression()); 7969 var function_ = (tree && tree.is$FunctionExpression());
7919 var name = (($0 = function_.name) && $0.is$Identifier()); 7970 var name = (($0 = function_.name) && $0.is$Identifier());
7920 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) { 7971 if ($notnull_bool(false/*null.GENERATE_SSA_TRACE*/)) {
7921 HTracer.HTracer$singleton$factory().traceGraph("codegen", graph); 7972 HTracer.HTracer$singleton$factory().traceGraph("codegen", graph);
7922 } 7973 }
7923 var code = $this.generateMethod(name.get$source(), SsaCodeGeneratorTask.coun tParameters(function_), graph); 7974 var code = $this.generateMethod(name.get$source(), SsaCodeGeneratorTask.coun tParameters(function_), graph);
7924 return code; 7975 return code;
7925 }) 7976 })
7926 ); 7977 ));
7927 } 7978 }
7928 SsaCodeGeneratorTask.prototype.generateMethod = function(methodName, parameterCo unt, graph) { 7979 SsaCodeGeneratorTask.prototype.generateMethod = function(methodName, parameterCo unt, graph) {
7929 var buffer = new StringBufferImpl(""); 7980 var buffer = new StringBufferImpl("");
7930 var codegen = new SsaCodeGenerator(this.compiler, buffer); 7981 var codegen = new SsaCodeGenerator(this.compiler, buffer);
7931 graph.assignInstructionIds(); 7982 graph.assignInstructionIds();
7932 codegen.visitGraph(graph); 7983 codegen.visitGraph(graph);
7933 var parameters = new StringBufferImpl(""); 7984 var parameters = new StringBufferImpl("");
7934 for (var i = 0; 7985 for (var i = 0;
7935 $notnull_bool(i < parameterCount); i++) { 7986 $notnull_bool(i < parameterCount); i++) {
7936 if ($notnull_bool(i != 0)) parameters.add(', '); 7987 if ($notnull_bool(i != 0)) parameters.add(', ');
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
8186 instruction = instruction.next; 8237 instruction = instruction.next;
8187 } 8238 }
8188 } 8239 }
8189 // ********** Code for HGraph ************** 8240 // ********** Code for HGraph **************
8190 function HGraph() { 8241 function HGraph() {
8191 this.blocks = new ListFactory$HBasicBlock(); 8242 this.blocks = new ListFactory$HBasicBlock();
8192 // Initializers done 8243 // Initializers done
8193 this.entry = this.addNewBlock(); 8244 this.entry = this.addNewBlock();
8194 this.exit = new HBasicBlock(); 8245 this.exit = new HBasicBlock();
8195 } 8246 }
8247 HGraph.prototype.is$HGraph = function(){return this;};
8196 HGraph.prototype.addBlock = function(block) { 8248 HGraph.prototype.addBlock = function(block) {
8197 var id = this.blocks.length; 8249 var id = this.blocks.length;
8198 block.id = id; 8250 block.id = id;
8199 this.blocks.add(block); 8251 this.blocks.add(block);
8200 $assert(this.blocks.$index(id) === block, "blocks[id] === block", "nodes.dart" , 84, 12); 8252 $assert(this.blocks.$index(id) === block, "blocks[id] === block", "nodes.dart" , 84, 12);
8201 } 8253 }
8202 HGraph.prototype.addNewBlock = function() { 8254 HGraph.prototype.addNewBlock = function() {
8203 var result = new HBasicBlock(); 8255 var result = new HBasicBlock();
8204 this.addBlock(result); 8256 this.addBlock(result);
8205 return result; 8257 return result;
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
8423 $assert(this.isValid(), "isValid()", "nodes.dart", 290, 12); 8475 $assert(this.isValid(), "isValid()", "nodes.dart", 290, 12);
8424 } 8476 }
8425 HBasicBlock.rewriteInput = function(instruction, from, to) { 8477 HBasicBlock.rewriteInput = function(instruction, from, to) {
8426 var inputs = instruction.inputs; 8478 var inputs = instruction.inputs;
8427 for (var i = 0; 8479 for (var i = 0;
8428 $notnull_bool(i < inputs.length); i++) { 8480 $notnull_bool(i < inputs.length); i++) {
8429 if ($notnull_bool(inputs.$index(i) === from)) inputs.$setindex(i, to); 8481 if ($notnull_bool(inputs.$index(i) === from)) inputs.$setindex(i, to);
8430 } 8482 }
8431 } 8483 }
8432 HBasicBlock.prototype.isExitBlock = function() { 8484 HBasicBlock.prototype.isExitBlock = function() {
8433 return this.first === this.last && (this.first instanceof HExit); 8485 return $assert_bool(this.first === this.last && (this.first instanceof HExit)) ;
8434 } 8486 }
8435 HBasicBlock.prototype.addDominatedBlock = function(block) { 8487 HBasicBlock.prototype.addDominatedBlock = function(block) {
8436 $assert(this.isClosed(), "isClosed()", "nodes.dart", 307, 12); 8488 $assert(this.isClosed(), "isClosed()", "nodes.dart", 307, 12);
8437 $assert(this.id != null && block.id != null, "id !== null && block.id !== null ", "nodes.dart", 308, 12); 8489 $assert(this.id != null && block.id != null, "id !== null && block.id !== null ", "nodes.dart", 308, 12);
8438 $assert(this.dominatedBlocks.indexOf(block) < 0, "dominatedBlocks.indexOf(bloc k) < 0", "nodes.dart", 309, 12); 8490 $assert(this.dominatedBlocks.indexOf(block) < 0, "dominatedBlocks.indexOf(bloc k) < 0", "nodes.dart", 309, 12);
8439 var index = this.dominatedBlocks.length; 8491 var index = this.dominatedBlocks.length;
8440 while ($notnull_bool(index > 0 && this.dominatedBlocks.$index(index - 1).id > block.id)) { 8492 while ($notnull_bool(index > 0 && this.dominatedBlocks.$index(index - 1).id > block.id)) {
8441 index--; 8493 index--;
8442 } 8494 }
8443 if ($notnull_bool(index == this.dominatedBlocks.length)) { 8495 if ($notnull_bool(index == this.dominatedBlocks.length)) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
8537 return this.getFlag(3/*HInstruction.FLAG_USE_GVN*/); 8589 return this.getFlag(3/*HInstruction.FLAG_USE_GVN*/);
8538 } 8590 }
8539 HInstruction.prototype.setUseGvn = function() { 8591 HInstruction.prototype.setUseGvn = function() {
8540 this.setFlag(3/*HInstruction.FLAG_USE_GVN*/); 8592 this.setFlag(3/*HInstruction.FLAG_USE_GVN*/);
8541 } 8593 }
8542 HInstruction.prototype.get$usedBy = function() { 8594 HInstruction.prototype.get$usedBy = function() {
8543 if ($notnull_bool(this._usedBy == null)) return const$235/*const []*/; 8595 if ($notnull_bool(this._usedBy == null)) return const$235/*const []*/;
8544 return this._usedBy; 8596 return this._usedBy;
8545 } 8597 }
8546 HInstruction.prototype.isInBasicBlock = function() { 8598 HInstruction.prototype.isInBasicBlock = function() {
8547 return this._usedBy != null; 8599 return $assert_bool(this._usedBy != null);
8548 } 8600 }
8549 HInstruction.prototype.equals = function(other) { 8601 HInstruction.prototype.equals = function(other) {
8550 $assert(this.useGvn() && other.useGvn(), "useGvn() && other.useGvn()", "nodes. dart", 443, 12); 8602 $assert(this.useGvn() && other.useGvn(), "useGvn() && other.useGvn()", "nodes. dart", 443, 12);
8551 if ($notnull_bool(!$notnull_bool(this.typeEquals(other)))) return false; 8603 if ($notnull_bool(!$notnull_bool(this.typeEquals(other)))) return false;
8552 if ($notnull_bool(this.flags != other.flags)) return false; 8604 if ($notnull_bool(this.flags != other.flags)) return false;
8553 var inputsLength = this.inputs.length; 8605 var inputsLength = this.inputs.length;
8554 var otherInputs = other.inputs; 8606 var otherInputs = other.inputs;
8555 if ($notnull_bool(inputsLength != otherInputs.length)) return false; 8607 if ($notnull_bool(inputsLength != otherInputs.length)) return false;
8556 for (var i = 0; 8608 for (var i = 0;
8557 $notnull_bool(i < inputsLength); i++) { 8609 $notnull_bool(i < inputsLength); i++) {
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
8958 } 9010 }
8959 return this.visitArithmetic(node); 9011 return this.visitArithmetic(node);
8960 } 9012 }
8961 // ********** Code for SsaDeadCodeEliminator ************** 9013 // ********** Code for SsaDeadCodeEliminator **************
8962 function SsaDeadCodeEliminator() { 9014 function SsaDeadCodeEliminator() {
8963 HGraphVisitor.call(this); 9015 HGraphVisitor.call(this);
8964 // Initializers done 9016 // Initializers done
8965 } 9017 }
8966 $inherits(SsaDeadCodeEliminator, HGraphVisitor); 9018 $inherits(SsaDeadCodeEliminator, HGraphVisitor);
8967 SsaDeadCodeEliminator.isDeadCode = function(instruction) { 9019 SsaDeadCodeEliminator.isDeadCode = function(instruction) {
8968 return !$notnull_bool(instruction.hasSideEffects()) && instruction.get$usedBy( ).isEmpty(); 9020 return $assert_bool(!$notnull_bool(instruction.hasSideEffects()) && instructio n.get$usedBy().isEmpty());
8969 } 9021 }
8970 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) { 9022 SsaDeadCodeEliminator.prototype.visitGraph = function(graph) {
8971 this.visitPostDominatorTree(graph); 9023 this.visitPostDominatorTree(graph);
8972 } 9024 }
8973 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) { 9025 SsaDeadCodeEliminator.prototype.visitBasicBlock = function(block) {
8974 var instruction = block.last; 9026 var instruction = block.last;
8975 while ($notnull_bool(instruction != null)) { 9027 while ($notnull_bool(instruction != null)) {
8976 var previous = instruction.previous; 9028 var previous = instruction.previous;
8977 if ($notnull_bool(SsaDeadCodeEliminator.isDeadCode(instruction))) block.remo ve(instruction); 9029 if ($notnull_bool(SsaDeadCodeEliminator.isDeadCode(instruction))) block.remo ve(instruction);
8978 instruction = (previous && previous.is$HInstruction()); 9030 instruction = (previous && previous.is$HInstruction());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
9027 SsaGlobalValueNumberer.prototype.getChangesFlagsForBlock = function(block) { 9079 SsaGlobalValueNumberer.prototype.getChangesFlagsForBlock = function(block) {
9028 var id = block.id; 9080 var id = block.id;
9029 var cached = $assert_num(this.blockChangesFlags.$index(id)); 9081 var cached = $assert_num(this.blockChangesFlags.$index(id));
9030 if ($notnull_bool(cached != null)) return cached; 9082 if ($notnull_bool(cached != null)) return cached;
9031 var changesFlags = 0; 9083 var changesFlags = 0;
9032 var instruction = block.first; 9084 var instruction = block.first;
9033 while ($notnull_bool(instruction != null)) { 9085 while ($notnull_bool(instruction != null)) {
9034 changesFlags |= instruction.getChangesFlags(); 9086 changesFlags |= instruction.getChangesFlags();
9035 instruction = instruction.next; 9087 instruction = instruction.next;
9036 } 9088 }
9037 return this.blockChangesFlags.$setindex(id, changesFlags); 9089 return $assert_num(this.blockChangesFlags.$setindex(id, changesFlags));
9038 } 9090 }
9039 SsaGlobalValueNumberer.prototype.getChangesFlagsForDominatedBlock = function(dom inator, dominated) { 9091 SsaGlobalValueNumberer.prototype.getChangesFlagsForDominatedBlock = function(dom inator, dominated) {
9040 var $0; 9092 var $0;
9041 var changesFlags = 0; 9093 var changesFlags = 0;
9042 var predecessors = dominated.predecessors; 9094 var predecessors = dominated.predecessors;
9043 for (var i = 0, length = predecessors.length; 9095 for (var i = 0, length = predecessors.length;
9044 $notnull_bool(i < length); i++) { 9096 $notnull_bool(i < length); i++) {
9045 var block = (($0 = predecessors.$index(i)) && $0.is$HBasicBlock()); 9097 var block = (($0 = predecessors.$index(i)) && $0.is$HBasicBlock());
9046 var id = block.id; 9098 var id = block.id;
9047 if ($notnull_bool(dominator.id < id && id < dominated.id && !$notnull_bool(t his.visited.contains(id)))) { 9099 if ($notnull_bool(dominator.id < id && id < dominated.id && !$notnull_bool(t his.visited.contains(id)))) {
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
9648 function ResolverTask(compiler) { 9700 function ResolverTask(compiler) {
9649 CompilerTask.call(this, compiler); 9701 CompilerTask.call(this, compiler);
9650 // Initializers done 9702 // Initializers done
9651 } 9703 }
9652 $inherits(ResolverTask, CompilerTask); 9704 $inherits(ResolverTask, CompilerTask);
9653 ResolverTask.prototype.get$name = function() { 9705 ResolverTask.prototype.get$name = function() {
9654 return 'Resolver'; 9706 return 'Resolver';
9655 } 9707 }
9656 ResolverTask.prototype.resolve = function(tree) { 9708 ResolverTask.prototype.resolve = function(tree) {
9657 var $this = this; // closure support 9709 var $this = this; // closure support
9658 return this.measure((function () { 9710 var $0;
9711 return (($0 = this.measure((function () {
9659 var visitor = new ResolverVisitor($this.compiler); 9712 var visitor = new ResolverVisitor($this.compiler);
9660 visitor.visit(tree); 9713 visitor.visit(tree);
9661 return visitor.mapping; 9714 return visitor.mapping;
9662 }) 9715 })
9663 ); 9716 )) && $0.is$Map$Node$Element());
9664 } 9717 }
9665 // ********** Code for ErrorMessages ************** 9718 // ********** Code for ErrorMessages **************
9666 function ErrorMessages() {} 9719 function ErrorMessages() {}
9667 ErrorMessages.cannotResolve = function(id) { 9720 ErrorMessages.cannotResolve = function(id) {
9668 return ("cannot resolve " + id + ""); 9721 return ("cannot resolve " + id + "");
9669 } 9722 }
9670 ErrorMessages.cannotResolveType = function(id) { 9723 ErrorMessages.cannotResolveType = function(id) {
9671 return ("cannot resolve type " + id + ""); 9724 return ("cannot resolve type " + id + "");
9672 } 9725 }
9673 ErrorMessages.duplicateDefinition = function(id) { 9726 ErrorMessages.duplicateDefinition = function(id) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
9791 this.warning(node, ErrorMessages.cannotResolveType(name)); 9844 this.warning(node, ErrorMessages.cannotResolveType(name));
9792 } 9845 }
9793 return this.useElement(node, element); 9846 return this.useElement(node, element);
9794 } 9847 }
9795 ResolverVisitor.prototype.visitVariableDefinitions = function(node) { 9848 ResolverVisitor.prototype.visitVariableDefinitions = function(node) {
9796 this.visit(node.type); 9849 this.visit(node.type);
9797 var visitor = new VariableDefinitionsVisitor(node, this); 9850 var visitor = new VariableDefinitionsVisitor(node, this);
9798 visitor.visit(node.definitions); 9851 visitor.visit(node.definitions);
9799 } 9852 }
9800 ResolverVisitor.prototype.defineElement = function(node, element) { 9853 ResolverVisitor.prototype.defineElement = function(node, element) {
9854 var $0;
9801 this.compiler.ensure($assert_bool(element != null)); 9855 this.compiler.ensure($assert_bool(element != null));
9802 this.mapping.$setindex(node, element); 9856 this.mapping.$setindex(node, element);
9803 return this.context.add(element); 9857 return (($0 = this.context.add(element)) && $0.is$Element());
9804 } 9858 }
9805 ResolverVisitor.prototype.useElement = function(node, element) { 9859 ResolverVisitor.prototype.useElement = function(node, element) {
9806 if ($notnull_bool(element == null)) return null; 9860 if ($notnull_bool(element == null)) return null;
9807 this.mapping.$setindex(node, element); 9861 this.mapping.$setindex(node, element);
9808 return element; 9862 return element;
9809 } 9863 }
9810 // ********** Code for VariableDefinitionsVisitor ************** 9864 // ********** Code for VariableDefinitionsVisitor **************
9811 function VariableDefinitionsVisitor(definitions, resolver) { 9865 function VariableDefinitionsVisitor(definitions, resolver) {
9812 this.definitions = definitions; 9866 this.definitions = definitions;
9813 this.resolver = resolver; 9867 this.resolver = resolver;
9814 // Initializers done 9868 // Initializers done
9815 } 9869 }
9816 VariableDefinitionsVisitor.prototype.visitSendSet = function(node) { 9870 VariableDefinitionsVisitor.prototype.visitSendSet = function(node) {
9817 var $0; 9871 var $0;
9818 $assert(node.get$arguments().get$tail().isEmpty(), "node.arguments.tail.isEmpt y()", "resolver.dart", 200, 12); 9872 $assert(node.get$arguments().get$tail().isEmpty(), "node.arguments.tail.isEmpt y()", "resolver.dart", 200, 12);
9819 if ($notnull_bool(node.receiver != null)) { 9873 if ($notnull_bool(node.receiver != null)) {
9820 this.resolver.compiler.unimplemented("receiver on a variable definition"); 9874 this.resolver.compiler.unimplemented("receiver on a variable definition");
9821 } 9875 }
9822 var selector = (($0 = node.selector) && $0.is$Identifier()); 9876 var selector = (($0 = node.selector) && $0.is$Identifier());
9823 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node())); 9877 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node()));
9824 return this.visit(node.selector); 9878 return (($0 = this.visit(node.selector)) && $0.is$SourceString());
9825 } 9879 }
9826 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { 9880 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) {
9827 return node.get$source(); 9881 return node.get$source();
9828 } 9882 }
9829 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { 9883 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) {
9830 var $0; 9884 var $0;
9831 for (var link = node.nodes; 9885 for (var link = node.nodes;
9832 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { 9886 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) {
9833 var name = (($0 = this.visit((($0 = link.get$head()) && $0.is$Node()))) && $ 0.is$SourceString()); 9887 var name = (($0 = this.visit((($0 = link.get$head()) && $0.is$Node()))) && $ 0.is$SourceString());
9834 var element = new VariableElement((($0 = link.get$head()) && $0.is$Node()), this.definitions.type, name, this.resolver.context.enclosingElement); 9888 var element = new VariableElement((($0 = link.get$head()) && $0.is$Node()), this.definitions.type, name, this.resolver.context.enclosingElement);
(...skipping 26 matching lines...) Expand all
9861 } 9915 }
9862 Scope.enclosing$ctor.prototype = Scope.prototype; 9916 Scope.enclosing$ctor.prototype = Scope.prototype;
9863 Scope.prototype.get$parent = function() { return this.parent; }; 9917 Scope.prototype.get$parent = function() { return this.parent; };
9864 Scope.prototype.lookup = function(name) { 9918 Scope.prototype.lookup = function(name) {
9865 var $0; 9919 var $0;
9866 var element = (($0 = this.elements.$index(name)) && $0.is$Element()); 9920 var element = (($0 = this.elements.$index(name)) && $0.is$Element());
9867 if ($notnull_bool(element != null)) return element; 9921 if ($notnull_bool(element != null)) return element;
9868 return this.parent.lookup(name); 9922 return this.parent.lookup(name);
9869 } 9923 }
9870 Scope.prototype.add = function(element) { 9924 Scope.prototype.add = function(element) {
9871 if ($notnull_bool(this.elements.containsKey(element.name))) return this.elemen ts.$index(element.name); 9925 var $0;
9926 if ($notnull_bool(this.elements.containsKey(element.name))) return (($0 = this .elements.$index(element.name)) && $0.is$Element());
9872 this.elements.$setindex(element.name, element); 9927 this.elements.$setindex(element.name, element);
9873 return element; 9928 return element;
9874 } 9929 }
9875 // ********** Code for TopScope ************** 9930 // ********** Code for TopScope **************
9876 function TopScope(universe) { 9931 function TopScope(universe) {
9877 this.universe = universe; 9932 this.universe = universe;
9878 Scope.top$ctor.call(this); 9933 Scope.top$ctor.call(this);
9879 // Initializers done 9934 // Initializers done
9880 } 9935 }
9881 $inherits(TopScope, Scope); 9936 $inherits(TopScope, Scope);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
9982 } 10037 }
9983 else if ($notnull_bool($eq(const$10/*Types.DYNAMIC*/, s) || s.get$stringValue( ) === 'var')) { 10038 else if ($notnull_bool($eq(const$10/*Types.DYNAMIC*/, s) || s.get$stringValue( ) === 'var')) {
9984 return this.dynamicType; 10039 return this.dynamicType;
9985 } 10040 }
9986 else if ($notnull_bool($eq(const$12/*Types.STRING*/, s))) { 10041 else if ($notnull_bool($eq(const$12/*Types.STRING*/, s))) {
9987 return this.stringType; 10042 return this.stringType;
9988 } 10043 }
9989 return null; 10044 return null;
9990 } 10045 }
9991 Types.prototype.isSubtype = function(r, s) { 10046 Types.prototype.isSubtype = function(r, s) {
9992 return r === s || r === this.dynamicType || s === this.dynamicType; 10047 return $assert_bool(r === s || r === this.dynamicType || s === this.dynamicTyp e);
9993 } 10048 }
9994 Types.prototype.isAssignable = function(r, s) { 10049 Types.prototype.isAssignable = function(r, s) {
9995 return this.isSubtype(r, s) || this.isSubtype(s, r); 10050 return $assert_bool(this.isSubtype(r, s) || this.isSubtype(s, r));
9996 } 10051 }
9997 // ********** Code for CancelTypeCheckException ************** 10052 // ********** Code for CancelTypeCheckException **************
9998 function CancelTypeCheckException(node, reason) { 10053 function CancelTypeCheckException(node, reason) {
9999 this.node = node; 10054 this.node = node;
10000 this.reason = reason; 10055 this.reason = reason;
10001 // Initializers done 10056 // Initializers done
10002 } 10057 }
10003 // ********** Code for TypeCheckerVisitor ************** 10058 // ********** Code for TypeCheckerVisitor **************
10004 function TypeCheckerVisitor(compiler, elements, types) { 10059 function TypeCheckerVisitor(compiler, elements, types) {
10005 this.compiler = compiler; 10060 this.compiler = compiler;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
10067 this.type(node.thenPart); 10122 this.type(node.thenPart);
10068 if ($notnull_bool(node.get$hasElsePart())) this.type(node.elsePart); 10123 if ($notnull_bool(node.get$hasElsePart())) this.type(node.elsePart);
10069 return this.types.voidType; 10124 return this.types.voidType;
10070 } 10125 }
10071 TypeCheckerVisitor.prototype.visitSend = function(node) { 10126 TypeCheckerVisitor.prototype.visitSend = function(node) {
10072 var $0; 10127 var $0;
10073 var target = this.elements.$index(node); 10128 var target = this.elements.$index(node);
10074 if ($notnull_bool(target != null)) { 10129 if ($notnull_bool(target != null)) {
10075 var targetType = target.computeType(this.compiler, this.types); 10130 var targetType = target.computeType(this.compiler, this.types);
10076 if ($notnull_bool(node.get$isPropertyAccess())) { 10131 if ($notnull_bool(node.get$isPropertyAccess())) {
10077 return targetType; 10132 return (targetType && targetType.is$Type());
10078 } 10133 }
10079 else if ($notnull_bool(node.get$isFunctionObjectInvocation())) { 10134 else if ($notnull_bool(node.get$isFunctionObjectInvocation())) {
10080 this.fail(node); 10135 this.fail(node);
10081 } 10136 }
10082 else { 10137 else {
10083 if ($notnull_bool(!(targetType instanceof FunctionType))) { 10138 if ($notnull_bool(!(targetType instanceof FunctionType))) {
10084 if ($notnull_bool((target instanceof ForeignElement))) { 10139 if ($notnull_bool((target instanceof ForeignElement))) {
10085 return this.types.dynamicType; 10140 return this.types.dynamicType;
10086 } 10141 }
10087 this.fail(node, 'can only handle function types'); 10142 this.fail(node, 'can only handle function types');
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
10193 return null; 10248 return null;
10194 } 10249 }
10195 // ********** Code for Universe ************** 10250 // ********** Code for Universe **************
10196 function Universe() { 10251 function Universe() {
10197 this.elements = $map([]); 10252 this.elements = $map([]);
10198 this.generatedCode = $map([]); 10253 this.generatedCode = $map([]);
10199 this.scope = new Element(const$2, null, null); 10254 this.scope = new Element(const$2, null, null);
10200 // Initializers done 10255 // Initializers done
10201 } 10256 }
10202 Universe.prototype.find = function(name) { 10257 Universe.prototype.find = function(name) {
10203 return this.elements.$index(name); 10258 var $0;
10259 return (($0 = this.elements.$index(name)) && $0.is$Element());
10204 } 10260 }
10205 Universe.prototype.define = function(element) { 10261 Universe.prototype.define = function(element) {
10206 $assert(this.elements.$index(element.name) == null, "elements[element.name] == null", "universe.dart", 20, 12); 10262 $assert(this.elements.$index(element.name) == null, "elements[element.name] == null", "universe.dart", 20, 12);
10207 this.elements.$setindex(element.name, element); 10263 this.elements.$setindex(element.name, element);
10208 } 10264 }
10209 Universe.prototype.addGeneratedCode = function(element, code) { 10265 Universe.prototype.addGeneratedCode = function(element, code) {
10210 this.generatedCode.$setindex(element, code); 10266 this.generatedCode.$setindex(element, code);
10211 } 10267 }
10212 // ********** Code for top level ************** 10268 // ********** Code for top level **************
10213 function unreachable() { 10269 function unreachable() {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
10355 w.writeln("/**\n * Generates a dynamic call stub for a function.\n * Our goa l is to create a stub method like this on-the-fly:\n * function($0, $1, captur e) { this($0, $1, true, capture); }\n *\n * This stub then replaces the dynamic one on Function, with one that is\n * specialized for that particular function, taking into account its default\n * arguments.\n */\nFunction.prototype.$genStub = function(argsLength, names) {\n // TODO(jmesserly): only emit $genStub if ac tually needed\n\n // Fast path: if no named arguments and arg count matches\n if (this.length == argsLength && !names) {\n return this;\n }\n\n function $throwArgMismatch() {\n // TODO(jmesserly): better error message\n $throw( new ClosureArgumentMismatchException());\n }\n\n var paramsNamed = this.$optio nal ? (this.$optional.length / 2) : 0;\n var paramsBare = this.length - paramsN amed;\n var argsNamed = names ? names.length : 0;\n var argsBare = argsLength - argsNamed;\n\n // Check we got the right number of arguments\n if (argsBare < paramsBare || argsLength > this.length ||\n argsNamed > paramsNamed) {\n return $throwArgMismatch;\n }\n\n // First, fill in all of the default valu es\n var p = new Array(paramsBare);\n if (paramsNamed) {\n p = p.concat(thi s.$optional.slice(paramsNamed));\n }\n // Fill in positional args\n var a = n ew Array(argsLength);\n for (var i = 0; i < argsBare; i++) {\n p[i] = a[i] = '$' + i;\n }\n // Then overwrite with supplied values for optional args\n va r lastParameterIndex;\n var namesInOrder = true;\n for (var i = 0; i < argsNam ed; i++) {\n var name = names[i];\n a[i + argsBare] = name;\n var j = t his.$optional.indexOf(name, 0);\n if (j < 0 || j >= paramsNamed) {\n ret urn $throwArgMismatch;\n } else if (lastParameterIndex && lastParameterIndex > j) {\n namesInOrder = false;\n }\n p[j + paramsBare] = name;\n l astParameterIndex = j;\n }\n\n if (this.length == argsLength && namesInOrder) {\n // Fast path #2: named arguments, but they're in order.\n return this; \n }\n\n // Note: using Function instead of 'eval' to get a clean scope.\n // TODO(jmesserly): evaluate the performance of these stubs.\n var f = 'function( ' + a.join(',') + '){return $f(' + p.join(',') + ');}';\n return new Function(' $f', 'return ' + f + '').call(null, this);\n}"); 10411 w.writeln("/**\n * Generates a dynamic call stub for a function.\n * Our goa l is to create a stub method like this on-the-fly:\n * function($0, $1, captur e) { this($0, $1, true, capture); }\n *\n * This stub then replaces the dynamic one on Function, with one that is\n * specialized for that particular function, taking into account its default\n * arguments.\n */\nFunction.prototype.$genStub = function(argsLength, names) {\n // TODO(jmesserly): only emit $genStub if ac tually needed\n\n // Fast path: if no named arguments and arg count matches\n if (this.length == argsLength && !names) {\n return this;\n }\n\n function $throwArgMismatch() {\n // TODO(jmesserly): better error message\n $throw( new ClosureArgumentMismatchException());\n }\n\n var paramsNamed = this.$optio nal ? (this.$optional.length / 2) : 0;\n var paramsBare = this.length - paramsN amed;\n var argsNamed = names ? names.length : 0;\n var argsBare = argsLength - argsNamed;\n\n // Check we got the right number of arguments\n if (argsBare < paramsBare || argsLength > this.length ||\n argsNamed > paramsNamed) {\n return $throwArgMismatch;\n }\n\n // First, fill in all of the default valu es\n var p = new Array(paramsBare);\n if (paramsNamed) {\n p = p.concat(thi s.$optional.slice(paramsNamed));\n }\n // Fill in positional args\n var a = n ew Array(argsLength);\n for (var i = 0; i < argsBare; i++) {\n p[i] = a[i] = '$' + i;\n }\n // Then overwrite with supplied values for optional args\n va r lastParameterIndex;\n var namesInOrder = true;\n for (var i = 0; i < argsNam ed; i++) {\n var name = names[i];\n a[i + argsBare] = name;\n var j = t his.$optional.indexOf(name, 0);\n if (j < 0 || j >= paramsNamed) {\n ret urn $throwArgMismatch;\n } else if (lastParameterIndex && lastParameterIndex > j) {\n namesInOrder = false;\n }\n p[j + paramsBare] = name;\n l astParameterIndex = j;\n }\n\n if (this.length == argsLength && namesInOrder) {\n // Fast path #2: named arguments, but they're in order.\n return this; \n }\n\n // Note: using Function instead of 'eval' to get a clean scope.\n // TODO(jmesserly): evaluate the performance of these stubs.\n var f = 'function( ' + a.join(',') + '){return $f(' + p.join(',') + ');}';\n return new Function(' $f', 'return ' + f + '').call(null, this);\n}");
10356 } 10412 }
10357 if ($notnull_bool(this.useStackTraceOf)) { 10413 if ($notnull_bool(this.useStackTraceOf)) {
10358 w.writeln("function $stackTraceOf(e) {\n // TODO(jmesserly): we shouldn't b e relying on the e.stack property.\n // Need to mangle it.\n return e.stack ? e.stack : null;\n}"); 10414 w.writeln("function $stackTraceOf(e) {\n // TODO(jmesserly): we shouldn't b e relying on the e.stack property.\n // Need to mangle it.\n return e.stack ? e.stack : null;\n}");
10359 } 10415 }
10360 if ($notnull_bool(this.useToDartException)) { 10416 if ($notnull_bool(this.useToDartException)) {
10361 w.writeln("// Translate a JavaScript exception to a Dart exception\n// TODO( jmesserly): cross browser support. This is Chrome specific.\nfunction $toDartExc eption(e) {\n var res = e;\n if (e instanceof TypeError) {\n switch(e.type) {\n case 'property_not_function':\n case 'called_non_callable':\n if (e.arguments[0] == null) {\n res = new NullPointerException();\n } else {\n res = new ObjectNotClosureException();\n }\n break;\n case 'non_object_property_call':\n case 'non_object_pr operty_load':\n res = new NullPointerException();\n break;\n case 'undefined_method':\n if (e.arguments[0] == 'call' || e.arguments[0] == 'apply') {\n res = new ObjectNotClosureException();\n } else {\n // TODO(jmesserly): can this ever happen?\n res = new NoS uchMethodException('', e.arguments[0], []);\n }\n break;\n }\n } else if (e instanceof RangeError) {\n if (e.message.indexOf('call stack') >= 0) {\n res = new StackOverflowException();\n }\n }\n // TODO(jmesse rly): setting the stack property is not a long term solution.\n // Also it caus es the exception to print as if it were a TypeError or\n // RangeError, instead of using the proper toString.\n res.stack = e.stack;\n return res;\n}"); 10417 w.writeln("// Translate a JavaScript exception to a Dart exception\n// TODO( jmesserly): cross browser support. This is Chrome specific.\nfunction $toDartExc eption(e) {\n var res = e;\n if (e instanceof TypeError) {\n switch(e.type) {\n case 'property_not_function':\n case 'called_non_callable':\n if (e.arguments[0] == null) {\n res = new NullPointerException();\n } else {\n res = new ObjectNotClosureException();\n }\n break;\n case 'non_object_property_call':\n case 'non_object_pr operty_load':\n res = new NullPointerException();\n break;\n case 'undefined_method':\n if (e.arguments[0] == 'call' || e.arguments[0] == 'apply') {\n res = new ObjectNotClosureException();\n } else {\n // TODO(jmesserly): can this ever happen?\n res = new NoS uchMethodException('', e.arguments[0], []);\n }\n break;\n }\n } else if (e instanceof RangeError) {\n if (e.message.indexOf('call stack') >= 0) {\n res = new StackOverflowException();\n }\n }\n // TODO(jmesse rly): setting the stack property is not a long term solution.\n // Also it caus es the exception to print as if it were a TypeError or\n // RangeError, instead of using the proper toString.\n res.stack = e.stack;\n return res;\n}");
10362 } 10418 }
10363 if ($notnull_bool(this.useNotNullBool)) { 10419 if ($notnull_bool(this.useNotNullBool)) {
10364 this.useThrow = true; 10420 this.useThrow = true;
10365 w.writeln("function $notnull_bool(test) {\n if (test == null || typeof(test ) != 'boolean') {\n $throw(new TypeError('must be \"true\" or \"false\"'));\n }\n return test === true;\n}"); 10421 w.writeln("function $notnull_bool(test) {\n return typeof(test) == 'boolean ' ? test : test.is$bool();\n}");
10366 } 10422 }
10367 if ($notnull_bool(this.useAssert)) { 10423 if ($notnull_bool(this.useAssert)) {
10368 this.useThrow = true; 10424 this.useThrow = true;
10369 w.writeln("function $assert(test, text, url, line, column) {\n if (typeof t est == 'function') test = test();\n if (!test) $throw(new AssertError(text, url , line, column));\n}"); 10425 w.writeln("function $assert(test, text, url, line, column) {\n if (typeof t est == 'function') test = test();\n if (!test) $throw(new AssertError(text, url , line, column));\n}");
10370 } 10426 }
10371 if ($notnull_bool(this.useThrow)) { 10427 if ($notnull_bool(this.useThrow)) {
10372 w.writeln("function $throw(e) {\n // If e is not a value, we can use V8's c aptureStackTrace utility method.\n // TODO(jmesserly): capture the stack trace on other JS engines.\n if (e && (typeof e == 'object') && Error.captureStackTra ce) {\n // TODO(jmesserly): this will clobber the e.stack property\n Error .captureStackTrace(e, $throw);\n }\n throw e;\n}"); 10428 w.writeln("function $throw(e) {\n // If e is not a value, we can use V8's c aptureStackTrace utility method.\n // TODO(jmesserly): capture the stack trace on other JS engines.\n if (e && (typeof e == 'object') && Error.captureStackTra ce) {\n // TODO(jmesserly): this will clobber the e.stack property\n Error .captureStackTrace(e, $throw);\n }\n throw e;\n}");
10373 } 10429 }
10374 if ($notnull_bool(this.useMap)) { 10430 if ($notnull_bool(this.useMap)) {
10375 w.writeln("function $map(items) {\n var ret = new HashMapImplementation();\ n for (var i=0; i < items.length;) {\n ret.$setindex(items[i++], items[i++]) ;\n }\n return ret;\n}"); 10431 w.writeln("function $map(items) {\n var ret = new HashMapImplementation();\ n for (var i=0; i < items.length;) {\n ret.$setindex(items[i++], items[i++]) ;\n }\n return ret;\n}");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
10411 world.get$coreimpl().types.$index('StringImplementation').markUsed(); 10467 world.get$coreimpl().types.$index('StringImplementation').markUsed();
10412 world.get$coreimpl().types.$index('MatchImplementation').markUsed(); 10468 world.get$coreimpl().types.$index('MatchImplementation').markUsed();
10413 this.genMethod((($0 = world.get$coreimpl().types.$index('MatchImplementation') .getConstructor('')) && $0.is$Member())); 10469 this.genMethod((($0 = world.get$coreimpl().types.$index('MatchImplementation') .getConstructor('')) && $0.is$Member()));
10414 this.writeTypes(world.get$coreimpl()); 10470 this.writeTypes(world.get$coreimpl());
10415 this.writeTypes(world.corelib); 10471 this.writeTypes(world.corelib);
10416 this.writeTypes(this.main.declaringType.get$library()); 10472 this.writeTypes(this.main.declaringType.get$library());
10417 this._writeGlobals(); 10473 this._writeGlobals();
10418 this.writer.writeln(('RunEntry(function () {' + mainCall.code + ';}, []);')); 10474 this.writer.writeln(('RunEntry(function () {' + mainCall.code + ';}, []);'));
10419 } 10475 }
10420 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe ndencies) { 10476 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe ndencies) {
10477 var $0;
10421 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + ""); 10478 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + "");
10422 if ($notnull_bool(!$notnull_bool(this.globals.containsKey(fullname)))) { 10479 if ($notnull_bool(!$notnull_bool(this.globals.containsKey(fullname)))) {
10423 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory( field, fieldValue, dependencies)); 10480 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory( field, fieldValue, dependencies));
10424 } 10481 }
10425 return this.globals.$index(fullname); 10482 return (($0 = this.globals.$index(fullname)) && $0.is$GlobalValue());
10426 } 10483 }
10427 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { 10484 WorldGenerator.prototype.globalForConst = function(exp, dependencies) {
10485 var $0;
10428 var code = exp.canonicalCode; 10486 var code = exp.canonicalCode;
10429 if ($notnull_bool(!$notnull_bool(this.globals.containsKey(code)))) { 10487 if ($notnull_bool(!$notnull_bool(this.globals.containsKey(code)))) {
10430 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this. globals.get$length(), exp, dependencies)); 10488 this.globals.$setindex(code, GlobalValue.GlobalValue$fromConst$factory(this. globals.get$length(), exp, dependencies));
10431 } 10489 }
10432 return this.globals.$index(code); 10490 return (($0 = this.globals.$index(code)) && $0.is$GlobalValue());
10433 } 10491 }
10434 WorldGenerator.prototype.writeTypes = function(lib) { 10492 WorldGenerator.prototype.writeTypes = function(lib) {
10435 if ($notnull_bool(lib.isWritten)) return; 10493 if ($notnull_bool(lib.isWritten)) return;
10436 lib.isWritten = true; 10494 lib.isWritten = true;
10437 var $list = lib.imports; 10495 var $list = lib.imports;
10438 for (var $i = 0;$i < $list.length; $i++) { 10496 for (var $i = 0;$i < $list.length; $i++) {
10439 var import_ = $list.$index($i); 10497 var import_ = $list.$index($i);
10440 this.writeTypes(import_.get$library()); 10498 this.writeTypes(import_.get$library());
10441 } 10499 }
10442 for (var i = 0; 10500 for (var i = 0;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
10696 return WorldGenerator.prototype._compareMembers.bind(this); 10754 return WorldGenerator.prototype._compareMembers.bind(this);
10697 } 10755 }
10698 WorldGenerator.prototype.useMapFactory = function() { 10756 WorldGenerator.prototype.useMapFactory = function() {
10699 var $0; 10757 var $0;
10700 this.corejs.useMap = true; 10758 this.corejs.useMap = true;
10701 var factType = world.get$coreimpl().types.$index('HashMapImplementation'); 10759 var factType = world.get$coreimpl().types.$index('HashMapImplementation');
10702 var m = factType.resolveMember('\$setindex'); 10760 var m = factType.resolveMember('\$setindex');
10703 this.genMethod((($0 = m.get$members().$index(0)) && $0.is$Member())); 10761 this.genMethod((($0 = m.get$members().$index(0)) && $0.is$Member()));
10704 var c = factType.getConstructor(''); 10762 var c = factType.getConstructor('');
10705 this.genMethod((c && c.is$Member())); 10763 this.genMethod((c && c.is$Member()));
10706 return factType; 10764 return (factType && factType.is$lang_Type());
10707 } 10765 }
10708 // ********** Code for BlockScope ************** 10766 // ********** Code for BlockScope **************
10709 function BlockScope(enclosingMethod, parent, reentrant) { 10767 function BlockScope(enclosingMethod, parent, reentrant) {
10710 this.enclosingMethod = enclosingMethod; 10768 this.enclosingMethod = enclosingMethod;
10711 this.parent = parent; 10769 this.parent = parent;
10712 this.reentrant = reentrant; 10770 this.reentrant = reentrant;
10713 this._vars = $map([]); 10771 this._vars = $map([]);
10714 // Initializers done 10772 // Initializers done
10715 if ($notnull_bool(this.get$isMethodScope())) { 10773 if ($notnull_bool(this.get$isMethodScope())) {
10716 this._closedOver = new HashSetImplementation$String(); 10774 this._closedOver = new HashSetImplementation$String();
10717 } 10775 }
10718 else { 10776 else {
10719 this.reentrant = $assert_bool(this.reentrant || this.parent.reentrant); 10777 this.reentrant = $assert_bool(this.reentrant || this.parent.reentrant);
10720 } 10778 }
10721 } 10779 }
10780 BlockScope.prototype.is$BlockScope = function(){return this;};
10722 BlockScope.prototype.get$parent = function() { return this.parent; }; 10781 BlockScope.prototype.get$parent = function() { return this.parent; };
10723 BlockScope.prototype.set$parent = function(value) { return this.parent = value; }; 10782 BlockScope.prototype.set$parent = function(value) { return this.parent = value; };
10724 BlockScope.prototype.get$isMethodScope = function() { 10783 BlockScope.prototype.get$isMethodScope = function() {
10725 return this.parent == null || $ne(this.parent.enclosingMethod, this.enclosingM ethod); 10784 return $assert_bool(this.parent == null || $ne(this.parent.enclosingMethod, th is.enclosingMethod));
10726 } 10785 }
10727 BlockScope.prototype.get$methodScope = function() { 10786 BlockScope.prototype.get$methodScope = function() {
10728 var s = this; 10787 var s = this;
10729 while ($notnull_bool(!$notnull_bool(s.get$isMethodScope()))) s = s.get$parent( ); 10788 while ($notnull_bool(!$notnull_bool(s.get$isMethodScope()))) s = s.get$parent( );
10730 return s; 10789 return (s && s.is$BlockScope());
10731 } 10790 }
10732 BlockScope.prototype.lookup = function(name) { 10791 BlockScope.prototype.lookup = function(name) {
10733 var ret = this._vars.$index(name); 10792 var ret = this._vars.$index(name);
10734 if ($notnull_bool($ne(ret, null))) return ret; 10793 if ($notnull_bool($ne(ret, null))) return ret;
10735 for (var s = this.parent; 10794 for (var s = this.parent;
10736 $notnull_bool($ne(s, null)); s = s.get$parent()) { 10795 $notnull_bool($ne(s, null)); s = s.get$parent()) {
10737 ret = s._vars.$index(name); 10796 ret = s._vars.$index(name);
10738 if ($notnull_bool($ne(ret, null))) { 10797 if ($notnull_bool($ne(ret, null))) {
10739 if ($notnull_bool($ne(s.enclosingMethod, this.enclosingMethod))) { 10798 if ($notnull_bool($ne(s.enclosingMethod, this.enclosingMethod))) {
10740 s.get$methodScope()._closedOver.add(ret.code); 10799 s.get$methodScope()._closedOver.add(ret.code);
(...skipping 27 matching lines...) Expand all
10768 } 10827 }
10769 } 10828 }
10770 if ($notnull_bool(!$notnull_bool(isParameter))) { 10829 if ($notnull_bool(!$notnull_bool(isParameter))) {
10771 var index = 0; 10830 var index = 0;
10772 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) { 10831 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) {
10773 jsName = ('' + name + '' + index++ + ''); 10832 jsName = ('' + name + '' + index++ + '');
10774 } 10833 }
10775 } 10834 }
10776 var ret = new Value(type, jsName, $notnull_bool(location != null) ? location.s pan : null, false, false, false); 10835 var ret = new Value(type, jsName, $notnull_bool(location != null) ? location.s pan : null, false, false, false);
10777 this._vars.$setindex(name, ret); 10836 this._vars.$setindex(name, ret);
10778 return ret; 10837 return (ret && ret.is$Value());
10779 } 10838 }
10780 BlockScope.prototype.declareParameter = function(p) { 10839 BlockScope.prototype.declareParameter = function(p) {
10781 return this.create(p.name, p.type, p.definition, true); 10840 return this.create(p.name, p.type, p.definition, true);
10782 } 10841 }
10783 BlockScope.prototype.declare = function(id) { 10842 BlockScope.prototype.declare = function(id) {
10784 var type = this.enclosingMethod.method.resolveType(id.type, false); 10843 var type = this.enclosingMethod.method.resolveType(id.type, false);
10785 return this.create(id.name.name, (type && type.is$lang_Type()), id, false); 10844 return this.create(id.name.name, (type && type.is$lang_Type()), id, false);
10786 } 10845 }
10787 BlockScope.prototype.getRethrow = function() { 10846 BlockScope.prototype.getRethrow = function() {
10788 var scope = this; 10847 var scope = this;
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
11136 world.error('initialization cycle', node.span); 11195 world.error('initialization cycle', node.span);
11137 break; 11196 break;
11138 } 11197 }
11139 other = other.get$initDelegate(); 11198 other = other.get$initDelegate();
11140 } 11199 }
11141 world.gen.genMethod((m && m.is$Member())); 11200 world.gen.genMethod((m && m.is$Member()));
11142 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments)); 11201 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments));
11143 if ($notnull_bool($ne(target.type, world.objectType))) { 11202 if ($notnull_bool($ne(target.type, world.objectType))) {
11144 this.writer.writeln(('' + value.code + ';')); 11203 this.writer.writeln(('' + value.code + ';'));
11145 } 11204 }
11146 return target; 11205 return (target && target.is$Value());
11147 } 11206 }
11148 MethodGenerator.prototype._makeArgs = function(arguments) { 11207 MethodGenerator.prototype._makeArgs = function(arguments) {
11149 var $0; 11208 var $0;
11150 var args = []; 11209 var args = [];
11151 var seenLabel = false; 11210 var seenLabel = false;
11152 for (var $i = 0;$i < arguments.length; $i++) { 11211 for (var $i = 0;$i < arguments.length; $i++) {
11153 var arg = arguments.$index($i); 11212 var arg = arguments.$index($i);
11154 if ($notnull_bool(arg.label != null)) { 11213 if ($notnull_bool(arg.label != null)) {
11155 seenLabel = true; 11214 seenLabel = true;
11156 } 11215 }
(...skipping 25 matching lines...) Expand all
11182 this._scope = new BlockScope(this, this._scope, reentrant); 11241 this._scope = new BlockScope(this, this._scope, reentrant);
11183 } 11242 }
11184 MethodGenerator.prototype._popBlock = function() { 11243 MethodGenerator.prototype._popBlock = function() {
11185 this._scope = this._scope.parent; 11244 this._scope = this._scope.parent;
11186 } 11245 }
11187 MethodGenerator.prototype._makeLambdaMethod = function(name, func) { 11246 MethodGenerator.prototype._makeLambdaMethod = function(name, func) {
11188 var meth = new MethodMember(name, this.method.declaringType, func); 11247 var meth = new MethodMember(name, this.method.declaringType, func);
11189 meth.isLambda = true; 11248 meth.isLambda = true;
11190 meth.resolve(this.method.declaringType); 11249 meth.resolve(this.method.declaringType);
11191 world.gen.genMethod((meth && meth.is$Member()), this); 11250 world.gen.genMethod((meth && meth.is$Member()), this);
11192 return meth; 11251 return (meth && meth.is$MethodMember());
11193 } 11252 }
11194 MethodGenerator.prototype.visitBool = function(node) { 11253 MethodGenerator.prototype.visitBool = function(node) {
11195 return this.visitValue(node).convertToNonNullBool(this, node); 11254 return this.visitValue(node).convertToNonNullBool(this, node);
11196 } 11255 }
11197 MethodGenerator.prototype.visitValue = function(node) { 11256 MethodGenerator.prototype.visitValue = function(node) {
11198 if ($notnull_bool(node == null)) return null; 11257 if ($notnull_bool(node == null)) return null;
11199 var value = node.visit(this); 11258 var value = node.visit(this);
11200 value.checkFirstClass(node.span); 11259 value.checkFirstClass(node.span);
11201 return value; 11260 return value;
11202 } 11261 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
11261 return false; 11320 return false;
11262 } 11321 }
11263 MethodGenerator.prototype.visitReturnStatement = function(node) { 11322 MethodGenerator.prototype.visitReturnStatement = function(node) {
11264 if ($notnull_bool(node.value == null)) { 11323 if ($notnull_bool(node.value == null)) {
11265 this.writer.writeln('return;'); 11324 this.writer.writeln('return;');
11266 } 11325 }
11267 else { 11326 else {
11268 if ($notnull_bool(this.method.get$isConstructor())) { 11327 if ($notnull_bool(this.method.get$isConstructor())) {
11269 world.error('return of value not allowed from constructor', node.span); 11328 world.error('return of value not allowed from constructor', node.span);
11270 } 11329 }
11271 this.writer.writeln(('return ' + this.visitValue(node.value).code + ';')); 11330 var value = this.visitTypedValue(node.value, this.method.get$returnType());
11331 this.writer.writeln(('return ' + value.code + ';'));
11272 } 11332 }
11273 return true; 11333 return true;
11274 } 11334 }
11275 MethodGenerator.prototype.visitThrowStatement = function(node) { 11335 MethodGenerator.prototype.visitThrowStatement = function(node) {
11276 if ($notnull_bool(node.value != null)) { 11336 if ($notnull_bool(node.value != null)) {
11277 var value = this.visitValue(node.value); 11337 var value = this.visitValue(node.value);
11278 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY()); 11338 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY());
11279 this.writer.writeln(('\$throw(' + value.code + ');')); 11339 this.writer.writeln(('\$throw(' + value.code + ');'));
11280 world.gen.corejs.useThrow = true; 11340 world.gen.corejs.useThrow = true;
11281 } 11341 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
11559 } 11619 }
11560 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { 11620 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) {
11561 for (var i = 0; 11621 for (var i = 0;
11562 $notnull_bool(i < statementList.length); i++) { 11622 $notnull_bool(i < statementList.length); i++) {
11563 var stmt = statementList.$index(i); 11623 var stmt = statementList.$index(i);
11564 exits = stmt.visit(this); 11624 exits = stmt.visit(this);
11565 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1)) && exits)) { 11625 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1)) && exits)) {
11566 world.warning('unreachable code', statementList.$index(i + 1).get$span()); 11626 world.warning('unreachable code', statementList.$index(i + 1).get$span());
11567 } 11627 }
11568 } 11628 }
11569 return exits; 11629 return $assert_bool(exits);
11570 } 11630 }
11571 MethodGenerator.prototype.visitBlockStatement = function(node) { 11631 MethodGenerator.prototype.visitBlockStatement = function(node) {
11572 this._pushBlock(false); 11632 this._pushBlock(false);
11573 this.writer.enterBlock('{'); 11633 this.writer.enterBlock('{');
11574 var exits = this._visitAllStatements(node.body, false); 11634 var exits = this._visitAllStatements(node.body, false);
11575 this.writer.exitBlock('}'); 11635 this.writer.exitBlock('}');
11576 this._popBlock(); 11636 this._popBlock();
11577 return exits; 11637 return $assert_bool(exits);
11578 } 11638 }
11579 MethodGenerator.prototype.visitLabeledStatement = function(node) { 11639 MethodGenerator.prototype.visitLabeledStatement = function(node) {
11580 this.writer.writeln(('' + node.name.name + ':')); 11640 this.writer.writeln(('' + node.name.name + ':'));
11581 node.body.visit(this); 11641 node.body.visit(this);
11582 return false; 11642 return false;
11583 } 11643 }
11584 MethodGenerator.prototype.visitExpressionStatement = function(node) { 11644 MethodGenerator.prototype.visitExpressionStatement = function(node) {
11585 if ($notnull_bool((node.body instanceof VarExpression) || (node.body instanceo f ThisExpression))) { 11645 if ($notnull_bool((node.body instanceof VarExpression) || (node.body instanceo f ThisExpression))) {
11586 world.warning('variable used as statement', node.span); 11646 world.warning('variable used as statement', node.span);
11587 } 11647 }
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
11960 for (var $i = 0;$i < $list.length; $i++) { 12020 for (var $i = 0;$i < $list.length; $i++) {
11961 var item = $list.$index($i); 12021 var item = $list.$index($i);
11962 var arg = this.visitValue((item && item.is$lang_Expression())); 12022 var arg = this.visitValue((item && item.is$lang_Expression()));
11963 argValues.add(arg); 12023 argValues.add(arg);
11964 if ($notnull_bool(node.isConst)) { 12024 if ($notnull_bool(node.isConst)) {
11965 if ($notnull_bool(!$notnull_bool(arg.get$isConst()))) { 12025 if ($notnull_bool(!$notnull_bool(arg.get$isConst()))) {
11966 world.error('const list can only contain const values', item.get$span()) ; 12026 world.error('const list can only contain const values', item.get$span()) ;
11967 argsCode.add(arg.code); 12027 argsCode.add(arg.code);
11968 } 12028 }
11969 else { 12029 else {
11970 argsCode.add(arg.canonicalCode); 12030 argsCode.add(arg.get$canonicalCode());
11971 } 12031 }
11972 } 12032 }
11973 else { 12033 else {
11974 argsCode.add(arg.code); 12034 argsCode.add(arg.code);
11975 } 12035 }
11976 } 12036 }
11977 world.get$coreimpl().types.$index('ListFactory').markUsed(); 12037 world.get$coreimpl().types.$index('ListFactory').markUsed();
11978 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); 12038 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']');
11979 var value = new Value(world.listType, code, node.span, false, true, false); 12039 var value = new Value(world.listType, code, node.span, false, true, false);
11980 if ($notnull_bool(node.isConst)) { 12040 if ($notnull_bool(node.isConst)) {
(...skipping 16 matching lines...) Expand all
11997 var value = this.visitValue((valueItem && valueItem.is$lang_Expression())); 12057 var value = this.visitValue((valueItem && valueItem.is$lang_Expression()));
11998 argValues.add(key); 12058 argValues.add(key);
11999 argValues.add(value); 12059 argValues.add(value);
12000 if ($notnull_bool(node.isConst)) { 12060 if ($notnull_bool(node.isConst)) {
12001 if ($notnull_bool(!$notnull_bool(key.get$isConst()) || !$notnull_bool(valu e.get$isConst()))) { 12061 if ($notnull_bool(!$notnull_bool(key.get$isConst()) || !$notnull_bool(valu e.get$isConst()))) {
12002 world.error('const map can only contain const values', valueItem.get$spa n()); 12062 world.error('const map can only contain const values', valueItem.get$spa n());
12003 argsCode.add(key.code); 12063 argsCode.add(key.code);
12004 argsCode.add(value.code); 12064 argsCode.add(value.code);
12005 } 12065 }
12006 else { 12066 else {
12007 argsCode.add(key.canonicalCode); 12067 argsCode.add(key.get$canonicalCode());
12008 argsCode.add(value.canonicalCode); 12068 argsCode.add(value.get$canonicalCode());
12009 } 12069 }
12010 } 12070 }
12011 else { 12071 else {
12012 argsCode.add(key.code); 12072 argsCode.add(key.code);
12013 argsCode.add(value.code); 12073 argsCode.add(value.code);
12014 } 12074 }
12015 } 12075 }
12016 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); 12076 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']');
12017 var code = ('\$map(' + argList + ')'); 12077 var code = ('\$map(' + argList + ')');
12018 if ($notnull_bool(node.isConst)) { 12078 if ($notnull_bool(node.isConst)) {
(...skipping 16 matching lines...) Expand all
12035 } 12095 }
12036 MethodGenerator.prototype.visitIsExpression = function(node) { 12096 MethodGenerator.prototype.visitIsExpression = function(node) {
12037 var value = this.visitValue(node.x); 12097 var value = this.visitValue(node.x);
12038 var type = this.method.resolveType(node.type, false); 12098 var type = this.method.resolveType(node.type, false);
12039 return value.instanceOf(this, (type && type.is$lang_Type()), node.span, node.i sTrue, false); 12099 return value.instanceOf(this, (type && type.is$lang_Type()), node.span, node.i sTrue, false);
12040 } 12100 }
12041 MethodGenerator.prototype.visitParenExpression = function(node) { 12101 MethodGenerator.prototype.visitParenExpression = function(node) {
12042 var $0; 12102 var $0;
12043 var body = this.visitValue(node.body); 12103 var body = this.visitValue(node.body);
12044 if ($notnull_bool(body.get$isConst())) { 12104 if ($notnull_bool(body.get$isConst())) {
12045 return EvaluatedValue.EvaluatedValue$factory((($0 = body.type) && $0.is$lang _Type()), body.get$actualValue(), ('(' + body.canonicalCode + ')'), node.span); 12105 return EvaluatedValue.EvaluatedValue$factory((($0 = body.type) && $0.is$lang _Type()), body.get$actualValue(), ('(' + body.get$canonicalCode() + ')'), node.s pan);
12046 } 12106 }
12047 return new Value(body.type, ('(' + body.code + ')'), node.span, false, true, f alse); 12107 return new Value(body.type, ('(' + body.code + ')'), node.span, false, true, f alse);
12048 } 12108 }
12049 MethodGenerator.prototype.visitDotExpression = function(node) { 12109 MethodGenerator.prototype.visitDotExpression = function(node) {
12050 var target = node.self.visit(this); 12110 var target = node.self.visit(this);
12051 return target.get_(this, node.name.name, node.name); 12111 return target.get_(this, node.name.name, node.name);
12052 } 12112 }
12053 MethodGenerator.prototype.visitVarExpression = function(node) { 12113 MethodGenerator.prototype.visitVarExpression = function(node) {
12054 var name = node.name.name; 12114 var name = node.name.name;
12055 var ret = this._scope.lookup(name); 12115 var ret = this._scope.lookup(name);
(...skipping 12 matching lines...) Expand all
12068 } 12128 }
12069 MethodGenerator.prototype.visitSuperExpression = function(node) { 12129 MethodGenerator.prototype.visitSuperExpression = function(node) {
12070 return this._makeSuperValue(node); 12130 return this._makeSuperValue(node);
12071 } 12131 }
12072 MethodGenerator.prototype.visitNullExpression = function(node) { 12132 MethodGenerator.prototype.visitNullExpression = function(node) {
12073 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null); 12133 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null);
12074 } 12134 }
12075 MethodGenerator.prototype.visitLiteralExpression = function(node) { 12135 MethodGenerator.prototype.visitLiteralExpression = function(node) {
12076 var $0; 12136 var $0;
12077 var type = node.type.type; 12137 var type = node.type.type;
12078 $assert($ne(type, null), "type != null", "gen.dart", 2075, 12); 12138 $assert($ne(type, null), "type != null", "gen.dart", 2078, 12);
12079 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { 12139 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) {
12080 var items = []; 12140 var items = [];
12081 var $list = node.value; 12141 var $list = node.value;
12082 for (var $i = node.value.iterator(); $i.hasNext(); ) { 12142 for (var $i = node.value.iterator(); $i.hasNext(); ) {
12083 var item = $i.next(); 12143 var item = $i.next();
12084 var val = this.visitValue((item && item.is$lang_Expression())); 12144 var val = this.visitValue((item && item.is$lang_Expression()));
12085 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); 12145 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY());
12086 var code = val.code; 12146 var code = val.code;
12087 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C onditionalExpression))) { 12147 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C onditionalExpression))) {
12088 code = ('(' + code + ')'); 12148 code = ('(' + code + ')');
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
12153 Arguments.prototype.getIndexOfName = function(name) { 12213 Arguments.prototype.getIndexOfName = function(name) {
12154 for (var i = this.get$bareCount(); 12214 for (var i = this.get$bareCount();
12155 $notnull_bool(i < this.get$length()); i++) { 12215 $notnull_bool(i < this.get$length()); i++) {
12156 if ($notnull_bool(this.getName(i) == name)) { 12216 if ($notnull_bool(this.getName(i) == name)) {
12157 return i; 12217 return i;
12158 } 12218 }
12159 } 12219 }
12160 return -1; 12220 return -1;
12161 } 12221 }
12162 Arguments.prototype.getValue = function(name) { 12222 Arguments.prototype.getValue = function(name) {
12223 var $0;
12163 var i = this.getIndexOfName(name); 12224 var i = this.getIndexOfName(name);
12164 return $notnull_bool(i >= 0) ? this.values.$index(i) : null; 12225 return (($0 = $notnull_bool(i >= 0) ? this.values.$index(i) : null) && $0.is$V alue());
12165 } 12226 }
12166 Arguments.prototype.get$bareCount = function() { 12227 Arguments.prototype.get$bareCount = function() {
12167 if ($notnull_bool(this._bareCount == null)) { 12228 if ($notnull_bool(this._bareCount == null)) {
12168 this._bareCount = this.get$length(); 12229 this._bareCount = this.get$length();
12169 if ($notnull_bool(this.nodes != null)) { 12230 if ($notnull_bool(this.nodes != null)) {
12170 for (var i = 0; 12231 for (var i = 0;
12171 $notnull_bool(i < this.nodes.length); i++) { 12232 $notnull_bool(i < this.nodes.length); i++) {
12172 if ($notnull_bool(this.nodes.$index(i).label != null)) { 12233 if ($notnull_bool(this.nodes.$index(i).label != null)) {
12173 this._bareCount = i; 12234 this._bareCount = i;
12174 break; 12235 break;
(...skipping 16 matching lines...) Expand all
12191 while ($notnull_bool(argsCode.length > 0 && $eq(argsCode.last(), 'null'))) { 12252 while ($notnull_bool(argsCode.length > 0 && $eq(argsCode.last(), 'null'))) {
12192 argsCode.removeLast(); 12253 argsCode.removeLast();
12193 } 12254 }
12194 } 12255 }
12195 Arguments.prototype.getNames = function() { 12256 Arguments.prototype.getNames = function() {
12196 var names = []; 12257 var names = [];
12197 for (var i = this.get$bareCount(); 12258 for (var i = this.get$bareCount();
12198 $notnull_bool(i < this.get$length()); i++) { 12259 $notnull_bool(i < this.get$length()); i++) {
12199 names.add(this.getName(i)); 12260 names.add(this.getName(i));
12200 } 12261 }
12201 return names; 12262 return (names && names.is$List$String());
12202 } 12263 }
12203 Arguments.prototype.toCallStubArgs = function() { 12264 Arguments.prototype.toCallStubArgs = function() {
12204 var result = []; 12265 var result = [];
12205 for (var i = 0; 12266 for (var i = 0;
12206 $notnull_bool(i < this.get$bareCount()); i++) { 12267 $notnull_bool(i < this.get$bareCount()); i++) {
12207 result.add(new Value(world.varType, ('\$' + i + ''), null, false, false, fal se)); 12268 result.add(new Value(world.varType, ('\$' + i + ''), null, false, false, fal se));
12208 } 12269 }
12209 for (var i = this.get$bareCount(); 12270 for (var i = this.get$bareCount();
12210 $notnull_bool(i < this.get$length()); i++) { 12271 $notnull_bool(i < this.get$length()); i++) {
12211 var name = this.getName(i); 12272 var name = this.getName(i);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
12262 } 12323 }
12263 Library.prototype.addImport = function(fullname, prefix) { 12324 Library.prototype.addImport = function(fullname, prefix) {
12264 var newLib = world.getOrAddLibrary(fullname); 12325 var newLib = world.getOrAddLibrary(fullname);
12265 this.imports.add(new LibraryImport(newLib, prefix)); 12326 this.imports.add(new LibraryImport(newLib, prefix));
12266 return newLib; 12327 return newLib;
12267 } 12328 }
12268 Library.prototype.addNative = function(fullname) { 12329 Library.prototype.addNative = function(fullname) {
12269 this.natives.add(world.reader.readFile(fullname)); 12330 this.natives.add(world.reader.readFile(fullname));
12270 } 12331 }
12271 Library.prototype._findMembers = function(name) { 12332 Library.prototype._findMembers = function(name) {
12333 var $0;
12272 if ($notnull_bool(name.startsWith('_'))) { 12334 if ($notnull_bool(name.startsWith('_'))) {
12273 return this._privateMembers.$index(name); 12335 return (($0 = this._privateMembers.$index(name)) && $0.is$MemberSet());
12274 } 12336 }
12275 else { 12337 else {
12276 return world._members.$index(name); 12338 return (($0 = world._members.$index(name)) && $0.is$MemberSet());
12277 } 12339 }
12278 } 12340 }
12279 Library.prototype._addMember = function(member) { 12341 Library.prototype._addMember = function(member) {
12280 var $0; 12342 var $0;
12281 if ($notnull_bool(member.get$isPrivate())) { 12343 if ($notnull_bool(member.get$isPrivate())) {
12282 if ($notnull_bool(member.get$isStatic())) { 12344 if ($notnull_bool(member.get$isStatic())) {
12283 if ($notnull_bool(member.declaringType.get$isTop())) { 12345 if ($notnull_bool(member.declaringType.get$isTop())) {
12284 world._addTopName(member); 12346 world._addTopName(member);
12285 } 12347 }
12286 return; 12348 return;
(...skipping 21 matching lines...) Expand all
12308 } 12370 }
12309 Library.prototype.getOrAddFunctionType = function(name, func, inType) { 12371 Library.prototype.getOrAddFunctionType = function(name, func, inType) {
12310 var def = new FunctionTypeDefinition(func, null, func.span); 12372 var def = new FunctionTypeDefinition(func, null, func.span);
12311 var type = new DefinedType(name, this, def, false); 12373 var type = new DefinedType(name, this, def, false);
12312 type.addMethod('\$call', func); 12374 type.addMethod('\$call', func);
12313 type.members.$index('\$call').resolve(inType); 12375 type.members.$index('\$call').resolve(inType);
12314 type.interfaces = [world.functionType]; 12376 type.interfaces = [world.functionType];
12315 return type; 12377 return type;
12316 } 12378 }
12317 Library.prototype.addType = function(name, definition, isClass) { 12379 Library.prototype.addType = function(name, definition, isClass) {
12380 var $0;
12318 if ($notnull_bool(this.types.containsKey(name))) { 12381 if ($notnull_bool(this.types.containsKey(name))) {
12319 var existingType = this.types.$index(name); 12382 var existingType = this.types.$index(name);
12320 if ($notnull_bool(this.get$isCore() && existingType.get$definition() == null )) { 12383 if ($notnull_bool(this.get$isCore() && existingType.get$definition() == null )) {
12321 existingType.setDefinition((definition && definition.is$Definition())); 12384 existingType.setDefinition((definition && definition.is$Definition()));
12322 } 12385 }
12323 else { 12386 else {
12324 world.warning(('duplicate definition of ' + name + ''), definition.span); 12387 world.warning(('duplicate definition of ' + name + ''), definition.span);
12325 } 12388 }
12326 } 12389 }
12327 else { 12390 else {
12328 this.types.$setindex(name, new DefinedType(name, this, (definition && defini tion.is$Definition()), isClass)); 12391 this.types.$setindex(name, new DefinedType(name, this, (definition && defini tion.is$Definition()), isClass));
12329 } 12392 }
12330 return this.types.$index(name); 12393 return (($0 = this.types.$index(name)) && $0.is$DefinedType());
12331 } 12394 }
12332 Library.prototype.findType = function(type) { 12395 Library.prototype.findType = function(type) {
12333 var result = this.findTypeByName(type.name.name); 12396 var result = this.findTypeByName(type.name.name);
12334 if ($notnull_bool(result == null)) return null; 12397 if ($notnull_bool(result == null)) return null;
12335 if ($notnull_bool(type.names != null)) { 12398 if ($notnull_bool(type.names != null)) {
12336 if ($notnull_bool(type.names.length > 1)) { 12399 if ($notnull_bool(type.names.length > 1)) {
12337 return null; 12400 return null;
12338 } 12401 }
12339 if ($notnull_bool(!$notnull_bool(result.get$isTop()))) { 12402 if ($notnull_bool(!$notnull_bool(result.get$isTop()))) {
12340 return null; 12403 return null;
(...skipping 16 matching lines...) Expand all
12357 } 12420 }
12358 if ($notnull_bool($ne(newRet, null))) { 12421 if ($notnull_bool($ne(newRet, null))) {
12359 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 12422 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
12360 world.error(('conflicting types for "' + name + '"'), ret.get$span(), ne wRet.get$span()); 12423 world.error(('conflicting types for "' + name + '"'), ret.get$span(), ne wRet.get$span());
12361 } 12424 }
12362 else { 12425 else {
12363 ret = newRet; 12426 ret = newRet;
12364 } 12427 }
12365 } 12428 }
12366 } 12429 }
12367 return ret; 12430 return (ret && ret.is$lang_Type());
12368 } 12431 }
12369 Library.prototype.lookup = function(name, span) { 12432 Library.prototype.lookup = function(name, span) {
12370 var retType = this.findTypeByName(name); 12433 var retType = this.findTypeByName(name);
12371 var ret = null; 12434 var ret = null;
12372 if ($notnull_bool($ne(retType, null))) { 12435 if ($notnull_bool($ne(retType, null))) {
12373 ret = retType.get$typeMember(); 12436 ret = retType.get$typeMember();
12374 } 12437 }
12375 var newRet = this.topType.getMember(name); 12438 var newRet = this.topType.getMember(name);
12376 if ($notnull_bool($ne(newRet, null))) { 12439 if ($notnull_bool($ne(newRet, null))) {
12377 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 12440 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
(...skipping 11 matching lines...) Expand all
12389 if ($notnull_bool($ne(newRet, null))) { 12452 if ($notnull_bool($ne(newRet, null))) {
12390 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 12453 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
12391 world.error(('conflicting members for "' + name + '"'), span, ret.get$ span(), newRet.get$span()); 12454 world.error(('conflicting members for "' + name + '"'), span, ret.get$ span(), newRet.get$span());
12392 } 12455 }
12393 else { 12456 else {
12394 ret = newRet; 12457 ret = newRet;
12395 } 12458 }
12396 } 12459 }
12397 } 12460 }
12398 } 12461 }
12399 return ret; 12462 return (ret && ret.is$Member());
12400 } 12463 }
12401 Library.prototype.resolve = function() { 12464 Library.prototype.resolve = function() {
12402 var $0; 12465 var $0;
12403 if ($notnull_bool(this.name == null)) { 12466 if ($notnull_bool(this.name == null)) {
12404 this.name = this.baseSource.filename; 12467 this.name = this.baseSource.filename;
12405 var index = this.name.lastIndexOf('/', this.name.length); 12468 var index = this.name.lastIndexOf('/', this.name.length);
12406 if ($notnull_bool(index >= 0)) { 12469 if ($notnull_bool(index >= 0)) {
12407 this.name = this.name.substring(index + 1); 12470 this.name = this.name.substring(index + 1);
12408 } 12471 }
12409 index = this.name.indexOf('.', 0); 12472 index = this.name.indexOf('.', 0);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
12663 context = new MethodGenerator(method, null); 12726 context = new MethodGenerator(method, null);
12664 } 12727 }
12665 this.value = (($0 = this.definition.value.visit(context)) && $0.is$Value()); 12728 this.value = (($0 = this.definition.value.visit(context)) && $0.is$Value());
12666 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse); 12729 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse);
12667 } 12730 }
12668 Parameter.prototype.copyWithNewType = function(newType) { 12731 Parameter.prototype.copyWithNewType = function(newType) {
12669 var ret = new Parameter(this.definition); 12732 var ret = new Parameter(this.definition);
12670 ret.type = newType; 12733 ret.type = newType;
12671 ret.name = this.name; 12734 ret.name = this.name;
12672 ret.isInitializer = this.isInitializer; 12735 ret.isInitializer = this.isInitializer;
12673 return ret; 12736 return (ret && ret.is$Parameter());
12674 } 12737 }
12675 Parameter.prototype.get$isOptional = function() { 12738 Parameter.prototype.get$isOptional = function() {
12676 return this.definition != null && this.definition.value != null; 12739 return $assert_bool(this.definition != null && this.definition.value != null);
12677 } 12740 }
12678 // ********** Code for Member ************** 12741 // ********** Code for Member **************
12679 function Member(name, declaringType) { 12742 function Member(name, declaringType) {
12680 this.name = name; 12743 this.name = name;
12681 this.declaringType = declaringType; 12744 this.declaringType = declaringType;
12682 this.isGenerated = false; 12745 this.isGenerated = false;
12683 // Initializers done 12746 // Initializers done
12684 } 12747 }
12685 Member.prototype.is$Member = function(){return this;}; 12748 Member.prototype.is$Member = function(){return this;};
12686 Member.prototype.is$Named = function(){return this;}; 12749 Member.prototype.is$Named = function(){return this;};
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
12721 Member.prototype.get$prefersPropertySyntax = function() { 12784 Member.prototype.get$prefersPropertySyntax = function() {
12722 return true; 12785 return true;
12723 } 12786 }
12724 Member.prototype.get$requiresFieldSyntax = function() { 12787 Member.prototype.get$requiresFieldSyntax = function() {
12725 return false; 12788 return false;
12726 } 12789 }
12727 Member.prototype.get$isNative = function() { 12790 Member.prototype.get$isNative = function() {
12728 return false; 12791 return false;
12729 } 12792 }
12730 Member.prototype.get$constructorName = function() { 12793 Member.prototype.get$constructorName = function() {
12731 return world.internalError('can not be a constructor', this.get$span()); 12794 world.internalError('can not be a constructor', this.get$span());
12732 } 12795 }
12733 Member.prototype.provideFieldSyntax = function() { 12796 Member.prototype.provideFieldSyntax = function() {
12734 return world.internalError('can not be field', this.get$span()); 12797 return world.internalError('can not be field', this.get$span());
12735 } 12798 }
12736 Member.prototype.providePropertySyntax = function() { 12799 Member.prototype.providePropertySyntax = function() {
12737 return world.internalError('can not be property', this.get$span()); 12800 return world.internalError('can not be property', this.get$span());
12738 } 12801 }
12739 Member.prototype.get$initDelegate = function() { 12802 Member.prototype.get$initDelegate = function() {
12740 return world.internalError('cannot have initializers', this.get$span()); 12803 world.internalError('cannot have initializers', this.get$span());
12741 } 12804 }
12742 Member.prototype.set$initDelegate = function(ctor) { 12805 Member.prototype.set$initDelegate = function(ctor) {
12743 return world.internalError('cannot have initializers', this.get$span()); 12806 world.internalError('cannot have initializers', this.get$span());
12744 } 12807 }
12745 Member.prototype.get$definition = function() { 12808 Member.prototype.get$definition = function() {
12746 return null; 12809 return null;
12747 } 12810 }
12748 Member.prototype.get$parameters = function() { 12811 Member.prototype.get$parameters = function() {
12749 return []; 12812 return [];
12750 } 12813 }
12751 Member.prototype.canInvoke = function(context, args) { 12814 Member.prototype.canInvoke = function(context, args) {
12752 return this.get$canGet() && new Value(this.get$returnType(), null, null, false , true, false).canInvoke(context, '\$call', args); 12815 return $assert_bool(this.get$canGet() && new Value(this.get$returnType(), null , null, false, true, false).canInvoke(context, '\$call', args));
12753 } 12816 }
12754 Member.prototype.invoke = function(context, node, target, args, isDynamic) { 12817 Member.prototype.invoke = function(context, node, target, args, isDynamic) {
12755 var newTarget = this._get(context, node, target, isDynamic); 12818 var newTarget = this._get(context, node, target, isDynamic);
12756 return newTarget.invoke(context, '\$call', node, args, isDynamic); 12819 return newTarget.invoke(context, '\$call', node, args, isDynamic);
12757 } 12820 }
12758 Member.prototype.override = function(other) { 12821 Member.prototype.override = function(other) {
12759 if ($notnull_bool(this.get$isStatic())) { 12822 if ($notnull_bool(this.get$isStatic())) {
12760 world.error('static members can not hide parent members', this.get$span(), o ther.get$span()); 12823 world.error('static members can not hide parent members', this.get$span(), o ther.get$span());
12761 return false; 12824 return false;
12762 } 12825 }
12763 else if ($notnull_bool(other.get$isStatic())) { 12826 else if ($notnull_bool(other.get$isStatic())) {
12764 world.error('can not override static member', this.get$span(), other.get$spa n()); 12827 world.error('can not override static member', this.get$span(), other.get$spa n());
12765 return false; 12828 return false;
12766 } 12829 }
12767 return true; 12830 return true;
12768 } 12831 }
12769 Member.prototype.get$generatedFactoryName = function() { 12832 Member.prototype.get$generatedFactoryName = function() {
12770 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 175, 12); 12833 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 178, 12);
12771 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo rName() + '\$'); 12834 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo rName() + '\$');
12772 if ($notnull_bool(this.name == '')) { 12835 if ($notnull_bool(this.name == '')) {
12773 return ('' + prefix + 'factory'); 12836 return ('' + prefix + 'factory');
12774 } 12837 }
12775 else { 12838 else {
12776 return ('' + prefix + '' + this.name + '\$factory'); 12839 return ('' + prefix + '' + this.name + '\$factory');
12777 } 12840 }
12778 } 12841 }
12779 Member.prototype.resolveType = function(node, isRequired) { 12842 Member.prototype.resolveType = function(node, isRequired) {
12780 var type = this.declaringType.resolveType(node, isRequired); 12843 var type = this.declaringType.resolveType(node, isRequired);
12781 if ($notnull_bool(this.get$isStatic() && type.get$hasTypeParams())) { 12844 if ($notnull_bool(this.get$isStatic() && type.get$hasTypeParams())) {
12782 world.error('using type parameter in static context', node.span); 12845 world.error('using type parameter in static context', node.span);
12783 } 12846 }
12784 return type; 12847 return (type && type.is$lang_Type());
12785 } 12848 }
12786 Member.prototype._get$3 = function($0, $1, $2) { 12849 Member.prototype._get$3 = function($0, $1, $2) {
12787 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value())); 12850 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()));
12788 } 12851 }
12789 ; 12852 ;
12790 Member.prototype._set$4 = function($0, $1, $2, $3) { 12853 Member.prototype._set$4 = function($0, $1, $2, $3) {
12791 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value())); 12854 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()));
12792 } 12855 }
12793 ; 12856 ;
12794 Member.prototype.invoke$4 = function($0, $1, $2, $3) { 12857 Member.prototype.invoke$4 = function($0, $1, $2, $3) {
12795 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); 12858 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false);
12796 } 12859 }
12797 ; 12860 ;
12798 // ********** Code for TypeMember ************** 12861 // ********** Code for TypeMember **************
12799 function TypeMember(type) { 12862 function TypeMember(type) {
12800 this.type = type; 12863 this.type = type;
12801 Member.call(this, type.name, type.library.topType); 12864 Member.call(this, type.name, type.library.topType);
12802 // Initializers done 12865 // Initializers done
12803 } 12866 }
12804 $inherits(TypeMember, Member); 12867 $inherits(TypeMember, Member);
12868 TypeMember.prototype.is$TypeMember = function(){return this;};
12805 TypeMember.prototype.get$span = function() { 12869 TypeMember.prototype.get$span = function() {
12806 return this.type.definition.span; 12870 return this.type.definition.span;
12807 } 12871 }
12808 TypeMember.prototype.get$isStatic = function() { 12872 TypeMember.prototype.get$isStatic = function() {
12809 return true; 12873 return true;
12810 } 12874 }
12811 TypeMember.prototype.get$returnType = function() { 12875 TypeMember.prototype.get$returnType = function() {
12812 return world.varType; 12876 return world.varType;
12813 } 12877 }
12814 TypeMember.prototype.canInvoke = function(context, args) { 12878 TypeMember.prototype.canInvoke = function(context, args) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
12875 FieldMember.prototype.get$prefersPropertySyntax = function() { 12939 FieldMember.prototype.get$prefersPropertySyntax = function() {
12876 return false; 12940 return false;
12877 } 12941 }
12878 FieldMember.prototype.get$requiresFieldSyntax = function() { 12942 FieldMember.prototype.get$requiresFieldSyntax = function() {
12879 return this.isNative; 12943 return this.isNative;
12880 } 12944 }
12881 FieldMember.prototype.provideFieldSyntax = function() { 12945 FieldMember.prototype.provideFieldSyntax = function() {
12882 12946
12883 } 12947 }
12884 FieldMember.prototype.providePropertySyntax = function() { 12948 FieldMember.prototype.providePropertySyntax = function() {
12885 return this._providePropertySyntax = true; 12949 this._providePropertySyntax = true;
12886 } 12950 }
12887 FieldMember.prototype.get$span = function() { 12951 FieldMember.prototype.get$span = function() {
12888 return $notnull_bool(this.definition == null) ? null : this.definition.span; 12952 var $0;
12953 return (($0 = $notnull_bool(this.definition == null) ? null : this.definition. span) && $0.is$SourceSpan());
12889 } 12954 }
12890 FieldMember.prototype.get$returnType = function() { 12955 FieldMember.prototype.get$returnType = function() {
12891 return this.type; 12956 return this.type;
12892 } 12957 }
12893 FieldMember.prototype.get$canGet = function() { 12958 FieldMember.prototype.get$canGet = function() {
12894 return true; 12959 return true;
12895 } 12960 }
12896 FieldMember.prototype.get$canSet = function() { 12961 FieldMember.prototype.get$canSet = function() {
12897 return !$notnull_bool(this.isFinal); 12962 return !$notnull_bool(this.isFinal);
12898 } 12963 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
12954 } 13019 }
12955 } 13020 }
12956 if ($notnull_bool(this.isStatic)) { 13021 if ($notnull_bool(this.isStatic)) {
12957 this._computedValue = world.gen.globalForStaticField(this, this._computedV alue, [this._computedValue]); 13022 this._computedValue = world.gen.globalForStaticField(this, this._computedV alue, [this._computedValue]);
12958 } 13023 }
12959 this._computing = false; 13024 this._computing = false;
12960 } 13025 }
12961 return this._computedValue; 13026 return this._computedValue;
12962 } 13027 }
12963 FieldMember.prototype._get = function(context, node, target, isDynamic) { 13028 FieldMember.prototype._get = function(context, node, target, isDynamic) {
13029 var $0;
12964 if ($notnull_bool(!$notnull_bool(isDynamic))) { 13030 if ($notnull_bool(!$notnull_bool(isDynamic))) {
12965 this.declaringType.markUsed(); 13031 this.declaringType.markUsed();
12966 } 13032 }
12967 if ($notnull_bool(this.isStatic)) { 13033 if ($notnull_bool(this.isStatic)) {
12968 var cv = this.computeValue(); 13034 var cv = this.computeValue();
12969 if ($notnull_bool(this.isFinal)) { 13035 if ($notnull_bool(this.isFinal)) {
12970 return cv; 13036 return (cv && cv.is$Value());
12971 } 13037 }
12972 if ($notnull_bool(this.declaringType.get$isTop())) { 13038 if ($notnull_bool(this.declaringType.get$isTop())) {
12973 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, fals e, true, false); 13039 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, fals e, true, false);
12974 } 13040 }
12975 else { 13041 else {
12976 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, false, true, false); 13042 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, false, true, false);
12977 } 13043 }
12978 } 13044 }
12979 else if ($notnull_bool(target.get$isConst() && this.isFinal)) { 13045 else if ($notnull_bool(target.get$isConst() && this.isFinal)) {
12980 var constTarget = $notnull_bool((target instanceof GlobalValue)) ? target.ge t$dynamic().exp : target; 13046 var constTarget = $notnull_bool((target instanceof GlobalValue)) ? target.ge t$dynamic().exp : target;
12981 if ($notnull_bool((constTarget instanceof ConstObjectValue))) { 13047 if ($notnull_bool((constTarget instanceof ConstObjectValue))) {
12982 return constTarget.fields.$index(this.name); 13048 return (($0 = constTarget.fields.$index(this.name)) && $0.is$Value());
12983 } 13049 }
12984 else if ($notnull_bool($eq(constTarget.type, world.stringType) && this.name == 'length')) { 13050 else if ($notnull_bool($eq(constTarget.type, world.stringType) && this.name == 'length')) {
12985 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), node.span, false, true, false); 13051 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), node.span, false, true, false);
12986 } 13052 }
12987 } 13053 }
12988 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, false, true, false); 13054 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, false, true, false);
12989 } 13055 }
12990 FieldMember.prototype._set = function(context, node, target, value, isDynamic) { 13056 FieldMember.prototype._set = function(context, node, target, value, isDynamic) {
12991 var lhs = this._get(context, node, target, isDynamic); 13057 var lhs = this._get(context, node, target, isDynamic);
12992 value = value.convertTo(context, this.type, node, isDynamic); 13058 value = value.convertTo(context, this.type, node, isDynamic);
12993 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), node.sp an, false, true, false); 13059 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), node.sp an, false, true, false);
12994 } 13060 }
12995 FieldMember.prototype._get$3 = function($0, $1, $2) { 13061 FieldMember.prototype._get$3 = function($0, $1, $2) {
12996 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); 13062 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
12997 } 13063 }
12998 ; 13064 ;
12999 FieldMember.prototype._set$4 = function($0, $1, $2, $3) { 13065 FieldMember.prototype._set$4 = function($0, $1, $2, $3) {
13000 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); 13066 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false);
13001 } 13067 }
13002 ; 13068 ;
13003 // ********** Code for PropertyMember ************** 13069 // ********** Code for PropertyMember **************
13004 function PropertyMember(name, declaringType) { 13070 function PropertyMember(name, declaringType) {
13005 this._provideFieldSyntax = false 13071 this._provideFieldSyntax = false
13006 Member.call(this, name, declaringType); 13072 Member.call(this, name, declaringType);
13007 // Initializers done 13073 // Initializers done
13008 } 13074 }
13009 $inherits(PropertyMember, Member); 13075 $inherits(PropertyMember, Member);
13010 PropertyMember.prototype.is$PropertyMember = function(){return this;}; 13076 PropertyMember.prototype.is$PropertyMember = function(){return this;};
13011 PropertyMember.prototype.get$span = function() { 13077 PropertyMember.prototype.get$span = function() {
13012 return $notnull_bool(this.getter != null) ? this.getter.get$span() : null; 13078 var $0;
13079 return (($0 = $notnull_bool(this.getter != null) ? this.getter.get$span() : nu ll) && $0.is$SourceSpan());
13013 } 13080 }
13014 PropertyMember.prototype.get$canGet = function() { 13081 PropertyMember.prototype.get$canGet = function() {
13015 return this.getter != null; 13082 return this.getter != null;
13016 } 13083 }
13017 PropertyMember.prototype.get$canSet = function() { 13084 PropertyMember.prototype.get$canSet = function() {
13018 return this.setter != null; 13085 return this.setter != null;
13019 } 13086 }
13020 PropertyMember.prototype.get$prefersPropertySyntax = function() { 13087 PropertyMember.prototype.get$prefersPropertySyntax = function() {
13021 return true; 13088 return true;
13022 } 13089 }
13023 PropertyMember.prototype.get$requiresFieldSyntax = function() { 13090 PropertyMember.prototype.get$requiresFieldSyntax = function() {
13024 return false; 13091 return false;
13025 } 13092 }
13026 PropertyMember.prototype.provideFieldSyntax = function() { 13093 PropertyMember.prototype.provideFieldSyntax = function() {
13027 return this._provideFieldSyntax = true; 13094 this._provideFieldSyntax = true;
13028 } 13095 }
13029 PropertyMember.prototype.providePropertySyntax = function() { 13096 PropertyMember.prototype.providePropertySyntax = function() {
13030 13097
13031 } 13098 }
13032 PropertyMember.prototype.get$isStatic = function() { 13099 PropertyMember.prototype.get$isStatic = function() {
13033 return $notnull_bool(this.getter == null) ? this.setter.isStatic : this.getter .isStatic; 13100 return $notnull_bool(this.getter == null) ? this.setter.isStatic : this.getter .isStatic;
13034 } 13101 }
13035 PropertyMember.prototype.get$isProperty = function() { 13102 PropertyMember.prototype.get$isProperty = function() {
13036 return true; 13103 return true;
13037 } 13104 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
13170 ConcreteMember.prototype.providePropertySyntax = function() { 13237 ConcreteMember.prototype.providePropertySyntax = function() {
13171 return this.baseMember.providePropertySyntax(); 13238 return this.baseMember.providePropertySyntax();
13172 } 13239 }
13173 ConcreteMember.prototype.get$isConstructor = function() { 13240 ConcreteMember.prototype.get$isConstructor = function() {
13174 return this.name == this.declaringType.name; 13241 return this.name == this.declaringType.name;
13175 } 13242 }
13176 ConcreteMember.prototype.get$constructorName = function() { 13243 ConcreteMember.prototype.get$constructorName = function() {
13177 return this.baseMember.get$constructorName(); 13244 return this.baseMember.get$constructorName();
13178 } 13245 }
13179 ConcreteMember.prototype.get$definition = function() { 13246 ConcreteMember.prototype.get$definition = function() {
13180 return this.baseMember.get$definition(); 13247 var $0;
13248 return (($0 = this.baseMember.get$definition()) && $0.is$Definition());
13181 } 13249 }
13182 ConcreteMember.prototype.get$initDelegate = function() { 13250 ConcreteMember.prototype.get$initDelegate = function() {
13183 return this.baseMember.get$initDelegate(); 13251 var $0;
13252 return (($0 = this.baseMember.get$initDelegate()) && $0.is$Definition());
13184 } 13253 }
13185 ConcreteMember.prototype.set$initDelegate = function(ctor) { 13254 ConcreteMember.prototype.set$initDelegate = function(ctor) {
13186 this.baseMember.set$initDelegate(ctor); 13255 this.baseMember.set$initDelegate(ctor);
13187 } 13256 }
13188 ConcreteMember.prototype.resolveType = function(node, isRequired) { 13257 ConcreteMember.prototype.resolveType = function(node, isRequired) {
13189 var type = this.baseMember.resolveType(node, isRequired); 13258 var type = this.baseMember.resolveType(node, isRequired);
13190 return type.resolveTypeParams(this.declaringType); 13259 return type.resolveTypeParams(this.declaringType);
13191 } 13260 }
13192 ConcreteMember.prototype.override = function(other) { 13261 ConcreteMember.prototype.override = function(other) {
13193 return this.baseMember.override(other); 13262 return this.baseMember.override(other);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
13262 MethodMember.prototype.get$isNative = function() { 13331 MethodMember.prototype.get$isNative = function() {
13263 return (this.definition.body instanceof NativeStatement); 13332 return (this.definition.body instanceof NativeStatement);
13264 } 13333 }
13265 MethodMember.prototype.get$canGet = function() { 13334 MethodMember.prototype.get$canGet = function() {
13266 return false; 13335 return false;
13267 } 13336 }
13268 MethodMember.prototype.get$canSet = function() { 13337 MethodMember.prototype.get$canSet = function() {
13269 return false; 13338 return false;
13270 } 13339 }
13271 MethodMember.prototype.get$span = function() { 13340 MethodMember.prototype.get$span = function() {
13272 return $notnull_bool(this.definition == null) ? null : this.definition.span; 13341 var $0;
13342 return (($0 = $notnull_bool(this.definition == null) ? null : this.definition. span) && $0.is$SourceSpan());
13273 } 13343 }
13274 MethodMember.prototype.get$constructorName = function() { 13344 MethodMember.prototype.get$constructorName = function() {
13275 var $0; 13345 var $0;
13276 var returnType = (($0 = this.definition.returnType) && $0.is$NameTypeReference ()); 13346 var returnType = (($0 = this.definition.returnType) && $0.is$NameTypeReference ());
13277 if ($notnull_bool(returnType == null)) return ''; 13347 if ($notnull_bool(returnType == null)) return '';
13278 if ($notnull_bool(returnType.names != null)) { 13348 if ($notnull_bool(returnType.names != null)) {
13279 return returnType.names.$index(0).get$name(); 13349 return $assert_String(returnType.names.$index(0).get$name());
13280 } 13350 }
13281 else if ($notnull_bool(returnType.name != null)) { 13351 else if ($notnull_bool(returnType.name != null)) {
13282 return returnType.name.name; 13352 return returnType.name.name;
13283 } 13353 }
13284 world.internalError('no valid constructor name', this.definition.span); 13354 world.internalError('no valid constructor name', this.definition.span);
13285 } 13355 }
13286 MethodMember.prototype.get$functionType = function() { 13356 MethodMember.prototype.get$functionType = function() {
13287 if ($notnull_bool(this._functionType == null)) { 13357 if ($notnull_bool(this._functionType == null)) {
13288 this._functionType = this.get$library().getOrAddFunctionType(this.name, this .definition, this.declaringType); 13358 this._functionType = this.get$library().getOrAddFunctionType(this.name, this .definition, this.declaringType);
13289 if ($notnull_bool(this.parameters == null)) { 13359 if ($notnull_bool(this.parameters == null)) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
13329 } 13399 }
13330 return -1; 13400 return -1;
13331 } 13401 }
13332 MethodMember.prototype.get$prefersPropertySyntax = function() { 13402 MethodMember.prototype.get$prefersPropertySyntax = function() {
13333 return true; 13403 return true;
13334 } 13404 }
13335 MethodMember.prototype.get$requiresFieldSyntax = function() { 13405 MethodMember.prototype.get$requiresFieldSyntax = function() {
13336 return false; 13406 return false;
13337 } 13407 }
13338 MethodMember.prototype.provideFieldSyntax = function() { 13408 MethodMember.prototype.provideFieldSyntax = function() {
13339 return this._provideFieldSyntax = true; 13409 this._provideFieldSyntax = true;
13340 } 13410 }
13341 MethodMember.prototype.providePropertySyntax = function() { 13411 MethodMember.prototype.providePropertySyntax = function() {
13342 return this._providePropertySyntax = true; 13412 this._providePropertySyntax = true;
13343 } 13413 }
13344 MethodMember.prototype._set = function(context, Node, target, value, isDynamic) { 13414 MethodMember.prototype._set = function(context, Node, target, value, isDynamic) {
13345 world.error('can not set method', this.definition.span); 13415 world.error('can not set method', this.definition.span);
13346 } 13416 }
13347 MethodMember.prototype._get = function(context, node, target, isDynamic) { 13417 MethodMember.prototype._get = function(context, node, target, isDynamic) {
13348 this.declaringType.genMethod(this); 13418 this.declaringType.genMethod(this);
13349 this._provideOptionalParamInfo = true; 13419 this._provideOptionalParamInfo = true;
13350 if ($notnull_bool(this.isStatic)) { 13420 if ($notnull_bool(this.isStatic)) {
13351 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d eclaringType.get$jsname() + '.'); 13421 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d eclaringType.get$jsname() + '.');
13352 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname( ) + ''), node.span, false, true, false); 13422 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname( ) + ''), node.span, false, true, false);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
13430 var bareCount = args.get$bareCount(); 13500 var bareCount = args.get$bareCount();
13431 for (var i = 0; 13501 for (var i = 0;
13432 $notnull_bool(i < bareCount); i++) { 13502 $notnull_bool(i < bareCount); i++) {
13433 var arg = args.values.$index(i); 13503 var arg = args.values.$index(i);
13434 if ($notnull_bool(i >= this.parameters.length)) { 13504 if ($notnull_bool(i >= this.parameters.length)) {
13435 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false); 13505 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.len gth, false);
13436 return this._argError(context, node, target, args, $assert_String(msg)); 13506 return this._argError(context, node, target, args, $assert_String(msg));
13437 } 13507 }
13438 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $0.is $lang_Type()), node, isDynamic); 13508 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $0.is $lang_Type()), node, isDynamic);
13439 if ($notnull_bool(this.isConst && arg.get$isConst())) { 13509 if ($notnull_bool(this.isConst && arg.get$isConst())) {
13440 argsCode.add(arg.canonicalCode); 13510 argsCode.add(arg.get$canonicalCode());
13441 } 13511 }
13442 else { 13512 else {
13443 argsCode.add(arg.code); 13513 argsCode.add(arg.code);
13444 } 13514 }
13445 } 13515 }
13446 if ($notnull_bool(bareCount < this.parameters.length)) { 13516 if ($notnull_bool(bareCount < this.parameters.length)) {
13447 this.genParameterValues(); 13517 this.genParameterValues();
13448 var namedArgsUsed = 0; 13518 var namedArgsUsed = 0;
13449 for (var i = bareCount; 13519 for (var i = bareCount;
13450 $notnull_bool(i < this.parameters.length); i++) { 13520 $notnull_bool(i < this.parameters.length); i++) {
13451 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( ))); 13521 var arg = args.getValue($assert_String(this.parameters.$index(i).get$name( )));
13452 if ($notnull_bool(arg == null)) { 13522 if ($notnull_bool(arg == null)) {
13453 arg = this.parameters.$index(i).get$value(); 13523 arg = this.parameters.$index(i).get$value();
13454 } 13524 }
13455 else { 13525 else {
13456 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $ 0.is$lang_Type()), node, isDynamic); 13526 arg = arg.convertTo(context, (($0 = this.parameters.$index(i).type) && $ 0.is$lang_Type()), node, isDynamic);
13457 namedArgsUsed++; 13527 namedArgsUsed++;
13458 } 13528 }
13459 if ($notnull_bool(arg == null || !$notnull_bool(this.parameters.$index(i). get$isOptional()))) { 13529 if ($notnull_bool(arg == null || !$notnull_bool(this.parameters.$index(i). get$isOptional()))) {
13460 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + 1, true); 13530 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + 1, true);
13461 return this._argError(context, node, target, args, $assert_String(msg)); 13531 return this._argError(context, node, target, args, $assert_String(msg));
13462 } 13532 }
13463 else { 13533 else {
13464 argsCode.add($notnull_bool(this.isConst && arg.get$isConst()) ? arg.cano nicalCode : arg.code); 13534 argsCode.add($notnull_bool(this.isConst && arg.get$isConst()) ? arg.get$ canonicalCode() : arg.code);
13465 } 13535 }
13466 } 13536 }
13467 if ($notnull_bool(namedArgsUsed < args.get$nameCount())) { 13537 if ($notnull_bool(namedArgsUsed < args.get$nameCount())) {
13468 var seen = new HashSetImplementation$String(); 13538 var seen = new HashSetImplementation$String();
13469 for (var i = bareCount; 13539 for (var i = bareCount;
13470 $notnull_bool(i < args.get$length()); i++) { 13540 $notnull_bool(i < args.get$length()); i++) {
13471 var name = args.getName(i); 13541 var name = args.getName(i);
13472 if ($notnull_bool(seen.contains(name))) { 13542 if ($notnull_bool(seen.contains(name))) {
13473 return this._argError(context, node, target, args, ('duplicate argumen t "' + name + '"')); 13543 return this._argError(context, node, target, args, ('duplicate argumen t "' + name + '"'));
13474 } 13544 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
13578 } 13648 }
13579 this.generator._scope._vars.$setindex(name, value); 13649 this.generator._scope._vars.$setindex(name, value);
13580 } 13650 }
13581 var $list = this.definition.initializers; 13651 var $list = this.definition.initializers;
13582 for (var $i = 0;$i < $list.length; $i++) { 13652 for (var $i = 0;$i < $list.length; $i++) {
13583 var init = $list.$index($i); 13653 var init = $list.$index($i);
13584 if ($notnull_bool((init instanceof CallExpression))) { 13654 if ($notnull_bool((init instanceof CallExpression))) {
13585 var delegateArgs = this.generator._makeArgs((($0 = init.get$arguments()) && $0.is$List$ArgumentNode())); 13655 var delegateArgs = this.generator._makeArgs((($0 = init.get$arguments()) && $0.is$List$ArgumentNode()));
13586 var value = this.initDelegate.invoke(this.generator, node, target, deleg ateArgs, false); 13656 var value = this.initDelegate.invoke(this.generator, node, target, deleg ateArgs, false);
13587 if ($notnull_bool((init.target instanceof ThisExpression))) { 13657 if ($notnull_bool((init.target instanceof ThisExpression))) {
13588 return value; 13658 return (value && value.is$Value());
13589 } 13659 }
13590 else { 13660 else {
13591 if ($notnull_bool((value instanceof GlobalValue))) { 13661 if ($notnull_bool((value instanceof GlobalValue))) {
13592 value = value.exp; 13662 value = value.exp;
13593 } 13663 }
13594 var $list0 = value.fields.getKeys(); 13664 var $list0 = value.fields.getKeys();
13595 for (var $i0 = value.fields.getKeys().iterator(); $i0.hasNext(); ) { 13665 for (var $i0 = value.fields.getKeys().iterator(); $i0.hasNext(); ) {
13596 var fname = $i0.next(); 13666 var fname = $i0.next();
13597 fields.$setindex(fname, value.fields.$index(fname)); 13667 fields.$setindex(fname, value.fields.$index(fname));
13598 } 13668 }
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
13925 MemberSet.prototype.get$containsMethods = function() { 13995 MemberSet.prototype.get$containsMethods = function() {
13926 return this.members.some((function (m) { 13996 return this.members.some((function (m) {
13927 return (m instanceof MethodMember); 13997 return (m instanceof MethodMember);
13928 }) 13998 })
13929 ); 13999 );
13930 } 14000 }
13931 MemberSet.prototype.add = function(member) { 14001 MemberSet.prototype.add = function(member) {
13932 return this.members.add(member); 14002 return this.members.add(member);
13933 } 14003 }
13934 MemberSet.prototype.get$isStatic = function() { 14004 MemberSet.prototype.get$isStatic = function() {
13935 return this.members.length == 1 && this.members.$index(0).get$isStatic(); 14005 return $assert_bool(this.members.length == 1 && this.members.$index(0).get$isS tatic());
13936 } 14006 }
13937 MemberSet.prototype.canInvoke = function(context, args) { 14007 MemberSet.prototype.canInvoke = function(context, args) {
13938 return this.members.some((function (m) { 14008 return this.members.some((function (m) {
13939 return m.canInvoke(context, args); 14009 return m.canInvoke(context, args);
13940 }) 14010 })
13941 ); 14011 );
13942 } 14012 }
13943 MemberSet.prototype._makeError = function(node, target, action) { 14013 MemberSet.prototype._makeError = function(node, target, action) {
13944 if ($notnull_bool(!$notnull_bool(target.type.get$isVar()))) { 14014 if ($notnull_bool(!$notnull_bool(target.type.get$isVar()))) {
13945 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span); 14015 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
14099 return m.canInvoke(context, args); 14169 return m.canInvoke(context, args);
14100 }) 14170 })
14101 ); 14171 );
14102 var returnType = reduce(map((targets && targets.is$Iterable()), (function (t ) { 14172 var returnType = reduce(map((targets && targets.is$Iterable()), (function (t ) {
14103 return t.get$returnType(); 14173 return t.get$returnType();
14104 }) 14174 })
14105 ), lang_Type.union); 14175 ), lang_Type.union);
14106 stub = new VarMethodSet($assert_String(stubName), targets, args, returnType) ; 14176 stub = new VarMethodSet($assert_String(stubName), targets, args, returnType) ;
14107 world.objectType.varStubs.$setindex(stubName, stub); 14177 world.objectType.varStubs.$setindex(stubName, stub);
14108 } 14178 }
14109 return stub; 14179 return (stub && stub.is$VarMember());
14110 } 14180 }
14111 MemberSet.prototype._get$3 = function($0, $1, $2) { 14181 MemberSet.prototype._get$3 = function($0, $1, $2) {
14112 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); 14182 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
14113 } 14183 }
14114 ; 14184 ;
14115 MemberSet.prototype._set$4 = function($0, $1, $2, $3) { 14185 MemberSet.prototype._set$4 = function($0, $1, $2, $3) {
14116 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); 14186 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false);
14117 } 14187 }
14118 ; 14188 ;
14119 MemberSet.prototype.invoke$4 = function($0, $1, $2, $3) { 14189 MemberSet.prototype.invoke$4 = function($0, $1, $2, $3) {
14120 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); 14190 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false);
14121 } 14191 }
14122 ; 14192 ;
14123 // ********** Code for FactoryMap ************** 14193 // ********** Code for FactoryMap **************
14124 function FactoryMap() { 14194 function FactoryMap() {
14125 this.factories = $map([]); 14195 this.factories = $map([]);
14126 // Initializers done 14196 // Initializers done
14127 } 14197 }
14128 FactoryMap.prototype.getFactoriesFor = function(typeName) { 14198 FactoryMap.prototype.getFactoriesFor = function(typeName) {
14129 var ret = this.factories.$index(typeName); 14199 var ret = this.factories.$index(typeName);
14130 if ($notnull_bool(ret == null)) { 14200 if ($notnull_bool(ret == null)) {
14131 ret = $map([]); 14201 ret = $map([]);
14132 this.factories.$setindex(typeName, ret); 14202 this.factories.$setindex(typeName, ret);
14133 } 14203 }
14134 return ret; 14204 return (ret && ret.is$Map$String$Member());
14135 } 14205 }
14136 FactoryMap.prototype.addFactory = function(typeName, name, member) { 14206 FactoryMap.prototype.addFactory = function(typeName, name, member) {
14137 this.getFactoriesFor(typeName).$setindex(name, member); 14207 this.getFactoriesFor(typeName).$setindex(name, member);
14138 } 14208 }
14139 FactoryMap.prototype.getFactory = function(typeName, name) { 14209 FactoryMap.prototype.getFactory = function(typeName, name) {
14140 return this.getFactoriesFor(typeName).$index(name); 14210 var $0;
14211 return (($0 = this.getFactoriesFor(typeName).$index(name)) && $0.is$Member());
14141 } 14212 }
14142 FactoryMap.prototype.forEach = function(f) { 14213 FactoryMap.prototype.forEach = function(f) {
14143 this.factories.forEach((function (_, constructors) { 14214 this.factories.forEach((function (_, constructors) {
14144 constructors.forEach((function (_, member) { 14215 constructors.forEach((function (_, member) {
14145 f(member); 14216 f(member);
14146 }) 14217 })
14147 ); 14218 );
14148 }) 14219 })
14149 ); 14220 );
14150 } 14221 }
(...skipping 11 matching lines...) Expand all
14162 lang_Token.prototype.toString = function() { 14233 lang_Token.prototype.toString = function() {
14163 var kindText = TokenKind.kindToString(this.kind); 14234 var kindText = TokenKind.kindToString(this.kind);
14164 var actualText = this.get$text(); 14235 var actualText = this.get$text();
14165 if ($notnull_bool($ne(kindText, actualText))) { 14236 if ($notnull_bool($ne(kindText, actualText))) {
14166 if ($notnull_bool(actualText.length > 10)) { 14237 if ($notnull_bool(actualText.length > 10)) {
14167 actualText = actualText.substring(0, 8) + '...'; 14238 actualText = actualText.substring(0, 8) + '...';
14168 } 14239 }
14169 return ('' + kindText + '(' + actualText + ')'); 14240 return ('' + kindText + '(' + actualText + ')');
14170 } 14241 }
14171 else { 14242 else {
14172 return kindText; 14243 return $assert_String(kindText);
14173 } 14244 }
14174 } 14245 }
14175 lang_Token.prototype.get$span = function() { 14246 lang_Token.prototype.get$span = function() {
14176 return new SourceSpan(this.source, this.start, this.end); 14247 return new SourceSpan(this.source, this.start, this.end);
14177 } 14248 }
14178 // ********** Code for SourceFile ************** 14249 // ********** Code for SourceFile **************
14179 function SourceFile(filename, _text) { 14250 function SourceFile(filename, _text) {
14180 this.filename = filename; 14251 this.filename = filename;
14181 this._text = _text; 14252 this._text = _text;
14182 // Initializers done 14253 // Initializers done
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
14226 buf.add(textLine); 14297 buf.add(textLine);
14227 var i = 0; 14298 var i = 0;
14228 for (; $notnull_bool(i < $assert_num(column)); i++) { 14299 for (; $notnull_bool(i < $assert_num(column)); i++) {
14229 buf.add(' '); 14300 buf.add(' ');
14230 } 14301 }
14231 var toColumn = Math.min($assert_num(column + (end - start)), textLine.length ); 14302 var toColumn = Math.min($assert_num(column + (end - start)), textLine.length );
14232 for (; $notnull_bool(i < toColumn); i++) { 14303 for (; $notnull_bool(i < toColumn); i++) {
14233 buf.add('^'); 14304 buf.add('^');
14234 } 14305 }
14235 } 14306 }
14236 return buf.toString(); 14307 return $assert_String(buf.toString());
14237 } 14308 }
14238 SourceFile.prototype.compareTo = function(other) { 14309 SourceFile.prototype.compareTo = function(other) {
14239 if ($notnull_bool(this.orderInLibrary != null && other.orderInLibrary != null) ) { 14310 if ($notnull_bool(this.orderInLibrary != null && other.orderInLibrary != null) ) {
14240 return this.orderInLibrary - other.orderInLibrary; 14311 return this.orderInLibrary - other.orderInLibrary;
14241 } 14312 }
14242 else { 14313 else {
14243 return this.filename.compareTo(other.filename); 14314 return this.filename.compareTo(other.filename);
14244 } 14315 }
14245 } 14316 }
14246 // ********** Code for SourceSpan ************** 14317 // ********** Code for SourceSpan **************
(...skipping 23 matching lines...) Expand all
14270 return this.file.compareTo(other.file); 14341 return this.file.compareTo(other.file);
14271 } 14342 }
14272 // ********** Code for InterpStack ************** 14343 // ********** Code for InterpStack **************
14273 function InterpStack(previous, quote, isMultiline) { 14344 function InterpStack(previous, quote, isMultiline) {
14274 this.previous = previous; 14345 this.previous = previous;
14275 this.quote = quote; 14346 this.quote = quote;
14276 this.isMultiline = isMultiline; 14347 this.isMultiline = isMultiline;
14277 this.depth = -1; 14348 this.depth = -1;
14278 // Initializers done 14349 // Initializers done
14279 } 14350 }
14351 InterpStack.prototype.is$InterpStack = function(){return this;};
14280 InterpStack.prototype.pop = function() { 14352 InterpStack.prototype.pop = function() {
14281 return this.previous; 14353 return this.previous;
14282 } 14354 }
14283 InterpStack.push = function(stack, quote, isMultiline) { 14355 InterpStack.push = function(stack, quote, isMultiline) {
14284 var newStack = new InterpStack(stack, quote, isMultiline); 14356 var newStack = new InterpStack(stack, quote, isMultiline);
14285 if ($notnull_bool(stack != null)) newStack.previous = stack; 14357 if ($notnull_bool(stack != null)) newStack.previous = stack;
14286 return newStack; 14358 return (newStack && newStack.is$InterpStack());
14287 } 14359 }
14288 // ********** Code for TokenizerBase ************** 14360 // ********** Code for TokenizerBase **************
14289 function TokenizerBase(_source, _skipWhitespace, _index) { 14361 function TokenizerBase(_source, _skipWhitespace, _index) {
14290 this._source = _source; 14362 this._source = _source;
14291 this._skipWhitespace = _skipWhitespace; 14363 this._skipWhitespace = _skipWhitespace;
14292 this._lang_index = _index; 14364 this._lang_index = _index;
14293 // Initializers done 14365 // Initializers done
14294 this._text = this._source.get$text(); 14366 this._text = this._source.get$text();
14295 } 14367 }
14296 $inherits(TokenizerBase, TokenizerHelpers); 14368 $inherits(TokenizerBase, TokenizerHelpers);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
14548 return this._errorToken(); 14620 return this._errorToken();
14549 } 14621 }
14550 } 14622 }
14551 } 14623 }
14552 } 14624 }
14553 TokenizerBase.prototype.eatEscapeSequence = function() { 14625 TokenizerBase.prototype.eatEscapeSequence = function() {
14554 var hex; 14626 var hex;
14555 switch (this._nextChar()) { 14627 switch (this._nextChar()) {
14556 case 120: 14628 case 120:
14557 14629
14558 return this.maybeEatHexDigit() && this.maybeEatHexDigit(); 14630 return $assert_bool(this.maybeEatHexDigit() && this.maybeEatHexDigit());
14559 14631
14560 case 117: 14632 case 117:
14561 14633
14562 if ($notnull_bool(this._maybeEatChar(123))) { 14634 if ($notnull_bool(this._maybeEatChar(123))) {
14563 var start = this._lang_index; 14635 var start = this._lang_index;
14564 this.eatHexDigits(); 14636 this.eatHexDigits();
14565 var chars = this._lang_index - start; 14637 var chars = this._lang_index - start;
14566 if ($notnull_bool(chars > 0 && chars <= 6 && this._maybeEatChar(125))) { 14638 if ($notnull_bool(chars > 0 && chars <= 6 && this._maybeEatChar(125))) {
14567 hex = this._text.substring(start, start + chars); 14639 hex = this._text.substring(start, start + chars);
14568 break; 14640 break;
(...skipping 11 matching lines...) Expand all
14580 return false; 14652 return false;
14581 } 14653 }
14582 } 14654 }
14583 14655
14584 default: 14656 default:
14585 14657
14586 return true; 14658 return true;
14587 14659
14588 } 14660 }
14589 var n = lang_Parser.parseHex(hex); 14661 var n = lang_Parser.parseHex(hex);
14590 return n < 0xD800 || n > 0xDFFF && n <= 0x10FFFF; 14662 return $assert_bool(n < 0xD800 || n > 0xDFFF && n <= 0x10FFFF);
14591 } 14663 }
14592 TokenizerBase.prototype.finishDot = function() { 14664 TokenizerBase.prototype.finishDot = function() {
14593 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) { 14665 if ($notnull_bool(TokenizerHelpers.isDigit(this._peekChar()))) {
14594 this.eatDigits(); 14666 this.eatDigits();
14595 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/); 14667 return this.finishNumberExtra(62/*TokenKind.DOUBLE*/);
14596 } 14668 }
14597 else { 14669 else {
14598 return this._finishToken(14/*TokenKind.DOT*/); 14670 return this._finishToken(14/*TokenKind.DOT*/);
14599 } 14671 }
14600 } 14672 }
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
15139 15211
15140 default: 15212 default:
15141 15213
15142 return 70/*TokenKind.IDENTIFIER*/; 15214 return 70/*TokenKind.IDENTIFIER*/;
15143 15215
15144 } 15216 }
15145 } 15217 }
15146 // ********** Code for TokenizerHelpers ************** 15218 // ********** Code for TokenizerHelpers **************
15147 function TokenizerHelpers() {} 15219 function TokenizerHelpers() {}
15148 TokenizerHelpers.isIdentifierStart = function(c) { 15220 TokenizerHelpers.isIdentifierStart = function(c) {
15149 return ((c >= 97 && c <= 122) || (c >= 65 && c <= 90) || c == 95); 15221 return $assert_bool(((c >= 97 && c <= 122) || (c >= 65 && c <= 90) || c == 95) );
15150 } 15222 }
15151 TokenizerHelpers.isDigit = function(c) { 15223 TokenizerHelpers.isDigit = function(c) {
15152 return (c >= 48 && c <= 57); 15224 return $assert_bool((c >= 48 && c <= 57));
15153 } 15225 }
15154 TokenizerHelpers.isHexDigit = function(c) { 15226 TokenizerHelpers.isHexDigit = function(c) {
15155 return (TokenizerHelpers.isDigit(c) || (c >= 97 && c <= 102) || (c >= 65 && c <= 70)); 15227 return $assert_bool((TokenizerHelpers.isDigit(c) || (c >= 97 && c <= 102) || ( c >= 65 && c <= 70)));
15156 } 15228 }
15157 TokenizerHelpers.isWhitespace = function(c) { 15229 TokenizerHelpers.isWhitespace = function(c) {
15158 return (c == 32 || c == 9 || c == 10 || c == 13); 15230 return $assert_bool((c == 32 || c == 9 || c == 10 || c == 13));
15159 } 15231 }
15160 TokenizerHelpers.isIdentifierPart = function(c) { 15232 TokenizerHelpers.isIdentifierPart = function(c) {
15161 return (TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers.isDigit(c)); 15233 return $assert_bool((TokenizerHelpers.isIdentifierStart(c) || TokenizerHelpers .isDigit(c)));
15162 } 15234 }
15163 // ********** Code for TokenKind ************** 15235 // ********** Code for TokenKind **************
15164 function TokenKind() {} 15236 function TokenKind() {}
15165 TokenKind.kindToString = function(kind) { 15237 TokenKind.kindToString = function(kind) {
15166 switch (kind) { 15238 switch (kind) {
15167 case 1/*TokenKind.END_OF_FILE*/: 15239 case 1/*TokenKind.END_OF_FILE*/:
15168 15240
15169 return "end of file"; 15241 return "end of file";
15170 15242
15171 case 2/*TokenKind.LPAREN*/: 15243 case 2/*TokenKind.LPAREN*/:
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
15620 15692
15621 return "keyword 'while'"; 15693 return "keyword 'while'";
15622 15694
15623 default: 15695 default:
15624 15696
15625 return "TokenKind(" + kind.toString() + ")"; 15697 return "TokenKind(" + kind.toString() + ")";
15626 15698
15627 } 15699 }
15628 } 15700 }
15629 TokenKind.isIdentifier = function(kind) { 15701 TokenKind.isIdentifier = function(kind) {
15630 return kind >= 70/*TokenKind.IDENTIFIER*/ && kind < 88/*TokenKind.BREAK*/; 15702 return $assert_bool(kind >= 70/*TokenKind.IDENTIFIER*/ && kind < 88/*TokenKind .BREAK*/);
15631 } 15703 }
15632 TokenKind.infixPrecedence = function(kind) { 15704 TokenKind.infixPrecedence = function(kind) {
15633 switch (kind) { 15705 switch (kind) {
15634 case 20/*TokenKind.ASSIGN*/: 15706 case 20/*TokenKind.ASSIGN*/:
15635 15707
15636 return 2; 15708 return 2;
15637 15709
15638 case 21/*TokenKind.ASSIGN_OR*/: 15710 case 21/*TokenKind.ASSIGN_OR*/:
15639 15711
15640 return 2; 15712 return 2;
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
16056 } 16128 }
16057 lang_Parser.prototype.compilationUnit = function() { 16129 lang_Parser.prototype.compilationUnit = function() {
16058 var ret = []; 16130 var ret = [];
16059 this._maybeEat(13/*TokenKind.HASHBANG*/); 16131 this._maybeEat(13/*TokenKind.HASHBANG*/);
16060 while ($notnull_bool(this._peekKind(12/*TokenKind.HASH*/))) { 16132 while ($notnull_bool(this._peekKind(12/*TokenKind.HASH*/))) {
16061 ret.add(this.directive()); 16133 ret.add(this.directive());
16062 } 16134 }
16063 while ($notnull_bool(!$notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/) ))) { 16135 while ($notnull_bool(!$notnull_bool(this._maybeEat(1/*TokenKind.END_OF_FILE*/) ))) {
16064 ret.add(this.topLevelDefinition()); 16136 ret.add(this.topLevelDefinition());
16065 } 16137 }
16066 return ret; 16138 return (ret && ret.is$List$Definition());
16067 } 16139 }
16068 lang_Parser.prototype.directive = function() { 16140 lang_Parser.prototype.directive = function() {
16069 var start = this._peekToken.start; 16141 var start = this._peekToken.start;
16070 this._eat(12/*TokenKind.HASH*/); 16142 this._eat(12/*TokenKind.HASH*/);
16071 var name = this.identifier(); 16143 var name = this.identifier();
16072 var args = this.arguments(); 16144 var args = this.arguments();
16073 this._eatSemicolon(); 16145 this._eatSemicolon();
16074 return new DirectiveDefinition(name, args, this._makeSpan(start)); 16146 return new DirectiveDefinition(name, args, this._makeSpan(start));
16075 } 16147 }
16076 lang_Parser.prototype.topLevelDefinition = function() { 16148 lang_Parser.prototype.topLevelDefinition = function() {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
16271 name = new lang_Identifier('', names.$index(0).get$span()); 16343 name = new lang_Identifier('', names.$index(0).get$span());
16272 } 16344 }
16273 if ($notnull_bool(names.length > 1)) { 16345 if ($notnull_bool(names.length > 1)) {
16274 this._lang_error('unsupported qualified name for factory', names.$index(0).g et$span()); 16346 this._lang_error('unsupported qualified name for factory', names.$index(0).g et$span());
16275 } 16347 }
16276 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get $span()); 16348 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get $span());
16277 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); 16349 var di = new DeclaredIdentifier(type, name, this._makeSpan(start));
16278 return this.finishDefinition(start, [factoryToken], di); 16350 return this.finishDefinition(start, [factoryToken], di);
16279 } 16351 }
16280 lang_Parser.prototype.statement = function() { 16352 lang_Parser.prototype.statement = function() {
16353 var $0;
16281 switch (this._peek()) { 16354 switch (this._peek()) {
16282 case 88/*TokenKind.BREAK*/: 16355 case 88/*TokenKind.BREAK*/:
16283 16356
16284 return this.breakStatement(); 16357 return (($0 = this.breakStatement()) && $0.is$lang_Statement());
16285 16358
16286 case 92/*TokenKind.CONTINUE*/: 16359 case 92/*TokenKind.CONTINUE*/:
16287 16360
16288 return this.continueStatement(); 16361 return (($0 = this.continueStatement()) && $0.is$lang_Statement());
16289 16362
16290 case 105/*TokenKind.RETURN*/: 16363 case 105/*TokenKind.RETURN*/:
16291 16364
16292 return this.returnStatement(); 16365 return (($0 = this.returnStatement()) && $0.is$lang_Statement());
16293 16366
16294 case 109/*TokenKind.THROW*/: 16367 case 109/*TokenKind.THROW*/:
16295 16368
16296 return this.throwStatement(); 16369 return (($0 = this.throwStatement()) && $0.is$lang_Statement());
16297 16370
16298 case 72/*TokenKind.ASSERT*/: 16371 case 72/*TokenKind.ASSERT*/:
16299 16372
16300 return this.assertStatement(); 16373 return (($0 = this.assertStatement()) && $0.is$lang_Statement());
16301 16374
16302 case 114/*TokenKind.WHILE*/: 16375 case 114/*TokenKind.WHILE*/:
16303 16376
16304 return this.whileStatement(); 16377 return this.whileStatement();
16305 16378
16306 case 94/*TokenKind.DO*/: 16379 case 94/*TokenKind.DO*/:
16307 16380
16308 return this.doStatement(); 16381 return this.doStatement();
16309 16382
16310 case 99/*TokenKind.FOR*/: 16383 case 99/*TokenKind.FOR*/:
16311 16384
16312 return this.forStatement(); 16385 return (($0 = this.forStatement()) && $0.is$lang_Statement());
16313 16386
16314 case 100/*TokenKind.IF*/: 16387 case 100/*TokenKind.IF*/:
16315 16388
16316 return this.ifStatement(); 16389 return this.ifStatement();
16317 16390
16318 case 107/*TokenKind.SWITCH*/: 16391 case 107/*TokenKind.SWITCH*/:
16319 16392
16320 return this.switchStatement(); 16393 return (($0 = this.switchStatement()) && $0.is$lang_Statement());
16321 16394
16322 case 111/*TokenKind.TRY*/: 16395 case 111/*TokenKind.TRY*/:
16323 16396
16324 return this.tryStatement(); 16397 return (($0 = this.tryStatement()) && $0.is$lang_Statement());
16325 16398
16326 case 6/*TokenKind.LBRACE*/: 16399 case 6/*TokenKind.LBRACE*/:
16327 16400
16328 return this.block(); 16401 return this.block();
16329 16402
16330 case 10/*TokenKind.SEMICOLON*/: 16403 case 10/*TokenKind.SEMICOLON*/:
16331 16404
16332 return this.emptyStatement(); 16405 return this.emptyStatement();
16333 16406
16334 case 97/*TokenKind.FINAL*/: 16407 case 97/*TokenKind.FINAL*/:
16335 16408
16336 return this.declaration(false); 16409 return (($0 = this.declaration(false)) && $0.is$lang_Statement());
16337 16410
16338 case 112/*TokenKind.VAR*/: 16411 case 112/*TokenKind.VAR*/:
16339 16412
16340 return this.declaration(false); 16413 return (($0 = this.declaration(false)) && $0.is$lang_Statement());
16341 16414
16342 default: 16415 default:
16343 16416
16344 return this.finishExpressionAsStatement(this.expression()); 16417 return (($0 = this.finishExpressionAsStatement(this.expression())) && $0.i s$lang_Statement());
16345 16418
16346 } 16419 }
16347 } 16420 }
16348 lang_Parser.prototype.finishExpressionAsStatement = function(expr) { 16421 lang_Parser.prototype.finishExpressionAsStatement = function(expr) {
16349 var $0; 16422 var $0;
16350 var start = expr.get$span().start; 16423 var start = expr.get$span().start;
16351 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) { 16424 if ($notnull_bool(this._maybeEat(8/*TokenKind.COLON*/))) {
16352 var label = this._makeLabel(expr); 16425 var label = this._makeLabel(expr);
16353 return new LabeledStatement(label, this.statement(), this._makeSpan(start)); 16426 return new LabeledStatement(label, this.statement(), this._makeSpan(start));
16354 } 16427 }
(...skipping 28 matching lines...) Expand all
16383 } 16456 }
16384 else { 16457 else {
16385 this._eatSemicolon(); 16458 this._eatSemicolon();
16386 return new lang_ExpressionStatement(expr, this._makeSpan(expr.get$span().sta rt)); 16459 return new lang_ExpressionStatement(expr, this._makeSpan(expr.get$span().sta rt));
16387 } 16460 }
16388 } 16461 }
16389 lang_Parser.prototype.testCondition = function() { 16462 lang_Parser.prototype.testCondition = function() {
16390 this._eat(2/*TokenKind.LPAREN*/); 16463 this._eat(2/*TokenKind.LPAREN*/);
16391 var ret = this.expression(); 16464 var ret = this.expression();
16392 this._eat(3/*TokenKind.RPAREN*/); 16465 this._eat(3/*TokenKind.RPAREN*/);
16393 return ret; 16466 return (ret && ret.is$lang_Expression());
16394 } 16467 }
16395 lang_Parser.prototype.block = function() { 16468 lang_Parser.prototype.block = function() {
16396 var start = this._peekToken.start; 16469 var start = this._peekToken.start;
16397 this._eat(6/*TokenKind.LBRACE*/); 16470 this._eat(6/*TokenKind.LBRACE*/);
16398 var stmts = []; 16471 var stmts = [];
16399 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/)))) { 16472 while ($notnull_bool(!$notnull_bool(this._maybeEat(7/*TokenKind.RBRACE*/)))) {
16400 if ($notnull_bool(this.isPrematureEndOfFile())) break; 16473 if ($notnull_bool(this.isPrematureEndOfFile())) break;
16401 stmts.add(this.statement()); 16474 stmts.add(this.statement());
16402 } 16475 }
16403 return new BlockStatement(stmts, this._makeSpan(start)); 16476 return new BlockStatement(stmts, this._makeSpan(start));
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
17112 } 17185 }
17113 } 17186 }
17114 lang_Parser.parseHex = function(hex) { 17187 lang_Parser.parseHex = function(hex) {
17115 var result = 0; 17188 var result = 0;
17116 for (var i = 0; 17189 for (var i = 0;
17117 $notnull_bool(i < hex.length); i++) { 17190 $notnull_bool(i < hex.length); i++) {
17118 var digit = lang_Parser._hexDigit(hex.charCodeAt(i)); 17191 var digit = lang_Parser._hexDigit(hex.charCodeAt(i));
17119 $assert($ne(digit, -1), "digit != -1", "parser.dart", 1257, 14); 17192 $assert($ne(digit, -1), "digit != -1", "parser.dart", 1257, 14);
17120 result = (result << 4) + $assert_num(digit); 17193 result = (result << 4) + $assert_num(digit);
17121 } 17194 }
17122 return result; 17195 return $assert_num(result);
17123 } 17196 }
17124 lang_Parser.prototype.finishNewExpression = function(start, isConst) { 17197 lang_Parser.prototype.finishNewExpression = function(start, isConst) {
17125 var type = this.type(0); 17198 var type = this.type(0);
17126 var name = null; 17199 var name = null;
17127 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) { 17200 if ($notnull_bool(this._maybeEat(14/*TokenKind.DOT*/))) {
17128 name = this.identifier(); 17201 name = this.identifier();
17129 } 17202 }
17130 var args = this.arguments(); 17203 var args = this.arguments();
17131 return new lang_NewExpression(isConst, type, name, args, this._makeSpan(start) ); 17204 return new lang_NewExpression(isConst, type, name, args, this._makeSpan(start) );
17132 } 17205 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
17501 return null; 17574 return null;
17502 } 17575 }
17503 } 17576 }
17504 // ********** Code for IncompleteSourceException ************** 17577 // ********** Code for IncompleteSourceException **************
17505 function IncompleteSourceException(token) { 17578 function IncompleteSourceException(token) {
17506 this.token = token; 17579 this.token = token;
17507 // Initializers done 17580 // Initializers done
17508 } 17581 }
17509 IncompleteSourceException.prototype.toString = function() { 17582 IncompleteSourceException.prototype.toString = function() {
17510 if ($notnull_bool(this.token.get$span() == null)) return ('Unexpected ' + this .token + ''); 17583 if ($notnull_bool(this.token.get$span() == null)) return ('Unexpected ' + this .token + '');
17511 return this.token.get$span().toMessageString(('Unexpected ' + this.token + '') ); 17584 return $assert_String(this.token.get$span().toMessageString(('Unexpected ' + t his.token + '')));
17512 } 17585 }
17513 // ********** Code for lang_Node ************** 17586 // ********** Code for lang_Node **************
17514 function lang_Node(span) { 17587 function lang_Node(span) {
17515 this.span = span; 17588 this.span = span;
17516 // Initializers done 17589 // Initializers done
17517 } 17590 }
17518 lang_Node.prototype.is$lang_Node = function(){return this;}; 17591 lang_Node.prototype.is$lang_Node = function(){return this;};
17519 lang_Node.prototype.get$span = function() { return this.span; }; 17592 lang_Node.prototype.get$span = function() { return this.span; };
17520 lang_Node.prototype.set$span = function(value) { return this.span = value; }; 17593 lang_Node.prototype.set$span = function(value) { return this.span = value; };
17521 // ********** Code for Definition ************** 17594 // ********** Code for Definition **************
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
18207 this.isTested = false; 18280 this.isTested = false;
18208 // Initializers done 18281 // Initializers done
18209 } 18282 }
18210 lang_Type.prototype.is$lang_Type = function(){return this;}; 18283 lang_Type.prototype.is$lang_Type = function(){return this;};
18211 lang_Type.prototype.is$Named = function(){return this;}; 18284 lang_Type.prototype.is$Named = function(){return this;};
18212 lang_Type.prototype.get$name = function() { return this.name; }; 18285 lang_Type.prototype.get$name = function() { return this.name; };
18213 lang_Type.prototype.markUsed = function() { 18286 lang_Type.prototype.markUsed = function() {
18214 18287
18215 } 18288 }
18216 lang_Type.prototype.get$typeMember = function() { 18289 lang_Type.prototype.get$typeMember = function() {
18290 var $0;
18217 if ($notnull_bool(this._typeMember == null)) { 18291 if ($notnull_bool(this._typeMember == null)) {
18218 this._typeMember = new TypeMember((this && this.is$DefinedType())); 18292 this._typeMember = new TypeMember((this && this.is$DefinedType()));
18219 } 18293 }
18220 return this._typeMember; 18294 return (($0 = this._typeMember) && $0.is$TypeMember());
18221 } 18295 }
18222 lang_Type.prototype.getMember = function(name) { 18296 lang_Type.prototype.getMember = function(name) {
18223 return null; 18297 return null;
18224 } 18298 }
18225 lang_Type.prototype.get$isVar = function() { 18299 lang_Type.prototype.get$isVar = function() {
18226 return false; 18300 return false;
18227 } 18301 }
18228 lang_Type.prototype.get$isTop = function() { 18302 lang_Type.prototype.get$isTop = function() {
18229 return false; 18303 return false;
18230 } 18304 }
(...skipping 12 matching lines...) Expand all
18243 lang_Type.prototype.get$isList = function() { 18317 lang_Type.prototype.get$isList = function() {
18244 return false; 18318 return false;
18245 } 18319 }
18246 lang_Type.prototype.get$isNum = function() { 18320 lang_Type.prototype.get$isNum = function() {
18247 return false; 18321 return false;
18248 } 18322 }
18249 lang_Type.prototype.get$isVoid = function() { 18323 lang_Type.prototype.get$isVoid = function() {
18250 return false; 18324 return false;
18251 } 18325 }
18252 lang_Type.prototype.get$isVarOrFunction = function() { 18326 lang_Type.prototype.get$isVarOrFunction = function() {
18253 return this.get$isVar() || this.get$isFunction(); 18327 return $assert_bool(this.get$isVar() || this.get$isFunction());
18254 } 18328 }
18255 lang_Type.prototype.getCallMethod = function() { 18329 lang_Type.prototype.getCallMethod = function() {
18256 return null; 18330 return null;
18257 } 18331 }
18258 lang_Type.prototype.get$isClosed = function() { 18332 lang_Type.prototype.get$isClosed = function() {
18259 return this.get$isString() || this.get$isBool() || this.get$isNum() || this.ge t$isFunction() || this.get$isVar(); 18333 return $assert_bool(this.get$isString() || this.get$isBool() || this.get$isNum () || this.get$isFunction() || this.get$isVar());
18260 } 18334 }
18261 lang_Type.prototype.get$isUsed = function() { 18335 lang_Type.prototype.get$isUsed = function() {
18262 return false; 18336 return false;
18263 } 18337 }
18264 lang_Type.prototype.get$isGeneric = function() { 18338 lang_Type.prototype.get$isGeneric = function() {
18265 return false; 18339 return false;
18266 } 18340 }
18267 lang_Type.prototype.get$isNativeType = function() { 18341 lang_Type.prototype.get$isNativeType = function() {
18268 return false; 18342 return false;
18269 } 18343 }
(...skipping 18 matching lines...) Expand all
18288 lang_Type.prototype.get$definition = function() { 18362 lang_Type.prototype.get$definition = function() {
18289 return null; 18363 return null;
18290 } 18364 }
18291 lang_Type.prototype.get$factories = function() { 18365 lang_Type.prototype.get$factories = function() {
18292 return null; 18366 return null;
18293 } 18367 }
18294 lang_Type.prototype.get$typeArgsInOrder = function() { 18368 lang_Type.prototype.get$typeArgsInOrder = function() {
18295 return null; 18369 return null;
18296 } 18370 }
18297 lang_Type.prototype.get$genericType = function() { 18371 lang_Type.prototype.get$genericType = function() {
18298 return this; 18372 return (this && this.is$DefinedType());
18299 } 18373 }
18300 lang_Type.prototype.get$interfaces = function() { 18374 lang_Type.prototype.get$interfaces = function() {
18301 return null; 18375 return null;
18302 } 18376 }
18303 lang_Type.prototype.get$parent = function() { 18377 lang_Type.prototype.get$parent = function() {
18304 return null; 18378 return null;
18305 } 18379 }
18306 lang_Type.prototype.getAllMembers = function() { 18380 lang_Type.prototype.getAllMembers = function() {
18307 return $map([]); 18381 return $map([]);
18308 } 18382 }
(...skipping 23 matching lines...) Expand all
18332 } 18406 }
18333 return false; 18407 return false;
18334 } 18408 }
18335 lang_Type.union = function(x, y) { 18409 lang_Type.union = function(x, y) {
18336 if ($notnull_bool($eq(x, y))) return x; 18410 if ($notnull_bool($eq(x, y))) return x;
18337 if ($notnull_bool(x.get$isNum() && y.get$isNum())) return world.numType; 18411 if ($notnull_bool(x.get$isNum() && y.get$isNum())) return world.numType;
18338 if ($notnull_bool(x.get$isString() && y.get$isString())) return world.stringTy pe; 18412 if ($notnull_bool(x.get$isString() && y.get$isString())) return world.stringTy pe;
18339 return world.varType; 18413 return world.varType;
18340 } 18414 }
18341 lang_Type.prototype.isAssignable = function(other) { 18415 lang_Type.prototype.isAssignable = function(other) {
18342 return this.isSubtypeOf(other) || other.isSubtypeOf(this); 18416 return $assert_bool(this.isSubtypeOf(other) || other.isSubtypeOf(this));
18343 } 18417 }
18344 lang_Type.prototype._isDirectSupertypeOf = function(other) { 18418 lang_Type.prototype._isDirectSupertypeOf = function(other) {
18345 var $this = this; // closure support 18419 var $this = this; // closure support
18346 if ($notnull_bool(other.get$isClass())) { 18420 if ($notnull_bool(other.get$isClass())) {
18347 return $eq(other.get$parent(), this) || this.get$isObject() && other.get$par ent() == null; 18421 return $assert_bool($eq(other.get$parent(), this) || this.get$isObject() && other.get$parent() == null);
18348 } 18422 }
18349 else { 18423 else {
18350 if ($notnull_bool(other.get$interfaces() == null || other.get$interfaces().i sEmpty())) { 18424 if ($notnull_bool(other.get$interfaces() == null || other.get$interfaces().i sEmpty())) {
18351 return this.get$isObject(); 18425 return this.get$isObject();
18352 } 18426 }
18353 else { 18427 else {
18354 return other.get$interfaces().some((function (i) { 18428 return other.get$interfaces().some((function (i) {
18355 return $eq(i, $this); 18429 return $eq(i, $this);
18356 }) 18430 })
18357 ); 18431 );
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
18418 ParameterType.prototype.get$isClass = function() { 18492 ParameterType.prototype.get$isClass = function() {
18419 return false; 18493 return false;
18420 } 18494 }
18421 ParameterType.prototype.get$library = function() { 18495 ParameterType.prototype.get$library = function() {
18422 return null; 18496 return null;
18423 } 18497 }
18424 ParameterType.prototype.get$span = function() { 18498 ParameterType.prototype.get$span = function() {
18425 return this.typeParameter.span; 18499 return this.typeParameter.span;
18426 } 18500 }
18427 ParameterType.prototype.get$constructors = function() { 18501 ParameterType.prototype.get$constructors = function() {
18428 return world.internalError('no constructors on type parameters yet'); 18502 world.internalError('no constructors on type parameters yet');
18429 } 18503 }
18430 ParameterType.prototype.getCallMethod = function() { 18504 ParameterType.prototype.getCallMethod = function() {
18431 return this.extendsType.getCallMethod(); 18505 return this.extendsType.getCallMethod();
18432 } 18506 }
18433 ParameterType.prototype.genMethod = function(method) { 18507 ParameterType.prototype.genMethod = function(method) {
18434 this.extendsType.genMethod(method); 18508 this.extendsType.genMethod(method);
18435 } 18509 }
18436 ParameterType.prototype.isSubtypeOf = function(child) { 18510 ParameterType.prototype.isSubtypeOf = function(child) {
18437 return true; 18511 return true;
18438 } 18512 }
18439 ParameterType.prototype.resolveMember = function(memberName) { 18513 ParameterType.prototype.resolveMember = function(memberName) {
18440 return this.extendsType.resolveMember(memberName); 18514 return this.extendsType.resolveMember(memberName);
18441 } 18515 }
18442 ParameterType.prototype.getConstructor = function(constructorName) { 18516 ParameterType.prototype.getConstructor = function(constructorName) {
18443 world.internalError('no constructors on type parameters yet'); 18517 world.internalError('no constructors on type parameters yet');
18444 } 18518 }
18445 ParameterType.prototype.getOrMakeConcreteType = function(typeArgs) { 18519 ParameterType.prototype.getOrMakeConcreteType = function(typeArgs) {
18446 world.internalError('no concrete types of type parameters yet', this.get$span( )); 18520 world.internalError('no concrete types of type parameters yet', this.get$span( ));
18447 } 18521 }
18448 ParameterType.prototype.resolveTypeParams = function(inType) { 18522 ParameterType.prototype.resolveTypeParams = function(inType) {
18449 return inType.typeArguments.$index(this.name); 18523 var $0;
18524 return (($0 = inType.typeArguments.$index(this.name)) && $0.is$lang_Type());
18450 } 18525 }
18451 ParameterType.prototype.addDirectSubtype = function(type) { 18526 ParameterType.prototype.addDirectSubtype = function(type) {
18452 world.internalError('no subtypes of type parameters yet', this.get$span()); 18527 world.internalError('no subtypes of type parameters yet', this.get$span());
18453 } 18528 }
18454 ParameterType.prototype.resolve = function(inType) { 18529 ParameterType.prototype.resolve = function(inType) {
18455 if ($notnull_bool(this.typeParameter.extendsType != null)) { 18530 if ($notnull_bool(this.typeParameter.extendsType != null)) {
18456 this.extendsType = inType.resolveType(this.typeParameter.extendsType, true); 18531 this.extendsType = inType.resolveType(this.typeParameter.extendsType, true);
18457 } 18532 }
18458 else { 18533 else {
18459 this.extendsType = world.objectType; 18534 this.extendsType = world.objectType;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
18535 var $0; 18610 var $0;
18536 var result = this.genericType.getAllMembers(); 18611 var result = this.genericType.getAllMembers();
18537 var $list = result.getKeys(); 18612 var $list = result.getKeys();
18538 for (var $i = result.getKeys().iterator(); $i.hasNext(); ) { 18613 for (var $i = result.getKeys().iterator(); $i.hasNext(); ) {
18539 var memberName = $i.next(); 18614 var memberName = $i.next();
18540 var myMember = this.members.$index(memberName); 18615 var myMember = this.members.$index(memberName);
18541 if ($notnull_bool($ne(myMember, null))) { 18616 if ($notnull_bool($ne(myMember, null))) {
18542 result.$setindex(memberName, myMember); 18617 result.$setindex(memberName, myMember);
18543 } 18618 }
18544 } 18619 }
18545 return result; 18620 return (result && result.is$Map$String$Member());
18546 } 18621 }
18547 ConcreteType.prototype.markUsed = function() { 18622 ConcreteType.prototype.markUsed = function() {
18548 this.genericType.markUsed(); 18623 this.genericType.markUsed();
18549 } 18624 }
18550 ConcreteType.prototype.genMethod = function(method) { 18625 ConcreteType.prototype.genMethod = function(method) {
18551 this.genericType.genMethod(method); 18626 this.genericType.genMethod(method);
18552 } 18627 }
18553 ConcreteType.prototype.getFactory = function(type, constructorName) { 18628 ConcreteType.prototype.getFactory = function(type, constructorName) {
18554 return this.genericType.getFactory(type, constructorName); 18629 return this.genericType.getFactory(type, constructorName);
18555 } 18630 }
(...skipping 14 matching lines...) Expand all
18570 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member( ))); 18645 this.factories.addFactory(this.name, constructorName, (ret && ret.is$Member( )));
18571 } 18646 }
18572 else { 18647 else {
18573 ret = new ConcreteMember(this.name, this, genericMember); 18648 ret = new ConcreteMember(this.name, this, genericMember);
18574 this.constructors.$setindex(constructorName, ret); 18649 this.constructors.$setindex(constructorName, ret);
18575 } 18650 }
18576 return ret; 18651 return ret;
18577 } 18652 }
18578 ConcreteType.prototype.getMember = function(memberName) { 18653 ConcreteType.prototype.getMember = function(memberName) {
18579 var ret = this.members.$index(memberName); 18654 var ret = this.members.$index(memberName);
18580 if ($notnull_bool($ne(ret, null))) return ret; 18655 if ($notnull_bool($ne(ret, null))) return (ret && ret.is$Member());
18581 var genericMember = this.genericType.getMember(memberName); 18656 var genericMember = this.genericType.getMember(memberName);
18582 if ($notnull_bool(genericMember == null)) return null; 18657 if ($notnull_bool(genericMember == null)) return null;
18583 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gener icMember); 18658 ret = new ConcreteMember($assert_String(genericMember.get$name()), this, gener icMember);
18584 this.members.$setindex(memberName, ret); 18659 this.members.$setindex(memberName, ret);
18585 return ret; 18660 return (ret && ret.is$Member());
18586 } 18661 }
18587 ConcreteType.prototype.resolveMember = function(memberName) { 18662 ConcreteType.prototype.resolveMember = function(memberName) {
18588 var $0; 18663 var $0;
18589 var mem = this.getMember(memberName); 18664 var mem = this.getMember(memberName);
18590 if ($notnull_bool(mem == null)) return null; 18665 if ($notnull_bool(mem == null)) return null;
18591 var ret = new MemberSet((mem && mem.is$Member())); 18666 var ret = new MemberSet((mem && mem.is$Member()));
18592 if ($notnull_bool(mem.get$isStatic())) return ret; 18667 if ($notnull_bool(mem.get$isStatic())) return (ret && ret.is$MemberSet());
18593 var $list = this.genericType.get$subtypes(); 18668 var $list = this.genericType.get$subtypes();
18594 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext(); ) { 18669 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext(); ) {
18595 var t = $i.next(); 18670 var t = $i.next();
18596 var m = t.get$members().$index(memberName); 18671 var m = t.get$members().$index(memberName);
18597 if ($notnull_bool($ne(m, null))) ret.add(m); 18672 if ($notnull_bool($ne(m, null))) ret.add(m);
18598 } 18673 }
18599 return ret; 18674 return (ret && ret.is$MemberSet());
18600 } 18675 }
18601 ConcreteType.prototype.resolveType = function(node, isRequired) { 18676 ConcreteType.prototype.resolveType = function(node, isRequired) {
18602 var ret = this.genericType.resolveType(node, isRequired); 18677 var ret = this.genericType.resolveType(node, isRequired);
18603 return ret; 18678 return (ret && ret.is$lang_Type());
18604 } 18679 }
18605 ConcreteType.prototype.addDirectSubtype = function(type) { 18680 ConcreteType.prototype.addDirectSubtype = function(type) {
18606 this.genericType.addDirectSubtype(type); 18681 this.genericType.addDirectSubtype(type);
18607 } 18682 }
18608 // ********** Code for DefinedType ************** 18683 // ********** Code for DefinedType **************
18609 function DefinedType(name, library, definition, isClass) { 18684 function DefinedType(name, library, definition, isClass) {
18610 this.isUsed = false 18685 this.isUsed = false
18611 this.isNativeType = false 18686 this.isNativeType = false
18612 this.library = library; 18687 this.library = library;
18613 this.isClass = isClass; 18688 this.isClass = isClass;
18614 this.directSubtypes = new HashSetImplementation$Type(); 18689 this.directSubtypes = new HashSetImplementation$Type();
18615 this.constructors = $map([]); 18690 this.constructors = $map([]);
18616 this.members = $map([]); 18691 this.members = $map([]);
18617 this.factories = new FactoryMap(); 18692 this.factories = new FactoryMap();
18618 this._resolvedMembers = $map([]); 18693 this._resolvedMembers = $map([]);
18619 lang_Type.call(this, name); 18694 lang_Type.call(this, name);
18620 // Initializers done 18695 // Initializers done
18621 this.setDefinition(definition); 18696 this.setDefinition(definition);
18622 } 18697 }
18623 $inherits(DefinedType, lang_Type); 18698 $inherits(DefinedType, lang_Type);
18624 DefinedType.prototype.is$DefinedType = function(){return this;}; 18699 DefinedType.prototype.is$DefinedType = function(){return this;};
18625 DefinedType.prototype.get$definition = function() { return this.definition; }; 18700 DefinedType.prototype.get$definition = function() { return this.definition; };
18626 DefinedType.prototype.set$definition = function(value) { return this.definition = value; }; 18701 DefinedType.prototype.set$definition = function(value) { return this.definition = value; };
18627 DefinedType.prototype.get$library = function() { return this.library; }; 18702 DefinedType.prototype.get$library = function() { return this.library; };
18628 DefinedType.prototype.get$isClass = function() { return this.isClass; }; 18703 DefinedType.prototype.get$isClass = function() { return this.isClass; };
18629 DefinedType.prototype.get$parent = function() { 18704 DefinedType.prototype.get$parent = function() {
18630 return this._parent; 18705 return this._parent;
18631 } 18706 }
18632 DefinedType.prototype.set$parent = function(p) { 18707 DefinedType.prototype.set$parent = function(p) {
18633 return this._parent = p; 18708 this._parent = p;
18634 } 18709 }
18635 DefinedType.prototype.get$interfaces = function() { return this.interfaces; }; 18710 DefinedType.prototype.get$interfaces = function() { return this.interfaces; };
18636 DefinedType.prototype.set$interfaces = function(value) { return this.interfaces = value; }; 18711 DefinedType.prototype.set$interfaces = function(value) { return this.interfaces = value; };
18637 DefinedType.prototype.get$typeParameters = function() { return this.typeParamete rs; }; 18712 DefinedType.prototype.get$typeParameters = function() { return this.typeParamete rs; };
18638 DefinedType.prototype.set$typeParameters = function(value) { return this.typePar ameters = value; }; 18713 DefinedType.prototype.set$typeParameters = function(value) { return this.typePar ameters = value; };
18639 DefinedType.prototype.get$constructors = function() { return this.constructors; }; 18714 DefinedType.prototype.get$constructors = function() { return this.constructors; };
18640 DefinedType.prototype.set$constructors = function(value) { return this.construct ors = value; }; 18715 DefinedType.prototype.set$constructors = function(value) { return this.construct ors = value; };
18641 DefinedType.prototype.get$members = function() { return this.members; }; 18716 DefinedType.prototype.get$members = function() { return this.members; };
18642 DefinedType.prototype.set$members = function(value) { return this.members = valu e; }; 18717 DefinedType.prototype.set$members = function(value) { return this.members = valu e; };
18643 DefinedType.prototype.get$factories = function() { return this.factories; }; 18718 DefinedType.prototype.get$factories = function() { return this.factories; };
18644 DefinedType.prototype.set$factories = function(value) { return this.factories = value; }; 18719 DefinedType.prototype.set$factories = function(value) { return this.factories = value; };
18645 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; 18720 DefinedType.prototype.get$isUsed = function() { return this.isUsed; };
18646 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value; }; 18721 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value; };
18647 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType; }; 18722 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType; };
18648 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT ype = value; }; 18723 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT ype = value; };
18649 DefinedType.prototype.setDefinition = function(def) { 18724 DefinedType.prototype.setDefinition = function(def) {
18650 $assert(this.definition == null, "definition == null", "type.dart", 563, 12); 18725 $assert(this.definition == null, "definition == null", "type.dart", 564, 12);
18651 this.definition = def; 18726 this.definition = def;
18652 if ($notnull_bool((this.definition instanceof TypeDefinition) && this.definiti on.get$nativeType() != null)) { 18727 if ($notnull_bool((this.definition instanceof TypeDefinition) && this.definiti on.get$nativeType() != null)) {
18653 this.isNativeType = true; 18728 this.isNativeType = true;
18654 } 18729 }
18655 if ($notnull_bool(this.definition != null && this.definition.get$typeParameter s() != null)) { 18730 if ($notnull_bool(this.definition != null && this.definition.get$typeParameter s() != null)) {
18656 this._concreteTypes = $map([]); 18731 this._concreteTypes = $map([]);
18657 this.typeParameters = []; 18732 this.typeParameters = [];
18658 var $list = this.definition.get$typeParameters(); 18733 var $list = this.definition.get$typeParameters();
18659 for (var $i = 0;$i < $list.length; $i++) { 18734 for (var $i = 0;$i < $list.length; $i++) {
18660 var tp = $list.$index($i); 18735 var tp = $list.$index($i);
(...skipping 12 matching lines...) Expand all
18673 DefinedType.prototype.get$isVar = function() { 18748 DefinedType.prototype.get$isVar = function() {
18674 return $eq(this, world.varType); 18749 return $eq(this, world.varType);
18675 } 18750 }
18676 DefinedType.prototype.get$isVoid = function() { 18751 DefinedType.prototype.get$isVoid = function() {
18677 return $eq(this, world.voidType); 18752 return $eq(this, world.voidType);
18678 } 18753 }
18679 DefinedType.prototype.get$isTop = function() { 18754 DefinedType.prototype.get$isTop = function() {
18680 return this.name == null; 18755 return this.name == null;
18681 } 18756 }
18682 DefinedType.prototype.get$isObject = function() { 18757 DefinedType.prototype.get$isObject = function() {
18683 return this.library.get$isCore() && this.name == 'Object'; 18758 return $assert_bool(this.library.get$isCore() && this.name == 'Object');
18684 } 18759 }
18685 DefinedType.prototype.get$isString = function() { 18760 DefinedType.prototype.get$isString = function() {
18686 return this.library.get$isCore() && this.name == 'String' || this.library.get$ isCoreImpl() && this.name == 'StringImplementation'; 18761 return $assert_bool(this.library.get$isCore() && this.name == 'String' || this .library.get$isCoreImpl() && this.name == 'StringImplementation');
18687 } 18762 }
18688 DefinedType.prototype.get$isBool = function() { 18763 DefinedType.prototype.get$isBool = function() {
18689 return this.library.get$isCore() && this.name == 'bool'; 18764 return $assert_bool(this.library.get$isCore() && this.name == 'bool');
18690 } 18765 }
18691 DefinedType.prototype.get$isFunction = function() { 18766 DefinedType.prototype.get$isFunction = function() {
18692 return this.library.get$isCore() && this.name == 'Function'; 18767 return $assert_bool(this.library.get$isCore() && this.name == 'Function');
18693 } 18768 }
18694 DefinedType.prototype.get$isList = function() { 18769 DefinedType.prototype.get$isList = function() {
18695 return this.library.get$isCore() && this.name == 'List'; 18770 return $assert_bool(this.library.get$isCore() && this.name == 'List');
18696 } 18771 }
18697 DefinedType.prototype.get$isGeneric = function() { 18772 DefinedType.prototype.get$isGeneric = function() {
18698 return this.typeParameters != null; 18773 return this.typeParameters != null;
18699 } 18774 }
18700 DefinedType.prototype.get$span = function() { 18775 DefinedType.prototype.get$span = function() {
18701 return $notnull_bool(this.definition == null) ? null : this.definition.span; 18776 var $0;
18777 return (($0 = $notnull_bool(this.definition == null) ? null : this.definition. span) && $0.is$SourceSpan());
18702 } 18778 }
18703 DefinedType.prototype.get$typeofName = function() { 18779 DefinedType.prototype.get$typeofName = function() {
18704 if ($notnull_bool(!$notnull_bool(this.library.get$isCore()))) return null; 18780 if ($notnull_bool(!$notnull_bool(this.library.get$isCore()))) return null;
18705 if ($notnull_bool(this.get$isBool())) return 'boolean'; 18781 if ($notnull_bool(this.get$isBool())) return 'boolean';
18706 else if ($notnull_bool(this.get$isNum())) return 'number'; 18782 else if ($notnull_bool(this.get$isNum())) return 'number';
18707 else if ($notnull_bool(this.get$isString())) return 'string'; 18783 else if ($notnull_bool(this.get$isString())) return 'string';
18708 else if ($notnull_bool(this.get$isFunction())) return 'function'; 18784 else if ($notnull_bool(this.get$isFunction())) return 'function';
18709 else return null; 18785 else return null;
18710 } 18786 }
18711 DefinedType.prototype.get$isNum = function() { 18787 DefinedType.prototype.get$isNum = function() {
18712 return this.library != null && this.library.get$isCore() && (this.name == 'num ' || this.name == 'int' || this.name == 'double'); 18788 return $assert_bool(this.library != null && this.library.get$isCore() && (this .name == 'num' || this.name == 'int' || this.name == 'double'));
18713 } 18789 }
18714 DefinedType.prototype.getCallMethod = function() { 18790 DefinedType.prototype.getCallMethod = function() {
18715 return this.members.$index('\$call'); 18791 var $0;
18792 return (($0 = this.members.$index('\$call')) && $0.is$MethodMember());
18716 } 18793 }
18717 DefinedType.prototype.getAllMembers = function() { 18794 DefinedType.prototype.getAllMembers = function() {
18718 return HashMapImplementation.HashMapImplementation$from$factory(this.members); 18795 return HashMapImplementation.HashMapImplementation$from$factory(this.members);
18719 } 18796 }
18720 DefinedType.prototype.markUsed = function() { 18797 DefinedType.prototype.markUsed = function() {
18721 if ($notnull_bool(this.isUsed)) return; 18798 if ($notnull_bool(this.isUsed)) return;
18722 this.isUsed = true; 18799 this.isUsed = true;
18723 if ($notnull_bool(this._lazyGenMethods != null)) { 18800 if ($notnull_bool(this._lazyGenMethods != null)) {
18724 var $list = orderValuesByKeys(this._lazyGenMethods); 18801 var $list = orderValuesByKeys(this._lazyGenMethods);
18725 for (var $i = 0;$i < $list.length; $i++) { 18802 for (var $i = 0;$i < $list.length; $i++) {
(...skipping 18 matching lines...) Expand all
18744 var interfaces = []; 18821 var interfaces = [];
18745 for (var $i = 0;$i < types.length; $i++) { 18822 for (var $i = 0;$i < types.length; $i++) {
18746 var type = types.$index($i); 18823 var type = types.$index($i);
18747 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true); 18824 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true);
18748 if ($notnull_bool(resolvedInterface.get$isClosed() && !$notnull_bool((this.l ibrary.get$isCore() || this.library.get$isCoreImpl())))) { 18825 if ($notnull_bool(resolvedInterface.get$isClosed() && !$notnull_bool((this.l ibrary.get$isCore() || this.library.get$isCoreImpl())))) {
18749 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span()); 18826 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span());
18750 } 18827 }
18751 resolvedInterface.addDirectSubtype(this); 18828 resolvedInterface.addDirectSubtype(this);
18752 interfaces.add(resolvedInterface); 18829 interfaces.add(resolvedInterface);
18753 } 18830 }
18754 return interfaces; 18831 return (interfaces && interfaces.is$List$Type());
18755 } 18832 }
18756 DefinedType.prototype.addDirectSubtype = function(type) { 18833 DefinedType.prototype.addDirectSubtype = function(type) {
18757 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 679, 12); 18834 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 680, 12);
18758 this.directSubtypes.add(type); 18835 this.directSubtypes.add(type);
18759 } 18836 }
18760 DefinedType.prototype.get$subtypes = function() { 18837 DefinedType.prototype.get$subtypes = function() {
18761 var $0; 18838 var $0;
18762 if ($notnull_bool(this._subtypes == null)) { 18839 if ($notnull_bool(this._subtypes == null)) {
18763 this._subtypes = new HashSetImplementation$Type(); 18840 this._subtypes = new HashSetImplementation$Type();
18764 var $list = this.directSubtypes; 18841 var $list = this.directSubtypes;
18765 for (var $i = this.directSubtypes.iterator(); $i.hasNext(); ) { 18842 for (var $i = this.directSubtypes.iterator(); $i.hasNext(); ) {
18766 var st = $i.next(); 18843 var st = $i.next();
18767 this._subtypes.add(st); 18844 this._subtypes.add(st);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
19023 } 19100 }
19024 DefinedType.prototype.getMemberInParents = function(memberName) { 19101 DefinedType.prototype.getMemberInParents = function(memberName) {
19025 if ($notnull_bool(this.isClass)) { 19102 if ($notnull_bool(this.isClass)) {
19026 if ($notnull_bool(this.get$parent() != null)) { 19103 if ($notnull_bool(this.get$parent() != null)) {
19027 return this.get$parent().getMember(memberName); 19104 return this.get$parent().getMember(memberName);
19028 } 19105 }
19029 else if ($notnull_bool(this.get$isObject())) { 19106 else if ($notnull_bool(this.get$isObject())) {
19030 if ($notnull_bool(memberName == '\$ne')) { 19107 if ($notnull_bool(memberName == '\$ne')) {
19031 var ret = this._createNotEqualMember(); 19108 var ret = this._createNotEqualMember();
19032 this.members.$setindex(memberName, ret); 19109 this.members.$setindex(memberName, ret);
19033 return ret; 19110 return (ret && ret.is$Member());
19034 } 19111 }
19035 return null; 19112 return null;
19036 } 19113 }
19037 } 19114 }
19038 else { 19115 else {
19039 if ($notnull_bool(this.interfaces != null && this.interfaces.length > 0)) { 19116 if ($notnull_bool(this.interfaces != null && this.interfaces.length > 0)) {
19040 var $list = this.interfaces; 19117 var $list = this.interfaces;
19041 for (var $i = 0;$i < $list.length; $i++) { 19118 for (var $i = 0;$i < $list.length; $i++) {
19042 var i = $list.$index($i); 19119 var i = $list.$index($i);
19043 var ret = i.getMember(memberName); 19120 var ret = i.getMember(memberName);
19044 if ($notnull_bool($ne(ret, null))) { 19121 if ($notnull_bool($ne(ret, null))) {
19045 return ret; 19122 return (ret && ret.is$Member());
19046 } 19123 }
19047 } 19124 }
19048 return null; 19125 return null;
19049 } 19126 }
19050 else { 19127 else {
19051 return world.objectType.getMember(memberName); 19128 return world.objectType.getMember(memberName);
19052 } 19129 }
19053 } 19130 }
19054 } 19131 }
19055 DefinedType.prototype.resolveMember = function(memberName) { 19132 DefinedType.prototype.resolveMember = function(memberName) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
19175 } 19252 }
19176 else { 19253 else {
19177 world.internalError('unknown type reference', node.span); 19254 world.internalError('unknown type reference', node.span);
19178 } 19255 }
19179 return node.type; 19256 return node.type;
19180 } 19257 }
19181 DefinedType.prototype.resolveTypeParams = function(inType) { 19258 DefinedType.prototype.resolveTypeParams = function(inType) {
19182 return this; 19259 return this;
19183 } 19260 }
19184 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { 19261 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) {
19185 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1161, 12); 19262 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1162, 12);
19186 var names = [this.name]; 19263 var names = [this.name];
19187 var typeMap = $map([]); 19264 var typeMap = $map([]);
19188 for (var i = 0; 19265 for (var i = 0;
19189 $notnull_bool(i < typeArgs.length); i++) { 19266 $notnull_bool(i < typeArgs.length); i++) {
19190 var paramName = this.typeParameters.$index(i).get$name(); 19267 var paramName = this.typeParameters.$index(i).get$name();
19191 typeMap.$setindex(paramName, typeArgs.$index(i)); 19268 typeMap.$setindex(paramName, typeArgs.$index(i));
19192 names.add(typeArgs.$index(i).get$name()); 19269 names.add(typeArgs.$index(i).get$name());
19193 } 19270 }
19194 var concreteName = Strings.join((names && names.is$List$String()), '\$'); 19271 var concreteName = Strings.join((names && names.is$List$String()), '\$');
19195 var ret = this._concreteTypes.$index(concreteName); 19272 var ret = this._concreteTypes.$index(concreteName);
19196 if ($notnull_bool(ret == null)) { 19273 if ($notnull_bool(ret == null)) {
19197 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs ); 19274 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs );
19198 this._concreteTypes.$setindex(concreteName, ret); 19275 this._concreteTypes.$setindex(concreteName, ret);
19199 } 19276 }
19200 return ret; 19277 return (ret && ret.is$lang_Type());
19201 } 19278 }
19202 DefinedType.prototype.getCallStub = function(args) { 19279 DefinedType.prototype.getCallStub = function(args) {
19203 $assert(this.get$isFunction(), "isFunction", "type.dart", 1181, 12); 19280 $assert(this.get$isFunction(), "isFunction", "type.dart", 1182, 12);
19204 var name = _getCallStubName('call', args); 19281 var name = _getCallStubName('call', args);
19205 if ($notnull_bool(this.varStubs == null)) this.varStubs = $map([]); 19282 if ($notnull_bool(this.varStubs == null)) this.varStubs = $map([]);
19206 var stub = this.varStubs.$index(name); 19283 var stub = this.varStubs.$index(name);
19207 if ($notnull_bool(stub == null)) { 19284 if ($notnull_bool(stub == null)) {
19208 stub = new VarFunctionStub($assert_String(name), args); 19285 stub = new VarFunctionStub($assert_String(name), args);
19209 this.varStubs.$setindex(name, stub); 19286 this.varStubs.$setindex(name, stub);
19210 } 19287 }
19211 return stub; 19288 return (stub && stub.is$VarFunctionStub());
19212 } 19289 }
19213 // ********** Code for FixedCollection ************** 19290 // ********** Code for FixedCollection **************
19214 function FixedCollection(value, length) { 19291 function FixedCollection(value, length) {
19215 this.value = value; 19292 this.value = value;
19216 this.length = length; 19293 this.length = length;
19217 // Initializers done 19294 // Initializers done
19218 } 19295 }
19219 FixedCollection.prototype.is$Iterable = function(){return this;}; 19296 FixedCollection.prototype.is$Iterable = function(){return this;};
19220 FixedCollection.prototype.get$value = function() { return this.value; }; 19297 FixedCollection.prototype.get$value = function() { return this.value; };
19221 FixedCollection.prototype.iterator = function() { 19298 FixedCollection.prototype.iterator = function() {
(...skipping 19 matching lines...) Expand all
19241 } 19318 }
19242 $inherits(FixedCollection$Type, FixedCollection); 19319 $inherits(FixedCollection$Type, FixedCollection);
19243 FixedCollection$Type.prototype.is$Iterable = function(){return this;}; 19320 FixedCollection$Type.prototype.is$Iterable = function(){return this;};
19244 // ********** Code for FixedIterator ************** 19321 // ********** Code for FixedIterator **************
19245 function FixedIterator(value, length) { 19322 function FixedIterator(value, length) {
19246 this._index = 0 19323 this._index = 0
19247 this.value = value; 19324 this.value = value;
19248 this.length = length; 19325 this.length = length;
19249 // Initializers done 19326 // Initializers done
19250 } 19327 }
19328 FixedIterator.prototype.is$Iterator$T = function(){return this;};
19251 FixedIterator.prototype.get$value = function() { return this.value; }; 19329 FixedIterator.prototype.get$value = function() { return this.value; };
19252 FixedIterator.prototype.hasNext = function() { 19330 FixedIterator.prototype.hasNext = function() {
19253 return this._index < this.length; 19331 return this._index < this.length;
19254 } 19332 }
19255 FixedIterator.prototype.next = function() { 19333 FixedIterator.prototype.next = function() {
19256 this._index++; 19334 this._index++;
19257 return this.value; 19335 return this.value;
19258 } 19336 }
19259 // ********** Code for FixedIterator$E ************** 19337 // ********** Code for FixedIterator$E **************
19260 function FixedIterator$E(value, length) { 19338 function FixedIterator$E(value, length) {
19261 this._index = 0 19339 this._index = 0
19262 this.value = value; 19340 this.value = value;
19263 this.length = length; 19341 this.length = length;
19264 // Initializers done 19342 // Initializers done
19265 } 19343 }
19266 $inherits(FixedIterator$E, FixedIterator); 19344 $inherits(FixedIterator$E, FixedIterator);
19345 FixedIterator$E.prototype.is$Iterator$T = function(){return this;};
19267 // ********** Code for Value ************** 19346 // ********** Code for Value **************
19268 function Value(type, code, span, isSuper, needsTemp, isType) { 19347 function Value(type, code, span, isSuper, needsTemp, isType) {
19269 this.type = type; 19348 this.type = type;
19270 this.code = code; 19349 this.code = code;
19271 this.span = span; 19350 this.span = span;
19272 this.isSuper = isSuper; 19351 this.isSuper = isSuper;
19273 this.needsTemp = needsTemp; 19352 this.needsTemp = needsTemp;
19274 this.isType = isType; 19353 this.isType = isType;
19275 // Initializers done 19354 // Initializers done
19276 if ($notnull_bool(this.type == null)) this.type = world.varType; 19355 if ($notnull_bool(this.type == null)) this.type = world.varType;
19277 } 19356 }
19278 Value.prototype.is$Value = function(){return this;}; 19357 Value.prototype.is$Value = function(){return this;};
19279 Value.prototype.get$span = function() { return this.span; }; 19358 Value.prototype.get$span = function() { return this.span; };
19280 Value.prototype.set$span = function(value) { return this.span = value; }; 19359 Value.prototype.set$span = function(value) { return this.span = value; };
19281 Value.prototype.get$_typeIsVarOrParameterType = function() { 19360 Value.prototype.get$_typeIsVarOrParameterType = function() {
19282 return this.type.get$isVar() || (this.type instanceof ParameterType); 19361 return $assert_bool(this.type.get$isVar() || (this.type instanceof ParameterTy pe));
19283 } 19362 }
19284 Value.prototype.get$isConst = function() { 19363 Value.prototype.get$isConst = function() {
19285 return false; 19364 return false;
19286 } 19365 }
19366 Value.prototype.get$canonicalCode = function() {
19367 return null;
19368 }
19287 Value.prototype.get_ = function(context, name, node) { 19369 Value.prototype.get_ = function(context, name, node) {
19288 var member = this._resolveMember(context, name, node, false); 19370 var member = this._resolveMember(context, name, node, false);
19289 if ($notnull_bool($ne(member, null))) { 19371 if ($notnull_bool($ne(member, null))) {
19290 return member._get$3(context, node, this); 19372 return member._get$3(context, node, this);
19291 } 19373 }
19292 else { 19374 else {
19293 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node); 19375 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node);
19294 } 19376 }
19295 } 19377 }
19296 Value.prototype.set_ = function(context, name, node, value, isDynamic) { 19378 Value.prototype.set_ = function(context, name, node, value, isDynamic) {
(...skipping 30 matching lines...) Expand all
19327 } 19409 }
19328 } 19410 }
19329 Value.prototype.canInvoke = function(context, name, args) { 19411 Value.prototype.canInvoke = function(context, name, args) {
19330 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) { 19412 if ($notnull_bool(this.get$_typeIsVarOrParameterType() && name == '\$ne')) {
19331 return true; 19413 return true;
19332 } 19414 }
19333 if ($notnull_bool(this.type.get$isVarOrFunction() && name == '\$call')) { 19415 if ($notnull_bool(this.type.get$isVarOrFunction() && name == '\$call')) {
19334 return true; 19416 return true;
19335 } 19417 }
19336 var member = this._resolveMember(context, name, null, true); 19418 var member = this._resolveMember(context, name, null, true);
19337 return $ne(member, null) && member.canInvoke(context, args); 19419 return $assert_bool($ne(member, null) && member.canInvoke(context, args));
19338 } 19420 }
19339 Value.prototype._hasOverriddenNoSuchMethod = function() { 19421 Value.prototype._hasOverriddenNoSuchMethod = function() {
19340 if ($notnull_bool(this.isSuper)) { 19422 if ($notnull_bool(this.isSuper)) {
19341 var m = this.type.getMember('noSuchMethod'); 19423 var m = this.type.getMember('noSuchMethod');
19342 return $ne(m, null) && !$notnull_bool(m.declaringType.get$isObject()); 19424 return $assert_bool($ne(m, null) && !$notnull_bool(m.declaringType.get$isObj ect()));
19343 } 19425 }
19344 else { 19426 else {
19345 return this.type.resolveMember('noSuchMethod').members.length > 1; 19427 return this.type.resolveMember('noSuchMethod').members.length > 1;
19346 } 19428 }
19347 } 19429 }
19348 Value.prototype._tryResolveMember = function(context, name) { 19430 Value.prototype._tryResolveMember = function(context, name) {
19349 if ($notnull_bool(this.isSuper)) { 19431 if ($notnull_bool(this.isSuper)) {
19350 return this.type.getMember(name); 19432 return this.type.getMember(name);
19351 } 19433 }
19352 else { 19434 else {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
19399 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) { 19481 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) {
19400 return true; 19482 return true;
19401 } 19483 }
19402 } 19484 }
19403 if ($notnull_bool(options.enableTypeChecks)) { 19485 if ($notnull_bool(options.enableTypeChecks)) {
19404 var fromType = this.type; 19486 var fromType = this.type;
19405 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { 19487 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) {
19406 fromType = world.objectType; 19488 fromType = world.objectType;
19407 } 19489 }
19408 var bothNum = $assert_bool(this.type.get$isNum() && toType.get$isNum()); 19490 var bothNum = $assert_bool(this.type.get$isNum() && toType.get$isNum());
19409 return fromType.isSubtypeOf(toType) || bothNum; 19491 return $assert_bool(fromType.isSubtypeOf(toType) || bothNum);
19410 } 19492 }
19411 return false; 19493 return false;
19412 } 19494 }
19413 Value.prototype.convertTo = function(context, toType, node, isDynamic) { 19495 Value.prototype.convertTo = function(context, toType, node, isDynamic) {
19496 var $0;
19414 var checked = !$notnull_bool(isDynamic); 19497 var checked = !$notnull_bool(isDynamic);
19415 var callMethod = toType.getCallMethod(); 19498 var callMethod = toType.getCallMethod();
19416 if ($notnull_bool($ne(callMethod, null))) { 19499 if ($notnull_bool($ne(callMethod, null))) {
19417 if ($notnull_bool(checked && !$notnull_bool(toType.isAssignable(this.type))) ) { 19500 if ($notnull_bool(checked && !$notnull_bool(toType.isAssignable(this.type))) ) {
19418 this.convertWarning(toType, node); 19501 this.convertWarning(toType, node);
19419 } 19502 }
19420 var arity = callMethod.get$parameters().length; 19503 var arity = callMethod.get$parameters().length;
19421 var myCall = this.type.getCallMethod(); 19504 var myCall = this.type.getCallMethod();
19422 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) { 19505 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity) ) {
19423 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory (arity)); 19506 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory (arity));
19424 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), node.span, false, true, false); 19507 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), node.span, false, true, false);
19425 return $notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i sDomCallback(this.type))) ? val._wrapDomCallback(toType, arity) : val; 19508 return (($0 = $notnull_bool(this._isDomCallback(toType) && !$notnull_bool( this._isDomCallback(this.type))) ? val._wrapDomCallback(toType, arity) : val) && $0.is$Value());
19426 } 19509 }
19427 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i sDomCallback(this.type)))) { 19510 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i sDomCallback(this.type)))) {
19428 return this._wrapDomCallback(toType, arity); 19511 return this._wrapDomCallback(toType, arity);
19429 } 19512 }
19430 } 19513 }
19431 var fromType = this.type; 19514 var fromType = this.type;
19432 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { 19515 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) {
19433 fromType = world.objectType; 19516 fromType = world.objectType;
19434 } 19517 }
19435 var bothNum = $assert_bool(this.type.get$isNum() && toType.get$isNum()); 19518 var bothNum = $assert_bool(this.type.get$isNum() && toType.get$isNum());
(...skipping 21 matching lines...) Expand all
19457 if ($notnull_bool(this.code.startsWith('\$notnull_bool'))) { 19540 if ($notnull_bool(this.code.startsWith('\$notnull_bool'))) {
19458 return this; 19541 return this;
19459 } 19542 }
19460 else { 19543 else {
19461 world.gen.corejs.useNotNullBool = true; 19544 world.gen.corejs.useNotNullBool = true;
19462 return new Value(world.boolType, ('\$notnull_bool(' + this.code + ')'), th is.span, false, true, false); 19545 return new Value(world.boolType, ('\$notnull_bool(' + this.code + ')'), th is.span, false, true, false);
19463 } 19546 }
19464 } 19547 }
19465 } 19548 }
19466 Value.prototype._isDomCallback = function(toType) { 19549 Value.prototype._isDomCallback = function(toType) {
19467 return ((toType.get$definition() instanceof FunctionTypeDefinition) && $eq(toT ype.get$library(), world.get$dom())); 19550 return $assert_bool(((toType.get$definition() instanceof FunctionTypeDefinitio n) && $eq(toType.get$library(), world.get$dom())));
19468 } 19551 }
19469 Value.prototype._wrapDomCallback = function(toType, arity) { 19552 Value.prototype._wrapDomCallback = function(toType, arity) {
19470 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, false, true, false); 19553 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, false, true, false);
19471 } 19554 }
19472 Value.prototype._typeAssert = function(context, toType, node) { 19555 Value.prototype._typeAssert = function(context, toType, node) {
19473 if ($notnull_bool((toType instanceof ParameterType))) { 19556 if ($notnull_bool((toType instanceof ParameterType))) {
19474 var p = (toType && toType.is$ParameterType()); 19557 var p = (toType && toType.is$ParameterType());
19475 toType = p.extendsType; 19558 toType = p.extendsType;
19476 } 19559 }
19477 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) { 19560 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) {
19478 world.internalError(('We thought ' + this.type.name + ' is not a subtype of ' + toType.name + '?')); 19561 world.internalError(('We thought ' + this.type.name + ' is not a subtype of ' + toType.name + '?'));
19479 } 19562 }
19480 if ($notnull_bool(toType.get$isNum())) toType = world.numType; 19563 if ($notnull_bool(toType.get$isNum())) toType = world.numType;
19481 var check; 19564 var check;
19482 if ($notnull_bool(toType.get$library().get$isCore() && toType.get$typeofName() != null)) { 19565 if ($notnull_bool(toType.get$isVoid())) {
19566 check = ('\$assert_void(' + this.code + ')');
19567 if ($notnull_bool(toType.typeCheckCode == null)) {
19568 toType.typeCheckCode = "function $assert_void(x) {\n return x == null ? x : x.is$void(); // throws TypeError\n}";
19569 }
19570 }
19571 else if ($notnull_bool(toType.get$library().get$isCore() && toType.get$typeofN ame() != null)) {
19483 check = ('\$assert_' + toType.name + '(' + this.code + ')'); 19572 check = ('\$assert_' + toType.name + '(' + this.code + ')');
19484 if ($notnull_bool(toType.typeCheckCode == null)) { 19573 if ($notnull_bool(toType.typeCheckCode == null)) {
19485 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}"); 19574 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}");
19486 } 19575 }
19487 } 19576 }
19488 else { 19577 else {
19489 toType.isTested = true; 19578 toType.isTested = true;
19490 var temp = context.getTemp(this); 19579 var temp = context.getTemp(this);
19491 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); 19580 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&');
19492 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); 19581 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())');
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
19528 testCode = '!' + testCode; 19617 testCode = '!' + testCode;
19529 } 19618 }
19530 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value( ))); 19619 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value( )));
19531 } 19620 }
19532 return new Value(world.boolType, testCode, span, false, true, false); 19621 return new Value(world.boolType, testCode, span, false, true, false);
19533 } 19622 }
19534 Value.prototype.convertWarning = function(toType, node) { 19623 Value.prototype.convertWarning = function(toType, node) {
19535 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType .name + '"'), node.span); 19624 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType .name + '"'), node.span);
19536 } 19625 }
19537 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { 19626 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) {
19627 var $0;
19538 var pos = ''; 19628 var pos = '';
19539 if ($notnull_bool(args != null)) { 19629 if ($notnull_bool(args != null)) {
19540 var argsCode = []; 19630 var argsCode = [];
19541 for (var i = 0; 19631 for (var i = 0;
19542 $notnull_bool(i < args.get$length()); i++) { 19632 $notnull_bool(i < args.get$length()); i++) {
19543 argsCode.add(args.values.$index(i).code); 19633 argsCode.add(args.values.$index(i).code);
19544 } 19634 }
19545 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); 19635 pos = Strings.join((argsCode && argsCode.is$List$String()), ", ");
19546 } 19636 }
19547 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, f alse, true, false), new Value(world.listType, ('[' + pos + ']'), node.span, fals e, true, false)]; 19637 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, f alse, true, false), new Value(world.listType, ('[' + pos + ']'), node.span, fals e, true, false)];
19548 return this._resolveMember(context, 'noSuchMethod', node, false).invoke$4(cont ext, node, this, new Arguments(null, noSuchArgs)); 19638 return (($0 = this._resolveMember(context, 'noSuchMethod', node, false).invoke $4(context, node, this, new Arguments(null, noSuchArgs))) && $0.is$Value());
19549 } 19639 }
19550 Value.prototype.invokeSpecial = function(name, args, returnType) { 19640 Value.prototype.invokeSpecial = function(name, args, returnType) {
19551 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 447, 12 ); 19641 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 461, 12 );
19552 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 48, 12); 19642 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 62, 12);
19553 var argsString = args.getCode(); 19643 var argsString = args.getCode();
19554 if ($notnull_bool(name == '\$index' || name == '\$setindex')) { 19644 if ($notnull_bool(name == '\$index' || name == '\$setindex')) {
19555 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, false, true, false); 19645 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, false, true, false);
19556 } 19646 }
19557 else { 19647 else {
19558 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString + ''); 19648 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString + '');
19559 world.gen.corejs.useOperator(name); 19649 world.gen.corejs.useOperator(name);
19560 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), this.span, false, true, false); 19650 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), this.span, false, true, false);
19561 } 19651 }
19562 } 19652 }
(...skipping 12 matching lines...) Expand all
19575 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype; 19665 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype;
19576 $inherits(EvaluatedValue, Value); 19666 $inherits(EvaluatedValue, Value);
19577 EvaluatedValue.EvaluatedValue$factory = function(type, actualValue, canonicalCod e, span) { 19667 EvaluatedValue.EvaluatedValue$factory = function(type, actualValue, canonicalCod e, span) {
19578 return new EvaluatedValue._internal$ctor(type, actualValue, canonicalCode, spa n, EvaluatedValue.codeWithComments(canonicalCode, span)); 19668 return new EvaluatedValue._internal$ctor(type, actualValue, canonicalCode, spa n, EvaluatedValue.codeWithComments(canonicalCode, span));
19579 } 19669 }
19580 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue; }; 19670 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue; };
19581 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV alue = value; }; 19671 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV alue = value; };
19582 EvaluatedValue.prototype.get$isConst = function() { 19672 EvaluatedValue.prototype.get$isConst = function() {
19583 return true; 19673 return true;
19584 } 19674 }
19675 EvaluatedValue.prototype.get$canonicalCode = function() { return this.canonicalC ode; };
19676 EvaluatedValue.prototype.set$canonicalCode = function(value) { return this.canon icalCode = value; };
19585 EvaluatedValue.codeWithComments = function(canonicalCode, span) { 19677 EvaluatedValue.codeWithComments = function(canonicalCode, span) {
19586 return $notnull_bool((span != null && span.get$text() != canonicalCode)) ? ('' + canonicalCode + '/*' + span.get$text() + '*/') : canonicalCode; 19678 return $notnull_bool((span != null && span.get$text() != canonicalCode)) ? ('' + canonicalCode + '/*' + span.get$text() + '*/') : canonicalCode;
19587 } 19679 }
19588 // ********** Code for ConstListValue ************** 19680 // ********** Code for ConstListValue **************
19589 function ConstListValue() {} 19681 function ConstListValue() {}
19590 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod e, span, code) { 19682 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod e, span, code) {
19591 this.values = values; 19683 this.values = values;
19592 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); 19684 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code));
19593 // Initializers done 19685 // Initializers done
19594 } 19686 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
19642 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span, dependencies) { 19734 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span, dependencies) {
19643 this.field = field; 19735 this.field = field;
19644 this.name = name; 19736 this.name = name;
19645 this.exp = exp; 19737 this.exp = exp;
19646 this.canonicalCode = canonicalCode; 19738 this.canonicalCode = canonicalCode;
19647 this.dependencies = dependencies; 19739 this.dependencies = dependencies;
19648 Value.call(this, type, code, span, false, !$notnull_bool(isConst), false); 19740 Value.call(this, type, code, span, false, !$notnull_bool(isConst), false);
19649 // Initializers done 19741 // Initializers done
19650 } 19742 }
19651 $inherits(GlobalValue, Value); 19743 $inherits(GlobalValue, Value);
19744 GlobalValue.prototype.is$GlobalValue = function(){return this;};
19652 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) { 19745 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) {
19653 var code = ($notnull_bool(exp.get$isConst()) ? exp.canonicalCode : exp.code); 19746 var code = ($notnull_bool(exp.get$isConst()) ? exp.get$canonicalCode() : exp.c ode);
19654 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie ld.get$name() + '*/'); 19747 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie ld.get$name() + '*/');
19655 return new GlobalValue(exp.type, $assert_String(codeWithComment), field.isFina l, field, null, exp, code, exp.span, dependencies.filter((function (d) { 19748 return new GlobalValue(exp.type, $assert_String(codeWithComment), field.isFina l, field, null, exp, code, exp.span, dependencies.filter((function (d) {
19656 return (d instanceof GlobalValue); 19749 return (d instanceof GlobalValue);
19657 }) 19750 })
19658 )); 19751 ));
19659 } 19752 }
19660 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies ) { 19753 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies ) {
19661 var name = ("const\$" + uniqueId + ""); 19754 var name = ("const\$" + uniqueId + "");
19662 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/"); 19755 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/");
19663 return new GlobalValue(exp.type, $assert_String(codeWithComment), true, null, name, exp, name, exp.span, dependencies.filter((function (d) { 19756 return new GlobalValue(exp.type, $assert_String(codeWithComment), true, null, name, exp, name, exp.span, dependencies.filter((function (d) {
19664 return (d instanceof GlobalValue); 19757 return (d instanceof GlobalValue);
19665 }) 19758 })
19666 )); 19759 ));
19667 } 19760 }
19668 GlobalValue.prototype.get$name = function() { return this.name; }; 19761 GlobalValue.prototype.get$name = function() { return this.name; };
19669 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; 19762 GlobalValue.prototype.set$name = function(value) { return this.name = value; };
19763 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode ; };
19764 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica lCode = value; };
19670 GlobalValue.prototype.get$isConst = function() { 19765 GlobalValue.prototype.get$isConst = function() {
19671 return this.exp.get$isConst() && (this.field == null || this.field.isFinal); 19766 return $assert_bool(this.exp.get$isConst() && (this.field == null || this.fiel d.isFinal));
19672 } 19767 }
19673 GlobalValue.prototype.get$actualValue = function() { 19768 GlobalValue.prototype.get$actualValue = function() {
19674 return this.exp.get$dynamic().get$actualValue(); 19769 return this.exp.get$dynamic().get$actualValue();
19675 } 19770 }
19676 GlobalValue.prototype.compareTo = function(other) { 19771 GlobalValue.prototype.compareTo = function(other) {
19677 if ($notnull_bool($eq(other, this))) { 19772 if ($notnull_bool($eq(other, this))) {
19678 return 0; 19773 return 0;
19679 } 19774 }
19680 else if ($notnull_bool(this.dependencies.indexOf(other, 0) >= 0)) { 19775 else if ($notnull_bool(this.dependencies.indexOf(other, 0) >= 0)) {
19681 return 1; 19776 return 1;
(...skipping 21 matching lines...) Expand all
19703 } 19798 }
19704 } 19799 }
19705 // ********** Code for BareValue ************** 19800 // ********** Code for BareValue **************
19706 function BareValue(home, outermost, span) { 19801 function BareValue(home, outermost, span) {
19707 this.home = home; 19802 this.home = home;
19708 Value.call(this, outermost.method.declaringType, null, span, false, false, out ermost.get$isStatic()); 19803 Value.call(this, outermost.method.declaringType, null, span, false, false, out ermost.get$isStatic());
19709 // Initializers done 19804 // Initializers done
19710 } 19805 }
19711 $inherits(BareValue, Value); 19806 $inherits(BareValue, Value);
19712 BareValue.prototype._tryResolveMember = function(context, name) { 19807 BareValue.prototype._tryResolveMember = function(context, name) {
19713 $assert($eq(context, this.home), "context == home", "value.dart", 651, 12); 19808 $assert($eq(context, this.home), "context == home", "value.dart", 665, 12);
19714 var member = this.type.resolveMember(name); 19809 var member = this.type.resolveMember(name);
19715 if ($notnull_bool($ne(member, null))) { 19810 if ($notnull_bool($ne(member, null))) {
19716 $assert(this.code == null, "code == null", "value.dart", 656, 14); 19811 $assert(this.code == null, "code == null", "value.dart", 670, 14);
19717 if ($notnull_bool(this.isType)) { 19812 if ($notnull_bool(this.isType)) {
19718 this.code = this.type.get$jsname(); 19813 this.code = this.type.get$jsname();
19719 } 19814 }
19720 else { 19815 else {
19721 this.code = this.home._makeThisCode(); 19816 this.code = this.home._makeThisCode();
19722 } 19817 }
19723 return member; 19818 return member;
19724 } 19819 }
19725 member = this.home.get$library().lookup(name, this.span); 19820 member = this.home.get$library().lookup(name, this.span);
19726 if ($notnull_bool($ne(member, null))) { 19821 if ($notnull_bool($ne(member, null))) {
(...skipping 24 matching lines...) Expand all
19751 this.seenFatal = false 19846 this.seenFatal = false
19752 this.files = files; 19847 this.files = files;
19753 this.libraries = $map([]); 19848 this.libraries = $map([]);
19754 this._todo = []; 19849 this._todo = [];
19755 this._members = $map([]); 19850 this._members = $map([]);
19756 this._topNames = $map([]); 19851 this._topNames = $map([]);
19757 this.reader = new LibraryReader(); 19852 this.reader = new LibraryReader();
19758 // Initializers done 19853 // Initializers done
19759 } 19854 }
19760 World.prototype.get$coreimpl = function() { 19855 World.prototype.get$coreimpl = function() {
19761 return this.libraries.$index('dart:coreimpl'); 19856 var $0;
19857 return (($0 = this.libraries.$index('dart:coreimpl')) && $0.is$Library());
19762 } 19858 }
19763 World.prototype.get$dom = function() { 19859 World.prototype.get$dom = function() {
19764 return this.libraries.$index('dart:dom'); 19860 var $0;
19861 return (($0 = this.libraries.$index('dart:dom')) && $0.is$Library());
19765 } 19862 }
19766 World.prototype.get$functionType = function() { return this.functionType; }; 19863 World.prototype.get$functionType = function() { return this.functionType; };
19767 World.prototype.set$functionType = function(value) { return this.functionType = value; }; 19864 World.prototype.set$functionType = function(value) { return this.functionType = value; };
19768 World.prototype.init = function() { 19865 World.prototype.init = function() {
19769 var $0; 19866 var $0;
19770 this.corelib = new Library(this.readFile('dart:core')); 19867 this.corelib = new Library(this.readFile('dart:core'));
19771 this.libraries.$setindex('dart:core', this.corelib); 19868 this.libraries.$setindex('dart:core', this.corelib);
19772 this._todo.add(this.corelib); 19869 this._todo.add(this.corelib);
19773 this.voidType = (($0 = this._addToCoreLib('void', false)) && $0.is$DefinedType ()); 19870 this.voidType = (($0 = this._addToCoreLib('void', false)) && $0.is$DefinedType ());
19774 this.dynamicType = (($0 = this._addToCoreLib('Dynamic', false)) && $0.is$Defin edType()); 19871 this.dynamicType = (($0 = this._addToCoreLib('Dynamic', false)) && $0.is$Defin edType());
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
20209 } 20306 }
20210 ; 20307 ;
20211 // ********** Code for VarFunctionStub ************** 20308 // ********** Code for VarFunctionStub **************
20212 function VarFunctionStub(name, callArgs) { 20309 function VarFunctionStub(name, callArgs) {
20213 this.args = callArgs.toCallStubArgs(); 20310 this.args = callArgs.toCallStubArgs();
20214 VarMember.call(this, name); 20311 VarMember.call(this, name);
20215 // Initializers done 20312 // Initializers done
20216 world.gen.corejs.useGenStub = true; 20313 world.gen.corejs.useGenStub = true;
20217 } 20314 }
20218 $inherits(VarFunctionStub, VarMember); 20315 $inherits(VarFunctionStub, VarMember);
20316 VarFunctionStub.prototype.is$VarFunctionStub = function(){return this;};
20219 VarFunctionStub.prototype.generate = function(code) { 20317 VarFunctionStub.prototype.generate = function(code) {
20220 if ($notnull_bool(this.args.get$hasNames())) { 20318 if ($notnull_bool(this.args.get$hasNames())) {
20221 this.generateNamed(code); 20319 this.generateNamed(code);
20222 } 20320 }
20223 else { 20321 else {
20224 this.generatePositional(code); 20322 this.generatePositional(code);
20225 } 20323 }
20226 } 20324 }
20227 VarFunctionStub.prototype.generatePositional = function(w) { 20325 VarFunctionStub.prototype.generatePositional = function(w) {
20228 var arity = this.args.get$length(); 20326 var arity = this.args.get$length();
(...skipping 19 matching lines...) Expand all
20248 // ********** Code for VarMethodStub ************** 20346 // ********** Code for VarMethodStub **************
20249 function VarMethodStub(name, member, args, body) { 20347 function VarMethodStub(name, member, args, body) {
20250 this.member = member; 20348 this.member = member;
20251 this.args = args; 20349 this.args = args;
20252 this.body = body; 20350 this.body = body;
20253 VarMember.call(this, name); 20351 VarMember.call(this, name);
20254 // Initializers done 20352 // Initializers done
20255 } 20353 }
20256 $inherits(VarMethodStub, VarMember); 20354 $inherits(VarMethodStub, VarMember);
20257 VarMethodStub.prototype.get$returnType = function() { 20355 VarMethodStub.prototype.get$returnType = function() {
20258 return $notnull_bool(this.member != null) ? this.member.get$returnType() : wor ld.varType; 20356 var $0;
20357 return (($0 = $notnull_bool(this.member != null) ? this.member.get$returnType( ) : world.varType) && $0.is$lang_Type());
20259 } 20358 }
20260 VarMethodStub.prototype.get$typeName = function() { 20359 VarMethodStub.prototype.get$typeName = function() {
20261 return $notnull_bool(this.member != null) ? this.member.declaringType.get$jsna me() : 'Object'; 20360 return $notnull_bool(this.member != null) ? this.member.declaringType.get$jsna me() : 'Object';
20262 } 20361 }
20263 VarMethodStub.prototype.generate = function(code) { 20362 VarMethodStub.prototype.generate = function(code) {
20264 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = ')); 20363 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = '));
20265 this.generateBody(code); 20364 this.generateBody(code);
20266 code.writeln(';'); 20365 code.writeln(';');
20267 } 20366 }
20268 VarMethodStub.prototype.generateBody = function(code) { 20367 VarMethodStub.prototype.generateBody = function(code) {
(...skipping 29 matching lines...) Expand all
20298 this.members = members; 20397 this.members = members;
20299 this.returnType = returnType; 20398 this.returnType = returnType;
20300 this.args = callArgs.toCallStubArgs(); 20399 this.args = callArgs.toCallStubArgs();
20301 VarMember.call(this, name); 20400 VarMember.call(this, name);
20302 // Initializers done 20401 // Initializers done
20303 } 20402 }
20304 $inherits(VarMethodSet, VarMember); 20403 $inherits(VarMethodSet, VarMember);
20305 VarMethodSet.prototype.get$members = function() { return this.members; }; 20404 VarMethodSet.prototype.get$members = function() { return this.members; };
20306 VarMethodSet.prototype.get$returnType = function() { return this.returnType; }; 20405 VarMethodSet.prototype.get$returnType = function() { return this.returnType; };
20307 VarMethodSet.prototype.get$baseName = function() { 20406 VarMethodSet.prototype.get$baseName = function() {
20308 return this.members.$index(0).get$name(); 20407 return $assert_String(this.members.$index(0).get$name());
20309 } 20408 }
20310 VarMethodSet.prototype.invoke = function(context, node, target, args) { 20409 VarMethodSet.prototype.invoke = function(context, node, target, args) {
20311 this._invokeMembers(context, node); 20410 this._invokeMembers(context, node);
20312 return VarMember.prototype.invoke.call(this, context, node, target, args); 20411 return VarMember.prototype.invoke.call(this, context, node, target, args);
20313 } 20412 }
20314 VarMethodSet.prototype._invokeMembers = function(context, node) { 20413 VarMethodSet.prototype._invokeMembers = function(context, node) {
20315 if ($notnull_bool(this._fallbackStubs != null)) return; 20414 if ($notnull_bool(this._fallbackStubs != null)) return;
20316 this._fallbackStubs = []; 20415 this._fallbackStubs = [];
20317 var $list = this.members; 20416 var $list = this.members;
20318 for (var $i = 0;$i < $list.length; $i++) { 20417 for (var $i = 0;$i < $list.length; $i++) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
20399 }) 20498 })
20400 ); 20499 );
20401 var values = []; 20500 var values = [];
20402 for (var $i = 0;$i < keys.length; $i++) { 20501 for (var $i = 0;$i < keys.length; $i++) {
20403 var k = keys.$index($i); 20502 var k = keys.$index($i);
20404 values.add(map.$index(k)); 20503 values.add(map.$index(k));
20405 } 20504 }
20406 return values; 20505 return values;
20407 } 20506 }
20408 function isMultilineString(text) { 20507 function isMultilineString(text) {
20409 return text.startsWith('"""') || text.startsWith("'''"); 20508 return $assert_bool(text.startsWith('"""') || text.startsWith("'''"));
20410 } 20509 }
20411 function isRawMultilineString(text) { 20510 function isRawMultilineString(text) {
20412 return text.startsWith('@"""') || text.startsWith("@'''"); 20511 return $assert_bool(text.startsWith('@"""') || text.startsWith("@'''"));
20413 } 20512 }
20414 function parseStringLiteral(lit) { 20513 function parseStringLiteral(lit) {
20415 if ($notnull_bool(lit.startsWith('@'))) { 20514 if ($notnull_bool(lit.startsWith('@'))) {
20416 if ($notnull_bool(isRawMultilineString(lit))) { 20515 if ($notnull_bool(isRawMultilineString(lit))) {
20417 return stripLeadingNewline(lit.substring(4, lit.length - 3)); 20516 return stripLeadingNewline(lit.substring(4, lit.length - 3));
20418 } 20517 }
20419 else { 20518 else {
20420 return lit.substring(2, lit.length - 1); 20519 return lit.substring(2, lit.length - 1);
20421 } 20520 }
20422 } 20521 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
20459 var code = world.getGeneratedCode(); 20558 var code = world.getGeneratedCode();
20460 if ($notnull_bool(!$notnull_bool(options.outfile.endsWith('.js')))) { 20559 if ($notnull_bool(!$notnull_bool(options.outfile.endsWith('.js')))) {
20461 code = '#!/usr/bin/env node\n' + code; 20560 code = '#!/usr/bin/env node\n' + code;
20462 } 20561 }
20463 world.files.writeString(options.outfile, code); 20562 world.files.writeString(options.outfile, code);
20464 } 20563 }
20465 else { 20564 else {
20466 world.files.writeString(options.outfile, "throw 'Sorry, but I could not ge nerate reasonable code to run.\\n';"); 20565 world.files.writeString(options.outfile, "throw 'Sorry, but I could not ge nerate reasonable code to run.\\n';");
20467 } 20566 }
20468 } 20567 }
20469 return success; 20568 return $assert_bool(success);
20470 } 20569 }
20471 var options; 20570 var options;
20472 function parseOptions(homedir, args, files) { 20571 function parseOptions(homedir, args, files) {
20473 $assert(options == null, "options == null", "frog_options.dart", 10, 10); 20572 $assert(options == null, "options == null", "frog_options.dart", 10, 10);
20474 options = new FrogOptions(homedir, args, files); 20573 options = new FrogOptions(homedir, args, files);
20475 } 20574 }
20476 function _getCallStubName(name, args) { 20575 function _getCallStubName(name, args) {
20477 var nameBuilder = new StringBufferImpl(('' + name + '\$' + args.get$bareCount( ) + '')); 20576 var nameBuilder = new StringBufferImpl(('' + name + '\$' + args.get$bareCount( ) + ''));
20478 for (var i = args.get$bareCount(); 20577 for (var i = args.get$bareCount();
20479 $notnull_bool(i < args.get$length()); i++) { 20578 $notnull_bool(i < args.get$length()); i++) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
20626 INTERFACE, 20725 INTERFACE,
20627 LIBRARY, 20726 LIBRARY,
20628 NATIVE, 20727 NATIVE,
20629 NEGATE, 20728 NEGATE,
20630 OPERATOR, 20729 OPERATOR,
20631 SET, 20730 SET,
20632 SOURCE, 20731 SOURCE,
20633 STATIC, 20732 STATIC,
20634 TYPEDEF ]*/; 20733 TYPEDEF ]*/;
20635 RunEntry(function () {main();}, []); 20734 RunEntry(function () {main();}, []);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698